How can I generate an aging report that shows a breakdown of accounts that are 0-30, 31-60, and over 60 days past due?
Use a for command to open the Primary table and specify any required selection criteria using a with clause.
Use a list records command to list the fields you want to print.
Under the list records command, list the field you want to group (e.g., CUSTOMER NO., MEMBER ID, STUDENT ID) in groups.
Use an if function to check each record to see which age group it falls into (e.g., 0-30, 31-60, 60+, or whatever age groups you want to establish).
Within each if function use the sum statistical operator to generate the total for each group.
for INVOICES
LAST NAME ;
if ( current date - INVOICE DATE < 30, AMT_DUE,
if ( current date - INVOICE DATE between 31 to
if ( current date - INVOICE DATE > 60, AMT_DUE ,
This example tells DataEase to: (1) list all open invoice records grouped by MEMBER ID, (2) check the difference between today's date and the INVOICE DATE to determine the number of days the invoice is past due, and (3) if the records for each member have amounts less than 30 days past due, calculate the sum of those amounts. If the records for each member contain totals between 30 and 61 days past due, calculate the sum of those totals. Finally, if the records for each member contain totals more than 60 days past due, calculate the sum of those totals.
Example 1 can be formatted to look like this:
Member ID |
Last Name |
Current |
30 - 60 |
Over60 |
00001 |
Birnbaum |
0.00 |
0.00 |
2,502.00 |
00002 |
Perrault |
2,720.00 |
2,900.00 |
0.00 |
00003 |
Christino |
7,000.00 |
0.00 |
0.00 |
00004 |
Williams |
0.00 |
0.00 |
0.00 |
00005 |
Riggs |
0.00 |
3,120.00 |
0.00 |
|
|
|
|
|
|
9,720.00 |
6,020.00 |
2,502.00 |
define temp "MEMID" numeric string 5 .
define temp "XTHIRTY" number .
define temp "ACC_THIRTY" number .
define temp "ACC_SIXTY" number .
define temp "ACC_OVER" number .
assign temp MEMID := MEMBER ID .
assign temp XTHIRTY := sum of INVOICES named
"under 30" with ( MEMBER ID = INVOICES
MEMBER ID
and PAID = NO and current date - INV_DATE < 30)
AMT_DUE .
assign temp XSIXTY := sum of INVOICES named
"thirty-60" with ( MEMBER ID = INVOICES
MEMBER ID
and PAID = NO and current date - INV_DATE
assign temp XOVER := sum of INVOICES named
"over60" with ( MEMBER ID = INVOICESMEMBER ID
and PAID = NO and current date - INV_DATE > 60 )
AMT_DUE .
assign temp ACC_THIRTY := temp ACC_THIRTY + temp
XTHIRTY .
assign temp ACC_SIXTY := temp ACC_SIXTY + temp XSIXTY .
assign temp AC_OVER := temp ACC_OVER + temp XOVER .
MEMBER ID in groups with group-totals ;
LAST NAME ;
Example 2 uses temporary variables to accumulate the individual totals for each member (broken down by day range) and report totals for each day range. This example tells DataEase to: (1) create seven separate temporary variables. The first will be used to track each instance of the group changing (in this example, it holds the current MEMBER ID). The next three variables are used to accumulate the day range values: one accumulates totals less than 30 days past due, the next, 31 to 60 days past due and the last, over 60 days past due. The last three variables accumulate report totals for each of the three day ranges. The next part of the script tells DataEase to: (2) use a for command to open the INVOICES table, and (3) under the for loop, assign each temporary variable whenever the current record represents a new group. This is accomplished by testing the MEMID variable with an if command to see if it contains the same value as the MEMBER ID in the current record. In the rest of the script, (4) whenever the MEMID variable is reassigned, the next three variables (XTHIRTY, XSIXTY and XOVER) are also reassigned. At the same time, the values in the last three variables are incremented to accumulate report totals for each category, and (5) list the MEMBER ID (in groups) and the values in each of the variables.
Example 2 can be formatted to produce the identical output as Example 1 shown on the previous page.
Example 2, though much more complex than Example 1, provides the added benefit of assigning the totals DataEase generates to temporary variables. This lets you post the totals to a separate summary file if desired.
When you choose a layout for the procedure, you should choose a tabular format (the default) and place the temporary variables in the layout.