Knowledgebase
[QODBC-Desktop] How to create Supplier Credits (VendorCredit)
Posted by brad waddell on 12 March 2009 05:21 PM

An Example of creating VendorCredit

Creates One VendorCredit with Three Lines

Note: This creates one VendorCredit with three lines. Note the FQSaveToCache field, set to True except on the last one.

Note: The primary rule is to save the data to the child record first. The child record for each parent/child pair has all of the data required by the parent record included in it.
Please do not close connection between the Insert of Child / Header & sp_lastinsertID otherwise you will not be able to get last inserted ID.

First Line

INSERT INTO "VendorCreditItemLine" ("VendorRefListID", "APAccountRefListID", "TxnDate", "RefNumber", "Memo", "ItemLineItemRefListID", "ItemLineDesc", "ItemLineCost", "ItemLineQuantity", "ItemLineAmount", "ItemLineCustomerRefListID", "FQSaveToCache") VALUES ('90000-933272656', 'C0000-933270541', {d'2003-12-15'}, '1', 'Memo Test', 'E0000-933272656', 'Install tile or counter', 1.11, 1.00, 1.11, '280000-933272658', 1)

Second Line

INSERT INTO "VendorCreditItemLine" ("VendorRefListID", "APAccountRefListID", "TxnDate", "RefNumber", "Memo", "ItemLineItemRefListID", "ItemLineDesc", "ItemLineCost", "ItemLineQuantity", "ItemLineAmount", "ItemLineCustomerRefListID", "FQSaveToCache") VALUES ('90000-933272656', 'C0000-933270541', {d'2003-12-15'}, '1', 'Memo Test', 'D0000-933272656', 'Roofing', 2.22, 2.00, 4.44, '280000-933272658', 1)

Third (Last) Line

INSERT INTO "VendorCreditItemLine" ("VendorRefListID", "APAccountRefListID", "TxnDate", "RefNumber", "Memo", "ItemLineItemRefListID", "ItemLineDesc", "ItemLineCost", "ItemLineQuantity", "ItemLineAmount", "ItemLineCustomerRefListID", "FQSaveToCache") VALUES ('90000-933272656', 'C0000-933270541', {d'2003-12-15'}, '1', 'Memo Test', '250000-933272656', 'Permit', 3.33, 3.00, 9.99, '280000-933272658', 0)

 

Create One VendorCredit with Three Lines with All Shared Header Information

Note: This creates one VendorCredit with three lines. Note the FQSaveToCache field, set to True. Saving the VendorCredit will save the lines.

First Line

INSERT INTO "VendorCreditItemLine" ("ItemLineItemRefListID", "ItemLineDesc", "ItemLineCost", "ItemLineQuantity", "ItemLineAmount", "ItemLineCustomerRefListID", "FQSaveToCache") VALUES ('E0000-933272656', 'Install tile or counter', 1.11, 1.00, 1.11, '280000-933272658', 1)

Second Line

INSERT INTO "VendorCreditItemLine" ("ItemLineItemRefListID", "ItemLineDesc", "ItemLineCost", "ItemLineQuantity", "ItemLineAmount", "ItemLineCustomerRefListID", "FQSaveToCache") VALUES ('D0000-933272656', 'Roofing', 2.22, 2.00, 4.44, '280000-933272658', 1)

Third Line

INSERT INTO "VendorCreditItemLine" ("ItemLineItemRefListID", "ItemLineDesc", "ItemLineCost", "ItemLineQuantity", "ItemLineAmount", "ItemLineCustomerRefListID", "FQSaveToCache") VALUES ('250000-933272656', 'Permit', 3.33, 3.00, 9.99, '280000-933272658', 1)

Shared Header Information

INSERT INTO "VendorCredit" ("VendorRefListID", "APAccountRefListID", "TxnDate", "RefNumber", "Memo") VALUES ('90000-933272656', 'C0000-933270541', {d'2003-12-15'}, '1', 'Memo Test')

(136 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please complete the captcha below (we use this to prevent automated submissions).