Costs non commercial

Here we have a detail of the costs that are not commercial and which need to be rejected.
Most of these costs are directly from the trial balance, but we need the possibility to fill in some of them ourselves.
Our code is partly correct, but we don’t seem to get the endresult correct.
How do we need to change our code to get the correct result?
Thanks!

{% capture table %}
{% if custom.detail.accounts == blank %}{% assign account_range = '61' %}{% else %}{% assign account_range = custom.detail.accounts %}{% endif %}

| **Detail kosten weerhouden niet bedrijfsmatig per {{ period.year_end_date | date:'%d/%m/%Y' }}** {% input custom.detail.accounts as:account_collection range:6,7 default:account_range %} | Bruto | % niet bedrijfsmatig | Te verwerpen {% assign accounts = period.accounts | range:account_range %}
|-----------40%---------------|---------------15%-----------:|---------------25%-----------:+{% for account in accounts %}
|{% if forloop.last %}_{% endif %}{{ account.name }}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{%=$0+ -1*account.value %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% input custom[account.number].nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if custom[account.number].nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = custom[account.number].nietbedrijfsmatig %}{% endif %}{%=$1+ -1*nietbedrijfsmatig*account.value %}{% if forloop.last %}_{% endif %}{% endfor %}

{%fori explanation in custom.verklaringen %}
|{% input explanation.description %}|{% $2+input explanation.value as:currency %}|{% if forloop.last %}_{% endif %}{% input custom[account.number].nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if custom[account.number].nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = custom[account.number].nietbedrijfsmatig %}{% endif %}{%=$1+ -1*nietbedrijfsmatig*account.value %}{% if forloop.last %}_{% endif %}{%endfori %}

|----------40%----------|------------15%------|-----------25%-------:+
|                    | **{{ $0 | currency }}** | {{ $1-$0 | currency }} | **{{ $1 default:nietbedrijfsmatig1 | currency }}**
{% endcapture %}

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


===p


{{ table }}

And how do we get the right column centered on the right site?

Hi!

In the bottom line you’re using {% input custom[account.number].nietbedrijfsmatig as:percentage %}, but account is not an object that’s available in that context. (It’s used because in the upper table all data is linked to accounts, but in the extra data it’s not).

It’s best to just couple it to the explanation for example explanation.nietbedrijfsmatig

Thanks! It works. At this moment it looks like this:

{% capture table %}
{% if custom.detail.accounts == blank %}{% assign account_range = '61' %}{% else %}{% assign account_range = custom.detail.accounts %}{% endif %}

| **DETAIL KOSTEN WEERHOUDEN NIET-BEDRIJFSMATIG** {% input custom.detail.accounts as:account_collection range:6,7 default:account_range %} | Bruto | % niet bedrijfsmatig | Te verwerpen {% assign accounts = period.accounts | range:account_range %}
|-----------40%---------------|---------------15%-----------:|---------------25%-----------:+{% for account in accounts %}
|{% if forloop.last %}_{% endif %}{{ account.name }}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{%=$0+ -1*account.value %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% input custom[account.number].nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if custom[account.number].nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = custom[account.number].nietbedrijfsmatig %}{% endif %}{%=$1+ -1*nietbedrijfsmatig*account.value %}{% if forloop.last %}_{% endif %}{% endfor %}

{%fori explanation in custom.verklaringen %}
|{% input explanation.description %}|{% $2+input explanation.value as:currency %}|{% if forloop.last %}_{% endif %}{% input explanation.nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if explanation.nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = explanation.nietbedrijfsmatig %}{% endif %}{%=$1+ -1*nietbedrijfsmatig*account.value %}{% if forloop.last %}_{% endif %}{%endfori %}

|----------40%----------|------------15%------|-----------25%-------:+
|                    | **{{ $0 | currency }}** | {{ $1-$0 | currency }} | **{{ $1 default:nietbedrijfsmatig1 | currency }}**
{% endcapture %}

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


===p


{{ table }}

In the last column, the sum is’t correct. What do I need to change?
And how do we get the layout correct?

Thanks in advance!

Hello @Fiduciaire.Eulaers,

My answer is a solution for your layout issue. Check if this works better for you:

{% capture table %}
{% if custom.detail.accounts == blank %}{% assign account_range = '61' %}{% else %}{% assign account_range = custom.detail.accounts %}{% endif %}

| **DETAIL KOSTEN WEERHOUDEN NIET-BEDRIJFSMATIG** {% input custom.detail.accounts as:account_collection range:6,7 default:account_range %} | Bruto | % niet bedrijfsmatig | Te verwerpen {% assign accounts = period.accounts | range:account_range %}
|-----------40%---------------|---------------15%-----------:|:---------------25%-----------:+{% for account in accounts %}
|{% if forloop.last %}_{% endif %}{{ account.name }}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{%=$0+ -1*account.value %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% input custom[account.number].nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if custom[account.number].nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = custom[account.number].nietbedrijfsmatig %}{% endif %}{%=$1+ -1*nietbedrijfsmatig*account.value %}{% if forloop.last %}_{% endif %}{% endfor %}
|-----------40%---------------|---------------15%-----------:|:---------------25%-----------:+{%fori explanation in custom.verklaringen %}
|{% input explanation.description %}|{% $2+input explanation.value as:currency %}|{% if forloop.last %}_{% endif %}{% input explanation.nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if explanation.nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = explanation.nietbedrijfsmatig %}{% endif %}{%=$1+ -1*nietbedrijfsmatig*account.value %}{% if forloop.last %}_{% endif %}{%endfori %}

|-----------40%----------|------------15%------:|:-----------25%-------:+
|                   |  **{{ $0 | currency }}** | {{ $1-$0 | currency }} | **{{ $1 default:nietbedrijfsmatig1 | currency }}**
{% endcapture %}

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


===p


{{ table }}

In order to “move things” in a column you just have to add the : sign in your table like that:

|:-----------------:|----------------------:|:----------------|
| centered content  | right aligned content | left aligned content (default)

You can find some more info about styling your tables at https://github.com/GetSilverfin/sf-templates

About your sum now, do you mean the third column on the very last row?

With the code you gave me, I got the entire column right! Thanks!
The sum is also correct.
Now I need the result:

in another report. How can I name this field en use it in the overvieuw in the beginning?

Hello @Fiduciaire.Eulaers,

I am glad that the code worked for you. The reports you’re talking about, are these text documents, or reconciliations?

Regards,
Michail

This are text documents (like all the reports)

May I friendly remind you about this topic? :slight_smile:

Hello @Fiduciaire.Eulaers and sorry for the late answer,

Can you please check this post of Tim? Maybe it is the solution for your issue. I know it surely works for reconciliation templates but I am not sure about text templates.

If it doesn’t work please let me know. (it is also the answer in your other post here in the community)

Regards,
Michail

I tried but it doesn’t seem to work. What am I doing wrong?

_**RESULTATENREKENING**_

**KOSTEN**

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

|---------------------|-------15%-------:+
| Afschrijvingen {% input custom.detail.afschrijvingen as:account_collection range:6 default:'63' accounts_var:afschrijvingen %} | {{ afschrijvingen.value| currency}}
| Diverse diensten {% input custom.detail.diversediensten as:account_collection range:6 default:'61' accounts_var:diversediensten %}| {{ diversediensten.value| currency}}
| Personeelskosten {% input custom.detail.personeelskosten as:account_collection range:6 default:'62' accounts_var:personeelskosten %}|{{ personeelskosten.value| currency}}
| Andere bedrijfskosten {% input custom.detail.andere as:account_collection range:6 default:'64' accounts_var:andere %}|{{ andere.value | currency}}
| Financiële kosten {% input custom.detail.financieel as:account_collection range:6 default:'65' accounts_var:financieel %}|{{ financieel.value | currency}}
| Sociale bijdrage {% input custom.detail.socialebijdrage as:account_collection range:6 default:'' accounts_var:socialebijdrage %}|_{{ socialebijdrage.value | currency}}_
|       | {{ afschrijvingen.value+diversediensten.value+personeelskosten.value+andere.value+financieel.value+socialebijdrage.value | currency }}
| Kosten weerhouden niet-bedrijfsmatig| {{ period.reconciliations.handle.results.the_form }}
| Kosten met fiscale aftrekbeperking {% input custom.detail.aftrekbeperking as:account_collection range:6 default:'64' accounts_var:aftrekbeperking %}|_{{ -1*aftrekbeperking.value | currency}}_
|       | {{ afschrijvingen.value+diversediensten.value+personeelskosten.value+andere.value+financieel.value+socialebijdrage.value-bedrijfsmatig.value-aftrekbeperking.value | currency }}
| **Nettowinst van het boekjaar**      |_**{{ opbrengsten-afschrijvingen.value+diversediensten.value+personeelskosten.value+andere.value+financieel.value+socialebijdrage.value-bedrijfsmatig.value-aftrekbeperking.value | currency }}**_
|  {% input custom.detail.opbrengsten as:account_collection range:7 default:'7' accounts_var:opbrengsten %}|{{ -1*opbrengsten.value | currency}}



| |
| |

Datum,
Handtekening,

My table where I named the result…

{% capture table 'the_form' %}
{% if custom.detail.accounts == blank %}{% assign account_range = '61' %}{% else %}{% assign account_range = custom.detail.accounts %}{% endif %}

| **DETAIL KOSTEN WEERHOUDEN NIET-BEDRIJFSMATIG** {% input custom.detail.accounts as:account_collection range:6,7 default:account_range %} | Totaal rekening | % niet bedrijfsmatig | Te verwerpen {% assign accounts = period.accounts | range:account_range %}
|-----------40%---------------|---------------15%-----------:|---------------25%-----------:|---------------15%-----------:+{% for account in accounts %}
|{% if forloop.last %}_{% endif %}{{ account.name }}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{%=$0+ account.value %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% input custom[account.number].nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if custom[account.number].nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = custom[account.number].nietbedrijfsmatig %}{% endif %}{%=$1+ 1*nietbedrijfsmatig*account.value %}{% if forloop.last %}_{% endif %}{% endfor %}

|-----------40%---------------|---------------15%-----------:|---------------25%-----------:|---------------15%-----------:+{%fori explanation in custom.verklaringen %}
|{% input explanation.description %}|{% $2+input explanation.value as:currency %}|{% if forloop.last %}_{% endif %}{% input explanation.nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if explanation.nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = explanation.nietbedrijfsmatig %}{% endif %}{%=$1+ 1*explanation.value*explanation.nietbedrijfsmatig %}{% if forloop.last %}_{% endif %}{%endfori %}


|-----------40%----------|------------15%------:|-----------25%-------:|-----------15%-------:+
|                   |  **{{ $0 | currency }}** | {{ $1-$0 | currency }} | **{{ $1 | currency }}**
{% endcapture %}
{% result 'the_form' the_form %}
{% if custom.detail.goederen == blank %}{% assign goederen_range = '60'%}{% else %}{% assign goederen_range = custom.detail.goederen %}{% endif %}
{% assign goederen = period.accounts | range:goederen_range %}


===p


{{ table }}

It’s getting urgent…
Is it possible to look at this asap?
Thanks in advance!

Hello @Fiduciaire.Eulaers,

This doesn’t work for you because it is only for reconciliation templates and not for text templates. I will have to check this with my colleague but he is going to be in the office on Monday. Can it wait until Monday?

Regards,
Michail

Yes, it can. Thanks for the quick reply.
What is the difference between a “reconciliation template” and a “text template”?
I figured, since it is possible with “Bedrijfsparameters” and all the reports who take over this data, it would be possible.
Do I need to make different templates?

Technically there is no difference. We just can’t have handles in text templates at the moment. We only provide this for reconciliation texts. We are going to check all the possible solutions for your issue on Monday though.

Thanks! Have a great weekend!

Enjoy your weekend too! :slight_smile:

Hello @Fiduciaire.Eulaers,

I just had a discussion with my colleague and in order to user a value from a text table to another is to assign a variable attached to a period or a company. For example you can create something like

{% assign period.custom.some.thing = $1 %}

and then try to display this in your other table like

{{ period.custom.some.thing }}

If this doesn’t work too, I will have to ask for support for Tim.

Best Regards,
Michail

Where do I need to put this text in my code? Now it doesn’t seem to work.

{% capture table 'the_form' %}
{% if custom.detail.accounts == blank %}{% assign account_range = '61' %}{% else %}{% assign account_range = custom.detail.accounts %}{% endif %}

| **DETAIL KOSTEN WEERHOUDEN NIET-BEDRIJFSMATIG** {% input custom.detail.accounts as:account_collection range:6,7 default:account_range %} | Totaal rekening | % niet bedrijfsmatig | Te verwerpen {% assign accounts = period.accounts | range:account_range %}
|-----------40%---------------|---------------15%-----------:|---------------25%-----------:|---------------15%-----------:+{% for account in accounts %}
|{% if forloop.last %}_{% endif %}{{ account.name }}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{%=$0+ account.value %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% input custom[account.number].nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if custom[account.number].nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = custom[account.number].nietbedrijfsmatig %}{% endif %}{%=$1+ 1*nietbedrijfsmatig*account.value %}{% if forloop.last %}_{% endif %}{% endfor %}

|-----------40%---------------|---------------15%-----------:|---------------25%-----------:|---------------15%-----------:+{%fori explanation in custom.verklaringen %}
|{% input explanation.description %}|{% $2+input explanation.value as:currency %}|{% if forloop.last %}_{% endif %}{% input explanation.nietbedrijfsmatig as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if explanation.nietbedrijfsmatig == blank %}{% assign nietbedrijfsmatig = 0 %}{% else %}{% assign nietbedrijfsmatig = explanation.nietbedrijfsmatig %}{% endif %}{%=$1+ 1*explanation.value*explanation.nietbedrijfsmatig %}{% if forloop.last %}_{% endif %}{%endfori %}


|-----------40%----------|------------15%------:|-----------25%-------:|-----------15%-------:+
|                   |  **{{ $0 | currency }}** | {{ $1-$0 | currency }} | **{{ $1 | currency }}**
{% endcapture %}
{% result 'the_form' the_form %}
{% if custom.detail.goederen == blank %}{% assign goederen_range = '60'%}{% else %}{% assign goederen_range = custom.detail.goederen %}{% endif %}
{% assign goederen = period.accounts | range:goederen_range %}
{% assign period.custom.some.thing = $1 %}

===p


{{ table }}
_**RESULTATENREKENING**_

**KOSTEN**

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

|---------------------|-------15%-------:+
| Afschrijvingen {% input custom.detail.afschrijvingen as:account_collection range:6 default:'63' accounts_var:afschrijvingen %} | {{ afschrijvingen.value| currency}}
| Diverse diensten {% input custom.detail.diversediensten as:account_collection range:6 default:'61' accounts_var:diversediensten %}| {{ diversediensten.value| currency}}
| Personeelskosten {% input custom.detail.personeelskosten as:account_collection range:6 default:'62' accounts_var:personeelskosten %}|{{ personeelskosten.value| currency}}
| Andere bedrijfskosten {% input custom.detail.andere as:account_collection range:6 default:'64' accounts_var:andere %}|{{ andere.value | currency}}
| Financiële kosten {% input custom.detail.financieel as:account_collection range:6 default:'65' accounts_var:financieel %}|{{ financieel.value | currency}}
| Sociale bijdrage {% input custom.detail.socialebijdrage as:account_collection range:6 default:'' accounts_var:socialebijdrage %}|_{{ socialebijdrage.value | currency}}_
|       | {{ afschrijvingen.value+diversediensten.value+personeelskosten.value+andere.value+financieel.value+socialebijdrage.value | currency }}
| Kosten weerhouden niet-bedrijfsmatig| {{ period.custom.some.thing }}
| Kosten met fiscale aftrekbeperking {% input custom.detail.aftrekbeperking as:account_collection range:6 default:'64' accounts_var:aftrekbeperking %}|_{{ -1*aftrekbeperking.value | currency}}_
|       | {{ afschrijvingen.value+diversediensten.value+personeelskosten.value+andere.value+financieel.value+socialebijdrage.value-bedrijfsmatig.value-aftrekbeperking.value | currency }}
| **Nettowinst van het boekjaar**      |_**{{ opbrengsten-afschrijvingen.value+diversediensten.value+personeelskosten.value+andere.value+financieel.value+socialebijdrage.value-bedrijfsmatig.value-aftrekbeperking.value | currency }}**_
|  {% input custom.detail.opbrengsten as:account_collection range:7 default:'7' accounts_var:opbrengsten %}|{{ -1*opbrengsten.value | currency}}



| |
| |

Datum,
Handtekening,