Jump to content
Changes to the Jaspersoft community edition download ×

Calculating "Grand Total" on invoice report

2004 IR Help

Recommended Posts

By: CaptnTony - captntony

Calculating "Grand Total" on invoice report

2005-10-17 07:21

I have a master report with 2 Group bands (Site and Circuit). The detail section contains 5 subreports. Each of these subreports calculate an 'amtDue' based on their subset of charges for each of the site's circuits. The master Report has 5 variables defined (amtDue1, amtDue2...amtDue5) which houses each corresponding subreport's amtDue Total.


Goal 1: provide a sub-total of the amount due for each circuit within a site.

Solution 1: Create a Circuit Footer band and insert a textbox (TextBox_3) that .add()s each of the amtDueX variables.


Goal 2: provide a sub-total for each of the sites within a customer (ulitmately use the same method to calculate the 'grand total due' from a customer).

Solution 2: >> ? <<


I've tried to create a variable that would SUM TextBox_3 (no luck), but cannot find a way to do that. I tried to create a variable that is calculated on a Report basis rather than Group basis that .add()s the amtDueX values (no luck).


I'm wondering if I have to create a variable in the master report that uses a System type calculation and the expression might be something that can increment another variable (something like x += amtDue1.add(amtDue2)...)


Any ideas would be greatly appreciated. If I can't print grand totals on an invoice I'm stuck and will have to look for other alternative report engines.


I've had experience with ActiveReports and was able to specify an action that occurs before/after the printing of each of the band. That was perfect for something like this (before band report header set 'variable1' to 0. After each detail band add the sub-totals returned to variable1. Then assign variable one to a textbox in the report footer...done.


Maybe I could make a request to add this sort of functionality to JasperReports. Just an idea.



Thanks in addvance.







By: Lucian Chirita - lucianc

RE: Calculating "Grand Total" on invoice repo

2005-10-17 09:32



You can do this: create 5 more variables siteAmdDueX having Site as reset group and for each of the 5 subreports add one more return value for the same subreport variable, siteAmdDueX and Sum calculation.


Then, in the Site group header (with group evaluation) or footer create a text field where you do add()...








By: CaptnTony - captntony

RE: Calculating "Grand Total" on invoice report

2005-10-17 09:51

Thank you! I will give that a try now. I was just playing with the 'Returning Values from Subreport Trick'. Too new to java and JR to really make much sense of it.





By: CaptnTony - captntony

RE: Calculating "Grand Total" on invoice report

2005-10-17 10:13

Thank you VERY MUCH! That did the trick.


I do appreciate the quick response.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...