[QODBC-Desktop] How to Import Bill with Expense line and Item line using QODBC
Posted by brad waddell on 12 March 2009 05:21 PM
An Example of Importing a Bill with Item Line and Expense Line
Note: It's simple, but you need to first create either the Expense or Item lines first and then add the Item or Expense lines afterward like below.
Note: The primary rule is to save the data to the child record first. The child record for each parent/child pair has all the data required by the parent record included in it.
Create the Expense Line
INSERT INTO "BillExpenseLine" ("ExpenseLineAccountRefListID", "ExpenseLineAmount",
Write the Bill Header
INSERT INTO "Bill" ("VendorRefListID", "APAccountRefListID", "TxnDate", "RefNumber",
Determine the TxnID of the new Bill
Note: Please do not close connection between the Insert Bill / BillExpenseLine / BillItemLine otherwise you will not be able to get last inserted ID.
Use the TxnID to append Item lines to the existing Bill
Note: The LastInsertID returned was: 5CAD-1197762987
INSERT INTO "BillItemLine" ("TxnID", "ItemLineItemRefListID",
Result in QuickBooks
This results in the following Bill in QuickBooks with both an Expense and Item line: