emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[A solution of sorts] (was: accounting)


From: Uwe Brauer
Subject: [A solution of sorts] (was: accounting)
Date: Tue, 05 Jan 2021 17:02:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> "UB" == Uwe Brauer <oub@mat.ucm.es> writes:

>> On Monday,  4 Jan 2021 at 21:01, Uwe Brauer wrote:

>> Yes.

>> Sorry I was brief: I cut and pasted something from one of my files while
>> in a rush!

>> Basically, you could do:

>> #+begin_src ledger :cmdline -V --format "%-20A %14T\n" bal --flat assets 
>> 2010/01/01 * Starting balance
>> assets:bank:savings  1300.00
>> income:starting balances
>> 2010/07/22 * Got paid
>> assets:bank:chequing  1000.00
>> income:salary
>> #+end_src

>> and you would get, as output,


> But I rather prefer to have

> |  340 | expenses |                 |               |
> |  170 |          | BigBrother      |               |
> |  150 |          |                 | Jacket        |
> |   20 |          |                 | Shoes         |
> |  170 |          | Brother         |               |
> |  130 |          |                 | BigBrother    |
> |   40 |          |                 | ChristmasTree |
> | -340 | income   |                 |               |
> | -170 |          | BigBrother:Card |               |
> | -170 |          | Brother:Card    |               |
> |      |          |                 |               |
> |------+----------+-----------------+---------------|
> |    0 |          |                 |               |


> Any idea how to achieve this?

Well 10 years ago Eric Schulte posted this 
https://lists.gnu.org/archive/html/emacs-orgmode/2010-08/msg00502.html

#+name: test
#+begin_src ledger 
2010/01/01 * Starting balance
  assets:bank:savings  0
  income:starting balances
2010/07/23 ChristmasTree
  expenses:Brother:ChristmasTree  40.00
  income:Brother:Card
2010/07/24 Jacket
  expenses:BigBrother:Jacket  150.00
  income:BigBrother:Card
2010/07/24 Schuhe
  expenses:BigBrother:Shoes  20
  income:BigBrother:Card
2010/07/23 BigBrother 
  expenses:Brother:BigBrother  130
  income:Brother:Card
#+end_src

#+begin_src emacs-lisp :var ledger=test
  (with-temp-buffer
    (insert ledger)
    (message ledger)
    (org-table-convert-region (point-min) (point-max) 2)
    (org-table-to-lisp))
#+end_src

#+RESULTS:
|                  340 | expenses        |
|                  170 | BigBrother      |
|                  150 | Jacket          |
|                   20 | Shoes           |
|                  170 | Brother         |
|                  130 | BigBrother      |
|                   40 | ChristmasTree   |
|                 -340 | income          |
|                 -170 | BigBrother:Card |
|                 -170 | Brother:Card    |
| -------------------- |                 |
|                    0 |                 |


It is not precisely what I want, but not bad either. If somebody can
come up with a better solution.......




reply via email to

[Prev in Thread] Current Thread [Next in Thread]