Creating and Using Report Templates
Overview
Report template is used to generated PDF reports using data from an order. This feature is useful to generate end of order report for auditing, or even to generate a certificate of analysis.
When generating a PDF report we can incorporate any data from activities that were submitted, including pictures, and we have the ability to format the report to our liking.
The process of creating a report template is split into two steps.
First we filter the data that is relevant to this report, which activities are to be read and displayed and which order attribute should be listed.
Then we work on a HTML template. This HTML Template is what allows you to format the final PDF the way you need, adding your company logo, fonts and colours.
This guide details the process for creating and managing report templates within our system, focusing on producing PDF reports through various configurations and customisations.
Accessing and Creating a Report Template
Navigate to Settings > Configuration > Report Template to go to the configuration page.
Creating a Report Template
Click on the Create button, then you should be presented with a modal with three fields like the image below.
Name | Desc |
---|---|
Name | Name of the Report Template |
Description | Description of the template |
Data type | The type of the report |
For this example, we will make a Order Report of type ORDER. After filling out the details, click on Save and Open.
You should then presented with this template configuration page. Have a read through the table with the fields explanation and then proceed to the example walkthrough
Name | Desc |
---|---|
Name* | The name of the report |
Description | Description of the Report |
Data type* | ORDER or EVENT or ACTIVITY |
Asset Classes | The option to choose what Asset classes will be included in the report. |
HTML Template | Choose to create a new HTML template or an existing one (if there is one). This will be our main area of configuration. |
Include Attributes | The option to choose which attributes will be included in the report. |
Include Activities | The option to choose which activities will be included in the report. |
Include Operations | The option to choose which order template operations, will be included in the report. Note: this must be written in a comma separated list. |
Include Images | The checkbox option to include images in your report. |
Here I will choose to create a new HTML template and name it "Order Report".
Then I chose the other configurations like below. It depends on what you want included in the report yourself. After that we can start editing our HTML below.
Utilize the HTML editor to begin designing your report. This is where you can format and lay out your report. We use a templating engine called Mustache, which allows dynamic data insertion using curly braces, e.g., {{order.order_number}}
.
To make the editing process easier, you can simulate the form with an actual order by scrolling down to the bottom of the page and click "Select and Order".
Then you will be presented with three views.
The Preview HTML view shows you what the HTML you have on the editor will render in one scroll in the page.
The Preview PDF will render a PDF file that is formatted with your HTML and this file can be saved and viewed in pages.
The Order Data will show you what data is available based on not just the chosen preview order but also the data from all the assets, attributes and activities that you had chosen before. This can be utilized to figure out how to write your data insertion.
Creating an Order Report
Now after creating your template, go back to the Homepage, then click on Orders. Choose any Order then click on Details. Next to the name there is a little button with a printer icon.
Here if you have more than one templates, more than one will pop up, but "Order Template" is the one we just made.
Afterwards, a dialogue will pop up like below that will let you download the report.
Last updated