Skip to main content

Sub reports in Openbravo

Report is one of the key USP for any ERP application. The more enhanced and flexible the reports are, more happy is the customer. In Openbravo, jasper reports provides us the flexibility to handle all this. iReport is one  tool that can be used to create jasper reports. I have provided a simple example of how to add sub-report for an Openbravo Report using iReport.
Main Report:
Assume we have created a main report with the following query and layout.
Adding Sub Report:
The Sub Report can be created by adding the sub report icon as follows.
The sub-report can be added by drag and dropping the highlighted portion in the above screen shot. It will open the sub report wizard.
The sub report can be created in any one of the following three ways. Each way has different number of configuration steps.
1. A new sub report can be created using the wizard by using the "Create a new Report" Option. This will ask for all the options needed to create a new report including the report query. This will go through all the 7 steps.
The Sub Report expression can be any one of the following two options.
1. Through SUBREPORT_DIR Parameter
This will create a parameter SUBREPORT_DIR in Main Report. We have to point this parameter to the folder containing the sub report.
2. Through absolute path.
2. We can also call a already existing report as a sub report. This can be done by "Use an existing Report"  option. We have to provide the path of the existing report. This will directly go to step 6 skipping the steps before that.
3. The last option will just create a blank sub report.
Adding Parameter:
In the Report Properties window, there is an option called parameter. This option enables us to add the parameter for that particular report.
Any number of parameters can be provided to the report through this option.
Sub Report Query:
Note that you can see the parameter in the available parameters list in the above screen shot. We can also add the parameter through the "New Parameter" button in the above screen shot.
Importing Report in Openbravo:
For importing the report into openbravo,  the jrxml files should be placed inside your module. For instance, if your module is XYZ with the Java Package com.fugoconsulting.XYZ, then the jrxml file should be inside the folder modules/com.fugoconsulting.XYZ/src/com/fugoconsulting/XYZ/erpReports/.  Before importing the report into openbravo, we need to give the relative path for the sub-report and the images that  we have added. This will make the report work in all systems irrespective of the path of the report. In order to give relative path, you need to add the following two parameters in main report.
This parameter will be resolved at run time and will be pointing to your module folder(In our case modules/com.fugoconsulting.XYZ/src). The sub report expression must be modified as follows. This can be modified using the property "Sub report Expression".
This parameter will be resolved to point the web folder at run time. This parameter is used to give the relative path for images. The sub report expression must be modified as follows.
Registering in Reports and Process:
Create menu and compile the application. The output will be,
For creating charts using iReport refer here.


Popular posts from this blog

My 10 years in Application Development

It's been around 10 years since I started programming. May be a bit more, if I have to include my first attempts at C programming in school. But it would be a grave insult to call remembering ten lines of code and just replicating it to put a star on the screen. I also did a course on Visual basic, but it was more gimmicks that Application development. But it was truly in the year 2007 when I started my Master in Computer Applications that I found a new flare for developing applications. 
I was very late to computers in general and even when I joined my Masters, computers were not really accessible to me. But when I joined my Masters where one is actually expected to hone the skills which they already have, but in case it was were I was learning the skills, initially it was very difficult. I was not sure what computers had for me nor I had a natural flair for programming. But the thing about computers that attracted me was the visual medium it gave. Initially it was just a door t…

Changing Timezone in Postgresql, Ubuntu

Timezone and locale are integral concepts that one should be aware of when implementing a System. For example. if you create a database in PostgreSql, it will use the default System settings for the database. Lets say you have a server in UK and your client is US. If the client tries to retrieve the current date or time, it is going to show the UK time and not the US one.
Today I encountered a different issue in our client place where the Ubuntu timezone and PostgreSql timezone were showing a incorrect values. Instead of Indian Standard Time (IST) it was showing Pacific Daylight Time(PDT). These are the steps that I followed to change the timezone to IST in PostgreSql and Ubuntu.
Changing timezone in Ubuntu:
sudo dpkg-reconfigure tzdataYou will be prompted to choose the continent and then the area. Provided screen shots where we configure the location.
Use TAB key to navigate to the OK button and then press Enter.

The changes will get reflected immediately. To check it you can open a n…

Dissecting Openbravo 3.0 UI Architecture

Having been worked on Openbravo 3.0 UI for more than a year now (right from RC1) , Openbravo has leaped ahead of most contemporary ERP's in terms of UX design and usability. And a part of the credit has to go to the community too as they were actively involved in finalizing the UX and also involved enthusiastically in tested out the RC versions and providing their feedback.

In this post, I have tried to draw limelight on the basic UI components that are being used in Openbravo and their corresponding smartclient components. This is just to provide a very high level idea on how the entire architecture is coupled together. I have tried to use a single screen shot of Openbravo interface and tried to map the base components here.

The hierarchy can be visualized in simple terms as follows:

Exhaustive information on these components are provided in the Openbravo Wiki here.

Most of these components are defined and managed from individual files (or code) thereby making it really easy to …