# Plugin ReportS

## About

The actual version of the plugin contains built-it reports, available after plugin’s activation in menu Reports. These reports may be defined int the plugin itself for kernel data or in other plugins, including Custom with self-written reports.

The plugin provides right now a single built-in report Processes. Beside that reports have the following plugins.

- Invoice

- Subscription

### Setup

Make sure the plugin is enabled in configuration.

Restrict report permissions using standard permissions system.

### Usage

Each report is represented with a separated item in the main menu. On the top placed kernel-related reports, after reports of different plugin. The last item opens old-style JSP Reports.

After choosing a report, it is opened as a separated tool, providing some filters and representation.

Some reports provide diagrams support. They can be chosen using extra button.

Diagrams visualize the actual shown data in graphic forms.

### Development

Reports are implemented with unified Action MVC API. Each report extends Java class org.bgerp.plugin.report.action.ReportActionBase. Source codes of existing reports may be used as examples for development of new.

As an report example you can have a look on the following files which together make built-it Processes report:

- org.bgerp.plugin.report.Plugin

- org.bgerp.plugin.report.action.ReportProcessAction

- webapps/WEB-INF/jspf/user/plugin/report/report/process.jsp

The relationships between the different parts of report are shown in the diagram below.

## JSP Reports

This is a simplified self-developed report system with the following specifics:

- all report logic and view included in a single JSP file

- complex report permissions handling using permission option

- no diagrams supported

### Setup

For each JSP add the following configuration block.

    report:report.<ID>.title=<TITLE>
    report:report.<ID>.jspFile=<jsp>

Where:

- <ID> - unique numeric report’s ID

- <TITLE> - title

- <jsp> - path to JSP file, placed in Custom webapps

Configuration example, using JSP from the default custom GIT.

    report:report.{@inc:cnt}.title=Example JSP Report
    report:report.{@cnt}.jspFile=/WEB-INF/plugin/report/example.jsp

You can find samples of JSP reports here

### Usage

All the JSP reports are shown in a single tool running by Reports / JSP Reports menu item. A needed report has to be selected in the top-placed combo box.

| The example JSP report is not translated to English yet.

### Migration of old JSP reports

As there is no way to declare API used in JSP in deprecated, after updating from old app versions you may find your reports broken. Here are the typical replacement patterns for making them running again.

OLD | NEW
--- | ---
openUrlToParent( formUrl( this.form ), $(this.form) ) | $$.ajax.load(this, $(this.form).parent())
u:parseDate | tu.parse
u:formatDate | tu.format
fn:substringAfter | su.substringAfter
u:getFirst | u.getFirst
u:toString | u.toString

This migration mainly comes down to replacing calls of no more supported JSP functions to method calls of objects, similar like for Standard JEXL Context.