Knowledgebase
[QODBC-Desktop] How to create Credit Memos
Posted by brad waddell on 12 March 2009 05:21 PM

An Example of creating Credit Memos

Create One CreditMemo with Three Lines

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

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

First Line

INSERT INTO "CreditMemoLine" ("CustomerRefListID", "ARAccountRefListID", "TxnDate", "RefNumber", "Memo", "CreditMemoLineItemRefListID", "CreditMemoLineDesc", "CreditMemoLineQuantity", "CreditMemoLineRate", "FQSaveToCache") VALUES ('180000-933272658', '40000-933270541', {d'2003-12-15'}, '1', 'Test Memo 1', '1E0000-933272656', 'Test Desc 1', 1.0, 11.1, 1)

Second Line

INSERT INTO "CreditMemoLine" ("CustomerRefListID", "ARAccountRefListID", "TxnDate", "RefNumber", "Memo", "CreditMemoLineItemRefListID", "CreditMemoLineDesc", "CreditMemoLineQuantity", "CreditMemoLineRate", "FQSaveToCache") VALUES ('180000-933272658', '40000-933270541', {d'2003-12-15'}, '1', 'Test Memo 2', '1E0000-933272656', 'Test Desc 2', 2.0, 22.2, 1)

Third (Last) Line

INSERT INTO "CreditMemoLine" ("CustomerRefListID", "ARAccountRefListID", "TxnDate", "RefNumber", "Memo", "CreditMemoLineItemRefListID", "CreditMemoLineDesc", "CreditMemoLineQuantity", "CreditMemoLineRate", "FQSaveToCache") VALUES ('180000-933272658', '40000-933270541', {d'2003-12-15'}, '1', 'Test Memo 3', '1E0000-933272656', 'Test Desc 3', 3.0, 33.3, 0)

 

Create One CreditMemo with Three Lines with All Shared Header Information

Note: This creates one CreditMemo with three lines. Saving the CreditMemo saves the lines with it. Note the FQSaveToCache field, set to True.

First Line

INSERT INTO "CreditMemoLine" ("CreditMemoLineItemRefListID", "CreditMemoLineDesc", "CreditMemoLineQuantity", "CreditMemoLineRate", "FQSaveToCache") VALUES ('1E0000-933272656', 'Test Desc 1', 1.0, 11.1, 1)

Second Line

INSERT INTO "CreditMemoLine" ("CreditMemoLineItemRefListID", "CreditMemoLineDesc", "CreditMemoLineQuantity", "CreditMemoLineRate", "FQSaveToCache") VALUES ('1E0000-933272656', 'Test Desc 2', 2.0, 22.2, 1)

Third Line

INSERT INTO "CreditMemoLine" ("CreditMemoLineItemRefListID", "CreditMemoLineDesc", "CreditMemoLineQuantity", "CreditMemoLineRate", "FQSaveToCache") VALUES ('1E0000-933272656', 'Test Desc 3', 3.0, 33.3, 1)

Shared Header Information

INSERT INTO "CreditMemo" ("CustomerRefListID", "ARAccountRefListID", "TxnDate", "RefNumber", "Memo") VALUES ('180000-933272658', '40000-933270541', {d'2003-12-15'}, '1', 'Test Memo')

 

Create Three CreditMemo with One Line Each

Note: This creates three CreditMemo with one line each. Note the FQSaveToCache field is not specified (or can be set to false)

First CreditMemo

INSERT INTO "CreditMemoLine" ("CustomerRefListID", "ARAccountRefListID", "TxnDate", "RefNumber", "Memo", "CreditMemoLineItemRefListID", "CreditMemoLineDesc", "CreditMemoLineQuantity", "CreditMemoLineRate") VALUES ('180000-933272658', '40000-933270541', {d'2003-12-15'}, '1', 'Test Memo 1', '1E0000-933272656', 'Test Desc 1', 1.0, 11.1)

Second CreditMemo

INSERT INTO "CreditMemoLine" ("CustomerRefListID", "ARAccountRefListID", "TxnDate", "RefNumber", "Memo", "CreditMemoLineItemRefListID", "CreditMemoLineDesc", "CreditMemoLineQuantity", "CreditMemoLineRate") VALUES ('180000-933272658', '40000-933270541', {d'2003-12-15'}, '1', 'Test Memo 2', '1E0000-933272656', 'Test Desc 2', 2.0, 22.2)

Third CreditMemo

INSERT INTO "CreditMemoLine" ("CustomerRefListID", "ARAccountRefListID", "TxnDate", "RefNumber", "Memo", "CreditMemoLineItemRefListID", "CreditMemoLineDesc", "CreditMemoLineQuantity", "CreditMemoLineRate") VALUES ('180000-933272658', '40000-933270541', {d'2003-12-15'}, '1', 'Test Memo 3', '1E0000-933272656', 'Test Desc 3', 3.0, 33.3)

 

(156 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).