Our company has always charged a % of the order total for a shipping fee. I don't believe this is possible using shipping rate maintenance since I wouldn't want to have an enormous table with every possible price to the penny...
This has left me looking at creating a script to do this. I saw another post that mentioned this is easily done using a script, which sounds great.. I'm just having problems actually implementing it.
The post I read said to pass the TaxableAmt and NonTaxableAmt fields to the script, sum them, then multiply by our shipping rate. Math works out, that sounds right. Problem is the TaxableAmt and NonTaxableAmt fields show as "Display Only", and I cannot select them to "Return" to the script. That being said, I'm not what I would consider good at scripting... If I could get some help with this I'd greatly appreciate it.. Trying to apply 7% shipping with a $5 minimum charge.
Here's my script:
-----------------------------------------------------------------------------------------------------------------------------------------
If oSession.CompanyCode = "TST" then
retval = 0
nTaxableAmt = ""
nNonTaxableAmt = ""
nTotal = 0
retval = obusobj.getvalue("TaxableAmt", nTaxableAmt)
retval = obusobj.getvalue("NonTaxableAmt", nNonTaxableAmt)
if nTotal < 5 then
nTotal = 5.0
else
nTotal = (nTaxableAmt + nNonTaxableAmt * .07)
End If
retval = obusobj.setvalue("FreightAmt", nTotal)
End If
-----------------------------------------------------------------------------------------------------------------------------------------
When I press the button this is assigned to, nothing writes to the FreightAmt field. I know the script is firing because if I put this in it:
retval = oSession.AsObject(oSession.UI).MessageBox("Test")
It shows the dialog box... The script passes the syntax check just fine, just doesn't do anything else. Something else to note is, in User defined script maintenance, if I try to compile the script I get an error message that says "There are no user-defined script events defined for columns or tables." I'm not exactly sure what this is referring too. Is there something else I need in my script to make it a "script event"? I have two "similar" scripts doing different things that work just fine. Not sure what's up.