<?xml version="1.0"?>
<?xml-stylesheet href="NULL" type="application/x-xsp"?>
<?xml-stylesheet href="/ip2wp.xsl.es" type="text/xsl"?>
<?xml-stylesheet href="/wp2html.xsl.es" type="text/xsl"?>

<xsp:page
  language="Perl"
  xmlns:xsp="http://apache.org/xsp/core/v1" 
  xmlns:esql="http://apache.org/xsp/SQL/v2" 
  xmlns:conv="http://xmlns.knowscape.com/xsp/CharsetConv"
  xmlns:web="http://axkit.org/NS/xsp/webutils/v1"
> 
<page>
<xsp:logic>
  my @foo=split('/', <web:request_uri/>);
  my $usuario = $foo[$#foo-1] unless $#foo&lt;1;
  my $rfc = '';
</xsp:logic>

<!--<personal version="0.0">-->

<!--Conexión a la base de datos sica2007 -->
<esql:connection>
  <esql:driver>Pg</esql:driver>
  <esql:dburl>dbname=sica2007 host=xalli</esql:dburl>
  <esql:username>postgres</esql:username>
  <esql:execute-query>
     <esql:query>
      select rfc,nombre,apellidos from datos_per where login='<xsp:expr>$usuario</xsp:expr>'
    </esql:query>
    <esql:results>
       <esql:row-results>

	<xsp:logic>
	#
	# Reading rfc from esql
	#
        $rfc .= do <conv:charset-convert><esql:get-string column="rfc"/></conv:charset-convert>;
        </xsp:logic>

          <author e-mail="eogm@cie.unam.mx">eogm</author>
          <nombre><xsp:content><esql:get-string column="nombre"/> <esql:get-string column="apellidos"/></xsp:content></nombre>
          </esql:row-results>
    </esql:results>
  </esql:execute-query>
</esql:connection>

<!-- Julio 2013 
     Se visualiza 2010-2012 
 -->

<esql:connection>
  <esql:driver>Pg</esql:driver>
  <esql:dburl>dbname=sica2007 host=xalli</esql:dburl>
  <esql:username>postgres</esql:username>
  <esql:execute-query>
<!--
  <esql:query>
      select titulo_proy from ia_proyectos where rfc='<xsp:expr>$rfc</xsp:expr>'and anho=2008
  </esql:query>
  <esql:results>
  <esql:row-results>
       <proyecto>
            <nombre><esql:get-string column="titulo_proy"/></nombre>
          </proyecto>
  </esql:row-results>
  </esql:results>
-->
<!-- Distinciones -->
  <esql:query>
  select name,inst,fecha from ia_distinciones
  where rfc='<xsp:expr>$rfc</xsp:expr>'
  and pub like 'S%' and anho>2009 order by anho
  </esql:query>
  <esql:results>
    <esql:row-results>
      <distincion>
        <nombre><esql:get-string column="name" /> </nombre>
        <descripcion><esql:get-string column="inst"/> </descripcion>
        <anho><esql:get-string column="fecha"/> </anho>
      </distincion>
    </esql:row-results>
  </esql:results>
<!-- 
<esql:query>
 select ia_art.tipo_art,ia_art.titulo,ia_art.autores,lista_rev.nom_rev,ia_art.vol,ia_art.pag_ini,ia_art.pag_fin,ia_art.anho where ia_art.rfc='<xsp:expr>$rfc</xsp:expr>' and ia_art.num_rev=lista_rev.id and ia_art.status='Publicado' and ia_art.anho=2008;
  </esql:query>
  <esql:results>
    <esql:row-results>
      <publicacion>
        <tipo><esql:get-string column="tipo_art" /></tipo>
        <titulo><esql:get-string column="titulo" /></titulo>
        <autor><esql:get-string column="autores"/></autor>
        <revista><esql:get-string column="nom_rev"/></revista>
        <vol><esql:get-string column="vol"/></vol>
        <paginas><esql:get-string column="pag_ini"/>-<esql:get-string column="pag_fin"/></paginas>
        <anno><esql:get-string column="anho"/></anno>
      </publicacion>
    </esql:row-results>
  </esql:results>
-->
<!--Actividades docentes 2008-->
<!--
  <esql:query>
  select ia_cursos_sem.mat, nivel_frh.nivel, ia_cursos_sem.fac, ia_cursos_sem.sem where ia_cursos_sem.rfc='<xsp:expr>$rfc</xsp:expr>' and ia_cursos_sem.id_nivel=nivel_frh.id and ia_cursos_sem.anho=2008 and ia_cursos_sem.status=1
  </esql:query>
  <esql:results>
    <esql:row-results>
      <profesor>
        <materia><esql:get-string column="mat" /> </materia>
        <nivel><esql:get-string column="nivel" /> </nivel>
        <facultad><esql:get-string column="fac" /> </facultad>
        <semestre><esql:get-string column="sem" /> </semestre>
      </profesor>
    </esql:row-results>
  </esql:results>
-->
<!--Libro 2008-->
<!--
  <esql:query>
  select tit_lib, aut_lib, edit, isbn from ia_libros where rfc='<xsp:expr>$rfc</xsp:expr>' and anho=2008
  </esql:query>
  <esql:results>
    <esql:row-results>
      <libro>
        <titulo><esql:get-string column="tit_lib"/>
        </titulo>
        <autor><esql:get-string column="aut_lib"/>
        </autor>
        <editorial><esql:get-string column="edit"/>
        </editorial>
        <isbn><esql:get-string column="isbn"/>
        </isbn>
      </libro>
    </esql:row-results>
  </esql:results>
-->
<!--Capitulo 2008-->
<!--
     <esql:query>
    select tit_cap,aut_cap,aut_lib, tit_lib, edit, pags, anho, isbn from ia_caplib where rfc='<xsp:expr>$rfc</xsp:expr>' and anho=2008
  </esql:query>
  <esql:results>
    <esql:row-results>
      <capitulo>
        <titulo><esql:get-string column="tit_lib"/>
        </titulo>
        <autor><esql:get-string column="aut_cap"/>
        </autor>
        <paginas><esql:get-string column="pags"/>
        </paginas>
      <libro>
        <titulo><esql:get-string column="tit_cap"/>
        </titulo>
        <autor><esql:get-string column="aut_lib"/>
        </autor>
        <isbn><esql:get-string column="isbn"/>
        </isbn>
        <editorial><esql:get-string column="edit"/>
        </editorial>
      </libro>
        <anno><esql:get-string column="periodo"/></anno>
      </capitulo>
    </esql:row-results>
  </esql:results>
-->
<!-- Propiedad Industrial/Intelectual 2008-->
<!--
    <esql:query>
      select titulo,tipo_pat,registro from ia_patentes where rfc='<xsp:expr>$rfc</xsp:expr>' and anho=2008
    </esql:query>
    <esql:results>
       <esql:row-results>
          <patentes>
            <titulo><esql:get-string column="titulo"/></titulo>
            <tipo_pat><esql:get-string column="tipo_pat"/></tipo_pat>
            <registro><esql:get-string column="registro"/></registro>
          </patentes>
       </esql:row-results>
    </esql:results>
-->
<!--Tesis dirigidas 2008-->
<!--
 <esql:query>
 select alumnos.ap_alu,alumnos.nom_alu,inst_frh.nom_inst,nivel_frh.nivel,ia_frh.titulo,ia_frh.fecha_fin
 where (ia_frh.rfc='<xsp:expr>$rfc</xsp:expr>') 
  and (ia_frh.tipo_part&lt;3)
  and (ia_frh.id_nivel&gt;1)
  and (ia_frh.id_nivel=nivel_frh.id)
  and (ia_frh.id_alu=alumnos.id)
  and (ia_frh.id_inst=inst_frh.id)
  and ia_frh.conc
  and ia_frh.anho_actual=2008
 </esql:query>
 <esql:results>
   <esql:row-results>
     <tesis>
       <alumno>
         <esql:get-string column="ap_alu"/>
        <xsp:content> </xsp:content>
         <esql:get-string column="nom_alu"/>
       </alumno>
       <institucion><esql:get-string column="nom_inst"/></institucion>
       <nivel><esql:get-string column="nivel"/></nivel>
       <titulo><esql:get-string column="titulo"/></titulo>
       <fecha><esql:get-string column="fecha_fin"/></fecha>
     </tesis>
   </esql:row-results>
 </esql:results>
-->
<esql:no-results>
   <p>No hay datos 2008</p>
 </esql:no-results>
 </esql:execute-query>
</esql:connection>

<!-- Informe2009 / Informe 2010 -->

<esql:connection>
  <esql:driver>Pg</esql:driver>
  <esql:dburl>dbname=sica2007 host=xalli</esql:dburl>
  <esql:username>postgres</esql:username>
  <esql:execute-query>

  <!-- Proyectos programados en el PPA2009  -->
 <!-- 
 <esql:query>
      select ppa_proyectos.nombre_proy,ppa_proyectos.tipo_part where ppa_proyectos.id=ia_proy_prog.ref_ppa and ppa_proyectos.rfc='<xsp:expr>$rfc</xsp:expr>' and ppa_proyectos.anho=2009
  </esql:query>
  <esql:results>
  <esql:row-results>
       <proyecto_prog>
            <nombre><esql:get-string column="nombre_proy"/></nombre>
            <part><esql:get-string column="tipo_part"/></part>
          </proyecto_prog>
  </esql:row-results>
  </esql:results>
-->
  <!-- Proyectos del Informe 2010-->
  <esql:query>
    select titulo_proy,tipo_part from ia_proyectos where rfc='<xsp:expr>$rfc</xsp:expr>' and anho > 2009; 
 </esql:query>
  <esql:results>
  <esql:row-results>
       <proyecto>
            <nombre><esql:get-string column="titulo_proy"/></nombre>
          </proyecto>
  </esql:row-results>
  </esql:results>

 <esql:query>
select catalogo_proyectos.nombre_proy from catalogo_proyectos,ppa_proyectos2010,ia_proy_prog where catalogo_proyectos.id=ppa_proyectos2010.no_proy and ppa_proyectos2010.no_proy=ia_proy_prog.ref_ppa and ppa_proyectos2010.anho=2010 and ppa_proyectos2010.rfc ='<xsp:expr>$rfc</xsp:expr>' and ia_proy_prog.rfc = '<xsp:expr>$rfc</xsp:expr>';
 </esql:query>
  <esql:results>
  <esql:row-results>
       <proyecto>
            <nombre><esql:get-string column="nombre_proy"/></nombre>
          </proyecto>
  </esql:row-results>
  </esql:results>

<!--Publicaciones 2009 y 2010. Solo actividades publicadas-->
 <esql:query>
  select tipo_art,datos from ia_art2009 where rfc='<xsp:expr>$rfc</xsp:expr>' and status='Publicado' and anho>2009 order by anho;
  </esql:query>
  <esql:results>
    <esql:row-results>
      <publicacion2009>
        <tipo><esql:get-string column="tipo_art" /></tipo>
        <datos><esql:get-string column="datos" /></datos>
      </publicacion2009>
    </esql:row-results>
  </esql:results>

<!--Libros 2009 y 2010-->
  <esql:query>
  select datos, tipo_part from ia_libros2009 where rfc='<xsp:expr>$rfc</xsp:expr>' and anho>2009 order by anho
  </esql:query>
  <esql:results>
    <esql:row-results>
      <libro2009>
        <datos><esql:get-string column="datos"/>
        </datos>
        <tipo><esql:get-string column="tipo_part"/>
        </tipo>
      </libro2009>
    </esql:row-results>
  </esql:results>

<!--Capitulo en libros 2009 y 2010-->
  <esql:query>
    select datos from ia_caplib2009 where rfc='<xsp:expr>$rfc</xsp:expr>' and anho>2009 order by anho
  </esql:query>
  <esql:results>
    <esql:row-results>
      <capitulo2009>
        <datos><esql:get-string column="datos"/></datos>
      </capitulo2009>
    </esql:row-results>
  </esql:results>

<!-- Propiedad Industrial/Intelectual 2009-->
    <esql:query>
      select titulo,tipo,estado from ia_patentes2009 where rfc='<xsp:expr>$rfc</xsp:expr>' and anho>2009 order by anho
    </esql:query>
    <esql:results>
       <esql:row-results>
          <patentes2009>
            <titulo><esql:get-string column="titulo"/></titulo>
            <tipo><esql:get-string column="tipo"/></tipo>
            <estado><esql:get-string column="estado"/></estado>
          </patentes2009>
       </esql:row-results>
    </esql:results>

<!--Cursos 2009 y 2010-->
  <esql:query>
  SELECT tipo_curso,prog_curso,datos FROM ia_cursos2009 where rfc='<xsp:expr>$rfc</xsp:expr>' and anho>2009 order by anho
  </esql:query>
  <esql:results>
    <esql:row-results>
      <curso2009>
        <tipo><esql:get-string column="tipo_curso" /> </tipo>
        <datos><esql:get-string column="datos" /> </datos>
        <prog_curso><esql:get-string column="prog_curso" /> </prog_curso>
      </curso2009>
    </esql:row-results>
  </esql:results>

<!-- Formación de recursos humanos 2009 y 2010-->
 <esql:query>
 select alu,inst,nivel,prog,titulo from ia_frh2009 where rfc='<xsp:expr>$rfc</xsp:expr>' and anho>2009 and titulado order by tipo_part,anho
 </esql:query>
 <esql:results>
   <esql:row-results>
     <tesis2009>
       <alu><esql:get-string column="alu"/></alu>
       <institucion><esql:get-string column="inst"/></institucion>
       <nivel><esql:get-string column="nivel"/></nivel>
       <prog><esql:get-string column="prog"/></prog>
       <titulo><esql:get-string column="titulo"/></titulo>
     </tesis2009>
   </esql:row-results>
 </esql:results>

<esql:no-results>
   <p>No hay datos</p>
 </esql:no-results>

 </esql:execute-query>
</esql:connection>


</page>
</xsp:page>
