Invoice Using Subreport
Create an invoice with a subreport using the DynamicPDF Designer.
In this sample you create a invoice containing a subreport to display the invoice's line items.
Sample Project
The Subreport Blog
project is available from the DynamicPDF Portal Samples in the File Manager.
The project consists of the following four files.
order-invoice.dlex
order-invoice.json
acmegroceries.png
NorthwindLogo.gif
Refer to the following for more information on the File Manager and on adding sample projects.
Sample Description
The sample consist of a Report where all the information is contained in the Body rather than the Header or Footer. The Body also has a SubReport which contains the Products
.
The JSON data consist of the invoice data and an array of products (Products
).
{
"RemitName": "Test Co.",
"RemitAddress": "999 Nowhere Drive",
"RemitCity": "Northwoods",
"RemitState": "MD",
"RemitZip": "99999",
"Phone": "(000) 000-0000",
"Fax": "(000) 000-0000",
"Email":"support@dynamicpdf.com",
"CustomerLogo": "acmegroceries.png",
"CustomerName": "Acme Groceries",
"CustomerAddress": "9999 Nowhere Ln",
"CustomerCity": "Northwoods",
"CustomerState": "MD",
"CustomerZip": "99999",
"InvoiceNumber": "9999999-A9",
"ShipToName": "John Doe",
"ShipToAddress": "9999 Nowhere Ln",
"ShipToCity": "Northwoods",
"ShipToState": "MD",
"ShipToZip": "99999",
"CustomerNumber": "11111-1111",
"Note": "This month only, join our mailing list for 5% discount.",
"Note2": " Sign up TODAY to receive invoices by email",
"StateTax": 25.65,
"LocalTax": 7.81,
"ShipVia": "PICK UP",
"DateShipped": "9/09/21",
"DueDate": "10/10/21",
"DynamicPdfLogo":"https://www.dynamicpdf.com/images/logo.png",
"Products":
[
{
"ProductID": 1,
"ProductName": "Chai",
"QuantityPerUnit": "10 boxes x 20 bags",
"UnitPrice": 18,
"Quantity":4,
"Discontinued": false
},
{
"ProductID": 2,
"ProductName": "Chang",
"QuantityPerUnit": "24 - 12 oz bottles",
"UnitPrice": 19,
"Quantity":5,
"Discontinued": false
},
---snip---
The finished invoice is two pages and displays the invoice data and the product line items.
More Information
For more information on using Designer refer to one of our many tutorials and the Users Guide documentation. Also refer to the Designer Examples documentation page in the Users Guide for numerous examples illustrating Designer's capabilities. Our blog also has numerous tips and tricks for using Designer.