<?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");
//
$CM=V($_GET['C']);
$P1=V($_GET['P1']);
$P2=V($_GET['P2']);
$P3=V($_GET['P3']);
$P4=V($_GET['P4']);
$P5=V($_GET['P5']);
$P6=V($_GET['P6']);
$P7=V($_GET['P7']);	
//
if($CM=="T"){
	$StrDes="%".$P1."%";
	$StrMar=$P2."%";
	$StrCod=$P3."%";
	$StrAlm=$P4;
	///////////////////////////////////////////////////////////////////////
	$s="<table width=\"822\" border=\"1\" cellpadding=\"0\" ".
	   "cellspacing=\"0\" bgcolor=\"#d4e3e5\" class=\"estilo888\" ".
	   "style=\"table-layout:fixed\">";
	$t=$s;
	$s="";
	$sql="SELECT ID,COD,SUBSTRING(DESCRIPCION,1,40),SUBSTRING(LINEA,1,35),C_CAJA,C_UNI ".
	     "FROM vis_stock_presentaciones ".
		 "WHERE DESCRIPCION LIKE '$StrDes' AND ".
		 "LINEA LIKE '$StrMar' AND COD Like '$StrCod' AND C_CAJA>0 AND ALMC LIKE '$StrAlm' AND CAST(USO AS CHAR)='SI'".
		 "ORDER BY DESCRIPCION,COD";
	//echo $sql;
	$result = grs($sql);
	$cx=0;
	//onmouseover=\"this.style.backgroundColor='#ffff66'\" onmouseout=\"this.style.backgroundColor='#d4e3e5'\" 
	//
	$s=$s."<tr >";
	$s=$s."<td  width=\"136\"></td>";
	$s=$s."<td  width=\"365\"></td>";
	$s=$s."<td  width=\"121\"></td>";
	$s=$s."<td  width=\"100\" align=\"right\"></td>";
	$s=$s."<td  width=\"100\" align=\"right\"></td>";
	$s=$s."</tr>";
	while ($row = $result->fetch_row()){
	  $KEY=$row[0].".".$row[5];
	  $s=$s."<tr ondblclick=\"z('$KEY')\">";
	  $s=$s."<td>".VV($row[1]."x".$row[5])."</td>";
	  $s=$s."<td>".VV($row[2])."</td>";
	  $s=$s."<td>".VV($row[3])."</td>";
	  $s=$s."<td>$row[4]</td>";
	  $s=$s."<td>$row[5]</td>";
	  $s=$s."</tr>";
	}
	if($s!=""){
	$s=$t.$s."</table>";		
	}		
	echo $s;	
}
?>