Up to this point, we have created the basic structure of our management – it will be up to you to enter the fields and calculations you deem necessary for your work.
In this chapter, we’ll see how to create a print to associate with the orders in order to print them and send them to our customers in pdf format.
The program allows you to create an infinite number of prints that can be linked to a data table in order to have, for example, prints in several languages or prints that can only be used by certain types of users according to their permissions.
Let's enter the Options and go to the Print page. Open the file menu and select New Print.
The program will display the window for selecting the table that will be used to create the print and for our example we will choose Orders.
The Nios4 prints are composed of five sections. Each section is added to the print being processed.
- The Report Start section shows all the elements that will be inserted at the beginning of the print only on the first page.
- The Page Start section shows all the items that will be included in the print at the beginning of each page, except for the first one.
- The Detail is the section that will be repeated according to the number of rows of data to be printed. In this section the lines of our order will be inserted and as long as there are lines to print the Detail section will be created and added to the final print. In case there are no more rows of data the program, it will continue to add the Detail section without data to get to the end of the current page and allow you to attach the end of the report, where necessary.
- The Page End section shows all the elements that will be inserted before the print starts again with the Start of Page section. This section is used when the document consists of at least two pages. This way the End of Page section will be inserted at the end of the first page and the End of Report section at the end of the second.
- The Report End section shows all the elements that will be inserted at the end of the last page of the print.
If, for example, the print was only one page, the program would insert the Report Start section and then automatically the Detail sections, reporting the data, so that the Report End section can be inserted at the end of the page.
All the elements must be enclosed in a table for the proper functioning of the print. Then place the cursor inside the Detail section and right-click on the menu. Open the Insert submenu and choose the table.
Let's set the number of columns to 5 and the number of rows to 1: inside each column will be inserted a field of the orders_rows table. Clicking OK should let us see a table inserted inside the Detail section.
Now place the cursor inside the first cell on the left and select from the list of fields the code found under the item orders_rows.
Proceed to insert in the other cells “Description”, “Qty”, “Price” and “Total price”. The writing between the symbols of major identify the name of the field. When the program makes the final print, it will replace the field with its actual value.
Now insert a table with only one cell inside the Start report section and inside we will insert the Customer field that is under the item Orders.
Then, insert a table, again with only one cell, in the Report End section and insert the Total Price field which is always under Orders.
Save and we have our print ready.
Now all you have to do to test it is create a test order, insert articles and send the print.
As you can see, the program will generate the print by entering the fields of our order and repeating the detail until the end of the page.