Hi,
sorry it took a while.
Am Dienstag, den 04.01.2022, 11:11 +0100 schrieb Uwe Brauer:
> So I understand that using the solution below, in particular:
>
> $account -1.0
>
> Means that I only use one account which is a bit contrary to the idea
> of double-entry accounting?
Ah, not exactly. First, automated transaction rules apply to
*postings*, i.e., the individual rows of transactions. So the automated
transaction
```
= expr account =~ /Liabilities:User2$/
$account -1.0
Income:User2 (amount-roundto(0.5*amount, 0))
Liabilities:User1-from-User2 (roundto(0.5*amount, 0))
```
matches postings where the account "Liabilities:User2" is used. Then
the line `$account -1.0` means "add the negative of the involved
amount (the -1.0 multiple) to the same account". You can actually check
that with `ledger reg`:
For the input
```
2021-12-05=2021-12-07 User2
expenses:Flowers 20 EUR
Liabilities:User2
```
the `ledger reg` output is
```
21-Dec-05 User2 expenses:Flowers 20 EUR 20 EUR
Liabilities:User2 -20 EUR 0
Liabilities:User2 20 EUR 20 EUR
Income:User2 -10 EUR 10 EUR
Liabi:User1-from-User2 -10 EUR 0
```
so `$account -1.0` effectively removes the matched posting, but you
have to add other postings with the same value sum in order to balance.
> I wounder that this common situation is so hm difficult to achieve
I am no accountant, a lot of the vocabulary around accounting is
foreign to me, and I guess it doesn't help that the way of doing things
is closely coupled to each country's legislation; so take everything I
write with a bucket of salt.
However, my understanding of double-entry accounting is that it is
usually used to manage finances of *one* entity. There is an inherently
one-sided view of writing things down, credit and debit flip meaning
(or sign) once you view from the other side. I am not sure how well
this way of writing things down works when you want to describe a
"global state" of things, rather than the view from one single entity.
This is what I meant when I said "somewhat contrary to the idea of
double-entry accounting".
I think in my first attempt to address this,
```
= expr account =~ /Liabilities:[a-zA-z0-9]*$/ and aux_date >= [2020/05]
$account -1.0
$account:from User1 (roundto(0.6*amount, 0))
$account:from User2 (amount-roundto(0.6*amount, 0))
```
the entity that I am implicitly modelling is a virtual "shared wallet",
so I have income from one user, I have expenses, and the wallet is also
somehow responsible for keeping track of how each expense distributes
across participants. (This would be similar to apps like Kittysplit <
https://www.kittysplit.com/en/> where each expense of one user is split
between participants and then settled at the end. Note that settling
expenses is not a trivial problem once more than two players are
involved, cf. <https://stackoverflow.com/q/877728/3663881>)
You could also model this from the perspective of one of the involved
users. Rather than keeping the expense as a whole and splitting the
income side of things in automated transactions so that it becomes
something like
```
2021-12-05 Flowers
Expenses:Flowers 20 EUR
Income:User1 -10 EUR
Liabilities:User1-from-User2 -10 EUR
```
or the like, you would note things purely from the view of User1:
```
2021-12-05 Flowers (paid by me)
Expenses:Flowers 10 EUR ; this is only half the price
Liabilities:User2 10 EUR ; this is the other half
Assets:Cash -20 EUR ; this is what went out of your wallet
2021-12-05 Christmas Tree (paid by User2)
Expenses:Tree 70 EUR ; this is only half the price
Liabilities:User2 -70 EUR ; namely, your share
```
Even though in the global view of things, flowers for 20 EUR and a tree
for 140 EUR were bought, in your expenses account only your share of
things ever shows up, not the total price. I think this may be much
simpler, but you don't have the total overview of what was paid or
whether a credit card was used by User2 etc. You could still try to
write automated transactions so that your ledger file contains all that
information and is just transformed into the simple shape above.
Hope that helps
Tobias
--
---
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ledger-cli/6133e987b314149394ba25565ed521dec0f58936.camel%40web.de.