How to get Payment "Deductions or Loss" data from the Payment Entry Print Format

When Deductions or Loss are added for a Payment Entry type “Pay”, how to get the “Deductions and Loss” Data for a custom HTML element in Print Format. I can already display the default “Deductions and Loss” table in the print format by dragging the element, but I want format the appearance using a custom HTML.

Please check it.

<table class="table table-bordered" style="width: 100%; border-collapse: collapse;">
    <thead>
        <tr>
            <th style="width: 30%;">Account</th>
            <th style="width: 20%;">Cost Center</th>
            <th style="width: 20%; text-align: right;">Amount (Company Currency)</th>
            <th style="width: 30%;">Description</th>
        </tr>
    </thead>
    <tbody>
        {% for row in doc.deductions %}
        <tr>
            <td>{{ row.get_formatted("account") }}</td>
            <td>{{ row.get_formatted("cost_center") }}</td>
            <td style="text-align: right;">{{ row.get_formatted("amount") }}</td>
            <td>{{ row.get_formatted("description") }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>
1 Like

Thank you for the reply, I was looking to get the Data from Deductions and Loss table, and also from Taxes and Charges, if exist. I was able to get it done using the below code,

<table class="table table-bordered" style="border: 0px solid black; border-collapse: collapse;">
    <tbody> 
        <tr>
            <td style="text-align: left; border: 0px solid black;">Unallocated Amount</td>
            <td style="text-align: right; border: 0px solid black;">{{ "{:,.2f}".format(doc.unallocated_amount) }}</td>
        </tr>
        {% if doc.deductions and doc.deductions|length > 0 %}
        {% for deduction in doc.deductions %}
        <tr>
            <td style="text-align: left; border: 0px solid black;">{{ deduction.account }}</td>
            <td style="text-align: right; border: 0px solid black;">{{ "{:,.2f}".format(deduction.amount) }}</td>
        </tr>
        {% endfor %}
        {% elif doc.taxes and doc.taxes|length > 0 %}
        
        {% for tax in doc.taxes %}
        <tr>
            <td style="text-align: left; border: 0px solid black;">{{ tax.account_head }}</td>
            <td style="text-align: right; border: 0px solid black;">{{ "{:,.2f}".format(tax.tax_amount) }}</td>
        </tr>
        {% endfor %}
        
        {% endif %}
        <tr>
            <td style="text-align: left; border: 0px solid black;">Amount After Taxes</td>
            <td style="text-align: right; border: 0px solid black;">{{ "{:,.2f}".format(doc.paid_amount - (doc.base_total_taxes_and_charges or 0)) }}</td>
        </tr>
    </tbody>
</table>