Printing an invoice
In this sample a PDF Report is used to create an invoice.
Creating a PDF Report
1. Create a new PDF Report application using the SQL statement below:
2. In the menu PDF Report -> Settings, change the attribute PDF Format to Letter (216 x 279 mm) and in the Search Create check yes.
3. Open the tab Font and Background.
4. The attribute Image defines the report's background image. To select an image, click on the icon beside the field. If the image desired is not listed it is possible to upload a new one clicking in the second icon .
5. The image used in this sample is the same image as that one below, save to your computer and do the upload to your ScriptCase (right click on the image and click on Save image as).
Creating a Subselect
6. Now create a new field of the type Subselect to display the invoice's items. Open the folder Fields in the menu and click on New Field.
7. Enter 1 in quantity and click Next.
8. Choose Subselect type, enter order_details in Name and click Create.
9. Change Increment to 5. Choose the connection and then choose the table order_details. Change Subselect according to the image below:
10. Change the SQL statement adding a field named total and a WHERE Clause like the image below:
11. click on Save on ScriptCase's toolbar.
Setting up the fields
12. Open the folder Fields in the menu, open order_details and click on order_details.ProductID.
13. Open the tab Grid Lookup and enter the SQL statement according to the image below:
14. click on the field ShipCountry on the menu. Go to the tab Grid Lookup and change the Lookup Method to Manual.
15. In the attribute Load lookup definitions select Countries.
Editing the fields position
16. Open the item Layout PDF on the menu and click on Interface.
17. Now edit the cell position, font-family, size, alignment and more. To see more options click on the icon .
18. Edit the cells according with the information below:
Setting up the search
19. Open the folder Search in the menu and click on Select Fields.
20. Select only the field OrderID.
21. Open the folder Fields in the menu and click on OrderID.
22. Change the attribute Data Type to Select.
23. Open the tab Search Lookup and enter the SQL statement according to the image below: