Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 30 NOV 2011 09:33:03AM Martin Drenovac wrote:

I wonder if someone could cast their eyes of this VB and it's OI equivalent.

The program interfaces into Sybiz Vision accounting.

The VB code works perfectly - exec this through excel and the data pops out in Sybiz.

The OI code, also executes perfectly (returns errorcode 0 all the way), however it does not end up writing into Sybiz.

VB Code:

Private Sub AutoLoad1_Run()

  AutoLoad1.ErrorCode = 0
  Me.AutoLoad1.DatabasePath = "V:\Home\Sample"
  Me.AutoLoad1.AutoloadPath = "V:\Home\Sample"
  Me.AutoLoad1.SerialNumber = "AUB3192"
  Me.AutoLoad1.UserNo = 192
  Me.AutoLoad1.SuppressMessages = True
  Me.AutoLoad1.Filename = "import"
  'This error trapping can be after each parameter is passed
  If AutoLoad1.ErrorCode <> 0 Then
      MsgBox AutoLoad1.ErrorCode
      'Exit Sub
  End If
  '2.
  AutoLoad1.TranType = "SYSNEXT"
  AutoLoad1.UseSystem = 3
  AutoLoad1.Save
  '3.
  AutoLoad1.TranType = "GSTAPPLIES" '(this is for AU serial number only)
  AutoLoad1.GST = "1"
  AutoLoad1.Save
  '4.
  AutoLoad1.TranType = "LOCKING"
  AutoLoad1.Locking = 3
  AutoLoad1.Save
  '5.
  AutoLoad1.TranType = "FORCEPER"
  AutoLoad1.ForcePer = 0
  AutoLoad1.Save
  '6.
  AutoLoad1.TranType = "SETPOSTING"
  AutoLoad1.Posting = "0"
  AutoLoad1.Save
  '7.
  AutoLoad1.TranType = "NEWBATCH"
  AutoLoad1.NewBatch = 1
  AutoLoad1.Save
  '8.
  AutoLoad1.TranType = "SETINVNO"
  AutoLoad1.InvNo = "INV2234"
  AutoLoad1.Save
  '9.
  AutoLoad1.TranType = "SETLOCN"
  AutoLoad1.LocnNo = 3
  AutoLoad1.Save
  '10.
  AutoLoad1.TranType = "SINVLINE"
  AutoLoad1.LineLedg = "I" '"1"
  AutoLoad1.LineAcc = "1" '"I1"
  AutoLoad1.Desc = "PRODUCT mpd Of The Invoice"
  AutoLoad1.TranRef = "000008"
  AutoLoad1.SaleAnCode = 1
  AutoLoad1.Quantity = -5
  AutoLoad1.Amount = -600#
  AutoLoad1.TaxCode2 = 103
  AutoLoad1.TaxAmount2 = -60
  AutoLoad1.Save
  '11.
  AutoLoad1.TranType = "SINVLTXT"
  AutoLoad1.TranRef = "000008"
  AutoLoad1.Desc = "This is line DESCRIPTION of the trade text lines for Sales Invoice"
  AutoLoad1.Save
  '12.
  AutoLoad1.TranType = "SShipped"
  AutoLoad1.CustomerAcct = "2" '"D1"
  AutoLoad1.DelivAcct = "2" '"D1"
  AutoLoad1.TranDate = "11/09/2011"
  AutoLoad1.TranRef = "SIO00008"
  AutoLoad1.SaleAnCode = 5
  AutoLoad1.Amount = 600#
  AutoLoad1.TaxCode2 = 103
  AutoLoad1.TaxAmount2 = 60#
  AutoLoad1.Save
  'Now import the file
  If AutoLoad1.ErrorCode <> 0 Then
      MsgBox AutoLoad1.ErrorCode
  Else
      AutoLoad1.ProcessBatch
  End If

End Sub

OI Code:

compile function nv_sybiz_vision(directive,arg)

This program is proprietary and is not to be used by or disclosed to others, nor is it to

be copied without written permission from Envizion Systems Pty Ltd.

Name :

Description:

* @package PowerForce * @author Martin Drenovac (for Envizion Systems Pty Ltd)

* @copyright Copyright © 2007 - 2011, Envizion Systems Pty Ltd * @licence http://powerforcesoftware.com/user/license.html

* @link http://powerforcesoftware.com * @since Version 1.0

* @filesource

Notes: Pre-system event handlers will have a \"_PRE\" appended to the Event parameter

Parameters:

Returns :

History (Date, Initials, Notes) 04/02/11 mpd Original programmer

29/09/11 mpd oleputproperty is SUB 04/10/11 mpd sbVisiloadAutoload.AutoLoad

* Date: 2011-02-05 17:34:21 +1000 (Fri, 4 Feb 2011)

#PRAGMA OUTPUT SYSLISTS mpd_

$INSERT nv_copyright

$INSERT nv_sysprocmarker

$INSERT nv_userprefs

declare subroutine check_assignments, OlePutProperty, olecallmethod

declare function olecallmethod

* check_assignments(CtrlEntId, CtrlClassId, PassedEvent, P1,P2,P3,P4 )

EQU nv_version$$ TO "\99\"

equ vision$$ TO @WINDOW:".OLE_VISION"

DECLARE FUNCTION get_property

debug

OLE_control$ = OleCreateInstance('sbVisiloadAutoload.AutoLoad') ; .AutoLoad') * vb_object = "sbVisiloadAutoload.AutoLoad" ; 04/10/11

OlePutProperty(OLE_control$,"DatabasePath", "V:\Home\Sample")

oleerror01 = olestatus()

OlePutProperty(OLE_control$, "AutoloadPath", "V:\Home\Sample")

oleerror02 = olestatus()

OlePutProperty(OLE_control$, "SerialNumber", "AUB3192")

oleerror03 = olestatus()

OlePutProperty(OLE_control$, "UserNo", 192)

oleerror04 = olestatus()

OlePutProperty(OLE_control$, "SuppressMessages", True)

oleerror05 = olestatus()

OlePutProperty(OLE_control$, "Filename", "import")

oleerror06 = olestatus()

OlePutProperty(OLE_control$, "TranType", "SYSNEXT")

oleerror07 = olestatus()

OlePutProperty(OLE_control$, "UseSystem", 3)

oleerror08 = olestatus()

debug

a = OleCallMethod(OLE_control$, "Save")

oleerror9 = olestatus()

OlePutProperty(OLE_control$, "TranType", "GSTAPPLIES") ; '(this is for AU serial number only) oleerror10 = olestatus() OlePutProperty(OLE_control$, "GST", "1") oleerror11 = olestatus() a = olecallmethod(OLE_control$, "Save") oleerror12 = olestatus() OlePutProperty(OLE_control$, "TranType", "LOCKING") oleerror13 = olestatus() OlePutProperty(OLE_control$, "Locking", 3) oleerror14 = olestatus() b = OleCallMethod(OLE_control$, "Save") oleerror15 = olestatus() OlePutProperty(OLE_control$, "TranType", "FORCEPER") oleerror16 = olestatus() OlePutProperty(OLE_control$, "ForcePer", 0) oleerror17 = olestatus() c = OleCallMethod(OLE_control$, "Save") oleerror18 = olestatus() OlePutProperty(OLE_control$, "TranType", "SETPOSTING") oleerror19 = olestatus() OlePutProperty(OLE_control$, "Posting", "0") oleerror20 = olestatus() d = OleCallmethod(OLE_control$, "Save") oleerror21 = olestatus() OlePutProperty(OLE_control$, "TranType","NEWBATCH") oleerror22 = olestatus() OlePutProperty(OLE_control$, "NewBatch", 1) oleerror23 = olestatus() h = OleCallMethod(OLE_control$, "Save") oleerror24 = olestatus() OlePutProperty(OLE_control$, "TranType", "SETINVNO") oleerror25 = olestatus() OlePutProperty(OLE_control$, "InvNo", "INV1234") oleerror26 = olestatus() i = OleCallMethod(OLE_control$, "Save") oleerror27 = olestatus() OlePutProperty(OLE_control$, "TranType", "SETLOCN") oleerror28 = olestatus() OlePutProperty(OLE_control$, "LocnNo", 3) oleerror29 = olestatus() e = OleCallMethod(OLE_control$, "Save") oleerror30 = olestatus() OlePutProperty(OLE_control$, "TranType", "SINVLINE") oleerror31 = olestatus() OlePutProperty(OLE_control$, "LineLedg","I") ; '"1"

oleerror32 = olestatus()

OlePutProperty(OLE_control$, "LineAcc", "1") ; '"I1" oleerror33 = olestatus() OlePutProperty(OLE_control$, "Desc", "DESCRIPTION Product XXX Of The Invoice") oleerror34 = olestatus() OlePutProperty(OLE_control$, "TranRef", "000008") oleerror35 = olestatus() OlePutProperty(OLE_control$, "SaleAnCode", 1) oleerror36 = olestatus() OlePutProperty(OLE_control$, "Quantity", -5) oleerror37 = olestatus() OlePutProperty(OLE_control$, "Amount", -600) oleerror38 = olestatus() OlePutProperty(OLE_control$, "TaxCode2", 103) oleerror39 = olestatus() OlePutProperty(OLE_control$, "TaxAmount2", -60) oleerror40 = olestatus() x = OleCallMethod(OLE_control$, "Save") oleerror41 = olestatus() OlePutProperty(OLE_control$, "TranType", "SINVLTXT") oleerror42 = olestatus() OlePutProperty(OLE_control$, "TranRef", "000008") oleerror43 = olestatus() OlePutProperty(OLE_control$, "Desc", "POWERFORCE Sales Invoice") oleerror44 = olestatus() x = OleCallMethod(OLE_control$, "Save") oleerror45 = olestatus() OlePutProperty(OLE_control$, "TranType", "Shipped") oleerror46 = olestatus() OlePutProperty(OLE_control$, "CustomerAcct", "2") ; '"D1"

oleerror47 = olestatus()

OlePutProperty(OLE_control$, "DelivAcct", "2") ; '"D1" oleerror48 = olestatus() OlePutProperty(OLE_control$, "TranDate", "15/09/2011") oleerror49 = olestatus() OlePutProperty(OLE_control$, "TranRef", "SIO00088") oleerror50 = olestatus() OlePutProperty(OLE_control$, "SaleAnCode", 5) oleerror51 = olestatus() OlePutProperty(OLE_control$, "Amount", 600) oleerror52 = olestatus() OlePutProperty(OLE_control$, "TaxCode2", 103) oleerror53 = olestatus() OlePutProperty(OLE_control$, "TaxAmount2", 60) oleerror54 = olestatus() x = OleCallMethod(OLE_control$, "Save") oleerror55 = olestatus() debug x = OleCallMethod(OLE_control$, "ProcessBatch") oleerror56 = olestatus() RETURN 0 </QUOTE> —- === At 30 NOV 2011 12:16PM Carl Pates wrote: === <QUOTE>Martin, It all looks pretty straightforward so I can't see anything obvious - some observations though… 1) the SuppressMessages property looks like it's being passed an unassigned var called "True" 2) The Basic+ OLE functions do not need to be declared - they are intrinsics in the same way as Len(), Xlate() and so on. 3) Have you tried looking at the "ErrorCode" property of the AutoLoad object as they do in the VB code? That looks like something that oleStatus() wouldn't pick up as it's specific to the object in question. /c </QUOTE> —- === At 01 DEC 2011 12:54AM Martin Drenovac wrote: === <QUOTE>Cheers Carl - that is certainly helping. The errorCode has further information. </QUOTE> View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/059a2d040004fcd79ba895200.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1