<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT"); 
set_magic_quotes_runtime(0);

include("include/dbcommon.php");
include("include/pf_proceso_variables.php");


$conn=db_connect(); 
$recordsCounter = 0;


$strSQL = $gstrSQL;



$str = SecuritySQL("Search");
if(strlen($str))
	$where.=" and ".$str;
$strSQL = AddWhere($strSQL,$where);

$strSQL.=" ".$gstrOrderBy;

$rs=db_query($strSQL,$conn);

if ( GetRowCount($strSQL) ) {
	echo "Detalles encontrados".": <strong>".GetRowCount($strSQL)."</strong>";
			echo ( GetRowCount($strSQL) > 10 ) ? ". Displaying first: <strong>10</strong>.<br /><br />" : "<br /><br />";
	echo "<table cellpadding=1 cellspacing=1 border=0 align=left class=\"detailtable\"><tr>";
	echo "<td><strong>Fecha de Inicio</strong></td>";
	echo "<td><strong>Identificador Proceso</strong></td>";
	echo "<td><strong>Identificador Camara</strong></td>";
	echo "<td><strong>Fecha de Fin</strong></td>";
	echo "<td><strong>Fecha del Ultimo Cambio</strong></td>";
	echo "<td><strong>Estado</strong></td>";
	echo "<td><strong>Frecuencia</strong></td>";
	echo "<td><strong>Creador Inicial</strong></td>";
	echo "<td><strong>Fecha Inicio Giro 1</strong></td>";
	echo "<td><strong>Fecha Fin Giro 1</strong></td>";
	echo "<td><strong>Fecha Inicio Giro 2</strong></td>";
	echo "<td><strong>Fecha Fin Giro 1</strong></td>";
	echo "<td><strong>Fecha Inicio Giro 3</strong></td>";
	echo "<td><strong>Fecha Fin Giro 1</strong></td>";
	echo "<td><strong>Pallets</strong></td>";
	echo "<td><strong>Puchos</strong></td>";
	echo "<td><strong>bins</strong></td>";
	echo "<td><strong>origen</strong></td>";
	echo "<td><strong>destino</strong></td>";
	echo "<td><strong>Identificador Especie</strong></td>";
	echo "<td><strong>Identificador Envase</strong></td>";
	echo "<td><strong>Condicion Inicial</strong></td>";
	echo "<td><strong>Numero de Giros</strong></td>";
	echo "<td><strong>Creador Final</strong></td>";
	echo "<td><strong>Condicion Final</strong></td>";
	echo "</tr>";
	while ($data = db_fetch_array($rs)) {
		$recordsCounter++;
					if ( $recordsCounter > 10 ) { break; }
		echo "<tr>";
		$keylink="";
		$keylink.="&key1=".htmlspecialchars(urlencode($data["id_proceso"]));

	//	fecha_inicio - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"fecha_inicio", ""),"field=fecha%5Finicio".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	id_proceso - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"id_proceso", ""),"field=id%5Fproceso".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	id_camara - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"id_camara", ""),"field=id%5Fcamara".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	fecha_fin - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"fecha_fin", ""),"field=fecha%5Ffin".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	fecha_ultcam - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"fecha_ultcam", ""),"field=fecha%5Fultcam".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	estado - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"estado", ""),"field=estado".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	frecuencia - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"frecuencia", ""),"field=frecuencia".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	creador_inicial - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"creador_inicial", ""),"field=creador%5Finicial".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	fecha_inicio_giro1 - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"fecha_inicio_giro1", ""),"field=fecha%5Finicio%5Fgiro1".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	fecha_fin_giro1 - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"fecha_fin_giro1", ""),"field=fecha%5Ffin%5Fgiro1".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	fecha_inicio_giro2 - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"fecha_inicio_giro2", ""),"field=fecha%5Finicio%5Fgiro2".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	fecha_fin_giro2 - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"fecha_fin_giro2", ""),"field=fecha%5Ffin%5Fgiro2".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	fecha_inicio_giro3 - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"fecha_inicio_giro3", ""),"field=fecha%5Finicio%5Fgiro3".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	fecha_fin_giro3 - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"fecha_fin_giro3", ""),"field=fecha%5Ffin%5Fgiro3".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	Pallets - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"Pallets", ""),"field=Pallets".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	Puchos - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"Puchos", ""),"field=Puchos".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	bins - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"bins", ""),"field=bins".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	origen - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"origen", ""),"field=origen".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	destino - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"destino", ""),"field=destino".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	id_especie - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"id_especie", ""),"field=id%5Fespecie".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	id_envase - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"id_envase", ""),"field=id%5Fenvase".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	condicion_inicial - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"condicion_inicial", ""),"field=condicion%5Finicial".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	num_giros - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"num_giros", ""),"field=num%5Fgiros".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	creador_final - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"creador_final", ""),"field=creador%5Ffinal".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
	//	condicion_final - 
		    $value="";
				$value = ProcessLargeText(GetData($data,"condicion_final", ""),"field=condicion%5Ffinal".$keylink,"",MODE_PRINT);
			echo "<td>".$value."</td>";
		echo "</tr>";
	}
	echo "</table>";
} else {
	echo "Detalles encontrados".": <strong>".GetRowCount($strSQL)."</strong>";
}

echo "counterSeparator".postvalue("counter");
?>