Hi Mehdi,
Welcome to our Community,
I have managed to amend your code to get the expected results:
- I have introduced the variable
prev_adj_number
to compare the adjustment numbers between the rows and add a blank space when they are different. Like this:
{% if adj_number != blank %}
{% assign prev_adj_number = adj_number %}
{% else %}
{% assign prev_adj_number = adjustment.number %}
{% endif %}
{% if adj_number != prev_adj_number %}
|
{% newline %}
{% endif %}
- Since
adjustment.tags
is a collection containing all the tags, you need to loop over it to print the name. Like this:
{% assign adj_tags = adjustment.tags %}
{% for tag in adj_tags %}
{{ tag.name }}
{% endfor %}
- First you need to define what your PnL range is. Then you loop over it to check whether your account belongs to that range. Like this:
{% comment %}Define P&L range & accounts{% endcomment %}
{% assign pnl_range = pnl_range | default:'4__9' %}
{% assign pnl_accounts = period.accounts.include_zeros | range:pnl_range %}
{% for account in pnl_accounts %}
{% if tran_account_pwc == account.mapped_number %}
{{ tranval | currenct }}
{% break %}
{% endif %}
{% endfor %}
- You are probably missing the
virtual account number
on your reconciliation. Please make sure you have a number here:
Here is the full script of the code:
{% comment %}Define P&L range & accounts{% endcomment %}
{% assign pnl_range = pnl_range | default:'4__9' %}
{% assign pnl_accounts = period.accounts.include_zeros | range:pnl_range %}
{% comment %}have the GREY header in INPUT, while having the BLACK LINE header in export{% endcomment %}
{% comment %}GREY header{% endcomment %}
{% stripnewlines %}
| Adjustment nb
| PwC / Client / Audit
| Description
| Account xxx
| Account Client
| Account Name
| Debit
| credit
| P&L impact
{% newline %}
|:----25%----:
|:----25%----:
|:----25%----:
|:----25%----:
{% ic %}#{% endic %} {% comment %}shows GREY header in INPUT mode{% endcomment %}
{% nic %}+{% endnic %}{% comment %}shows BLACK LINE header in OUTPUT mode{% endcomment %}
{% newline %}
{% assign adjs = period.adjustments %}
{% fori adjustment in adjs %}
{% assign lineindex = 0 %}
{% fori transaction in adjustment.transactions %}
{% assign lineindex = lineindex+1 %}
{% if adj_number != blank %}
{% assign prev_adj_number = adj_number %}
{% else %}
{% assign prev_adj_number = adjustment.number %}
{% endif %}
{% assign adj_number = adjustment.number %}
{% assign adj_tags = adjustment.tags %}
{% assign tran_account_pwc = transaction.account.mapped_number %}
{% assign tran_account_client = transaction.account.original_number %}
{% assign tran_account_name_client = transaction.account.original_name %}
{% assign tran_description = transaction.description %}
{% assign tran_amount_debit = transaction.value %}
{% assign tran_amount_credit = transaction.credit %}
{% if adj_number != prev_adj_number %}
|
{% newline %}
{% endif %}
|# {{ adj_number }}
|
{% for tag in adj_tags %}
{{ tag.name }}
{% endfor %}
|{{ tran_description }}
|{{ tran_account_xxx }}
|{{ tran_account_client }}
|{{ tran_account_name_client }}
| {% if transaction.value > 0 %}{% assign tranval = transaction.value %}{% else %}{% assign tranval = - %}{% endif %} {{ tranval | currency }}
| {% if transaction.value < 0 %}{% assign tranval = (-1)*transaction.value %}{% else %}{% assign tranval = - %}{% endif %} {{ tranval | currency }}
|
{% for account in pnl_accounts %}
{% if tran_account_pwc == account.mapped_number %}
{{ tranval | currenct }}
{% break %}
{% endif %}
{% endfor %}
{% newline %}
{% endfori %}
{% endfori %}
{% endstripnewlines %}
Let us know if you have any questions.
Best,
Borja