Common use cases
Showing a different billing account per currency
Using the document.currency
variable, you can easily display different messages based on the document's currency. A common use case is to show a different bank account for euros and dollars.
{% if document.currency == 'EUR' %}
<p>Show EUR bank account</p>
{% elsif document.currency == 'USD' %}
<p>Show USD bank account</p>
{% endif %}
Adding a negative sign for refunds
In Quaderno, refunds are shown with a positive sign. If you prefer to display them with a negative sign, simply add the following conditional before each amount.
<tr>
<td colspan="2"> </td>
<td class="label">{{ labels.subtotal }}</td>
<td class="right">
<strong>
{% if document.type == 'Credit' %}
-
{% endif %}
{{ document.subtotal | money }}
</strong>
</td>
</tr>
Displaying applied discounts by line item
In the sample templates, discounts are shown totalized. If you need to show discounts broken down by line item, you'll need to access the {{ item.discount_rate }}
variable and modify the loop that renders the line items.
Note that some integrations might send discounts as negative line items with no discount.
In the loop for the invoice's line items, add the {{item.discount_rate}}
variable to the table and change it to 5 columns.
<tr>
<td>{{item.description}}</td>
<td class="right">{{item.quantity | precision}}</td>
<td class="right">{{item.unit_price | money}}</td>
<td class="right">{{item.discount_rate}}%</td>
<td class="right">{{item.subtotal | money}}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="5">
Displaying order numbers or other document data
You can display any data that can be obtained through Quaderno variables. To show the order number, use {{ document.po_number }}
.
Adding information to your documents via API
Using our API, you can add additional information to any document using the custom_metadata
hash.
For example, when creating an invoice, send the following hash:
{ "custom_metadata": { "your_internal_field": "value" } }
And you will be able to access your_internal_field
from document
with {{ document.your_internal_field }}
.
Displaying a message for non-European customers
In some cases, regulatory agencies in a country may recommend including specific text on an invoice, for example, to reference a legal article justifying the absence of taxes in a particular situation.
In this example, we'll display a message in French when the customer is outside the EU:
{% unless contact.eu_member? %}
<p> TVA non applicable pour les clients hors UE - art. 259-1 du CGI</p>
{% endunless %}
Displaying the currency ISO code
Sometimes it might be confusing to show just the currency symbol, as some are shared in different countries. For instance, the "$" symbol is used in both the United States and Canada.
To display the currency ISO code, you can use the money
filter: {{ document.total | money: true }}
Showing reverse charge legal notes in your B2B invoices
You can show a legal note when reverse charge applies to your invoice, with:
{% if document.reverse_charged? %}
<p> Your country's reverse charge text </p>
{% endif %}
The variable document.reverse_charged?
is true when a valid customer tax id was provided on the transaction. Check the “selling to businesses” use case from our tax calculation guide to learn more.
Please note that invoices created from Stripe’s charges already provide a message “Tax amount subject to reverse charge” into the document.notes
, and all sample templates show that variable when it exists.