Report generator pxp nd - kplian/pxp-nd GitHub Wiki

Report generator pxp-nd

All files are located at:

https://github.com/kplian/pxp-nd/tree/main/packages/core/src/lib/reports

image

  1. This file contains the necessary functions to generate the report, extract the information from the database data, generate titles and headers, generate and extract filters. It also contains the functions for consult information of the groups of reports and of each report.
  2. File that contains common functions that will or will be used in different files.
  3. File that contains functions to generate reports in a table in PDF format.
  4. Routes file, contains the necessary endpoints that allow generating the reports.
  5. File that contains functions to generate reports in a table in XLSX format.

Note: The Report and ReportGroup entities are part of the reports, they are located in @pxp-nd/common.

Tables: The report generator depends on the tpar_report and tpar_report_group tables.

tpar_report_group:

image

table Description
title Descriptive title of the report group
allow_roles Array containing the ids of the allowed roles
active Flag to activate or not the group of reports

tpar_report_group:

image

table Description
name Descriptive name of the report group
query Raw query that returns the report data
allow_roles Array containing the ids of the allowed roles
detail_query Raw query that returns the detail data of a report
template HTML template to generate the report
filters Configuration object to generate the filter form
config Configuration object to generate the report grid
order Report number order
report_group_id Primary key of the group to which the report belongs
active Flag to activate or not the report

Important: The component used to generate the grid in the frontend and the configuration objects in the tables are strictly oriented to the PxpForm component.

PXP-UI

All files are located at:

https://github.com/kplian/pxp-ui (Missing specify current location)

image

  1. Component that generates the list of groups and Reports.

image

  1. Component that shows and hides the filter form.

image

  1. Main container, which groups the components to generate the desktop and mobile view for the reports.

image

Desktop View

image

View on a mobile device

  1. Shows the report list of each group.

image

  1. Component that allows managing a master detail view.
  2. Component that generates a table to display the data of each report.

image

  1. Main component that allows changing the type of report view to be generated. (Grid, Graphic, Html, etc). Currently only the type Grid is available.

Use in a PXP-ND project

  1. Install the @pxp-nd/common dependency. 2.In the App.ts file it is necessary to define the Report and ReportGroup entities from @pxp-nd/common

image

image

  1. In the config.ts file activate the reports flag, this enables the necessary routes:

image

It is important to also have the entities declared this configuration, you can import all the entities or only Report and ReportGroup:

image

image

  1. Declare the entities (Report, ReportGroup) in the file connection configuration ormconfig.js

image

image

Note: If your project requires it, you only need to define the Report and ReportGroup entities.

entites: { Report, ReportGroup },

# Usage in the current PXP-UI version:

  1. Install the @pxp-ui/common dependency
  2. It is necessary to create a page or view, which will act as the container for the reports.
  3. In the page created above, import the Reports component from @pxp-ui/common

image

  1. Finally you can use in component is your view

image

This should generate a view similar to the following:

image