<?php
session_start();
require_once('conexion.php');
require_once('include/sesiones.php');
if (isset($_SESSION['usu_nombre']))
{
    $regis=mysqli_query($con,"SELECT * from permiso where modulo_mod_id='26' and usuario_usu_id='$usu_id'") or die(mysqli_error($con));
    $reg=mysqli_fetch_array($regis);
        if($reg['per_visualizar']=="Activo")
        {
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <?php include ('head.php'); ?>
</head>
<body>
<?php
$inicio="";
$M_inventario="";
$M_contactos="";
$M_compras="";
$M_ventas="";
$M_pedidos="";
$M_pos="";
$R_reportes="active";

$ventas="";
$caja="active";
$compra="";
$contactos="";
$inventario="";
$utilidad="";
include ('menu.php');
?> 
    
<div class="main">
    <div class="col-md-2">
        <?php include ('include/menu_reportes.php');?>
    </div>
    <div class="col-md-10">
        <div class="widget stacked">
            <div class="widget-content">
                <div class="parent-list">
                    <div class="col-md-3" >
                        <a href="#cierre" class="icon-btn" data-toggle="modal">
                             <p style="padding: 10px; text-align: left;"><i class="shortcut-icon fas fa-file-export" style="color: red;"></i><strong> CIERRES DE CAJA</strong></p>
                        </a>
                    </div>
                    <div class="col-md-3" >
                        <a href="#detalles" class="icon-btn" data-toggle="modal">
                             <p style="padding: 10px; text-align: left;"><i class="shortcut-icon fas fa-file-export" style="color: red;"></i><strong> DETALLE POR MEDIO DE PAGO</strong></p>
                        </a>
                    </div>
                    <div class="col-md-3" >
                        <a href="#egresos" class="icon-btn" data-toggle="modal">
                             <p style="padding: 10px; text-align: left;"><i class="shortcut-icon fas fa-file-export" style="color: red;"></i><strong> EGRESOS</strong></p>
                        </a>
                    </div>
                    <div class="col-md-3" >
                        <a href="#abono_adelantado" class="icon-btn" data-toggle="modal">
                             <p style="padding: 10px; text-align: left;"><i class="shortcut-icon fas fa-file-export" style="color: red;"></i><strong> HISTORIAL ABONOS ADELANTADOS</strong></p>
                        </a>
                    </div>
                </div>
                 <?php include ('php_reportes/form_caja.php');?>
            </div>  
        </div>
    
        <div class="widget stacked">
            <div class="widget-content">
                <div class="table-responsive" style="overflow-y: hidden; overflow-x: auto;">
                      <div class="widget-header" >
                <h3>CIERRES DE CAJA </h3>  
            </div> <!-- /widget-header -->  
                    <center> <span id="loader"></span></center>
                    <div class='outer_div'></div><!-- Carga los datos ajax -->
                </div> <!-- /widget-content -->
            </div>
        </div>
        </br></br></br>
    </div>
</div> <!-- /main -->
<?php
    include ('php_caja/caja_abrir.php');
    include ('script.php');
?>
</body>
</html>
<script type="text/javascript">

    $(document).ready(function(){
      load(1);
    });

    function load(page){
      $("#loader").fadeIn('slow');
      $.ajax({
        url:'php_caja/tabla_reportes.php?action=ajax&page='+page,
         beforeSend: function(objeto){
         $('#loader').html('<img src="./img/ajax-loader.gif"> Cargando...');
        },
        success:function(data){
          $(".outer_div").html(data).fadeIn('slow');
          $('#loader').html('');
          
        }
      })
    }

</script>

<?php
}
else
{
   echo '<script>alert("No tienes permiso para ver esta pagina")</script>';
   echo '<script> setTimeout("history.back(1)", 0); </script>';
}
}
else
{
    echo '<script>location.href = "index.php";</script>';
}
?>