Explained/unexplained

Hi,

I’m trying to build a custom template for the calculation of intercompany intrests.
The problem I’m facing is the indicator of the account keeps unexplained. How can i solve this?

Here is my code:

|Kwartaal                    |Saldo begin kwartaal       | Saldo einde kwartaal       |           Gemiddelde  |    D/C Intrest (%)     |   Intrest  |
|--22%-----------------------|--20%----------------------:|----20%---------------------:|-------10%-------------:|---------------------:|---------:+
|Kwartaal  {% input custom.kwartaal1.naam %}|{% input custom.kwartaal1.beginsaldo as:currency %}{% $1+ custom.kwartaal1.beginsaldo %}|{% input custom.kwartaal1.eindsaldo as:currency %}{% $1+ custom.kwartaal1.eindsaldo %}|{{ $1/2 | currency }}|{% input custom.kwartaal1.intrestperc as:percentage %}{% $0+ custom.kwartaal1.intrestperc %}|{%=$2+ $1/2*$0 | currency %}{% assign $0 = 0 %}{% assign $1 = 0 %}{% $3+ $2 %}{% $2+ custom.kwartaal1.eindsaldo | currency %}{% $1+ $2 %}{% assign $2 = 0 %}
|Kwartaal  {% input custom.kwartaal2.naam %}|{{ $1 | currency }}|{% input custom.kwartaal2.eindsaldo as:currency %}{% $1+ custom.kwartaal2.eindsaldo %} |{{ $1/2 | currency }}|{% input custom.kwartaal2.intrestperc as:percentage %}{% $0+ custom.kwartaal2.intrestperc %}|{%=$2+ $1/2*$0 | currency %}{% assign $0 = 0 %}{% assign $1 = 0 %}{% $3+ $2 %}{% $2+ custom.kwartaal2.eindsaldo | currency %}{% $1+ $2 %}{% assign $2 = 0 %}
|Kwartaal  {% input custom.kwartaal3.naam %}|{{ $1 | currency }}|{% input custom.kwartaal3.eindsaldo as:currency %}{% $1+ custom.kwartaal3.eindsaldo %} |{{ $1/2 | currency }}|{% input custom.kwartaal3.intrestperc as:percentage %}{% $0+ custom.kwartaal3.intrestperc %}|{%=$2+ $1/2*$0 | currency %}{% assign $0 = 0 %}{% assign $1 = 0 %}{% $3+ $2 %}{% $2+ custom.kwartaal3.eindsaldo | currency %}{% $1+ $2 %}{% assign $2 = 0 %}
|Kwartaal  {% input custom.kwartaal4.naam %}|{{ $1 | currency }}|{% input custom.kwartaal4.eindsaldo as:currency %}{% $1+ custom.kwartaal4.eindsaldo %} |{{ $1/2 | currency }}|{% input custom.kwartaal4.intrestperc as:percentage %}{% $0+ custom.kwartaal4.intrestperc %}|{%=$2+ $1/2*$0 | currency %}{% assign $0 = 0 %}{% assign $1 = 0 %}{% $3+ $2 %}{% $2+ custom.kwartaal4.eindsaldo | currency %}{% $1+ $2 %}{% assign $2 = 0 %}
| | |**{{ $1 | currency }}** | | **Totaal intresten :**  | **{{ $3 | currency }}**|


{% unexplained $3-current_account.value | as:indicator %}

*{{ current_account.link }} waarde rekening {{ current_account.value }} waarde var 3 {{ $3 | currency }} moet 0 zijn om goed te zijn ! {%=$2+$3-current_account.value %}*

Hello Wim,

Can you provide me a screenshot of the output too please?

Hello Wim,

Since the indicator bottom left is green, it means that your code is correct. The issue is not in code but we need to make available a new addition in the UI which will make your indicator on the top to agree with the one at the bottom. @Tim has been already informed for that and when it’s done, it will look like that:

Hi @Wim

We’ll add this feature indeed, but in the mean time, you can pass which template should be converted in the support/chat and we’ll do it manually behind the scenes for you.

Thx! I don’t need the indicator below. Can i just delete the last 3 lines? I’ve only need the one on top for the account.

I’ve dropped the question at the helpdesk to adjust the setting for the template.

To tweak the code i think i need to add a multiplier *1 or *-1 for use in the 65 and 75 ranges.

My code is very simplistic any suggestions to tweak it up?

If you want to delete the indicator, you will just have to delete {% unexplained $3-current_account.value | as:indicator %} . If you want to delete the next row too, then delete the last line of your code too.

I had a look at your code and would simplify it a bit, for example I would change the first line to

{% stripnewlines %}
  {% assign $1 = 0 %}
  | Kwartaal  {% input custom.kwartaal1.naam %}
  | {% input custom.kwartaal1.beginsaldo as:currency %}
  | {% input custom.kwartaal1.eindsaldo as:currency %}
  | {% assign average = (custom.kwartaal1.beginsaldo+custom.kwartaal1.eindsaldo)/2 %} 
    {{ average | currency }}
  | {% input custom.kwartaal1.intrestperc as:percentage %}
  | {% assign intrest = average*custom.kwartaal1.intrestperc %} 
    {{ intrest | currency }}
    {% $3+ intrest %}
    {% $1+ intrest+custom.kwartaal1.eindsaldo %}
{% endstripnewlines %}

Mainly making things a bit more readable by using some variables simpler by using some variables. If you’d want to keep using registers, you could also do $1+input iso first doing the input and then adding in a register.

What I would also probably do, depending on the usecase is making the amount of quarters flexible depending on the book years. Don’t know if that’s necessary here, if it is, I can give you an idea how to approach this.

1 Like