In the balance sheet report, we created a formula called Amount that was used in calculating the sub-total for each account. This formula used Table A-1 to determine whether a balance should be positive or negative based upon the account type and whether it was a debit or credit. The same rules that apply for a balance sheet apply for the income statement. We are just going to copy that same formula to this report.
- In the Field Explorer window, right-click the Formula Fields category and select New.
- For the formula name, enter Amount.
- In the Formula Workshop window, enter the following formula:
if {Account_Type.Account Type} = "Asset" Then
if {Journal_Entry.Debit Or Credit} = "Debit" Then
{Journal_Entry.Amount}
Else
{Journal_Entry.Amount} * -1
Else
if {Journal_Entry.Debit Or Credit} = "Credit" Then
{Journal_Entry.Amount}
Else
{Journal_Entry.Amount} * -1
- Click the Save and Close button to check for errors and save your changes.
- The bottom half of this formula is really the only portion necessary for the income statement because it handles the revenue and expense accounts. The first half of the formula handles assets which only appear on the balance sheet. I’m using the same formula on both reports for consistency purposes, as well as, making sure that it stays compliant with the rules in Table A-1.
- Drag and drop the {@Amount} formula onto the Details section of the report. Even though the Details section is suppressed and the {@Amount} balance won’t be displayed, this makes it easy for us to add sub-totals to the group footers.
- Delete the Amount column header that Crystal Reports added to the report automatically when you dropped the formula onto the report.
- Right-click on the {@Amount} formula in the Details section and select Insert > Summary.
- On the Insert Summary dialog box, click the Summary Location drop down box and choose Group #3.
- Click the OK button to save your changes and insert the summary field into group #3.
- Click on the summary field and turn off the bold formatting so that the font matches the group #3 field.
- Right-click on the {@Amount} formula in the Details section and select Insert > Summary.
- On the Insert Summary dialog box, click the Summary Location drop down box and choose Group #2.
- Click the OK button to save your changes and insert the summary field into group #2.
- Click on the summary field and turn off the bold formatting so that the font matches the group #2 field.
- For the report sections (e.g. Gross Margin, Operating Income, etc.), we can’t add a summary field to the group footer because the balances are not sub-totals of the accounts within that section. Instead, each section balance is a running total of all the balances that came before it. We need to add a running total field and put it in the group footer for the section group.
- Right-click on the {@Amount} field in the Details section and select Insert > Running Total. This opens the Create Running Total Field dialog box.
- For the running total name, enter Section Balance.
- Click the OK button to save your changes and insert the running total onto the report.
- Crystal Reports automatically put the running total field in the Details section. Drag it into the group #1 footer and line it up with the summary field in group #2.
- Set the format of the running total field to bold.
- Delete the running total’s column header field that was automatically placed on the Page Header section by Crystal Reports.
- At this point, we are almost finished. If you look at the report, you’ll see that each group has a balance associated with it. The account class groups show the sub-totals of the account balances within each category and the sections print the running total balances. This is shown in Figure A-11.