mirror of
https://github.com/simonmichael/hledger.git
synced 2025-01-04 00:07:29 +03:00
244 lines
9.7 KiB
Plaintext
244 lines
9.7 KiB
Plaintext
#* budget report sorting
|
|
# These tests below aren't very thorough, could use more varied amounts
|
|
# and pathological cases.
|
|
|
|
#** Default sort without account declarations
|
|
# already tested in budget.test, but for completeness:
|
|
|
|
<
|
|
~ daily from 2016/1/1
|
|
expenses:food $10
|
|
expenses:leisure $15
|
|
assets:cash
|
|
|
|
2016/12/01
|
|
expenses:food $10
|
|
assets:cash
|
|
|
|
2016/12/02
|
|
expenses:food $9
|
|
assets:cash
|
|
|
|
2016/12/03
|
|
expenses:food $11
|
|
assets:cash
|
|
|
|
2016/12/02
|
|
expenses:leisure $5
|
|
assets:cash
|
|
|
|
2016/12/03
|
|
expenses:movies $25
|
|
assets:cash
|
|
|
|
2016/12/03
|
|
expenses:cab $15
|
|
assets:cash
|
|
|
|
$ hledger -f- bal --budget -DTN
|
|
Budget performance in 2016-12-01-2016-12-03:
|
|
|
|
|| 2016-12-01 2016-12-02 2016-12-03 Total
|
|
==================++========================================================================================
|
|
assets || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25] $-75 [ 100% of $-75]
|
|
assets:cash || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25] $-75 [ 100% of $-75]
|
|
expenses || $10 [ 40% of $25] $14 [ 56% of $25] $51 [ 204% of $25] $75 [ 100% of $75]
|
|
expenses:food || $10 [ 100% of $10] $9 [ 90% of $10] $11 [ 110% of $10] $30 [ 100% of $30]
|
|
expenses:leisure || 0 [ 0% of $15] $5 [ 33% of $15] 0 [ 0% of $15] $5 [ 11% of $45]
|
|
|
|
#** Default sort with account declarations
|
|
|
|
<
|
|
account expenses
|
|
account expenses:leisure
|
|
|
|
~ daily from 2016/1/1
|
|
expenses:food $10
|
|
expenses:leisure $15
|
|
assets:cash
|
|
|
|
2016/12/01
|
|
expenses:food $10
|
|
assets:cash
|
|
|
|
2016/12/02
|
|
expenses:food $9
|
|
assets:cash
|
|
|
|
2016/12/03
|
|
expenses:food $11
|
|
assets:cash
|
|
|
|
2016/12/02
|
|
expenses:leisure $5
|
|
assets:cash
|
|
|
|
2016/12/03
|
|
expenses:movies $25
|
|
assets:cash
|
|
|
|
2016/12/03
|
|
expenses:cab $15
|
|
assets:cash
|
|
|
|
$ hledger -f- bal --budget -DTN
|
|
Budget performance in 2016-12-01-2016-12-03:
|
|
|
|
|| 2016-12-01 2016-12-02 2016-12-03 Total
|
|
==================++========================================================================================
|
|
expenses || $10 [ 40% of $25] $14 [ 56% of $25] $51 [ 204% of $25] $75 [ 100% of $75]
|
|
expenses:leisure || 0 [ 0% of $15] $5 [ 33% of $15] 0 [ 0% of $15] $5 [ 11% of $45]
|
|
expenses:food || $10 [ 100% of $10] $9 [ 90% of $10] $11 [ 110% of $10] $30 [ 100% of $30]
|
|
assets || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25] $-75 [ 100% of $-75]
|
|
assets:cash || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25] $-75 [ 100% of $-75]
|
|
|
|
# # 2. -E
|
|
# $ hledger bal -D -b 2016-12-01 -e 2016-12-04 -f - --budget -E
|
|
# Budget performance in 2016-12-01-2016-12-03:
|
|
|
|
# || 2016-12-01 2016-12-02 2016-12-03
|
|
# ==============================++==============================================================================
|
|
# <unbudgeted>:expenses:cab || 0 0 $15
|
|
# <unbudgeted>:expenses:movies || 0 0 $25
|
|
# assets:cash || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25]
|
|
# expenses:food || $10 [ 100% of $10] $9 [ 90% of $10] $11 [ 110% of $10]
|
|
# expenses:leisure || 0 [ 0% of $15] $5 [ 33% of $15] 0 [ 0% of $15]
|
|
# ------------------------------++------------------------------------------------------------------------------
|
|
# || 0 [ 0] 0 [ 0] 0 [ 0]
|
|
|
|
# # 3. Test that budget works with mix of commodities
|
|
# <
|
|
# 2016/12/01
|
|
# expenses:food £10 @@ $15
|
|
# assets:cash
|
|
|
|
# 2016/12/02
|
|
# expenses:food 10 CAD @ $1
|
|
# assets:cash
|
|
|
|
# 2016/12/02
|
|
# expenses:food 10 CAD @ $1.1
|
|
# assets:cash
|
|
|
|
# 2016/12/03
|
|
# expenses:food $11
|
|
# assets:cash
|
|
|
|
# 2016/12/02
|
|
# expenses:leisure $5
|
|
# assets:cash
|
|
|
|
# 2016/12/03
|
|
# expenses:movies $25
|
|
# assets:cash
|
|
|
|
# 2016/12/03
|
|
# expenses:cab $15
|
|
# assets:cash
|
|
|
|
# ~ daily from 2016/1/1
|
|
# expenses:food $10
|
|
# expenses:leisure $15
|
|
# assets:cash
|
|
|
|
# $ hledger bal -D -b 2016-12-01 -e 2016-12-04 -f - --budget
|
|
# Budget performance in 2016-12-01-2016-12-03:
|
|
|
|
# || 2016-12-01 2016-12-02 2016-12-03
|
|
# ==================++=====================================================================================
|
|
# <unbudgeted> || 0 0 $40
|
|
# assets:cash || $-15 [ 60% of $-25] $-26 [ 104% of $-25] $-51 [ 204% of $-25]
|
|
# expenses:food || £10 [ 150% of $10] 20 CAD [ 210% of $10] $11 [ 110% of $10]
|
|
# expenses:leisure || 0 [ 0% of $15] $5 [ 33% of $15] 0 [ 0% of $15]
|
|
# ------------------++-------------------------------------------------------------------------------------
|
|
# || $-15, £10 [ 0] $-21, 20 CAD [ 0] 0 [ 0]
|
|
|
|
#** Sort by actual amount, flat mode.
|
|
|
|
$ hledger -f- bal --budget -DTNS
|
|
Budget performance in 2016-12-01-2016-12-03:
|
|
|
|
|| 2016-12-01 2016-12-02 2016-12-03 Total
|
|
==================++========================================================================================
|
|
expenses || $10 [ 40% of $25] $14 [ 56% of $25] $51 [ 204% of $25] $75 [ 100% of $75]
|
|
expenses:food || $10 [ 100% of $10] $9 [ 90% of $10] $11 [ 110% of $10] $30 [ 100% of $30]
|
|
expenses:leisure || 0 [ 0% of $15] $5 [ 33% of $15] 0 [ 0% of $15] $5 [ 11% of $45]
|
|
assets || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25] $-75 [ 100% of $-75]
|
|
assets:cash || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25] $-75 [ 100% of $-75]
|
|
|
|
#** Sort by actual amount, tree mode.
|
|
|
|
$ hledger -f- bal --budget -DTNS --tree
|
|
Budget performance in 2016-12-01-2016-12-03:
|
|
|
|
|| 2016-12-01 2016-12-02 2016-12-03 Total
|
|
===========++========================================================================================
|
|
expenses || $10 [ 40% of $25] $14 [ 56% of $25] $51 [ 204% of $25] $75 [ 100% of $75]
|
|
food || $10 [ 100% of $10] $9 [ 90% of $10] $11 [ 110% of $10] $30 [ 100% of $30]
|
|
leisure || 0 [ 0% of $15] $5 [ 33% of $15] 0 [ 0% of $15] $5 [ 11% of $45]
|
|
assets || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25] $-75 [ 100% of $-75]
|
|
cash || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25] $-75 [ 100% of $-75]
|
|
|
|
#** other ?
|
|
# with -E
|
|
# $ hledger bal -D -b 2016-12-01 -e 2016-12-04 -f - --budget -E
|
|
# Budget performance in 2016/12/01-2016/12/03:
|
|
|
|
# || 2016/12/01 2016/12/02 2016/12/03
|
|
# ==============================++==============================================================================
|
|
# <unbudgeted>:expenses:cab || 0 0 $15
|
|
# <unbudgeted>:expenses:movies || 0 0 $25
|
|
# assets:cash || $-10 [ 40% of $-25] $-14 [ 56% of $-25] $-51 [ 204% of $-25]
|
|
# expenses:food || $10 [ 100% of $10] $9 [ 90% of $10] $11 [ 110% of $10]
|
|
# expenses:leisure || 0 [ 0% of $15] $5 [ 33% of $15] 0 [ 0% of $15]
|
|
# ------------------------------++------------------------------------------------------------------------------
|
|
# || 0 [ 0] 0 [ 0] 0 [ 0]
|
|
|
|
# with multiple commodities
|
|
# <
|
|
# 2016/12/01
|
|
# expenses:food £10 @@ $15
|
|
# assets:cash
|
|
|
|
# 2016/12/02
|
|
# expenses:food 10 CAD @ $1
|
|
# assets:cash
|
|
|
|
# 2016/12/02
|
|
# expenses:food 10 CAD @ $1.1
|
|
# assets:cash
|
|
|
|
# 2016/12/03
|
|
# expenses:food $11
|
|
# assets:cash
|
|
|
|
# 2016/12/02
|
|
# expenses:leisure $5
|
|
# assets:cash
|
|
|
|
# 2016/12/03
|
|
# expenses:movies $25
|
|
# assets:cash
|
|
|
|
# 2016/12/03
|
|
# expenses:cab $15
|
|
# assets:cash
|
|
|
|
# ~ daily from 2016/1/1
|
|
# expenses:food $10
|
|
# expenses:leisure $15
|
|
# assets:cash
|
|
|
|
# $ hledger bal -D -b 2016-12-01 -e 2016-12-04 -f - --budget
|
|
# Budget performance in 2016/12/01-2016/12/03:
|
|
|
|
# || 2016/12/01 2016/12/02 2016/12/03
|
|
# ==================++=====================================================================================
|
|
# <unbudgeted> || 0 0 $40
|
|
# assets:cash || $-15 [ 60% of $-25] $-26 [ 104% of $-25] $-51 [ 204% of $-25]
|
|
# expenses:food || £10 [ 150% of $10] 20 CAD [ 210% of $10] $11 [ 110% of $10]
|
|
# expenses:leisure || 0 [ 0% of $15] $5 [ 33% of $15] 0 [ 0% of $15]
|
|
# ------------------++-------------------------------------------------------------------------------------
|
|
# || $-15, £10 [ 0] $-21, 20 CAD [ 0] 0 [ 0]
|
|
|