Hi
I am not sure whether this is the right place to ask this, but anyhow.
I don't really use ledger, I use emacs org mode, that allows me via its
babel extension to connect to ledger and perform certain very simple
operations.
Be it as it may, I have a conceptual question, that I explain using the
following example.
Suppose two friends want to buy Christmas presents, but when they have
finished, they want to have spent the same amount of money. If they
don't a compensation must be transferred.
Here is an example
** Start
#+name: presents
#+begin_src ledger
2010/01/01 * Starting balance
assets:bank:savings 0
income:starting balances
2021/12/01 User1:Jacket
expenses:User1:Jacket 80
income:User1:creditcard1
2010/07/24 User1:Pajama
expenses:User1:Pajama 30
income:User1:creditcard1
2010/07/23 User2:Flowers
expenses:User2:Flowers 20
income:User2:creditcard2
2010/07/23 User2:ChristmasTree
expenses:User2:ChristmasTree 40.00
income:User2:creditcard2
#+end_src
#+RESULTS: presents
#+begin_example
170 expenses
110 User1
80 Jacket
30 Pajama
60 User2
40 ChristmasTree
20 Flowers
-170 income
-110 User1:creditcard1
-60 User2:creditcard2
--------------------
0
#+end_example
So user1 spent 110, while user2 spent 60
** Compensation manually
So the compensation is (trivally)
that is org's version of a spreadsheet.
| User1 | User2 | User2-->Uwer1 |
|-------+-------+---------------|
| 110 | 60 | -25 |
#+TBLFM: $3=($2-$1)/2;f2
Leading to
#+name: compensated
#+begin_src ledger
2010/01/01 * Starting balance
assets:bank:savings 0
income:starting balances
2021/12/01 User1:Jacket
expenses:User1:Jacket 80
income:User1:creditcard1
2010/07/24 User1:Pajama
expenses:User1:Pajama 30
income:User1:creditcard1
2010/07/23 User2:Flowers
expenses:User2:Flowers 20
income:User2:creditcard2
2010/07/23 User2:ChristmasTree
expenses:User2:ChristmasTree 40.00
income:User2:creditcard2
2010/07/23 User2:User1-Compensation
expenses:User2:User1-Compensation 25.00
expenses:User1:User1-Compensation
#+end_src
#+RESULTS: compensated
#+begin_example
170 expenses
85 User1
80 Jacket
30 Pajama
-25 User1-Compensation
85 User2
40 ChristmasTree
20 Flowers
25 User1-Compensation
-170 income
-110 User1:creditcard1
-60 User2:creditcard2
--------------------
0
#+end_example
The question is can this be done automatically?
By this I mean
can
2010/07/23 User2:User1-Compensation
expenses:User2:User1-Compensation 25.00
expenses:User1:User1-Compensation
Somehow be generated automatically?
Regards
Uwe Brauer
--
---
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/875yr7fjo5.fsf%40mat.ucm.es.