Agregando JasperReports a Gestión de Clientes


En un post anterior presente una integración con Spring Boot + Thymelaf + BooStrap + MySQL.

En esta nueva versión veremos la integración de JasperReports al proyecto Gestión de Clientes.

Código Fuente:  https://github.com/joedayz/gestionclientes

JasperReports

1. Al proyecto de Gestión de Clientes le hacía falta generar reportes.  Y para eso vamos a usar la librería gratuita de código abierto JasperReports

Agregaremos en el pom.xml:



NOTA: Nos aseguramos de tener la librereia itextpdf porque vamos a generar los reportes en PDF. 

Existe también un Editor de Reportes gratuito denominado JasperSoft Studio. Para el presente post yo voy a utilizar la versión JasperSoft Studio 6.8.0.





2. En el application.properties definiremos la ruta donde se ubicarán los reportes. Estos tienen extensión jrxml y compilado extensión jasper.  En el código fuente ver la carpeta Reportes



3. Para los reportes se ha reutilizado la búsqueda de clientes y agregado en el listado la opción de exportar o generar el reporte en PDF. 


En el Thymeleaf delegamos dicha tarea a un URL de la controladora:


4. En la controladora delegamos el trabajo de generar el reporte a RepositoryService.java


NOTA: 
- Se busca que al exportar el reporte se use el File Saver de manera que el usuario decida donde guardar su archivo.
- Verifique su navegador tenga habilitada dicha opción. 




5. ReporteService.java obtiene la data del cliente y delega al Repository el trabajo de generar el reporte.



6. El ReporteRepository.java busca los reportes compilados anteriormente con JasperSoft Studio y genera el reporte necesario.


Y eso es todo.

Vídeo del Resultado Final




Enjoy!!

Joe


Share:

12 comentarios:

  1. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
    Spring boot Online Training

    ResponderBorrar
  2. The information you provided is very useful, thank you very much for sharing useful information with us. You can apply for a kenya online visa - If you are Planning a Trip to Turkey for business, tourism purpose.

    ResponderBorrar
  3. Wonderful post….. Indian visa for US citizens, This visa to India allows travellers from the United States to visit India for short term stays.

    ResponderBorrar
  4. Thanks for posting great information and the blog is very helpful. Do you know how much does an Indian e visa cost? Indian e Visa cost depends on your nationality and your visa type. You can find out more about the Indian Visa on our website.

    ResponderBorrar
  5. I learn from a good blog, your blog is a great inspiration, thank you. India visas for US citizens are available online. US citizens can apply for an Indian visa within 5 to 10 minutes. Firstly you can read all the document requirements for Indian visa for US citizens via our website then you can apply for your Indian visa.

    ResponderBorrar
  6. UnoGeeks Offers the best Oracle Fusion Financials Training in the market today. If you want to become Expert Fusion Financials Consultant, Enrol in the
    Oracle Fusion Financials Online Training offered by UnoGeeks.

    ResponderBorrar