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

|638px;x340px;

  • 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 %}