Example #1
0
     if ($rs->EOF) {
         echo json_encode(array("band" => "false"));
     } elseif ($rs->fields['idUsuario'] == $id) {
         echo json_encode(array("band" => "false"));
     } else {
         echo json_encode(array("band" => "true"));
     }
     break;
 case 'add':
     $obj = new TUsuario($_POST['id']);
     $obj->setNick($_POST['nick']);
     $obj->setNombre($_POST['nombre']);
     $obj->setEmail($_POST['email']);
     $obj->setTipo($_POST['tipo']);
     if ($obj->guardar()) {
         echo json_encode(array("band" => "true", "idUsuario" => $obj->getId()));
     } else {
         echo json_encode(array("band" => "false", "mensaje" => "Error al registrar la cuenta"));
     }
     break;
 case 'setPass':
     $obj = new TUsuario($_POST['usuario']);
     if ($obj->setPass($_POST['pass'])) {
         echo json_encode(array("band" => "true"));
     } else {
         echo json_encode(array("band" => "false"));
     }
     break;
 case 'del':
     $obj = new TUsuario(hexdec($_POST['usuario']));
     if ($obj->delete()) {
 /**
  * Agregar a doctor a supervisor
  *
  * @autor Hugo
  * @access public
  * @param $id Identificador del usuario doctor
  * @return boolean True si se realizó sin problemas
  */
 public function addSupervisado($id = '')
 {
     if ($id == '') {
         return false;
     }
     if ($this->getId() == '' or $this->getIdTipo() != 2) {
         return false;
     }
     $obj = new TUsuario($id);
     if ($obj->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("insert into encargados(idSupervisor, idUsuario) values (" . $this->getId() . ", " . $id . ")");
     return $rs ? true : false;
 }
Example #3
0
                     case 6:
                         $rs2 = $db->Execute("select * from horario where now() between sabadoEntrada and sabadoSalida");
                         $result = array('band' => !$rs2->EOF, 'mensaje' => 'Acceso denegado en este horario');
                         break;
                     default:
                         $rs2 = $db->Execute("select * from horario where now() between lunesEntrada and lunesSalida");
                         $result = array('band' => !$rs2->EOF, 'mensaje' => 'Acceso denegado en este horario');
                 }
             } else {
                 $result = array('band' => true);
             }
         }
     }
     if ($result['band']) {
         $obj = new TUsuario($rs->fields['idUsuario']);
         $sesion['usuario'] = $obj->getId();
         $_SESSION[SISTEMA] = $sesion;
     }
     echo json_encode($result);
     break;
 case 'logout':
     $_SESSION[SISTEMA] = array();
     session_destroy();
     header("Location: index.php");
     break;
 case 'validarPedido':
     $obj = new TPedido();
     $obj->setId($_POST['orden']);
     if (strtolower($obj->cliente->getEmail()) == strtolower($_POST['email'])) {
         echo json_encode(array("band" => true, "cliente" => $obj->cliente->getNombre()));
     } else {
Example #4
0
     $supervisor = new TUsuario($sesion['usuario']);
     if ($supervisor->getIdTipo() == 2) {
         $rs = $db->Execute("select distinct estado, ciudad from consultorio where idSupervisor = " . $supervisor->getId() . " order by estado, ciudad");
     } else {
         $rs = $db->Execute("select distinct estado, ciudad from consultorio order by estado, ciudad");
     }
     while (!$rs->EOF) {
         array_push($datos, $rs->fields);
         $rs->moveNext();
     }
     $smarty->assign("estados", $datos);
     break;
 case 'reporteCiudad':
     $db = TBase::conectaDB();
     $supervisor = new TUsuario($sesion['usuario']);
     $rs = $db->Execute("select d.ciudad, d.estado, c.nombre as servicio, sum(b.cantidad) as cantidad, descripcion as tipoServicio from reporte a join consulta b using(idReporte) join servicio c using(idServicio) join consultorio d using(idConsultorio) join tipoServicio e using(idTipo) where estado = '" . $_GET['estado'] . "' and ciudad = '" . $_GET['ciudad'] . "' and extract(month from a.fecha) = " . $_GET['mes'] . " and extract(year from a.fecha) = " . $_GET['anio'] . " " . ($supervisor->getIdTipo() == 2 ? " and idSupervisor = " . $supervisor->getId() : "") . " group by idServicio;");
     $datos = array();
     while (!$rs->EOF) {
         array_push($datos, $rs->fields);
         $rs->moveNext();
     }
     $smarty->assign("consultas", $datos);
     $rs = $db->Execute("select f.idClasificacion, clasificacion, sum(b.cantidad) as cantidad from reporte a join consulta b using(idReporte) join servicio c using(idServicio) join consultorio d using(idConsultorio) join tipoServicio e using(idTipo) join clasificacion f using(idClasificacion) where estado = '" . $_GET['estado'] . "' and ciudad = '" . $_GET['ciudad'] . "' and extract(month from a.fecha) = " . $_GET['mes'] . " and extract(year from a.fecha) = " . $_GET['anio'] . " " . ($supervisor->getIdTipo() == 2 ? " and idSupervisor = " . $supervisor->getId() : "") . " group by idClasificacion;");
     $datos = array();
     while (!$rs->EOF) {
         array_push($datos, $rs->fields);
         $rs->moveNext();
     }
     $smarty->assign("clasificacion", $datos);
     break;
 case 'listaReportes':
         $rs->moveNext();
     }
     $smarty->assign("turnos", $datos);
     $rs = $db->Execute("select * from usuario where idTipo = 2 order by nombre, app, apm");
     $datos = array();
     while (!$rs->EOF) {
         $obj = new TUsuario($rs->fields['idUsuario']);
         $datos[$obj->getId()] = $obj->getNombreCompleto();
         $rs->moveNext();
     }
     $smarty->assign("supervisor", $datos);
     $rs = $db->Execute("select * from usuario order by nombre, app, apm");
     $datos = array();
     while (!$rs->EOF) {
         $obj = new TUsuario($rs->fields['idUsuario']);
         $datos[$obj->getId()] = $obj->getNombreCompleto();
         $rs->moveNext();
     }
     $smarty->assign("responsable", $datos);
     $rs = $db->Execute("select * from turno");
     $datos = array();
     while (!$rs->EOF) {
         array_push($datos, $rs->fields);
         $rs->moveNext();
     }
     $smarty->assign("turnos", $datos);
     break;
 case 'listaConsultorios':
     $db = TBase::conectaDB();
     $rs = $db->Execute("select a.*, c.nombre as supervisor from consultorio a join usuario c on a.idSupervisor = c.idUsuario where eliminado = 0");
     $datos = array();
Example #6
0
<?php

global $objModulo;
switch ($objModulo->getId()) {
    case 'panel':
        global $sesion;
        $obj = new TUsuario($sesion['usuario']);
        $smarty->assign("nombre", $obj->getNombre());
        $smarty->assign("foto", file_exists('repositorio/usuarios/user_' . $obj->getId() . '.jpg') ? 'repositorio/usuarios/user_' . $obj->getId() . '.jpg' : 'templates/imagenes/usuario.png');
        $smarty->assign("ultimoAcceso", $obj->getUltimoAcceso());
        break;
}
Example #7
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;
 }
Example #8
0
                    $datos['comentario1'] = $reporte->getCampo1();
                    $datos['comentario2'] = $reporte->getCampo2();
                    $datos['comentario3'] = $reporte->getCampo3();
                    $email->setBodyHTML(utf8_decode($email->construyeMail(file_get_contents("repositorio/mail/ubicacion.txt"), $datos)));
                    $email->adjuntar($img);
                    $email->send();
                    $rs->moveNext();
                }
                $result = array("doc" => $documento, "band" => true);
                echo json_encode($result);
                break;
            case 'solicitarUbicacionMail':
                $db = TBase::conectaDB();
                $email = new TMail();
                $usuario = new TUsuario($_GET['user']);
                $origen = new TUsuario($_GET['solicita']);
                $datos = json_decode(file_get_contents("data.json"));
                foreach ($datos as $key => $val) {
                    $config[$key] = $val;
                }
                $email->setTema(utf8_decode("Solicitud de ubicación"));
                $email->setDestino($usuario->getEmail(), utf8_decode($usuario->getNombre()));
                $datos = array();
                $datos['nombreCompleto'] = $usuario->getNombre();
                $datos['direccionReportar'] = $config['web'] . "/?mod=reportarUbicacion&usuario=" . base64_encode($usuario->getId()) . "&solicita=" . base64_encode($origen->getId());
                $email->setBodyHTML(utf8_decode($email->construyeMail(file_get_contents("repositorio/mail/ubicar.txt"), $datos)));
                echo json_encode(array("band" => $email->send()));
                break;
        }
        break;
}