<?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='22' 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'); ?>
<script>
function miFuncion() {
   load(1);
}
</script>
</head>
<body onload="miFuncion();">
<?php
  $inicio="";
  $M_inventario="";
  $M_contactos="";
  $M_compras="";
  $M_ventas="active";
  $M_pedidos="";
  $M_pos="";
  $R_reportes="";

  $cotizacion="";
  $ventas="";
  $periodica="";
  $clientes="";
  $cartera="active";
  $garantias="";
  $abonos="";
  $cotizacion_online="";

  include ('menu.php');
?> 
<div class="main">
    <div class="col-md-2"> 
        <?php include ('include/menu_ventas.php');?>
    </div> <!-- /span6 -->
    <div class="col-md-10"> 
        <div class="widget stacked">
            <div class="widget-content">
                <div class="widget stacked">
                    <div class="widget-content">
                        <section id="buttons">
                            <form action="libraries/pdf/pdf_reportes/ventas_cxc.php" target="_blank">
                                <div class="col-md-7"> <input type="hidden" value="<?php echo  date('Y-m-d');?>" data-date-format="dd-mm-yyyy" name="hasta"></div>
                                <div class="col-md-4">
                                    <input type="hidden" name="sucursal_form" value="<?php echo $sucursal; ?>">
                                    <section id="intro">
                                        <select name="cliente" id="cliente"  class="form-control name_list" onchange="load(1);" required>
                                            <option value='0'>TODOS</option>
                                            <?php
                                                $result_1 = mysqli_query($con,"SELECT * FROM cliente WHERE empresa='$empresa'");  
                                                while ($row_1=mysqli_fetch_array($result_1)) 
                                                {   
                                                    echo' <option value="'.$row_1['clie_id'].'">'.$row_1['clie_cc'].' - '.utf8_encode($row_1['clie_nombre']).'</option>';
                                                }  
                                            ?>
                                        </select>
                                    </section>
                                </div>
                                <div class="col-md-1">
                                    <button type="submit" class="btn btn-danger btn-sm" ><i class="icon-print"></i> IMPRIMIR</a></button>
                                </div>
                            </form>
                        </section>
                    </div>
                </div>
                <div class="table-responsive">
                    <center> <span id="loader"></span></center>
                    <div id="resultados"></div><!-- Carga los datos ajax -->
                    <div class='outer_div'></div><!-- Carga los datos ajax -->
                </div>
            </div> <!-- /widget-content -->
        </div> <!-- /widget --> 
    </div> <!-- /span9 -->
</div> <!-- /main -->
<div class="modal fade" id="detalle" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Detalle de Venta</h4>
            </div>
            <div class="modal-body">
                <div id="form-detalle"></div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php
  include ('php_caja/caja_abrir.php');
  include ('script.php');
?>
<script type="text/javascript" src="php_ventas/ajax_cartera.js"></script>
  </body>
</html>
<?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>';
}
?>