Custom Report Example - Total Contributions By Envelope Report
This example creates a report that shows the total contributions to each fund by envelope number. It uses data from the Contributions module. The report contains two nested groups of records. It groups records first by Envelope Number and then by Contribution Fund. It includes a summary total for each fund, a subtotal by envelope, and a grand total at the end of the report.
The first task in this example is to create the query. The following procedure gives the details. Subsequent procedures show how to add subtotals, a grand total, and a report title.
To create the report query:
- Create a new query for the Contributions module. Select Custom Reports from the Contributions menu and choose the Posted option. Give the new query the title "Total Amount Given to Each Fund by Envelope."
- Create the filter condition. Choose Contribution Date as the field and Between Two Dates as the operator. For the Contribution Date range, select Ask Later. This option prompts you for a date range every time you select the query.
- Choose the output fields. On the Query List Manager, choose the new query and click Select. On the Select Fields to Show in Query window, choose the following fields: Envelope Number, Envelope Name, Contribution Fund Number, Contribution Fund Desc, and Contribution Amount.
- Group and summarize. On the Select Fields to Show in Query window, choose two group fields and one summary field:
- Choose Envelope Number, click Group, select Group Records First By This Field, and click Done.
- Choose Contribution Fund Number, click Group, select Group Records Second By This Field, and click Done.
- Choose Contribution Amount, click Group, select Sum This Field For Each Group, and click Done.
- Specify the sort order. Select Edit Sort Order on the Query Overview window. Choose the following sort fields: Profile Last Name, Profile First Name, Envelope Number, Contribution Fund Number. This example sorts records alphabetically using a method similar to the previous example, the "Contributions Over $250" report. The additions of Envelope Number and Contribution Fund Number are for the groups defined in the previous step. After sorting the output alphabetically, the groups are sorted by Envelope Number and then Fund Number.
The next task is to group the records on the report by Envelope Number and add a subtotal.
To group by Envelope Number and add a subtotal:
- On the Query Overview window, click Pick Output Type.
- On the Type of Output dialog box, choose Detail/Summary Report and click Edit.
- From the Group 1st by list, choose Envelope Number.
- Click the Step 2: Pick Summary Field tab.
- From the Summarize the Field list, choose Contribution Amount.
- Click the Sum button.
- Click Done, and then Done again.
The next step is to add a grand total at the end of the report. You work on the Report Designer for this step.
To add a grand total:
- On the Query Overview window, click Run Query. You see a prompt asking for the Contribution Date range. Enter a range of dates.
- If a preview window appears, close it.
- On the Report Setup dialog box, click Edit Form.
- Add a Summary band. Choose Properties from the Report menu, then click the Optional Bands tab. Check the Report Has Summary Band option and click OK.
- Insert the sum_amount field into the Summary band. Use the Copy and Paste functions on the Edit menu. First, select the sum_amount field in the Detail band (not the Group Footer band). Then choose Copy, then Paste, and then drag the field into the Summary band.
- Specify the summary type for the sum_amount field. Double-click the sum_amount object in the Summary band to display the Field Properties window. Click the Calculate tab and select Sum in the Calculation Type field. Also, select Report from the Reset Based On field.
- Add the label "Grand Total" next to the summary field. Use the Label tool to add this object. You can display the label in boldface text by selecting it and choosing the Font option from the Format menu.
The next task will look familiar if you worked through the report to print contributions over $250. The following procedure shows how to suppress duplicate records from the report. The result is that each name and envelope number appear only once.
To suppress repeated values:
- On the Report Designer window, double-click the field env_no.
- On the Field Properties dialog box, click the Print When tab.
- Choose No under Print Repeated Values.
- Click OK to return to the Report Designer.
- Repeat steps 1 through 3 for the env_name field.
- On the Print When tab of the Field Properties dialog box, in the Also Print section, check When This Group Changes. Notice that the field env_no appears in the list to the right of this option. You used the envelope number field to define a group in an earlier procedure.
- Click OK to return to the Report Designer. The purpose of these steps is to show how duplicate names are handled if different envelopes have the same name.
The final task for this report is to clean it up a bit and add a title.
To create a professional looking report:
- Delete the Fund Number field and header description. This field appears in the output for sorting purposes, but it isn't necessary in the final report. To delete the field, choose the Select tool, click fund_no, and press Delete. Repeat the process with the Fund text object.
- Move the desc field and the Desc text object to the left. Click and drag them one at a time. They should be at about the 4" mark on the ruler bar.
- Change the wording of the headers.
- Change Env. No. to Envelope.
- Change Desc to Fund Description.
- Change Amt to Amount.
- Widen the env_name and desc fields. Choose the Select tool and then click one of the objects. Drag its right handle to widen the field. Each field should be long enough so that the corresponding data won't be truncated in the report.
- Add a church name to the Page Header band as a title. First, create some extra space by dragging the bottom edge of the page header band downward. Next, drag the existing header titles to the bottom of the report band. Then use the Label tool to add the church name to the top of the band above the header titles. To center the title within the band, choose Align from the Format menu and select the Center Horizontal option. Use the Font command on the Format menu to display the header in 18-point bold face italic text.
To change a text object, select the Label tool and then click the object. You can edit the object while it is selected.
Note that you could create a separate Title band in step 5 instead of using the header band. However, the contents of the Title band appear just once at the start of the report. The Page Header contents appear on every page.
You're finally ready to print the report. On the Report Designer, choose Save from the File menu. Then exit the Report Designer and click Start Report on the Report Setup dialog box. The following illustration shows how the report should look.
PCPlus V 7, PCPlus V 8, PCPlus V 8.5, PCPlus V 9, PCPlus V 10/10.4, PCPlus V 11/11.1, PCPlus V 11.5/11.55, PowerChurch Online
Last updated: 04/08/2015