Invoice memo from Manual Check Entry

Is there a way to access invoice memo feature from Manual check entry?  Has anyone tried to create a script to open up AP Invoice Memos?

  • 0

    Hey

    You should be able to script this Justin.  I saw this late last night and threw an example together, let me clean it up and I'll post it on Monday, unless you've figured it out already Slight smile

    Happy Friday!

    Elliott

  • 0 in reply to jepritch

    @Elliott - We still have not figured this out.  I look forward to your example.

  • 0 in reply to justinaroberts

    Hey 

    Thanks for the poke, totally forgot to get back to you on this.  So, what I did was add a script button that looks exactly like Sage's memo buttons.  (Use bitmap !Memo3).  So this new button called BT_Link_1, has a script below attached to it.  Also, I added a post-read event script that will enable and disable this button when there are available memos.

    BT_Link_1 - Script (remember to execute on server)

    =================================================================

    ' new script
    Set oDict = oSession.AsObject(oSession.FileObj)
    invLen = oDict.GetColumnLength("AP_ManualCheckDetail", "InvoiceNo$")

    Set oLines = oSession.AsObject(oBusObj.Lines) ' has to be done because button is not in the grid

    apInv = ""
    apInvSeq = "000000" ' hard-coded history sequence #, you may want to locate this sequence # if it is different
    retVal = oLines.GetValue("InvoiceNo$", apInv)

    If Len(apInv)<>0 Then
        oMemo = 0
        Set oMemo = oSession.AsObject(oSession.GetObject("SY_MemoHandler_ui"))

        memoKey = apInv & String(invLen-Len(apInv),pvxNUL) & apInvSeq

        ' this is based on the same logic that is used in invoice history

        retVal = oMemo.MaintainMemos(memoKey, "AP_INVOICEHISTORY_UI", "A/P", "04", 0)
    End If

    ===================================================================

    Post-Read Event Script  and Post-Validate of InvoiceNo - Attached to ManualCheckDetail to enable/disable the new memo button

    If (IsObject(oUIObj)) Then
        MASUI = True
    Else
        MASUI = CBool(oScript.UIObj)
        If (MASUI) Then
            Set oUIObj = oSession.AsObject(oScript.UIObj)
        End If
    End If

    If MASUI Then
        Set oDict = oSession.AsObject(oSession.FileObj)
        invLen = oDict.GetColumnLength("AP_ManualCheckDetail", "InvoiceNo$")

        apInv = ""
        apInvSeq = "000000" ' again, this is hard-coded here may need a routine to find history hdr seq
        retVal = oBusObj.GetValue("InvoiceNo$", apInv)

        action = "DISABLE"

        If Len(apInv)<>0 Then
            oMemo = 0
            Set oMemo = oSession.AsObject(oSession.GetObject("SY_MemoHandler_ui"))

            memoKey = apInv & String(invLen-Len(apInv),pvxNUL) & apInvSeq ' pad key

            hasMemos = 0
            hasMemos = oMemo.HasMemos(memoKey, "AP_INVOICEHISTORY_UI", "A/P", "04", 0)

            If hasMemos=2 Then
                action = "ENABLE"
            End If
        End If

        retVal = oScript.SetUIControl("BT_LINK_1", action)
        retVal = oUIObj.HandleScriptUI()
    End If

    ======================================================================

    Hopefully, this all makes sense.  The memo objects aren't the easiest to understand, but I think this should get you where you want to go.

    Also, I added this idea to the ideas site, to have Invoice memos accessible via check entry and manual check entry. If you want to vote for it.  

    https://www5.v1ideas.com/TheSageGroupplc/Sage100ERP/Idea/Detail/39070

    Hope that helps, and remember to always try on a test system first Slight smile

    Elliott