Checkbox - print text

Hi,

I am trying to build a new template using optional textoptions. Text should appear when a checkbox is ticked. I have following code:

{% ic %}
{::infotext}
{% stripnewlines %}
|----|----|----|----|----|----
{% newline %}
| Afschrijvingsexcedent
| {% input custom.excedent.advance as:boolean assign:show_excedent_alinea%}
| Voorraden
| {%input custom.voorraad.advance as:boolean assign:show_voorraad_alinea%}
| Dubieuze debiteuren
| {% input custom.dub_deb.advance as:boolean assign:show_dubdeb_alinea%}
| Voorziening risico's en kosten
| {%input custom_voorziening.advance as:boolean assign:show_voorziening_alinea%}
| Te ontvangen facturen
| {% input custom.tof.advance as:boolean assign:show_tof_alinea%}
| {%newline%}
| Fiscale verliezen
| {% input custom.test3.advance as:boolean assign:show_fisc_verl_alinea%}
| Verworpen uitgaven
| {% input custom.test4.advance as:boolean %}
| Fiches 281.50
| {% input custom.test5.advance as:boolean %}
{% newline %}
| Laattijdige neerlegging
| {% input custom.test6.advance as:boolean %}
| Reconciliaties
|{% input custom.reconciliaties.advance as:boolean %}
| Grootte onderneming
|{% input custom.grootte.advance as:boolean %}
| Rekening courant
|{% input custom.rc.advance as:boolean %}
|Laattijdige Biztax
|{% input custom.biztax.advance as:boolean %}

{% newline %}
{% endstripnewlines %}
{:/infotext}
{% endic %}

{%newline%}
{%if show_excedent_alinea%}
{%newline%}
{%newline%}
**_VASTE ACTIVA - AFSCRIJVINGSEXCEDENT_**{%newline%}{%newline%}Naar aanleiding van een belastingcontrole zou de belastingadministratie kunnen argumenteren dat sommige activa dienen te worden afgeschreven over een langere periode en/of dat sommige kosten dienen te worden gekapitaliseerd en afgeschreven.{%newline%}{%newline%}In geval van een belastingcontrole, kan de belastingadministratie een afschrijvingsexcedent toevoegen aan de belastbare basis van de onderneming.

{%endif%}
{%endstripnewlines%}
{%endifi%}

Of course the checkboxes shouldn’t be printed but the text should be printed if the checkbox is ticked. Is it also possible to make this text adaptable after being chosen?

Thank you!

Hi @FBOG,

It sure is possible, but keep in mind you are creating a variable within IC-tags, meaning the variables used to show text or not, will only be made in input-mode (and won’t work as expected when exporting).

Allow me to clarify:

{% ic %}
{::infotext}
{% stripnewlines %}
|----|----|----|----|----|----
{% newline %}
| Te ontvangen facturen
| {% input custom.tof.advance as:boolean assign:show_tof_alinea%}
{% endstripnewlines %}
{:/infotext}
{% endic %}

should become this, where the assign statement is made outside the IC-tags:

{% ic %}
{::infotext}
{% stripnewlines %}
|----|----|----|----|----|----
{% newline %}
| Afschrijvingsexcedent
| {% input custom.excedent.advance as:boolean %}
{% endstripnewlines %}
{:/infotext}
{% endic %}

{% comment %}create variable{% endcomment %}
{% assign show_excedent_alinea = custom.excedent.advance %}

Then, we can create a default text (with the capture tag, more info here), and use that as a default:

{% comment %}create default text{% endcomment %}
{% capture depre_txt %}Naar aanleiding van een belastingcontrole zou de belastingadministratie kunnen argumenteren dat sommige activa dienen te worden afgeschreven over een langere periode en/of dat sommige kosten dienen te worden gekapitaliseerd en afgeschreven.<br><br>In geval van een belastingcontrole, kan de belastingadministratie een afschrijvingsexcedent toevoegen aan de belastbare basis van de onderneming{% endcapture %}


{% comment %}show text depending on boolean{% endcomment %}
{% if show_excedent_alinea %}

{% input custom.depreciations.txt as:text default:depre_txt %}

{% endif %}  

Let me know if this works out for you?

Hi @sven,

Thank you very much! It works as expected. Just 2 more questions.

  1. When composing text the default text appears as follows:

{::font size=“xs”}WAARDEVERMINDERING OP VOORRADEN{:/font}
De onderneming dient in staat te zijn de geboekte waardeverminderingen op voorraden te individualiseren per individueel product (of productgroep) en te verantwoorden aan de hand van onderliggende bewijsstukken (bv. statistische/ historische informatie).

Wij nemen aan dat aan voornoemde voorwaarden voldaan is. Indien dit niet het geval zou zijn, dienen deze waardeverminderingen toegevoegd te worden aan de belastbare basis van de onderneming.

When exporting, everything looks fine. is it possible to get rid of the remarks regarding font size?

  1. Text is using the full width of the page. How can i change the print margins of this text? if this is part of the bootcamp, never mind, i will attend in november and ask this question then.

Hi @FBOG,

  1. Could you post the exact liquid code you use for {::font size=“xs”} WAARDEVERMINDERING OP VOORRADEN {:/font} and the lines just below and after?

  2. The print margins can be set in the advanced settings of an export style. If you just want the change the margins for a specific part of the template, you might consider using a table with an empty column in the front and/or back to achieve your desired layout.

Hi, @Kimberly_Vlietinck, Thanks for your response.

{%comment%}Create default text {%endcomment%}

Hi @FBOG,

I think only part of your reply came through :sweat_smile:, can you try again or edit your message?

Thank you!

Kind regards,
Robin

I’ll try again:

{%comment%} create variable {%endcomment%}

{%assign show_excedent_alinea = custom.afschrijven.advance%}

{%comment%}Create default text {%endcomment%}

{% comment%}show text depending on boolean{%endcomment%}
{%if show_excedent_alinea%}
{%input custom.excedent.txt as:text default:depre_txt%}
{%endif%}

Hi @FBOG,

Thank you for sharing the code.

Based on this code snippet, it’s still a bit unclear for us where exactly the issue with the font size tags appearing as this is not part of the snippet. However, based on your earlier post you stated that the font size appears in the default text. So I’m guessing you see these {::font size=“xs”} appearing in an input box because this is part of your capture depre_txt?

That would make sense because indeed it’s not possible to add this kind of formatting in input mode.

If you want this header to have different formatting, consider not printing it in an inputfield or in case this header should be overwritable, create a different inputfield between ic-tags and print this value between nic tags and font formatting, like this:

{% capture header_txt %}WAARDEVERMINDERING OP VOORRADEN{% endcapture %}

{% ic %}{% input custom.some.header default:header_txt as:text %}{% endic %}

{% assign header_export = custom.some.header | default:header_txt %}

{% nic %}{::font size=“xs”}{{ header_export }}{:/font}{% endnic %}

Hope this helps!

Kind regards,
Robin