Author Topic: credit memo  (Read 3645 times)

gnickerson

  • Member
  • *
  • Posts: 1
credit memo
« on: July 06, 2009, 07:01:34 AM »
How do I apply a credit memo to a specifc invoice?

Melinda DePalma

  • Member
  • *
  • Posts: 179
    • Productive Computing
Re: credit memo
« Reply #1 on: July 06, 2009, 06:22:38 PM »
According to the OSR documentation CreditMemos are applied to Invoices by creating a ReceivePayment transaction and setting the 'SetCredit' aggregate.  Below is pseudo script outlining the way to apply a creditmemo to an invoice.  Elipsis (...) indicate steps left out for brevity.


PCQB_RqNew( "ReceivePaymentAdd" )
...
Loop
 #for each invoice to receive a payment against or to apply a credit memo - do the following...
 PCQB_RqAddRelatedRecord( "AppliedToTxnAdd")
 PCQB_RqAddFieldWithValue( "TxnID" ; The_Invoice_TxnID )
 ...
 Loop
  #for each creditmemo to be applied to the current invoice
  PCQB_RqAddRelatedRecord( "SetCredit" )
  PCQB_RqAddFieldWithValue( "CreditTxnID" ; the_txnid_of_the_credit_memo )
  PCQB_RqAddFieldWihtValue( "AppliedAmount" ; the_amt_from_the_creditmemo_to_apply )
  #be sure to close the related credit memo record!
  PCQB_RqCloseRelatedRecord
  ...
 End Loop
 ...
 #be sure to close the AppliedToTxnAdd record!
 PCQB_RqCloseRelatedRecord
 ...
End Loop
...
« Last Edit: September 16, 2011, 08:53:02 AM by Melinda DePalma »