<?php
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;
}
*/
$HW=$_SESSION['SYS_HW'];
$StrGT="";$LStrMsg="";$LStrFoc="";$LStrMM="";
$LStrPag=V($_POST['TxtPag']);
//
include("lq_prod_ed_fun.php");
//
$VP_RegXPag=20;
$LStrTR=gn("count(*)","vproductos",$FF);
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Actualizar estado del producto</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="fe/funcionex.js"></script>
<script type="text/javascript" src="fe/lq_prod_ed.js"></script>
<!--FIN_SCRIPT------------------------------------->
<link rel="stylesheet" type="text/css" href="estilox.css"  />
<link rel="stylesheet" type="text/css" href="basix.css"  />
<style type="text/css">
.cF {height:800px;width:1300px;position:relative; <?php echo "top:0px";?>}
</style>
<script>
$(document).ready(function(){  
   Inicializar();   
});
</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>
</head>

<body  <?php echo $LStrMsg;?>  >
<div align="center">

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;" >
<form id="Frm" name="Frm" method="post" action="lq_prod_ed.php">
<!--INI_TITULO-->
<div id="DivT" class="dT"  style="width:1300px">
<img src="img/unidades.png" class="iT" />
<div class="tT" style="width:1000px">ACTUALIZAR ESTADO DEL PRODUCTO</div>
</div>
<!--FIN_TITULO-->
<div class="s1" style="left:177px; top: 114px; width: 142px; height: 18px;">
  <?php
	if(strlen($_PDF)>0){
		echo "<a href=\"$_PDF\" target=\"_new\">DESCARGAR</a>";	
	}
?>
  
</div>

<div class="ad" style="left:35px; top:132px; width: 139px; height: 18px;">LINEA DE PRODUCTO</div>
<select name="Lin" id="Lin" 
class="lty" style="left:35px; top:149px; width: 139px;"
tabindex="<?php echo ++$TI;?>"  >
<?php
	echo FCBO("lin_nombre","lineas","id_linea>0",$Lin,"S","N");
?>
</select>

<div class="s1" style="left:184px; top: 132px; width: 54px; height: 18px;">CODIGO</div>
<input name="Cod"  type="text" 
class="lt"  id="Cod" 
style="left:184px; top: 149px; width: 114px;"
maxlength="11" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Cod;?>"   />

<div class="s1" style="left:312px; top: 132px; width: 316px; height: 18px;">DESCRIPCION</div>
<input name="Des"  type="text" 
class="lt"  id="Des" 
style="left:310px; top: 149px; width: 340px;"
maxlength="150" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Des;?>"   />

<div class="ad" style="left:661px; top:132px; width: 139px; height: 18px;">EN USO</div>
<select name="Est" id="Est" 
class="lty" style="left:661px; top:149px; width: 139px;"
tabindex="<?php echo ++$TI;?>"  >
<?php
echo FCBO("au_item","auxiliar","au_tab='SI_NO'",$Est,"S","N");
?>
</select>


<input name="CmdF" type="button" id="CmdF"  style="position:absolute; top:149px; left:819px; width: 75px;"
value="Filtrar" onClick="fFiltrar();"  
tabindex="<?php echo ++$TI;?>" />

<!--INI_TABLA----->
<div class="s1"
style="background:#ECF9FF; position:absolute; left: 35px; top: 182px; width: 1244px; height: 550px; overflow:auto;">
<div class="s1" style="left: 0px; top: 0px; width: 1242px;">
  <table id="Exportar_a_Excel" class="f4t" width="1223" border="1" style="border-collapse: collapse">
   <tr>
      <td colspan="6" bgcolor="#CCCCCC" height="18" align="center">
      <?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
      </td>
      </tr>   
    <tr>
      <td width="139" bgcolor="#CCCCCC">CODIGO</td>
      <td width="70" bgcolor="#CCCCCC">EN USO</td>
      <td width="402" bgcolor="#CCCCCC">DESCRIPCION</td>
      <td width="267" bgcolor="#CCCCCC">LINEA</td>
      <td width="161" bgcolor="#CCCCCC">PRE.MIN</td>
      <td width="144" bgcolor="#CCCCCC">PRE.MAX</td>
    </tr>   
    <?php
		$s="SELECT ID,COD as C,DESCRIPCION as D,LINEA as L,
			PV_MIN as PM,PV_MAX as PW,USO 
			FROM vproductos WHERE $FF 
			ORDER BY DESCRIPCION ";
		$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
		//echo $s;  
		$rs = grs($s);
		while ($r = $rs->fetch_assoc()){
			$ID=$r['ID'];
	?>
    <tr>
        <td><?php echo $r['C'];?></td>
        <td>
        <select name="E_<?php echo $ID;?>" id="E_<?php echo $ID;?>" 
        class="lt" style="position:inherit; width:100%"
        tabindex="<?php echo ++$TI;?>"  >
        <?php
        echo FCBO("au_item","auxiliar","au_tab='SI_NO'",$r['USO'],"N","N");
        ?>
        </select>
        </td>       
        <td><?php echo $r['D'];?></td>
        <td><?php echo $r['L'];?></td>
        <td><?php echo $r['PM'];?></td>
        <td><?php echo $r['PW'];?></td>        
    </tr>			
    <?php
		}
	?>
  </table>
</div>
</div>
<!--FIN_TABLA----->
<!--INI_OCULTOS-------------------------------->
<?php include("ocultox.php");?>
<!--FIN_OCULTOS-------------------------------->
<!--INI_BOTONES----->
<div id="DivBtn"  align="left"
style="position:absolute; left: 33px; top: 71px; width: 703px; height: 26px;">
<input name="CmdP" type="button" id="CmdP" class="btm"
value="Guardar" onClick="fGuardar();"  
tabindex="<?php echo ++$TI;?>" />
<input name="CmdB" type="button" id="CmdZ" class="btm"
value="Menu" onClick="fBuscar('menu.php');"  
tabindex="<?php echo ++$TI;?>" />
</div>
<!--FIN_BOTONES-->
</form>
<form action="ficheroExcel.php" 
method="post" target="_blank" 
id="FormularioExportacion" >
</form>

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