Hi,
I have written the followinf formula to try and calculate a sales rep commission amout in Crystal Reports 7 used via Visual Basic 6. When I try and save the following formula the program tells me that a 'Boolean is required here' and flags the last zero (0) character in the formula. What have I done wrong? Please help:
------------------code snippet----------------------
//Calculate the difference between the Sell Price and the KeyPak Price
//and the Commision amount now.
Global numberVar KPSPDifference := {ado.sellprice} - {ado.price/unit};
Global numberVar KPCommAmount := ({ado.price/unit} * (10/100));
Global numberVar KPCommission := 0;
//If we have a regular record then simply pass through the commission value from SQL
if {ado.Type} = 0 Then
//Extract commission from sql
{ado.comm}
//If we have a Manual Invoice type then calculate the commission
else
//If the selling price is larger than the unit price
if {ado.sellprice} > {ado.price/unit} then
//If the difference is greater than or equal to 10% of the unit price.
if KPSPDifference >= KPCommAmount then
KPCommission = KPCommission + KPCommAmount
else
//Else commission is the difference between the cost and selling price.
KPCommission = KPCommission + KPSPDifference
else
//Selling price is less than KeyPak price
//so there can be no commission. Commission is 0.
0
------------------code snippet----------------------
Many thanks in advance.
JonAtBits
I have written the followinf formula to try and calculate a sales rep commission amout in Crystal Reports 7 used via Visual Basic 6. When I try and save the following formula the program tells me that a 'Boolean is required here' and flags the last zero (0) character in the formula. What have I done wrong? Please help:
------------------code snippet----------------------
//Calculate the difference between the Sell Price and the KeyPak Price
//and the Commision amount now.
Global numberVar KPSPDifference := {ado.sellprice} - {ado.price/unit};
Global numberVar KPCommAmount := ({ado.price/unit} * (10/100));
Global numberVar KPCommission := 0;
//If we have a regular record then simply pass through the commission value from SQL
if {ado.Type} = 0 Then
//Extract commission from sql
{ado.comm}
//If we have a Manual Invoice type then calculate the commission
else
//If the selling price is larger than the unit price
if {ado.sellprice} > {ado.price/unit} then
//If the difference is greater than or equal to 10% of the unit price.
if KPSPDifference >= KPCommAmount then
KPCommission = KPCommission + KPCommAmount
else
//Else commission is the difference between the cost and selling price.
KPCommission = KPCommission + KPSPDifference
else
//Selling price is less than KeyPak price
//so there can be no commission. Commission is 0.
0
------------------code snippet----------------------
Many thanks in advance.
JonAtBits