To understand the process, I will do a simple one line estimate example and then add a new line.
FIRST TO CREATE THE ESTIMATE The following SQL statement will create a new estimate:
INSERT INTO "EstimateLine" ("CustomerRefListID", "RefNumber", "EstimateLineItemRefListID", "EstimateLineDesc", "EstimateLineRate", "EstimateLineAmount", "EstimateLineSalesTaxCodeRefListID", "FQSaveToCache") VALUES ('470001-1071525403', '201', '250000-933272656', 'Building permit No 201', 100.00000, 100.00, '20000-999022286', 0)
Once the etimate is created, we can locate the TxnID using the QODBC stored procedure (as long as we haven't broken our QODBC connection) or by quering the Estimate table later on:
SP_LASTINSERTID EstimateLine
The TxnID for the new estimate is 5D0A-1197668108, so we can now add additional lines to the Estimate by using the TxnID and doing:
INSERT INTO "EstimateLine" ("TxnID", "EstimateLineItemRefListID", "EstimateLineDesc", "EstimateLineRate", "EstimateLineAmount", "EstimateLineSalesTaxCodeRefListID") VALUES ('5D0A-1197668108', '250000-933272656', 'Building permit No 202', 200.00000, 200.00, '20000-999022286')
which results in the following estimate with two lines in the QuickBooks 2007 Premier USA Edition - Sample Rock Castle Construction company file:
|