<?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_productos_bx.php");
//++++++++++++
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Productos - 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("Cod");
});
</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_productos_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">PRODUCTOS - BUSCAR</div>
</div>

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

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


<div class="s1" style="left: 178px; top: 121px; width: 103px;">
PARTIDA</div>
<input name="Partida" type="text" id="Partida" 
class="lt" style="left: 178px; top: 138px; width: 98px;"
value="<?php echo $Partida;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 289px; top: 121px; width: 190px;">
NOMBRE / DESCRIPCION</div>
<input name="Des" type="text" id="Des" 
class="lt" style="left: 288px; top: 138px; width:301px;"
value="<?php echo $Des;?>"  
tabindex="<?php echo ++$TI;?>"/>


<div class="s1" style="left: 601px; top: 121px; width: 190px;">
MEDIDAS</div>
<input name="Med" type="text" id="Med" 
class="lt" style="left: 601px; top: 138px; width:160px; text-transform:none;"
value="<?php echo $Med;?>"  
tabindex="<?php echo ++$TI;?>"/>


<div class="s1" style="left:775px; top: 121px; width: 67px;">
UNIDAD</div>
<select name="Und" id="Und" 
class="lt" style="left:774px; top: 138px; width: 97px">
<?php 
echo FCBO_("und_abr","ges_unidades","id_und>0",$Und,"S","N");
?>
</select>


<div class="s1" style="left:893px; top: 121px; width: 91px;">
HABILITADO</div>
<select name="Hab" id="Hab" 
class="lt" style="left: 892px; top: 138px; width: 77px" >
<?php 
echo FCBO_("aux_nom","auxiliar","aux_des='SN'",$Hab,"S","N");
?>
</select>



<input name="CmdRep" type="button" id="CmdRep"  
value="Ver codigos repetidos" style="position: absolute; left: 986px; top: 138px; width: 227px; height: 23px;"
onClick="verRepetidos();" 
/>
<script>
function verRepetidos(){
	Ow("prod_cod_rep.php",570,620);
}
</script>

<!----------------------------------------->
<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_productos.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: 193px; 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="124" align="left">CODIGO</th>
<th width="124" align="left">PARTIDA</th>
<th width="443" align="left">NOMBRE / DESCRIPCION</th>
<th width="231" align="left">MEDIDAS</th>
<th width="102" align="left">PRECIO UNIT. $</th>
<th width="86" align="left">UNIDAD</th>
<th width="93"  align="left">HAB</th>
<th width="27"  align="left">&nbsp;</th>
<th width="36"  align="left">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php		  		
$i=0;
$ST=0;
$CE=0;
$TF=0;
$s="SELECT * FROM vis_ges_productos WHERE $FF ORDER BY DES";
$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_productos.php?Id=<?php echo $r['ID'];?>&Pag=0'" <?php echo $CSS;?>>
	<!----------------------------------------------->
	<td><?php echo $r['COD'];?></td> 
    <td><?php echo $r['PARTIDA'];?></td> 
	<td><?php echo $r['DES'];?></td> 
    <td><?php echo $r['MEDIDAS'];?></td> 
    <td><?php echo $r['PRE'];?></td> 
    <td><?php echo $r['UND'];?></td> 
    <td><?php echo $r['HAB'];?></td> 
    <td align="center">
    <a href="ges_productos.php?Id=<?php echo $r['ID'];?>&Pag=0"  >
    <img src="e.png"  border="0"/></a></td>
    <td align="center">
    <a href="ges_productos.php?Id=<?php echo $r['ID'];?>&Pag=0" target="_blank"  >
    <img src="run16.png"  border="0"/></a></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>
