Average Monthly Expenses Report/Chart?

Christian Stimming stimming@tuhh.de
Fri, 22 Feb 2002 21:09:19 +0100


On Monday 11 February 2002 16:21, Chris Ingram wrote:
> My question is: How does everyone else generate reports and pie charts
> containing such average monthly expenses dollar amounts?  Is this
> currently possible?  

It is not possible currently. If I want to have averages, I open one expense 
piechart for the whole period, take my HP-48 (calculator) and calculate the 
result "by hand".

>However, there don't appear to be options to
> select the start date for the P&L report as "Start of previous month
> minus X" where X is could be 12 or 3 (or any other number of months I
> choose).

No, there is no such option at the moment. If you want to add these to the 
dropdown multi-choice list by yourself, you can do so relatively easily 
(provided you are willing to take the Scheme challenge). Changes in two files 
are required: In date-utilities.scm, you need to add a function to calculate 
the right relative date (just follow e.g.  gnc:get-start-prev-month). 
Additionally, this relative date option has to be added to the big lists in 
the function gnc:reldate-initialize, just the other examples. One more file 
change and you're done: In the file options-utilities.scm,  add the new date 
option to the lists in the functions gnc:options-add-report-date! and  
gnc:options-add-date-interval! . That's it, no more changes in any report 
code is required.

> Should I look into modifying the existing P&L report and Expense
> Piechart to have a "show average monthly dollars instead of total
> dollars" checkbox?  Where would I start looking to do such a thing?  

Just a rough hint: Dividing the amounts in the expense piecharts by some 
value (e.g. the number of months) would need to take place in file 
account-piecharts.scm line 249-250. The function collector->double returns a 
double value which can be divided by the number of months. To create an 
option choice box for this, follow the example for e.g. the show-total option 
in that file.  To get the number of months you can use the function 
gnc:timepair-get-month  and gnc:timepair-get-year from date-utilities.scm. 

If you have further questions, don't hesitate to ask and we'll try to assist 
you in your requests as quickly as possible. Thanks for your ideas.

Version: GnuPG v1.0.5 (GNU/Linux)
Comment: For info see http://www.gnupg.org