AR_InvoiceHistoryPrinting with BOI

SOLVED

Anyone ever done this?  I have a list of non-consecutive historical invoices I need to export to a specified directory.  I was going to use the 'QuickPrint' property before calling ProcessReport() for each necessary invoice, but I've only ever performed this when dealing with SOs (where there is only one key field).  For Invoice History printing, would I set the 'QuickPrint' property to InvoiceNo + HeaderSeqNo?

Parents
  • 0

    Dim oScript, oss, retval, oPrint


    Set oScript = CreateObject ("ProvideX.Script")
    oScript.Init "C:\Sage\Sage 100 Standard 2020\MAS90\Home"
    Set oSS = oScript.NewObject("SY_SESSION")

    if not cbool(oSS.nLogon()) then
    MSGBOX CSTR("Logon: " + oSS.sLastErrorMsg)
    end if


    if not cbooL(oSS.nSetCompany("ABC")) then
    MSGBOX CSTR("Set Company: " + oSS.sLastErrorMsg)
    end if

    if not cbool(oSS.nSetModule("A/R")) then
    MSGBOX CSTR("Set Module: " + oSS.sLastErrorMsg)
    end if

    if not cbool(oSS.nSetDate("A/R", Year(Date) & Right("00" & Month(Date), 2) & Right("00" & Day(Date), 2))) then
    MSGBOX CSTR("Set Date: " + oSS.sLastErrorMsg)
    end if

    if not cbool(oSS.nSetProgram(oSS.nLookupTask("AR_InvoiceHistoryPrinting_UI"))) then
    MSGBOX CSTR("Set Program: " + oSS.sLastErrorMsg)
    end if

    SET oPrint = oScript.NewObject("AR_InvoiceHistoryPrinting_rpt", oSS)


    if not cbool(oPrint.nSelectReportSetting("STANDARD")) then
    MSGBOX CSTR("Select report setting 'INVOICE': " + oPrint.sLastErrorMsg)
    end if

    oPrint.sQuickPrint = "S/O01SHEPARD" + chr(0) + chr(0) + chr(0)+ chr(0)+ chr(0)+ chr(0)+ chr(0) + chr(0)+ chr(0)+ chr(0)+ chr(0)+ chr(0)+ chr(0) + "0100045000000"

    if not cbool(oPrint.nProcessReport("PREVIEW")) then <-----Throws error shown below
    MSGBOX CSTR("Process report: " + oPrint.sLastErrorMsg)
    end if


    oPrint.DropObject
    SET oPrint = Nothing
    oSS.nCleanup()
    oSS.DropObject()
    Set oSS = Nothing
    Set oScript = Nothing

  • 0 in reply to Justin K

    I was able to get this to work. This is what I did. I put my customer number and invoice number into variables. I hard coded the division as "00" since we don't use divisions.

    Note I can't seem to post code snippets either apparently!

  • 0 in reply to Sage100User

    OK thanks for the response!   At least I know it SHOULD work.  Will see if the variables makes any difference.  Just curious what version/edition of Sage 100 you tested with?

  • +1 in reply to Justin K
    verified answer

    I'm using version 2019.

    My code is a little different than yours however, so you may want to adjust yours to match what I did. I used the "SetModuleToPrint" function as mentioned above.

Reply Children