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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quickbooks integration from VFP? 1

Status
Not open for further replies.

EzLogic

Programmer
Aug 21, 2001
1,230
US
Has anyone done any integration with Quickbooks or know of any api/wrapper to talk to QB?

going from VFP -> to QB one way only.

looking to post invoices, credit memos, post payments.

data in vfp, and want to "mimic" and post them in QB, instead of doing them the manual way.

any info would be greatly appreciated.

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
The best way to integrate any 'outside' application to Quickbooks is to use QODBC ( )

With that you can, depending on the version you purchase, have full functionality into and out of the Quickbooks data tables.

NOTE - I have no vested interest in this product. In fact, while I hope to make the integration myself in the not too far future, I have not used the product myself yet.

Good Luck,
JRB-Bldr
 
The connection part is the easy one, but what tables are affected when you do an update is the difficult. Adn I am not sure that QuickBooks is eager to help you determining that part.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Thanks guys!

and Tamar, i will look at it.

thank you.

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
I have some quickbooks code for customer master lookups and invoice posting that i would be willing to share. It does use the QuickBooks SDK for backend. Email me and i can send you some of what i have.

steve at independenttech dot net

Steve Bowman
Independent Technology, Inc.
CA, USA
 
I decided some samples might help others so here is a simple customer master extraction. Some of this code was borrowed by me in the first place however i can not remember where i got it from it was soooo long ago. some is very modified so i am giving some credit to "unknown"

Code:
LPARAMETERS tcListID, tcFullName

#INCLUDE qbfc.h
LOCAL loQBSM, loRequest, loCustQuery

Public lcQBsdkver, lcQBsession, lcQBfile
lcQBsdkver="QBFC8.QBSessionManager"	&& change to the SDK version you are using
lcQBsession="Your Program Name"	&& Quickbooks uses this to identify your process
lcQBfile=GetFile("qbw""Locate QB File")
CREATE CURSOR Customers (ListID C(20), FullName C(50), Contact C(30), Phone C(20), ladsid c(20))

* create the session manager which will communicate with QuickBooks
loQBSM = CREATEOBJECT(lcQBsdkver)

* open connection with QuickBooks
loQBSM.OpenConnection(lcQBsession, lcQBsession)

* open a session with QuickBooks using the company file which is
* currently open
loQBSM.BeginSession(lcQBfile, qbFileOpenDoNotCare) && 2

* get a message set request object (version 1.1 xml)
loRequestSet = loQBSM.CreateMsgSetRequest("US",1,1)

* set the on error attribute for the request
loRequestSet.Attributes.OnError = qbContinueOnError && 1

* Build a set of requests - in this case, containing only one request
* Add a request to the request set
loCustomerQuery = loRequestSet.AppendCustomerQueryRq

 

* First Parameter
IF VARTYPE(tcListID) = "C" AND !ISBLANK(tcListID)
	* Note - There doesn't appear to be a way to pull a specific record using the ListID!
	* This code doesn't work.
	loCustomerQuery.ORCustomerListQuery.CustomerListFilter.ORNameFilter.ListIDFilter.Name.SetValue(tcListID)
	loCustomerQuery.ORCustomerListQuery.CustomerListFilter.ORNameFilter.ListIDFilter.MatchCriterion.SetValue(1) && 0 - Starts With, 1 - Contains, 2 - Ends With
ELSE
	* Second Parameter
	IF VARTYPE(tcFullName) = "C" AND !ISBLANK(tcFullName)
		loCustomerQuery.ORCustomerListQuery.CustomerListFilter.ORNameFilter.NameFilter.Name.SetValue(tcFullName)
		loCustomerQuery.ORCustomerListQuery.CustomerListFilter.ORNameFilter.NameFilter.MatchCriterion.SetValue(1) && 0 - Starts With, 1 - Contains, 2 - Ends With
	ELSE
		=MESSAGEBOX("Forgot to specify parameter")
		RETURN
	ENDIF	
ENDIF

* Send the request set to QuickBooks
loResponseSet = loQBSM.DoRequests(loRequestSet)

* Check response status and data

* The response list contains only one response, corresponding to our single request
loCustResp = loResponseSet.ResponseList.GetAt(0)

* Any status code other than `0' should be investigated further
IF (loCustResp.StatusCode # 0)
	MESSAGEBOX("Status: Code = " + ALLTRIM(STR(loCustResp.StatusCode)) + ;
		", Severity = " + loCustResp.StatusSeverity + ;
		", Message = " + loCustResp.StatusMessage)
ENDIF

* loop through the collection of customer ret objects
* 0 based array
FOR lni = 0 TO loCustResp.Detail.Count - 1
	
	* get reference to single customer
	loCust = loCustResp.Detail.GetAt(lni)
	
	lcListID = loCust.ListID.GetValue()
	
	* get the value of the fullname tag
	lcFullName = loCust.FullName.GetValue()
	
	* get the contact information if it exists .. if not avoid errors
	IF VARTYPE(loCust.Contact) = "O"
		lcContact = loCust.Contact.GetValue()
	ELSE
		lcContact = "[not set]"
	ENDIF

	* get the phone number if it exists .. if not avoid errors
	IF VARTYPE(loCust.Phone) = "O"
		lcPhone = loCust.Phone.GetValue()
	ELSE
		lcPhone = "[not set]"
	ENDIF
	lcLadsid=""
	* get the lads number if it exists .. if not avoid errors
	IF VARTYPE(loCust.ladsid) = "O"
		lcLadsid = loCust.ladsid.GetValue()
	ELSE
		lcLadsid = "[not set]"
	ENDIF

	* get the value of the Sublevel tag
	lnSubLevel = loCust.SubLevel.GetValue()
	
	* note the projects (sublevel is 1)
	IF lnSubLevel = 1
		lcFullName = '    Project: ' + lcFullName
	ENDIF
	
	* insert into cursor
	INSERT INTO Customers VALUES (lcListID, lcFullName, lcContact, lcPhone, lcLadsid)

ENDFOR

* Relinquish the communication channel with QuickBooks
loQBSM.EndSession
loQBSM.CloseConnection

RETURN

Steve Bowman
Independent Technology, Inc.
CA, USA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top