%--
Document : frm_ver_informacion_declaraIntereses
Created on : 29/04/2016, 02:18: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 (!fecha_desde.equals("") && !fecha_hasta.equals("")){
if(!Awhere.equals("")){
Awhere+=" and (de.fecha_declaracion >='"+fecha_desde +"' and de.fecha_declaracion <='"+ fecha_hasta+"' )";
}
else{
Awhere+=" WHERE (de.fecha_declaracion>='"+fecha_desde +"' and de.fecha_declaracion<='"+ fecha_hasta+"' )";
}
}
ls_query="select count(de.id_declaracion) as total "
+ " from declaration de "
+ " left join altabaja a ON a.id_altabaja=de.id_altabaja "
+ " 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 "
+Awhere
+ " and (de.intereses=1 or de.intereses=3)";
// + " 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 Declaración de Intereses
Total <%=total_declaracion%>
<%
} 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 reportes de Declaración de Intereses del sistema - desde reportes;";
Config.GuardarLog(Integer.parseInt(session.getAttribute("id_user").toString()), mensaje_log, 3);
} catch (Exception e) {
}
%>