CASE: create rental income journal overview

This is especially for Belgium important as it would be needed to give an overview of all received rental income if your customer has this kind of income. It can look like this as a reconciliation template:

Below is the source code, where all additional info is given between comment-tags:

<!------------------------------------------------------ RENTAL JOURNAL ------------------------------------------------------>

{% stripnewlines %}
| Rental income journal
{% newline %}
|:--------:{% ic %}#{% endic %}{% nic %}+{% endnic %}
{% newline %}
{% newline %}
| 
| Rental received
| Info
|
| Value
{% newline %}
|----40%----:
|----15%----
|----30%----
|----05%----
|----10%----:{% ic %}#{% endic %}{% nic %}+{% endnic %}
{% fori rent in custom.rentals %}
  {% newline %}
  | {% input rent.address placeholder:"Street and number, postal code and city" %}
  |
  |
  | {% input rent.all_invoices as:file %}
    {% comment %}
    the "persisted" if-statement will check if there is a value inputted in the custom collection "rentals" in the current loop; if so, only then the second fori loop will be executed/shown, so all data from now on will be linked to the unique loop of the first fori!
    {% endcomment %}
    {% if rent.persisted %}
      {% comment %}
      each loop has its unique key, and we'll use that key to capture that and use it as the name of another custom collection (one that will be linked to the inputted data from the frst fori)
      {% endcomment %}
      {% capture key_address %}address_{{ rent.key }}{% endcapture %} 
      {% comment %}
      each loop of the original fori, the register $1 needs to be reset back to zero. If we wouldn't do that, each given rental will count the values of the previous rental
      {% endcomment %}
      {% assign $1 = 0 %}
      {% comment %}we create a custom collection "custom[key_address]" that is actually linked to the value we've put in the first fori{% endcomment %}
      {% fori rental in custom[key_address] %}
        {% newline %}
        |
        | {% input rental.rental_date as:date %}
        | {% input rental.info placeholder:"extra info" %}
        | {% input rental.invoice as:file %}
        | {% $1+input rental.value as:currency %}
        {% if forloop.last %}
          {% newline %}
          |
          |
          |
          |
          |_^ {{ $1 | currency }} ^_|
          {% comment %}
          at the end of each "address", we need the end value before it gets reset; that is why we take that value in another register to calculate later on with (to reconile the template)
          {% endcomment %}
          {% $0+ $1 %}
        {% endif %}
      {% endfori %}
    {% endif %}  
{% endfori %}
{% endstripnewlines %}

<br>

|--------:+
| Total rent journal: {{ $0 | currency }}{% comment %}this is the total of all rental income{% endcomment %}


<!------------------------------------------------------ RECONCILE WITH ACTUAL ACCOUNTS ------------------------------------------------------>

{% comment %}we create an account collection to display the total value of all accounts{% endcomment %}
{% input custom.rental.accounts as:account_collection range:"7" accounts_var:rental_acc %}

{% stripnewlines %}
| Account
| Value
{% newline %}
|----90%----
|----10%----:{% ic %}#{% endic %}{% nic %}+{% endnic %}
{% for acc in rental_acc %}
  {% newline %}
  | {{ acc.link }}
  | {{ -acc.value | currency }}
  {% if forloop.last %}
    {% newline %}
    |
    |_^ {{ -rental_acc.value | currency }}  ^_|
  {% endif %}
{% endfor %}
{% endstripnewlines %}

{% comment %}declare any differences if needed{% endcomment %}
{% assign rental_diff = $0+rental_acc.value %}

{% comment %}with an ifi-statement we will show always in input, but when the if-statement is true, only then will we show it in export{% endcomment %}
{% ifi rental_diff != 0 %}

<br>

{% stripnewlines %}
|----90%----
|----10%----:+
{% newline %}
| ***Difference***
| *{{ rental_diff | currency }}*
{% endstripnewlines %}

{% comment %}create fori to explain differences{% endcomment %}
{% stripnewlines %}
|----90%----
|----10%----:+
{% fori diff in custom.rental_diff %}
  {% newline %}
  | {% input diff.description placeholder:"Description" %}
  | {% $2+input diff.value_diff as:currency %}{% comment %}all values of explanation will be taken into register $2{% endcomment %}
{% endfori %}
{% newline %}
|
| {{ $2 | currency }}{% comment %}total of explained differences{% endcomment %}
{% endstripnewlines %}

{% endifi %}

{% assign explained = $2 %}

{% comment %}show only when it's not zero in export (always show in input though){% endcomment %}
{% ifi rental_diff-explained != 0 %}
{% stripnewlines %}
|----90%----
|----10%----:+
{% newline %}
| ***Difference to be explained***
| *{{ rental_diff-explained | currency }}*
{% endstripnewlines %}
{% endifi %}

{% comment %}with the unreconciled tag, we can reconcile the template: if the amount of the formula is zero, it's reconciled{% endcomment %}
{% unreconciled rental_diff-explained %}

To know how to add this template as a custom reconciliation template, follow these steps: