Can Subreport Solve this Issue

0

Hi,

I have a scenario below.

I need to print an Invoice together with an acknowledgement letter. (Seperate for each customer)

 

Sample data

Customer                  Invoice             Date                 Amount

A1                               INV001            01/01/2010     1000

A2                               INV002            03/02/2010      2000

A1                               INV003            03/02/2010      1500

 

Ineed to print as below

Acknowledgement (first Page)

Customer : A1

INV            Date                   Amount

INV001     01/01/2010       1000

INV003     03/02/2010        1500

                                                2500

after this need to print the above invoices (001 and 003) on seperate pages (page 2 and 3)

 

Acknowledgement (Page 4)

Customer : A2

INV            Date                   Amount

INV002     03/02/2010       2000

                                               2000

after this need to print the above invoice (002) on next page(page 5)

 

SO in total the file should be in 5 pages.

 

Can someone help..? Can subreports do this?

susobh.sugathan's picture
Joined: Mar 30 2015 - 11:12pm
Last seen: 4 years 10 months ago

2 Answers:

1

You do not need to use sub report to produce the report as per your design requirement. Please take a look at this wiki article for a sample report based on your requirement:

http://community.jaspersoft.com/wiki/sample-report-using-one-report-temp...

 

tchen's picture
57761
Joined: Feb 27 2008 - 7:33am
Last seen: 8 hours 41 min ago

Awsome one. Thanks A Lot...

susobh.sugathan - 4 years 10 months ago
0

Yes this can be done with JasperReport with 1 page and the help of 1 table and 1 subreport.

Main query (dataset):

Here you should make a query and GROUP BY Customer. This way it returns X (is amount of customers) record, and the whole report is repeated X times.

Table on first page:       

You have to define table on the first page. As parameter you should send the 'Customer' and then make a query for that tables that returns all the invoices of that parameter (Customer).

 

If you preview now, you'll see page 1 and page 4 (from your example)

Subreport on second page

Now you place a subreport on the second page. As parameter you give it 'Customer' as well, and you could use the same query: it returns the report as many times as there are records in teh result.

 

Good luck with it

gert_1's picture
210
Joined: Aug 7 2014 - 12:25am
Last seen: 4 years 3 months ago
Feedback