hledger/tests/misc/pivot.test
Simon Michael 39662260cd cli: use a blank acct name for postings without the specified pivot tag
Eg. if you --pivot code, postings from transactions with no code value
were formerly displayed with the unpivoted account name, so you'd see
a mixture of account names and codes. Now we always pivot the account name,
to blank if nothing else. This probably makes reports pretty ugly, it's just another
step towards making --pivot's behaviour clearer.
2017-01-13 14:06:23 -08:00

125 lines
3.7 KiB
Plaintext

# --pivot tests
# check pivot with print
hledger -f- --pivot TAG print
<<<
2016/02/16 Test Transaction
Account1 2 EUR
Account2 -2 EUR
; TAG: value
>>>
2016/02/16 Test Transaction
2 EUR
value -2 EUR
; TAG: value
>>>=0
# check pivot with bal
hledger -f- --pivot member bal --no-total
<<<
2016/02/16 Member Fee Payment John Doe
assets:bank account 2 EUR
income:member fees -2 EUR
; member: John Doe
>>>
2 EUR
-2 EUR John Doe
>>>=0
# check with another example
hledger -f- --pivot budget bal --no-total
<<<
2016/02/16 Donation Freifunk
assets:bank account 2 EUR
income:donations -2 EUR
; budget: Freifunk
>>>
2 EUR
-2 EUR Freifunk
>>>=0
# query on account will find either effective name or original one
hledger -f- --pivot TAG reg '^Account2$' '^fun$' not:hidden
<<<
2016/02/16 Test Transaction
Account1 2 EUR
; TAG: fun
Account2 -1 EUR
; TAG: value
Account2 -1 EUR
; TAG: hidden
>>>
2016/02/16 Test Transaction fun 2 EUR 2 EUR
value -1 EUR 1 EUR
>>>=0
# pivot for implicit tag desc (technical sample)
hledger -f- --pivot description reg -M
<<<
2016/02/16 Freifunk
assets:bank account 2 EUR ; date:03/01
income:donations -2 EUR
>>>
2016/02 Freifunk -2 EUR -2 EUR
2016/03 Freifunk 2 EUR 0
>>>=0
# pivot for implicit tag code (technical sample)
hledger -f- --pivot code reg -M
<<<
2016/02/16 (Freifunk) Donation Freifunk
assets:bank account 2 EUR ; date:03/01
income:donations -2 EUR
>>>
2016/02 Freifunk -2 EUR -2 EUR
2016/03 Freifunk 2 EUR 0
>>>=0
# use of pivot with code-based budgeting
hledger -f- --pivot code reg ^income
<<<
2016/02/16 (Freifunk) Donation Freifunk
assets:bank account 2 EUR
income:donations -2 EUR
>>>
2016/02/16 Donation Freifunk Freifunk -2 EUR -2 EUR
>>>=0
# get expenses balance by description/payee
hledger -f- --pivot payee bal --no-total --flat ^expense
<<<
2016/02/16 (1138) Auchan | buy a food for tomorrow morning
assets:bank account
expense:snacks 2 EUR
expense:grocery 20 EUR
2016/02/16 StarBars
assets:bank account
expense:coffee 5 EUR
>>>
22 EUR Auchan
5 EUR StarBars
>>>=0
# get daily expenses by description/payee
hledger -f- --pivot payee reg -D ^expense
<<<
2016/02/16 (1138) Auchan
assets:bank account
expense:snacks 2 EUR
expense:grocery 20 EUR
2016/02/16 StarBars
assets:bank account
expense:coffee 5 EUR
2016/02/17 (1139) Auchan
assets:bank account
expense:grocery 30 EUR
>>>
2016/02/16 Auchan 22 EUR 22 EUR
StarBars 5 EUR 27 EUR
2016/02/17 Auchan 30 EUR 57 EUR
>>>=0