I am trying to subtract a return item from an ordered item. ex. Customer A buys a product that cost $2833.22, later they return the same product so our accounting enteres it as a return (SOPTYPE=4) When i run my crystal report for that product and customer my calculation does not subtract the return from the order. Which in turn makes my total over by that amount.
The SOPTYPE=4 is a return, SOPTYPE=3 is an order and SOPTYPE=2 is a quote,

By using this formula it never subrtacts the xtndprice, If a customer oredered $2,833.32 worth of an item, then returned the product, a soptype 4 which is a return is created to cancel out. but instead using the formula below my totals are off on the plus side of $2,833.32 so my totals are showing $106,892.63 but when i print out the totals in Dynamics they are $104,059.31 which is the - diff of $2833.32. Any idea


//CALCULATES XTND PRICE FOR CURRENT DATE RANGE SELECTED.

//If the SOPTYPE is an order or return then subtract from xtndprice ie: soptype 3 = orders

//so if the soptype = 4 or 2 then the xtndprce needs to be subtracted


if {SOP30300.SOPTYPE} = 4 then ({SOP30300.XTNDPRCE} * -1);
if {SOP30300.SOPTYPE} = 2 then ({SOP30300.XTNDPRCE}*-1)
Else ({SOP30300.XTNDPRCE});

If {SOP30200.DOCDATE} in {?Date Range} Then
{SOP30300.XTNDPRCE}
Else
0.00