Eliminando cosas, se esta eliminando el soporte de maven y se replazo por el sistema de intellij
This commit is contained in:
21
LICENSE
21
LICENSE
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2018 Daniel Cortés
|
|
||||||
|
|
||||||
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.
|
|
||||||
29
caja.iml
29
caja.iml
@@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
|
||||||
<output url="file://$MODULE_DIR$/target/classes" />
|
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library>
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$APPLICATION_HOME_DIR$/redist/forms_rt.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<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: com.google.protobuf:protobuf-java:3.6.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.25.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.lgooddatepicker:LGoodDatePicker:10.3.1" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# configuracion del sistema de Caja
|
|
||||||
|
|
||||||
# configuracion de la base de datos:
|
|
||||||
|
|
||||||
# database_type sirve para elegir el sistema de base de datos que utilizara el sistema.
|
|
||||||
# los valores soportados son:
|
|
||||||
# - mysql
|
|
||||||
# - sqlite
|
|
||||||
|
|
||||||
#database_type = mysql
|
|
||||||
database_type = sqlite
|
|
||||||
|
|
||||||
# database_uri es la uri de la base de datos con la que se conectara el sistema.
|
|
||||||
# debe corresponder con el sistema de base de datos seleccionado en database_type
|
|
||||||
|
|
||||||
#database_uri = jdbc:mysql://localhost/caja?user=root&password=lagging&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
|
|
||||||
database_uri = jdbc:sqlite:database.sqlite
|
|
||||||
|
|
||||||
|
|
||||||
# look_and_feel elige el look and feel que intentara utilizar la aplicacion, si el seleccionado no funciona en el sistema operativo se hara fallback a metal.
|
|
||||||
|
|
||||||
look_and_feel = javax.swing.plaf.metal.MetalLookAndFeel
|
|
||||||
#look_and_feel = com.sun.java.swing.plaf.motif.MotifLookAndFeel
|
|
||||||
#look_and_feel = com.sun.java.swing.plaf.gtk.GTKLookAndFeel
|
|
||||||
#look_and_feel = com.sun.java.swing.plaf.windows.WindowsLookAndFeel
|
|
||||||
BIN
database.sqlite
BIN
database.sqlite
Binary file not shown.
@@ -1,119 +0,0 @@
|
|||||||
/*
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
drop table if exists egresos;
|
|
||||||
drop table if exists tipos_egreso;
|
|
||||||
drop table if exists ingresos;
|
|
||||||
drop table if exists tipos_ingreso;
|
|
||||||
drop table if exists efectivos;
|
|
||||||
drop table if exists documentos;
|
|
||||||
drop table if exists caja;
|
|
||||||
|
|
||||||
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,
|
|
||||||
nombre varchar(191) not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table egresos
|
|
||||||
(
|
|
||||||
id int(10) unsigned primary key auto_increment,
|
|
||||||
nro varchar(191) not null,
|
|
||||||
descripcion varchar(191) not null,
|
|
||||||
valor int(10) not null,
|
|
||||||
tipo_egreso_id int(10) unsigned not null,
|
|
||||||
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
|
|
||||||
(
|
|
||||||
id int(10) unsigned primary key auto_increment,
|
|
||||||
nombre varchar(191) not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table ingresos
|
|
||||||
(
|
|
||||||
id int(10) unsigned primary key auto_increment,
|
|
||||||
valor int(10) not null,
|
|
||||||
nro_inicial varchar(191) not null,
|
|
||||||
nro_final varchar(191) not null,
|
|
||||||
tipo_ingreso_id int(10) unsigned not null,
|
|
||||||
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
|
|
||||||
);
|
|
||||||
|
|
||||||
create table efectivos
|
|
||||||
(
|
|
||||||
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'),
|
|
||||||
('Gasto Menor Materia Prima'),
|
|
||||||
('Gasto General Sin Respaldo'),
|
|
||||||
('Gasto General Con Boleta'),
|
|
||||||
('Guia Materia Prima'),
|
|
||||||
('Anticipo Arriendo'),
|
|
||||||
('Anticipo Personal'),
|
|
||||||
('Pago Partime'),
|
|
||||||
('Retiros Gerencia'),
|
|
||||||
('Otro');
|
|
||||||
|
|
||||||
insert into tipos_ingreso (nombre)
|
|
||||||
values ('Boletas Fiscales'),
|
|
||||||
('Boletas Manuales'),
|
|
||||||
('Facturas'),
|
|
||||||
('Guias')
|
|
||||||
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
/*
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
pragma foreign_keys = ON;
|
|
||||||
|
|
||||||
drop table if exists egresos;
|
|
||||||
drop table if exists tipos_egreso;
|
|
||||||
drop table if exists ingresos;
|
|
||||||
drop table if exists tipos_ingreso;
|
|
||||||
drop table if exists efectivos;
|
|
||||||
drop table if exists documentos;
|
|
||||||
drop table if exists caja;
|
|
||||||
|
|
||||||
create table caja
|
|
||||||
(
|
|
||||||
id integer primary key,
|
|
||||||
fecha date not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table tipos_egreso
|
|
||||||
(
|
|
||||||
id integer primary key,
|
|
||||||
nombre text not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table egresos
|
|
||||||
(
|
|
||||||
id integer primary key,
|
|
||||||
nro text not null,
|
|
||||||
descripcion text not null,
|
|
||||||
valor integer not null,
|
|
||||||
tipo_egreso_id integer not null,
|
|
||||||
caja_id integer not null,
|
|
||||||
foreign key (tipo_egreso_id) references tipos_egreso (id) on update cascade on delete restrict,
|
|
||||||
foreign key (caja_id) references caja (id) on update cascade on delete restrict
|
|
||||||
);
|
|
||||||
|
|
||||||
create table tipos_ingreso
|
|
||||||
(
|
|
||||||
id integer primary key,
|
|
||||||
nombre text not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table ingresos
|
|
||||||
(
|
|
||||||
id integer primary key,
|
|
||||||
valor integer not null,
|
|
||||||
nro_inicial text not null,
|
|
||||||
nro_final text not null,
|
|
||||||
tipo_ingreso_id integer unsigned not null,
|
|
||||||
caja_id integer unsigned not null,
|
|
||||||
foreign key (tipo_ingreso_id) references tipos_ingreso (id) on update cascade on delete restrict,
|
|
||||||
foreign key (caja_id) references caja (id) on update cascade on delete restrict
|
|
||||||
);
|
|
||||||
|
|
||||||
create table efectivos
|
|
||||||
(
|
|
||||||
id integer primary key,
|
|
||||||
veinte_mil integer not null,
|
|
||||||
diez_mil integer not null,
|
|
||||||
cinco_mil integer not null,
|
|
||||||
dos_mil integer not null,
|
|
||||||
mil integer not null,
|
|
||||||
quinientos integer not null,
|
|
||||||
cien integer not null,
|
|
||||||
cincuenta integer not null,
|
|
||||||
diez integer not null,
|
|
||||||
caja_id integer not null,
|
|
||||||
foreign key (caja_id) references caja (id) on update cascade on delete restrict
|
|
||||||
);
|
|
||||||
|
|
||||||
create table documentos
|
|
||||||
(
|
|
||||||
id integer primary key,
|
|
||||||
cheques integer not null,
|
|
||||||
tarjetas integer not null,
|
|
||||||
caja_id integer not null,
|
|
||||||
foreign key (caja_id) references caja (id) on update cascade on delete restrict
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
insert into tipos_egreso (nombre)
|
|
||||||
values ('Factura Materia Prima'),
|
|
||||||
('Factura Gastos Generales'),
|
|
||||||
('Gasto Menor Materia Prima'),
|
|
||||||
('Gasto General Sin Respaldo'),
|
|
||||||
('Gasto General Con Boleta'),
|
|
||||||
('Guia Materia Prima'),
|
|
||||||
('Anticipo Arriendo'),
|
|
||||||
('Anticipo Personal'),
|
|
||||||
('Pago Partime'),
|
|
||||||
('Retiros Gerencia'),
|
|
||||||
('Otro');
|
|
||||||
|
|
||||||
insert into tipos_ingreso (nombre)
|
|
||||||
values ('Boletas Fiscales'),
|
|
||||||
('Boletas Manuales'),
|
|
||||||
('Facturas'),
|
|
||||||
('Guias')
|
|
||||||
|
|
||||||
47
pom.xml
47
pom.xml
@@ -1,47 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>danielcortes.xyz</groupId>
|
|
||||||
<artifactId>caja</artifactId>
|
|
||||||
<version>0.1</version>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.0</version>
|
|
||||||
<configuration>
|
|
||||||
<release>8</release>
|
|
||||||
<source>8</source>
|
|
||||||
<target>8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
<version>2.8.5</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<version>8.0.13</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.xerial</groupId>
|
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
|
||||||
<version>3.25.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.lgooddatepicker</groupId>
|
|
||||||
<artifactId>LGoodDatePicker</artifactId>
|
|
||||||
<version>10.3.1</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
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.models.caja.SQLiteCajaDAO;
|
|
||||||
import danielcortes.xyz.models.documentos.DocumentosDAO;
|
|
||||||
import danielcortes.xyz.models.documentos.MysqlDocumentosDAO;
|
|
||||||
import danielcortes.xyz.models.documentos.SQLiteDocumentosDAO;
|
|
||||||
import danielcortes.xyz.models.efectivo.EfectivoDAO;
|
|
||||||
import danielcortes.xyz.models.efectivo.MysqlEfectivoDAO;
|
|
||||||
import danielcortes.xyz.models.efectivo.SQLiteEfectivoDAO;
|
|
||||||
import danielcortes.xyz.models.egreso.EgresoDAO;
|
|
||||||
import danielcortes.xyz.models.egreso.MysqlEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.egreso.SQLiteEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.ingreso.IngresoDAO;
|
|
||||||
import danielcortes.xyz.models.ingreso.MysqlIngresoDAO;
|
|
||||||
import danielcortes.xyz.models.ingreso.SQLiteIngresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.MysqlTipoEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.SQLiteTipoEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.MysqlTipoIngresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.SQLiteTipoIngresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
|
|
||||||
import danielcortes.xyz.views.ManagerView;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args) throws SQLException {
|
|
||||||
System.setProperty("awt.useSystemAAFontSettings", "on");
|
|
||||||
System.setProperty("swing.aatext", "true");
|
|
||||||
|
|
||||||
try {
|
|
||||||
UIManager.setLookAndFeel(Properties.getInstance().getProperty("look_and_feel"));
|
|
||||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
Locale.setDefault(new Locale("es"));
|
|
||||||
|
|
||||||
|
|
||||||
CajaDAO cajaDAO = null;
|
|
||||||
DocumentosDAO documentosDAO = null;
|
|
||||||
EfectivoDAO efectivoDAO = null;
|
|
||||||
EgresoDAO egresoDAO = null;
|
|
||||||
IngresoDAO ingresoDAO = null;
|
|
||||||
TipoEgresoDAO tipoEgresoDAO = null;
|
|
||||||
TipoIngresoDAO tipoIngresoDAO = null;
|
|
||||||
|
|
||||||
if(Properties.getInstance().getProperty("database_type").equals("mysql")){
|
|
||||||
cajaDAO = new MysqlCajaDAO();
|
|
||||||
documentosDAO = new MysqlDocumentosDAO();
|
|
||||||
efectivoDAO = new MysqlEfectivoDAO();
|
|
||||||
egresoDAO = new MysqlEgresoDAO();
|
|
||||||
ingresoDAO = new MysqlIngresoDAO();
|
|
||||||
tipoEgresoDAO = new MysqlTipoEgresoDAO();
|
|
||||||
tipoIngresoDAO = new MysqlTipoIngresoDAO();
|
|
||||||
}else if(Properties.getInstance().getProperty("database_type").equals("sqlite")){
|
|
||||||
cajaDAO = new SQLiteCajaDAO();
|
|
||||||
documentosDAO = new SQLiteDocumentosDAO();
|
|
||||||
efectivoDAO = new SQLiteEfectivoDAO();
|
|
||||||
egresoDAO = new SQLiteEgresoDAO();
|
|
||||||
ingresoDAO = new SQLiteIngresoDAO();
|
|
||||||
tipoEgresoDAO = new SQLiteTipoEgresoDAO();
|
|
||||||
tipoIngresoDAO = new SQLiteTipoIngresoDAO();
|
|
||||||
}
|
|
||||||
|
|
||||||
ManagerView view = new ManagerView();
|
|
||||||
ManagerController managerController = new ManagerController(view, cajaDAO, documentosDAO, efectivoDAO, egresoDAO, ingresoDAO, tipoEgresoDAO, tipoIngresoDAO);
|
|
||||||
|
|
||||||
JFrame frame = new JFrame("Caja");
|
|
||||||
frame.setContentPane(view.getContentPanel());
|
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
||||||
//frame.setSize(780, 450);
|
|
||||||
frame.pack();
|
|
||||||
frame.setLocationRelativeTo(null);
|
|
||||||
frame.setVisible(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,324 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.documentos.Documentos;
|
|
||||||
import danielcortes.xyz.models.documentos.DocumentosDAO;
|
|
||||||
import danielcortes.xyz.models.efectivo.Efectivo;
|
|
||||||
import danielcortes.xyz.models.efectivo.EfectivoDAO;
|
|
||||||
import danielcortes.xyz.models.egreso.EgresoDAO;
|
|
||||||
import danielcortes.xyz.models.ingreso.IngresoDAO;
|
|
||||||
import danielcortes.xyz.views.ArqueoView;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
|
|
||||||
public class ArqueoController {
|
|
||||||
private ArqueoView view;
|
|
||||||
private Caja caja;
|
|
||||||
private Efectivo efectivo;
|
|
||||||
private Documentos documentos;
|
|
||||||
|
|
||||||
private EfectivoDAO efectivoDAO;
|
|
||||||
private DocumentosDAO documentosDAO;
|
|
||||||
private IngresoDAO ingresoDAO;
|
|
||||||
private EgresoDAO egresoDAO;
|
|
||||||
|
|
||||||
public ArqueoController(ArqueoView view, EfectivoDAO efectivoDAO, DocumentosDAO documentosDAO, IngresoDAO ingresoDAO, EgresoDAO egresoDAO) {
|
|
||||||
this.view = view;
|
|
||||||
this.efectivoDAO = efectivoDAO;
|
|
||||||
this.documentosDAO = documentosDAO;
|
|
||||||
this.ingresoDAO = ingresoDAO;
|
|
||||||
this.egresoDAO = egresoDAO;
|
|
||||||
|
|
||||||
this.setUpViewEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateCaja(Caja caja) {
|
|
||||||
this.caja = caja;
|
|
||||||
fillDocumentos();
|
|
||||||
fillEfectivo();
|
|
||||||
fillResumen();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateResumen() {
|
|
||||||
this.fillResumen();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillEfectivo() {
|
|
||||||
this.efectivo = this.efectivoDAO.findByCaja(this.caja);
|
|
||||||
this.view.getVeinteMilField().setText(String.valueOf(efectivo.getVeinteMil()));
|
|
||||||
this.view.getDiezMilField().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 fillDocumentos() {
|
|
||||||
this.documentos = this.documentosDAO.findByCaja(caja);
|
|
||||||
this.view.getTarjetasField().setText(String.valueOf(documentos.getTarjetas()));
|
|
||||||
this.view.getChequesField().setText(String.valueOf(documentos.getCheques()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillResumen() {
|
|
||||||
this.updateResumenEfectivo();
|
|
||||||
this.updateResumenDocumentos();
|
|
||||||
this.updateResumenIngresos();
|
|
||||||
this.updateResumenEgresos();
|
|
||||||
this.updateResumenArqueo();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateResumenEfectivo() {
|
|
||||||
JTextField efectivoField = this.view.getEfectivoField();
|
|
||||||
int total = 0;
|
|
||||||
total += this.efectivo.getDiez();
|
|
||||||
total += this.efectivo.getCincuenta();
|
|
||||||
total += this.efectivo.getCien();
|
|
||||||
total += this.efectivo.getQuinientos();
|
|
||||||
total += this.efectivo.getMil();
|
|
||||||
total += this.efectivo.getDosMil();
|
|
||||||
total += this.efectivo.getCincoMil();
|
|
||||||
total += this.efectivo.getDiezMil();
|
|
||||||
total += this.efectivo.getVeinteMil();
|
|
||||||
|
|
||||||
efectivoField.setText(String.valueOf(total));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateResumenDocumentos() {
|
|
||||||
JTextField documentosField = this.view.getDocumentosField();
|
|
||||||
int total = 0;
|
|
||||||
total += this.documentos.getCheques();
|
|
||||||
total += this.documentos.getTarjetas();
|
|
||||||
|
|
||||||
documentosField.setText(String.valueOf(total));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateResumenIngresos() {
|
|
||||||
int total = this.ingresoDAO.getTotalIngreso(this.caja);
|
|
||||||
this.view.getIngresosField().setText(String.valueOf(total));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateResumenEgresos() {
|
|
||||||
int total = this.egresoDAO.getTotalEgreso(this.caja);
|
|
||||||
this.view.getEgresosField().setText(String.valueOf(total));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateResumenArqueo() {
|
|
||||||
int totalEfectivo = Integer.parseInt(this.view.getEfectivoField().getText());
|
|
||||||
int totalDocumentos = Integer.parseInt(this.view.getDocumentosField().getText());
|
|
||||||
int totalIngresos = Integer.parseInt(this.view.getIngresosField().getText());
|
|
||||||
int totalEgresos = Integer.parseInt(this.view.getEgresosField().getText());
|
|
||||||
|
|
||||||
int arqueo = totalDocumentos + totalEfectivo + totalEgresos;
|
|
||||||
int ajuste = arqueo - totalIngresos;
|
|
||||||
|
|
||||||
this.view.getArqueoField().setText(String.valueOf(arqueo));
|
|
||||||
this.view.getRendidoField().setText(String.valueOf(totalIngresos));
|
|
||||||
this.view.getAjusteField().setText(String.valueOf(ajuste));
|
|
||||||
|
|
||||||
if(ajuste < 0) {
|
|
||||||
this.view.getAjusteField().setForeground(new Color(255,0,0));
|
|
||||||
}else{
|
|
||||||
this.view.getAjusteField().setForeground(new Color(0,0,0));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpViewEvents() {
|
|
||||||
this.view.getGuardarEfectivoButton().addActionListener(e -> {
|
|
||||||
this.normalizeEfectivoInput();
|
|
||||||
this.guardarEfectivo();
|
|
||||||
});
|
|
||||||
this.view.getGuardarDocumentosButton().addActionListener(e -> {
|
|
||||||
this.normalizeDocumentosInput();
|
|
||||||
this.guardarDocumentos();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void guardarEfectivo() {
|
|
||||||
String diez = this.view.getDiezField().getText();
|
|
||||||
String cincuenta = this.view.getCincuentaField().getText();
|
|
||||||
String cien = this.view.getCienField().getText();
|
|
||||||
String quinientos = this.view.getQuinientosField().getText();
|
|
||||||
String mil = this.view.getMilField().getText();
|
|
||||||
String dosMil = this.view.getDosMilField().getText();
|
|
||||||
String cincoMil = this.view.getCincoMilField().getText();
|
|
||||||
String diezMil = this.view.getDiezMilField().getText();
|
|
||||||
String veinteMil = this.view.getVeinteMilField().getText();
|
|
||||||
|
|
||||||
if (this.validateEfectivoInput(diez, cincuenta, cien, quinientos, mil, dosMil, cincoMil, diezMil, veinteMil)) {
|
|
||||||
this.efectivo.setDiez(Integer.valueOf(diez));
|
|
||||||
this.efectivo.setCincuenta(Integer.valueOf(cincuenta));
|
|
||||||
this.efectivo.setCien(Integer.valueOf(cien));
|
|
||||||
this.efectivo.setQuinientos(Integer.valueOf(quinientos));
|
|
||||||
this.efectivo.setMil(Integer.valueOf(mil));
|
|
||||||
this.efectivo.setDosMil(Integer.valueOf(dosMil));
|
|
||||||
this.efectivo.setCincoMil(Integer.valueOf(cincoMil));
|
|
||||||
this.efectivo.setDiezMil(Integer.valueOf(diezMil));
|
|
||||||
this.efectivo.setVeinteMil(Integer.valueOf(veinteMil));
|
|
||||||
this.efectivoDAO.updateEfectivo(efectivo);
|
|
||||||
|
|
||||||
this.updateResumenEfectivo();
|
|
||||||
this.updateResumenArqueo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void guardarDocumentos() {
|
|
||||||
String tarjetas = this.view.getTarjetasField().getText();
|
|
||||||
String cheques = this.view.getChequesField().getText();
|
|
||||||
|
|
||||||
if (this.validateDocumentosInput(tarjetas, cheques)) {
|
|
||||||
this.documentos.setTarjetas(Integer.valueOf(tarjetas));
|
|
||||||
this.documentos.setCheques(Integer.valueOf(cheques));
|
|
||||||
this.documentosDAO.updateDocumentos(documentos);
|
|
||||||
|
|
||||||
this.updateResumenDocumentos();
|
|
||||||
this.updateResumenArqueo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateEfectivoInput(String diez, String cincuenta, String cien, String quinientos, String mil, String dosMil, String cincoMil, String diezMil, String veinteMil) {
|
|
||||||
this.hiddeEfectivoErrorMessages();
|
|
||||||
|
|
||||||
boolean diezValidation = validateEfectivoMoneda(diez, this.view.getErrorDiez());
|
|
||||||
boolean cincuentaValidation = validateEfectivoMoneda(cincuenta, this.view.getErrorCincuenta());
|
|
||||||
boolean cienValidation = validateEfectivoMoneda(cien, this.view.getErrorCien());
|
|
||||||
boolean quinientosValidation = validateEfectivoMoneda(quinientos, this.view.getErrorQuinientos());
|
|
||||||
boolean milValidation = validateEfectivoMoneda(mil, this.view.getErrorMil());
|
|
||||||
boolean dosMilValidation = validateEfectivoMoneda(dosMil, this.view.getErrorDosMil());
|
|
||||||
boolean cincoMilValidation = validateEfectivoMoneda(cincoMil, this.view.getErrorCincoMil());
|
|
||||||
boolean diezMilValidation = validateEfectivoMoneda(diezMil, this.view.getErrorDiezMil());
|
|
||||||
boolean veinteMilValidation = validateEfectivoMoneda(veinteMil, this.view.getErrorVeinteMil());
|
|
||||||
|
|
||||||
return diezValidation && cincuentaValidation && cienValidation && quinientosValidation && milValidation && dosMilValidation && cincoMilValidation && diezMilValidation && veinteMilValidation;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateDocumentosInput(String tarjetas, String cheques) {
|
|
||||||
this.hiddeDocumentosErrorMessages();
|
|
||||||
|
|
||||||
boolean tarjetasValidation = validateDocumentosValor(tarjetas, this.view.getErrorTarjetas());
|
|
||||||
boolean chequesValidation = validateDocumentosValor(cheques, this.view.getErrorCheques());
|
|
||||||
|
|
||||||
return tarjetasValidation && chequesValidation;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateEfectivoMoneda(String valor, JLabel errorLabel) {
|
|
||||||
if (valor == null) {
|
|
||||||
errorLabel.setText("Hubo un problema con los datos");
|
|
||||||
errorLabel.setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valor.isEmpty()) {
|
|
||||||
errorLabel.setText("El campo esta vacio");
|
|
||||||
errorLabel.setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!valor.chars().allMatch(Character::isDigit)) {
|
|
||||||
errorLabel.setText("Deben ser numeros");
|
|
||||||
errorLabel.setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valor.length() > 10) {
|
|
||||||
errorLabel.setText("El numero ingresado es demasiado largo");
|
|
||||||
errorLabel.setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateDocumentosValor(String valor, JLabel errorLabel) {
|
|
||||||
|
|
||||||
if (valor == null) {
|
|
||||||
errorLabel.setText("Hubo un problema con los datos");
|
|
||||||
errorLabel.setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valor.isEmpty()) {
|
|
||||||
errorLabel.setText("El campo esta vacio");
|
|
||||||
errorLabel.setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!valor.chars().allMatch(Character::isDigit)) {
|
|
||||||
errorLabel.setText("Deben ser numeros");
|
|
||||||
errorLabel.setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valor.length() > 10) {
|
|
||||||
errorLabel.setText("El numero ingresado es demasiado largo");
|
|
||||||
errorLabel.setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hiddeEfectivoErrorMessages() {
|
|
||||||
this.view.getErrorDiez().setVisible(false);
|
|
||||||
this.view.getErrorCincuenta().setVisible(false);
|
|
||||||
this.view.getErrorCien().setVisible(false);
|
|
||||||
this.view.getErrorQuinientos().setVisible(false);
|
|
||||||
this.view.getErrorMil().setVisible(false);
|
|
||||||
this.view.getErrorDosMil().setVisible(false);
|
|
||||||
this.view.getErrorCincoMil().setVisible(false);
|
|
||||||
this.view.getErrorDiezMil().setVisible(false);
|
|
||||||
this.view.getErrorVeinteMil().setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hiddeDocumentosErrorMessages(){
|
|
||||||
this.view.getErrorTarjetas().setVisible(false);
|
|
||||||
this.view.getErrorCheques().setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void normalizeEfectivoInput() {
|
|
||||||
this.view.getDiezField().setText(this.view.getDiezField().getText().trim());
|
|
||||||
this.view.getCincuentaField().setText(this.view.getCincuentaField().getText().trim());
|
|
||||||
this.view.getCienField().setText(this.view.getCienField().getText().trim());
|
|
||||||
this.view.getQuinientosField().setText(this.view.getQuinientosField().getText().trim());
|
|
||||||
this.view.getMilField().setText(this.view.getMilField().getText().trim());
|
|
||||||
this.view.getDosMilField().setText(this.view.getDosMilField().getText().trim());
|
|
||||||
this.view.getCincoMilField().setText(this.view.getCincoMilField().getText().trim());
|
|
||||||
this.view.getDiezMilField().setText(this.view.getDiezMilField().getText().trim());
|
|
||||||
this.view.getVeinteMilField().setText(this.view.getVeinteMilField().getText().trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void normalizeDocumentosInput() {
|
|
||||||
this.view.getChequesField().setText(this.view.getChequesField().getText().trim());
|
|
||||||
this.view.getTarjetasField().setText(this.view.getTarjetasField().getText().trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,319 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.egreso.Egreso;
|
|
||||||
import danielcortes.xyz.models.egreso.EgresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgreso;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgresoDAO;
|
|
||||||
import danielcortes.xyz.views.EgresosView;
|
|
||||||
import danielcortes.xyz.views.components.EgresosTableModel;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.event.KeyAdapter;
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import java.awt.event.MouseAdapter;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
|
|
||||||
public class EgresosController {
|
|
||||||
private EgresosView view;
|
|
||||||
private EgresoDAO egresoDAO;
|
|
||||||
private TipoEgresoDAO tipoEgresoDAO;
|
|
||||||
private Caja caja;
|
|
||||||
|
|
||||||
private int editingId;
|
|
||||||
private boolean editing;
|
|
||||||
private Egreso editingEgreso;
|
|
||||||
|
|
||||||
public EgresosController(EgresosView view, EgresoDAO egresoDAO, TipoEgresoDAO tipoEgresoDAO) {
|
|
||||||
this.view = view;
|
|
||||||
this.egresoDAO = egresoDAO;
|
|
||||||
this.tipoEgresoDAO = tipoEgresoDAO;
|
|
||||||
this.setUpViewEvents();
|
|
||||||
this.fillTipoEgresoCombo();
|
|
||||||
this.updateButtonsEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
public EgresoDAO getEgresoDAO() {
|
|
||||||
return egresoDAO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TipoEgresoDAO getTipoEgresoDAO() {
|
|
||||||
return tipoEgresoDAO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateCaja(Caja caja){
|
|
||||||
this.caja = caja;
|
|
||||||
this.fillEgresosTable();
|
|
||||||
this.updateTotalEgresos();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillTipoEgresoCombo() {
|
|
||||||
JComboBox<TipoEgreso> tipoCombo = view.getTipoCombo();
|
|
||||||
for (TipoEgreso tipoEgreso : this.tipoEgresoDAO.findAll()) {
|
|
||||||
tipoCombo.addItem(tipoEgreso);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillEgresosTable() {
|
|
||||||
EgresosTableModel egresosTableModel = view.getEgresosTableModel();
|
|
||||||
egresosTableModel.removeRows();
|
|
||||||
for (Egreso egreso : this.egresoDAO.findByCaja(this.caja)) {
|
|
||||||
egresosTableModel.addRow(egreso);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpViewEvents() {
|
|
||||||
this.view.getEgresosTable().getSelectionModel().addListSelectionListener(e -> onSelectTableRowListener());
|
|
||||||
this.view.getGuardarButton().addActionListener(e -> guardarActionListener());
|
|
||||||
this.view.getEliminarButton().addActionListener(e -> eliminarActionListener());
|
|
||||||
this.view.getEditarButton().addActionListener(e -> editarActionListener());
|
|
||||||
this.view.getDescripcionField().addActionListener(e -> guardarActionListener());
|
|
||||||
this.view.getNroField().addActionListener(e -> guardarActionListener());
|
|
||||||
this.view.getValorField().addActionListener(e -> guardarActionListener());
|
|
||||||
this.view.getTipoCombo().addKeyListener(new KeyAdapter() {
|
|
||||||
@Override
|
|
||||||
public void keyPressed(KeyEvent e) {
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
|
||||||
guardarActionListener();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
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() {
|
|
||||||
this.normalizeInputs();
|
|
||||||
|
|
||||||
String nro = this.view.getNroField().getText();
|
|
||||||
String descripcion = this.view.getDescripcionField().getText();
|
|
||||||
String valor = this.view.getValorField().getText();
|
|
||||||
TipoEgreso tipo = (TipoEgreso) this.view.getTipoCombo().getSelectedItem();
|
|
||||||
|
|
||||||
if(editing){
|
|
||||||
this.editarEgreso(nro, descripcion, valor, tipo, this.caja);
|
|
||||||
}else {
|
|
||||||
this.guardarEgreso(nro, descripcion, valor, tipo, this.caja);
|
|
||||||
}
|
|
||||||
this.resetFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void eliminarActionListener() {
|
|
||||||
int selectedID = this.view.getEgresosTable().getSelectedRow();
|
|
||||||
if (selectedID >= 0) {
|
|
||||||
Egreso egreso = this.view.getEgresosTableModel().getEgreso(selectedID);
|
|
||||||
this.view.getEgresosTableModel().removeRow(selectedID);
|
|
||||||
this.egresoDAO.deleteEgreso(egreso);
|
|
||||||
this.updateTotalEgresos();
|
|
||||||
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() {
|
|
||||||
this.view.getEliminarButton().setEnabled(true);
|
|
||||||
this.view.getEditarButton().setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateTotalEgresos() {
|
|
||||||
int total = this.egresoDAO.getTotalEgreso(this.caja);
|
|
||||||
this.view.getTotalEgresosField().setText(String.valueOf(total));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateButtonsEnabled() {
|
|
||||||
if (this.view.getEgresosTable().getSelectedRow() >= 0) {
|
|
||||||
this.view.getEliminarButton().setEnabled(true);
|
|
||||||
this.view.getEditarButton().setEnabled(true);
|
|
||||||
} else {
|
|
||||||
this.view.getEliminarButton().setEnabled(false);
|
|
||||||
this.view.getEditarButton().setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void guardarEgreso(String nro, String descripcion, String valor, TipoEgreso tipo, Caja caja) {
|
|
||||||
if (this.validateInput(nro, descripcion, valor, tipo, caja)) {
|
|
||||||
Egreso egreso = new Egreso();
|
|
||||||
egreso.setValor(Integer.valueOf(valor));
|
|
||||||
egreso.setDescripcion(descripcion);
|
|
||||||
egreso.setNro(nro);
|
|
||||||
egreso.setTipoEgreso(tipo);
|
|
||||||
egreso.setCaja(caja);
|
|
||||||
egresoDAO.insertEgreso(egreso);
|
|
||||||
this.view.getEgresosTableModel().addRow(egreso);
|
|
||||||
this.updateTotalEgresos();
|
|
||||||
this.clearInputs();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void editarEgreso(String nro, String descripcion, String valor, TipoEgreso tipo, Caja caja) {
|
|
||||||
if (this.validateInput(nro, descripcion, valor, tipo, caja)) {
|
|
||||||
this.editingEgreso.setValor(Integer.valueOf(valor));
|
|
||||||
this.editingEgreso.setDescripcion(descripcion);
|
|
||||||
this.editingEgreso.setNro(nro);
|
|
||||||
this.editingEgreso.setTipoEgreso(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, Caja caja) {
|
|
||||||
this.hideErrorMessages();
|
|
||||||
|
|
||||||
boolean nroValidation = this.validateNro(nro);
|
|
||||||
boolean descripcionValidation = this.validateDescripcion(descripcion);
|
|
||||||
boolean valorValidation = this.validateValor(valor);
|
|
||||||
boolean tipoEgresoValidation = this.validateTipoEgreso(tipoEgreso);
|
|
||||||
boolean cajaValidation = this.validateCaja(caja);
|
|
||||||
|
|
||||||
return nroValidation && descripcionValidation && valorValidation && tipoEgresoValidation;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateNro(String nro) {
|
|
||||||
if (nro == null) {
|
|
||||||
this.view.getErrorNumero().setText("Hubo un problema con los datos");
|
|
||||||
this.view.getErrorNumero().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nro = nro.trim();
|
|
||||||
if (nro.isEmpty()) {
|
|
||||||
this.view.getErrorNumero().setText("El campo esta vacio");
|
|
||||||
this.view.getErrorNumero().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateDescripcion(String descripcion) {
|
|
||||||
if (descripcion == null) {
|
|
||||||
this.view.getErrorDescripcion().setText("Hubo un problema con los datos");
|
|
||||||
this.view.getErrorDescripcion().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
descripcion = descripcion.trim();
|
|
||||||
if (descripcion.isEmpty()) {
|
|
||||||
this.view.getErrorDescripcion().setText("El campo esta vacio");
|
|
||||||
this.view.getErrorDescripcion().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateValor(String valor) {
|
|
||||||
if (valor == null) {
|
|
||||||
this.view.getErrorValor().setText("Hubo un problema con los datos");
|
|
||||||
this.view.getErrorValor().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
valor = valor.trim();
|
|
||||||
if (valor.isEmpty()) {
|
|
||||||
this.view.getErrorValor().setText("El campo esta vacio");
|
|
||||||
this.view.getErrorValor().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!valor.chars().allMatch(Character::isDigit)) {
|
|
||||||
this.view.getErrorValor().setText("Deben ser numeros");
|
|
||||||
this.view.getErrorValor().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valor.length() > 10) {
|
|
||||||
this.view.getErrorValor().setText("El numero ingresado es demasiado largo");
|
|
||||||
this.view.getErrorValor().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
if (tipoEgreso == null) {
|
|
||||||
this.view.getErrorTipoEgreso().setText("Hubo un problema con los datos");
|
|
||||||
this.view.getErrorTipoEgreso().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateCaja(Caja caja){
|
|
||||||
return caja != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hideErrorMessages() {
|
|
||||||
this.view.getErrorTipoEgreso().setVisible(false);
|
|
||||||
this.view.getErrorValor().setVisible(false);
|
|
||||||
this.view.getErrorDescripcion().setVisible(false);
|
|
||||||
this.view.getErrorNumero().setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearInputs() {
|
|
||||||
this.view.getTipoCombo().setSelectedIndex(0);
|
|
||||||
this.view.getNroField().setText("");
|
|
||||||
this.view.getValorField().setText("");
|
|
||||||
this.view.getDescripcionField().setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void normalizeInputs(){
|
|
||||||
this.view.getValorField().setText(this.view.getValorField().getText().trim());
|
|
||||||
this.view.getNroField().setText(this.view.getNroField().getText().trim());
|
|
||||||
this.view.getDescripcionField().setText(this.view.getDescripcionField().getText().trim());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resetFocus() {
|
|
||||||
this.view.getNroField().requestFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,321 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.ingreso.Ingreso;
|
|
||||||
import danielcortes.xyz.models.ingreso.IngresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
|
|
||||||
import danielcortes.xyz.views.IngresosView;
|
|
||||||
import danielcortes.xyz.views.components.IngresosTableModel;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.event.KeyAdapter;
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import java.awt.event.MouseAdapter;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
|
|
||||||
public class IngresosController {
|
|
||||||
private IngresosView view;
|
|
||||||
private IngresoDAO ingresoDAO;
|
|
||||||
private TipoIngresoDAO tipoIngresoDAO;
|
|
||||||
private Caja caja;
|
|
||||||
|
|
||||||
private int editingId;
|
|
||||||
private Ingreso editingIngreso;
|
|
||||||
private boolean editing;
|
|
||||||
|
|
||||||
public IngresosController(IngresosView view, IngresoDAO ingresoDAO, TipoIngresoDAO tipoIngresoDAO) {
|
|
||||||
this.view = view;
|
|
||||||
this.ingresoDAO = ingresoDAO;
|
|
||||||
this.tipoIngresoDAO = tipoIngresoDAO;
|
|
||||||
this.fillTipoIngresoCombo();
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillTipoIngresoCombo() {
|
|
||||||
JComboBox<TipoIngreso> tipoCombo = this.view.getTipoCombo();
|
|
||||||
for (TipoIngreso tipo : this.tipoIngresoDAO.findAll()) {
|
|
||||||
tipoCombo.addItem(tipo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillIngresosTable() {
|
|
||||||
IngresosTableModel ingresosTableModel = this.view.getIngresosTableModel();
|
|
||||||
ingresosTableModel.removeRows();
|
|
||||||
for (Ingreso ingreso : this.ingresoDAO.findByCaja(this.caja)) {
|
|
||||||
ingresosTableModel.addRow(ingreso);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupViewEvents() {
|
|
||||||
this.view.getIngresosTable().getSelectionModel().addListSelectionListener(e -> onSelectTableRowListener());
|
|
||||||
this.view.getGuardarButton().addActionListener(e -> guardarActionListener());
|
|
||||||
this.view.getValorField().addActionListener(e -> guardarActionListener());
|
|
||||||
this.view.getNroInicialField().addActionListener(e -> guardarActionListener());
|
|
||||||
this.view.getNroFinalField().addActionListener(e -> guardarActionListener());
|
|
||||||
this.view.getEliminarButton().addActionListener(e -> eliminarActionListener());
|
|
||||||
this.view.getEditarButton().addActionListener(e -> editarActionListener());
|
|
||||||
|
|
||||||
this.view.getTipoCombo().addKeyListener(new KeyAdapter() {
|
|
||||||
@Override
|
|
||||||
public void keyPressed(KeyEvent e) {
|
|
||||||
if(e.getKeyCode() == KeyEvent.VK_ENTER){
|
|
||||||
guardarActionListener();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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() {
|
|
||||||
this.normalizeInputs();
|
|
||||||
String valor = this.view.getValorField().getText();
|
|
||||||
String nroInicial = this.view.getNroInicialField().getText();
|
|
||||||
String nroFinal = this.view.getNroFinalField().getText();
|
|
||||||
TipoIngreso tipoIngreso = (TipoIngreso) this.view.getTipoCombo().getSelectedItem();
|
|
||||||
|
|
||||||
System.out.println(nroInicial);
|
|
||||||
System.out.println(nroFinal);
|
|
||||||
|
|
||||||
if(editing) {
|
|
||||||
this.editarIngreso(valor, nroInicial, nroFinal, tipoIngreso, this.caja);
|
|
||||||
} else {
|
|
||||||
this.guardarIngreso(valor, nroInicial, nroFinal, tipoIngreso, this.caja);
|
|
||||||
}
|
|
||||||
this.resetFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void eliminarActionListener() {
|
|
||||||
int selectedId = this.view.getIngresosTable().getSelectedRow();
|
|
||||||
if(selectedId >= 0){
|
|
||||||
Ingreso ingreso = this.view.getIngresosTableModel().getIngreso(selectedId);
|
|
||||||
this.view.getIngresosTableModel().removeRow(selectedId);
|
|
||||||
this.ingresoDAO.deleteIngreso(ingreso);
|
|
||||||
this.updateTotalIngresos();
|
|
||||||
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()));
|
|
||||||
this.view.getNroInicialField().setText(String.valueOf(ingreso.getNroInicial()));
|
|
||||||
this.view.getNroFinalField().setText(String.valueOf(ingreso.getNroFinal()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onSelectTableRowListener(){
|
|
||||||
this.view.getEliminarButton().setEnabled(true);
|
|
||||||
this.view.getEditarButton().setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateTotalIngresos(){
|
|
||||||
int total = this.ingresoDAO.getTotalIngreso(this.caja);
|
|
||||||
this.view.getTotalIngresoField().setText(String.valueOf(total));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateButtonsEnabled() {
|
|
||||||
if(this.view.getIngresosTable().getSelectedRow()>=0){
|
|
||||||
this.view.getEliminarButton().setEnabled(true);
|
|
||||||
this.view.getEditarButton().setEnabled(true);
|
|
||||||
}else{
|
|
||||||
this.view.getEliminarButton().setEnabled(false);
|
|
||||||
this.view.getEditarButton().setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void guardarIngreso(String valor, String nroInicial, String nroFinal, TipoIngreso tipoIngreso, Caja caja){
|
|
||||||
if(this.validateInput(valor, nroInicial, nroFinal, tipoIngreso, caja)){
|
|
||||||
Ingreso ingreso = new Ingreso();
|
|
||||||
ingreso.setTipoIngreso(tipoIngreso);
|
|
||||||
ingreso.setCaja(caja);
|
|
||||||
ingreso.setValor(Integer.valueOf(valor));
|
|
||||||
ingreso.setNroInicial(nroInicial);
|
|
||||||
ingreso.setNroFinal(nroFinal);
|
|
||||||
|
|
||||||
this.ingresoDAO.insertIngreso(ingreso);
|
|
||||||
this.view.getIngresosTableModel().addRow(ingreso);
|
|
||||||
|
|
||||||
this.clearInputs();
|
|
||||||
this.updateTotalIngresos();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void editarIngreso(String valor, String nroInicial, String nroFinal, TipoIngreso tipoIngreso, Caja caja){
|
|
||||||
if(this.validateInput(valor, nroInicial, nroFinal, tipoIngreso, caja)){
|
|
||||||
this.editingIngreso.setTipoIngreso(tipoIngreso);
|
|
||||||
this.editingIngreso.setValor(Integer.valueOf(valor));
|
|
||||||
this.editingIngreso.setNroInicial(nroInicial);
|
|
||||||
this.editingIngreso.setNroFinal(nroFinal);
|
|
||||||
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, String nroInicial, String nroFinal, TipoIngreso tipoIngreso, Caja caja) {
|
|
||||||
this.hideErrorMessages();
|
|
||||||
|
|
||||||
boolean valorValidation = this.validateValor(valor);
|
|
||||||
boolean nroInicialValidation = this.validateNroInicial(nroInicial);
|
|
||||||
boolean nroFinalValidation = this.validateNroFinal(nroFinal);
|
|
||||||
boolean tipoIngresoValidation = this.validateTipoIngreso(tipoIngreso);
|
|
||||||
boolean cajaValidation = this.validateCaja(caja);
|
|
||||||
|
|
||||||
return valorValidation && tipoIngresoValidation && cajaValidation;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateCaja(Caja caja) {
|
|
||||||
return caja != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateValor(String valor) {
|
|
||||||
if (valor == null) {
|
|
||||||
this.view.getErrorValor().setText("Hubo un problema con los datos");
|
|
||||||
this.view.getErrorValor().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
valor = valor.trim();
|
|
||||||
if (valor.isEmpty()) {
|
|
||||||
this.view.getErrorValor().setText("El campo esta vacio");
|
|
||||||
this.view.getErrorValor().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!valor.chars().allMatch(Character::isDigit)) {
|
|
||||||
this.view.getErrorValor().setText("Deben ser numeros");
|
|
||||||
this.view.getErrorValor().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(valor.length() > 10){
|
|
||||||
this.view.getErrorValor().setText("El numero ingresado es demasiado largo");
|
|
||||||
this.view.getErrorValor().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateNroInicial(String nroInicial){
|
|
||||||
if (nroInicial == null) {
|
|
||||||
this.view.getErrorNroInicial().setText("Hubo un problema con los datos");
|
|
||||||
this.view.getErrorNroInicial().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nroInicial.isEmpty()) {
|
|
||||||
this.view.getErrorNroInicial().setText("El campo esta vacio");
|
|
||||||
this.view.getErrorNroInicial().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateNroFinal(String nroFinal){
|
|
||||||
if (nroFinal == null) {
|
|
||||||
this.view.getErrorNroFinal().setText("Hubo un problema con los datos");
|
|
||||||
this.view.getErrorNroFinal().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nroFinal.isEmpty()) {
|
|
||||||
this.view.getErrorNroFinal().setText("El campo esta vacio");
|
|
||||||
this.view.getErrorNroFinal().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateTipoIngreso(TipoIngreso tipoIngreso) {
|
|
||||||
if (tipoIngreso == null) {
|
|
||||||
this.view.getErrorTipoIngreso().setText("Hubo un problema con los datos");
|
|
||||||
this.view.getErrorTipoIngreso().setVisible(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hideErrorMessages() {
|
|
||||||
this.view.getErrorTipoIngreso().setVisible(false);
|
|
||||||
this.view.getErrorValor().setVisible(false);
|
|
||||||
this.view.getErrorNroInicial().setVisible(false);
|
|
||||||
this.view.getErrorNroFinal().setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearInputs() {
|
|
||||||
this.view.getTipoCombo().setSelectedIndex(0);
|
|
||||||
this.view.getValorField().setText("");
|
|
||||||
this.view.getNroInicialField().setText("");
|
|
||||||
this.view.getNroFinalField().setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void normalizeInputs(){
|
|
||||||
this.view.getValorField().setText(this.view.getValorField().getText().trim());
|
|
||||||
this.view.getNroInicialField().setText(this.view.getNroInicialField().getText().trim());
|
|
||||||
this.view.getNroFinalField().setText(this.view.getNroFinalField().getText().trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resetFocus(){
|
|
||||||
this.view.getTipoCombo().requestFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.documentos.Documentos;
|
|
||||||
import danielcortes.xyz.models.documentos.DocumentosDAO;
|
|
||||||
import danielcortes.xyz.models.documentos.MysqlDocumentosDAO;
|
|
||||||
import danielcortes.xyz.models.efectivo.Efectivo;
|
|
||||||
import danielcortes.xyz.models.efectivo.EfectivoDAO;
|
|
||||||
import danielcortes.xyz.models.efectivo.MysqlEfectivoDAO;
|
|
||||||
import danielcortes.xyz.models.egreso.EgresoDAO;
|
|
||||||
import danielcortes.xyz.models.ingreso.IngresoDAO;
|
|
||||||
import danielcortes.xyz.models.ingreso.MysqlIngresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.egreso.MysqlEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.MysqlTipoEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.MysqlTipoIngresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
|
|
||||||
import danielcortes.xyz.views.ArqueoView;
|
|
||||||
import danielcortes.xyz.views.EgresosView;
|
|
||||||
import danielcortes.xyz.views.IngresosView;
|
|
||||||
import danielcortes.xyz.views.ManagerView;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
|
|
||||||
public class ManagerController {
|
|
||||||
private ManagerView view;
|
|
||||||
private CajaDAO cajaDAO;
|
|
||||||
private DocumentosDAO documentosDAO;
|
|
||||||
private EfectivoDAO efectivoDAO;
|
|
||||||
private EgresoDAO egresoDAO;
|
|
||||||
private IngresoDAO ingresoDAO;
|
|
||||||
private TipoEgresoDAO tipoEgresoDAO;
|
|
||||||
private TipoIngresoDAO tipoIngresoDAO;
|
|
||||||
private IngresosController ingresosController;
|
|
||||||
private EgresosController egresosController;
|
|
||||||
private ArqueoController arqueoController;
|
|
||||||
|
|
||||||
public ManagerController(ManagerView view, CajaDAO cajaDAO, DocumentosDAO documentosDAO, EfectivoDAO efectivoDAO, EgresoDAO egresoDAO, IngresoDAO ingresoDAO, TipoEgresoDAO tipoEgresoDAO, TipoIngresoDAO tipoIngresoDAO) {
|
|
||||||
this.view = view;
|
|
||||||
this.cajaDAO = cajaDAO;
|
|
||||||
this.documentosDAO = documentosDAO;
|
|
||||||
this.efectivoDAO = efectivoDAO;
|
|
||||||
this.egresoDAO = egresoDAO;
|
|
||||||
this.ingresoDAO = ingresoDAO;
|
|
||||||
this.tipoEgresoDAO = tipoEgresoDAO;
|
|
||||||
this.tipoIngresoDAO = tipoIngresoDAO;
|
|
||||||
this.loadCardContents();
|
|
||||||
this.setUpDate();
|
|
||||||
this.setUpViewEvents();
|
|
||||||
this.pressInitialButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpDate(){
|
|
||||||
this.view.getDatePicker().setDateToToday();
|
|
||||||
this.updateCaja();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpViewEvents() {
|
|
||||||
this.view.getEgresosButton().addActionListener(e -> {
|
|
||||||
CardLayout layout = (CardLayout) this.view.getCardPanel().getLayout();
|
|
||||||
layout.show(this.view.getCardPanel(), "EGRESOS");
|
|
||||||
});
|
|
||||||
this.view.getIngresosButton().addActionListener(e -> {
|
|
||||||
CardLayout layout = (CardLayout) this.view.getCardPanel().getLayout();
|
|
||||||
layout.show(this.view.getCardPanel(), "INGRESOS");
|
|
||||||
});
|
|
||||||
|
|
||||||
this.view.getArqueoButton().addActionListener(e -> {
|
|
||||||
this.arqueoController.updateResumen();
|
|
||||||
|
|
||||||
CardLayout layout = (CardLayout) this.view.getCardPanel().getLayout();
|
|
||||||
layout.show(this.view.getCardPanel(), "ARQUEO");
|
|
||||||
});
|
|
||||||
|
|
||||||
this.view.getDatePicker().addDateChangeListener(e -> updateCaja());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateCaja(){
|
|
||||||
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);
|
|
||||||
|
|
||||||
Efectivo efectivo = new Efectivo();
|
|
||||||
efectivo.setCaja(caja);
|
|
||||||
this.efectivoDAO.insertDefaultEfectivo(efectivo);
|
|
||||||
|
|
||||||
Documentos documentos = new Documentos();
|
|
||||||
documentos.setCaja(caja);
|
|
||||||
this.documentosDAO.insertDefaultDocumentos(documentos);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ingresosController.updateCaja(caja);
|
|
||||||
this.egresosController.updateCaja(caja);
|
|
||||||
this.arqueoController.updateCaja(caja);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadCardContents() {
|
|
||||||
this.loadEgresosView();
|
|
||||||
this.loadIngresosView();
|
|
||||||
this.loadArqueoView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadIngresosView() {
|
|
||||||
IngresosView ingresosView = new IngresosView();
|
|
||||||
|
|
||||||
this.view.getCardPanel().add(ingresosView.getContentPanel(), "INGRESOS");
|
|
||||||
|
|
||||||
this.ingresosController = new IngresosController(ingresosView, this.ingresoDAO, this.tipoIngresoDAO);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadEgresosView() {
|
|
||||||
EgresosView egresosView = new EgresosView();
|
|
||||||
|
|
||||||
this.view.getCardPanel().add(egresosView.getContentPanel(), "EGRESOS");
|
|
||||||
|
|
||||||
this.egresosController = new EgresosController(egresosView, this.egresoDAO, this.tipoEgresoDAO);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadArqueoView() {
|
|
||||||
ArqueoView arqueoView = new ArqueoView();
|
|
||||||
|
|
||||||
this.view.getCardPanel().add(arqueoView.getContentPanel(), "ARQUEO");
|
|
||||||
|
|
||||||
this.arqueoController = new ArqueoController(arqueoView, this.efectivoDAO, this.documentosDAO, this.ingresoDAO, this.egresoDAO);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pressInitialButton() {
|
|
||||||
this.view.getIngresosButton().doClick();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.sql.SQLException;
|
|
||||||
|
|
||||||
public interface ConnectionHolder {
|
|
||||||
public java.sql.Connection getConnection() throws SQLException;
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.sql.*;
|
|
||||||
|
|
||||||
public class MysqlConnectionHolder implements ConnectionHolder {
|
|
||||||
private String databaseURI;
|
|
||||||
public MysqlConnectionHolder(){
|
|
||||||
this.databaseURI = Properties.getInstance().getProperty("database_uri");
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.sql.Connection getConnection() throws SQLException{
|
|
||||||
return DriverManager.getConnection(databaseURI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.properties");
|
|
||||||
this.props.load(in);
|
|
||||||
in.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("Couldn't load properties");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.sql.DriverManager;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class SQLiteConnectionHolder implements ConnectionHolder {
|
|
||||||
private String databaseURI;
|
|
||||||
public SQLiteConnectionHolder(){
|
|
||||||
this.databaseURI = Properties.getInstance().getProperty("database_uri");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public java.sql.Connection getConnection() throws SQLException{
|
|
||||||
try {
|
|
||||||
Class.forName("org.sqlite.JDBC");
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return DriverManager.getConnection(databaseURI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.data.SQLiteConnectionHolder;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class CajaDAO {
|
|
||||||
protected ConnectionHolder connectionHolder;
|
|
||||||
|
|
||||||
public abstract List<Caja> findAll();
|
|
||||||
public abstract Caja findById(int id);
|
|
||||||
public abstract Caja findByFecha(LocalDate fecha);
|
|
||||||
public abstract boolean insertCaja(Caja caja);
|
|
||||||
public abstract boolean updateCaja(Caja caja);
|
|
||||||
|
|
||||||
protected 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(LocalDate.parse(rs.getString("fecha")));
|
|
||||||
cajaList.add(caja);
|
|
||||||
}
|
|
||||||
return cajaList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.MysqlConnectionHolder;
|
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MysqlCajaDAO extends CajaDAO {
|
|
||||||
|
|
||||||
public MysqlCajaDAO() {
|
|
||||||
this.connectionHolder = new MysqlConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Caja> findAll() {
|
|
||||||
List<Caja> cajaList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.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 = connectionHolder.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 = connectionHolder.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 = connectionHolder.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 = connectionHolder.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.SQLiteConnectionHolder;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class SQLiteCajaDAO extends CajaDAO {
|
|
||||||
public SQLiteCajaDAO () {
|
|
||||||
this.connectionHolder = new SQLiteConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Caja> findAll() {
|
|
||||||
List<Caja> cajaList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.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 = connectionHolder.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 = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from caja where fecha = ?");
|
|
||||||
|
|
||||||
ps.setString(1, fecha.toString());
|
|
||||||
|
|
||||||
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 = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into caja (fecha) values (?)");
|
|
||||||
|
|
||||||
ps.setString(1, caja.getFecha().toString());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_rowid()");
|
|
||||||
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 = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("update caja set fecha = ? where id = ?");
|
|
||||||
ps.setString(1, caja.getFecha().toString());
|
|
||||||
ps.setInt(2, caja.getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* MIT License
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 Daniel Cortes
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package danielcortes.xyz.models.documentos;
|
|
||||||
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
|
|
||||||
public class Documentos {
|
|
||||||
private int id;
|
|
||||||
private int cheques;
|
|
||||||
private int tarjetas;
|
|
||||||
private Caja caja;
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCheques() {
|
|
||||||
return cheques;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCheques(int cheques) {
|
|
||||||
this.cheques = cheques;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTarjetas() {
|
|
||||||
return tarjetas;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTarjetas(int tarjetas) {
|
|
||||||
this.tarjetas = tarjetas;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Caja getCaja() {
|
|
||||||
return caja;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCaja(Caja caja) {
|
|
||||||
this.caja = caja;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* MIT License
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 Daniel Cortes
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package danielcortes.xyz.models.documentos;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.data.MysqlConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.MysqlCajaDAO;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class DocumentosDAO {
|
|
||||||
protected ConnectionHolder connectionHolder;
|
|
||||||
|
|
||||||
public abstract List<Documentos> findAll();
|
|
||||||
public abstract Documentos findById(int id);
|
|
||||||
public abstract Documentos findByCaja(Caja caja);
|
|
||||||
|
|
||||||
public abstract boolean insertDocumentos(Documentos documentos);
|
|
||||||
public abstract boolean insertDefaultDocumentos(Documentos documentos);
|
|
||||||
public abstract boolean updateDocumentos(Documentos documentos);
|
|
||||||
public abstract boolean deleteDocumentos(Documentos documentos);
|
|
||||||
|
|
||||||
protected List<Documentos> documentosFromResultSet(ResultSet rs) throws SQLException {
|
|
||||||
List<Documentos> documentosList = new ArrayList<>();
|
|
||||||
while (rs.next()) {
|
|
||||||
CajaDAO cajaDAO = new MysqlCajaDAO();
|
|
||||||
Caja caja = cajaDAO.findById(rs.getInt("caja_id"));
|
|
||||||
|
|
||||||
Documentos documentos = new Documentos();
|
|
||||||
documentos.setCaja(caja);
|
|
||||||
documentos.setId(rs.getInt("id"));
|
|
||||||
documentos.setCheques(rs.getInt("cheques"));
|
|
||||||
documentos.setTarjetas(rs.getInt("tarjetas"));
|
|
||||||
|
|
||||||
documentosList.add(documentos);
|
|
||||||
}
|
|
||||||
return documentosList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,206 +0,0 @@
|
|||||||
/*
|
|
||||||
* MIT License
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 Daniel Cortes
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package danielcortes.xyz.models.documentos;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.MysqlConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.MysqlCajaDAO;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MysqlDocumentosDAO extends DocumentosDAO {
|
|
||||||
|
|
||||||
public MysqlDocumentosDAO() {
|
|
||||||
this.connectionHolder = new MysqlConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Documentos> findAll() {
|
|
||||||
List<Documentos> documentosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from documentos");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
documentosList = this.documentosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return documentosList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Documentos findById(int id) {
|
|
||||||
Documentos documentos = null;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from documentos where id = ?");
|
|
||||||
ps.setInt(1, id);
|
|
||||||
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
List<Documentos> documentosList = this.documentosFromResultSet(rs);
|
|
||||||
if(documentosList.size() > 0){
|
|
||||||
documentos = documentosList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return documentos;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Documentos findByCaja(Caja caja) {
|
|
||||||
Documentos documentos = null;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from documentos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
List<Documentos> documentosList = this.documentosFromResultSet(rs);
|
|
||||||
if(documentosList.size() > 0){
|
|
||||||
documentos = documentosList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return documentos;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertDocumentos(Documentos documentos) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into documentos (cheques, tarjetas, caja_id) values (?,?,?)");
|
|
||||||
ps.setInt(1, documentos.getCheques());
|
|
||||||
ps.setInt(2, documentos.getTarjetas());
|
|
||||||
ps.setInt(3, documentos.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_id()");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
rs.next();
|
|
||||||
documentos.setId(rs.getInt(1));
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertDefaultDocumentos(Documentos documentos) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into documentos (cheques, tarjetas, caja_id) values (0,0,?)");
|
|
||||||
ps.setInt(1, documentos.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_id()");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
rs.next();
|
|
||||||
documentos.setId(rs.getInt(1));
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateDocumentos(Documentos documentos) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("update documentos set tarjetas = ?, cheques = ?, caja_id = ? where id = ?");
|
|
||||||
ps.setInt(1, documentos.getTarjetas());
|
|
||||||
ps.setInt(2, documentos.getCheques());
|
|
||||||
ps.setInt(3, documentos.getCaja().getId());
|
|
||||||
ps.setInt(4, documentos.getId());
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteDocumentos(Documentos documentos) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("delete from documentos where id = ?");
|
|
||||||
ps.setInt(1, documentos.getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
/*
|
|
||||||
* MIT License
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 Daniel Cortes
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package danielcortes.xyz.models.documentos;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.data.SQLiteConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.SQLiteCajaDAO;
|
|
||||||
|
|
||||||
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 SQLiteDocumentosDAO extends DocumentosDAO {
|
|
||||||
public SQLiteDocumentosDAO() {
|
|
||||||
this.connectionHolder = new SQLiteConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Documentos> findAll() {
|
|
||||||
List<Documentos> documentosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from documentos");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
documentosList = this.documentosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return documentosList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Documentos findById(int id) {
|
|
||||||
Documentos documentos = null;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from documentos where id = ?");
|
|
||||||
ps.setInt(1, id);
|
|
||||||
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
List<Documentos> documentosList = this.documentosFromResultSet(rs);
|
|
||||||
if(documentosList.size() > 0){
|
|
||||||
documentos = documentosList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return documentos;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Documentos findByCaja(Caja caja) {
|
|
||||||
Documentos documentos = null;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from documentos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
List<Documentos> documentosList = this.documentosFromResultSet(rs);
|
|
||||||
if(documentosList.size() > 0){
|
|
||||||
documentos = documentosList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return documentos;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertDocumentos(Documentos documentos) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into documentos (cheques, tarjetas, caja_id) values (?,?,?)");
|
|
||||||
ps.setInt(1, documentos.getCheques());
|
|
||||||
ps.setInt(2, documentos.getTarjetas());
|
|
||||||
ps.setInt(3, documentos.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_rowid()");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
rs.next();
|
|
||||||
documentos.setId(rs.getInt(1));
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertDefaultDocumentos(Documentos documentos) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into documentos (cheques, tarjetas, caja_id) values (0,0,?)");
|
|
||||||
ps.setInt(1, documentos.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_rowid()");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
rs.next();
|
|
||||||
documentos.setId(rs.getInt(1));
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateDocumentos(Documentos documentos) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("update documentos set tarjetas = ?, cheques = ?, caja_id = ? where id = ?");
|
|
||||||
ps.setInt(1, documentos.getTarjetas());
|
|
||||||
ps.setInt(2, documentos.getCheques());
|
|
||||||
ps.setInt(3, documentos.getCaja().getId());
|
|
||||||
ps.setInt(4, documentos.getId());
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteDocumentos(Documentos documentos) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("delete from documentos where id = ?");
|
|
||||||
ps.setInt(1, documentos.getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.models.caja.Caja;
|
|
||||||
|
|
||||||
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;
|
|
||||||
private Caja caja;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Caja getCaja() {
|
|
||||||
return caja;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCaja(Caja caja) {
|
|
||||||
this.caja = caja;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.data.MysqlConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.MysqlCajaDAO;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class EfectivoDAO {
|
|
||||||
protected ConnectionHolder connectionHolder;
|
|
||||||
|
|
||||||
public abstract List<Efectivo> findAll();
|
|
||||||
public abstract Efectivo findById(int id);
|
|
||||||
public abstract Efectivo findByCaja(Caja caja);
|
|
||||||
|
|
||||||
public abstract boolean insertEfectivo(Efectivo efectivo);
|
|
||||||
public abstract boolean insertDefaultEfectivo(Efectivo efectivo);
|
|
||||||
public abstract boolean updateEfectivo(Efectivo efectivo);
|
|
||||||
public abstract boolean deleteEfectivo(Efectivo efectivo);
|
|
||||||
|
|
||||||
protected List<Efectivo> efectivosFromResultSet(ResultSet rs) throws SQLException {
|
|
||||||
List<Efectivo> efectivoList = new ArrayList<>();
|
|
||||||
while (rs.next()) {
|
|
||||||
CajaDAO cajaDAO = new MysqlCajaDAO();
|
|
||||||
Caja caja = cajaDAO.findById(rs.getInt("caja_id"));
|
|
||||||
|
|
||||||
Efectivo efectivo = new Efectivo();
|
|
||||||
efectivo.setCaja(caja);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.MysqlConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.MysqlCajaDAO;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MysqlEfectivoDAO extends EfectivoDAO {
|
|
||||||
public MysqlEfectivoDAO() {
|
|
||||||
this.connectionHolder = new MysqlConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Efectivo> findAll() {
|
|
||||||
List<Efectivo> efectivoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from efectivos");
|
|
||||||
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 = connectionHolder.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 Efectivo findByCaja(Caja caja) {
|
|
||||||
Efectivo efectivo = null;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from efectivos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
List<Efectivo> efectivoList = this.efectivosFromResultSet(rs);
|
|
||||||
if (efectivoList.size() > 0) {
|
|
||||||
efectivo = efectivoList.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 = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into efectivos (veinte_mil, diez_mil, cinco_mil, dos_mil, mil, quinientos, cien, cincuenta, diez, caja_id) 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());
|
|
||||||
ps.setInt(10, efectivo.getCaja().getId());
|
|
||||||
|
|
||||||
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 insertDefaultEfectivo(Efectivo efectivo) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into efectivos (veinte_mil, diez_mil, cinco_mil, dos_mil, mil, quinientos, cien, cincuenta, diez, caja_id) values (0,0,0,0,0,0,0,0,0,?)");
|
|
||||||
ps.setInt(1, efectivo.getCaja().getId());
|
|
||||||
|
|
||||||
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 = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("update efectivos set veinte_mil = ?, diez_mil = ?, cinco_mil = ?, dos_mil = ?, mil = ?, quinientos = ?, cien = ?, cincuenta = ?, diez = ?, caja_id = ? 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.getCaja().getId());
|
|
||||||
ps.setInt(11, 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 = connectionHolder.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.data.SQLiteConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.SQLiteCajaDAO;
|
|
||||||
|
|
||||||
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 SQLiteEfectivoDAO extends EfectivoDAO {
|
|
||||||
public SQLiteEfectivoDAO() {
|
|
||||||
this.connectionHolder = new SQLiteConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Efectivo> findAll() {
|
|
||||||
List<Efectivo> efectivoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from efectivos");
|
|
||||||
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 = connectionHolder.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 Efectivo findByCaja(Caja caja) {
|
|
||||||
Efectivo efectivo = null;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from efectivos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
List<Efectivo> efectivoList = this.efectivosFromResultSet(rs);
|
|
||||||
if (efectivoList.size() > 0) {
|
|
||||||
efectivo = efectivoList.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 = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into efectivos (veinte_mil, diez_mil, cinco_mil, dos_mil, mil, quinientos, cien, cincuenta, diez, caja_id) 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());
|
|
||||||
ps.setInt(10, efectivo.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_rowid()");
|
|
||||||
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 insertDefaultEfectivo(Efectivo efectivo) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into efectivos (veinte_mil, diez_mil, cinco_mil, dos_mil, mil, quinientos, cien, cincuenta, diez, caja_id) values (0,0,0,0,0,0,0,0,0,?)");
|
|
||||||
ps.setInt(1, efectivo.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_rowid()");
|
|
||||||
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 = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("update efectivos set veinte_mil = ?, diez_mil = ?, cinco_mil = ?, dos_mil = ?, mil = ?, quinientos = ?, cien = ?, cincuenta = ?, diez = ?, caja_id = ? 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.getCaja().getId());
|
|
||||||
ps.setInt(11, 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 = connectionHolder.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.egreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgreso;
|
|
||||||
|
|
||||||
public class Egreso {
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
private String nro;
|
|
||||||
private String descripcion;
|
|
||||||
private int valor;
|
|
||||||
private TipoEgreso tipoEgreso;
|
|
||||||
private Caja caja;
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNro() {
|
|
||||||
return nro;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNro(String nro) {
|
|
||||||
this.nro = nro;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescripcion() {
|
|
||||||
return descripcion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescripcion(String descripcion) {
|
|
||||||
this.descripcion = descripcion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getValor() {
|
|
||||||
return valor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValor(int valor) {
|
|
||||||
this.valor = valor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TipoEgreso getTipoEgreso() {
|
|
||||||
return tipoEgreso;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
this.tipoEgreso = tipoEgreso;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Caja getCaja() {
|
|
||||||
return caja;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCaja(Caja caja) {
|
|
||||||
this.caja = caja;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.egreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.MysqlCajaDAO;
|
|
||||||
import danielcortes.xyz.models.egreso.Egreso;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.MysqlTipoEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgreso;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgresoDAO;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class EgresoDAO {
|
|
||||||
protected ConnectionHolder connectionHolder;
|
|
||||||
|
|
||||||
public abstract List<Egreso> findAll();
|
|
||||||
public abstract List<Egreso> findById(int id);
|
|
||||||
public abstract List<Egreso> findByCaja(Caja caja);
|
|
||||||
public abstract List<Egreso> findByNro(String nro);
|
|
||||||
public abstract List<Egreso> findByTipoEgreso(TipoEgreso tipoEgreso);
|
|
||||||
|
|
||||||
public abstract boolean insertEgreso(Egreso egreso);
|
|
||||||
public abstract boolean updateEgreso(Egreso egreso);
|
|
||||||
public abstract boolean deleteEgreso(Egreso egreso);
|
|
||||||
|
|
||||||
public abstract int getTotalEgreso(Caja caja);
|
|
||||||
|
|
||||||
List<Egreso> egresosFromResultSet(ResultSet rs) throws SQLException {
|
|
||||||
ArrayList<Egreso> egresoList = new ArrayList<>();
|
|
||||||
while(rs.next()){
|
|
||||||
int tipoEgresoId = rs.getInt("tipo_egreso_id");
|
|
||||||
TipoEgresoDAO tipoEgresoDAO = new MysqlTipoEgresoDAO();
|
|
||||||
TipoEgreso tipoEgreso = tipoEgresoDAO.findById(tipoEgresoId).get(0);
|
|
||||||
|
|
||||||
int cajaId = rs.getInt("caja_id");
|
|
||||||
CajaDAO cajaDAO = new MysqlCajaDAO();
|
|
||||||
Caja caja = cajaDAO.findById(cajaId);
|
|
||||||
|
|
||||||
Egreso egreso = new Egreso();
|
|
||||||
|
|
||||||
egreso.setId(rs.getInt("id"));
|
|
||||||
egreso.setNro(rs.getString("nro"));
|
|
||||||
egreso.setDescripcion(rs.getString("descripcion"));
|
|
||||||
egreso.setValor(rs.getInt("valor"));
|
|
||||||
egreso.setTipoEgreso(tipoEgreso);
|
|
||||||
egreso.setCaja(caja);
|
|
||||||
|
|
||||||
egresoList.add(egreso);
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,241 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.egreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.MysqlConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.MysqlCajaDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgreso;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.MysqlTipoEgresoDAO;
|
|
||||||
|
|
||||||
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 MysqlEgresoDAO extends EgresoDAO {
|
|
||||||
|
|
||||||
public MysqlEgresoDAO(){
|
|
||||||
this.connectionHolder = new MysqlConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findAll() {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findById(int id) {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos where id = ?");
|
|
||||||
ps.setInt(1,id);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findByCaja(Caja caja) {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findByNro(String nro) {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos where nro = ?");
|
|
||||||
ps.setString(1, nro);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findByTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos where tipo_egreso_id = ?");
|
|
||||||
ps.setInt(1, tipoEgreso.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertEgreso(Egreso egreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into egresos (nro, descripcion, valor, tipo_egreso_id, caja_id) values (?,?,?,?,?)");
|
|
||||||
ps.setString(1,egreso.getNro());
|
|
||||||
ps.setString(2,egreso.getDescripcion());
|
|
||||||
ps.setInt(3,egreso.getValor());
|
|
||||||
ps.setInt(4,egreso.getTipoEgreso().getId());
|
|
||||||
ps.setInt(5, egreso.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_id()");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
rs.next();
|
|
||||||
egreso.setId(rs.getInt(1));
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateEgreso(Egreso egreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("update egresos set nro = ?, descripcion = ?, valor = ?, tipo_egreso_id = ?, caja_id = ? where id = ? ");
|
|
||||||
ps.setString(1,egreso.getNro());
|
|
||||||
ps.setString(2,egreso.getDescripcion());
|
|
||||||
ps.setInt(3,egreso.getValor());
|
|
||||||
ps.setInt(4,egreso.getTipoEgreso().getId());
|
|
||||||
ps.setInt(5, egreso.getCaja().getId());
|
|
||||||
ps.setInt(6, egreso.getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteEgreso(Egreso egreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("delete from egresos where id = ? ");
|
|
||||||
ps.setInt(1, egreso.getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTotalEgreso(Caja caja) {
|
|
||||||
int total = 0;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select sum(valor) from egresos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
rs.next();
|
|
||||||
total = rs.getInt(1);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,239 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.egreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.data.SQLiteConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.SQLiteCajaDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.SQLiteTipoEgresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgreso;
|
|
||||||
import danielcortes.xyz.models.tipo_egreso.TipoEgresoDAO;
|
|
||||||
|
|
||||||
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 SQLiteEgresoDAO extends EgresoDAO {
|
|
||||||
public SQLiteEgresoDAO(){
|
|
||||||
this.connectionHolder = new SQLiteConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findAll() {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findById(int id) {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos where id = ?");
|
|
||||||
ps.setInt(1,id);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findByCaja(Caja caja) {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findByNro(String nro) {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos where nro = ?");
|
|
||||||
ps.setString(1, nro);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Egreso> findByTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from egresos where tipo_egreso_id = ?");
|
|
||||||
ps.setInt(1, tipoEgreso.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
egresoList = this.egresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return egresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertEgreso(Egreso egreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into egresos (nro, descripcion, valor, tipo_egreso_id, caja_id) values (?,?,?,?,?)");
|
|
||||||
ps.setString(1,egreso.getNro());
|
|
||||||
ps.setString(2,egreso.getDescripcion());
|
|
||||||
ps.setInt(3,egreso.getValor());
|
|
||||||
ps.setInt(4,egreso.getTipoEgreso().getId());
|
|
||||||
ps.setInt(5, egreso.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_rowid()");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
rs.next();
|
|
||||||
egreso.setId(rs.getInt(1));
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateEgreso(Egreso egreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("update egresos set nro = ?, descripcion = ?, valor = ?, tipo_egreso_id = ?, caja_id = ? where id = ? ");
|
|
||||||
ps.setString(1,egreso.getNro());
|
|
||||||
ps.setString(2,egreso.getDescripcion());
|
|
||||||
ps.setInt(3,egreso.getValor());
|
|
||||||
ps.setInt(4,egreso.getTipoEgreso().getId());
|
|
||||||
ps.setInt(5, egreso.getCaja().getId());
|
|
||||||
ps.setInt(6, egreso.getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteEgreso(Egreso egreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("delete from egresos where id = ? ");
|
|
||||||
ps.setInt(1, egreso.getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTotalEgreso(Caja caja) {
|
|
||||||
int total = 0;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select sum(valor) from egresos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
rs.next();
|
|
||||||
total = rs.getInt(1);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.ingreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
|
|
||||||
|
|
||||||
public class Ingreso {
|
|
||||||
private int id;
|
|
||||||
private int valor;
|
|
||||||
private String nroInicial;
|
|
||||||
private String nroFinal;
|
|
||||||
private TipoIngreso tipoIngreso;
|
|
||||||
private Caja caja;
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getValor() {
|
|
||||||
return valor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValor(int valor) {
|
|
||||||
this.valor = valor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNroInicial() {
|
|
||||||
return nroInicial;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNroInicial(String nroInicial) {
|
|
||||||
this.nroInicial = nroInicial;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNroFinal() {
|
|
||||||
return nroFinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNroFinal(String nroFinal) {
|
|
||||||
this.nroFinal = nroFinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TipoIngreso getTipoIngreso() {
|
|
||||||
return tipoIngreso;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTipoIngreso(TipoIngreso tipoIngreso) {
|
|
||||||
this.tipoIngreso = tipoIngreso;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Caja getCaja() {
|
|
||||||
return caja;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCaja(Caja caja) {
|
|
||||||
this.caja = caja;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.ingreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
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.TipoIngreso;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class IngresoDAO {
|
|
||||||
protected ConnectionHolder connectionHolder;
|
|
||||||
|
|
||||||
public abstract List<Ingreso> findAll();
|
|
||||||
public abstract List<Ingreso> findByCaja(Caja caja);
|
|
||||||
public abstract List<Ingreso> findById(int id);
|
|
||||||
public abstract List<Ingreso> findByTipoIngreso(TipoIngreso tipoIngreso);
|
|
||||||
|
|
||||||
public abstract boolean insertIngreso(Ingreso ingreso);
|
|
||||||
public abstract boolean updateIngreso(Ingreso ingreso);
|
|
||||||
public abstract boolean deleteIngreso(Ingreso ingreso);
|
|
||||||
|
|
||||||
public abstract int getTotalIngreso(Caja caja);
|
|
||||||
|
|
||||||
List<Ingreso> ingresosFromResultSet(ResultSet rs) throws SQLException {
|
|
||||||
ArrayList<Ingreso> ingresosList = new ArrayList<>();
|
|
||||||
while(rs.next()){
|
|
||||||
int tipoIngresoId = rs.getInt("tipo_ingreso_id");
|
|
||||||
TipoIngresoDAO tipoEgresoDAO = new MysqlTipoIngresoDAO();
|
|
||||||
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.setId(rs.getInt("id"));
|
|
||||||
ingreso.setValor(rs.getInt("valor"));
|
|
||||||
ingreso.setNroInicial(rs.getString("nro_inicial"));
|
|
||||||
ingreso.setNroFinal(rs.getString("nro_final"));
|
|
||||||
ingreso.setTipoIngreso(tipoIngreso);
|
|
||||||
ingreso.setCaja(caja);
|
|
||||||
|
|
||||||
ingresosList.add(ingreso);
|
|
||||||
}
|
|
||||||
return ingresosList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.ingreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.MysqlConnectionHolder;
|
|
||||||
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.TipoIngreso;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
|
|
||||||
|
|
||||||
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 MysqlIngresoDAO extends IngresoDAO {
|
|
||||||
|
|
||||||
public MysqlIngresoDAO(){
|
|
||||||
this.connectionHolder = new MysqlConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Ingreso> findAll() {
|
|
||||||
List<Ingreso> ingresosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from ingresos");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
ingresosList = this.ingresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return ingresosList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Ingreso> findByCaja(Caja caja) {
|
|
||||||
List<Ingreso> ingresosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.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
|
|
||||||
public List<Ingreso> findById(int id) {
|
|
||||||
List<Ingreso> ingresosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from ingresos where id = ?");
|
|
||||||
ps.setInt(1, id);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
ingresosList = this.ingresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return ingresosList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Ingreso> findByTipoIngreso(TipoIngreso tipoIngreso) {
|
|
||||||
List<Ingreso> ingresosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select ingresos.* from ingresos inner join tipos_ingreso on (ingresos.tipo_ingreso_id = tipos_ingreso.id) where ingresos.tipo_ingreso_id = ?");
|
|
||||||
ps.setInt(1, tipoIngreso.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
ingresosList = this.ingresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return ingresosList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertIngreso(Ingreso ingreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into ingresos (valor, nro_inicial, nro_final, tipo_ingreso_id, caja_id) values (?,?,?,?,?)");
|
|
||||||
ps.setInt(1, ingreso.getValor());
|
|
||||||
ps.setString(2, ingreso.getNroInicial());
|
|
||||||
ps.setString(3, ingreso.getNroFinal());
|
|
||||||
ps.setInt(4, ingreso.getTipoIngreso().getId());
|
|
||||||
ps.setInt(5, ingreso.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_id()");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
rs.next();
|
|
||||||
ingreso.setId(rs.getInt(1));
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateIngreso(Ingreso ingreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("update ingresos set valor = ? , nro_inicial = ?, nro_final = ?, tipo_ingreso_id = ?, caja_id = ? where id = ?");
|
|
||||||
ps.setInt(1,ingreso.getValor());
|
|
||||||
ps.setString(2, ingreso.getNroInicial());
|
|
||||||
ps.setString(3, ingreso.getNroFinal());
|
|
||||||
ps.setInt(4, ingreso.getTipoIngreso().getId());
|
|
||||||
ps.setInt(5, ingreso.getCaja().getId());
|
|
||||||
ps.setInt(6, ingreso.getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteIngreso(Ingreso ingreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("delete from ingresos where id = ?");
|
|
||||||
ps.setInt(1,ingreso.getId());
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTotalIngreso(Caja caja) {
|
|
||||||
int total = 0;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select sum(valor) from ingresos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
rs.next();
|
|
||||||
total = rs.getInt(1);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,217 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.ingreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.data.SQLiteConnectionHolder;
|
|
||||||
import danielcortes.xyz.models.caja.Caja;
|
|
||||||
import danielcortes.xyz.models.caja.CajaDAO;
|
|
||||||
import danielcortes.xyz.models.caja.SQLiteCajaDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.SQLiteTipoIngresoDAO;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
|
|
||||||
|
|
||||||
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 SQLiteIngresoDAO extends IngresoDAO {
|
|
||||||
public SQLiteIngresoDAO(){
|
|
||||||
this.connectionHolder = new SQLiteConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Ingreso> findAll() {
|
|
||||||
List<Ingreso> ingresosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from ingresos");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
ingresosList = this.ingresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return ingresosList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Ingreso> findByCaja(Caja caja) {
|
|
||||||
List<Ingreso> ingresosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.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
|
|
||||||
public List<Ingreso> findById(int id) {
|
|
||||||
List<Ingreso> ingresosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from ingresos where id = ?");
|
|
||||||
ps.setInt(1, id);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
ingresosList = this.ingresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return ingresosList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Ingreso> findByTipoIngreso(TipoIngreso tipoIngreso) {
|
|
||||||
List<Ingreso> ingresosList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select ingresos.* from ingresos inner join tipos_ingreso on (ingresos.tipo_ingreso_id = tipos_ingreso.id) where ingresos.tipo_ingreso_id = ?");
|
|
||||||
ps.setInt(1, tipoIngreso.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
ingresosList = this.ingresosFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return ingresosList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertIngreso(Ingreso ingreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("insert into ingresos (valor, nro_inicial, nro_final, tipo_ingreso_id, caja_id) values (?,?,?,?,?)");
|
|
||||||
ps.setInt(1, ingreso.getValor());
|
|
||||||
ps.setString(2, ingreso.getNroInicial());
|
|
||||||
ps.setString(3, ingreso.getNroFinal());
|
|
||||||
ps.setInt(4, ingreso.getTipoIngreso().getId());
|
|
||||||
ps.setInt(5, ingreso.getCaja().getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
ps = conn.prepareStatement("select last_insert_rowid()");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
rs.next();
|
|
||||||
ingreso.setId(rs.getInt(1));
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateIngreso(Ingreso ingreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("update ingresos set valor = ? , nro_inicial = ?, nro_final = ?, tipo_ingreso_id = ?, caja_id = ? where id = ?");
|
|
||||||
ps.setInt(1,ingreso.getValor());
|
|
||||||
ps.setString(2, ingreso.getNroInicial());
|
|
||||||
ps.setString(3, ingreso.getNroFinal());
|
|
||||||
ps.setInt(4, ingreso.getTipoIngreso().getId());
|
|
||||||
ps.setInt(5, ingreso.getCaja().getId());
|
|
||||||
ps.setInt(6, ingreso.getId());
|
|
||||||
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteIngreso(Ingreso ingreso) {
|
|
||||||
int updates;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("delete from ingresos where id = ?");
|
|
||||||
ps.setInt(1,ingreso.getId());
|
|
||||||
updates = ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return updates > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTotalIngreso(Caja caja) {
|
|
||||||
int total = 0;
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select sum(valor) from ingresos where caja_id = ?");
|
|
||||||
ps.setInt(1, caja.getId());
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
rs.next();
|
|
||||||
total = rs.getInt(1);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.tipo_egreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.MysqlConnectionHolder;
|
|
||||||
|
|
||||||
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 MysqlTipoEgresoDAO extends TipoEgresoDAO {
|
|
||||||
|
|
||||||
public MysqlTipoEgresoDAO(){
|
|
||||||
this.connectionHolder = new MysqlConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoEgreso> findAll() {
|
|
||||||
List<TipoEgreso> tipoEgresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_egreso");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tipoEgresoList = this.tipoEgresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tipoEgresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoEgreso> findById(int id) {
|
|
||||||
List<TipoEgreso> tipoEgresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_egreso where id = ?");
|
|
||||||
ps.setInt(1, id);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tipoEgresoList = this.tipoEgresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tipoEgresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoEgreso> findByNombre(String nombre) {
|
|
||||||
List<TipoEgreso> tipoEgresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_egreso where nombre = ?");
|
|
||||||
ps.setString(1, nombre);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tipoEgresoList = this.tipoEgresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tipoEgresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.tipo_egreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.data.SQLiteConnectionHolder;
|
|
||||||
|
|
||||||
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 SQLiteTipoEgresoDAO extends TipoEgresoDAO {
|
|
||||||
public SQLiteTipoEgresoDAO(){
|
|
||||||
this.connectionHolder = new SQLiteConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoEgreso> findAll() {
|
|
||||||
List<TipoEgreso> tipoEgresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_egreso");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tipoEgresoList = this.tipoEgresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tipoEgresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoEgreso> findById(int id) {
|
|
||||||
List<TipoEgreso> tipoEgresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_egreso where id = ?");
|
|
||||||
ps.setInt(1, id);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tipoEgresoList = this.tipoEgresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tipoEgresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoEgreso> findByNombre(String nombre) {
|
|
||||||
List<TipoEgreso> tipoEgresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_egreso where nombre = ?");
|
|
||||||
ps.setString(1, nombre);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tipoEgresoList = this.tipoEgresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tipoEgresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteTipoEgreso(TipoEgreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.tipo_egreso;
|
|
||||||
|
|
||||||
public class TipoEgreso {
|
|
||||||
private int id;
|
|
||||||
private String nombre;
|
|
||||||
|
|
||||||
public TipoEgreso(int id, String nombre) {
|
|
||||||
this.id = id;
|
|
||||||
this.nombre = nombre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TipoEgreso(String nombre) {
|
|
||||||
this.nombre = nombre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TipoEgreso(){}
|
|
||||||
|
|
||||||
public String getNombre() {
|
|
||||||
return nombre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNombre(String nombre) {
|
|
||||||
this.nombre = nombre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString(){
|
|
||||||
return this.nombre;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.tipo_egreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class TipoEgresoDAO {
|
|
||||||
protected ConnectionHolder connectionHolder;
|
|
||||||
|
|
||||||
public abstract List<TipoEgreso> findAll();
|
|
||||||
public abstract List<TipoEgreso> findById(int id);
|
|
||||||
public abstract List<TipoEgreso> findByNombre(String nombre);
|
|
||||||
|
|
||||||
public abstract boolean insertTipoEgreso(TipoEgreso tipoEgreso);
|
|
||||||
public abstract boolean updateTipoEgreso(TipoEgreso tipoEgreso);
|
|
||||||
public abstract boolean deleteTipoEgreso(TipoEgreso tipoEgreso);
|
|
||||||
|
|
||||||
List<TipoEgreso> tipoEgresoFromResultSet(ResultSet rs) throws SQLException {
|
|
||||||
ArrayList<TipoEgreso> tipoEgresoList = new ArrayList<>();
|
|
||||||
while(rs.next()){
|
|
||||||
TipoEgreso tipoEgreso = new TipoEgreso();
|
|
||||||
tipoEgreso.setId(rs.getInt("id"));
|
|
||||||
tipoEgreso.setNombre(rs.getString("nombre"));
|
|
||||||
tipoEgresoList.add(tipoEgreso);
|
|
||||||
}
|
|
||||||
return tipoEgresoList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.tipo_ingreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.MysqlConnectionHolder;
|
|
||||||
|
|
||||||
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 MysqlTipoIngresoDAO extends TipoIngresoDAO {
|
|
||||||
public MysqlTipoIngresoDAO(){
|
|
||||||
this.connectionHolder = new MysqlConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoIngreso> findAll() {
|
|
||||||
List<TipoIngreso> tiposIngresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_ingreso");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tiposIngresoList = this.tiposIngresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tiposIngresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoIngreso> findById(int id) {
|
|
||||||
List<TipoIngreso> tiposIngresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_ingreso where id = ?");
|
|
||||||
ps.setInt(1,id);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tiposIngresoList = this.tiposIngresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tiposIngresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoIngreso> findByNombre(String nombre) {
|
|
||||||
List<TipoIngreso> tiposIngresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_ingreso where nombre = ?");
|
|
||||||
ps.setString(1,nombre);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tiposIngresoList = this.tiposIngresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tiposIngresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertTipoIngreso(TipoIngreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateTipoIngreso(TipoIngreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteTipoIngreso(TipoIngreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.tipo_ingreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
import danielcortes.xyz.data.SQLiteConnectionHolder;
|
|
||||||
|
|
||||||
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 SQLiteTipoIngresoDAO extends TipoIngresoDAO {
|
|
||||||
public SQLiteTipoIngresoDAO(){
|
|
||||||
this.connectionHolder = new SQLiteConnectionHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoIngreso> findAll() {
|
|
||||||
List<TipoIngreso> tiposIngresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_ingreso");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tiposIngresoList = this.tiposIngresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tiposIngresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoIngreso> findById(int id) {
|
|
||||||
List<TipoIngreso> tiposIngresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_ingreso where id = ?");
|
|
||||||
ps.setInt(1,id);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tiposIngresoList = this.tiposIngresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tiposIngresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TipoIngreso> findByNombre(String nombre) {
|
|
||||||
List<TipoIngreso> tiposIngresoList = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
Connection conn = connectionHolder.getConnection();
|
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from tipos_ingreso where nombre = ?");
|
|
||||||
ps.setString(1,nombre);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
tiposIngresoList = this.tiposIngresoFromResultSet(rs);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return tiposIngresoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insertTipoIngreso(TipoIngreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateTipoIngreso(TipoIngreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteTipoIngreso(TipoIngreso tipoEgreso) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.tipo_ingreso;
|
|
||||||
|
|
||||||
public class TipoIngreso {
|
|
||||||
private int id;
|
|
||||||
private String nombre;
|
|
||||||
|
|
||||||
public TipoIngreso(int id, String nombre) {
|
|
||||||
this.id = id;
|
|
||||||
this.nombre = nombre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TipoIngreso(String nombre) {
|
|
||||||
this.nombre = nombre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TipoIngreso() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNombre() {
|
|
||||||
return nombre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNombre(String nombre) {
|
|
||||||
this.nombre = nombre;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.nombre;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.tipo_ingreso;
|
|
||||||
|
|
||||||
import danielcortes.xyz.data.ConnectionHolder;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class TipoIngresoDAO {
|
|
||||||
protected ConnectionHolder connectionHolder;
|
|
||||||
public abstract List<TipoIngreso> findAll();
|
|
||||||
public abstract List<TipoIngreso> findById(int id);
|
|
||||||
public abstract List<TipoIngreso> findByNombre(String nombre);
|
|
||||||
|
|
||||||
public abstract boolean insertTipoIngreso(TipoIngreso tipoEgreso);
|
|
||||||
public abstract boolean updateTipoIngreso(TipoIngreso tipoEgreso);
|
|
||||||
public abstract boolean deleteTipoIngreso(TipoIngreso tipoEgreso);
|
|
||||||
|
|
||||||
List<TipoIngreso> tiposIngresoFromResultSet(ResultSet rs) throws SQLException {
|
|
||||||
ArrayList<TipoIngreso> tiposIngresoList = new ArrayList<>();
|
|
||||||
while(rs.next()){
|
|
||||||
TipoIngreso tipoIngreso = new TipoIngreso();
|
|
||||||
tipoIngreso.setId(rs.getInt("id"));
|
|
||||||
tipoIngreso.setNombre(rs.getString("nombre"));
|
|
||||||
tiposIngresoList.add(tipoIngreso);
|
|
||||||
}
|
|
||||||
return tiposIngresoList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,526 +0,0 @@
|
|||||||
<?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="4" 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="616" height="646"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none">
|
|
||||||
<font/>
|
|
||||||
</border>
|
|
||||||
<children>
|
|
||||||
<grid id="1ca11" 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="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="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="2" 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="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>
|
|
||||||
<text value="0"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="1681b" class="javax.swing.JButton" binding="guardarDocumentosButton">
|
|
||||||
<constraints>
|
|
||||||
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Guardar"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="a438" class="javax.swing.JLabel" binding="errorCheques">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<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="4f33f" class="javax.swing.JLabel" binding="errorTarjetas">
|
|
||||||
<constraints>
|
|
||||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="84446" layout-manager="GridLayoutManager" row-count="8" 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="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="Rendido"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="b0664" class="javax.swing.JTextField" binding="arqueoField">
|
|
||||||
<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="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<editable value="false"/>
|
|
||||||
<font style="1"/>
|
|
||||||
<text value="0"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="509b2" class="javax.swing.JTextField" binding="ajusteField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<editable value="false"/>
|
|
||||||
<font style="1"/>
|
|
||||||
<text value="0"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="bafd7" 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="Ajuste "/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="679e2" class="javax.swing.JSeparator">
|
|
||||||
<constraints>
|
|
||||||
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
<component id="fb43c" 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="Debe Rendir"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="b117a" class="javax.swing.JTextField" binding="rendidoField">
|
|
||||||
<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="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<font style="1"/>
|
|
||||||
<text value="0"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="3f85f" layout-manager="GridLayoutManager" row-count="19" 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="3" 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="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="$10000"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="5431d" class="javax.swing.JTextField" binding="diezMilField">
|
|
||||||
<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="af49b" class="javax.swing.JTextField" binding="cincoMilField">
|
|
||||||
<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="8d468" 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="$5000"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="7a8c3" 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="$2000"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="bbb4" class="javax.swing.JTextField" binding="dosMilField">
|
|
||||||
<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="4807e" class="javax.swing.JTextField" binding="milField">
|
|
||||||
<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>
|
|
||||||
<component id="e80c8" 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="$1000"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="62d5d" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="10" 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="10" 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="12" 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="12" 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="14" 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="14" 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="16" 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="16" 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="a2c3f" class="javax.swing.JButton" binding="guardarEfectivoButton">
|
|
||||||
<constraints>
|
|
||||||
<grid row="18" column="0" row-span="1" col-span="2" 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>
|
|
||||||
<component id="92070" class="javax.swing.JLabel" binding="errorVeinteMil">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="52622" class="javax.swing.JLabel" binding="errorDiezMil">
|
|
||||||
<constraints>
|
|
||||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="12e87" class="javax.swing.JLabel" binding="errorCincoMil">
|
|
||||||
<constraints>
|
|
||||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="c4ae2" class="javax.swing.JLabel" binding="errorDosMil">
|
|
||||||
<constraints>
|
|
||||||
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="78dc8" class="javax.swing.JLabel" binding="errorMil">
|
|
||||||
<constraints>
|
|
||||||
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="f9374" class="javax.swing.JLabel" binding="errorQuinientos">
|
|
||||||
<constraints>
|
|
||||||
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="b7c59" class="javax.swing.JLabel" binding="errorCien">
|
|
||||||
<constraints>
|
|
||||||
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="c66e5" class="javax.swing.JLabel" binding="errorCincuenta">
|
|
||||||
<constraints>
|
|
||||||
<grid row="15" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="fa2bc" class="javax.swing.JLabel" binding="errorDiez">
|
|
||||||
<constraints>
|
|
||||||
<grid row="17" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<vspacer id="28775">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<vspacer id="93947">
|
|
||||||
<constraints>
|
|
||||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</form>
|
|
||||||
@@ -1,441 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 com.intellij.uiDesigner.core.GridConstraints;
|
|
||||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
|
||||||
import com.intellij.uiDesigner.core.Spacer;
|
|
||||||
|
|
||||||
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 guardarEfectivoButton;
|
|
||||||
private JButton guardarDocumentosButton;
|
|
||||||
private JLabel errorVeinteMil;
|
|
||||||
private JLabel errorDiezMil;
|
|
||||||
private JLabel errorCincoMil;
|
|
||||||
private JLabel errorDosMil;
|
|
||||||
private JLabel errorMil;
|
|
||||||
private JLabel errorQuinientos;
|
|
||||||
private JLabel errorCien;
|
|
||||||
private JLabel errorCincuenta;
|
|
||||||
private JLabel errorDiez;
|
|
||||||
private JLabel errorCheques;
|
|
||||||
private JLabel errorTarjetas;
|
|
||||||
private JTextField ajusteField;
|
|
||||||
private JTextField rendidoField;
|
|
||||||
|
|
||||||
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 JTextField getRendidoField() {
|
|
||||||
return rendidoField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getAjusteField() {
|
|
||||||
return ajusteField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getGuardarEfectivoButton() {
|
|
||||||
return guardarEfectivoButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getGuardarDocumentosButton() {
|
|
||||||
return guardarDocumentosButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorVeinteMil() {
|
|
||||||
return errorVeinteMil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorDiezMil() {
|
|
||||||
return errorDiezMil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorCincoMil() {
|
|
||||||
return errorCincoMil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorDosMil() {
|
|
||||||
return errorDosMil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorMil() {
|
|
||||||
return errorMil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorQuinientos() {
|
|
||||||
return errorQuinientos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorCien() {
|
|
||||||
return errorCien;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorCincuenta() {
|
|
||||||
return errorCincuenta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorDiez() {
|
|
||||||
return errorDiez;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorCheques() {
|
|
||||||
return errorCheques;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorTarjetas() {
|
|
||||||
return errorTarjetas;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// 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 GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1));
|
|
||||||
final JPanel panel1 = new JPanel();
|
|
||||||
panel1.setLayout(new GridLayoutManager(5, 2, new Insets(10, 10, 10, 10), -1, -1));
|
|
||||||
contentPanel.add(panel1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Detalle Documentos", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, -1, -1, panel1.getFont())));
|
|
||||||
chequesField = new JTextField();
|
|
||||||
chequesField.setText("0");
|
|
||||||
panel1.add(chequesField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final JLabel label1 = new JLabel();
|
|
||||||
label1.setText("Tarjetas de Credito");
|
|
||||||
panel1.add(label1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
tarjetasField = new JTextField();
|
|
||||||
tarjetasField.setText("0");
|
|
||||||
panel1.add(tarjetasField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
guardarDocumentosButton = new JButton();
|
|
||||||
guardarDocumentosButton.setText("Guardar");
|
|
||||||
panel1.add(guardarDocumentosButton, new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorCheques = new JLabel();
|
|
||||||
errorCheques.setForeground(new Color(-65536));
|
|
||||||
errorCheques.setText("Error");
|
|
||||||
errorCheques.setVisible(false);
|
|
||||||
panel1.add(errorCheques, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JLabel label2 = new JLabel();
|
|
||||||
label2.setText("Cheques al Dia");
|
|
||||||
panel1.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorTarjetas = new JLabel();
|
|
||||||
errorTarjetas.setForeground(new Color(-65536));
|
|
||||||
errorTarjetas.setText("Error");
|
|
||||||
errorTarjetas.setVisible(false);
|
|
||||||
panel1.add(errorTarjetas, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JPanel panel2 = new JPanel();
|
|
||||||
panel2.setLayout(new GridLayoutManager(8, 2, new Insets(10, 10, 10, 10), -1, -1));
|
|
||||||
contentPanel.add(panel2, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Resumen"));
|
|
||||||
final JLabel label3 = new JLabel();
|
|
||||||
label3.setText("Efectivo");
|
|
||||||
panel2.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
efectivoField = new JTextField();
|
|
||||||
efectivoField.setEditable(false);
|
|
||||||
efectivoField.setText("0");
|
|
||||||
panel2.add(efectivoField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final JLabel label4 = new JLabel();
|
|
||||||
label4.setText("Documentos");
|
|
||||||
panel2.add(label4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
documentosField = new JTextField();
|
|
||||||
documentosField.setEditable(false);
|
|
||||||
documentosField.setText("0");
|
|
||||||
panel2.add(documentosField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final JLabel label5 = new JLabel();
|
|
||||||
label5.setText("Ingresos");
|
|
||||||
panel2.add(label5, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JLabel label6 = new JLabel();
|
|
||||||
label6.setText("Egresos");
|
|
||||||
panel2.add(label6, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
egresosField = new JTextField();
|
|
||||||
egresosField.setEditable(false);
|
|
||||||
egresosField.setText("0");
|
|
||||||
panel2.add(egresosField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
ingresosField = new JTextField();
|
|
||||||
ingresosField.setEditable(false);
|
|
||||||
ingresosField.setText("0");
|
|
||||||
panel2.add(ingresosField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final JLabel label7 = new JLabel();
|
|
||||||
label7.setText("Rendido");
|
|
||||||
panel2.add(label7, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
arqueoField = new JTextField();
|
|
||||||
arqueoField.setEditable(false);
|
|
||||||
Font arqueoFieldFont = this.$$$getFont$$$(null, Font.BOLD, -1, arqueoField.getFont());
|
|
||||||
if (arqueoFieldFont != null) arqueoField.setFont(arqueoFieldFont);
|
|
||||||
arqueoField.setText("0");
|
|
||||||
panel2.add(arqueoField, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
ajusteField = new JTextField();
|
|
||||||
ajusteField.setEditable(false);
|
|
||||||
Font ajusteFieldFont = this.$$$getFont$$$(null, Font.BOLD, -1, ajusteField.getFont());
|
|
||||||
if (ajusteFieldFont != null) ajusteField.setFont(ajusteFieldFont);
|
|
||||||
ajusteField.setText("0");
|
|
||||||
panel2.add(ajusteField, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final JLabel label8 = new JLabel();
|
|
||||||
label8.setText("Ajuste ");
|
|
||||||
panel2.add(label8, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JSeparator separator1 = new JSeparator();
|
|
||||||
panel2.add(separator1, new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
|
||||||
final JLabel label9 = new JLabel();
|
|
||||||
label9.setText("Debe Rendir");
|
|
||||||
panel2.add(label9, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
rendidoField = new JTextField();
|
|
||||||
Font rendidoFieldFont = this.$$$getFont$$$(null, Font.BOLD, -1, rendidoField.getFont());
|
|
||||||
if (rendidoFieldFont != null) rendidoField.setFont(rendidoFieldFont);
|
|
||||||
rendidoField.setText("0");
|
|
||||||
panel2.add(rendidoField, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final JPanel panel3 = new JPanel();
|
|
||||||
panel3.setLayout(new GridLayoutManager(19, 2, new Insets(10, 10, 10, 10), -1, -1));
|
|
||||||
contentPanel.add(panel3, new GridConstraints(0, 0, 3, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
panel3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Detalle Efectivo", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, -1, -1, panel3.getFont())));
|
|
||||||
final JLabel label10 = new JLabel();
|
|
||||||
label10.setText("$20000");
|
|
||||||
panel3.add(label10, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
veinteMilField = new JTextField();
|
|
||||||
veinteMilField.setText("0");
|
|
||||||
panel3.add(veinteMilField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
final JLabel label11 = new JLabel();
|
|
||||||
label11.setText("$10000");
|
|
||||||
panel3.add(label11, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
diezMilField = new JTextField();
|
|
||||||
diezMilField.setText("0");
|
|
||||||
panel3.add(diezMilField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
cincoMilField = new JTextField();
|
|
||||||
cincoMilField.setText("0");
|
|
||||||
panel3.add(cincoMilField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
final JLabel label12 = new JLabel();
|
|
||||||
label12.setText("$5000");
|
|
||||||
panel3.add(label12, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JLabel label13 = new JLabel();
|
|
||||||
label13.setText("$2000");
|
|
||||||
panel3.add(label13, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
dosMilField = new JTextField();
|
|
||||||
dosMilField.setText("0");
|
|
||||||
panel3.add(dosMilField, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
milField = new JTextField();
|
|
||||||
milField.setText("0");
|
|
||||||
panel3.add(milField, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
final JLabel label14 = new JLabel();
|
|
||||||
label14.setText("$1000");
|
|
||||||
panel3.add(label14, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JLabel label15 = new JLabel();
|
|
||||||
label15.setText("$500");
|
|
||||||
panel3.add(label15, new GridConstraints(10, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
quinientosField = new JTextField();
|
|
||||||
quinientosField.setText("0");
|
|
||||||
panel3.add(quinientosField, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
final JLabel label16 = new JLabel();
|
|
||||||
label16.setText("$100");
|
|
||||||
panel3.add(label16, new GridConstraints(12, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
cienField = new JTextField();
|
|
||||||
cienField.setText("0");
|
|
||||||
panel3.add(cienField, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
final JLabel label17 = new JLabel();
|
|
||||||
label17.setText("$50");
|
|
||||||
panel3.add(label17, new GridConstraints(14, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
cincuentaField = new JTextField();
|
|
||||||
cincuentaField.setText("0");
|
|
||||||
panel3.add(cincuentaField, new GridConstraints(14, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
final JLabel label18 = new JLabel();
|
|
||||||
label18.setText("$10");
|
|
||||||
panel3.add(label18, new GridConstraints(16, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
diezField = new JTextField();
|
|
||||||
diezField.setText("0");
|
|
||||||
panel3.add(diezField, new GridConstraints(16, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
guardarEfectivoButton = new JButton();
|
|
||||||
guardarEfectivoButton.setText("Guardar");
|
|
||||||
panel3.add(guardarEfectivoButton, new GridConstraints(18, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
|
|
||||||
errorVeinteMil = new JLabel();
|
|
||||||
errorVeinteMil.setForeground(new Color(-65536));
|
|
||||||
errorVeinteMil.setText("Error");
|
|
||||||
errorVeinteMil.setVisible(false);
|
|
||||||
panel3.add(errorVeinteMil, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorDiezMil = new JLabel();
|
|
||||||
errorDiezMil.setForeground(new Color(-65536));
|
|
||||||
errorDiezMil.setText("Error");
|
|
||||||
errorDiezMil.setVisible(false);
|
|
||||||
panel3.add(errorDiezMil, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorCincoMil = new JLabel();
|
|
||||||
errorCincoMil.setForeground(new Color(-65536));
|
|
||||||
errorCincoMil.setText("Error");
|
|
||||||
errorCincoMil.setVisible(false);
|
|
||||||
panel3.add(errorCincoMil, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorDosMil = new JLabel();
|
|
||||||
errorDosMil.setForeground(new Color(-65536));
|
|
||||||
errorDosMil.setText("Error");
|
|
||||||
errorDosMil.setVisible(false);
|
|
||||||
panel3.add(errorDosMil, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorMil = new JLabel();
|
|
||||||
errorMil.setForeground(new Color(-65536));
|
|
||||||
errorMil.setText("Error");
|
|
||||||
errorMil.setVisible(false);
|
|
||||||
panel3.add(errorMil, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorQuinientos = new JLabel();
|
|
||||||
errorQuinientos.setForeground(new Color(-65536));
|
|
||||||
errorQuinientos.setText("Error");
|
|
||||||
errorQuinientos.setVisible(false);
|
|
||||||
panel3.add(errorQuinientos, new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorCien = new JLabel();
|
|
||||||
errorCien.setForeground(new Color(-65536));
|
|
||||||
errorCien.setText("Error");
|
|
||||||
errorCien.setVisible(false);
|
|
||||||
panel3.add(errorCien, new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorCincuenta = new JLabel();
|
|
||||||
errorCincuenta.setForeground(new Color(-65536));
|
|
||||||
errorCincuenta.setText("Error");
|
|
||||||
errorCincuenta.setVisible(false);
|
|
||||||
panel3.add(errorCincuenta, new GridConstraints(15, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorDiez = new JLabel();
|
|
||||||
errorDiez.setForeground(new Color(-65536));
|
|
||||||
errorDiez.setText("Error");
|
|
||||||
errorDiez.setVisible(false);
|
|
||||||
panel3.add(errorDiez, new GridConstraints(17, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final Spacer spacer1 = new Spacer();
|
|
||||||
contentPanel.add(spacer1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
|
||||||
final Spacer spacer2 = new Spacer();
|
|
||||||
contentPanel.add(spacer2, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,244 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="danielcortes.xyz.views.EgresosView">
|
|
||||||
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" 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="860" height="487"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<grid id="9047a" layout-manager="GridLayoutManager" row-count="3" column-count="1" 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="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="Egresos"/>
|
|
||||||
<children>
|
|
||||||
<scrollpane id="65bec">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="c0fff" class="javax.swing.JTable" binding="egresosTable" custom-create="true">
|
|
||||||
<constraints/>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</scrollpane>
|
|
||||||
<grid id="98ec" layout-manager="GridLayoutManager" row-count="3" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<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"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="c5b18" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" 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="N°"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="da489" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="1" 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="Descripcion"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="d8e90" class="javax.swing.JTextField" binding="descripcionField">
|
|
||||||
<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/>
|
|
||||||
</component>
|
|
||||||
<component id="1af5c" class="javax.swing.JTextField" binding="nroField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" 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/>
|
|
||||||
</component>
|
|
||||||
<component id="696ee" class="javax.swing.JTextField" binding="valorField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="2" 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/>
|
|
||||||
</component>
|
|
||||||
<component id="f50cf" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="2" 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="Valor"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="daec8" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="3" 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="Tipo"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="5602d" class="javax.swing.JComboBox" binding="tipoCombo">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
<component id="33b8a" class="javax.swing.JLabel" binding="errorNumero">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" 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>
|
|
||||||
<enabled value="true"/>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="116af" class="javax.swing.JLabel" binding="errorDescripcion">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<enabled value="true"/>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="42cb" class="javax.swing.JLabel" binding="errorValor">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<enabled value="true"/>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="e586b" class="javax.swing.JLabel" binding="errorTipoEgreso">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<enabled value="true"/>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Error"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="2cb6e" 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="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<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"/>
|
|
||||||
<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"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="c5738" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" 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="&Guardar"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="ee598" class="javax.swing.JButton" binding="eliminarButton" 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="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<enabled value="false"/>
|
|
||||||
<text value="&Eliminar"/>
|
|
||||||
</properties>
|
|
||||||
</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="&Editar"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<hspacer id="99a08">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</hspacer>
|
|
||||||
<grid id="3715e" layout-manager="GridLayoutManager" row-count="1" 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>
|
|
||||||
<grid row="0" column="2" 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="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="3442d" 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="Total Egresos:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="2b8d0" class="javax.swing.JTextField" binding="totalEgresosField">
|
|
||||||
<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"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<inspectionSuppressions>
|
|
||||||
<suppress inspection="FormSpellChecking"/>
|
|
||||||
<suppress inspection="I18nForm"/>
|
|
||||||
<suppress inspection="NoLabelFor"/>
|
|
||||||
</inspectionSuppressions>
|
|
||||||
</form>
|
|
||||||
@@ -1,238 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 danielcortes.xyz.models.tipo_egreso.TipoEgreso;
|
|
||||||
import danielcortes.xyz.views.components.EgresosTableModel;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class EgresosView {
|
|
||||||
public JPanel contentPanel;
|
|
||||||
private JTable egresosTable;
|
|
||||||
private JButton guardarButton;
|
|
||||||
private JTextField valorField;
|
|
||||||
private JTextField descripcionField;
|
|
||||||
private JTextField nroField;
|
|
||||||
private JTextField totalEgresosField;
|
|
||||||
private JComboBox<TipoEgreso> tipoCombo;
|
|
||||||
|
|
||||||
|
|
||||||
private JButton eliminarButton;
|
|
||||||
private JLabel errorNumero;
|
|
||||||
private JLabel errorDescripcion;
|
|
||||||
private JLabel errorValor;
|
|
||||||
private JLabel errorTipoEgreso;
|
|
||||||
private JButton editarButton;
|
|
||||||
|
|
||||||
private EgresosTableModel egresosTableModel;
|
|
||||||
|
|
||||||
private void createUIComponents() {
|
|
||||||
createEgresosTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createEgresosTable() {
|
|
||||||
egresosTableModel = new EgresosTableModel();
|
|
||||||
egresosTable = new JTable(egresosTableModel);
|
|
||||||
egresosTable.setAutoCreateRowSorter(true);
|
|
||||||
egresosTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPanel getContentPanel() {
|
|
||||||
return contentPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getGuardarButton() {
|
|
||||||
return guardarButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getEliminarButton() {
|
|
||||||
return eliminarButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getEditarButton() {
|
|
||||||
return editarButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getValorField() {
|
|
||||||
return valorField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getDescripcionField() {
|
|
||||||
return descripcionField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getNroField() {
|
|
||||||
return nroField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getTotalEgresosField() {
|
|
||||||
return totalEgresosField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JComboBox<TipoEgreso> getTipoCombo() {
|
|
||||||
return tipoCombo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTable getEgresosTable() {
|
|
||||||
return egresosTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EgresosTableModel getEgresosTableModel() {
|
|
||||||
return egresosTableModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorNumero() {
|
|
||||||
return errorNumero;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorDescripcion() {
|
|
||||||
return errorDescripcion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorValor() {
|
|
||||||
return errorValor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorTipoEgreso() {
|
|
||||||
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("N°");
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,239 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="danielcortes.xyz.views.IngresosView">
|
|
||||||
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" 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="766" height="411"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<grid id="e14bc" layout-manager="GridLayoutManager" row-count="3" column-count="1" 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="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="Ingresos"/>
|
|
||||||
<children>
|
|
||||||
<scrollpane id="bb19b">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="1ba21" class="javax.swing.JTable" binding="ingresosTable" custom-create="true">
|
|
||||||
<constraints/>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</scrollpane>
|
|
||||||
<grid id="7fa26" layout-manager="GridLayoutManager" row-count="3" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<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"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="50b32" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="3" 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="Tipo"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="b5d8c" class="javax.swing.JComboBox" binding="tipoCombo">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="3" 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>
|
|
||||||
<model/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="d0439" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" 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="Valor"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="375b0" class="javax.swing.JTextField" binding="valorField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" 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/>
|
|
||||||
</component>
|
|
||||||
<component id="9bb1" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="1" 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="N° Inicial"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="3f626" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="2" 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="N° Final"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="461c1" class="javax.swing.JTextField" binding="nroInicialField">
|
|
||||||
<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/>
|
|
||||||
</component>
|
|
||||||
<component id="949e" class="javax.swing.JTextField" binding="nroFinalField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="2" 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/>
|
|
||||||
</component>
|
|
||||||
<component id="d11b0" class="javax.swing.JLabel" binding="errorTipoIngreso">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Label"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="4b7ff" class="javax.swing.JLabel" binding="errorValor">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" 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>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Label"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="7d011" class="javax.swing.JLabel" binding="errorNroInicial">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Label"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="ef90" class="javax.swing.JLabel" binding="errorNroFinal">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<foreground color="-65536"/>
|
|
||||||
<text value="Label"/>
|
|
||||||
<visible value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="ea865" 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="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<grid id="bec48" layout-manager="GridLayoutManager" row-count="1" 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>
|
|
||||||
<grid row="0" column="2" 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="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="ed411" 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="Total Ingresos"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="d9f4a" class="javax.swing.JTextField" binding="totalIngresoField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<editable value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<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"/>
|
|
||||||
<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"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="98602" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" 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="&Añadir"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="c9542" class="javax.swing.JButton" binding="eliminarButton" 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="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Eliminar"/>
|
|
||||||
</properties>
|
|
||||||
</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>
|
|
||||||
</grid>
|
|
||||||
<hspacer id="7b168">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</hspacer>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<inspectionSuppressions>
|
|
||||||
<suppress inspection="I18nForm"/>
|
|
||||||
<suppress inspection="FormSpellChecking"/>
|
|
||||||
</inspectionSuppressions>
|
|
||||||
</form>
|
|
||||||
@@ -1,232 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 com.intellij.uiDesigner.core.GridConstraints;
|
|
||||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
|
||||||
import com.intellij.uiDesigner.core.Spacer;
|
|
||||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
|
|
||||||
import danielcortes.xyz.views.components.IngresosTableModel;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class IngresosView {
|
|
||||||
private JPanel contentPanel;
|
|
||||||
private JTable ingresosTable;
|
|
||||||
private JButton guardarButton;
|
|
||||||
private JButton eliminarButton;
|
|
||||||
private JTextField totalIngresoField;
|
|
||||||
private JTextField valorField;
|
|
||||||
private JComboBox<TipoIngreso> tipoCombo;
|
|
||||||
private JLabel errorTipoIngreso;
|
|
||||||
private JLabel errorValor;
|
|
||||||
private JButton editarButton;
|
|
||||||
private JTextField nroInicialField;
|
|
||||||
private JTextField nroFinalField;
|
|
||||||
private JLabel errorNroInicial;
|
|
||||||
private JLabel errorNroFinal;
|
|
||||||
|
|
||||||
private IngresosTableModel ingresosTableModel;
|
|
||||||
|
|
||||||
private void createUIComponents() {
|
|
||||||
this.createIngresosTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createIngresosTable() {
|
|
||||||
this.ingresosTableModel = new IngresosTableModel();
|
|
||||||
this.ingresosTable = new JTable(ingresosTableModel);
|
|
||||||
this.ingresosTable.setAutoCreateRowSorter(true);
|
|
||||||
this.ingresosTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPanel getContentPanel() {
|
|
||||||
return contentPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTable getIngresosTable() {
|
|
||||||
return ingresosTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getGuardarButton() {
|
|
||||||
return guardarButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getEliminarButton() {
|
|
||||||
return eliminarButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getTotalIngresoField() {
|
|
||||||
return totalIngresoField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getValorField() {
|
|
||||||
return valorField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JComboBox<TipoIngreso> getTipoCombo() {
|
|
||||||
return tipoCombo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorTipoIngreso() {
|
|
||||||
return errorTipoIngreso;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorValor() {
|
|
||||||
return errorValor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getEditarButton() {
|
|
||||||
return editarButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getNroInicialField() {
|
|
||||||
return nroInicialField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getNroFinalField() {
|
|
||||||
return nroFinalField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorNroInicial() {
|
|
||||||
return errorNroInicial;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JLabel getErrorNroFinal() {
|
|
||||||
return errorNroFinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IngresosTableModel getIngresosTableModel() {
|
|
||||||
return ingresosTableModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// 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 GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
|
||||||
final JPanel panel1 = new JPanel();
|
|
||||||
panel1.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1));
|
|
||||||
contentPanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Ingresos"));
|
|
||||||
final JScrollPane scrollPane1 = new JScrollPane();
|
|
||||||
panel1.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
|
||||||
scrollPane1.setViewportView(ingresosTable);
|
|
||||||
final JPanel panel2 = new JPanel();
|
|
||||||
panel2.setLayout(new GridLayoutManager(3, 4, new Insets(0, 0, 0, 0), -1, -1));
|
|
||||||
panel1.add(panel2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
final JLabel label1 = new JLabel();
|
|
||||||
label1.setText("Tipo");
|
|
||||||
panel2.add(label1, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
tipoCombo = new JComboBox();
|
|
||||||
final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
|
|
||||||
tipoCombo.setModel(defaultComboBoxModel1);
|
|
||||||
panel2.add(tipoCombo, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final JLabel label2 = new JLabel();
|
|
||||||
label2.setText("Valor");
|
|
||||||
panel2.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
valorField = new JTextField();
|
|
||||||
panel2.add(valorField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final JLabel label3 = new JLabel();
|
|
||||||
label3.setText("N° Inicial");
|
|
||||||
panel2.add(label3, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JLabel label4 = new JLabel();
|
|
||||||
label4.setText("N° Final");
|
|
||||||
panel2.add(label4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
nroInicialField = new JTextField();
|
|
||||||
panel2.add(nroInicialField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
nroFinalField = new JTextField();
|
|
||||||
panel2.add(nroFinalField, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 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 GridConstraints(2, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, 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 GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorNroInicial = new JLabel();
|
|
||||||
errorNroInicial.setForeground(new Color(-65536));
|
|
||||||
errorNroInicial.setText("Label");
|
|
||||||
errorNroInicial.setVisible(false);
|
|
||||||
panel2.add(errorNroInicial, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
errorNroFinal = new JLabel();
|
|
||||||
errorNroFinal.setForeground(new Color(-65536));
|
|
||||||
errorNroFinal.setText("Label");
|
|
||||||
errorNroFinal.setVisible(false);
|
|
||||||
panel2.add(errorNroFinal, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JPanel panel3 = new JPanel();
|
|
||||||
panel3.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
|
|
||||||
panel1.add(panel3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
final JPanel panel4 = new JPanel();
|
|
||||||
panel4.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
|
||||||
panel3.add(panel4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
final JLabel label5 = new JLabel();
|
|
||||||
label5.setText("Total Ingresos");
|
|
||||||
panel4.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
totalIngresoField = new JTextField();
|
|
||||||
totalIngresoField.setEditable(false);
|
|
||||||
panel4.add(totalIngresoField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final JPanel panel5 = new JPanel();
|
|
||||||
panel5.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
|
|
||||||
panel3.add(panel5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
guardarButton = new JButton();
|
|
||||||
guardarButton.setText("Añadir");
|
|
||||||
guardarButton.setMnemonic('A');
|
|
||||||
guardarButton.setDisplayedMnemonicIndex(0);
|
|
||||||
panel5.add(guardarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
eliminarButton = new JButton();
|
|
||||||
eliminarButton.setText("Eliminar");
|
|
||||||
panel5.add(eliminarButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
editarButton = new JButton();
|
|
||||||
editarButton.setText("Editar");
|
|
||||||
panel5.add(editarButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
final Spacer spacer1 = new Spacer();
|
|
||||||
panel3.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @noinspection ALL
|
|
||||||
*/
|
|
||||||
public JComponent $$$getRootComponent$$$() {
|
|
||||||
return contentPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="danielcortes.xyz.views.ManagerView">
|
|
||||||
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="10" left="10" bottom="10" right="10"/>
|
|
||||||
<constraints>
|
|
||||||
<xy x="20" y="20" width="561" height="307"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<grid id="100a8" binding="cardPanel" layout-manager="CardLayout" hgap="0" vgap="0">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" 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="none"/>
|
|
||||||
<children/>
|
|
||||||
</grid>
|
|
||||||
<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"/>
|
|
||||||
<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"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="a853b" class="javax.swing.JToggleButton" binding="egresosButton">
|
|
||||||
<constraints>
|
|
||||||
<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"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="&Egresos"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="a494c" class="javax.swing.JToggleButton" binding="ingresosButton">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="1" 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="&Ingresos"/>
|
|
||||||
</properties>
|
|
||||||
</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="&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>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<buttonGroups>
|
|
||||||
<group name="btnGroup">
|
|
||||||
<member id="a853b"/>
|
|
||||||
<member id="a494c"/>
|
|
||||||
<member id="d23e2"/>
|
|
||||||
</group>
|
|
||||||
</buttonGroups>
|
|
||||||
<inspectionSuppressions>
|
|
||||||
<suppress inspection="I18nForm"/>
|
|
||||||
<suppress inspection="FormSpellChecking"/>
|
|
||||||
</inspectionSuppressions>
|
|
||||||
</form>
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 com.github.lgooddatepicker.components.DatePicker;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class ManagerView {
|
|
||||||
private JToggleButton egresosButton;
|
|
||||||
private JToggleButton ingresosButton;
|
|
||||||
private JPanel contentPanel;
|
|
||||||
private JPanel cardPanel;
|
|
||||||
private JPanel controlsPanel;
|
|
||||||
private JToggleButton arqueoButton;
|
|
||||||
private DatePicker datePicker;
|
|
||||||
|
|
||||||
public JToggleButton getEgresosButton() {
|
|
||||||
return egresosButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JToggleButton getIngresosButton() {
|
|
||||||
return ingresosButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JToggleButton getArqueoButton() {
|
|
||||||
return arqueoButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatePicker getDatePicker() {
|
|
||||||
return datePicker;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPanel getContentPanel() {
|
|
||||||
return contentPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPanel getCardPanel() {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.components;
|
|
||||||
|
|
||||||
import danielcortes.xyz.models.egreso.Egreso;
|
|
||||||
|
|
||||||
import javax.swing.table.AbstractTableModel;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class EgresosTableModel extends AbstractTableModel {
|
|
||||||
private String[] columns;
|
|
||||||
private ArrayList<Egreso> rows;
|
|
||||||
|
|
||||||
public EgresosTableModel(){
|
|
||||||
super();
|
|
||||||
this.columns = new String[]{"N°", "Descripcion", "Valor", "Tipo"};
|
|
||||||
this.rows = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColumnName(int col) {
|
|
||||||
return columns[col];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getColumnCount() {
|
|
||||||
return columns.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRowCount() {
|
|
||||||
return rows.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addRow(Egreso egreso) {
|
|
||||||
rows.add(egreso);
|
|
||||||
this.fireTableRowsInserted(getRowCount()-1, getRowCount()-1);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeRow(int row){
|
|
||||||
this.rows.remove(row);
|
|
||||||
this.fireTableRowsDeleted(row,row);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeRows(){
|
|
||||||
int rowCount = getRowCount();
|
|
||||||
if(rowCount > 0){
|
|
||||||
this.rows.clear();
|
|
||||||
this.fireTableRowsDeleted(0, rowCount-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEgreso(int editingId, Egreso egreso) {
|
|
||||||
this.rows.set(editingId, egreso);
|
|
||||||
this.fireTableRowsUpdated(0,getRowCount()-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValueAt(int row, int col) {
|
|
||||||
switch (col){
|
|
||||||
case 0:
|
|
||||||
return rows.get(row).getNro();
|
|
||||||
case 1:
|
|
||||||
return rows.get(row).getDescripcion();
|
|
||||||
case 2:
|
|
||||||
return rows.get(row).getValor();
|
|
||||||
case 3:
|
|
||||||
return rows.get(row).getTipoEgreso();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Egreso getEgreso(int row){
|
|
||||||
return rows.get(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.components;
|
|
||||||
|
|
||||||
import danielcortes.xyz.models.ingreso.Ingreso;
|
|
||||||
|
|
||||||
import javax.swing.table.AbstractTableModel;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class IngresosTableModel extends AbstractTableModel {
|
|
||||||
private String[] columns;
|
|
||||||
private ArrayList<Ingreso> rows;
|
|
||||||
|
|
||||||
public IngresosTableModel() {
|
|
||||||
super();
|
|
||||||
this.columns = new String[]{"Valor", "N° Inicial", "N° Final", "Tipo"};
|
|
||||||
this.rows = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColumnName(int col) {
|
|
||||||
return this.columns[col];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getColumnCount() {
|
|
||||||
return this.columns.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRowCount() {
|
|
||||||
return this.rows.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addRow(Ingreso ingreso) {
|
|
||||||
this.rows.add(ingreso);
|
|
||||||
this.fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeRow(int row) {
|
|
||||||
this.rows.remove(row);
|
|
||||||
this.fireTableRowsDeleted(row, row);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeRows() {
|
|
||||||
int rowCount = getRowCount();
|
|
||||||
if (rowCount > 0) {
|
|
||||||
this.rows.clear();
|
|
||||||
this.fireTableRowsDeleted(0, rowCount - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValueAt(int row, int col) {
|
|
||||||
switch (col) {
|
|
||||||
case 0:
|
|
||||||
return this.rows.get(row).getValor();
|
|
||||||
case 1:
|
|
||||||
return this.rows.get(row).getNroInicial();
|
|
||||||
case 2:
|
|
||||||
return this.rows.get(row).getNroFinal();
|
|
||||||
case 3:
|
|
||||||
return this.rows.get(row).getTipoIngreso().getNombre();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingreso getIngreso(int row) {
|
|
||||||
return this.rows.get(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIngreso(int editingId, Ingreso ingreso) {
|
|
||||||
this.rows.set(editingId, ingreso);
|
|
||||||
this.fireTableRowsUpdated(getRowCount() - 2, getRowCount() - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
Main-Class: danielcortes.xyz.Main
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user