Reports
*******

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

  * Creation of tables, with headings, subheadings, totals, and subtotals.

  * Formatting of dates & numbers.

  * Currency conversions.

  * Create of graphs such as pie and bar charts.

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

Creating a Report
=================

To define a report, your report must have

(gnc:support <your_report_name>)

and should have

(gnc:depend "report-utilities.scm")

as well as

(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 (gnc:depend <your_report_name>) to the file src/scm/report/report-list.scm.

(gnc:depend "date-utilities.scm")

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

To define a report, you call (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:

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

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

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 (N_ ).

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.

renderer
     This is the function which renders the HTML.