emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: Org-Babel and Ledger
Date: Thu, 29 Jul 2010 11:40:57 +0200	[thread overview]
Message-ID: <87eiemsk0m.fsf@mundaneum.com> (raw)

Hello,

I'm trying to really begin working with Ledger for my personal accounting.
Of course, trying to do it with as much Org as possible...

Though, results of 3 small requests (whose results is snipped, for brievety)
is the following:

--8<---------------cut here---------------start------------->8---
#+TITLE:     Scorpios-Ledger
#+LANGUAGE:  en_US

* Balance

#+srcname: bal
#+begin_src sh
ledger -f scorpios-ledger.dat bal
#+end_src

#+results: bal
|             -1117.47 | EUR | Assets:Bank             |
|              1036.15 | EUR | Checking:FR04304429459  |
|              -631.62 | EUR | Savings:FR00307599427   |
|              -1522.0 | EUR | Transferred             |
|             -2036.52 | EUR | Expenses                |
|                20.25 | EUR | Bank:Charges            |
|               175.09 | EUR | Insurance:House         |
|              -2838.1 | EUR | Unknown                 |
|               606.24 | EUR | Utilities:Electricity   |
|              3153.99 | EUR | Liabilities:Loans:Cecaz |
| -------------------- |     |                         |
|                 -0.0 | EUR |                         |

* Registry

#+srcname: reg
#+begin_src sh
ledger -f scorpios-ledger.dat reg unknown
#+end_src

#+results: reg
| 2009/08/21 | CHEQUE   | :           | 9953055          | Expenses:Unknown | 166.7            |              EUR | 166.7    |      EUR |          |     |
| 2009/09/17 | CHEQUE   | :           | 7691785          | Expenses:Unknown | 100.0            |              EUR | 266.7    |      EUR |          |     |
| 2009/10/16 | REMISE   | CHEQUE      | N                | 86..             | Expenses:Unknown |           -525.0 | EUR      |   -258.3 | EUR      |     |
| 2009/11/06 | CHEQUE   | :           | 7691786          | Expenses:Unknown | 192.0            |              EUR | -66.3    |      EUR |          |     |
| 2009/11/24 | CHEQUE   | :           | 7691787          | Expenses:Unknown | 833.0            |              EUR | 766.7    |      EUR |          |     |
| 2009/11/25 | REMISE   | CHEQUE      | N                | 92..             | Expenses:Unknown |           -970.0 | EUR      |   -203.3 | EUR      |     |
| 2009/12/31 | INTERETS | CAPITALISES | Expenses:Unknown | -8.48            | EUR              |          -211.78 | EUR      |          |          |     |
| 2010/01/05 | CHEQUE   | :           | 7691789          | Expenses:Unknown | 733.0            |              EUR | 521.22   |      EUR |          |     |
| 2010/01/05 | REMISE   | CHEQUE      | N                | 93..             | Expenses:Unknown |           -525.0 | EUR      |    -3.78 | EUR      |     |
| 2010/01/14 | REMISE   | CHEQUE      | N                | 98..             | Expenses:Unknown |           -525.0 | EUR      |  -528.78 | EUR      |     |
| 2010/01/16 | FRAIS    | PRELEVEMENT | ..               | Expenses:Unknown | 10.73            |              EUR | -518.05  |      EUR |          |     |

* Reporting monthly expenses

#+srcname: monthly-exp
#+begin_src sh
ledger -f scorpios-ledger.dat -M reg ^expenses
#+end_src

#+results: monthly-exp
| 2009/08/01         |        0 | 2009/08/31 | Expenses:Bank:Charges | 3.05  | EUR |     3.05 | EUR |
| Expenses:Unknown   |    166.7 | EUR        |                169.75 | EUR   |     |          |     |
| 2009/09/01         |        0 | 2009/09/30 | Expenses:Bank:Charges | 1.1   | EUR |   170.85 | EUR |
| Ex:Insurance:House |     15.9 | EUR        |                186.75 | EUR   |     |          |     |
| Expenses:Unknown   |    100.0 | EUR        |                286.75 | EUR   |     |          |     |
| 2009/10/01         |        0 | 2009/10/31 | Expenses:Bank:Charges | 5.85  | EUR |    292.6 | EUR |
| Ex:Insurance:House |     15.9 | EUR        |                 308.5 | EUR   |     |          |     |
| Expenses:Unknown   |   -525.0 | EUR        |                -216.5 | EUR   |     |          |     |
| Ex:Ut:Electricity  |    28.38 | EUR        |               -188.12 | EUR   |     |          |     |
| 2009/11/01         |        0 | 2009/11/30 | Expenses:Bank:Charges | 1.1   | EUR |  -187.02 | EUR |
| Ex:Insurance:House |     15.9 | EUR        |               -171.12 | EUR   |     |          |     |
| Expenses:Unknown   |     55.0 | EUR        |               -116.12 | EUR   |     |          |     |
--8<---------------cut here---------------end--------------->8---

As you can see, the tables are completely wrongly made, because they're based
on spaces ("à la Awk") and not on fixed position of fields ("à la Cut").

What can I do about this?

- Post-process every ledger command with some awk or cut command that will do
  whatever is needed

- Exploit the CSV export format (never tried, don't have Ledger 3 installed
  yet -- and I'm also using hledger...)

- Other ideas?

Do you have suggestions about the best way to go?

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2010-07-29  9:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29  9:40 Sébastien Vauban [this message]
2010-07-29 16:33 ` Eric Abrahamsen
2010-07-30 20:47   ` Eric Schulte
2010-08-12 11:45     ` Sébastien Vauban
2010-08-12 22:57       ` Eric Schulte
2010-08-13  9:23         ` Sébastien Vauban
2010-08-13 11:33           ` Sébastien Vauban
2010-08-13 17:41             ` Eric Schulte
2010-08-13 19:04               ` Sébastien Vauban

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=87eiemsk0m.fsf@mundaneum.com \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
    --subject='Re: Org-Babel and Ledger' \
    /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

Code repositories for project(s) associated with this 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).