CASE: FastForward 2018 - how to build a checklist within a template

Everyone,

This case was presented on our FastForward-event 2018 in Belgium, and as promised, we would provide the whole code to build something like this:

This is the code to generate this completely:


{% comment %}
Below code gives a header with an automatically check for an user to check-off, that will impact the reconciliation as well
{% endcomment %}

{% stripnewlines %}
| 
|
|
|
{% newline %}
|----15%----:
|----35%----
|----15%----:
|----35%----+#
{% newline %}
| {% t "Name client" %}
| {{ company.name | upcase }}
| {% t "Period working papers" %}
| {{ period.end_date | date:"%d-%m-%Y" }}
{% newline %}
| {% t "Prepared by:" %}  
  {% input custom.prepared.check as:boolean %}
  {% if custom.prepared.check == "true" %}
    {% assign check_prep = 0 %}
  {% else %}
    {% assign check_prep = 1 %}
  {% endif %}
| {% unexplained check_prep as:indicator  %}
  {{ custom.prepared.check.updated_by.name  }}
| {% t "Prepared on:" %}
| {{ custom.prepared.check.updated_at | date:"%d/%m/%Y"  }}
{% newline %}
| {% t "Review by:" %}  
  {% input custom.review.check as:boolean %}
  {% if custom.review.check == "true" %}
    {% assign check_review = 0 %}
  {% else %}
    {% assign check_review = 1 %}
  {% endif %}
| {% unexplained check_review as:indicator  %}
  {{ custom.review.check.updated_by.name  }}
| {% t "Review on:" %}
| {{ custom.review.check.updated_at | date:"%d/%m/%Y"  }}
{% endstripnewlines %}

{% comment %}
below code is random text in an infotag; 
it can also give an overview of related templates that need to be linked to (linkto-tag)
- to use a linkto-tag, you will need the handle-name of a recon-template (click on a template to discover that name)
- replace the last part of "period.reconciliations.vaste_activa" in the handle-name you need f.i.: "period.reconciliations.belastingberekening"  
- each recon-template should have an unique handle which can be used!
- a check is added as well in case the template does not exist in the working papers, to give a proper warning
- want a second linkto? just copy the code between {% if ... %} and {% endif %}, and add it below just before the {:/infotext}
{% endcomment %}

{% ic %}
{::infotext}
Deze checklist dient vervolledigd te worden vooraleer XML ingediend wordt
Volgende templates dienen gecontroleerd en afgewerkt te worden: 
{% if period.reconciliations.btw_saldo != blank %}{% linkto period.reconciliations.btw_saldo %}{% t "BTW saldo" %}{% endlinkto %}{% else %}**{% t "The template BTW saldo is not present in the working papers - please add them to the working papers" %}**{% endif %}
{% if period.reconciliations.omzetvergelijking != blank %}{% linkto period.reconciliations.omzetvergelijking %}{% t "omzetvergelijking" %}{% endlinkto %}{% else %}**{% t "The template omzetvergelijking is not present in the working papers - please add them to the working papers" %}**{% endif %}
{:/infotext}
{% endic %}




{% comment %}
use below code to create an array of questions / checks
- the first part is to create the actual questions, separated by a ";"
- the second part is used to loop over each question / check (separated by a ";")
Want to add questions?? => Be sure to add the question in the first part, and add in the second part an unique word (key) for that question. 
Respect order in both arrays!!
Split on ";"
{% endcomment %} 

{% assign array_checks = "Has every invoice been delivered by the customer?;Are the sales invoices been booked and finalized?;Are the purchase voices been booked and finalized?;Is BTW terugbroderbaar via bankuitreksels?;Are there any invoices that are related to a previous VAT-period?" | split:";" %}

{% assign array_keys = "delivered;sales_finalized;purchases_finalized;financial;previous_vat" | split:";" %}


<!---------- actual template ----------> 


{% stripnewlines %}
|
|
| {% t "VAT-check" %}
| {% t "Extra comments" %}
{% newline %}
|----5%----
|----5%----
|----35%---
|----------+
{% for check in array_keys %}
{% newline %}
| {% input custom.[check].check_mark as:boolean %}
  {% comment %}Below will make the templates reconciliation needed{% endcomment %}
  {% if custom.[check].check_mark == true %}
    {% assign check_ind = 0 %}
  {% else %}
    {% assign check_ind = 1 %}
  {% endif %}
| {% unexplained check_ind as:indicator %}
| {{ array_checks[forloop.index0] }} 
| {% input custom.[check].extra_info as:text size:mini placeholder:"Extra info" %}
{% endfor %}
{% endstripnewlines %}

{% comment %}
below code gives the option to either input some extra info or add a file, or both
when nothing is added, this section will not be exported
- change the name of custom.some.thing into something proper like "custom.VAT.additional_info" and "custom.VAT.additional_file" for instance
{% endcomment %}

<br> 

{% ifi custom.some.thing.document or custom.some.thing_2 != blank %}
{% stripnewlines %}
|----
|---- 
{% newline %}
| **{% t "Additional information" %}** 
| {% input custom.some.thing as:file_collection %}
{% endstripnewlines %}

{% input custom.some.thing_2 as:text placeholder:'extra info' %}
{% endifi %}

This is taken directly from following cases:

1 Like

Hello,
I tried creating the same checklist template and succeeded (thanks!). The problem now is that I can’t seem to print this template. It always appears blank.
I found the additional code to print a boolean but still the export is blank.
Can someone help out?

Hi @k.debouvere,

Nice to hear that you succeeded in creating the checklist template!

Regarding the export, does the self-built checklist template concern a reconciliation? If so, did you add a virtual account number (in the box ‘Virtual account number’)? This is necessary for the template to be included in the export. Note that the first number of the virtual account number should be within the range from 1 until 8.

Please let us know this resolved your issue!

How to translate the questions to become a template in multiple languages?

Hi Marie.

In this CASE you can find some more information on translation tags: CASE: variables in translation-tags.

Best regards,

Michiel

I saw thias but I don’t find an anwer to my question. It’s the translation of the questions when using array checks.

Hi Marie,

To make the list of questions translatable, you need to put the string first in a capture statement, and than split it afterwards via an assign statement. For the code of my colleague Sven, it would look like this:

{% t="Has every invoice been delivered by the customer?;Are the sales invoices been booked and finalized?;Are the purchase voices been booked and finalized?;Is BTW terugbroderbaar via bankuitreksels?;Are there any invoices that are related to a previous VAT-period?" en:"Question A;Question B;Question C;Question D;Question E" %}

{% capture array_checks_string %}{% t "Has every invoice been delivered by the customer?;Are the sales invoices been booked and finalized?;Are the purchase voices been booked and finalized?;Is BTW terugbroderbaar via bankuitreksels?;Are there any invoices that are related to a previous VAT-period?" %}{% endcapture %}
{% assign array_checks = array_checks_string | split:";" %}