CASE: calculate provision, depending on fiscal year

In this case, we show how an account template can be created, that calculates the provision. Depending on which fiscal year it is, it will take into account a certain percentage:

Below is the source code; additional information is placed between comment-tags:

{% comment %}put fiscal year in local variable "fiscal_year"{% endcomment %}
{% assign fiscal_year = period.fiscal_year %}

{% comment %}for each fiscal year, create percentage of provision{% endcomment %}
{% case fiscal_year %}
{% when 2016 %}
  {% assign provision = 0.1880 %}
{% when 2017 %}
  {% assign provision = 0.1860 %}
{% when 2018 %}
  {% assign provision = 0.1820 %}
{% else %}
  {% comment %}if percentage fiscal year is not known yet, we will set the percentage of the last known fiscal year and create an info text for users to make that clear{% endcomment %}
  {% assign show_info = true %}
  {% assign provision = 0.1820 %}
{% endcase %}

<!----------------------------------- PROVISION TEMPLATE ----------------------------------->

{% comment %}option to add attachment - do not show if there is no attachment through the ifi-statement (same as if-statement but will be executed on export - visible always in input mode). To check if a document is added as an attachment, we have the extra method .document that can be added to the database variable custom.doc.wages{% endcomment %}
{% ifi custom.doc.wages.document != blank %}
Offical document social secretary: {% input custom.doc.wages as:file %}
{% endifi %}

{% comment %}actual calculation of provision with option to overwrite the wages{% endcomment %}

{% stripnewlines %}
| Wages
  {% comment %}make account collection to choose on which accounts the provision can be calculated on{% endcomment %}
  {% input custom.wages.accounts as:account_collection range:"62" default:"620" accounts_var:wages placeholder:"select the accounts to calculate the provision on" %}
|
| Perc. 
  {% comment %}show info if perc not known yet - that's the local variable "show_info" we created in the beginning{% endcomment %}
  {% if show_info %}
    {% ic %}
      {::infotext as="hover"}
      When percentages are not yet official, last known percentage will be shown
      {:/infotext}
    {% endic %}
  {% endif %}
|
| Provision
{% newline %}
|----30%----
|:---10%----:
|----30%----
|:---05%----:
|----25%----:+
{% newline %}
| {% input custom.value.wages as:currency default:wages %}
  {% comment %}put default in local variable "wages" if value is not overwritten; if it is overwritten, that value will be assigned to local variable "wages"{% endcomment %}
  {% assign wages = custom.value.wages | default:wages %}
| x
| {{ provision | percentage }}
| =
| {{ wages*provision | currency }}
{% comment %}the unreconciled-tag can calculate values: when zero, it will function as being reconciled. Anything else than zero, is unreconciled.{% endcomment %}
  {% unreconciled current_account.value+(wages*provision) %}{% comment %}the current_account.value has the value of the account the template is linked to{% endcomment %}
{% endstripnewlines %}

How to add a custom template to your firm, is explained here: