Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Help with Invoice CreationSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Sample Scripts Forum

 New Topic 
 
 Post Reply 
[1]  
 Help with Invoice Creation 
 Author   Message 
  Tim Stopher 
  
 Group: Members 
 Posts: 1 
 Joined: 2006-11-20 
 Profile
 Posted : 2006-11-21 01:33:56

Hi. I am trying to create an invoice using QODBC. I have studied the documentation and other posts within this forum, but still cannot make it work.

Query1 does not error. Query2 fails with 'ODBC Call Failed' and 'Not Supported (#10003)

QBODBC Version: 7.00.00.199 - Eval prior to purchase.

Any help is greatly appreciated!

Query1
----------

INSERT INTO "InvoiceLine" ("InvoiceLineItemRefListID", "InvoiceLineDesc",
"InvoiceLineRate", "InvoiceLineAmount","FQSaveToCache") VALUES ('20000-1163540252', 'Database Programming', 300,1.00, 1)

Query 2
-----------

INSERT INTO "Invoice" ("CustomerRefListID", "ARAccountRefListID", "TxnDate", "RefNumber","IsPending", "TermsRefListID", "DueDate", "ShipDate",  "Memo", "IsToBePrinted")
VALUES ('30000-1163540252', '360000-1161104852', {d'2002-10-01'}, '10', 0, '20000-1160477728', {d'2002-10-31'}, {d'2002-10-01'}, 'Memo Test', 0)

 Thanks

 

Tim

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-11-21 09:41:48

Query1 and then Query2 must be run without breaking the QODBC connection. If you run each query, for example, in MS Access, each query will execute as a seperate connection. That's why Query2 fails with 'ODBC Call Failed'. Some products like FileMaker also execute a seperate connection when each query is executed.

To get around this you can create the Invoice in one query and then add additional invoice lines using seperate connections later on, like this:

INSERT INTO "InvoiceLine" ("CustomerRefListID", "ClassRefListID", "RefNumber",
"InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate",
"InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache")
VALUES ('470001-1071525403', '30000-933272658', 'QODBCClass2', '250000-933272656',
'Building permit Additional Room', 100.00000, 100.00, '20000-999022286', 0)

Once the invoice is created, we can locate the TxnID using the QODBC stored procedure (as long as we haven't broken our QODBC connection):

SP_LASTINSERTID InvoiceLine

or use were you have broken your QODBC connection:

SELECT TOP 1 TxnID from INVOICE where CustomerRefListID='470001-1071525403' order by TIMECREATED desc

The TxnID for the new invoice is 5CA9-1197764583, so we can now add additional lines to the Invoice by doing:

INSERT INTO "InvoiceLine" ("TxnID", "ClassRefListID", 
"InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate",
"InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID")
VALUES ('5CA9-1197764583', '60000-933272658', '250000-933272656',
'Bin Permit Renovations', 200.00000, 200.00, '20000-999022286')

INSERT INTO "InvoiceLine" ("TxnID", "ClassRefListID",
"InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate",
"InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID")
VALUES ('5CA9-1197764583', '', '250000-933272656', 'Less Council Rebate',
-50.00000, -50.00, '20000-999022286')

The invoice now appears in QuickBooks with three lines:

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to