selected_accounts_and_reconciliation_texts
Root: export
This drop can only be used in the Detail text section within "Style settings".
Methods
Method | Return type | Description |
---|---|---|
accounts | accounts drop | Returns an accounts drop with all the accounts selected on the export. |
assets | array | Returns only reconciliations and accounts of type "assets". |
equity | array | Returns only reconciliations and accounts of type "equity". |
empty? | boolean | Returns true if no accounts or reconciliations are selected. |
expenses | array | Returns only reconciliations and accounts of type "expense". |
incomes | array | Returns only reconciliations and accounts of type "income". |
include_zeros | array | Same as the 'include_zeros' method in accounts |
is_account | boolean | Returns true if the selected item is an account. |
liabilities | array | Returns only reconciliations and accounts of type "liabilities". |
name | string | Returns the account/reconciliation name. |
p_and_l | array | Returns only reconciliations and accounts of type "profit and loss". |
reconciliation_texts | array | Returns a reconciliation drop with all the reconciliations selected on the export. |
rendered_template | template | Prints the selected account/reconciliation template on the PDF export. |
unreconciled_value (accounts only) | decimal | Returns the amount pending to be reconciled in the account template. |
value (accounts only) | decimal | Returns the value of the selected account. |
Example
The below code was entered in the Detail Text section within a Style. Silverfin will print the information from all the selected accounts that are "liabilities". You will note the code is structured into 3 parts: A top and bottom table which are coded directly into the Detail Text and in the middle the original template code is called, which exists outside of the Detail Text code.
{% for account_or_text in export.selected_accounts_and_reconciliation_texts.liabilities %}
{::group}
{% if account_or_text.is_account %}
{% capture top_table %}
<table>
<tbody>
<tr>
<td class="usr-width-85 usr-line-bottom"><b>{{ account_or_text.number }} {{ account_or_text.name }}</b></td>
<td class="usr-width-15 usr-line-bottom"><b>{{ account_or_text.value | currency }}</b></td>
</tr>
</tbody>
</table>
{% endcapture %}
{% capture bottom_table %}
<table>
<tbody>
<tr>
<td class="usr-width-85"><b>Difference</b></td>
<td class="usr-width-15"><font color="{{ export.highlight_alt_text_color }}"><b>{{ account_or_text.unreconciled_value | currency }}</b></font></td>
</tr>
</tbody>
</table><br><br>
{% endcapture %}
{{ top_table }}{{ account_or_text.rendered_template }}{{ bottom_table }}
{% endif %}
{:/group}
{% endfor %}
In the code, you will note the following methods have been used on the drop “selected_accounts_and_reconciliation_texts”:
.liabilities
to only display templates of type liability.is_account
in control flow to only display templates which are accounts.value
in top table and.unreconciled_value
in bottom table
Finally, in terms of the separation between template and Detail Text code, we can see this clearly demonstrated by the use of font colour for the unreconciled value of 393.00. This is coded using the variable {{ export.highlight_alt_text_color }}
which is unique to the Style, and renders the text in a color which is selected within the Style configuration itself.
Updated over 1 year ago