virtual postings balance against real postings
Given journal
2022/04/07 test
Real1 $10
Real2 $-10
[Fake1] $-10
Run a bal report and get no warning that the virtual posting is unbalanced, and also no balance of Fake1 at all. It seems to ignore the unbalanced transaction entirely.
PS C:\Users\user\ledger> ./ledger -f test.journal bal
$10 Real1
$-10 Real2
--------------------
0
I'm very new to ledger so it is possible I do not understand how this works. But in my main journal I have more complicated entries like the below, where I had an unbalanced virtual posting. It's off by .02, but I totally missed it because bal reports never warned me I had an out of balance situation.
4/1 Paycheck
Assets:Fairwinds $1198.07
Income:Paycheck
[Equity:Budget] $-1198.07
[Budget:Fairwinds:General Funds] $333.06
[Budget:Fairwinds:Mortgage Hold] $865.03 ; This should have been 865.01 and transaction is out of balance
I'm running the FullofQuarks Binary
PS C:\Users\user\ledger> ./ledger --version
Ledger 3.2.1-20200518, the command-line accounting tool
hey @JesseFL , I spotted you transaction missing an extra space after the last posting
2022/04/07 test
Real1 $10
Real2 $-10
- [Fake1] $-10
+ [Fake1] $-10
after this
$ ledger b
While parsing file "/home/zanona/tmp/finances/.ledger", line 8:
While balancing transaction from "/home/zanona/tmp/finances/.ledger", lines 5-8:
> 2022/04/07 test
> Real1 $10
> Real2 $-10
> [Fake1] $-10
Unbalanced remainder is:
$-10
Amount to balance against:
$10
Error: Transaction does not balance
Try to make sure to always align your costs to the right like the below to avoid these issues:
2022/04/07 test
Real1 $10
Real2 $-10
[Fake1] $-10
In regard to your other example, perhaps run ledger register to understand what is happening with the balance?
Perhaps that can help?
$ ledger r
22-Apr-01 Paycheck Assets:Fairwinds $1198.07 $1198.07
Income:Paycheck $-1198.09 $-0.02
[Equity:Budget] $-1198.07 $-1198.09
[B:Fairwinds:General Funds] $333.06 $-865.03
[B:Fairwinds:Mortgage Hold] $865.03 0
Thank you for pointing out my lack of spacing; that is definitely a new user issue.
However, my paycheck example still looks like something is wrong. The register shows that the .02 difference is going to Income:Paycheck, but shouldn't that be impossible? How can a virtual posting balance to a real account? I thought virtual postings are "fake money" and not part of the double-entry accounting system. I ran bal --real and now I have an out-of-balance condition for the whole journal. This should be throwing a warning, but it does not.
PS C:\Users\user\ledger> ./ledger -f test.journal bal --real
$1198.07 Assets:Fairwinds
$-1198.09 Income:Paycheck
--------------------
$-0.02
I don't believe real accounts should be affected by virtual postings, ever...even if the transaction is being elided. Unless I'm not understanding something here again, which is entirely possible haha.
In the meantime I am going to stop using the eliding feature and manually input the offsetting accounts. When I input $-1198.07 for Income:Paycheck, ledger started accurately warning me of the unbalanced condition. So this is not that big of a deal, now that I know how to correctly use it.
The register shows that the .02 difference is going to
That sounds weird. Do you have an example?
My main paycheck example does it
4/1 Paycheck
Assets:Fairwinds $1198.07
Income:Paycheck
[Equity:Budget] $-1198.07
[Budget:Fairwinds:General Funds] $333.06
[Budget:Fairwinds:Mortgage Hold] $865.03 ; This should have been 865.01 and transaction is out of balance
Hey, @JesseFL please have a look at the difference between virtual postings
Just quoting the docs:
To specify a virtual account, surround the account name with parentheses:
2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash (Budget:Food) $-20.00
If you want, you can state that virtual postings should balance against one or more other virtual postings by using brackets (which look “harder”) rather than parentheses:
2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash [Budget:Food] $-20.00 [Equity:Budgets] $20.00
Basically this means that, if you don't want to alter the balances, use a virtual posting surrounded by parenthesis, otherwise brackets. Also, when you use a parenthesis virtual posting, you don't need to balance out with anything else, so don't need to worry about eliding (for that posting, that is).
$ ledger r
22-Apr-01 Paycheck Assets:Fairwinds $1198.07 $1198.07
Income:Paycheck $-1198.07 0
(Equity:Budget) $-1198.07 $-1198.07
(B:Fairwinds:General Funds) $333.06 $-865.01
(B:Fairwinds:Mortgage Hold) $865.03 $0.02
$ ledger r -R
22-Apr-01 Paycheck Assets:Fairwinds $1198.07 $1198.07
Income:Paycheck $-1198.07 0
Furthermore, note that AFAIK, it's completely normal to hold a negative balanced account. The only restriction is that each transaction needs to be balanced out evenly (in = out)
I don't use virtual postings, but this looks like a major flaw to me. I don't think virtual postings should balance against real postings.
The docs say "If you want, you can state that virtual postings should balance against one or more other virtual postings by using brackets". So virtual postings should balance against each other, not against real postings.
@zanona you haven't identified the problem correctly.
The problem is this, which should never happen:
ledger -f d bal --real -B master
$1198.07 Assets:Fairwinds
$-1198.09 Income:Paycheck
--------------------
$-0.02