# BAQ stop sending empty messages

Hi
I have inherited a BAQ on Vantage 6.1 that runs when we recieve goods
to check that the price variance is within 20%

It seems to work ok except when an item is recieved that is within
the 20% it send an empty e-mail.

My BAQ trigger on RcvDtl on Ourqty and OurUnitPrice.

here is my code.
any thoughts?

Dave

DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.
DEFINE VARIABLE PurchasePrice AS DECIMAL NO-UNDO.
DEFINE VARIABLE StandardCost AS DECIMAL NO-UNDO.
DEFINE VARIABLE Ratio AS Decimal NO-UNDO.
DEFINE VARIABLE Variance AS DECIMAL NO-UNDO.

find first mfgsys.Part where mfgsys.Part.company =
mfgsys.RcvDtl.company
and mfgsys.Part.PartNum =
mfgsys.RcvDtl.PartNum
no-lock no-error.

/* Calculate the ratio of Standard Cost to Purchase Price */
PurchasePrice = mfgsys.RcvDtl.OurUnitCost.
StandardCost = Mfgsys.Part.StdMaterialCost.
Ratio = StandardCost / PurchasePrice.
Variance = StandardCost - PurchasePrice.

/* Create the new body of the email */
IF ((Ratio <= 0.8) OR (Ratio >= 1.2)) or StandardCost = 0 THEN DO:
ASSIGN Email-Subject = "Purchase Price Variance greater than 20%".
ASSIGN Email-Text = "Purchase price variance of " + String
(Variance)
+ " Standard Cost: " + String(StandardCost)
+ " with PO Number : " + String
(Mfgsys.RcvDtl.PONum)
+ " Line : " + String(Mfgsys.RcvDtl.POLine)
+ " Part Number : " + String
(Mfgsys.RcvDtl.PartNum).

/*END.
ELSE DO:
RETURN "CANCEL SEND".
END.*/