Print Page | Close Window

Grand Total summary

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8123
Printed Date: 26 Apr 2024 at 1:34pm


Topic: Grand Total summary
Posted By: billym17
Subject: Grand Total summary
Date Posted: 26 Oct 2009 at 8:09am
I created a report with  a column that calculates commission but I cannot summarize it. I want to get a grand total of the commissions.
I appreciate any help or if you can direct me to the right formula to do this. Thanks

Here is the formula
// This tests the number of chits per day for a class in indoor fitness and claculates the commission
// sorts indoor fitness sales items
if {tblPOSItems.POSItemCode} startswith "N" then
//counts chits and determines if chits are less than or equal to 5
(if count({tblPOSChits_ItemDetails.POSChitDate},{tblPOSChits_ItemDetails.POSChitDate}) <= 5
// if true chit amount will be commission amount
then {tblPOSChits_ItemDetails.GrossAmount}*1.0
// if chits are over 5 then commission will be only 70%
else {tblPOSChits_ItemDetails.GrossAmount}*.7)
else {tblPOSChits_ItemDetails.GrossAmount}*.7



Replies:
Posted By: lockwelle
Date Posted: 30 Oct 2009 at 11:58am
since you want a sum of the commission, life is pretty simple.
add a variable into the formula...well here something like:
 
shared numbervar totCom;
local numbervar thisCom;
 
/ This tests the number of chits per day for a class in indoor fitness and claculates the commission
// sorts indoor fitness sales items
if {tblPOSItems.POSItemCode} startswith "N" then
//counts chits and determines if chits are less than or equal to 5
(if count({tblPOSChits_ItemDetails.POSChitDate},{tblPOSChits_ItemDetails.POSChitDate}) <= 5
// if true chit amount will be commission amount
then thisCom:={tblPOSChits_ItemDetails.GrossAmount}*1.0
// if chits are over 5 then commission will be only 70%
else thisCom:={tblPOSChits_ItemDetails.GrossAmount}*.7)
else thisCom:={tblPOSChits_ItemDetails.GrossAmount}*.7;
 
totCom:=totCom + thisCom;
thisCom
basically set the current commision to a variable, since CR displays the last value that it sees, you need the current commision at the bottom of the formula, the rest is a simple incrementing.
 
HTH
 



Print Page | Close Window