<%-- Document : frm_ver_informacion_declaranet Created on : 27/04/2016, 04:38:35 PM Author : martha --%> <%@page import="java.text.SimpleDateFormat"%> <%@page import="sun.misc.Perf.GetPerfAction"%> <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@page import = "conexion.*" import = "java.sql.*" import = "general.Config" import = "general.Permisos" import = "own.codec.*" import = "java.text.NumberFormat" %> Desplegar Información del DeclaraNet <% /****** Despliega la lista de cines del sistema filtrados por el texto de búsqueda de buscar_cines.jsp (no obligatorio)***********/ /********************************************creado por: Ing. Martha*******************************************************/ out.println(""); String nompag[] = request.getRequestURI().split("/"); %> <% //Conexion c = null; //Connection lcnt_con = null; ResultSet lrs_res = null; Statement lst_stm = null; String ls_query = new String(""); /*INICIO. Segunda Conexión*/ ConexionDeclaranet cd = null; Connection lcd_connection = null; //Statement lstg_conecta=null; /*FIN. SEGUNDA CONEXIÓN*/ String emergent_error = new String(""); boolean lb_connection = false; String debug = new String("si"); String estado = new String("0"); String id_dep = new String(""); String fecha_desde = new String(""); String fecha_hasta = new String(""); String fecha_desdeb = new String(""); String fecha_hastab = new String(""); String Awhere = new String(""); boolean elementos_encontrados = false; //String id_puesto = new String(""); int total_declaracion = 0; SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd"); /********* INICIO. Conexión a la base de datos ********/ try { if (!Config.getParametro("debug").equals("si")) { debug = "no"; } cd = new ConexionDeclaranet(); lcd_connection = cd.getConnection(); lst_stm = lcd_connection.createStatement(); lb_connection = true; }catch (Exception e) { emergent_error = "Error al conectarse a la base de datos "; if (debug.equals("si")) { emergent_error += e; } lb_connection = false; } /**********FIN. CONEXIÓN A LA BASE DE DATOS*******/ //********* Validación fundamental para evitar ejecución de código sin privilegios suficientes **********// try { if (!Permisos.PermisoModulo(nompag[nompag.length - 1].toString(), Integer.parseInt(session.getAttribute("id_user").toString()))) { if (lb_connection) { lst_stm.close(); lcd_connection.close(); } emergent_error += " Privilegios insuficientes. "; lb_connection = false; } } catch (Exception e) { emergent_error += " Privilegios insuficientes. "; if (debug.equals("si")) { emergent_error += "Trace: " + e.toString(); } lb_connection = false; } //*******************************************************************************************************// if (lb_connection) { try { estado = request.getParameter("estado"); id_dep = request.getParameter("id_dep"); fecha_desde = request.getParameter("fecha_desde"); fecha_hasta = request.getParameter("fecha_hasta"); fecha_desdeb = request.getParameter("fecha_desdeb"); fecha_hastab = request.getParameter("fecha_hastab"); // id_puesto = request.getParameter("id_puesto"); // out.println("fecha "+ request.getParameter("fecha_desde")+" fecha hasta"+request.getParameter("fecha_hasta")); /*if (estado.equals("1")){ Awhere= "WHERE a.status=1 "; }else{ Awhere= "WHERE a.status=0 "; }*/ if(!id_dep.equals("")){ if(id_dep.equals("0")){ if(!Awhere.equals("")){ Awhere+=" and pf.id_dependencia>=1"; } else{ Awhere+= " WHERE pf.id_dependencia>=1"; } } else{ if(!Awhere.equals("")){ Awhere+= " and pf.id_dependencia="+id_dep; } else{ Awhere+= " WHERE pf.id_dependencia="+id_dep; } } } if (estado.equals("1")){ if(!Awhere.equals("")){ Awhere+=" and (a.fecha_alta>='"+fecha_desde +"' and a.fecha_alta<='"+ fecha_hasta+"' )"; } else{ Awhere+=" WHERE (a.fecha_alta>='"+fecha_desde +"' and a.fecha_alta<='"+ fecha_hasta+"' )"; } } if (estado.equals("2")){ if(!Awhere.equals("")){ Awhere+=" and (a.fecha_baja='"+fecha_desdeb +"' and a.fecha_baja<='"+ fecha_hastab+"' )"; } else{ Awhere+=" WHERE (a.fecha_baja>='"+fecha_desdeb +"' and a.fecha_baja<='"+ fecha_hastab+"' )"; } } if(!Awhere.equals("")){ Awhere+=" and (f.id_usuarios>0)"; } else{ Awhere+=" WHERE f.id_usuarios>0"; } ls_query="select count(a.id_altabaja) as total " + " from altabaja a " + " left join puesto_funcionario pf ON pf.id_puesto_funcionario=a.id_puesto_funcionario " + " left join funcionarios f ON f.id_funcionario=a.id_funcionario " //+ " left join declaration de ON de.id_altabaja=a.id_altabaja " +Awhere + " group by f.id_funcionario;"; lrs_res = lst_stm.executeQuery(ls_query); if (lrs_res.next()) { total_declaracion = lrs_res.getInt("total"); } %>
Listado de Funcionarios con Usuarios en el DeclaraNETs
Total Usuaarios <%=total_declaracion%>
<%if (estado.equals("1")){%> <% } else if (estado.equals("2")){%> <% } %> <% ls_query="select a.id_funcionario, " + " CONCAT(f.ap_paterno, ' ', f.ap_materno, ' ', f.nombre ) as nombre, " + " pf.area, d.nombre_dep, tc.cargo, " // + " (select td.descripcion from tipodeclaracion td where td.id_tipodeclaracion=de.id_tipodeclaracion) as tipodeclaracion, " + " a.fecha_alta, a.fecha_baja, " + " a.clave " + " from altabaja a " + " left join puesto_funcionario pf ON pf.id_puesto_funcionario=a.id_puesto_funcionario " + " left join tipo_cargos tc ON tc.id_tipo_cargo=pf.id_tipo_cargo" + " left join dependencias d ON d.id_cat_dep_estatales=pf.id_dependencia " // + " left join declaration de ON de.id_altabaja=a.id_altabaja " + " left join funcionarios f ON f.id_funcionario=a.id_funcionario " //+ " where "+id_puesto + Awhere + " group by f.id_funcionario " + "ORDER BY a.id_funcionario"; //out.println(ls_query); //out.println(" STATUS "); //out.println(status); lrs_res = lst_stm.executeQuery(ls_query); while (lrs_res.next()) { elementos_encontrados = true; %> <%if (estado.equals("1")){ %> <%}else if (estado.equals("1")){ %> <% }%> <% } %>
Id Nombre Dependencia Puesto Área Fecha de Inicio del CargoFecha de Fin del CargoCLAVE
<%=lrs_res.getRow()%> <%=lrs_res.getString("nombre")%> <%=lrs_res.getString("nombre_dep").toUpperCase()%> <%=lrs_res.getString("cargo")%> <%=lrs_res.getString("area")%><%=lrs_res.getString("fecha_alta")%><%=lrs_res.getDate("fecha_baja")%><%=lrs_res.getString("clave")%>
<% } catch (Exception e) { emergent_error += "Error: " + e.toString() + " Ultimo query: " + ls_query; %>
<%=emergent_error%>
<% } finally { lst_stm.close(); } } else { %>
<%=emergent_error%>
<% } if (!elementos_encontrados) { %>
<%= "No se encontraron funcionarios que coincidan con los criterios de búsqueda. "%>
<% } //Registrar en la bitácora try { String mensaje_log = new String(""); mensaje_log = "Usuario -" + session.getAttribute("username").toString() + "- desplegó lista de Declaraciones del sistema del tipo -" + request.getParameter("id_tipodeclaracion") + "- desde reportes;"; Config.GuardarLog(Integer.parseInt(session.getAttribute("id_user").toString()), mensaje_log, 3); } catch (Exception e) { } %>