2017-01-01 11:49:36 +03:00
|
|
|
# Tests for rewrite addon
|
|
|
|
|
|
|
|
# Add proportional income tax (from documentation)
|
2017-01-08 16:52:45 +03:00
|
|
|
runghc ../../bin/hledger-rewrite.hs -f- ^income --add-posting '(liabilities:tax) *.33'
|
2017-01-01 11:49:36 +03:00
|
|
|
<<<
|
|
|
|
2016/1/1 paycheck
|
|
|
|
income:remuneration $-100
|
|
|
|
assets:bank
|
|
|
|
|
|
|
|
2016/1/1 withdraw
|
|
|
|
assets:cash $20
|
|
|
|
assets:bank
|
|
|
|
>>>
|
|
|
|
2016/01/01 paycheck
|
|
|
|
income:remuneration $-100
|
2017-01-13 18:25:44 +03:00
|
|
|
assets:bank
|
2017-01-01 11:49:36 +03:00
|
|
|
(liabilities:tax) $-33
|
|
|
|
|
|
|
|
2016/01/01 withdraw
|
|
|
|
assets:cash $20
|
2017-01-13 18:25:44 +03:00
|
|
|
assets:bank
|
2017-01-01 11:49:36 +03:00
|
|
|
|
2017-01-13 18:25:44 +03:00
|
|
|
>>>2
|
2017-01-01 11:49:36 +03:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# Duplicate posting for budgeting (from documentation)
|
2017-01-08 16:52:45 +03:00
|
|
|
runghc ../../bin/hledger-rewrite.hs -f- expenses:gifts --add-posting '(budget:gifts) *-1'
|
2017-01-01 11:49:36 +03:00
|
|
|
<<<
|
|
|
|
2016/1/1 withdraw
|
|
|
|
assets:cash $20
|
|
|
|
assets:bank
|
|
|
|
|
|
|
|
2016/1/1 gift
|
|
|
|
assets:cash $-15
|
|
|
|
expenses:gifts
|
|
|
|
>>>
|
|
|
|
2016/01/01 withdraw
|
|
|
|
assets:cash $20
|
2017-01-13 18:25:44 +03:00
|
|
|
assets:bank
|
2017-01-01 11:49:36 +03:00
|
|
|
|
|
|
|
2016/01/01 gift
|
|
|
|
assets:cash $-15
|
2017-01-13 18:25:44 +03:00
|
|
|
expenses:gifts
|
2017-01-01 11:49:36 +03:00
|
|
|
(budget:gifts) $-15
|
|
|
|
|
2017-01-13 18:25:44 +03:00
|
|
|
>>>2
|
2017-01-01 11:49:36 +03:00
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# Add absolute bank processing fee
|
2017-01-08 16:52:45 +03:00
|
|
|
runghc ../../bin/hledger-rewrite.hs -f- assets:bank and 'amt:<0' --add-posting 'expenses:fee $5' --add-posting 'assets:bank $-5'
|
2017-01-01 11:49:36 +03:00
|
|
|
<<<
|
|
|
|
2016/1/1 withdraw
|
|
|
|
assets:cash $20
|
|
|
|
assets:bank
|
|
|
|
|
|
|
|
2016/1/2 withdraw
|
|
|
|
assets:cash
|
|
|
|
assets:bank $-30
|
|
|
|
|
|
|
|
# # TODO: Fix to filter out this txn by missing amt:<0 condition on assets:bank
|
|
|
|
# 2016/1/31 paycheck
|
|
|
|
# income:remuneration $-100
|
|
|
|
# assets:bank
|
|
|
|
>>>
|
|
|
|
2016/01/01 withdraw
|
|
|
|
assets:cash $20
|
2017-01-13 18:25:44 +03:00
|
|
|
assets:bank
|
2017-01-01 11:49:36 +03:00
|
|
|
expenses:fee $5
|
|
|
|
assets:bank $-5
|
|
|
|
|
|
|
|
2016/01/02 withdraw
|
2017-01-13 18:25:44 +03:00
|
|
|
assets:cash
|
2017-01-01 11:49:36 +03:00
|
|
|
assets:bank $-30
|
|
|
|
expenses:fee $5
|
|
|
|
assets:bank $-5
|
|
|
|
|
2017-01-13 18:25:44 +03:00
|
|
|
>>>2
|
2017-01-01 11:49:36 +03:00
|
|
|
>>>=0
|