From e8849f5db2a071e3bfefea50d80525d36e193876 Mon Sep 17 00:00:00 2001 From: Daniel Cortes Date: Fri, 28 Dec 2018 01:49:58 -0300 Subject: [PATCH] Funcionalidad de ingresar documentos en el arqueo! --- .../xyz/controllers/ArqueoController.java | 84 ++++++- .../xyz/controllers/ManagerController.java | 12 +- .../xyz/models/documentos/Documentos.java | 66 ++++++ .../xyz/models/documentos/DocumentosDAO.java | 40 ++++ .../models/documentos/MysqlDocumentosDAO.java | 223 ++++++++++++++++++ .../xyz/models/efectivo/MysqlEfectivoDAO.java | 2 +- .../danielcortes/xyz/views/ArqueoView.form | 44 +++- .../danielcortes/xyz/views/ArqueoView.java | 38 ++- 8 files changed, 483 insertions(+), 26 deletions(-) create mode 100644 src/main/java/danielcortes/xyz/models/documentos/Documentos.java create mode 100644 src/main/java/danielcortes/xyz/models/documentos/DocumentosDAO.java create mode 100644 src/main/java/danielcortes/xyz/models/documentos/MysqlDocumentosDAO.java diff --git a/src/main/java/danielcortes/xyz/controllers/ArqueoController.java b/src/main/java/danielcortes/xyz/controllers/ArqueoController.java index 5ad5b40..424efaf 100644 --- a/src/main/java/danielcortes/xyz/controllers/ArqueoController.java +++ b/src/main/java/danielcortes/xyz/controllers/ArqueoController.java @@ -25,6 +25,8 @@ package danielcortes.xyz.controllers; import danielcortes.xyz.models.caja.Caja; +import danielcortes.xyz.models.documentos.Documentos; +import danielcortes.xyz.models.documentos.DocumentosDAO; import danielcortes.xyz.models.efectivo.Efectivo; import danielcortes.xyz.models.efectivo.EfectivoDAO; import danielcortes.xyz.models.egreso.EgresoDAO; @@ -36,15 +38,19 @@ import javax.swing.*; public class ArqueoController { private ArqueoView view; - private EfectivoDAO efectivoDAO; private Caja caja; private Efectivo efectivo; + private Documentos documentos; + + private EfectivoDAO efectivoDAO; + private DocumentosDAO documentosDAO; private IngresoDAO ingresoDAO; private EgresoDAO egresoDAO; - public ArqueoController(ArqueoView view, EfectivoDAO efectivoDAO, IngresoDAO ingresoDAO, EgresoDAO egresoDAO) { + public ArqueoController(ArqueoView view, EfectivoDAO efectivoDAO, DocumentosDAO documentosDAO, IngresoDAO ingresoDAO, EgresoDAO egresoDAO) { this.view = view; this.efectivoDAO = efectivoDAO; + this.documentosDAO = documentosDAO; this.ingresoDAO = ingresoDAO; this.egresoDAO = egresoDAO; @@ -76,7 +82,9 @@ public class ArqueoController { } private void fillDocumentos() { - + this.documentos = this.documentosDAO.findByCaja(caja); + this.view.getTarjetasField().setText(String.valueOf(documentos.getTarjetas())); + this.view.getChequesField().setText(String.valueOf(documentos.getCheques())); } private void fillResumen() { @@ -104,7 +112,12 @@ public class ArqueoController { } private void updateResumenDocumentos() { + JTextField documentosField = this.view.getDocumentosField(); + int total = 0; + total += this.documentos.getCheques(); + total += this.documentos.getTarjetas(); + documentosField.setText(String.valueOf(total)); } private void updateResumenIngresos() { @@ -126,6 +139,10 @@ public class ArqueoController { this.normalizeEfectivoInput(); this.guardarEfectivo(); }); + this.view.getGuardarDocumentosButton().addActionListener(e -> { + this.normalizeDocumentosInput(); + this.guardarDocumentos(); + }); } private void guardarEfectivo() { @@ -155,6 +172,19 @@ public class ArqueoController { } } + private void guardarDocumentos() { + String tarjetas = this.view.getTarjetasField().getText(); + String cheques = this.view.getChequesField().getText(); + + if (this.validateDocumentosInput(tarjetas, cheques)) { + this.documentos.setTarjetas(Integer.valueOf(tarjetas)); + this.documentos.setCheques(Integer.valueOf(cheques)); + this.documentosDAO.updateDocumentos(documentos); + + this.updateResumenDocumentos(); + } + } + private boolean validateEfectivoInput(String diez, String cincuenta, String cien, String quinientos, String mil, String dosMil, String cincoMil, String diezMil, String veinteMil) { this.hiddeEfectivoErrorMessages(); @@ -171,6 +201,15 @@ public class ArqueoController { return diezValidation && cincuentaValidation && cienValidation && quinientosValidation && milValidation && dosMilValidation && cincoMilValidation && diezMilValidation && veinteMilValidation; } + private boolean validateDocumentosInput(String tarjetas, String cheques) { + this.hiddeDocumentosErrorMessages(); + + boolean tarjetasValidation = validateDocumentosValor(tarjetas, this.view.getErrorTarjetas()); + boolean chequesValidation = validateDocumentosValor(cheques, this.view.getErrorCheques()); + + return tarjetasValidation && chequesValidation; + } + private boolean validateEfectivoMoneda(String valor, JLabel errorLabel) { if (valor == null) { errorLabel.setText("Hubo un problema con los datos"); @@ -199,6 +238,35 @@ public class ArqueoController { return true; } + private boolean validateDocumentosValor(String valor, JLabel errorLabel) { + + if (valor == null) { + errorLabel.setText("Hubo un problema con los datos"); + errorLabel.setVisible(true); + return false; + } + + if (valor.isEmpty()) { + errorLabel.setText("El campo esta vacio"); + errorLabel.setVisible(true); + return false; + } + + if (!valor.chars().allMatch(Character::isDigit)) { + errorLabel.setText("Deben ser numeros"); + errorLabel.setVisible(true); + return false; + } + + if (valor.length() > 10) { + errorLabel.setText("El numero ingresado es demasiado largo"); + errorLabel.setVisible(true); + return false; + } + + return true; + } + private void hiddeEfectivoErrorMessages() { this.view.getErrorDiez().setVisible(false); this.view.getErrorCincuenta().setVisible(false); @@ -211,6 +279,11 @@ public class ArqueoController { this.view.getErrorVeinteMil().setVisible(false); } + private void hiddeDocumentosErrorMessages(){ + this.view.getErrorTarjetas().setVisible(false); + this.view.getErrorCheques().setVisible(false); + } + private void normalizeEfectivoInput() { this.view.getDiezField().setText(this.view.getDiezField().getText().trim()); this.view.getCincuentaField().setText(this.view.getCincuentaField().getText().trim()); @@ -223,4 +296,9 @@ public class ArqueoController { this.view.getVeinteMilField().setText(this.view.getVeinteMilField().getText().trim()); } + private void normalizeDocumentosInput() { + this.view.getChequesField().setText(this.view.getChequesField().getText().trim()); + this.view.getTarjetasField().setText(this.view.getTarjetasField().getText().trim()); + } + } diff --git a/src/main/java/danielcortes/xyz/controllers/ManagerController.java b/src/main/java/danielcortes/xyz/controllers/ManagerController.java index 61a2536..d323d97 100644 --- a/src/main/java/danielcortes/xyz/controllers/ManagerController.java +++ b/src/main/java/danielcortes/xyz/controllers/ManagerController.java @@ -26,6 +26,9 @@ package danielcortes.xyz.controllers; import danielcortes.xyz.models.caja.Caja; import danielcortes.xyz.models.caja.CajaDAO; +import danielcortes.xyz.models.documentos.Documentos; +import danielcortes.xyz.models.documentos.DocumentosDAO; +import danielcortes.xyz.models.documentos.MysqlDocumentosDAO; import danielcortes.xyz.models.efectivo.Efectivo; import danielcortes.xyz.models.efectivo.EfectivoDAO; import danielcortes.xyz.models.efectivo.MysqlEfectivoDAO; @@ -91,6 +94,7 @@ public class ManagerController { private void updateCaja(){ LocalDate selectedDate = this.view.getDatePicker().getDate(); Caja caja = this.cajaDAO.findByFecha(selectedDate); + if(caja == null){ caja = new Caja(); caja.setFecha(selectedDate); @@ -101,7 +105,12 @@ public class ManagerController { efectivo.setCaja(caja); efectivoDAO.insertDefaultEfectivo(efectivo); + DocumentosDAO documentosDAO = new MysqlDocumentosDAO(); + Documentos documentos = new Documentos(); + documentos.setCaja(caja); + documentosDAO.insertDefaultDocumentos(documentos); } + this.ingresosController.updateCaja(caja); this.egresosController.updateCaja(caja); this.arqueoController.updateCaja(caja); @@ -136,12 +145,13 @@ public class ManagerController { private void loadArqueoView() { ArqueoView arqueoView = new ArqueoView(); EfectivoDAO efectivoDAO = new MysqlEfectivoDAO(); + DocumentosDAO documentosDAO = new MysqlDocumentosDAO(); EgresoDAO egresoDAO = new MysqlEgresoDAO(); IngresoDAO ingresoDAO = new MysqlIngresoDAO(); this.view.getCardPanel().add(arqueoView.getContentPanel(), "ARQUEO"); - this.arqueoController = new ArqueoController(arqueoView, efectivoDAO, ingresoDAO, egresoDAO); + this.arqueoController = new ArqueoController(arqueoView, efectivoDAO, documentosDAO, ingresoDAO, egresoDAO); } private void pressInitialButton() { diff --git a/src/main/java/danielcortes/xyz/models/documentos/Documentos.java b/src/main/java/danielcortes/xyz/models/documentos/Documentos.java new file mode 100644 index 0000000..f0bb1b7 --- /dev/null +++ b/src/main/java/danielcortes/xyz/models/documentos/Documentos.java @@ -0,0 +1,66 @@ +/* + * MIT License + * + * Copyright (c) 2018 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.models.documentos; + +import danielcortes.xyz.models.caja.Caja; + +public class Documentos { + private int id; + private int cheques; + private int tarjetas; + private Caja caja; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getCheques() { + return cheques; + } + + public void setCheques(int cheques) { + this.cheques = cheques; + } + + public int getTarjetas() { + return tarjetas; + } + + public void setTarjetas(int tarjetas) { + this.tarjetas = tarjetas; + } + + public Caja getCaja() { + return caja; + } + + public void setCaja(Caja caja) { + this.caja = caja; + } +} diff --git a/src/main/java/danielcortes/xyz/models/documentos/DocumentosDAO.java b/src/main/java/danielcortes/xyz/models/documentos/DocumentosDAO.java new file mode 100644 index 0000000..75b4606 --- /dev/null +++ b/src/main/java/danielcortes/xyz/models/documentos/DocumentosDAO.java @@ -0,0 +1,40 @@ +/* + * MIT License + * + * Copyright (c) 2018 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.models.documentos; + +import danielcortes.xyz.models.caja.Caja; + +import java.util.List; + +public interface DocumentosDAO { + List findAll(); + Documentos findById(int id); + Documentos findByCaja(Caja caja); + + boolean insertDocumentos(Documentos documentos); + boolean insertDefaultDocumentos(Documentos documentos); + boolean updateDocumentos(Documentos documentos); + boolean deleteDocumentos(Documentos documentos); +} diff --git a/src/main/java/danielcortes/xyz/models/documentos/MysqlDocumentosDAO.java b/src/main/java/danielcortes/xyz/models/documentos/MysqlDocumentosDAO.java new file mode 100644 index 0000000..db9d85c --- /dev/null +++ b/src/main/java/danielcortes/xyz/models/documentos/MysqlDocumentosDAO.java @@ -0,0 +1,223 @@ +/* + * MIT License + * + * Copyright (c) 2018 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.models.documentos; + +import danielcortes.xyz.data.MysqlConnection; +import danielcortes.xyz.models.caja.Caja; +import danielcortes.xyz.models.caja.CajaDAO; +import danielcortes.xyz.models.caja.MysqlCajaDAO; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class MysqlDocumentosDAO implements DocumentosDAO { + private MysqlConnection mysqlConnection; + + public MysqlDocumentosDAO() { + this.mysqlConnection = new MysqlConnection(); + } + + @Override + public List findAll() { + List documentosList = new ArrayList<>(); + try { + Connection conn = mysqlConnection.getConnection(); + PreparedStatement ps = conn.prepareStatement("select * from documentos"); + ResultSet rs = ps.executeQuery(); + + documentosList = this.documentosFromResultSet(rs); + + rs.close(); + ps.close(); + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + return documentosList; + } + + @Override + public Documentos findById(int id) { + Documentos documentos = null; + try { + Connection conn = mysqlConnection.getConnection(); + PreparedStatement ps = conn.prepareStatement("select * from documentos where id = ?"); + ps.setInt(1, id); + + ResultSet rs = ps.executeQuery(); + + List documentosList = this.documentosFromResultSet(rs); + if(documentosList.size() > 0){ + documentos = documentosList.get(0); + } + + rs.close(); + ps.close(); + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + return documentos; + } + + @Override + public Documentos findByCaja(Caja caja) { + Documentos documentos = null; + try { + Connection conn = mysqlConnection.getConnection(); + PreparedStatement ps = conn.prepareStatement("select * from documentos where caja_id = ?"); + ps.setInt(1, caja.getId()); + + ResultSet rs = ps.executeQuery(); + + List documentosList = this.documentosFromResultSet(rs); + if(documentosList.size() > 0){ + documentos = documentosList.get(0); + } + + rs.close(); + ps.close(); + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + return documentos; + } + + @Override + public boolean insertDocumentos(Documentos documentos) { + int updates; + try { + Connection conn = mysqlConnection.getConnection(); + PreparedStatement ps = conn.prepareStatement("insert into documentos (cheques, tarjetas, caja_id) values (?,?,?)"); + ps.setInt(1, documentos.getCheques()); + ps.setInt(2, documentos.getTarjetas()); + ps.setInt(3, documentos.getCaja().getId()); + + updates = ps.executeUpdate(); + ps.close(); + + ps = conn.prepareStatement("select last_insert_id()"); + ResultSet rs = ps.executeQuery(); + rs.next(); + documentos.setId(rs.getInt(1)); + + rs.close(); + ps.close(); + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + return false; + } + return updates > 0; + } + + @Override + public boolean insertDefaultDocumentos(Documentos documentos) { + int updates; + try { + Connection conn = mysqlConnection.getConnection(); + PreparedStatement ps = conn.prepareStatement("insert into documentos (cheques, tarjetas, caja_id) values (0,0,?)"); + ps.setInt(1, documentos.getCaja().getId()); + + updates = ps.executeUpdate(); + ps.close(); + + ps = conn.prepareStatement("select last_insert_id()"); + ResultSet rs = ps.executeQuery(); + rs.next(); + documentos.setId(rs.getInt(1)); + + rs.close(); + ps.close(); + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + return false; + } + return updates > 0; + } + + @Override + public boolean updateDocumentos(Documentos documentos) { + int updates; + try { + Connection conn = mysqlConnection.getConnection(); + PreparedStatement ps = conn.prepareStatement("update documentos set tarjetas = ?, cheques = ?, caja_id = ? where id = ?"); + ps.setInt(1, documentos.getTarjetas()); + ps.setInt(2, documentos.getCheques()); + ps.setInt(3, documentos.getCaja().getId()); + ps.setInt(4, documentos.getId()); + updates = ps.executeUpdate(); + + ps.close(); + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + return false; + } + return updates > 0; + } + + @Override + public boolean deleteDocumentos(Documentos documentos) { + int updates; + try { + Connection conn = mysqlConnection.getConnection(); + PreparedStatement ps = conn.prepareStatement("delete from documentos where id = ?"); + ps.setInt(1, documentos.getId()); + + updates = ps.executeUpdate(); + + ps.close(); + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + return false; + } + return updates > 0; + } + + private List documentosFromResultSet(ResultSet rs) throws SQLException { + List documentosList = new ArrayList<>(); + while (rs.next()) { + CajaDAO cajaDAO = new MysqlCajaDAO(); + Caja caja = cajaDAO.findById(rs.getInt("caja_id")); + + Documentos documentos = new Documentos(); + documentos.setCaja(caja); + documentos.setId(rs.getInt("id")); + documentos.setCheques(rs.getInt("cheques")); + documentos.setTarjetas(rs.getInt("tarjetas")); + + documentosList.add(documentos); + } + return documentosList; + } +} diff --git a/src/main/java/danielcortes/xyz/models/efectivo/MysqlEfectivoDAO.java b/src/main/java/danielcortes/xyz/models/efectivo/MysqlEfectivoDAO.java index 5b8ad34..78e2b3c 100644 --- a/src/main/java/danielcortes/xyz/models/efectivo/MysqlEfectivoDAO.java +++ b/src/main/java/danielcortes/xyz/models/efectivo/MysqlEfectivoDAO.java @@ -94,7 +94,7 @@ public class MysqlEfectivoDAO implements EfectivoDAO { ResultSet rs = ps.executeQuery(); List efectivoList = this.efectivosFromResultSet(rs); - if(efectivoList.size() > 0) { + if (efectivoList.size() > 0) { efectivo = efectivoList.get(0); } diff --git a/src/main/java/danielcortes/xyz/views/ArqueoView.form b/src/main/java/danielcortes/xyz/views/ArqueoView.form index 3f83ac9..c90ce29 100644 --- a/src/main/java/danielcortes/xyz/views/ArqueoView.form +++ b/src/main/java/danielcortes/xyz/views/ArqueoView.form @@ -10,7 +10,7 @@ - + @@ -20,14 +20,6 @@ - - - - - - - - @@ -40,7 +32,7 @@ - + @@ -48,7 +40,7 @@ - + @@ -58,12 +50,40 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/danielcortes/xyz/views/ArqueoView.java b/src/main/java/danielcortes/xyz/views/ArqueoView.java index ecebb8c..44fbecf 100644 --- a/src/main/java/danielcortes/xyz/views/ArqueoView.java +++ b/src/main/java/danielcortes/xyz/views/ArqueoView.java @@ -60,6 +60,8 @@ public class ArqueoView { private JLabel errorCien; private JLabel errorCincuenta; private JLabel errorDiez; + private JLabel errorCheques; + private JLabel errorTarjetas; public JPanel getContentPanel() { return contentPanel; @@ -173,6 +175,14 @@ public class ArqueoView { return errorDiez; } + public JLabel getErrorCheques() { + return errorCheques; + } + + public JLabel getErrorTarjetas() { + return errorTarjetas; + } + { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< @@ -191,24 +201,34 @@ public class ArqueoView { contentPanel = new JPanel(); contentPanel.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(3, 2, new Insets(10, 10, 10, 10), -1, -1)); + panel1.setLayout(new GridLayoutManager(5, 2, new Insets(10, 10, 10, 10), -1, -1)); contentPanel.add(panel1, 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)); panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Detalle Documentos", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, -1, -1, panel1.getFont()))); - final JLabel label1 = new JLabel(); - label1.setText("Cheques al Dia"); - panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); chequesField = new JTextField(); chequesField.setText("0"); panel1.add(chequesField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - final JLabel label2 = new JLabel(); - label2.setText("Tarjetas de Credito"); - panel1.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Tarjetas de Credito"); + panel1.add(label1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); tarjetasField = new JTextField(); tarjetasField.setText("0"); - panel1.add(tarjetasField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + panel1.add(tarjetasField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); guardarDocumentosButton = new JButton(); guardarDocumentosButton.setText("Guardar"); - panel1.add(guardarDocumentosButton, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel1.add(guardarDocumentosButton, new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + errorCheques = new JLabel(); + errorCheques.setForeground(new Color(-65536)); + errorCheques.setText("Error"); + errorCheques.setVisible(true); + panel1.add(errorCheques, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Cheques al Dia"); + panel1.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + errorTarjetas = new JLabel(); + errorTarjetas.setForeground(new Color(-65536)); + errorTarjetas.setText("Error"); + errorTarjetas.setVisible(true); + panel1.add(errorTarjetas, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(5, 2, new Insets(10, 10, 10, 10), -1, -1)); contentPanel.add(panel2, new GridConstraints(1, 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));