Jump to content
Server Maintenance This Week. ×

Applying a Payment to multiple invoices - Sample


PCIPal

This topic is 2255 days old. Please don't post here. Open a new topic instead.

Recommended Posts

#
# This script snippet demonstrates applying a received payment to multiple invoices.
# It assumes that the FileMaker solution has a 'join' table between the payment and the invoice(s), and from the
# join table the txn id of the invoice is accessible.
#
PCQB_RqNew( "ReceivePaymentAdd" )
#adding the remainder of the fields left out of this sample in the interest of brevity
#ensure to add them in your script.
#
#now apply this payment to the invoices..
#go to the related records that indicate which invoices the current FM payment is applied to
#from these records it will be necessary to have access to the invoice txn id and the amount applied to the invoice - design your fm schema accordingly
#
Go to Related Record.....
Go to Record/Request/Page[ First ]
#create the 'related records' to the request
Loop
 # use pcqb_rqaddrelatedrecord to add an application of the payment to a transaction/invoice
 PCQB_RqAddRelatedRecord( "AppliedToTxnAdd" )
 #
 # now add the transaction id for the invoice - this tells QB that this is the invoice to which we are applying part of the payment
 PCQB_RqAddFieldWithValue( "TxnId" ; INV_PMT::Invoice_TXNID )
 #note that INV_PMT::Invoice_TXNID is a place holder for your table/field holding the txnid for the invoice
 #
 # now add the payment amount - the part of the payment applied to the invoice
 PCQB_RqAddFieldWithValue( "PaymentAmount" : INV_PMT::Applied_Amount )
 #note that INV_PMT::Applied_Amount is a place holder for your table/field holding the amount of the current payment that is applied to the invoice
 #
 #very important! - close the related record in the request
 PCQB_RqCloseRelatedRecord
 #
 #and navigate to the next invoice to which the payment is to be applied
 Go to Record/Request/Page[ Next ; Exit After Last ]
End Loop
#
#
 

Link to comment
Share on other sites

This topic is 2255 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.