14.1 Create a PDF template
To create a new template for the PDF Maker module, click on the ADD TEMPLATE key or button on the right and indicate the name for the template and the reference module: the template will be available for the indicated module only. This means that we will find it in the PDF Print options only if it is located in that module. For example, if I create a template to print invitations to contacts, I will only find it inside a registry in the OTHER menu at the top right.
The content of the template is organised into three different sections:
- Body: template body
- Header: repeats on every page
- Page footer: repeats on every page
Within the three areas you can enter:
- Fixed text parts
- Variables: they are replaced with vtenext data when exporting the document in PDF or RTF format
It is possible to insert fixed text inside the Header, Body or Footer by positioning the cursor and starting to write the content:
To insert variables, position the cursor at the point where you want to insert the variable, choose the type of variable to insert from the MODULE item above, and then click on Insert in the template:
The system inserts a variable string that will be replaced with the value assumed by the field when the PDF/RTF is generated:
Once the text has been entered, you can format fixed and variable text using the editor tools.
All the fields on the main module (Module) to which the template has been associated are available in the linked drop-down menu.
It is possible to insert variables on modules related to the main module (Module) also. There are two types of variables:
- modules connected in a 1-to-1 relation with the main module: there is a field within the registry that refers to another vtenext module. Example: in the Quotes form, you will find the Company Name field linking to a company registry.
- blocks connected with modules with 1-to-many relations with the main module: the module item is in the relations menu. Example: in the Quotes module, you can find the Sales Orders block, with numerous orders inside (you can generate a number of orders from one Quote).
Variables in 1-to-1 relations
- a) position the cursor at the point where you want to insert the variable
- b) choose the related module
- c) choose a field to insert
- d) click on Insert in the template
Variables in 1-to-many relations (connected blocks)
- a) move the cursor to the point where you want to insert the variable
- b) click on the Insert button in the template under Related Blocks:
You can now select one of the already existing blocks (check that they refer to the module for which we are building the template) or start the wizard procedure to create a new block through Create Related Blocks:
Click on CREATE A RELATED BLOCK
Choose the fields you want to display (from the left-hand column, using the cursor, shift the fields into the right-hand column)
If appropriate, set a filter to display the desired data (e.g.: all Sales Orders in Approved status)
Refine the table as desired and name the block
Once the configuration is finished, the result will be like the one shown in the figure