<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
include("phpmnu_fun.php");
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
//
include("ges_empresas_bx.php");
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Empresas - Buscar</title>

<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>

<!----------------------------------------->
<link rel="stylesheet" type="text/css" href="css/estiloss.css"  />
<link rel="stylesheet" type="text/css" href="css/basic.css"  />
<link rel="stylesheet" type="text/css" href="css/mnu.css"  />
<!----------------------------------------->
<style type="text/css">
.tableFixHead          { overflow-y: auto; }
.tableFixHead thead th { position: sticky; top: 0; }

table  {border-collapse:collapse;width:100%;}
th, td {padding: 3px 3px;}
th     {background:#A0A0A0}

.cF {height:600px;width:1250px;position:relative;top:0px}
.mM {height:34px;width:1250px;position:relative;top:0px;background-color:#09C; z-index:500;}

</style>

<!----------------------------------------->
<script>
$(document).ready(function(){  
   Inicializar();
   jF("Nom");
});

</script>

<!----------------------------------------->
<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>
<!----------------------------------------->
<body  <?php echo $LStrMsg;?>  >
<div align="center">

<div class="mM" align="left" style="font-size:12px">
<?php
echo GEN_MENU(vbval(V($_SESSION['SYS_USER_ID'])));
?>
</div>

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;" >
<form id="Frm" name="Frm" method="post" action="ges_empresas_b.php" 
autocomplete="off"
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!----------------------------------------->
<div id="DivT" class="dT"  style="width:1250px;">
<img src="b.png" class="iT" />
<div class="tT">EMPRESAS - BUSCAR</div>
</div>

<!----------------------------------------->

<div class="s1" style="left: 35px; top: 121px; width: 138px;">
NOMBRE COMERCIAL</div>
<input name="Nom" type="text" id="Nom" 
class="lt" style="left: 35px; top: 138px; width: 309px;"
value="<?php echo $Nom;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 358px; top: 121px; width: 89px;"> RUC
</div>
<input name="Ruc" type="text" id="Ruc" 
class="lt" style="left: 358px; top: 138px; width:120px;"
value="<?php echo $Ruc;?>"  
tabindex="<?php echo ++$TI;?>"/>

<!----------------------------------------->
<div id="DivBtn" align="left" style="position:absolute; left: 33px; top: 71px; width: 551px; height: 26px;">
<input name="CmdB" type="button" id="CmdB" class="btm"
value="Buscar" onClick="fFiltrar();"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdZ" class="btm"
value="Volver" onClick="fBuscar('ges_empresas.php?TxtAc=X');"  
tabindex="<?php echo ++$TI;?>" />

</div>

<div  style="position:absolute; top:165px; left:35px; height:27px; background-color:#FFF; width: 1180px;">
<table width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:11px" border="0">
<tr>
<td align="center">
	<?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
</td>
</tr>
</table>
</div> 
    
<!----------------------------------------->
<div class="tableFixHead" style="position: absolute; left: 35px; top: 194px; width: 1180px; height: 380px; overflow:auto; border:solid 1px #363636">
<table id="Exportar_a_Excel" width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:11px">
<thead>
<tr>
<th width="263" align="left">NOMBRE COMERCIAL</th>
<th width="338" align="left">NOMBRE CORTO</th>
<th width="160" align="left">RUC</th>
<th width="397" align="left">DIRECCION</th>
</tr>
</thead>
<tbody>
<?php		  		
$i=0;
$ST=0;
$CE=0;
$TF=0;
$s="SELECT * FROM ges_empresas WHERE $FF ORDER BY emp_nom_com";
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
$rs=grs($s);				
while($r=$rs->fetch_assoc()){
	$i++;
	$CSS="";
	if($i%2==0)$CSS=" style=\"background-color:#E2E2E2\" ";
?>	
	<tr onDblClick="location.href='ges_empresas.php?Id=<?php echo $r['id_emp'];?>&Pag=0'" <?php echo $CSS;?>>
	<!----------------------------------------------->
	<td><?php echo $r['emp_nom_com'];?></td>  
	<td><?php echo $r['emp_nom_cor'];?></td> 
    <td><?php echo $r['emp_ruc'];?></td> 
    <td><?php echo $r['emp_dir'];?></td> 
	<!----------------------------------------------->
	</tr>
<?php	
}
?>		  
</tbody>
</table>
</div>
<!----------------------------------------->
<?php include("ocultos.php");?>

<div class="s1" style="left: 33px; top: 579px; width: 426px;">
Doble Click sobre el registro para activar Actualizacion</div>
</form>

<form action="ficheroExcel.php" 
    method="post" target="_blank" id="FormularioExportacion" >    
    <div style="position: absolute; left: 313px; top: 71px; width: 45px; height: 15px;">  
    <input name="" type="button" class="botonExcel btm" value="Exportar"  />
    <input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
    </div>
</form>


</div>
</div>
</body>
</html>
