Printing an invoice

In this example, a PDF report is used to create an invoice.

Creating a PDF report

1. Create a new PDF report application using the following SQL statement:

SELECT
CustomerID, OrderID, OrderDate, ShipName, ShipAddress,
ShipCity, ShipPostalCode, ShipCountry, PriceOrder
FROM
orders

2. In the PDF Report menu – > Configuration, change the attribute PDF Format to Letter (216 x 279 mm) and in Create Search check yes.

3. Open the Source and Background tab.

4. The Image attribute defines the background image of the report. To select an image, click on the Send icon next to the field. If the desired image is not in the list, it is possible to load a new one by clicking on the second Send icon.

5. The image used in this sample is the same as the one below, save it to your computer and load it to your ScriptCase (right click on the image and click Save Image As).

Creating a Subselect

6. Now create a new field of the Subselection type to display the invoice items. Open the Fields folder 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 order_details table. Change the subselect according to the image below:

10. Change the SQL statement by adding a field called total and a WHERE clause as the image below:

11. Click Save on the ScriptCase toolbar.

Configuring the fields

12. Open the Fields folder in the menu, open order_details and click order_details.ProductID.

13. Open the Lookup tab of the Grid and enter the SQL statement according to the following image:

Editing the position of the fields.

14. Open the PDF Layout item in the menu and click Interface.

15. Now edit the cell position, font family, size, alignment and more. To see more options click on the Send icon.

16. Edit the cells according to the following information:

CellX PositionY PositionFont SizeFont Style
cell_CustomerID16037
cell_OrderID16030
cell_OrderDate16042
cell_ShipName13015014Bold
cell_ShipAddress13015514Bold
cell_ShipCity13016014Bold
cell_ShipPostalCode13016514Bold
cell_ShipCountry13017014Bold
cell_PriceOrder15013514Bold
cell_order_details_ProductID108010
cell_order_details_UnitPrice908010
cell_order_details_Quantity1308010
cell_order_details_Total1558010

Setting up search

17. Open the Search folder in the menu.

18. Select only the OrderID field.

19. Open the Fields folder in the menu and click OrderID.

20. Change the Data Type attribute to Select.

21. Open the Search Search tab and enter the SQL statement according to the following image:

Tutorials in the same category

Tutorial: Grid with modal filter.

This tutorial will show how to configure a query filter to display in a modal window, using the res...

Export Option

To export different types of files we must carry out the following steps: 1 - Create a Grid ...

Integration with WhatsApp

To integrate WhatsApp with ScriptCase, we will be using a specific API called Chat-API, it is a...

Menu with Font-Awesome

For the items in a menu to have icons of the new Font-Awesome functionality and design, do the ...

Comment this post