diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 8e8340e..576b8b3 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,10 +10,16 @@
-
-
-
+
+
+
+
+
+
+
+
+
@@ -77,13 +83,15 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -153,8 +161,6 @@
@@ -231,6 +239,7 @@
+
@@ -248,7 +257,6 @@
-
@@ -267,11 +275,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -285,7 +323,7 @@
-
+
@@ -510,6 +548,9 @@
+
+
+
1545280618093
@@ -830,7 +871,7 @@
-
+
@@ -845,7 +886,7 @@
-
+
@@ -1003,87 +1044,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1182,40 +1144,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1241,20 +1174,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1272,13 +1193,7 @@
-
-
-
-
-
-
-
+
@@ -1290,23 +1205,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1339,13 +1237,7 @@
-
-
-
-
-
-
-
+
@@ -1367,34 +1259,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1578,13 +1444,81 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dist/caja.jar b/dist/caja.jar
index cd3fa78..75307c6 100644
Binary files a/dist/caja.jar and b/dist/caja.jar differ
diff --git a/src/danielcortes/xyz/controllers/InformesController.java b/src/danielcortes/xyz/controllers/InformesController.java
index fec9c92..eaac40e 100644
--- a/src/danielcortes/xyz/controllers/InformesController.java
+++ b/src/danielcortes/xyz/controllers/InformesController.java
@@ -24,8 +24,9 @@
package danielcortes.xyz.controllers;
-import danielcortes.xyz.informes.InformeMensual;
-import danielcortes.xyz.views.InformeMensualDialog;
+import danielcortes.xyz.informes.InformeLibroDeVentas;
+import danielcortes.xyz.utils.StringUtils;
+import danielcortes.xyz.views.MonthSelectDialog;
import danielcortes.xyz.views.InformesView;
import javax.swing.*;
@@ -45,33 +46,32 @@ public class InformesController {
}
private void setupViewEvents() {
- this.view.getInformeMensualButton().addActionListener(e -> generarInformeMensualListener());
+ this.view.getInformeLibroDeVentasButton().addActionListener(e -> generarInformeLibroDeVentasListener());
}
- private void generarInformeMensualListener() {
+ private void generarInformeLibroDeVentasListener() {
LocalDate month = askForMonth();
- if (month == null) {
- return;
+ if (month != null) {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM YYYY");
+
+ String formatedName = month.format(formatter);
+ String capitalized = StringUtils.toUpperCase(formatedName);
+
+ File saveFile = askForFile("Libro " + capitalized);
+
+ if (saveFile != null) {
+ InformeLibroDeVentas informeLibroDeVentas = new InformeLibroDeVentas(month, saveFile);
+ File generatedFile = informeLibroDeVentas.generarInforme();
+
+ this.showConfirmation(generatedFile);
+ }
}
-
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM YYYY");
- String formatedName = month.format(formatter);
- String capitalized = formatedName.substring(0, 1).toUpperCase() + formatedName.substring(1);
- File saveFile = askForFile("Informe " + capitalized);
- if (saveFile == null) {
- return;
- }
-
- InformeMensual informeMensual = new InformeMensual(month, saveFile);
- File generatedFile = informeMensual.generarInforme();
-
- this.showConfirmation(generatedFile);
}
private LocalDate askForMonth() {
- InformeMensualDialog informeMensualDialog = new InformeMensualDialog(this.view.getContentPanel());
- if (informeMensualDialog.isAcepted()) {
- return informeMensualDialog.getMonth();
+ MonthSelectDialog monthSelectDialog = new MonthSelectDialog(this.view.getContentPanel());
+ if (monthSelectDialog.isAcepted()) {
+ return monthSelectDialog.getMonth();
} else {
return null;
}
diff --git a/src/danielcortes/xyz/informes/InformeMensual.java b/src/danielcortes/xyz/informes/InformeLibroDeVentas.java
similarity index 99%
rename from src/danielcortes/xyz/informes/InformeMensual.java
rename to src/danielcortes/xyz/informes/InformeLibroDeVentas.java
index 05e082f..0373f39 100644
--- a/src/danielcortes/xyz/informes/InformeMensual.java
+++ b/src/danielcortes/xyz/informes/InformeLibroDeVentas.java
@@ -40,7 +40,7 @@ import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
-public class InformeMensual {
+public class InformeLibroDeVentas {
private final String[] titles = {
"", "",
"BOLETA MANUAL", "", "",
@@ -74,7 +74,7 @@ public class InformeMensual {
private CreationHelper createHelper;
private HashMap styles;
- public InformeMensual(LocalDate date, File saveFile) {
+ public InformeLibroDeVentas(LocalDate date, File saveFile) {
new SQLiteCajaDAO().createCajasForMonth(date);
this.informe = new ArrayList<>(new SQLiteInformeMensualContentDAO().getInformeMensual(date));
diff --git a/src/danielcortes/xyz/utils/StringUtils.java b/src/danielcortes/xyz/utils/StringUtils.java
new file mode 100644
index 0000000..d6d54d1
--- /dev/null
+++ b/src/danielcortes/xyz/utils/StringUtils.java
@@ -0,0 +1,31 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2018-2019 Daniel Cortes
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package danielcortes.xyz.utils;
+
+public class StringUtils {
+ public static String toUpperCase(String string){
+ return string.substring(0, 1).toUpperCase() + string.substring(1);
+ }
+}
diff --git a/src/danielcortes/xyz/views/InformesView.form b/src/danielcortes/xyz/views/InformesView.form
index 2245c8e..54577d4 100644
--- a/src/danielcortes/xyz/views/InformesView.form
+++ b/src/danielcortes/xyz/views/InformesView.form
@@ -1,6 +1,6 @@
-
-
-
-
-
@@ -61,6 +56,11 @@
+
+
+
+
+
diff --git a/src/danielcortes/xyz/views/InformesView.java b/src/danielcortes/xyz/views/InformesView.java
index ec0221c..8abed20 100644
--- a/src/danielcortes/xyz/views/InformesView.java
+++ b/src/danielcortes/xyz/views/InformesView.java
@@ -39,7 +39,7 @@ public class InformesView {
return contentPanel;
}
- public JButton getInformeMensualButton() {
+ public JButton getInformeLibroDeVentasButton() {
return informeMensualButton;
}
@@ -59,26 +59,26 @@ public class InformesView {
*/
private void $$$setupUI$$$() {
contentPanel = new JPanel();
- contentPanel.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
+ contentPanel.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
final JPanel panel1 = new JPanel();
- panel1.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
+ panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
contentPanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Informes"));
informeMensualButton = new JButton();
- informeMensualButton.setText("Informe Mensual");
+ informeMensualButton.setText("Libro de Ventas Mensual");
panel1.add(informeMensualButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
- final Spacer spacer1 = new Spacer();
- panel1.add(spacer1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
contentPanel.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
- final Spacer spacer2 = new Spacer();
- panel2.add(spacer2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+ final Spacer spacer1 = new Spacer();
+ panel2.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
contentPanel.add(panel3, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+ final Spacer spacer2 = new Spacer();
+ panel3.add(spacer2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final Spacer spacer3 = new Spacer();
- panel3.add(spacer3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+ contentPanel.add(spacer3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
}
/**
diff --git a/src/danielcortes/xyz/views/InformeMensualDialog.form b/src/danielcortes/xyz/views/MonthSelectDialog.form
similarity index 98%
rename from src/danielcortes/xyz/views/InformeMensualDialog.form
rename to src/danielcortes/xyz/views/MonthSelectDialog.form
index c249f10..78eac42 100644
--- a/src/danielcortes/xyz/views/InformeMensualDialog.form
+++ b/src/danielcortes/xyz/views/MonthSelectDialog.form
@@ -1,5 +1,5 @@
-