mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-18 17:57:11 +03:00
;examples:multi-year: how to show year-end balances in closed files [#2151]
This commit is contained in:
parent
785206ee94
commit
e61c9bad10
14
examples/multi-year/2021.journal
Normal file
14
examples/multi-year/2021.journal
Normal file
@ -0,0 +1,14 @@
|
||||
; 2021.journal
|
||||
|
||||
2021-06-01 opening balances ; start:2021
|
||||
assets 20 = 20
|
||||
equity:start
|
||||
|
||||
2021-07-01 income
|
||||
income
|
||||
assets 1
|
||||
|
||||
2021-12-31 closing balances ; start:2022
|
||||
assets -21 = 0
|
||||
equity:start
|
||||
|
14
examples/multi-year/2022.journal
Normal file
14
examples/multi-year/2022.journal
Normal file
@ -0,0 +1,14 @@
|
||||
; 2022.journal
|
||||
|
||||
2022-01-01 opening balances ; start:2022
|
||||
assets 21 = 21
|
||||
equity:start
|
||||
|
||||
2022-07-01 income
|
||||
income
|
||||
assets 1
|
||||
|
||||
2022-12-31 closing balances ; start:2023
|
||||
assets -22 = 0
|
||||
equity:start
|
||||
|
10
examples/multi-year/2023.journal
Normal file
10
examples/multi-year/2023.journal
Normal file
@ -0,0 +1,10 @@
|
||||
; 2023.journal
|
||||
|
||||
2023-01-01 opening balances ; start:2023
|
||||
assets 22 = 22
|
||||
equity:start
|
||||
|
||||
2023-07-01 income
|
||||
income
|
||||
assets 1
|
||||
|
4
examples/multi-year/README.md
Normal file
4
examples/multi-year/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
Multiple yearly journal files, demonstrating the tags and commands
|
||||
suggested in the [close command's doc](https://hledger.org/dev/hledger.html#example-exclude-openingclosing-transactions>)
|
||||
for flexible multi-year reporting.
|
||||
See `reports`.
|
14
examples/multi-year/reports
Executable file
14
examples/multi-year/reports
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Suppressing redundant starting/ending balances transactions as suggested in
|
||||
# https://hledger.org/dev/hledger.html#example-exclude-openingclosing-transactions .
|
||||
# All of these will show the year-end balances correctly.
|
||||
# In each case, we exclude all transactions tagged with start: except the earliest.
|
||||
|
||||
hledger bs -Y -f 2021.journal -f 2022.journal -f 2023.journal expr:'tag:start=2021 or not tag:start'
|
||||
hledger bs -Y -f 2021.journal -f 2022.journal expr:'tag:start=2021 or not tag:start'
|
||||
hledger bs -Y -f 2022.journal -f 2023.journal expr:'tag:start=2022 or not tag:start'
|
||||
hledger bs -Y -f 2021.journal expr:'tag:start=2021 or not tag:start'
|
||||
hledger bs -Y -f 2022.journal expr:'tag:start=2022 or not tag:start'
|
||||
hledger bs -Y -f 2023.journal # unclosed file, no query needed
|
||||
|
@ -188,7 +188,7 @@ $ hledger -f 2022.journal bs not:desc:'closing balances'
|
||||
When combining files for multi-year reports, for some reports (eg a yearly balance sheet)
|
||||
you may need to suppress all opening/closing transactions except the first.
|
||||
This is a bit awkward if you also want to be able to choose any range of year files,
|
||||
but here is a way, using tags:
|
||||
but here is a way, using tags (full example [here](https://github.com/simonmichael/hledger/tree/master/examples/multi-year/)):
|
||||
|
||||
```journal
|
||||
; 2021.journal
|
||||
|
Loading…
Reference in New Issue
Block a user