Hello -- first time posting here.

I am trying to understand unexpected behavior of a combination of virtual 
transactions with balance assignments. The use-case is using virtual 
accounts to hold 'envelope budgets' as has been described by various people 
<http://plaintextaccounting.org/#budgeting>. I want to reset the budget 
account (a virtual account Assets:Budgets:Groceries) using a balance 
assignment at the beginning of the month; I want however much is required 
to achieve the new balance to be moved from another account. However, the 
balance is always off. Here's a minimal example:

2017/01/01 * Opening Balance
    Assets:Checking                      $100
    Equity:OpeningBalances


;match Grocery transactions from Budget
= /Expenses:Groceries/
    * [Assets:Budgets:Groceries]              -1.0
    * [Assets:Checking]                        1.0


2017/01/01 * Budgeting for January 2017
    [Assets:Checking]
    [Assets:Budgets:Groceries]           $50

2017/01/02 * groceries
    Assets:Checking                      $-30
    Expenses:Groceries


2017/01/25 * Salary
    Assets:Checking                     $100
    Income:Salary

2017/02/01 * Budgeting for February 2017
    [Assets:Checking]
    [Assets:Budgets:Groceries]        $20 = $50

Note that the final transaction asserts that after adding $20 to the 
Groceries budget, it should equal $50 -- which Ledger agrees it does. 
However, the balance report says it's $40, which is also what I get adding 
it up by hand:

~> ledger -f journal.txt bal
                $170  Assets
                 $40    Budgets:Groceries
                $130    Checking
               $-100  Equity:OpeningBalances
                 $30  Expenses:Groceries
               $-100  Income:Salary
--------------------
                   0

That's the first thing I don't understand. The second: if I change that 
last transaction to be:

2017/02/01 * Budgeting for February 2017
    [Assets:Checking]
    [Assets:Budgets:Groceries]        = $40

then the balance report says:
~> ledger -f journal.txt bal
                $170  Assets
                 $10    Budgets:Groceries
                $160    Checking
               $-100  Equity:OpeningBalances
                 $30  Expenses:Groceries
               $-100  Income:Salary
--------------------
                   0

My understanding of the documentation is that this assertion transaction 
should set the balance to $40. Why is it then being reported as $10, with 
the Checking account as $160? I would expect it to be $40 and $130.

I've tried everything I can think of, but I can't figure out what I'm doing 
wrong. The documentation seems pretty clear. What do I not understand about 
virtual transactions, balance assignments, or the combination of the two? 
I'm using ledger 3.1

Thanks,
Hans




-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to