Skip to main content

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.

<td colspan="2"> </td>
<td class="label">{{ labels.subtotal }}</td>
<td class="right">
{% if document.type == 'Credit' %}
{% endif %}
{{ document.subtotal | money }}

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.

<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>
{% endfor %}
<td colspan="5">

Breaking tables across PDF pages

You can apply different styles when printing and exporting documents as PDF, by modifying the @media print CSS rules included in the default templates.

For instance, when printing documents with a lot of items tables will be shown as a whole by default, moving the entire table to the next page if needed. In case you prefer to break down the items table across pages to optimize the space used in the PDF, you can modify the default behaviour overriding this line:

#items tr { page-break-inside: auto !important }

Now tables with lots of items will use all available space and continue on the next PDF page.

Customize decimal precision in your invoices

Easily adjust decimal precision in Quaderno documents using the precision filter. By default, it displays two decimal places, but you can specify a different number, like in {{ total_amount | precision: 3 }} for three decimal places.

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: {{ | money: true }}

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.