Autokosten in template verworpen uitgaven automatisch toewijzen

Beste,

Ik ben momenteel de template verworpen uitgaven in Silverfin aan het bekijken en wou aan alle rubrieken vaste rekeningen toewijzen.
Voor de autokosten heb ik enkele problemen.
Onder de rubriek “Niet aftrekbare autokosten en minderwaarden op autovoertuigen” heb ik reeds een subcategarie “Kosten personenwagens 50% aftrekbaar” kunnen maken.
Onder de # VAA en algemene rekeningen kan ik de juiste rekeningen die enkel betrekking hebben op 50% aftrekbaarheid tonen, maar wij zouden graag hebben dat deze rekeningen automatisch onder de subcategorie komen zonder ze te moeten selecteren.
Verder kan ik de percentages aanpassen, maar gebeurt er geen berekening. Wanneer ik 70% van 100 wil nemen, dan krijg ik 0,00 euro te zien, maar wordt dit correct opgenomen in de tussenberekening.
Wanneer ik een 2de subcategorie wil maken, dan worden de rekeningen van de eerste automatisch overgenomen ondanks dat ik deze eruit haal. Hoe kan ik dit oplossen?

Kan u mij hiermee verder helpen ?

Alvast bedankt.

Mvg,

Truyts Kevin

Hi Kevin

You can give defaults accounts to your categorie in this way:

{% if custom.accounts.subcategorie != blank %}
{% assign range_kosten_personenwageen_50 = custom.accounts.subcategorie %}
{% endif %}

{% input custom.accounts.subcategorie as:account_collection range:6,7 default:range_kosten_personenwageen_50 %}

Regarding the percentage, did you do something like this?

|| | {{ $1 | currency }} | 50% | {%=$0+ $10.50 | round | currency %}*

Kind regards
Sam

Hi Sam,

This is how my code looks like :

| **{% t "Niet aftrekbare autokosten en minderwaarden op autovoertuigen" %}**

{{ accounts_header_cars }}{% fori autokost in custom.autokosten %}
|| {% t "Kosten personenwagens 50% aftrekbaar" %} {% input autokost.account_range_vaa as:account_collection range:74641050 placeholder:'VAA' %} {% input autokost.account_range as:account_collection range:61210050,61220050,61240050,63026050,64010050,66300050,74610050,74630050,76300050 placeholder:'Algemene rekeningen' %}{% assign accounts_vaa = period.accounts | range: autokost.account_range_vaa %}{% assign accounts = period.accounts | range: autokost.account_range %}{% assign $1 = -70 %}{% for account in accounts_vaa %}
|| {{ account.number }} {{ account.name }} | {{ account.value | currency}} | {% ic %}{% input autokost[account.number] as:percentage default:'0.7'%}{% endic %}{% nic %}{{ autokost[account.number] | percentage | remove:',0' }}{% endnic %}| {%=$1+ account.value*autokost[account.number] | round | currency %} |  |   {% endfor %}{% for account in accounts %}
|| {{ account.number }} {{ account.name }} ||| {%=$1+ account.value %}{% endfor %}{% ifi autokost.afschrijving_value != blank %}
|| {% input autokost.afschrijving placeholder_default:"630200 Afschrijving" %} ||| {%=$1+input autokost.afschrijving_value as:currency %}{% endifi %}{% if autokost.key %}{% fori extra in custom[autokost.key] %}
||{% input extra.description %} ||| {%=$1+input extra.value as:currency %} {% endfori %}{% endif %}
|| ||| *{{$1 | currency}}* | {% ic %}{% input autokost.percentage as:percentage as:integer default:'0.5'%}{% endic %}{% nic %}{{ autokost.percentage | percentage | remove:',00' }}{% endnic %} | *{%=$2+ $1*autokost.percentage | round | currency %}* {% endfori %}
|| |||                     |                                                              | **{%=$0+ $2 | round | currency %}**
| 

{{ accounts_header_cars }}{% fori autokost in custom.autokosten %}
|| {% t "Kosten personenwagens 60% aftrekbaar" %} {% input autokost.account_range_vaa as:account_collection range:74641060 placeholder:'VAA' %} {% input autokost.account_range as:account_collection range:61210060,61220060,61240060,63026060,64010060,66300060,74610060,74630060,76300060 placeholder:'Algemene rekeningen' %}{% assign accounts_vaa = period.accounts | range: autokost.account_range_vaa %}{% assign accounts = period.accounts | range: autokost.account_range %}{% assign $1 = -70 %}{% for account in accounts_vaa %}
|| {{ account.number }} {{ account.name }} | {{ account.value | currency}} | {% ic %}{% input autokost[account.number] as:percentage default:'0.7'%}{% endic %}{% nic %}{{ autokost[account.number] | percentage | remove:',0' }}{% endnic %}| {%=$1+ account.value*autokost[account.number] | round | currency %} |  |   {% endfor %}{% for account in accounts %}
|| {{ account.number }} {{ account.name }} ||| {%=$1+ account.value %}{% endfor %}{% ifi autokost.afschrijving_value != blank %}
|| {% input autokost.afschrijving placeholder_default:"630200 Afschrijving" %} ||| {%=$1+input autokost.afschrijving_value as:currency %}{% endifi %}{% if autokost.key %}{% fori extra in custom[autokost.key] %}
||{% input extra.description %} ||| {%=$1+input extra.value as:currency %} {% endfori %}{% endif %}
|| ||| *{{$1 | currency}}* | {% ic %}{% input autokost.percentage as:percentage as:integer default:'0.6'%}{% endic %}{% nic %}{{ autokost.percentage | percentage | remove:',00' }}{% endnic %} | *{%=$2+ $1*autokost.percentage | round | currency %}* {% endfori %}
|| |||                     |                                                              | **{%=$0+ $2 | round | currency %}**
| 
{% nic %}
{:/group}
{::group}
{% endnic %}
{% endifi %}

Hi Kevin

First of all, default values are not automatically saved. This means that the value 0.5 will not be saved in our database. So autokost.percentage will not have the value 0.5 automatically. Only when you change and save it, you can use autokost.percentage. Since we are working with numbers, the best workaround is using a register (i.e. $4)

Also, when you define a number, don’t use quotes around it. This will make a string of the numbers which is not what you want.

The code beneath sums up the 2 issues above and should solve your problem. If not, please let us know.

{% $4+input autokost.percentage as:percentage as:integer default:0.5 %}
{%=$2+ $1*$4 | round | currency %}

Kind regards
Sam

Hi Sam,

Thanks for the information.
I just don’t understand it. When I adjust the code, I stil don’t get what I want.
I get the following :


I don’t get any subcalculations, the same accounts comes again under 60% while it’s is 50%, I get the same subcategorie twice.
How can I fix these things?

Kind regards,

Kevin

Hi @Kevin,

Can you post your whole code, so I canhave a look at it,a nd help you further?

Thanks

| **{% t "Niet aftrekbare autokosten en minderwaarden op autovoertuigen" %}**

{{ accounts_header_cars }}{% fori autokost in custom.autokosten %}
|| {% t "Kosten personenwagens 50% aftrekbaar" %} {% input autokost.account_range_vaa as:account_collection range:74641050 placeholder:'VAA' %} {% input autokost.account_range as:account_collection range:61210050,61220050,61240050,63026050,64010050,66300050,74610050,74630050,76300050 placeholder:'Algemene rekeningen' %}{% assign accounts_vaa = period.accounts | range: autokost.account_range_vaa %}{% assign accounts = period.accounts | range: autokost.account_range %}{% assign $1 = -70 %}{% for account in accounts_vaa %}
|| {{ account.number }} {{ account.name }} | {{ account.value | currency}} | {% ic %}{% input autokost[account.number] as:percentage default:'0.7'%}{% endic %}{% nic %}{{ autokost[account.number] | percentage | remove:',0' }}{% endnic %}| {%=$1+ account.value*autokost[account.number] | round | currency %} |  |   {% endfor %}{% for account in accounts %}
|| {{ account.number }} {{ account.name }} ||| {%=$1+ account.value %}{% endfor %}{% ifi autokost.afschrijving_value != blank %}
|| {% input autokost.afschrijving placeholder_default:"630200 Afschrijving" %} ||| {%=$1+input autokost.afschrijving_value as:currency %}{% endifi %}{% if autokost.key %}{% fori extra in custom[autokost.key] %}
||{% input extra.description %} ||| {%=$1+input extra.value as:currency %} {% endfori %}{% endif %}
|| ||| *{{$1 | currency}}* | {% ic %}{% $4+input autokost.percentage as:percentage as:integer default:0.5 %}{% endic %}{% nic %}{{ autokost.percentage | percentage | remove:',00' }}{% endnic %} | *{%=$2+ $1*autokost.percentage | round | currency %}* {% endfori %}
|| |||                     |                                                              | **{%=$2+ $1*$4 | round | currency %}**
| 

{{ accounts_header_cars }}{% fori autokost in custom.autokosten %}
|| {% t "Kosten personenwagens 60% aftrekbaar" %} {% input autokost.account_range_vaa as:account_collection range:74641060 placeholder:'VAA' %} {% input autokost.account_range as:account_collection range:61210060,61220060,61240060,63026060,64010060,66300060,74610060,74630060,76300060 placeholder:'Algemene rekeningen' %}{% assign accounts_vaa = period.accounts | range: autokost.account_range_vaa %}{% assign accounts = period.accounts | range: autokost.account_range %}{% assign $1 = -70 %}{% for account in accounts_vaa %}
|| {{ account.number }} {{ account.name }} | {{ account.value | currency}} | {% ic %}{% input autokost[account.number] as:percentage default:'0.7'%}{% endic %}{% nic %}{{ autokost[account.number] | percentage | remove:',0' }}{% endnic %}| {%=$1+ account.value*autokost[account.number] | round | currency %} |  |   {% endfor %}{% for account in accounts %}
|| {{ account.number }} {{ account.name }} ||| {%=$1+ account.value %}{% endfor %}{% ifi autokost.afschrijving_value != blank %}
|| {% input autokost.afschrijving placeholder_default:"630200 Afschrijving" %} ||| {%=$1+input autokost.afschrijving_value as:currency %}{% endifi %}{% if autokost.key %}{% fori extra in custom[autokost.key] %}
||{% input extra.description %} ||| {%=$1+input extra.value as:currency %} {% endfori %}{% endif %}
| ||| *{{$1 | currency}}* | {% ic %}{% input autokost.percentage as:percentage as:integer default:'0.4'%}{% endic %}{% nic %}{{ autokost.percentage | percentage | remove:',00' }}{% endnic %} | *{%=$2+ $1*autokost.percentage | round | currency %}* {% endfori %}
|| |||                     |                                                              | **{%=$0+ $2 | round | currency %}**

| 
{% nic %}
{:/group}
{::group}
{% endnic %}
{% endifi %}

Hm okay I see @Kevin what’s wrong: you use defaults in your input-tags but as explained earlier by @SamVanEenoo you cannot do that.

If you have this for instance (and you can always try this out):

{% input custom.some.thing default:'70' %}

that object will display that value of 70 BUT the object custom.some.thing is actually empty.
:warning: Only when you change it (and press ENTER), it will store data in that object.

Feel free to check this as well :wink:

So, basically you gonna need to add something like this in your template:

{% if autokost.account_range_vaa != blank %}
  {% assign vaa_range = autokost.account_range_vaa %}
{% else %}
  {% assign vaa_range = '74'  %}
{% endif %}

and use vaa_range to define your variable accounts_vaa :

{% assign accounts_vaa = period.accounts | range:vaa_range %}

Same goes for the percentage too :

{% input autokost[account.number] as:percentage default:'0.7'%}

The object autokost[account.number]is empty (even if you see it in the input/output-mode of Silverfin.

Can you try further with this info @Kevin? Hope this clarifies it a bit for you!