emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: [A solution of sorts] (was: accounting)
Date: Tue, 05 Jan 2021 17:02:13 +0100	[thread overview]
Message-ID: <87sg7f1iey.fsf_-_@mat.ucm.es> (raw)
In-Reply-To: 878s972y8l.fsf@mat.ucm.es

>>> "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	other threads:[~2021-01-05 16:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04  8:54 accounting Uwe Brauer
2021-01-04  9:31 ` accounting Eric S Fraga
2021-01-04 10:19 ` accounting Dr. Arne Babenhauserheide
2021-01-04 12:43   ` accounting Uwe Brauer
2021-01-04 14:00     ` accounting Eric S Fraga
2021-01-04 20:01       ` accounting Uwe Brauer
     [not found]         ` <87r1mzkb7u.fsf@disroot.org>
2021-01-05 15:35           ` accounting Uwe Brauer
2021-01-05 16:02             ` Uwe Brauer [this message]
2021-01-05 16:09               ` [A solution of sorts] Eric S Fraga
2021-01-06 17:02                 ` Uwe Brauer
2021-01-05 16:03             ` accounting Eric S Fraga
2021-01-06  2:49               ` accounting Ihor Radchenko
2021-01-04 11:13 ` accounting Daniele Nicolodi
2021-01-04 20:04   ` accounting Uwe Brauer
2021-01-04 21:17     ` accounting Samuel Wales
2021-01-05  0:08     ` accounting Daniele Nicolodi
2021-01-05  7:50       ` accounting Uwe Brauer
2021-01-04 12:52 ` accounting Charles Millar
2021-01-05 15:44   ` accounting Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sg7f1iey.fsf_-_@mat.ucm.es \
    --to=oub@mat.ucm.es \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).