<?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;
	}
	//
	$StrId=V($_POST['TxtId']);
	$StrCmd=V($_POST['TxtAc']);
	//-------------------------
	$StrONE=trim(V($_GET['CmdB']));	
	//-------------------------
	$StrCod=V($_POST['TxtCod']);		
	$StrLin=V($_POST['CboLin']);
	$StrDes=V($_POST['TxtDes']);
	$StrMar=V($_POST['CboMar']);
	if($StrCmd=="X" || strlen($StrCmd)==0){
		$StrLin="TODOS";
		$StrMar="TODOS";		
	}
	//-------------------------
	$StrCodT=$StrCod."%";
	$StrLinT=$StrLin;
	if(($StrLinT)=="TODOS") $StrLinT="%";
	$StrDesT=$StrDes."%";
	$StrMarT=$StrMar;
	if(($StrMarT)=="TODOS") $StrMarT="%";
	$LStrTR=gn("count(*)","vproductos",
				"COD LIKE '$StrCodT' AND LINEA LIKE '$StrLinT' AND 
				 DESCRIPCION LIKE '$StrDesT' ");
$LStrPag=V($_POST['TxtPag']);	
if($StrCmd=="F"){$LStrPag="1";}
$VP_RegXPag=5000;	
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
?>
<!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>Reporte de productos</title>
<?php AddJs();?>
<script type="text/javascript" src="fe/funciones.js"></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>
<style type="text/css">
<!--
body {
	background-color: #CCC;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
	width:800px;
	height:600px;
	position:absolute;
	left:<?php echo "50%";?>;
	top:<?php echo "50%";?>;
	background-color:#006699;
	margin:<?php echo "-300px";?> 0 0 <?php echo "-400px";?>;
}
#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;}
.Estilo4 {
	color: #000099;
	text-align: right;
}
.Estilo5 {color: #000000}
#Frm center #DivFRM #layer3 .f2 table tr td {
	color: #000;
}

-->
</style>

</head>
<body  <?php echo $StrMsg;?>>
 <div Id="DivFRM"  class="centrarFrm" >
<form id="Frm" name="Frm" method="post" action="rep_productos.php">

 
    <div id="layer6" style="position:absolute; left: 29px; top: 89px; width: 52px;">
      <div align="left" class="f2">CODIGO</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('menu.php');" />
        <input type="hidden" name="TxtAc" id="TxtAc" />
        <input name="TxtPag" id="TxtPag" type="hidden" value="<?php echo $LStrPag; ?>" />
      </div>
    </div>


<div id="layer3" style="position:absolute; left: 30px; top: 140px; width: 738px; height: 429px; overflow:auto">
<div align="left" class="f2">
<table id="Exportar_a_Excel" width="722" height="19" border="1" cellpadding="0" cellspacing="0">

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

<tr>
<td width="88" height="17" bgcolor="#999999"><span class="Estilo4">CODIGO</span></td>
<td width="114" bgcolor="#999999"><span class="Estilo4">LINEA</span></td>
<td width="306" bgcolor="#999999"><span class="Estilo4">DESCRIPCION</span></td>
<td width="57" bgcolor="#999999" align="right"><span class="Estilo4">PV. MIN</span></td>
<td width="56" bgcolor="#999999"  align="right"><span class="Estilo4">PV. MAX</span></td>
</tr>

<?php
$s="SELECT ID,COD,LINEA,DESCRIPCION,MARCA,ROUND(PV_MIN,1)
,ROUND(PV_MAX,1) FROM vproductos WHERE  ID>0 AND COD LIKE '$StrCodT' AND LINEA LIKE '$StrLinT' AND 
DESCRIPCION LIKE '$StrDesT' AND MARCA LIKE '$StrMarT' 
ORDER BY COD ";
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);						
$result = grs($s);
while ($row = $result->fetch_row()){
echo "<tr class=\"Estilo5\">";
echo "<td bgcolor=\"#FFFFFF\">$row[1]</td>";
echo "<td bgcolor=\"#FFFFFF\">$row[2]</td>";
echo "<td bgcolor=\"#FFFFFF\">$row[3]</td>";
echo "<td bgcolor=\"#FFFFFF\" align=\"right\">$row[5]</td>";						 
echo "<td bgcolor=\"#FFFFFF\" align=\"right\">$row[6]</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">REPORTE DE PRODUCTOS</div>
    </div>
          <input name="TxtCod" type="text" id="TxtCod" 
          style="position:absolute; left: 29px; top: 109px; width: 91px;" value="<?php echo $StrCod;?>"  
          onkeydown="return SoloTextoEx(event,'CboLin');"
          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: 675px; top: 109px; width: 54px;"
 value="Filtrar" onclick="fFiltrar();" />

<select name="CboLin" id="CboLin" style="position:absolute; left: 134px; top: 109px; width: 194px;" 
onkeydown="return SoloTextoEx(event,'TxtDes');">
<?php echo FCBO_("lin_nombre","lineas","id_linea>0",$StrLin,"S","N");?>
</select>

    <div id="layer7" style="position:absolute; left: 137px; top: 89px; width: 154px;">
      <div align="left" class="f2">LINEA DE PRODUCTO</div>
    </div>
    <div id="layer8" style="position:absolute; left: 340px; top: 89px; width: 136px;">
      <div align="left" class="f2">DESCRIPCION</div>
    </div>
   <input name="TxtDes" type="text" id="TxtDes" style="position:absolute; left: 339px; top: 109px; width: 313px;" 
        value="<?php echo $StrDes;?>"  
        onkeydown="return SoloTextoEx(event,'CmdB');"  tabindex="1" />
</form>

<form action="ficheroExcel.php" method="post" target="_blank" id="FormularioExportacion" >
<div style="position:absolute; left: 184px; 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>
