@node Reports, User Preferences, Register, Top
@chapter Reports
@cindex Reports

@strong{This whole document is completely outdated. Don't read this. All
function names and every described structure has changed
completely. Only read this if you want to know how gnucash looked like
in 1999. This is completely outdated!}

The reporting infrastructure is designed facilitate the creation
of sophisticated reports including tables, graphs, and hyperlinks.
The infrastructure includes functionality to support the following:

@itemize

@item
Creation of tables, with headings, subheadings, totals, and subtotals.

@item
Formatting of dates & numbers.

@item
Currency conversions.

@item
Creation of graphs such as pie and bar charts.

@item
Creation of hyperlinks to other reports and to other GnuCash
objects such as registers.

@end itemize

@menu
* Creating a Report::           
@end menu


@node Creating a Report,  , Reports, Reports
@section Creating a Report

To define a report, your report must have 

@code{(gnc:support <your_report_name>)}

and should have

@code{(gnc:depend "report-utilities.scm")}

as well as

@code{(gnc:depend "report-html.scm")}
 
if you wish to use the html generation facilities. You should
avoid creating HTML directly wherever possible.

To autoload your report, you should add the line @code{(gnc:depend
<your_report_name>)} to the file @file{src/scm/report/report-list.scm}.

@code{(gnc:depend "date-utilities.scm")}

has lots of date-manipulation functions you'll almost certainly need.

To define a report, you call @code{(gnc:define-report)}. This function
can accept a variable number of arguments, but at the moment four
distinct arguments are recognised, as in the following from
the transaction report:

@example
  (gnc:define-report
   'version 1
   'name (N_ "Transaction Report")
   'options-generator trep-options-generator
   'renderer trep-renderer)
@end example

@table @code

@item version
This is the version number of the report, which is currently ignored.

@item name
This is the name of the report. It should be marked as translatable,
but the name should be given in untranslated form, hence the use of
@code{(N_ )}.

@item options-generator
This should be a function that takes no arguments and returns an options
structure with the options for the report. The options interface is
currently not fully documented, but should be.

@item renderer
This is the function which renders the HTML.

@end table
