Skip to content

Instantly share code, notes, and snippets.

View HashRaygoza's full-sized avatar

David Raygoza Gómez HashRaygoza

View GitHub Profile
@HashRaygoza
HashRaygoza / index.js
Created May 22, 2020 21:04
Módulo que inicializa los botones
import { Contador } from "./modulos/contador.js";
import { Separador } from "./modulos/separador.js";
var areaTexto = document.getElementById("salida");
console.log(areaTexto === undefined);
var accionContador = new Contador(areaTexto);
var accionSeparador = new Separador(areaTexto);
var botonIncrementar = document.getElementById("botonContador");
@HashRaygoza
HashRaygoza / separador.js
Created May 22, 2020 21:03
Clase separador en forma de módulo
class Separador {
constructor(tArea) {
this.areaTexto = tArea;
}
separadorMas() {
var texto = this.areaTexto.value;
texto = texto + "++++++++++" + "\n";
@HashRaygoza
HashRaygoza / contador.js
Created May 22, 2020 21:01
Clase contador.js en forma de módulo
class Contador {
constructor(tArea) {
this.conteo = 0;
this.texto = tArea;
}
incrementar() {
console.log("Incrementar");
this.conteo++;
@HashRaygoza
HashRaygoza / App.java
Created May 9, 2020 19:37
Clase principal del generador de reportes
package mx.ticom.autoreporte;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import mx.ticom.autoreporte.dao.EmpleadosDAO;
package mx.ticom.autoreporte.reporte;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.util.ArrayList;
package mx.ticom.autoreporte.dao;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import mx.ticom.autoreporte.vo.DatosReporteEmpleados;
public class EmpleadosDAO {
package mx.ticom.autoreporte.dao;
import java.math.BigDecimal;
import java.math.MathContext;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import mx.ticom.autoreporte.vo.DatosReporteProductos;
@HashRaygoza
HashRaygoza / DatosReporteProductos.java
Created May 9, 2020 19:33
Datos del reporte de productos
package mx.ticom.autoreporte.vo;
import java.math.BigDecimal;
import java.util.Date;
import mx.ticom.autoreporte.anotaciones.ColumnaReporte;
public class DatosReporteProductos {
@ColumnaReporte(nombreColumna="Fecha del producto")
private Date fecha;
@HashRaygoza
HashRaygoza / DatosReporteEmpleados.java
Created May 9, 2020 19:33
Datos del reporte de empleados
package mx.ticom.autoreporte.vo;
import java.util.Date;
import mx.ticom.autoreporte.anotaciones.ColumnaReporte;
public class DatosReporteEmpleados {
@ColumnaReporte(nombreColumna="Fecha del contrato")
private Date fechaContrato;
@ColumnaReporte(nombreColumna="Nombre del Empleado")
@HashRaygoza
HashRaygoza / agregarDatos.java
Created May 9, 2020 19:30
Agrega datos a una fila de Excel
protected <TipoGenerico> void agregarDatos(Row fila, TipoGenerico dato) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
Class clase = dato.getClass();
Field[] campos = clase.getDeclaredFields();
int numCelda = 0;
for (Field campo : campos) {
ColumnaReporte columna = campo.getAnnotation(ColumnaReporte.class);
Cell celda = fila.createCell(numCelda);
if (columna != null) {