ASP.NET VETtrak API web services
ContentsIndexHome
PreviousUpNext
VT_API.AddWebInvoice Method

Record an Invoice for a Web Enrolment. 

Calling this will cause an invoice to be created for the web enrolment when it is processed. This can be used instead of AddWebPayment to cause an invoice to be created without a payment. It also allows other options for the invoice to be specified, including a purchase order number, the invoicee (either the enrolee or another employer), and whether the invoice should be combined with an existing invoice for the invoicee and occurrence. 

This can also be used in conjunction with AddWebPayment to specify additional options for the invoice that will be created (and that the payment will be recorded against) when the enrolment is processed. Note than an invoice will always be created for the new enrolment when AddWebPayment is called, so other than to specify these additional options for the invoice, it is not necessary to call this function when using AddWebPayment

A Web Enrolment ID (webEnrolId) is passed as a parameter. This should be the ID returned by the function used to create the enrolment: AddClientWebEnrolment or AddEmployerWebEnrolment

For the webEmployerId, pass 0 or null to invoice the enrolee (this is standard behaviour). To invoice another employer, call AddLooseWebEmployer to create a web employer, and pass the ID of that employer into this function as webEmployerId. 

For the combineInvoices flag, pass 0 to always create a new invoice (this is standard behaviour). To combine this invoice with a previous invoice, pass 1 for combineInvoices. This will cause the enrolment to be included on the latest existing invoice for the invoicee and occurrence, if there is one. If there is no existing invoice for the invoicee and occurrence, a new invoice is created. Note that even if combineInvoices is 1, if the latest existing invoice for the invoicee and occurrence is "locked" (that is, a custom VETtrak extension has marked the invoice as having been exported to an external system), a new invoice will still be created. 

A token is passed for authentication. If the authentication fails, or other errors occur, NO INVOICE is recorded. The result of the authentication is represented by a TAuthenticate object. 

A call to GetWebEnrolment could be used to check the value of database fields updated by AddWebInvoice. 

Requires a valid registration key entry for the Finance feature. 

This function has security level "Protected", and can only be accessed by users that have explicitly been granted permission to the API.

C#
[WebMethod(Description = "Records an invoice against the existing web enrolment ID")]
public TAuthenticate AddWebInvoice(string token, int webEnrolId, string purchaseOrderNumber, int? webEmployerId, int combineInvoices);
Parameters 
Description 
string token 
String containing a token. 
int webEnrolId 
Integer ID of Web Enrolment. 
string purchaseOrderNumber 
String - the Purchase Order Number to record on the invoice. Maximum length 20 characters. 
int? webEmployerId 
Integer ID of the web employer that will pay the invoice. Pass 0 or null to make the enrolee the invoicee (this is the normal case). 
int combineInvoices 
0 to make this a separate invoice, or 1 to combine this with any existing invoice for the invoicee and occurrence. 

TAuthenticate : an Authenticate Object containing the result of the update.

Copyright (c) VETtrak 2022. All rights reserved.