automated transaction amount multipliers and value expressions

2015-03-22 Thread John Buxton
Hi, 

I'm trying to get Ledger to automatically work out UK VAT (tax at 20%) on a 
sales invoice; it seems crazy for me to have to calculate and enter this by 
hand every time.

First I've tried using automated transaction amount multipliers:

= expr true

Liabilities:VAT   0.2

Assets:Accounts Receivable   -1.2

 

08/07/2011 Invoice

Income:Sales£1000


According to the doc 
http://ledger-cli.org/3.0/doc/ledger3.html#Amount-multipliers this should 
be equivalent to:

08/07/2011 Invoice

Income:Sales £100

Liabilities:VAT   £20

Assets:Accounts Receivable  -£120


But instead I get an error:

johnpc$ ledger   -f test.ldg reg  -E

While parsing file /home/john/Documents/test.ldg, line 6:

While balancing transaction from /home/john/Documents/test.ldg, lines 5-6:

 08/07/2011 Invoice

 Income:Sales£100

Unbalanced remainder is:

£100

Amount to balance against:

£100

Error: Transaction does not balance

johnpc$


With debug, it seems that the amount multipliers are being treated as 
simple values rather than £s, and so the transaction doesn't balance.

johnpc$ ledger   --debug textual.parse -f test.ldg reg  -E

0ms  [INFO]  Ledger starting

2ms  [INFO]  Parsing file /home/john/.ledgerrc

3ms  [INFO]  Parsing file /home/john/Documents/test.ldg

4ms  [DEBUG] line 2: Parsed account name Liabilities:VAT

4ms  [DEBUG] line 2: post amount = 0.2

4ms  [DEBUG] line 3: Parsed account name Assets:Accounts Receivable

4ms  [DEBUG] line 3: post amount = -1.2

4ms  [DEBUG] line 6: Parsed account name Income:Sales

5ms  [DEBUG] line 6: post amount = £100

While parsing file /home/john/Documents/test.ldg, line 6:

While balancing transaction from /home/john/Documents/test.ldg, lines 5-6:

 08/07/2011 Invoice

 Income:Sales£100

Unbalanced remainder is:

£100

Amount to balance against:

£100

Error: Transaction does not balance

6ms  [INFO]  Ledger ended

johnpc$


I've also tried value expressions which seem like they ought to be powerful 
enough to help me do this, but the docs don't explain it very clearly and 
I'm just stabbing in the dark. It feels like there's a value expression 
party that I've not been invited to. For example the value expression in 
here evaluates to zero:

08/07/2011 Invoice

Income:Sales£100

Liabilities:VAT (amount * 0.2)

Assets:Accounts Receivable


johnpc$ ledger   -f test.ldg reg  -E

08/07/11 Invoice   Income:Sales £100.00 
  £100.00

   Liabilities:VAT0 
  £100.00

   Ass:Accounts Receivable £-100.00 
0

johnpc$


When I first started reading about ledger; it seemed like exactly what I 
wanted. But now I'm nervous about switching my accounting system. Too much 
of it seems like a black art. I'm wondering if beancount or hlledger would 
be better at this sort of thing, or better documented?

Any solutions or advice would be most welcome.

Thanks in advance,
John

-- 

--- 
You received this message because you are subscribed to the Google Groups 
Ledger group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: support negative arguments in xact?

2015-03-22 Thread John Buxton
Try:

ledger xact -- restaurant 24 credit -14 cash -10

The '--' stops option processing.

On Wednesday, 28 January 2015 03:18:55 UTC, Eric Abrahamsen wrote:

 Is there any way that negative values could be supported in ledger xact. 
 I've got a few fairly complicated recurring postings where I need to 
 specify one of the lines as a negative value, and no variety of quoting 
 approaches has allowed me to specify, for example: 

 ledger xact restaurant 24 credit -14 cash -10 

 Thanks! 
 Eric 



-- 

--- 
You received this message because you are subscribed to the Google Groups 
Ledger group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: support negative arguments in xact?

2015-03-22 Thread Eric Abrahamsen
John Buxton lquer...@gmail.com writes:

 Try:

 ledger xact -- restaurant 24 credit -14 cash -10

 The '--' stops option processing.

That works great -- thanks very much for the tip!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
Ledger group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: support negative arguments in xact?

2015-03-22 Thread Simon Michael
On 3/22/15 6:33 PM, Eric Abrahamsen wrote:
 John Buxton lquer...@gmail.com writes:
 ledger xact -- restaurant 24 credit -14 cash -10

 The '--' stops option processing.

Nice one!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
Ledger group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.