Layout depreciation

We would like to make an overview of the depreciation but I can’t seem to make it work

This is the code:

{% assign cost_groups = custom.afschrijvingen %}

_**AFSCHRIJVINGEN**_

{% if custom.detail.goederen == blank %}{% assign goederen_range = '63'%}{% else %}{% assign goederen_range = custom.detail.goederen %}{% endif %}
{% assign goederen = period.accounts | range:goederen_range %}

|---------------------|-------15%-------:+{% for afschr in custom.afschrijvingen %}
| {% input afschr.afschrijving1 %}  | {% input custom.detail.afschrijving1 as:currency %}
| {% input afschr.afschrijving2 %}  | {% input custom.detail.afschrijving2 as:currency %}
| {% input afschr.afschrijving3 %}  | {% input custom.detail.afschrijving3 as:currency %}
| {% input afschr.afschrijving4 %}  | {% input custom.detail.afschrijving4 as:currency %}
| {% input afschr.afschrijving5 %}  | {% input custom.detail.afschrijving5 as:currency %}
| {% input afschr.afschrijving6 %}  | {% input custom.detail.afschrijving6 as:currency %}
| {% input afschr.afschrijving7 %}  | {% input custom.detail.afschrijving7 as:currency %}
| {% input afschr.afschrijving8 %}  |_{% input custom.detail.afschrijving8 as:currency %}_
| Totaal  | **{{ $10+custom.detail.afschrijving1+custom.detail.afschrijving2+custom.detail.afschrijving3+custom.detail.afschrijving4+custom.detail.afschrijving5+custom.detail.afschrijving6+custom.detail.afschrijving7+custom.detail.afschrijving8 | currency }}**{% endfor %}

And this is the result:

This is urgent at the moment…

Hello @Fiduciaire.Eulaers,

Could you please try removing the forloop and changing all inputs in the first column to custom?

So removing:

{% endfor %}```

**And renaming:**
```{% input afschr.afschrijving1 %}```
**to**
```{% input custom.afschr.afschrijving1 %}```

In this case using a forloop seems a bit reduntant. A forloop repeatedly executes a block of code, which is not necessary here (if the amount of depreciations you want to show here always is 8).

Kind regards,

Mathias

It worked! Thanks!

Now I have another question about this one.

We get a lot of white space… Can we fix this for a more sophisticated format?

Can we program this template that only 1 line is shown to fill in, and when we fill the 1st one in, we get a second line and so on?

The code at the moment, after the adjustments

{% assign cost_groups = custom.afschrijvingen %}

_**AFSCHRIJVINGEN**_

{% if custom.detail.goederen == blank %}{% assign goederen_range = '63'%}{% else %}{% assign goederen_range = custom.detail.goederen %}{% endif %}
{% assign goederen = period.accounts | range:goederen_range %}

|---------------------|-------15%-------:+
| {% input custom.afschr.afschrijving1 %}  | {% input custom.detail.afschrijving1 as:currency %}
| {% input custom.afschr.afschrijving2 %}  | {% input custom.detail.afschrijving2 as:currency %}
| {% input custom.afschr.afschrijving3 %}  | {% input custom.detail.afschrijving3 as:currency %}
| {% input custom.afschr.afschrijving4 %}  | {% input custom.detail.afschrijving4 as:currency %}
| {% input custom.afschr.afschrijving5 %}  | {% input custom.detail.afschrijving5 as:currency %}
| {% input custom.afschr.afschrijving6 %}  | {% input custom.detail.afschrijving6 as:currency %}
| {% input custom.afschr.afschrijving7 %}  | {% input custom.detail.afschrijving7 as:currency %}
| {% input custom.afschr.afschrijving8 %}  |_{% input custom.detail.afschrijving8 as:currency %}_
| Totaal  | **{{ $10+custom.detail.afschrijving1+custom.detail.afschrijving2+custom.detail.afschrijving3+custom.detail.afschrijving4+custom.detail.afschrijving5+custom.detail.afschrijving6+custom.detail.afschrijving7+custom.detail.afschrijving8 | currency }}**

@Fiduciaire.Eulaers,

I suggest you work with a forloop then. But you should use a specific type: fori. The fori works with input fields and will provide you with a second line if the first one is filled in.

For the table I would suggest something like the following:

| {% input afschrijving.naam %}  | {% =$10+input afschrijving.bedrag as:currency %}{% endfori %}
| **Totaal**  | **{{ $10 | currency }}**```

The fori will repeat the code for each line that was inputted. And the $10 will save every number per line. At the end, you can show the total by just showing $10.

Kind regards,

Mathias

Allright! Thanks!

One last question: how do we get a line between the numbers and the endresult?

@Fiduciaire.Eulaers,

You could use an {% if forloop.last %}. The code after this function will only be run for the last line in the forloop.

Building further on the table from the last post it should look something like this:

|{% input afschrijving.naam %}|{% if forloop.last %}_{% endif %}{% $10+input afschrijving.bedrag as:currency %}{% if forloop.last %}_{% endif %}{% endfori %}
| **Totaal**  | **{{ $10 | currency }}**``` 

Kind regards,

Mathias

It works! Thank you very much!

Here is our code:

{% assign cost_groups = custom.afschrijvingen %}

_**AFSCHRIJVINGEN**_

{% if custom.detail.goederen == blank %}{% assign goederen_range = '63'%}{% else %}{% assign goederen_range = custom.detail.goederen %}{% endif %}
{% assign goederen = period.accounts | range:goederen_range %}

|---------------------|-------10%-------:+ {% fori afschrijving in custom.afschrijvingen %}
|{% input afschrijving.naam %}|{% if forloop.last %}_{% endif %}{% $10+input afschrijving.bedrag as:currency %}{% if forloop.last %}_{% endif %}{% endfori %}
| **Totaal** | **{{ $10 | currency }}**