Re: Automated transaction and account balance assertion

2016-05-03 Thread Sébastien Gross
Yes seems to be.

Thanks for pointing it to me.

S.

-- 

--- 
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: Automated transaction and account balance assertion

2016-05-03 Thread Jostein Berntsen

On 03.05.16,03:34, Sébastien Gross wrote:

Hi Jostein,

Yes I tried something like:

--8<--
2016/03/31 * Bob
   Assets:Bank:Invests:Plan 100.00 EUR
   Equity:Invests:Plan-100.00 EUR
--8<--

Event I tried:
--8<--

2016/03/31 * Bob
   Assets:Bank:Invests:Plan 100.00 EUR =291.00 EUR
   Equity:Invests:Plan-100.00 EUR
--8<--

But still this does not work, following error is yield:

--8<--
While parsing posting:
 Assets:Bank:Invests:Plan 100.00 EUR =291.00 EUR
  ^^
Error: Balance assertion off by -9.00 EUR (expected to see 200.00 EUR)
--8<--

The following ledger file works:

--8<--

= /^(?:Assets:Bank:Invests:Plan$)/ and not %/^noauto$/ and expr date >=
[2016/01/01]
   $account-1
   $account  0.97
   Expenses:Bank:Invests:Plan0.03


2016/01/31 * Bob
   Assets:Bank:Invests:Plan 100.00 EUR
   Equity:Invests:Plan -100.00 EUR

2016/02/29 * Bob
   Assets:Bank:Invests:Plan 100.00 EUR
   Equity:Invests:Plan-100.00 EUR

2016/03/31 * Bob
   Assets:Bank:Invests:Plan 100.00 EUR = 200.00 EUR   ;; The
assertion is ALSO correct with 100.00 EUR = 300.00 EUR  How can this be
correct?
   Equity:Invests:Plan-100.00 EUR
--8<--

But this is an error since on March 31st the  Assets:Bank:Invests:Plan IS
291,00 EUR not 200 EUR neither 300 EUR.



My assumption is that ledger does the following:
- Read the file
- computes all accounts and run assertion BEFORE and AFTER account is
modified, yield and error if either one or the other assertion failed.
- apply automated xacts.

BTW I use Ledger 3.1.1-20160111, the command-line accounting tool brew
version on macosx.



There is a similar thead on this from February this year. Seems to be a bug:

https://groups.google.com/forum/#!topic/ledger-cli/OHTX8fNkteM

Jostein

--

--- 
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: Automated transaction and account balance assertion

2016-05-03 Thread Sébastien Gross
Hi Jostein,

Yes I tried something like:

--8<--
2016/03/31 * Bob
Assets:Bank:Invests:Plan 100.00 EUR 
Equity:Invests:Plan-100.00 EUR 
--8<--

Event I tried:
--8<--

2016/03/31 * Bob
Assets:Bank:Invests:Plan 100.00 EUR =291.00 EUR
Equity:Invests:Plan-100.00 EUR 
--8<--

But still this does not work, following error is yield:

--8<--
While parsing posting:
  Assets:Bank:Invests:Plan 100.00 EUR =291.00 EUR
   ^^
Error: Balance assertion off by -9.00 EUR (expected to see 200.00 EUR)
--8<--

The following ledger file works:

--8<--

= /^(?:Assets:Bank:Invests:Plan$)/ and not %/^noauto$/ and expr date >= 
[2016/01/01]
$account-1
$account  0.97
Expenses:Bank:Invests:Plan0.03


2016/01/31 * Bob
Assets:Bank:Invests:Plan 100.00 EUR
Equity:Invests:Plan -100.00 EUR

2016/02/29 * Bob
Assets:Bank:Invests:Plan 100.00 EUR
Equity:Invests:Plan-100.00 EUR

2016/03/31 * Bob
Assets:Bank:Invests:Plan 100.00 EUR = 200.00 EUR   ;; The 
assertion is ALSO correct with 100.00 EUR = 300.00 EUR  How can this be 
correct?
Equity:Invests:Plan-100.00 EUR 
--8<-- 

But this is an error since on March 31st the  Assets:Bank:Invests:Plan IS 
291,00 EUR not 200 EUR neither 300 EUR. 



My assumption is that ledger does the following:
- Read the file
- computes all accounts and run assertion BEFORE and AFTER account is 
modified, yield and error if either one or the other assertion failed.
- apply automated xacts.

BTW I use Ledger 3.1.1-20160111, the command-line accounting tool brew 
version on macosx.


S.

-- 

--- 
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: Automated transaction and account balance assertion

2016-05-02 Thread Jostein Berntsen

On 26.04.16,08:08, Sébastien Gross wrote:

Hi,

Every months I put some money (100 EUR) on a saving account. My bank is
charging 3% for that.

My ledger file looks like:

--8<--
#!/usr/bin/env ledger -f

= /^(?:Assets:Bank:Invests:Plan$)/ and not %/^noauto$/ and expr date >=
[2016/01/01]
   $account-1
   $account  0.97
   Expenses:Bank:Invests:Plan0.03


2016/01/31 * Bob
   Assets:Bank:Invests:Plan 100.00 EUR
   Equity:Invests:Plan

2016/02/29 * Bob
   Assets:Bank:Invests:Plan 100.00 EUR
   Equity:Invests:Plan

2016/03/31 * Bob
   Assets:Bank:Invests:Plan 100.00 EUR
   Equity:Invests:Plan

--8<--

The balance is correct:

./automated-bug.ledger bal -E
 291.00 EUR  Assets:Bank:Invests:Plan
-300.00 EUR  Equity:Invests:Plan
   9.00 EUR  Expenses:Bank:Invests:Plan

  0


Now I want to add some assertion to reconcile against my bank statements:

--8<--
2016/04/01 * Check Invest total
   ; ;noauto;
   (Assets:Bank:Invests:Plan) 0 EUR = 291EUR

--8<--

Now it yields:

While parsing posting:
 (Assets:Bank:Invests:Plan) 0 EUR = 291EUR
^^
Error: Balance assertion off by -9.00 EUR (expected to see 300.00 EUR)


It seems that the balance assertion is done BEFORE any of the automated
transaction are done. Is there a way Am I missing something here?



Have you tried entering this like in the manual to check if that works
better?

2012-03-10 KFC
   Expenses:Food$20.00
   Assets:Cash $-20.00 = $500.00


Jostein

--

--- 
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.


Automated transaction and account balance assertion

2016-04-26 Thread Sébastien Gross
Hi,

Every months I put some money (100 EUR) on a saving account. My bank is 
charging 3% for that.

My ledger file looks like:

--8<--
#!/usr/bin/env ledger -f

= /^(?:Assets:Bank:Invests:Plan$)/ and not %/^noauto$/ and expr date >= 
[2016/01/01]
$account-1
$account  0.97
Expenses:Bank:Invests:Plan0.03


2016/01/31 * Bob
Assets:Bank:Invests:Plan 100.00 EUR
Equity:Invests:Plan

2016/02/29 * Bob
Assets:Bank:Invests:Plan 100.00 EUR
Equity:Invests:Plan

2016/03/31 * Bob
Assets:Bank:Invests:Plan 100.00 EUR 
Equity:Invests:Plan

--8<--

The balance is correct:

./automated-bug.ledger bal -E
  291.00 EUR  Assets:Bank:Invests:Plan
 -300.00 EUR  Equity:Invests:Plan
9.00 EUR  Expenses:Bank:Invests:Plan

   0


Now I want to add some assertion to reconcile against my bank statements:

--8<--
2016/04/01 * Check Invest total
; ;noauto;
(Assets:Bank:Invests:Plan) 0 EUR = 291EUR

--8<--

Now it yields:

While parsing posting:
  (Assets:Bank:Invests:Plan) 0 EUR = 291EUR
 ^^
Error: Balance assertion off by -9.00 EUR (expected to see 300.00 EUR)


It seems that the balance assertion is done BEFORE any of the automated 
transaction are done. Is there a way Am I missing something here?

Thanks in advance.

S.

-- 

--- 
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.