Question : Totaling with Crystal Reports

I have a report (see attachment), i need to take the row total (invoice total = (qty * price)) and add it to a variable based on the Sales Acct.

If Left({my-table.Sales-acct},4) = "4500" then
    add the invoice total to labor (labor = labor + invoice total)
if Left(my-table.Sales-acct = "4505" then
    add the invoice total to material (material = material + invoice total)
etc... there are 9 different Sales Account.

i would like to have one line when the group changes that displays the Labor $'s, Material $'s, Equipment $'s etc for all 9 Sales Accounts

Really not sure the best way to proceed with this, and i could really use some help on this one.

I am using CR (XII) (12.2.0.290)

Thanks
 
Attachments:
 
Report example...
 

Answer : Totaling with Crystal Reports

Try this idea

In the report header add a formula to declare the variables

WhilePrintingRecords;
Global NumberVar LaborTotal;
Global NumberVar MaterialTotal;
Global NumberVar Class3Total;
Global NumberVar Class4Total;
Global NumberVar Class5Total;
Global NumberVar Class6Total;
Global NumberVar Class7Total;
Global NumberVar Class8Total;
Global NumberVar Class9Total;
''

In the group header (group 2 )
WhilePrintingRecords;
Global NumberVar LaborTotal;
Global NumberVar MaterialTotal;
Global NumberVar Class3Total;
Global NumberVar Class4Total;
Global NumberVar Class5Total;
Global NumberVar Class6Total;
Global NumberVar Class7Total;
Global NumberVar Class8Total;
Global NumberVar Class9Total;

LaborTotal := 0;
MaterialTotal := 0;
Class3Total := 0;
Class4Total := 0;
Class5Total := 0;
Class6Total := 0;
Class7Total := 0;
Class8Total := 0;
Class9Total := 0;
''

In the detail section
WhilePrintingRecords;
Global NumberVar LaborTotal;
Global NumberVar MaterialTotal;
Global NumberVar Class3Total;
Global NumberVar Class4Total;
Global NumberVar Class5Total;
Global NumberVar Class6Total;
Global NumberVar Class7Total;
Global NumberVar Class8Total;
Global NumberVar Class9Total;
If Left({my-table.Sales-acct},4) = "4500" then
    LaborTotal := LaborTotal + (qty * price)
Else If Left({my-table.Sales-acct},4) = "4505" then
    MaterialTotal := MaterialTotal + (qty * price)
Else If Left({my-table.Sales-acct},4) = "NextClass" then
    Class3Total := Class3Total + (qty * price)
Else  etc for each class

To display then in the group footer (1 formula for each total)
WhilePrintingRecords;
Global NumberVar LaborTotal;
LaborTotal

mlmcc


Random Solutions  
 
programming4us programming4us