Tobias Pfeiffer
unread,Oct 13, 2019, 12:46:42 AM10/13/19Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ledge...@googlegroups.com
Hi,
I have a fairly long history of transactions in my ledger files and I
would like to generate some pretty reports from this data. Think a one-
page PDF (or HTML) file that opens with a sentence like "this month's
revenue was X, expenses were Y, P% higher than average" and then has
some charts about, say, distribution of expenses, historical data,
comparison with forecast data.
I guess many people on this list have a similar thing running already,
so I would like to hear about recommendations with respect to
toolchain, libraries, etc. that you are using.
Currently I have an emacs org-mode file and use babel to get the ledger
output, as follows:
```
#+TITLE: Financial Report
#+PROPERTY: header-args :results output :exports results :cache true
#+PROPERTY: header-args+ :var F="-f all.ledger" :var MONTH="sep 2019"
#+BEGIN_HTML
<link rel="stylesheet" href="web/graphs.js" />
#+END_HTML
#+BEGIN_SRC sh
PARAMS="${F} --effective -p ${MONTH}"
ledger balance $PARAMS Expenses
#+END_SRC
```
Then the HTML export contains a <pre> block with the ledger output and
my script in `web/graphs.js` parses it and creates some charts.
It somehow works that way, but I don't think it's a very nice pipeline.
It's all very tightly coupled and seems fairly fragile, I need to parse
the output of ledger in JavaScript, the application logic to compute
averages etc. is also in JavaScript, there are a lot of components
involved (which makes it hard to debug), and still it is not simple to
generate a simple sentence like "this month's revenue was X".
If anyone has any suggestions or can point at tools suited for that
purpose, please let me know.
Thanks
Tobias