Resubido todo
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
out
|
||||||
14
.idea/artifacts/caja_jar.xml
generated
Normal file
14
.idea/artifacts/caja_jar.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<component name="ArtifactManager">
|
||||||
|
<artifact type="jar" name="caja:jar">
|
||||||
|
<output-path>$PROJECT_DIR$/out/artifacts/caja_jar</output-path>
|
||||||
|
<root id="archive" name="caja.jar">
|
||||||
|
<element id="module-output" name="caja" />
|
||||||
|
<element id="extracted-dir" path="$APPLICATION_HOME_DIR$/redist/forms_rt.jar" path-in-jar="/" />
|
||||||
|
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/github/lgooddatepicker/LGoodDatePicker/10.3.1/LGoodDatePicker-10.3.1.jar" path-in-jar="/" />
|
||||||
|
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar" path-in-jar="/" />
|
||||||
|
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1.jar" path-in-jar="/" />
|
||||||
|
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13.jar" path-in-jar="/" />
|
||||||
|
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/xerial/sqlite-jdbc/3.25.2/sqlite-jdbc-3.25.2.jar" path-in-jar="/" />
|
||||||
|
</root>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
16
.idea/compiler.xml
generated
Normal file
16
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="caja" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
<bytecodeTargetLevel target="8">
|
||||||
|
<module name="caja" target="8" />
|
||||||
|
</bytecodeTargetLevel>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
7
.idea/copyright/MIT_License.xml
generated
Normal file
7
.idea/copyright/MIT_License.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="keyword" />
|
||||||
|
<option name="notice" value="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." />
|
||||||
|
<option name="myName" value="MIT License" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
||||||
7
.idea/copyright/profiles_settings.xml
generated
Normal file
7
.idea/copyright/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="MIT License">
|
||||||
|
<module2copyright>
|
||||||
|
<element module="src files" copyright="MIT License" />
|
||||||
|
</module2copyright>
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
24
.idea/dataSources.local.xml
generated
Normal file
24
.idea/dataSources.local.xml
generated
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="dataSourceStorageLocal">
|
||||||
|
<data-source name="MariaDB - caja@localhost" uuid="ddc47f43-aee6-477e-9abc-9a07c78c8f9d">
|
||||||
|
<database-info product="MySQL" version="10.1.37-MariaDB" jdbc-version="4.2" driver-name="MariaDB connector/J" driver-version="2.2.1" dbms="MARIADB" exact-version="10.1.37" exact-driver-version="2.2">
|
||||||
|
<extra-name-characters>#@</extra-name-characters>
|
||||||
|
<identifier-quote-string>`</identifier-quote-string>
|
||||||
|
</database-info>
|
||||||
|
<case-sensitivity plain-identifiers="exact" quoted-identifiers="exact" />
|
||||||
|
<secret-storage>master_key</secret-storage>
|
||||||
|
<user-name>root</user-name>
|
||||||
|
<introspection-schemas>*:@</introspection-schemas>
|
||||||
|
</data-source>
|
||||||
|
<data-source name="Sqlite" uuid="6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50">
|
||||||
|
<database-info product="SQLite" version="3.25.1" jdbc-version="2.1" driver-name="SQLite JDBC" driver-version="3.25.1" dbms="SQLITE" exact-version="3.25.1" exact-driver-version="3.25">
|
||||||
|
<identifier-quote-string>"</identifier-quote-string>
|
||||||
|
</database-info>
|
||||||
|
<case-sensitivity plain-identifiers="mixed" quoted-identifiers="mixed" />
|
||||||
|
<secret-storage>master_key</secret-storage>
|
||||||
|
<auth-required>false</auth-required>
|
||||||
|
<introspection-schemas>*:@</introspection-schemas>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
28
.idea/dataSources.xml
generated
Normal file
28
.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="MariaDB - caja@localhost" uuid="ddc47f43-aee6-477e-9abc-9a07c78c8f9d">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://localhost:3306/caja</jdbc-url>
|
||||||
|
<driver-properties>
|
||||||
|
<property name="autoReconnect" value="true" />
|
||||||
|
<property name="zeroDateTimeBehavior" value="convertToNull" />
|
||||||
|
<property name="tinyInt1isBit" value="false" />
|
||||||
|
<property name="characterEncoding" value="utf8" />
|
||||||
|
<property name="characterSetResults" value="utf8" />
|
||||||
|
<property name="yearIsDateType" value="false" />
|
||||||
|
</driver-properties>
|
||||||
|
</data-source>
|
||||||
|
<data-source source="LOCAL" name="Sqlite" uuid="6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50">
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/database.sqlite</jdbc-url>
|
||||||
|
<driver-properties>
|
||||||
|
<property name="enable_load_extension" value="true" />
|
||||||
|
</driver-properties>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
273
.idea/dataSources/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50.xml
generated
Normal file
273
.idea/dataSources/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50.xml
generated
Normal file
@@ -0,0 +1,273 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<dataSource name="Sqlite">
|
||||||
|
<database-model serializer="dbm" dbms="SQLITE" family-id="SQLITE" format-version="4.14">
|
||||||
|
<root id="1">
|
||||||
|
<ServerVersion>3.25.1</ServerVersion>
|
||||||
|
</root>
|
||||||
|
<schema id="2" parent="1" name="main">
|
||||||
|
<Current>1</Current>
|
||||||
|
<Visible>1</Visible>
|
||||||
|
</schema>
|
||||||
|
<collation id="3" parent="1" name="BINARY"/>
|
||||||
|
<collation id="4" parent="1" name="NOCASE"/>
|
||||||
|
<collation id="5" parent="1" name="RTRIM"/>
|
||||||
|
<table id="6" parent="2" name="caja"/>
|
||||||
|
<table id="7" parent="2" name="documentos"/>
|
||||||
|
<table id="8" parent="2" name="efectivos"/>
|
||||||
|
<table id="9" parent="2" name="egresos"/>
|
||||||
|
<table id="10" parent="2" name="ingresos"/>
|
||||||
|
<table id="11" parent="2" name="sqlite_master">
|
||||||
|
<System>1</System>
|
||||||
|
</table>
|
||||||
|
<table id="12" parent="2" name="tipos_egreso"/>
|
||||||
|
<table id="13" parent="2" name="tipos_ingreso"/>
|
||||||
|
<column id="14" parent="6" name="id">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="15" parent="6" name="fecha">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>date|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<key id="16" parent="6">
|
||||||
|
<ColNames>id</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
</key>
|
||||||
|
<column id="17" parent="7" name="id">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="18" parent="7" name="cheques">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="19" parent="7" name="tarjetas">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="20" parent="7" name="caja_id">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<key id="21" parent="7">
|
||||||
|
<ColNames>id</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
</key>
|
||||||
|
<foreign-key id="22" parent="7">
|
||||||
|
<ColNames>caja_id</ColNames>
|
||||||
|
<RefTableName>caja</RefTableName>
|
||||||
|
<RefColNames>id</RefColNames>
|
||||||
|
<OnDelete>restrict</OnDelete>
|
||||||
|
<OnUpdate>cascade</OnUpdate>
|
||||||
|
</foreign-key>
|
||||||
|
<column id="23" parent="8" name="id">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="24" parent="8" name="veinte_mil">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="25" parent="8" name="diez_mil">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="26" parent="8" name="cinco_mil">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="27" parent="8" name="dos_mil">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="28" parent="8" name="mil">
|
||||||
|
<Position>6</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="29" parent="8" name="quinientos">
|
||||||
|
<Position>7</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="30" parent="8" name="cien">
|
||||||
|
<Position>8</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="31" parent="8" name="cincuenta">
|
||||||
|
<Position>9</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="32" parent="8" name="diez">
|
||||||
|
<Position>10</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="33" parent="8" name="caja_id">
|
||||||
|
<Position>11</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<key id="34" parent="8">
|
||||||
|
<ColNames>id</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
</key>
|
||||||
|
<foreign-key id="35" parent="8">
|
||||||
|
<ColNames>caja_id</ColNames>
|
||||||
|
<RefTableName>caja</RefTableName>
|
||||||
|
<RefColNames>id</RefColNames>
|
||||||
|
<OnDelete>restrict</OnDelete>
|
||||||
|
<OnUpdate>cascade</OnUpdate>
|
||||||
|
</foreign-key>
|
||||||
|
<column id="36" parent="9" name="id">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="37" parent="9" name="nro">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="38" parent="9" name="descripcion">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="39" parent="9" name="valor">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="40" parent="9" name="tipo_egreso_id">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="41" parent="9" name="caja_id">
|
||||||
|
<Position>6</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<key id="42" parent="9">
|
||||||
|
<ColNames>id</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
</key>
|
||||||
|
<foreign-key id="43" parent="9">
|
||||||
|
<ColNames>tipo_egreso_id</ColNames>
|
||||||
|
<RefTableName>tipos_egreso</RefTableName>
|
||||||
|
<RefColNames>id</RefColNames>
|
||||||
|
<OnDelete>restrict</OnDelete>
|
||||||
|
<OnUpdate>cascade</OnUpdate>
|
||||||
|
</foreign-key>
|
||||||
|
<foreign-key id="44" parent="9">
|
||||||
|
<ColNames>caja_id</ColNames>
|
||||||
|
<RefTableName>caja</RefTableName>
|
||||||
|
<RefColNames>id</RefColNames>
|
||||||
|
<OnDelete>restrict</OnDelete>
|
||||||
|
<OnUpdate>cascade</OnUpdate>
|
||||||
|
</foreign-key>
|
||||||
|
<column id="45" parent="10" name="id">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="46" parent="10" name="valor">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="47" parent="10" name="nro_inicial">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="48" parent="10" name="nro_final">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="49" parent="10" name="tipo_ingreso_id">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>integer unsigned|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="50" parent="10" name="caja_id">
|
||||||
|
<Position>6</Position>
|
||||||
|
<DataType>integer unsigned|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<key id="51" parent="10">
|
||||||
|
<ColNames>id</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
</key>
|
||||||
|
<foreign-key id="52" parent="10">
|
||||||
|
<ColNames>tipo_ingreso_id</ColNames>
|
||||||
|
<RefTableName>tipos_ingreso</RefTableName>
|
||||||
|
<RefColNames>id</RefColNames>
|
||||||
|
<OnDelete>restrict</OnDelete>
|
||||||
|
<OnUpdate>cascade</OnUpdate>
|
||||||
|
</foreign-key>
|
||||||
|
<foreign-key id="53" parent="10">
|
||||||
|
<ColNames>caja_id</ColNames>
|
||||||
|
<RefTableName>caja</RefTableName>
|
||||||
|
<RefColNames>id</RefColNames>
|
||||||
|
<OnDelete>restrict</OnDelete>
|
||||||
|
<OnUpdate>cascade</OnUpdate>
|
||||||
|
</foreign-key>
|
||||||
|
<column id="54" parent="11" name="type">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="55" parent="11" name="name">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="56" parent="11" name="tbl_name">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="57" parent="11" name="rootpage">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>int|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="58" parent="11" name="sql">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="59" parent="12" name="id">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="60" parent="12" name="nombre">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<key id="61" parent="12">
|
||||||
|
<ColNames>id</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
</key>
|
||||||
|
<column id="62" parent="13" name="id">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>integer|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="63" parent="13" name="nombre">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<key id="64" parent="13">
|
||||||
|
<ColNames>id</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
</key>
|
||||||
|
</database-model>
|
||||||
|
</dataSource>
|
||||||
2
.idea/dataSources/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/storage_v2/_src_/schema/main.uQUzAA.meta
generated
Normal file
2
.idea/dataSources/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/storage_v2/_src_/schema/main.uQUzAA.meta
generated
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#n:main
|
||||||
|
!<md> [0, 0, null, null, -2147483648, -2147483648]
|
||||||
1274
.idea/dataSources/ddc47f43-aee6-477e-9abc-9a07c78c8f9d.xml
generated
Normal file
1274
.idea/dataSources/ddc47f43-aee6-477e-9abc-9a07c78c8f9d.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
4
.idea/encodings.xml
generated
Normal file
4
.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||||
|
</project>
|
||||||
11
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
11
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="Duplicates" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||||
|
<option name="processCode" value="true" />
|
||||||
|
<option name="processLiterals" value="true" />
|
||||||
|
<option name="processComments" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__com_github_lgooddatepicker_LGoodDatePicker_10_3_1.xml
generated
Normal file
13
.idea/libraries/Maven__com_github_lgooddatepicker_LGoodDatePicker_10_3_1.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.github.lgooddatepicker:LGoodDatePicker:10.3.1">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/lgooddatepicker/LGoodDatePicker/10.3.1/LGoodDatePicker-10.3.1.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/lgooddatepicker/LGoodDatePicker/10.3.1/LGoodDatePicker-10.3.1-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/lgooddatepicker/LGoodDatePicker/10.3.1/LGoodDatePicker-10.3.1-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__com_google_code_gson_gson_2_8_5.xml
generated
Normal file
13
.idea/libraries/Maven__com_google_code_gson_gson_2_8_5.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.google.code.gson:gson:2.8.5">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.5/gson-2.8.5-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.5/gson-2.8.5-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_6_1.xml
generated
Normal file
13
.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_6_1.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.google.protobuf:protobuf-java:3.6.1">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__mysql_mysql_connector_java_8_0_13.xml
generated
Normal file
13
.idea/libraries/Maven__mysql_mysql_connector_java_8_0_13.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: mysql:mysql-connector-java:8.0.13">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__org_xerial_sqlite_jdbc_3_25_2.xml
generated
Normal file
13
.idea/libraries/Maven__org_xerial_sqlite_jdbc_3_25_2.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.xerial:sqlite-jdbc:3.25.2">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/xerial/sqlite-jdbc/3.25.2/sqlite-jdbc-3.25.2.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/xerial/sqlite-jdbc/3.25.2/sqlite-jdbc-3.25.2-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/xerial/sqlite-jdbc/3.25.2/sqlite-jdbc-3.25.2-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/misc.xml
generated
Normal file
13
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/caja.iml" filepath="$PROJECT_DIR$/caja.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
3
.idea/scopes/src_files.xml
generated
Normal file
3
.idea/scopes/src_files.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<scope name="src files" pattern="src:danielcortes.xyz..*||file[caja]:database/*" />
|
||||||
|
</component>
|
||||||
8
.idea/sqldialects.xml
generated
Normal file
8
.idea/sqldialects.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="SqlDialectMappings">
|
||||||
|
<file url="file://$PROJECT_DIR$/database/mysql.sql" dialect="MariaDB" />
|
||||||
|
<file url="file://$PROJECT_DIR$/database/sqlite.sql" dialect="SQLite" />
|
||||||
|
<file url="PROJECT" dialect="GenericSQL" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
135
.idea/uiDesigner.xml
generated
Normal file
135
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Favoritos">
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToggleButton" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="com.github.lgooddatepicker.components.DatePicker" icon="images/DatePickerIcon 16x16.png" removable="true" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
<component name="uidesigner-configuration">
|
||||||
|
<option name="INSTRUMENT_CLASSES" value="false" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
1030
.idea/workspace.xml
generated
Normal file
1030
.idea/workspace.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
16
caja.iml
Normal file
16
caja.iml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="com.google.code.gson:gson:2.8.5" level="project" />
|
||||||
|
<orderEntry type="library" name="mysql:mysql-connector-java:8.0.13" level="project" />
|
||||||
|
<orderEntry type="library" name="org.xerial:sqlite-jdbc:3.25.2" level="project" />
|
||||||
|
<orderEntry type="library" name="com.github.lgooddatepicker:LGoodDatePicker:10.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="forms_rt" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
25
conf.properties
Normal file
25
conf.properties
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# 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
Normal file
BIN
database.sqlite
Normal file
Binary file not shown.
119
database/mysql.sql
Normal file
119
database/mysql.sql
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
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')
|
||||||
|
|
||||||
120
database/sqlite.sql
Normal file
120
database/sqlite.sql
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
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')
|
||||||
|
|
||||||
BIN
lib/LGoodDatePicker-10.3.1-javadoc.jar
Normal file
BIN
lib/LGoodDatePicker-10.3.1-javadoc.jar
Normal file
Binary file not shown.
BIN
lib/LGoodDatePicker-10.3.1-sources.jar
Normal file
BIN
lib/LGoodDatePicker-10.3.1-sources.jar
Normal file
Binary file not shown.
BIN
lib/LGoodDatePicker-10.3.1.jar
Normal file
BIN
lib/LGoodDatePicker-10.3.1.jar
Normal file
Binary file not shown.
BIN
lib/gson-2.8.5-javadoc.jar
Normal file
BIN
lib/gson-2.8.5-javadoc.jar
Normal file
Binary file not shown.
BIN
lib/gson-2.8.5-sources.jar
Normal file
BIN
lib/gson-2.8.5-sources.jar
Normal file
Binary file not shown.
BIN
lib/gson-2.8.5.jar
Normal file
BIN
lib/gson-2.8.5.jar
Normal file
Binary file not shown.
BIN
lib/mysql-connector-java-8.0.13-sources.jar
Normal file
BIN
lib/mysql-connector-java-8.0.13-sources.jar
Normal file
Binary file not shown.
BIN
lib/mysql-connector-java-8.0.13.jar
Normal file
BIN
lib/mysql-connector-java-8.0.13.jar
Normal file
Binary file not shown.
BIN
lib/protobuf-java-3.6.1-javadoc.jar
Normal file
BIN
lib/protobuf-java-3.6.1-javadoc.jar
Normal file
Binary file not shown.
BIN
lib/protobuf-java-3.6.1-sources.jar
Normal file
BIN
lib/protobuf-java-3.6.1-sources.jar
Normal file
Binary file not shown.
BIN
lib/protobuf-java-3.6.1.jar
Normal file
BIN
lib/protobuf-java-3.6.1.jar
Normal file
Binary file not shown.
BIN
lib/sqlite-jdbc-3.25.2-javadoc.jar
Normal file
BIN
lib/sqlite-jdbc-3.25.2-javadoc.jar
Normal file
Binary file not shown.
BIN
lib/sqlite-jdbc-3.25.2-sources.jar
Normal file
BIN
lib/sqlite-jdbc-3.25.2-sources.jar
Normal file
Binary file not shown.
BIN
lib/sqlite-jdbc-3.25.2.jar
Normal file
BIN
lib/sqlite-jdbc-3.25.2.jar
Normal file
Binary file not shown.
3
src/META-INF/MANIFEST.MF
Normal file
3
src/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: danielcortes.xyz.Main
|
||||||
|
|
||||||
108
src/danielcortes/xyz/Main.java
Normal file
108
src/danielcortes/xyz/Main.java
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
324
src/danielcortes/xyz/controllers/ArqueoController.java
Normal file
324
src/danielcortes/xyz/controllers/ArqueoController.java
Normal file
@@ -0,0 +1,324 @@
|
|||||||
|
/*
|
||||||
|
* 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
319
src/danielcortes/xyz/controllers/EgresosController.java
Normal file
319
src/danielcortes/xyz/controllers/EgresosController.java
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
/*
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
321
src/danielcortes/xyz/controllers/IngresosController.java
Normal file
321
src/danielcortes/xyz/controllers/IngresosController.java
Normal file
@@ -0,0 +1,321 @@
|
|||||||
|
/*
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
163
src/danielcortes/xyz/controllers/ManagerController.java
Normal file
163
src/danielcortes/xyz/controllers/ManagerController.java
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
31
src/danielcortes/xyz/data/ConnectionHolder.java
Normal file
31
src/danielcortes/xyz/data/ConnectionHolder.java
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
38
src/danielcortes/xyz/data/MysqlConnectionHolder.java
Normal file
38
src/danielcortes/xyz/data/MysqlConnectionHolder.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
52
src/danielcortes/xyz/data/Properties.java
Normal file
52
src/danielcortes/xyz/data/Properties.java
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Daniel Cortes
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package danielcortes.xyz.data;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class Properties {
|
||||||
|
private static Properties ourInstance = new Properties();
|
||||||
|
public static java.util.Properties getInstance() {
|
||||||
|
return ourInstance.props;
|
||||||
|
}
|
||||||
|
|
||||||
|
private java.util.Properties props;
|
||||||
|
|
||||||
|
private Properties() {
|
||||||
|
try {
|
||||||
|
this.props = new java.util.Properties();
|
||||||
|
FileInputStream in = new FileInputStream("conf.properties");
|
||||||
|
this.props.load(in);
|
||||||
|
in.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Couldn't load properties");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
45
src/danielcortes/xyz/data/SQLiteConnectionHolder.java
Normal file
45
src/danielcortes/xyz/data/SQLiteConnectionHolder.java
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
48
src/danielcortes/xyz/models/caja/Caja.java
Normal file
48
src/danielcortes/xyz/models/caja/Caja.java
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Daniel Cortes
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package danielcortes.xyz.models.caja;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class Caja {
|
||||||
|
private int id;
|
||||||
|
private LocalDate fecha;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getFecha() {
|
||||||
|
return fecha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecha(LocalDate fecha) {
|
||||||
|
this.fecha = fecha;
|
||||||
|
}
|
||||||
|
}
|
||||||
55
src/danielcortes/xyz/models/caja/CajaDAO.java
Normal file
55
src/danielcortes/xyz/models/caja/CajaDAO.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
152
src/danielcortes/xyz/models/caja/MysqlCajaDAO.java
Normal file
152
src/danielcortes/xyz/models/caja/MysqlCajaDAO.java
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
155
src/danielcortes/xyz/models/caja/SQLiteCajaDAO.java
Normal file
155
src/danielcortes/xyz/models/caja/SQLiteCajaDAO.java
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/danielcortes/xyz/models/documentos/Documentos.java
Normal file
66
src/danielcortes/xyz/models/documentos/Documentos.java
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Daniel Cortes
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package danielcortes.xyz.models.documentos;
|
||||||
|
|
||||||
|
import danielcortes.xyz.models.caja.Caja;
|
||||||
|
|
||||||
|
public class Documentos {
|
||||||
|
private int id;
|
||||||
|
private int cheques;
|
||||||
|
private int tarjetas;
|
||||||
|
private Caja caja;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCheques() {
|
||||||
|
return cheques;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCheques(int cheques) {
|
||||||
|
this.cheques = cheques;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTarjetas() {
|
||||||
|
return tarjetas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTarjetas(int tarjetas) {
|
||||||
|
this.tarjetas = tarjetas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Caja getCaja() {
|
||||||
|
return caja;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCaja(Caja caja) {
|
||||||
|
this.caja = caja;
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/danielcortes/xyz/models/documentos/DocumentosDAO.java
Normal file
66
src/danielcortes/xyz/models/documentos/DocumentosDAO.java
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Daniel Cortes
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package danielcortes.xyz.models.documentos;
|
||||||
|
|
||||||
|
import danielcortes.xyz.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
206
src/danielcortes/xyz/models/documentos/MysqlDocumentosDAO.java
Normal file
206
src/danielcortes/xyz/models/documentos/MysqlDocumentosDAO.java
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
205
src/danielcortes/xyz/models/documentos/SQLiteDocumentosDAO.java
Normal file
205
src/danielcortes/xyz/models/documentos/SQLiteDocumentosDAO.java
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Daniel Cortes
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package danielcortes.xyz.models.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
129
src/danielcortes/xyz/models/efectivo/Efectivo.java
Normal file
129
src/danielcortes/xyz/models/efectivo/Efectivo.java
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
73
src/danielcortes/xyz/models/efectivo/EfectivoDAO.java
Normal file
73
src/danielcortes/xyz/models/efectivo/EfectivoDAO.java
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
218
src/danielcortes/xyz/models/efectivo/MysqlEfectivoDAO.java
Normal file
218
src/danielcortes/xyz/models/efectivo/MysqlEfectivoDAO.java
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
218
src/danielcortes/xyz/models/efectivo/SQLiteEfectivoDAO.java
Normal file
218
src/danielcortes/xyz/models/efectivo/SQLiteEfectivoDAO.java
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
86
src/danielcortes/xyz/models/egreso/Egreso.java
Normal file
86
src/danielcortes/xyz/models/egreso/Egreso.java
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
80
src/danielcortes/xyz/models/egreso/EgresoDAO.java
Normal file
80
src/danielcortes/xyz/models/egreso/EgresoDAO.java
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
241
src/danielcortes/xyz/models/egreso/MysqlEgresoDAO.java
Normal file
241
src/danielcortes/xyz/models/egreso/MysqlEgresoDAO.java
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
239
src/danielcortes/xyz/models/egreso/SQLiteEgresoDAO.java
Normal file
239
src/danielcortes/xyz/models/egreso/SQLiteEgresoDAO.java
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
85
src/danielcortes/xyz/models/ingreso/Ingreso.java
Normal file
85
src/danielcortes/xyz/models/ingreso/Ingreso.java
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
79
src/danielcortes/xyz/models/ingreso/IngresoDAO.java
Normal file
79
src/danielcortes/xyz/models/ingreso/IngresoDAO.java
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
218
src/danielcortes/xyz/models/ingreso/MysqlIngresoDAO.java
Normal file
218
src/danielcortes/xyz/models/ingreso/MysqlIngresoDAO.java
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
217
src/danielcortes/xyz/models/ingreso/SQLiteIngresoDAO.java
Normal file
217
src/danielcortes/xyz/models/ingreso/SQLiteIngresoDAO.java
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
115
src/danielcortes/xyz/models/tipo_egreso/MysqlTipoEgresoDAO.java
Normal file
115
src/danielcortes/xyz/models/tipo_egreso/MysqlTipoEgresoDAO.java
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
116
src/danielcortes/xyz/models/tipo_egreso/SQLiteTipoEgresoDAO.java
Normal file
116
src/danielcortes/xyz/models/tipo_egreso/SQLiteTipoEgresoDAO.java
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
86
src/danielcortes/xyz/models/tipo_egreso/TipoEgreso.java
Normal file
86
src/danielcortes/xyz/models/tipo_egreso/TipoEgreso.java
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
79
src/danielcortes/xyz/models/tipo_egreso/TipoEgresoDAO.java
Normal file
79
src/danielcortes/xyz/models/tipo_egreso/TipoEgresoDAO.java
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
87
src/danielcortes/xyz/models/tipo_ingreso/TipoIngreso.java
Normal file
87
src/danielcortes/xyz/models/tipo_ingreso/TipoIngreso.java
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
54
src/danielcortes/xyz/models/tipo_ingreso/TipoIngresoDAO.java
Normal file
54
src/danielcortes/xyz/models/tipo_ingreso/TipoIngresoDAO.java
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
526
src/danielcortes/xyz/views/ArqueoView.form
Normal file
526
src/danielcortes/xyz/views/ArqueoView.form
Normal file
@@ -0,0 +1,526 @@
|
|||||||
|
<?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>
|
||||||
440
src/danielcortes/xyz/views/ArqueoView.java
Normal file
440
src/danielcortes/xyz/views/ArqueoView.java
Normal file
@@ -0,0 +1,440 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
244
src/danielcortes/xyz/views/EgresosView.form
Normal file
244
src/danielcortes/xyz/views/EgresosView.form
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
<?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>
|
||||||
241
src/danielcortes/xyz/views/EgresosView.java
Normal file
241
src/danielcortes/xyz/views/EgresosView.java
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
/*
|
||||||
|
* 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_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 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(), "Egresos"));
|
||||||
|
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(egresosTable);
|
||||||
|
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("N°");
|
||||||
|
panel2.add(label1, new GridConstraints(0, 0, 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("Descripcion");
|
||||||
|
panel2.add(label2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
descripcionField = new JTextField();
|
||||||
|
panel2.add(descripcionField, 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));
|
||||||
|
nroField = new JTextField();
|
||||||
|
panel2.add(nroField, 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));
|
||||||
|
valorField = new JTextField();
|
||||||
|
panel2.add(valorField, 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));
|
||||||
|
final JLabel label3 = new JLabel();
|
||||||
|
label3.setText("Valor");
|
||||||
|
panel2.add(label3, new GridConstraints(0, 2, 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("Tipo");
|
||||||
|
panel2.add(label4, 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();
|
||||||
|
panel2.add(tipoCombo, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, 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 GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, 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 GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, 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 GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, 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 GridConstraints(2, 3, 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, 3, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
|
panel3.add(panel4, 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("Guardar");
|
||||||
|
guardarButton.setMnemonic('G');
|
||||||
|
guardarButton.setDisplayedMnemonicIndex(0);
|
||||||
|
panel4.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.setEnabled(false);
|
||||||
|
eliminarButton.setText("Eliminar");
|
||||||
|
eliminarButton.setMnemonic('E');
|
||||||
|
eliminarButton.setDisplayedMnemonicIndex(0);
|
||||||
|
panel4.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.setEnabled(false);
|
||||||
|
editarButton.setText("Editar");
|
||||||
|
editarButton.setMnemonic('E');
|
||||||
|
editarButton.setDisplayedMnemonicIndex(0);
|
||||||
|
panel4.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_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
||||||
|
final JPanel panel5 = new JPanel();
|
||||||
|
panel5.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
|
panel3.add(panel5, 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 Egresos:");
|
||||||
|
panel5.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));
|
||||||
|
totalEgresosField = new JTextField();
|
||||||
|
totalEgresosField.setEditable(false);
|
||||||
|
panel5.add(totalEgresosField, 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noinspection ALL
|
||||||
|
*/
|
||||||
|
public JComponent $$$getRootComponent$$$() {
|
||||||
|
return contentPanel;
|
||||||
|
}
|
||||||
|
}
|
||||||
239
src/danielcortes/xyz/views/IngresosView.form
Normal file
239
src/danielcortes/xyz/views/IngresosView.form
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
<?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>
|
||||||
231
src/danielcortes/xyz/views/IngresosView.java
Normal file
231
src/danielcortes/xyz/views/IngresosView.java
Normal file
@@ -0,0 +1,231 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
78
src/danielcortes/xyz/views/ManagerView.form
Normal file
78
src/danielcortes/xyz/views/ManagerView.form
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<?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>
|
||||||
120
src/danielcortes/xyz/views/ManagerView.java
Normal file
120
src/danielcortes/xyz/views/ManagerView.java
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.intellij.uiDesigner.core.GridConstraints;
|
||||||
|
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||||
|
|
||||||
|
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 GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));
|
||||||
|
cardPanel = new JPanel();
|
||||||
|
cardPanel.setLayout(new CardLayout(0, 0));
|
||||||
|
contentPanel.add(cardPanel, new GridConstraints(1, 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));
|
||||||
|
controlsPanel = new JPanel();
|
||||||
|
controlsPanel.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
|
contentPanel.add(controlsPanel, 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));
|
||||||
|
egresosButton = new JToggleButton();
|
||||||
|
egresosButton.setText("Egresos");
|
||||||
|
egresosButton.setMnemonic('E');
|
||||||
|
egresosButton.setDisplayedMnemonicIndex(0);
|
||||||
|
controlsPanel.add(egresosButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | 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 GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | 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 GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, -1), null, 0, false));
|
||||||
|
datePicker = new DatePicker();
|
||||||
|
controlsPanel.add(datePicker, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
96
src/danielcortes/xyz/views/components/EgresosTableModel.java
Normal file
96
src/danielcortes/xyz/views/components/EgresosTableModel.java
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user