add a non inventory item to quickbooks using the

Discussions Involving the Soft Indicator Software Package

add a non inventory item to quickbooks using the

Postby jrusso on Thu May 14, 2009 6:54 am

Dim acctid As String
Dim newResp As IMsgSetResponse
Dim ItemResp As IResponse
'This Code provided by scaleprogrammers.com 5/14/2009 source for custom programming
'weighing systems, scale systems and bar code systems specializing
'in meat processing software
'VB.net Quickbooks SDK Item add example
'Its purpose is to add a non inventory item to quickbooks using the
'Quickbooks SDK
'you can use this code so long as you do not remove these comment lines
Dim sessionmgr As QBSessionManager
sessionmgr = New QBSessionManager
sessionmgr.OpenConnection("", "Scale Programmers")
Dim majorversion, minorversion, releasenumber As Integer

Dim releaseLevel As ENReleaseLevel
sessionmgr.GetVersion(majorversion, minorversion, releaseLevel, releasenumber)

If majorversion >= 7 Then


sessionmgr.BeginSession("Z:\Docs\qbooks\Test Company1.qbw", ENOpenMode.omDontCare)

Dim requestMsgSet As QBFC7Lib.IMsgSetRequest


requestMsgSet = sessionmgr.CreateMsgSetRequest("US", "7", "0")
requestMsgSet.Attributes.OnError = QBFC7Lib.ENRqOnError.roeStop


Try
Dim itemadd As IItemNonInventoryAdd
Dim customeradd As ICustomerAdd

itemadd = requestMsgSet.AppendItemNonInventoryAddRq
With itemadd

.Name.SetValue("99996")
.ORSalesPurchase.SalesOrPurchase.Desc.SetValue("Hello")
.ORSalesPurchase.SalesOrPurchase.AccountRef.FullName.SetValue("Cash Discounts")
.ORSalesPurchase.SalesOrPurchase.ORPrice.Price.SetValue(1.5)


End With


newResp = sessionmgr.DoRequests(requestMsgSet)
ItemResp = newResp.ResponseList.GetAt(0)
Select Case ItemResp.StatusCode.ToString
Case 0
'Item added OK ignore
Case 3100
'item already added ignore
Case Else
MsgBox(ItemResp.StatusMessage.ToString)

End Select




sessionmgr.EndSession()
sessionmgr.CloseConnection()
Catch ex As Exception
MsgBox(ex.Message)
sessionmgr.EndSession()
sessionmgr.CloseConnection()
End Try
MsgBox("Item Send Complete. If any errors occured you would have been informed")

Else
MsgBox("Quickbooks Version Not Compatible. Must be version 7 or better")
sessionmgr.EndSession()
sessionmgr.CloseConnection()
End If
jrusso
Site Admin
 
Posts: 17
Joined: Fri Jan 11, 2008 10:10 am

Return to Soft Indicator

Who is online

Users browsing this forum: No registered users and 1 guest

cron