Hi, I came across the same problem and got it partially working by using amount instead of total:
% cat test.dat
2012/10/09 t
a € 2
b
2012/10/09 t
a € 4
b
2012/10/09 t
c € 5
a
check account("a").amount == € 1
2012/10/09 t
a:1 € 3
z
check account("a").amount == € 4
check account("a:1").amount == € 3
% ledger -f test.dat bal
Warning: "test.dat", line 19: Check failed: account("a").amount == € 4
€ 4 a
€ 3 1
€ -6 b
€ 5 c
€ -3 z
--------------------
0
What I find furthermore interesting is how the account's
total() and amount() develop during a register report.
Is this behaviour intended? Is it correct?
Or could this be a bug?
%ledger -f test.dat reg --total 'account("a").total()'
09.10.2012 t a € 2 € 2
b € -2 € 2
09.10.2012 t a € 4 € 2
; I'd expect € 6 here
b € -4 € 2
09.10.2012 t c € 5 € 2
a € -5 € -3
; I'd expect € 1 here
09.10.2012 t a:1 € 3 € -3
z € -3 € -3
%ledger -f test.dat reg --total 'account("a").amount()'
09.10.2012 t a € 2 € 2
b € -2 € 2
09.10.2012 t a € 4 € 2
b € -4 € 2
09.10.2012 t c € 5 € 2
a € -5 € 2
09.10.2012 t a:1 € 3 € 2
z
Alexis
