Nuevo informe!!

Se me olvido hacer check-out a una nueva branch, I tried :c
This commit is contained in:
Daniel Cortes
2019-03-15 23:55:20 -03:00
parent 7adffc835e
commit ada25ed373
7 changed files with 441 additions and 8 deletions

View File

@@ -27,6 +27,8 @@ package danielcortes.xyz.controllers;
import danielcortes.xyz.data.Configuration;
import danielcortes.xyz.informes.InformeEgresosToExcel;
import danielcortes.xyz.informes.InformeLibroDeVentasToExcel;
import danielcortes.xyz.informes.InformeResumenArqueo;
import danielcortes.xyz.informes.InformeResumenArqueoToExcel;
import danielcortes.xyz.models.tipo_egreso.TipoEgreso;
import danielcortes.xyz.utils.SaveFile;
import danielcortes.xyz.utils.StringUtils;
@@ -58,6 +60,8 @@ public class InformesSideBarController {
.addActionListener(e -> generarInformeLibroDeVentasListener());
this.view.getGenerarEgresosFacturasMateriaPrimaButton()
.addActionListener(e -> generarInformeEgresosListener());
this.view.getGenerarResumenArqueoButton()
.addActionListener(e -> generarInformeResumenArqueoListener());
}
private void generarInformeLibroDeVentasListener() {
@@ -112,4 +116,30 @@ public class InformesSideBarController {
new InformeGeneratedConfirmation(saveFile).execute();
}
private void generarInformeResumenArqueoListener() {
System.out.println("Executed");
YearMonth mes = new MonthSelectDialog().execute();
if (mes == null) {
return;
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM yyyy");
String formatedName = mes.format(formatter);
String capitalized = StringUtils.capitalize(formatedName);
Path saveFile = new XLSFileChooser(
Configuration.get("base_save_directory") + "Resumen Arqueo" + capitalized).execute();
if (saveFile == null) {
return;
}
InformeResumenArqueo informe = InformeResumenArqueo.generate(mes);
Workbook wb = new InformeResumenArqueoToExcel(informe).generarInforme();
SaveFile.save(wb, saveFile);
new InformeGeneratedConfirmation(saveFile).execute();
System.out.println(informe);
}
}