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.
1. BASE_DESIGN:
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".
2. BASE_WEB:
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.

Comments

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…

கிறுக்கனின் கிறுக்கல்கள் - அழுகையின் சிறப்பு

அழுகை என்பதை வெறுத்தவன் நான்... என்னை ஒரு நாள் பிரிந்திருக்க முடியாமல் , கைப்பேசியில் நீ சிந்திய உன் கண்ணீர் ஓசை என் காதில் கேட்கும் வரை...

பின்குறிப்பு: கிறுக்கனின் கிறுக்கல்கள் எங்கிருந்தோ தழுவப்பட்டது போல் தோன்றினால் கிறுக்கன் ( நான் உண்மையை ஏற்றுக்கொள்பவன்..:) ) பொறுப்பல்ல. கிறுக்கனின் கிறுக்கல்களில் வரும் கிறுக்கல்கள் யாவும் என் சிறய மூளையில் உதித்ததே ஆகும்.  Inspirations could have been drawn from somewhere else, but its the execution that counts....Isn't it ?