}
        $smarty->assign("lista", $datos);
        break;
    case 'cconsultorio':
        switch ($objModulo->getAction()) {
            case 'add':
                $obj = new TConsultorio($_POST['id']);
                $obj->setSupervisor($_POST['supervisor']);
                $obj->setResponsable($_POST['responsable']);
                $obj->setClave($_POST['clave']);
                $obj->setNombre($_POST['nombre']);
                $obj->setCiudad($_POST['ciudad']);
                $obj->setEstado($_POST['estado']);
                $obj->setCubiculos($_POST['cubiculos']);
                echo json_encode(array("band" => $obj->guardar()));
                break;
            case 'del':
                $obj = new TConsultorio($_POST['id']);
                echo json_encode(array("band" => $obj->eliminar()));
                break;
            case 'addTurno':
                $obj = new TConsultorio($_POST['consultorio']);
                echo json_encode(array("band" => $obj->addTurno($_POST['turno'])));
                break;
            case 'delTurno':
                $obj = new TConsultorio($_POST['consultorio']);
                echo json_encode(array("band" => $obj->delTurno($_POST['turno'])));
                break;
        }
        break;
}
Example #2
0
     $doc->setCubiculo($_POST['cubiculo']);
     $doc->setDoctor($_POST['usuario']);
     $doc->setConsultorio($_POST['consultorio']);
     $doc->setTurno($_POST['turno']);
     $doc->setMes($_POST['mes']);
     $doc->setAnio($_POST['anio']);
     $documento = $doc->output();
     if ($documento == '') {
         $result = array("doc" => "", "band" => false);
     } else {
         if ($_POST['enviar'] == 'no') {
             $result = array("doc" => $documento, "band" => true);
         } else {
             global $sesion;
             $email = new TMail();
             $consultorio = new TConsultorio($_POST['consultorio']);
             $email->setTema("Reporte " . utf8_decode($consultorio->getClave() . " " . $consultorio->getNombre()));
             $email->setDestino($consultorio->supervisor->getEmail(), utf8_decode($consultorio->supervisor->getNombreCompleto()));
             $doctor = new TDoctor($_POST['usuario'] == '' ? $sesion['usuario'] : $_POST['usuario']);
             $datos = array();
             $datos['nombreCompleto'] = $consultorio->supervisor->getNombreCompleto();
             $datos['nombreDoctor'] = $doctor->getNombreCompleto();
             $email->setBodyHTML(utf8_decode($email->construyeMail(file_get_contents("repositorio/mail/reporteDoctor.txt"), $datos)));
             $email->adjuntar($documento);
             $result = array("doc" => $documento, "band" => $email->send(), "emailSupervisor" => $consultorio->supervisor->getEmail());
         }
     }
     print json_encode($result);
     break;
 case 'generalExcel2':
     #Este incluye todas las consultas realizadas en un mes
Example #3
0
 public function generar()
 {
     /*Primero hay que checar si es supervisor o administrador*/
     global $sesion;
     $supervisor = new TUsuario($sesion['usuario']);
     $hoja =& $this->libro->addWorksheet('Reporte');
     $head =& $this->libro->addFormat(array('Size' => 8, 'bold' => 1, 'Color' => 'red'));
     $this->libro->setCustomColor(15, 192, 192, 192);
     $titulo =& $this->libro->addFormat(array('Size' => 8, 'bold' => 1, "Align" => "center", "border" => 1, "FgColor" => 15));
     $encabezado =& $this->libro->addFormat(array('Size' => 10, 'bold' => 1, "Align" => "center", "FgColor" => 15));
     $hoja->write(2, 1, utf8_decode("REPORTE DE CONSULTAS GENERAL"), $encabezado);
     $hoja->mergeCells(2, 1, 2, 9);
     $hoja->write(3, 1, utf8_decode("Generado el: " . date("Y-m-d")), $head);
     $hoja->mergeCells(3, 1, 3, 9);
     $titulo->setAlign("vcenter");
     $db = TBase::conectaDB();
     switch ($supervisor->getIdTipo()) {
         case 1:
             $rs = $db->Execute("select idConsultorio, idDoctor, idServicio, sum(cantidad) as cantidad from reporte a join consulta b using(idReporte) join consultorio d using(idConsultorio) join servicio e using(idServicio) join tipoServicio f using(idTipo) join clasificacion g using(idClasificacion) where extract(month from fecha) = " . $this->mes . " and extract(year from fecha) = " . $this->anio . " group by idConsultorio, idDoctor, idServicio");
             break;
         case 2:
             $rs = $db->Execute("select idConsultorio, idDoctor, idServicio, sum(cantidad) as cantidad from reporte a join consulta b using(idReporte) join consultorio d using(idConsultorio) join servicio e using(idServicio) join tipoServicio f using(idTipo) join clasificacion g using(idClasificacion) where extract(month from fecha) = " . $this->mes . " and extract(year from fecha) = " . $this->anio . " and idSupervisor = " . $supervisor->getId() . " group by idConsultorio, idDoctor, idServicio");
             break;
         default:
             return false;
     }
     $hoja->write(4, 1, utf8_decode("Estado"), $titulo);
     $hoja->mergeCells(4, 1, 5, 1);
     $hoja->write(4, 2, utf8_decode("Ciudad"), $titulo);
     $hoja->mergeCells(4, 2, 5, 2);
     $hoja->write(4, 3, utf8_decode("Consultorio"), $titulo);
     $hoja->mergeCells(4, 3, 4, 4);
     $hoja->write(5, 3, utf8_decode("Clave"), $titulo);
     $hoja->write(5, 4, utf8_decode("Nombre"), $titulo);
     $hoja->write(4, 5, utf8_decode("Doctor"), $titulo);
     $hoja->mergeCells(4, 5, 4, 6);
     $hoja->write(5, 5, utf8_decode("Nombre"), $titulo);
     $hoja->write(5, 6, utf8_decode("EMail"), $titulo);
     $hoja->write(4, 7, utf8_decode("Servicio"), $titulo);
     $hoja->mergeCells(4, 7, 4, 8);
     $hoja->write(5, 7, utf8_decode("Tipo"), $titulo);
     $hoja->write(5, 8, utf8_decode("Nombre"), $titulo);
     $hoja->write(4, 9, utf8_decode("Cantidad"), $titulo);
     $hoja->mergeCells(4, 9, 5, 9);
     $datos =& $this->libro->addFormat(array('Size' => 8, "border" => 1));
     $hoja->setColumn(4, 8, 30);
     $y = 6;
     while (!$rs->EOF) {
         $consultorio = new TConsultorio($rs->fields['idConsultorio']);
         $servicio = new TServicio($rs->fields['idServicio']);
         $doctor = new TDoctor($rs->fields['idDoctor']);
         $hoja->write($y, 1, utf8_decode($consultorio->getEstado()), $datos);
         $hoja->write($y, 2, utf8_decode($consultorio->getCiudad()), $datos);
         $hoja->write($y, 3, utf8_decode($consultorio->getClave()), $datos);
         $hoja->write($y, 4, utf8_decode($consultorio->getNombre()), $datos);
         $hoja->write($y, 5, utf8_decode($doctor->getNombre()), $datos);
         $hoja->write($y, 6, utf8_decode($doctor->getEmail()), $datos);
         $hoja->write($y, 7, utf8_decode($servicio->tipo->getDescripcion()), $datos);
         $hoja->write($y, 8, utf8_decode($servicio->getNombre()), $datos);
         $hoja->write($y, 9, utf8_decode($rs->fields["cantidad"]), $datos);
         $rs->moveNext();
         $y++;
     }
     return true;
 }