Gnucash reports using php and mysql

Donald Allen donaldcallen at gmail.com
Wed Dec 21 10:10:39 EST 2011


On Tue, Dec 20, 2011 at 5:11 PM, Pedro Abel <pedroabel at gmail.com> wrote:
> Hello friends, greetings from Brazil,
>
> My name is Pedro and this is the first time I send an e-mail to this list.
>
> First, thank you all for such a great software. I'm using it for years.
>
> I was wondering if anyone is working on some reports for Gnucash not using
> of the standard language (Scheme) Gnucash reports uses right now. I'm
> asking that because since there is the mysql option I started writing some
> custom reports for my personal finances using PHP. Nothing really new, just
> the same reports in a way that I prefer to see it (basically with each
> period organized into columns, for comparison, and with a quick way to
> group the values in broader periods, like quarters and years). The PHP also
> allow me to check my reports quickly from any other computer in my network.
>
> So, I would like to know if someone is doing the same, and maybe share some
> codes.
>
> If you want, I could send to list what I have so far (does this list
> accepts attachments?). If so, please do not expect nothing exactly good, as
> I'm not really a programmer. I'm just a regular user that wanted some
> custom reports and decided to do what I need instead of bothering you with
> requests.
>
> Best regards,
>
> Pedro

Pedro --

A few years ago, I did something similar, though at the time, the
gnucash database option was not available. My motivation was the same
as yours -- I could not get what I wanted from the built-in reports
and I felt that the cost of trying to learn to work within gnucash (in
spite of the fact that I am a *very* experienced Scheme programmer)
was higher than the approach I took. I wrote a python program that
processes the gnucash xml file (the python library xml parser was very
useful for this). The program produces reports and charts by
generating latex and gnuplot files. It has served me well. While I now
do use the database capability (postgres), I have not yet taken the
time to convert my program to query the database rather than parsing
the xml file.

Christian's response about using the C API makes sense to me if you
are modifying your gnucash data with an external program. Writing to
the database without using gnucash as an intermediary is a great way
to corrupt your data. But, if you restrict yourself to read-only
access to the data, then corruption is not an issue (I would still be
careful to back up your data in case you make an error and write to
the database accidentally -- unlikely, but possible). Then it becomes
a matter of which requires less effort on your part to get what you
want. I chose the same route you took on this basis. I'd suggest
having a look at an interesting thread, "Scripting API", on
gnucash-devel started by Hendrik Boom in November. It discusses
similar issues and the subject of the fairly new python bindings
capability comes up, something I have not investigated myself (only
because I already have something that serves my purpose, developed
before the python bindings capability became available) but is
probably worth looking at if you are actively developing reports for
yourself.

/Don Allen


> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel


More information about the gnucash-devel mailing list