Add group totals and a grand total
Group the lines of a document, print a subtotal after each group and a grand total at the end. The example groups the items of an Invoice by material group.
Before you begin
- Open the designer from a saved invoice, on a template you may change. See Design an advanced report.
- The template must already list the invoice items in the Detail band, with the fields of the "Bill Items" table of the field list (such as
Material_Name,QuantityandTotal_ic). The "Bill" table has aTotal_ictoo: take the one of "Bill Items" for the totals of this page. See Field list and data binding.
Steps
Group the items
- Open the Group and Sort panel.
- Click Add a Group and choose the field
Group_Name(of the "Bill Items" table). The group header and footer bands are created for it. - Tick Show Footer for the group, so the Group Footer band exists.
- Move the label that shows
Group_Nameto the Group Header band.
Total each group
- Add a label to the Group Footer band, under the column of totals.
- In the Expressions tab of the Properties panel, set the Text expression to
sumSum([Total_ic]). The function totals the values of its summary region. - In the Properties panel, set Summary Running to the group, so the label totals only its own group.
Total the report
-
Add a label to the Report Footer band, in the same column.
-
Set its Text expression to
sumSum([Total_ic])and its Summary Running to the report. -
Format both labels as the other amounts. For example
ToPrice(sumSum([Total_ic])). See Formatting values. -
Click the Preview tab, then click Save.
Result
After the last item of each material group, a line shows the total of that group, such as 1,250.00 for the group Beverages. After the last group, the report footer shows the total of all items. The values are the sums of the Total_ic column of the items. Nothing changes in accounts or stock.
If something goes wrong
| Situation | Why it happens | What to do |
|---|---|---|
| Every group shows the same total. | Summary Running is not set to the group. | Select the label and set Summary Running again. |
| Groups are split in an odd order. | The items are not sorted by the group field. | In Group and Sort, check that the group sorts by Group_Name. |
| The grand total differs from the invoice total. | The invoice total also holds discounts and extras. | Total the items only, or print GrandTotal_ic from the "Bill" table. |
Related
This page applies to alameen ERP 10, version 10.1.79.764.