{% extends 'CmBundle:Z:baseDos.html.twig' %}

{% block javascripts %}
    <script src="{{asset('js/misJs/egresosCorporativo.js')}}"></script>
{% endblock %}

{% block content %}

    <div class="row">
        <h3 class="text-center">SALIDAS: {{'now' | date('d-m-Y') }} </h3>
        <div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
            <form class="form-horizontal" action="{{path('salidas_cordiancion_administrativa')}}" method="POST" onsubmit="document.getElementById('btnGuardarEgreso').disabled = true">
                <div class="form-group">
                    <label class="control-label col-sm-2" for="descripcion">Concepto:</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="descripcion" id="descripcion" required="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2" for="monto">Monto:</label>
                    <div class="col-sm-10">
                        <input type="number" step="any" min="0" class="form-control" name="monto" id="monto" required="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2" for="recibe">Quién Recibe:</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="recibe" id="recibe" required="true">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10 text-right">
                        <button type="submit" class="btn btn-primary" id="btnGuardarEgreso">Guardar</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="col-lg-7 col-md-7 col-sm-7 col-xs-12">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="background-color: lightgray;border-radius: 15px 3px 15px 3px;">
                <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                    <label>Fecha A</label>
                    <input type="date" name="fA" id="fA" value="{{"now" | date('Y-m-d') }}" class="form-control">
                </div>
                <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                    <label>Fecha B</label>
                    <input type="date" name="fB" id="fB" class="form-control">
                </div>
            </div>
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding-top: 3px;padding-bottom: 3px;background-color: lightgray;border-radius: 0px 15px 15px 3px;">
                <a class="btn btn-success btn-sm pull-right" onclick="generarReporte()"><span class="fa fa-print fw"></span> Imprimir</a>
            </div>
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <table class="table table-condensed table-sobre table-striped table-responsive">
                    <thead>
                        <tr style="background-color: lightblue;">
                            <th>NC</th>
                            <th>FECHA</th>
                            <th>RECIBO</th>
                            <th>CONCEPTO</th>
                            <th>QUIÉN RECIBE</th>
                            <th>MONTO</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        {% set total = 0 %}
                        {% for e in egresos %}
                            <tr>
                                <td>{{loop.index}}</td>
                                <td>{{e.fecMov | date('d-m-Y') }}</td>
                                <td>{{e.numRecibo}}</td>
                                <td>{{e.descripcion}}</td>
                                <td>{{e.recibe}}</td>
                                <td>
                                    <strong>
                                        ${{e.monto | number_format(2,".",",") }}
                                    </strong>
                                </td>
                                <td>
                                    <a class="btn btn-success btn-xs" href="{{path('salidas_cordiancion_administrativa_recibo',{ideEgr : e.ideEgr})}}" target="_blank"><span class="fa fa-print fa-fw"></span></a>
                                </td>
                                {% set total = total + e.monto %}
                            </tr>
                        {% else %}
                            <tr style="background-color: lightgreen;">
                                <td colspan="8" class="text-center">EL DÍA DE HOY NO HA REGISTRADO SALIDAS</td>
                            </tr>
                        {% endfor %}
                        {% if egresos is defined and egresos != null %}
                            <tr>
                                <td colspan="5"></td>
                                <td style="background-color: lightblue;">TOTAL</td>
                                <td style="background-color: lightblue;">${{total | number_format(2,".",",") }}</td>
                                <td style="background-color: lightblue;"></td>
                            </tr>
                        {% endif %}
                    </tbody>
                </table>
            </div>

        </div>
    </div>

{% endblock %}