Set freight amount

Hi all,

                First script first post. Task is simple for one customer set freight amount field to negotiated amount that is based on the sales order total amount. Script is attached to pre-total event and it always works BUT only if sales order has more than one line even if the second line is just /C with nothing else. UDF that keeps SO Total amount is always correct regardless of the number of lines. Script is below. What am I missing? Thank you.

'Initialize vars

retVal=0
sDivision = ""
sCustomer = ""
nExtAmt = 0
nFreight = 0

retVal = oBusObj.GetValue("ARDivisionNo$", sDivision)
retVal = oBusObj.GetValue("CustomerNo$", sCustomer)

if sDivision = "01" and sCustomer = "MMED" then

         retVal = oBusObj.GetValue("UDF_EXTENSION_AMT", nExtAmt)
         retVal = oBusObj.GetValue("FreightAmt", nFreight)

                 If nExtAmt > 0 and nExtAmt <= 20 then
                                retVal = oBusObj.SetValue("FreightAmt", 7.98)
                Elseif nExtAmt > 20 and nExtAmt <= 30 then
                                retVal = oBusObj.SetValue("FreightAmt", 8.98)
                Elseif nExtAmt > 30 and nExtAmt <= 40 then
                                retVal = oBusObj.SetValue("FreightAmt", 9.98)
                Elseif nExtAmt > 40 and nExtAmt <= 50 then
                                retVal = oBusObj.SetValue("FreightAmt", 10.98)
                Elseif nExtAmt > 50 and nExtAmt <= 70 then
                                retVal = oBusObj.SetValue("FreightAmt", 11.98)
                Elseif nExtAmt > 70 and nExtAmt <= 90 then
                                retVal = oBusObj.SetValue("FreightAmt", 12.98)
                Elseif nExtAmt > 90 then
                                retVal = oBusObj.SetValue("FreightAmt", 13.98)
                End if

Else
                retVal = oBusObj.SetValue("FreightAmt", nFreight)

End if