Agregado informe que muestra los egresos de facturas materia prima
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
package danielcortes.xyz.controllers;
|
||||
|
||||
import danielcortes.xyz.informes.InformeEgresosFacturaMateriaPrima;
|
||||
import danielcortes.xyz.informes.InformeLibroDeVentas;
|
||||
import danielcortes.xyz.utils.StringUtils;
|
||||
import danielcortes.xyz.views.MonthSelectDialog;
|
||||
@@ -47,6 +48,7 @@ public class InformesController {
|
||||
|
||||
private void setupViewEvents() {
|
||||
this.view.getInformeLibroDeVentasButton().addActionListener(e -> generarInformeLibroDeVentasListener());
|
||||
this.view.getGenerarEgresosFacturasMateriaPrimaButton().addActionListener(e -> generarInformeEgresosFacturasMateriaPrima());
|
||||
}
|
||||
|
||||
private void generarInformeLibroDeVentasListener() {
|
||||
@@ -60,8 +62,27 @@ public class InformesController {
|
||||
File saveFile = askForFile("Libro " + capitalized);
|
||||
|
||||
if (saveFile != null) {
|
||||
InformeLibroDeVentas informeLibroDeVentas = new InformeLibroDeVentas(month, saveFile);
|
||||
File generatedFile = informeLibroDeVentas.generarInforme();
|
||||
InformeLibroDeVentas informe = new InformeLibroDeVentas(month, saveFile);
|
||||
File generatedFile = informe.generarInforme();
|
||||
|
||||
this.showConfirmation(generatedFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void generarInformeEgresosFacturasMateriaPrima() {
|
||||
LocalDate month = askForMonth();
|
||||
if (month != null) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM YYYY");
|
||||
|
||||
String formatedName = month.format(formatter);
|
||||
String capitalized = StringUtils.toUpperCase(formatedName);
|
||||
|
||||
File saveFile = askForFile("Egresos Materia Prima " + capitalized);
|
||||
|
||||
if (saveFile != null) {
|
||||
InformeEgresosFacturaMateriaPrima informe = new InformeEgresosFacturaMateriaPrima(month, saveFile);
|
||||
File generatedFile = informe.generarInforme();
|
||||
|
||||
this.showConfirmation(generatedFile);
|
||||
}
|
||||
@@ -97,7 +118,7 @@ public class InformesController {
|
||||
private void showConfirmation(File file) {
|
||||
int result = JOptionPane.showConfirmDialog(
|
||||
this.view.getContentPanel(),
|
||||
"El informe se a generado\n" +
|
||||
"El informes se a generado\n" +
|
||||
"¿Desea abrirlo?",
|
||||
"Confirmacion",
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
|
||||
Reference in New Issue
Block a user