<?php $__env->startSection('main-content'); ?>


    <?php
    if (isset($_GET['dias'])) {

        $dias = $_GET["dias"];
        $startf = "";
        if ($dias == 30) {
            $startf = date('Y-m-d', strtotime('today - 30 days'));
        }
        if ($startf == 15) {
            $startf = date('Y-m-d', strtotime('today - 15 days'));
        }
        if ($dias == 7) {
            $startf = date('Y-m-d', strtotime('today - 7 days'));
        }
        if ($dias == 1) {
            $startf = date('Y-m-d', strtotime('today'));
        }

        $finishf = $startf = date('Y-m-d', strtotime('today'));
    } else {
        $finishf = '';
        $startf = '';
    }

    if (isset($_GET['start'])) {
        $startf = $_GET["start"];
    } else {
        $startf = "";
    }

    if (isset($_GET['finish'])) {
        $finishf = $_GET["finish"];
    } else {
        $finishf = '';
    }

    if (isset($_GET['dias'])) {
        $diasf = $_GET["dias"];
    } else {
        $diasf = '';
    }

    if (isset($_GET["tipo"])) {
        $tipof = $_GET["tipo"];
    } else {
        $tipof = "";
    }
    if (isset($_GET["cuentas"])) {
        $cuentasf = $_GET["cuentas"];
    } else {
        $cuentasf = "";
    }
    if (isset($_GET["tipo"])) {
        $tipof = $_GET["tipo"];
    } else {
        $tipof = "";
    }

    if (isset($_GET["categoria"])) {
        $categoriaf = $_GET["categoria"];
    } else {
        $categoriaf = "";
    }

    if (isset($_GET['id_attr'])) {
        $id_attrf = $_GET["id_attr"];
    } else {
        $id_attrf = '';
    }



    if (isset($_GET['tf'])) {
        $id_tf = $_GET["tf"];
    } else {
        $id_tf = '';
    }
    if (isset($_GET['id_attr_tours'])) {
        $id_attr_tours = $_GET["id_attr_tours"];
    } else {
        $id_attr_tours = '';
    }

    $url = "?start=" . $startf . "&finish=" . $finishf . "&dias=" . $diasf . "&tipo=" . $tipof . "&cuentas=" . $cuentasf . "&categoria=" . $categoriaf . "&id_attr=" . $id_attrf . "&id_attr_tours=" . $id_attr_tours . "&tf=" . $id_tf . "";

    ?>
    <div class="container-fluid spark-screen">
        <div class="row">
            <div class="col-md-12 ">
                <div class="box-body ">
                    <div class="container-fluid spark-screen">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="box box-admin-border">
                                    <div class="box-header with-border">
                                        <i class="fa fa-bar-chart"></i>
                                        <h3 class="box-title"><b>Movimientos</b></h3>

                                        <a class="btn btn-primary pull-right " href="/summary/create"> <i
                                                    class="fa fa-plus"></i> Nuevo</a>
                                    </div>
                                    <form action="/summary/summary" method="get">
                                        <div class="col-sm-12 add_top_10">

                                            <div class="form-group col-sm-6">
                                                <input type="date" name="start" placeholder="Fecha Inicio"
                                                       class="form-control">
                                            </div>
                                            <div class="form-group col-sm-6">
                                                <input type="date" name="finish" placeholder="Fecha Final"
                                                       class="form-control">
                                            </div>
                                        </div>
                                        <div class="col-sm-12 add_top_1">
                                            <div class="col-sm-2 add_top_1  ">
                                                <select class="form-control" type="text" name="dias">
                                                    <option value="">Filtrar Por dias</option>
                                                    <option value="30">Ultimo mes</option>
                                                    <option value="15">Ultimos 15 dias</option>
                                                    <option value="7">Ultimos 7 dias</option>
                                                    <option value="1">Hoy</option>
                                                </select>
                                            </div>
                                            <div class="col-sm-2 add_top_1">
                                                <select class="form-control" type="text" name="tipo">
                                                    <option value="">Tipo de movimiento</option>
                                                    <option value="1">Transferencia</option>
                                                    <option value="add">Abonos</option>
                                                    <option value="out">Retiros</option>
                                                </select>
                                            </div>
                                            <div class="col-sm-2 add_top_1">
                                                <select class="form-control" type="text" name="cuentas">
                                                    <option value="">Cuentas</option>
                                                    <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $datas): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($datas->id); ?>"><?php echo e($datas->name); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            </div>
                                            <div class="col-sm-2 add_top_1">
                                                <select class="form-control" name="tf" id="tours_select">
                                                    <option value="">Tours</option>
                                                    <?php $__currentLoopData = $tours; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tour): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option class="attr-<?php echo e($tour->price); ?>" value="<?php echo e($tour->id); ?>">
                                                            <?php echo e($tour->name); ?>

                                                        </option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                                <div id="modal1" class="modal">
                                                    <div class="modal-dialog">
                                                        <!-- Modal content-->
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <button type="button" id="closemodal1" class="close"
                                                                        data-dismiss="modal">&times;
                                                                </button>
                                                                <h4 class="modal-title">Fecha De Tours</h4>
                                                            </div>
                                                            <div class="modal-body" id="res_ajax1">

                                                            </div>
                                                            </br>
                                                            <div class="modal-footer">
                                                                <button style=" margin: 15px;" type="button"
                                                                        id="closemodal2" class="btn btn-default"
                                                                        data-dismiss="modal">Ok
                                                                </button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-sm-2 add_top_1">
                                                <select class="form-control" name="categoria" id="categorie_select">
                                                    <option value="">Categorias</option>
                                                    <?php $__currentLoopData = $data2; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $datas2): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <?php if($datas2->name!="transferencia"): ?>
                                                            <option class="attr-<?php echo e($datas2->type); ?>"
                                                                    value="<?php echo e($datas2->id); ?>">
                                                                <?php echo e($datas2->name); ?>

                                                            </option>
                                                        <?php endif; ?>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>

                                                <div id="modal" class="modal">
                                                    <div class="modal-dialog">
                                                        <!-- Modal content-->
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <button type="button" id="closemodal" class="close"
                                                                        data-dismiss="modal">&times;
                                                                </button>
                                                                <h4 class="modal-title">Subcategorias</h4>
                                                            </div>
                                                            <div class="modal-body" id="res_ajax">
                                                            </div>
                                                            </br>
                                                            <div class="modal-footer">
                                                                <button style=" margin: 15px;" type="button"
                                                                        id="closemodal3" class="btn btn-default"
                                                                        data-dismiss="modal">Ok
                                                                </button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-sm-2 add_top_1  ">
                                                <button type="submit" class="btn btn-sm  btn-default form-control "><i
                                                            class="fa fa-filter"></i></button>
                                            </div>
                                            <!-- <div   class=" col-sm-12">
                                                           <div   class="hidden" id="res_ajax">
                                                           </div>
                                            </div> -->
                                        </div>
                                    </form>


                                    <div class="box-body responsive-table  ">
                                        <div id="lista_item_wrapper"
                                             class="dataTables_wrapper form-inline dt-bootstrap">
                                            <div class="row ">
                                                <div class="col-sm-12 ">
                                                    <table id="summary" class="display" cellspacing="0" width="100%">
                                                        <thead>
                                                        <tr>
                                                            <th>ID</th>
                                                            <th>Fecha</th>
                                                            <th>Tipo</th>
                                                            <th>Monto</th>
                                                            <th>Impuesto</th>
                                                            <th>Motivo</th>
                                                            <th>Cuenta</th>
                                                            <th>Categorias</th>
                                                            <th>Acción</th>
                                                        </tr>
                                                        </thead>
                                                        <tbody>
                                                        <?php $__currentLoopData = $summary; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $summarys): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <tr>
                                                                <td><?php echo e($summarys->id); ?></td>
                                                                <?php if( $summarys->created_at ): ?>
                                                                    <?php  $datef = date_create($summarys->created_at);
                                                                    $fecha = date_format($datef, 'd-m-Y ');
                                                                    ?>
                                                                <?php endif; ?>
                                                                <td><?php echo e($fecha); ?></td>
                                                                <?php if($summarys->type=="add"): ?>
                                                                    <td>Abono
                                                                        <small class="label pull-right bg-primary">
                                                                            <?php if($summarys->id_transfer!=""): ?>
                                                                                <i class="fa fa-exchange"></i>
                                                                            <?php else: ?>
                                                                                <i class="fa fa-sort-up"></i>
                                                                            <?php endif; ?>
                                                                        </small>
                                                                    </td>
                                                                <?php elseif($summarys->type=="out"): ?>
                                                                    <td>Retiro
                                                                        <small class="label pull-right bg-red">
                                                                            <?php if($summarys->id_transfer!=""): ?>
                                                                                <i class="fa fa-exchange"></i>
                                                                            <?php else: ?>
                                                                                <i class="fa fa-sort-desc"></i>
                                                                            <?php endif; ?>
                                                                        </small>
                                                                    </td>
                                                                <?php endif; ?>
                                                                <td><?php echo e(number_format($summarys->amount, 2, '.', ',')); ?> <?php echo e($divisa->value); ?></td>
                                                                <td><?php echo e(number_format( $summarys->tax, 2, '.', ',')); ?></td>
                                                                <td><?php echo e($summarys->concept); ?></td>
                                                                <td><?php echo e($summarys->name_account); ?></td>
                                                                <td><?php echo e($summarys->name_categories); ?></td>
                                                                <td>
                                                                    <?php if($summarys->id_transfer!=""): ?>
                                                                        <?php $elimina = "eliminart";
                                                                        $id = $summarys->id_transfer;
                                                                        ?>
                                                                    <?php else: ?>
                                                                        <?php $elimina = "eliminar";
                                                                        $id = $summarys->id;
                                                                        ?>
                                                                    <?php endif; ?>
                                                                    <form role="form"
                                                                          action="/summary/<?php echo $elimina ?>/<?php echo $id ?>"
                                                                          method="post" enctype="multipart/form-data">
                                                                        <?php echo e(method_field('DELETE')); ?>

                                                                        <?php echo e(csrf_field()); ?>

                                                                        <a class="btn btn-sm btn-default"
                                                                           href="/detalle/detalle/<?php echo e($summarys->id); ?>"><i
                                                                                    class="fa fa fa-eye"></i></a>
                                                                        <?php if($summarys->attached): ?>
                                                                            <a class="btn btn-sm btn-default"
                                                                               target="_blank"
                                                                               href="/download/<?php echo e($summarys->attached->id); ?>"><i
                                                                                        class="fa fa-paperclip"></i></a>
                                                                        <?php endif; ?>

                                                                        <?php if($summarys->id_transfer!=""): ?>
                                                                            <a class="btn btn-sm btn-default"
                                                                               href="/transfer/edit/<?php echo e($summarys->id_transfer); ?>"><i
                                                                                        class="fa fa-edit"></i></a>
                                                                        <?php else: ?>
                                                                            <a class="btn btn-sm btn-default"
                                                                               href="/summary/edit/<?php echo e($summarys->id); ?>"><i
                                                                                        class="fa fa-edit"></i></a>
                                                                        <?php endif; ?>

                                                                        <button onclick='if(confirmDel() == false){return false;}'
                                                                                class="btn btn-sm btn-default"
                                                                                type="submit"><i
                                                                                    class="fa fa-trash"></i></button>
                                                                    </form>
                                                                </td>
                                                            </tr>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- /.box-body -->
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-3 col-sm-6 col-xs-12 ">
            <div class="small-box box">
                <div class="inner">
                    <h1> <?php echo e(number_format($totalfinal, 2, '.', ',')); ?></h1>

                    <p><?php echo e($divisa->value); ?></p>
                </div>
                <div class="icon">
                    <i class="fa fa-money"></i>
                </div>
                <label class="small-box-footer">
                    Balance Actual
                </label>
            </div>
        </div>


        <div class="col-md-4 col-sm-6 col-xs-12  pull-right ">
            <div class="info-box ">
                <span class="info-box-icon"><i class="fa fa-credit-card-alt"></i></span>
                <div class="info-box-content">
                    <span class="info-box-text">Balance de Impuestos</span>
                    <span class="info-box-number"
                          style="color: darkgreen;">+ <?php echo e(number_format($totalfinaliva, 2, '.', ',')); ?></span>

                    <div class="progress">
                        <div class="progress-bar" style="width: 0%">

                        </div>
                    </div>
                    <span class="progress-description">No deducibles:
			          		<span style="color: red;"> <?php echo e(number_format($totalfinalivae, 2, '.', ',')); ?></span>
			          	</span>
                </div>
            </div>
            <a target="_blank" href="/pdf<?php echo $url . "&tax"  ?>" class="btn btn-block btn-social btn-google">
                <i class="fa fa-file-pdf-o"></i> Reporte Detallado
            </a>
            <a target="_blank" href="/pdf<?php echo $url  ?>" class="btn btn-block btn-social btn-google">
                <i class="fa fa-file-pdf-o"></i> Reporte Sin tax
            </a>
        </div>
    </div>


<?php $__env->stopSection(); ?>

<?php echo $__env->make('adminlte::layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>