Sage 100

 View Only
  • 1.  Help with BT_ACCEPT script

    Posted 12-17-2020 05:50

    Good morning - I've been fighting with different variations of this script and know that I'm missing something about the placement of the if-then-else but just can't see it. I have a button script to replace the current Accept button in Sales Order Entry to pop a message about terms/deposit details but allow the user past if needed. I can't get sales orders that don't meet these conditions to save and close - the order just stays open. The sales orders that do meet the condition will behave properly based on the user input. Any guidance would be appreciated!

    retVal = oBusObj.GetValue("SalesOrderNo$", sSalesOrder)
    retVal = oBusObj.GetValue("TermsCode$", sTermsCode)
    retVal = oBusObj.GetValue("DepositAmt", nDepositAmt)
    retVal = oBusObj.GetValue("PaymentType$", sPaymentType)

     
    if (sTermsCode = "00" or sTermsCode = "99") and sPaymentType <> "CCWEB" and nDepositAmt = 0 then
    sMsg = "PREPAID CUSTOMER ACCOUNT. EDIT PAYMENT INFORMATION?"
    sMsgRetVal = oSession.AsObject(oSession.UI).MessageBox("",sMsg,"Style=YesNo")

    if sMsgRetVal = "YES" then

    retVal = oUIObj.InvokeChange("SalesOrderNo$", sSalesOrder)
    retVal = oScript.InvokeButton("fldr.pTOTALS")

    elseif sMsgRetVal = "NO" then

    retVal = oUIObj.InvokeChange("SalesOrderNo$", sSalesOrder)
    retVal = oUIObj.BT_Accept()

    else

    retVal = oUIObj.BT_Accept()

    end if

    end if

    ​  #scripting



    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------


  • 2.  RE: Help with BT_ACCEPT script

    Posted 12-17-2020 09:35



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 3.  RE: Help with BT_ACCEPT script

    Posted 12-17-2020 11:27

    Try:

    End if

    instead of Endif



    ------------------------------
    Lee Graham
    Friendly Systems, Inc.
    ------------------------------



  • 4.  RE: Help with BT_ACCEPT script

    Posted 12-17-2020 13:08

    Thank you, Kevin!! Your expertise is extremely appreciated!!



    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------



  • 5.  RE: Help with BT_ACCEPT script

    Posted 12-17-2020 13:14

    Looking at the script indented properly made it easy to see there was no "else" for the initial "if".

    :-)



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 6.  RE: Help with BT_ACCEPT script

    Posted 12-17-2020 13:43

    You're right - I have to get better at using indentation!



    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------