List of usage examples for org.apache.poi.ss.usermodel Workbook createSheet
Sheet createSheet(String sheetname);
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteProveedoresSistema() throws Exception { String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else {/*w w w . j a v a2s . co m*/ rutaArchivo = System.getProperty("user.home") + "/" + "PROVEEDORES" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("PROVEEDORES"); List<Proveedor> proveedores = administradorGeneradorReportesBO.consultarProveedoresRegistrados(); int tamtotal = 0; if (null != proveedores) { tamtotal = proveedores.size(); } for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); Proveedor proveedor = proveedores.get(f); for (int c = 0; c < 4; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("NIT_PROVEEDOR"); } else if (c == 1) { celda.setCellValue("NOMBRE_PROVEEDOR"); } else if (c == 2) { celda.setCellValue("DIRECCION"); } else if (c == 3) { celda.setCellValue("TELEFONO"); } } else { if (c == 0) { celda.setCellValue(proveedor.getNitproveedor()); } else if (c == 1) { celda.setCellValue(proveedor.getNombreproveedor()); } else if (c == 2) { celda.setCellValue(proveedor.getDireccionproveedor()); } else if (c == 3) { celda.setCellValue(proveedor.getTelefonoproveedor()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteSalasLaboratorio() throws Exception { String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else {//from www . jav a2s . c o m rutaArchivo = System.getProperty("user.home") + "/" + "SALAS_LABORATORIO" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("SALAS_LABORATORIO"); List<SalaLaboratorio> salas = administradorGeneradorReportesBO.obtenerSalasLaboratorio(); int tamtotal = 0; if (null != salas) { tamtotal = salas.size(); } for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); SalaLaboratorio sala = salas.get(f); for (int c = 0; c < 8; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("DEPARTAMENTO"); } else if (c == 1) { celda.setCellValue("LABORATORIO"); } else if (c == 2) { celda.setCellValue("NOMBRE"); } else if (c == 3) { celda.setCellValue("CODIGO"); } else if (c == 4) { celda.setCellValue("ESTADO"); } else if (c == 5) { celda.setCellValue("SEDE"); } else if (c == 6) { celda.setCellValue("EDIFICIO"); } else if (c == 7) { celda.setCellValue("UBICACION"); } } else { if (c == 0) { celda.setCellValue(sala.getLaboratorio().getDepartamento().getNombredepartamento()); } else if (c == 1) { celda.setCellValue(sala.getLaboratorio().getNombrelaboratorio()); } else if (c == 2) { celda.setCellValue(sala.getNombresala()); } else if (c == 3) { celda.setCellValue(sala.getCodigosala()); } else if (c == 4) { celda.setCellValue(sala.getStrEstado()); } else if (c == 5) { celda.setCellValue(sala.getEdificio().getSede().getNombresede()); } else if (c == 6) { celda.setCellValue(sala.getEdificio().getDescripcionedificio()); } else if (c == 7) { celda.setCellValue(sala.getPisoubicacion()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteReservasPorPeriodo() throws Exception { listaReservasGenerador = null;/*from w w w . java 2s.c om*/ String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else { rutaArchivo = System.getProperty("user.home") + "/" + "RESERVAS_POR_PERIODO" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("RESERVAS"); BigInteger idPeriodo = null; if (null != periodo) { idPeriodo = periodo.getIdperiodoacademico(); } List<ReservaModuloLaboratorio> reservamodulo = administradorGeneradorReportesBO .obtenerReservasModuloLaboratorioPorPeriodoAcademico(idPeriodo); convertirReservasModulo(reservamodulo); List<ReservaSala> reservasala = administradorGeneradorReportesBO .obtenerReservasSalaPorPeriodoAcademico(idPeriodo); convertirReservasSala(reservasala); int tamtotal = listaReservasGenerador.size(); for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); ReservasGenerador reserva = listaReservasGenerador.get(f); for (int c = 0; c < 13; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("ID_RESERVA"); } else if (c == 1) { celda.setCellValue("RESERVA"); } else if (c == 2) { celda.setCellValue("FECHA_RESERVA"); } else if (c == 3) { celda.setCellValue("HORA_RESERVA"); } else if (c == 4) { celda.setCellValue("HORA_REAL"); } else if (c == 5) { celda.setCellValue("TIPO_RESERVA"); } else if (c == 6) { celda.setCellValue("SERVICIO"); } else if (c == 7) { celda.setCellValue("LABORATORIO"); } else if (c == 8) { celda.setCellValue("SALA_LABORATORIO"); } else if (c == 9) { celda.setCellValue("ESTADO"); } else if (c == 10) { celda.setCellValue("TIPO_USUARIO"); } else if (c == 11) { celda.setCellValue("USUARIO"); } else if (c == 12) { celda.setCellValue("ID_USUARIO"); } } else { if (c == 0) { celda.setCellValue(reserva.getID_RESERVA()); } else if (c == 1) { celda.setCellValue(reserva.getRESERVA()); } else if (c == 2) { celda.setCellValue(reserva.getFECHA_RESERVA()); } else if (c == 3) { celda.setCellValue(reserva.getHORA_RESERVA()); } else if (c == 4) { celda.setCellValue(reserva.getHORA_REAL()); } else if (c == 5) { celda.setCellValue(reserva.getTIPO_RESERVA()); } else if (c == 6) { celda.setCellValue(reserva.getSERVICIO()); } else if (c == 7) { celda.setCellValue(reserva.getLABORATORIO()); } else if (c == 8) { celda.setCellValue(reserva.getSALA_LABORATORIO()); } else if (c == 9) { celda.setCellValue(reserva.getESTADO()); } else if (c == 10) { celda.setCellValue(reserva.getTIPO_USUARIO()); } else if (c == 11) { celda.setCellValue(reserva.getUSUARIO()); } else if (c == 12) { celda.setCellValue(reserva.getID_USUARIO()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteReservasPorTipoUsuario() throws Exception { listaReservasGenerador = null;/* ww w . ja v a 2s .c o m*/ String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else { rutaArchivo = System.getProperty("user.home") + "/" + "RESERVAS_POR_TIPO_USUARIO" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("RESERVAS"); List<ReservaModuloLaboratorio> reservamodulo = administradorGeneradorReportesBO .obtenerReservasModuloLaboratorioPorTipoUsuario(tipoUsuario); convertirReservasModulo(reservamodulo); List<ReservaSala> reservasala = administradorGeneradorReportesBO .obtenerReservasSalaPorTipoUsuario(tipoUsuario); convertirReservasSala(reservasala); int tamtotal = listaReservasGenerador.size(); for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); ReservasGenerador reserva = listaReservasGenerador.get(f); for (int c = 0; c < 13; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("ID_RESERVA"); } else if (c == 1) { celda.setCellValue("RESERVA"); } else if (c == 2) { celda.setCellValue("FECHA_RESERVA"); } else if (c == 3) { celda.setCellValue("HORA_RESERVA"); } else if (c == 4) { celda.setCellValue("HORA_REAL"); } else if (c == 5) { celda.setCellValue("TIPO_RESERVA"); } else if (c == 6) { celda.setCellValue("SERVICIO"); } else if (c == 7) { celda.setCellValue("LABORATORIO"); } else if (c == 8) { celda.setCellValue("SALA_LABORATORIO"); } else if (c == 9) { celda.setCellValue("ESTADO"); } else if (c == 10) { celda.setCellValue("TIPO_USUARIO"); } else if (c == 11) { celda.setCellValue("USUARIO"); } else if (c == 12) { celda.setCellValue("ID_USUARIO"); } } else { if (c == 0) { celda.setCellValue(reserva.getID_RESERVA()); } else if (c == 1) { celda.setCellValue(reserva.getRESERVA()); } else if (c == 2) { celda.setCellValue(reserva.getFECHA_RESERVA()); } else if (c == 3) { celda.setCellValue(reserva.getHORA_RESERVA()); } else if (c == 4) { celda.setCellValue(reserva.getHORA_REAL()); } else if (c == 5) { celda.setCellValue(reserva.getTIPO_RESERVA()); } else if (c == 6) { celda.setCellValue(reserva.getSERVICIO()); } else if (c == 7) { celda.setCellValue(reserva.getLABORATORIO()); } else if (c == 8) { celda.setCellValue(reserva.getSALA_LABORATORIO()); } else if (c == 9) { celda.setCellValue(reserva.getESTADO()); } else if (c == 10) { celda.setCellValue(reserva.getTIPO_USUARIO()); } else if (c == 11) { celda.setCellValue(reserva.getUSUARIO()); } else if (c == 12) { celda.setCellValue(reserva.getID_USUARIO()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteReservasPorSala() throws Exception { listaReservasGenerador = null;/* ww w .java2 s .c o m*/ String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else { rutaArchivo = System.getProperty("user.home") + "/" + "RESERVAS_POR_SALA" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("RESERVAS"); BigInteger idSala = null; if (null != salaLaboratorio) { idSala = salaLaboratorio.getIdsalalaboratorio(); } List<ReservaModuloLaboratorio> reservamodulo = administradorGeneradorReportesBO .obtenerReservasModuloLaboratorioPorSala(idSala); convertirReservasModulo(reservamodulo); List<ReservaSala> reservasala = administradorGeneradorReportesBO.obtenerReservasSalaPorSala(idSala); convertirReservasSala(reservasala); int tamtotal = listaReservasGenerador.size(); for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); ReservasGenerador reserva = listaReservasGenerador.get(f); for (int c = 0; c < 13; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("ID_RESERVA"); } else if (c == 1) { celda.setCellValue("RESERVA"); } else if (c == 2) { celda.setCellValue("FECHA_RESERVA"); } else if (c == 3) { celda.setCellValue("HORA_RESERVA"); } else if (c == 4) { celda.setCellValue("HORA_REAL"); } else if (c == 5) { celda.setCellValue("TIPO_RESERVA"); } else if (c == 6) { celda.setCellValue("SERVICIO"); } else if (c == 7) { celda.setCellValue("LABORATORIO"); } else if (c == 8) { celda.setCellValue("SALA_LABORATORIO"); } else if (c == 9) { celda.setCellValue("ESTADO"); } else if (c == 10) { celda.setCellValue("TIPO_USUARIO"); } else if (c == 11) { celda.setCellValue("USUARIO"); } else if (c == 12) { celda.setCellValue("ID_USUARIO"); } } else { if (c == 0) { celda.setCellValue(reserva.getID_RESERVA()); } else if (c == 1) { celda.setCellValue(reserva.getRESERVA()); } else if (c == 2) { celda.setCellValue(reserva.getFECHA_RESERVA()); } else if (c == 3) { celda.setCellValue(reserva.getHORA_RESERVA()); } else if (c == 4) { celda.setCellValue(reserva.getHORA_REAL()); } else if (c == 5) { celda.setCellValue(reserva.getTIPO_RESERVA()); } else if (c == 6) { celda.setCellValue(reserva.getSERVICIO()); } else if (c == 7) { celda.setCellValue(reserva.getLABORATORIO()); } else if (c == 8) { celda.setCellValue(reserva.getSALA_LABORATORIO()); } else if (c == 9) { celda.setCellValue(reserva.getESTADO()); } else if (c == 10) { celda.setCellValue(reserva.getTIPO_USUARIO()); } else if (c == 11) { celda.setCellValue(reserva.getUSUARIO()); } else if (c == 12) { celda.setCellValue(reserva.getID_USUARIO()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteReservasPorParametros() throws Exception { listaReservasGenerador = null;// w ww . ja v a 2s . c o m String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else { rutaArchivo = System.getProperty("user.home") + "/" + "RESERVAS_POR_PARAMETROS" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("RESERVAS"); if (0 == tipoReserva) { List<ReservaModuloLaboratorio> reservamodulo = administradorGeneradorReportesBO .obtenerReservasModuloLaboratorioPorFechas(fechaInicio, fechaFin); convertirReservasModulo(reservamodulo); List<ReservaSala> reservasala = administradorGeneradorReportesBO .obtenerReservasSalaPorFechas(fechaInicio, fechaFin); convertirReservasSala(reservasala); } else { if (tipoReserva == 1) { List<ReservaModuloLaboratorio> reservamodulo = administradorGeneradorReportesBO .obtenerReservasModuloLaboratorioPorFechas(fechaInicio, fechaFin); convertirReservasModulo(reservamodulo); } else { List<ReservaSala> reservasala = administradorGeneradorReportesBO .obtenerReservasSalaPorFechas(fechaInicio, fechaFin); convertirReservasSala(reservasala); } } int tamtotal = listaReservasGenerador.size(); for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); ReservasGenerador reserva = listaReservasGenerador.get(f); for (int c = 0; c < 13; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("ID_RESERVA"); } else if (c == 1) { celda.setCellValue("RESERVA"); } else if (c == 2) { celda.setCellValue("FECHA_RESERVA"); } else if (c == 3) { celda.setCellValue("HORA_RESERVA"); } else if (c == 4) { celda.setCellValue("HORA_REAL"); } else if (c == 5) { celda.setCellValue("TIPO_RESERVA"); } else if (c == 6) { celda.setCellValue("SERVICIO"); } else if (c == 7) { celda.setCellValue("LABORATORIO"); } else if (c == 8) { celda.setCellValue("SALA_LABORATORIO"); } else if (c == 9) { celda.setCellValue("ESTADO"); } else if (c == 10) { celda.setCellValue("TIPO_USUARIO"); } else if (c == 11) { celda.setCellValue("USUARIO"); } else if (c == 12) { celda.setCellValue("ID_USUARIO"); } } else { if (c == 0) { celda.setCellValue(reserva.getID_RESERVA()); } else if (c == 1) { celda.setCellValue(reserva.getRESERVA()); } else if (c == 2) { celda.setCellValue(reserva.getFECHA_RESERVA()); } else if (c == 3) { celda.setCellValue(reserva.getHORA_RESERVA()); } else if (c == 4) { celda.setCellValue(reserva.getHORA_REAL()); } else if (c == 5) { celda.setCellValue(reserva.getTIPO_RESERVA()); } else if (c == 6) { celda.setCellValue(reserva.getSERVICIO()); } else if (c == 7) { celda.setCellValue(reserva.getLABORATORIO()); } else if (c == 8) { celda.setCellValue(reserva.getSALA_LABORATORIO()); } else if (c == 9) { celda.setCellValue(reserva.getESTADO()); } else if (c == 10) { celda.setCellValue(reserva.getTIPO_USUARIO()); } else if (c == 11) { celda.setCellValue(reserva.getUSUARIO()); } else if (c == 12) { celda.setCellValue(reserva.getID_USUARIO()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteReservasPorIdUsuario() throws Exception { listaReservasGenerador = null;/*from w ww . j a va 2s . c o m*/ String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else { rutaArchivo = System.getProperty("user.home") + "/" + "RESERVAS_POR_USUARIO" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("RESERVAS"); List<ReservaModuloLaboratorio> reservamodulo = administradorGeneradorReportesBO .obtenerReservasModuloLaboratorioPorUsuario(idUsuario); convertirReservasModulo(reservamodulo); List<ReservaSala> reservasala = administradorGeneradorReportesBO.obtenerReservasSalaPorUsuario(idUsuario); convertirReservasSala(reservasala); int tamtotal = listaReservasGenerador.size(); for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); ReservasGenerador reserva = listaReservasGenerador.get(f); for (int c = 0; c < 13; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("ID_RESERVA"); } else if (c == 1) { celda.setCellValue("RESERVA"); } else if (c == 2) { celda.setCellValue("FECHA_RESERVA"); } else if (c == 3) { celda.setCellValue("HORA_RESERVA"); } else if (c == 4) { celda.setCellValue("HORA_REAL"); } else if (c == 5) { celda.setCellValue("TIPO_RESERVA"); } else if (c == 6) { celda.setCellValue("SERVICIO"); } else if (c == 7) { celda.setCellValue("LABORATORIO"); } else if (c == 8) { celda.setCellValue("SALA_LABORATORIO"); } else if (c == 9) { celda.setCellValue("ESTADO"); } else if (c == 10) { celda.setCellValue("TIPO_USUARIO"); } else if (c == 11) { celda.setCellValue("USUARIO"); } else if (c == 12) { celda.setCellValue("ID_USUARIO"); } } else { if (c == 0) { celda.setCellValue(reserva.getID_RESERVA()); } else if (c == 1) { celda.setCellValue(reserva.getRESERVA()); } else if (c == 2) { celda.setCellValue(reserva.getFECHA_RESERVA()); } else if (c == 3) { celda.setCellValue(reserva.getHORA_RESERVA()); } else if (c == 4) { celda.setCellValue(reserva.getHORA_REAL()); } else if (c == 5) { celda.setCellValue(reserva.getTIPO_RESERVA()); } else if (c == 6) { celda.setCellValue(reserva.getSERVICIO()); } else if (c == 7) { celda.setCellValue(reserva.getLABORATORIO()); } else if (c == 8) { celda.setCellValue(reserva.getSALA_LABORATORIO()); } else if (c == 9) { celda.setCellValue(reserva.getESTADO()); } else if (c == 10) { celda.setCellValue(reserva.getTIPO_USUARIO()); } else if (c == 11) { celda.setCellValue(reserva.getUSUARIO()); } else if (c == 12) { celda.setCellValue(reserva.getID_USUARIO()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteEquiposdeTrabajo() throws Exception { String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else {/*w w w .java 2 s .c o m*/ rutaArchivo = System.getProperty("user.home") + "/" + "EQUIPOS_DE_TRABAJO" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("EQUIPOS DE TRABAJO"); List<EquipoElemento> equipos = administradorGeneradorReportesBO.consultarEquiposdeTrabajoRegistrados(); int tamtotal = 0; if (null != equipos) { tamtotal = equipos.size(); } for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); EquipoElemento equipo = equipos.get(f); for (int c = 0; c < 13; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("NOMBRE_EQUIPO"); } else if (c == 1) { celda.setCellValue("CODIGO_EQUIPO"); } else if (c == 2) { celda.setCellValue("MARCA"); } else if (c == 3) { celda.setCellValue("MODELO"); } else if (c == 4) { celda.setCellValue("SERIE"); } else if (c == 5) { celda.setCellValue("CANTIDAD"); } else if (c == 6) { celda.setCellValue("TIPO_ACTIVO"); } else if (c == 7) { celda.setCellValue("PROVEEDOR"); } else if (c == 8) { celda.setCellValue("NIT_PROVEEDOR"); } else if (c == 9) { celda.setCellValue("LABORATORIO"); } else if (c == 10) { celda.setCellValue("SALA_LABORATORIO"); } else if (c == 11) { celda.setCellValue("MODULO_LABORATORIO"); } else if (c == 12) { celda.setCellValue("ESTADO_EQUIPO"); } } else { if (c == 0) { celda.setCellValue(equipo.getNombreequipo()); } else if (c == 1) { celda.setCellValue(equipo.getInventarioequipo()); } else if (c == 2) { celda.setCellValue(equipo.getMarcaequipo()); } else if (c == 3) { celda.setCellValue(equipo.getModeloequipo()); } else if (c == 4) { celda.setCellValue(equipo.getSeriequipo()); } else if (c == 5) { celda.setCellValue(equipo.getCantidadequipo()); } else if (c == 6) { celda.setCellValue(equipo.getTipoactivo().getNombretipoactivo()); } else if (c == 7) { celda.setCellValue(equipo.getProveedor().getNombreproveedor()); } else if (c == 8) { celda.setCellValue(equipo.getProveedor().getNitproveedor()); } else if (c == 9) { celda.setCellValue(equipo.getModulolaboratorio().getSalalaboratorio().getLaboratorio() .getNombrelaboratorio()); } else if (c == 10) { celda.setCellValue(equipo.getModulolaboratorio().getSalalaboratorio().getNombresala()); } else if (c == 11) { celda.setCellValue(equipo.getModulolaboratorio().getDetallemodulo()); } else if (c == 12) { celda.setCellValue(equipo.getEstadoequipo().getNombreestadoequipo()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteModulosLaboratorio() throws Exception { String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else {/* w ww . jav a 2 s. c o m*/ rutaArchivo = System.getProperty("user.home") + "/" + "MODULOS_LABORATORIO_REGISTRADOS" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("MODULOS_REGISTRADOS"); List<ModuloLaboratorio> modulos = administradorGeneradorReportesBO.consultarModuloLaboratorioRegistrados(); int tamtotal = 0; if (null != modulos) { tamtotal = modulos.size(); } for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); ModuloLaboratorio modulo = modulos.get(f); for (int c = 0; c < 7; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("CODIGO_MODULO"); } else if (c == 1) { celda.setCellValue("NOMBRE"); } else if (c == 2) { celda.setCellValue("ESTADO"); } else if (c == 3) { celda.setCellValue("CAPACIDAD"); } else if (c == 4) { celda.setCellValue("COSTO_ALQUILER"); } else if (c == 5) { celda.setCellValue("SALA_LABORATORIO"); } else if (c == 6) { celda.setCellValue("LABORATORIO"); } } else { if (c == 0) { celda.setCellValue(modulo.getCodigomodulo()); } else if (c == 1) { celda.setCellValue(modulo.getDetallemodulo()); } else if (c == 2) { celda.setCellValue(modulo.getStrEstado()); } else if (c == 3) { celda.setCellValue(modulo.getCapacidadmodulo()); } else if (c == 4) { celda.setCellValue(modulo.getCostoalquiler().toString()); } else if (c == 5) { celda.setCellValue(modulo.getSalalaboratorio().getNombresala()); } else if (c == 6) { celda.setCellValue(modulo.getSalalaboratorio().getLaboratorio().getNombrelaboratorio()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }
From source file:com.sirelab.controller.reportes.ControllerGeneradorReportes.java
public void reporteComponentes() throws Exception { String rutaArchivo = ""; if (validarNombreReporte()) { rutaArchivo = System.getProperty("user.home") + "/" + nombreReporte + ".xls"; } else {//w w w .ja v a2s. c om rutaArchivo = System.getProperty("user.home") + "/" + "COMPONENTES_REGISTRADOS" + ".xls"; } File archivoXLS = new File(rutaArchivo); if (archivoXLS.exists()) { archivoXLS.delete(); } archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("COMPONENTES"); List<ComponenteEquipo> componentes = administradorGeneradorReportesBO.consultarComponentesRegistrados(); int tamtotal = 0; if (null != componentes) { tamtotal = componentes.size(); } for (int f = 0; f < tamtotal; f++) { Row fila = hoja.createRow(f); ComponenteEquipo componente = componentes.get(f); for (int c = 0; c < 12; c++) { Cell celda = fila.createCell(c); if (f == 0) { if (c == 0) { celda.setCellValue("CODIGO_COMPONENTE"); } else if (c == 1) { celda.setCellValue("NOMBRE_COMPONENTE"); } else if (c == 2) { celda.setCellValue("DESCRIPCION_COMPONENTE"); } else if (c == 3) { celda.setCellValue("MARCA_COMPONENTE"); } else if (c == 4) { celda.setCellValue("MODELO_COMPONENTE"); } else if (c == 5) { celda.setCellValue("SERIAL_COMPONENTE"); } else if (c == 6) { celda.setCellValue("TIPO_COMPONENTE_COMPONENTE"); } else if (c == 7) { celda.setCellValue("ESTADO_COMPONENTE"); } else if (c == 8) { celda.setCellValue("CODIGO_EQUIPO_TRABAJO"); } else if (c == 9) { celda.setCellValue("EQUIPO_TRABAJO"); } else if (c == 10) { celda.setCellValue("CODIGO_MODULO_LABORATORIO"); } else if (c == 11) { celda.setCellValue("MODULO_LABORATORIO"); } else if (c == 12) { celda.setCellValue("SALA_LABORATORIO"); } else if (c == 13) { celda.setCellValue("LABORATORIO"); } } else { if (c == 0) { celda.setCellValue(componente.getCodigocomponete()); } else if (c == 1) { celda.setCellValue(componente.getNombrecomponente()); } else if (c == 2) { celda.setCellValue(componente.getDescripcioncomponente()); } else if (c == 3) { celda.setCellValue(componente.getMarcacomponente()); } else if (c == 4) { celda.setCellValue(componente.getModelocomponente()); } else if (c == 5) { celda.setCellValue(componente.getSerialcomponente()); } else if (c == 6) { celda.setCellValue(componente.getTipocomponente().getNombretipo()); } else if (c == 7) { celda.setCellValue(componente.getStrEstado()); } else if (c == 8) { celda.setCellValue(componente.getEquipoelemento().getInventarioequipo()); } else if (c == 9) { celda.setCellValue(componente.getEquipoelemento().getNombreequipo()); } else if (c == 10) { celda.setCellValue(componente.getEquipoelemento().getModulolaboratorio().getCodigomodulo()); } else if (c == 11) { celda.setCellValue( componente.getEquipoelemento().getModulolaboratorio().getDetallemodulo()); } else if (c == 12) { celda.setCellValue(componente.getEquipoelemento().getModulolaboratorio() .getSalalaboratorio().getNombresala()); } else if (c == 13) { celda.setCellValue(componente.getEquipoelemento().getModulolaboratorio() .getSalalaboratorio().getLaboratorio().getNombrelaboratorio()); } } } } libro.write(archivo); archivo.close(); descargarArchivo(rutaArchivo); }