Twig template variables: Invoices
The invoice variables show data of an invoice (for example, the totals, the payments and the line items). Each variable starts with invoice.
Variables that check a condition
Some of these variables show if a condition is true. For example, invoice.HasAnimal is true if the invoice has a related patient record.
To use a variable of this type:
- Put the variable in a Twig
ifstatement. - Between the
iftag and theelsetag, put the text to show when the condition is true. - Between the
elsetag and theendiftag, put the text to show when the condition is not true.
if statement, the variable shows 1 when the condition is true. When the condition is not true, the variable shows no value.Example:
{% if invoice.HasAnimal %}
Patient: {{ invoice.AnimalName }}
{% else %}
This invoice is not for a patient.
{% endif %}In this example:
invoice.HasAnimalis true if the invoice has a related patient record.- When the condition is true, the invoice shows the name of the patient.
- When the condition is not true, the invoice tells the client that the invoice is not for a patient.
| Record | The document shows |
|---|---|
| An invoice for Newsflash, the patient of Mr Riker, Will (200019). The condition is true. | Patient: Newsflash |
| An invoice for Mr Riker, Will (200019), for a product only. The invoice has no patient. The condition is not true. | This invoice is not for a patient. |
Variables that show a list
Some of these variables show a list. For example, invoice.AllocatedPayments shows a list of the payments allocated to the invoice.
To use a variable of this type:
- Put the variable in a Twig
forloop. - Between the
fortag and theendfortag, put the text to show for each item. - After
for, enter a name for each item in the list.
Example:
{% for payment in invoice.AllocatedPayments %}
{{ payment.Date|dateformat }}: {{ payment.Amount }}
{% endfor %}In this example:
invoice.AllocatedPaymentsis the list of the payments allocated to the invoice.paymentis the name for each item in the list.payment.Dateandpayment.Amountshow the date and the quantity of each payment.- The document shows the text between the tags one time for each item in the list.
Variables that show a date
Some of these variables show a date. To show the date in a format that is easy to read, use the dateformat Twig filter. The Function column of each variable of this type has a note about the dateformat filter.
After the variable name, enter a vertical bar and dateformat.
Example:
{{ invoice.ApprovedAt|dateformat }}In this example:
invoice.ApprovedAtshows the approval date of the invoice.- The
dateformatfilter shows the date in a format that is easy to read.
Variables
| Name | Classic template system equivalent? | Function |
|---|---|---|
{{ invoice.Name }} | No | Shows the name of the invoice. Note: This variable uses this format for the invoice name: <invoice-number>-<invoice-date>. <invoice-number> is the number of the invoice. <invoice-date> is the date of the invoice. The date obeys your date format configuration. |
{{ invoice.StatusName }} | No | Shows the status of the invoice. The possible values are:
|
{{ invoice.ClientContactName }} | No | Shows the name of the client of the invoice. |
{{ invoice.TaxBreakDownString }} | {InvoiceTaxBreakdown} | Shows the dollar quantity of each tax rate of the invoice. |
{{ invoice.PaymentMethods }} | {InvoicePaymentMethod} | Shows the payment method of the invoice. |
{{ invoice.TotalDiscountAmountIncTax }} | {InvoiceTotalDiscountAmountIncTax} | Shows the total discount quantity of the invoice. The value includes tax. |
{{ invoice.TotalDiscountPercent }} | {InvoiceTotalDiscountPercentage} | Shows the total discount quantity of the invoice. |
{{ invoice.InvoiceTypeName }} | {InvoiceTypeName} | Shows the type of the invoice (for example, if the invoice is a credit note). |
{{ invoice.OrderNumber }} | {InvoiceOrderNumber} | Shows the purchase order numbers of the invoice. |
{{ invoice.ApprovedAt }} | No | Shows the approval date of the invoice. Note: To show a date value that is easy to read, use this variable with the dateformat Twig filter. For example:For more information, refer to Variables that show a date. |
{{ invoice.FreightGstRate }} | No | Shows the GST rate of the freight of the invoice. |
{{ invoice.FreightGst }} | No | Shows the total GST of the freight of the invoice. |
{{ invoice.Freight }} | No | Shows the total dollar value of the freight of the invoice. The value does not include tax. |
{{ invoice.Outstanding }} | No | Shows the same value as {{ invoice.Due }}. |
{{ invoice.Due }} | {InvoiceDue} | Shows the outstanding dollar value of the invoice. Tip: Use this variable to show the dollar value that the client must pay. |
{{ invoice.Allocated }} | No | Shows the same value as {{ invoice.Paid }}. |
{{ invoice.Paid }} | {InvoicePaid} | Shows the paid dollar value of the invoice. Note: ezyVet calculates the value as the total dollar value of the invoice minus {{ invoice.Due }}. |
{{ invoice.Gst }} | {InvoiceGst} | Shows the total tax of the invoice. |
{{ invoice.Total }} | {InvoiceTotal} | Shows the total dollar value of the invoice. |
{{ invoice.Date }} | {InvoiceDate} | Shows the date of the invoice. |
{{ invoice.DueDate }} | {InvoiceDueDate} | Shows the due date of the invoice. |
{{ invoice.CustomerReference }} | {InvoiceCustomerReference} | Shows the reference number of the invoice. |
{{ invoice.AllocatedHtml }} | No | Shows the payment allocation values of the invoice. Note: To show each payment allocation value on a new line, enter: Note: To show a character between each payment allocation value, use the replace Twig filter. Put the character between quotation marks. For example, to show a | character, enter: To show a comma, enter: |
{{ invoice.InvoiceItemsHtml }} | No | Shows the line items of the invoice. This variable uses this format to show each line item: <product-code>-<barcode>-<product-name> x <quantity> @ <unit-price>. The unit price is the price after the discount. The value includes tax. If the product has no barcode, this variable does not show a barcode.Note: To show each line item on a new line, enter: |
{{ invoice.Comments }} | {InvoiceComments} | Shows all comments of the Comments section of the invoice. Note: This variable shows the content without formatting and without line breaks. |
{{ invoice.Department.TaxNumber }} | {DepartmentTaxNumber} | Shows the tax number of the department that person set for the invoice. |
{{ invoice.Consult.TherapeuticSpecifics }} | No | Shows the content of the Specifics box of clinical procedure records of the clinical record. |
{{ financial.DivisionTaxNumber }} | No | Shows the tax number of the department that you are signed in to. |
{{ invoice.Consult.Date|dateformat }} | {ConsultDate} | Shows the date of the clinical record. |
{{ invoice.ClientContact.AllContacts }} | No | Shows the name of the contact record and its Secondary Contact name. Note: The template variable shows & between the two names. Note: If the contact record does not have a Secondary Contact name, the template variable shows the name of the contact record only. |
{{ invoice.surchargeAmount }} | {InvoiceSurchargeAmount} | Shows the surcharge quantity. |
{{ invoice.paymentMethodsIncludingSurcharge }} | {invoicePaymentMethodsIncludingSurcharge} | Shows the payment methods that have a surcharge. |
{{ invoice.NonBundleTotalDiscount }} | No | Shows the total discount of the invoice without the discounts for fixed-price product bundles. |
{{ invoice.NonBundleTotalDiscountIncTax }} | No | Shows the total discount of the invoice with tax without the discounts for fixed-price product bundles. |
{{ invoice.PaymentAmountTendered }} | {PaymentAmountTendered} | Shows the cash quantity paid of the payment. |
{{ invoice.PaymentChange }} | {PaymentChange} | Shows the cash change of the payment. |
{{ invoice.PaymentRounding }} | {PaymentRounding} | Shows the cash rounding value of the payment. |
{{ invoice.LineItems }} | No | Shows a list of the line items of the invoice. Note: Use this variable in a Twig for loop. For example:In the loop, you can use all invoice line item variables. For more information, refer to Variables that show a list. |
{{ invoice.AllocatedPayments }} | No | Shows a list of the payments allocated to the invoice. Note: Use this variable in a Twig for loop. For example:For more information, refer to Variables that show a list. |
{{ invoice.Animal }} | No | Shows the patient record of the invoice. Tip: To show more information about the record, add one more variable after this variable, for example {{ invoice.Animal.Name }}. |
{{ invoice.AnimalName }} | No | Shows the name of the patient of the invoice. |
{{ invoice.HasAnimal }} | No | True if the invoice has a related patient record. |
{{ invoice.ApprovedByUser }} | No | Shows the record of the staff member who approved the invoice. Tip: To show more information about the record, add one more variable after this variable, for example {{ invoice.ApprovedByUser.Name }}. |
{{ invoice.User }} | No | Shows the record of the staff member who made the invoice. Tip: To show more information about the record, add one more variable after this variable, for example {{ invoice.User.Name }}. |
{{ invoice.ContactInvoiceHasBeenMadeFor }} | No | Shows the contact record of the owner of the patient of the clinical record of the invoice. Note: The owner of the patient can be different from the contact that ezyVet invoices. |
{{ invoice.CustomerOrder }} | No | Shows the online customer order record that the invoice came from. Note: If the invoice did not come from an online customer order, this variable shows no value. |
{{ invoice.Financial }} | No | Shows the ledger record of the invoice. Note: You can use these statement line variables after this variable:
{{ invoice.Financial.AllocatedAmount }}. |
{{ invoice.PaymentTerms }} | No | Shows the payment terms record of the invoice. Tip: To show more information about the record, add one more variable after this variable, for example {{ invoice.PaymentTerms.Name }}. |
{{invoice.HasBalanceOutstanding}} | No | Shows if the invoice has an outstanding balance. The possible values are:
|
{{ invoice.HasRemotePaymentMethod }} | No | Shows if ezyVet can supply an online payment link for the invoice. The possible values are:
|
{{invoice.RemotePaymentLink}} | No | Shows the online payment link of the invoice. |
{{ invoice.SurchargeRate }} | No | Shows the surcharge rate for a payment with the online payment link of the invoice, for example 3.5%. Note: If the payment method has no surcharge, this variable shows no value. |
{{ invoice.SurchargeType }} | No | Shows the type of the surcharge of the invoice. The possible values are:
|
{{ invoice.IsSurcharge }} | No | True if the invoice is for a payment surcharge. |
{{ invoice.IncludesTax }} | No | True if the total dollar value of the invoice includes tax. |
{{ invoice.SubTotal }} | No | Shows the total of the invoice without tax and freight. Tip: To include tax, enter {{ invoice.SubTotal(true) }}. |
{{ invoice.TotalDiscountAmount }} | No | Shows the total discount quantity of all line items of the invoice, without tax. Tip: To include tax, enter {{ invoice.TotalDiscountAmount(true) }}. |
{{ invoice.TotalDiscountAmountBeforeTax }} | No | Shows the total of all price adjustments of the line items of the invoice, without tax. |
{{ invoice.OnBilledFromInvoice }} | No | Shows the record of the initial invoice of the on-billed invoice. Note: This variable is applicable to syndicate on-billed invoices. |
{{ invoice.OnBilledPercent }} | No | Shows the share of the initial invoice that the syndicate member pays. This variable uses a percentage to show the value. Note: This variable is applicable to syndicate on-billed invoices. |
{{ invoice.WellnessPlanMemberships }} | No | Shows a list of the wellness plan memberships of the invoice. |
{{ invoice.HasDisabledLines }} | No | True if the invoice has line items that are deactivated. |
{{ invoice.HasDiscounts }} | No | True if the invoice has a line item with a discount. |
{{ invoice.HasNoPending }} | No | True if the invoice has no line items with the Pending status and you have the permission to approve the invoice. Note: This variable uses the permissions of the user who prints or sends the document. The same invoice can show a different result for a different user. Note: For an invoice with a total less than 0, the user must also have the permission to approve credit notes. |
{{ invoice.HasRoundingLine }} | No | True if the invoice has a line item with a rounding value. |
{{ invoice.IsApproved }} | No | True if the invoice is approved. |
{{ invoice.IsLocked }} | No | True if the invoice is locked. |
{{ invoice.IsSent }} | No | True if the invoice has the Sent condition. |
{{ invoice.IsReadyForBilling }} | No | True if the invoice is approved but not locked. |
{{ invoice.IsCreditNote }} | No | True if the total dollar value of the invoice is less than 0. |