<?php
ini_set("session.cookie_lifetime",60*60*10);
ini_set("session.gc_maxlifetime", 60*60*10);
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//
if(vbval($_SESSION['SYS_USER_GI'])!=USU_GET_GI($_SESSION['SYS_USER_ID'])){
JsDir("cerrar.php");	
return;
}
//-------------------------
$LStrPag=V($_POST['TxtPag']);
//-------------------------
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$StrNom=V($_POST['TxtNom']);		
$StrDni=V($_POST['TxtDni']);		
//-------------------------
if($StrCmd=="F")$LStrPag="1";
//-------------------------
$StrNomT="%".$StrNom."%";
$StrDniT=$StrDni."%";
//-------------------------
$LStrTR=gn("count(*)","vpersonal","ID>0 AND 
					NOMBRE LIKE '$StrNomT' AND
					DNI LIKE '$StrDniT'");
if($StrCmd=="F"){$LStrPag="1";}
$VP_RegXPag=100;
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
$LStrFoc="document.getElementById('TxtNom').focus();";
$LStrMsg="onload=\"$LStrFoc;\"";
?>
<!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>Personal - Buscar</title>
<script type="text/javascript" src="fe/funciones.js"></script>
<?php AddJs();?>
<script language="javascript">
	$(document).ready(function() {
		$(".botonExcel").click(function(event) {
			$("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
			$("#FormularioExportacion").submit();
	});
	});
</script>
<style type="text/css">
<!--
body {
	background-color: #CCC;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
     width:1300px;
     height:600px;
     position:absolute;
     left:50%;
     top:50%;
	 background-color:#006699;
	 margin:-300px 0 0 -650px;

}
#Layer2 {
	position:absolute;
	left:409px;
	top:205px;
	width:82px;
	height:24px;
	z-index:1;
}
.Estilo1 {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	color: #FFFFFF;
}
.f2 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFFFFF; font-size: 12px; }
.Estilo3 {color: #FFFFFF; font-size: 12px; font-family: Arial, Helvetica, sans-serif;}
.z4 {color: #000099}
.Estilo5 {color: #000000}

-->
</style>

</head>
<body  <?php echo $StrMsg;?>>
<div Id="DivFRM"  class="centrarFrm" >
<form id="Frm" name="Frm" method="post" action="personal_buscar.php">
<center> 
  
    <div id="layer6" style="position:absolute; left: 30px; top: 86px; width: 256px;">
      <div align="left" class="f2">NOMBRES (Para los cuadros de seleccion)</div>
    </div>
    <div id="layer5" style="position:absolute; left: 116px; top: 50px; width: 85px; height: 28px;">
      <div align="left" class="f2">
        <input name="CmdV" type="button" id="CmdV" 
        value="Volver" onclick="fVolver('personal.php');" />
      </div>
    </div>
<div id="layer3" style="position:absolute; left: 30px; top: 138px; width: 1256px; height: 409px; overflow:auto">
<div align="left" class="f2">
<table id="Exportar_a_Excel" width="1240" border="1" cellpadding="0" cellspacing="0">

<tr>
<td height="18" colspan="11" bgcolor="#666666" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>

<tr>
<td width="218" bgcolor="#999999"><span class="z4">NOMBRES </span></td>
<td width="117" bgcolor="#999999"><span class="z4">NOM. Y. APE.</span></td>
<td width="57" bgcolor="#999999"><span class="z4">DNI</span></td>
<td width="72" bgcolor="#999999"><span class="z4">TEL</span></td>
<td width="81" bgcolor="#999999"><span class="z4">CEL</span></td>
<td width="80" bgcolor="#999999"><span class="z4">CARGO</span></td>
<td width="128" bgcolor="#999999"><span class="z4">DEPARTAMENTO</span></td>
<td width="182" bgcolor="#999999"><span class="z4">EMAIL</span></td>
<td width="74" bgcolor="#999999"><span class="z4">FEC.ING.</span></td>
<td width="188" bgcolor="#999999"><span class="z4">DIRECCION</span></td>
<td width="19" bgcolor="#999999">&nbsp;</td>
</tr>
<?php		  		
$s="SELECT *,DATE_FORMAT(FEC_ING,'%d-%m-%y') as FIN FROM vpersonal 
WHERE ID>0 AND NOMBRE Like '$StrNomT' AND 
DNI Like '$StrDniT' ORDER BY NOMBRE ";	
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);		  				
$result = grs($s);
$X1="<td bgcolor=\"#FFFFFF\" style=\"white-space: nowrap;\"><span class=\"Estilo5\">";
$X2="</span></td>";
while ($row = $result->fetch_assoc()){
	if($row[FIN]=="00-00-00")$row[FIN]="";
	if($row[FIN]=="00-01-01")$row[FIN]="";
	if($row[FIN]=="01-01-00")$row[FIN]="";
	echo "<tr ondblclick=\"location.href='personal.php?Id=$row[ID]&Pag=0';\">";
	echo $X1.VV($row[NOMBRE]).$X2;
	echo $X1.VV(gs("per_nom_ape","personal","id_personal=".$row[ID])).$X2;
	echo $X1.VV($row[DNI]).$X2;
	echo $X1.VV($row[TEL]).$X2;
	echo $X1.VV($row[CEL]).$X2;
	echo $X1.VV($row[CARGO]).$X2;
	echo $X1.VV($row[DISTRITO]).$X2;
	echo $X1.VV($row[EMAIL]).$X2;
	echo $X1.VV($row[FIN]).$X2;
	echo $X1.VV($row[DIRECCION]).$X2;
	echo "<td bgcolor=\"#FFFFFF\" align=\"center\" style=\"white-space: nowrap;\"><a href=\"personal.php?Id=$row[ID]&Pag=0\" > <| </a></td>";
	echo "</tr>";
}

?>		  

</table>
</div>
</div>
    <div id="layer" style="position:absolute; left: 116px; top: 30px; width: 412px; height: 24px;">
      <div align="left" class="Estilo1">PERSONAL - BUSCAR
        <input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
        <input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
		<input name="TxtAc" type="hidden" id="TxtAc" value="" />
      </div>
    </div>
          <input name="TxtNom" type="text" id="TxtNom" 
          style="position:absolute; left: 30px; top: 109px; width: 254px;" value="<?php echo $StrNom;?>" 
          onKeyDown="return SoloTextoEx(event,'TxtDni');" tabindex="1" />

    <div id="LblTit" style="position:absolute; left: 57px; top: 25px; width: 64px;">
    <div align="left" class="Estilo1"><img src="img/buscar.png" width="57" height="60" /></div>
  </div>	
        <input name="CmdB" type="button" id="CmdB" 
style="position:absolute; left: 453px; top: 109px; width: 57px;"
value="Filtrar" onclick="fFiltrar();" />

<input name="TxtDni" type="text" id="TxtDni" 
style="position:absolute; left: 297px; top: 109px; width: 140px;" value="<?php echo $StrDni;?>"  
onKeyDown="return SoloTextoEx(event,'CmdB');" 
 tabindex="1" />

    <div id="layer10" style="position:absolute; left: 298px; top: 86px; width: 104px;">
      <div align="left" class="f2">DNI</div>
    </div>
</center>	
</form>
<form action="ficheroExcel.php" method="post" target="_blank" id="FormularioExportacion" >
<div style="position:absolute; left: 173px; top: 50px; width: 45px; height: 15px;">  
<input name="" type="button" class="botonExcel" value="Exportar" />
<input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
</div>
</form>
</div>
</body>
</html>
