<?php require_once('Connections/conexionabm.php'); ?>

<?php

session_start();

$fecha11 = date("d-m-Y"); 
$fecha12 = date("d-m-Y"); 

if (!isset($_SESSION['sigla'])) {
	echo '<script language = javascript>
		self.location = "index"
	</script>';
}

if (!isset($_SESSION['nombreuser'])) {
	echo '<script language = javascript>
		self.location = "index"
	</script>';
}

if (!isset($_SESSION['niveluser'])) {
	echo '<script language = javascript>
		self.location = "index"
	</script>';
}

$sigla = $_SESSION['sigla'];
	
$txtbuscar = "";	
$txtbuscar2 = "";	
$direccionadj = "";
$depart = "";

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

	

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $_SESSION['cia'] ?></title>
<link rel="shortcut icon" href="images/favicon.ico" />

<script src="jquery-1.3.2.js" type="text/javascript"></script>
<script src="jquery.maskedinput-1.2.2.js" type="text/javascript"></script>

<style type="text/css">
.border_tabla3 {
	border: 1px solid #CCC;
}

.brillo:hover {
	background-color: #EFC89C;
}

body table tr td table tr td {
	font-family: Arial, Helvetica, sans-serif;
	text-align: justify;
	font-weight: normal;
	font-size: 12px;
}

.negr {
	font-weight: bold;
	color: #006;
}
normal {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: normal;
}
.arial11 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: normal;
	color: #003;
	text-align: left;
}

.izq {text-align: left;
}
.izq {text-align: left;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #009;
}
.izq {
	text-align: left;
	color: #006;
}
.total {font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
}
.checkbox {
	height:17px;
	width:17px;
}

.brillo .arial11 table tr td {
	text-align: center;
}

.botonImportExp {
	box-shadow: 3px 4px 0px 0px #899599;
	background:linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
	background-color:#ededed;
	border-radius:3px;
	border:1px solid #d6bcd6;
	display:inline-block;
	cursor:pointer;
	color:#000000;
	font-family:Arial;
	font-size:12px;
	padding:8px 13px;
	text-decoration:none;
	text-shadow:0px 1px 0px #e1e2ed;
}
.botonImportExp:hover {
	background-color: #DCD5C7;
	font-weight:bold;
}
.botonImportExp:active {
	position:relative;
	top:1px;
}

.boton_imp_exp {	background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f7f7f7), color-stop(1, #d1cfd1));
	background:-moz-linear-gradient(top, #f7f7f7 5%, #d1cfd1 100%);
	background:-webkit-linear-gradient(top, #f7f7f7 5%, #d1cfd1 100%);
	background:-o-linear-gradient(top, #f7f7f7 5%, #d1cfd1 100%);
	background:-ms-linear-gradient(top, #f7f7f7 5%, #d1cfd1 100%);
	background:linear-gradient(to bottom, #f7f7f7 5%, #d1cfd1 100%);
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f7f7', endColorstr='#d1cfd1',GradientType=0);
	background-color:#E0DBD1;
	-moz-border-radius:15px;
	-webkit-border-radius:15px;
	border-radius:5px;
	border:1px solid skyblue;
	display:inline-block;
	cursor:pointer;
	color:#000;
	font-family:Arial;
	font-size:14px;
	padding:5px 5px;
	text-decoration:none;
	text-shadow:0px 1px 0px #e1e2ed;	
	width:120px;
	height:35px;
}

.boton_imp_exp:hover {
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f7faf0), color-stop(1, #b6c2ae));
	background: -moz-linear-gradient(top, #f7faf0 5%, #b6c2ae 100%);
	background: -webkit-linear-gradient(top, #f7faf0 5%, #b6c2ae 100%);
	background: -o-linear-gradient(top, #f7faf0 5%, #b6c2ae 100%);
	background: -ms-linear-gradient(top, #f7faf0 5%, #b6c2ae 100%);
	background: linear-gradient(to bottom, #f7faf0 5%, #b6c2ae 100%);
	background-color: #E1CA9D;
}
</style>

<script>
$(document).ready(function(){
   $('#boton_impr').click(function() {
		remote = open('personal_solicitud_impr', 'remote',

   		'top=10,left=400, width=960,height=900 location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,fullscreen=no,status=yes');
		remote.focus()		
	});
});
</script>

<script>
function imprimeEstado(idempl) {
	
	self.name = 'opener';		
	remote = open('personal_solicitud_print?idempl='+idempl, 'remote',
			'top=10,left=400, width=1024,height=800, location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,fullscreen=no,status=yes');
	remote.focus();	
}
</script>

<script>
function vistaPrevia(idempl) {
	
	self.name = 'opener';		
	remote = open('personal_solicitud_view?idempl='+idempl, 'remote',
			'top=10,left=400, width=1024,height=800, location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,fullscreen=no,status=yes');
	remote.focus();	
}
</script>
</head>
<body>
<table width="100%" border="0" align="center" class="border_tabla3">
  <tr class="total">
    <th height="46" colspan="6" align="center" class="total" scope="col">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr bgcolor="#ECE9DF">
        <td width="58%" height="46" style="font-weight:bold; font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif; font-size:14px">MANTENIMIENTO DE PERSONAL</td>
        <td width="42%" style="text-align:right">
          <input name="button" type="button" class="botonImportExp" id="button" 
      style="background-image: url(img/importar2.png); background-position:left; background-size:30px 30px; background-repeat:no-repeat; width:100px;" value="    Importar" />
          &nbsp;&nbsp;
          <input name="button" type="button" class="botonImportExp" id="button" 
      style="background-image: url(img/export3.png); background-position:left; background-size:30px 30px; background-repeat:no-repeat; width:100px;" value="    Exportar" />
          &nbsp;&nbsp; 
            <input name="button2" type="button" class="botonImportExp" id="button2" 
      style="background-image: url(img/nuevo4.png); background-position:left; background-size:30px 30px; background-repeat:no-repeat; width:150px;" value="    Nuevo Personal"  onclick="Localiza_personal_add()" />
        </td>
      </tr>
    </table>
    </th>
  </tr>
  <tr class="total">
    <th align="center" class="total" scope="col">&nbsp;</th>
    <th height="24" colspan="5" align="right" class="total" style="text-align: right" scope="col">&nbsp;</th>
  </tr>
  <tr bgcolor="#E4DFC9" class="total">
    <th width="16" align="center" class="total" scope="col">CK</th>
    <th width="40" class="total" style="text-align:center" scope="col">ITEM</th>
    <th height="24" class="total" style="text-align:left" scope="col">NOMBRE</th>
    <th width="112" style="text-align:center" scope="col">CEDULA</th>
    <th width="112" style="text-align:center" scope="col">CELULAR</th>
    <th width="99" style="text-align:center" scope="col">ACCIONES</th>
  </tr>
  <?php 
	$lin = 0;
	$linea = 1;
	$sql = "SELECT * FROM personal WHERE sigla ='$sigla' ORDER BY apellido";
	if ($result = $mysqli->query($sql)) {
		while ($row_Recordset1= $result->fetch_assoc()) {	
			$item = str_pad($row_Recordset1['idpersonal'],4,"0",STR_PAD_LEFT);	
	?>
      <tr <?php if ($linea==2) { ?>bgcolor="#F8F4EF"<?php }?> class="brillo">
        <td align="center" class="arial" style="text-align:center"><input name="checkbox" type="checkbox" class="checkbox" id="checkbox" />
        <label for="checkbox"></label></td>
        <td align="center" class="arial" style="text-align:center"><span class="arial11"><?php echo $item; ?></span></td>
        <td height="24" class="arial"><span class="arial11"><?php echo $row_Recordset1['apellido']; ?></span> <span class="arial11"><?php echo $row_Recordset1['nombre']; ?></span></td>
        <td class="arial11" style="text-align:center"><?php echo $row_Recordset1['cedula']; ?></td>
        <td class="arial11" style="text-align:center"><?php echo $row_Recordset1['celular']; ?></td>
        <td class="arial11" style="text-align:center"><table width="100%" border="0">
          <tr>
            <td align="center"><a href="#"><img src="img/ojos_ver2.png" width="20" height="20" title="Vista Previa" onclick="vistaPrevia(<?php echo $row_Recordset1['idpersonal']; ?>)"/></a></td>
            <td align="center"><a href="#"><img src="img/img_printer1.png" name="boton_impr" title="Imprimir formulario" width="25" height="20" id="2boton_impr2" onclick="imprimeEstado(<?php echo $row_Recordset1['idpersonal']; ?>)"/></a></td>
            <td align="center"><a href="#"><img src="img/edita1.png" width="20" height="20" title="Editar personal" onclick="Localiza_personal_edit(<?php echo $row_Recordset1['idpersonal'] ?>)"/></a></td>
          </tr>
        </table></td>
  </tr>
      <?php 
		  if ($linea > 2) {
			  $linea = 1;
		  }
	  	  $linea = $linea + 1;
		  
		  $lin = $lin + 1;
		  }; 
		}
	?>
</table>
</body>
</html>
