2013-12-07 02:06:12 +04:00
|
|
|
# multi-column balance reports
|
|
|
|
|
|
|
|
# 1. Here are the postings used in most tests below:
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal register
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>
|
|
|
|
2012/12/31 (assets:checking) 10 10
|
|
|
|
2013/01/01 (assets:checking) 1 11
|
|
|
|
2013/01/15 (assets:checking) -1 10
|
|
|
|
2013/02/01 (assets:cash) 1 11
|
|
|
|
2013/02/02 (assets) 1 12
|
|
|
|
2013/03/01 (assets:checking) 1 13
|
|
|
|
>>>=0
|
|
|
|
|
2014-03-26 06:27:18 +04:00
|
|
|
# 2. A period balance (flow) report. --no-total also works but isn't pretty.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --no-total
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Balance changes in 2013q1:
|
2013-12-07 02:06:12 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01 2013/02 2013/03
|
|
|
|
=================++===========================
|
|
|
|
assets || 0 1 0
|
|
|
|
assets:cash || 0 1 0
|
|
|
|
assets:checking || 0 0 1
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 3. With --empty, includes leading/trailing empty periods
|
2015-07-12 21:54:08 +03:00
|
|
|
#hledger -f balance-multicol.journal balance -p 'quarterly in 2013' --empty
|
|
|
|
hledger -f - balance -p 'quarterly in 2013' --empty
|
2013-12-07 02:06:12 +04:00
|
|
|
<<<
|
|
|
|
2012/12/31
|
|
|
|
(a) 10
|
|
|
|
2013/1/1
|
|
|
|
(a) 1
|
|
|
|
2013/3/1
|
|
|
|
(a) 1
|
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Balance changes in 2013:
|
2013-12-07 02:06:12 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013q1 2013q2 2013q3 2013q4
|
|
|
|
===++================================
|
|
|
|
a || 2 0 0 0
|
|
|
|
---++--------------------------------
|
|
|
|
|| 2 0 0 0
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 4. A cumulative ending balance report. Column totals are the sum of
|
|
|
|
# the highest-level displayed accounts (here, assets).
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Ending balances (cumulative) in 2013q1:
|
2013-12-07 02:06:12 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01/31 2013/02/28 2013/03/31
|
|
|
|
=================++====================================
|
|
|
|
assets || 0 1 1
|
|
|
|
assets:cash || 0 1 1
|
|
|
|
assets:checking || 0 0 1
|
|
|
|
-----------------++------------------------------------
|
|
|
|
|| 0 2 3
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 5. With the assets:cash account excluded. As with a single-column
|
|
|
|
# balance --flat report, or ledger's balance --flat, assets' balance
|
|
|
|
# includes the displayed subaccount and not the excluded one.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative not:cash
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Ending balances (cumulative) in 2013q1:
|
2013-12-07 02:06:12 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01/31 2013/02/28 2013/03/31
|
|
|
|
=================++====================================
|
|
|
|
assets || 0 1 1
|
|
|
|
assets:checking || 0 0 1
|
|
|
|
-----------------++------------------------------------
|
|
|
|
|| 0 1 2
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 6. A historical ending balance report.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --historical
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Ending balances (historical) in 2013q1:
|
2013-12-07 02:06:12 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01/31 2013/02/28 2013/03/31
|
|
|
|
=================++====================================
|
|
|
|
assets || 0 1 1
|
|
|
|
assets:cash || 0 1 1
|
|
|
|
assets:checking || 10 10 11
|
|
|
|
-----------------++------------------------------------
|
|
|
|
|| 10 12 13
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 7. With top-level accounts excluded. As always, column totals are the sum of
|
|
|
|
# the highest-level displayed accounts, now assets:cash and assets:checking.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Balance changes in 2013q1:
|
2013-12-07 02:06:12 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01 2013/02 2013/03
|
|
|
|
=================++===========================
|
|
|
|
assets:cash || 0 1 0
|
|
|
|
assets:checking || 0 0 1
|
|
|
|
-----------------++---------------------------
|
|
|
|
|| 0 1 1
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 8. cumulative:
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$ --cumulative
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Ending balances (cumulative) in 2013q1:
|
2013-12-07 02:06:12 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01/31 2013/02/28 2013/03/31
|
|
|
|
=================++====================================
|
|
|
|
assets:cash || 0 1 1
|
|
|
|
assets:checking || 0 0 1
|
|
|
|
-----------------++------------------------------------
|
|
|
|
|| 0 1 2
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 9. historical
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --historical
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Ending balances (historical) in 2013q1:
|
2013-12-07 02:06:12 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01/31 2013/02/28 2013/03/31
|
|
|
|
=================++====================================
|
|
|
|
assets || 0 1 1
|
|
|
|
assets:cash || 0 1 1
|
|
|
|
assets:checking || 10 10 11
|
|
|
|
-----------------++------------------------------------
|
|
|
|
|| 10 12 13
|
2014-03-26 06:27:18 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# --depth
|
|
|
|
|
|
|
|
# 10. A flow report with depth limiting. The depth limit aggregates the three accounts as "assets".
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1
|
2014-03-26 06:27:18 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Balance changes in 2013q1:
|
2014-03-26 06:27:18 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01 2013/02 2013/03
|
|
|
|
========++===========================
|
|
|
|
assets || 0 2 1
|
|
|
|
--------++---------------------------
|
|
|
|
|| 0 2 1
|
2014-03-26 06:27:18 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 11. As above, but postings in the top-level assets account have been excluded.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 assets:
|
2014-03-26 06:27:18 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Balance changes in 2013q1:
|
2014-03-26 06:27:18 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01 2013/02 2013/03
|
|
|
|
========++===========================
|
|
|
|
assets || 0 1 1
|
|
|
|
--------++---------------------------
|
|
|
|
|| 0 1 1
|
2014-03-26 06:27:18 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 12. A cumulative balance report with depth limiting.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --cumulative
|
2014-03-26 06:27:18 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Ending balances (cumulative) in 2013q1:
|
2014-03-26 06:27:18 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01/31 2013/02/28 2013/03/31
|
|
|
|
========++====================================
|
|
|
|
assets || 0 2 3
|
|
|
|
--------++------------------------------------
|
|
|
|
|| 0 2 3
|
2014-03-26 06:27:18 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 13. A historical balance report with depth limiting.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --historical
|
2014-03-26 06:27:18 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Ending balances (historical) in 2013q1:
|
2014-03-26 06:27:18 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01/31 2013/02/28 2013/03/31
|
|
|
|
========++====================================
|
|
|
|
assets || 10 12 13
|
|
|
|
--------++------------------------------------
|
|
|
|
|| 10 12 13
|
2013-12-07 02:06:12 +04:00
|
|
|
>>>=0
|
2014-04-13 22:07:39 +04:00
|
|
|
|
|
|
|
# 14. The three multicol balance report types again, this time with --tree
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --tree
|
2014-04-13 22:07:39 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Balance changes in 2013q1:
|
2014-04-13 22:07:39 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01 2013/02 2013/03
|
|
|
|
============++===========================
|
|
|
|
assets || 0 2 1
|
|
|
|
cash || 0 1 0
|
|
|
|
checking || 0 0 1
|
|
|
|
------------++---------------------------
|
|
|
|
|| 0 2 1
|
2014-04-13 22:07:39 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 15.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative --tree
|
2014-04-13 22:07:39 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Ending balances (cumulative) in 2013q1:
|
2014-04-13 22:07:39 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01/31 2013/02/28 2013/03/31
|
|
|
|
============++====================================
|
|
|
|
assets || 0 2 3
|
|
|
|
cash || 0 1 1
|
|
|
|
checking || 0 0 1
|
|
|
|
------------++------------------------------------
|
|
|
|
|| 0 2 3
|
2014-04-13 22:07:39 +04:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 16.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --historical --tree
|
2014-04-13 22:07:39 +04:00
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Ending balances (historical) in 2013q1:
|
2014-04-13 22:07:39 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2013/01/31 2013/02/28 2013/03/31
|
|
|
|
============++====================================
|
|
|
|
assets || 10 12 13
|
|
|
|
cash || 0 1 1
|
|
|
|
checking || 10 10 11
|
|
|
|
------------++------------------------------------
|
|
|
|
|| 10 12 13
|
2014-04-13 22:07:39 +04:00
|
|
|
>>>=0
|
|
|
|
|
2014-04-14 02:14:07 +04:00
|
|
|
# 17. --date2 should work
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f- balance --monthly --date2
|
2014-04-14 02:14:07 +04:00
|
|
|
<<<
|
|
|
|
2014/1/1
|
|
|
|
(a) 1
|
|
|
|
|
|
|
|
2014/2/1=2014/1/31
|
|
|
|
(b) 1
|
|
|
|
|
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Balance changes in 2014/01:
|
2014-04-14 02:14:07 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2014/01
|
|
|
|
===++=========
|
|
|
|
a || 1
|
|
|
|
b || 1
|
|
|
|
---++---------
|
|
|
|
|| 2
|
2014-04-14 02:14:07 +04:00
|
|
|
>>>=0
|
2014-04-19 19:40:16 +04:00
|
|
|
|
|
|
|
# 18. All matched postings in the displayed intervals should be reported on.
|
2015-07-12 21:54:08 +03:00
|
|
|
hledger -f- balance -p 'monthly 2014/1/10-2014/2/20'
|
2014-04-19 19:40:16 +04:00
|
|
|
<<<
|
|
|
|
2014/1/5
|
|
|
|
(before) 1
|
|
|
|
|
|
|
|
2014/2/1
|
|
|
|
(within) 1
|
|
|
|
|
|
|
|
2014/2/25
|
|
|
|
(after) 1
|
|
|
|
|
|
|
|
>>>
|
2014-07-27 04:29:20 +04:00
|
|
|
Balance changes in 2014/01/01-2014/02/28:
|
2014-04-19 19:40:16 +04:00
|
|
|
|
2017-07-27 18:52:49 +03:00
|
|
|
|| 2014/01 2014/02
|
|
|
|
========++==================
|
|
|
|
after || 0 1
|
|
|
|
before || 1 0
|
|
|
|
within || 0 1
|
|
|
|
--------++------------------
|
|
|
|
|| 1 2
|
2014-04-19 19:40:16 +04:00
|
|
|
>>>=0
|