	<?php
		global $base_url;
		$base_url_ = $base_url."/modulos/data/";
		$base_img = $base_url."/";
		
		drupal_add_css("formularios/dhtmlx/dhtmlx.css");	  
		drupal_add_css("modulos/css/template.css");	  
		drupal_add_js("formularios/dhtmlx/dhtmlx.js");
		drupal_add_js("formularios/dhtmlx/format-number.js");
		
	?>	

<style type="text/css">
body {
	background-color:#f1f5f6;
	margin:0 auto; 
	padding:0; 
	font:normal 12px Arial, Helvetica, sans-serif; 
	/*word-wrap: break-word;*/
}
/*#page-container {
	background:url(../sites/all/themes/opendashboard/images/body_bg.gif) repeat-y; 
	margin:0 auto; 
	padding:30px 20px; 
	width:900px; 
}*/

h1{
	color: #30556D;
	margin: 0 auto;
	padding: 0;
	width: 600px;
	font-size: 24px;
	text-align: center;
}

h2{
	color: #0053A1;
	margin: 20px 0 3px;
	padding: 0;
	font-size: 18px;
	font-weight: normal;
}
</style>

<?php

	module_load_include('php', 'connect', 'formularios/data/connect');

	//$urlxmls = "http://drupal6.betapruebas.com/modulos/data/";
	
	$depto = $_GET['depto'] ? $_GET['depto'] : 0;
	$ente = $_GET['ente'] ? $_GET['ente'] : 0;
	
	$filtro = '';
	if($depto>0)
	{
		$filtro .= "&depto=$depto";
		
		$query = "SELECT Nombre FROM departamentos WHERE IdDepartamento = $depto";
		$RS = mysql_query($query);
		$row = mysql_fetch_array($RS);
		$nomdepto = utf8_encode($row['Nombre']);
	}

	if($ente>0)
	{
		$filtro .= "&ente=$ente";
		
		$query = "SELECT Nombre FROM entidades WHERE IdEntidad = $ente AND IdDepartamento = $depto";
		$RS = mysql_query($query);
		$row = mysql_fetch_array($RS);
		$nomente = utf8_encode($row['Nombre']);
	}
?>
<div >

    <h1><?php echo t('Historial de Evaluaciones de Programas TICs del Gobierno Vasco'); ?></h1>
    <?php
		if($depto>0)
			print '<h3>'.t('Departamento').': '.$nomdepto.'</h3>';
		if($ente>0)
			print '<h3>'.t('Organismo Aut&oacute;nomo').': '.$nomente.'</h3>';
	?>    
    <h2><?php echo t('Evaluaci&oacute;n General'); ?></h2>
    <div id="grid1"></div>
    
    <h2><?php echo t('Evaluaci&oacute;n por Responsable'); ?></h2>
    <div id="grid2"></div>
    
    <h2><?php echo t('Evaluaci&oacute;n de Costo'); ?></h2>
    <div id="grid3"></div>
    
    <h2><?php echo t('Evaluaci&oacute;n de Plan'); ?></h2>
    <div id="grid4"></div>
    
    <h2><?php echo t('Historial de Evaluaciones'); ?></h2>
    <div id="grid5"></div>
</div>


<script type="text/javascript">

	grid1 = new dhtmlXGridObject("grid1");
	with(grid1)
	{
		setImagePath("<?php echo $base_img; ?>formularios/dhtmlx/imgs/");
		setHeader("<center><?php echo t('Verde'); ?></center>,<center><?php echo t('Amarillo'); ?></center>,<center><?php echo t('Rojo'); ?></center>,<center><?php echo t('Importe Verde'); ?></center>,<center><?php echo t('Importe Amarillo'); ?></center>,<center><?php echo t('Importe Rojo'); ?></center>");
		setInitWidths("120,120,120,165,165,165");
		setColAlign("center,center,center,center,center,center");
		setColTypes("ro,ro,ro,ro,ro,ro");
		enableAutoHeight(true);
		init();
		clearAndLoad("<?=$base_url_?>tabular.php?op=gene<?=$filtro?>");
	}

	grid2 = new dhtmlXGridObject("grid2");
	with(grid2)
	{
		setImagePath("<?php echo $base_img; ?>formularios/dhtmlx/imgs/");
		setHeader("<center><?php echo t('Verde'); ?></center>,<center><?php echo t('Amarillo'); ?></center>,<center><?php echo t('Rojo'); ?></center>,<center><?php echo t('Importe Verde'); ?></center>,<center><?php echo t('Importe Amarillo'); ?></center>,<center><?php echo t('Importe Rojo'); ?></center>");
		setInitWidths("120,120,120,165,165,165");
		setColAlign("center,center,center,center,center,center");
		setColTypes("ro,ro,ro,ro,ro,ro");
		enableAutoHeight(true);
		init();
		clearAndLoad("<?=$base_url_?>tabular.php?op=resp<?=$filtro?>");
	}

	grid3 = new dhtmlXGridObject("grid3");
	with(grid3)
	{
		setImagePath("<?php echo $base_img; ?>formularios/dhtmlx/imgs/");
		setHeader("<center><?php echo t('Verde'); ?></center>,<center><?php echo t('Amarillo'); ?></center>,<center><?php echo t('Rojo'); ?></center>,<center><?php echo t('Importe Verde'); ?></center>,<center><?php echo t('Importe Amarillo'); ?></center>,<center><?php echo t('Importe Rojo'); ?></center>");
		setInitWidths("120,120,120,165,165,165");
		setColAlign("center,center,center,center,center,center");
		setColTypes("ro,ro,ro,ro,ro,ro");
		enableAutoHeight(true);
		init();
		clearAndLoad("<?=$base_url_?>tabular.php?op=costo<?=$filtro?>");
	}

	grid4 = new dhtmlXGridObject("grid4");
	with(grid4)
	{
		setImagePath("<?php echo $base_img; ?>formularios/dhtmlx/imgs/");
		setHeader("<center><?php echo t('Verde'); ?></center>,<center><?php echo t('Amarillo'); ?></center>,<center><?php echo t('Rojo'); ?></center>,<center><?php echo t('Importe Verde'); ?></center>,<center><?php echo t('Importe Amarillo'); ?></center>,<center><?php echo t('Importe Rojo'); ?></center>");
		setInitWidths("120,120,120,165,165,165");
		setColAlign("center,center,center,center,center,center");
		setColTypes("ro,ro,ro,ro,ro,ro");
		enableAutoHeight(true);
		init();
		clearAndLoad("<?=$base_url_?>tabular.php?op=plan<?=$filtro?>");
	}

	grid5 = new dhtmlXGridObject("grid5");
	with(grid5)
	{
		setImagePath("<?php echo $base_img; ?>formularios/dhtmlx/imgs/");
		setHeader("<center><?php echo t('Fecha'); ?></center>,<center><?php echo t('Evaluaci&oacute;n del Responsable'); ?></center>,<center><?php echo t('Evaluaci&oacute;n de Costo'); ?></center>,<center><?php echo t('Evaluaci&oacute;n de Plan'); ?></center>,<center><?php echo t('Evaluaci&oacute;n General'); ?></center>");
		setInitWidths("165,165,165,165,165");
		setColAlign("center,center,center,center,center");
		setColTypes("ro,ro,ro,ro,ro");
		enableAutoHeight(true);
		init();
		clearAndLoad("<?=$base_url_?>tabular.php?op=hist<?=$filtro?>");
	}
</script>