Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript Automating S/O Invoice processing problem

Status
Not open for further replies.

rsmit212

Programmer
Mar 10, 2014
1
US
We are creating a script that will upon being fed a Batch Number will create a PDF and send it electronically to the customer using the Paperless Office functionality in Sage MAS 200 version 4.5. The process works fine doing it by hand via the UI, but we want to automate the process for our batch feed into Sage and free up our accounting staff to do other things for us.

---------------------------------------------
Set oPVX = CreateObject ("ProvideX.Script")
oPVX.Init("\\*******\mas450\MAS90\Home\")

Set oSS = oPVX.NewObject("SY_Session")

retVal = oSS.nSetUser("username", "password")
retVal = oSS.nSetCompany(Company,1)
retVal = oSS.nSetDate("S/O", aDate)
retVal = oSS.nSetModule("S/O")
retVal = oSS.nSetProgram(oSS.nLookupTask("SO_InvoicePrinting_ui"))
Set oPrint = oPVX.NewObject("SO_InvoicePrinting_rpt", oSS)

oSS.nTerminateUI()

If CBool(oPrint.nBatchEnabled) Then
retVal = oPrint.nSelectBatch(BatchNo)
If retval=0 Then
WScript.Quit
End If
Else
WScript.Quit
End If

retval = oPrint.nSelectReportSetting("PSP")

Set oPaperless = oPrint.ocoPLCommon ' Get Paperless object
oPaperless.sFormPrintUISelection = "2" ' Electronic Delivery Only in dropbox on the Form

'delay one second
WScript.Sleep 1000

' Call ProcessReport to execute the printout
retVal = oPrint.nProcessReport("PRINT")
if retVal = 0 then
WScript.Quit
end if
-----------------------------------

The problem seems to be the Electronic Delivery portion is not being fired. When we set the sFormPrintUISelection to “4” (Print/PDF All and Electronically Deliver) we get the printout, a PDF is created, but no email is generated and no errors are returned. When done via the UI, it works just fine. It’s only in the script we are having issue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top