Added credit card fee to a sales order

I'm trying to calculate the extension amount of a miscellaneous charge code.  When "/CCFEE" is entered as the charge code, I want the extension amount to be the total amount multiplied by .025.

Here is my script.  I'm getting the following error when clicking on the Totals tab.

OrderAmt = 0
FeeAmt = 0
NonTaxAmt = 0
SalesTaxAmt = 0
TaxAmt = 0
FreightAmt = 0
TaxAmt = 0


ItemNumber = ""

retVal = oHeaderObj.GetValue("NonTaxableAmt", NonTaxAmt)
retVal = oHeaderObj.GetValue("TaxableAmt", TaxAmt)
retVal = oHeaderObj.GetValue("SalesTaxAmt", SalesTaxAmt)
retVal = oHeaderObj.GetValue("FrieghtAmt", FreightAmt)

retVAL = OBusobj.GetValue("ItemCode$",ItemNumber)

OrderAmt = NonTaxAmt + TaxAmt + SalesTaxAmt + FreightAmt

FeeAmt = OrderAmt * .025

if ItemNumber = "/CCFEE" then retVAL = oBusobj.setValue("ExtensionAmt", FeeAmt) end if

Parents
  • What's your script trigger?  PreTotals?  If so, there is no oHeaderObj, and you can't rely on the header totals (not calculated yet).  Since you want to include SalesTaxAmt in your base formula, you'll probably have to change your script to a button on the Totals tab, instead of a PreTotals event... restructuring the script properly, with a line loop to find the fee line.

  • in reply to Kevin M

    It's working now.  I had an incorrect event script running on the sales order header.  Once that was deleted, the script works great.

Reply Children