Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group by in report footer

Status
Not open for further replies.

PPetronas

Programmer
Nov 13, 2008
14
0
0
US
I have a report which looks like:

Price Amount
Charges $0.00 $0.00
$4.99 $14.97

Total $14.97

Refunds Price Amount
$10.99 $10.99

Total $10.99

Now I want to have Net Charged in the Report footer as (Charges Total -Refunds Total).
I have a sum(amount) in the group footer which calculates the Total for each section.
Any help will be appreciated.

Thanks,
Petronas
 
Create this formula and place it in the report footer.

WhilePrintingRecords;
currencyvar Refunds/Charges :=Sum({Amount}, {groupname});

currencyvar maxsum;
currencyvar minsum;
currencyvar diffsum;

if Refunds/Charges > maxsum then
maxsum := Refunds/Charges;
if groupnumber = 1 or
Refunds/Charges < minsum
then
minsum := Refunds/Charges;
diffsum := maxsum-minsum



 
You could create two running totals {#chg} and {#ref} that sum amount, with an evaluation formula like this:

{table.type} = "Charges" //or "Refunds"

Reset never. Then create a formula to place in the report footer:

{#chg} - {#ref}

Or you could use variables by placing the following formula in the group section:

whileprintingrecords;
currencyvar chg;
currencyvar ref;
if {table.type} = "Charges" then
chg := sum({table.amt},{table.type});
if {table.type} = "Refunds" then
ref := sum({table.amt},{table.type});

Then in the report footer, use a formula like this:

whileprintingrecords;
currencyvar chg;
currencyvar ref;
chg-ref

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top