Account value prior year

Hi, i’m trying to create a custom report to confirm the balance of the current account.
I have 2 issues:
1- I don’t succeed in getting the correct amount for each selected account. The code only makes a sum of all selected accounts. I don’t have the problem for the current year data.
2- When exporting, the PDF-file remains empty.


For now i have the following code:

{% include "parts/translation" %}

{% ic %}
Selecteer rekeningen: {% input as:account_collection range:"416,48" accounts_var:accounts_rc %}
{% assign prev_date = period.year_end_date|%d/%m/%Y %}
{% assign new_date = prev_date |retract_years:1 %}
{% endic %}

<table class="usr-bordered usr-width-100">
  <thead class="usr-repeated-header">
      <th class="usr-align-center">**{% t "t_rc" %}**</th>
      <th class="usr-align-center">**{% t "t_amount" %} {{ period.year_end_date|date:"%d/%m/%Y" }}**</th>
      <th class="usr-align-center">**{% t "t_amount" %} {{ new_date| date: "%d/%m/%Y" }}**</th>

     {%for account in accounts_rc%}
    {% assign account_value_py = period.minus_1y.accounts | %}
      <td>{{ }}</td>
      <td class="usr-align-right">{{ account.value|currency }}</td>
      <td class="usr-align-right">{{ account_value_py|currency }}</td>    
    {% endfor %}


I’m glad to see you’re using HTML tables, it’s looking pretty good already!

First off, I do notice you’ve assigned accounts_rc within ic-tags.
That will pose an issue in export, so I would recommend defining that variable outside of the ic-tags:

{% assign accounts_rc = period.accounts.include_zeros | %}

Next off, the reason you’re seeing the total value for the previous year is this line:

{% assign account_value_py = period.minus_1y.accounts | %}

→ the range applied is every account selected.
What you actually want is the account number for every iteration, which looks like this since you’re already looping over the accounts:

{% assign account_value_py = period.minus_1y.accounts.include_zeros | range:account.number %}

For your second issue regarding the PDF export, it might depend on the style you’re using.
Can you try with a different style? If you create a new blank style, that should export any template as the detail text in the style settings is empty.
Please also make sure the Virtual Account Number has been filled out, a template cannot be exported if this is empty.

Hope this helps,
Kind regards

Thanks Romy!

Adjustments worked out fine!