;update manuals

This commit is contained in:
Simon Michael 2021-01-10 15:37:32 -08:00
parent de5dfe2d1b
commit 50a7914b3b
3 changed files with 1953 additions and 1573 deletions

View File

@ -604,11 +604,18 @@ messages.
.PP .PP
You can also force a specific reader/format by prefixing the file path You can also force a specific reader/format by prefixing the file path
with the format and a colon. with the format and a colon.
Eg to read a .dat file as csv: Eg, to read a .dat file as csv format:
.IP .IP
.nf .nf
\f[C] \f[C]
$ hledger -f csv:/some/csv-file.dat stats $ hledger -f csv:/some/csv-file.dat stats
\f[R]
.fi
.PP
Or to read stdin (\f[C]-\f[R]) as timeclock format:
.IP
.nf
\f[C]
$ echo \[aq]i 2009/13/1 08:00:00\[aq] | hledger print -ftimeclock:- $ echo \[aq]i 2009/13/1 08:00:00\[aq] | hledger print -ftimeclock:-
\f[R] \f[R]
.fi .fi
@ -1277,7 +1284,13 @@ A \f[I]any chain of market prices\f[R]: a chain of any market prices,
including both forward and reverse prices (1 and 2 above), leading from including both forward and reverse prices (1 and 2 above), leading from
A to B. A to B.
.PP .PP
Amounts for which no applicable market price can be found, are not There is a limit to the length of these price chains; if hledger reaches
that length without finding a complete chain or exhausting all
possibilities, it will give up (with a \[dq]gave up\[dq] message visible
in \f[C]--debug=2\f[R] output).
That limit is currently 1000.
.PP
Amounts for which no suitable market price can be found, are not
converted. converted.
.SS --infer-value: market prices from transactions .SS --infer-value: market prices from transactions
.PP .PP
@ -1421,7 +1434,6 @@ Convert amounts to cost, using the prices recorded in transactions.
\f[B]\f[CB]--value=then\f[B]\f[R] \f[B]\f[CB]--value=then\f[B]\f[R]
Convert amounts to their value in the default valuation commodity, using Convert amounts to their value in the default valuation commodity, using
market prices on each posting\[aq]s date. market prices on each posting\[aq]s date.
This is currently supported only by the print and register commands.
.TP .TP
\f[B]\f[CB]--value=end\f[B]\f[R] \f[B]\f[CB]--value=end\f[B]\f[R]
Convert amounts to their value in the default valuation commodity, using Convert amounts to their value in the default valuation commodity, using
@ -1604,7 +1616,7 @@ Related: #329, #1083.
.PP .PP
.TS .TS
tab(@); tab(@);
lw(10.6n) lw(13.2n) lw(13.4n) lw(11.0n) lw(13.4n) lw(8.2n). lw(9.5n) lw(11.8n) lw(12.0n) lw(17.2n) lw(12.0n) lw(7.4n).
T{ T{
Report type Report type
T}@T{ T}@T{
@ -1675,7 +1687,7 @@ cost
T}@T{ T}@T{
value at day before report or journal start value at day before report or journal start
T}@T{ T}@T{
not supported valued at day each historical posting was made
T}@T{ T}@T{
value at day before report or journal start value at day before report or journal start
T}@T{ T}@T{
@ -1742,7 +1754,7 @@ sums of costs
T}@T{ T}@T{
value at report end or today of sums of postings value at report end or today of sums of postings
T}@T{ T}@T{
not supported value at posting date
T}@T{ T}@T{
value at report or journal end of sums of postings value at report or journal end of sums of postings
T}@T{ T}@T{
@ -1755,7 +1767,7 @@ like balance changes
T}@T{ T}@T{
like balance changes like balance changes
T}@T{ T}@T{
not supported like balance changes
T}@T{ T}@T{
like balances like balances
T}@T{ T}@T{
@ -1768,7 +1780,7 @@ sum of displayed values
T}@T{ T}@T{
sum of displayed values sum of displayed values
T}@T{ T}@T{
not supported sum of displayed valued
T}@T{ T}@T{
sum of displayed values sum of displayed values
T}@T{ T}@T{
@ -1796,7 +1808,8 @@ sums of costs of postings before report start
T}@T{ T}@T{
value at report start of sums of all postings before report start value at report start of sums of all postings before report start
T}@T{ T}@T{
not supported sums of values of postings before report start at respective posting
dates
T}@T{ T}@T{
value at report start of sums of all postings before report start value at report start of sums of all postings before report start
T}@T{ T}@T{
@ -1809,7 +1822,7 @@ sums of costs of postings in period
T}@T{ T}@T{
same as --value=end same as --value=end
T}@T{ T}@T{
not supported sums of values of postings in period at respective posting dates
T}@T{ T}@T{
balance change in each period, valued at period ends balance change in each period, valued at period ends
T}@T{ T}@T{
@ -1822,7 +1835,8 @@ sums of costs of postings from before report start to period end
T}@T{ T}@T{
same as --value=end same as --value=end
T}@T{ T}@T{
not supported sums of values of postings from before period start to period end at
respective posting dates
T}@T{ T}@T{
period end balances, valued at period ends period end balances, valued at period ends
T}@T{ T}@T{
@ -1835,7 +1849,7 @@ like balance changes/end balances
T}@T{ T}@T{
like balance changes/end balances like balance changes/end balances
T}@T{ T}@T{
not supported like balance changes/end balances
T}@T{ T}@T{
like balances like balances
T}@T{ T}@T{
@ -1848,7 +1862,7 @@ sums, averages of displayed values
T}@T{ T}@T{
sums, averages of displayed values sums, averages of displayed values
T}@T{ T}@T{
not supported sums, averages of displayed values
T}@T{ T}@T{
sums, averages of displayed values sums, averages of displayed values
T}@T{ T}@T{
@ -1861,7 +1875,7 @@ sums of displayed values
T}@T{ T}@T{
sums of displayed values sums of displayed values
T}@T{ T}@T{
not supported sums of displayed values
T}@T{ T}@T{
sums of displayed values sums of displayed values
T}@T{ T}@T{
@ -1874,7 +1888,7 @@ sum, average of column totals
T}@T{ T}@T{
sum, average of column totals sum, average of column totals
T}@T{ T}@T{
not supported sum, average of column totals
T}@T{ T}@T{
sum, average of column totals sum, average of column totals
T}@T{ T}@T{
@ -2449,10 +2463,39 @@ options The output formats supported are (in most modes): \f[C]txt\f[R],
\f[C]csv\f[R], \f[C]html\f[R], and \f[C]json\f[R]. \f[C]csv\f[R], \f[C]html\f[R], and \f[C]json\f[R].
.PP .PP
The balance command can produce several styles of report: The balance command can produce several styles of report:
.SS Classic balance report
.PP .PP
This is the original balance report, as found in Ledger. .SS Single-period flat balance report
It usually looks like this: .PP
This is the default for hledger\[aq]s balance command: a flat list of
all (or with a query, matched) accounts, showing full account names.
Accounts are sorted by declaration order if any, and then by account
name.
Accounts which have zero balance are not shown unless
\f[C]-E/--empty\f[R] is used.
The reported balances\[aq] total is shown as the last line, unless
disabled by \f[C]-N\f[R]/\f[C]--no-total\f[R].
.IP
.nf
\f[C]
$ hledger bal
$1 assets:bank:saving
$-2 assets:cash
$1 expenses:food
$1 expenses:supplies
$-1 income:gifts
$-1 income:salary
$1 liabilities:debts
--------------------
0
\f[R]
.fi
.PP
.SS Single-period tree-mode balance report
.PP
With the \f[C]-t/--tree\f[R] flag, accounts are displayed
hierarchically, showing subaccounts as short names indented below their
parent.
(This is the default style in Ledger and in older hledger versions.)
.IP .IP
.nf .nf
\f[C] \f[C]
@ -2472,38 +2515,30 @@ $ hledger balance
\f[R] \f[R]
.fi .fi
.PP .PP
By default, accounts are displayed hierarchically, with subaccounts For more compact output, \[dq]boring\[dq] accounts containing a single
indented below their parent, with accounts at each level of the tree interesting subaccount and no balance of their own
sorted by declaration order if declared, then by account name. (\f[C]assets:bank\f[R] and \f[C]liabilities\f[R] here) are elided into
the following line, unless \f[C]--no-elide\f[R] is used.
And accounts which have zero balance and no non-zero subaccounts are
omitted, unless \f[C]-E/--empty\f[R] is used.
.PP .PP
\[dq]Boring\[dq] accounts, which contain a single interesting subaccount Account balances in tree mode are \[dq]inclusive\[dq] - they include the
and no balance of their own, are elided into the following line for more balances of any subaccounts.
compact output. Eg, the \f[C]assets\f[R] \f[C]$-1\f[R] balance here includes the
(Eg above, the \[dq]liabilities\[dq] account.) Use \f[C]--no-elide\f[R] \f[C]$1\f[R] from \f[C]assets:bank:saving\f[R] and the \f[C]$-2\f[R]
to prevent this. from \f[C]assets:cash\f[R].
(And it would include balance posted to the \f[C]assets\f[R] account
itself, if there was any).
Note this causes some repetition, and the final total (\f[C]0\f[R]) is
the sum of the top-level balances, not of all the balances shown.
.PP .PP
Account balances are \[dq]inclusive\[dq] - they include the balances of Each group of sibling accounts is sorted separately, by declaration
any subaccounts. order and then by account name.
.SS Customising single-period balance reports
.PP .PP
Accounts which have zero balance (and no non-zero subaccounts) are You can customise the layout of single-period balance reports with
omitted. \f[C]--format FMT\f[R], which sets the format of each line.
Use \f[C]-E/--empty\f[R] to show them. Eg:
.PP
A final total is displayed by default; use \f[C]-N/--no-total\f[R] to
suppress it, eg:
.IP
.nf
\f[C]
$ hledger balance -p 2008/6 expenses --no-total
$2 expenses
$1 food
$1 supplies
\f[R]
.fi
.SS Customising the classic balance report
.PP
You can customise the layout of classic balance reports with
\f[C]--format FMT\f[R]:
.IP .IP
.nf .nf
\f[C] \f[C]
@ -2572,32 +2607,13 @@ rendered on one line
.IP \[bu] 2 .IP \[bu] 2
\f[C]%20(total) %2(depth_spacer)%-(account)\f[R] - the default format \f[C]%20(total) %2(depth_spacer)%-(account)\f[R] - the default format
for the single-column balance report for the single-column balance report
.SS Colour support .SS Depth limiting
.PP .PP
In terminal output, when colour is enabled, the balance command shows With a \f[C]depth:N\f[R] query, or \f[C]--depth N\f[R] option, or just
negative amounts in red. \f[C]-N\f[R], balance reports will show accounts only to the specified
.SS Flat mode depth.
.PP This is very useful to hide low-level accounts and get an overview.
To see a flat list instead of the default hierarchical display, use Eg, limiting to depth 1 shows the top-level accounts:
\f[C]--flat\f[R].
In this mode, accounts (unless depth-clipped) show their full names and
\[dq]exclusive\[dq] balance, excluding any subaccount balances.
In this mode, you can also use \f[C]--drop N\f[R] to omit the first few
account name components.
.IP
.nf
\f[C]
$ hledger balance -p 2008/6 expenses -N --flat --drop 1
$1 food
$1 supplies
\f[R]
.fi
.SS Depth limited balance reports
.PP
With \f[C]--depth N\f[R] or \f[C]depth:N\f[R] or just \f[C]-N\f[R],
balance reports show accounts only to the specified numeric depth.
This is very useful to summarise a complex set of accounts and get an
overview.
.IP .IP
.nf .nf
\f[C] \f[C]
@ -2609,8 +2625,30 @@ $ hledger balance -N -1
\f[R] \f[R]
.fi .fi
.PP .PP
Flat-mode balance reports, which normally show exclusive balances, show Accounts at the depth limit will include the balances of any hidden
inclusive balances at the depth limit. subaccounts (even in flat mode, which normally shows exclusive
balances).
.PP
You can also drop account name components from the start of account
names, using \f[C]--drop N\f[R].
This can be useful to hide unwanted top-level detail.
.SS Colour support
.PP
In terminal output, when colour is enabled, the balance command shows
negative amounts in red.
.SS Sorting by amount
.PP
With \f[C]-S\f[R]/\f[C]--sort-amount\f[R], accounts with the largest
(most positive) balances are shown first.
For example, \f[C]hledger bal expenses -MAS\f[R] shows your biggest
averaged monthly expenses first.
.PP
Revenues and liability balances are typically negative, however, so
\f[C]-S\f[R] shows these in reverse order.
To work around this, you can add \f[C]--invert\f[R] to flip the signs.
Or, use one of the sign-flipping reports like \f[C]balancesheet\f[R] or
\f[C]incomestatement\f[R], which also support \f[C]-S\f[R].
Eg: \f[C]hledger is -MAS\f[R].
.SS Percentages .SS Percentages
.PP .PP
With \f[C]-%\f[R] or \f[C]--percent\f[R], balance reports show each With \f[C]-%\f[R] or \f[C]--percent\f[R], balance reports show each
@ -2646,34 +2684,25 @@ accounts.
If there are mixed commodity accounts in the report be sure to use If there are mixed commodity accounts in the report be sure to use
\f[C]-V\f[R] or \f[C]-B\f[R] to coerce the report into using a single \f[C]-V\f[R] or \f[C]-B\f[R] to coerce the report into using a single
commodity. commodity.
.SS Sorting by amount
.PP .PP
With \f[C]-S\f[R]/\f[C]--sort-amount\f[R], accounts with the largest .SS Multi-period balance report
(most positive) balances are shown first.
For example, \f[C]hledger bal expenses -MAS\f[R] shows your biggest
averaged monthly expenses first.
.PP .PP
Revenues and liability balances are typically negative, however, so Multi-period balance reports are a very useful hledger feature,
\f[C]-S\f[R] shows these in reverse order. activated if you provide one of the reporting interval flags, such as
To work around this, you can add \f[C]--invert\f[R] to flip the signs. \f[C]-M\f[R]/\f[C]--monthly\f[R].
Or, use one of the sign-flipping reports like \f[C]balancesheet\f[R] or They are similar to single-period balance reports, but they show the
\f[C]incomestatement\f[R], which also support \f[C]-S\f[R]. report as a table, with columns representing one or more successive time
Eg: \f[C]hledger is -MAS\f[R]. periods.
.SS Multicolumn balance report This is the usually the preferred style of balance report in hledger
(even for a single period).
.PP .PP
Multicolumn or tabular balance reports are a very useful hledger Multi-period balance reports come in several types, showing different
feature, and usually the preferred style.
They share many of the above features, but they show the report as a
table, with columns representing time periods.
This mode is activated by providing a reporting interval.
.PP
There are three types of multicolumn balance report, showing different
information: information:
.IP "1." 3 .IP "1." 3
By default: each column shows the sum of postings in that period, ie the A balance change report: by default, each column shows the sum of
account\[aq]s change of balance in that period. postings in that period, ie the account\[aq]s change of balance in that
period.
This is useful eg for a monthly income statement: This is useful eg for a monthly income statement:
.RS 4
.IP .IP
.nf .nf
\f[C] \f[C]
@ -2690,11 +2719,10 @@ Balance changes in 2008:
|| $-1 $1 0 0 || $-1 $1 0 0
\f[R] \f[R]
.fi .fi
.RE
.IP "2." 3 .IP "2." 3
With \f[C]--cumulative\f[R]: each column shows the ending balance for A cumulative end balance report: with \f[C]--cumulative\f[R], each
that period, accumulating the changes across periods, starting from 0 at column shows the end balance for that period, accumulating the changes
the report start date: across periods, starting from 0 at the report start date:
.RS 4 .RS 4
.IP .IP
.nf .nf
@ -2714,11 +2742,12 @@ Ending balances (cumulative) in 2008:
.fi .fi
.RE .RE
.IP "3." 3 .IP "3." 3
With \f[C]--historical/-H\f[R]: each column shows the actual historical A historical end balance report: with \f[C]--historical/-H\f[R], each
ending balance for that period, accumulating the changes across periods, column shows the actual historical end balance for that period,
starting from the actual balance at the report start date. accumulating the changes across periods, and including the balance from
This is useful eg for a multi-period balance sheet, and when you are any postings before the report start date.
showing only the data after a certain start date: This is useful eg for a multi-period balance sheet, and when you want to
see balances only after a certain date:
.RS 4 .RS 4
.IP .IP
.nf .nf
@ -2742,9 +2771,6 @@ Note that \f[C]--cumulative\f[R] or \f[C]--historical/-H\f[R] disable
\f[C]--row-total/-T\f[R], since summing end balances generally does not \f[C]--row-total/-T\f[R], since summing end balances generally does not
make sense. make sense.
.PP .PP
Multicolumn balance reports display accounts in flat mode by default; to
see the hierarchy, use \f[C]--tree\f[R].
.PP
With a reporting interval (like \f[C]--quarterly\f[R] above), the report With a reporting interval (like \f[C]--quarterly\f[R] above), the report
start/end dates will be adjusted if necessary so that they encompass the start/end dates will be adjusted if necessary so that they encompass the
displayed report periods. displayed report periods.
@ -3263,27 +3289,29 @@ check
.P .P
.PD .PD
Check for various kinds of errors in your data. Check for various kinds of errors in your data.
\f[I]experimental\f[R]
.PP .PP
hledger provides a number of built-in error checks to help prevent hledger provides a number of built-in error checks to help prevent
problems in your data. problems in your data.
Some of these are run automatically; or, you can use this Some of these are run automatically; or, you can use this
\f[C]check\f[R] command to run them on demand, with no output and a zero \f[C]check\f[R] command to run them on demand, with no output and a zero
exit code if all is well. exit code if all is well.
Specify their names (or a prefix) as argument(s).
.PP
Some examples: Some examples:
.IP .IP
.nf .nf
\f[C] \f[C]
hledger check # basic checks hledger check # basic checks
hledger check -s # basic + strict checks hledger check -s # basic + strict checks
hledger check ordereddates uniqueleafnames # basic + specified checks hledger check ordereddates payees # basic + two other checks
\f[R] \f[R]
.fi .fi
.PP .PP
Here are the checks currently available: Here are the checks currently available:
.SS Basic checks .SS Basic checks
.PP .PP
These are always run by this command and other commands: These checks are always run automatically, by (almost) all hledger
commands, including \f[C]check\f[R]:
.IP \[bu] 2 .IP \[bu] 2
\f[B]parseable\f[R] - data files are well-formed and can be successfully \f[B]parseable\f[R] - data files are well-formed and can be successfully
parsed parsed
@ -3298,8 +3326,10 @@ passing.
\f[C]-I\f[R]/\f[C]--ignore-assertions\f[R].) \f[C]-I\f[R]/\f[C]--ignore-assertions\f[R].)
.SS Strict checks .SS Strict checks
.PP .PP
These are always run by this and other commands when These additional checks are run when the \f[C]-s\f[R]/\f[C]--strict\f[R]
\f[C]-s\f[R]/\f[C]--strict\f[R] is used (strict mode): (strict mode) flag is used.
Or, they can be run by giving their names as arguments to
\f[C]check\f[R]:
.IP \[bu] 2 .IP \[bu] 2
\f[B]accounts\f[R] - all account names used by transactions have been \f[B]accounts\f[R] - all account names used by transactions have been
declared declared
@ -3307,18 +3337,21 @@ declared
\f[B]commodities\f[R] - all commodity symbols used have been declared \f[B]commodities\f[R] - all commodity symbols used have been declared
.SS Other checks .SS Other checks
.PP .PP
These checks can be run by specifying their names as arguments to the These checks can be run only by giving their names as arguments to
check command: \f[C]check\f[R].
They are more specialised and not desirable for everyone, therefore
optional:
.IP \[bu] 2 .IP \[bu] 2
\f[B]ordereddates\f[R] - transactions are ordered by date (similar to \f[B]ordereddates\f[R] - transactions are ordered by date (similar to
the old \f[C]check-dates\f[R] command) the old \f[C]check-dates\f[R] command)
.IP \[bu] 2 .IP \[bu] 2
\f[B]payees\f[R] - all payees used by transactions have been declared
.IP \[bu] 2
\f[B]uniqueleafnames\f[R] - all account leaf names are unique (similar \f[B]uniqueleafnames\f[R] - all account leaf names are unique (similar
to the old \f[C]check-dupes\f[R] command) to the old \f[C]check-dupes\f[R] command).
.SS Add-on checks .SS Custom checks
.PP .PP
Some checks are not yet integrated with this command, but are available A few more checks are are available as separate add-on commands, in
as add-on commands in
https://github.com/simonmichael/hledger/tree/master/bin: https://github.com/simonmichael/hledger/tree/master/bin:
.IP \[bu] 2 .IP \[bu] 2
\f[B]hledger-check-tagfiles\f[R] - all tag values containing / (a \f[B]hledger-check-tagfiles\f[R] - all tag values containing / (a
@ -3327,8 +3360,8 @@ forward slash) exist as file paths
\f[B]hledger-check-fancyassertions\f[R] - more complex balance \f[B]hledger-check-fancyassertions\f[R] - more complex balance
assertions are passing assertions are passing
.PP .PP
You could make your own similar scripts to perform custom checks; You could make similar scripts to perform your own custom checks.
Cookbook -> Scripting may be helpful. See: Cookbook -> Scripting.
.SS close .SS close
.PP .PP
close, equity close, equity
@ -5198,7 +5231,7 @@ Account names typically have several parts separated by a full colon,
from which hledger derives a hierarchical chart of accounts. from which hledger derives a hierarchical chart of accounts.
They can be anything you like, but in finance there are traditionally They can be anything you like, but in finance there are traditionally
five top-level accounts: \f[C]assets\f[R], \f[C]liabilities\f[R], five top-level accounts: \f[C]assets\f[R], \f[C]liabilities\f[R],
\f[C]income\f[R], \f[C]expenses\f[R], and \f[C]equity\f[R]. \f[C]revenue\f[R], \f[C]expenses\f[R], and \f[C]equity\f[R].
.PP .PP
Account names may contain single spaces, eg: Account names may contain single spaces, eg:
\f[C]assets:accounts receivable\f[R]. \f[C]assets:accounts receivable\f[R].
@ -5808,6 +5841,15 @@ T}@T{
what the included directives affect what the included directives affect
T} T}
T{ T{
[\f[C]payee\f[R]]
T}@T{
T}@T{
T}@T{
declare a payee name
T}@T{
following entries until end of current file
T}
T{
\f[C]P\f[R] \f[C]P\f[R]
T}@T{ T}@T{
T}@T{ T}@T{
@ -5952,6 +5994,19 @@ Y2010 ; change default year to 2010
assets assets
\f[R] \f[R]
.fi .fi
.SS Declaring payees
.PP
The \f[C]payee\f[R] directive can be used to declare a limited set of
payees which may appear in transaction descriptions.
The \[dq]payees\[dq] check will report an error if any transaction
refers to a payee that has not been declared.
Eg:
.IP
.nf
\f[C]
payee Whole Foods
\f[R]
.fi
.SS Declaring commodities .SS Declaring commodities
.PP .PP
The \f[C]commodity\f[R] directive has several functions: The \f[C]commodity\f[R] directive has several functions:
@ -7961,32 +8016,148 @@ https://hledger.org -> sidebar -> real world setups
https://plaintextaccounting.org -> data import/conversion https://plaintextaccounting.org -> data import/conversion
.SS Setting amounts .SS Setting amounts
.PP .PP
A posting amount can be set in one of these ways: Some tips on using the amount-setting rules discussed above.
.IP \[bu] 2
by assigning (with a fields list or field assignment) to
\f[C]amountN\f[R] (posting N\[aq]s amount) or \f[C]amount\f[R] (posting
1\[aq]s amount)
.IP \[bu] 2
by assigning to \f[C]amountN-in\f[R] and \f[C]amountN-out\f[R] (or
\f[C]amount-in\f[R] and \f[C]amount-out\f[R]).
For each CSV record, whichever of these has a non-zero value will be
used, with appropriate sign.
If both contain a non-zero value, this may not work.
.IP \[bu] 2
by assigning to \f[C]balanceN\f[R] (or \f[C]balance\f[R]) instead of the
above, setting the amount indirectly via a balance assignment.
If you do this the default account name may be wrong, so you should set
that explicitly.
.PP .PP
There is some special handling for an amount\[aq]s sign: Here are the ways to set a posting\[aq]s amount:
.IP "1." 3
\f[B]If the CSV has a single amount field:\f[R]
.PD 0
.P
.PD
Assign (via a fields list or a field assignment) to \f[C]amountN\f[R].
This sets the Nth posting\[aq]s amount.
N is usually 1 or 2 but can go up to 99.
.IP "2." 3
\f[B]If the CSV has separate Debit and Credit amount fields:\f[R]
.PD 0
.P
.PD
Assign to \f[C]amountN-in\f[R] and \f[C]amountN-out\f[R].
This sets posting N\[aq]s amount to whichever of these has a non-zero
value, guessing an appropriate sign.
.RS 4
.IP \[bu] 2 .IP \[bu] 2
If an amount value is parenthesised, it will be de-parenthesised and \f[B]If hledger guesses the wrong sign:\f[R]
sign-flipped. .PD 0
.P
.PD
Prepend a minus sign to flip it.
Eg:
.RS 2
.IP
.nf
\f[C]
fields date, description, amount-in, amount-out
amount-out -%amount-out
\f[R]
.fi
.RE
.IP \[bu] 2 .IP \[bu] 2
If an amount value begins with a double minus sign, those cancel out and \f[B]If both fields contain a non-zero value:\f[R]
are removed. .PD 0
.P
.PD
The \f[C]amountN-in\f[R]/\f[C]amountN-out\f[R] rules require that each
CSV record has a non-zero value in exactly one of the two fields, so
that hledger knows which to choose.
So these would all be rejected:
.RS 2
.IP
.nf
\f[C]
\[dq]\[dq], \[dq]\[dq]
\[dq]0\[dq], \[dq]0\[dq]
\[dq]1\[dq], \[dq]none\[dq]
\f[R]
.fi
.PP
If your CSV has amount values like this, use conditional rules instead.
For example, to make hledger to choose the value containing non-zero
digits:
.IP
.nf
\f[C]
fields date, description, in, out
if %in [1-9]
amount1 %in
if %out [1-9]
amount1 %out
\f[R]
.fi
.RE
.RE
.IP "3." 3
\f[B]Using the old numberless syntax:\f[R]
.PD 0
.P
.PD
Assign to \f[C]amount\f[R] (or to \f[C]amount-in\f[R] and
\f[C]amount-out\f[R]).
This sets posting 1\[aq]s and posting 2\[aq]s amounts (and converts
posting 2\[aq]s amount to cost).
This is supported for backwards compatibility (and occasional
convenience).
.IP "4." 3
\f[B]If the CSV has the balance instead of the transaction amount:\f[R]
.PD 0
.P
.PD
Assign to \f[C]balanceN\f[R], which sets posting N\[aq]s amount
indirectly via a balance assignment.
(Old syntax: \f[C]balance\f[R], equivalent to \f[C]balance1\f[R].)
.RS 4
.IP \[bu] 2 .IP \[bu] 2
If an amount value begins with a plus sign, that will be removed \f[B]If hledger guesses the wrong default account name:\f[R]
.PD 0
.P
.PD
When setting the amount via balance assertion, hledger may guess the
wrong default account name.
So, set the account name explicitly, eg:
.RS 2
.IP
.nf
\f[C]
fields date, description, balance1
account1 assets:checking
\f[R]
.fi
.RE
.RE
.SS Amount signs
.PP
There is some special handling for amount signs, to simplify parsing and
sign-flipping:
.IP \[bu] 2
\f[B]If an amount value begins with a plus sign:\f[R]
.PD 0
.P
.PD
that will be removed: \f[C]+AMT\f[R] becomes \f[C]AMT\f[R]
.IP \[bu] 2
\f[B]If an amount value is parenthesised:\f[R]
.PD 0
.P
.PD
it will be de-parenthesised and sign-flipped: \f[C](AMT)\f[R] becomes
\f[C]-AMT\f[R]
.IP \[bu] 2
\f[B]If an amount value has two minus signs (or two sets of parentheses,
or a minus sign and parentheses):\f[R]
.PD 0
.P
.PD
they cancel out and will be removed: \f[C]--AMT\f[R] or \f[C]-(AMT)\f[R]
becomes \f[C]AMT\f[R]
.IP \[bu] 2
\f[B]If an amount value contains just a sign (or just a set of
parentheses):\f[R]
.PD 0
.P
.PD
that is removed, making it an empty value.
\f[C]\[dq]+\[dq]\f[R] or \f[C]\[dq]-\[dq]\f[R] or \f[C]\[dq]()\[dq]\f[R]
becomes \f[C]\[dq]\[dq]\f[R].
.SS Setting currency/commodity .SS Setting currency/commodity
.PP .PP
If the currency/commodity symbol is included in the CSV\[aq]s amount If the currency/commodity symbol is included in the CSV\[aq]s amount

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff