Hi list,
I cannot understand why this causes a syntax error. I get a 'Remaining text does not appear to be a part of the formula' error for the innermost nested 'else' in the code. The code follows:
----code snippet of ERROR code------------
//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;
Global numberVar KPCommissionShared := 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;
//If the Difference is greater than the Commission amount then calculate the split commission
if KPSPDifference > KPCommAmount then
KPCommissionShared := KPSPDifference - KPCommAmount;
KPCommission := KPCommission + KPCommissionShared;
//Return the calculated commission value incl. the commission split
KPCommission
else
//Return the calculated commission value incl. the commission split
KPCommission
else
//Else commission is the difference between the cost and selling price.
KPCommission := KPCommission + KPSPDifference;
KPCommission
else
//Selling price is less than KeyPak price
//so there can be no commission. Commission is 0.
0
----code snippet of ERROR code------------
Can anyone offfer advice?
The previous code (before I tried to complete it was fine uo to the following point (see OK code below this text):
----code snippet of OK code-----------
//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;
Global numberVar KPCommissionShared := 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 of OK code-----------
Can anyone offer advice?
Regards and Thanks
JonAtBits
I cannot understand why this causes a syntax error. I get a 'Remaining text does not appear to be a part of the formula' error for the innermost nested 'else' in the code. The code follows:
----code snippet of ERROR code------------
//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;
Global numberVar KPCommissionShared := 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;
//If the Difference is greater than the Commission amount then calculate the split commission
if KPSPDifference > KPCommAmount then
KPCommissionShared := KPSPDifference - KPCommAmount;
KPCommission := KPCommission + KPCommissionShared;
//Return the calculated commission value incl. the commission split
KPCommission
else
//Return the calculated commission value incl. the commission split
KPCommission
else
//Else commission is the difference between the cost and selling price.
KPCommission := KPCommission + KPSPDifference;
KPCommission
else
//Selling price is less than KeyPak price
//so there can be no commission. Commission is 0.
0
----code snippet of ERROR code------------
Can anyone offfer advice?
The previous code (before I tried to complete it was fine uo to the following point (see OK code below this text):
----code snippet of OK code-----------
//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;
Global numberVar KPCommissionShared := 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 of OK code-----------
Can anyone offer advice?
Regards and Thanks
JonAtBits