hledger/tests/balancesheet/balancesheet.test
Simon Michael 6b349e3123 bs/bse/cf/is: show all balances as normally-positive (experimental)
Income, liability and equity balances, which until now we have
always displayed as negative numbers, are now shown as normally positive
by these reports.
Negative numbers now indicate a contra-balance (eg an overdrawn
checking account), a net loss, a negative net worth, etc.
This makes these reports more like conventional financial statements,
and easier to read and share with normal people.
2018-01-18 11:01:07 -08:00

246 lines
18 KiB
Plaintext

# 1. trivial balance sheet
hledger -f - balancesheet
<<<
2016/1/1
assets 1
b
>>>
Balance Sheet
Assets:
1 assets
--------------------
1
Liabilities:
--------------------
0
Total:
--------------------
1
>>>2
>>>= 0
# 2. monthly balance sheet, normal positive sign
# old (arithmetic sign):
#Balance Sheet
#
# || 2008/01/31 2008/02/29 2008/03/31 2008/04/30 2008/05/31 2008/06/30 2008/07/31 2008/08/31 2008/09/30 2008/10/31 2008/11/30 2008/12/31
#======================++================================================================================================================================================
# Assets ||
#----------------------++------------------------------------------------------------------------------------------------------------------------------------------------
# assets:bank:checking || $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 0
# assets:bank:saving || 0 0 0 0 0 $1 $1 $1 $1 $1 $1 $1
# assets:cash || 0 0 0 0 0 $-2 $-2 $-2 $-2 $-2 $-2 $-2
#----------------------++------------------------------------------------------------------------------------------------------------------------------------------------
# || $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1
#======================++================================================================================================================================================
# Liabilities ||
#----------------------++------------------------------------------------------------------------------------------------------------------------------------------------
# liabilities:debts || 0 0 0 0 0 0 0 0 0 0 0 $1
#----------------------++------------------------------------------------------------------------------------------------------------------------------------------------
# || 0 0 0 0 0 0 0 0 0 0 0 $1
#======================++================================================================================================================================================
# Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0
#
hledger -f sample.journal balancesheet -p 'monthly in 2008'
>>>
Balance Sheet
|| 2008/01/31 2008/02/29 2008/03/31 2008/04/30 2008/05/31 2008/06/30 2008/07/31 2008/08/31 2008/09/30 2008/10/31 2008/11/30 2008/12/31
======================++================================================================================================================================================
Assets ||
----------------------++------------------------------------------------------------------------------------------------------------------------------------------------
assets:bank:checking || $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 0
assets:bank:saving || 0 0 0 0 0 $1 $1 $1 $1 $1 $1 $1
assets:cash || 0 0 0 0 0 $-2 $-2 $-2 $-2 $-2 $-2 $-2
----------------------++------------------------------------------------------------------------------------------------------------------------------------------------
|| $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1
======================++================================================================================================================================================
Liabilities ||
----------------------++------------------------------------------------------------------------------------------------------------------------------------------------
liabilities:debts || 0 0 0 0 0 0 0 0 0 0 0 $-1
----------------------++------------------------------------------------------------------------------------------------------------------------------------------------
|| 0 0 0 0 0 0 0 0 0 0 0 $-1
======================++================================================================================================================================================
Net: || $1 $1 $1 $1 $1 0 0 0 0 0 0 0
>>>=0
# 3. monthly balance sheet in tree mode
# old (arithmetic sign):
# || 2008/01/31 2008/02/29 2008/03/31 2008/04/30 2008/05/31 2008/06/30 2008/07/31 2008/08/31 2008/09/30 2008/10/31 2008/11/30 2008/12/31
#==============++================================================================================================================================================
# Assets ||
#--------------++------------------------------------------------------------------------------------------------------------------------------------------------
# assets || $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1
# bank || $1 $1 $1 $1 $1 $2 $2 $2 $2 $2 $2 $1
# checking || $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 0
# saving || 0 0 0 0 0 $1 $1 $1 $1 $1 $1 $1
# cash || 0 0 0 0 0 $-2 $-2 $-2 $-2 $-2 $-2 $-2
#--------------++------------------------------------------------------------------------------------------------------------------------------------------------
# || $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1
#==============++================================================================================================================================================
# Liabilities ||
#--------------++------------------------------------------------------------------------------------------------------------------------------------------------
# liabilities || 0 0 0 0 0 0 0 0 0 0 0 $1
# debts || 0 0 0 0 0 0 0 0 0 0 0 $1
#--------------++------------------------------------------------------------------------------------------------------------------------------------------------
# || 0 0 0 0 0 0 0 0 0 0 0 $1
#==============++================================================================================================================================================
# Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0
#
hledger -f sample.journal balancesheet -p 'monthly in 2008' --tree
>>>
Balance Sheet
|| 2008/01/31 2008/02/29 2008/03/31 2008/04/30 2008/05/31 2008/06/30 2008/07/31 2008/08/31 2008/09/30 2008/10/31 2008/11/30 2008/12/31
==============++================================================================================================================================================
Assets ||
--------------++------------------------------------------------------------------------------------------------------------------------------------------------
assets || $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1
bank || $1 $1 $1 $1 $1 $2 $2 $2 $2 $2 $2 $1
checking || $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 0
saving || 0 0 0 0 0 $1 $1 $1 $1 $1 $1 $1
cash || 0 0 0 0 0 $-2 $-2 $-2 $-2 $-2 $-2 $-2
--------------++------------------------------------------------------------------------------------------------------------------------------------------------
|| $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1
==============++================================================================================================================================================
Liabilities ||
--------------++------------------------------------------------------------------------------------------------------------------------------------------------
liabilities || 0 0 0 0 0 0 0 0 0 0 0 $-1
debts || 0 0 0 0 0 0 0 0 0 0 0 $-1
--------------++------------------------------------------------------------------------------------------------------------------------------------------------
|| 0 0 0 0 0 0 0 0 0 0 0 $-1
==============++================================================================================================================================================
Net: || $1 $1 $1 $1 $1 0 0 0 0 0 0 0
>>>= 0
# 4. monthly balancesheet with average/total columns and without overall totals row
hledger -f sample.journal balancesheet -p 'monthly in 2008' -NAT
>>>
Balance Sheet
|| 2008/01/31 2008/02/29 2008/03/31 2008/04/30 2008/05/31 2008/06/30 2008/07/31 2008/08/31 2008/09/30 2008/10/31 2008/11/30 2008/12/31 Total Average
======================++==================================================================================================================================================================
Assets ||
----------------------++------------------------------------------------------------------------------------------------------------------------------------------------------------------
assets:bank:checking || $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 0 $11 $1
assets:bank:saving || 0 0 0 0 0 $1 $1 $1 $1 $1 $1 $1 $7 $1
assets:cash || 0 0 0 0 0 $-2 $-2 $-2 $-2 $-2 $-2 $-2 $-14 $-1
----------------------++------------------------------------------------------------------------------------------------------------------------------------------------------------------
|| $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1 $4 0
======================++==================================================================================================================================================================
Liabilities ||
----------------------++------------------------------------------------------------------------------------------------------------------------------------------------------------------
liabilities:debts || 0 0 0 0 0 0 0 0 0 0 0 $-1 $-1 0
----------------------++------------------------------------------------------------------------------------------------------------------------------------------------------------------
|| 0 0 0 0 0 0 0 0 0 0 0 $-1 $-1 0
>>>= 0
# 5. Tree output still works, #565
hledger -f- balancesheet
<<<
2017/1/1
(assets:b) 1
>>>
Balance Sheet
Assets:
1 assets
1 b
--------------------
1
Liabilities:
--------------------
0
Total:
--------------------
1
>>>2
>>>=0
# 6. Flat output still works, #552
hledger -f- balancesheet --flat
<<<
2017/1/1
(assets:b) 1
>>>
Balance Sheet
Assets:
1 assets:b
--------------------
1
Liabilities:
--------------------
0
Total:
--------------------
1
>>>2
>>>=0
# 7. An empty section is does not disrupt the overall totals, #588
hledger -f- balancesheet -YTA
<<<
2017/1/1
(assets) $1
>>>
Balance Sheet
|| 2017/12/31 Total Average
=============++==============================
Assets ||
-------------++------------------------------
assets || $1 $1 $1
-------------++------------------------------
|| $1 $1 $1
=============++==============================
Liabilities ||
-------------++------------------------------
-------------++------------------------------
||
=============++==============================
Net: || $1 $1 $1
>>>2
>>>=0
# 9. --pretty-tables uses unicode chars for borders
hledger -f - balancesheet -M --pretty-tables
<<<
2016/1/1
assets 1
b
>>>
Balance Sheet
║ 2016/01/31
═════════════╬════════════
Assets ║
─────────────╫────────────
assets ║ 1
─────────────╫────────────
║ 1
═════════════╬════════════
Liabilities ║
─────────────╫────────────
─────────────╫────────────
═════════════╬════════════
Net: ║ 1
>>>2
>>>= 0