Template 'dagvergoedingen'

Hello

I’ve tried to make a new account template ‘dagvergoedingen’.
In the second line the calculation of the colums are not correct.
See my code below.

{% stripnewlines %}
|Omschrijving
|Periode
|Aantal dagen
|Bedrag
|
|Totaal
{% newline %}
|---30%---
|---25%---
|---15%---
|---10%---:
|---5%---
|---15%---:+
{% fori detail in current_account.details %}
{% newline %}
|{% input detail.custom.Omschrijving %}
|{% input detail.custom.Periode as:date %}-{% input detail.custom.Period as:date %}
|{% $28+input detail.custom.Aantal dagen %}
|{% $29+input detail.custom.Bedrag as:currency %}
|{% input detail.custom as:file %}
|{%=$30+ $28*$29 | currency
{% newline %}
{% endfori %}
{% endstripnewlines %}

{% comment %}reconcile value $30{% endcomment %}
{% unreconciled current_account.value-$30%}

Can anyone help me with this please?

Many thanks.

Kind regards
Yana van Landegem

Hello @Yana,

The issue is that in each loop ( = each line of your collection of data ) you use registers $28 & $29 to take in the value of each line.
So in each line the value is added while the value of the previous line is also still in the registers.

What needs to be done here, is reset the registers in each line back to zero, which you can do like this (doing that after the calculation) :

{% assign $28 = 0 %}
{% assign $29 = 0 %}

If not clear, let us know!

Hello,

This is a handy template.
Would it also be possible to calculate ‘Aantal dagen’ based upon the values in ‘Periode’ but at the same time, you can change this number manually?

Kind regards,
Thijs Leenaerts

Hi Thijs

You could do this by changing

|{% input detail.custom.Periode as:date %}-{% input detail.custom.Period as:date %}
|{% $28+input detail.custom.Aantal dagen %}

to

|{% input detail.custom.Periode as:date %}-{% input detail.custom.Period as:date %}
{% assign days = detail.custom.Period-detail.custom.Periode+1 %}
|{% $28+input detail.custom.aantal_dagen placeholder:“Aantal dagen” default:days %}

Hi,

Thanks. Just one more thing: how can you make the value of ‘Aantal dagen’ a number with no decimals?

Verzonden: vrijdag 5 april 2019 15:35

Hi Thijs,

you can print the variable as follows:

{{ detail.custom.aantal_dagen | integer }}

Kind regards,

Michiel