Tutorial: 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:

CustomerID, OrderID, OrderDate, ShipName, ShipAddress,
ShipCity, ShipPostalCode, ShipCountry, PriceOrder

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 Enviar beside the field. If the image desired is not listed it is possible to upload a new one clicking in the second icon Enviar.

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 Enviar .

18. Edit the cells according with the information below:

Cell X Position Y Position Font Size Font Style
cell_CustomerID 160 37
cell_OrderID 160 30
cell_OrderDate 160 42
cell_ShipName 130 150 14 Bold
cell_ShipAddress 130 155 14 Bold
cell_ShipCity 130 160 14 Bold
cell_ShipPostalCode 130 165 14 Bold
cell_ShipCountry 130 170 14 Bold
cell_PriceOrder 150 135 14 Bold
cell_order_details_ProductID 10 80 10
cell_order_details_UnitPrice 90 80 10
cell_order_details_Quantity 130 80 10
cell_order_details_Total 155 80 10

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:

Tutorials in the same category

Printing a business card

This example demonstrates how to create a PDF Report to display several business card in the same pa...

Comment this post