hledger/tests/balance-multicol.test
Simon Michael c53732a4af balance: new multi-column reports & documentation
Two new multi-column balance report modes show ending balance per
period: `--cumulative`, starting from 0, and `--historical`, starting
from the historical starting balance.

The balance command's specification has been clarified and consolidated
in the Balance.hs haddock. Reports.hs has also had haddock updates. The
old AccountsReport type is now BalanceReport, still used by
single-column balance report. The new MultiBalanceReport type is used by
the multi-column reports.
2013-12-07 05:43:31 -08:00

139 lines
5.8 KiB
Plaintext

# multi-column balance reports
# 1. Here are the postings used in most tests below:
hledgerdev -f data/balance-multicol.journal register
>>>
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
# 2. A period balance (flow) report.
hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --no-total
>>>
Change of balance (flow):
|| 2013/01/01-2013/01/31 2013/02/01-2013/02/28 2013/03/01-2013/03/31
=================++======================================================================
assets || 0 2 1
assets:cash || 0 1 0
assets:checking || 0 0 1
-----------------++----------------------------------------------------------------------
||
>>>=0
# 3. With --empty, includes leading/trailing empty periods
#hledgerdev -f data/balance-multicol.journal balance -p 'quarterly in 2013' --empty
hledgerdev -f - balance -p 'quarterly in 2013' --empty
<<<
2012/12/31
(a) 10
2013/1/1
(a) 1
2013/3/1
(a) 1
>>>
Change of balance (flow):
|| 2013/01/01-2013/03/31 2013/04/01-2013/06/30 2013/07/01-2013/09/30 2013/10/01-2013/12/31
===++=============================================================================================
a || 2 0 0 0
---++---------------------------------------------------------------------------------------------
|| 2 0 0 0
>>>=0
# 4. A cumulative ending balance report. Column totals are the sum of
# the highest-level displayed accounts (here, assets).
hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --cumulative
>>>
Ending balance (cumulative):
|| 2013/01/31 2013/02/28 2013/03/31
=================++=====================================
assets || 0 2 3
assets:cash || 0 1 1
assets:checking || 0 0 1
-----------------++-------------------------------------
|| 0 2 3
>>>=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.
hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --cumulative not:cash
>>>
Ending balance (cumulative):
|| 2013/01/31 2013/02/28 2013/03/31
=================++=====================================
assets || 0 1 2
assets:checking || 0 0 1
-----------------++-------------------------------------
|| 0 1 2
>>>=0
# 6. A historical ending balance report.
hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' --historical
>>>
Ending balance (historical):
|| 2013/01/31 2013/02/28 2013/03/31
=================++=====================================
assets || 10 12 13
assets:cash || 0 1 1
assets:checking || 10 10 11
-----------------++-------------------------------------
|| 10 12 13
>>>=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.
hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' not:assets$
>>>
Change of balance (flow):
|| 2013/01/01-2013/01/31 2013/02/01-2013/02/28 2013/03/01-2013/03/31
=================++======================================================================
assets:cash || 0 1 0
assets:checking || 0 0 1
-----------------++----------------------------------------------------------------------
|| 0 1 1
>>>=0
# 8. cumulative:
hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' not:assets$ --cumulative
>>>
Ending balance (cumulative):
|| 2013/01/31 2013/02/28 2013/03/31
=================++=====================================
assets:cash || 0 1 1
assets:checking || 0 0 1
-----------------++-------------------------------------
|| 0 1 2
>>>=0
# 9. historical
hledgerdev -f data/balance-multicol.journal balance -p 'monthly in 2013' not:assets$ --historical
>>>
Ending balance (historical):
|| 2013/01/31 2013/02/28 2013/03/31
=================++=====================================
assets:cash || 0 1 1
assets:checking || 10 10 11
-----------------++-------------------------------------
|| 10 11 12
>>>=0