Advanced [Exercise 3: Reference values] (Training slides exercise)

  • Create a reconciliation that sums up VAT declarations of the book year
  • The handle for this template should be vat_declaration
  • Also checks if the company is still VAT obligated

|509px;x271px;

  • Create a separate reconciliation template
  • Automate a text that should read: is <VAT obligated/non VAT obligated>
  • In case of VAT obligated: show what the total was (value from the previously made reconciliation)
  • Make sure that, whether it’s due or deductible, VAT value is always printed as positive

|597px;x70px;

Solution

Code for main template:

{% ic %}{::infotext}Values from this reconciliation are referred to in other templates{:/infotext}{% endic %}
*Vat obligated?* {% input custom.tax.check as:boolean %}

{% stripnewlines %}
| Vat declaration
| VAT deductible
| VAT due
| VAT total
{% newline %}
|------
|------:
|------:
|------:+
{% newline %}
{% fori tax in custom.taxes %}
  | {% input tax.information %}
  | {% =$1+input tax.deductible as:currency %}
  | {% =$2+input tax.due as:currency %}
  | {{ tax.deductible+tax.due }}
  {% newline %}
{% endfori %}
|_^ ^_
|_^ {{ $1 | currency }} ^_
|_^ {{ $2 | currency }} ^_
|_^ {% =$0+ $1-$2 %} ^_
{% endstripnewlines %}

{% result 'total_vat' $0 %}

Code of the second reconciliation template with text:

{{ company.name }} is {% if period.reconciliations.vat_declaration.custom.tax.check != true %}non{% endif %} VAT obligated{% if period.reconciliations.vat_declaration.custom.tax.check == true %}; in bookyear {{ period.end_date | date:"%Y" }} they had {{ period.reconciliations.vat_declaration.results.total_vat | currency_dc }} due.{% else %}.{% endif %}

Solution using HTML Tables:

{% ic %}{::infotext}Values from this reconciliation are referred to in other templates{:/infotext}{% endic %}
*Vat obligated?* {% input custom.tax.check as:boolean %}

<table class="usr-width-100">
  <thead>
    <tr>
      <th class="usr-line-bottom"><b>Vat declaration</b></th>
      <th class="usr-line-bottom usr-align-right"><b>VAT deductible</b></th>
      <th class="usr-line-bottom usr-align-right"><b>VAT due</b></th>
      <th class="usr-line-bottom usr-align-right"><b>VAT total</b></th>
    </tr>
  </thead>
  <tbody>
    {% fori tax in custom.taxes %}
      <tr>
        <td class="">{% input tax.information %}</td>
        <td class="usr-align-right">{% input tax.deductible as:currency %}{% assign tax_deductible = tax_deductible+tax.deductible %}</td>
        <td class="usr-align-right">{% input tax.due as:currency %}{% assign tax_due = tax_due+tax.due %}</td>
        <td class="usr-align-right">{{ tax.deductible+tax.due }}</td>
      </tr>
    {% endfori %}
    <tr>
      <td class="usr-line-top usr-line-bottom"></td>
      <td class="usr-line-top usr-line-bottom usr-align-right"><b>{{ tax_deductible | currency }}</b></td>
      <td class="usr-line-top usr-line-bottom usr-align-right"><b>{{ tax_deductible | currency }}</b></td>
      <td class="usr-line-top usr-line-bottom usr-align-right"><b>{% assign total_tax = tax_deductible+tax_due %}{% =$0+ $1-$2 %}</b></td>
    </tr>
  </tbody>
</table>

{% result 'total_vat' total_tax %}