<?php
session_start();
$mensaje = '';
//RESTRICCIÓN DE ACCESO A TRABAJADOR (ACCESO INDIVIDUAL) 
if (isset($_SESSION['tipousuario'])) {
	if ($_SESSION['tipousuario'] == '1')
		header('location:menu_personal.php');
}
if (trim($_SESSION['nombre_validar']) == '') header('location:index.php');
require('fphp.php');

if (array_key_exists('imprime', $_POST) && $_POST['imprime'] == 1) {
	///////////////////////////////////////////////// imprimir registros ////////////////////////////////////////////////////////////////
	$enlace = cargar_conexion();
	$consulta = mysqli_query($enlace, "select * from empresa where id='" . $_SESSION['id_validar'] . "' ");
	if (mysqli_num_rows($consulta) != 0) {
		$row = mysqli_fetch_array($consulta);
		$_POST['pie'] = $row['pie'];
		$_POST['encabeza'] = $row['encabeza'];
		$_POST['empresa'] = (substr($_POST['nomina'], 6, 100) == "" ? $_SESSION['empresa_validar'] : substr($_POST['nomina'], 6, 100));
	}
	require('fpdf.php');

	class PDF extends FPDF
				  
	{
		function Header()
		{
			$this->Image($_SESSION['logo_validar'], 10, 10, 20, 20);
			$this->SetFont('arial', '', 12);
			$this->Ln(2);
			$this->Cell(0, 0, $_POST['empresa'], 0, 1, 'R');
			$this->Ln(5);
			$this->Cell(0, 0, $_POST['encabeza'], 0, 1, 'R');
			$this->Ln(5);
			$this->SetFont('arial', '', 10);
			$this->Cell(140);
			$this->Cell(0, 0, 'Fecha: ' . hoy(), 0, 1, 'L');
			$this->Ln(5);
			$this->Cell(140);
			$this->Cell(0, 0, 'Usuario: ' . $usuario, 0, 1, 'L');
			$this->Ln(5);

			$this->Ln(10);
			$this->SetFont('arial', 'B', 8);
			$this->Cell(0, 0, 'Reporte General de Empleados RETIRADOS', 0, 1, 'C');
			$this->Ln(5);
			$header = array('Item', 'Cédula', 'Nombres', 'Apellidos', 'Cargo', 'Fecha ingreso', 'Fecha egreso');
			$this->SetFillColor(255, 0, 0);
			$this->SetTextColor(255);
			$this->SetDrawColor(128, 0, 0);
			$this->SetLineWidth(.3);
			$this->SetFont('', '');
			//Cabecera
			$w = array(10, 20, 30, 30, 50, 20, 20);
			for ($i = 0; $i < count($header); $i++)
				$this->Cell($w[$i], 5, $header[$i], 1, 0, 'C', 1);
			$this->Ln();
			//RestauraciÃ³n de colores y fuentes
			$this->SetFillColor(224, 235, 255);
			$this->SetTextColor(0);
			$this->SetFont('');
		}


		//Pie de pÃ¡gina ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		function Footer()
		{
			$this->SetY(-15);
			$this->Cell(0, 0, '', 1, 1, 'C');
			$this->SetFont('Times', 'I', 8);
			$this->ln(2);
			$this->Cell(20);
			$this->Cell(0, 0, $_POST['pie'], 0, 1, 'C');
			$this->Cell(0, 10, 'Página ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
		}
	}
 
	//Cuerpo ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	$pdf = new PDF();
	$pdf->AddPage();
	$pdf->AliasNbPages();
	$pdf->SetFont('Arial', '', 6);
	$pdf->SetFillColor(224, 235, 255);
	$pdf->SetTextColor(0);
	$consulta = mysqli_query($enlace, "SELECT * from personal where id='" . $_SESSION['id_validar'] . "' and status='I' order by codigo");
	$linea = 0;
	$color = 0;
	while ($row = mysqli_fetch_array($consulta)) {
		$linea++;
		$tcargo = $row['cargo'];
		$pdf->cell(10, 5, $linea, 0, 0, 'C', $color);
		$pdf->cell(20, 5, $row['codigo'], 0, 0, 'C', $color);
		$pdf->cell(30, 5, $row['nombres'], 0, 0, '', $color);
		$pdf->cell(30, 5, $row['apellidos'], 0, 0, '', $color);
		$cons1 = mysqli_query($enlace, "select tablas.detalle as car from tablas where id='" . $_SESSION['id_validar'] . "' and codigo='" . $row['cargo'] . "' and tabla='CARGO'");
		while ($row1 = mysqli_fetch_array($cons1))
			$pdf->cell(50, 5, $row1['car'], 0, 0, 'L', $color);
		$pdf->cell(20, 5, $row['fechai'], 0, 0, 'C', $color);
		$pdf->cell(20, 5, $row['fechae'], 0, 1, 'C', $color);
		$color = !$color;
	}
	$pdf->Output();
} else {
	/*	
$accion=$_REQUEST["accion"];
$codigo=$_REQUEST["codigo"];
$cedula=$_REQUEST["cedula"];
*/
	$accion = array_key_exists('accion', $_REQUEST) ? $_REQUEST["accion"] : "";
	$codigo = array_key_exists('codigo', $_REQUEST) ? $_REQUEST["codigo"] : "";
	$cedula = array_key_exists('cedula', $_REQUEST) ? $_REQUEST["cedula"] : "";
	$enlace = cargar_conexion();
	$consulta = mysqli_query($enlace, "select * from periodo where id='" . $_SESSION['id_validar'] . "' order by nomina,periodo desc limit 1");
	if (mysqli_num_rows($consulta) != 0) {
		$row = mysqli_fetch_array($consulta);
		$_SESSION['per_validar'] = mostrar_fecha($row['desde']) . ' al ' . mostrar_fecha($row['hasta']) . " (Nom:" . $row['nomina'] . ")";
	} else $_SESSION['per_validar'] = '';

	///////////////////////////////////////////////// inicio del programa ////////////////////////////////////////////////////////////////
	menu();
	$entra = 0;


	///////////////////////////////////////////////// ACTUALIZAR TRABAJADOR ////////////////////////////////////////////////////////////////
	echo "<b>Opciones:</b>&nbsp;&nbsp;<img border = 0 src='img2/icono_buscar.png' alt='Modificar'>&nbsp;Consultar";
	echo "&nbsp;&nbsp;<img border = 0 src='img2/icono_06.png' alt='Constancia'>&nbsp;Imprimir Constancia de trabajo";
	echo "<hr><h2>CONSULTA DE TRABAJADORES RETIRADOS</h2>";


	///////////////////////////////////////////////// actualizar registros  ////////////////////////////////////////////////////////////////
	if (array_key_exists('modifica', $_POST) && $_POST['modifica'] == 1) {
		$consulta3 = mysqli_query($enlace, "select * from periodo where id='" . $_SESSION['id_validar'] . "' and nomina='" . substr($_POST['nomina'], 0, 3) . "' order by periodo DESC limit 1");
		if (mysqli_num_rows($consulta3) != 0) {
			$row3 = mysqli_fetch_array($consulta3);
			if ($row3['pre'] == 1) $nograbar = 1;
			else $nograbar = 0;
		}
		if ($nograbar == 1)
			echo "<center><font color=red>" . ($nograbar == 1 ? "No se puede procesar al trabajador porque la Nómina esta en Pre-Cierre" : "") . "</font></center>";
		else {
			$query = "update personal set status = ucase(trim('" . $_POST['status'] . "')) where id='" . $_SESSION['id_validar'] . "' and codigo = '" . $_POST['cedula'] . "'";
			mysqli_query($enlace, $query) or die(mysqli_error($enlace) . $query);
		}
	}
 

	///////////////////////////////////////////////// eliminar registros ////////////////////////////////////////////////////////////////
	if ($accion == 2) {
		$consulta = "select cedula from historico where id='" . $_SESSION['id_validar'] . "' and cedula='" . $cedula . "' ";
		$resultado = mysqli_query($enlace, $consulta) or die('verificaci&oacute; del c&oacute;digo fall&oacute;: ' . mysqli_error($enlace));
		if (mysqli_num_rows($resultado) != 0) $mensaje = 'Trabajador NO puede eliminarse por tener informaci&oacute;n en Historicos...';
		else {
			$consulta = "delete from personal where id='" . $_SESSION['id_validar'] . "' and codigo='" . $cedula . "' ";
			$resultado = mysqli_query($enlace, $consulta) or die('verificaci&oacute; del c&oacute;digo fall&oacute;: ' . mysqli_error($enlace));
		}
	}
 

	///////////////////////////////////////////////// mostrar entrada de datos  ////////////////////////////////////////////////////////////////
	if ((!$_POST || $accion == 2 || $_POST['graba'] == 1 || $_POST['modifica'] == 1 || $_POST['bandera'] == 33) && $accion != 3 && $accion != 11) {
		echo "<form name = 'entrada' action = '" . $_SERVER['PHP_SELF'] . "' method = 'POST'  enctype='multipart/form-data'>";
		echo "<input type = 'hidden' name = 'busca' value = '1'>";
		echo "<table cellpadding=2 cellspacing=0 width='500' align='center'>";
		echo "<tr>";
		echo "<td align=right> C&eacute;dula/Nombre/Apellido:</td>";
		echo "<td> <input name='cedula' size = '30' maxlength = '8'></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td align=right> Ordenado por:</td>";
		echo "<td>";
		echo "	<input type = 'radio' name = 'orden' value = 'ced' checked> cedula";
		echo "	<input type = 'radio' name = 'orden' value = 'nom'> nombre";
		echo "	<input type = 'radio' name = 'orden' value = 'ape'> apellido";
		echo "	<input type = 'radio' name = 'orden' value = 'fechae'> Fecha Egreso";
		echo "</tr>";
		echo "<tr>";
		echo "<td> </td>";
		echo "<td colspan=3><input type='image' src='img2/boton_buscar.jpg' value='Entrar' ></td>";
		echo "</tr>";
		echo "</table></form>";
		echo "<script language='javascript' type='text/javascript'>document.entrada.cedula.focus();</script>";
		if ($mensaje != '') echo "<br><br><center><font style='color:black; font-size:1em;' face='Verdana' ><b>" . $mensaje . "</b></font></center>";

	}


	///////////////////////////////////////////////// modificar registros ////////////////////////////////////////////////////////////////
	if ($accion == 3) {
		include("calendario/calendario.php");
		$consulta = "select * from personal where id='" . $_SESSION['id_validar'] . "' and codigo='" . $cedula . "' ";
		$resultado = mysqli_query($enlace, $consulta) or die('verificaci&oacute; del c&oacute;digo fall&oacute;: ' . mysqli_error($enlace));
		$num_rows = mysqli_num_rows($resultado);
		if ($num_rows != 0) {
			$row = mysqli_fetch_array($resultado);
			echo "<center><img src='img2/administrator.png'><font color=black size=5>&nbsp;" . trim($row['nombres']) . " " . trim($row['nombres1']) . ' ' . trim($row['apellidos']) . " " . trim($row['apellidos1']) . "</font></center><br>";
			echo "<form name = 'entrada' action = '" . $_SERVER['PHP_SELF'] . "' method = 'POST'  enctype='multipart/form-data' onsubmit='return validar_cedula_nombre_apellido(this)'>";
			echo "<input type = 'hidden' name = 'modifica' value = '1'>";

			echo "<table rules=none border=0 cellpadding=2 cellspacing=0 align='center' style='border-width: 1px; border-color: 75263C;border-style: solid;'>";

			//=================================================================================================///
			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'> DATOS PERSONALES </font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";

			echo "<td align = 'right' > Nacionalidad y No. C&eacute;dula: ";
			echo "<select name = 'nacionalidad'>";
			echo "<option value='V' " . ($row['nacionalidad'] != 'E' ? 'selected' : '') . "> VE ";
			echo "<option value='E' " . ($row['nacionalidad'] == 'E' ? 'selected' : '') . "> EX ";
			echo  "</select></td>";

			echo "<td  align = 'left'> <input type = 'text' name = 'cedula' size = '30' maxlength = '8' readonly value = '" . $row['codigo'] . "' readonly> * </td>";

			echo "<td align = 'right' > Global ID: </td>";
			echo "<td  align = 'left'> <input type = 'text' name = 'globalid' size = '30' maxlength = '7' value = '" . $row['global_id'] . "'>  </td>";

			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td  align = 'right'> Nombre: </td>";
			echo "<td  align = 'left'> <input type = 'text' name = 'nombres' size = '30' maxlength = '50' value = '" . $row['nombres'] . "' readonly> * </td>";
			echo "<td  align = 'right'> Segundo Nombre: </td>";
			echo "<td  align = 'left'> <input type = 'text' name = 'nombres1' size = '30' maxlength = '50' value = '" . $row['nombres1'] . "' readonly>  </td>";
			echo "</tr>";
			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td align = 'right'> Apellido: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'apellidos' size = '30' maxlength = '50' value = '" . $row['apellidos'] . "' readonly> * </td>";
			echo "<td align = 'right'> Segundo Apellido: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'apellidos1' size = '30' maxlength = '50' value = '" . $row['apellidos1'] . "' readonly>  </td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";

			echo "<td align = 'right' > RIF: </td>";
			echo "<td align = 'left' > <input type = 'text' name = 'sso' size = '30' maxlength = '30' value = '" . $row['sso'] . "' readonly></td>";

			echo "<td align = 'right'> Sexo: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'sexo' size = '30' maxlength = '50' value = '" . $row['sexo'] . "' readonly> * </td>";

			echo "</tr>";
			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'> DATOS NACIMIENTO </font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";

			echo "<td align = 'right' > Fecha de Nacimiento: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'fecnac' size = '30' maxlength = '50' value = '" . $row['fechan'] . "' readonly> * </td>";

			cargar_select_modificar_paises($enlace, "pais", "Pais Nacimiento: ", $row['pais']);

			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			cargar_select_modificar_estados_nac($enlace, "edonac", " Edo. Nacimiento: ", $row['edo_nac']);

			echo "<td align = 'right'> Ciudad Nacimiento:</td>";
			echo "<td align = 'left' ><input type = 'text' name = 'ciudnac' size = '30' maxlength = '50' value = '" . $row['ciudad_nac'] . "' readonly> </td>";

			echo "</tr>";
			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'> DATOS DE RESIDENCIA Y CONTACTO </font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td align = 'right' > Direcci&oacute;n de Habitaci&oacute;n </td>";
			echo "<td colspan=3 align = 'left'> <input type = 'text' name = 'dir' size = '100' maxlength = '100' value = '" . $row['dir'] . "' readonly></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			cargar_select_modificar_estados_ven($enlace, "estado", "Estado: ", $row['estado']);
			cargar_select_modificar_municipios_ven($enlace, "municipio", "Municipio: ", $row['municipio']);
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td align = 'right' > Tel&eacute;fono: </td>";
			echo "<td align = 'left' > <input type = 'text' name = 'telefono' size = '30' maxlength = '50' value = '" . $row['telefono'] . "'readonly></td>";

			echo "<td align = 'right' > Email: </td>";
			echo "<td align = 'left' ><input type = 'text' name = 'email' size = '30' maxlength = '50' value = '" . $row['mensaje'] . "'readonly> </td>";
			echo "</tr>";
			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'> CARGA FAMILIAR </font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";

			echo "<td align = 'right'> Edo. Civil: </td>";
			if ($row['edocivil'] == '1') {
				echo "<td align = 'left'> <input type = 'text' name = 'edocivil' size = '30' maxlength = '50' value = 'Soltero(a)' readonly> </td>";
	 
			} elseif ($row['edocivil'] == '2') {
				echo "<td align = 'left'> <input type = 'text' name = 'edocivil' size = '30' maxlength = '50' value = 'Casado(a)' readonly> </td>";
	 
			} elseif ($row['edocivil'] == '3') {
				echo "<td align = 'left'> <input type = 'text' name = 'edocivil' size = '30' maxlength = '50' value = 'Viudo(a)' readonly> </td>";
	 
			} elseif ($row['edocivil'] == '4') {
				echo "<td align = 'left'> <input type = 'text' name = 'edocivil' size = '30' maxlength = '50' value = 'Divorciado(a)' readonly> </td>";
	 
			} elseif ($row['edocivil'] == '5') {
				echo "<td align = 'left'> <input type = 'text' name = 'edocivil' size = '30' maxlength = '50' value = 'Uni&oacute;n Libre' readonly> </td>";
	 
			} else
				echo "<td align = 'left'> <input type = 'text' name = 'edocivil' size = '30' maxlength = '50' value = '--' readonly> </td>";

			echo "<td> </td>";
			//espacio en blaco
			echo "<td> </td>";

			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td align = 'right' > Conyugue (Nombre y Apellido): </td>";
			echo "<td colspan=3 align = 'left' ><input type = 'text' name = 'conyugue' size = '100' maxlength = '100' value = '" . $row['conyugue'] . "' readonly> </td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td align = 'right' > Nº Documento: </td>";
			echo "<td align = 'left' ><input type = 'text' name = 'id_conyugue' size = '20' maxlength = '20' value = '" . $row['id_conyugue'] . "' readonly> </td>";

			echo "<td align = 'right' > Telf. Conyugue: </td>";
			echo "<td align = 'left' ><input type = 'text' name = 'tel_conyug' size = '20' maxlength = '20' value = '" . $row['tel_conyug'] . "' readonly> </td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td align = 'right'> Nro. de Hijos: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'hijo' size = '30' maxlength = '50' value = '" . $row['hijo'] . "' readonly>  </td>";

			echo "<td align = 'right'>  </td>";
			///////////espacio en blanco
			echo "<td align = 'right'>  </td>";
			echo "</tr>";
			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'> DATOS SEGURIDAD SOCIAL Y SST</font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";

			echo "<td align = 'right'> Mano dominante: </td>";
			echo "<td align = 'left'>";
			echo "<select name = 'mano'>";
			echo "<option " . ($row['mano'] == ' ' ? 'selected' : '') . "> ";
			echo "<option " . ($row['mano'] == 'D' ? 'selected' : '') . "> Derecha";
			echo "<option " . ($row['mano'] == 'I' ? 'selected' : '') . "> Izquierda";
			echo "</select></td>";

			echo "<td align ='right'> Tipo de sangre</td>";
			echo "<td align = 'left'>";
			echo "<select name = 'gsanguineo'>";
			echo "<option value='' " . ($row['gsanguineo'] == '' ? 'selected' : '') . "> ";
			echo "<option value='1' " . ($row['gsanguineo'] == '1' ? 'selected' : '') . "> O-";
			echo "<option value='2' " . ($row['gsanguineo'] == '2' ? 'selected' : '') . "> O+";
			echo "<option value='3' " . ($row['gsanguineo'] == '3' ? 'selected' : '') . "> A-";
			echo "<option value='4' " . ($row['gsanguineo'] == '4' ? 'selected' : '') . "> A+";
			echo "<option value='5' " . ($row['gsanguineo'] == '5' ? 'selected' : '') . "> B-";
			echo "<option value='6' " . ($row['gsanguineo'] == '6' ? 'selected' : '') . "> B+";
			echo "<option value='7' " . ($row['gsanguineo'] == '7' ? 'selected' : '') . "> AB-";
			echo "<option value='8' " . ($row['gsanguineo'] == '8' ? 'selected' : '') . "> AB+";
			echo  "</select></td>";

			echo "</tr>";
			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'>Datos de Dotaci&oacute;n </font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td align = 'right' > Talla Zapato: </td>";
			echo "<td align = 'left'>";
			echo "<select name = 'tallazapato'>";
			echo "<option value='' " . ($row['tallazapato'] == '' ? 'selected' : '') . "> ";
			echo "<option " . ($row['tallazapato'] == '35' ? 'selected' : '') . "> 35";
			echo "<option " . ($row['tallazapato'] == '36' ? 'selected' : '') . "> 36";
			echo "<option " . ($row['tallazapato'] == '37' ? 'selected' : '') . "> 37";
			echo "<option " . ($row['tallazapato'] == '38' ? 'selected' : '') . "> 38";
			echo "<option " . ($row['tallazapato'] == '39' ? 'selected' : '') . "> 39";
			echo "<option " . ($row['tallazapato'] == '40' ? 'selected' : '') . "> 40";
			echo "<option " . ($row['tallazapato'] == '41' ? 'selected' : '') . "> 41";
			echo "<option " . ($row['tallazapato'] == '42' ? 'selected' : '') . "> 42";
			echo "<option " . ($row['tallazapato'] == '43' ? 'selected' : '') . "> 43";
			echo "<option " . ($row['tallazapato'] == '44' ? 'selected' : '') . "> 44";
			echo "<option " . ($row['tallazapato'] == '45' ? 'selected' : '') . "> 45";
			echo  "</select></td>";

			echo "<td align = 'right'> Talla Camisa: </td>";
			echo "<td align = 'left'>";
			echo "<select name = 'tallacamisa'>";
			echo "<option value='' " . ($row['tallacamisa'] == '' ? 'selected' : '') . "> ";
			echo "<option " . ($row['tallacamisa'] == 'XS' ? 'selected' : '') . "> XS";
			echo "<option " . ($row['tallacamisa'] == 'S' ? 'selected' : '') . "> S";
			echo "<option " . ($row['tallacamisa'] == 'M' ? 'selected' : '') . "> M";
			echo "<option " . ($row['tallacamisa'] == 'L' ? 'selected' : '') . "> L";
			echo "<option " . ($row['tallacamisa'] == 'XL' ? 'selected' : '') . "> XL";
			echo "<option " . ($row['tallacamisa'] == 'XXL' ? 'selected' : '') . "> XXL";
			echo  "</select></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td align = 'right' > Talla Pantal&oacute;n: </td>";
			echo "<td align = 'left'>";
			echo "<select name = 'tallapantalon'>";
			echo "<option value='' " . ($row['tallapantalon'] == '' ? 'selected' : '') . "> ";
			echo "<option " . ($row['tallapantalon'] == '8' ? 'selected' : '') . "> 8";
			echo "<option " . ($row['tallapantalon'] == '10' ? 'selected' : '') . "> 10";
			echo "<option " . ($row['tallapantalon'] == '12' ? 'selected' : '') . "> 12";
			echo "<option " . ($row['tallapantalon'] == '14' ? 'selected' : '') . "> 14";
			echo "<option " . ($row['tallapantalon'] == '26' ? 'selected' : '') . "> 26";
			echo "<option " . ($row['tallapantalon'] == '28' ? 'selected' : '') . "> 28";
			echo "<option " . ($row['tallapantalon'] == '30' ? 'selected' : '') . "> 30";
			echo "<option " . ($row['tallapantalon'] == '32' ? 'selected' : '') . "> 32";
			echo "<option " . ($row['tallapantalon'] == '34' ? 'selected' : '') . "> 34";
			echo "<option " . ($row['tallapantalon'] == '36' ? 'selected' : '') . "> 36";
			echo "<option " . ($row['tallapantalon'] == '38' ? 'selected' : '') . "> 38";
			echo  "</select></td>";

			echo "<td align = 'right' > Fecha última Dotación: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'fec_dota' size = '30' maxlength = '50' value = '" . $row['fec_dota'] . "' readonly> </td>";

			echo "</tr>";

			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'> DATOS BANCARIOS </font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE' readonly>";
			echo "<td align = 'right' > Forma de Pago: </td>";
			echo "<td align = 'left'>";
			echo "<select name = 'pago'>";
			echo "<option value='1' " . ($row['pago'] != '2' ? 'selected' : '') . "> Efectivo";
			echo "<option value='2' " . ($row['pago'] == '2' ? 'selected' : '') . "> Banco";
			echo  "</select></td>";

			echo "<td align = 'right' > Entidad Bancaria: </td>";
			echo "<td align = 'left'>";
			echo "<select name = 'banco'>";
			echo "<option value='' " . ($row['banco'] == '' ? 'selected' : '') . ">";
			echo "<option value='0156' " . ($row['banco'] == '0156' ? 'selected' : '') . "> 100%BANCO";
			echo "<option value='0196' " . ($row['banco'] == '0196' ? 'selected' : '') . "> ABN AMRO BANK";
			echo "<option value='0172' " . ($row['banco'] == '0172' ? 'selected' : '') . "> BANCAMIGA BANCO MICROFINANCIERO, C.A.";
			echo "<option value='0171' " . ($row['banco'] == '0171' ? 'selected' : '') . "> BANCO ACTIVO BANCO COMERCIAL, C.A.";
			echo "<option value='0166' " . ($row['banco'] == '0166' ? 'selected' : '') . "> BANCO AGRICOLA";
			echo "<option value='0175' " . ($row['banco'] == '0175' ? 'selected' : '') . "> BANCO BICENTENARIO";
			echo "<option value='0128' " . ($row['banco'] == '0128' ? 'selected' : '') . "> BANCO CARONI, C.A. BANCO UNIVERSAL";
			echo "<option value='0164' " . ($row['banco'] == '0164' ? 'selected' : '') . "> BANCO DE DESARROLLO DEL MICROEMPRESARIO";
			echo "<option value='0102' " . ($row['banco'] == '0102' ? 'selected' : '') . "> BANCO DE VENEZUELA";
			echo "<option value='0114' " . ($row['banco'] == '0114' ? 'selected' : '') . "> BANCO DEL CARIBE C.A.";
			echo "<option value='0149' " . ($row['banco'] == '0149' ? 'selected' : '') . "> BANCO DEL PUEBLO SOBERANO C.A.";
			echo "<option value='0163' " . ($row['banco'] == '0163' ? 'selected' : '') . "> BANCO DEL TESORO";
			echo "<option value='0176' " . ($row['banco'] == '0176' ? 'selected' : '') . "> BANCO ESPIRITO SANTO, S.A.";
			echo "<option value='0115' " . ($row['banco'] == '0115' ? 'selected' : '') . "> BANCO EXTERIOR C.A.";
			echo "<option value='0003' " . ($row['banco'] == '0003' ? 'selected' : '') . "> BANCO INDUSTRIAL DE VENEZUELA.";
			echo "<option value='0173' " . ($row['banco'] == '0173' ? 'selected' : '') . "> BANCO INTERNACIONAL DE DESARROLLO, C.A.";
			echo "<option value='0105' " . ($row['banco'] == '0105' ? 'selected' : '') . "> BANCO MERCANTIL C.A.";
			echo "<option value='0191' " . ($row['banco'] == '0191' ? 'selected' : '') . "> BANCO NACIONAL DE CREDITO";
			echo "<option value='0116' " . ($row['banco'] == '0116' ? 'selected' : '') . "> BANCO OCCIDENTAL DE DESCUENTO.";
			echo "<option value='0138' " . ($row['banco'] == '0138' ? 'selected' : '') . "> BANCO PLAZA";
			echo "<option value='0108' " . ($row['banco'] == '0108' ? 'selected' : '') . "> BANCO PROVINCIAL BBVA";
			echo "<option value='0104' " . ($row['banco'] == '0104' ? 'selected' : '') . "> BANCO VENEZOLANO DE CREDITO S.A.";
			echo "<option value='0168' " . ($row['banco'] == '0168' ? 'selected' : '') . "> BANCRECER S.A. BANCO DE DESARROLLO";
			echo "<option value='0134' " . ($row['banco'] == '0134' ? 'selected' : '') . "> BANESCO BANCO UNIVERSAL";
			echo "<option value='0177' " . ($row['banco'] == '0177' ? 'selected' : '') . "> BANFANB";
			echo "<option value='0146' " . ($row['banco'] == '0146' ? 'selected' : '') . "> BANGENTE";
			echo "<option value='0174' " . ($row['banco'] == '0174' ? 'selected' : '') . "> BANPLUS BANCO COMERCIAL C.A.";
			echo "<option value='0190' " . ($row['banco'] == '0190' ? 'selected' : '') . "> CITIBANK";
			echo "<option value='0121' " . ($row['banco'] == '0121' ? 'selected' : '') . "> CORP BANCA";
			echo "<option value='0157' " . ($row['banco'] == '0157' ? 'selected' : '') . "> DELSUR BANCO UNIVERSAL";
			echo "<option value='0151' " . ($row['banco'] == '0151' ? 'selected' : '') . "> FONDO COMUN";
			echo "<option value='0169' " . ($row['banco'] == '0169' ? 'selected' : '') . "> MIBANCO BANCO DE DESARROLLO, C.A.";
			echo "<option value='0137' " . ($row['banco'] == '0137' ? 'selected' : '') . "> SOFITASA";
			echo  "</select></td>";
			echo "</tr>";
			echo "<tr bgcolor='#F5F6CE' readonly>";
			echo "<td align = 'right' > Tipo de Cuenta: </td>";
			echo "<td align = 'left'>";
			echo "<select name = 'tipo'>";
			echo "<option value='' " . ($row['tipo'] == '' ? 'selected' : '') . "> ";
			echo "<option value='1' " . ($row['tipo'] != '2' && $row['tipo'] != '' ? 'selected' : '') . "> Ahorro";
			echo "<option value='2' " . ($row['tipo'] == '2' ? 'selected' : '') . "> Corriente";
			echo  "</select></td>";
			echo "<td align = 'right' > Cuenta Bancaria: </td>";
			echo "<td align = 'left' ><input type = 'text' name = 'cuenta' size = '30'maxlength = '30' value = '" . $row['cuenta'] . "' readonly></td>";
			echo "</tr>";

			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'> DATOS DE CARGO/ORGANIGRAMA </font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			cargar_select_modificar($enlace, "unidad", "Unidad", $row['unidad']);
			cargar_select_modificar($enlace, "area", "&Aacute;rea", $row['area']);
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE' readonly>";
			cargar_select_modificar($enlace, "departamento", "Departamento:", $row['departamento']);
			cargar_select_modificar($enlace, "cargo", "Cargo", $row['cargo']);
			echo "</tr>";

			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'> DATOS DE CONTRATO </font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE' readonly>";
			echo "<td align = 'right' > Fecha de Ingreso: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'fechai' size = '30' maxlength = '50' value = '" . $row['fechai'] . "' readonly> * </td>";
			echo "<td align = 'right' > Fecha de Retiro: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'fechae' size = '30' maxlength = '50' value = '" . $row['fechae'] . "' readonly> * </td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE' readonly>";
			cargar_select_modificar($enlace, "tipoingreso", "Tipo de Ingreso", $row['tipoingreso']);

			echo "<td align = 'right' ><font color=red>Motivo de retiro : <font color='red'> </td>";
			echo "<td align = 'left'>";
			echo "<select name = 'motivoretiro'>";
			echo "<option value='' " . ($row['motivoretiro'] == '?' ? 'selected' : '') . ">";
			echo "<option value='50' " . ($row['motivoretiro'] == '50' ? 'selected' : '') . "> DESPIDO";
			echo "<option value='51' " . ($row['motivoretiro'] == '51' ? 'selected' : '') . "> RENUNCIA";
			echo "<option value='52' " . ($row['motivoretiro'] == '52' ? 'selected' : '') . "> MUERTE ACCIDENTAL";
			echo "<option value='53' " . ($row['motivoretiro'] == '53' ? 'selected' : '') . "> MUERTE NATURAL";
			echo "<option value='54' " . ($row['motivoretiro'] == '54' ? 'selected' : '') . "> MUERTE RAZONES DESCONOCIDAS";
			echo "<option value='55' " . ($row['motivoretiro'] == '55' ? 'selected' : '') . "> DESPIDO ART NRO ????";
			echo "<option value='56' " . ($row['motivoretiro'] == '56' ? 'selected' : '') . "> REDUCCION PERSONAL";
			echo "<option value='57' " . ($row['motivoretiro'] == '57' ? 'selected' : '') . "> CULMINACION PRACTICA/SERVICIOS";
			echo "<option value='58' " . ($row['motivoretiro'] == '58' ? 'selected' : '') . "> CULMINACION CONTRATO/TIEMPO DETERMINADO";
			echo "<option value='59' " . ($row['motivoretiro'] == '59' ? 'selected' : '') . "> MUTUO ACUERDO/JUBILACION";
			echo "<option value='60' " . ($row['motivoretiro'] == '60' ? 'selected' : '') . "> CULMINACION PASANTIAS";
			echo "<option value='61' " . ($row['motivoretiro'] == '61' ? 'selected' : '') . "> RENUNCIA APRENDIZ";
			echo "<option value='62' " . ($row['motivoretiro'] == '62' ? 'selected' : '') . "> CULMINACION ASIGNACION";
			echo  "</select></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE' readonly>";
			$query = "select * from contrato where id='" . $_SESSION['id_validar'] . "' ";
			$consulta = mysqli_query($enlace, $query) or die("no se pudo realizar la consulta...");
			$resultado = mysqli_num_rows($consulta);
			echo "<td align = 'right'> Contrato: </td>";
			echo "<td align = 'left'> <select name = 'contrato'><option>";
			if ($resultado != 0) {
				for ($i = 0; $i < $resultado; $i++) {
					$row1 = mysqli_fetch_array($consulta);
					if ($row1['codigo'] == $row['contrato']) echo "<option width = '30%' selected>" . $row1['codigo'] . " - " . $row1['detalle'];
					else echo "<option width = '30%'>" . $row1['codigo'] . " - " . $row1['detalle'];
				}
			}
			echo "</select>";
			echo "</td>";

			echo "<td align = 'right' >Nro. Contrato: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'nrocontrato' size = '30' maxlength = '30' value = '" . $row['nrocontrato'] . "' readonly></td>";

			echo "</tr>";

			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

			echo "<tr bgcolor='red' height='25'>";
			echo "<td colspan=4 align = center><font color='white'> DATOS DE NÓMINA Y SALARIOS </font></td>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";

			////Tipo de Vinculo
			cargar_select_modificar($enlace, "tp", "Tipo vínculo", $row['tp']);

			echo "<td align = 'right'>  </td>";
			///////////espacio en blanco
			echo "<td align = 'right'>  </td>";

			echo "<tr bgcolor='#F5F6CE'>";

			$query = "select * from nomina where id='" . $_SESSION['id_validar'] . "' order by detalle";
			$consulta = mysqli_query($enlace, $query) or die("no se pudo realizar la consulta...");
			$resultado = mysqli_num_rows($consulta);
			echo "<td align = 'right'> <font color=red>N&Oacute;MINA:</font> </td>";
			echo "<td align = 'left'> <select name = 'nomina'>";
			if ($resultado != 0) {
				for ($i = 0; $i < $resultado; $i++) {
					$row1 = mysqli_fetch_array($consulta);
					if ($row1['codigo'] == $row['nomina']) echo "<option width = '30%' selected>" . $row1['codigo'] . " - " . $row1['detalle'];
					else echo "<option width = '30%'>" . $row1['codigo'] . " - " . $row1['detalle'];
				}
			}
			echo "</select>";
			echo "</td>";

			$query = "select * from turno where id='" . $_SESSION['id_validar'] . "' order by detalle";
			$consulta = mysqli_query($enlace, $query) or die("no se pudo realizar la consulta...");
			$resultado = mysqli_num_rows($consulta);

			echo "<td align = 'right'> <font color=blue>Jornada:</font> </td>";
			echo "<td align = 'left'> <select name = 'turno'><option>";
			if ($resultado != 0) {
				for ($i = 0; $i < $resultado; $i++) {
					$row1 = mysqli_fetch_array($consulta);
					if ($row1['codigo'] == $row['turno']) echo "<option width = '30%' selected>" . $row1['codigo'] . " - " . $row1['detalle'];
					else echo "<option width = '30%'>" . $row1['codigo'] . " - " . $row1['detalle'];
				}
			}
			echo "</select>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE' readonly>";

			echo "<td align = 'right' >Salario Mes: </td>";
			echo "<td align = 'left'> <input type = 'text' name = 'smes' size = '30' maxlength = '30' value = '" . $row['smes'] . "' readonly></td>";

			echo "<td align = 'right' >Tipo Salario: </td>";
										echo "<td align = 'left'>";
										echo "<select name = 'sector'>";
											echo "<option value='' ".($row['sector'] == ''?'selected':'').">";
											echo "<option value='1000' ".($row['sector'] == '1000'?'selected':'')."> SALARIO FIJO";
											echo "<option value='2000' ".($row['sector'] == '2000'?'selected':'')."> SALARIO VARIABLE";
										echo  "</select></td>";
													   
															   
																									  
																								  
																									  
																		 

			echo "</tr>";
			echo "</tr>";

			echo "<tr bgcolor='#F5F6CE'>";
			echo "<td align = 'right' > <font color=blue>Grado salarial: </td></font>";
			echo "<td align = 'left'>";
			echo "<select name = 'grado_salar'>";

			echo "<option value='' " . ($row['grado_salar'] == '' ? 'selected' : '') . ">";
			echo "<option value='001' " . ($row['grado_salar'] == '001' ? 'selected' : '') . "> 001";
			echo "<option value='002' " . ($row['grado_salar'] == '002' ? 'selected' : '') . "> 002";
			echo "<option value='003' " . ($row['grado_salar'] == '003' ? 'selected' : '') . "> 003";
			echo "<option value='004' " . ($row['grado_salar'] == '004' ? 'selected' : '') . "> 004";
			echo "<option value='005' " . ($row['grado_salar'] == '005' ? 'selected' : '') . "> 005";
			echo "<option value='006' " . ($row['grado_salar'] == '006' ? 'selected' : '') . "> 006";
			echo "<option value='007' " . ($row['grado_salar'] == '007' ? 'selected' : '') . "> 007";
			echo "<option value='008' " . ($row['grado_salar'] == '008' ? 'selected' : '') . "> 008";
			echo "<option value='LL5' " . ($row['grado_salar'] == 'LL5' ? 'selected' : '') . "> LL5";
			echo "<option value='LL6' " . ($row['grado_salar'] == 'LL6' ? 'selected' : '') . "> LL6";

			echo  "</select></td>";

			echo "<td align = 'right' >Líder: </td>";
			echo "<td align = 'left'>";
			echo "<select name = 'lider'>";
			echo "<option value='' " . ($row['lider'] == '' ? 'selected' : '') . ">";
			echo "<option value='LG' " . ($row['lider'] == 'LG' ? 'selected' : '') . "> Líder grupo";
			echo "<option value='LM' " . ($row['lider'] == 'LM' ? 'selected' : '') . "> Líder manufac";
			echo  "</select></td>";

			echo "</tr>";



			//echo "<tr bgcolor='#F5F6CE'>";
			//echo "<td align = 'right'> <font color=red>STATUS:</font> </td>";
			//echo "<td align = 'left'> <select name = 'status'>";
			//if ($row['status']=="A") echo "<option selected>Activos";
			//else echo "<option>Activos";
			//if ($row['status']=="V") echo "<option selected>Vacaciones";
			//else echo "<option>Vacaciones";
			//if ($row['status']=="S") echo "<option selected>Suspendidos";
			//else echo "<option>Suspendidos";
			//if ($row['status']=="I") echo "<option selected>Inactivos";
			//else echo "<option>Inactivos";
			//if ($row['status']=="C") echo "<option selected>Contratados";
			//else echo "<option>Contratados";
			//echo "</select>";
			//echo "</td>";


			//echo "<td>";
			//echo "</td>";
			//echo "<td>";
			//echo "</td>";			
			//echo "</tr>";



			echo "</table><br><br>";

			echo "<table width = '20%' align ='center'>";
			echo "<tr><td><input type = 'submit' value = '' " . (substr($_SESSION['acceso_validar'], 17, 1) == '1' ? '' : 'disabled') . "></td></form>";
			echo "<form name = 'regresar' method = 'POST' action = '" . $_SERVER['PHP_SELF'] . "'>";
			echo "<td><input type = 'submit' value = 'Regresar al Inicio'></td></tr></form>";
			//echo "	<script language='javascript' type='text/javascript'>";
			//echo "		document.entrada.status.focus()";
			//echo "	</script>";
		}
	}
 

	////////////////////////////////////////// busca por filtros en tabla de registros ////////////////////////////////////////////////////////////////
	if ((!$_POST || $_POST['busca'] == 1 || $_POST['graba'] == 1 || $_POST['modifica'] == 1 || $_POST['bandera'] == 3) && $accion != 3 && $accion != 11) {

		if (array_key_exists('busca', $_POST) && $_POST['busca'] == 1) {
			echo "<form name = 'entrada' action = '" . $_SERVER['PHP_SELF'] . "' method = 'POST'  enctype='multipart/form-data'>";
			echo "<input type = 'hidden' name = 'busca' value = '1'>";
			echo "<table cellpadding=2 cellspacing=0 width='500' align='center'>";
			echo "<tr>";
			echo "<td align=right> C&eacute;dula/Nombre/Apellido:</td>";
			echo "<td> <input name='cedula' size = '30' maxlength = '8'></td>";
			echo "</tr>";
			echo "<tr>";
			echo "<td align=right> Ordenado por:</td>";
			echo "<td>";
			echo "	<input type = 'radio' name = 'orden' value = 'ced' checked> cedula";
			echo "	<input type = 'radio' name = 'orden' value = 'nom'> nombre";
			echo "	<input type = 'radio' name = 'orden' value = 'ape'> apellido";
			echo "	<input type = 'radio' name = 'orden' value = 'fechae'> Fecha Egreso";
			echo "</tr>";
			echo "</table>";
			echo "	<script language='javascript' type='text/javascript'>";
			echo "		document.entrada.cedula.focus()";
			echo "	</script>";
			echo "<table border=0  align = 'center'><tr>";
			echo "<td><input type = 'submit' value = 'Buscar Registros'></td>";
			echo "</form></table>";
		}

		$query1 = "";
		if (obtener_valor_diccionario($_POST, 'cedula') != "") {
			$query1 = " and (codigo like '%" . $_POST['cedula'] . "%' or nombres like '%" . $_POST['cedula'] . "%' or apellidos like '%" . $_POST['cedula'] . "%') ";
		}
		if (obtener_valor_diccionario($_POST, 'orden') == "ced") $query2 = " order by codigo";
		else if (obtener_valor_diccionario($_POST, 'orden') == "nom") $query2 = " order by nombres";
		else if (obtener_valor_diccionario($_POST, 'orden') == "ape") $query2 = " order by apellidos";
		else if (obtener_valor_diccionario($_POST, 'orden') == "fechae") $query2 = " order by fechae DESC";
		else $query2 = " order by nombres";

		$consulta = "select * from personal where id='" . $_SESSION['id_validar'] . "' and status='I' " . $query1 . $query2;
		$resultado = mysqli_query($enlace, $consulta) or die('verificaci&oacute; del c&oacute;digo fall&oacute;: ' . mysqli_error($enlace));
		$num_rows = mysqli_num_rows($resultado);
		if ($num_rows != 0) {
			echo "<table rules=none border=0 cellpadding=2 cellspacing=0 align='center'>";
			echo "<tr bgcolor='#43bced' height='35'>";
			echo "<th align = center><font color='white'> # </font></th>";
			echo "<th align = center><font color='white'> Foto </font></th>";
			echo "<th align = left><font color='white'> C&eacute;dula </font></th>";
			echo "<th align = left><font color='white'> Nombres </font></th>";
			echo "<th align = left><font color='white'> Apellidos </font></th>";
			echo "<th align = center><font color='white'> Status </font></th>";
			echo "<th align = center><font color='white'> Fec/Ingreso </font></th>";
			echo "<th align = center><font color='white'> Fec/Egreso </font></th>";
			echo "<th colspan = 2 align = center><font color='white'> Acci&oacute;n </font></th>";
			for ($cont = 0; $cont < $num_rows; $cont++) {
				$row = mysqli_fetch_array($resultado);
				$cedula = $row['codigo'];
				if ($color) {
					$tcolor = "#dfdfd0";
					if (file_exists('fotos/' . $cedula . '.jpg')) $imagen = 'fotos/' . $cedula . '.jpg';
					else $imagen = 'img2/nohay2.jpg';
				} else {
					$tcolor = "white";
					if (file_exists('fotos/' . $cedula . '.jpg')) $imagen = 'fotos/' . $cedula . '.jpg';
					else $imagen = 'img2/nohay.jpg';
				}
				echo '<tr bgcolor=' . $tcolor . ' >';
				echo "<td width='20'><font color=red>" . ($cont + 1) . "</font></td>";
				echo "<td align'center'><a href='" . $_SERVER['PHP_SELF'] . "?accion=33&cedula=" . $cedula . "'><img src='" . $imagen . "' height='64' width='64'></a></td>";
				echo "<td width='100'>" . $row['codigo'] . "</td>";
				echo "<td width='250'>" . trim($row['nombres']) . " " . $row['nombres1'] . "</td>";
				echo "<td width='250'>" . trim($row['apellidos']) . " " . $row['apellidos1'] . "</td>";
				echo "<td width='50' align='center'>" . ($row['status'] == 'A' ? '<img src="img2/status_ver.png">' : '<img src="img2/status_fal.png">') . "</td>";
				echo "<td width='120' align=center>" . $row['fechai'] . "</td>";
				echo "<td width='120' align=center>" . $row['fechae'] . "</td>";

				if (substr($_SESSION['acceso_validar'], 17, 1) == '1')
					echo "<td width='30' align='center'><a href='" . $_SERVER['PHP_SELF'] . "?accion=3&cedula=" . $cedula . "'><img border = 0 src='img2/icono_buscar.png' alt='modificar éste registro'></a></td>";
				else echo "<td width='30' align='center'>&nbsp;</td>";

				echo "<td width='30' align='center'><a target='_blank' href='archivo_trabajador_retirado_constancia.php?cedula=" . $cedula . "'><img border = 0 src='img2/icono_06.png' alt='Imprimir éste registro'></a></td>";
				echo '</tr>';
				$color =! $color;
			}
			echo '</table>';
			echo "<form name='imprimir' method='post' target ='_blank' action='" . $_SERVER['PHP_SELF'] . "' enctype='multipart/form-data'>";
			echo "  <input type = 'hidden' name = 'imprime' value = '1'>";
			echo "<center><input type = 'submit' value = 'Imprimir Resultado'></center></form>";
		} else echo "<hr>";
		mysqli_free_result($resultado);
	}
	mysqli_close($enlace);
	echo "</font>";
	echo "</body>";
	echo "</html>";
}
?>