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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help ....noob 1

Status
Not open for further replies.

jomarelectric

IS-IT--Management
Jan 19, 2007
36
CA
i'm trying to create a commissions report. there are two types of invoice in the sales tbl: one begins w/ a 'C' (for cash sales) & the other w/ a "0" (account sales).

the commission amount is different depending on the sales type (i.e., C or 0).

i need two seperate totals in my footer. am i on the right track. something like:

if {INIH.INVOICE} startswith "C" then {SACR.COMPER2};
else
If {INIH.INVOICE} startswith "0" Then {SACR.COMPER1};

any help would be appreciated.



 
You need a pair of running totals, each of which uses one of your tests.

There are several ways to find totals: running totals, summary totals and variables. Right-click on a field and choose Insert to get a choice of Running Total or Summary. Or else use the Field Explorer, the icon that is a grid-like box, to add running totals.

Running totals allow you to do clever things with grouping and formulas. They also accumulate for each line, hence the name. The disadvantage is that they are working out at the same time as the Crystal report formats the line. You cannot test for their values until after the details have been printed. You can show them in the group footer but not the group header, where they will be zero if you are resetting them for each group.

Summary totals are cruder, but are based directly on the data. This means that they can be shown in the header. They can also be used to sort groups, or to suppress them. Suppress a group if it has less than three members, say. They default to 'Grand Total', but also can be for a group.

Variables are user-defined fields. One useful variant are shared variables to pass data from a subreport back to the main report. You can also use variables to show page totals. For normal counting I find running totals or summary totals much easier.

It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods change between versions, and higher versions have extra options.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
it's cr10. umm, i created two seperate running totals. under the 'evaluate' i used this formula for rtotals_cash:

if {INIH.INVOICE} startswith "C"
then {SACR.COMPER2};

and this formula for my other running total (rtotals_acct:

if {INIH.INVOICE} startswith "0"
then {SACR.COMPER1};

i put these in the footer & nothing.

i don't think i'm following you.
 
The first running total should be based on the field {SACR.COMPER2}. In 'evaluate;, select 'formula' and enter
Code:
Left({SACR.COMPER2}, 1) = "C"

Likewise for the other.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
It can be even easier:

group by the following formula

if {INIH.INVOICE} startswith "C" then 'Cash Sale'
else 'Account Sale'

then insert the following formula into the detail section and summarized by group.

if {INIH.INVOICE} startswith "C" then {SACR.COMPER2};
else
If {INIH.INVOICE} startswith "0" Then {SACR.COMPER1};


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top