# Template 'dagvergoedingen'

**URL:** <https://community.silverfin.com/t/template-dagvergoedingen/1438>\
**Category:** Templates\
**Created:** [March 26, 2019, 10:48am UTC](https://community.silverfin.com/t/template-dagvergoedingen/1438 "2019-03-26T10:48:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yana](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@Yana](https://community.silverfin.com/u/Yana)\
**Post date:** [March 26, 2019, 10:48am UTC](https://community.silverfin.com/t/template-dagvergoedingen/1438/1 "2019-03-26T10:48:24Z")

</div>

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.

```auto
{% 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%}

```

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/b3e385d5a5316306dacd0abefcd415c944f2bc5e.png)

Can anyone help me with this please?

Many thanks.

Kind regards  
Yana van Landegem

---

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [March 26, 2019, 12:18pm UTC](https://community.silverfin.com/t/template-dagvergoedingen/1438/2 "2019-03-26T12:18:13Z")

</div>

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) :

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

```

If not clear, let us know!

---

<div class="post-metadata">

**Author:** ![ThijsL](https://avatars.discourse-cdn.com/v4/letter/t/e68b1a/32.png) [@ThijsL](https://community.silverfin.com/u/ThijsL)\
**Post date:** [April 5, 2019, 10:46am UTC](https://community.silverfin.com/t/template-dagvergoedingen/1438/3 "2019-04-05T10:46:16Z")

</div>

> [@sven](#):
>
> {% assign $28 = 0 %} {% assign $29 = 0 %}

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

---

<div class="post-metadata">

**Author:** ![SamVanEenoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/samvaneenoo/32/134_2.png) [@SamVanEenoo](https://community.silverfin.com/u/SamVanEenoo)\
**Post date:** [April 5, 2019, 1:25pm UTC](https://community.silverfin.com/t/template-dagvergoedingen/1438/4 "2019-04-05T13:25:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ThijsL](https://avatars.discourse-cdn.com/v4/letter/t/e68b1a/32.png) [@ThijsL](https://community.silverfin.com/u/ThijsL)\
**Post date:** [May 6, 2019, 3:50pm UTC](https://community.silverfin.com/t/template-dagvergoedingen/1438/5 "2019-05-06T15:50:04Z")

</div>

Hi,

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

![](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/7653e7f242062234d88f3596c647d07a8da59485.png)

**Verzonden:** vrijdag 5 april 2019 15:35

---

<div class="post-metadata">

**Author:** ![Michiel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/michiel/32/2364_2.png) [@Michiel](https://community.silverfin.com/u/Michiel)\
**Post date:** [May 6, 2019, 4:02pm UTC](https://community.silverfin.com/t/template-dagvergoedingen/1438/6 "2019-05-06T16:02:35Z")

</div>

Hi Thijs,

you can print the variable as follows:

```auto
{{ detail.custom.aantal_dagen | integer }}

```

Kind regards,

Michiel
