close: use the same default equity account for both (#1165)
And some doc cleanups. "equity:opening/closing balances" is now the default account for both.
This commit is contained in:
parent
9710c86c7f
commit
4bb840a0f3
@ -18,18 +18,20 @@ import System.Console.CmdArgs.Explicit as C
|
|||||||
import Hledger
|
import Hledger
|
||||||
import Hledger.Cli.CliOptions
|
import Hledger.Cli.CliOptions
|
||||||
|
|
||||||
defclosingacct = "equity:closing balances"
|
defclosingdesc = "closing balances"
|
||||||
defopeningacct = "equity:opening balances"
|
defopeningdesc = "opening balances"
|
||||||
|
defclosingacct = "equity:opening/closing balances"
|
||||||
|
defopeningacct = defclosingacct
|
||||||
|
|
||||||
closemode = hledgerCommandMode
|
closemode = hledgerCommandMode
|
||||||
$(embedFileRelative "Hledger/Cli/Commands/Close.txt")
|
$(embedFileRelative "Hledger/Cli/Commands/Close.txt")
|
||||||
[flagNone ["closing"] (setboolopt "closing") "show just closing transaction"
|
[flagNone ["closing"] (setboolopt "closing") "show just closing transaction"
|
||||||
,flagNone ["opening"] (setboolopt "opening") "show just opening transaction"
|
,flagNone ["opening"] (setboolopt "opening") "show just opening transaction"
|
||||||
,flagReq ["close-to"] (\s opts -> Right $ setopt "close-to" s opts) "ACCT" ("account to transfer closing balances to (default: "++defclosingacct++")")
|
,flagReq ["close-to"] (\s opts -> Right $ setopt "close-to" s opts) "ACCT" ("account to transfer closing balances to (default: "++defclosingacct++")")
|
||||||
,flagReq ["open-from"] (\s opts -> Right $ setopt "open-from" s opts) "ACCT" ("account to transfer opening balances from (default: "++defopeningacct++")")
|
,flagReq ["open-from"] (\s opts -> Right $ setopt "open-from" s opts) "ACCT" ("account to transfer opening balances from (default: "++defopeningacct++")")
|
||||||
,flagNone ["explicit","x"] (setboolopt "explicit") "show all amounts explicitly"
|
,flagNone ["explicit","x"] (setboolopt "explicit") "show all amounts explicitly"
|
||||||
,flagNone ["interleaved"] (setboolopt "interleaved") "keep equity and non-equity postings adjacent"
|
,flagNone ["interleaved"] (setboolopt "interleaved") "keep equity and non-equity postings adjacent"
|
||||||
,flagNone ["show-costs"] (setboolopt "show-costs") "keep balances with different costs separate"
|
,flagNone ["show-costs"] (setboolopt "show-costs") "keep balances with different costs separate"
|
||||||
]
|
]
|
||||||
[generalflagsgroup1]
|
[generalflagsgroup1]
|
||||||
hiddenflags
|
hiddenflags
|
||||||
@ -82,7 +84,7 @@ close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do
|
|||||||
interleaved = boolopt "interleaved" rawopts
|
interleaved = boolopt "interleaved" rawopts
|
||||||
|
|
||||||
-- the closing transaction
|
-- the closing transaction
|
||||||
closingtxn = nulltransaction{tdate=closingdate, tdescription="closing balances", tpostings=closingps}
|
closingtxn = nulltransaction{tdate=closingdate, tdescription=defclosingdesc, tpostings=closingps}
|
||||||
closingps =
|
closingps =
|
||||||
concat [
|
concat [
|
||||||
[posting{paccount = a
|
[posting{paccount = a
|
||||||
@ -112,7 +114,7 @@ close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do
|
|||||||
++ [posting{paccount=closingacct, pamount=if explicit then mapMixedAmount precise totalamt else missingmixedamt} | not interleaved]
|
++ [posting{paccount=closingacct, pamount=if explicit then mapMixedAmount precise totalamt else missingmixedamt} | not interleaved]
|
||||||
|
|
||||||
-- the opening transaction
|
-- the opening transaction
|
||||||
openingtxn = nulltransaction{tdate=openingdate, tdescription="opening balances", tpostings=openingps}
|
openingtxn = nulltransaction{tdate=openingdate, tdescription=defopeningdesc, tpostings=openingps}
|
||||||
openingps =
|
openingps =
|
||||||
concat [
|
concat [
|
||||||
[posting{paccount = a
|
[posting{paccount = a
|
||||||
|
|||||||
@ -1,31 +1,29 @@
|
|||||||
close, equity\
|
close, equity\
|
||||||
Prints a "closing balances" transaction and an "opening balances" transaction
|
Prints a "closing balances" transaction and an "opening balances" transaction
|
||||||
that bring account balances to and from zero, respectively.
|
that bring account balances to and from zero, respectively.
|
||||||
Useful for bringing asset/liability balances forward into a new journal file,
|
These can be added to your journal file(s), eg to bring
|
||||||
or for closing out revenues/expenses to retained earnings at the end of a
|
asset/liability balances forward into a new journal file, or to
|
||||||
period.
|
close out revenues/expenses to retained earnings at the end of a period.
|
||||||
|
|
||||||
_FLAGS
|
_FLAGS
|
||||||
|
|
||||||
You can choose to print just one of the transactions by using the
|
You can choose to print just one of these transactions by using the
|
||||||
`--opening` or `--closing` flag.
|
`--opening` or `--closing` flag.
|
||||||
|
|
||||||
The closing transaction transfers balances to `equity:closing balances`,
|
One posting to `equity:opening/closing balances`,
|
||||||
and the opening transaction transfers balances from `equity:opening balances`,
|
with an implicit amount, is added to balance these transactions,
|
||||||
by default. You can choose different account names with the
|
by default.
|
||||||
`--close-to` and `--open-from` options. If you specify only one of
|
You can choose different closing/opening account names with the
|
||||||
these, it is used for both.
|
`--close-to` and `--open-from` options.
|
||||||
|
If you specify only one, it is used for both.
|
||||||
|
|
||||||
By default, a single balancing equity posting is added at the end of
|
With `--x/--explicit`, the equity posting's amount will be shown.
|
||||||
these journal entries, with the amount left implicit.
|
If it involves multiple commodities, a posting for each commodity
|
||||||
|
will be shown (like the print command).
|
||||||
|
|
||||||
With `--x/--explicit`, the balancing amount is shown, and if
|
With `--interleaved`, the equity postings are shown next to the
|
||||||
multiple commodities are involved, multiple single-commodity equity
|
postings they balance, which makes troubleshooting easier.
|
||||||
postings are shown (like the print command).
|
(It can also generate more postings.)
|
||||||
|
|
||||||
With `--interleaved`, the equity postings are shown next to each
|
|
||||||
posting they balance, which can be better for troubleshooting (and can
|
|
||||||
generate more postings).
|
|
||||||
|
|
||||||
By default, transaction prices in the journal are ignored when
|
By default, transaction prices in the journal are ignored when
|
||||||
generating the closing/opening transactions.
|
generating the closing/opening transactions.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user