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 : Duplicate invoice on Insert of new InvoiceLineSearch Forum

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

 New Topic 
 
 Post Reply 
[1]  
 Duplicate invoice on Insert of new InvoiceLine 
 Author   Message 
  David 
  
 Group: Members 
 Posts: 1 
 Joined: 2006-09-15 
 Profile
 Posted : 2006-09-15 03:54:02
I am trying to add a new line item to an existing invoice using the query below and I am getting a new invoice created with the line item listed in the new invoice not appended to the original invoice.
 
INSERT INTO InvoiceLine (CustomerRefListID, RefNumber, InvoiceLineItemRefListID, InvoiceLineDesc, InvoiceLineRate, InvoiceLineAmount, InvoiceLineSalesTaxCodeRefListID, FQSaveToCache)
VALUES ('3A70000-1158067598', '8339', '7E60001-1131471613', 'AWB 67335828895',
0, 0, '20000-1081779570', 0)
 
 

 
David A. Mugler 
 
  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-09-15 08:37:28

First you need to create the Invoice or locate the invoice you want to add lines too, 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 if the Invoice already exists, or we want to find it later on, you can locate the TxnID by finding by the RefNumber:

SELECT TxnID from Invoice where RefNumber='QODBCClass2'

The TxnID for the 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 different Class values for each line:

See also: Do you have an example on how to modify existing invoices and add lines also? 

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to