Done
Pinned fields
Click on the next to a field label to start pinning.
Details
Details
Assignee
Chongsun Ahn
Chongsun AhnReporter
Josh Zamor
Josh Zamor(Deactivated)Labels
Story Points
8
Original estimate
5h
Time tracking
Components
Sprint
None
Fix versions
Priority
Time Assistant
Time Assistant
Created January 4, 2017 at 9:09 PM
Updated February 2, 2017 at 1:57 PM
Resolved February 2, 2017 at 11:27 AM
This is to copy/re-build the reporting extension done to Jasper Reports in OpenLMIS v1. However, it has eventually turned into building the basic version of the built-in reporting framework.
The outline of this functionality includes:
Reports define a property named "selectSql" in a report parameter. e.g. this month parameter
The code that saves the jrxml (and compiles to .jasper) will need to save that SQL: https://github.com/OpenLMIS/open-lmis/blob/2fae5c3fc2fc8397915bbafecf5619d42cb09df2/modules/reporting/src/main/java/org/openlmis/reporting/service/TemplateService.java#L138
We'll need a way to run that sql in the selectSql: https://github.com/OpenLMIS/open-lmis/blob/2fae5c3fc2fc8397915bbafecf5619d42cb09df2/modules/reporting/src/main/java/org/openlmis/reporting/repository/mapper/TemplateMapper.java#L88
The angular page will need to understand the list of values for this parameter of the report and create a select box: https://github.com/OpenLMIS/open-lmis/blob/2fae5c3fc2fc8397915bbafecf5619d42cb09df2/modules/openlmis-web/src/main/webapp/public/pages/report/partials/view.html#L70
This report can use SQL to access each service's schema directly (it does not need to call HTTP/S endpoints to get the data from each service).
Please ask if you have any questions about this ticket.
You can use the sample XML here (https://github.com/OpenLMIS/openlmis-requisition/blob/master/sample/OpenLMISv3-Requisitions.jrxml) to upload a report template.
Acceptance Criteria
There should be new rights in the system, REPORTS_VIEW and REPORT_TEMPLATES_EDIT.
The demo administrator user should have these rights via a "Reporting Personnel" role.
The view requisition report template endpoint (/api/reports/templates/requisitions/id) should now return a selectValues property for each templateParameter.
This property should be an array of strings and should reflect the results if the selectSql property was run against the database.
There should be a new endpoint (/api/reports/templates/requisitions/id/format) that can generate reports for an existing report template. (Format options are pdf, csv, xls, html)
The Reference UI should have a new report tab with a "View reports" link for any user with the REPORTS_VIEW right. (administrator has this right, devadmin or admin do not.)
This link goes to the View Reports page.
The View Reports page shows all requisition reports in the system.
This page is only viewable by someone with the REPORTS_VIEW right.
Clicking on the report name goes to the Choose Report Options page for that report.
The Choose Report Options page shows options defined in the report.
This page is only viewable by someone with the REPORTS_VIEW right.
Clicking on a format button (PDF, CSV, XLS, HTML) will open a new tab with the report in that format.
The report generated should vary based on the options chosen.
Any user without the REPORT_TEMPLATES_EDIT right should not be able to use the following endpoints:
POST /api/reports/templates/requisitions
PUT /api/reports/templates/requisitions/id
DELETE /api/reports/templates/requisitions/id
Any user without the REPORTS_VIEW right should not be able to use the following endpoints:
GET /api/reports/templates/requisitions
GET /api/reports/templates/requisitions/id
GET /api/reports/templates/requisitions/id/format