Gnucash reports using php and mysql

Pedro Abel pedroabel at gmail.com
Wed Dec 21 07:12:15 EST 2011


Hello Christian,

Thanks for the comments.

Yes, the php code accesses the data directly from the MySql database. But
the code does not modify the data through the php, only read it (only
selects, no drop, alter or anything like that).

Everything that I did is in the zip file attached. To make it run, you
should change the first lines of the functions.php. I run it on a Ubuntu
11.10, with Apache 2, PHP 5 and MySql 5. I translated everything from
Portuguese to send it to you, but maybe something is still on Portuguese.

There are 4 reports, but there are some issues:
- the reports do not work well if any account does not have a code, as the
code is used to sort;
- the cashflow report is not working correctly yet, as the initial balance
of the selected accounts are not right. It also do not have an option to
select the accounts (it should have, but I did not make it yet as I change
it when I need directly in the php code);
- the balance sheet and the trial balance do not have an option to change
the dates we want to check (same thing with the accounts in the cashflow. I
change it directly in the php code when I need).

It will be nice to have your comments.

Best regards,

Pedro

On Wed, Dec 21, 2011 at 6:18 AM, Christian Stimming
<christian at cstimming.de>wrote:

> Dear Pedro,
>
> thanks for sharing your experience with gnucash so far.
>
> Do I understand correctly: You are storing your gnucash data in a MySQL
> database, and you have written PHP code that accesses that MySQL database
> to show some reports? This would be an interesting other usage of the
> gnucash data.
>
> It does not (yet) fit into the way the developers intended to use the
> data, as we still strongly recommend to access the gnucash data only
> through the C API of gnucash instead of directly reading from the SQL
> database or XML file.
>
> On the other hand, this is Open Source and you're free to do what you want
> with your data. :-)
>
> I guess it would be interesting to send your php code here as an
> attachment, or put it somewhere on the web (e.g. on github.com) so that
> others can have a look.
>
> Best Regards,
>
> Christian
>
>
> Zitat von Pedro Abel <pedroabel at gmail.com>:
>
>  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
>> ______________________________**_________________
>> gnucash-devel mailing list
>> gnucash-devel at gnucash.org
>> https://lists.gnucash.org/**mailman/listinfo/gnucash-devel<https://lists.gnucash.org/mailman/listinfo/gnucash-devel>
>>
>>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gnucashreports.zip
Type: application/zip
Size: 22044 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20111221/a4fc32a9/attachment.zip>


More information about the gnucash-devel mailing list