Here is my module for reportsPage class (attached).
It produces the above image.
Reports are generated as PDF and output to the PDF viewer (which is cool).
Of course, you won't be able to run this code exact since it relies on my tables to fetch data, but it will show you how to make it work for yourself and give you some ideas...