How to Add a New Line Item to an Existing Purchase Order
DESCRIPTION:We have already known how to create new PurchaseOderLine, Refer How to create a Purchase Order using QODBC for more details. After creating a new line item, we found that the system has automatically create a Purchase Order to contain the new line item. But what should be done if we just want to insert a new line item to an existing Purchase Order/Invoice? Here I will use an example to show how to add a line item to an existing Purchase Order.
Locate and Note Down the Purchase Order TxnID
QuickBooks generates a unique TxnID for each transaction that is added to QuickBooks. A TxnID can be used to refer to the transaction in our following requests.
Here we note this TxnID down:DCC-1071523566
Note: VB DEMO is to be used for testing of QODBC SQL queries only and is not a development tool.
And this is the Purchase Order in QuickBooks:
Insert Line Item with the TxnID of Existing Purchase Order
Here is the query I use to insert line item:
INSERT INTO "PurchaseOrderLine"("TxnID",
"PurchaseOrderLineItemRefListID",
"PurchaseOrderLineDesc",
"PurchaseOrderLineQuantity",
"PurchaseOrderLineRate",
"PurchaseOrderLineAmount",
"FQSaveToCache")
VALUES ('DCC-1071523566', '240000-1071531214',
'Pen9', 1.0, 1.0, 1.11, 0)
Please note that the TxnID is the value we noted down in our 1st step.
And this is the result in QuickBooks: