<?php
/*
----------------------------------------------------------------------------------------
Castor is a system to manage medical information.
Copyright (C) 2002, 2003 INTTELMEX hide@address.com, hide@address.com
Copurigth (C) 2004, SERVICIOS DE SALUD DEL ESTADO DE QUERETARO
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-----------------------------------------------------------------------------------------
Castor es un sistema para el manejo de información médica
Copyright (C) 2002, 2003 INTTELMEX hide@address.com, hide@address.com
Este programa es Software Libre; usted puede redistribuirlo
y/o modificarlo bajo los términos de la "GNU General Public
License" como lo publica la "FSF Free Software Foundation" version 2,
o de cualquier versión posterior.
Este programa es distribuido con la esperanza de que le será
útil, pero SIN NINGUNA GARANTIA; incluso sin la garantía
implícita por el MERCADEO o EJERCICIO DE ALGUN PROPOSITO en
particular. Vea la "GNU General Public License" para más
detalles.
Usted debe haber recibido una copia de la "GNU General Public
License" junto con este programa, si no, escriba a la "FSF
Free Software Foundation, Inc.", 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
----------------------------------------------------------------------------------------------
*/
////====================Termina Zona de funciones
/*echo "
<div id=\"3\">";*/
$idunidad=chop($idunidad);
$fecha1=$year1."-".$mes1."-".$dia1;
$fecha2=$year2."-".$mes2."-".$dia2;
$tipo_usuario=$clave;
$tipo_reporte=$tipo;
if($tipo_usuario==1)
{
$sql=new Tquery("select
dihiob_catalogo_farmacologico.farmacologico,count(dihiob_farmacologico.clave)
from dihiob_farmacologico,dihiob_control, dihiob_catalogo_farmacologico
where dihiob_control.idcontrol=dihiob_farmacologico.idcontroldho and
dihiob_farmacologico.clave=dihiob_catalogo_farmacologico.caso and
dihiob_control.fecha>='$fecha1'and
dihiob_control.fecha<='$fecha2' and
dihiob_control.idunidad= '$idunidad'
group by dihiob_catalogo_farmacologico.farmacologico ;
");
}
else if (($tipo_usuario==2)&&($tipo_reporte==1)) // reporte estatal para superusuario
{
$sql=new Tquery("select
dihiob_catalogo_farmacologico.farmacologico,count(dihiob_farmacologico.clave)
from dihiob_farmacologico,dihiob_control, dihiob_catalogo_farmacologico, unidades, consulta, dihiob_registro
where dihiob_control.idcontrol=dihiob_farmacologico.idcontroldho and
dihiob_farmacologico.clave=dihiob_catalogo_farmacologico.caso and
dihiob_control.fecha>='$fecha1'and
dihiob_control.fecha<='$fecha2' and
unidades.clave_unidad=consulta.idunidad and
unidades.estado='$estado' and
consulta.idconsulta=dihiob_registro.idconsulta and
dihiob_registro.idregistro=dihiob_control.idregistro
group by dihiob_catalogo_farmacologico.farmacologico ;");
}
else if (($tipo_usuario==2)&&($tipo_reporte==2)) // reporte jurisdiccional para superusuario
{
$sql=new Tquery("select
dihiob_catalogo_farmacologico.farmacologico,count(dihiob_farmacologico.clave)
from dihiob_farmacologico,dihiob_control, dihiob_catalogo_farmacologico, unidades, consulta, dihiob_registro
where dihiob_control.idcontrol=dihiob_farmacologico.idcontroldho and
dihiob_farmacologico.clave=dihiob_catalogo_farmacologico.caso and
dihiob_control.fecha>='$fecha1'and
dihiob_control.fecha<='$fecha2' and
unidades.clave_unidad=consulta.idunidad and
unidades.estado='$estado' and
unidades.jurisdiccion=$jurisdiccion and
consulta.idconsulta=dihiob_registro.idconsulta and
dihiob_registro.idregistro=dihiob_control.idregistro
group by dihiob_catalogo_farmacologico.farmacologico ;");
}
$ejecuta=$sql->consulta();
/*echo " <div id=\"main3\"> ";*/
echo "<p>$Inf_farmacos_entregados_por_control_en_la_unidad:$idunidad $txt_del $fecha1 $txt_al $fecha2</p>";
echo "<table> <tr> <td><p>$txt_farmacologico </td> <td><p>$txt_cantidad </td> </tr>";
for($i=0;$datos=@pg_fetch_array($ejecuta,$i);$i++)
{
echo "<tr> <td> <p> $datos[0]</p></td> <td><p>$datos[1] </p></td> </tr>";
}
echo "</table>";
//echo " </div>";
?>