Looks like a bug to me. I fixed it in report.h. By changing the divided terms into quantities. I will file a bug report and send john a pull request tonight.
On 2011-11-03, John Rakestraw <[email protected]> wrote: > Hi, all -- > > With the following ledger file "test": > > ~Monthly > Expenses:Allowance:me $200.00 > Assets > > 2011/11/01 Test entry 1 > Expenses:Allowance:me $50.00 > Liabilities:Checking > > 2011/11/02 Test entry 2 > Expenses:Groceries $35.00 > Expenses:Allowance:me > > 2011/11/03 Test entry 3 > Expenses:Misc $15.00 > Expenses:Allowance:me > > The command > > ledger budget -f test reg -p 'this month' allowance:me > > fails with this error message: > > --8<---------------cut here---------------start------------->8--- > While evaluating value expression: > ansify_if(justify((get_at(total_expr, 1) ? (((100% * > scrub(get_at(total_expr, 0))) / (- scrub(get_at(total_expr, 1)))) : 0)), 5, > -1, true, false), (((color & get_at(total_expr, 1)) & > (abs((quantity(scrub(get_at(total_expr, 0))) / > quantity(scrub(get_at(total_expr, 1))))) >= 1)) ? (magenta : null))) > While multiplying 0 with 100%: > Error: Cannot multiply an amount with a balance > --8<---------------cut here---------------end--------------->8--- > > I realize that this is a bit of a corner case -- and therefore perhaps not > worth fixing. The entries above fit the scenario in which I discovered it. > My wife and I have monthly allowances. I take out $50.00 in cash, charged > to my allowance. However, then I use this cash instead for groceries and a > miscellaneous purchase, which brings my allowance spending for the month > back to $0. > > -- > John Rakestraw > -- Craig, Corona De Tucson, AZ enderw88.wordpress.com
