emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-Babel and Ledger
@ 2010-07-29  9:40 Sébastien Vauban
  2010-07-29 16:33 ` Eric Abrahamsen
  0 siblings, 1 reply; 9+ messages in thread
From: Sébastien Vauban @ 2010-07-29  9:40 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-08-13 19:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-29  9:40 Org-Babel and Ledger Sébastien Vauban
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

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).