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

    <div class="sixteen wide tablet fourteen wide computer column ">
        <div class="ui segment">
            
            <h4 class="ui dividing header teal centered">REPORTE DE VENTAS POR PERSONAL</h4>
            <br>

            <form class="ui form" id="frmComprobante" autocomplete="off">

                

                <div class="three fields">
                    <div class="four wide field">
                        <div class="ui fluid large white label">Personal</div>
                    </div>
                    <div class="eleven wide field">
                        <select class="ui small search selection dropdown" name="id_usuario">
                            

                            <?php if(Auth::guard("usuario")->user()->id_rol == 1 || Auth::guard("usuario")->user()->id_rol == 4 ): ?>
                                <option value="0">Todo el personal</option>
                                <?php $__currentLoopData = $usuarios; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                   <option value="<?php echo e($data->id_usuario); ?>"> <?php echo e(ucwords(mb_strtolower($data->nombres))); ?> <?php echo e(ucwords(mb_strtolower($data->apellidos))); ?> (<?php echo e($data->username); ?>)</option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                            <?php else: ?>

                                <option value="<?php echo e(Auth::guard('usuario')->user()->id_usuario); ?>"> <?php echo e(ucwords(mb_strtolower(Auth::guard('usuario')->user()->nombres))); ?> <?php echo e(ucwords(mb_strtolower(Auth::guard('usuario')->user()->apellidos))); ?> (<?php echo e(Auth::guard('usuario')->user()->username); ?>)</option>

                            <?php endif; ?> 
   
                        </select>  
                    </div>
                </div>

                 <div class="three fields">
                    <div class="four wide field">
                        <div class="ui fluid large white label">Tipo de Pago</div>
                    </div>
                    <div class="four wide field">
                        <select class="ui fluid small input dropdown" name="tipo_pago">
                            <option value="EFECTIVO">EN EFECTIVO</option>
                            <option value="TARJETA">CON TARJETA</option>
                            <option value="CREDITO">AL CREDITO</option>
                            <option value="LIQUIDACION">LIQUIDACION</option>
                        </select>  
                    </div>
                    <div class="three wide field">
                        <div class="ui fluid large white label">Tipo de Transaccion</div>
                    </div>
                    <div class="four wide field">
                        <select class="ui fluid small input dropdown" name="tipo_transaccion" id="tipo_transaccion">
                            <option value="VENTA">VENTA</option>
                            <option value="PEDIDO">PEDIDO</option>
                        </select>  
                    </div>
                </div>

                <div class="four fields">
                    <div class="four wide field">
                        <div class="ui fluid large white label">Fecha Inicio</div>
                    </div>
                    <div class="field">
                        <div class="ui small input">
                            <input type="text" class="fecha_hora" name="fecha1">
                        </div> 
                    </div>
                    <div class="three wide field">
                        <div class="ui fluid large white label">Fecha Fin</div>
                    </div>
                    <div class="field">
                        <div class="ui small input">
                            <input type="text" class="fecha_hora" name="fecha2">
                        </div>  
                    </div>
                </div>

                

                <div class="form_footer">
                    <div class="ui right floated primary button btn_reporte_usuarios"><i class="download icon"></i>DESCARGAR EXCEL</div>
                </div>    
            </form>

            <br>
            <h4 class="ui dividing header teal centered">VENTAS DE HOY POR PERSONAL</h4>
            
            <table class="ui celled striped table">
                <thead>
                    <tr>
                        <th class="head_table">N°</th>
                        <th class="head_table">Personal</th>
                        <th class="head_table">DNI</th>
                        <th class="head_table">N° Ventas</th>
                        <th class="head_table">Monto S/</th>
                        <th class="head_table">Fecha de Venta</th>
                        <th class="head_table">Acciones</th>
                    </tr>
                </thead>
                <tbody>
                   <?php /**/ $i = 1 /**/ ?>

                   <?php /**/ $ventas = 0 /**/ ?>
                   <?php /**/ $total = 0 /**/ ?>

                    <?php $__currentLoopData = $consulta; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $venta): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr data-table="<?php echo e($venta->id_usuario); ?>">
                        <td><?php echo e($i); ?></td>
                        <td><?php echo e($venta->nombres); ?> <?php echo e($venta->apellidos); ?></td>
                        <td><?php echo e($venta->dni); ?></td>
                        <td><?php echo e($venta->ventas); ?></td>
                        <td><?php echo e($venta->monto); ?></td>
                        <td><?php echo e($venta->fecha_venta); ?></td>
                        <td>                            
                            
                            <a class="ui mini vertical animated blue button" title="Ver informacion detallada" href="<?php echo e(url('reporte/detalles/'.$venta->id_usuario)); ?>">
                                <div class="hidden content">Detalles</div>
                                <div class="visible content"><i class="search icon"></i></div>
                            </a>
                           
                      
                        </td>
                    </tr>
                    <?php /**/ $i++ /**/ ?>
                    <?php /**/ $ventas = $ventas + $venta->ventas  /**/ ?>
                   <?php /**/ $total = $total + $venta->monto  /**/ ?>

                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td colspan="3"> <b>TOTAL</b></td>
                        
                        <td><b><?php echo e($ventas); ?></b></td>
                        <td><b><?php echo e($total); ?></b></td>
                        <td colspan="2"></td>
                       
                    </tr>
                </tbody>
              
            </table>

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

<?php $__env->startSection('scripts'); ?>
    <script src="<?php echo e(asset('js/reporte/comprobantes.js')); ?>"></script>
<?php $__env->stopSection(); ?>



<?php echo $__env->make('layout.main', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>