mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-10 14:16:41 +03:00
7c2511aa29
Compound balance reports showing ending balances (eg balancesheet), now show the ending date (single column) or range of ending dates (multi column) in their title. ,, (double comma) is used rather than - (hyphen) to suggest a sequence of discrete dates rather than a continuous span.
287 lines
20 KiB
Plaintext
287 lines
20 KiB
Plaintext
# 1. trivial balance sheet
|
|
hledger -f - balancesheet
|
|
<<<
|
|
2016/1/1
|
|
assets 1
|
|
b
|
|
>>>
|
|
Balance Sheet 2016/01/01
|
|
|
|
|| 2016/01/01
|
|
=============++============
|
|
Assets ||
|
|
-------------++------------
|
|
assets || 1
|
|
-------------++------------
|
|
|| 1
|
|
=============++============
|
|
Liabilities ||
|
|
-------------++------------
|
|
-------------++------------
|
|
||
|
|
=============++============
|
|
Net: || 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/12/31
|
|
|
|
|| 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/12/31
|
|
|
|
|| 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 column and without overall totals row.
|
|
# Total column is requested but not shown because balancesheet is in historical mode
|
|
# by default (shows ending balances).
|
|
hledger -f sample.journal balancesheet -p 'monthly in 2008' -NAT
|
|
>>>
|
|
Balance Sheet 2008/01/31,,2008/12/31
|
|
|
|
|| 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 Average
|
|
======================++=========================================================================================================================================================
|
|
Assets ||
|
|
----------------------++---------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
assets:bank:checking || $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 $1 0 $1
|
|
assets:bank:saving || 0 0 0 0 0 $1 $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 $1 0 0 0 0 0 0 $-1 0
|
|
======================++=========================================================================================================================================================
|
|
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 0 $-1 0
|
|
>>>= 0
|
|
|
|
# 5. Tree output still works, #565
|
|
hledger -f- balancesheet
|
|
<<<
|
|
2017/1/1
|
|
(assets:b) 1
|
|
>>>
|
|
Balance Sheet 2017/01/01
|
|
|
|
|| 2017/01/01
|
|
=============++============
|
|
Assets ||
|
|
-------------++------------
|
|
assets || 1
|
|
b || 1
|
|
-------------++------------
|
|
|| 1
|
|
=============++============
|
|
Liabilities ||
|
|
-------------++------------
|
|
-------------++------------
|
|
||
|
|
=============++============
|
|
Net: || 1
|
|
>>>2
|
|
>>>=0
|
|
|
|
# 6. Flat output still works, #552
|
|
hledger -f- balancesheet --flat
|
|
<<<
|
|
2017/1/1
|
|
(assets:b) 1
|
|
>>>
|
|
Balance Sheet 2017/01/01
|
|
|
|
|| 2017/01/01
|
|
=============++============
|
|
Assets ||
|
|
-------------++------------
|
|
assets:b || 1
|
|
-------------++------------
|
|
|| 1
|
|
=============++============
|
|
Liabilities ||
|
|
-------------++------------
|
|
-------------++------------
|
|
||
|
|
=============++============
|
|
Net: || 1
|
|
>>>2
|
|
>>>=0
|
|
|
|
# 7. An empty section does not disrupt the overall totals, #588
|
|
hledger -f- balancesheet -YA
|
|
<<<
|
|
2017/1/1
|
|
(assets) $1
|
|
>>>
|
|
Balance Sheet 2017/12/31
|
|
|
|
|| 2017/12/31 Average
|
|
=============++=====================
|
|
Assets ||
|
|
-------------++---------------------
|
|
assets || $1 $1
|
|
-------------++---------------------
|
|
|| $1 $1
|
|
=============++=====================
|
|
Liabilities ||
|
|
-------------++---------------------
|
|
-------------++---------------------
|
|
||
|
|
=============++=====================
|
|
Net: || $1 $1
|
|
>>>2
|
|
>>>=0
|
|
|
|
# 8. --pretty-tables uses unicode chars for borders
|
|
hledger -f - balancesheet -M --pretty-tables
|
|
<<<
|
|
2016/1/1
|
|
assets 1
|
|
b
|
|
>>>
|
|
Balance Sheet 2016/01/31
|
|
|
|
║ 2016/01/31
|
|
═════════════╬════════════
|
|
Assets ║
|
|
─────────────╫────────────
|
|
assets ║ 1
|
|
─────────────╫────────────
|
|
║ 1
|
|
═════════════╬════════════
|
|
Liabilities ║
|
|
─────────────╫────────────
|
|
─────────────╫────────────
|
|
║
|
|
═════════════╬════════════
|
|
Net: ║ 1
|
|
>>>2
|
|
>>>= 0
|
|
|
|
# 9. Check that accounts brought to zero by subaccount balances
|
|
# are not erased from balancesheet
|
|
hledger -f - balancesheet
|
|
<<<
|
|
2018-10-01
|
|
income:whatever
|
|
assets:bank $100
|
|
assets:bank:subaccount $10
|
|
assets:bank:this subaccount should disappear $10
|
|
|
|
2018-10-02
|
|
assets:bank:this subaccount should disappear -$10
|
|
assets:bank
|
|
|
|
2018-10-03
|
|
assets:this account should not disappear:subaccount -$10
|
|
assets:this account should not disappear
|
|
>>>
|
|
Balance Sheet 2018/10/03
|
|
|
|
|| 2018/10/03
|
|
=====================================++============
|
|
Assets ||
|
|
-------------------------------------++------------
|
|
assets || $120
|
|
bank || $120
|
|
subaccount || $10
|
|
this account should not disappear || 0
|
|
subaccount || $-10
|
|
-------------------------------------++------------
|
|
|| $120
|
|
=====================================++============
|
|
Liabilities ||
|
|
-------------------------------------++------------
|
|
-------------------------------------++------------
|
|
||
|
|
=====================================++============
|
|
Net: || $120
|
|
>>>2
|
|
>>>= 0
|