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 : How do I force the driver to send insert queries to QuickBooks?Search Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Support Forum

 New Topic 
 
 Post Reply 
[1]  
 How do I force the driver to send insert queries to QuickBooks? 
 Author   Message 
  tom 
  
 Group: Members 
 Posts: 6 
 Joined: 2006-06-01 
 Profile
 Posted : 2006-06-07 05:04:56
How do I force the driver to send insert queries to quickbooks without having to use another insert field?

 I have a loop of various queries that are used to insert orders into quickbooks --- however, some queries are not used on all jobs so I am not always sure where the last insert query will be.

Thanks,

Tom Komin

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-06-07 09:05:48

This example creates one Sales Order with 2 order lines. Note how the FQSaveToCache field is set to True except on the last line. Setting FQSaveToCache to 0 will force the driver to submit the inserts for a Sales Order into QuickBooks.

INSERT INTO "SalesOrderLine" ("CustomerRefListID", "TemplateRefListID","RefNumber", "SalesOrderLineItemRefListID", "SalesOrderLineDesc", "SalesOrderLineQuantity", "SalesOrderLineRate", "SalesOrderLineAmount", "SalesOrderLineSalesTaxCodeRefListID","FQSaveToCache") VALUES ('120000-1045537156','C0000-1080110273','1015', '90000-1045537150', '4m Steel Ladder', 1.00000, 1.00000, 150.00, '90000-1045536338', 1)

INSERT INTO "SalesOrderLine" ("CustomerRefListID", "TemplateRefListID","RefNumber", "SalesOrderLineItemRefListID", "SalesOrderLineDesc", "SalesOrderLineQuantity", "SalesOrderLineRate", "SalesOrderLineAmount", "SalesOrderLineSalesTaxCodeRefListID","FQSaveToCache") VALUES ('120000-1045537156','C0000-1080110273','1015', '150001-1045625669', 'Paint Brush:Big', 1.00000, 1.00000, 11.60, '90000-1045536338', 0)

Where:
CustomerRefListID is the existing Customer ListID
found by using "Select * from Customer"
TemplateRefListID is the Sales Order Template ListID
found by using "Select * from Template"
SalesOrderLineItemRefListID is the existing Inventory Item ListIDs
found by using:

 

  Top 
  tom 
  
 Group: Members 
 Posts: 6 
 Joined: 2006-06-01 
 Profile
 Posted : 2006-06-07 09:24:41

In my programming, I don't know which line item will be the last. I have 3 different types of services that it needs to bill for on an invoice but some use the first two but not the last and others use just the 2nd one. I can't use the "FQSaveToCache" set to 0 because I don't know if the insert in going to be used or not. Is there a SQL command to force the driver to submit the insert without adding an additional one or can I add a blank line item that has the FQSaveToCache set to 0 --- if yes, how should the blank line be coded.

Thanks,

Tom

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-06-07 09:35:39

Ok, I gather you have if.... else... conditional statements around which invoiceline you will execute. So the simple answer is to do the invoice header insert at the end, which will force the driver to submit the inserts for the Invoice into QuickBooks.

Here we create an invoice with 3 lines by using 3 InvoiceLine INSERT commands (with the FQSaveToCache caching flag set true) followed by the Invoice table (header) insert, which is automatically designed to pull in all cached InvoiceLine records and save immediately.

INSERT INTO "InvoiceLine" ("InvoiceLineItemRefListID", "InvoiceLineDesc",
"InvoiceLineRate", "InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID",
"FQSaveToCache") VALUES ('250000-933272656', 'Building permit 1', 1.00000,
1.00, '20000-999022286', 1)

INSERT INTO "InvoiceLine" ("InvoiceLineItemRefListID", "InvoiceLineDesc",
"InvoiceLineRate", "InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID",
"FQSaveToCache") VALUES ('250000-933272656', 'Building permit 2', 2.00000,
2.00, '20000-999022286', 1)

INSERT INTO "InvoiceLine" ("InvoiceLineItemRefListID", "InvoiceLineDesc",
"InvoiceLineRate", "InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID",
"FQSaveToCache") VALUES ('250000-933272656', 'Building permit 3', 3.00000,
3.00, '20000-999022286', 1)

INSERT INTO "Invoice" ("CustomerRefListID", "ARAccountRefListID", "TxnDate",
"RefNumber", "BillAddressAddr1", "BillAddressAddr2", "BillAddressCity",
"BillAddressState", "BillAddressPostalCode", "BillAddressCountry",
"IsPending", "TermsRefListID", "DueDate", "ShipDate", "ItemSalesTaxRefListID",
"Memo", "IsToBePrinted", "CustomerSalesTaxCodeRefListID") VALUES ('470001-1071525403',
'40000-933270541', {d'2002-10-01'}, '1', 'Brad Lamb', '1921 Appleseed
Lane', 'Bayshore', 'CA', '94326', 'USA', 0, '10000-933272658',
{d'2002-10-31'}, {d'2002-10-01'}, '2E0000-933272656', 'Memo Test', 0,
'10000-999022286')

 

  Top 
  tom 
  
 Group: Members 
 Posts: 6 
 Joined: 2006-06-01 
 Profile
 Posted : 2006-06-07 10:20:50

Is the invoice header necessary in other cases? I seem to be getting my other invoices into quickbooks fine without making a "Insert into Invoices..." query?  I can see the reason for using it to submit the inserts into quickbooks but is it necessary.

Tom

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-06-07 10:56:01
For multiple line transactions, you need to set FqSaveToCache to 0 or insert the header to commit the cached transactions (not both). 

  Top 
  tom 
  
 Group: Members 
 Posts: 6 
 Joined: 2006-06-01 
 Profile
 Posted : 2006-06-07 11:05:32

One last question --- hopefully. What is the minimum fields that are required for the Invoice Insert command? I would only like to send the minimum info that is required?

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-06-07 12:57:24

This would be the minimum:

INSERT INTO "Invoice" ("CustomerRefListID") VALUES ('470001-1071525403')

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to