hledger/tests/cashflow/cashflow.test
Christian G. Warden deaf9cfbef Exclude Fixed Assets from Cashflow Report
Add "fixed" to the regex used to exclude asset accounts from cashflow
reports.  Assumes accounts are set up something like:
assets:fixed assets:equipment
assets:fixed assets:vehicles
assets:fixed assets:buildings
2017-08-27 04:41:05 -07:00

263 lines
7.5 KiB
Plaintext

# 1.
hledger -f - cashflow
<<<
2016/1/1
assets 1
b
>>>
Cashflow Statement
Cash flows:
1 assets
--------------------
1
>>>2
>>>= 0
# 2. Period reporting works for a specific year
hledger -f - cashflow -b 2016 -e 2017
<<<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
revenue:clients:A -$10,000.00
2015/11/02 Deposit | Invoice #1
assets:checking $10,000.00
assets:receivables -$10,000.00
2016/02/01 Client B | Invoice #2
assets:receivables $10.00
revenue:clients:B -$10.00
2016/02/15 ACME | Hosting Costs
expense:hosting $50.00
assets:checking -$50.00
2016/03/01 Deposit | Invoice #2
assets:checking $10.00
assets:receivables -$10.00
>>>
Cashflow Statement
Cash flows:
$-40.00 assets:checking
--------------------
$-40.00
>>>2
>>>= 0
# 3. Period reporting works for two years
hledger -f - cashflow -b 2015 -e 2017
<<<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
revenue:clients:A -$10,000.00
2015/11/02 Deposit | Invoice #1
assets:checking $10,000.00
assets:receivables -$10,000.00
2016/02/01 Client B | Invoice #2
assets:receivables $10.00
revenue:clients:B -$10.00
2016/02/15 ACME | Hosting Costs
expense:hosting $50.00
assets:checking -$50.00
2016/03/01 Deposit | Invoice #2
assets:checking $10.00
assets:receivables -$10.00
>>>
Cashflow Statement
Cash flows:
$9,960.00 assets:checking
--------------------
$9,960.00
>>>2
>>>= 0
# 4. Period reporting works for one month
hledger -f - cashflow -b 2015/11 -e 2015/12
<<<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
revenue:clients:A -$10,000.00
2015/11/02 Deposit | Invoice #1
assets:checking $10,000.00
assets:receivables -$10,000.00
2016/02/01 Client B | Invoice #2
assets:receivables $10.00
revenue:clients:B -$10.00
2016/02/15 ACME | Hosting Costs
expense:hosting $50.00
assets:checking -$50.00
2016/03/01 Deposit | Invoice #2
assets:checking $10.00
assets:receivables -$10.00
>>>
Cashflow Statement
Cash flows:
$10,000.00 assets:checking
--------------------
$10,000.00
>>>2
>>>= 0
# 5. Period reporting works for one month in another year
hledger -f - cashflow -b 2016/10 -e 2016/11
<<<
2015/10/10 Client A | Invoice #1
assets:receivables $10,000.00
revenue:clients:A -$10,000.00
2015/11/02 Deposit | Invoice #1
assets:checking $10,000.00
assets:receivables -$10,000.00
2016/02/01 Client B | Invoice #2
assets:receivables $10.00
revenue:clients:B -$10.00
2016/02/15 ACME | Hosting Costs
expense:hosting $50.00
assets:checking -$50.00
2016/03/01 Deposit | Invoice #2
assets:checking $10.00
assets:receivables -$10.00
>>>
Cashflow Statement
Cash flows:
--------------------
0
>>>2
>>>= 0
# 6. Multicolumn test
hledger -f sample.journal cashflow -p 'monthly in 2008'
>>>
Cashflow Statement
|| 2008/01 2008/02 2008/03 2008/04 2008/05 2008/06 2008/07 2008/08 2008/09 2008/10 2008/11 2008/12
======================++============================================================================================================
Cash flows ||
----------------------++------------------------------------------------------------------------------------------------------------
assets:bank:checking || $1 0 0 0 0 0 0 0 0 0 0 $-1
assets:bank:saving || 0 0 0 0 0 $1 0 0 0 0 0 0
assets:cash || 0 0 0 0 0 $-2 0 0 0 0 0 0
----------------------++------------------------------------------------------------------------------------------------------------
|| $1 0 0 0 0 $-1 0 0 0 0 0 $-1
>>>= 0
# 7. Multicolumn test (historical)
hledger -f sample.journal cashflow -p 'monthly in 2008' -A --historical
>>>
Cashflow Statement (Historical Ending Balances)
|| 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
======================++=========================================================================================================================================================
Cash flows ||
----------------------++---------------------------------------------------------------------------------------------------------------------------------------------------------
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
>>>= 0
# 8. without -N/--no-total (single column)
hledger -f sample.journal cf
>>>
Cashflow Statement
Cash flows:
$-1 assets
$1 bank:saving
$-2 cash
--------------------
$-1
>>>2
>>>= 0
# 9. with -N (single column)
hledger -f sample.journal cf -N
>>>
Cashflow Statement
Cash flows:
$-1 assets
$1 bank:saving
$-2 cash
>>>2
>>>= 0
# 10. without -N (multi column)
hledger -f sample.journal cf -Y
>>>
Cashflow Statement
|| 2008
====================++======
Cash flows ||
--------------------++------
assets:bank:saving || $1
assets:cash || $-2
--------------------++------
|| $-1
>>>2
>>>= 0
# 11. with -N (multi column)
hledger -f sample.journal cf -Y -N
>>>
Cashflow Statement
|| 2008
====================++======
Cash flows ||
--------------------++------
assets:bank:saving || $1
assets:cash || $-2
>>>2
>>>= 0
# 12. exclude fixed assets from cashflow
hledger -f - cashflow
<<<
2016/1/1
assets 1
b
2016/1/1
assets:fixed assets:equipment 1
b
>>>
Cashflow Statement
Cash flows:
1 assets
--------------------
1
>>>2
>>>= 0