<div class="col-lg-12">
    <div class="col-lg-6" style="background-color: lightblue;">
        <h4>TOTAL A PAGAR: <strong>${{convenio.monto}}</strong></h4>
    </div>
    {% set restan = (convenio.monto - convenio.deposito) %}
    {% if restan > 0 %}
        <div class="col-lg-6" style="background-color: lightcoral;">
            <h4>RESTA: <strong>${{restan | number_format(2,".",",") }}</strong></h4>
            <input type="hidden" value="{{restan}}" id="restanAbono">
        </div>
    {% else %}
        <div class="col-lg-6" style="background-color: lightgreen;">
            <h4>RESTA: <strong>${{restan | number_format(2,".",",")}}</strong></h4>
            <input type="hidden" value="{{restan}}" id="restanAbono">
        </div>
    {% endif %}

</div>
<table class="table table-condensed table-bordered table-striped table-hover table-responsive">
    <thead>
        <tr>
            <th>#</th>
            <th>FECHA</th>
            <th>MONTO</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        {% set total = 0 %}
        {% set sumaTotal = 0 %}
        {% for a in abonos %}
            {% set total = 0 %}
            <tr>
                <td>{{loop.index}}</td>
                <td>{{a.fecMov | date('d-m-Y') }}</td>
                <td>$ {{a.monto | number_format(2,".",",") }}</td>
                <td>
                    {% if loop.last %}
                        <a id="btnGenerarComprobanteAbono" class="btn btn-xs btn-success" href="{{path('imprimir_pagos_abonos_convenio',{ideIng:a.ideIng})}}" target="_blank">IMP</a>
                    {% else %}
                        <a id="btnGenerarComprobanteAbono" class="btn btn-xs btn-default" href="{{path('imprimir_pagos_abonos_convenio',{ideIng:a.ideIng})}}" target="_blank">IMP</a>
                    {% endif %}
                </td>
            </tr>
        {% else %}
            <tr>
                <td colspan="4" class="text-center" style="background-color: lightgreen;">
                    NO HAY PAGOS ABONADOS
                </td>
            </tr>
        {% endfor %}
        {% if pagos is defined and pagos != null %}
            <tr>
                <td colspan="2" class="text-right">
                    TOTAL ABONADO
                </td>
                <td class="text-right" style="background-color: lightgreen;">
                    ${{sumaTotal | number_format(2,".",",") }}
                    <input type="hidden" value="{{sumaTotal}}" id="totalAbonoConvenio" name="totalAbonoConvenio">
                </td>
            </tr>
        {% endif %}
    </tbody>
</table>