List of Accounts in Country-Specific Reports

Add the List of Accounts macro to your report's HTML/XML template if you want to see the balance of each variable split into balances of individual accounts. This means that for each variable in your report, you will see the list of accounts that are included in the variable.

The List of Accounts macro also contains the macro for handling a hierarchical display of accounts according to the parent-child relationship in your Chart of Accounts. When you have added this macro, you can then enable this hierarchical view on a variable level. For more information, see Displaying Parent-Child Hierarchy of Accounts in Country-Specific Reports.

If you are using the Contra Account Sheet SuiteApp, adding the List of Accounts macro to your report template is necessary for the drill-down feature to work. For more information, see Viewing Country-Specific Reports.

You must add the List of Accounts macro to the beginning of your template before the rest of the code. You can copy and paste the whole macro to your template. If your template has a custom layout, such as for instances that your report contains additional columns, you need to edit the macro’s content accordingly.

Important:

If you want to be able to toggle the display of the list of accounts in your report, you can add the List of Accounts filter on the report record. This filter adds the Show individual accounts box when you view your report on the Country-Specific Reports page. For more information, see Filters in Country-Specific Reports.

The following is the macro for handling the display of a list and hierarchy of accounts in a variable:

          <!-- Paste this macro before at the beginning of your template -->
 
    <#macro printFullVariable name value value2=0 accounts=[] level=1>
        <tr class="csr-level-${level}">
            <td class="csr-label">${name}</td>
            <td class="csr-value"><#if !accounts?has_content>${value}</#if></td>
            <td class="csr-value csr-secondary"><#if !accounts?has_content>${value2}</#if></td>
        </tr>
        <#list accounts as acc>
            <tr class="csr-level-${level + 1}">
                <td class="csr-label"><#if acc.number?length gt 0 >${‌acc.number} - </#if>${‌acc.name}</td>
                <td class="csr-value">${‌acc.value}</td>
                <td class="csr-value csr-secondary">${‌acc.value2}</td>
            </tr>
        </#list>
        <#if accounts?has_content>
            <tr class="csr-level-${level} csr-total">
                <td class="csr-label">Total - ${name}</td>
                <td class="csr-value">${value}</td>
                <td class="csr-value csr-secondary">${value2}</td>
            </tr>
        </#if>
    </#macro>

<!-- Macro for the hierarchical display of accounts-->
 
  <#macro printAcc acc level=2>
        <tr class="csr-level-${level}">
            <td class="csr-label">${‌acc.number} ${‌acc.name} </td>
            <td class="csr-value"><#if !acc.accounts?has_content>${‌acc.value}</#if></td>
            <td class="csr-value csr-secondary"><#if !acc.accounts?has_content>${‌acc.value2}</#if></td>
        </tr>
        <#if acc.accounts?has_content>
            <#list acc.accounts as acch>
                <@printAcc acch level+1/>
            </#list>
            <tr class="csr-level-${level} csr-total">
                <td class="csr-label">${‌SYS.totalstring}${‌acc.number}  ${‌acc.name} </td>
                <td class="csr-value">${‌acc.value}</td>
                <td class="csr-value csr-secondary">${‌acc.value2}</td>
            </tr>
        </#if>
    </#macro>
     
<!-- END of macro -->

<!-- About section-->
 
<table class="csr-about">
    <!-- ... -->
</table>
<!-- End of About section-->

<!-- Contents of the report start here-->
 
<div class="csr-content">
    <table class="csr-data csr-indent-deep">
        <thead>
            <tr>
                <td width="80%">${VAR.header_label.name}</td>
                <td width="20%" class="csr-align-right">${VAR.header_value.name}</td>
            </tr>
        </thead>
        <tbody>
 
            <!-- Section A -->
            <tr class="csr-level-1">
                <td class="csr-label">${VAR.var_A.name}</td>
                <td></td>
            </tr>
 
            <!-- Subsection A I. -->
            <tr class="csr-level-2">
                <td class="csr-label">${VAR.var_AI.name}</td>
                <td></td>
            </tr> 

        

Then, you must call this macro for every variable where you want the list or hierarchy of accounts to be displayed. This macro is for low-level variables only. Do not use for the total variables (these are variables that contain other variables).

In this sample code, the macro is called for var_AI1, var_AI2, and var_AI3 variables:

          <!-- To render the lowest-level variable with the list of included accounts, call the macro -->
            <!-- The first arguments are attributes of the variable and the last one is the indentation level to be printed -->
            <@printFullVariable VAR.var_AI1.name VAR.var_AI1.value VAR.var_AI1.value2 VAR.var_AI1.accounts 3 />
             
            <@printFullVariable VAR.var_AI2.name VAR.var_AI2.value VAR.var_AI2.value2 VAR.var_AI2.accounts 3 />
 
            <tr class="csr-level-4">
                <td class="csr-label">${VAR.var_AI2_of.name}</td>
                <td class="csr-value">${VAR.var_AI2_of.value}</td>
            </tr>
 
            <@printFullVariable VAR.var_AI3.name VAR.var_AI3.value VAR.var_AI3.value2 VAR.var_AI3.accounts 3 />
 
            <!-- Total for subsection A I. -->
            <tr class="csr-level-2 csr-total">
                <td class="csr-label">${VAR.var_AI_total.name}</td>
                <td class="csr-value">${VAR.var_AI_total.value}</td>
            </tr>
            <!-- END Subsection A I. -->
 
            <!-- Subsection A II. -->
            <tr class="csr-level-2">
                <td class="csr-label">${VAR.var_AII.name}</td>
                <td class="csr-value">${VAR.var_AII.value}</td>
            </tr>
            <!-- END Subsection A II. -->
 
            <!-- Total for section A -->
            <tr class="csr-level-1 csr-total">
                <td class="csr-label">${VAR.var_A_total.name}</td>
                <td class="csr-value">${VAR.var_A_total.value}</td>
            </tr>
            <!-- END Section A -->
        </tbody>
 
        <!-- Total all -->
        <tfoot class="csr-totalall">
            <tr>
                <td width="80%" class="csr-label">${VAR.total_all.name}</td>
                <td width="20%" class="csr-value">${VAR.total_all.value}</td>
            </tr>
        </tfoot> 
        <!-- END Total all -->
     
    </table>
</div> 

        
Sample Report with List and Hierarchy of Accounts
Sample report where the accounts that constitute a balance are displayed in a parent-child hierarchy.

Related Topics

General Notices