Build rota pero avanzando para conseguir que todo funcione unido a una caja

This commit is contained in:
Daniel Cortes
2018-12-27 15:00:42 -03:00
parent 3a45692c7a
commit ca6970a1ba
33 changed files with 2163 additions and 164 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_9">
<output url="file://$MODULE_DIR$/target/classes" /> <output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
@@ -9,7 +9,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" /> <excludeFolder url="file://$MODULE_DIR$/target" />
</content> </content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.5" level="project" /> <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.5" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.13" level="project" /> <orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.13" level="project" />

View File

@@ -26,49 +26,92 @@ drop table if exists egresos;
drop table if exists tipos_egreso; drop table if exists tipos_egreso;
drop table if exists ingresos; drop table if exists ingresos;
drop table if exists tipos_ingreso; drop table if exists tipos_ingreso;
drop table if exists efectivos;
drop table if exists documentos;
drop table if exists caja;
create table tipos_egreso( create table caja
(
id int(10) unsigned primary key auto_increment,
fecha date not null
);
create table tipos_egreso
(
id int(10) unsigned primary key auto_increment, id int(10) unsigned primary key auto_increment,
nombre varchar(191) not null nombre varchar(191) not null
); );
create table egresos( create table egresos
(
id int(10) unsigned primary key auto_increment, id int(10) unsigned primary key auto_increment,
nro varchar(191) not null, nro varchar(191) not null,
descripcion varchar(191) not null, descripcion varchar(191) not null,
valor int(10) not null, valor int(10) not null,
tipo_egreso_id int(10) unsigned not null, tipo_egreso_id int(10) unsigned not null,
foreign key fk_tipo_id(tipo_egreso_id) references tipos_egreso(id) on update cascade on delete restrict caja_id int(10) unsigned not null,
foreign key fk_egresos_tipo_egreso (tipo_egreso_id) references tipos_egreso (id) on update cascade on delete restrict,
foreign key fk_egresos_caja (caja_id) references caja (id) on update cascade on delete restrict
); );
create table tipos_ingreso
create table tipos_ingreso( (
id int(10) unsigned primary key auto_increment, id int(10) unsigned primary key auto_increment,
nombre varchar(191) not null nombre varchar(191) not null
); );
create table ingresos( create table ingresos
(
id int(10) unsigned primary key auto_increment, id int(10) unsigned primary key auto_increment,
valor int(10) not null, valor int(10) not null,
tipo_ingreso_id int(10) unsigned not null, tipo_ingreso_id int(10) unsigned not null,
foreign key fk_tipo_ingreso(tipo_ingreso_id) references tipos_ingreso(id) on update cascade on delete restrict caja_id int(10) unsigned not null,
foreign key fk_tipo_ingreso (tipo_ingreso_id) references tipos_ingreso (id) on update cascade on delete restrict,
foreign key fk_ingresos_caja (caja_id) references caja (id) on update cascade on delete restrict
); );
insert into tipos_egreso (nombre) values create table efectivos
('Guia Materia Prima'), (
('Factura Materia Prima'), id int(10) unsigned primary key auto_increment,
veinte_mil int(10) not null,
diez_mil int(10) not null,
cinco_mil int(10) not null,
dos_mil int(10) not null,
mil int(10) not null,
quinientos int(10) not null,
cien int(10) not null,
cincuenta int(10) not null,
diez int(10) not null,
caja_id int(10) unsigned not null,
foreign key fk_efectivos_caja (caja_id) references caja (id) on update cascade on delete restrict
);
create table documentos
(
id int(10) unsigned primary key auto_increment,
cheques int(10) not null,
tarjetas int(10) not null,
caja_id int(10) unsigned not null,
foreign key fk_documentos_caja (caja_id) references caja (id) on update cascade on delete restrict
);
insert into tipos_egreso (nombre)
values ('Factura Materia Prima'),
('Factura Gastos Generales'), ('Factura Gastos Generales'),
('Pago Partime'),
('Gasto Menor Materia Prima'), ('Gasto Menor Materia Prima'),
('Gasto General Sin Respaldo'), ('Gasto General Sin Respaldo'),
('Gasto General Con Boleta'), ('Gasto General Con Boleta'),
('Guia Materia Prima'),
('Anticipo Arriendo'), ('Anticipo Arriendo'),
('Anticipo Personal'), ('Anticipo Personal'),
('Pago Partime'),
('Retiros Gerencia'), ('Retiros Gerencia'),
('Otro'); ('Otro');
insert into tipos_ingreso (nombre) values insert into tipos_ingreso (nombre)
('Boletas Fiscales'), values ('Boletas Fiscales'),
('Boletas Manuales'), ('Boletas Manuales'),
('Facturas'), ('Facturas'),
('Guias') ('Guias')

View File

@@ -15,6 +15,8 @@
<version>3.8.0</version> <version>3.8.0</version>
<configuration> <configuration>
<release>8</release> <release>8</release>
<source>9</source>
<target>9</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@@ -25,30 +25,39 @@
package danielcortes.xyz; package danielcortes.xyz;
import danielcortes.xyz.controllers.ManagerController; import danielcortes.xyz.controllers.ManagerController;
import danielcortes.xyz.data.Properties;
import danielcortes.xyz.models.caja.CajaDAO;
import danielcortes.xyz.models.caja.MysqlCajaDAO;
import danielcortes.xyz.views.ManagerView; import danielcortes.xyz.views.ManagerView;
import javax.swing.*; import javax.swing.*;
import java.util.Locale;
public class Main { public class Main {
private static final String lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
public static void main(String[] args) { public static void main(String[] args) {
System.setProperty("awt.useSystemAAFontSettings", "on");
System.setProperty("swing.aatext", "true");
try { try {
UIManager.setLookAndFeel(lookAndFeel); UIManager.setLookAndFeel(Properties.getInstance().getProperty("look_and_feel"));
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
e.printStackTrace(); e.printStackTrace();
} }
Locale.setDefault(new Locale("es"));
CajaDAO cajaDAO = new MysqlCajaDAO();
ManagerView view = new ManagerView(); ManagerView view = new ManagerView();
ManagerController managerController = new ManagerController(view); ManagerController managerController = new ManagerController(view, cajaDAO);
JFrame frame = new JFrame("Caja"); JFrame frame = new JFrame("Caja");
frame.setContentPane(view.getContentPanel()); frame.setContentPane(view.getContentPanel());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1300,700); frame.setSize(780, 450);
//frame.pack();
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(null);
frame.setVisible(true); frame.setVisible(true);
} }
} }

View File

@@ -0,0 +1,76 @@
/*
* 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.controllers;
import danielcortes.xyz.models.efectivo.Efectivo;
import danielcortes.xyz.models.efectivo.EfectivoDAO;
import danielcortes.xyz.views.ArqueoView;
import java.util.ArrayList;
import java.util.List;
public class ArqueoController {
private ArqueoView view;
private EfectivoDAO efectivoDAO;
public ArqueoController(ArqueoView view, EfectivoDAO efectivoDAO) {
this.view = view;
this.efectivoDAO = efectivoDAO;
// this.fillEfectivo();
// this.fillDocumentos();
// this.fillDocumentos();
}
private void fillEfectivo(){
List<Efectivo> efectivoList = this.efectivoDAO.findAll();
if(efectivoList.size() > 0) {
Efectivo efectivo = efectivoList.get(0);
this.view.getVeinteMilField().setText(String.valueOf(efectivo.getVeinteMil()));
this.view.getDiezField().setText(String.valueOf(efectivo.getDiezMil()));
this.view.getCincoMilField().setText(String.valueOf(efectivo.getCincoMil()));
this.view.getDosMilField().setText(String.valueOf(efectivo.getDosMil()));
this.view.getMilField().setText(String.valueOf(efectivo.getMil()));
this.view.getQuinientosField().setText(String.valueOf(efectivo.getQuinientos()));
this.view.getCienField().setText(String.valueOf(efectivo.getCien()));
this.view.getCincuentaField().setText(String.valueOf(efectivo.getCincuenta()));
this.view.getDiezField().setText(String.valueOf(efectivo.getDiez()));
}
}
private void fillResumen(){
List<Efectivo> efectivoList = this.efectivoDAO.findAll();
if(efectivoList.size() > 0) {
Efectivo efectivo = efectivoList.get(0);
int total = this.efectivoDAO.getTotalEfectivo(efectivo);
this.view.getEfectivoField().setText(String.valueOf(total));
}
}
private void fillDocumentos(){
}
}

View File

@@ -34,21 +34,35 @@ import danielcortes.xyz.views.components.EgresosTableModel;
import javax.swing.*; import javax.swing.*;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class EgresosController { public class EgresosController {
private EgresosView view; private EgresosView view;
private EgresoDAO egresoDAO; private EgresoDAO egresoDAO;
private TipoEgresoDAO tipoEgresoDAO; private TipoEgresoDAO tipoEgresoDAO;
private int editingId;
private boolean editing;
private Egreso editingEgreso;
public EgresosController(EgresosView view, EgresoDAO egresoDAO, TipoEgresoDAO tipoEgresoDAO) { public EgresosController(EgresosView view, EgresoDAO egresoDAO, TipoEgresoDAO tipoEgresoDAO) {
this.view = view; this.view = view;
this.egresoDAO = egresoDAO; this.egresoDAO = egresoDAO;
this.tipoEgresoDAO = tipoEgresoDAO; this.tipoEgresoDAO = tipoEgresoDAO;
this.setUpViewEvents(); // this.setUpViewEvents();
this.fillEgresosTable(); // this.fillEgresosTable();
this.fillTipoEgresoCombo(); // this.fillTipoEgresoCombo();
this.updateTotalEgresos(); // this.updateTotalEgresos();
this.updateEliminarButton(); // this.updateButtonsEnabled();
}
public EgresoDAO getEgresoDAO() {
return egresoDAO;
}
public TipoEgresoDAO getTipoEgresoDAO() {
return tipoEgresoDAO;
} }
private void fillTipoEgresoCombo() { private void fillTipoEgresoCombo() {
@@ -69,6 +83,7 @@ public class EgresosController {
this.view.getEgresosTable().getSelectionModel().addListSelectionListener(e -> onSelectTableRowListener()); this.view.getEgresosTable().getSelectionModel().addListSelectionListener(e -> onSelectTableRowListener());
this.view.getGuardarButton().addActionListener(e -> guardarActionListener()); this.view.getGuardarButton().addActionListener(e -> guardarActionListener());
this.view.getEliminarButton().addActionListener(e -> eliminarActionListener()); this.view.getEliminarButton().addActionListener(e -> eliminarActionListener());
this.view.getEditarButton().addActionListener(e -> editarActionListener());
this.view.getDescripcionField().addActionListener(e -> guardarActionListener()); this.view.getDescripcionField().addActionListener(e -> guardarActionListener());
this.view.getNroField().addActionListener(e -> guardarActionListener()); this.view.getNroField().addActionListener(e -> guardarActionListener());
this.view.getValorField().addActionListener(e -> guardarActionListener()); this.view.getValorField().addActionListener(e -> guardarActionListener());
@@ -80,6 +95,14 @@ public class EgresosController {
} }
} }
}); });
this.view.getEgresosTable().addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent mouseEvent) {
JTable table = (JTable) mouseEvent.getSource();
if (mouseEvent.getClickCount() == 2 && table.getSelectedRow() != -1) {
EgresosController.this.editarActionListener();
}
}
});
} }
private void guardarActionListener() { private void guardarActionListener() {
@@ -87,11 +110,10 @@ public class EgresosController {
String descripcion = this.view.getDescripcionField().getText(); String descripcion = this.view.getDescripcionField().getText();
String valor = this.view.getValorField().getText(); String valor = this.view.getValorField().getText();
TipoEgreso tipo = (TipoEgreso) this.view.getTipoCombo().getSelectedItem(); TipoEgreso tipo = (TipoEgreso) this.view.getTipoCombo().getSelectedItem();
if(this.validateInput(nro, descripcion, valor, tipo)){ if(editing){
Egreso egreso = this.createEgreso(nro, descripcion, valor, tipo); this.editarEgreso(nro, descripcion, valor, tipo);
this.view.getEgresosTableModel().addRow(egreso); }else {
this.updateTotalEgresos(); this.guardarEgreso(nro, descripcion, valor, tipo);
this.clearInputs();
} }
this.resetFocus(); this.resetFocus();
} }
@@ -103,12 +125,29 @@ public class EgresosController {
this.view.getEgresosTableModel().removeRow(selectedID); this.view.getEgresosTableModel().removeRow(selectedID);
this.egresoDAO.deleteEgreso(egreso); this.egresoDAO.deleteEgreso(egreso);
this.updateTotalEgresos(); this.updateTotalEgresos();
this.updateEliminarButton(); this.updateButtonsEnabled();
}
}
private void editarActionListener() {
int selectedID = this.view.getEgresosTable().getSelectedRow();
if (selectedID >= 0) {
Egreso egreso = this.view.getEgresosTableModel().getEgreso(selectedID);
this.editingId = selectedID;
this.editingEgreso = egreso;
this.editing = true;
this.view.getNroField().setText(egreso.getNro());
this.view.getDescripcionField().setText(egreso.getDescripcion());
this.view.getValorField().setText(String.valueOf(egreso.getValor()));
this.view.getTipoCombo().setSelectedItem(egreso.getTipoEgreso());
} }
} }
private void onSelectTableRowListener() { private void onSelectTableRowListener() {
this.view.getEliminarButton().setEnabled(true); this.view.getEliminarButton().setEnabled(true);
this.view.getEditarButton().setEnabled(true);
} }
private void updateTotalEgresos() { private void updateTotalEgresos() {
@@ -116,23 +155,42 @@ public class EgresosController {
this.view.getTotalEgresosField().setText(String.valueOf(total)); this.view.getTotalEgresosField().setText(String.valueOf(total));
} }
private void updateEliminarButton() { private void updateButtonsEnabled() {
if (this.view.getEgresosTable().getSelectedRow() >= 0) { if (this.view.getEgresosTable().getSelectedRow() >= 0) {
this.view.getEliminarButton().setEnabled(true); this.view.getEliminarButton().setEnabled(true);
this.view.getEditarButton().setEnabled(true);
} else { } else {
this.view.getEliminarButton().setEnabled(false); this.view.getEliminarButton().setEnabled(false);
this.view.getEditarButton().setEnabled(false);
} }
} }
private Egreso createEgreso(String nro, String descripcion, String valor, TipoEgreso tipo){ private void guardarEgreso(String nro, String descripcion, String valor, TipoEgreso tipo) {
if (this.validateInput(nro, descripcion, valor, tipo)) {
Egreso egreso = new Egreso(); Egreso egreso = new Egreso();
egreso.setValor(Integer.valueOf(valor)); egreso.setValor(Integer.valueOf(valor));
egreso.setDescripcion(descripcion); egreso.setDescripcion(descripcion);
egreso.setNro(nro); egreso.setNro(nro);
egreso.setTipo(tipo); egreso.setTipo(tipo);
egresoDAO.insertEgreso(egreso); egresoDAO.insertEgreso(egreso);
return egreso; this.view.getEgresosTableModel().addRow(egreso);
this.updateTotalEgresos();
this.clearInputs();
}
}
private void editarEgreso(String nro, String descripcion, String valor, TipoEgreso tipo) {
if (this.validateInput(nro, descripcion, valor, tipo)) {
this.editingEgreso.setValor(Integer.valueOf(valor));
this.editingEgreso.setDescripcion(descripcion);
this.editingEgreso.setNro(nro);
this.editingEgreso.setTipo(tipo);
egresoDAO.updateEgreso(this.editingEgreso);
this.view.getEgresosTableModel().setEgreso(this.editingId, this.editingEgreso);
this.updateTotalEgresos();
this.clearInputs();
this.editing = false;
}
} }
private boolean validateInput(String nro, String descripcion, String valor, TipoEgreso tipoEgreso) { private boolean validateInput(String nro, String descripcion, String valor, TipoEgreso tipoEgreso) {

View File

@@ -24,6 +24,7 @@
package danielcortes.xyz.controllers; package danielcortes.xyz.controllers;
import danielcortes.xyz.models.caja.Caja;
import danielcortes.xyz.models.ingreso.Ingreso; import danielcortes.xyz.models.ingreso.Ingreso;
import danielcortes.xyz.models.ingreso.IngresoDAO; import danielcortes.xyz.models.ingreso.IngresoDAO;
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso; import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
@@ -34,21 +35,40 @@ import danielcortes.xyz.views.components.IngresosTableModel;
import javax.swing.*; import javax.swing.*;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class IngresosController { public class IngresosController {
private IngresosView view; private IngresosView view;
private IngresoDAO ingresoDAO; private IngresoDAO ingresoDAO;
private TipoIngresoDAO tipoIngresoDAO; private TipoIngresoDAO tipoIngresoDAO;
private Caja caja;
private int editingId;
private Ingreso editingIngreso;
private boolean editing;
public IngresosController(IngresosView view, IngresoDAO ingresoDAO, TipoIngresoDAO tipoIngresoDAO) { public IngresosController(IngresosView view, IngresoDAO ingresoDAO, TipoIngresoDAO tipoIngresoDAO) {
this.view = view; this.view = view;
this.ingresoDAO = ingresoDAO; this.ingresoDAO = ingresoDAO;
this.tipoIngresoDAO = tipoIngresoDAO; this.tipoIngresoDAO = tipoIngresoDAO;
this.fillTipoIngresoCombo(); this.fillTipoIngresoCombo();
this.fillIngresosTable();
this.setupViewEvents(); this.setupViewEvents();
this.updateButtonsEnabled();
}
public IngresoDAO getIngresoDAO() {
return ingresoDAO;
}
public TipoIngresoDAO getTipoIngresoDAO() {
return tipoIngresoDAO;
}
public void updateCaja(Caja caja){
this.caja = caja;
this.fillIngresosTable();
this.updateTotalIngresos(); this.updateTotalIngresos();
this.updateEliminarButton();
} }
private void fillTipoIngresoCombo() { private void fillTipoIngresoCombo() {
@@ -60,7 +80,8 @@ public class IngresosController {
private void fillIngresosTable() { private void fillIngresosTable() {
IngresosTableModel ingresosTableModel = this.view.getIngresosTableModel(); IngresosTableModel ingresosTableModel = this.view.getIngresosTableModel();
for (Ingreso ingreso : this.ingresoDAO.findAll()) { ingresosTableModel.removeRows();
for (Ingreso ingreso : this.ingresoDAO.findByCaja(this.caja)) {
ingresosTableModel.addRow(ingreso); ingresosTableModel.addRow(ingreso);
} }
} }
@@ -70,6 +91,7 @@ public class IngresosController {
this.view.getGuardarButton().addActionListener(e -> guardarActionListener()); this.view.getGuardarButton().addActionListener(e -> guardarActionListener());
this.view.getValorField().addActionListener(e -> guardarActionListener()); this.view.getValorField().addActionListener(e -> guardarActionListener());
this.view.getEliminarButton().addActionListener(e -> eliminarActionListener()); this.view.getEliminarButton().addActionListener(e -> eliminarActionListener());
this.view.getEditarButton().addActionListener(e -> editarActionListener());
this.view.getTipoCombo().addKeyListener(new KeyAdapter() { this.view.getTipoCombo().addKeyListener(new KeyAdapter() {
@Override @Override
@@ -79,17 +101,25 @@ public class IngresosController {
} }
} }
}); });
this.view.getIngresosTable().addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent mouseEvent) {
JTable table = (JTable) mouseEvent.getSource();
if (mouseEvent.getClickCount() == 2 && table.getSelectedRow() != -1) {
IngresosController.this.editarActionListener();
}
}
});
} }
private void guardarActionListener() { private void guardarActionListener() {
String valor = this.view.getValorField().getText(); String valor = this.view.getValorField().getText();
TipoIngreso tipoIngreso = (TipoIngreso) this.view.getTipoCombo().getSelectedItem(); TipoIngreso tipoIngreso = (TipoIngreso) this.view.getTipoCombo().getSelectedItem();
if(this.validateInput(valor, tipoIngreso)){ if(editing) {
Ingreso ingreso = this.createIngreso(valor,tipoIngreso); this.editarIngreso(valor, tipoIngreso, this.caja);
this.view.getIngresosTableModel().addRow(ingreso); } else {
this.clearInputs(); this.guardarIngreso(valor, tipoIngreso, this.caja);
this.updateTotalIngresos();
} }
this.resetFocus(); this.resetFocus();
} }
@@ -101,44 +131,83 @@ public class IngresosController {
this.view.getIngresosTableModel().removeRow(selectedId); this.view.getIngresosTableModel().removeRow(selectedId);
this.ingresoDAO.deleteIngreso(ingreso); this.ingresoDAO.deleteIngreso(ingreso);
this.updateTotalIngresos(); this.updateTotalIngresos();
this.updateEliminarButton(); this.updateButtonsEnabled();
}
}
private void editarActionListener() {
int selectedID = this.view.getIngresosTable().getSelectedRow();
if(selectedID >= 0) {
Ingreso ingreso = this.view.getIngresosTableModel().getIngreso(selectedID);
this.editingId = selectedID;
this.editingIngreso = ingreso;
this.editing = true;
this.view.getTipoCombo().setSelectedItem(ingreso.getTipoIngreso());
this.view.getValorField().setText(String.valueOf(ingreso.getValor()));
} }
} }
private void onSelectTableRowListener(){ private void onSelectTableRowListener(){
this.view.getEliminarButton().setEnabled(true); this.view.getEliminarButton().setEnabled(true);
this.view.getEditarButton().setEnabled(true);
} }
private void updateTotalIngresos(){ private void updateTotalIngresos(){
int total = this.ingresoDAO.getTotalIngreso(); int total = this.ingresoDAO.getTotalIngreso(this.caja);
this.view.getTotalIngresoField().setText(String.valueOf(total)); this.view.getTotalIngresoField().setText(String.valueOf(total));
} }
private void updateEliminarButton() { private void updateButtonsEnabled() {
if(this.view.getIngresosTable().getSelectedRow()>=0){ if(this.view.getIngresosTable().getSelectedRow()>=0){
this.view.getEliminarButton().setEnabled(true); this.view.getEliminarButton().setEnabled(true);
this.view.getEditarButton().setEnabled(true);
}else{ }else{
this.view.getEliminarButton().setEnabled(false); this.view.getEliminarButton().setEnabled(false);
this.view.getEditarButton().setEnabled(false);
} }
} }
private Ingreso createIngreso(String valor, TipoIngreso tipoIngreso) { private void guardarIngreso(String valor, TipoIngreso tipoIngreso, Caja caja){
if(this.validateInput(valor, tipoIngreso, caja)){
Ingreso ingreso = new Ingreso(); Ingreso ingreso = new Ingreso();
ingreso.setTipoIngreso(tipoIngreso); ingreso.setTipoIngreso(tipoIngreso);
ingreso.setCaja(caja);
ingreso.setValor(Integer.valueOf(valor)); ingreso.setValor(Integer.valueOf(valor));
this.ingresoDAO.insertIngreso(ingreso); this.ingresoDAO.insertIngreso(ingreso);
this.view.getIngresosTableModel().addRow(ingreso);
return ingreso; this.clearInputs();
this.updateTotalIngresos();
}
} }
private boolean validateInput(String valor, TipoIngreso tipoIngreso) { private void editarIngreso(String valor, TipoIngreso tipoIngreso, Caja caja){
if(this.validateInput(valor, tipoIngreso, caja)){
this.editingIngreso.setTipoIngreso(tipoIngreso);
this.editingIngreso.setValor(Integer.valueOf(valor));
this.ingresoDAO.updateIngreso(this.editingIngreso);
this.view.getIngresosTableModel().setIngreso(this.editingId, this.editingIngreso);
this.updateTotalIngresos();
this.clearInputs();
this.editing = false;
}
}
private boolean validateInput(String valor, TipoIngreso tipoIngreso, Caja caja) {
this.hideErrorMessages(); this.hideErrorMessages();
boolean valorValidation = this.validateValor(valor); boolean valorValidation = this.validateValor(valor);
boolean tipoIngresoValidation = this.validateTipoIngreso(tipoIngreso); boolean tipoIngresoValidation = this.validateTipoIngreso(tipoIngreso);
boolean cajaValidation = this.validateCaja(caja);
return valorValidation && tipoIngresoValidation; return valorValidation && tipoIngresoValidation && cajaValidation;
}
private boolean validateCaja(Caja caja) {
return caja != null;
} }
private boolean validateValor(String valor) { private boolean validateValor(String valor) {

View File

@@ -24,6 +24,10 @@
package danielcortes.xyz.controllers; package danielcortes.xyz.controllers;
import danielcortes.xyz.models.caja.Caja;
import danielcortes.xyz.models.caja.CajaDAO;
import danielcortes.xyz.models.efectivo.EfectivoDAO;
import danielcortes.xyz.models.efectivo.MysqlEfectivoDAO;
import danielcortes.xyz.models.egreso.EgresoDAO; import danielcortes.xyz.models.egreso.EgresoDAO;
import danielcortes.xyz.models.ingreso.IngresoDAO; import danielcortes.xyz.models.ingreso.IngresoDAO;
import danielcortes.xyz.models.ingreso.MysqlIngresoDAO; import danielcortes.xyz.models.ingreso.MysqlIngresoDAO;
@@ -31,22 +35,30 @@ import danielcortes.xyz.models.tipo_egreso.TipoEgresoDAO;
import danielcortes.xyz.models.egreso.MysqlEgresoDAO; import danielcortes.xyz.models.egreso.MysqlEgresoDAO;
import danielcortes.xyz.models.tipo_egreso.MysqlTipoEgresoDAO; import danielcortes.xyz.models.tipo_egreso.MysqlTipoEgresoDAO;
import danielcortes.xyz.models.tipo_ingreso.MysqlTipoIngresoDAO; import danielcortes.xyz.models.tipo_ingreso.MysqlTipoIngresoDAO;
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO; import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
import danielcortes.xyz.views.ArqueoView;
import danielcortes.xyz.views.EgresosView; import danielcortes.xyz.views.EgresosView;
import danielcortes.xyz.views.IngresosView; import danielcortes.xyz.views.IngresosView;
import danielcortes.xyz.views.ManagerView; import danielcortes.xyz.views.ManagerView;
import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.time.LocalDate;
public class ManagerController { public class ManagerController {
private ManagerView view; private ManagerView view;
private CajaDAO cajaDAO;
private IngresosController ingresosController;
private EgresosController egresosController;
private ArqueoController arqueoController;
public ManagerController(ManagerView view) { public ManagerController(ManagerView view, CajaDAO cajaDAO) {
this.view = view; this.view = view;
this.cajaDAO = cajaDAO;
this.loadCardContents(); this.loadCardContents();
this.setUpViewEvents(); this.setUpViewEvents();
this.pressInitialButton();
} }
private void setUpViewEvents() { private void setUpViewEvents() {
@@ -58,12 +70,31 @@ public class ManagerController {
CardLayout layout = (CardLayout) this.view.getCardPanel().getLayout(); CardLayout layout = (CardLayout) this.view.getCardPanel().getLayout();
layout.show(this.view.getCardPanel(), "INGRESOS"); layout.show(this.view.getCardPanel(), "INGRESOS");
}); });
this.view.getArqueoButton().addActionListener(e -> {
CardLayout layout = (CardLayout) this.view.getCardPanel().getLayout();
layout.show(this.view.getCardPanel(), "ARQUEO");
});
this.view.getDatePicker().addDateChangeListener(e -> {
LocalDate selectedDate = this.view.getDatePicker().getDate();
Caja caja = this.cajaDAO.findByFecha(selectedDate);
if(caja == null){
caja = new Caja();
caja.setFecha(selectedDate);
this.cajaDAO.insertCaja(caja);
}
this.ingresosController.updateCaja(caja);
// this.egresosController.updateCaja(caja);
// this.arqueoController.updateCaja(caja);
});
} }
private void loadCardContents() { private void loadCardContents() {
//this.view.getCardPanel().add(new JPanel(), "NONE");
this.loadEgresosView(); this.loadEgresosView();
this.loadIngresosView(); this.loadIngresosView();
this.loadArqueoView();
} }
private void loadIngresosView() { private void loadIngresosView() {
@@ -73,7 +104,7 @@ public class ManagerController {
this.view.getCardPanel().add(ingresosView.getContentPanel(), "INGRESOS"); this.view.getCardPanel().add(ingresosView.getContentPanel(), "INGRESOS");
IngresosController ingresosController = new IngresosController(ingresosView,ingresoDAO,tipoIngresoDAO); this.ingresosController = new IngresosController(ingresosView, ingresoDAO, tipoIngresoDAO);
} }
private void loadEgresosView() { private void loadEgresosView() {
@@ -83,6 +114,19 @@ public class ManagerController {
this.view.getCardPanel().add(egresosView.getContentPanel(), "EGRESOS"); this.view.getCardPanel().add(egresosView.getContentPanel(), "EGRESOS");
EgresosController egresosController = new EgresosController(egresosView, egresoDAO, tipoEgresoDAO); this.egresosController = new EgresosController(egresosView, egresoDAO, tipoEgresoDAO);
}
private void loadArqueoView() {
ArqueoView arqueoView = new ArqueoView();
EfectivoDAO efectivoDAO = new MysqlEfectivoDAO();
this.view.getCardPanel().add(arqueoView.getContentPanel(), "ARQUEO");
this.arqueoController = new ArqueoController(arqueoView, efectivoDAO);
}
private void pressInitialButton() {
this.view.getIngresosButton().doClick();
} }
} }

View File

@@ -24,25 +24,15 @@
package danielcortes.xyz.data; package danielcortes.xyz.data;
import com.mysql.cj.jdbc.MysqlDataSource;
import java.sql.*; import java.sql.*;
public class MysqlConnection { public class MysqlConnection {
private MysqlDataSource dataSource; private String databaseURI;
public MysqlConnection(){ public MysqlConnection(){
this.dataSource = new MysqlDataSource(); this.databaseURI = Properties.getInstance().getProperty("database_uri");
this.configureDataSource();
}
private void configureDataSource(){
this.dataSource.setUser("root");
this.dataSource.setPassword("lagging");
this.dataSource.setServerName("localhost");
this.dataSource.setDatabaseName("caja");
} }
public Connection getConnection() throws SQLException{ public Connection getConnection() throws SQLException{
return this.dataSource.getConnection(); return DriverManager.getConnection(databaseURI);
} }
} }

View File

@@ -0,0 +1,52 @@
/*
* 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.data;
import java.io.FileInputStream;
import java.io.IOException;
public class Properties {
private static Properties ourInstance = new Properties();
public static java.util.Properties getInstance() {
return ourInstance.props;
}
private java.util.Properties props;
private Properties() {
try {
this.props = new java.util.Properties();
FileInputStream in = new FileInputStream("conf");
this.props.load(in);
in.close();
} catch (IOException e) {
System.err.println("Couldn't load properties");
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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.caja;
import java.time.LocalDate;
public class Caja {
private int id;
private LocalDate fecha;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public LocalDate getFecha() {
return fecha;
}
public void setFecha(LocalDate fecha) {
this.fecha = fecha;
}
}

View File

@@ -0,0 +1,36 @@
/*
* 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.caja;
import java.time.LocalDate;
import java.util.List;
public interface CajaDAO {
List<Caja> findAll();
Caja findById(int id);
Caja findByFecha(LocalDate fecha);
boolean insertCaja(Caja caja);
boolean updateCaja(Caja caja);
}

View File

@@ -0,0 +1,164 @@
/*
* 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.caja;
import danielcortes.xyz.data.MysqlConnection;
import java.sql.*;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
public class MysqlCajaDAO implements CajaDAO {
private MysqlConnection mysqlConnection;
public MysqlCajaDAO() {
this.mysqlConnection = new MysqlConnection();
}
@Override
public List<Caja> findAll() {
List<Caja> cajaList = new ArrayList<>();
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("select * from caja");
ResultSet rs = ps.executeQuery();
cajaList = this.cajasFromResultSet(rs);
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
return cajaList;
}
@Override
public Caja findById(int id) {
Caja caja = null;
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("select * from caja where id = ?");
ps.setInt(1, id);
ResultSet rs = ps.executeQuery();
caja = this.cajasFromResultSet(rs).get(0);
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
return caja;
}
@Override
public Caja findByFecha(LocalDate fecha) {
Caja caja = null;
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("select * from caja where fecha = ?");
ps.setObject(1, fecha);
ResultSet rs = ps.executeQuery();
List<Caja> cajaList = this.cajasFromResultSet(rs);
if(cajaList.size() > 0){
caja = cajaList.get(0);
}
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
return caja;
}
@Override
public boolean insertCaja(Caja caja) {
int updates;
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("insert into caja (fecha) values (?)");
ps.setObject(1, caja.getFecha());
updates = ps.executeUpdate();
ps.close();
ps = conn.prepareStatement("select last_insert_id()");
ResultSet rs = ps.executeQuery();
rs.next();
caja.setId(rs.getInt(1));
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
return updates > 0;
}
@Override
public boolean updateCaja(Caja caja) {
int updates;
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("update caja set fecha = ? where id = ?");
ps.setObject(1, caja.getFecha());
ps.setInt(2, caja.getId());
updates = ps.executeUpdate();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
return updates > 0;
}
private List<Caja> cajasFromResultSet(ResultSet rs) throws SQLException {
List<Caja> cajaList = new ArrayList<>();
while (rs.next()) {
Caja caja = new Caja();
caja.setId(rs.getInt("id"));
caja.setFecha(rs.getObject("fecha", LocalDate.class));
cajaList.add(caja);
}
return cajaList;
}
}

View File

@@ -0,0 +1,118 @@
/*
* 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.efectivo;
public class Efectivo {
private int id;
private int veinteMil;
private int diezMil;
private int cincoMil;
private int dosMil;
private int mil;
private int quinientos;
private int cien;
private int cincuenta;
private int diez;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getVeinteMil() {
return veinteMil;
}
public void setVeinteMil(int veinteMil) {
this.veinteMil = veinteMil;
}
public int getDiezMil() {
return diezMil;
}
public void setDiezMil(int diezMil) {
this.diezMil = diezMil;
}
public int getCincoMil() {
return cincoMil;
}
public void setCincoMil(int cincoMil) {
this.cincoMil = cincoMil;
}
public int getDosMil() {
return dosMil;
}
public void setDosMil(int dosMil) {
this.dosMil = dosMil;
}
public int getMil() {
return mil;
}
public void setMil(int mil) {
this.mil = mil;
}
public int getQuinientos() {
return quinientos;
}
public void setQuinientos(int quinientos) {
this.quinientos = quinientos;
}
public int getCien() {
return cien;
}
public void setCien(int cien) {
this.cien = cien;
}
public int getCincuenta() {
return cincuenta;
}
public void setCincuenta(int cincuenta) {
this.cincuenta = cincuenta;
}
public int getDiez() {
return diez;
}
public void setDiez(int diez) {
this.diez = diez;
}
}

View File

@@ -0,0 +1,36 @@
/*
* 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.efectivo;
import java.util.List;
public interface EfectivoDAO {
List<Efectivo> findAll();
Efectivo findById(int id);
boolean insertEfectivo(Efectivo efectivo);
boolean updateEfectivo(Efectivo efectivo);
boolean deleteEfectivo(Efectivo efectivo);
int getTotalEfectivo(Efectivo efectivo);
}

View File

@@ -0,0 +1,205 @@
/*
* 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.efectivo;
import danielcortes.xyz.data.MysqlConnection;
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 MysqlEfectivoDAO implements EfectivoDAO {
private MysqlConnection mysqlConnection;
public MysqlEfectivoDAO() {
this.mysqlConnection = new MysqlConnection();
}
@Override
public List<Efectivo> findAll() {
List<Efectivo> efectivoList = new ArrayList<>();
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("select * from efectivo");
ResultSet rs = ps.executeQuery();
efectivoList = this.efectivosFromResultSet(rs);
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
return efectivoList;
}
@Override
public Efectivo findById(int id) {
Efectivo efectivo = null;
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("select * from efectivos where id = ?");
ps.setInt(1, id);
ResultSet rs = ps.executeQuery();
efectivo = this.efectivosFromResultSet(rs).get(0);
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
return efectivo;
}
@Override
public boolean insertEfectivo(Efectivo efectivo) {
int updates;
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("insert into efectivos (veinte_mil, diez_mil, cinco_mil, dos_mil, mil, quinientos, cien, cincuenta, diez) values (?,?,?,?,?,?,?,?,?)");
ps.setInt(1, efectivo.getVeinteMil());
ps.setInt(2, efectivo.getDiezMil());
ps.setInt(3, efectivo.getCincoMil());
ps.setInt(4, efectivo.getDosMil());
ps.setInt(5, efectivo.getMil());
ps.setInt(6, efectivo.getQuinientos());
ps.setInt(7, efectivo.getCien());
ps.setInt(8, efectivo.getCincuenta());
ps.setInt(9, efectivo.getDiez());
updates = ps.executeUpdate();
ps.close();
ps = conn.prepareStatement("select last_insert_id()");
ResultSet rs = ps.executeQuery();
rs.next();
efectivo.setId(rs.getInt(1));
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
return updates > 0;
}
@Override
public boolean updateEfectivo(Efectivo efectivo) {
int updates;
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("update efectivos set veinte_mil = ?, diez_mil = ?, cinco_mil = ?, dos_mil = ?, mil = ?, quinientos = ?, cien = ?, cincuenta = ?, diez = ? where id = ?");
ps.setInt(1, efectivo.getVeinteMil());
ps.setInt(2, efectivo.getDiezMil());
ps.setInt(3, efectivo.getCincoMil());
ps.setInt(4, efectivo.getDosMil());
ps.setInt(5, efectivo.getMil());
ps.setInt(6, efectivo.getQuinientos());
ps.setInt(7, efectivo.getCien());
ps.setInt(8, efectivo.getCincuenta());
ps.setInt(9, efectivo.getDiez());
ps.setInt(10, efectivo.getId());
updates = ps.executeUpdate();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
return updates > 0;
}
@Override
public boolean deleteEfectivo(Efectivo efectivo) {
int updates;
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("delete from efectivos where id = ?");
ps.setInt(1, efectivo.getId());
updates = ps.executeUpdate();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
return updates > 0;
}
@Override
public int getTotalEfectivo(Efectivo efectivo) {
int total = 0;
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("select (veinte_mil + diez_mil + cinco_mil + dos_mil + mil + quinientos + cien + cincuenta + diez) as total from efectivos where id = ?");
ps.setInt(1, efectivo.getId());
ResultSet rs = ps.executeQuery();
rs.next();
total = rs.getInt(1);
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
return total;
}
private List<Efectivo> efectivosFromResultSet(ResultSet rs) throws SQLException {
List<Efectivo> efectivoList = new ArrayList<>();
while (rs.next()) {
Efectivo efectivo = new Efectivo();
efectivo.setId(rs.getInt("id"));
efectivo.setVeinteMil(rs.getInt("veinte_mil"));
efectivo.setDiezMil(rs.getInt("diez_mil"));
efectivo.setCincoMil(rs.getInt("cinco_mil"));
efectivo.setDosMil(rs.getInt("dos_mil"));
efectivo.setMil(rs.getInt("mil"));
efectivo.setQuinientos(rs.getInt("quinientos"));
efectivo.setCien(rs.getInt("cien"));
efectivo.setCincuenta(rs.getInt("cincuenta"));
efectivo.setDiez(rs.getInt("diez"));
efectivoList.add(efectivo);
}
return efectivoList;
}
}

View File

@@ -83,7 +83,7 @@ public class Egreso {
this.valor = valor; this.valor = valor;
} }
public TipoEgreso getTipo() { public TipoEgreso getTipoEgreso() {
return tipo; return tipo;
} }

View File

@@ -111,7 +111,7 @@ public class MysqlEgresoDAO implements EgresoDAO {
ps.setString(1,egreso.getNro()); ps.setString(1,egreso.getNro());
ps.setString(2,egreso.getDescripcion()); ps.setString(2,egreso.getDescripcion());
ps.setInt(3,egreso.getValor()); ps.setInt(3,egreso.getValor());
ps.setInt(4,egreso.getTipo().getId()); ps.setInt(4,egreso.getTipoEgreso().getId());
updates = ps.executeUpdate(); updates = ps.executeUpdate();
ps.close(); ps.close();
@@ -120,6 +120,7 @@ public class MysqlEgresoDAO implements EgresoDAO {
rs.next(); rs.next();
egreso.setId(rs.getInt(1)); egreso.setId(rs.getInt(1));
rs.close();
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
@@ -137,9 +138,11 @@ public class MysqlEgresoDAO implements EgresoDAO {
ps.setString(1,egreso.getNro()); ps.setString(1,egreso.getNro());
ps.setString(2,egreso.getDescripcion()); ps.setString(2,egreso.getDescripcion());
ps.setInt(3,egreso.getValor()); ps.setInt(3,egreso.getValor());
ps.setInt(4,egreso.getTipo().getId()); ps.setInt(4,egreso.getTipoEgreso().getId());
ps.setInt(5, egreso.getId()); ps.setInt(5, egreso.getId());
updates = ps.executeUpdate(); updates = ps.executeUpdate();
ps.close(); ps.close();
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
@@ -156,7 +159,9 @@ public class MysqlEgresoDAO implements EgresoDAO {
Connection conn = mysqlConnection.getConnection(); Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("delete from egresos where id = ? "); PreparedStatement ps = conn.prepareStatement("delete from egresos where id = ? ");
ps.setInt(1, egreso.getId()); ps.setInt(1, egreso.getId());
updates = ps.executeUpdate(); updates = ps.executeUpdate();
ps.close(); ps.close();
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
@@ -200,6 +205,7 @@ public class MysqlEgresoDAO implements EgresoDAO {
egreso.setDescripcion(rs.getString("descripcion")); egreso.setDescripcion(rs.getString("descripcion"));
egreso.setValor(rs.getInt("valor")); egreso.setValor(rs.getInt("valor"));
egreso.setTipo(tipoEgreso); egreso.setTipo(tipoEgreso);
egresoList.add(egreso); egresoList.add(egreso);
} }
return egresoList; return egresoList;

View File

@@ -24,12 +24,14 @@
package danielcortes.xyz.models.ingreso; package danielcortes.xyz.models.ingreso;
import danielcortes.xyz.models.caja.Caja;
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso; import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
public class Ingreso { public class Ingreso {
private int id; private int id;
private int valor; private int valor;
private TipoIngreso tipoIngreso; private TipoIngreso tipoIngreso;
private Caja caja;
public Ingreso(int id, int valor, TipoIngreso tipoIngreso ) { public Ingreso(int id, int valor, TipoIngreso tipoIngreso ) {
this.id = id; this.id = id;
@@ -67,4 +69,12 @@ public class Ingreso {
public void setValor(int valor) { public void setValor(int valor) {
this.valor = valor; this.valor = valor;
} }
public Caja getCaja() {
return caja;
}
public void setCaja(Caja caja) {
this.caja = caja;
}
} }

View File

@@ -25,16 +25,18 @@
package danielcortes.xyz.models.ingreso; package danielcortes.xyz.models.ingreso;
import danielcortes.xyz.models.caja.Caja;
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso; import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
import java.util.List; import java.util.List;
public interface IngresoDAO { public interface IngresoDAO {
List<Ingreso> findAll(); List<Ingreso> findAll();
List<Ingreso> findByCaja(Caja caja);
List<Ingreso> findById(int id); List<Ingreso> findById(int id);
List<Ingreso> findByTipoIngreso(TipoIngreso tipoIngreso); List<Ingreso> findByTipoIngreso(TipoIngreso tipoIngreso);
boolean insertIngreso(Ingreso ingreso); boolean insertIngreso(Ingreso ingreso);
boolean updateIngreso(Ingreso ingreso); boolean updateIngreso(Ingreso ingreso);
boolean deleteIngreso(Ingreso ingreso); boolean deleteIngreso(Ingreso ingreso);
int getTotalIngreso(); int getTotalIngreso(Caja caja);
} }

View File

@@ -25,6 +25,9 @@
package danielcortes.xyz.models.ingreso; package danielcortes.xyz.models.ingreso;
import danielcortes.xyz.data.MysqlConnection; import danielcortes.xyz.data.MysqlConnection;
import danielcortes.xyz.models.caja.Caja;
import danielcortes.xyz.models.caja.CajaDAO;
import danielcortes.xyz.models.caja.MysqlCajaDAO;
import danielcortes.xyz.models.tipo_ingreso.MysqlTipoIngresoDAO; import danielcortes.xyz.models.tipo_ingreso.MysqlTipoIngresoDAO;
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso; import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO; import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
@@ -62,6 +65,26 @@ public class MysqlIngresoDAO implements IngresoDAO{
return ingresosList; return ingresosList;
} }
@Override
public List<Ingreso> findByCaja(Caja caja) {
List<Ingreso> ingresosList = new ArrayList<>();
try {
Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("select * from ingresos where caja_id = ?");
ps.setInt(1, caja.getId());
ResultSet rs = ps.executeQuery();
ingresosList = this.ingresosFromResultSet(rs);
rs.close();
ps.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
return ingresosList;
}
@Override @Override
public List<Ingreso> findById(int id) { public List<Ingreso> findById(int id) {
List<Ingreso> ingresosList = new ArrayList<>(); List<Ingreso> ingresosList = new ArrayList<>();
@@ -107,9 +130,10 @@ public class MysqlIngresoDAO implements IngresoDAO{
int updates; int updates;
try { try {
Connection conn = mysqlConnection.getConnection(); Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("insert into ingresos (valor, tipo_ingreso_id) values (?,?)"); PreparedStatement ps = conn.prepareStatement("insert into ingresos (valor, tipo_ingreso_id, caja_id) values (?,?,?)");
ps.setInt(1, ingreso.getValor()); ps.setInt(1, ingreso.getValor());
ps.setInt(2, ingreso.getTipoIngreso().getId()); ps.setInt(2, ingreso.getTipoIngreso().getId());
ps.setInt(3, ingreso.getCaja().getId());
updates = ps.executeUpdate(); updates = ps.executeUpdate();
ps.close(); ps.close();
@@ -132,10 +156,11 @@ public class MysqlIngresoDAO implements IngresoDAO{
int updates; int updates;
try { try {
Connection conn = mysqlConnection.getConnection(); Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("update ingresos set valor = ? , tipo_ingreso_id = ? where id = ?"); PreparedStatement ps = conn.prepareStatement("update ingresos set valor = ? , tipo_ingreso_id = ?, caja_id = ? where id = ?");
ps.setInt(1,ingreso.getValor()); ps.setInt(1,ingreso.getValor());
ps.setInt(2, ingreso.getTipoIngreso().getId()); ps.setInt(2, ingreso.getTipoIngreso().getId());
ps.setInt(3, ingreso.getId()); ps.setInt(3, ingreso.getCaja().getId());
ps.setInt(4, ingreso.getId());
updates = ps.executeUpdate(); updates = ps.executeUpdate();
ps.close(); ps.close();
conn.close(); conn.close();
@@ -164,11 +189,12 @@ public class MysqlIngresoDAO implements IngresoDAO{
} }
@Override @Override
public int getTotalIngreso() { public int getTotalIngreso(Caja caja) {
int total = 0; int total = 0;
try { try {
Connection conn = mysqlConnection.getConnection(); Connection conn = mysqlConnection.getConnection();
PreparedStatement ps = conn.prepareStatement("select sum(valor) from ingresos"); PreparedStatement ps = conn.prepareStatement("select sum(valor) from ingresos where caja_id = ?");
ps.setInt(1, caja.getId());
ResultSet rs = ps.executeQuery(); ResultSet rs = ps.executeQuery();
rs.next(); rs.next();
@@ -190,11 +216,16 @@ public class MysqlIngresoDAO implements IngresoDAO{
TipoIngresoDAO tipoEgresoDAO = new MysqlTipoIngresoDAO(); TipoIngresoDAO tipoEgresoDAO = new MysqlTipoIngresoDAO();
TipoIngreso tipoIngreso = tipoEgresoDAO.findById(tipoIngresoId).get(0); TipoIngreso tipoIngreso = tipoEgresoDAO.findById(tipoIngresoId).get(0);
int cajaId = rs.getInt("caja_id");
CajaDAO cajaDAO = new MysqlCajaDAO();
Caja caja = cajaDAO.findById(cajaId);
Ingreso ingreso = new Ingreso(); Ingreso ingreso = new Ingreso();
ingreso.setId(rs.getInt("id")); ingreso.setId(rs.getInt("id"));
ingreso.setValor(rs.getInt("valor")); ingreso.setValor(rs.getInt("valor"));
ingreso.setTipoIngreso(tipoIngreso); ingreso.setTipoIngreso(tipoIngreso);
ingreso.setCaja(caja);
ingresosList.add(ingreso); ingresosList.add(ingreso);
} }

View File

@@ -0,0 +1,372 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="danielcortes.xyz.views.ArqueoView">
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="636" height="405"/>
</constraints>
<properties/>
<border type="none">
<font/>
</border>
<children>
<grid id="1ca11" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="etched" title="Detalle Documentos">
<font/>
</border>
<children>
<component id="b855f" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Cheques al Dia"/>
</properties>
</component>
<component id="1b69f" class="javax.swing.JTextField" binding="chequesField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="d49a7" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Tarjetas de Credito"/>
</properties>
</component>
<component id="7049f" class="javax.swing.JTextField" binding="tarjetasField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
</children>
</grid>
<grid id="84446" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="etched" title="Resumen"/>
<children>
<component id="1dc40" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Efectivo"/>
</properties>
</component>
<component id="df645" class="javax.swing.JTextField" binding="efectivoField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
<text value="0"/>
</properties>
</component>
<component id="440ad" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Documentos"/>
</properties>
</component>
<component id="42661" class="javax.swing.JTextField" binding="documentosField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
<text value="0"/>
</properties>
</component>
<component id="66420" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Ingresos"/>
</properties>
</component>
<component id="6dc0a" class="javax.swing.JLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Egresos"/>
</properties>
</component>
<component id="3093a" class="javax.swing.JTextField" binding="EgresosField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
<text value="0"/>
</properties>
</component>
<component id="8094" class="javax.swing.JTextField" binding="IngresosField">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
<text value="0"/>
</properties>
</component>
<component id="cee37" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Arqueo"/>
</properties>
</component>
<component id="b0664" class="javax.swing.JTextField" binding="ArqueoField">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
<text value="0"/>
</properties>
</component>
</children>
</grid>
<grid id="26b23" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="a2c3f" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Guardar"/>
</properties>
</component>
<hspacer id="93a03">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="ed312">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
<grid id="3f85f" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="etched" title="Detalle Efectivo">
<font/>
</border>
<children>
<component id="10824" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$20000"/>
</properties>
</component>
<component id="99f2e" class="javax.swing.JTextField" binding="veinteMilField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="584ed" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$10000"/>
</properties>
</component>
<component id="5431d" class="javax.swing.JTextField" binding="diezMilField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="af49b" class="javax.swing.JTextField" binding="cincoMilField">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="8d468" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$5000"/>
</properties>
</component>
<component id="7a8c3" class="javax.swing.JLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$2000"/>
</properties>
</component>
<component id="bbb4" class="javax.swing.JTextField" binding="dosMilField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="4807e" class="javax.swing.JTextField" binding="milField">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="e80c8" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$1000"/>
</properties>
</component>
<component id="62d5d" class="javax.swing.JLabel">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$500"/>
</properties>
</component>
<component id="3d6c3" class="javax.swing.JTextField" binding="quinientosField">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="7910b" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$100"/>
</properties>
</component>
<component id="8f6e8" class="javax.swing.JTextField" binding="cienField">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="e105f" class="javax.swing.JLabel">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$50"/>
</properties>
</component>
<component id="22b2c" class="javax.swing.JTextField" binding="cincuentaField">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="fcf59" class="javax.swing.JLabel">
<constraints>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$10"/>
</properties>
</component>
<component id="6f156" class="javax.swing.JTextField" binding="diezField">
<constraints>
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>

View File

@@ -0,0 +1,296 @@
/*
* 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.views;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
public class ArqueoView {
private JPanel contentPanel;
private JTextField veinteMilField;
private JTextField diezMilField;
private JTextField cincoMilField;
private JTextField dosMilField;
private JTextField milField;
private JTextField quinientosField;
private JTextField cienField;
private JTextField cincuentaField;
private JTextField diezField;
private JTextField chequesField;
private JTextField tarjetasField;
private JTextField efectivoField;
private JTextField documentosField;
private JTextField EgresosField;
private JTextField IngresosField;
private JTextField ArqueoField;
private JButton guardarButton;
public JPanel getContentPanel() {
return contentPanel;
}
public JTextField getVeinteMilField() {
return veinteMilField;
}
public JTextField getDiezMilField() {
return diezMilField;
}
public JTextField getCincoMilField() {
return cincoMilField;
}
public JTextField getDosMilField() {
return dosMilField;
}
public JTextField getMilField() {
return milField;
}
public JTextField getQuinientosField() {
return quinientosField;
}
public JTextField getCienField() {
return cienField;
}
public JTextField getCincuentaField() {
return cincuentaField;
}
public JTextField getDiezField() {
return diezField;
}
public JTextField getChequesField() {
return chequesField;
}
public JTextField getTarjetasField() {
return tarjetasField;
}
public JTextField getEfectivoField() {
return efectivoField;
}
public JTextField getDocumentosField() {
return documentosField;
}
public JTextField getEgresosField() {
return EgresosField;
}
public JTextField getIngresosField() {
return IngresosField;
}
public JTextField getArqueoField() {
return ArqueoField;
}
public JButton getGuardarButton() {
return guardarButton;
}
/*
* @noinspection ALL
*/
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
contentPanel = new JPanel();
contentPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1));
final JPanel panel1 = new JPanel();
panel1.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(2, 2, new Insets(10, 10, 10, 10), -1, -1));
contentPanel.add(panel1, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.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 com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
chequesField = new JTextField();
chequesField.setText("0");
panel1.add(chequesField, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.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 com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
tarjetasField = new JTextField();
tarjetasField.setText("0");
panel1.add(tarjetasField, new com.intellij.uiDesigner.core.GridConstraints(1, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JPanel panel2 = new JPanel();
panel2.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(5, 2, new Insets(10, 10, 10, 10), -1, -1));
contentPanel.add(panel2, new com.intellij.uiDesigner.core.GridConstraints(1, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Resumen"));
final JLabel label3 = new JLabel();
label3.setText("Efectivo");
panel2.add(label3, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
efectivoField = new JTextField();
efectivoField.setEditable(false);
efectivoField.setText("0");
panel2.add(efectivoField, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JLabel label4 = new JLabel();
label4.setText("Documentos");
panel2.add(label4, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
documentosField = new JTextField();
documentosField.setEditable(false);
documentosField.setText("0");
panel2.add(documentosField, new com.intellij.uiDesigner.core.GridConstraints(1, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JLabel label5 = new JLabel();
label5.setText("Ingresos");
panel2.add(label5, new com.intellij.uiDesigner.core.GridConstraints(2, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label6 = new JLabel();
label6.setText("Egresos");
panel2.add(label6, new com.intellij.uiDesigner.core.GridConstraints(3, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
EgresosField = new JTextField();
EgresosField.setEditable(false);
EgresosField.setText("0");
panel2.add(EgresosField, new com.intellij.uiDesigner.core.GridConstraints(3, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
IngresosField = new JTextField();
IngresosField.setEditable(false);
IngresosField.setText("0");
panel2.add(IngresosField, new com.intellij.uiDesigner.core.GridConstraints(2, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JLabel label7 = new JLabel();
label7.setText("Arqueo");
panel2.add(label7, new com.intellij.uiDesigner.core.GridConstraints(4, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
ArqueoField = new JTextField();
ArqueoField.setEditable(false);
ArqueoField.setText("0");
panel2.add(ArqueoField, new com.intellij.uiDesigner.core.GridConstraints(4, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
contentPanel.add(panel3, new com.intellij.uiDesigner.core.GridConstraints(2, 0, 1, 2, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
guardarButton = new JButton();
guardarButton.setText("Guardar");
panel3.add(guardarButton, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final com.intellij.uiDesigner.core.Spacer spacer1 = new com.intellij.uiDesigner.core.Spacer();
panel3.add(spacer1, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final com.intellij.uiDesigner.core.Spacer spacer2 = new com.intellij.uiDesigner.core.Spacer();
panel3.add(spacer2, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JPanel panel4 = new JPanel();
panel4.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(9, 2, new Insets(10, 10, 10, 10), -1, -1));
contentPanel.add(panel4, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 2, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
panel4.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Detalle Efectivo", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, -1, -1, panel4.getFont())));
final JLabel label8 = new JLabel();
label8.setText("$20000");
panel4.add(label8, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
veinteMilField = new JTextField();
veinteMilField.setText("0");
panel4.add(veinteMilField, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label9 = new JLabel();
label9.setText("$10000");
panel4.add(label9, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
diezMilField = new JTextField();
diezMilField.setText("0");
panel4.add(diezMilField, new com.intellij.uiDesigner.core.GridConstraints(1, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
cincoMilField = new JTextField();
cincoMilField.setText("0");
panel4.add(cincoMilField, new com.intellij.uiDesigner.core.GridConstraints(2, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label10 = new JLabel();
label10.setText("$5000");
panel4.add(label10, new com.intellij.uiDesigner.core.GridConstraints(2, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label11 = new JLabel();
label11.setText("$2000");
panel4.add(label11, new com.intellij.uiDesigner.core.GridConstraints(3, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
dosMilField = new JTextField();
dosMilField.setText("0");
panel4.add(dosMilField, new com.intellij.uiDesigner.core.GridConstraints(3, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
milField = new JTextField();
milField.setText("0");
panel4.add(milField, new com.intellij.uiDesigner.core.GridConstraints(4, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label12 = new JLabel();
label12.setText("$1000");
panel4.add(label12, new com.intellij.uiDesigner.core.GridConstraints(4, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label13 = new JLabel();
label13.setText("$500");
panel4.add(label13, new com.intellij.uiDesigner.core.GridConstraints(5, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
quinientosField = new JTextField();
quinientosField.setText("0");
panel4.add(quinientosField, new com.intellij.uiDesigner.core.GridConstraints(5, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label14 = new JLabel();
label14.setText("$100");
panel4.add(label14, new com.intellij.uiDesigner.core.GridConstraints(6, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cienField = new JTextField();
cienField.setText("0");
panel4.add(cienField, new com.intellij.uiDesigner.core.GridConstraints(6, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label15 = new JLabel();
label15.setText("$50");
panel4.add(label15, new com.intellij.uiDesigner.core.GridConstraints(7, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cincuentaField = new JTextField();
cincuentaField.setText("0");
panel4.add(cincuentaField, new com.intellij.uiDesigner.core.GridConstraints(7, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label16 = new JLabel();
label16.setText("$10");
panel4.add(label16, new com.intellij.uiDesigner.core.GridConstraints(8, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
diezField = new JTextField();
diezField.setText("0");
panel4.add(diezField, new com.intellij.uiDesigner.core.GridConstraints(8, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
}
/**
* @noinspection ALL
*/
private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
if (currentFont == null) return null;
String resultName;
if (fontName == null) {
resultName = currentFont.getName();
} else {
Font testFont = new Font(fontName, Font.PLAIN, 10);
if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
resultName = fontName;
} else {
resultName = currentFont.getName();
}
}
return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contentPanel;
}
}

View File

@@ -155,7 +155,7 @@
<properties/> <properties/>
<border type="none"/> <border type="none"/>
<children> <children>
<grid id="68df1" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="68df1" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -170,7 +170,7 @@
</grid> </grid>
</constraints> </constraints>
<properties> <properties>
<text value="&amp;Añadir"/> <text value="&amp;Guardar"/>
</properties> </properties>
</component> </component>
<component id="ee598" class="javax.swing.JButton" binding="eliminarButton" default-binding="true"> <component id="ee598" class="javax.swing.JButton" binding="eliminarButton" default-binding="true">
@@ -184,6 +184,17 @@
<text value="&amp;Eliminar"/> <text value="&amp;Eliminar"/>
</properties> </properties>
</component> </component>
<component id="50154" class="javax.swing.JButton" binding="editarButton">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<enabled value="false"/>
<text value="&amp;Editar"/>
</properties>
</component>
</children> </children>
</grid> </grid>
<hspacer id="99a08"> <hspacer id="99a08">

View File

@@ -28,6 +28,7 @@ import danielcortes.xyz.models.tipo_egreso.TipoEgreso;
import danielcortes.xyz.views.components.EgresosTableModel; import danielcortes.xyz.views.components.EgresosTableModel;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
public class EgresosView { public class EgresosView {
public JPanel contentPanel; public JPanel contentPanel;
@@ -45,6 +46,7 @@ public class EgresosView {
private JLabel errorDescripcion; private JLabel errorDescripcion;
private JLabel errorValor; private JLabel errorValor;
private JLabel errorTipoEgreso; private JLabel errorTipoEgreso;
private JButton editarButton;
private EgresosTableModel egresosTableModel; private EgresosTableModel egresosTableModel;
@@ -71,6 +73,10 @@ public class EgresosView {
return eliminarButton; return eliminarButton;
} }
public JButton getEditarButton() {
return editarButton;
}
public JTextField getValorField() { public JTextField getValorField() {
return valorField; return valorField;
} }
@@ -114,4 +120,119 @@ public class EgresosView {
public JLabel getErrorTipoEgreso() { public JLabel getErrorTipoEgreso() {
return errorTipoEgreso; return errorTipoEgreso;
} }
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
createUIComponents();
contentPanel = new JPanel();
contentPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
final JPanel panel1 = new JPanel();
panel1.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1));
contentPanel.add(panel1, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Egresos"));
final JScrollPane scrollPane1 = new JScrollPane();
panel1.add(scrollPane1, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane1.setViewportView(egresosTable);
final JPanel panel2 = new JPanel();
panel2.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(3, 4, new Insets(0, 0, 0, 0), -1, -1));
panel1.add(panel2, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JLabel label1 = new JLabel();
label1.setText("");
panel2.add(label1, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label2 = new JLabel();
label2.setText("Descripcion");
panel2.add(label2, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
descripcionField = new JTextField();
panel2.add(descripcionField, new com.intellij.uiDesigner.core.GridConstraints(1, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
nroField = new JTextField();
panel2.add(nroField, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
valorField = new JTextField();
panel2.add(valorField, new com.intellij.uiDesigner.core.GridConstraints(1, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JLabel label3 = new JLabel();
label3.setText("Valor");
panel2.add(label3, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label4 = new JLabel();
label4.setText("Tipo");
panel2.add(label4, new com.intellij.uiDesigner.core.GridConstraints(0, 3, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
tipoCombo = new JComboBox();
panel2.add(tipoCombo, new com.intellij.uiDesigner.core.GridConstraints(1, 3, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
errorNumero = new JLabel();
errorNumero.setEnabled(true);
errorNumero.setForeground(new Color(-65536));
errorNumero.setText("Error");
errorNumero.setVisible(false);
panel2.add(errorNumero, new com.intellij.uiDesigner.core.GridConstraints(2, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorDescripcion = new JLabel();
errorDescripcion.setEnabled(true);
errorDescripcion.setForeground(new Color(-65536));
errorDescripcion.setText("Error");
errorDescripcion.setVisible(false);
panel2.add(errorDescripcion, new com.intellij.uiDesigner.core.GridConstraints(2, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorValor = new JLabel();
errorValor.setEnabled(true);
errorValor.setForeground(new Color(-65536));
errorValor.setText("Error");
errorValor.setVisible(false);
panel2.add(errorValor, new com.intellij.uiDesigner.core.GridConstraints(2, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorTipoEgreso = new JLabel();
errorTipoEgreso.setEnabled(true);
errorTipoEgreso.setForeground(new Color(-65536));
errorTipoEgreso.setText("Error");
errorTipoEgreso.setVisible(false);
panel2.add(errorTipoEgreso, new com.intellij.uiDesigner.core.GridConstraints(2, 3, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
panel1.add(panel3, new com.intellij.uiDesigner.core.GridConstraints(2, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JPanel panel4 = new JPanel();
panel4.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
panel3.add(panel4, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
guardarButton = new JButton();
guardarButton.setText("Guardar");
guardarButton.setMnemonic('G');
guardarButton.setDisplayedMnemonicIndex(0);
panel4.add(guardarButton, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
eliminarButton = new JButton();
eliminarButton.setEnabled(false);
eliminarButton.setText("Eliminar");
eliminarButton.setMnemonic('E');
eliminarButton.setDisplayedMnemonicIndex(0);
panel4.add(eliminarButton, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
editarButton = new JButton();
editarButton.setEnabled(false);
editarButton.setText("Editar");
editarButton.setMnemonic('E');
editarButton.setDisplayedMnemonicIndex(0);
panel4.add(editarButton, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final com.intellij.uiDesigner.core.Spacer spacer1 = new com.intellij.uiDesigner.core.Spacer();
panel3.add(spacer1, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JPanel panel5 = new JPanel();
panel5.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
panel3.add(panel5, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JLabel label5 = new JLabel();
label5.setText("Total Egresos:");
panel5.add(label5, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
totalEgresosField = new JTextField();
totalEgresosField.setEditable(false);
panel5.add(totalEgresosField, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contentPanel;
}
} }

View File

@@ -127,7 +127,7 @@
</component> </component>
</children> </children>
</grid> </grid>
<grid id="6385a" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="6385a" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -155,6 +155,16 @@
<text value="Eliminar"/> <text value="Eliminar"/>
</properties> </properties>
</component> </component>
<component id="6be05" class="javax.swing.JButton" binding="editarButton">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Editar"/>
</properties>
</component>
</children> </children>
</grid> </grid>
<hspacer id="7b168"> <hspacer id="7b168">

View File

@@ -28,6 +28,7 @@ import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
import danielcortes.xyz.views.components.IngresosTableModel; import danielcortes.xyz.views.components.IngresosTableModel;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
public class IngresosView { public class IngresosView {
private JPanel contentPanel; private JPanel contentPanel;
@@ -39,6 +40,7 @@ public class IngresosView {
private JComboBox<TipoIngreso> tipoCombo; private JComboBox<TipoIngreso> tipoCombo;
private JLabel errorTipoIngreso; private JLabel errorTipoIngreso;
private JLabel errorValor; private JLabel errorValor;
private JButton editarButton;
private IngresosTableModel ingresosTableModel; private IngresosTableModel ingresosTableModel;
@@ -69,6 +71,10 @@ public class IngresosView {
return eliminarButton; return eliminarButton;
} }
public JButton getEditarButton() {
return editarButton;
}
public JTextField getTotalIngresoField() { public JTextField getTotalIngresoField() {
return totalIngresoField; return totalIngresoField;
} }
@@ -92,4 +98,90 @@ public class IngresosView {
public JLabel getErrorValor() { public JLabel getErrorValor() {
return errorValor; return errorValor;
} }
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
createUIComponents();
contentPanel = new JPanel();
contentPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
final JPanel panel1 = new JPanel();
panel1.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1));
contentPanel.add(panel1, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Ingresos"));
final JScrollPane scrollPane1 = new JScrollPane();
panel1.add(scrollPane1, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane1.setViewportView(ingresosTable);
final JPanel panel2 = new JPanel();
panel2.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1));
panel1.add(panel2, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JLabel label1 = new JLabel();
label1.setText("Tipo");
panel2.add(label1, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label2 = new JLabel();
label2.setText("Valor");
panel2.add(label2, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
valorField = new JTextField();
panel2.add(valorField, new com.intellij.uiDesigner.core.GridConstraints(1, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
tipoCombo = new JComboBox();
final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
tipoCombo.setModel(defaultComboBoxModel1);
panel2.add(tipoCombo, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
errorTipoIngreso = new JLabel();
errorTipoIngreso.setForeground(new Color(-65536));
errorTipoIngreso.setText("Label");
errorTipoIngreso.setVisible(false);
panel2.add(errorTipoIngreso, new com.intellij.uiDesigner.core.GridConstraints(2, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorValor = new JLabel();
errorValor.setForeground(new Color(-65536));
errorValor.setText("Label");
errorValor.setVisible(false);
panel2.add(errorValor, new com.intellij.uiDesigner.core.GridConstraints(2, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
panel1.add(panel3, new com.intellij.uiDesigner.core.GridConstraints(2, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JPanel panel4 = new JPanel();
panel4.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
panel3.add(panel4, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JLabel label3 = new JLabel();
label3.setText("Total Ingresos");
panel4.add(label3, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_EAST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
totalIngresoField = new JTextField();
panel4.add(totalIngresoField, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JPanel panel5 = new JPanel();
panel5.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
panel3.add(panel5, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
guardarButton = new JButton();
guardarButton.setText("Añadir");
guardarButton.setMnemonic('A');
guardarButton.setDisplayedMnemonicIndex(0);
panel5.add(guardarButton, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
eliminarButton = new JButton();
eliminarButton.setText("Eliminar");
panel5.add(eliminarButton, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
editarButton = new JButton();
editarButton.setText("Editar");
panel5.add(editarButton, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final com.intellij.uiDesigner.core.Spacer spacer1 = new com.intellij.uiDesigner.core.Spacer();
panel3.add(spacer1, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contentPanel;
}
} }

View File

@@ -16,7 +16,7 @@
<border type="none"/> <border type="none"/>
<children/> <children/>
</grid> </grid>
<grid id="b2933" binding="controlsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="b2933" binding="controlsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -26,7 +26,7 @@
<children> <children>
<component id="a853b" class="javax.swing.JToggleButton" binding="egresosButton"> <component id="a853b" class="javax.swing.JToggleButton" binding="egresosButton">
<constraints> <constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"> <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/> <preferred-size width="200" height="-1"/>
</grid> </grid>
</constraints> </constraints>
@@ -44,6 +44,22 @@
<text value="&amp;Ingresos"/> <text value="&amp;Ingresos"/>
</properties> </properties>
</component> </component>
<component id="d23e2" class="javax.swing.JToggleButton" binding="arqueoButton">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="&amp;Arqueo"/>
</properties>
</component>
<component id="43ef1" class="com.github.lgooddatepicker.components.DatePicker" binding="datePicker">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
</children> </children>
</grid> </grid>
</children> </children>
@@ -52,6 +68,7 @@
<group name="btnGroup"> <group name="btnGroup">
<member id="a853b"/> <member id="a853b"/>
<member id="a494c"/> <member id="a494c"/>
<member id="d23e2"/>
</group> </group>
</buttonGroups> </buttonGroups>
<inspectionSuppressions> <inspectionSuppressions>

View File

@@ -24,7 +24,10 @@
package danielcortes.xyz.views; package danielcortes.xyz.views;
import com.github.lgooddatepicker.components.DatePicker;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
public class ManagerView { public class ManagerView {
private JToggleButton egresosButton; private JToggleButton egresosButton;
@@ -32,6 +35,8 @@ public class ManagerView {
private JPanel contentPanel; private JPanel contentPanel;
private JPanel cardPanel; private JPanel cardPanel;
private JPanel controlsPanel; private JPanel controlsPanel;
private JToggleButton arqueoButton;
private DatePicker datePicker;
public JToggleButton getEgresosButton() { public JToggleButton getEgresosButton() {
return egresosButton; return egresosButton;
@@ -41,6 +46,14 @@ public class ManagerView {
return ingresosButton; return ingresosButton;
} }
public JToggleButton getArqueoButton() {
return arqueoButton;
}
public DatePicker getDatePicker() {
return datePicker;
}
public JPanel getContentPanel() { public JPanel getContentPanel() {
return contentPanel; return contentPanel;
} }
@@ -48,4 +61,60 @@ public class ManagerView {
public JPanel getCardPanel() { public JPanel getCardPanel() {
return cardPanel; return cardPanel;
} }
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
contentPanel = new JPanel();
contentPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));
cardPanel = new JPanel();
cardPanel.setLayout(new CardLayout(0, 0));
contentPanel.add(cardPanel, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
controlsPanel = new JPanel();
controlsPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), -1, -1));
contentPanel.add(controlsPanel, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
egresosButton = new JToggleButton();
egresosButton.setText("Egresos");
egresosButton.setMnemonic('E');
egresosButton.setDisplayedMnemonicIndex(0);
controlsPanel.add(egresosButton, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, -1), null, 0, false));
ingresosButton = new JToggleButton();
ingresosButton.setText("Ingresos");
ingresosButton.setMnemonic('I');
ingresosButton.setDisplayedMnemonicIndex(0);
controlsPanel.add(ingresosButton, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, -1), null, 0, false));
arqueoButton = new JToggleButton();
arqueoButton.setText("Arqueo");
arqueoButton.setMnemonic('A');
arqueoButton.setDisplayedMnemonicIndex(0);
controlsPanel.add(arqueoButton, new com.intellij.uiDesigner.core.GridConstraints(0, 3, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, -1), null, 0, false));
datePicker = new DatePicker();
controlsPanel.add(datePicker, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
ButtonGroup buttonGroup;
buttonGroup = new ButtonGroup();
buttonGroup.add(egresosButton);
buttonGroup.add(ingresosButton);
buttonGroup.add(arqueoButton);
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contentPanel;
}
} }

View File

@@ -70,7 +70,7 @@ public class EgresosTableModel extends AbstractTableModel {
case 2: case 2:
return rows.get(row).getValor(); return rows.get(row).getValor();
case 3: case 3:
return rows.get(row).getTipo(); return rows.get(row).getTipoEgreso();
} }
return null; return null;
} }
@@ -78,4 +78,9 @@ public class EgresosTableModel extends AbstractTableModel {
public Egreso getEgreso(int row){ public Egreso getEgreso(int row){
return rows.get(row); return rows.get(row);
} }
public void setEgreso(int editingId, Egreso egreso) {
this.rows.set(editingId, egreso);
this.fireTableRowsUpdated(0,getRowCount()-1);
}
} }

View File

@@ -35,7 +35,7 @@ public class IngresosTableModel extends AbstractTableModel {
public IngresosTableModel(){ public IngresosTableModel(){
super(); super();
this.columns = new String[]{"Valor", "Tipo"}; this.columns = new String[]{"Tipo", "Valor"};
this.rows = new ArrayList<>(); this.rows = new ArrayList<>();
} }
@@ -53,20 +53,30 @@ public class IngresosTableModel extends AbstractTableModel {
public void addRow(Ingreso ingreso) { public void addRow(Ingreso ingreso) {
this.rows.add(ingreso); this.rows.add(ingreso);
this.fireTableRowsInserted(0,getRowCount()-1); this.fireTableRowsInserted(getRowCount()-1, getRowCount()-1);
} }
public void removeRow(int row){ public void removeRow(int row){
this.rows.remove(row); this.rows.remove(row);
this.fireTableRowsDeleted(0,getRowCount()-1); this.fireTableRowsDeleted(row,row);
} }
public void removeRows(){
int rowCount = getRowCount();
if(rowCount > 0){
this.rows.clear();
System.out.println("deleted from " + 0 + " to " + rowCount);
this.fireTableRowsDeleted(0, rowCount-1);
}
}
public Object getValueAt(int row, int col) { public Object getValueAt(int row, int col) {
switch (col) { switch (col) {
case 0: case 0:
return this.rows.get(row).getValor();
case 1:
return this.rows.get(row).getTipoIngreso().getNombre(); return this.rows.get(row).getTipoIngreso().getNombre();
case 1:
return this.rows.get(row).getValor();
} }
return null; return null;
} }
@@ -75,4 +85,8 @@ public class IngresosTableModel extends AbstractTableModel {
return this.rows.get(row); return this.rows.get(row);
} }
public void setIngreso(int editingId, Ingreso ingreso) {
this.rows.set(editingId, ingreso);
this.fireTableRowsUpdated(getRowCount()-2, getRowCount()-1);
}
} }

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: danielcortes.xyz.Main

View File

@@ -1,10 +0,0 @@
{
"egresos": [
{
"nro": "1",
"descripcion": "2",
"valor": 123,
"tipo": 1
}
]
}