Reportes de Declaraciones
<%
out.println("");
String nompag[] = request.getRequestURI().split("/");
/********************** tomo el formato de la fecha *************************/
SimpleDateFormat formato = new SimpleDateFormat("dd");
// SimpleDateFormat format0 = new SimpleDateFormat("yyyy");
//Date hoy = new Date();
//String fecha_hoy = format0.format(hoy);
%>
<%
//Conexion c = null;
//Connection lc_connection = null;
ResultSet lrs_res = null;
ResultSet lrs_res1 = null;
Statement lst_stm = null;
Statement lst_stm1 = null;
/*INICIO. Segunda Conexión*/
ConexionDeclaranet cd = null;
Connection lcd_connection = null;
/*FIN. SEGUNDA CONEXIÓN*/
boolean lb_connection = true;
//Connection lcnt_con = null;
String debug = new String("si");
String emergent_error = new String("");
//String nompag[] = request.getRequestURI().split("/");
String ruta = new String("");
String ruta_archivos = new String("");
String ruta_imagen = new String("");
String ruta_imagen1 = new String("");
String ls_query = "";
Date fechahoy = new Date();
String nombre_jrxml = new String("");
SimpleDateFormat formato1 = new SimpleDateFormat("yyyy");
SimpleDateFormat formato2 = new SimpleDateFormat("MMMM");
String Fecha = "";
String ruta_archivos_exportar = new String("");
String nombre_archivo = new String("");
String parrafo1 = "";
String parrafo2 = "";
String parrafo3 = "";
String parrafo4 = "";
/********* 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();
lst_stm1 = lcd_connection.createStatement();
lb_connection = true;
}catch (Exception e) {
emergent_error = "Error al conectarse a la base de datos 2 ";
if (debug.equals("si")) {
emergent_error += e;
}
lb_connection = false;
}
/**********FIN. CONEXIÓN A LA BASE DE DATOS*******/
if (lb_connection) {
try {
// Creando ruta de archivos fisica
try {
java.net.URL url_clase = Conexion.class.getResource("");
ruta = url_clase.getPath().substring(0, url_clase.getPath().indexOf("WEB-INF"));
int hli_vacio = 0;
String ls_path = "";
// Eliminar los espacios en la ruta (%20)
hli_vacio = ruta.indexOf("%20");
if (hli_vacio > 0) {
ls_path = ruta.substring(0, hli_vacio);
while (hli_vacio < ruta.length() && hli_vacio > 0) {
ls_path = ls_path + " " + ruta.substring(hli_vacio + 3, ruta.length());
hli_vacio = ruta.indexOf("%20", hli_vacio + 1);
if (hli_vacio == -1) {
ruta = ls_path;
break;
}
ls_path = ls_path.substring(0, hli_vacio - 2);
}
}
} catch (Exception e) {
emergent_error += " Error al obtener la ruta física para almacenar el achivo: ";
if (debug.equals("si")) {
emergent_error += e;
}
throw new Exception(e.toString());
}
////////termina la creacion de la ruta fisica
ruta_imagen = ruta + "medios/imagenes/";
ruta_imagen1 = ruta + "medios/tema/";
ruta_archivos = ruta + "declarantes/reportes/reportes_pdf/";
ruta_archivos_exportar = ruta + "declarantes/reportes/reportes_pdf/pdfs/";
nombre_archivo = "convenio";
String ruta_jasper = ruta_archivos + "jaspers/";
/**********Parametros**************/
Map params = new HashMap();
//params.put("mich", ruta_imagen + "/michoacan.png");
params.put("escudo", ruta_imagen1 + "/banner.png");
nombre_jrxml = ruta_archivos + "jaspers/convenio1.jrxml";
ls_query="select "
+ "CONCAT('C. ', nombre,' ',ap_paterno,' ',ap_materno,' ') AS nombre, "
+ "ifnull(f.rfc, '') as rfc, f.id_usuarios, "
+ "UPPER(CONCAT(do.calle, ' # ', do.num, ', COLONIA ', do.col, ', EN LOCALIDAD DE ', do.cd, ' EN EL MUNICIPIO DE ', m.nombre_municipio, ', ', edo.nombre_estado)) as domicilio, "
+ "UPPER(CONCAT(tc.cargo,' DE ', pf.area,' EN LA DEPENDENCIA U ORGANISMO ', dep.nombre_dep)) as dependencia "
+ "from altabaja a "
+ "left join funcionarios f ON f.id_funcionario=a.id_funcionario "
+ "left join domicilios do ON do.id_funcionario=a.id_funcionario "
+ "left join estados edo on edo.id_estado=do.id_edo "
+ "left join municipios m on m.id_municipio=do.id_municipio "
+ "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 dep on dep.id_cat_dep_estatales=pf.id_dependencia "
+ "where do.tipo=1 and a.status=1 and a.id_funcionario="+request.getParameter("id_funcionario") +" limit 1;";
// }
try {
lrs_res = lst_stm.executeQuery(ls_query);
//out.println(lst_stm);
if (lrs_res.next()) {
usuarios.select_usuarios(lrs_res.getInt("id_usuarios"));
parrafo1 = lrs_res.getString("nombre")+" A QUIEN EN LO SUCESIVO SE LE DENOMINARÁ \"EL SERVIDOR PÚBLICO\", QUIENES CELEBRAN "
+ "EL PRESENTE Y SE SUJETAN AL TENOR DE LAS SIGUIENTES "
+ "DECLARACIONES Y SUBSECUENTES CLÁUSULAS:";
parrafo2="II.I. LLAMARSE COMO HA QUEDADO ESCRITO, DE NACIONALIDAD MEXICANA, MAYOR DE EDAD, CON REGISTRO FEDERAL DE CONTRIBUYENTES NÚMERO "
+ lrs_res.getString("rfc")+" QUIEN EN ESTOS MOMENTOS PRESENTA DOCUMENTO OFICIAL DE IDENTIFICACIÓN, CONSISTENTE EN CREDENCIAL DE ELECTOR FOLIO NUMERO "
+ usuarios.getIfe()+" EN PLENO EJERCICIO DE SUS DERECHOS, CON DOMICILIO UBICADO EN "
+ lrs_res.getString("domicilio")+" Y SEÑALANDO PARA EFECTOS DE COMUNICACIÓN QUE SE CONSIDEREN PERTINENTES LA DIRECCIÓN DE CORREO ELECTRÓNICO: "
+ usuarios.getEmail()+" ";
parrafo3 = "II.II DESEMPEÑARSE COMO SERVIDOR PÚBLICO DE LA ADMINISTRACIÓN DEL GOBIERNO DEL ESTADO DE MICHOACÁN Y QUE A LA FECHA DE SUSCRIPCIÓN DEL PRESENTE CONVENIO SE DESEMPEÑA COMO "
+" "+ lrs_res.getString("dependencia")
+" Y ESTÁ OBLIGADO A ENTERAR DECLARACIÓN DE SITUACIÓN PATRIMONIAL EN LOS TÉRMINOS DE LA LEY DE RESPONSABILIDADES DE LOS SERVIDORES PÚBLICOS DEL ESTADO DE MICHOACÁN DE OCAMPO.";
parrafo4 = lrs_res.getString("nombre");
Fecha = formato.format(usuarios.getFecha_inicio())+" DÍAS DEL MES DE "+formato2.format(usuarios.getFecha_inicio()) +" DEL AÑO "+formato1.format(usuarios.getFecha_inicio())+".";
params.put("parrafo1", parrafo1);
params.put("parrafo2", parrafo2);
params.put("parrafo3", parrafo3);
params.put("parrafo4", parrafo4);
params.put("SUBREPORT_DIR", ruta_jasper);
params.put("fecha", Fecha.toUpperCase());
//out.println("Entro");
nombre_archivo += ".pdf";
%>
Generando reporte, espere por favor...
<%
//JasperReport reporte = (JasperReport) JRLoader.loadObject(ruta_jasper + "/convenio1.jasper");////ruta donde se encuentra el reporte local
//JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, params, lcd_connection);
//JasperExportManager.exportReportToPdfFile(jasperPrint, ruta_archivos_exportar + nombre_archivo);///pdf
JasperDesign jasperDesign = JRXmlLoader.load(nombre_jrxml);
JRDesignQuery query = new JRDesignQuery();
query.setText(ls_query);
jasperDesign.setQuery(query);
JasperReport reporte = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, params, lcd_connection);
JasperExportManager.exportReportToPdfFile(jasperPrint, ruta_archivos_exportar + nombre_archivo);
//out.println(ruta+"declarantes/reportes/reportes_pdf/pdfs/"+nombre_archivo);
out.println(" ");
} else {
%>
Lo sentimos pero su selección, no regreso ningún resultado. Verifique la información. Agregue la información faltante.
<% }
%>
<%
} catch (Exception e) {
%>
<%="Error al crear reporte de Declaraciones. Error: " + e%>