Printing & Document Templates

Template variables and helpers: currency, Jalali dates, translations

Reference for inserting document data, formatting numbers, displaying Dari text, and using date helpers.

Jul 11, 2026

This reference lists the most common variables and helper functions available in Usystems templates. Use these in your Handlebars template code (e.g., {{variable_name}}) to insert dynamic document data.

Document data variables (examples by document type):

VariableExampleUse
{{invoice.number}}INV-2026-001Invoice number or reference code
{{invoice.date}}2026-07-03Document creation date (use with date helper)
{{customer.name}}Acme Ltd.Customer or contact name
{{customer.code}}C-0042Customer or vendor code
{{contact.phone}}+93 700 123456Phone number
{{contact.email}}info@acme.exampleEmail address
{{total_amount}}5000.00Total invoice or bill amount
{{tax_amount}}500.00Total tax
{{line_items}}(array)List of invoice/bill line items; use with {{#each}} loop
{{item.description}}Widget A – BlueItem name or description
{{item.quantity}}10Quantity ordered or sold
{{item.unit_price}}500.00Price per unit
{{item.total}}5000.00Line item total
{{business.name}}MyCompany TradingBusiness/organization name
{{business.address}}123 Market St, KabulBusiness address
{{business.registration}}Tax ID: 123456Business registration or tax ID

Date formatting helper:

Use {{date_jalali variable_name}} to display a date in the Jalali (Solar Hijri) calendar, used in Afghanistan and Iran:

<p>Date: {{date_jalali invoice.date}}</p>
<!-- Output: Date: 1405-04-12 -->

Currency and number formatting:

Use {{currency variable_name}} to format a number with thousand separators and decimal places according to the document's currency:

<p>Total: {{currency total_amount}} {{currency_code}}</p>
<!-- Output: Total: 5,000.00 AFN -->

Translation helper (multi-language support):

Use {{t "key.path"}} to insert translated text from your organization's language files. This is useful for adding labels, titles, or standard text in the user's preferred language:

<h1>{{t "invoice.title"}}</h1>
<p>{{t "invoice.due_date_label"}}</p>
<!-- Renders in English, Dari, or Pashto depending on the active language -->

Common translation keys (examples; your system may have additional keys):

  • invoice.title → "Invoice"
  • invoice.due_date_label → "Due Date"
  • report.page_of → "Page X of Y"
  • common.total → "Total"
  • common.quantity → "Quantity"

Conditional logic (Handlebars if/else):

Use {{#if condition}}...{{/if}} to show or hide content based on a field value:

{{#if discount_amount}}
  <p>Discount: {{currency discount_amount}}</p>
{{/if}}
<!-- Shows discount only if a discount amount exists -->

Loops (iterating over line items):

Use {{#each line_items}}...{{/each}} to repeat a block of HTML for each item in a list:

<table>
  <tr>
    <th>Description</th>
    <th>Quantity</th>
    <th>Unit Price</th>
    <th>Total</th>
  </tr>
  {{#each line_items}}
  <tr>
    <td>{{item.description}}</td>
    <td>{{item.quantity}}</td>
    <td>{{currency item.unit_price}}</td>
    <td>{{currency item.total}}</td>
  </tr>
  {{/each}}
</table>

Tips:

  • Not all variables exist on all document types. For example, {{customer.name}} is available on invoices but not on internal journal entries. If a variable is empty or missing, it will render as blank text.
  • Always test your template with real data to confirm variables render correctly. Use the preview function or print a test document.
  • For variables that may be empty (like discount or notes), use the {{#if}} helper to avoid printing blank lines.

Was this helpful?

More like this