To pass a value from a subreport to its parent, the parent must first have a variable to get the value. In your case, the main report should contain 4 variables, one for presentPayable, presentPayment, balance and totalCost.
Then you need to add the returnValue element to the subreport element of the main report. This element maps the variable to a subreport of the variable in this report using the subreportVariable and toVariable .
To do this in iReport, click on your sub-register item in the main report. In the list of properties, click Return Values. A dialog should appear. Click the Add button. Enter the subreport variable name and select the variable in this report that you want to transfer. You must leave the calculation type as "Nothing", which will instruct jasper to simply rewrite the variable with a new value. Click OK to add this, and then repeat for other variables / subscriptions.
Now, when you run the report, every time the sub-register finishes processing, the current value of the variable in the sub message returns to the specified variable in the main report.
To use this value in another subreport, you need to pass the variable from the main report to another subreport as a parameter. This has two parts: adding the subreportParameter element to the subreport element in the parent report and adding parameter to the subreport itself.
In iReport, click on the item of your sub-register in the main report. In the list of properties, click "Options." In the dialog that appears, click the Add button. Give the parameter a name (for example, presentPayable) and enter a value expression that references the variable in your main report (for example, $V{presentPayable} ). Repeat this for each of the variables you want to pass.
Then open your report. In the report inspector, right-click Options. Select Add Parameter, and then rename the new parameter according to the name you entered in the previous step.
In the subtitle, you can now refer to these values, as well as to any other parameter (for example, $P{presentPayable} ).