Corregido error en la generacion del informe, mucho se tuvo que cambiar del mismo para que voliera a funcionar

Presentaba errores al intentar conseguir los numeros de las distintos numeros de boleta dado a la query que se estaba realizando, se corrige creando 2 querys separadas y se comprueba que los numeros de boleta sean minimos o maimos en el codigo
This commit is contained in:
Daniel Cortes
2019-01-12 17:39:10 -03:00
parent 0024ed1376
commit 06b2de9f65
10 changed files with 369 additions and 339 deletions

2
.idea/dataSources.xml generated
View File

@@ -19,7 +19,7 @@
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/dist/database.sqlite</jdbc-url>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/dist/rodriguez.dat</jdbc-url>
<driver-properties>
<property name="enable_load_extension" value="true" />
</driver-properties>

386
.idea/workspace.xml generated
View File

@@ -6,19 +6,19 @@
</artifacts-to-build>
</component>
<component name="BookmarkManager">
<bookmark url="file://$PROJECT_DIR$/src/danielcortes/xyz/controllers/IngresosController.java" line="401" mnemonic="0" />
<bookmark url="file://$PROJECT_DIR$/src/danielcortes/xyz/controllers/ArqueoController.java" line="55" />
</component>
<component name="ChangeListManager">
<list default="true" id="a633d35a-56a6-4479-b4c4-f97198052fb7" name="Default Changelist" comment="">
<list default="true" id="a633d35a-56a6-4479-b4c4-f97198052fb7" name="Default Changelist" comment="Corregido error en la generacion del informe, mucho se tuvo que cambiar del mismo para que voliera a funcionar&#10;Presentaba errores al intentar conseguir los numeros de las distintos numeros de boleta">
<change beforePath="$PROJECT_DIR$/.idea/dataSources.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/sqlite.sql" beforeDir="false" afterPath="$PROJECT_DIR$/database/sqlite.sql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dist/caja.jar" beforeDir="false" afterPath="$PROJECT_DIR$/dist/caja.jar" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dist/conf.properties" beforeDir="false" afterPath="$PROJECT_DIR$/dist/conf.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dist/database.sqlite" beforeDir="false" afterPath="$PROJECT_DIR$/dist/database.sqlite" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/danielcortes/xyz/Demo.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/danielcortes/xyz/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/danielcortes/xyz/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/danielcortes/xyz/informes/InformeMensual.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/danielcortes/xyz/informes/InformeMensual.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContent.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContent.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContentDAO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContentDAO.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/SQLiteInformeMensualContentDAO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/SQLiteInformeMensualContentDAO.java" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/target/" />
@@ -74,41 +74,7 @@
<favorites_list name="caja" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/informes/InformeMensual.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="191">
<caret line="278" column="76" selection-start-line="278" selection-start-column="76" selection-end-line="278" selection-end-column="76" />
<folding>
<element signature="method#InformeMensual#0;class#InformeMensual#0" />
<element signature="method#fillHeaders#0;class#InformeMensual#0" />
<element signature="e#3207#3281#1" />
<element signature="e#3339#3419#1" />
<element signature="method#fillData#0;class#InformeMensual#0" />
<element signature="e#3509#5501#1" />
<element signature="e#5445#5529#1" />
<element signature="e#5533#5633#1" />
<element signature="method#fillTotales#0;class#InformeMensual#0" />
<element signature="method#joinCells#0;class#InformeMensual#0" />
<element signature="method#addBorders#0;class#InformeMensual#0" />
<element signature="e#9057#9100#1" />
<element signature="e#9285#9399#1" />
<element signature="e#9442#10062#1" />
<element signature="e#11422#11564#1" />
<element signature="e#12003#12070#1" />
<element signature="e#12575#12623#1" />
<element signature="method#generarInforme#0;class#InformeMensual#0" />
<element signature="e#10089#10165#0" />
<element signature="e#10188#10232#0" />
<element signature="method#generateStyles#0;class#InformeMensual#0" />
<marker date="1547082507124" expanded="false" signature="12828:13057" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
@@ -121,9 +87,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>onSelec</find>
<find>timezone</find>
<find>efect</find>
<find>from efectivo</find>
<find>caj</find>
<find>remove</find>
@@ -151,6 +114,9 @@
<find>or</find>
<find>s</find>
<find>getSub</find>
<find>get</find>
<find>System.out.println(.+)</find>
<find>System.out</find>
</findStrings>
<replaceStrings>
<replace>2018 Daniel Cortes</replace>
@@ -163,6 +129,7 @@
</replaceStrings>
<dirStrings>
<dir>$PROJECT_DIR$/src</dir>
<dir>$PROJECT_DIR$/src/danielcortes/xyz</dir>
</dirStrings>
</component>
<component name="Git.Settings">
@@ -198,7 +165,6 @@
<option value="$PROJECT_DIR$/src/danielcortes/xyz/Demo.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/informes/Informe.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeContent.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContentDAO.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/controllers/IngresosController.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/caja/CajaDAO.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/caja/MysqlCajaDAO.java" />
@@ -215,13 +181,14 @@
<option value="$PROJECT_DIR$/src/danielcortes/xyz/controllers/InformesController.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/caja/SQLiteCajaDAO.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/File.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/Main.java" />
<option value="$PROJECT_DIR$/database/sqlite.sql" />
<option value="$APPLICATION_CONFIG_DIR$/consoles/db/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/console_1.sql" />
<option value="$APPLICATION_CONFIG_DIR$/consoles/db/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/console.sql" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContentDAO.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/Main.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContent.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/SQLiteInformeMensualContentDAO.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/informes/InformeMensual.java" />
<option value="$PROJECT_DIR$/src/danielcortes/xyz/models/informe/SQLiteInformeMensualContentDAO.java" />
</list>
</option>
</component>
@@ -266,7 +233,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
@@ -285,13 +251,6 @@
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="xyz" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="caja" type="b2602c69:ProjectViewProjectNode" />
<item name="caja" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="xyz" type="462c0819:PsiDirectoryNode" />
<item name="informes" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="caja" type="b2602c69:ProjectViewProjectNode" />
<item name="caja" type="462c0819:PsiDirectoryNode" />
@@ -299,24 +258,21 @@
<item name="xyz" type="462c0819:PsiDirectoryNode" />
<item name="models" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="caja" type="b2602c69:ProjectViewProjectNode" />
<item name="caja" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="xyz" type="462c0819:PsiDirectoryNode" />
<item name="models" type="462c0819:PsiDirectoryNode" />
<item name="informe" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="caja" type="b2602c69:ProjectViewProjectNode" />
<item name="caja" type="462c0819:PsiDirectoryNode" />
<item name="database" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="caja" type="b2602c69:ProjectViewProjectNode" />
<item name="Scratches and Consoles" type="1a2a3e82:ScratchProjectViewPane$MyProjectNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -330,7 +286,7 @@
<property name="UI_DESIGNER_EDITOR_MODE.UIDesignerToolWindowManager.STATE" value="ToolWindow" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1547082701714" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1547325445022" />
<property name="com.intellij.ide.scratch.LRUPopupBuilder$1/Change SQL Dialect" value="SQLite" />
<property name="database.console.LAST_STATE" value="false" />
<property name="database.data.extractors.current.id" value="Tab-separated (TSV)_id" />
@@ -344,7 +300,7 @@
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="restartRequiresConfirmation" value="false" />
<property name="settings.editor.selected.configurable" value="database.data.views" />
<property name="settings.editor.selected.configurable" value="database.main" />
</component>
<component name="RecentsManager">
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
@@ -543,7 +499,12 @@
<workItem from="1546968296762" duration="9932000" />
<workItem from="1546982620530" duration="468000" />
<workItem from="1547056862751" duration="4209000" />
<workItem from="1547073548038" duration="8948000" />
<workItem from="1547073548038" duration="9187000" />
<workItem from="1547230659998" duration="3001000" />
<workItem from="1547267080995" duration="827000" />
<workItem from="1547315193858" duration="5374000" />
<workItem from="1547322244451" duration="1427000" />
<workItem from="1547324215778" duration="1060000" />
</task>
<task id="LOCAL-00001" summary="First!! :3 Existe una pequeña base de proyecto por ahora">
<created>1545280618093</created>
@@ -832,11 +793,18 @@
<option name="project" value="LOCAL" />
<updated>1547057968640</updated>
</task>
<option name="localTasksCounter" value="42" />
<task id="LOCAL-00042" summary="Informes mejorados, pensado para transcribirlo a un informe de ventas">
<created>1547082730641</created>
<option name="number" value="00042" />
<option name="presentableId" value="LOCAL-00042" />
<option name="project" value="LOCAL" />
<updated>1547082730641</updated>
</task>
<option name="localTasksCounter" value="43" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="279873000" />
<option name="totallyTimeSpent" value="291801000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@@ -849,9 +817,8 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="-18" width="1366" height="765" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.49438202" weight="0.2283105" />
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.49438202" visible="true" weight="0.2283105" />
<window_info id="Image Layers" order="1" />
<window_info id="Designer" order="2" />
<window_info x="458" y="95" width="450" height="453" id="UI Designer" order="3" weight="0.20243531" />
@@ -869,8 +836,7 @@
<window_info anchor="bottom" id="Terminal" order="8" show_stripe_button="false" weight="0.32744783" />
<window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.50076103" side_tool="true" weight="0.24077046" />
<window_info anchor="bottom" id="Messages" order="10" weight="0.32744783" />
<window_info anchor="bottom" id="Database Console" order="11" weight="0.5072231" />
<window_info anchor="right" id="Coverage" sideWeight="0.5024077" side_tool="true" weight="0.3500761" />
<window_info anchor="bottom" id="Database Console" order="11" weight="0.36597112" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" show_stripe_button="false" weight="0.24961948" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
@@ -879,11 +845,12 @@
<window_info anchor="right" id="Maven" order="5" show_stripe_button="false" weight="0.32876712" />
<window_info anchor="right" id="Capture Analysis" order="6" />
<window_info anchor="right" id="Palette&#9;" order="7" />
<window_info anchor="right" id="Database" order="8" sideWeight="0.4988067" weight="0.32115677" />
<window_info anchor="right" x="4" y="0" width="902" height="488" id="Run" order="9" sideWeight="0.4975923" weight="0.39497718" />
<window_info anchor="right" x="4" y="0" width="902" height="488" id="Run" order="8" sideWeight="0.4975923" visible="true" weight="0.40182647" />
<window_info anchor="right" id="Database" order="9" sideWeight="0.4988067" weight="0.32115677" />
<window_info anchor="right" id="Version Control" order="10" weight="0.7435312" />
<window_info anchor="right" id="Structure" order="11" sideWeight="0.5008026" weight="0.2283105" />
<window_info anchor="right" x="0" y="0" width="291" height="565" id="Documentation" order="12" sideWeight="0.50119334" side_tool="true" weight="0.32648402" />
<window_info anchor="right" id="Coverage" order="13" sideWeight="0.5024077" side_tool="true" weight="0.3500761" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -942,7 +909,6 @@
<component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" />
<MESSAGE value="Tecnicamente esta terminada la funcionalidad basica" />
<MESSAGE value="Agregadas clases para compatibilidad con sqlite" />
<MESSAGE value="Corregido problemas .w." />
<MESSAGE value="Separando un poco las clases de los modelos" />
@@ -967,7 +933,8 @@
<MESSAGE value="Correccion con bug sobre seleccion de mes" />
<MESSAGE value="Mensaje de confirmacion al generarse el informe" />
<MESSAGE value="Solucionado bug que no generaba el ultimo dia del mes :3" />
<option name="LAST_COMMIT_MESSAGE" value="Solucionado bug que no generaba el ultimo dia del mes :3" />
<MESSAGE value="Informes mejorados, pensado para transcribirlo a un informe de ventas" />
<option name="LAST_COMMIT_MESSAGE" value="Informes mejorados, pensado para transcribirlo a un informe de ventas" />
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
@@ -997,26 +964,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/caja/Caja.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="41">
<caret line="28" column="13" selection-start-line="28" selection-start-column="13" selection-end-line="28" selection-end-column="13" />
<folding>
<element signature="e#0#1535#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContentDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="115">
<caret line="27" selection-start-line="27" selection-end-line="27" />
<folding>
<element signature="docComment;method#getInformeMensual#0;class#InformeMensualContentDAO#0" />
</folding>
</state>
</provider>
</entry>
<entry file="jar://$MAVEN_REPOSITORY$/org/apache/poi/poi/4.0.1/poi-4.0.1-sources.jar!/org/apache/poi/ss/usermodel/CreationHelper.java">
<provider selected="true" editor-type-id="text-editor">
<state>
@@ -1052,16 +999,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/caja/CajaDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="232">
<caret line="44" column="62" selection-start-line="44" selection-start-column="62" selection-end-line="44" selection-end-column="62" />
<folding>
<element signature="e#0#2120#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/caja/MysqlCajaDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="212">
@@ -1377,29 +1314,8 @@
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/views/InformesView.form">
<provider selected="true" editor-type-id="ui-designer" />
</entry>
<entry file="das://6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/schema/main/table/caja">
<provider selected="true" editor-type-id="com.intellij.database.editor.DatabaseTableFileEditorProvider">
<state>
<filtering enabled="true" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/caja/SQLiteCajaDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1957">
<caret line="162" column="19" lean-forward="true" selection-start-line="162" selection-start-column="19" selection-end-line="162" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/Demo.java" />
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/File.java" />
<entry file="das://6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/schema/main/table/ingresos">
<provider selected="true" editor-type-id="com.intellij.database.editor.DatabaseTableFileEditorProvider">
<state>
<filtering enabled="true" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/controllers/InformesController.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="140">
@@ -1415,13 +1331,7 @@
</state>
</provider>
</entry>
<entry file="file://$APPLICATION_CONFIG_DIR$/consoles/db/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/console_1.sql">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="40" selection-start-column="40" selection-end-column="40" />
</state>
</provider>
</entry>
<entry file="file://$APPLICATION_CONFIG_DIR$/consoles/db/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/console_1.sql" />
<entry file="file://$PROJECT_DIR$/database/sqlite.sql">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="443">
@@ -1448,104 +1358,6 @@
</state>
</provider>
</entry>
<entry file="das://6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/schema/main/table/tipos_ingreso">
<provider selected="true" editor-type-id="com.intellij.database.editor.DatabaseTableFileEditorProvider">
<state>
<filtering enabled="true" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContent.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="206">
<caret line="155" column="21" selection-start-line="155" selection-start-column="15" selection-end-line="155" selection-end-column="21" />
<folding>
<element signature="e#1915#1916#0" expanded="true" />
<element signature="e#1941#1942#0" expanded="true" />
<element signature="e#1976#1977#0" expanded="true" />
<element signature="e#2006#2007#0" expanded="true" />
<element signature="e#2041#2042#0" expanded="true" />
<element signature="e#2069#2070#0" expanded="true" />
<element signature="e#2114#2115#0" expanded="true" />
<element signature="e#2148#2149#0" expanded="true" />
<element signature="e#2190#2191#0" expanded="true" />
<element signature="e#2228#2229#0" expanded="true" />
<element signature="e#2290#2291#0" expanded="true" />
<element signature="e#2344#2345#0" expanded="true" />
<element signature="e#2384#2385#0" expanded="true" />
<element signature="e#2420#2421#0" expanded="true" />
<element signature="e#2478#2479#0" expanded="true" />
<element signature="e#2528#2529#0" expanded="true" />
<element signature="e#2560#2561#0" expanded="true" />
<element signature="e#2591#2592#0" expanded="true" />
<element signature="e#2636#2637#0" expanded="true" />
<element signature="e#2676#2677#0" expanded="true" />
<element signature="e#2719#2720#0" expanded="true" />
<element signature="e#2758#2759#0" expanded="true" />
<element signature="e#2822#2823#0" expanded="true" />
<element signature="e#2878#2879#0" expanded="true" />
<element signature="e#2919#2920#0" expanded="true" />
<element signature="e#2956#2957#0" expanded="true" />
<element signature="e#3016#3017#0" expanded="true" />
<element signature="e#3068#3069#0" expanded="true" />
<element signature="e#3110#3111#0" expanded="true" />
<element signature="e#3148#3149#0" expanded="true" />
<element signature="e#3210#3211#0" expanded="true" />
<element signature="e#3264#3265#0" expanded="true" />
<element signature="e#3304#3305#0" expanded="true" />
<element signature="e#3340#3341#0" expanded="true" />
<element signature="e#3398#3399#0" expanded="true" />
<element signature="e#3448#3449#0" expanded="true" />
<element signature="e#3480#3481#0" expanded="true" />
<element signature="e#3511#3512#0" expanded="true" />
<element signature="e#3556#3557#0" expanded="true" />
<element signature="e#3596#3597#0" expanded="true" />
<element signature="e#3637#3638#0" expanded="true" />
<element signature="e#3674#3675#0" expanded="true" />
<element signature="e#3734#3735#0" expanded="true" />
<element signature="e#3786#3787#0" expanded="true" />
<element signature="e#3825#3826#0" expanded="true" />
<element signature="e#3860#3861#0" expanded="true" />
<element signature="e#3916#3917#0" expanded="true" />
<element signature="e#3964#3965#0" expanded="true" />
<element signature="e#3995#3996#0" expanded="true" />
<element signature="e#4025#4026#0" expanded="true" />
<element signature="e#4068#4069#0" expanded="true" />
<element signature="e#4106#4107#0" expanded="true" />
<element signature="e#4139#4140#0" expanded="true" />
<element signature="e#4171#4172#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$APPLICATION_CONFIG_DIR$/consoles/db/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/console.sql">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="322">
<caret line="14" column="100" selection-end-line="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="186">
<caret line="61" column="5" lean-forward="true" selection-start-line="61" selection-start-column="5" selection-end-line="61" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
<element signature="method#run#0;class#Main#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/informe/SQLiteInformeMensualContentDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="460">
<caret line="67" column="64" selection-start-line="67" selection-start-column="64" selection-end-line="67" selection-end-column="64" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="jar://$MAVEN_REPOSITORY$/org/apache/poi/poi/4.0.1/poi-4.0.1-sources.jar!/org/apache/poi/hssf/usermodel/HSSFRow.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="253">
@@ -1570,37 +1382,117 @@
</state>
</provider>
</entry>
<entry file="das://6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/schema/main/table/caja">
<provider selected="true" editor-type-id="com.intellij.database.editor.DatabaseTableFileEditorProvider">
<state>
<filtering enabled="true" />
</state>
</provider>
</entry>
<entry file="das://6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/schema/main/table/ingresos">
<provider selected="true" editor-type-id="com.intellij.database.editor.DatabaseTableFileEditorProvider">
<state>
<filtering enabled="true" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/caja/Caja.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="167">
<caret line="28" column="13" selection-start-line="28" selection-start-column="13" selection-end-line="28" selection-end-column="13" />
<folding>
<element signature="e#0#1535#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/caja/SQLiteCajaDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2647">
<caret line="162" column="19" lean-forward="true" selection-start-line="162" selection-start-column="19" selection-end-line="162" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/caja/CajaDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="117">
<caret line="44" column="62" selection-start-line="44" selection-start-column="62" selection-end-line="44" selection-end-column="62" />
</state>
</provider>
</entry>
<entry file="das://6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/schema/main/table/tipos_ingreso">
<provider selected="true" editor-type-id="com.intellij.database.editor.DatabaseTableFileEditorProvider">
<state>
<filtering enabled="true" />
</state>
</provider>
</entry>
<entry file="file://$APPLICATION_CONFIG_DIR$/consoles/db/6e2ee496-6ca2-4cc4-a2b0-4f122e6bfd50/console.sql">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="372">
<caret line="27" column="20" selection-start-line="27" selection-start-column="20" selection-end-line="27" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContentDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="138">
<caret line="28" selection-start-line="28" selection-end-line="28" />
<folding>
<element signature="imports" expanded="true" />
<element signature="docComment;method#getInformeMensual#0;class#InformeMensualContentDAO#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="253">
<caret line="110" column="5" selection-start-line="110" selection-start-column="5" selection-end-line="110" selection-end-column="5" />
<folding>
<element signature="e#2714#2715#0" expanded="true" />
<element signature="e#2735#2736#0" expanded="true" />
<element signature="method#run#0;class#Main#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/informe/InformeMensualContent.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="370">
<caret line="221" column="29" selection-start-line="221" selection-start-column="29" selection-end-line="221" selection-end-column="29" />
<folding>
<element signature="e#2440#2519#0" />
<element signature="e#6257#7465#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/informes/InformeMensual.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="191">
<caret line="278" column="76" selection-start-line="278" selection-start-column="76" selection-end-line="278" selection-end-column="76" />
<state relative-caret-position="193">
<caret line="112" selection-start-line="112" selection-end-line="112" />
<folding>
<element signature="method#InformeMensual#0;class#InformeMensual#0" />
<element signature="n#!!block;n#sortInforme#0;n#InformeMensual#0" />
<element signature="method#fillHeaders#0;class#InformeMensual#0" />
<element signature="e#3207#3281#1" />
<element signature="e#3339#3419#1" />
<element signature="method#fillData#0;class#InformeMensual#0" />
<element signature="e#3509#5501#1" />
<element signature="e#5445#5529#1" />
<element signature="e#5533#5633#1" />
<element signature="method#fillTotales#0;class#InformeMensual#0" />
<element signature="method#joinCells#0;class#InformeMensual#0" />
<element signature="method#addBorders#0;class#InformeMensual#0" />
<element signature="e#9057#9100#1" />
<element signature="e#9285#9399#1" />
<element signature="e#9442#10062#1" />
<element signature="e#11422#11564#1" />
<element signature="e#12003#12070#1" />
<element signature="e#12575#12623#1" />
<element signature="method#setStyles#0;class#InformeMensual#0" />
<element signature="method#generarInforme#0;class#InformeMensual#0" />
<element signature="e#10089#10165#0" />
<element signature="e#10188#10232#0" />
<element signature="method#generateStyles#0;class#InformeMensual#0" />
<marker date="1547082507124" expanded="false" signature="12828:13057" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/danielcortes/xyz/models/informe/SQLiteInformeMensualContentDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="390">
<caret line="147" selection-start-line="147" selection-end-line="147" />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>

BIN
dist/caja.jar vendored

Binary file not shown.

View File

@@ -14,7 +14,7 @@ database_type = sqlite
# 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
database_uri = jdbc:sqlite:rodriguez.dat
# 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.

BIN
dist/database.sqlite vendored

Binary file not shown.

View File

@@ -38,6 +38,7 @@ 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.informe.SQLiteInformeMensualContentDAO;
import danielcortes.xyz.models.ingreso.IngresoDAO;
import danielcortes.xyz.models.ingreso.MysqlIngresoDAO;
import danielcortes.xyz.models.ingreso.SQLiteIngresoDAO;
@@ -49,6 +50,7 @@ import danielcortes.xyz.models.tipo_ingreso.SQLiteTipoIngresoDAO;
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
import danielcortes.xyz.views.ManagerView;
import javax.swing.*;
import java.time.LocalDate;
import java.util.Locale;
public class Main {

View File

@@ -38,10 +38,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.*;
public class InformeMensual {
private final String[] titles = {
@@ -68,7 +65,8 @@ public class InformeMensual {
private final String[] dias = {"Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"};
private List<InformeMensualContent> informe;
private ArrayList<InformeMensualContent> informe;
private int informeSize;
private File saveFile;
private Workbook wb;
@@ -79,7 +77,8 @@ public class InformeMensual {
public InformeMensual(LocalDate date, File saveFile) {
new SQLiteCajaDAO().createCajasForMonth(date);
this.informe = new SQLiteInformeMensualContentDAO().getInformeMensual(date);
this.informe = new ArrayList<>(new SQLiteInformeMensualContentDAO().getInformeMensual(date));
this.informeSize = this.informe.size();
this.saveFile = saveFile;
this.wb = new HSSFWorkbook();
@@ -89,6 +88,10 @@ public class InformeMensual {
this.styles = this.generateStyles();
}
private void sortInforme(){
this.informe.sort(Comparator.comparing(InformeMensualContent::getFecha));
}
private void fillHeaders() {
Row titles = sheet.createRow(0);
Row subtitles = sheet.createRow(1);
@@ -103,38 +106,39 @@ public class InformeMensual {
}
private void fillData() {
for (int x = 2; x < 2 + informe.size(); x++) {
int x = 2;
for(InformeMensualContent data : this.informe){
int y = 0;
Row dataRow = sheet.createRow(x);
InformeMensualContent data = informe.get(x - 2);
Date fecha = Date.from(data.getFecha().atStartOfDay(ZoneId.systemDefault()).toInstant());
dataRow.createCell(y++).setCellValue(this.dias[data.getDia()]);
dataRow.createCell(y++).setCellValue(fecha);
dataRow.createCell(y++).setCellValue(data.getManualesInicial());
dataRow.createCell(y++).setCellValue(data.getManualesFinal());
dataRow.createCell(y++).setCellValue(data.getManualesInicial() == null ? "0": data.getManualesInicial());
dataRow.createCell(y++).setCellValue(data.getManualesFinal() == null ? "0" : data.getManualesFinal());
dataRow.createCell(y++).setCellValue(data.getManuales());
dataRow.createCell(y++).setCellValue(data.getFiscalesZInicial());
dataRow.createCell(y++).setCellValue(data.getFiscalesZFinal());
dataRow.createCell(y++).setCellValue(data.getFiscalesInicial());
dataRow.createCell(y++).setCellValue(data.getFiscalesFinal());
dataRow.createCell(y++).setCellValue(data.getFiscalesZInicial() == null ? "0" : data.getFiscalesZInicial());
dataRow.createCell(y++).setCellValue(data.getFiscalesZFinal() == null ? "0" : data.getFiscalesZFinal());
dataRow.createCell(y++).setCellValue(data.getFiscalesInicial() == null ? "0" : data.getFiscalesInicial());
dataRow.createCell(y++).setCellValue(data.getFiscalesFinal() == null ? "0" : data.getFiscalesFinal());
dataRow.createCell(y++).setCellValue(data.getFiscales());
dataRow.createCell(y++).setCellValue(data.getExentasInicial());
dataRow.createCell(y++).setCellValue(data.getExentasFinal());
dataRow.createCell(y++).setCellValue(data.getExentasInicial() == null ? "0" : data.getExentasInicial());
dataRow.createCell(y++).setCellValue(data.getExentasFinal() == null ? "0" : data.getExentasFinal());
dataRow.createCell(y++).setCellValue(data.getExentas());
dataRow.createCell(y++).setCellValue(data.getSubTotal());
dataRow.createCell(y++).setCellValue(data.getFacturasInicial());
dataRow.createCell(y++).setCellValue(data.getFacturasFinal());
dataRow.createCell(y++).setCellValue(data.getFacturasInicial() == null ? "0" : data.getFacturasInicial());
dataRow.createCell(y++).setCellValue(data.getFacturasFinal() == null ? "0" : data.getFacturasFinal());
dataRow.createCell(y++).setCellValue(data.getFacturas());
dataRow.createCell(y++).setCellValue(data.getGuiasInicial());
dataRow.createCell(y++).setCellValue(data.getGuiasFinal());
dataRow.createCell(y++).setCellValue(data.getGuiasInicial() == null ? "0" : data.getGuiasInicial());
dataRow.createCell(y++).setCellValue(data.getGuiasFinal() == null ? "0" : data.getGuiasFinal());
dataRow.createCell(y++).setCellValue(data.getGuias());
dataRow.createCell(y++).setCellValue(data.getTotal());
@@ -144,11 +148,12 @@ public class InformeMensual {
} else {
dataRow.createCell(y).setCellFormula(("U" + (x + 1)) + ("+") + ("V" + (x)));
}
x++;
}
}
private void fillTotales() {
int row = 2 + informe.size();
int row = 2 + this.informeSize;
Row totalesRow = sheet.createRow(row);
totalesRow.createCell(0).setCellValue("TOTALES");
@@ -223,7 +228,7 @@ public class InformeMensual {
}
//Estilos para las celdas de los datos
for (int x = 2; x < informe.size() + 2; x++) {
for (int x = 2; x < this.informeSize + 2; x++) {
Row row = this.sheet.getRow(x);
int y = 0;
@@ -294,6 +299,7 @@ public class InformeMensual {
}
public File generarInforme() {
sortInforme();
fillData();
fillHeaders();
fillTotales();

View File

@@ -74,6 +74,7 @@ public class InformeMensualContent {
}
public String getManualesFinal() {
return manualesFinal;
}
@@ -110,7 +111,7 @@ public class InformeMensualContent {
}
public void setFiscalesInicial(String fiscalesInicial) {
this.fiscalesInicial = fiscalesInicial;
this.fiscalesInicial = fiscalesInicial;
}
public String getFiscalesFinal() {
@@ -222,12 +223,18 @@ public class InformeMensualContent {
return "InformeMensualContent{" +
"dia=" + dia +
", fecha=" + fecha +
", fiscalesInicial='" + fiscalesInicial + '\'' +
", fiscalesFinal='" + fiscalesFinal + '\'' +
", fiscales=" + fiscales +
", manualesInicial='" + manualesInicial + '\'' +
", manualesFinal='" + manualesFinal + '\'' +
", manuales=" + manuales +
", fiscalesZInicial='" + fiscalesZInicial + '\'' +
", fiscalesZFinal='" + fiscalesZFinal + '\'' +
", fiscalesInicial='" + fiscalesInicial + '\'' +
", fiscalesFinal='" + fiscalesFinal + '\'' +
", fiscales=" + fiscales +
", exentasInicial='" + exentasInicial + '\'' +
", exentasFinal='" + exentasFinal + '\'' +
", exentas=" + exentas +
", subTotal=" + subTotal +
", facturasInicial='" + facturasInicial + '\'' +
", facturasFinal='" + facturasFinal + '\'' +
", facturas=" + facturas +

View File

@@ -25,7 +25,7 @@
package danielcortes.xyz.models.informe;
import java.time.LocalDate;
import java.util.List;
import java.util.Collection;
public abstract class InformeMensualContentDAO {
/**
@@ -33,5 +33,5 @@ public abstract class InformeMensualContentDAO {
* @param date fecha que esta dentro del mes en el que se necesita el informe
* @return Lista con las columnas principales necesarias para el informe
*/
public abstract List<InformeMensualContent> getInformeMensual(LocalDate date);
public abstract Collection<InformeMensualContent> getInformeMensual(LocalDate date);
}

View File

@@ -31,78 +31,57 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
public class SQLiteInformeMensualContentDAO extends InformeMensualContentDAO {
HashMap<Integer, InformeMensualContent> map;
public SQLiteInformeMensualContentDAO(){
this.map = new HashMap<>();
}
@Override
public List<InformeMensualContent> getInformeMensual(LocalDate date) {
ArrayList<InformeMensualContent> list = new ArrayList<>();
public Collection<InformeMensualContent> getInformeMensual(LocalDate date) {
try {
Connection conn = new SQLiteConnectionHolder().getConnection();
String query =
String queryTotales =
"select " +
"caja.id as \"caja\",\n" +
"strftime(\"%w\", caja.fecha) as \"dia\",\n" +
"caja.fecha as \"fecha\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 2 then ingresos.valor else 0 end) as \"manuales\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 1 then ingresos.valor else 0 end) as \"fiscales\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 5 then ingresos.valor else 0 end) as \"exentas\",\n" +
"sum(case when ingresos.tipo_ingreso_id in (2, 1, 5) then ingresos.valor else 0 end) as \"sub_total\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 3 then ingresos.valor else 0 end) as \"facturas\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 4 then ingresos.valor else 0 end) as \"guias\",\n" +
"sum(case when ingresos.valor not null then ingresos.valor else 0 end) as \"total\"\n" +
"from caja left join ingresos on (caja.id = ingresos.caja_id)\n" +
"where caja.fecha between date(?) and date(?)\n" +
"group by caja.fecha\n";
String queryNumeros =
"select\n" +
"strftime(\"%w\", caja.fecha) as \"dia\",\n" +
"caja.fecha as \"fecha\",\n" +
"min(case when ingresos.tipo_ingreso_id = 2 and ingresos.valor > 0 then ingresos.nro_inicial else 0 end) as \"manuales_inicial\",\n" +
"max(case when ingresos.tipo_ingreso_id = 2 and ingresos.valor > 0 then ingresos.nro_final else 0 end) as \"manuales_final\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 2 then ingresos.valor else 0 end) as \"manuales\",\n" +
"min(case when ingresos.tipo_ingreso_id = 1 and ingresos.valor > 0 then ingresos.nro_inicial else 0 end) as \"fiscales_inicial\",\n" +
"max(case when ingresos.tipo_ingreso_id = 1 and ingresos.valor > 0 then ingresos.nro_final else 0 end) as \"fiscales_final\",\n" +
"min(case when ingresos.tipo_ingreso_id = 1 and ingresos.valor > 0 then ingresos.nro_z_inicial else 0 end) as \"fiscales_z_inicial\",\n" +
"max(case when ingresos.tipo_ingreso_id = 1 and ingresos.valor > 0 then ingresos.nro_z_final else 0 end) as \"fiscales_z_final\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 1 then ingresos.valor else 0 end) as \"fiscales\",\n" +
"min(case when ingresos.tipo_ingreso_id = 5 and ingresos.valor > 0 then ingresos.nro_inicial else 0 end) as \"exentas_inicial\",\n" +
"max(case when ingresos.tipo_ingreso_id = 5 and ingresos.valor > 0 then ingresos.nro_final else 0 end) as \"exentas_final\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 5 then ingresos.valor else 0 end) as \"exentas\",\n" +
"sum(case when ingresos.tipo_ingreso_id in (2, 1, 5) then ingresos.valor else 0 end ) as \"sub_total\",\n" +
"min(case when ingresos.tipo_ingreso_id = 3 and ingresos.valor > 0 then ingresos.nro_inicial else 0 end) as \"facturas_inicial\",\n" +
"max(case when ingresos.tipo_ingreso_id = 3 and ingresos.valor > 0 then ingresos.nro_final else 0 end) as \"facturas_final\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 3 then ingresos.valor else 0 end) as \"facturas\",\n" +
"min(case when ingresos.tipo_ingreso_id = 4 and ingresos.valor > 0 then ingresos.nro_inicial else 0 end) as \"guias_inicial\",\n" +
"max(case when ingresos.tipo_ingreso_id = 4 and ingresos.valor > 0 then ingresos.nro_final else 0 end) as \"guias_final\",\n" +
"sum(case when ingresos.tipo_ingreso_id = 4 then ingresos.valor else 0 end) as \"guias\",\n" +
"sum(case when ingresos.valor not null then ingresos.valor else 0 end) as \"total\"\n" +
"from caja\n" +
"left join ingresos on (caja.id = ingresos.caja_id)\n" +
"where caja.fecha between date(?) and date(?)\n" +
"group by caja.fecha\n" +
"order by caja.fecha\n";
PreparedStatement ps = conn.prepareStatement(query);
"caja.id as \"caja\",\n" +
"caja.fecha as \"fecha\",\n" +
"ingresos.nro_inicial as \"inicial\",\n" +
"ingresos.nro_final as \"final\",\n" +
"ingresos.nro_z_inicial as \"z_inicial\",\n" +
"ingresos.nro_z_final as \"z_final\",\n" +
"ingresos.tipo_ingreso_id as \"tipo_ingreso\"\n" +
"from caja join ingresos on (caja.id = ingresos.caja_id)\n" +
"where caja.fecha between date(?) and date(?)\n";
PreparedStatement ps = conn.prepareStatement(queryTotales);
ps.setString(1, date.withDayOfMonth(1).toString());
ps.setString(2, date.withDayOfMonth(date.lengthOfMonth()).toString());
ResultSet rs = ps.executeQuery();
while (rs.next()) {
InformeMensualContent informeMensualContent = new InformeMensualContent();
informeMensualContent.setDia(rs.getInt("dia"));
informeMensualContent.setFecha(LocalDate.parse(rs.getString("fecha")));
informeMensualContent.setManualesInicial(rs.getString("manuales_inicial"));
informeMensualContent.setManualesFinal(rs.getString("manuales_final"));
informeMensualContent.setManuales(rs.getInt("manuales"));
informeMensualContent.setFiscalesZInicial(rs.getString("fiscales_z_inicial"));
informeMensualContent.setFiscalesZFinal(rs.getString("fiscales_z_final"));
informeMensualContent.setFiscalesInicial(rs.getString("fiscales_inicial"));
informeMensualContent.setFiscalesFinal(rs.getString("fiscales_final"));
informeMensualContent.setFiscales(rs.getInt("fiscales"));
informeMensualContent.setExentasInicial(rs.getString("exentas_inicial"));
informeMensualContent.setExentasFinal(rs.getString("exentas_final"));
informeMensualContent.setExentas(rs.getInt("exentas"));
informeMensualContent.setSubTotal(rs.getInt("sub_total"));
informeMensualContent.setFiscales(rs.getInt("fiscales"));
informeMensualContent.setFacturasInicial(rs.getString("facturas_inicial"));
informeMensualContent.setFacturasFinal(rs.getString("facturas_final"));
informeMensualContent.setFacturas(rs.getInt("facturas"));
informeMensualContent.setGuiasInicial(rs.getString("guias_inicial"));
informeMensualContent.setGuiasFinal(rs.getString("guias_final"));
informeMensualContent.setGuias(rs.getInt("guias"));
informeMensualContent.setTotal(rs.getInt("total"));
this.fillTotalesFromResultSet(rs);
list.add(informeMensualContent);
}
ps = conn.prepareStatement(queryNumeros);
ps.setString(1, date.withDayOfMonth(1).toString());
ps.setString(2, date.withDayOfMonth(date.lengthOfMonth()).toString());
rs = ps.executeQuery();
this.fillBoletasFromResultSet(rs);
rs.close();
ps.close();
@@ -110,6 +89,150 @@ public class SQLiteInformeMensualContentDAO extends InformeMensualContentDAO {
} catch (SQLException e) {
e.printStackTrace();
}
return list;
return map.values();
}
private void fillTotalesFromResultSet(ResultSet rs) throws SQLException {
while (rs.next()) {
InformeMensualContent informe = new InformeMensualContent();
informe.setDia(rs.getInt("dia"));
informe.setFecha(LocalDate.parse(rs.getString("fecha")));
informe.setManuales(rs.getInt("manuales"));
informe.setFiscales(rs.getInt("fiscales"));
informe.setExentas(rs.getInt("exentas"));
informe.setSubTotal(rs.getInt("sub_total"));
informe.setFacturas(rs.getInt("facturas"));
informe.setGuias(rs.getInt("guias"));
informe.setTotal(rs.getInt("total"));
map.put(rs.getInt("caja"), informe);
}
}
private void fillBoletasFromResultSet(ResultSet rs) throws SQLException{
while (rs.next()) {
InformeMensualContent informe = map.get(rs.getInt("caja"));
int tipoIngreso = rs.getInt("tipo_ingreso");
switch (tipoIngreso) {
case 1:
String fiscalesInicial = rs.getString("inicial");
String fiscalesFinal = rs.getString("final");
String fiscalesZInicial = rs.getString("z_inicial");
String fiscalesZFinal = rs.getString("z_final");
if (informe.getFiscalesInicial() != null) {
if (fiscalesInicial.compareTo(informe.getFiscalesInicial()) < 0) {
informe.setFiscalesInicial(fiscalesInicial);
}
} else {
informe.setFiscalesInicial(fiscalesInicial);
}
if (informe.getFiscalesFinal() != null) {
if (fiscalesFinal.compareTo(informe.getFiscalesFinal()) > 0) {
informe.setFiscalesFinal(fiscalesFinal);
}
} else {
informe.setFiscalesFinal(fiscalesFinal);
}
if (informe.getFiscalesZInicial() != null) {
if (fiscalesZInicial.compareTo(informe.getFiscalesZInicial()) < 0) {
informe.setFiscalesZInicial(fiscalesZInicial);
}
} else {
informe.setFiscalesZInicial(fiscalesZInicial);
}
if (informe.getFiscalesZFinal() != null) {
if (fiscalesZFinal.compareTo(informe.getFiscalesZFinal()) > 0) {
informe.setFiscalesZFinal(fiscalesZFinal);
}
} else {
informe.setFiscalesZFinal(fiscalesZFinal);
}
break;
case 2:
String manualesInicial = rs.getString("inicial");
String manualesFinal = rs.getString("final");
if (informe.getManualesInicial() != null) {
if (manualesInicial.compareTo(informe.getManualesInicial()) < 0) {
informe.setManualesInicial(manualesInicial);
}
} else {
informe.setManualesInicial(manualesInicial);
}
if (informe.getManualesFinal() != null) {
if (manualesFinal.compareTo(informe.getManualesFinal()) > 0) {
informe.setManualesFinal(manualesFinal);
}
} else {
informe.setManualesFinal(manualesFinal);
}
break;
case 3:
String facturasInicial = rs.getString("inicial");
String facturasFinal = rs.getString("final");
if (informe.getFacturasInicial() != null) {
if (facturasInicial.compareTo(informe.getFacturasInicial()) < 0) {
informe.setFacturasInicial(facturasInicial);
}
} else {
informe.setFacturasInicial(facturasInicial);
}
if (informe.getFacturasFinal() != null) {
if (facturasFinal.compareTo(informe.getFacturasFinal()) > 0) {
informe.setFacturasFinal(facturasFinal);
}
} else {
informe.setFacturasFinal(facturasFinal);
}
break;
case 4:
String guiasInicial = rs.getString("inicial");
String guiasFinal = rs.getString("final");
if (informe.getGuiasInicial() != null) {
if (guiasInicial.compareTo(informe.getGuiasInicial()) < 0) {
informe.setGuiasInicial(guiasInicial);
}
} else {
informe.setGuiasInicial(guiasInicial);
}
if (informe.getGuiasFinal() != null) {
if (guiasFinal.compareTo(informe.getGuiasFinal()) > 0) {
informe.setGuiasFinal(guiasFinal);
}
} else {
informe.setGuiasFinal(guiasFinal);
}
break;
case 5:
String exentasInicial = rs.getString("inicial");
String exentasFinal = rs.getString("final");
if (informe.getExentasInicial() != null) {
if (exentasInicial.compareTo(informe.getExentasInicial()) < 0) {
informe.setExentasInicial(exentasInicial);
}
} else {
informe.setExentasInicial(exentasInicial);
}
if (informe.getExentasFinal() != null) {
if (exentasFinal.compareTo(informe.getExentasFinal()) > 0) {
informe.setExentasFinal(exentasFinal);
}
} else {
informe.setExentasFinal(exentasFinal);
}
break;
}
}
}
}