<?php
@session_start();
 $vg_login=$_SESSION["usuario"];
 $vg_empresa=$_SESSION["empresa"];
if($vg_login<>""){}
else
  {echo "<script>";
   echo "window.location='../../index.php';";
   echo "</script>";
  }	

include "../../parametros.php"; 

?>

<!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 $nombreprograma." - ".$version; ?></title>

<script src="../../js/jquery.min.js"></script>
<link href="../../bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src="../../bootstrap/js/bootstrap.min.js"></script>
  <link rel="icon" href="../../icono.ico" type="image/x-icon"/>
 

 </head>
<body>
<?php


include "../../conexion.php";
$fecha="";$observacion="";$tiposolicitud=0;$empresa=0;


$rs_empresa=mysqli_query($conexion,"SELECT id,nombre FROM empresa	
									union select 0,'' from empresa
							  		order by nombre asc");

$rs_asignada=mysqli_query($conexion,"SELECT login,nombre,apellido FROM usuario  where estado='A' and tipo=1
									union select ' ','','' from usuario 									
									 order by nombre asc");


if(isset($_REQUEST['oculto']))
  { 
 	 $empresa=$_REQUEST['empresa'];
	 $asignada=$_REQUEST['asignada'];
 }

?>

<form name="frmempleados" method="post" action="" >
   <center>
     <table width="100%" border="0" cellpadding="0" cellspacing="0">
	      <tr>
	        <td width="6%" ><div align="left" class="texto_campos">Empresa</div></td>
	        <td ><select name="empresa" id="empresa"
                                        onfocus="this.style.background='#ccffff'" onblur="this.style.background='#FFFFDD'"
                                        class="form-control" style="width: 100%">
	          <?php while ($rowba=mysqli_fetch_array($rs_empresa))
									{
									 if ($empresa==$rowba['id'])
										{echo "<option value=".$rowba['id']." selected>".substr($rowba['nombre'],0,40)."</option>";}
									 else
										{echo "<option value=".$rowba['id'].">".substr($rowba['nombre'],0,40)."</option>";}		
									}
							 ?>
            </select></td>
	        <td width="7%" ><div align="left" class="texto_campos">Asignada</div></td>
	        <td width="27%" ><select name="asignada"  id="asignada"
                            onfocus="this.style.background='#ccffff'" onblur="this.style.background='#FFFFDD'"
                            class="form-control"  style="width: 100%" >
	          <?php while ($rowba=mysqli_fetch_array($rs_asignada))
									{
										
									 if ($asignada==$rowba['login'])
										{echo "<option value=".$rowba['login']." selected>".strtoupper($rowba['nombre'])." ".strtoupper($rowba['apellido'])."</option>";}
									 else
										{echo "<option value=".$rowba['login'].">".strtoupper($rowba['nombre'])." ".strtoupper($rowba['apellido'])."</option>";}		
									}
							 ?>
            </select></td>
	        <td width="2%" >&nbsp;</td>
	        <td width="22%" >
            <input name="buscar" type="submit" class="btn btn-primary"  id="buscar"  value="Buscar" onclick="obusca.value=1;" />
		    <input name="oculto" type="hidden" id="oculto">
		    <input name="obusca" type="hidden" id="obusca">
            </td>
       </tr>
     </table>
   </center>  




<?php

if($_REQUEST["obusca"]==1)
{
	?>
    <br><br>
	<iframe src="cptg.php?emp=<?php echo $empresa; ?>&asi=<?php echo $asignada; ?>&obusca=0" width="100%" height="600px" style="border:hidden;"></iframe>
	<?php	
}
?>
</form>
</body>
</html>
