Here is some example code and the setup data required:
CustomerRefListID = '790000-1071511999' (Required) DepositToAccountRefListID = '80000-933270541' (Undeposited Funds) TotalAmount = 129.30 (Necessary) AppliedToTxnTxnID = '4909-1071512260' (Find from Invoice Table) AppliedToTxnPaymentAmount = 129.30 (Necessary, otherwise the payment in TotalAmount will be unapplied) AppliedToTxnSetCreditCreditTxnID = '5540-1197772280' (Find from CreditMemo Table) AppliedToTxnSetCreditAppliedAmount = 10.03 TxnDate = 2007-12-15
TO RECEIVE A PAYMENT INSERT INTO ReceivePaymentLine (CustomerRefListID, DepositToAccountRefListID, TotalAmount, AppliedToTxnTxnID, AppliedToTxnPaymentAmount, TxnDate, FQSaveToCache) Values ('790000-1071511999', '80000-933270541', 129.30, '4909-1071512260', 129.30, {d'2007-12-15'} ,0)
TO APPLY A CREDIT INSERT INTO ReceivePaymentLine (CustomerRefListID, DepositToAccountRefListID, TotalAmount, AppliedToTxnTxnID, AppliedToTxnPaymentAmount, AppliedToTxnSetCreditCreditTxnID, AppliedToTxnSetCreditAppliedAmount, TxnDate, FQSaveToCache) Values ('790000-1071511999', '80000-933270541', 129.30, '4909-1071512260', 129.30, '5540-1197772280', 10.03, {d'2007-12-15'}, 0)
See: How do I create a new Customer, invoice them and mark the invoice as paid? for a complete example.
See also: How to I handle Customer credits on account? for more information on the procedure for receiving the payment before the Invoice. |