<?php
  //Query parametros perfil
$queryperfil = mysqli_query($mysqli, "SELECT * FROM perfil")
                                or die('error'.mysqli_error($mysqli));
$rows  = mysqli_num_rows($queryperfil);
$data_perfil  = mysqli_fetch_assoc($queryperfil);
$folio_perfil = $data_perfil['folio'];
$folio_rem_perfil = $data_perfil['folio2'];
$nombre_perfil = $data_perfil['nombre_empresa'];
$direccion_perfil = $data_perfil['direccion'];
$direccion_perfil = $data_perfil['direccion'];
$email_perfil = $data_perfil['email'];
$almacen_perfil = $data_perfil['almacen'];
$almacenista_perfil = $data_perfil['almacenista'];
  
  
?>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<!-- El CSS de DataTables -->
	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jszip-2.5.0/pdfmake-0.1.18/dt-1.10.12/af-2.1.2/b-1.2.2/b-colvis-1.2.2/b-flash-1.2.2/b-html5-1.2.2/b-print-1.2.2/cr-1.3.2/fc-3.2.2/fh-3.1.2/kt-2.1.3/r-2.1.0/rr-1.1.2/sc-1.4.2/se-1.2.0/datatables.min.css"/>
	<!-- El CSS de Bootstrap -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
	<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">-->
</head>

<section class="content-header">
  <h1>
    <i class="fa fa-file-text-o icon-title"></i> Paramtros de empresa en almacen <?php echo $almacen_perfil ?>;


  </h1>

</section>

<!-- Main content -->
<section class="content">
  <div class="row">
    <div class="col-md-12">
	
	    <?php  
	    $queryclose = mysqli_query($mysqli, "SELECT apertura FROM apertura_cierre where id = 1") 
or die('error: '.mysqli_error($mysqli));
$rows  = mysqli_num_rows($queryclose);
$data  = mysqli_fetch_assoc($queryclose);
$bandera = $data['apertura'];
/*print_r($bandera);
die();*/

/*if($bandera == 'CERRADO') {
	echo '<script>
                alert("EL ALMACEN SE ENCUENTRA CERRADO POR INVENTARIO DEL SUPERVISOR");
                window.location = "http://inventarios.sanmatias.mx/cdc/main.php?module=closed";
          </script>';     
    return;
} */

if ($bandera == 'CERRADO') {
    echo '<script>
                alert("EL ALMACEN SE ENCUENTRA CERRADO POR INVENTARIO DEL SUPERVISOR");
                // Obtener el nombre del servidor y construir la URL base
                var serverUrl = "http://" + window.location.hostname;
                var url = serverUrl + "/main.php?module=closed";
                window.location = url;
          </script>';
    return;
}

    if (empty($_GET['alert'])) {
      echo "";
    } 
  
    elseif ($_GET['alert'] == 1) {
      echo "<div class='alert alert-success alert-dismissable'>
              <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
              <h4>  <i class='icon fa fa-check-circle'></i> Exito!</h4>
             Nuevos dato almacenado correctamente.
            </div>";
    }

    elseif ($_GET['alert'] == 2) {
      echo "<div class='alert alert-success alert-dismissable'>
              <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
              <h4>  <i class='icon fa fa-check-circle'></i> Exito!</h4>
             Datos modificados correcamente.
            </div>";
    }

    elseif ($_GET['alert'] == 3) {
      echo "<div class='alert alert-success alert-dismissable'>
              <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
              <h4>  <i class='icon fa fa-check-circle'></i> Exito!</h4>
            Se eliminaron los datos correctamente
            </div>";
    }
    ?>
      <div class="box box-primary">
        <div class="box-body">
        
          <table id="dataTables2" class="table table-bordered table-striped table-hover">
          
            <thead>
              <tr>
			  <th class="center">ID</th>
                <th class="center">Empresa</th>
                <th class="center">Direccion</th>
                <th class="center">Email</th>
				<th class="center">Folio ENT/SAL</th>
				<th class="center">Folio REM</th>
                <th class="center">Almacen</th>
                <th class="center">Almacenista</th>
				 <th class="center">Editar</th>
				
              </tr>
            </thead>
          
            <tbody>

            <?php  
            $no = 1;
          
            $query = mysqli_query($mysqli, "SELECT * from perfil")
                                            or die('Error: '.mysqli_error($mysqli));

           
            while ($data = mysqli_fetch_assoc($query)) { 
      
             
              echo "<tr>
			          <td width='80' class='center'>$data[id]</td>
                      <td width='30' class='center'>$data[nombre_empresa]</td>
                      <td width='80' class='center'>$data[direccion]</td>
                      <td width='180'class='center'>$data[email]</td>
                      <td width='80' class='center'>$data[folio]</td>
					   <td width='80' class='center'>$data[folio2]</td>
                      <td width='80' class='center'>$data[almacen]</td>
					  <td width='80' class='center'>$data[almacenista]</td>
					    <td class='center' width='80'>
					  <div>
                          <a data-toggle='tooltip' data-placement='top' title='modificar' style='margin-right:5px' class='btn btn-primary btn-sm' href='?module=form_perfil&form=edit&id=$data[id]'>
                              <i style='color:#fff' class='glyphicon glyphicon-edit'></i>
                          </a>";
            ?>
    					  
            <?php
              echo "    </div>
                      </td>
                    </tr>";
              $no++;
            }
            ?>
            </tbody>
          </table>
		  
        </div><!-- /.box-body -->
      </div><!-- /.box -->
    </div><!--/.col -->
  </div>   <!-- /.row -->
</section><!-- /.content-->
<script language="javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
	<!-- El JavaScript de DataTables -->
	<script language="javascript" type="text/javascript" src="https://cdn.datatables.net/v/dt/jszip-2.5.0/pdfmake-0.1.18/dt-1.10.12/af-2.1.2/b-1.2.2/b-colvis-1.2.2/b-flash-1.2.2/b-html5-1.2.2/b-print-1.2.2/cr-1.3.2/fc-3.2.2/fh-3.1.2/kt-2.1.3/r-2.1.0/rr-1.1.2/sc-1.4.2/se-1.2.0/datatables.min.js"></script>
	<!-- El JavaScript de BootStrap -->
	<script language="javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<script type="text/javascript">
$('#dataTables2').dataTable( 

  
{
	
    "drawCallback": function( settings ) {
         $('ul.pagination').addClass("pagination-sm");
		 
    }
	
	
});
	</script>