Example #1
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['uni_acad'])) {
         $where[] = "uni_acad = " . quote("{$filtro['uni_acad']}");
     }
     if (isset($filtro['desc_materia'])) {
         $where[] = "desc_materia ILIKE " . quote("%{$filtro['desc_materia']}%");
     }
     if (isset($filtro['id_departamento'])) {
         $where[] = "id_departamento = " . $filtro['id_departamento'];
     }
     if (isset($filtro['cod_carrera'])) {
         $where[] = "cod_carrera ILIKE " . quote("%{$filtro['cod_carrera']}%");
     }
     if (isset($filtro['periodo_dictado'])) {
         $where[] = "periodo_dictado = " . $filtro['periodo_dictado'];
     }
     $sql = "SELECT\n\t\t\tt_m.id_materia,\n\t\t\tt_pe.cod_carrera as id_plan,\n\t\t\tt_m.desc_materia,\n\t\t\tt_m.orden_materia,\n\t\t\tt_m.anio_segunplan,\n\t\t\tt_m.horas_semanales,\n\t\t\tt_p.descripcion as periodo_dictado_nombre,\n\t\t\tt_p1.descripcion as periodo_dictado_real_nombre,\n\t\t\tt_d.descripcion as id_departamento,\n\t\t\tt_ma.descripcion as id_area,\n\t\t\tt_o.descripcion as id_orientacion,\n\t\t\tt_m.cod_siu,\n                        t_pe.cod_carrera,\n                        t_pe.ordenanza,\n                        t_pe. uni_acad\n\t\tFROM\n\t\t\tmateria as t_m\tLEFT OUTER JOIN periodo as t_p ON (t_m.periodo_dictado = t_p.id_periodo)\n\t\t\tLEFT OUTER JOIN periodo as t_p1 ON (t_m.periodo_dictado_real = t_p1.id_periodo)\n\t\t\tLEFT OUTER JOIN departamento as t_d ON (t_m.id_departamento = t_d.iddepto)\n                        LEFT OUTER JOIN area as t_ma ON (t_m.id_area = t_ma.idarea) \n                        LEFT OUTER JOIN orientacion as t_o ON (t_m.id_orientacion = t_o.idorient and t_o.idarea=t_ma.idarea) ,\n\t\t\tplan_estudio as t_pe\n\t\tWHERE\n\t\t\tt_m.id_plan = t_pe.id_plan\n                                \n\t\t";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " order by id_plan,anio_segunplan";
     return toba::db('designa')->consultar($sql);
 }
Example #2
0
 function listar_sedes($array_id_sedes, $filtro = null)
 {
     $where = array();
     if (isset($filtro['direccion_calle'])) {
         $where[] = 'direccion_calle ILIKE ' . quote("%{$filtro['direccion_calle']['valor']}%");
     }
     if (isset($filtro['localidad'])) {
         $where[] = 'localidad ILIKE ' . quote("%{$filtro['localidad']['valor']}%");
     }
     if (isset($filtro['provincia'])) {
         $where[] = 'provincia ILIKE ' . quote("%{$filtro['provincia']['valor']}%");
     }
     if (isset($filtro['id_sede'])) {
         $where[] = 'id_sede = ' . $filtro['id_sede']['valor'];
     }
     if (isset($filtro['id_unidad_academica'])) {
         $where[] = 'id_unidad_academica ILIKE ' . quote("%{$filtro['id_unidad_academica']['valor']}%");
     }
     $w = "(";
     for ($i = 0; $i < sizeof($array_id_sedes) - 1; $i++) {
         $w .= "id_sede = " . $array_id_sedes[$i]['id_sede'] . " OR ";
     }
     $w .= "id_sede = " . $array_id_sedes[$i]['id_sede'] . ")";
     $where[] = $w;
     $sql = "SELECT \n                    t_s.id_sede, \n                    t_s.direccion, \n                    t_s.id_localidad,\n                    t_s.coordenadas_x,\n                    t_s.coordenadas_y,\n                    t_l.nombre as localidad,\n                    t_s.telefono_1,\n                    t_s.telefono_2,\n                    t_s.telefono_3,\n                    t_s.fax_1,\n                    t_s.fax_2,\n                    t_s.fax_3,\n                    t_p.id_provincia,\n                    t_p.nombre as provincia,\n                    t_s.id_unidad_academica\n                    \n                    FROM sede as t_s\n                    LEFT OUTER JOIN localidad as t_l ON t_l.id_localidad = t_s.id_localidad\n                    LEFT OUTER JOIN provincia as t_p ON t_p.id_provincia = t_l.id_provincia\n                    ";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " ORDER BY provincia";
     return toba::db('libro_unco')->consultar($sql);
 }
Example #3
0
 function test_varios_where_espaciados_con_order()
 {
     $where = array('3=3', '4=4');
     $sql = 'SELECT 1,2 FROM apex_instancia WHERE 1 = 1 AND 2 = 2 ORDER BY 1,2';
     $sql = sql_concatenar_where($sql, $where);
     $this->consultar_sql($sql);
 }
Example #4
0
 function get_listado($filtro = array())
 {
     $where = array();
     $from = '';
     if (isset($filtro['descripcion'])) {
         $where[] = "descripcion ILIKE " . quote("%{$filtro['descripcion']['valor']}%");
     }
     if (isset($filtro['id_plan'])) {
         $from = 'obs_plan ';
         $where[] = 'id_entidad = ' . $filtro['id_plan']['valor'];
     }
     if (isset($filtro['id_materia'])) {
         $from = 'obs_mat ';
         if ($filtro['id_materia']['valor'] != -1) {
             $where[] = "id_entidad = " . $filtro['id_materia']['valor'];
         }
     }
     if (isset($filtro['id_modulo'])) {
         $from = 'obs_mod ';
         if ($filtro['id_modulo']['valor'] != -1) {
             $where[] = "id_entidad = " . $filtro['id_modulo']['valor'];
         }
     }
     $sql = "SELECT\n\t\t\tid_observacion,\n                        descripcion,\n                        id_entidad\n\t\tFROM\n\t\t\t{$from} ";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " ORDER BY id_observacion";
     return toba::db('libro_unco')->consultar($sql);
 }
Example #5
0
 function get_listado($filtro = array())
 {
     $where = array();
     $from = '';
     if (isset($filtro['contenido'])) {
         $where[] = "contenido ILIKE " . quote("%{$filtro['contenido']['valor']}%");
     }
     if (isset($filtro['titulo'])) {
         $where[] = "titulo ILIKE " . quote("%{$filtro['titulo']['valor']}%");
     }
     if (isset($filtro['id_titulo'])) {
         $where[] = "id_titulo = " . $filtro['id_titulo']['valor'];
     }
     if (isset($filtro['id_seccion'])) {
         $where[] = "id_seccion = " . $filtro['id_seccion']['valor'];
     }
     if (isset($filtro['id_sector'])) {
         $where[] = "id_sector = " . $filtro['id_sector']['valor'];
     }
     if (isset($filtro['id_plan'])) {
         $where[] = "id_plan = " . $filtro['id_plan']['valor'];
     }
     $sql = "SELECT\n\t\t\tt_s.contenido,\n\t\t\tt_ts.titulo as titulo,\n                        t_ts.id_titulo_seccion,\n\t\t\tt_s.con_extra,\n\t\t\tt_s.id_seccion,\n                        t_s.id_sector,\n                        t_s.id_plan\n\t\tFROM\n\t\t\tseccion as t_s\t\n                LEFT OUTER JOIN titulo_seccion as t_ts ON (t_s.id_titulo = t_ts.id_titulo_seccion)\n                         ";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " ORDER BY id_seccion";
     return toba::db('libro_unco')->consultar($sql);
 }
Example #6
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['nombre'])) {
         $where[] = 'nombre ILIKE ' . quote("%{$filtro['nombre'][valor]}%");
     }
     if (isset($filtro['apellido'])) {
         $where[] = 'apellido ILIKE ' . quote("%{$filtro['apellido']['valor']}%");
     }
     if (isset($filtro['nro_doc'])) {
         $where[] = 'nro_doc ILIKE ' . quote("%{$filtro['nro_doc']['valor']}%");
     }
     if (isset($filtro['tipo_doc'])) {
         $where[] = 'tipo_doc = ' . $filtro['tipo_doc']['valor'];
     }
     if (isset($filtro['genero'])) {
         $where[] = 'genero = ' . $filtro['genero']['valor'];
     }
     if (isset($filtro['id_sector'])) {
         $where[] = 't_p.id_sector = ' . $filtro['id_sector']['valor'];
     }
     $sql = "SELECT\n\t\t\tt_t.id_titulo,\n                        t_t.nombre as titulo,\n\t\t\tt_p.tipo_doc,\n\t\t\tt_p.genero,\n\t\t\tt_s.nombre as id_sector_nombre,\n\t\t\tt_p.nro_doc,\n\t\t\tt_p.nombre,\n\t\t\tt_p.apellido,\n\t\t\tt_p.correo\n\t\tFROM\n\t\t\tpersona as t_p\tLEFT OUTER JOIN titulo as t_t ON (t_p.id_titulo = t_t.id_titulo)\n\t\t\tLEFT OUTER JOIN sector as t_s ON (t_p.id_sector = t_s.id_sector)";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " ORDER BY nombre";
     return toba::db('libro_unco')->consultar($sql);
 }
    function get_listado($filtro = array())
    {
        $where = array();
        if (isset($filtro['id_expediente'])) {
            $where[] = 'id_expediente = ' . quote($filtro['id_expediente']);
        }
        if (isset($filtro['id_tipo'])) {
            $where[] = 'id_tipo = ' . quote($filtro['id_tipo']);
        }
        if (isset($filtro['fecha'])) {
            $where[] = 'fecha = ' . quote($filtro['fecha']);
        }
        if (isset($filtro['observaciones'])) {
            $where[] = 'observaciones ILIKE ' . quote("%{$filtro['observaciones']}%");
        }
        if (isset($filtro['quien'])) {
            $where[] = 'quien ILIKE ' . quote("%{$filtro['quien']}%");
        }
        $sql = 'SELECT
			t_i.id,
			t_e.numero as id_expediente_nombre,
			t_ti.nombre as id_tipo_nombre,
			t_i.fecha,
			t_i.observaciones,
			t_i.quien
		FROM
			intervenciones as t_i	LEFT OUTER JOIN expedientes as t_e ON (t_i.id_expediente = t_e.id)
			LEFT OUTER JOIN tipos_intervenciones as t_ti ON (t_i.id_tipo = t_ti.id)
		ORDER BY observaciones';
        if (count($where) > 0) {
            $sql = sql_concatenar_where($sql, $where);
        }
        return toba::db('burgos_v2')->consultar($sql);
    }
Example #8
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['nombre'])) {
         $where[] = "t_m.nombre ILIKE " . quote("%{$filtro['nombre']['valor']}%");
     }
     if (isset($filtro['tipo_modulo'])) {
         $where[] = "t_tm.nombre ILIKE " . quote("%{$filtro['tipo_modulo']['valor']}%");
     }
     if (isset($filtro['modulo_padre'])) {
         $where[] = "t_mp.nombre ILIKE " . quote("%{$filtro['modulo_padre']['valor']}%");
     }
     if (isset($filtro['id_plan'])) {
         $where[] = "t_m.id_plan = " . $filtro['id_plan']['valor'];
     }
     if (isset($filtro['id_modulo'])) {
         $where[] = "t_m.id_modulo = " . $filtro['id_modulo']['valor'];
     }
     $sql = "SELECT\n\t\t\tt_m.id_modulo,\n                        t_m.nombre,\n                        t_m.id_tipo_modulo,\n                        t_mp.nombre as modulo_padre,\n                        t_m.id_plan,\n                        t_tm.nombre as tipo_modulo\n\t\tFROM\n\t\t\tmodulo as t_m\t\n                LEFT OUTER JOIN tipo_modulo as t_tm \n                ON (t_m.id_tipo_modulo = t_tm.id_tipo_modulo)\n                LEFT OUTER JOIN modulo as t_mp\n                ON (t_mp.id_modulo = t_m.id_modulo_padre)\n                ";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " ORDER BY id_tipo_modulo";
     return toba::db('libro_unco')->consultar($sql);
 }
Example #9
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['nombre'])) {
         $where[] = "t_m.nombre ILIKE " . quote("%{$filtro['nombre']['valor']}%");
     }
     if (isset($filtro['codigo_siu'])) {
         $where[] = "t_m.codigo_siu = " . $filtro['codigo_siu']['valor'];
     }
     if (isset($filtro['anio_cursado'])) {
         $where[] = "t_m.anio_cursado = " . $filtro['anio_cursado']['valor'];
     }
     if (isset($filtro['periodo'])) {
         $where[] = "t_p.nombre ILIKE " . quote("%{$filtro['periodo']['valor']}%");
     }
     if (isset($filtro['optativa'])) {
         $where[] = "t_m.optativa = '" . ($filtro['optativa']['valor'] == 'si' ? true : false) . "'";
     }
     if (isset($filtro['id_plan'])) {
         $where[] = "t_m.id_plan = " . $filtro['id_plan']['valor'];
     }
     $sql = "SELECT\n\t\t\tt_m.id_materia,\n                        t_m.nombre,\n                        t_m.codigo_siu,\n                        t_m.cuatri_inicio,\n                        t_p.nombre as periodo,\n                        t_p.id_periodo,\n                        t_m.anio_cursado,\n                        t_m.orden,\n                        t_m.optativa,\n                        t_m.id_plan,\n                        t_mo.nombre as modulo\n\t\tFROM\n\t\t\tmateria as t_m\t\n                LEFT OUTER JOIN periodo as t_p \n                ON (t_m.id_periodo = t_p.id_periodo)\n                LEFT OUTER JOIN se_encuentra as t_se\n                ON (t_m.id_materia = t_se.id_materia)\n                LEFT OUTER JOIN modulo as t_mo\n                ON (t_mo.id_modulo = t_se.id_modulo)\n                ";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " ORDER BY orden";
     return toba::db('libro_unco')->consultar($sql);
 }
Example #10
0
 function cargar($opciones, $id_item_inicial = null, $incluidos_forzados = array())
 {
     if (!isset($id_item_inicial)) {
         $id_item_inicial = toba_info_editores::get_item_raiz($this->proyecto);
     }
     $en_profundidad = $this->debe_cargar_en_profundidad($id_item_inicial, $opciones);
     $filtro_items = "";
     if (!$this->debe_cargar_todo($opciones) || $en_profundidad) {
         //--- Se dejan solo los items del primer nivel, excepto que este en las excepciones
         if (isset($id_item_inicial)) {
             $id_item_sano = toba_contexto_info::get_db()->quote($id_item_inicial);
             $filtro_padre = "(i.padre = {$id_item_sano} OR i.item= {$id_item_sano})";
             //OR i.padre IN (SELECT item FROM apex_item WHERE padre='$id_item_inicial'))";
         }
         if (!empty($incluidos_forzados) && !$en_profundidad) {
             $forzados = implode("', '", $incluidos_forzados);
             $filtro_incluidos = "( i.padre IN ('" . $forzados . "')";
             $filtro_incluidos .= " OR i.item IN ('" . $forzados . "') )";
         }
         if (isset($filtro_padre) && isset($filtro_incluidos)) {
             $filtro_items = "\tAND ({$filtro_padre} \n\t\t\t\t\t\t\t\t\t\tOR \n\t\t\t\t\t\t\t\t\t{$filtro_incluidos})\n\t\t\t\t\t";
         } elseif (isset($filtro_padre)) {
             $filtro_items = "\tAND {$filtro_padre} ";
         } elseif (isset($filtro_incluidos)) {
             $filtro_items = "\tAND {$filtro_incluidos} ";
         }
     }
     if (isset($opciones['solo_carpetas']) && $opciones['solo_carpetas'] == 1) {
         $filtro_items .= "\tAND i.carpeta = 1";
     }
     //-- Se utiliza como sql básica aquella que brinda la definición de un componente
     toba_item_def::set_db(toba_contexto_info::get_db());
     $sql_base = toba_item_def::get_vista_extendida($this->proyecto);
     $sql = sql_concatenar_where($sql_base['basica']['sql'], array(" (i.solicitud_tipo IS NULL OR i.solicitud_tipo <> 'fantasma')" . $filtro_items));
     $sql = sql_agregar_ordenamiento($sql, array(array('i.carpeta', 'asc'), array('i.orden', 'asc'), array('i.nombre', 'asc')));
     $rs = toba_contexto_info::get_db()->consultar($sql);
     $this->items = array();
     if (!empty($rs)) {
         foreach ($rs as $fila) {
             $id = array();
             $id['componente'] = $fila['item'];
             $id['proyecto'] = $fila['item_proyecto'];
             $datos = array('basica' => $fila);
             if ($en_profundidad) {
                 $info = toba_constructor::get_info($id, 'toba_item', true, null, true, true);
             } else {
                 $info = toba_constructor::get_info($id, 'toba_item', false, $datos);
             }
             $this->items[$fila['item']] = $info;
         }
         $this->carpeta_inicial = $id_item_inicial;
         $this->mensaje = "";
         $this->ordenar();
         $this->filtrar($opciones);
     }
 }
Example #11
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['tipo_nov'])) {
         $where[] = "tipo_nov = " . quote($filtro['tipo_nov']);
     }
     $sql = "SELECT\n\t\t\tt_n.id_novedad,\n\t\t\tt_tn.descripcion as tipo_nov_nombre,\n\t\t\tt_n.desde,\n\t\t\tt_n.hasta,\n\t\t\tt_d.cat_mapuche as id_designacion_nombre,\n\t\t\tt_tne.nombre_tipo as tipo_norma_nombre,\n\t\t\tt_te.quien_emite_norma as tipo_emite_nombre,\n\t\t\tt_n.norma_legal,\n\t\t\tt_n.observaciones,\n\t\t\tt_n.nro_tab10,\n\t\t\tt_n.sub_tipo\n\t\tFROM\n\t\t\tnovedad as t_n\tLEFT OUTER JOIN tipo_novedad as t_tn ON (t_n.tipo_nov = t_tn.id_tipo)\n\t\t\tLEFT OUTER JOIN designacion as t_d ON (t_n.id_designacion = t_d.id_designacion)\n\t\t\tLEFT OUTER JOIN tipo_norma_exp as t_tne ON (t_n.tipo_norma = t_tne.cod_tipo)\n\t\t\tLEFT OUTER JOIN tipo_emite as t_te ON (t_n.tipo_emite = t_te.cod_emite)\n\t\tORDER BY norma_legal";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('designa')->consultar($sql);
 }
Example #12
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['uni_acad'])) {
         $where[] = "uni_acad = " . quote($filtro['uni_acad']);
     }
     $sql = "SELECT\n\t\t\tt_p.id_pext,\n\t\t\tt_p.codigo,\n\t\t\tt_p.denominacion,\n\t\t\tt_p.nro_resol,\n\t\t\tt_p.fecha_resol,\n\t\t\tt_ua.descripcion as uni_acad,\n\t\t\tt_p.fec_desde,\n\t\t\tt_p.fec_hasta,\n\t\t\tt_p.nro_ord_cs,\n\t\t\tt_p.res_rect,\n\t\t\tt_p.expediente,\n\t\t\tt_p.duracion,\n\t\t\tt_p.palabras_clave,\n\t\t\tt_p.objetivo,\n\t\t\tt_p.estado,\n\t\t\tt_p.financiacion,\n\t\t\tt_p.monto,\n\t\t\tt_p.fecha_rendicion,\n\t\t\tt_p.rendicion_monto,\n\t\t\tt_p.fecha_prorroga1,\n\t\t\tt_p.fecha_prorroga2,\n\t\t\tt_p.observacion,\n\t\t\tt_p.estado_informe_a,\n\t\t\tt_p.estado_informe_f\n\t\tFROM\n\t\t\tpextension as t_p\tLEFT OUTER JOIN unidad_acad as t_ua ON (t_p.uni_acad = t_ua.sigla)\n\t\tORDER BY codigo";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('designa')->consultar($sql);
 }
Example #13
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['titulo'])) {
         $where[] = "titulo ILIKE " . quote("%{$filtro['titulo']}%");
     }
     $sql = "SELECT\n\t\t\tt_e.id_encuesta,\n\t\t\tt_e.titulo,\n\t\t\tt_e.descripcion,\n\t\t\tt_e1.descripcion as estado_nombre,\n\t\t\tt_e.fec_inicio,\n\t\t\tt_e.fec_fin,\n\t\t\tt_e.dni_gestor,\n\t\t\tt_e.cant_respuestas,\n\t\t\tt_e.tipo_doc,\n\t\t\tt_e.destino\n\t\tFROM\n\t\t\tencuesta as t_e\tLEFT OUTER JOIN estado as t_e1 ON (t_e.estado = t_e1.ident)\n\t\tORDER BY descripcion";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('encuesta')->consultar($sql);
 }
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['fecha_impresion'])) {
         $where[] = "fecha_impresion = " . quote($filtro['fecha_impresion']);
     }
     $sql = "SELECT\n\t\t\tt_i5.id,\n\t\t\tt_i5.fecha_impresion,\n\t\t\tt_i5.expediente\n\t\tFROM\n\t\t\timpresion_540 as t_i5\n\t\tORDER BY expediente";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('designa')->consultar($sql);
 }
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['nombre'])) {
         $where[] = "nombre ILIKE " . quote("%{$filtro['nombre']}%");
     }
     $sql = "SELECT\n\t\t\tt_tg.id,\n\t\t\tt_tg.nombre\n\t\tFROM\n\t\t\ttipos_gestiones as t_tg\n\t\tORDER BY nombre";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('burgos_v2')->consultar($sql);
 }
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['iddepto'])) {
         $where[] = "iddepto = " . quote($filtro['iddepto']);
     }
     $sql = "SELECT\n\t\t\tt_d.iddepto,\n\t\t\tt_ua.descripcion as idunidad_academica_nombre,\n\t\t\tt_d.descripcion\n\t\tFROM\n\t\t\tdepartamento as t_d,\n\t\t\tunidad_acad as t_ua\n\t\tWHERE\n\t\t\t\tt_d.idunidad_academica = t_ua.sigla\n\t\tORDER BY descripcion";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('designa')->consultar($sql);
 }
Example #17
0
 function get_seleccion_persona($filtro = array())
 {
     $where = array();
     if (isset($filtro['apellido'])) {
         $where[] = "apellido ILIKE " . quote("%{$filtro['apellido']}%");
     }
     if (isset($filtro['documento_nro'])) {
         $where[] = "documento_nro ILIKE " . quote("%{$filtro['documento_nro']}%");
     }
     $sql = "SELECT\n\t\t\t\t\t\tp.id,\n\t\t\t\t\t\tapellido,\n\t\t\t\t\t\tdocumento_nro,\n\t\t\t\t\t\tp.nombre || ' ' || apellido || ' ' || dt.nombre || ' ' || documento_nro AS dato \n\t\t\t\tFROM\n\t\t\t\t\tpersonas AS p \n\t\t\t\tINNER JOIN documentos_tipos AS dt\n\t\t\t\tON p.id_documento_tipo = dt.id\n\t\t\t\tORDER BY dato";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('burgos_v2')->consultar($sql);
 }
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['id_periodo'])) {
         $where[] = "t_mpp.anio = " . $filtro['id_periodo'];
     }
     if (isset($filtro['id_unidad'])) {
         $where[] = "t_mc.id_unidad = " . quote($filtro['id_unidad']);
     }
     $sql = "SELECT\n\t\t\tt_mc.id_credito,\n\t\t\tt_mpp.id_periodo as id_periodo_nombre,\n\t\t\tt_mc.id_unidad as id_unidad,\n\t\t\tt_e.descripcion as id_escalafon_nombre,\n\t\t\tt_mtc.tipo as id_tipo_credito_nombre,\n\t\t\tt_mc.descripcion,\n\t\t\tt_mc.credito,\n\t\t\tt_mp.nombre as id_programa_nombre\n\t\tFROM\n\t\t\tmocovi_credito as t_mc\t\n                        LEFT OUTER JOIN mocovi_periodo_presupuestario as t_mpp ON (t_mc.id_periodo = t_mpp.id_periodo)\n\t\t\tLEFT OUTER JOIN escalafon as t_e ON (t_mc.id_escalafon = t_e.id_escalafon)\n\t\t\tLEFT OUTER JOIN mocovi_tipo_credito as t_mtc ON (t_mc.id_tipo_credito = t_mtc.id_tipo_credito)\n\t\t\tLEFT OUTER JOIN mocovi_programa as t_mp ON (t_mc.id_programa = t_mp.id_programa)\n                where t_mc.id_escalafon='D'        \n\t\tORDER BY id_tipo_credito_nombre,id_programa_nombre";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('designa')->consultar($sql);
 }
Example #19
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['fecha'])) {
         $where[] = "fecha = " . quote($filtro['fecha']);
     }
     if (isset($filtro['descripcion'])) {
         $where[] = "descripcion ILIKE " . quote("%{$filtro['descripcion']}%");
     }
     $sql = "SELECT\n\t\t\t*\n\t\tFROM\n\t\t\teventos as t_e\n\t\tORDER BY t_e.fecha";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('burgos_v2')->consultar($sql);
 }
Example #20
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['nombre'])) {
         $where[] = "nombre ILIKE " . quote("%{$filtro['nombre']}%");
     }
     if (isset($filtro['id_localidad'])) {
         $where[] = "id_localidad = " . quote($filtro['id_localidad']);
     }
     $sql = "SELECT\n\t\t\tt_d.id,\n\t\t\tt_d.nombre,\n\t\t\tt_l.nombre as id_localidad_nombre\n\t\tFROM\n\t\t\tdistritos as t_d,\n\t\t\tlocalidades as t_l\n\t\tWHERE\n\t\t\t\tt_d.id_localidad = t_l.id\n\t\tORDER BY nombre";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('burgos_v2')->consultar($sql);
 }
Example #21
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['id_ambito'])) {
         $where[] = "id_ambito = " . quote($filtro['id_ambito']);
     }
     if (isset($filtro['nombre'])) {
         $where[] = "nombre ILIKE " . quote("%{$filtro['nombre']}%");
     }
     $sql = "SELECT\n\t\t\tt_tc.id,\n\t\t\tt_a.nombre as id_ambito_nombre,\n\t\t\tt_tc.nombre\n\t\tFROM\n\t\t\ttipos_casos as t_tc\tLEFT OUTER JOIN ambitos as t_a ON (t_tc.id_ambito = t_a.id)\n\t\tORDER BY nombre";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('burgos_v2')->consultar($sql);
 }
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['id_ambito'])) {
         $where[] = "id_ambito = " . quote($filtro['id_ambito']);
     }
     if (isset($filtro['violencia'])) {
         $where[] = "violencia = " . quote($filtro['violencia']);
     }
     $sql = "SELECT\n\t\t\tt_c.id,\n\t\t\tt_a.nombre as id_ambito_nombre,\n\t\t\tt_tc.nombre as id_tipo1_nombre,\n\t\t\tt_tc1.nombre as id_tipo2_nombre,\n\t\t\tt_tc2.nombre as id_tipo3_nombre,\n\t\t\tt_c.violencia,\n\t\t\tt_tv.nombre as id_tipov1_nombre,\n\t\t\tt_tv3.nombre as id_tipov2_nombre,\n\t\t\tt_tv4.nombre as id_tipov3_nombre\n\t\tFROM\n\t\t\tclasificadores as t_c\tLEFT OUTER JOIN ambitos as t_a ON (t_c.id_ambito = t_a.id)\n\t\t\tLEFT OUTER JOIN tipos_casos as t_tc ON (t_c.id_tipo1 = t_tc.id)\n\t\t\tLEFT OUTER JOIN tipos_casos as t_tc1 ON (t_c.id_tipo2 = t_tc1.id)\n\t\t\tLEFT OUTER JOIN tipos_casos as t_tc2 ON (t_c.id_tipo3 = t_tc2.id)\n\t\t\tLEFT OUTER JOIN tipos_violencias as t_tv ON (t_c.id_tipov1 = t_tv.id)\n\t\t\tLEFT OUTER JOIN tipos_violencias as t_tv3 ON (t_c.id_tipov2 = t_tv3.id)\n\t\t\tLEFT OUTER JOIN tipos_violencias as t_tv4 ON (t_c.id_tipov3 = t_tv4.id)";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('burgos_v2')->consultar($sql);
 }
Example #23
0
 function get_listado_enc($enc, $filtro = array())
 {
     //tener en cuenta que el nombre de las columnas del resultado de la consulta debe coincidir con el identificador de los campos correspondientes definidos en toba
     $where = array();
     if (isset($filtro['descripcion'])) {
         $where[] = "descripcion ILIKE " . quote("%{$filtro['descripcion']}%");
     }
     if (isset($filtro['estilo'])) {
         $where[] = "estilo = " . quote($filtro['estilo']);
     }
     $sql = "SELECT\n\t\t\t\tt_p.id_pregunta,\n                                t_p.descripcion,\n                                t_p.estilo,\n                                CASE WHEN t_p.es_obligatoria THEN 'si' ELSE 'no' END as es_obligatoria\n\t\t\t\t\n\t\t\tFROM\n\t\t\t\tpregunta as t_p\t,seccion t_s \n                        WHERE t_p.id_sec=t_s.id_seccion \n                        and exists(select * from opcion_comun t_o\n                                   where t_o.id_preg=t_p.id_pregunta and t_o.cantidad_respuestas>0)\n                        and  t_s.id_enc=" . $enc;
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('encuesta')->consultar($sql);
 }
Example #24
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['id_area'])) {
         $where[] = 'id_area = ' . $filtro['id_area']['valor'];
     }
     if (isset($filtro['id_plan'])) {
         $where[] = 'id_plan = ' . $filtro['id_plan']['valor'];
     }
     $sql = "SELECT \n                    t_p.id_area, \n                    t_p.id_plan \n                    \n                    FROM pertenece as t_p\n                    ";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " ORDER BY id_plan";
     return toba::db('libro_unco')->consultar($sql);
 }
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['sigla'])) {
         $where[] = 'sigla ILIKE ' . quote("%{$filtro['sigla']['valor']}%");
     }
     if (isset($filtro['nombre'])) {
         $where[] = 'nombre ILIKE ' . quote("%{$filtro['nombre']['valor']}%");
     }
     $sql = "SELECT\n\t\t\tt_ua.sigla,\n\t\t\tt_ua.correo_1,\n\t\t\tt_ua.correo_2,\n\t\t\tt_ua.correo_3,\n\t\t\tt_ua.pagina_1,\n\t\t\tt_ua.pagina_2,\n\t\t\tt_ua.nombre,\n\t\t\tt_ua.orden,\n\t\t\tt_ua.imagen\n\t\tFROM\n\t\t\tunidad_academica as t_ua";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " ORDER BY nombre";
     return toba::db('libro_unco')->consultar($sql);
 }
Example #26
0
 function get_seleccion_profesional($filtro = array())
 {
     $where = array();
     if (isset($filtro['apellido'])) {
         $where[] = "apellido ILIKE " . quote("%{$filtro['apellido']}%");
     }
     if (isset($filtro['nombre'])) {
         $where[] = "nombre ILIKE " . quote("%{$filtro['nombre']}%");
     }
     if (isset($filtro['area'])) {
         $where[] = "area ILIKE " . quote("%{$filtro['area']}%");
     }
     $sql = "SELECT\n\t\t\tt_p.id,\n\t\t\tt_p.apellido,\n\t\t\tt_p.nombre,\n\t\t\tt_p.telefono,\n\t\t\tt_p.area,\n\t\t\tt_p.apellido || ', '|| t_p.nombre || ' : ' || t_p.area AS dato\n\t\tFROM\n\t\t\tpersonal as t_p\n\t\tWHERE \n\t\t\tt_p.profesional = true\n\t\tORDER BY dato";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('burgos_v2')->consultar($sql);
 }
Example #27
0
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['ua'])) {
         $where[] = "ua = " . quote($filtro['ua']);
     }
     if (isset($filtro['id_periodo'])) {
         $where[] = "id_periodo = " . quote($filtro['id_periodo']);
     }
     if (isset($filtro['id_periodo_pres'])) {
         $where[] = "id_periodo_pres = " . quote($filtro['id_periodo_pres']);
     }
     $sql = "SELECT\n\t\t\tt_ec.id_conjunto,\n\t\t\tt_ec.ua,\n\t\t\tt_ec.id_materia,\n\t\t\tt_p.descripcion as id_periodo_nombre,\n\t\t\tt_mpp.id_periodo as id_periodo_pres_nombre\n\t\tFROM\n\t\t\ten_conjunto as t_ec\tLEFT OUTER JOIN periodo as t_p ON (t_ec.id_periodo = t_p.id_periodo)\n\t\t\tLEFT OUTER JOIN mocovi_periodo_presupuestario as t_mpp ON (t_ec.id_periodo_pres = t_mpp.id_periodo)";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('designa')->consultar($sql);
 }
Example #28
0
 function get_listado_con_persona($filtro = array())
 {
     $where = array();
     if (isset($filtro['nombre'])) {
         $where[] = 't_s.nombre ILIKE ' . quote("%{$filtro['nombre']['valor']}%");
     }
     if (isset($filtro['nombre_persona'])) {
         $where[] = 't_p.nombre ILIKE ' . quote("%{$filtro['nombre_persona']['valor']}%");
     }
     if (isset($filtro['apellido_persona'])) {
         $where[] = 't_p.apellido ILIKE ' . quote("%{$filtro['apellido_persona']['valor']}%");
     }
     $sql = "SELECT\n\t\t\tt_s.id_sector,\n\t\t\tt_s.nombre,\n\t\t\tt_s.id_unidad_academica,\n\t\t\tt_s.correo,\n\t\t\tt_s.telefono,\n\t\t\tt_s.fax,\n\t\t\tt_s.orden,\n\t\t\tt_s.interno_1,\n\t\t\tt_s.interno_2,\n\t\t\tt_s.nombre_masc,\n\t\t\tt_s.nombre_fem,\n                        t_p.nro_doc as nro_doc_persona,\n                        t_p.tipo_doc as tipo_doc_persona,\n                        t_p.nombre as nombre_persona,\n                        t_p.apellido as apellido_persona\n\t\tFROM\n\t\t\tsector as t_s \n                LEFT JOIN persona as t_p\n                ON t_s.id_sector = t_p.id_sector";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     $sql = $sql . " ORDER BY nombre";
     return toba::db('libro_unco')->consultar($sql);
 }
 function get_listado($filtro = array())
 {
     $where = array();
     if (isset($filtro['anio'])) {
         $where[] = "anio = " . quote($filtro['anio']);
     }
     $sql = "SELECT\n\t\t\tt_am.id_designacion,\n\t\t\tt_am.id_materia,\n\t\t\tt_am.nro_tab8,\n\t\t\tt_am.rol,\n\t\t\tt_p.descripcion as id_periodo_nombre,\n\t\t\tt_am.modulo,\n\t\t\tt_am.carga_horaria,\n\t\t\tt_am.anio,\n\t\t\tt_am.externa\n\t\tFROM\n\t\t\tasignacion_materia as t_am\tLEFT OUTER JOIN periodo as t_p ON (t_am.id_periodo = t_p.id_periodo)\n\t\tORDER BY rol";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('designa')->consultar($sql);
 }
Example #30
0
 function get_personas_expedientes($filtro = array(), $rol = null)
 {
     $where = array();
     $campo_persona = '';
     //',1 AS datos_persona';
     $join_persona = '';
     if (isset($rol)) {
         //este es el caso donde paso directamente el rol a buscar
         $where[] = "roles.id = {$rol}";
     }
     if (isset($filtro['id'])) {
         //este es el caso donde paso directamente el id del expediente. Es unico
         $where[] = "ex.id = {$filtro['id']}";
     }
     if (isset($filtro['numero'])) {
         $where[] = $this->operacion_filtro('numero', 'ex.numero', $filtro);
     }
     if (isset($filtro['estado'])) {
         if ($filtro['estado'] == 3) {
             $where[] = 'estado < 2 ';
         } else {
             $where[] = 'estado = ' . $filtro['estado'];
         }
     }
     if (isset($filtro['fecha'])) {
         $where[] = $this->operacion_filtro('fecha', 'ex.fecha_presentacion', $filtro);
     }
     if (isset($filtro['documento_nro'])) {
         $where[] = $this->operacion_filtro('documento_nro', 'per.documento_nro', $filtro);
         $campo_persona = "";
         $join_persona = "\n\t";
     }
     $sql = "SELECT DISTINCT\n\t\t\t\t\tex.id,\n\t\t\t\t\tex.numero,\n\t\t\t\t\tex.fecha_presentacion,\n\t\t\t\t\tex.lugar,\n\t\t\t\t\t'responsable' AS nombre_responsable_ingreso,\n\t\t\t\t\tex.procedencia,\n\t\t\t\t\ttc.nombre as nomeclador,\n\t\t\t\t\tvi.nombre AS violencia,\n\t\t\t\t\tper.nombre  || ' '|| per.apellido || '  --  ' || per.documento_nro AS datos_persona,\n\t\t\t\t\tper.nombre  || ' '|| per.apellido AS nombre_persona,\n\t\t\t\t\troles.nombre as rol\n\t\t\t\tFROM expedientes AS ex\n\t\t\t\tINNER JOIN roles_vinculos AS rv\n\t\t\t\t\tON ex.id = rv.id_expediente                 \n\t\t\t\tINNER JOIN personas as per\n\t\t\t\t\tON per.id = rv.id_persona\n\t\t\t\tINNER JOIN roles\n\t\t\t\t\tON roles.id = rv.id_rol\n\t\t\t\tLEFT JOIN tipos_casos AS tc\n\t\t\t\t\tON ex.nomeclador_1 =   tc.id\n\t\t\t\tLEFT JOIN tipos_violencias  AS vi\n\t\t\t\t\tON vi.id = ex.violencia_1\n\t\t\t\tORDER BY \n\t\t\t\t\tex.numero,  rol\n\t\t\t\t";
     if (count($where) > 0) {
         $sql = sql_concatenar_where($sql, $where);
     }
     return toba::db('burgos_v2')->consultar($sql);
 }