Developing Jasper Report Solutions for Opentaps

From Opentaps Wiki
Revision as of 21:25, 22 August 2008 by LeonTorres (talk | contribs) (Development Process Overview)
Jump to navigationJump to search

Overview

In this document we will cover the full development of a Jasper Report solution for opentaps. The goal is to cover enough information so that you can create any kind of report or document desired.

The basis for this tutorial is the customer statement PDF that can be generated in the financials application.

It is generated from the Balances by Customer report in the receivables tab. There are many features built into this particular document, which makes it an ideal candidate for study.

The PDF contains one statement for each party that was selected. Each statement contains the following information,

  1. Customer's billing address (or print not on file)
  2. Company's logo, address, phone number and other contact information
  3. A list of invoices that have open (unpaid) amounts
    1. If the invoice has a due date, then show the number of days since (age date)
  4. All invoice payments made in the 30 days prior to the statement date
    1. If the payment is to an invoice that was already paid off, then display the closed invoice for reference
  5. Total open amount, which must be paid by customer (sum of open amounts)
  6. Date brackets showing how much is past due and when.
    1. If any amount is past due, a large PAST DUE will be displayed on the statement
  7. Layout designed for perforated page with perforation running down the right side
    1. Information repeated on both sides for purposes of customer and return receipt

As you can see, this is a complex set of information that must be further grouped by partyId. We will cover all the steps in creating this document.

Development Process Overview

The first step in the development is to create a Jasper Report (.jrxml) document using JasperSoft iReport. The goal should be to create the basic layout and formatting for the report using mock data.

This section assumes basic familiarity with iReports. You may want to read our introductory tutorial to iReports first.

The Rasper Report document for the customer statements may be found in your opentaps installation,

hot-deploy/financials/webapp/financials/reports/repository/CustomerStatement.jrxml

Creating Mock Data

A basic Jasper Report will use a SQL query to extract a data set for the detail band. In the case of customer statement, the data for the detail band is too complex for a SQL query. Later on we will create a script that will build this report, but for now we can rely on a SQL query that returns an equivalent data set. Our query will simply select data from the Invoice table while grouping the results by the customer partyId.