Sum of Table Columns in Print Format


I am creating custom print format for Salary Slip, In which I am printing Loan Table as below.

Now I want to add a row with Totals.

May I know if any easy way is there.


{% set total_loans=[0]%}
{% for l in %}
{% if total_loans.append(total_loans.pop()+l.principal_amount) -%}{% endif %}
{% endfor %}

1 Like