Beroepskosten - totals

Hi there,

In the past totals were shown in the middle colums of the template ‘Beroepskosten’. I just can’t figure out how to get them back. Can someone help me?

Thanks in advance,
Cedric

Hey @CedricDeVos,

Do you mean our standard template? Because if so, you can give notice to that in our chat so our template-team can find out why it’s gone (but there haven’t been updates to that template lately so…).
Or did you mean your template? If so, can you post your code please?

@sven

It’s in the standard template. I reported this in the chat and they said I should ask it here, in the Silverfin Community.

Thanks!

As mentionned in the chat @CedricDeVos, you can change it but not in the original template of Silverfin. What they meant for you was to duplicate the code of our template, copied into a new “custom” template and adapt it there.

Is that something you’d be willing to try? If so, poste you code here (so we’re sure we’re working on the same code).

Hi @sven,

I duplicated the code from the standard template in a new template (we already made some changes in the configuration window in the standard template and I have put this piece of code at the end -{% t= “Huur en huurlasten”…}

{% t= "Beroeps-<br />beperking" fr:"La limite professionnelle" en:"Occupational disability" %}
{% t= "Fiscale beperking" fr:"La limite fiscale" en:"Fiscal limitation" %}
{% t= "Totale beperking" fr:"La limite totale" en:"Total limitation" %}
{% t= "Aftrekbaar" fr:"Déductible" en:"Deductible" %}
{% t= "aftrekbaar" fr:"déductible" en:"deductible" %}
{% t= "Niet aftrekbaar" fr:"Non déductible" en:"Not deductible" %}
{% t= "Ontvangsten/Baten" fr:"Le chiffre d'affaires" en:"Revenues" %}

{% t= "Voorraadwijziging" fr:"Changement de stock" en:"Afficher le stock initial - le stock final de l'exercice" en:"Show intial - final stock for the financial year" %}
{% t= "Beginvoorraad" fr:"Stock initial" en:"Initial stock" %}
{% t= "Eindvoorraad" fr:"Stock final" en:"Final stock" %}

{% t= "Verkochte voorraad" fr:"Le stock vendu" en:"Stock sold" %}
{% t= "Brutowinst" fr:"Le résultat brut" en:"Gross profit" %}
{% t= "Sociale bijdragen" fr:"Les cotisations sociales" en:"Social contributions" %}
{% t= "Toekenning meewerkende echtgeno(o)t(e)" fr:"L'Octroi époux/-ouse cooperative" en:"Allocation helping spous" %}
{% t= "Kosten" fr:"Les frais" en:"costs" %}
{% t= "Nettoresultaat" fr:"Le résultat net" en:"Net result" %}
{% t= "Niet toegewezen bedrag" fr:"Le montant non affectués" en:"Unassigned amount" %}
{% t= "Alle rekeningen zijn opgenomen" fr:"Tous des comptes sont inclus" en:"All accounts are selected" %}
{% t= "Eén of meerdere rekeningen werden meermaals toegewezen" fr:"Un ou plusieurs comptes ont été attribués plusieurs fois" en:"One or more accounts were selected more than once" %}
{% t= "Niet alle rekeningen zijn opgenomen" fr:"Tous les comptes ne sont pas inclus" en:"Not all accounts are selected" %}
{% t= "Handelsgoederen, grond en hulpstoffen" fr:"Les marchandises, matières premières et matières consommables" en:"Goods for resale, raw materials and additives" %}
{% t= "Verkochte goederen" fr:"Les biens vendus" en:"Sold goods" %}
{% t= "Huur en huurlasten" fr:"La location et les frais de location" en:"Rent and rental expenses" %}
{% t= "Onderhoud en herstellingen" fr:"L'entretien et les réparation" en:"Maintenance and repair" %}
{% t= "Leveringen en diensten" fr:"Les fournitures et les services" en:"Supplies and services" %}
{% t= "Vergoeding aan derden" fr:"Les frais de tiers" en:"Remuneration to third parties" %}
{% t= "Totaal" fr:"Le Total" en:"Total" %}
{% t= "Divers" fr:"Les Divers" en:"Miscellaneous" %}
{% t= "Extra toelichting" fr:"Explication supplémentaire" en:"Additional explanation" %}
{% t= "Nr." fr:"N°" en:"No." %}
{% t= "Bedrag" fr:"Montant" en:"Amount" %}

{% if cost_categories_string == blank %}
  {% assign cost_categories_string = "Huur en huurlasten|Onderhoud en herstellingen|Leveringen en diensten|Vergoeding aan derden|Divers" %}
  {% assign cost_keys_string = "huur|onderhoud|leveringen|vergoeding|divers" %}
{% endif %}

{% assign cost_categories = cost_categories_string | split:"|" %}

{% if cost_keys_string != blank %}
  {% assign cost_keys = cost_keys_string | split:"|" %}
{% endif %}

{% assign toegewezen = "" %}
{% assign def_voorraadwijziging = "" %}
{% assign count = 0 %}

{% for cost_category in cost_categories %}
  {% if cost_keys_string != blank %}
    {% assign category_key = cost_keys[forloop.index0] %}
  {% else %}
    {% assign category_key = cost_category | replace:" ","_" | downcase %}
  {% endif %}
  {% assign costs = period.accounts.include_zeros | range:custom[category_key].accounts %}
  {% for account in costs %}
    {% assign toegewezen = toegewezen | append: account.number | append:";" %}
  {% endfor %}
{% endfor %}

{% assign omzet_range = custom.detail.omzet | default:"70" %}
{% assign omzet = period.accounts.include_zeros| range:omzet_range %}
{% for account in omzet %}
  {% assign toegewezen = toegewezen | append:account.number | append:";" %}
{% endfor %}

{% assign goederen_range = custom.detail.goederen | default:"60" %}
{% assign goederen = period.accounts.include_zeros| range:goederen_range %}
{% for account in goederen %}
  {% assign toegewezen = toegewezen | append:account.number | append:";" %}
{% endfor %}

{% comment %} voorraadwijziging {% endcomment %}

{% assign beginvoorraad = period.accounts.include_zeros | range:custom.detail.beginvoorraad %} 
{% for account in beginvoorraad %}
  {% assign def_beginvoorraad = def_beginvoorraad | append:account.number %}
  {% unless forloop.last %}
    {% assign def_beginvoorraad = def_beginvoorraad | append:"," %}
  {% endunless %}
{% endfor %}

{% assign eindvoorraad = period.accounts.include_zeros| range:custom.detail.eindvoorraad %}
{% for account in eindvoorraad %}
  {% assign def_eindvoorraad = def_eindvoorraad  | append: account.number %}
  {% unless forloop.last %}
    {% assign def_eindvoorraad = def_eindvoorraad | append:"," %}
  {% endunless %}
{% endfor %}

{% assign def_voorraadwijziging = def_beginvoorraad  | append:"," | append:def_eindvoorraad %}

{% assign acccounts_begin = period.accounts | range:custom.begin_eind.range %}
{% assign beginvoorraad = custom.voorraad.begin | default:acccounts_begin.value %}

{% assign acccounts_eind = period.minus_1y.accounts | range:custom.begin_eind.range %}
{% assign eindvoorraad = custom.voorraad.eind | default:acccounts_eind.value %}

{% assign voorraadwijziging_range = custom.detail.voorraadwijziging | default:def_voorraadwijziging %}
{% assign voorraadwijziging = period.accounts.include_zeros | range:voorraadwijziging_range %}
{% capture voorraadwijziging_rows %}{% input custom.wijziging.voorraad as:currency default:-1*voorraadwijziging.value %} {% assign wijziging_in_voorraad = custom.wijziging.voorraad | default:-1*voorraadwijziging.value %}{% result 'voorraadwijziging' wijziging_in_voorraad %}
{% for account in voorraadwijziging %}
    {% assign toegewezen = toegewezen | append:account.number | append:";" %}
{% endfor %}
{% endcapture %}

{% assign sociale_bijdrage = period.accounts.include_zeros| range:custom.detail.sociale_bijdrage %}
{% for account in sociale_bijdrage %}
{% assign toegewezen = toegewezen | append:account.number | append:";" %}
{% endfor %}

{% assign echtgenote = period.accounts.include_zeros| range:custom.detail.echtgenote %}
{% for account in echtgenote %}
  {% assign toegewezen = toegewezen | append:account.number | append:";" %}
{% endfor %}

{% for extra_kost in custom.extra_kosten %}
  {% assign accounts = period.accounts.include_zeros | range:extra_kost.accounts %}
  {% for account in accounts %}
  {% assign toegewezen = toegewezen | append:account.number | append:";" %}
  {% endfor %}
{% endfor %}

{% for extra_account in custom.extra_accounts %}
  {% assign accounts = period.accounts.include_zeros | range:extra_account.accounts %}
  {% for account in accounts %}
  {% assign toegewezen = toegewezen | append:account.number | append:";" %}
  {% endfor %}
{% endfor %}
  
{% assign global_6_range = "" %}
{% assign accounts = period.accounts.include_zeros | range:'6' %}
{% for account in accounts %}
  {% unless toegewezen contains account.number %}
    {% unless global_6_range == blank %}{% assign global_6_range = global_6_range | append:"," %}{% endunless %}
    {% assign global_6_range = global_6_range | append:account.number %}
  {% endunless%}
{% endfor %}

{% assign global_7_range = "" %}
{% assign accounts = period.accounts.include_zeros | range:'7' %}
{% for account in accounts %}
  {% unless toegewezen contains account.number %}
    {% unless global_7_range == blank %}{% assign global_7_range = global_7_range | append:"," %}{% endunless %}
    {% assign global_7_range = global_7_range | append:account.number %}
  {% endunless%}
{% endfor %}

{% assign global_range = global_6_range | append:"," | append:global_7_range %}


{% capture header %}|-----------40%---------------|---------------15%-----------:|---------------15%-----------:|---------------15%-----------:|---------------15%-----------:+{% endcapture %}

{% capture table %}

-----------------------------------------------------------------------------------------------------------

{% stripnewlines %}
{{ header }}
{% newline %}
| **{% t "Detail van de kosten" %}**    
| **{{ period.year_end_date | date:'%Y' }}**
| **{% t "Beroeps-<br />beperking" %}**<br />**({% t "aftrekbaar" %})**
| **{% t "Fiscale beperking" %}**<br />**({% t "aftrekbaar" %})**
| **{% t "Aftrekbaar" %}**                      
{% newline %}                
{% newline %}
-----------------------------------------------------------------------------------------------------------
{% newline %}                
{% newline %}
{% for cost_category in cost_categories %}
  {% assign $11 = 0 %}
  {% assign $12 = 0 %}
  {% assign $13 = 0 %}
    {% if cost_keys_string != blank %}
    {% assign category_key = cost_keys[forloop.index0] %}
  {% else %}
    {% assign category_key = cost_category | replace:" ","_" | downcase %}
  {% endif %}

    {% ifi custom[category_key].accounts != blank %}
{% newline %}
  | **{% t cost_category %}** {% input custom[category_key].accounts as:account_collection range:global_range %} |
  {% assign category_key = cost_keys[forloop.index0] %}
  {% assign costs = period.accounts | range:custom[category_key].accounts %}
  {% newline %}
  {{ header }}
  {% newline %}
  {% for account in costs %}
    {% assign vin_old = 1-custom[account.number].vin %}
    {% assign beperking_old = 1-custom[account.number].beperking %}
    {% assign vin_new = custom[account.number].vin_new | default:vin_old %}
    {% if vin_new == blank %}
      {% assign vin = 0 %}
    {% else %}
      {% assign vin = vin_new %}
    {% endif %}
    
    {% assign beperking_new = custom[account.number].beperking_new | default:beperking_old %}
    {% if beperking_new == blank %}
      {% assign beperking = 0 %}
    {% else %}
      {% assign beperking = beperking_new %}
    {% endif %}
    
    | {{ account.name }}
    | {%=$11+ -1*account.value as:currency %}
    | {% input custom[account.number].vin_new as:percentage placeholder:'0.00%' default:vin_old %}
    | {% input custom[account.number].beperking_new as:percentage placeholder:'0.00%' default:beperking_old %}
    | {{ -1*vin*beperking*account.value | currency }}
      {% $13+ -1*vin*beperking*account.value as:currency %}
    {% newline %}
    {% if forloop.last %}
      |     
      | **{% =$21+ $11 as:currency %}** 
      |
      |
      | **{% =$23+ $13 as:currency %}** {% $1+ $13 as:currency %}
      {% result category_key $13 %}|
    {% newline %}
    {% endif %}
  {% endfor %}
  {% newline %}
    {% endifi %}
{% endfor %}
{% newline %}                
{% newline %}
-----------------------------------------------------------------------------------------------------------
{% newline %}                
{% newline %}
{% endstripnewlines %}

{{ header }}
| **{% t "Totaal" %}**                  | **{{ $21 | currency }}** | | | **{{ $23 | currency }}**

-----------------------------------------------------------------------------------------------------------

{% endcapture %}

{% stripnewlines %}
{% newline %}
|---------------------|-------15%-------:|-------15%-------:|-------15%-------:+
{% newline %}
| {% t "Ontvangsten/Baten" %} {% input custom.detail.omzet as:account_collection range:global_7_range default:'70' %}| | | {%=$10+ -1*omzet.value | currency %}
{% assign omzet = period.accounts | range:omzet_range %}
{% for account in omzet %}
  {% $31+ account.value %}
  {% newline %}
  | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ account.name }}|{{ -1*account.value | currency }}
{% endfor %}
{% assign goederen = period.accounts | range:goederen_range %}
{% ifi goederen.value != 0 %}
{% newline %}
| {% t "Handelsgoederen, grond en hulpstoffen" %} {% input custom.detail.goederen as:account_collection range:global_6_range default:'60' %}| |{{ -1*goederen.value | currency }}  
{% for account in goederen %}
  {% $32+ account.value %}
  {% newline %}
  | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ account.name }}|{{ -1*account.value | currency }}
{% endfor %}
{% newline %}
| {% t "Voorraadwijziging" %} {% input custom.detail.voorraadwijziging as:account_collection range:global_range default:def_voorraadwijziging %} {% input custom.eindvoorraad.doc as:file %}| |{{voorraadwijziging_rows}}
{% newline %}
{% ic %}| {% input custom.begin_eind.show as:boolean %} {% t "Toon beginvoorraad - eindvoorraad boekjaar" %} {% if custom.begin_eind.show == true %}{% input custom.begin_eind.range as:account_collection range:"34" %} {% unexplained wijziging_in_voorraad+(beginvoorraad-eindvoorraad) as:indicator %}{% endif %}{% newline %}{% endic %}
{% if custom.begin_eind.show == true %}
| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {% t "Beginvoorraad" %} | {% input custom.voorraad.begin as:currency placeholder_default:acccounts_begin.value %}{% newline %}
| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {% t "Eindvoorraad" %} |  {% input custom.voorraad.eind as:currency placeholder_default:acccounts_eind.value %}{% newline %}
{% endif %}
| {% t "Verkochte goederen" %}|||_{%=$10+ (-1*goederen.value+wijziging_in_voorraad) | currency %}_
{% newline %}
| **{% t "Brutowinst" %}**        ||| **{{ $10 | currency }}**{% endifi %}{% ifi custom.detail.sociale_bijdrage != blank %}
{% newline %}
| {% t "Sociale bijdragen" %} {% input custom.detail.sociale_bijdrage as:account_collection range:global_6_range %} {% input custom.sociale_bijdrage.doc as:file %}| | | {%=$10+ -1*sociale_bijdrage.value | currency %}{% result 'sociale_bijdrage' -1*sociale_bijdrage.value %}{% endifi %}{% ifi custom.detail.echtgenote != blank %}
{% newline %}
  | {% t "Toekenning meewerkende echtgeno(o)t(e)" %} {% input custom.detail.echtgenote as:account_collection range:global_6_range %} {% input custom.echtgenoot.doc as:file %} | | | {%=$10+ -1*echtgenote.value | currency %}{% result 'echtgenote' -1*echtgenote.value %}
  {% endifi %}
  {% assign bruto_winst = $10 %}

  | {% fori extra_kost in custom.extra_kosten %}
    {% newline %}
    |{% input extra_kost.name %} {% input extra_kost.accounts as:account_collection range:global_range %}{% input extra_kost.doc as:file %} | | |{% assign accounts = period.accounts.include_zeros | range:extra_kost.accounts %}{% if extra_kost.accounts != blank %}{% =$10+ accounts.value*-1 %}{% else %}{% $10+input extra_kost.value as:currency default:-1*accounts.value %}{% endif %}
  {% endfori %}
{% newline %}
  | {% t "Kosten" %}              | | |_{% =$10+ $1 %}_
{% newline %}
  | **{% t "Nettoresultaat" %}**      | | | **{{ $10 | currency }}**
{% newline %}
  |
  | {% fori extra_account in custom.extra_accounts %}
    {% newline %}
    |{% input extra_account.name %} {% input extra_account.accounts as:account_collection range:global_range %}{% input extra_account.doc as:file %} | | |{% assign accounts = period.accounts.include_zeros | range:extra_account.accounts %}{% if extra_account.accounts != blank %}{% =$10+ accounts.value*-1 %}{% else %}{% $10+input extra_account.value as:currency default:-1*accounts.value %}{% endif %}
  {% endfori %}
  |
{% endstripnewlines %}

{% newpage %}

{{ table }}

<!----------------------------------------- check to see if all accounts have been used JUST ONCE ----------------------------------------->

{% assign accounts = period.accounts.include_zeros | range:'6,7' %}
{% assign count_6_7 = accounts.count %}

{% assign count_toegewezen = toegewezen | split:";" %}
{% assign toegewezen_range = count_toegewezen | join:"," %}
{% assign count_toegewezen = count_toegewezen.size %}

{% assign toegewezen_bedrag = period.accounts | range:toegewezen_range %}

{% assign niet_toegewezen = #6+#7-toegewezen_bedrag.value %}

{% ic %}
*{% t "Niet toegewezen bedrag" %} {{ niet_toegewezen | currency }}* {% unexplained niet_toegewezen as:indicator %}

{% if count_6_7 > count_toegewezen %}

{% stripnewlines %}
| *{% t "Nr." %}* | *{% t "Naam" %}* | *{% t "Bedrag" %}*
{% newline %}
|--7%--|----|----:#+
{% newline %}
{% for account in accounts %}
  {% unless toegewezen contains account.number %}
           | *{{ account.number }}* | *{{ account.name }}* | *{%=$30+ account.value | currency %}*
    {% newline %}
      {% if forloop.last %}
      |                      |                      | _*{{ $30 | currency }}*_ 
      {% endif %}
  {% endunless %}
{% endfor %}
{% endstripnewlines %}
{% endif %}

{% endic %}

<!------------------------------------------------------------------------------ END -------------------------------------------------------------------------------->

{% ifi custom.extra.bijlage.document or custom.extra.toelichting != blank %}<br>

{% stripnewlines %}
|------
|------
{% newline %}
| **{% t "Extra toelichting" %}**
| {% input custom.extra.bijlage as:file placeholder:'' %}
{% endstripnewlines %}

{% input custom.extra.toelichting as:text size:mini placeholder:'' %}
{% endifi %}

{% t= "Huur en huurlasten" fr:"La location et les frais de location" en:"Rent and rental expenses" %}
{% t= "Onderhoud en herstellingen" fr:"L'entretien et les réparation" en:"Maintenance and repair" %}
{% t= "Personenwagen(s)" fr:"Voiture(s) particulière(s)" en:"" %}
{% t= "Bedrijfswagen(s)" fr:"Véhicule(s) utilitaire(s)" en:"" %}
{% t= "Leveringen aan de onderneming" fr:"Livraison à l'entreprise" en:"" %}
{% t= "Vergoeding aan derden" fr:"Les frais de tiers" en:"Remuneration to third parties" %}
{% t= "Communicatie" fr:"Les frais de communication" en:"" %}
{% t= "Publiciteit, documentatie en relatiegeschenken" fr:"Publicité, documentation et cadeaux promotionnels" en:"" %}
{% t= "Verzekeringspremies, andere dan voor het personeel" fr:"Primes d'assurances, autre que pour le personnel" en:"" %}
{% t= "Extra legale verzekeringen" fr:"Assurances extralégales" en:"" %}
{% t= "Personeel" fr:"Frais de personnel" en:"" %}
{% t= "Afschrijvingen" fr:"Amortissements" en:"" %}
{% t= "Overige bedrijfskosten" fr:"Divers charges d'exploitation" en:"" %}
{% t= "Financiële kosten" fr:"Frais financiers" en:"" %}

{% assign cost_categories_string = "Huur en huurlasten|Onderhoud en herstellingen|Personenwagen(s)|Bedrijfswagen(s)|Leveringen aan de onderneming|Vergoeding aan derden|Communicatie|Publiciteit, documentatie en relatiegeschenken|Verzekeringspremies, andere dan voor het personeel|Extra legale verzekeringen|Personeel|Afschrijvingen|Overige bedrijfskosten|Financiële kosten" %}

{% assign cost_keys_string = "huur|onderhoud|personenwagen|bedrijfswagen|leveringen|vergoeding|communicatie|publiciteit|verzekeringspremies|extralegaal|personeel|afschrijvingen|overige|financieel" %} ```

Okay,

So you want to have this value for instance, back displayed for each section of the costs:

{% assign beperking_old = 1-custom[account.number].beperking %} 

This can be done by taking the value of a formula into a register, like this for instance:

{% $12+ -1*beperking_old*account.value as:currency %} 

beperking_old is the value of the limitation
account.value is the value of the account

This will save the outcome of the formula into $12, for each loop of a cost group.
At the end of those loops, with a forloop-last, you can display it like this:

{% if forloop.last %}
**{{ $12 | currency }}**
{% endif %}

The one thing you shouldn’t forget, is that for each group of costs, the $12 is put back to zero (otherwise it will add the value of all the loops of all cost groups):

{% assign $12 = 0 %} 

Hi Sven,

I don’t know where to put these piece of code exactly.
Wouldn’t it be better is the standard template Beroepskosten is adjusted by you so everyone can see the totals?

Thanks for the explanation!

Hey @CedricDeVos,

It’s because of feedback we got from users, we decided to erase it. You can always add it to your custom template by the explanation above.

That can be added in the forlooop.last for each cost categorie:

{% if forloop.last %}
      |     
      | **{% =$21+ $11 as:currency %}** 
      |
      |
      | **{% =$23+ $13 as:currency %}** {% $1+ $13 as:currency %}
      {% result category_key $13 %}|
    {% newline %}
    {% endif %} 

This is where the definitive totals are, right?
The calculation with the formulas need to be put in each loop of every cost categorie:

| {{ account.name }}
    | {%=$11+ -1*account.value as:currency %}
    | {% input custom[account.number].vin_new as:percentage placeholder:'0.00%' default:vin_old %}
    | {% input custom[account.number].beperking_new as:percentage placeholder:'0.00%' default:beperking_old %}
    | {{ -1*vin*beperking*account.value | currency }} 

Care to take it a try? Let me know if you’re stuck with your new adapted code.