Commit 9cad6f658840805a67e758f721afc39aff011295
1 parent
b158b47b42
Exists in
master
Se cambia la forma de generar los directorios
Showing
97 changed files
with
1412 additions
and
32 deletions
Show diff stats
.gitignore
| 1 | *.iml | ||
| 2 | .gradle | ||
| 3 | /local.properties | ||
| 4 | /.idea/caches | ||
| 5 | /.idea/libraries | ||
| 6 | /.idea/modules.xml | ||
| 7 | /.idea/workspace.xml | ||
| 8 | /.idea/navEditor.xml | ||
| 9 | /.idea/assetWizardSettings.xml | ||
| 10 | .DS_Store | ||
| 11 | /build | ||
| 12 | /captures | ||
| 13 | .externalNativeBuild | ||
| 14 | .cxx | ||
| 15 |
.gradle/6.1.1/executionHistory/executionHistory.bin
No preview for this file type
.gradle/6.1.1/executionHistory/executionHistory.lock
No preview for this file type
.gradle/6.1.1/fileChanges/last-build.bin
No preview for this file type
.gradle/6.1.1/fileContent/fileContent.lock
No preview for this file type
.gradle/6.1.1/fileHashes/fileHashes.bin
No preview for this file type
.gradle/6.1.1/fileHashes/fileHashes.lock
No preview for this file type
.gradle/6.1.1/fileHashes/resourceHashesCache.bin
No preview for this file type
.gradle/6.1.1/gc.properties
.gradle/6.1.1/javaCompile/classAnalysis.bin
No preview for this file type
.gradle/6.1.1/javaCompile/jarAnalysis.bin
No preview for this file type
.gradle/6.1.1/javaCompile/javaCompile.lock
No preview for this file type
.gradle/6.1.1/javaCompile/taskHistory.bin
No preview for this file type
.gradle/buildOutputCleanup/buildOutputCleanup.lock
No preview for this file type
.gradle/buildOutputCleanup/cache.properties
| File was created | 1 | #Sat Jul 04 10:36:09 ART 2020 | |
| 2 | gradle.version=6.1.1 | ||
| 3 |
.gradle/buildOutputCleanup/outputFiles.bin
No preview for this file type
.gradle/checksums/checksums.lock
No preview for this file type
.gradle/checksums/md5-checksums.bin
No preview for this file type
.gradle/checksums/sha1-checksums.bin
No preview for this file type
.gradle/vcs-1/gc.properties
.idea/caches/build_file_checksums.ser
No preview for this file type
.idea/libraries/Gradle_____________Paquetes_librerias_apache_mime4j_0_6_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: ./../../../Paquetes/librerias/apache-mime4j-0.6.jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://D:/Paquetes/librerias/apache-mime4j-0.6.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES /> | ||
| 8 | </library> | ||
| 9 | </component> |
.idea/libraries/Gradle_____________Paquetes_librerias_httpclient_4_1_2_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: ./../../../Paquetes/librerias/httpclient-4.1.2.jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://D:/Paquetes/librerias/httpclient-4.1.2.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES /> | ||
| 8 | </library> | ||
| 9 | </component> |
.idea/libraries/Gradle_____________Paquetes_librerias_httpclient_cache_4_1_2_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: ./../../../Paquetes/librerias/httpclient-cache-4.1.2.jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://D:/Paquetes/librerias/httpclient-cache-4.1.2.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES /> | ||
| 8 | </library> | ||
| 9 | </component> |
.idea/libraries/Gradle_____________Paquetes_librerias_httpcore_4_1_2_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: ./../../../Paquetes/librerias/httpcore-4.1.2.jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://D:/Paquetes/librerias/httpcore-4.1.2.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES /> | ||
| 8 | </library> | ||
| 9 | </component> |
.idea/libraries/Gradle_____________Paquetes_librerias_httpmime_4_1_2_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: ./../../../Paquetes/librerias/httpmime-4.1.2.jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://D:/Paquetes/librerias/httpmime-4.1.2.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES /> | ||
| 8 | </library> | ||
| 9 | </component> |
.idea/libraries/Gradle_____________Paquetes_librerias_org_apache_httpcomponents_httpclient_4_1_2_sources_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: ./../../../Paquetes/librerias/org.apache.httpcomponents.httpclient-4.1.2-sources.jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://D:/Paquetes/librerias/org.apache.httpcomponents.httpclient-4.1.2-sources.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES /> | ||
| 8 | </library> | ||
| 9 | </component> |
.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.activity:activity:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/cb7465d23e93e74bedcba12369934f8a/jetified-activity-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/cb7465d23e93e74bedcba12369934f8a/jetified-activity-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.activity/activity/1.0.0/28eb83e6a29ac3fbb87aa632cfa0e644a313f491/activity-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_annotation_annotation_1_2_0_alpha01_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.annotation:annotation:1.2.0-alpha01@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.2.0-alpha01/cf0f760ea00702c040b3f8c9ccbe615ae26356dc/annotation-1.2.0-alpha01.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.2.0-alpha01/df9acce4eab41184c6ad166b55f36a753d2b5de0/annotation-1.2.0-alpha01-sources.jar!/" /> | ||
| 9 | </SOURCES> | ||
| 10 | </library> | ||
| 11 | </component> |
.idea/libraries/Gradle__androidx_appcompat_appcompat_1_3_0_alpha01_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.appcompat:appcompat:1.3.0-alpha01@aar"> | ||
| 3 | <ANNOTATIONS> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/79b8d4655de64746c0deb0a0f3c5ecd4/appcompat-1.3.0-alpha01/annotations.zip!/" /> | ||
| 5 | </ANNOTATIONS> | ||
| 6 | <CLASSES> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/79b8d4655de64746c0deb0a0f3c5ecd4/appcompat-1.3.0-alpha01/jars/classes.jar!/" /> | ||
| 8 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/79b8d4655de64746c0deb0a0f3c5ecd4/appcompat-1.3.0-alpha01/res" /> | ||
| 9 | </CLASSES> | ||
| 10 | <JAVADOC /> | ||
| 11 | <SOURCES> | ||
| 12 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.appcompat/appcompat/1.3.0-alpha01/7d8fa20e786b9c96531699df7805151d9a16b5d3/appcompat-1.3.0-alpha01-sources.jar!/" /> | ||
| 13 | </SOURCES> | ||
| 14 | </library> | ||
| 15 | </component> |
.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_3_0_alpha01_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.appcompat:appcompat-resources:1.3.0-alpha01@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/87a47b27eb57697db9352df1b258505c/jetified-appcompat-resources-1.3.0-alpha01/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/87a47b27eb57697db9352df1b258505c/jetified-appcompat-resources-1.3.0-alpha01/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.appcompat/appcompat-resources/1.3.0-alpha01/753bf8db5ab438d212454cb61349dec8c52d6f8a/appcompat-resources-1.3.0-alpha01-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.arch.core:core-common:2.1.0@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.arch.core/core-common/2.1.0/b3152fc64428c9354344bd89848ecddc09b6f07e/core-common-2.1.0.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.arch.core/core-common/2.1.0/80ac2d7c8e6400ce2fbc663cd1a7e1cbef38c4b8/core-common-2.1.0-sources.jar!/" /> | ||
| 9 | </SOURCES> | ||
| 10 | </library> | ||
| 11 | </component> |
.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/24d5b49fe2b36ef44f901a0f8118cef3/core-runtime-2.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/24d5b49fe2b36ef44f901a0f8118cef3/core-runtime-2.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.arch.core/core-runtime/2.0.0/bc41b287c95bc50a3cd27cb1b7cfb301805ba7f1/core-runtime-2.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/abef6da21d1c57f9122d146255360cc7/asynclayoutinflater-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/abef6da21d1c57f9122d146255360cc7/asynclayoutinflater-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.asynclayoutinflater/asynclayoutinflater/1.0.0/ac4d50701fce5c88dcc514f58e695cd32f05134c/asynclayoutinflater-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_collection_collection_1_1_0_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.collection:collection:1.1.0@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.collection/collection/1.1.0/1f27220b47669781457de0d600849a5de0e89909/collection-1.1.0.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.collection/collection/1.1.0/bae67b0019fbb38498198fcc2d0282a340b71c5b/collection-1.1.0-sources.jar!/" /> | ||
| 9 | </SOURCES> | ||
| 10 | </library> | ||
| 11 | </component> |
.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/0686ca90b872620e1e93c4a9f2d2181e/constraintlayout-1.1.3/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/0686ca90b872620e1e93c4a9f2d2181e/constraintlayout-1.1.3/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES /> | ||
| 9 | </library> | ||
| 10 | </component> |
.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.constraintlayout:constraintlayout-solver:1.1.3@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.constraintlayout/constraintlayout-solver/1.1.3/54abe9ffb22cc9019b0b6fcc10f185cc4e67b34e/constraintlayout-solver-1.1.3.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES /> | ||
| 8 | </library> | ||
| 9 | </component> |
.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.coordinatorlayout:coordinatorlayout:1.0.0@aar"> | ||
| 3 | <ANNOTATIONS> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/933284a5ca1fd2cab840868dee97f092/coordinatorlayout-1.0.0/annotations.zip!/" /> | ||
| 5 | </ANNOTATIONS> | ||
| 6 | <CLASSES> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/933284a5ca1fd2cab840868dee97f092/coordinatorlayout-1.0.0/jars/classes.jar!/" /> | ||
| 8 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/933284a5ca1fd2cab840868dee97f092/coordinatorlayout-1.0.0/res" /> | ||
| 9 | </CLASSES> | ||
| 10 | <JAVADOC /> | ||
| 11 | <SOURCES> | ||
| 12 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.coordinatorlayout/coordinatorlayout/1.0.0/4325b3c4422ad58201ed8dc15ae56bda9accedf2/coordinatorlayout-1.0.0-sources.jar!/" /> | ||
| 13 | </SOURCES> | ||
| 14 | </library> | ||
| 15 | </component> |
.idea/libraries/Gradle__androidx_core_core_1_4_0_alpha01_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.core:core:1.4.0-alpha01@aar"> | ||
| 3 | <ANNOTATIONS> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/faf603fe3248df85274d17d0665dfe66/core-1.4.0-alpha01/annotations.zip!/" /> | ||
| 5 | </ANNOTATIONS> | ||
| 6 | <CLASSES> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/faf603fe3248df85274d17d0665dfe66/core-1.4.0-alpha01/jars/classes.jar!/" /> | ||
| 8 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/faf603fe3248df85274d17d0665dfe66/core-1.4.0-alpha01/res" /> | ||
| 9 | </CLASSES> | ||
| 10 | <JAVADOC /> | ||
| 11 | <SOURCES> | ||
| 12 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.core/core/1.4.0-alpha01/778f0695b0e15f290fca37739b9ab666427a9dc7/core-1.4.0-alpha01-sources.jar!/" /> | ||
| 13 | </SOURCES> | ||
| 14 | </library> | ||
| 15 | </component> |
.idea/libraries/Gradle__androidx_core_core_ktx_1_3_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.core:core-ktx:1.3.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/eddd3afdd70de58f8cd62a2efe1aaa1b/jetified-core-ktx-1.3.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/eddd3afdd70de58f8cd62a2efe1aaa1b/jetified-core-ktx-1.3.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.core/core-ktx/1.3.0/98b0507bcf3cd12d671bf6dac09262757b60351d/core-ktx-1.3.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/b37b2aeed146cfc3b1274c4cf21d4028/cursoradapter-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/b37b2aeed146cfc3b1274c4cf21d4028/cursoradapter-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.cursoradapter/cursoradapter/1.0.0/1e323083b41c31fd4d45510dfce50614963c3c6c/cursoradapter-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.customview:customview:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/4bf5efb9c6ca1cc1042b4ed281aac9d8/customview-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/4bf5efb9c6ca1cc1042b4ed281aac9d8/customview-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.customview/customview/1.0.0/61f6a717d144dff3a6bda413d9abeeb2bca71581/customview-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.documentfile:documentfile:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/abca430f327a1ba4137054854d25dfd3/documentfile-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/abca430f327a1ba4137054854d25dfd3/documentfile-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.documentfile/documentfile/1.0.0/a1bed5cf96db96bd06a2feade98fe55653811dc8/documentfile-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar"> | ||
| 3 | <ANNOTATIONS> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/f66fa33308b0619d349f33f29e1b9234/drawerlayout-1.0.0/annotations.zip!/" /> | ||
| 5 | </ANNOTATIONS> | ||
| 6 | <CLASSES> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/f66fa33308b0619d349f33f29e1b9234/drawerlayout-1.0.0/jars/classes.jar!/" /> | ||
| 8 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/f66fa33308b0619d349f33f29e1b9234/drawerlayout-1.0.0/res" /> | ||
| 9 | </CLASSES> | ||
| 10 | <JAVADOC /> | ||
| 11 | <SOURCES> | ||
| 12 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.drawerlayout/drawerlayout/1.0.0/9ecd4ecb7da215ba4c5c3e00bf8d290dad6f2bc5/drawerlayout-1.0.0-sources.jar!/" /> | ||
| 13 | </SOURCES> | ||
| 14 | </library> | ||
| 15 | </component> |
.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.fragment:fragment:1.1.0@aar"> | ||
| 3 | <ANNOTATIONS> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/7619667f73099691456e81e3fedf8086/fragment-1.1.0/annotations.zip!/" /> | ||
| 5 | </ANNOTATIONS> | ||
| 6 | <CLASSES> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/7619667f73099691456e81e3fedf8086/fragment-1.1.0/jars/classes.jar!/" /> | ||
| 8 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/7619667f73099691456e81e3fedf8086/fragment-1.1.0/res" /> | ||
| 9 | </CLASSES> | ||
| 10 | <JAVADOC /> | ||
| 11 | <SOURCES> | ||
| 12 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.fragment/fragment/1.1.0/b9ebb04df2cb0cad4419af3c658690bc82aa5706/fragment-1.1.0-sources.jar!/" /> | ||
| 13 | </SOURCES> | ||
| 14 | </library> | ||
| 15 | </component> |
.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.interpolator:interpolator:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/32691ed1dd96a709bdd6754d66b7ebfd/interpolator-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/32691ed1dd96a709bdd6754d66b7ebfd/interpolator-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.interpolator/interpolator/1.0.0/fefd5e3cbc479b6b4a9532d05688a1e659e8d3d2/interpolator-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.legacy:legacy-support-core-ui:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/8d8538b270dedbd719c054e5cb3c4560/legacy-support-core-ui-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/8d8538b270dedbd719c054e5cb3c4560/legacy-support-core-ui-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.legacy/legacy-support-core-ui/1.0.0/f6044eaebe354c778f1f147ddb9e92a3f1e22fc7/legacy-support-core-ui-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/7d485c838bde573a9b774202fc501e14/legacy-support-core-utils-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/7d485c838bde573a9b774202fc501e14/legacy-support-core-utils-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.legacy/legacy-support-core-utils/1.0.0/46c37f178088153618cfb0afef08ec96c48f93cb/legacy-support-core-utils-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.legacy:legacy-support-v4:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/9360cf1367a704ccd74509b9c6640d83/legacy-support-v4-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/9360cf1367a704ccd74509b9c6640d83/legacy-support-v4-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.legacy/legacy-support-v4/1.0.0/5b8f86fea035328fc9e8c660773037a3401ce25f/legacy-support-v4-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_0_alpha03_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.lifecycle:lifecycle-common:2.3.0-alpha03@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.3.0-alpha03/eda523facdc9b2c2b6180b3e78ded7dbd6751147/lifecycle-common-2.3.0-alpha03.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.3.0-alpha03/3e1b634d39cc3a31841a736bc875665d335ac91d/lifecycle-common-2.3.0-alpha03-sources.jar!/" /> | ||
| 9 | </SOURCES> | ||
| 10 | </library> | ||
| 11 | </component> |
.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/c20b3a9c01fac1c58487516ff423d6b0/lifecycle-livedata-2.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/c20b3a9c01fac1c58487516ff423d6b0/lifecycle-livedata-2.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-livedata/2.0.0/740ce61935bd789380c01178bd8ce402402ebd2f/lifecycle-livedata-2.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/68a64a089b7f098f26bb791f76de8be0/lifecycle-livedata-core-2.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/68a64a089b7f098f26bb791f76de8be0/lifecycle-livedata-core-2.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-livedata-core/2.0.0/c158207594782b42f3a2e08a5a029eb3319e4404/lifecycle-livedata-core-2.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_0_alpha03_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.lifecycle:lifecycle-runtime:2.3.0-alpha03@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/bab842249c6cd3851271595261bd411b/lifecycle-runtime-2.3.0-alpha03/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/bab842249c6cd3851271595261bd411b/lifecycle-runtime-2.3.0-alpha03/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-runtime/2.3.0-alpha03/263ef87b15a59902049181df828e13427c94b8bf/lifecycle-runtime-2.3.0-alpha03-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_0_alpha03_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.3.0-alpha03@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/f38073da679040f2c791850ba1f974fd/lifecycle-viewmodel-2.3.0-alpha03/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/f38073da679040f2c791850ba1f974fd/lifecycle-viewmodel-2.3.0-alpha03/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-viewmodel/2.3.0-alpha03/d44e01939138d9977d82d9300ea34d309dc6dcbc/lifecycle-viewmodel-2.3.0-alpha03-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.loader:loader:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/c38deefe61a4b29c2fedadb5cb828cb9/loader-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/c38deefe61a4b29c2fedadb5cb828cb9/loader-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.loader/loader/1.0.0/b9ef587f3e46c7fe5b00264989764e43ff45cada/loader-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/836e9858d101fce50deef7223d87d0d6/localbroadcastmanager-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/836e9858d101fce50deef7223d87d0d6/localbroadcastmanager-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.localbroadcastmanager/localbroadcastmanager/1.0.0/3930e99159fd6b7f1d2e7d5fe9af0924ca1faf9/localbroadcastmanager-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_media_media_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.media:media:1.0.0@aar"> | ||
| 3 | <ANNOTATIONS> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/21868e54ee8fa7c5ee3c87552712a96c/media-1.0.0/annotations.zip!/" /> | ||
| 5 | </ANNOTATIONS> | ||
| 6 | <CLASSES> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/21868e54ee8fa7c5ee3c87552712a96c/media-1.0.0/jars/classes.jar!/" /> | ||
| 8 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/21868e54ee8fa7c5ee3c87552712a96c/media-1.0.0/res" /> | ||
| 9 | </CLASSES> | ||
| 10 | <JAVADOC /> | ||
| 11 | <SOURCES> | ||
| 12 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.media/media/1.0.0/5faf25be15e16e27275f5c7e04e15e944ebccea0/media-1.0.0-sources.jar!/" /> | ||
| 13 | </SOURCES> | ||
| 14 | </library> | ||
| 15 | </component> |
.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.print:print:1.0.0@aar"> | ||
| 3 | <ANNOTATIONS> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/6083e5aff4a41b4b352509ce72ef01fb/print-1.0.0/annotations.zip!/" /> | ||
| 5 | </ANNOTATIONS> | ||
| 6 | <CLASSES> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/6083e5aff4a41b4b352509ce72ef01fb/print-1.0.0/jars/classes.jar!/" /> | ||
| 8 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/6083e5aff4a41b4b352509ce72ef01fb/print-1.0.0/res" /> | ||
| 9 | </CLASSES> | ||
| 10 | <JAVADOC /> | ||
| 11 | <SOURCES> | ||
| 12 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.print/print/1.0.0/71fc2d9acf7cce6b96230c5af263268b1664914a/print-1.0.0-sources.jar!/" /> | ||
| 13 | </SOURCES> | ||
| 14 | </library> | ||
| 15 | </component> |
.idea/libraries/Gradle__androidx_savedstate_savedstate_1_1_0_alpha01_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.savedstate:savedstate:1.1.0-alpha01@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/5587988c6da5b7d5151bb153f4cf7562/jetified-savedstate-1.1.0-alpha01/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/5587988c6da5b7d5151bb153f4cf7562/jetified-savedstate-1.1.0-alpha01/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.savedstate/savedstate/1.1.0-alpha01/73464c2c55129727354a95ffa91dc9c2cf0c78b/savedstate-1.1.0-alpha01-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.slidingpanelayout:slidingpanelayout:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/0fcb8293f1ad8a72968cee415eb0b621/slidingpanelayout-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/0fcb8293f1ad8a72968cee415eb0b621/slidingpanelayout-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.slidingpanelayout/slidingpanelayout/1.0.0/f3f2e4fded24d5969a86e1974ad7e96975d970a0/slidingpanelayout-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:1.0.0@aar"> | ||
| 3 | <ANNOTATIONS> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/47969dd378bd395d9c130e31d38327f3/swiperefreshlayout-1.0.0/annotations.zip!/" /> | ||
| 5 | </ANNOTATIONS> | ||
| 6 | <CLASSES> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/47969dd378bd395d9c130e31d38327f3/swiperefreshlayout-1.0.0/jars/classes.jar!/" /> | ||
| 8 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/47969dd378bd395d9c130e31d38327f3/swiperefreshlayout-1.0.0/res" /> | ||
| 9 | </CLASSES> | ||
| 10 | <JAVADOC /> | ||
| 11 | <SOURCES> | ||
| 12 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.swiperefreshlayout/swiperefreshlayout/1.0.0/ab92d86c004eb1d48e45f311b02ca53d6c86b607/swiperefreshlayout-1.0.0-sources.jar!/" /> | ||
| 13 | </SOURCES> | ||
| 14 | </library> | ||
| 15 | </component> |
.idea/libraries/Gradle__androidx_test_core_1_2_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.test:core:1.2.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/bf5f96f1314ebd53158465123f96d5c1/jetified-core-1.2.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/bf5f96f1314ebd53158465123f96d5c1/jetified-core-1.2.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test/core/1.2.0/ed921186cfb809317daf41ccf8e6acc5dcea0e06/core-1.2.0-javadoc.jar!/" /> | ||
| 9 | </JAVADOC> | ||
| 10 | <SOURCES> | ||
| 11 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test/core/1.2.0/4c4174bc50358d65632faeb0bb392ef76aa74c39/core-1.2.0-sources.jar!/" /> | ||
| 12 | </SOURCES> | ||
| 13 | </library> | ||
| 14 | </component> |
.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.test.espresso:espresso-core:3.2.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/f30cf7e327badd1ff497a2f52c5cc4f8/espresso-core-3.2.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/f30cf7e327badd1ff497a2f52c5cc4f8/espresso-core-3.2.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test.espresso/espresso-core/3.2.0/4dd88178a28883ac149f76e4908942486e756b72/espresso-core-3.2.0-javadoc.jar!/" /> | ||
| 9 | </JAVADOC> | ||
| 10 | <SOURCES> | ||
| 11 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test.espresso/espresso-core/3.2.0/5d1b7f5b3c2877929324f5c846da358995c9af6d/espresso-core-3.2.0-sources.jar!/" /> | ||
| 12 | </SOURCES> | ||
| 13 | </library> | ||
| 14 | </component> |
.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.test.espresso:espresso-idling-resource:3.2.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/6049d4a0cb1fb4a740fcba61977b0b27/espresso-idling-resource-3.2.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/6049d4a0cb1fb4a740fcba61977b0b27/espresso-idling-resource-3.2.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test.espresso/espresso-idling-resource/3.2.0/ac774bb29e6171578dc7508bf390a4a3ccbedfea/espresso-idling-resource-3.2.0-javadoc.jar!/" /> | ||
| 9 | </JAVADOC> | ||
| 10 | <SOURCES> | ||
| 11 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test.espresso/espresso-idling-resource/3.2.0/565422b0951cfb8de4888853e4859d6a47a72d39/espresso-idling-resource-3.2.0-sources.jar!/" /> | ||
| 12 | </SOURCES> | ||
| 13 | </library> | ||
| 14 | </component> |
.idea/libraries/Gradle__androidx_test_ext_junit_1_1_1_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.test.ext:junit:1.1.1@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/4ddfae33acf1234487eb68207a9cdbfa/jetified-junit-1.1.1/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/4ddfae33acf1234487eb68207a9cdbfa/jetified-junit-1.1.1/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test.ext/junit/1.1.1/36f7bb8e054e7a5d0d6e17b52bd6b2a06118a437/junit-1.1.1-javadoc.jar!/" /> | ||
| 9 | </JAVADOC> | ||
| 10 | <SOURCES> | ||
| 11 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test.ext/junit/1.1.1/40a36b3426cde38b7eb2375034e358152366dc9a/junit-1.1.1-sources.jar!/" /> | ||
| 12 | </SOURCES> | ||
| 13 | </library> | ||
| 14 | </component> |
.idea/libraries/Gradle__androidx_test_monitor_1_3_0_alpha03_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.test:monitor:1.3.0-alpha03@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/e121aa172b1b6e4947a502e6f4a9561e/monitor-1.3.0-alpha03/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/e121aa172b1b6e4947a502e6f4a9561e/monitor-1.3.0-alpha03/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test/monitor/1.3.0-alpha03/591c7eaa31b1c9d99eea12d8f5b5cadb4586a116/monitor-1.3.0-alpha03-javadoc.jar!/" /> | ||
| 9 | </JAVADOC> | ||
| 10 | <SOURCES> | ||
| 11 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test/monitor/1.3.0-alpha03/4d9365d5571569a3dd3d3e3bc5c5c5715cd42d0d/monitor-1.3.0-alpha03-sources.jar!/" /> | ||
| 12 | </SOURCES> | ||
| 13 | </library> | ||
| 14 | </component> |
.idea/libraries/Gradle__androidx_test_rules_1_3_0_alpha03_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.test:rules:1.3.0-alpha03@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/9fd7e610be55aa9ca8a3b32a98217158/rules-1.3.0-alpha03/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/9fd7e610be55aa9ca8a3b32a98217158/rules-1.3.0-alpha03/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test/rules/1.3.0-alpha03/b95671839162f60568275396cc186e069b12cd2c/rules-1.3.0-alpha03-javadoc.jar!/" /> | ||
| 9 | </JAVADOC> | ||
| 10 | <SOURCES> | ||
| 11 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test/rules/1.3.0-alpha03/415e43c24e363a640f883d2b5d0949f77bc66818/rules-1.3.0-alpha03-sources.jar!/" /> | ||
| 12 | </SOURCES> | ||
| 13 | </library> | ||
| 14 | </component> |
.idea/libraries/Gradle__androidx_test_runner_1_3_0_alpha03_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.test:runner:1.3.0-alpha03@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/c1427b7e1a08e02f35f14658a6bc5ac7/runner-1.3.0-alpha03/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/c1427b7e1a08e02f35f14658a6bc5ac7/runner-1.3.0-alpha03/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC> | ||
| 8 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test/runner/1.3.0-alpha03/bdc79accd7a76b589ad970cb1eb15c62893e3612/runner-1.3.0-alpha03-javadoc.jar!/" /> | ||
| 9 | </JAVADOC> | ||
| 10 | <SOURCES> | ||
| 11 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.test/runner/1.3.0-alpha03/f2e3d9a760f20ce458b2b550c82b88ca14bfb5bb/runner-1.3.0-alpha03-sources.jar!/" /> | ||
| 12 | </SOURCES> | ||
| 13 | </library> | ||
| 14 | </component> |
.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.vectordrawable:vectordrawable:1.1.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/5449d447cecb7a5b7105df425966ce92/vectordrawable-1.1.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/5449d447cecb7a5b7105df425966ce92/vectordrawable-1.1.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.vectordrawable/vectordrawable/1.1.0/1e0694477eed874c50c54b547cc3e5a62a57a62b/vectordrawable-1.1.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.1.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/721dcdb357351f758b5df456f00974d6/vectordrawable-animated-1.1.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/721dcdb357351f758b5df456f00974d6/vectordrawable-animated-1.1.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.vectordrawable/vectordrawable-animated/1.1.0/871a7705cd03bc246947638c712cdd11378233ff/vectordrawable-animated-1.1.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/b741faf0c0e978004788a3922a8a438d/versionedparcelable-1.1.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/b741faf0c0e978004788a3922a8a438d/versionedparcelable-1.1.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.versionedparcelable/versionedparcelable/1.1.0/d9085927216387af679d18b6f472bc0fc5c7cc81/versionedparcelable-1.1.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: androidx.viewpager:viewpager:1.0.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/1570490a9aefa8bf7c72c2091e5007e6/viewpager-1.0.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/1570490a9aefa8bf7c72c2091e5007e6/viewpager-1.0.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.viewpager/viewpager/1.0.0/db045f92188b9d247d5f556866f8861ab68528f0/viewpager-1.0.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/2.0.1/516c03b21d50a644d538de0f0369c620989cd8f0/jsr305-2.0.1.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC /> | ||
| 7 | <SOURCES /> | ||
| 8 | </library> | ||
| 9 | </component> |
.idea/libraries/Gradle__com_google_zxing_core_3_4_0_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: com.google.zxing:core:3.4.0@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.zxing/core/3.4.0/5264296c46634347890ec9250bc65f14b7362bf8/core-3.4.0.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.zxing/core/3.4.0/d6d098a5d5c1a8cff1747b8934e842fd3339366f/core-3.4.0-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.zxing/core/3.4.0/392876e10bc1179c094f0b03cca80a79b8b338a7/core-3.4.0-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__com_journeyapps_zxing_android_embedded_4_1_0_aar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: com.journeyapps:zxing-android-embedded:4.1.0@aar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/311b09597b684ff33ecf53b9a489fb6f/jetified-zxing-android-embedded-4.1.0/jars/classes.jar!/" /> | ||
| 5 | <root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/311b09597b684ff33ecf53b9a489fb6f/jetified-zxing-android-embedded-4.1.0/res" /> | ||
| 6 | </CLASSES> | ||
| 7 | <JAVADOC /> | ||
| 8 | <SOURCES> | ||
| 9 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.journeyapps/zxing-android-embedded/4.1.0/7db56492456410aa9b60e97f3ca30fc8f2e1e946/zxing-android-embedded-4.1.0-sources.jar!/" /> | ||
| 10 | </SOURCES> | ||
| 11 | </library> | ||
| 12 | </component> |
.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: com.squareup:javawriter:2.1.1@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup/javawriter/2.1.1/67ff45d9ae02e583d0f9b3432a5ebbe05c30c966/javawriter-2.1.1.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup/javawriter/2.1.1/f591a105db78771d0a1e7a277b3747556c528c22/javawriter-2.1.1-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup/javawriter/2.1.1/5b31387d839a5cdaf5b6de3990da01f7f2b963c5/javawriter-2.1.1-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: javax.inject:javax.inject:1@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/70ec961c25111ed9015d1af77772d96383c2d238/javax.inject-1-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/a00123f261762a7c5e0ec916a2c7c8298d29c400/javax.inject-1-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__junit_junit_4_12_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: junit:junit:4.12@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/941a8be4506c65f0a9001c08812fb7da1e505e21/junit-4.12-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/a6c32b40bf3d76eca54e3c601e5d1470c86fcdfa/junit-4.12-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__junit_junit_4_13_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: junit:junit:4.13@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.13/e49ccba652b735c93bd6e6f59760d8254cf597dd/junit-4.13.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.13/17ed6c7dd587f52c9e7894964eff6a880f0658a/junit-4.13-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.13/d10a9c3acc6c07a5700e37697b5a6b4dcfb8abf9/junit-4.13-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: net.sf.kxml:kxml2:2.3.0@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.sf.kxml/kxml2/2.3.0/ccbc77a5fd907ef863c29f3596c6f54ffa4e9442/kxml2-2.3.0.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.sf.kxml/kxml2/2.3.0/dcb10030b92be67fd9dd224ade52310e40bbaf33/kxml2-2.3.0-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.sf.kxml/kxml2/2.3.0/309cd2cff7260e465792fda3dcbb063b730d8050/kxml2-2.3.0-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: org.hamcrest:hamcrest-core:1.3@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/ad09811315f1d4f5756986575b0ea16b99cd686f/hamcrest-core-1.3-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b/hamcrest-core-1.3-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-integration/1.3/5de0c73fef18917cd85d0ab70bb23818685e4dfd/hamcrest-integration-1.3.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-integration/1.3/cc5884d4138d3376f574f6a3992acceedfc37bea/hamcrest-integration-1.3-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-integration/1.3/ae7787a563e6a1b1f17fd4ac43be3a3c8830cfda/hamcrest-integration-1.3-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: org.hamcrest:hamcrest-library:1.3@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-library/1.3/4785a3c21320980282f9f33d0d1264a69040538f/hamcrest-library-1.3.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-library/1.3/4324046c5f99f3dc91b5370899fa3ae65fd137d2/hamcrest-library-1.3-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-library/1.3/47a7ee46628ab7133129cd7cef1e92657bc275e/hamcrest-library-1.3-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__org_jetbrains_annotations_13_0_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: org.jetbrains:annotations:13.0@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/73368c3b0887f3adc2c2730dd1b95d7c3781aaf3/annotations-13.0-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/5991ca87ef1fb5544943d9abc5a9a37583fabe03/annotations-13.0-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_android_extensions_runtime_1_3_72_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-android-extensions-runtime/1.3.72/83423235971335be77d2ea025008bc9959738ffc/kotlin-android-extensions-runtime-1.3.72.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-android-extensions-runtime/1.3.72/f3399b71a83521b6a2d366daaf5dc11184518ff6/kotlin-android-extensions-runtime-1.3.72-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-android-extensions-runtime/1.3.72/46492b02491d9b3fbe80dd89f4921a7e4aacd2ec/kotlin-android-extensions-runtime-1.3.72-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_3_72_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.3.72@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.72/8032138f12c0180bc4e51fe139d4c52b46db6109/kotlin-stdlib-1.3.72.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.72/b1d2ee58cf8c842c5143315cff20019a6173378d/kotlin-stdlib-1.3.72-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.72/28f81264fad20dd20cc692003f4a27d355632073/kotlin-stdlib-1.3.72-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_3_72_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.72/6ca8bee3d88957eaaaef077c41c908c9940492d8/kotlin-stdlib-common-1.3.72.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.72/b1d2ee58cf8c842c5143315cff20019a6173378d/kotlin-stdlib-common-1.3.72-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.72/8c35588215bc56f828c189e9edc37ee51672cf5c/kotlin-stdlib-common-1.3.72-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_3_72_jar.xml
| File was created | 1 | <component name="libraryTable"> | |
| 2 | <library name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72@jar"> | ||
| 3 | <CLASSES> | ||
| 4 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.72/3adfc2f4ea4243e01204be8081fe63bde6b12815/kotlin-stdlib-jdk7-1.3.72.jar!/" /> | ||
| 5 | </CLASSES> | ||
| 6 | <JAVADOC> | ||
| 7 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.72/d5c341c5580f6d1289efe06247f4818e57ad24eb/kotlin-stdlib-jdk7-1.3.72-javadoc.jar!/" /> | ||
| 8 | </JAVADOC> | ||
| 9 | <SOURCES> | ||
| 10 | <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.72/e83fed78d9bc2951a2c7e457969d5fd171cb9d5f/kotlin-stdlib-jdk7-1.3.72-sources.jar!/" /> | ||
| 11 | </SOURCES> | ||
| 12 | </library> | ||
| 13 | </component> |
.idea/modules.xml
| File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | <project version="4"> | ||
| 3 | <component name="ProjectModuleManager"> | ||
| 4 | <modules> | ||
| 5 | <module fileurl="file://$PROJECT_DIR$/.idea/modules/DeboInventario.iml" filepath="$PROJECT_DIR$/.idea/modules/DeboInventario.iml" group="DeboInventario" /> | ||
| 6 | <module fileurl="file://$PROJECT_DIR$/.idea/modules/app/app.iml" filepath="$PROJECT_DIR$/.idea/modules/app/app.iml" group="DeboInventario/app" /> | ||
| 7 | </modules> | ||
| 8 | </component> | ||
| 9 | </project> |
.idea/modules/DeboInventario.iml
| File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | <module external.linked.project.id="DeboInventario" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> | ||
| 3 | <component name="FacetManager"> | ||
| 4 | <facet type="java-gradle" name="Java-Gradle"> | ||
| 5 | <configuration> | ||
| 6 | <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/../../build" /> | ||
| 7 | <option name="BUILDABLE" value="false" /> | ||
| 8 | </configuration> | ||
| 9 | </facet> | ||
| 10 | </component> | ||
| 11 | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true"> | ||
| 12 | <exclude-output /> | ||
| 13 | <content url="file://$MODULE_DIR$/../.."> | ||
| 14 | <excludeFolder url="file://$MODULE_DIR$/../../.gradle" /> | ||
| 15 | </content> | ||
| 16 | <orderEntry type="inheritedJdk" /> | ||
| 17 | <orderEntry type="sourceFolder" forTests="false" /> | ||
| 18 | </component> | ||
| 19 | </module> |
.idea/modules/app/app.iml
| File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | <module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$/../../../app" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="DeboInventario" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> | ||
| 3 | <component name="FacetManager"> | ||
| 4 | <facet type="android-gradle" name="Android-Gradle"> | ||
| 5 | <configuration> | ||
| 6 | <option name="GRADLE_PROJECT_PATH" value=":app" /> | ||
| 7 | <option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="4.0.0" /> | ||
| 8 | <option name="LAST_KNOWN_AGP_VERSION" value="4.0.0" /> | ||
| 9 | </configuration> | ||
| 10 | </facet> | ||
| 11 | <facet type="android" name="Android"> | ||
| 12 | <configuration> | ||
| 13 | <option name="SELECTED_BUILD_VARIANT" value="debug" /> | ||
| 14 | <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" /> | ||
| 15 | <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" /> | ||
| 16 | <afterSyncTasks> | ||
| 17 | <task>generateDebugSources</task> | ||
| 18 | </afterSyncTasks> | ||
| 19 | <option name="ALLOW_USER_CONFIGURATION" value="false" /> | ||
| 20 | <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" /> | ||
| 21 | <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" /> | ||
| 22 | <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/main/res;file://$MODULE_DIR$/../../../app/src/debug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug" /> | ||
| 23 | <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/androidTest/res;file://$MODULE_DIR$/../../../app/src/test/res;file://$MODULE_DIR$/../../../app/src/androidTestDebug/res;file://$MODULE_DIR$/../../../app/src/testDebug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug" /> | ||
| 24 | <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> | ||
| 25 | </configuration> | ||
| 26 | </facet> | ||
| 27 | <facet type="kotlin-language" name="Kotlin"> | ||
| 28 | <configuration version="3" platform="JVM 1.6" allPlatforms="JVM [1.6]" useProjectSettings="false"> | ||
| 29 | <compilerSettings> | ||
| 30 | <option name="additionalArguments" value="-Xallow-no-source-files" /> | ||
| 31 | </compilerSettings> | ||
| 32 | <compilerArguments> | ||
| 33 | <option name="destination" value="$MODULE_DIR$/../../../app/build/tmp/kotlin-classes/debug" /> | ||
| 34 | <option name="classpath" value="$MODULE_DIR$/../../../app/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/debug/R.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/81c05ee5ec64f17385956014fb6e4888/jetified-apache-mime4j-0.6.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/f5871595b228df6d19d87dcf36eaea73/jetified-httpclient-4.1.2.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/ea2aa5a8d880898057a15d2b427c3bc5/jetified-httpclient-cache-4.1.2.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/8ac8c31bc08e63a025449194253628bf/jetified-httpcore-4.1.2.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/b019283f2bb35a416a6e3e81e602cdc5/jetified-httpmime-4.1.2.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/3658a2344336e0026f0f6b9200a71772/jetified-org.apache.httpcomponents.httpclient-4.1.2-sources.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/d8ecf77db437180f5945578a4d2539b5/jetified-kotlin-android-extensions-runtime-1.3.72.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/9a5eb1e946bc472a67e02c8d438374e0/jetified-kotlin-stdlib-jdk7-1.3.72.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/58717fd35b9f8892fe9be42af9e828a2/jetified-core-ktx-1.3.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/d7918a34a298ce6afd050963fe8285f4/jetified-kotlin-stdlib-1.3.72.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/7a610442c037d944b5571b97c8bc4008/jetified-kotlin-stdlib-common-1.3.72.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/b5ebe2cccd14b8a63e84eff597aa9d39/jetified-annotations-13.0.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/cb5e43e5bd726d4a8ba5ebb9a59e38e4/appcompat-1.3.0-alpha01-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/519ff3ad0f9c3d88ef7d48b84aadd455/jetified-zxing-android-embedded-4.1.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/52ffba07ad8b54236a2ba29ebd514b8b/legacy-support-v4-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/bad9133806d0e6c17c5a646b095e10cf/fragment-1.1.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/4eb432b0c0d7a664ddd9aa59c00bfa2c/jetified-appcompat-resources-1.3.0-alpha01-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/76ac490a79001efa758e2a1c2afa7914/legacy-support-core-ui-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/bbaf16160d0fa95398e1045beb1d0010/drawerlayout-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/efac5d11c2e6b1707664efe099358310/media-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/386c0595479ea5eee63013ad1ca3f96e/legacy-support-core-utils-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/3fd228e3ff76b95fe97ea7f2e2a78818/viewpager-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/88de42c7f900dd67b54e6b2166f3a37a/loader-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/8535ab70bb651513ebc4459b595a4dc4/jetified-activity-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/09f1405faca12a7c354e1276ae92d60a/vectordrawable-animated-1.1.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/0e5da3aaa8fb5db4904296d6b2ff36c1/vectordrawable-1.1.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/5c6217b8ffb0ebc3833a81142c3f11d8/coordinatorlayout-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/103cb63335f9c7eecfa29143b9d90d47/slidingpanelayout-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/5c99a88195e5ff342896ce52cc5bba45/customview-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/30c7870c64256fe26ee4ee52e41ed81d/swiperefreshlayout-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/bf62c516b55459e69a0dcaba9b56b9ec/asynclayoutinflater-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/fb64ef7d37c85fc159f7d959220e9202/core-1.4.0-alpha01-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/381652ed594b59d009b9f9d9beafbde7/cursoradapter-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/1d33d2ae8b99c3bec5d3ab341222b6cf/lifecycle-runtime-2.3.0-alpha03-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/81a870a6efb8a52c1bb894a01757303c/versionedparcelable-1.1.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/modules-2/files-2.1/androidx.collection/collection/1.1.0/1f27220b47669781457de0d600849a5de0e89909/collection-1.1.0.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/c231bcebc45ec3a7da6ea68367179ddc/lifecycle-viewmodel-2.3.0-alpha03-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/356cbcad5769d48d6334426aa66f8741/documentfile-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/6df5463ab41a6e670438776d3468cc94/localbroadcastmanager-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/147926b9bc953879c8b2ce29faea2d10/print-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/d85f5e91de901d11959de6be28aac684/interpolator-1.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/1bba0224ccd4975bab675215718e5d86/lifecycle-livedata-2.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/f9189a7cf783f398e7742a38bda9533d/lifecycle-livedata-core-2.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.3.0-alpha03/eda523facdc9b2c2b6180b3e78ded7dbd6751147/lifecycle-common-2.3.0-alpha03.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/1fa4fcf89eda01912154b5b83bd1fb06/core-runtime-2.0.0-api.jar;C:/Users/mauricio sanchez/.gradle/caches/modules-2/files-2.1/androidx.arch.core/core-common/2.1.0/b3152fc64428c9354344bd89848ecddc09b6f07e/core-common-2.1.0.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/c45d9eec00bebd76ab3e8b3f3b552993/jetified-savedstate-1.1.0-alpha01-api.jar;C:/Users/mauricio sanchez/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.2.0-alpha01/cf0f760ea00702c040b3f8c9ccbe615ae26356dc/annotation-1.2.0-alpha01.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/1ef2874d8575339c91629cbc50556c9d/constraintlayout-1.1.3-api.jar;C:/Users/mauricio sanchez/.gradle/caches/modules-2/files-2.1/androidx.constraintlayout/constraintlayout-solver/1.1.3/54abe9ffb22cc9019b0b6fcc10f185cc4e67b34e/constraintlayout-solver-1.1.3.jar;C:/Users/mauricio sanchez/.gradle/caches/transforms-2/files-2.1/ead57ccabce5e334b192f45637af7c91/jetified-core-3.4.0.jar;C:/Users/mauricio sanchez/AppData/Local/Android/Sdk/platforms/android-29/android.jar;C:/Users/mauricio sanchez/AppData/Local/Android/Sdk/build-tools/29.0.3/core-lambda-stubs.jar" /> | ||
| 35 | <option name="noStdlib" value="true" /> | ||
| 36 | <option name="noReflect" value="true" /> | ||
| 37 | <option name="moduleName" value="app_debug" /> | ||
| 38 | <option name="languageVersion" value="1.3" /> | ||
| 39 | <option name="apiVersion" value="1.3" /> | ||
| 40 | <option name="pluginOptions"> | ||
| 41 | <array> | ||
| 42 | <option value="plugin:org.jetbrains.kotlin.android:experimental=false" /> | ||
| 43 | <option value="plugin:org.jetbrains.kotlin.android:enabled=true" /> | ||
| 44 | <option value="plugin:org.jetbrains.kotlin.android:defaultCacheImplementation=hashMap" /> | ||
| 45 | </array> | ||
| 46 | </option> | ||
| 47 | <option name="pluginClasspaths"> | ||
| 48 | <array> | ||
| 49 | <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.intellij.deps/trove4j/1.0.20181211/216c2e14b070f334479d800987affe4054cd563f/trove4j-1.0.20181211.jar" /> | ||
| 50 | <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-android-extensions/1.3.72/ecbb105a12a9766d2188f454b3bc3aab46cb80b6/kotlin-android-extensions-1.3.72.jar" /> | ||
| 51 | <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.3.72/fb72232c8fa977d5e07d33c43381ddbdc5edab6/kotlin-compiler-embeddable-1.3.72.jar" /> | ||
| 52 | <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-daemon-embeddable/1.3.72/53bbaa2816dbf6bdb85f629451b1fcc88f2164d2/kotlin-daemon-embeddable-1.3.72.jar" /> | ||
| 53 | <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.3.72/86613e1a669a701b0c660bfd2af4f82a7ae11fca/kotlin-reflect-1.3.72.jar" /> | ||
| 54 | <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-script-runtime/1.3.72/657d8d34d91e1964b4439378c09933e840bfe8d5/kotlin-script-runtime-1.3.72.jar" /> | ||
| 55 | <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.72/6ca8bee3d88957eaaaef077c41c908c9940492d8/kotlin-stdlib-common-1.3.72.jar" /> | ||
| 56 | <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.72/8032138f12c0180bc4e51fe139d4c52b46db6109/kotlin-stdlib-1.3.72.jar" /> | ||
| 57 | <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar" /> | ||
| 58 | </array> | ||
| 59 | </option> | ||
| 60 | <option name="errors"> | ||
| 61 | <ArgumentParseErrors /> | ||
| 62 | </option> | ||
| 63 | </compilerArguments> | ||
| 64 | </configuration> | ||
| 65 | </facet> | ||
| 66 | </component> | ||
| 67 | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> | ||
| 68 | <output url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debug/classes" /> | ||
| 69 | <output-test url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debugUnitTest/classes" /> | ||
| 70 | <exclude-output /> | ||
| 71 | <content url="file://$MODULE_DIR$/../../../app"> | ||
| 72 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" /> | ||
| 73 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/aidl_source_output_dir/debug/out" isTestSource="false" generated="true" /> | ||
| 74 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" /> | ||
| 75 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/renderscript_source_output_dir/debug/out" isTestSource="false" generated="true" /> | ||
| 76 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug" type="java-resource" generated="true" /> | ||
| 77 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/aidl_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" /> | ||
| 78 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" /> | ||
| 79 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" /> | ||
| 80 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/renderscript_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" /> | ||
| 81 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" /> | ||
| 82 | <sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debugUnitTest/out" isTestSource="true" generated="true" /> | ||
| 83 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/debug/res" type="java-resource" /> | ||
| 84 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/debug/resources" type="java-resource" /> | ||
| 85 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/debug/assets" type="java-resource" /> | ||
| 86 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/debug/aidl" isTestSource="false" /> | ||
| 87 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/debug/java" isTestSource="false" /> | ||
| 88 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/debug/rs" isTestSource="false" /> | ||
| 89 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/debug/shaders" isTestSource="false" /> | ||
| 90 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTestDebug/res" type="java-test-resource" /> | ||
| 91 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTestDebug/resources" type="java-test-resource" /> | ||
| 92 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTestDebug/assets" type="java-test-resource" /> | ||
| 93 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTestDebug/aidl" isTestSource="true" /> | ||
| 94 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTestDebug/java" isTestSource="true" /> | ||
| 95 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTestDebug/rs" isTestSource="true" /> | ||
| 96 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTestDebug/shaders" isTestSource="true" /> | ||
| 97 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/testDebug/res" type="java-test-resource" /> | ||
| 98 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/testDebug/resources" type="java-test-resource" /> | ||
| 99 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/testDebug/assets" type="java-test-resource" /> | ||
| 100 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/testDebug/aidl" isTestSource="true" /> | ||
| 101 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/testDebug/java" isTestSource="true" /> | ||
| 102 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/testDebug/rs" isTestSource="true" /> | ||
| 103 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/testDebug/shaders" isTestSource="true" /> | ||
| 104 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/res" type="java-resource" /> | ||
| 105 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/resources" type="java-resource" /> | ||
| 106 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/assets" type="java-resource" /> | ||
| 107 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/aidl" isTestSource="false" /> | ||
| 108 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/java" isTestSource="false" /> | ||
| 109 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/rs" isTestSource="false" /> | ||
| 110 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/shaders" isTestSource="false" /> | ||
| 111 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTest/res" type="java-test-resource" /> | ||
| 112 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTest/resources" type="java-test-resource" /> | ||
| 113 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTest/assets" type="java-test-resource" /> | ||
| 114 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTest/aidl" isTestSource="true" /> | ||
| 115 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTest/java" isTestSource="true" /> | ||
| 116 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTest/rs" isTestSource="true" /> | ||
| 117 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/androidTest/shaders" isTestSource="true" /> | ||
| 118 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/test/res" type="java-test-resource" /> | ||
| 119 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/test/resources" type="java-test-resource" /> | ||
| 120 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/test/assets" type="java-test-resource" /> | ||
| 121 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/test/aidl" isTestSource="true" /> | ||
| 122 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/test/java" isTestSource="true" /> | ||
| 123 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/test/rs" isTestSource="true" /> | ||
| 124 | <sourceFolder url="file://$MODULE_DIR$/../../../app/src/test/shaders" isTestSource="true" /> | ||
| 125 | <excludeFolder url="file://$MODULE_DIR$/../../../app/build" /> | ||
| 126 | </content> | ||
| 127 | <orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" /> | ||
| 128 | <orderEntry type="sourceFolder" forTests="false" /> | ||
| 129 | <orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" /> | ||
| 130 | <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" /> | ||
| 131 | <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" /> | ||
| 132 | <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" /> | ||
| 133 | <orderEntry type="library" scope="TEST" name="Gradle: net.sf.kxml:kxml2:2.3.0@jar" level="project" /> | ||
| 134 | <orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" /> | ||
| 135 | <orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" /> | ||
| 136 | <orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" /> | ||
| 137 | <orderEntry type="library" scope="TEST" name="Gradle: androidx.test.ext:junit:1.1.1@aar" level="project" /> | ||
| 138 | <orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-core:3.2.0@aar" level="project" /> | ||
| 139 | <orderEntry type="library" scope="TEST" name="Gradle: androidx.test:rules:1.3.0-alpha03@aar" level="project" /> | ||
| 140 | <orderEntry type="library" scope="TEST" name="Gradle: androidx.test:runner:1.3.0-alpha03@aar" level="project" /> | ||
| 141 | <orderEntry type="library" scope="TEST" name="Gradle: androidx.test:core:1.2.0@aar" level="project" /> | ||
| 142 | <orderEntry type="library" scope="TEST" name="Gradle: androidx.test:monitor:1.3.0-alpha03@aar" level="project" /> | ||
| 143 | <orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-idling-resource:3.2.0@aar" level="project" /> | ||
| 144 | <orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.13@jar" level="project" /> | ||
| 145 | <orderEntry type="library" name="Gradle: ./../../../Paquetes/librerias/apache-mime4j-0.6.jar" level="project" /> | ||
| 146 | <orderEntry type="library" name="Gradle: ./../../../Paquetes/librerias/httpclient-4.1.2.jar" level="project" /> | ||
| 147 | <orderEntry type="library" name="Gradle: ./../../../Paquetes/librerias/httpclient-cache-4.1.2.jar" level="project" /> | ||
| 148 | <orderEntry type="library" name="Gradle: ./../../../Paquetes/librerias/httpcore-4.1.2.jar" level="project" /> | ||
| 149 | <orderEntry type="library" name="Gradle: ./../../../Paquetes/librerias/httpmime-4.1.2.jar" level="project" /> | ||
| 150 | <orderEntry type="library" name="Gradle: ./../../../Paquetes/librerias/org.apache.httpcomponents.httpclient-4.1.2-sources.jar" level="project" /> | ||
| 151 | <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72@jar" level="project" /> | ||
| 152 | <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72@jar" level="project" /> | ||
| 153 | <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.3.72@jar" level="project" /> | ||
| 154 | <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72@jar" level="project" /> | ||
| 155 | <orderEntry type="library" name="Gradle: org.jetbrains:annotations:13.0@jar" level="project" /> | ||
| 156 | <orderEntry type="library" name="Gradle: androidx.collection:collection:1.1.0@jar" level="project" /> | ||
| 157 | <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.3.0-alpha03@jar" level="project" /> | ||
| 158 | <orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.1.0@jar" level="project" /> | ||
| 159 | <orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.2.0-alpha01@jar" level="project" /> | ||
| 160 | <orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout-solver:1.1.3@jar" level="project" /> | ||
| 161 | <orderEntry type="library" name="Gradle: com.google.zxing:core:3.4.0@jar" level="project" /> | ||
| 162 | <orderEntry type="library" name="Gradle: androidx.core:core-ktx:1.3.0@aar" level="project" /> | ||
| 163 | <orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.3.0-alpha01@aar" level="project" /> | ||
| 164 | <orderEntry type="library" name="Gradle: com.journeyapps:zxing-android-embedded:4.1.0@aar" level="project" /> | ||
| 165 | <orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v4:1.0.0@aar" level="project" /> | ||
| 166 | <orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.1.0@aar" level="project" /> | ||
| 167 | <orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-resources:1.3.0-alpha01@aar" level="project" /> | ||
| 168 | <orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui:1.0.0@aar" level="project" /> | ||
| 169 | <orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" /> | ||
| 170 | <orderEntry type="library" name="Gradle: androidx.media:media:1.0.0@aar" level="project" /> | ||
| 171 | <orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0@aar" level="project" /> | ||
| 172 | <orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0@aar" level="project" /> | ||
| 173 | <orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0@aar" level="project" /> | ||
| 174 | <orderEntry type="library" name="Gradle: androidx.activity:activity:1.0.0@aar" level="project" /> | ||
| 175 | <orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.1.0@aar" level="project" /> | ||
| 176 | <orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.1.0@aar" level="project" /> | ||
| 177 | <orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout:1.0.0@aar" level="project" /> | ||
| 178 | <orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout:1.0.0@aar" level="project" /> | ||
| 179 | <orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" /> | ||
| 180 | <orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:1.0.0@aar" level="project" /> | ||
| 181 | <orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar" level="project" /> | ||
| 182 | <orderEntry type="library" name="Gradle: androidx.core:core:1.4.0-alpha01@aar" level="project" /> | ||
| 183 | <orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" /> | ||
| 184 | <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.3.0-alpha03@aar" level="project" /> | ||
| 185 | <orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.0@aar" level="project" /> | ||
| 186 | <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.3.0-alpha03@aar" level="project" /> | ||
| 187 | <orderEntry type="library" name="Gradle: androidx.documentfile:documentfile:1.0.0@aar" level="project" /> | ||
| 188 | <orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar" level="project" /> | ||
| 189 | <orderEntry type="library" name="Gradle: androidx.print:print:1.0.0@aar" level="project" /> | ||
| 190 | <orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" /> | ||
| 191 | <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar" level="project" /> | ||
| 192 | <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar" level="project" /> | ||
| 193 | <orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" /> | ||
| 194 | <orderEntry type="library" name="Gradle: androidx.savedstate:savedstate:1.1.0-alpha01@aar" level="project" /> | ||
| 195 | <orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar" level="project" /> | ||
| 196 | </component> | ||
| 197 | </module> |
.idea/workspace.xml
| File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | <project version="4"> | ||
| 3 | <component name="AndroidLayouts"> | ||
| 4 | <shared> | ||
| 5 | <config> | ||
| 6 | <device id="Nexus 7 2013" /> | ||
| 7 | <device id="Nexus 7" /> | ||
| 8 | <device id="Nexus 10" /> | ||
| 9 | </config> | ||
| 10 | </shared> | ||
| 11 | </component> | ||
| 12 | <component name="AndroidLogFilters"> | ||
| 13 | <option name="TOOL_WINDOW_LOG_LEVEL" value="debug" /> | ||
| 14 | <option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Show only selected application" /> | ||
| 15 | </component> | ||
| 16 | <component name="ChangeListManager"> | ||
| 17 | <list default="true" id="7c4d117b-8ff3-4bc3-b6f6-6052c7ab28c4" name="Default Changelist" comment="" /> | ||
| 18 | <option name="SHOW_DIALOG" value="false" /> | ||
| 19 | <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||
| 20 | <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | ||
| 21 | <option name="LAST_RESOLUTION" value="IGNORE" /> | ||
| 22 | </component> | ||
| 23 | <component name="ExecutionTargetManager" SELECTED_TARGET="0123456789ABCDEF" /> | ||
| 24 | <component name="ExternalProjectsData"> | ||
| 25 | <projectState path="$PROJECT_DIR$"> | ||
| 26 | <ProjectState /> | ||
| 27 | </projectState> | ||
| 28 | </component> | ||
| 29 | <component name="ExternalProjectsManager"> | ||
| 30 | <system id="GRADLE"> | ||
| 31 | <state> | ||
| 32 | <task path="$PROJECT_DIR$"> | ||
| 33 | <activation /> | ||
| 34 | </task> | ||
| 35 | <projects_view> | ||
| 36 | <tree_state> | ||
| 37 | <expand> | ||
| 38 | <path> | ||
| 39 | <item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" /> | ||
| 40 | <item name="DeboInventario" type="f1a62948:ProjectNode" /> | ||
| 41 | </path> | ||
| 42 | <path> | ||
| 43 | <item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" /> | ||
| 44 | <item name="DeboInventario" type="f1a62948:ProjectNode" /> | ||
| 45 | <item name="Tasks" type="e4a08cd1:TasksNode" /> | ||
| 46 | </path> | ||
| 47 | <path> | ||
| 48 | <item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" /> | ||
| 49 | <item name="DeboInventario" type="f1a62948:ProjectNode" /> | ||
| 50 | <item name="app" type="2d1252cf:ModuleNode" /> | ||
| 51 | </path> | ||
| 52 | </expand> | ||
| 53 | <select /> | ||
| 54 | </tree_state> | ||
| 55 | </projects_view> | ||
| 56 | </state> | ||
| 57 | </system> | ||
| 58 | </component> | ||
| 59 | <component name="FileTemplateManagerImpl"> | ||
| 60 | <option name="RECENT_TEMPLATES"> | ||
| 61 | <list> | ||
| 62 | <option value="Class" /> | ||
| 63 | </list> | ||
| 64 | </option> | ||
| 65 | </component> | ||
| 66 | <component name="ProjectId" id="1eBFznKyT9egM6kYnUt3Lx8OIvO" /> | ||
| 67 | <component name="ProjectLevelVcsManager" settingsEditedManually="true" /> | ||
| 68 | <component name="ProjectViewState"> | ||
| 69 | <option name="autoscrollFromSource" value="true" /> | ||
| 70 | <option name="hideEmptyMiddlePackages" value="true" /> | ||
| 71 | <option name="showExcludedFiles" value="true" /> | ||
| 72 | <option name="showLibraryContents" value="true" /> | ||
| 73 | </component> | ||
| 74 | <component name="PropertiesComponent"> | ||
| 75 | <property name="DeviceAndSnapshotComboBoxAction.selectedDevice" value="Nexus_7_2012_API_27" /> | ||
| 76 | <property name="DeviceAndSnapshotComboBoxAction.selectionTime" value="2020-07-11T00:08:01.736Z" /> | ||
| 77 | <property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> | ||
| 78 | <property name="adb_path" value="C:\Users\mauricio sanchez\AppData\Local\Android\Sdk\platform-tools\adb.exe" /> | ||
| 79 | <property name="last_opened_file_path" value="$PROJECT_DIR$" /> | ||
| 80 | <property name="project.structure.last.edited" value="Project" /> | ||
| 81 | <property name="project.structure.proportion" value="0.17" /> | ||
| 82 | <property name="project.structure.side.proportion" value="0.0" /> | ||
| 83 | <property name="settings.editor.selected.configurable" value="preferences.keymap" /> | ||
| 84 | <property name="show.migrate.to.gradle.popup" value="false" /> | ||
| 85 | </component> | ||
| 86 | <component name="RecentsManager"> | ||
| 87 | <key name="CreateClassDialog.RecentsKey"> | ||
| 88 | <recent name="com.focasoftware.deboinventario" /> | ||
| 89 | </key> | ||
| 90 | </component> | ||
| 91 | <component name="RunManager"> | ||
| 92 | <configuration default="true" type="AndroidJUnit" factoryName="Android JUnit"> | ||
| 93 | <option name="TEST_OBJECT" value="class" /> | ||
| 94 | <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" /> | ||
| 95 | <method v="2"> | ||
| 96 | <option name="Android.Gradle.BeforeRunTask" enabled="true" /> | ||
| 97 | </method> | ||
| 98 | </configuration> | ||
| 99 | <configuration name="app" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false"> | ||
| 100 | <module name="app" /> | ||
| 101 | <option name="DEPLOY" value="true" /> | ||
| 102 | <option name="DEPLOY_APK_FROM_BUNDLE" value="false" /> | ||
| 103 | <option name="DEPLOY_AS_INSTANT" value="false" /> | ||
| 104 | <option name="ARTIFACT_NAME" value="" /> | ||
| 105 | <option name="PM_INSTALL_OPTIONS" value="" /> | ||
| 106 | <option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" /> | ||
| 107 | <option name="ACTIVITY_EXTRA_FLAGS" value="" /> | ||
| 108 | <option name="MODE" value="default_activity" /> | ||
| 109 | <option name="CLEAR_LOGCAT" value="false" /> | ||
| 110 | <option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" /> | ||
| 111 | <option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" /> | ||
| 112 | <option name="FORCE_STOP_RUNNING_APP" value="true" /> | ||
| 113 | <option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" /> | ||
| 114 | <option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" /> | ||
| 115 | <option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" /> | ||
| 116 | <option name="DEBUGGER_TYPE" value="Auto" /> | ||
| 117 | <Auto> | ||
| 118 | <option name="USE_JAVA_AWARE_DEBUGGER" value="false" /> | ||
| 119 | <option name="SHOW_STATIC_VARS" value="true" /> | ||
| 120 | <option name="WORKING_DIR" value="" /> | ||
| 121 | <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" /> | ||
| 122 | <option name="SHOW_OPTIMIZED_WARNING" value="true" /> | ||
| 123 | </Auto> | ||
| 124 | <Hybrid> | ||
| 125 | <option name="USE_JAVA_AWARE_DEBUGGER" value="false" /> | ||
| 126 | <option name="SHOW_STATIC_VARS" value="true" /> | ||
| 127 | <option name="WORKING_DIR" value="" /> | ||
| 128 | <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" /> | ||
| 129 | <option name="SHOW_OPTIMIZED_WARNING" value="true" /> | ||
| 130 | </Hybrid> | ||
| 131 | <Java /> | ||
| 132 | <Native> | ||
| 133 | <option name="USE_JAVA_AWARE_DEBUGGER" value="false" /> | ||
| 134 | <option name="SHOW_STATIC_VARS" value="true" /> | ||
| 135 | <option name="WORKING_DIR" value="" /> | ||
| 136 | <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" /> | ||
| 137 | <option name="SHOW_OPTIMIZED_WARNING" value="true" /> | ||
| 138 | </Native> | ||
| 139 | <Profilers> | ||
| 140 | <option name="ADVANCED_PROFILING_ENABLED" value="false" /> | ||
| 141 | <option name="STARTUP_CPU_PROFILING_ENABLED" value="false" /> | ||
| 142 | <option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" /> | ||
| 143 | </Profilers> | ||
| 144 | <option name="DEEP_LINK" value="" /> | ||
| 145 | <option name="ACTIVITY_CLASS" value="" /> | ||
| 146 | <method v="2"> | ||
| 147 | <option name="Android.Gradle.BeforeRunTask" enabled="true" /> | ||
| 148 | </method> | ||
| 149 | </configuration> | ||
| 150 | </component> | ||
| 151 | <component name="SvnConfiguration"> | ||
| 152 | <configuration /> | ||
| 153 | </component> | ||
| 154 | <component name="TaskManager"> | ||
| 155 | <task active="true" id="Default" summary="Default task"> | ||
| 156 | <changelist id="7c4d117b-8ff3-4bc3-b6f6-6052c7ab28c4" name="Default Changelist" comment="" /> | ||
| 157 | <created>1593787344084</created> | ||
| 158 | <option name="number" value="Default" /> | ||
| 159 | <option name="presentableId" value="Default" /> | ||
| 160 | <updated>1593787344084</updated> | ||
| 161 | </task> | ||
| 162 | <servers /> | ||
| 163 | </component> | ||
| 164 | <component name="VcsManagerConfiguration"> | ||
| 165 | <ignored-roots> | ||
| 166 | <path value="$PROJECT_DIR$" /> | ||
| 167 | </ignored-roots> | ||
| 168 | </component> | ||
| 169 | <component name="WindowStateProjectService"> | ||
| 170 | <state x="197" y="96" key="#PSD" timestamp="1593885939160"> | ||
| 171 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 172 | </state> | ||
| 173 | <state x="197" y="96" key="#PSD/0.0.1360.728@0.0.1360.728" timestamp="1593885939160" /> | ||
| 174 | <state x="435" y="277" key="#com.google.gct.testrecorder.ui.TestClassNameInputDialog" timestamp="1593871958358"> | ||
| 175 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 176 | </state> | ||
| 177 | <state x="435" y="277" key="#com.google.gct.testrecorder.ui.TestClassNameInputDialog/0.0.1360.728@0.0.1360.728" timestamp="1593871958358" /> | ||
| 178 | <state x="485" y="73" key="#com.intellij.ide.util.MemberChooser" timestamp="1594067517204"> | ||
| 179 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 180 | </state> | ||
| 181 | <state x="485" y="73" key="#com.intellij.ide.util.MemberChooser/0.0.1360.728@0.0.1360.728" timestamp="1594067517204" /> | ||
| 182 | <state x="410" y="111" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog" timestamp="1594068262025"> | ||
| 183 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 184 | </state> | ||
| 185 | <state x="410" y="111" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1360.728@0.0.1360.728" timestamp="1594068262025" /> | ||
| 186 | <state x="435" y="67" key="#xdebugger.evaluate" timestamp="1593823546231"> | ||
| 187 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 188 | </state> | ||
| 189 | <state x="435" y="67" key="#xdebugger.evaluate/0.0.1360.728@0.0.1360.728" timestamp="1593823546231" /> | ||
| 190 | <state x="535" y="129" key="AndroidProcessChooserDialog" timestamp="1593805703006"> | ||
| 191 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 192 | </state> | ||
| 193 | <state x="535" y="129" key="AndroidProcessChooserDialog/0.0.1360.728@0.0.1360.728" timestamp="1593805703006" /> | ||
| 194 | <state width="464" height="438" key="DebuggerActiveHint" timestamp="1593792167670"> | ||
| 195 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 196 | </state> | ||
| 197 | <state width="464" height="438" key="DebuggerActiveHint/0.0.1360.728@0.0.1360.728" timestamp="1593792167670" /> | ||
| 198 | <state x="460" y="104" key="FileChooserDialogImpl" timestamp="1593892062771"> | ||
| 199 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 200 | </state> | ||
| 201 | <state x="460" y="104" key="FileChooserDialogImpl/0.0.1360.728@0.0.1360.728" timestamp="1593892062771" /> | ||
| 202 | <state width="1281" height="4" key="GridCell.Tab.0.bottom" timestamp="1594689787959"> | ||
| 203 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 204 | </state> | ||
| 205 | <state width="1281" height="4" key="GridCell.Tab.0.bottom/0.0.1360.728@0.0.1360.728" timestamp="1594689787959" /> | ||
| 206 | <state width="1281" height="4" key="GridCell.Tab.0.center" timestamp="1594689787959"> | ||
| 207 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 208 | </state> | ||
| 209 | <state width="1281" height="4" key="GridCell.Tab.0.center/0.0.1360.728@0.0.1360.728" timestamp="1594689787959" /> | ||
| 210 | <state width="1281" height="4" key="GridCell.Tab.0.left" timestamp="1594689787958"> | ||
| 211 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 212 | </state> | ||
| 213 | <state width="1281" height="4" key="GridCell.Tab.0.left/0.0.1360.728@0.0.1360.728" timestamp="1594689787958" /> | ||
| 214 | <state width="1281" height="4" key="GridCell.Tab.0.right" timestamp="1594689787959"> | ||
| 215 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 216 | </state> | ||
| 217 | <state width="1281" height="4" key="GridCell.Tab.0.right/0.0.1360.728@0.0.1360.728" timestamp="1594689787959" /> | ||
| 218 | <state width="1281" height="4" key="GridCell.Tab.1.bottom" timestamp="1594689787959"> | ||
| 219 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 220 | </state> | ||
| 221 | <state width="1281" height="4" key="GridCell.Tab.1.bottom/0.0.1360.728@0.0.1360.728" timestamp="1594689787959" /> | ||
| 222 | <state width="1281" height="4" key="GridCell.Tab.1.center" timestamp="1594689787959"> | ||
| 223 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 224 | </state> | ||
| 225 | <state width="1281" height="4" key="GridCell.Tab.1.center/0.0.1360.728@0.0.1360.728" timestamp="1594689787959" /> | ||
| 226 | <state width="1281" height="4" key="GridCell.Tab.1.left" timestamp="1594689787959"> | ||
| 227 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 228 | </state> | ||
| 229 | <state width="1281" height="4" key="GridCell.Tab.1.left/0.0.1360.728@0.0.1360.728" timestamp="1594689787959" /> | ||
| 230 | <state width="1281" height="4" key="GridCell.Tab.1.right" timestamp="1594689787959"> | ||
| 231 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 232 | </state> | ||
| 233 | <state width="1281" height="4" key="GridCell.Tab.1.right/0.0.1360.728@0.0.1360.728" timestamp="1594689787959" /> | ||
| 234 | <state x="181" y="8" key="SettingsEditor" timestamp="1593886025825"> | ||
| 235 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 236 | </state> | ||
| 237 | <state x="181" y="8" key="SettingsEditor/0.0.1360.728@0.0.1360.728" timestamp="1593886025825" /> | ||
| 238 | <state x="92" y="92" width="1176" height="544" key="com.android.tools.idea.avdmanager.AvdListDialog" timestamp="1594234076831"> | ||
| 239 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 240 | </state> | ||
| 241 | <state x="92" y="92" width="1176" height="544" key="com.android.tools.idea.avdmanager.AvdListDialog/0.0.1360.728@0.0.1360.728" timestamp="1594234076831" /> | ||
| 242 | <state x="223" y="101" key="com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory$2" timestamp="1594133697506"> | ||
| 243 | <screen x="0" y="0" width="1360" height="728" /> | ||
| 244 | </state> | ||
| 245 | <state x="223" y="101" key="com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory$2/0.0.1360.728@0.0.1360.728" timestamp="1594133697506" /> | ||
| 246 | </component> | ||
| 247 | <component name="XDebuggerManager"> | ||
| 248 | <breakpoint-manager> | ||
| 249 | <breakpoints> | ||
| 250 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 251 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/BaseDatos.java</url> | ||
| 252 | <line>4892</line> | ||
| 253 | <option name="timeStamp" value="22" /> | ||
| 254 | </line-breakpoint> | ||
| 255 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 256 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/HttpSender.java</url> | ||
| 257 | <line>17</line> | ||
| 258 | <option name="timeStamp" value="24" /> | ||
| 259 | </line-breakpoint> | ||
| 260 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 261 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/InventarioMainBoard.java</url> | ||
| 262 | <line>708</line> | ||
| 263 | <option name="timeStamp" value="30" /> | ||
| 264 | </line-breakpoint> | ||
| 265 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 266 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/HttpSender.java</url> | ||
| 267 | <line>141</line> | ||
| 268 | <option name="timeStamp" value="31" /> | ||
| 269 | </line-breakpoint> | ||
| 270 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 271 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/InventarioMainBoard.java</url> | ||
| 272 | <line>2383</line> | ||
| 273 | <option name="timeStamp" value="32" /> | ||
| 274 | </line-breakpoint> | ||
| 275 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 276 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/BaseDatos.java</url> | ||
| 277 | <line>2282</line> | ||
| 278 | <option name="timeStamp" value="35" /> | ||
| 279 | </line-breakpoint> | ||
| 280 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 281 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/HttpWriter.java</url> | ||
| 282 | <line>92</line> | ||
| 283 | <option name="timeStamp" value="46" /> | ||
| 284 | </line-breakpoint> | ||
| 285 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 286 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/HttpWriter.java</url> | ||
| 287 | <line>94</line> | ||
| 288 | <option name="timeStamp" value="47" /> | ||
| 289 | </line-breakpoint> | ||
| 290 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 291 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/PaginaInventarioDinamico.java</url> | ||
| 292 | <line>408</line> | ||
| 293 | <option name="timeStamp" value="70" /> | ||
| 294 | </line-breakpoint> | ||
| 295 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 296 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/BaseDatos.java</url> | ||
| 297 | <line>12114</line> | ||
| 298 | <option name="timeStamp" value="77" /> | ||
| 299 | </line-breakpoint> | ||
| 300 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 301 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/BaseDatos.java</url> | ||
| 302 | <line>12088</line> | ||
| 303 | <option name="timeStamp" value="80" /> | ||
| 304 | </line-breakpoint> | ||
| 305 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 306 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/HttpWriter.java</url> | ||
| 307 | <line>66</line> | ||
| 308 | <option name="timeStamp" value="84" /> | ||
| 309 | </line-breakpoint> | ||
| 310 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 311 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/HttpSender.java</url> | ||
| 312 | <line>161</line> | ||
| 313 | <option name="timeStamp" value="85" /> | ||
| 314 | </line-breakpoint> | ||
| 315 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 316 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/BaseDatos.java</url> | ||
| 317 | <line>9337</line> | ||
| 318 | <option name="timeStamp" value="87" /> | ||
| 319 | </line-breakpoint> | ||
| 320 | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||
| 321 | <url>file://$PROJECT_DIR$/app/src/main/java/com/focasoftware/deboinventario/HttpWriter.java</url> | ||
| 322 | <line>52</line> | ||
| 323 | <option name="timeStamp" value="88" /> | ||
| 324 | </line-breakpoint> | ||
| 325 | </breakpoints> | ||
| 326 | </breakpoint-manager> | ||
| 327 | <watches-manager> | ||
| 328 | <configuration name="app"> | ||
| 329 | <watch expression="document" /> | ||
| 330 | </configuration> | ||
| 331 | </watches-manager> | ||
| 332 | </component> | ||
| 333 | </project> |
app/src/main/java/com/focasoftware/deboinventario/BaseDatos.java
| 1 | package com.focasoftware.deboinventario; | 1 | package com.focasoftware.deboinventario; |
| 2 | //import android.content.ContentValues; | 2 | //import android.content.ContentValues; |
| 3 | //import android.content.Context; | 3 | //import android.content.Context; |
| 4 | //import android.database.Cursor; | 4 | //import android.database.Cursor; |
| 5 | //import android.database.sqlite.SQLiteDatabase; | 5 | //import android.database.sqlite.SQLiteDatabase; |
| 6 | //import android.database.sqlite.SQLiteDatabase.CursorFactory; | 6 | //import android.database.sqlite.SQLiteDatabase.CursorFactory; |
| 7 | //import android.database.sqlite.SQLiteOpenHelper; | 7 | //import android.database.sqlite.SQLiteOpenHelper; |
| 8 | //import android.widget.RadioGroup; | 8 | //import android.widget.RadioGroup; |
| 9 | // | 9 | // |
| 10 | //import com.focasoftware.deboinventario.Articulo; | 10 | //import com.focasoftware.deboinventario.Articulo; |
| 11 | //import com.focasoftware.deboinventario.ExceptionBDD; | 11 | //import com.focasoftware.deboinventario.ExceptionBDD; |
| 12 | //import com.focasoftware.deboinventario.ExceptionHttpExchange; | 12 | //import com.focasoftware.deboinventario.ExceptionHttpExchange; |
| 13 | //import com.focasoftware.deboinventario.GestorLogEventos; | 13 | //import com.focasoftware.deboinventario.GestorLogEventos; |
| 14 | //import com.focasoftware.deboinventario.HttpSender; | 14 | //import com.focasoftware.deboinventario.HttpSender; |
| 15 | //import com.focasoftware.deboinventario.HttpWriter; | 15 | //import com.focasoftware.deboinventario.HttpWriter; |
| 16 | //import com.focasoftware.deboinventario.Parametros; | 16 | //import com.focasoftware.deboinventario.Parametros; |
| 17 | // | 17 | // |
| 18 | //import org.w3c.dom.Document; | 18 | //import org.w3c.dom.Document; |
| 19 | //import org.w3c.dom.Element; | 19 | //import org.w3c.dom.Element; |
| 20 | // | 20 | // |
| 21 | //import java.io.File; | 21 | //import java.io.File; |
| 22 | //import java.io.IOException; | 22 | //import java.io.IOException; |
| 23 | //import java.text.SimpleDateFormat; | 23 | //import java.text.SimpleDateFormat; |
| 24 | //import java.util.ArrayList; | 24 | //import java.util.ArrayList; |
| 25 | //import java.util.Arrays; | 25 | //import java.util.Arrays; |
| 26 | //import java.util.Calendar; | 26 | //import java.util.Calendar; |
| 27 | //import java.util.Date; | 27 | //import java.util.Date; |
| 28 | //import java.util.HashMap; | 28 | //import java.util.HashMap; |
| 29 | // | 29 | // |
| 30 | //import javax.xml.parsers.DocumentBuilder; | 30 | //import javax.xml.parsers.DocumentBuilder; |
| 31 | //import javax.xml.parsers.DocumentBuilderFactory; | 31 | //import javax.xml.parsers.DocumentBuilderFactory; |
| 32 | //import javax.xml.parsers.ParserConfigurationException; | 32 | //import javax.xml.parsers.ParserConfigurationException; |
| 33 | // | 33 | // |
| 34 | ///** | 34 | ///** |
| 35 | // * Clase que maneja las conexiones y todas las operaciones de las Bases de | 35 | // * Clase que maneja las conexiones y todas las operaciones de las Bases de |
| 36 | // * Datos. | 36 | // * Datos. |
| 37 | // * | 37 | // * |
| 38 | // * @author GuillermoR | 38 | // * @author GuillermoR |
| 39 | // * | 39 | // * |
| 40 | // */ | 40 | // */ |
| 41 | // | 41 | // |
| 42 | //public class BaseDatos extends SQLiteOpenHelper { | 42 | //public class BaseDatos extends SQLiteOpenHelper { |
| 43 | // | 43 | // |
| 44 | // // ************************* | 44 | // // ************************* |
| 45 | // // ************************* | 45 | // // ************************* |
| 46 | // // **** ATRIBUTOS **** | 46 | // // **** ATRIBUTOS **** |
| 47 | // // ************************* | 47 | // // ************************* |
| 48 | // // ************************* | 48 | // // ************************* |
| 49 | // // | 49 | // // |
| 50 | // | 50 | // |
| 51 | // /** | 51 | // /** |
| 52 | // * Nombres de las Tablas de la base de datos parametrizadas | 52 | // * Nombres de las Tablas de la base de datos parametrizadas |
| 53 | // */ | 53 | // */ |
| 54 | // | 54 | // |
| 55 | // private String tabla_articulos_nombre = ParametrosInventario.tabla_articulos; | 55 | // private String tabla_articulos_nombre = ParametrosInventario.tabla_articulos; |
| 56 | // private String tabla_inventarios_nombre = ParametrosInventario.tabla_inventarios; | 56 | // private String tabla_inventarios_nombre = ParametrosInventario.tabla_inventarios; |
| 57 | // private String tabla_referencias_nombre = ParametrosInventario.tabla_referencias; | 57 | // private String tabla_referencias_nombre = ParametrosInventario.tabla_referencias; |
| 58 | // | 58 | // |
| 59 | // private String tabla_proveedores_nombre = ParametrosInventario.tabla_proveedores; | 59 | // private String tabla_proveedores_nombre = ParametrosInventario.tabla_proveedores; |
| 60 | // private String tabla_compraproveedor_nombre = ParametrosInventario.tabla_compra_proveedor; | 60 | // private String tabla_compraproveedor_nombre = ParametrosInventario.tabla_compra_proveedor; |
| 61 | // | 61 | // |
| 62 | // private RadioGroup RadioGroupProductosNoContabilizados; | 62 | // private RadioGroup RadioGroupProductosNoContabilizados; |
| 63 | // private int ProductosNoContabilizados; | 63 | // private int ProductosNoContabilizados; |
| 64 | // | 64 | // |
| 65 | // private int condR =0; | 65 | // private int condR =0; |
| 66 | // | 66 | // |
| 67 | // /*Variable para cuando esta activada la balanza*/ | 67 | // /*Variable para cuando esta activada la balanza*/ |
| 68 | // private String codcompleto = ""; | 68 | // private String codcompleto = ""; |
| 69 | // private String pesoObtenido = ""; | 69 | // private String pesoObtenido = ""; |
| 70 | // | 70 | // |
| 71 | // /** | 71 | // /** |
| 72 | // * Variables para almacenar las SQLs de Creaci๏ฟฝn de las tablas: | 72 | // * Variables para almacenar las SQLs de Creaci๏ฟฝn de las tablas: |
| 73 | // */ | 73 | // */ |
| 74 | // private String sqlCreateTablaArticulos = "CREATE TABLE IF NOT EXISTS " | 74 | // private String sqlCreateTablaArticulos = "CREATE TABLE IF NOT EXISTS " |
| 75 | // + tabla_articulos_nombre + " (" | 75 | // + tabla_articulos_nombre + " (" |
| 76 | // + ParametrosInventario.bal_bdd_articulo_sector + " INTEGER" + ", " | 76 | // + ParametrosInventario.bal_bdd_articulo_sector + " INTEGER" + ", " |
| 77 | // + ParametrosInventario.bal_bdd_articulo_codigo + " INTEGER" + ", " | 77 | // + ParametrosInventario.bal_bdd_articulo_codigo + " INTEGER" + ", " |
| 78 | // + ParametrosInventario.bal_bdd_articulo_balanza + " INTEGER" + ", " | 78 | // + ParametrosInventario.bal_bdd_articulo_balanza + " INTEGER" + ", " |
| 79 | // + ParametrosInventario.bal_bdd_articulo_decimales + " INTEGER" + ", " | 79 | // + ParametrosInventario.bal_bdd_articulo_decimales + " INTEGER" + ", " |
| 80 | // + ParametrosInventario.bal_bdd_articulo_codigo_barra | 80 | // + ParametrosInventario.bal_bdd_articulo_codigo_barra |
| 81 | // + " VARCHAR(150) DEFAULT '' " + ", " | 81 | // + " VARCHAR(150) DEFAULT '' " + ", " |
| 82 | // + ParametrosInventario.bal_bdd_articulo_codigo_barra_completo | 82 | // + ParametrosInventario.bal_bdd_articulo_codigo_barra_completo |
| 83 | // + " VARCHAR(150) DEFAULT '' " + ", " | 83 | // + " VARCHAR(150) DEFAULT '' " + ", " |
| 84 | // + ParametrosInventario.bal_bdd_articulo_inventario + " INTEGER" | 84 | // + ParametrosInventario.bal_bdd_articulo_inventario + " INTEGER" |
| 85 | // + ", " + ParametrosInventario.bal_bdd_articulo_descripcion | 85 | // + ", " + ParametrosInventario.bal_bdd_articulo_descripcion |
| 86 | // + " VARCHAR(50)" + ", " | 86 | // + " VARCHAR(50)" + ", " |
| 87 | // + ParametrosInventario.bal_bdd_articulo_precio_venta + " REAL" | 87 | // + ParametrosInventario.bal_bdd_articulo_precio_venta + " REAL" |
| 88 | // + ", " + ParametrosInventario.bal_bdd_articulo_precio_costo | 88 | // + ", " + ParametrosInventario.bal_bdd_articulo_precio_costo |
| 89 | // + " REAL" + ", " + ParametrosInventario.bal_bdd_articulo_foto | 89 | // + " REAL" + ", " + ParametrosInventario.bal_bdd_articulo_foto |
| 90 | // + " VARCHAR(100)" + ", " | 90 | // + " VARCHAR(100)" + ", " |
| 91 | // + ParametrosInventario.bal_bdd_articulo_cantidad + " FLOAT" | 91 | // + ParametrosInventario.bal_bdd_articulo_cantidad + " FLOAT" |
| 92 | // + ", " | 92 | // + ", " |
| 93 | // + ParametrosInventario.bal_bdd_articulo_subtotal + " FLOAT" | 93 | // + ParametrosInventario.bal_bdd_articulo_subtotal + " FLOAT" |
| 94 | // + ", " | 94 | // + ", " |
| 95 | // + ParametrosInventario.bal_bdd_articulo_pesaje + " FLOAT" | 95 | // + ParametrosInventario.bal_bdd_articulo_pesaje + " FLOAT" |
| 96 | // + ", " | 96 | // + ", " |
| 97 | // + ParametrosInventario.bal_bdd_articulo_existencia_venta + " REAL" | 97 | // + ParametrosInventario.bal_bdd_articulo_existencia_venta + " REAL" |
| 98 | // + ", " | 98 | // + ", " |
| 99 | // + ParametrosInventario.bal_bdd_articulo_existencia_deposito + " REAL" | 99 | // + ParametrosInventario.bal_bdd_articulo_existencia_deposito + " REAL" |
| 100 | // + ", " | 100 | // + ", " |
| 101 | // + ParametrosInventario.bal_bdd_articulo_depsn | 101 | // + ParametrosInventario.bal_bdd_articulo_depsn |
| 102 | // + " INTEGER" + ", " | 102 | // + " INTEGER" + ", " |
| 103 | // + ParametrosInventario.bal_bdd_articulo_fechaInicio | 103 | // + ParametrosInventario.bal_bdd_articulo_fechaInicio |
| 104 | // + " VARCHAR(24)" + ", " | 104 | // + " VARCHAR(24)" + ", " |
| 105 | // + ParametrosInventario.bal_bdd_articulo_fechaFin + " VARCHAR(24)" | 105 | // + ParametrosInventario.bal_bdd_articulo_fechaFin + " VARCHAR(24)" |
| 106 | // + ", " + "PRIMARY KEY (" | 106 | // + ", " + "PRIMARY KEY (" |
| 107 | // + ParametrosInventario.bal_bdd_articulo_sector + ", " | 107 | // + ParametrosInventario.bal_bdd_articulo_sector + ", " |
| 108 | // + ParametrosInventario.bal_bdd_articulo_codigo + ", " | 108 | // + ParametrosInventario.bal_bdd_articulo_codigo + ", " |
| 109 | // + ParametrosInventario.bal_bdd_articulo_inventario + ")" + " )"; | 109 | // + ParametrosInventario.bal_bdd_articulo_inventario + ")" + " )"; |
| 110 | // | 110 | // |
| 111 | // /** | 111 | // /** |
| 112 | // * Creacion de la tabla proveedores: | 112 | // * Creacion de la tabla proveedores: |
| 113 | // */ | 113 | // */ |
| 114 | // private String sqlCreateTablaProveedores = "CREATE TABLE IF NOT EXISTS " | 114 | // private String sqlCreateTablaProveedores = "CREATE TABLE IF NOT EXISTS " |
| 115 | // + tabla_proveedores_nombre + " (" | 115 | // + tabla_proveedores_nombre + " (" |
| 116 | // + ParametrosInventario.bal_bdd_proveedores_codigo + " INTEGER" + ", " | 116 | // + ParametrosInventario.bal_bdd_proveedores_codigo + " INTEGER" + ", " |
| 117 | // + ParametrosInventario.bal_bdd_proveedores_descripcion | 117 | // + ParametrosInventario.bal_bdd_proveedores_descripcion |
| 118 | // + " VARCHAR(150) NULL " + ", " + "PRIMARY KEY (" | 118 | // + " VARCHAR(150) NULL " + ", " + "PRIMARY KEY (" |
| 119 | // + ParametrosInventario.bal_bdd_proveedores_codigo + ")" + " )"; | 119 | // + ParametrosInventario.bal_bdd_proveedores_codigo + ")" + " )"; |
| 120 | // | 120 | // |
| 121 | // /** | 121 | // /** |
| 122 | // * Creacion de la tabla COMPRA_PROVEEDOR para relacionar la compra con un proveedor: | 122 | // * Creacion de la tabla COMPRA_PROVEEDOR para relacionar la compra con un proveedor: |
| 123 | // */ | 123 | // */ |
| 124 | // private String sqlCreateTablaCompraProveedor = "CREATE TABLE IF NOT EXISTS " | 124 | // private String sqlCreateTablaCompraProveedor = "CREATE TABLE IF NOT EXISTS " |
| 125 | // + tabla_compraproveedor_nombre + " (" | 125 | // + tabla_compraproveedor_nombre + " (" |
| 126 | // + ParametrosInventario.bal_bdd_compraproveedor_inventario + " INTEGER" + ", " | 126 | // + ParametrosInventario.bal_bdd_compraproveedor_inventario + " INTEGER" + ", " |
| 127 | // + ParametrosInventario.bal_bdd_compraproveedor_codigo | 127 | // + ParametrosInventario.bal_bdd_compraproveedor_codigo |
| 128 | // + " INTEGER )"; | 128 | // + " INTEGER )"; |
| 129 | // | 129 | // |
| 130 | // | 130 | // |
| 131 | // private String sqlCreateTablaInventarios = "CREATE TABLE IF NOT EXISTS " | 131 | // private String sqlCreateTablaInventarios = "CREATE TABLE IF NOT EXISTS " |
| 132 | // + tabla_inventarios_nombre + " (" | 132 | // + tabla_inventarios_nombre + " (" |
| 133 | // + ParametrosInventario.bal_bdd_inventario_numero + " INTEGER" | 133 | // + ParametrosInventario.bal_bdd_inventario_numero + " INTEGER" |
| 134 | // + ", " + ParametrosInventario.bal_bdd_inventario_descripcion | 134 | // + ", " + ParametrosInventario.bal_bdd_inventario_descripcion |
| 135 | // + " VARCHAR(50)" + ", " | 135 | // + " VARCHAR(50)" + ", " |
| 136 | // + ParametrosInventario.bal_bdd_inventario_fechaInicio | 136 | // + ParametrosInventario.bal_bdd_inventario_fechaInicio |
| 137 | // + " VARCHAR(24)" + ", " | 137 | // + " VARCHAR(24)" + ", " |
| 138 | // + ParametrosInventario.bal_bdd_inventario_fechaFin + " VARCHAR(24)" | 138 | // + ParametrosInventario.bal_bdd_inventario_fechaFin + " VARCHAR(24)" |
| 139 | // + ", " + ParametrosInventario.bal_bdd_inventario_estado | 139 | // + ", " + ParametrosInventario.bal_bdd_inventario_estado |
| 140 | // + " INTEGER" + ", " + ParametrosInventario.bal_bdd_inventario_lugar | 140 | // + " INTEGER" + ", " + ParametrosInventario.bal_bdd_inventario_lugar |
| 141 | // + " INTEGER" + ", " | 141 | // + " INTEGER" + ", " |
| 142 | // + ParametrosInventario.bal_bdd_inventario_prodcont | 142 | // + ParametrosInventario.bal_bdd_inventario_prodcont |
| 143 | // + " INTEGER" + ", "+ "PRIMARY KEY (" | 143 | // + " INTEGER" + ", "+ "PRIMARY KEY (" |
| 144 | // + ParametrosInventario.bal_bdd_inventario_numero + ")" + " )"; | 144 | // + ParametrosInventario.bal_bdd_inventario_numero + ")" + " )"; |
| 145 | // | 145 | // |
| 146 | // private String sqlCreateTablaReferencias = "CREATE TABLE IF NOT EXISTS " | 146 | // private String sqlCreateTablaReferencias = "CREATE TABLE IF NOT EXISTS " |
| 147 | // + tabla_referencias_nombre + " (" | 147 | // + tabla_referencias_nombre + " (" |
| 148 | // + ParametrosInventario.bal_bdd_referencia_sector + " INTEGER" | 148 | // + ParametrosInventario.bal_bdd_referencia_sector + " INTEGER" |
| 149 | // + ", " + ParametrosInventario.bal_bdd_referencia_codigo | 149 | // + ", " + ParametrosInventario.bal_bdd_referencia_codigo |
| 150 | // + " INTEGER" + ", " | 150 | // + " INTEGER" + ", " |
| 151 | // + ParametrosInventario.bal_bdd_referencia_balanza | 151 | // + ParametrosInventario.bal_bdd_referencia_balanza |
| 152 | // + " INTEGER" + ", " | 152 | // + " INTEGER" + ", " |
| 153 | // + ParametrosInventario.bal_bdd_referencia_decimales | 153 | // + ParametrosInventario.bal_bdd_referencia_decimales |
| 154 | // + " INTEGER" + ", " | 154 | // + " INTEGER" + ", " |
| 155 | // + ParametrosInventario.bal_bdd_referencia_existencia_venta | 155 | // + ParametrosInventario.bal_bdd_referencia_existencia_venta |
| 156 | // + " REAL" + ", " | 156 | // + " REAL" + ", " |
| 157 | // + ParametrosInventario.bal_bdd_referencia_existencia_deposito | 157 | // + ParametrosInventario.bal_bdd_referencia_existencia_deposito |
| 158 | // + " REAL" + ", " | 158 | // + " REAL" + ", " |
| 159 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra | 159 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra |
| 160 | // + " VARCHAR(150)" + ", " | 160 | // + " VARCHAR(150)" + ", " |
| 161 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra_completo | 161 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra_completo |
| 162 | // + " VARCHAR(150)" + ", " | 162 | // + " VARCHAR(150)" + ", " |
| 163 | // + ParametrosInventario.bal_bdd_referencia_descripcion | 163 | // + ParametrosInventario.bal_bdd_referencia_descripcion |
| 164 | // + " VARCHAR(50)" + ", " | 164 | // + " VARCHAR(50)" + ", " |
| 165 | // + ParametrosInventario.bal_bdd_referencia_precio_venta | 165 | // + ParametrosInventario.bal_bdd_referencia_precio_venta |
| 166 | // + " REAL" | 166 | // + " REAL" |
| 167 | // + ", " | 167 | // + ", " |
| 168 | // + ParametrosInventario.bal_bdd_referencia_precio_costo | 168 | // + ParametrosInventario.bal_bdd_referencia_precio_costo |
| 169 | // + " REAL" + ", " | 169 | // + " REAL" + ", " |
| 170 | // + ParametrosInventario.bal_bdd_referencia_depsn | 170 | // + ParametrosInventario.bal_bdd_referencia_depsn |
| 171 | // + " INTEGER" + ", " | 171 | // + " INTEGER" + ", " |
| 172 | // + ParametrosInventario.bal_bdd_referencia_foto | 172 | // + ParametrosInventario.bal_bdd_referencia_foto |
| 173 | // + " VARCHAR(100)" + ", " + "PRIMARY KEY (" | 173 | // + " VARCHAR(100)" + ", " + "PRIMARY KEY (" |
| 174 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + ")" + " )"; | 174 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + ")" + " )"; |
| 175 | // | 175 | // |
| 176 | // private String sqlCreateTableLocales = "CREATE TABLE IF NOT EXISTS [" | 176 | // private String sqlCreateTableLocales = "CREATE TABLE IF NOT EXISTS [" |
| 177 | // + ParametrosInventario.tabla_local + "] ( " + "[" | 177 | // + ParametrosInventario.tabla_local + "] ( " + "[" |
| 178 | // + ParametrosInventario.bal_bdd_local_idLocal | 178 | // + ParametrosInventario.bal_bdd_local_idLocal |
| 179 | // + "] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," + "[" | 179 | // + "] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," + "[" |
| 180 | // + ParametrosInventario.bal_bdd_local_nombre | 180 | // + ParametrosInventario.bal_bdd_local_nombre |
| 181 | // + "] VARCHAR(25) DEFAULT ''," + "[" | 181 | // + "] VARCHAR(25) DEFAULT ''," + "[" |
| 182 | // + ParametrosInventario.bal_bdd_local_descripcion | 182 | // + ParametrosInventario.bal_bdd_local_descripcion |
| 183 | // + "] VARCHAR(512) DEFAULT ''" + ")"; | 183 | // + "] VARCHAR(512) DEFAULT ''" + ")"; |
| 184 | // | 184 | // |
| 185 | // // ***************************** | 185 | // // ***************************** |
| 186 | // // ***************************** | 186 | // // ***************************** |
| 187 | // // **** CONSTRUCTORES **** | 187 | // // **** CONSTRUCTORES **** |
| 188 | // // ***************************** | 188 | // // ***************************** |
| 189 | // // ***************************** | 189 | // // ***************************** |
| 190 | // | 190 | // |
| 191 | // /** | 191 | // /** |
| 192 | // * Constructor de la clase BaseDatos | 192 | // * Constructor de la clase BaseDatos |
| 193 | // * | 193 | // * |
| 194 | // * @param contexto | 194 | // * @param contexto |
| 195 | // * @param nombre | 195 | // * @param nombre |
| 196 | // * @param factory | 196 | // * @param factory |
| 197 | // * @param version | 197 | // * @param version |
| 198 | // */ | 198 | // */ |
| 199 | // public BaseDatos(Context contexto, String nombre, CursorFactory factory, | 199 | // public BaseDatos(Context contexto, String nombre, CursorFactory factory, |
| 200 | // int version) { | 200 | // int version) { |
| 201 | // super(contexto, ParametrosInventario.BDD_NOMBRE, null, | 201 | // super(contexto, ParametrosInventario.BDD_NOMBRE, null, |
| 202 | // ParametrosInventario.BDD_VERSION); | 202 | // ParametrosInventario.BDD_VERSION); |
| 203 | // } | 203 | // } |
| 204 | // | 204 | // |
| 205 | // /** | 205 | // /** |
| 206 | // * Constructor de la clase BaseDatos con 2 parametros | 206 | // * Constructor de la clase BaseDatos con 2 parametros |
| 207 | // * | 207 | // * |
| 208 | // * @param contexto | 208 | // * @param contexto |
| 209 | // */ | 209 | // */ |
| 210 | // public BaseDatos(Context contexto) { | 210 | // public BaseDatos(Context contexto) { |
| 211 | // this(contexto, ParametrosInventario.BDD_NOMBRE, null, | 211 | // this(contexto, ParametrosInventario.BDD_NOMBRE, null, |
| 212 | // ParametrosInventario.BDD_VERSION); | 212 | // ParametrosInventario.BDD_VERSION); |
| 213 | // System.out.println("::: BaseDatos 177 Version en BD " + ParametrosInventario.VERSION); | 213 | // System.out.println("::: BaseDatos 177 Version en BD " + ParametrosInventario.VERSION); |
| 214 | // } | 214 | // } |
| 215 | // | 215 | // |
| 216 | // // *********************** | 216 | // // *********************** |
| 217 | // // *********************** | 217 | // // *********************** |
| 218 | // // **** METODOS **** | 218 | // // **** METODOS **** |
| 219 | // // *********************** | 219 | // // *********************** |
| 220 | // // *********************** | 220 | // // *********************** |
| 221 | // /** | 221 | // /** |
| 222 | // * Al llamarse este metodo se crean las tablas de nuevo? | 222 | // * Al llamarse este metodo se crean las tablas de nuevo? |
| 223 | // */ | 223 | // */ |
| 224 | // @Override | 224 | // @Override |
| 225 | // public void onCreate(SQLiteDatabase db) { | 225 | // public void onCreate(SQLiteDatabase db) { |
| 226 | // // Se ejecuta la sentencia SQL de creaci๏ฟฝn de la tabla | 226 | // // Se ejecuta la sentencia SQL de creaci๏ฟฝn de la tabla |
| 227 | // db.execSQL(sqlCreateTablaArticulos); | 227 | // db.execSQL(sqlCreateTablaArticulos); |
| 228 | // db.execSQL(sqlCreateTablaInventarios); | 228 | // db.execSQL(sqlCreateTablaInventarios); |
| 229 | // db.execSQL(sqlCreateTablaReferencias); | 229 | // db.execSQL(sqlCreateTablaReferencias); |
| 230 | // db.execSQL(sqlCreateTableLocales); | 230 | // db.execSQL(sqlCreateTableLocales); |
| 231 | // db.execSQL(sqlCreateTablaProveedores); | 231 | // db.execSQL(sqlCreateTablaProveedores); |
| 232 | // db.execSQL(sqlCreateTablaCompraProveedor); | 232 | // db.execSQL(sqlCreateTablaCompraProveedor); |
| 233 | // } | 233 | // } |
| 234 | // | 234 | // |
| 235 | // /** | 235 | // /** |
| 236 | // * Funcion para crear desde cero y vaciar las tablas de articulos e | 236 | // * Funcion para crear desde cero y vaciar las tablas de articulos e |
| 237 | // * inventarios | 237 | // * inventarios |
| 238 | // * <p> | 238 | // * <p> |
| 239 | // * 1๏ฟฝ Las borramos | 239 | // * 1๏ฟฝ Las borramos |
| 240 | // * <p> | 240 | // * <p> |
| 241 | // * 2๏ฟฝ Las creamos de nuevo | 241 | // * 2๏ฟฝ Las creamos de nuevo |
| 242 | // */ | 242 | // */ |
| 243 | // public void reiniciarArticulosInventarios() { | 243 | // public void reiniciarArticulosInventarios() { |
| 244 | // System.out.println("::: BaseDatos 206 reiniciarArticulosInventarios"); | 244 | // System.out.println("::: BaseDatos 206 reiniciarArticulosInventarios"); |
| 245 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 245 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 246 | // | 246 | // |
| 247 | // // 1๏ฟฝ Las borramos | 247 | // // 1๏ฟฝ Las borramos |
| 248 | // dtb.execSQL("DROP TABLE IF EXISTS " + tabla_articulos_nombre); | 248 | // dtb.execSQL("DROP TABLE IF EXISTS " + tabla_articulos_nombre); |
| 249 | // dtb.execSQL("DROP TABLE IF EXISTS " + tabla_inventarios_nombre); | 249 | // dtb.execSQL("DROP TABLE IF EXISTS " + tabla_inventarios_nombre); |
| 250 | // | 250 | // |
| 251 | // // 2๏ฟฝ Las creamos de nuevo | 251 | // // 2๏ฟฝ Las creamos de nuevo |
| 252 | // dtb.execSQL(sqlCreateTablaArticulos); | 252 | // dtb.execSQL(sqlCreateTablaArticulos); |
| 253 | // dtb.execSQL(sqlCreateTablaInventarios); | 253 | // dtb.execSQL(sqlCreateTablaInventarios); |
| 254 | // | 254 | // |
| 255 | // dtb.close(); | 255 | // dtb.close(); |
| 256 | // | 256 | // |
| 257 | // } | 257 | // } |
| 258 | // | 258 | // |
| 259 | // public void crearTablaLocales() { | 259 | // public void crearTablaLocales() { |
| 260 | // System.out.println("::: BaseDatos 222 crearTablaLocales"); | 260 | // System.out.println("::: BaseDatos 222 crearTablaLocales"); |
| 261 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 261 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 262 | // dtb.execSQL(sqlCreateTableLocales); | 262 | // dtb.execSQL(sqlCreateTableLocales); |
| 263 | // dtb.close(); | 263 | // dtb.close(); |
| 264 | // } | 264 | // } |
| 265 | // | 265 | // |
| 266 | // public void guardarLocal(Local pLocal) { | 266 | // public void guardarLocal(Local pLocal) { |
| 267 | // try { | 267 | // try { |
| 268 | // System.out.println("::: BaseDatos 230 guardarLocal"); | 268 | // System.out.println("::: BaseDatos 230 guardarLocal"); |
| 269 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 269 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 270 | // if (dtb != null) { | 270 | // if (dtb != null) { |
| 271 | // | 271 | // |
| 272 | // ContentValues nuevoRegistro = new ContentValues(); | 272 | // ContentValues nuevoRegistro = new ContentValues(); |
| 273 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_local_nombre, | 273 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_local_nombre, |
| 274 | // pLocal.getNombre()); | 274 | // pLocal.getNombre()); |
| 275 | // nuevoRegistro.put( | 275 | // nuevoRegistro.put( |
| 276 | // ParametrosInventario.bal_bdd_local_descripcion, | 276 | // ParametrosInventario.bal_bdd_local_descripcion, |
| 277 | // pLocal.getDescripcion()); | 277 | // pLocal.getDescripcion()); |
| 278 | // | 278 | // |
| 279 | // // 4๏ฟฝ Insertamos el registro en la base de datos | 279 | // // 4๏ฟฝ Insertamos el registro en la base de datos |
| 280 | // long resultado = dtb.insert(ParametrosInventario.tabla_local, | 280 | // long resultado = dtb.insert(ParametrosInventario.tabla_local, |
| 281 | // null, nuevoRegistro); | 281 | // null, nuevoRegistro); |
| 282 | // | 282 | // |
| 283 | // // Test resultado INSERT: | 283 | // // Test resultado INSERT: |
| 284 | // if (resultado < 0) { | 284 | // if (resultado < 0) { |
| 285 | // | 285 | // |
| 286 | // } | 286 | // } |
| 287 | // | 287 | // |
| 288 | // } else { | 288 | // } else { |
| 289 | // | 289 | // |
| 290 | // } | 290 | // } |
| 291 | // | 291 | // |
| 292 | // // 5๏ฟฝ Cierre: | 292 | // // 5๏ฟฝ Cierre: |
| 293 | // dtb.close(); | 293 | // dtb.close(); |
| 294 | // | 294 | // |
| 295 | // return; | 295 | // return; |
| 296 | // } catch (Exception e) { | 296 | // } catch (Exception e) { |
| 297 | // | 297 | // |
| 298 | // } | 298 | // } |
| 299 | // | 299 | // |
| 300 | // } | 300 | // } |
| 301 | // | 301 | // |
| 302 | // public void actualizarLocal(Local pLocal) { | 302 | // public void actualizarLocal(Local pLocal) { |
| 303 | // try { | 303 | // try { |
| 304 | // System.out.println("::: BaseDatos 266 actualizarLocal"); | 304 | // System.out.println("::: BaseDatos 266 actualizarLocal"); |
| 305 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 305 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 306 | // | 306 | // |
| 307 | // ContentValues registro = new ContentValues(); | 307 | // ContentValues registro = new ContentValues(); |
| 308 | // registro.put(ParametrosInventario.bal_bdd_local_nombre, | 308 | // registro.put(ParametrosInventario.bal_bdd_local_nombre, |
| 309 | // pLocal.getNombre()); | 309 | // pLocal.getNombre()); |
| 310 | // registro.put(ParametrosInventario.bal_bdd_local_descripcion, | 310 | // registro.put(ParametrosInventario.bal_bdd_local_descripcion, |
| 311 | // pLocal.getDescripcion()); | 311 | // pLocal.getDescripcion()); |
| 312 | // | 312 | // |
| 313 | // // 4๏ฟฝ Insertamos el registro en la base de datos | 313 | // // 4๏ฟฝ Insertamos el registro en la base de datos |
| 314 | // long resultado = dtb.update(ParametrosInventario.tabla_local, | 314 | // long resultado = dtb.update(ParametrosInventario.tabla_local, |
| 315 | // registro, ParametrosInventario.bal_bdd_local_idLocal | 315 | // registro, ParametrosInventario.bal_bdd_local_idLocal |
| 316 | // + " = " + pLocal.getIdLocal(), null); | 316 | // + " = " + pLocal.getIdLocal(), null); |
| 317 | // // 5๏ฟฝ Cierre: | 317 | // // 5๏ฟฝ Cierre: |
| 318 | // dtb.close(); | 318 | // dtb.close(); |
| 319 | // | 319 | // |
| 320 | // return; | 320 | // return; |
| 321 | // } catch (Exception e) { | 321 | // } catch (Exception e) { |
| 322 | // | 322 | // |
| 323 | // } | 323 | // } |
| 324 | // | 324 | // |
| 325 | // } | 325 | // } |
| 326 | // | 326 | // |
| 327 | // public Local ObtenerLocal_x_Id(int pIdLocal) throws ExceptionBDD { | 327 | // public Local ObtenerLocal_x_Id(int pIdLocal) throws ExceptionBDD { |
| 328 | // try { | 328 | // try { |
| 329 | // System.out.println("::: BaseDatos 291 ObtenerLocal_x_Id"); | 329 | // System.out.println("::: BaseDatos 291 ObtenerLocal_x_Id"); |
| 330 | // // 1๏ฟฝ Abrimos la base de datos en modo lectura | 330 | // // 1๏ฟฝ Abrimos la base de datos en modo lectura |
| 331 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 331 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 332 | // | 332 | // |
| 333 | // String sql = "SELECT * FROM " + ParametrosInventario.tabla_local | 333 | // String sql = "SELECT * FROM " + ParametrosInventario.tabla_local |
| 334 | // + " WHERE " + ParametrosInventario.bal_bdd_local_idLocal | 334 | // + " WHERE " + ParametrosInventario.bal_bdd_local_idLocal |
| 335 | // + " = " + pIdLocal; | 335 | // + " = " + pIdLocal; |
| 336 | // Cursor c = dtb.rawQuery(sql, null); | 336 | // Cursor c = dtb.rawQuery(sql, null); |
| 337 | // Local local = new Local(null, null); | 337 | // Local local = new Local(null, null); |
| 338 | // // Result: | 338 | // // Result: |
| 339 | // if (c.moveToFirst()) { | 339 | // if (c.moveToFirst()) { |
| 340 | // while (c.isAfterLast() == false) { | 340 | // while (c.isAfterLast() == false) { |
| 341 | // // 3๏ฟฝ Agregamos cada numero a la lista | 341 | // // 3๏ฟฝ Agregamos cada numero a la lista |
| 342 | // int idLocal = c | 342 | // int idLocal = c |
| 343 | // .getInt(c | 343 | // .getInt(c |
| 344 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_idLocal)); | 344 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_idLocal)); |
| 345 | // String nombreLocal = c | 345 | // String nombreLocal = c |
| 346 | // .getString(c | 346 | // .getString(c |
| 347 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_nombre)); | 347 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_nombre)); |
| 348 | // String descripcionLocal = c | 348 | // String descripcionLocal = c |
| 349 | // .getString(c | 349 | // .getString(c |
| 350 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_descripcion)); | 350 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_descripcion)); |
| 351 | // | 351 | // |
| 352 | // local.setIdLocal(idLocal); | 352 | // local.setIdLocal(idLocal); |
| 353 | // local.setDescripcion(descripcionLocal); | 353 | // local.setDescripcion(descripcionLocal); |
| 354 | // local.setNombre(nombreLocal); | 354 | // local.setNombre(nombreLocal); |
| 355 | // | 355 | // |
| 356 | // c.moveToNext(); | 356 | // c.moveToNext(); |
| 357 | // } | 357 | // } |
| 358 | // } else { | 358 | // } else { |
| 359 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 359 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 360 | // "Imposible obtener el local."); | 360 | // "Imposible obtener el local."); |
| 361 | // } | 361 | // } |
| 362 | // | 362 | // |
| 363 | // // 4๏ฟฝ Cierre de BD | 363 | // // 4๏ฟฝ Cierre de BD |
| 364 | // dtb.close(); | 364 | // dtb.close(); |
| 365 | // return local; | 365 | // return local; |
| 366 | // } catch (Exception e) { | 366 | // } catch (Exception e) { |
| 367 | // | 367 | // |
| 368 | // GestorLogEventos log = new GestorLogEventos(); | 368 | // GestorLogEventos log = new GestorLogEventos(); |
| 369 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 369 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 370 | // log.log("[-- 2976 --]" + e.toString(), 4); | 370 | // log.log("[-- 2976 --]" + e.toString(), 4); |
| 371 | // | 371 | // |
| 372 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 372 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 373 | // "Imposible obtener los locales"); | 373 | // "Imposible obtener los locales"); |
| 374 | // } | 374 | // } |
| 375 | // } | 375 | // } |
| 376 | // | 376 | // |
| 377 | // public ArrayList<Local> ObtenerTodosLocales() throws ExceptionBDD { | 377 | // public ArrayList<Local> ObtenerTodosLocales() throws ExceptionBDD { |
| 378 | // try { | 378 | // try { |
| 379 | // System.out.println("::: BaseDatos 341 ObtenerTodosLocales"); | 379 | // System.out.println("::: BaseDatos 341 ObtenerTodosLocales"); |
| 380 | // // Variable de respuesta: | 380 | // // Variable de respuesta: |
| 381 | // ArrayList<Local> LocalesRetornables = new ArrayList<Local>(); | 381 | // ArrayList<Local> LocalesRetornables = new ArrayList<Local>(); |
| 382 | // | 382 | // |
| 383 | // // 1๏ฟฝ Abrimos la base de datos en modo lectura | 383 | // // 1๏ฟฝ Abrimos la base de datos en modo lectura |
| 384 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 384 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 385 | // | 385 | // |
| 386 | // // Request: | 386 | // // Request: |
| 387 | // String[] col = new String[] { | 387 | // String[] col = new String[] { |
| 388 | // ParametrosInventario.bal_bdd_local_idLocal, | 388 | // ParametrosInventario.bal_bdd_local_idLocal, |
| 389 | // ParametrosInventario.bal_bdd_local_nombre, | 389 | // ParametrosInventario.bal_bdd_local_nombre, |
| 390 | // ParametrosInventario.bal_bdd_local_descripcion }; | 390 | // ParametrosInventario.bal_bdd_local_descripcion }; |
| 391 | // // 2๏ฟฝ Ejecutamos la consulta | 391 | // // 2๏ฟฝ Ejecutamos la consulta |
| 392 | // Cursor c = dtb.query(ParametrosInventario.tabla_local, col, null, | 392 | // Cursor c = dtb.query(ParametrosInventario.tabla_local, col, null, |
| 393 | // null, null, null, null); | 393 | // null, null, null, null); |
| 394 | // | 394 | // |
| 395 | // // Result: | 395 | // // Result: |
| 396 | // if (c.moveToFirst()) { | 396 | // if (c.moveToFirst()) { |
| 397 | // do { | 397 | // do { |
| 398 | // | 398 | // |
| 399 | // // 3๏ฟฝ Agregamos cada numero a la lista | 399 | // // 3๏ฟฝ Agregamos cada numero a la lista |
| 400 | // int idLocal = c | 400 | // int idLocal = c |
| 401 | // .getInt(c | 401 | // .getInt(c |
| 402 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_idLocal)); | 402 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_idLocal)); |
| 403 | // String nombreLocal = c | 403 | // String nombreLocal = c |
| 404 | // .getString(c | 404 | // .getString(c |
| 405 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_nombre)); | 405 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_nombre)); |
| 406 | // String descripcionLocal = c | 406 | // String descripcionLocal = c |
| 407 | // .getString(c | 407 | // .getString(c |
| 408 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_descripcion)); | 408 | // .getColumnIndex(ParametrosInventario.bal_bdd_local_descripcion)); |
| 409 | // Local loc = new Local(nombreLocal, descripcionLocal, | 409 | // Local loc = new Local(nombreLocal, descripcionLocal, |
| 410 | // idLocal); | 410 | // idLocal); |
| 411 | // LocalesRetornables.add(loc); | 411 | // LocalesRetornables.add(loc); |
| 412 | // | 412 | // |
| 413 | // } while (c.moveToNext()); | 413 | // } while (c.moveToNext()); |
| 414 | // } | 414 | // } |
| 415 | // dtb.close(); | 415 | // dtb.close(); |
| 416 | // return LocalesRetornables; | 416 | // return LocalesRetornables; |
| 417 | // } catch (Exception e) { | 417 | // } catch (Exception e) { |
| 418 | // | 418 | // |
| 419 | // GestorLogEventos log = new GestorLogEventos(); | 419 | // GestorLogEventos log = new GestorLogEventos(); |
| 420 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 420 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 421 | // log.log("[-- 2976 --]" + e.toString(), 4); | 421 | // log.log("[-- 2976 --]" + e.toString(), 4); |
| 422 | // | 422 | // |
| 423 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 423 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 424 | // "Imposible obtener los locales"); | 424 | // "Imposible obtener los locales"); |
| 425 | // } | 425 | // } |
| 426 | // } | 426 | // } |
| 427 | // | 427 | // |
| 428 | // /** | 428 | // /** |
| 429 | // * Al actualizar la version se regeneran las tablas.๏ฟฝSe guarda la | 429 | // * Al actualizar la version se regeneran las tablas.๏ฟฝSe guarda la |
| 430 | // * informacion anterior? | 430 | // * informacion anterior? |
| 431 | // * <p> | 431 | // * <p> |
| 432 | // * 1๏ฟฝ Iniciamos la transaccion: | 432 | // * 1๏ฟฝ Iniciamos la transaccion: |
| 433 | // * <p> | 433 | // * <p> |
| 434 | // * 2๏ฟฝ Cambiamos los nombres de las tablas que existen hacia temp | 434 | // * 2๏ฟฝ Cambiamos los nombres de las tablas que existen hacia temp |
| 435 | // * <p> | 435 | // * <p> |
| 436 | // * 3๏ฟฝ Creamos las tablas | 436 | // * 3๏ฟฝ Creamos las tablas |
| 437 | // * <p> | 437 | // * <p> |
| 438 | // * 4๏ฟฝ Se eliminan las tablas temporarias | 438 | // * 4๏ฟฝ Se eliminan las tablas temporarias |
| 439 | // * <p> | 439 | // * <p> |
| 440 | // * 5๏ฟฝ Se concluye el upgrade | 440 | // * 5๏ฟฝ Se concluye el upgrade |
| 441 | // */ | 441 | // */ |
| 442 | // | 442 | // |
| 443 | // @Override | 443 | // @Override |
| 444 | // public void onUpgrade(SQLiteDatabase db, int versionAnterior, | 444 | // public void onUpgrade(SQLiteDatabase db, int versionAnterior, |
| 445 | // int versionNueva) { | 445 | // int versionNueva) { |
| 446 | // System.out.println("::: BaseDatos 408 onUpgrade"); | 446 | // System.out.println("::: BaseDatos 408 onUpgrade"); |
| 447 | // // 1๏ฟฝ Iniciamos la transaccion: | 447 | // // 1๏ฟฝ Iniciamos la transaccion: |
| 448 | // db.beginTransaction(); | 448 | // db.beginTransaction(); |
| 449 | // | 449 | // |
| 450 | // // 2๏ฟฝ Cambiamos los nombres de las tablas que existen hacia temp: | 450 | // // 2๏ฟฝ Cambiamos los nombres de las tablas que existen hacia temp: |
| 451 | // db.execSQL("ALTER TABLE " + tabla_articulos_nombre + " RENAME TO temp_" | 451 | // db.execSQL("ALTER TABLE " + tabla_articulos_nombre + " RENAME TO temp_" |
| 452 | // + tabla_articulos_nombre); | 452 | // + tabla_articulos_nombre); |
| 453 | // db.execSQL("ALTER TABLE " + tabla_inventarios_nombre | 453 | // db.execSQL("ALTER TABLE " + tabla_inventarios_nombre |
| 454 | // + " RENAME TO temp_" + tabla_inventarios_nombre); | 454 | // + " RENAME TO temp_" + tabla_inventarios_nombre); |
| 455 | // | 455 | // |
| 456 | // // 3๏ฟฝ Creamos las tablas: | 456 | // // 3๏ฟฝ Creamos las tablas: |
| 457 | // db.execSQL(sqlCreateTablaArticulos); | 457 | // db.execSQL(sqlCreateTablaArticulos); |
| 458 | // db.execSQL(sqlCreateTablaInventarios); | 458 | // db.execSQL(sqlCreateTablaInventarios); |
| 459 | // | 459 | // |
| 460 | // //lo de abajo estaba descomentado 999 | 460 | // //lo de abajo estaba descomentado 999 |
| 461 | // db.execSQL(sqlCreateTablaReferencias); | 461 | // db.execSQL(sqlCreateTablaReferencias); |
| 462 | // db.execSQL(sqlCreateTablaProveedores); | 462 | // db.execSQL(sqlCreateTablaProveedores); |
| 463 | // db.execSQL(sqlCreateTablaCompraProveedor); | 463 | // db.execSQL(sqlCreateTablaCompraProveedor); |
| 464 | // // Recopiamos los datos de las tablas: | 464 | // // Recopiamos los datos de las tablas: |
| 465 | // /* | 465 | // /* |
| 466 | // * db.execSQL("INSERT INTO " + tabla_articulos_nombre + " " + | 466 | // * db.execSQL("INSERT INTO " + tabla_articulos_nombre + " " + |
| 467 | // * "SELECT * from temp_" + tabla_articulos_nombre ); | 467 | // * "SELECT * from temp_" + tabla_articulos_nombre ); |
| 468 | // */ | 468 | // */ |
| 469 | // /* | 469 | // /* |
| 470 | // * db.execSQL("INSERT INTO " + tabla_inventarios_nombre + " " + | 470 | // * db.execSQL("INSERT INTO " + tabla_inventarios_nombre + " " + |
| 471 | // * "SELECT * from temp_" + tabla_inventarios_nombre ); | 471 | // * "SELECT * from temp_" + tabla_inventarios_nombre ); |
| 472 | // */ | 472 | // */ |
| 473 | // // 4๏ฟฝ Se elimina las tablas temporarias: | 473 | // // 4๏ฟฝ Se elimina las tablas temporarias: |
| 474 | // db.execSQL("DROP TABLE IF EXISTS temp_" + tabla_articulos_nombre); | 474 | // db.execSQL("DROP TABLE IF EXISTS temp_" + tabla_articulos_nombre); |
| 475 | // db.execSQL("DROP TABLE IF EXISTS temp_" + tabla_inventarios_nombre); | 475 | // db.execSQL("DROP TABLE IF EXISTS temp_" + tabla_inventarios_nombre); |
| 476 | // | 476 | // |
| 477 | // // 5๏ฟฝ Se concluye el upgrade: | 477 | // // 5๏ฟฝ Se concluye el upgrade: |
| 478 | // db.setTransactionSuccessful(); | 478 | // db.setTransactionSuccessful(); |
| 479 | // db.endTransaction(); | 479 | // db.endTransaction(); |
| 480 | // } | 480 | // } |
| 481 | // | 481 | // |
| 482 | // /** | 482 | // /** |
| 483 | // * Borra los datos de una cierta tabla pasada como parametro Hardcodeado | 483 | // * Borra los datos de una cierta tabla pasada como parametro Hardcodeado |
| 484 | // * para que si es la de referencias y no se desea borrar todo se borre solo | 484 | // * para que si es la de referencias y no se desea borrar todo se borre solo |
| 485 | // * los articulos no nuevos (codigo y sector > 0) | 485 | // * los articulos no nuevos (codigo y sector > 0) |
| 486 | // * <p> | 486 | // * <p> |
| 487 | // * 1๏ฟฝ Abrimos la base | 487 | // * 1๏ฟฝ Abrimos la base |
| 488 | // * <p> | 488 | // * <p> |
| 489 | // * 2๏ฟฝSuprimimos todas (o algunas de) las entradas de las tablas, sin | 489 | // * 2๏ฟฝSuprimimos todas (o algunas de) las entradas de las tablas, sin |
| 490 | // * suprimir las tablas | 490 | // * suprimir las tablas |
| 491 | // * <p> | 491 | // * <p> |
| 492 | // * | 492 | // * |
| 493 | // * @param nombre_tabla | 493 | // * @param nombre_tabla |
| 494 | // * @param borrarTodo | 494 | // * @param borrarTodo |
| 495 | // * @throws ExceptionBDD | 495 | // * @throws ExceptionBDD |
| 496 | // */ | 496 | // */ |
| 497 | // public void borrarDatosBDD(String nombre_tabla, boolean borrarTodo) | 497 | // public void borrarDatosBDD(String nombre_tabla, boolean borrarTodo) |
| 498 | // throws ExceptionBDD { | 498 | // throws ExceptionBDD { |
| 499 | // try { | 499 | // try { |
| 500 | // System.out.println("::: BaseDatos 461 borrarDatosBDD"); | 500 | // System.out.println("::: BaseDatos 461 borrarDatosBDD"); |
| 501 | // // 1๏ฟฝ Abrimos la base: | 501 | // // 1๏ฟฝ Abrimos la base: |
| 502 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 502 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 503 | // | 503 | // |
| 504 | // String sentencia; | 504 | // String sentencia; |
| 505 | // | 505 | // |
| 506 | // if (nombre_tabla.compareTo(tabla_referencias_nombre) == 0 | 506 | // if (nombre_tabla.compareTo(tabla_referencias_nombre) == 0 |
| 507 | // && borrarTodo == false) { | 507 | // && borrarTodo == false) { |
| 508 | // | 508 | // |
| 509 | // sentencia = "DELETE FROM " + nombre_tabla + " WHERE " | 509 | // sentencia = "DELETE FROM " + nombre_tabla + " WHERE " |
| 510 | // + ParametrosInventario.bal_bdd_referencia_codigo | 510 | // + ParametrosInventario.bal_bdd_referencia_codigo |
| 511 | // + " >= 0 AND " | 511 | // + " >= 0 AND " |
| 512 | // + ParametrosInventario.bal_bdd_referencia_sector | 512 | // + ParametrosInventario.bal_bdd_referencia_sector |
| 513 | // + " >= 0 "; | 513 | // + " >= 0 "; |
| 514 | // | 514 | // |
| 515 | // } else { | 515 | // } else { |
| 516 | // | 516 | // |
| 517 | // sentencia = "DELETE FROM " + nombre_tabla; | 517 | // sentencia = "DELETE FROM " + nombre_tabla; |
| 518 | // | 518 | // |
| 519 | // } | 519 | // } |
| 520 | // // 2๏ฟฝSuprimimos todas las entradas de las tablas, sin suprimir las | 520 | // // 2๏ฟฝSuprimimos todas las entradas de las tablas, sin suprimir las |
| 521 | // // tablas: | 521 | // // tablas: |
| 522 | // dtb.execSQL(sentencia); | 522 | // dtb.execSQL(sentencia); |
| 523 | // // | 523 | // // |
| 524 | // // dtb.execSQL("DROP TABLE IF EXISTS " + nombre_tabla); | 524 | // // dtb.execSQL("DROP TABLE IF EXISTS " + nombre_tabla); |
| 525 | // // | 525 | // // |
| 526 | // // if (nombre_tabla.compareTo(tabla_articulos_nombre) == 0) { | 526 | // // if (nombre_tabla.compareTo(tabla_articulos_nombre) == 0) { |
| 527 | // // dtb.execSQL(sqlCreateTablaArticulos); | 527 | // // dtb.execSQL(sqlCreateTablaArticulos); |
| 528 | // // } | 528 | // // } |
| 529 | // // else if (nombre_tabla.compareTo(tabla_inventarios_nombre) == 0) { | 529 | // // else if (nombre_tabla.compareTo(tabla_inventarios_nombre) == 0) { |
| 530 | // // dtb.execSQL(sqlCreateTablaInventarios); | 530 | // // dtb.execSQL(sqlCreateTablaInventarios); |
| 531 | // // } | 531 | // // } |
| 532 | // // else if (nombre_tabla.compareTo(tabla_referencias_nombre) == 0) { | 532 | // // else if (nombre_tabla.compareTo(tabla_referencias_nombre) == 0) { |
| 533 | // // dtb.execSQL(sqlCreateTablaReferencias); | 533 | // // dtb.execSQL(sqlCreateTablaReferencias); |
| 534 | // // } | 534 | // // } |
| 535 | // | 535 | // |
| 536 | // // Cierre: | 536 | // // Cierre: |
| 537 | // dtb.close(); | 537 | // dtb.close(); |
| 538 | // | 538 | // |
| 539 | // } catch (Exception e) { | 539 | // } catch (Exception e) { |
| 540 | // | 540 | // |
| 541 | // // ///////////GESTOR DE LOG/////////////////// | 541 | // // ///////////GESTOR DE LOG/////////////////// |
| 542 | // GestorLogEventos log = new GestorLogEventos(); | 542 | // GestorLogEventos log = new GestorLogEventos(); |
| 543 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 543 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 544 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 544 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 545 | // log.log("[-- 301--]" | 545 | // log.log("[-- 301--]" |
| 546 | // + "Imposible suprimir el contenido de las tablas: " | 546 | // + "Imposible suprimir el contenido de las tablas: " |
| 547 | // + e.toString(), 4); | 547 | // + e.toString(), 4); |
| 548 | // // /////////////////////////////////////////// | 548 | // // /////////////////////////////////////////// |
| 549 | // | 549 | // |
| 550 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 550 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 551 | // "Imposible suprimir el contenido de las tablas: " | 551 | // "Imposible suprimir el contenido de las tablas: " |
| 552 | // + e.toString()); | 552 | // + e.toString()); |
| 553 | // } | 553 | // } |
| 554 | // } | 554 | // } |
| 555 | // | 555 | // |
| 556 | // /** | 556 | // /** |
| 557 | // * Borra el articulo sector-codigo del inventario con nro de inventario = a | 557 | // * Borra el articulo sector-codigo del inventario con nro de inventario = a |
| 558 | // * inventario | 558 | // * inventario |
| 559 | // * <p> | 559 | // * <p> |
| 560 | // * 1๏ฟฝ Abrimos la base: | 560 | // * 1๏ฟฝ Abrimos la base: |
| 561 | // * <p> | 561 | // * <p> |
| 562 | // * 2๏ฟฝ Suprimimos la entrada correspondiente los articulos | 562 | // * 2๏ฟฝ Suprimimos la entrada correspondiente los articulos |
| 563 | // * <p> | 563 | // * <p> |
| 564 | // * 3๏ฟฝ Cierre de la bd | 564 | // * 3๏ฟฝ Cierre de la bd |
| 565 | // * | 565 | // * |
| 566 | // * @param sector | 566 | // * @param sector |
| 567 | // * @param codigo | 567 | // * @param codigo |
| 568 | // * @param inventario | 568 | // * @param inventario |
| 569 | // * @throws ExceptionBDD | 569 | // * @throws ExceptionBDD |
| 570 | // */ | 570 | // */ |
| 571 | // public void borrarArcticuloInventario(int sector, int codigo, int inventario) | 571 | // public void borrarArcticuloInventario(int sector, int codigo, int inventario) |
| 572 | // throws ExceptionBDD { | 572 | // throws ExceptionBDD { |
| 573 | // try { | 573 | // try { |
| 574 | // System.out.println("::: BaseDatos 535 borrarArcticuloInventario"); | 574 | // System.out.println("::: BaseDatos 535 borrarArcticuloInventario"); |
| 575 | // // 1๏ฟฝ Abrimos la base: | 575 | // // 1๏ฟฝ Abrimos la base: |
| 576 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 576 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 577 | // | 577 | // |
| 578 | // // 2๏ฟฝ Suprimimos la entrada correspondiente a los articulos | 578 | // // 2๏ฟฝ Suprimimos la entrada correspondiente a los articulos |
| 579 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 579 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 580 | // + ParametrosInventario.bal_bdd_articulo_codigo + "=" | 580 | // + ParametrosInventario.bal_bdd_articulo_codigo + "=" |
| 581 | // + String.valueOf(codigo) + " AND " | 581 | // + String.valueOf(codigo) + " AND " |
| 582 | // + ParametrosInventario.bal_bdd_articulo_sector + "=" | 582 | // + ParametrosInventario.bal_bdd_articulo_sector + "=" |
| 583 | // + String.valueOf(sector) + " AND " | 583 | // + String.valueOf(sector) + " AND " |
| 584 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 584 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 585 | // + String.valueOf(inventario)); | 585 | // + String.valueOf(inventario)); |
| 586 | // | 586 | // |
| 587 | // // 3๏ฟฝ Cierre de la bd | 587 | // // 3๏ฟฝ Cierre de la bd |
| 588 | // dtb.close(); | 588 | // dtb.close(); |
| 589 | // | 589 | // |
| 590 | // } catch (Exception e) { | 590 | // } catch (Exception e) { |
| 591 | // | 591 | // |
| 592 | // GestorLogEventos log = new GestorLogEventos(); | 592 | // GestorLogEventos log = new GestorLogEventos(); |
| 593 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 593 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 594 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 594 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 595 | // log.log("[-- 349 --]" + e.toString(), 4); | 595 | // log.log("[-- 349 --]" + e.toString(), 4); |
| 596 | // | 596 | // |
| 597 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 597 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 598 | // "Imposible suprimir el articulo del inventario"); | 598 | // "Imposible suprimir el articulo del inventario"); |
| 599 | // | 599 | // |
| 600 | // } | 600 | // } |
| 601 | // | 601 | // |
| 602 | // } | 602 | // } |
| 603 | // | 603 | // |
| 604 | // /** | 604 | // /** |
| 605 | // * Elimina el inventario con id_inventario y sus articulos | 605 | // * Elimina el inventario con id_inventario y sus articulos |
| 606 | // * <p> | 606 | // * <p> |
| 607 | // * 1 Abrimos la base | 607 | // * 1 Abrimos la base |
| 608 | // * <p> | 608 | // * <p> |
| 609 | // * 2 Suprimimos la entrada correspondiente los articulos y luego el | 609 | // * 2 Suprimimos la entrada correspondiente los articulos y luego el |
| 610 | // * inventario | 610 | // * inventario |
| 611 | // * <p> | 611 | // * <p> |
| 612 | // * 3 Cierre de la BD | 612 | // * 3 Cierre de la BD |
| 613 | // * | 613 | // * |
| 614 | // * @param id_inventario | 614 | // * @param id_inventario |
| 615 | // * @throws ExceptionBDD | 615 | // * @throws ExceptionBDD |
| 616 | // */ | 616 | // */ |
| 617 | // public void borrarInventarioConArticulos(int id_inventario) | 617 | // public void borrarInventarioConArticulos(int id_inventario) |
| 618 | // throws ExceptionBDD { | 618 | // throws ExceptionBDD { |
| 619 | // try { | 619 | // try { |
| 620 | // System.out.println("::: BaseDatos 581 borrarInventarioConArticulos"); | 620 | // System.out.println("::: BaseDatos 581 borrarInventarioConArticulos"); |
| 621 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; | 621 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 622 | // // 1 Abrimos la base: | 622 | // // 1 Abrimos la base: |
| 623 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 623 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 624 | // | 624 | // |
| 625 | // if(condicionRadio==true && id_inventario==-1){ | 625 | // if(condicionRadio==true && id_inventario==-1){ |
| 626 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 626 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 627 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" | 627 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 628 | // + String.valueOf(id_inventario)); | 628 | // + String.valueOf(id_inventario)); |
| 629 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 629 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 630 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 630 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 631 | // + String.valueOf(id_inventario)); | 631 | // + String.valueOf(id_inventario)); |
| 632 | // }else if(condicionRadio==false && id_inventario==-2){ | 632 | // }else if(condicionRadio==false && id_inventario==-2){ |
| 633 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 633 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 634 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" | 634 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 635 | // + String.valueOf(id_inventario)); | 635 | // + String.valueOf(id_inventario)); |
| 636 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 636 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 637 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 637 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 638 | // + String.valueOf(id_inventario)); | 638 | // + String.valueOf(id_inventario)); |
| 639 | // }else if(id_inventario==-3){ | 639 | // }else if(id_inventario==-3){ |
| 640 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 640 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 641 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" | 641 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 642 | // + String.valueOf(id_inventario)); | 642 | // + String.valueOf(id_inventario)); |
| 643 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 643 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 644 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 644 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 645 | // + String.valueOf(id_inventario)); | 645 | // + String.valueOf(id_inventario)); |
| 646 | // dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre+ " WHERE COMPRA_INV_COD=" | 646 | // dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre+ " WHERE COMPRA_INV_COD=" |
| 647 | // + String.valueOf(id_inventario)); | 647 | // + String.valueOf(id_inventario)); |
| 648 | // }else if(id_inventario<-3){ | 648 | // }else if(id_inventario<-3){ |
| 649 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 649 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 650 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" | 650 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 651 | // + String.valueOf(id_inventario)); | 651 | // + String.valueOf(id_inventario)); |
| 652 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 652 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 653 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 653 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 654 | // + String.valueOf(id_inventario)); | 654 | // + String.valueOf(id_inventario)); |
| 655 | // dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre+ " WHERE COMPRA_INV_COD=" | 655 | // dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre+ " WHERE COMPRA_INV_COD=" |
| 656 | // + String.valueOf(id_inventario)); | 656 | // + String.valueOf(id_inventario)); |
| 657 | // }else if(id_inventario>0){ | 657 | // }else if(id_inventario>0){ |
| 658 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 658 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 659 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" | 659 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 660 | // + String.valueOf(id_inventario)); | 660 | // + String.valueOf(id_inventario)); |
| 661 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 661 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 662 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 662 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 663 | // + String.valueOf(id_inventario)); | 663 | // + String.valueOf(id_inventario)); |
| 664 | // } | 664 | // } |
| 665 | //// // 2 Suprimimos la entrada correspondiente los articulos y luego el | 665 | //// // 2 Suprimimos la entrada correspondiente los articulos y luego el |
| 666 | //// // inventario | 666 | //// // inventario |
| 667 | //// dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 667 | //// dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 668 | //// + ParametrosInventario.bal_bdd_inventario_numero + "=" | 668 | //// + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 669 | //// + String.valueOf(id_inventario)); | 669 | //// + String.valueOf(id_inventario)); |
| 670 | //// dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 670 | //// dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 671 | //// + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 671 | //// + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 672 | //// + String.valueOf(id_inventario)); | 672 | //// + String.valueOf(id_inventario)); |
| 673 | // // 3 Cierre de la BD | 673 | // // 3 Cierre de la BD |
| 674 | // dtb.close(); | 674 | // dtb.close(); |
| 675 | // | 675 | // |
| 676 | // } catch (Exception e) { | 676 | // } catch (Exception e) { |
| 677 | // | 677 | // |
| 678 | // GestorLogEventos log = new GestorLogEventos(); | 678 | // GestorLogEventos log = new GestorLogEventos(); |
| 679 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 679 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 680 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 680 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 681 | // log.log("[-- 394 --]" + e.toString(), 4); | 681 | // log.log("[-- 394 --]" + e.toString(), 4); |
| 682 | // | 682 | // |
| 683 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 683 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 684 | // "Imposible suprimir el contenido de las tablas"); | 684 | // "Imposible suprimir el contenido de las tablas"); |
| 685 | // } | 685 | // } |
| 686 | // | 686 | // |
| 687 | // } | 687 | // } |
| 688 | // | 688 | // |
| 689 | // public void borrarInventarioConArticulosCompras(int id_inventario) | 689 | // public void borrarInventarioConArticulosCompras(int id_inventario) |
| 690 | // throws ExceptionBDD { | 690 | // throws ExceptionBDD { |
| 691 | // try { | 691 | // try { |
| 692 | // System.out.println("::: BaseDatos 581 borrarInventarioConArticulos"); | 692 | // System.out.println("::: BaseDatos 581 borrarInventarioConArticulos"); |
| 693 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; | 693 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 694 | // // 1 Abrimos la base: | 694 | // // 1 Abrimos la base: |
| 695 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 695 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 696 | // | 696 | // |
| 697 | // if(id_inventario==-3){ | 697 | // if(id_inventario==-3){ |
| 698 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 698 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 699 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" | 699 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 700 | // + String.valueOf(id_inventario)); | 700 | // + String.valueOf(id_inventario)); |
| 701 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 701 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 702 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 702 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 703 | // + String.valueOf(id_inventario)); | 703 | // + String.valueOf(id_inventario)); |
| 704 | // dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre + " WHERE " | 704 | // dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre + " WHERE " |
| 705 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" | 705 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 706 | // + String.valueOf(id_inventario)); | 706 | // + String.valueOf(id_inventario)); |
| 707 | // System.out.println("::: BORRO SEGURO"); | 707 | // System.out.println("::: BORRO SEGURO"); |
| 708 | // } | 708 | // } |
| 709 | // | 709 | // |
| 710 | // // 3 Cierre de la BD | 710 | // // 3 Cierre de la BD |
| 711 | // dtb.close(); | 711 | // dtb.close(); |
| 712 | // } catch (Exception e) { | 712 | // } catch (Exception e) { |
| 713 | // | 713 | // |
| 714 | // GestorLogEventos log = new GestorLogEventos(); | 714 | // GestorLogEventos log = new GestorLogEventos(); |
| 715 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 715 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 716 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 716 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 717 | // log.log("[-- 394 --]" + e.toString(), 4); | 717 | // log.log("[-- 394 --]" + e.toString(), 4); |
| 718 | // | 718 | // |
| 719 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 719 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 720 | // "Imposible suprimir el contenido de las tablas"); | 720 | // "Imposible suprimir el contenido de las tablas"); |
| 721 | // } | 721 | // } |
| 722 | // | 722 | // |
| 723 | // } | 723 | // } |
| 724 | // | 724 | // |
| 725 | // /** | 725 | // /** |
| 726 | // * Borra los inventarios de la lista con sus articulos | 726 | // * Borra los inventarios de la lista con sus articulos |
| 727 | // * <p> | 727 | // * <p> |
| 728 | // * 1 Abrimos la base | 728 | // * 1 Abrimos la base |
| 729 | // * <p> | 729 | // * <p> |
| 730 | // * 2 Para cada inventario : Suprimimos la entrada correspondiente al | 730 | // * 2 Para cada inventario : Suprimimos la entrada correspondiente al |
| 731 | // * inventario y articulos | 731 | // * inventario y articulos |
| 732 | // * <p> | 732 | // * <p> |
| 733 | // * 3 Cierre | 733 | // * 3 Cierre |
| 734 | // * | 734 | // * |
| 735 | // * @param lista_inventarios | 735 | // * @param lista_inventarios |
| 736 | // * @throws ExceptionBDD | 736 | // * @throws ExceptionBDD |
| 737 | // */ | 737 | // */ |
| 738 | // public void borrarInventarioConArticulos( | 738 | // public void borrarInventarioConArticulos( |
| 739 | // ArrayList<Integer> lista_inventarios) throws ExceptionBDD { | 739 | // ArrayList<Integer> lista_inventarios) throws ExceptionBDD { |
| 740 | // try { | 740 | // try { |
| 741 | // System.out.println("::: BaseDatos 626 borrarInventarioConArticulos"); | 741 | // System.out.println("::: BaseDatos 626 borrarInventarioConArticulos"); |
| 742 | // // 1 Abrimos la base: | 742 | // // 1 Abrimos la base: |
| 743 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 743 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 744 | // | 744 | // |
| 745 | // // 2 Para cada inventario : Suprimimos la entrada correspondiente | 745 | // // 2 Para cada inventario : Suprimimos la entrada correspondiente |
| 746 | // // al inventario y articulos | 746 | // // al inventario y articulos |
| 747 | // for (int numero : lista_inventarios) { | 747 | // for (int numero : lista_inventarios) { |
| 748 | // try { | 748 | // try { |
| 749 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre | 749 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre |
| 750 | // + " WHERE " | 750 | // + " WHERE " |
| 751 | // + ParametrosInventario.bal_bdd_inventario_numero | 751 | // + ParametrosInventario.bal_bdd_inventario_numero |
| 752 | // + "=" + String.valueOf(numero)); | 752 | // + "=" + String.valueOf(numero)); |
| 753 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre | 753 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre |
| 754 | // + " WHERE " | 754 | // + " WHERE " |
| 755 | // + ParametrosInventario.bal_bdd_articulo_inventario | 755 | // + ParametrosInventario.bal_bdd_articulo_inventario |
| 756 | // + "=" + String.valueOf(numero)); | 756 | // + "=" + String.valueOf(numero)); |
| 757 | // } catch (Exception e) { | 757 | // } catch (Exception e) { |
| 758 | // | 758 | // |
| 759 | // GestorLogEventos log = new GestorLogEventos(); | 759 | // GestorLogEventos log = new GestorLogEventos(); |
| 760 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 760 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 761 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 761 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 762 | // log.log("[-- 438 --]" + e.toString(), 4); | 762 | // log.log("[-- 438 --]" + e.toString(), 4); |
| 763 | // | 763 | // |
| 764 | // } | 764 | // } |
| 765 | // } | 765 | // } |
| 766 | // | 766 | // |
| 767 | // // 3 Cierre: | 767 | // // 3 Cierre: |
| 768 | // dtb.close(); | 768 | // dtb.close(); |
| 769 | // | 769 | // |
| 770 | // } catch (Exception e) { | 770 | // } catch (Exception e) { |
| 771 | // | 771 | // |
| 772 | // GestorLogEventos log = new GestorLogEventos(); | 772 | // GestorLogEventos log = new GestorLogEventos(); |
| 773 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 773 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 774 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 774 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 775 | // log.log("[-- 451 --]" + e.toString(), 4); | 775 | // log.log("[-- 451 --]" + e.toString(), 4); |
| 776 | // | 776 | // |
| 777 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 777 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 778 | // "Imposible suprimir el contenido de las tablas"); | 778 | // "Imposible suprimir el contenido de las tablas"); |
| 779 | // } | 779 | // } |
| 780 | // | 780 | // |
| 781 | // } | 781 | // } |
| 782 | // | 782 | // |
| 783 | // /** | 783 | // /** |
| 784 | // * Limpia los inventarios y articulos de la BD | 784 | // * Limpia los inventarios y articulos de la BD |
| 785 | // * <p> | 785 | // * <p> |
| 786 | // * 1 Abrimos la base | 786 | // * 1 Abrimos la base |
| 787 | // * <p> | 787 | // * <p> |
| 788 | // * 2 Suprimimos todas las entradas de las tablas, sin suprimir las tablas | 788 | // * 2 Suprimimos todas las entradas de las tablas, sin suprimir las tablas |
| 789 | // * <p> | 789 | // * <p> |
| 790 | // * 3 Cierre | 790 | // * 3 Cierre |
| 791 | // * | 791 | // * |
| 792 | // * @throws ExceptionBDD | 792 | // * @throws ExceptionBDD |
| 793 | // */ | 793 | // */ |
| 794 | // public void borrarInventariosYArticulosEnBDD_y_tambien_locales() | 794 | // public void borrarInventariosYArticulosEnBDD_y_tambien_locales() |
| 795 | // throws ExceptionBDD { | 795 | // throws ExceptionBDD { |
| 796 | // try { | 796 | // try { |
| 797 | // System.out.println("::: BaseDatos 682 borrarInventariosYArticulosEnBDD_y_tambien_locales"); | 797 | // System.out.println("::: BaseDatos 682 borrarInventariosYArticulosEnBDD_y_tambien_locales"); |
| 798 | // // 1 Abrimos la base: | 798 | // // 1 Abrimos la base: |
| 799 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 799 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 800 | // | 800 | // |
| 801 | // // 2 Suprimimos todas las entradas de las tablas, sin suprimir las | 801 | // // 2 Suprimimos todas las entradas de las tablas, sin suprimir las |
| 802 | // // tablas: | 802 | // // tablas: |
| 803 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre); | 803 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre); |
| 804 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre); | 804 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre); |
| 805 | // dtb.execSQL("DROP TABLE IF EXISTS " | 805 | // dtb.execSQL("DROP TABLE IF EXISTS " |
| 806 | // + ParametrosInventario.tabla_local); | 806 | // + ParametrosInventario.tabla_local); |
| 807 | // dtb.execSQL(sqlCreateTableLocales); | 807 | // dtb.execSQL(sqlCreateTableLocales); |
| 808 | // dtb.execSQL("DROP DATABASE DB_INVENT;"); | 808 | // dtb.execSQL("DROP DATABASE DB_INVENT;"); |
| 809 | // // 3 Cierre: | 809 | // // 3 Cierre: |
| 810 | // dtb.close(); | 810 | // dtb.close(); |
| 811 | // | 811 | // |
| 812 | // } catch (Exception e) { | 812 | // } catch (Exception e) { |
| 813 | // | 813 | // |
| 814 | // GestorLogEventos log = new GestorLogEventos(); | 814 | // GestorLogEventos log = new GestorLogEventos(); |
| 815 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 815 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 816 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 816 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 817 | // log.log("[-- 488 --]" + e.toString(), 4); | 817 | // log.log("[-- 488 --]" + e.toString(), 4); |
| 818 | // | 818 | // |
| 819 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 819 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 820 | // "Tabla no encontrada en la base de datos"); | 820 | // "Tabla no encontrada en la base de datos"); |
| 821 | // } | 821 | // } |
| 822 | // } | 822 | // } |
| 823 | // | 823 | // |
| 824 | // /** | 824 | // /** |
| 825 | // * Busca en las referencias articulos con descripciones parecidas a las | 825 | // * Busca en las referencias articulos con descripciones parecidas a las |
| 826 | // * pasadas en la cadena de parametro | 826 | // * pasadas en la cadena de parametro |
| 827 | // * <p> | 827 | // * <p> |
| 828 | // * 1 Abrimos la base | 828 | // * 1 Abrimos la base |
| 829 | // * <p> | 829 | // * <p> |
| 830 | // * 2Procesar la cadena de busqueda (un espacio blanco cuenta como un &&): | 830 | // * 2Procesar la cadena de busqueda (un espacio blanco cuenta como un &&): |
| 831 | // * Reemplazamos los multiples espacios blancos por 1 solo | 831 | // * Reemplazamos los multiples espacios blancos por 1 solo |
| 832 | // * <p> | 832 | // * <p> |
| 833 | // * 3 Partimos el string en una tabla segun el caracter ' ' | 833 | // * 3 Partimos el string en una tabla segun el caracter ' ' |
| 834 | // * <p> | 834 | // * <p> |
| 835 | // * 4 Construimos la consulta SQL | 835 | // * 4 Construimos la consulta SQL |
| 836 | // * <p> | 836 | // * <p> |
| 837 | // * 5 Buscar en las referencias el articulo | 837 | // * 5 Buscar en las referencias el articulo |
| 838 | // * <p> | 838 | // * <p> |
| 839 | // * 6 Control respuestas | 839 | // * 6 Control respuestas |
| 840 | // * <p> | 840 | // * <p> |
| 841 | // * 7 Lectura de los resultados | 841 | // * 7 Lectura de los resultados |
| 842 | // * <p> | 842 | // * <p> |
| 843 | // * 8 Cerramos la BD | 843 | // * 8 Cerramos la BD |
| 844 | // * | 844 | // * |
| 845 | // * @param busqueda | 845 | // * @param busqueda |
| 846 | // * @return | 846 | // * @return |
| 847 | // * @throws ExceptionBDD | 847 | // * @throws ExceptionBDD |
| 848 | // */ | 848 | // */ |
| 849 | // public ArrayList<HashMap<Integer, Object>> buscarEnReferencias( | 849 | // public ArrayList<HashMap<Integer, Object>> buscarEnReferencias( |
| 850 | // String busqueda) throws ExceptionBDD { | 850 | // String busqueda) throws ExceptionBDD { |
| 851 | // // toModify; | 851 | // // toModify; |
| 852 | // try { | 852 | // try { |
| 853 | // System.out.println("::: BaseDatos 738 buscarEnReferencias"); | 853 | // System.out.println("::: BaseDatos 738 buscarEnReferencias"); |
| 854 | // // Variable de retorno:Revisar esto | 854 | // // Variable de retorno:Revisar esto |
| 855 | // ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); | 855 | // ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); |
| 856 | // | 856 | // |
| 857 | // // 1 Abrimos la base: | 857 | // // 1 Abrimos la base: |
| 858 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 858 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 859 | // | 859 | // |
| 860 | // // 2Procesar la cadena de busqueda (un espacio blanco cuenta como | 860 | // // 2Procesar la cadena de busqueda (un espacio blanco cuenta como |
| 861 | // // un | 861 | // // un |
| 862 | // // &&): | 862 | // // &&): |
| 863 | // // Reemplazamos los multiples espacios blancos por 1 solo: | 863 | // // Reemplazamos los multiples espacios blancos por 1 solo: |
| 864 | // busqueda = busqueda.replaceAll("\\s+", " "); | 864 | // busqueda = busqueda.replaceAll("\\s+", " "); |
| 865 | // | 865 | // |
| 866 | // // 3 Partimos el string en una tabla segun el caracter ' ': | 866 | // // 3 Partimos el string en una tabla segun el caracter ' ': |
| 867 | // String tabla_busqueda[] = busqueda.split("\\s"); | 867 | // String tabla_busqueda[] = busqueda.split("\\s"); |
| 868 | // | 868 | // |
| 869 | // // 4 Construimos la consulta SQL: | 869 | // // 4 Construimos la consulta SQL: |
| 870 | // String consulta_SQL = ""; | 870 | // String consulta_SQL = ""; |
| 871 | // for (String s : tabla_busqueda) { | 871 | // for (String s : tabla_busqueda) { |
| 872 | // consulta_SQL += ParametrosInventario.bal_bdd_referencia_descripcion | 872 | // consulta_SQL += ParametrosInventario.bal_bdd_referencia_descripcion |
| 873 | // + " LIKE '%" + s + "%' AND "; | 873 | // + " LIKE '%" + s + "%' AND "; |
| 874 | // } | 874 | // } |
| 875 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 875 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 876 | // // consulta_SQL += "AND " + | 876 | // // consulta_SQL += "AND " + |
| 877 | // // ParametrosInventario.bal_bdd_articulo_inventario + "=" + | 877 | // // ParametrosInventario.bal_bdd_articulo_inventario + "=" + |
| 878 | // // num_inventario; | 878 | // // num_inventario; |
| 879 | // | 879 | // |
| 880 | // // 5 Buscar en las referencias el articulo | 880 | // // 5 Buscar en las referencias el articulo |
| 881 | // // Mas columnas, o todo | 881 | // // Mas columnas, o todo |
| 882 | // String col[] = new String[] { | 882 | // String col[] = new String[] { |
| 883 | // ParametrosInventario.bal_bdd_referencia_sector, | 883 | // ParametrosInventario.bal_bdd_referencia_sector, |
| 884 | // ParametrosInventario.bal_bdd_referencia_codigo, | 884 | // ParametrosInventario.bal_bdd_referencia_codigo, |
| 885 | // ParametrosInventario.bal_bdd_referencia_descripcion | 885 | // ParametrosInventario.bal_bdd_referencia_descripcion |
| 886 | // // ParametrosInventario.bal_bdd_referencia_codigo_barra, | 886 | // // ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 887 | // // ParametrosInventario.bal_bdd_referencia_precio_venta, | 887 | // // ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 888 | // // ParametrosInventario.bal_bdd_referencia_precio_costo | 888 | // // ParametrosInventario.bal_bdd_referencia_precio_costo |
| 889 | // }; | 889 | // }; |
| 890 | // | 890 | // |
| 891 | // Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, | 891 | // Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, |
| 892 | // null, ParametrosInventario.bal_bdd_referencia_codigo + "," | 892 | // null, ParametrosInventario.bal_bdd_referencia_codigo + "," |
| 893 | // + ParametrosInventario.bal_bdd_referencia_sector, | 893 | // + ParametrosInventario.bal_bdd_referencia_sector, |
| 894 | // null, ParametrosInventario.bal_bdd_referencia_descripcion); | 894 | // null, ParametrosInventario.bal_bdd_referencia_descripcion); |
| 895 | // | 895 | // |
| 896 | // // 6 Control respuestas: | 896 | // // 6 Control respuestas: |
| 897 | // if (c.getCount() <= 0) { | 897 | // if (c.getCount() <= 0) { |
| 898 | // dtb.close(); | 898 | // dtb.close(); |
| 899 | // return lista_resultado; | 899 | // return lista_resultado; |
| 900 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 900 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 901 | // dtb.close(); | 901 | // dtb.close(); |
| 902 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 902 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 903 | // } | 903 | // } |
| 904 | // // ArticuloVisible nvoArt; | 904 | // // ArticuloVisible nvoArt; |
| 905 | // // int codigo,sector; | 905 | // // int codigo,sector; |
| 906 | // // String desc,codigoBarra; | 906 | // // String desc,codigoBarra; |
| 907 | // // double precioVenta, precioCosto; | 907 | // // double precioVenta, precioCosto; |
| 908 | // // ArrayList<String> losCodigosBarras; | 908 | // // ArrayList<String> losCodigosBarras; |
| 909 | // // 7 Lectura de los resultados: | 909 | // // 7 Lectura de los resultados: |
| 910 | // if (c.moveToFirst()) { | 910 | // if (c.moveToFirst()) { |
| 911 | // // System.out.println(":::ACA SI ENTROOOOOOO"); | 911 | // // System.out.println(":::ACA SI ENTROOOOOOO"); |
| 912 | // while (c.isAfterLast() == false) { | 912 | // while (c.isAfterLast() == false) { |
| 913 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 913 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 914 | // // Crear un articulo con los datos extraidos | 914 | // // Crear un articulo con los datos extraidos |
| 915 | // // codigo=c.getInt(0); | 915 | // // codigo=c.getInt(0); |
| 916 | // // sector=c.getInt(1); | 916 | // // sector=c.getInt(1); |
| 917 | // // desc=c.getString(2); | 917 | // // desc=c.getString(2); |
| 918 | // // codigoBarra=c.getString(3); | 918 | // // codigoBarra=c.getString(3); |
| 919 | // // precioVenta=c.getDouble(4); | 919 | // // precioVenta=c.getDouble(4); |
| 920 | // // precioCosto=c.getDouble(5); | 920 | // // precioCosto=c.getDouble(5); |
| 921 | // // losCodigosBarras= new ArrayList<String>(); | 921 | // // losCodigosBarras= new ArrayList<String>(); |
| 922 | // // losCodigosBarras.add(codigoBarra); | 922 | // // losCodigosBarras.add(codigoBarra); |
| 923 | // // nvoArt=new ArticuloVisible(sector, codigo, | 923 | // // nvoArt=new ArticuloVisible(sector, codigo, |
| 924 | // // losCodigosBarras, 0, desc, precioVenta, precioCosto, "", | 924 | // // losCodigosBarras, 0, desc, precioVenta, precioCosto, "", |
| 925 | // // -1, "", true); | 925 | // // -1, "", true); |
| 926 | // // Meterlo en el hash map | 926 | // // Meterlo en el hash map |
| 927 | // hashmap.put(ParametrosInventario.clave_art_sector, | 927 | // hashmap.put(ParametrosInventario.clave_art_sector, |
| 928 | // c.getInt(0)); | 928 | // c.getInt(0)); |
| 929 | // hashmap.put(ParametrosInventario.clave_art_codigo, | 929 | // hashmap.put(ParametrosInventario.clave_art_codigo, |
| 930 | // c.getInt(1)); | 930 | // c.getInt(1)); |
| 931 | // hashmap.put(ParametrosInventario.clave_art_nombre, | 931 | // hashmap.put(ParametrosInventario.clave_art_nombre, |
| 932 | // c.getString(2)); | 932 | // c.getString(2)); |
| 933 | // lista_resultado.add(hashmap); | 933 | // lista_resultado.add(hashmap); |
| 934 | // // System.out.println(":::"+lista_resultado); | 934 | // // System.out.println(":::"+lista_resultado); |
| 935 | // c.moveToNext(); | 935 | // c.moveToNext(); |
| 936 | // } | 936 | // } |
| 937 | // // 8 Cerramos la BD | 937 | // // 8 Cerramos la BD |
| 938 | // dtb.close(); | 938 | // dtb.close(); |
| 939 | // return lista_resultado; | 939 | // return lista_resultado; |
| 940 | // } else { | 940 | // } else { |
| 941 | // dtb.close(); | 941 | // dtb.close(); |
| 942 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 942 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 943 | // } | 943 | // } |
| 944 | // } catch (Exception e) { | 944 | // } catch (Exception e) { |
| 945 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 945 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 946 | // "Error en la busqueda: " + busqueda); | 946 | // "Error en la busqueda: " + busqueda); |
| 947 | // } | 947 | // } |
| 948 | // | 948 | // |
| 949 | // } | 949 | // } |
| 950 | // | 950 | // |
| 951 | // /** | 951 | // /** |
| 952 | // * Busca en las referencias articulos con descripciones parecidas a las | 952 | // * Busca en las referencias articulos con descripciones parecidas a las |
| 953 | // * pasadas en la cadena de parametro | 953 | // * pasadas en la cadena de parametro |
| 954 | // * <p> | 954 | // * <p> |
| 955 | // * 1 Abrimos la base | 955 | // * 1 Abrimos la base |
| 956 | // * <p> | 956 | // * <p> |
| 957 | // * 2Procesar la cadena de busqueda (un espacio blanco cuenta como un &&): | 957 | // * 2Procesar la cadena de busqueda (un espacio blanco cuenta como un &&): |
| 958 | // * Reemplazamos los multiples espacios blancos por 1 solo | 958 | // * Reemplazamos los multiples espacios blancos por 1 solo |
| 959 | // * <p> | 959 | // * <p> |
| 960 | // * 3 Partimos el string en una tabla segun el caracter ' ' | 960 | // * 3 Partimos el string en una tabla segun el caracter ' ' |
| 961 | // * <p> | 961 | // * <p> |
| 962 | // * 4 Construimos la consulta SQL | 962 | // * 4 Construimos la consulta SQL |
| 963 | // * <p> | 963 | // * <p> |
| 964 | // * 5 Buscar en las referencias el articulo | 964 | // * 5 Buscar en las referencias el articulo |
| 965 | // * <p> | 965 | // * <p> |
| 966 | // * 6 Control respuestas | 966 | // * 6 Control respuestas |
| 967 | // * <p> | 967 | // * <p> |
| 968 | // * 7 Lectura de los resultados | 968 | // * 7 Lectura de los resultados |
| 969 | // * <p> | 969 | // * <p> |
| 970 | // * 8 Cerramos la BD | 970 | // * 8 Cerramos la BD |
| 971 | // * | 971 | // * |
| 972 | // * @param busqueda | 972 | // * @param busqueda |
| 973 | // * @return | 973 | // * @return |
| 974 | // * @throws ExceptionBDD | 974 | // * @throws ExceptionBDD |
| 975 | // */ | 975 | // */ |
| 976 | // public ArrayList<HashMap<Integer, Object>> buscarEnReferenciasPorCodigoODescripcion( | 976 | // public ArrayList<HashMap<Integer, Object>> buscarEnReferenciasPorCodigoODescripcion( |
| 977 | // String busqueda) throws ExceptionBDD { | 977 | // String busqueda) throws ExceptionBDD { |
| 978 | // // toModify; | 978 | // // toModify; |
| 979 | // try { | 979 | // try { |
| 980 | // System.out.println("::: BaseDatos 738 buscarEnReferencias"); | 980 | // System.out.println("::: BaseDatos 738 buscarEnReferencias"); |
| 981 | // // Variable de retorno:Revisar esto | 981 | // // Variable de retorno:Revisar esto |
| 982 | // ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); | 982 | // ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); |
| 983 | // | 983 | // |
| 984 | // // 1 Abrimos la base: | 984 | // // 1 Abrimos la base: |
| 985 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 985 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 986 | // | 986 | // |
| 987 | // // 2Procesar la cadena de busqueda (un espacio blanco cuenta como | 987 | // // 2Procesar la cadena de busqueda (un espacio blanco cuenta como |
| 988 | // // un | 988 | // // un |
| 989 | // // &&): | 989 | // // &&): |
| 990 | // // Reemplazamos los multiples espacios blancos por 1 solo: | 990 | // // Reemplazamos los multiples espacios blancos por 1 solo: |
| 991 | // | 991 | // |
| 992 | // String consulta_SQL = ""; | 992 | // String consulta_SQL = ""; |
| 993 | // if(busqueda.matches("^\\d{1,5}$")){ | 993 | // if(busqueda.matches("^\\d{1,5}$")){ |
| 994 | // consulta_SQL = ParametrosInventario.bal_bdd_referencia_codigo + " = '" + busqueda + "'"; | 994 | // consulta_SQL = ParametrosInventario.bal_bdd_referencia_codigo + " = '" + busqueda + "'"; |
| 995 | // } else { | 995 | // } else { |
| 996 | // busqueda = busqueda.replaceAll("\\s+", " "); | 996 | // busqueda = busqueda.replaceAll("\\s+", " "); |
| 997 | // | 997 | // |
| 998 | // // 3 Partimos el string en una tabla segun el caracter ' ': | 998 | // // 3 Partimos el string en una tabla segun el caracter ' ': |
| 999 | // String tabla_busqueda[] = busqueda.split("\\s"); | 999 | // String tabla_busqueda[] = busqueda.split("\\s"); |
| 1000 | // | 1000 | // |
| 1001 | // // 4 Construimos la consulta SQL: | 1001 | // // 4 Construimos la consulta SQL: |
| 1002 | // for (String s : tabla_busqueda) { | 1002 | // for (String s : tabla_busqueda) { |
| 1003 | // consulta_SQL += ParametrosInventario.bal_bdd_referencia_descripcion | 1003 | // consulta_SQL += ParametrosInventario.bal_bdd_referencia_descripcion |
| 1004 | // + " LIKE '%" + s + "%' AND "; | 1004 | // + " LIKE '%" + s + "%' AND "; |
| 1005 | // } | 1005 | // } |
| 1006 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 1006 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 1007 | // // consulta_SQL += "AND " + | 1007 | // // consulta_SQL += "AND " + |
| 1008 | // // ParametrosInventario.bal_bdd_articulo_inventario + "=" + | 1008 | // // ParametrosInventario.bal_bdd_articulo_inventario + "=" + |
| 1009 | // // num_inventario; | 1009 | // // num_inventario; |
| 1010 | // } | 1010 | // } |
| 1011 | // | 1011 | // |
| 1012 | // // 5 Buscar en las referencias el articulo | 1012 | // // 5 Buscar en las referencias el articulo |
| 1013 | // // Mas columnas, o todo | 1013 | // // Mas columnas, o todo |
| 1014 | // String col[] = new String[] { | 1014 | // String col[] = new String[] { |
| 1015 | // ParametrosInventario.bal_bdd_referencia_sector, | 1015 | // ParametrosInventario.bal_bdd_referencia_sector, |
| 1016 | // ParametrosInventario.bal_bdd_referencia_codigo, | 1016 | // ParametrosInventario.bal_bdd_referencia_codigo, |
| 1017 | // ParametrosInventario.bal_bdd_referencia_descripcion | 1017 | // ParametrosInventario.bal_bdd_referencia_descripcion |
| 1018 | // // ParametrosInventario.bal_bdd_referencia_codigo_barra, | 1018 | // // ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 1019 | // // ParametrosInventario.bal_bdd_referencia_precio_venta, | 1019 | // // ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 1020 | // // ParametrosInventario.bal_bdd_referencia_precio_costo | 1020 | // // ParametrosInventario.bal_bdd_referencia_precio_costo |
| 1021 | // }; | 1021 | // }; |
| 1022 | // | 1022 | // |
| 1023 | // Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, | 1023 | // Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, |
| 1024 | // null, ParametrosInventario.bal_bdd_referencia_codigo + "," | 1024 | // null, ParametrosInventario.bal_bdd_referencia_codigo + "," |
| 1025 | // + ParametrosInventario.bal_bdd_referencia_sector, | 1025 | // + ParametrosInventario.bal_bdd_referencia_sector, |
| 1026 | // null, ParametrosInventario.bal_bdd_referencia_descripcion); | 1026 | // null, ParametrosInventario.bal_bdd_referencia_descripcion); |
| 1027 | // | 1027 | // |
| 1028 | // // 6 Control respuestas: | 1028 | // // 6 Control respuestas: |
| 1029 | // if (c.getCount() <= 0) { | 1029 | // if (c.getCount() <= 0) { |
| 1030 | // dtb.close(); | 1030 | // dtb.close(); |
| 1031 | // return lista_resultado; | 1031 | // return lista_resultado; |
| 1032 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 1032 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 1033 | // dtb.close(); | 1033 | // dtb.close(); |
| 1034 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 1034 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 1035 | // } | 1035 | // } |
| 1036 | // // ArticuloVisible nvoArt; | 1036 | // // ArticuloVisible nvoArt; |
| 1037 | // // int codigo,sector; | 1037 | // // int codigo,sector; |
| 1038 | // // String desc,codigoBarra; | 1038 | // // String desc,codigoBarra; |
| 1039 | // // double precioVenta, precioCosto; | 1039 | // // double precioVenta, precioCosto; |
| 1040 | // // ArrayList<String> losCodigosBarras; | 1040 | // // ArrayList<String> losCodigosBarras; |
| 1041 | // // 7 Lectura de los resultados: | 1041 | // // 7 Lectura de los resultados: |
| 1042 | // if (c.moveToFirst()) { | 1042 | // if (c.moveToFirst()) { |
| 1043 | // // System.out.println(":::ACA SI ENTROOOOOOO"); | 1043 | // // System.out.println(":::ACA SI ENTROOOOOOO"); |
| 1044 | // while (c.isAfterLast() == false) { | 1044 | // while (c.isAfterLast() == false) { |
| 1045 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 1045 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 1046 | // // Crear un articulo con los datos extraidos | 1046 | // // Crear un articulo con los datos extraidos |
| 1047 | // // codigo=c.getInt(0); | 1047 | // // codigo=c.getInt(0); |
| 1048 | // // sector=c.getInt(1); | 1048 | // // sector=c.getInt(1); |
| 1049 | // // desc=c.getString(2); | 1049 | // // desc=c.getString(2); |
| 1050 | // // codigoBarra=c.getString(3); | 1050 | // // codigoBarra=c.getString(3); |
| 1051 | // // precioVenta=c.getDouble(4); | 1051 | // // precioVenta=c.getDouble(4); |
| 1052 | // // precioCosto=c.getDouble(5); | 1052 | // // precioCosto=c.getDouble(5); |
| 1053 | // // losCodigosBarras= new ArrayList<String>(); | 1053 | // // losCodigosBarras= new ArrayList<String>(); |
| 1054 | // // losCodigosBarras.add(codigoBarra); | 1054 | // // losCodigosBarras.add(codigoBarra); |
| 1055 | // // nvoArt=new ArticuloVisible(sector, codigo, | 1055 | // // nvoArt=new ArticuloVisible(sector, codigo, |
| 1056 | // // losCodigosBarras, 0, desc, precioVenta, precioCosto, "", | 1056 | // // losCodigosBarras, 0, desc, precioVenta, precioCosto, "", |
| 1057 | // // -1, "", true); | 1057 | // // -1, "", true); |
| 1058 | // // Meterlo en el hash map | 1058 | // // Meterlo en el hash map |
| 1059 | // hashmap.put(ParametrosInventario.clave_art_sector, | 1059 | // hashmap.put(ParametrosInventario.clave_art_sector, |
| 1060 | // c.getInt(0)); | 1060 | // c.getInt(0)); |
| 1061 | // hashmap.put(ParametrosInventario.clave_art_codigo, | 1061 | // hashmap.put(ParametrosInventario.clave_art_codigo, |
| 1062 | // c.getInt(1)); | 1062 | // c.getInt(1)); |
| 1063 | // hashmap.put(ParametrosInventario.clave_art_nombre, | 1063 | // hashmap.put(ParametrosInventario.clave_art_nombre, |
| 1064 | // c.getString(2)); | 1064 | // c.getString(2)); |
| 1065 | // lista_resultado.add(hashmap); | 1065 | // lista_resultado.add(hashmap); |
| 1066 | // // System.out.println(":::"+lista_resultado); | 1066 | // // System.out.println(":::"+lista_resultado); |
| 1067 | // c.moveToNext(); | 1067 | // c.moveToNext(); |
| 1068 | // } | 1068 | // } |
| 1069 | // // 8 Cerramos la BD | 1069 | // // 8 Cerramos la BD |
| 1070 | // dtb.close(); | 1070 | // dtb.close(); |
| 1071 | // return lista_resultado; | 1071 | // return lista_resultado; |
| 1072 | // } else { | 1072 | // } else { |
| 1073 | // dtb.close(); | 1073 | // dtb.close(); |
| 1074 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 1074 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 1075 | // } | 1075 | // } |
| 1076 | // } catch (Exception e) { | 1076 | // } catch (Exception e) { |
| 1077 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 1077 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 1078 | // "Error en la busqueda: " + busqueda); | 1078 | // "Error en la busqueda: " + busqueda); |
| 1079 | // } | 1079 | // } |
| 1080 | // | 1080 | // |
| 1081 | // } | 1081 | // } |
| 1082 | // | 1082 | // |
| 1083 | // | 1083 | // |
| 1084 | // /* | 1084 | // /* |
| 1085 | // | 1085 | // |
| 1086 | // | 1086 | // |
| 1087 | // | 1087 | // |
| 1088 | // */ | 1088 | // */ |
| 1089 | // | 1089 | // |
| 1090 | // public boolean buscarArticulosNoTomadosBD(int inventario_curso)throws ExceptionBDD{ | 1090 | // public boolean buscarArticulosNoTomadosBD(int inventario_curso)throws ExceptionBDD{ |
| 1091 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 1091 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 1092 | // // 2 Construimos la consulta SQL: | 1092 | // // 2 Construimos la consulta SQL: |
| 1093 | // Cursor c; | 1093 | // Cursor c; |
| 1094 | // ArrayList<HashMap<Integer, Object>> art_no_tomados = new ArrayList<HashMap<Integer, Object>>(); | 1094 | // ArrayList<HashMap<Integer, Object>> art_no_tomados = new ArrayList<HashMap<Integer, Object>>(); |
| 1095 | // c= dtb.rawQuery("SELECT * FROM ARTICULOS WHERE ART_I="+inventario_curso + " AND ART_Q IN (-1,0)", null); | 1095 | // c= dtb.rawQuery("SELECT * FROM ARTICULOS WHERE ART_I="+inventario_curso + " AND ART_Q IN (-1,0)", null); |
| 1096 | // if (c.moveToFirst() == true) { | 1096 | // if (c.moveToFirst() == true) { |
| 1097 | // System.out.println("::: BD HAY ARTICULOS NO TOMADOS"); | 1097 | // System.out.println("::: BD HAY ARTICULOS NO TOMADOS"); |
| 1098 | // return true; | 1098 | // return true; |
| 1099 | // } else { | 1099 | // } else { |
| 1100 | // System.out.println("::: BD TODOS LOS ARTICULOS TIENEN COSAS"); | 1100 | // System.out.println("::: BD TODOS LOS ARTICULOS TIENEN COSAS"); |
| 1101 | // return false; | 1101 | // return false; |
| 1102 | // } | 1102 | // } |
| 1103 | // } | 1103 | // } |
| 1104 | // | 1104 | // |
| 1105 | // /* | 1105 | // /* |
| 1106 | // * | 1106 | // * |
| 1107 | // * Busca los proveedores existentes | 1107 | // * Busca los proveedores existentes |
| 1108 | // * */ | 1108 | // * */ |
| 1109 | // | 1109 | // |
| 1110 | // public ArrayList<String> buscarEnProveedores( | 1110 | // public ArrayList<String> buscarEnProveedores( |
| 1111 | // String valor) throws ExceptionBDD { | 1111 | // String valor) throws ExceptionBDD { |
| 1112 | // try { | 1112 | // try { |
| 1113 | // System.out.println("::: BaseDatos 738 buscarEnProveedores"); | 1113 | // System.out.println("::: BaseDatos 738 buscarEnProveedores"); |
| 1114 | // //ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); | 1114 | // //ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); |
| 1115 | // ArrayList<String> lista_resultado = new ArrayList<String>(); | 1115 | // ArrayList<String> lista_resultado = new ArrayList<String>(); |
| 1116 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 1116 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 1117 | // if(valor==""){ | 1117 | // if(valor==""){ |
| 1118 | // valor = valor.replaceAll("\\s+", " "); | 1118 | // valor = valor.replaceAll("\\s+", " "); |
| 1119 | // String tabla_busqueda[] = valor.split("\\s"); | 1119 | // String tabla_busqueda[] = valor.split("\\s"); |
| 1120 | // String consulta_SQL = ""; | 1120 | // String consulta_SQL = ""; |
| 1121 | // for (String s : tabla_busqueda) { | 1121 | // for (String s : tabla_busqueda) { |
| 1122 | // consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion | 1122 | // consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion |
| 1123 | // + " LIKE '%" + s + "%' AND "; | 1123 | // + " LIKE '%" + s + "%' AND "; |
| 1124 | // } | 1124 | // } |
| 1125 | // //consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 1125 | // //consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 1126 | // consulta_SQL = ""; | 1126 | // consulta_SQL = ""; |
| 1127 | // String col[] = new String[] { | 1127 | // String col[] = new String[] { |
| 1128 | // ParametrosInventario.bal_bdd_proveedores_descripcion | 1128 | // ParametrosInventario.bal_bdd_proveedores_descripcion |
| 1129 | // }; | 1129 | // }; |
| 1130 | // Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, | 1130 | // Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, |
| 1131 | // null, ParametrosInventario.bal_bdd_proveedores_codigo + "," | 1131 | // null, ParametrosInventario.bal_bdd_proveedores_codigo + "," |
| 1132 | // + ParametrosInventario.bal_bdd_proveedores_descripcion, | 1132 | // + ParametrosInventario.bal_bdd_proveedores_descripcion, |
| 1133 | // null, ParametrosInventario.bal_bdd_proveedores_descripcion); | 1133 | // null, ParametrosInventario.bal_bdd_proveedores_descripcion); |
| 1134 | // | 1134 | // |
| 1135 | // // 6 Control respuestas: | 1135 | // // 6 Control respuestas: |
| 1136 | // if (c.getCount() <= 0) { | 1136 | // if (c.getCount() <= 0) { |
| 1137 | // dtb.close(); | 1137 | // dtb.close(); |
| 1138 | // return lista_resultado; | 1138 | // return lista_resultado; |
| 1139 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 1139 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 1140 | // dtb.close(); | 1140 | // dtb.close(); |
| 1141 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 1141 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 1142 | // } | 1142 | // } |
| 1143 | // // 7 Lectura de los resultados: | 1143 | // // 7 Lectura de los resultados: |
| 1144 | // if (c.moveToFirst()) { | 1144 | // if (c.moveToFirst()) { |
| 1145 | // while (c.isAfterLast() == false) { | 1145 | // while (c.isAfterLast() == false) { |
| 1146 | // | 1146 | // |
| 1147 | //// lista_resultado.add(ParametrosInventario.clave_prov_cod, | 1147 | //// lista_resultado.add(ParametrosInventario.clave_prov_cod, |
| 1148 | //// c.getString(0)); | 1148 | //// c.getString(0)); |
| 1149 | // lista_resultado.add(c.getString(0)); | 1149 | // lista_resultado.add(c.getString(0)); |
| 1150 | // System.out.println("::: listaresultado " +lista_resultado ); | 1150 | // System.out.println("::: listaresultado " +lista_resultado ); |
| 1151 | // | 1151 | // |
| 1152 | // c.moveToNext(); | 1152 | // c.moveToNext(); |
| 1153 | // } | 1153 | // } |
| 1154 | // // 8 Cerramos la BD | 1154 | // // 8 Cerramos la BD |
| 1155 | // dtb.close(); | 1155 | // dtb.close(); |
| 1156 | // return lista_resultado; | 1156 | // return lista_resultado; |
| 1157 | // } else { | 1157 | // } else { |
| 1158 | // dtb.close(); | 1158 | // dtb.close(); |
| 1159 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 1159 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 1160 | // } | 1160 | // } |
| 1161 | // }else{ | 1161 | // }else{ |
| 1162 | // valor = valor.replaceAll("\\s+", " "); | 1162 | // valor = valor.replaceAll("\\s+", " "); |
| 1163 | // String tabla_busqueda[] = valor.split("\\s"); | 1163 | // String tabla_busqueda[] = valor.split("\\s"); |
| 1164 | // String consulta_SQL = ""; | 1164 | // String consulta_SQL = ""; |
| 1165 | // for (String s : tabla_busqueda) { | 1165 | // for (String s : tabla_busqueda) { |
| 1166 | // consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion | 1166 | // consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion |
| 1167 | // + " LIKE '%" + s + "%' AND "; | 1167 | // + " LIKE '%" + s + "%' AND "; |
| 1168 | // } | 1168 | // } |
| 1169 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 1169 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 1170 | // String col[] = new String[] { | 1170 | // String col[] = new String[] { |
| 1171 | // ParametrosInventario.bal_bdd_proveedores_descripcion | 1171 | // ParametrosInventario.bal_bdd_proveedores_descripcion |
| 1172 | // }; | 1172 | // }; |
| 1173 | // Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, | 1173 | // Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, |
| 1174 | // null, ParametrosInventario.bal_bdd_proveedores_codigo + "," | 1174 | // null, ParametrosInventario.bal_bdd_proveedores_codigo + "," |
| 1175 | // + ParametrosInventario.bal_bdd_proveedores_descripcion, | 1175 | // + ParametrosInventario.bal_bdd_proveedores_descripcion, |
| 1176 | // null, ParametrosInventario.bal_bdd_proveedores_descripcion); | 1176 | // null, ParametrosInventario.bal_bdd_proveedores_descripcion); |
| 1177 | // | 1177 | // |
| 1178 | // | 1178 | // |
| 1179 | // // 6 Control respuestas: | 1179 | // // 6 Control respuestas: |
| 1180 | // if (c.getCount() <= 0) { | 1180 | // if (c.getCount() <= 0) { |
| 1181 | // dtb.close(); | 1181 | // dtb.close(); |
| 1182 | // return lista_resultado; | 1182 | // return lista_resultado; |
| 1183 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 1183 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 1184 | // dtb.close(); | 1184 | // dtb.close(); |
| 1185 | // //throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 1185 | // //throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 1186 | // return lista_resultado; | 1186 | // return lista_resultado; |
| 1187 | // } | 1187 | // } |
| 1188 | // // 7 Lectura de los resultados: | 1188 | // // 7 Lectura de los resultados: |
| 1189 | // if (c.moveToFirst()) { | 1189 | // if (c.moveToFirst()) { |
| 1190 | // while (c.isAfterLast() == false) { | 1190 | // while (c.isAfterLast() == false) { |
| 1191 | //// lista_resultado.add(ParametrosInventario.clave_prov_cod, | 1191 | //// lista_resultado.add(ParametrosInventario.clave_prov_cod, |
| 1192 | //// c.getString(0)); | 1192 | //// c.getString(0)); |
| 1193 | // lista_resultado.add(c.getString(0)); | 1193 | // lista_resultado.add(c.getString(0)); |
| 1194 | // System.out.println("::: listaresultado " +lista_resultado ); | 1194 | // System.out.println("::: listaresultado " +lista_resultado ); |
| 1195 | // c.moveToNext(); | 1195 | // c.moveToNext(); |
| 1196 | // } | 1196 | // } |
| 1197 | // // 8 Cerramos la BD | 1197 | // // 8 Cerramos la BD |
| 1198 | // dtb.close(); | 1198 | // dtb.close(); |
| 1199 | // return lista_resultado; | 1199 | // return lista_resultado; |
| 1200 | // } else { | 1200 | // } else { |
| 1201 | // dtb.close(); | 1201 | // dtb.close(); |
| 1202 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 1202 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 1203 | // } | 1203 | // } |
| 1204 | // } | 1204 | // } |
| 1205 | // } catch (Exception e) { | 1205 | // } catch (Exception e) { |
| 1206 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 1206 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 1207 | // "Error en la busqueda: " + valor); | 1207 | // "Error en la busqueda: " + valor); |
| 1208 | // } | 1208 | // } |
| 1209 | // } | 1209 | // } |
| 1210 | // /* | 1210 | // /* |
| 1211 | // * | 1211 | // * |
| 1212 | // * Busca el codigo del proveedor mediante el nombre, y guarda el codigo en una tabla que relaciona el inventario de compra | 1212 | // * Busca el codigo del proveedor mediante el nombre, y guarda el codigo en una tabla que relaciona el inventario de compra |
| 1213 | // * */ | 1213 | // * */ |
| 1214 | // | 1214 | // |
| 1215 | // public ArrayList<String> cargarProveedor( | 1215 | // public ArrayList<String> cargarProveedor( |
| 1216 | // String valor,String proveedor_id) throws ExceptionBDD { | 1216 | // String valor,String proveedor_id) throws ExceptionBDD { |
| 1217 | // try { | 1217 | // try { |
| 1218 | // System.out.println("::: BaseDatos 738 buscarEnProveedores"); | 1218 | // System.out.println("::: BaseDatos 738 buscarEnProveedores"); |
| 1219 | // ArrayList<String> lista_resultado = new ArrayList<String>(); | 1219 | // ArrayList<String> lista_resultado = new ArrayList<String>(); |
| 1220 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 1220 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 1221 | // valor = valor.replaceAll("\\s+", " "); | 1221 | // valor = valor.replaceAll("\\s+", " "); |
| 1222 | // int codigoProve = 0; | 1222 | // int codigoProve = 0; |
| 1223 | // String tabla_busqueda[] = valor.split("\\s"); | 1223 | // String tabla_busqueda[] = valor.split("\\s"); |
| 1224 | // String consulta_SQL = ""; | 1224 | // String consulta_SQL = ""; |
| 1225 | // for (String s : tabla_busqueda) { | 1225 | // for (String s : tabla_busqueda) { |
| 1226 | // consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion | 1226 | // consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion |
| 1227 | // + " LIKE '%" + s + "%' AND "; | 1227 | // + " LIKE '%" + s + "%' AND "; |
| 1228 | // } | 1228 | // } |
| 1229 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 1229 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 1230 | // String col[] = new String[] { | 1230 | // String col[] = new String[] { |
| 1231 | // ParametrosInventario.bal_bdd_proveedores_codigo | 1231 | // ParametrosInventario.bal_bdd_proveedores_codigo |
| 1232 | // }; | 1232 | // }; |
| 1233 | // Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, | 1233 | // Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, |
| 1234 | // null, ParametrosInventario.bal_bdd_proveedores_codigo + "," | 1234 | // null, ParametrosInventario.bal_bdd_proveedores_codigo + "," |
| 1235 | // + ParametrosInventario.bal_bdd_proveedores_descripcion, | 1235 | // + ParametrosInventario.bal_bdd_proveedores_descripcion, |
| 1236 | // null, ParametrosInventario.bal_bdd_proveedores_descripcion); | 1236 | // null, ParametrosInventario.bal_bdd_proveedores_descripcion); |
| 1237 | // // 6 Control respuestas: | 1237 | // // 6 Control respuestas: |
| 1238 | // if (c.getCount() <= 0) { | 1238 | // if (c.getCount() <= 0) { |
| 1239 | // dtb.close(); | 1239 | // dtb.close(); |
| 1240 | // return lista_resultado; | 1240 | // return lista_resultado; |
| 1241 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 1241 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 1242 | // dtb.close(); | 1242 | // dtb.close(); |
| 1243 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 1243 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 1244 | // } | 1244 | // } |
| 1245 | // // 7 Lectura de los resultados: | 1245 | // // 7 Lectura de los resultados: |
| 1246 | // if (c.moveToFirst()) { | 1246 | // if (c.moveToFirst()) { |
| 1247 | // while (c.isAfterLast() == false) { | 1247 | // while (c.isAfterLast() == false) { |
| 1248 | //// lista_resultado.add(ParametrosInventario.clave_prov_cod,c.getString(0)); | 1248 | //// lista_resultado.add(ParametrosInventario.clave_prov_cod,c.getString(0)); |
| 1249 | // lista_resultado.add(c.getString(0)); | 1249 | // lista_resultado.add(c.getString(0)); |
| 1250 | // codigoProve = c.getInt(0); | 1250 | // codigoProve = c.getInt(0); |
| 1251 | // dtb.execSQL("DELETE FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD="+proveedor_id); | 1251 | // dtb.execSQL("DELETE FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD="+proveedor_id); |
| 1252 | // dtb.execSQL("INSERT INTO COMPRA_PROVEEDOR(COMPRA_INV_COD,COMPRA_PROVE_COD) VALUES ("+proveedor_id+","+codigoProve+") "); | 1252 | // dtb.execSQL("INSERT INTO COMPRA_PROVEEDOR(COMPRA_INV_COD,COMPRA_PROVE_COD) VALUES ("+proveedor_id+","+codigoProve+") "); |
| 1253 | // c.moveToNext(); | 1253 | // c.moveToNext(); |
| 1254 | // } | 1254 | // } |
| 1255 | // // 8 Cerramos la BD | 1255 | // // 8 Cerramos la BD |
| 1256 | // dtb.close(); | 1256 | // dtb.close(); |
| 1257 | // return lista_resultado; | 1257 | // return lista_resultado; |
| 1258 | // } else { | 1258 | // } else { |
| 1259 | // dtb.close(); | 1259 | // dtb.close(); |
| 1260 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 1260 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 1261 | // } | 1261 | // } |
| 1262 | // } catch (Exception e) { | 1262 | // } catch (Exception e) { |
| 1263 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 1263 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 1264 | // "Error en la busqueda: " + valor); | 1264 | // "Error en la busqueda: " + valor); |
| 1265 | // } | 1265 | // } |
| 1266 | // } | 1266 | // } |
| 1267 | // /** | 1267 | // /** |
| 1268 | // * Busca el articulo unSector-unCodigo en las referencias | 1268 | // * Busca el articulo unSector-unCodigo en las referencias |
| 1269 | // * <p> | 1269 | // * <p> |
| 1270 | // * 1 Abrimos la base | 1270 | // * 1 Abrimos la base |
| 1271 | // * <p> | 1271 | // * <p> |
| 1272 | // * 2 Construimos la consulta SQL | 1272 | // * 2 Construimos la consulta SQL |
| 1273 | // * <p> | 1273 | // * <p> |
| 1274 | // * 3 Buscar en las referencias el articulo | 1274 | // * 3 Buscar en las referencias el articulo |
| 1275 | // * <p> | 1275 | // * <p> |
| 1276 | // * 4 Control respuestas | 1276 | // * 4 Control respuestas |
| 1277 | // * <p> | 1277 | // * <p> |
| 1278 | // * 5 Lectura de los resultados | 1278 | // * 5 Lectura de los resultados |
| 1279 | // * <p> | 1279 | // * <p> |
| 1280 | // * 6 Crear un articulo con los datos extraidos | 1280 | // * 6 Crear un articulo con los datos extraidos |
| 1281 | // * <p> | 1281 | // * <p> |
| 1282 | // * 7 Cerramos la BD | 1282 | // * 7 Cerramos la BD |
| 1283 | // * | 1283 | // * |
| 1284 | // * @param unCodigo | 1284 | // * @param unCodigo |
| 1285 | // * @param unSector | 1285 | // * @param unSector |
| 1286 | // * @return el articulo encontrado | 1286 | // * @return el articulo encontrado |
| 1287 | // * @throws ExceptionBDD | 1287 | // * @throws ExceptionBDD |
| 1288 | // * si no encuentra | 1288 | // * si no encuentra |
| 1289 | // */ | 1289 | // */ |
| 1290 | // public ArticuloVisible buscarArticuloEnReferencias(int unCodigo, | 1290 | // public ArticuloVisible buscarArticuloEnReferencias(int unCodigo, |
| 1291 | // int unSector) throws ExceptionBDD { | 1291 | // int unSector) throws ExceptionBDD { |
| 1292 | // ArticuloVisible result = null; | 1292 | // ArticuloVisible result = null; |
| 1293 | // System.out.println("::: BaseDatos 866 buscarArticuloEnReferencias"); | 1293 | // System.out.println("::: BaseDatos 866 buscarArticuloEnReferencias"); |
| 1294 | // try { | 1294 | // try { |
| 1295 | // // 1 Abrimos la base: | 1295 | // // 1 Abrimos la base: |
| 1296 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 1296 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 1297 | // // 2 Construimos la consulta SQL: | 1297 | // // 2 Construimos la consulta SQL: |
| 1298 | // String consulta_SQL = ""; | 1298 | // String consulta_SQL = ""; |
| 1299 | // | 1299 | // |
| 1300 | // consulta_SQL = ParametrosInventario.bal_bdd_referencia_codigo | 1300 | // consulta_SQL = ParametrosInventario.bal_bdd_referencia_codigo |
| 1301 | // + " = " + String.valueOf(unCodigo) + " AND " | 1301 | // + " = " + String.valueOf(unCodigo) + " AND " |
| 1302 | // + ParametrosInventario.bal_bdd_referencia_sector + " = " | 1302 | // + ParametrosInventario.bal_bdd_referencia_sector + " = " |
| 1303 | // + String.valueOf(unSector); | 1303 | // + String.valueOf(unSector); |
| 1304 | // | 1304 | // |
| 1305 | // // 3 Buscar en las referencias el articulo | 1305 | // // 3 Buscar en las referencias el articulo |
| 1306 | // // Mas columnas, o todo | 1306 | // // Mas columnas, o todo |
| 1307 | // String col[] = new String[] { | 1307 | // String col[] = new String[] { |
| 1308 | // ParametrosInventario.bal_bdd_referencia_sector, | 1308 | // ParametrosInventario.bal_bdd_referencia_sector, |
| 1309 | // ParametrosInventario.bal_bdd_referencia_codigo, | 1309 | // ParametrosInventario.bal_bdd_referencia_codigo, |
| 1310 | // ParametrosInventario.bal_bdd_referencia_balanza, | 1310 | // ParametrosInventario.bal_bdd_referencia_balanza, |
| 1311 | // ParametrosInventario.bal_bdd_referencia_decimales, | 1311 | // ParametrosInventario.bal_bdd_referencia_decimales, |
| 1312 | // ParametrosInventario.bal_bdd_referencia_descripcion, | 1312 | // ParametrosInventario.bal_bdd_referencia_descripcion, |
| 1313 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, | 1313 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 1314 | // ParametrosInventario.bal_bdd_referencia_codigo_barra_completo, | 1314 | // ParametrosInventario.bal_bdd_referencia_codigo_barra_completo, |
| 1315 | // ParametrosInventario.bal_bdd_referencia_precio_venta, | 1315 | // ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 1316 | // ParametrosInventario.bal_bdd_referencia_precio_costo , | 1316 | // ParametrosInventario.bal_bdd_referencia_precio_costo , |
| 1317 | // ParametrosInventario.bal_bdd_referencia_existencia_venta, | 1317 | // ParametrosInventario.bal_bdd_referencia_existencia_venta, |
| 1318 | // ParametrosInventario.bal_bdd_referencia_existencia_deposito, | 1318 | // ParametrosInventario.bal_bdd_referencia_existencia_deposito, |
| 1319 | // ParametrosInventario.bal_bdd_referencia_depsn,}; | 1319 | // ParametrosInventario.bal_bdd_referencia_depsn,}; |
| 1320 | // System.out.println("::: BD 873 valor depsn " + ParametrosInventario.bal_bdd_referencia_depsn); | 1320 | // System.out.println("::: BD 873 valor depsn " + ParametrosInventario.bal_bdd_referencia_depsn); |
| 1321 | // | 1321 | // |
| 1322 | // Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, | 1322 | // Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, |
| 1323 | // null, null, null, null); | 1323 | // null, null, null, null); |
| 1324 | // | 1324 | // |
| 1325 | // // 4 Control respuestas: | 1325 | // // 4 Control respuestas: |
| 1326 | // if (c.getCount() <= 0) { | 1326 | // if (c.getCount() <= 0) { |
| 1327 | // dtb.close(); | 1327 | // dtb.close(); |
| 1328 | // return result; | 1328 | // return result; |
| 1329 | // } | 1329 | // } |
| 1330 | // | 1330 | // |
| 1331 | // // ArticuloVisible nvoArt; | 1331 | // // ArticuloVisible nvoArt; |
| 1332 | // int codigo, sector, depsn,balanza,decimales; | 1332 | // int codigo, sector, depsn,balanza,decimales; |
| 1333 | // String desc, codigoBarra,codigoBarraCompleto; | 1333 | // String desc, codigoBarra,codigoBarraCompleto; |
| 1334 | // double precioVenta, precioCosto, exisventa, exisdeposito; | 1334 | // double precioVenta, precioCosto, exisventa, exisdeposito; |
| 1335 | // ArrayList<String> losCodigosBarras; | 1335 | // ArrayList<String> losCodigosBarras; |
| 1336 | // ArrayList<String> losCodigosBarrasCompleto; | 1336 | // ArrayList<String> losCodigosBarrasCompleto; |
| 1337 | // // 5 Lectura de los resultados: | 1337 | // // 5 Lectura de los resultados: |
| 1338 | // if (c.moveToFirst()) { | 1338 | // if (c.moveToFirst()) { |
| 1339 | // // Deberia ser uno solo | 1339 | // // Deberia ser uno solo |
| 1340 | // // while (c.isAfterLast() == false) { | 1340 | // // while (c.isAfterLast() == false) { |
| 1341 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 1341 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 1342 | // // 6 Crear un articulo con los datos extraidos | 1342 | // // 6 Crear un articulo con los datos extraidos |
| 1343 | // sector = c.getInt(0); | 1343 | // sector = c.getInt(0); |
| 1344 | // codigo = c.getInt(1); | 1344 | // codigo = c.getInt(1); |
| 1345 | // balanza = c.getInt(2); | 1345 | // balanza = c.getInt(2); |
| 1346 | // decimales = c.getInt(3); | 1346 | // decimales = c.getInt(3); |
| 1347 | // desc = c.getString(4); | 1347 | // desc = c.getString(4); |
| 1348 | // codigoBarra = c.getString(5); | 1348 | // codigoBarra = c.getString(5); |
| 1349 | // codigoBarraCompleto = c.getString(6); | 1349 | // codigoBarraCompleto = c.getString(6); |
| 1350 | // precioVenta = c.getDouble(7); | 1350 | // precioVenta = c.getDouble(7); |
| 1351 | // precioCosto = c.getDouble(8); | 1351 | // precioCosto = c.getDouble(8); |
| 1352 | // exisventa = c.getDouble(9); | 1352 | // exisventa = c.getDouble(9); |
| 1353 | // exisdeposito = c.getDouble(10); | 1353 | // exisdeposito = c.getDouble(10); |
| 1354 | // depsn = c.getInt(11); | 1354 | // depsn = c.getInt(11); |
| 1355 | // System.out.println("::: BD 907 hasta aca llega el valor depsn " + depsn); | 1355 | // System.out.println("::: BD 907 hasta aca llega el valor depsn " + depsn); |
| 1356 | // losCodigosBarras = new ArrayList<String>(); | 1356 | // losCodigosBarras = new ArrayList<String>(); |
| 1357 | // losCodigosBarrasCompleto = new ArrayList<String>(); | 1357 | // losCodigosBarrasCompleto = new ArrayList<String>(); |
| 1358 | // losCodigosBarras.add(codigoBarra); | 1358 | // losCodigosBarras.add(codigoBarra); |
| 1359 | // result = new ArticuloVisible(sector, codigo, balanza,decimales, losCodigosBarras,losCodigosBarrasCompleto, | 1359 | // result = new ArticuloVisible(sector, codigo, balanza,decimales, losCodigosBarras,losCodigosBarrasCompleto, |
| 1360 | // 0, desc, precioVenta, precioCosto, "", -1,-1,exisventa,exisdeposito,depsn, "", true); | 1360 | // 0, desc, precioVenta, precioCosto, "", -1,-1,exisventa,exisdeposito,depsn, "", true); |
| 1361 | ///////////////////////////////////////////// | 1361 | ///////////////////////////////////////////// |
| 1362 | // // c.moveToNext(); | 1362 | // // c.moveToNext(); |
| 1363 | // // } | 1363 | // // } |
| 1364 | // // 7 Cerramos la BD | 1364 | // // 7 Cerramos la BD |
| 1365 | // dtb.close(); | 1365 | // dtb.close(); |
| 1366 | // return result; | 1366 | // return result; |
| 1367 | // } else { | 1367 | // } else { |
| 1368 | // dtb.close(); | 1368 | // dtb.close(); |
| 1369 | // return result; | 1369 | // return result; |
| 1370 | // // throw new | 1370 | // // throw new |
| 1371 | // // ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 1371 | // // ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 1372 | // } | 1372 | // } |
| 1373 | // } catch (Exception e) { | 1373 | // } catch (Exception e) { |
| 1374 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 1374 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 1375 | // "Error en la busqueda: " + unSector + "-" + unCodigo); | 1375 | // "Error en la busqueda: " + unSector + "-" + unCodigo); |
| 1376 | // } | 1376 | // } |
| 1377 | // | 1377 | // |
| 1378 | // } | 1378 | // } |
| 1379 | // | 1379 | // |
| 1380 | // | 1380 | // |
| 1381 | // public Proveedor buscarProveedor(int unCodigo) throws ExceptionBDD { | 1381 | // public Proveedor buscarProveedor(int unCodigo) throws ExceptionBDD { |
| 1382 | // Proveedor result = null; | 1382 | // Proveedor result = null; |
| 1383 | // System.out.println("::: BaseDatos 866 buscarProveedor"); | 1383 | // System.out.println("::: BaseDatos 866 buscarProveedor"); |
| 1384 | // try { | 1384 | // try { |
| 1385 | // // 1 Abrimos la base: | 1385 | // // 1 Abrimos la base: |
| 1386 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 1386 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 1387 | // // 2 Construimos la consulta SQL: | 1387 | // // 2 Construimos la consulta SQL: |
| 1388 | // String consulta_SQL = ""; | 1388 | // String consulta_SQL = ""; |
| 1389 | // | 1389 | // |
| 1390 | // consulta_SQL = ParametrosInventario.bal_bdd_proveedores_codigo | 1390 | // consulta_SQL = ParametrosInventario.bal_bdd_proveedores_codigo |
| 1391 | // + " = " + String.valueOf(unCodigo); | 1391 | // + " = " + String.valueOf(unCodigo); |
| 1392 | // | 1392 | // |
| 1393 | // // 3 Buscar en las referencias el articulo | 1393 | // // 3 Buscar en las referencias el articulo |
| 1394 | // // Mas columnas, o todo | 1394 | // // Mas columnas, o todo |
| 1395 | // String col[] = new String[] { | 1395 | // String col[] = new String[] { |
| 1396 | // ParametrosInventario.bal_bdd_proveedores_codigo, | 1396 | // ParametrosInventario.bal_bdd_proveedores_codigo, |
| 1397 | // ParametrosInventario.bal_bdd_proveedores_descripcion | 1397 | // ParametrosInventario.bal_bdd_proveedores_descripcion |
| 1398 | // }; | 1398 | // }; |
| 1399 | // Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, | 1399 | // Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, |
| 1400 | // null, null, null, null); | 1400 | // null, null, null, null); |
| 1401 | // | 1401 | // |
| 1402 | // // 4 Control respuestas: | 1402 | // // 4 Control respuestas: |
| 1403 | // if (c.getCount() <= 0) { | 1403 | // if (c.getCount() <= 0) { |
| 1404 | // dtb.close(); | 1404 | // dtb.close(); |
| 1405 | // return result; | 1405 | // return result; |
| 1406 | // } | 1406 | // } |
| 1407 | // | 1407 | // |
| 1408 | // int codigo; | 1408 | // int codigo; |
| 1409 | // String nombre; | 1409 | // String nombre; |
| 1410 | // // 5 Lectura de los resultados: | 1410 | // // 5 Lectura de los resultados: |
| 1411 | // if (c.moveToFirst()) { | 1411 | // if (c.moveToFirst()) { |
| 1412 | // // Deberia ser uno solo | 1412 | // // Deberia ser uno solo |
| 1413 | // // while (c.isAfterLast() == false) { | 1413 | // // while (c.isAfterLast() == false) { |
| 1414 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 1414 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 1415 | // // 6 Crear un articulo con los datos extraidos | 1415 | // // 6 Crear un articulo con los datos extraidos |
| 1416 | // codigo = c.getInt(0); | 1416 | // codigo = c.getInt(0); |
| 1417 | // nombre = c.getString(1); | 1417 | // nombre = c.getString(1); |
| 1418 | // System.out.println("::: BD 907 hasta aca llega el valor depsn "); | 1418 | // System.out.println("::: BD 907 hasta aca llega el valor depsn "); |
| 1419 | // result = new Proveedor(codigo,nombre); | 1419 | // result = new Proveedor(codigo,nombre); |
| 1420 | // | 1420 | // |
| 1421 | // dtb.close(); | 1421 | // dtb.close(); |
| 1422 | // return result; | 1422 | // return result; |
| 1423 | // } else { | 1423 | // } else { |
| 1424 | // dtb.close(); | 1424 | // dtb.close(); |
| 1425 | // return result; | 1425 | // return result; |
| 1426 | // // throw new | 1426 | // // throw new |
| 1427 | // // ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 1427 | // // ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 1428 | // } | 1428 | // } |
| 1429 | // } catch (Exception e) { | 1429 | // } catch (Exception e) { |
| 1430 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 1430 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 1431 | // "Error en la busqueda: " + unCodigo); | 1431 | // "Error en la busqueda: " + unCodigo); |
| 1432 | // } | 1432 | // } |
| 1433 | // | 1433 | // |
| 1434 | // } | 1434 | // } |
| 1435 | // | 1435 | // |
| 1436 | // /** | 1436 | // /** |
| 1437 | // * Busca por parecido de descripcion en el num_inventario | 1437 | // * Busca por parecido de descripcion en el num_inventario |
| 1438 | // * <p> | 1438 | // * <p> |
| 1439 | // * 1 Abrimos la base | 1439 | // * 1 Abrimos la base |
| 1440 | // * <p> | 1440 | // * <p> |
| 1441 | // * 2 Procesar la cadena de busqueda (un espacio blanco cuenta como un | 1441 | // * 2 Procesar la cadena de busqueda (un espacio blanco cuenta como un |
| 1442 | // * &&:Reemplazamos los multiples espacios blancos por 1 solo | 1442 | // * &&:Reemplazamos los multiples espacios blancos por 1 solo |
| 1443 | // * <p> | 1443 | // * <p> |
| 1444 | // * 3 Partimos el string en una tabla segun el caracter ' ' | 1444 | // * 3 Partimos el string en una tabla segun el caracter ' ' |
| 1445 | // * <p> | 1445 | // * <p> |
| 1446 | // * 4 Construimos la consulta SQL | 1446 | // * 4 Construimos la consulta SQL |
| 1447 | // * <p> | 1447 | // * <p> |
| 1448 | // * 5 Buscar en el inventario especificado el articulo | 1448 | // * 5 Buscar en el inventario especificado el articulo |
| 1449 | // * <p> | 1449 | // * <p> |
| 1450 | // * 6 Control respuestas | 1450 | // * 6 Control respuestas |
| 1451 | // * <p> | 1451 | // * <p> |
| 1452 | // * 7 Lectura de los resultados | 1452 | // * 7 Lectura de los resultados |
| 1453 | // * <p> | 1453 | // * <p> |
| 1454 | // * 8 Cerramos la BD | 1454 | // * 8 Cerramos la BD |
| 1455 | // * | 1455 | // * |
| 1456 | // * @param num_inventario | 1456 | // * @param num_inventario |
| 1457 | // * @param busqueda | 1457 | // * @param busqueda |
| 1458 | // * @return | 1458 | // * @return |
| 1459 | // * @throws ExceptionBDD | 1459 | // * @throws ExceptionBDD |
| 1460 | // */ | 1460 | // */ |
| 1461 | // public ArrayList<HashMap<Integer, Object>> buscar(int num_inventario, | 1461 | // public ArrayList<HashMap<Integer, Object>> buscar(int num_inventario, |
| 1462 | // String busqueda) throws ExceptionBDD { | 1462 | // String busqueda) throws ExceptionBDD { |
| 1463 | // System.out.println("::: BaseDatos 972 buscar"); | 1463 | // System.out.println("::: BaseDatos 972 buscar"); |
| 1464 | // try { | 1464 | // try { |
| 1465 | // // Variable de retorno: | 1465 | // // Variable de retorno: |
| 1466 | // ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); | 1466 | // ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); |
| 1467 | // | 1467 | // |
| 1468 | // // 1 Abrimos la base: | 1468 | // // 1 Abrimos la base: |
| 1469 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 1469 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 1470 | // | 1470 | // |
| 1471 | // // 2 Procesar la cadena de busqueda (un espacio blanco cuenta como | 1471 | // // 2 Procesar la cadena de busqueda (un espacio blanco cuenta como |
| 1472 | // // un | 1472 | // // un |
| 1473 | // // &&): | 1473 | // // &&): |
| 1474 | // // Reemplazamos los multiples espacios blancos por 1 solo: | 1474 | // // Reemplazamos los multiples espacios blancos por 1 solo: |
| 1475 | // busqueda = busqueda.replaceAll("\\s+", " "); | 1475 | // busqueda = busqueda.replaceAll("\\s+", " "); |
| 1476 | // | 1476 | // |
| 1477 | // // 3 Partimos el string en una tabla segn el caracter ' ': | 1477 | // // 3 Partimos el string en una tabla segn el caracter ' ': |
| 1478 | // String tabla_busqueda[] = busqueda.split("\\s"); | 1478 | // String tabla_busqueda[] = busqueda.split("\\s"); |
| 1479 | // | 1479 | // |
| 1480 | // // 4 Construimos la consulta SQL: | 1480 | // // 4 Construimos la consulta SQL: |
| 1481 | // String consulta_SQL = ""; | 1481 | // String consulta_SQL = ""; |
| 1482 | // for (String s : tabla_busqueda) { | 1482 | // for (String s : tabla_busqueda) { |
| 1483 | // consulta_SQL += ParametrosInventario.bal_bdd_articulo_descripcion | 1483 | // consulta_SQL += ParametrosInventario.bal_bdd_articulo_descripcion |
| 1484 | // + " LIKE '%" + s + "%' AND "; | 1484 | // + " LIKE '%" + s + "%' AND "; |
| 1485 | // } | 1485 | // } |
| 1486 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 1486 | // consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 1487 | // consulta_SQL += "AND " | 1487 | // consulta_SQL += "AND " |
| 1488 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 1488 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 1489 | // + num_inventario; | 1489 | // + num_inventario; |
| 1490 | // | 1490 | // |
| 1491 | // // 5 Buscar en el inventario especificado el articulo: | 1491 | // // 5 Buscar en el inventario especificado el articulo: |
| 1492 | // String col[] = new String[] { | 1492 | // String col[] = new String[] { |
| 1493 | // ParametrosInventario.bal_bdd_articulo_sector, | 1493 | // ParametrosInventario.bal_bdd_articulo_sector, |
| 1494 | // ParametrosInventario.bal_bdd_articulo_codigo, | 1494 | // ParametrosInventario.bal_bdd_articulo_codigo, |
| 1495 | // ParametrosInventario.bal_bdd_articulo_descripcion }; | 1495 | // ParametrosInventario.bal_bdd_articulo_descripcion }; |
| 1496 | // | 1496 | // |
| 1497 | // Cursor c = dtb.query(tabla_articulos_nombre, col, consulta_SQL, | 1497 | // Cursor c = dtb.query(tabla_articulos_nombre, col, consulta_SQL, |
| 1498 | // null, null, null, | 1498 | // null, null, null, |
| 1499 | // ParametrosInventario.bal_bdd_articulo_descripcion); | 1499 | // ParametrosInventario.bal_bdd_articulo_descripcion); |
| 1500 | // | 1500 | // |
| 1501 | // // 6 Control respuestas: | 1501 | // // 6 Control respuestas: |
| 1502 | // if (c.getCount() <= 0) { | 1502 | // if (c.getCount() <= 0) { |
| 1503 | // dtb.close(); | 1503 | // dtb.close(); |
| 1504 | // return lista_resultado; | 1504 | // return lista_resultado; |
| 1505 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 1505 | // } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 1506 | // dtb.close(); | 1506 | // dtb.close(); |
| 1507 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 1507 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 1508 | // } | 1508 | // } |
| 1509 | // | 1509 | // |
| 1510 | // // 7 Lectura de los resultados: | 1510 | // // 7 Lectura de los resultados: |
| 1511 | // if (c.moveToFirst()) { | 1511 | // if (c.moveToFirst()) { |
| 1512 | // while (c.isAfterLast() == false) { | 1512 | // while (c.isAfterLast() == false) { |
| 1513 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 1513 | // HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 1514 | // | 1514 | // |
| 1515 | // hashmap.put(ParametrosInventario.clave_art_sector, | 1515 | // hashmap.put(ParametrosInventario.clave_art_sector, |
| 1516 | // c.getInt(0)); | 1516 | // c.getInt(0)); |
| 1517 | // hashmap.put(ParametrosInventario.clave_art_codigo, | 1517 | // hashmap.put(ParametrosInventario.clave_art_codigo, |
| 1518 | // c.getInt(1)); | 1518 | // c.getInt(1)); |
| 1519 | // hashmap.put(ParametrosInventario.clave_art_nombre, | 1519 | // hashmap.put(ParametrosInventario.clave_art_nombre, |
| 1520 | // c.getString(2)); | 1520 | // c.getString(2)); |
| 1521 | // | 1521 | // |
| 1522 | // lista_resultado.add(hashmap); | 1522 | // lista_resultado.add(hashmap); |
| 1523 | // | 1523 | // |
| 1524 | // c.moveToNext(); | 1524 | // c.moveToNext(); |
| 1525 | // } | 1525 | // } |
| 1526 | // // 8 Cerramos la BD | 1526 | // // 8 Cerramos la BD |
| 1527 | // dtb.close(); | 1527 | // dtb.close(); |
| 1528 | // return lista_resultado; | 1528 | // return lista_resultado; |
| 1529 | // } else { | 1529 | // } else { |
| 1530 | // dtb.close(); | 1530 | // dtb.close(); |
| 1531 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 1531 | // throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 1532 | // } | 1532 | // } |
| 1533 | // } catch (Exception e) { | 1533 | // } catch (Exception e) { |
| 1534 | // | 1534 | // |
| 1535 | // GestorLogEventos log = new GestorLogEventos(); | 1535 | // GestorLogEventos log = new GestorLogEventos(); |
| 1536 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 1536 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 1537 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 1537 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 1538 | // log.log("[-- 818 --]" + e.toString(), 4); | 1538 | // log.log("[-- 818 --]" + e.toString(), 4); |
| 1539 | // | 1539 | // |
| 1540 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 1540 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 1541 | // "Error en la busqueda: " + busqueda); | 1541 | // "Error en la busqueda: " + busqueda); |
| 1542 | // } | 1542 | // } |
| 1543 | // } | 1543 | // } |
| 1544 | // | 1544 | // |
| 1545 | // /** | 1545 | // /** |
| 1546 | // * Regenera las tablas de articulos e inventarios. Si se ha cambiado la | 1546 | // * Regenera las tablas de articulos e inventarios. Si se ha cambiado la |
| 1547 | // * sentencia de creacion, se creana segun la nueva estriuctura 1 Abrimos la | 1547 | // * sentencia de creacion, se creana segun la nueva estriuctura 1 Abrimos la |
| 1548 | // * base 2 Suprimimos todas las entradas de las tablas, sin suprimir las 3 | 1548 | // * base 2 Suprimimos todas las entradas de las tablas, sin suprimir las 3 |
| 1549 | // * Se elimina la version anterior de la tabla 4 Se crea la nueva version de | 1549 | // * Se elimina la version anterior de la tabla 4 Se crea la nueva version de |
| 1550 | // * la tabla 5 Cierre | 1550 | // * la tabla 5 Cierre |
| 1551 | // * | 1551 | // * |
| 1552 | // * @throws ExceptionBDD | 1552 | // * @throws ExceptionBDD |
| 1553 | // */ | 1553 | // */ |
| 1554 | // public void destruirYReconstruir() throws ExceptionBDD { | 1554 | // public void destruirYReconstruir() throws ExceptionBDD { |
| 1555 | // try { | 1555 | // try { |
| 1556 | // System.out.println("::: BaseDatos 1065 destruirYReconstruir"); | 1556 | // System.out.println("::: BaseDatos 1065 destruirYReconstruir"); |
| 1557 | // // 1 Abrimos la base: | 1557 | // // 1 Abrimos la base: |
| 1558 | // SQLiteDatabase db = this.getWritableDatabase(); | 1558 | // SQLiteDatabase db = this.getWritableDatabase(); |
| 1559 | // | 1559 | // |
| 1560 | // // 2 Suprimimos todas las entradas de las tablas, sin suprimir las | 1560 | // // 2 Suprimimos todas las entradas de las tablas, sin suprimir las |
| 1561 | // // tablas: | 1561 | // // tablas: |
| 1562 | // db.execSQL("DELETE FROM " + tabla_articulos_nombre); | 1562 | // db.execSQL("DELETE FROM " + tabla_articulos_nombre); |
| 1563 | // db.execSQL("DELETE FROM " + tabla_inventarios_nombre); | 1563 | // db.execSQL("DELETE FROM " + tabla_inventarios_nombre); |
| 1564 | // | 1564 | // |
| 1565 | // // 3 Se elimina la versin anterior de la tabla | 1565 | // // 3 Se elimina la versin anterior de la tabla |
| 1566 | // db.execSQL("DROP TABLE IF EXISTS " + tabla_articulos_nombre); | 1566 | // db.execSQL("DROP TABLE IF EXISTS " + tabla_articulos_nombre); |
| 1567 | // db.execSQL("DROP TABLE IF EXISTS " + tabla_inventarios_nombre); | 1567 | // db.execSQL("DROP TABLE IF EXISTS " + tabla_inventarios_nombre); |
| 1568 | // | 1568 | // |
| 1569 | // // 4 Se crea la nueva version de la tabla | 1569 | // // 4 Se crea la nueva version de la tabla |
| 1570 | // db.execSQL(sqlCreateTablaArticulos); | 1570 | // db.execSQL(sqlCreateTablaArticulos); |
| 1571 | // db.execSQL(sqlCreateTablaInventarios); | 1571 | // db.execSQL(sqlCreateTablaInventarios); |
| 1572 | // | 1572 | // |
| 1573 | // // 5 Cierre: | 1573 | // // 5 Cierre: |
| 1574 | // db.close(); | 1574 | // db.close(); |
| 1575 | // | 1575 | // |
| 1576 | // } catch (Exception e) { | 1576 | // } catch (Exception e) { |
| 1577 | // | 1577 | // |
| 1578 | // GestorLogEventos log = new GestorLogEventos(); | 1578 | // GestorLogEventos log = new GestorLogEventos(); |
| 1579 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 1579 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 1580 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 1580 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 1581 | // log.log("[-- 859 --]" + e.toString(), 4); | 1581 | // log.log("[-- 859 --]" + e.toString(), 4); |
| 1582 | // | 1582 | // |
| 1583 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 1583 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 1584 | // "Imposible de hacer RESET"); | 1584 | // "Imposible de hacer RESET"); |
| 1585 | // } | 1585 | // } |
| 1586 | // } | 1586 | // } |
| 1587 | // | 1587 | // |
| 1588 | // public void borrarArticuloCompra(int cod_sector, int cod_art, int inventario_numero_en_curso){ | 1588 | // public void borrarArticuloCompra(int cod_sector, int cod_art, int inventario_numero_en_curso){ |
| 1589 | // try { | 1589 | // try { |
| 1590 | // System.out.println("::: BaseDatos 1459 borrarArticuloCompra"); | 1590 | // System.out.println("::: BaseDatos 1459 borrarArticuloCompra"); |
| 1591 | // // 1 Abrimos la base: | 1591 | // // 1 Abrimos la base: |
| 1592 | // SQLiteDatabase db = this.getWritableDatabase(); | 1592 | // SQLiteDatabase db = this.getWritableDatabase(); |
| 1593 | // // 2 Suprimimos todas las entradas de las tablas, sin suprimir las | 1593 | // // 2 Suprimimos todas las entradas de las tablas, sin suprimir las |
| 1594 | // // tablas: | 1594 | // // tablas: |
| 1595 | // db.execSQL("DELETE FROM ARTICULOS WHERE ART_SEC="+ cod_sector | 1595 | // db.execSQL("DELETE FROM ARTICULOS WHERE ART_SEC="+ cod_sector |
| 1596 | // + " AND ART_COD="+ cod_art | 1596 | // + " AND ART_COD="+ cod_art |
| 1597 | // + " AND ART_I= "+inventario_numero_en_curso); | 1597 | // + " AND ART_I= "+inventario_numero_en_curso); |
| 1598 | // // 3 Se elimina la versin anterior de la tabla | 1598 | // // 3 Se elimina la versin anterior de la tabla |
| 1599 | // // 5 Cierre: | 1599 | // // 5 Cierre: |
| 1600 | // db.close(); | 1600 | // db.close(); |
| 1601 | // } catch (Exception e) { | 1601 | // } catch (Exception e) { |
| 1602 | // GestorLogEventos log = new GestorLogEventos(); | 1602 | // GestorLogEventos log = new GestorLogEventos(); |
| 1603 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 1603 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 1604 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 1604 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 1605 | // log.log("[-- 859 --]" + e.toString(), 4); | 1605 | // log.log("[-- 859 --]" + e.toString(), 4); |
| 1606 | // //throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 1606 | // //throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 1607 | // // "Imposible de hacer RESET"); | 1607 | // // "Imposible de hacer RESET"); |
| 1608 | // } | 1608 | // } |
| 1609 | // } | 1609 | // } |
| 1610 | // | 1610 | // |
| 1611 | // /** | 1611 | // /** |
| 1612 | // * Regenera la tabla que se le pasa como parametro 1 Abrimos la base 2 | 1612 | // * Regenera la tabla que se le pasa como parametro 1 Abrimos la base 2 |
| 1613 | // * Suprimimos todas las entradas de la tabla 3 Suprimimos la tabla que se | 1613 | // * Suprimimos todas las entradas de la tabla 3 Suprimimos la tabla que se |
| 1614 | // * paso 4 Se crea la nueva versin de la tabla 5 Cierre | 1614 | // * paso 4 Se crea la nueva versin de la tabla 5 Cierre |
| 1615 | // * | 1615 | // * |
| 1616 | // * @param tabla | 1616 | // * @param tabla |
| 1617 | // * @throws ExceptionBDD | 1617 | // * @throws ExceptionBDD |
| 1618 | // */ | 1618 | // */ |
| 1619 | // public void destruirYReconstruir(String tabla) throws ExceptionBDD { | 1619 | // public void destruirYReconstruir(String tabla) throws ExceptionBDD { |
| 1620 | // try { | 1620 | // try { |
| 1621 | // System.out.println("::: BaseDatos 1107 destruirYReconstruir"); | 1621 | // System.out.println("::: BaseDatos 1107 destruirYReconstruir"); |
| 1622 | // // 1 Abrimos la base: | 1622 | // // 1 Abrimos la base: |
| 1623 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 1623 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 1624 | // | 1624 | // |
| 1625 | // // 2 Suprimimos todas las entradas de la tabla | 1625 | // // 2 Suprimimos todas las entradas de la tabla |
| 1626 | // dtb.execSQL("DELETE FROM " + tabla); | 1626 | // dtb.execSQL("DELETE FROM " + tabla); |
| 1627 | // | 1627 | // |
| 1628 | // // 3 Suprimimos la tabla que se paso | 1628 | // // 3 Suprimimos la tabla que se paso |
| 1629 | // dtb.execSQL("DROP TABLE IF EXISTS " + tabla); | 1629 | // dtb.execSQL("DROP TABLE IF EXISTS " + tabla); |
| 1630 | // | 1630 | // |
| 1631 | // // 4 Se crea la nueva versin de la tabla | 1631 | // // 4 Se crea la nueva versin de la tabla |
| 1632 | // if (tabla.compareTo(tabla_articulos_nombre) == 0) { | 1632 | // if (tabla.compareTo(tabla_articulos_nombre) == 0) { |
| 1633 | // dtb.execSQL(sqlCreateTablaArticulos); | 1633 | // dtb.execSQL(sqlCreateTablaArticulos); |
| 1634 | // } else if (tabla.compareTo(tabla_inventarios_nombre) == 0) { | 1634 | // } else if (tabla.compareTo(tabla_inventarios_nombre) == 0) { |
| 1635 | // dtb.execSQL(sqlCreateTablaInventarios); | 1635 | // dtb.execSQL(sqlCreateTablaInventarios); |
| 1636 | // } | 1636 | // } |
| 1637 | // | 1637 | // |
| 1638 | // // 5 Cierre: | 1638 | // // 5 Cierre: |
| 1639 | // dtb.close(); | 1639 | // dtb.close(); |
| 1640 | // | 1640 | // |
| 1641 | // } catch (Exception e) { | 1641 | // } catch (Exception e) { |
| 1642 | // | 1642 | // |
| 1643 | // GestorLogEventos log = new GestorLogEventos(); | 1643 | // GestorLogEventos log = new GestorLogEventos(); |
| 1644 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 1644 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 1645 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 1645 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 1646 | // log.log("[-- 900 --]" + e.toString(), 4); | 1646 | // log.log("[-- 900 --]" + e.toString(), 4); |
| 1647 | // | 1647 | // |
| 1648 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 1648 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 1649 | // "Imposible de hacer RESET"); | 1649 | // "Imposible de hacer RESET"); |
| 1650 | // } | 1650 | // } |
| 1651 | // | 1651 | // |
| 1652 | // } | 1652 | // } |
| 1653 | // | 1653 | // |
| 1654 | // /** | 1654 | // /** |
| 1655 | // * Verifica el estado del inventario por su id para ver si esta abierto 1 | 1655 | // * Verifica el estado del inventario por su id para ver si esta abierto 1 |
| 1656 | // * Abrimos la base de datos en modo lectura 2 Buscamos el inventario con | 1656 | // * Abrimos la base de datos en modo lectura 2 Buscamos el inventario con |
| 1657 | // * ese id en la tabla de inventarios 3 Evaluamos el resultado y si es 1 | 1657 | // * ese id en la tabla de inventarios 3 Evaluamos el resultado y si es 1 |
| 1658 | // * devolvemos true | 1658 | // * devolvemos true |
| 1659 | // * | 1659 | // * |
| 1660 | // * @param id | 1660 | // * @param id |
| 1661 | // * @return true si el inventario esta abierto | 1661 | // * @return true si el inventario esta abierto |
| 1662 | // * @throws ExceptionBDD | 1662 | // * @throws ExceptionBDD |
| 1663 | // * si el inventario no existe | 1663 | // * si el inventario no existe |
| 1664 | // */ | 1664 | // */ |
| 1665 | // public boolean estaAbiertoInventarioConId(int id) throws ExceptionBDD { | 1665 | // public boolean estaAbiertoInventarioConId(int id) throws ExceptionBDD { |
| 1666 | // System.out.println("::: BaseDatos 1152 estaAbiertoInventarioConId"); | 1666 | // System.out.println("::: BaseDatos 1152 estaAbiertoInventarioConId"); |
| 1667 | // // 1 Abrimos la base de datos en modo lectura | 1667 | // // 1 Abrimos la base de datos en modo lectura |
| 1668 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 1668 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 1669 | // System.out.println("::: BaseDatos 1155 que id es " + String.valueOf(id)); | 1669 | // System.out.println("::: BaseDatos 1155 que id es " + String.valueOf(id)); |
| 1670 | // | 1670 | // |
| 1671 | // | 1671 | // |
| 1672 | // /*hardcode mas o menos*/ | 1672 | // /*hardcode mas o menos*/ |
| 1673 | // /*COMO NO PUEDO TRAER EL VALOR DE -2 DEL INVENTARIO POR DEPOSITO Y SIEMPRE | 1673 | // /*COMO NO PUEDO TRAER EL VALOR DE -2 DEL INVENTARIO POR DEPOSITO Y SIEMPRE |
| 1674 | // * VIENE -1, HAGO UN IF PREGUNTANDO DE SI EL CHECK DE VENTAS ES FALSO Y EL ID | 1674 | // * VIENE -1, HAGO UN IF PREGUNTANDO DE SI EL CHECK DE VENTAS ES FALSO Y EL ID |
| 1675 | // * PASADO ES -1 LE ASIGNE A LO BRUTO UN -2 PARA PODER TRABAJAR*/ | 1675 | // * PASADO ES -1 LE ASIGNE A LO BRUTO UN -2 PARA PODER TRABAJAR*/ |
| 1676 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; | 1676 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 1677 | // Cursor c; | 1677 | // Cursor c; |
| 1678 | // System.out.println("::: BaseDatos condicionRadio " + condicionRadio + " " + String.valueOf(id)); | 1678 | // System.out.println("::: BaseDatos condicionRadio " + condicionRadio + " " + String.valueOf(id)); |
| 1679 | // int valorapasar = Integer.parseInt(String.valueOf(id)); | 1679 | // int valorapasar = Integer.parseInt(String.valueOf(id)); |
| 1680 | // if(condicionRadio==false && valorapasar==-1){ | 1680 | // if(condicionRadio==false && valorapasar==-1){ |
| 1681 | // //deposito | 1681 | // //deposito |
| 1682 | // System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 1682 | // System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 1683 | // c = dtb | 1683 | // c = dtb |
| 1684 | // .query(tabla_inventarios_nombre, | 1684 | // .query(tabla_inventarios_nombre, |
| 1685 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 1685 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 1686 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 1686 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 1687 | // new String[] {"-2"}, null, null, null); | 1687 | // new String[] {"-2"}, null, null, null); |
| 1688 | // }else{ | 1688 | // }else{ |
| 1689 | // //ventas | 1689 | // //ventas |
| 1690 | // System.out.println("VENTASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 1690 | // System.out.println("VENTASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 1691 | // c = dtb | 1691 | // c = dtb |
| 1692 | // .query(tabla_inventarios_nombre, | 1692 | // .query(tabla_inventarios_nombre, |
| 1693 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 1693 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 1694 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 1694 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 1695 | // new String[] { String.valueOf(id) }, null, null, null); | 1695 | // new String[] { String.valueOf(id) }, null, null, null); |
| 1696 | // } | 1696 | // } |
| 1697 | // | 1697 | // |
| 1698 | // | 1698 | // |
| 1699 | // /**/ | 1699 | // /**/ |
| 1700 | // // 2 Buscamos el inventario con ese id en la tabla de inventarios | 1700 | // // 2 Buscamos el inventario con ese id en la tabla de inventarios |
| 1701 | //// Cursor c = dtb | 1701 | //// Cursor c = dtb |
| 1702 | //// .query(tabla_inventarios_nombre, | 1702 | //// .query(tabla_inventarios_nombre, |
| 1703 | //// new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 1703 | //// new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 1704 | //// ParametrosInventario.bal_bdd_inventario_numero + "=?", | 1704 | //// ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 1705 | //// new String[] { String.valueOf(id) }, null, null, null); | 1705 | //// new String[] { String.valueOf(id) }, null, null, null); |
| 1706 | // | 1706 | // |
| 1707 | // // 3 Evaluamos el resultado y si es 1 devolvemos true | 1707 | // // 3 Evaluamos el resultado y si es 1 devolvemos true |
| 1708 | // if (c.moveToFirst() == true) { | 1708 | // if (c.moveToFirst() == true) { |
| 1709 | // if (c.getInt(0) == 1) { | 1709 | // if (c.getInt(0) == 1) { |
| 1710 | // return true; | 1710 | // return true; |
| 1711 | // } else { | 1711 | // } else { |
| 1712 | // return false; | 1712 | // return false; |
| 1713 | // } | 1713 | // } |
| 1714 | // | 1714 | // |
| 1715 | // } else { | 1715 | // } else { |
| 1716 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 1716 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 1717 | // "El INVENTARIO con NUMERO=" + String.valueOf(id) | 1717 | // "El INVENTARIO con NUMERO=" + String.valueOf(id) |
| 1718 | // + " no existe"); | 1718 | // + " no existe"); |
| 1719 | // } | 1719 | // } |
| 1720 | // } | 1720 | // } |
| 1721 | // | 1721 | // |
| 1722 | // public boolean estaAbiertoInventarioComprasConId(int id) throws ExceptionBDD { | 1722 | // public boolean estaAbiertoInventarioComprasConId(int id) throws ExceptionBDD { |
| 1723 | // System.out.println("::: BaseDatos 1152 estaAbiertoInventarioComprasConId"); | 1723 | // System.out.println("::: BaseDatos 1152 estaAbiertoInventarioComprasConId"); |
| 1724 | // // 1 Abrimos la base de datos en modo lectura | 1724 | // // 1 Abrimos la base de datos en modo lectura |
| 1725 | // | 1725 | // |
| 1726 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 1726 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 1727 | // Cursor c; | 1727 | // Cursor c; |
| 1728 | // //int valorapasar = Integer.parseInt(String.valueOf(id)); | 1728 | // //int valorapasar = Integer.parseInt(String.valueOf(id)); |
| 1729 | // //if(valorapasar==-3){ | 1729 | // //if(valorapasar==-3){ |
| 1730 | // //deposito | 1730 | // //deposito |
| 1731 | // System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 1731 | // System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 1732 | // //c = dtb.query(tabla_inventarios_nombre, | 1732 | // //c = dtb.query(tabla_inventarios_nombre, |
| 1733 | // // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 1733 | // // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 1734 | // // ParametrosInventario.bal_bdd_inventario_numero + "="+ id, | 1734 | // // ParametrosInventario.bal_bdd_inventario_numero + "="+ id, |
| 1735 | // // new String[] {"-2"}, null, null, null);} | 1735 | // // new String[] {"-2"}, null, null, null);} |
| 1736 | // //select count(INV_NUM) from INVENTARIOS WHERE INV_NUM=-6 | 1736 | // //select count(INV_NUM) from INVENTARIOS WHERE INV_NUM=-6 |
| 1737 | // //c= dtb.rawQuery("select * from "+tabla_inventarios_nombre+" WHERE "+ParametrosInventario.bal_bdd_inventario_numero | 1737 | // //c= dtb.rawQuery("select * from "+tabla_inventarios_nombre+" WHERE "+ParametrosInventario.bal_bdd_inventario_numero |
| 1738 | // // +"="+id, null); | 1738 | // // +"="+id, null); |
| 1739 | // | 1739 | // |
| 1740 | // c = dtb | 1740 | // c = dtb |
| 1741 | // .query(tabla_inventarios_nombre, | 1741 | // .query(tabla_inventarios_nombre, |
| 1742 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 1742 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 1743 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 1743 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 1744 | // new String[] { String.valueOf(id) }, null, null, null); | 1744 | // new String[] { String.valueOf(id) }, null, null, null); |
| 1745 | // | 1745 | // |
| 1746 | // System.out.println("::: BaseDatos c.getInt(0) que traeeee "); | 1746 | // System.out.println("::: BaseDatos c.getInt(0) que traeeee "); |
| 1747 | //// System.out.println("::: BaseDatos c.getInt(0) que traeeee " + c.getString(0)); | 1747 | //// System.out.println("::: BaseDatos c.getInt(0) que traeeee " + c.getString(0)); |
| 1748 | // // 3 Evaluamos el resultado y si es 1 devolvemos true | 1748 | // // 3 Evaluamos el resultado y si es 1 devolvemos true |
| 1749 | // | 1749 | // |
| 1750 | // | 1750 | // |
| 1751 | // // 3 Evaluamos el resultado y si es 1 devolvemos true | 1751 | // // 3 Evaluamos el resultado y si es 1 devolvemos true |
| 1752 | // if (c.moveToFirst() == true) { | 1752 | // if (c.moveToFirst() == true) { |
| 1753 | // if (c.getInt(0) == 1) { | 1753 | // if (c.getInt(0) == 1) { |
| 1754 | // return true; | 1754 | // return true; |
| 1755 | // } else { | 1755 | // } else { |
| 1756 | // return false; | 1756 | // return false; |
| 1757 | // } | 1757 | // } |
| 1758 | ////return true; | 1758 | ////return true; |
| 1759 | // } else { | 1759 | // } else { |
| 1760 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 1760 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 1761 | // "El INVENTARIO con NUMERO=" + String.valueOf(id) | 1761 | // "El INVENTARIO con NUMERO=" + String.valueOf(id) |
| 1762 | // + " no existe"); | 1762 | // + " no existe"); |
| 1763 | // } | 1763 | // } |
| 1764 | // } | 1764 | // } |
| 1765 | // | 1765 | // |
| 1766 | // | 1766 | // |
| 1767 | // public void SelectTotal() throws IOException { | 1767 | // public void SelectTotal() throws IOException { |
| 1768 | // System.out.println("::: BaseDatos 1179 SelectTotal"); | 1768 | // System.out.println("::: BaseDatos 1179 SelectTotal"); |
| 1769 | // | 1769 | // |
| 1770 | // /** | 1770 | // /** |
| 1771 | // * EN ESTA FUNCIN SE CREAR UNA EXPORTACIN DE SEGURIDAD DE LA BASE DE | 1771 | // * EN ESTA FUNCIN SE CREAR UNA EXPORTACIN DE SEGURIDAD DE LA BASE DE |
| 1772 | // * DATOS | 1772 | // * DATOS |
| 1773 | // */ | 1773 | // */ |
| 1774 | // | 1774 | // |
| 1775 | // /** | 1775 | // /** |
| 1776 | // * COMIENZO LA CONFIGURACIN DE DONDE IR LOS DATOS | 1776 | // * COMIENZO LA CONFIGURACIN DE DONDE IR LOS DATOS |
| 1777 | // */ | 1777 | // */ |
| 1778 | // | 1778 | // |
| 1779 | // String query = "Select * from " + ParametrosInventario.tabla_articulos; | 1779 | // String query = "Select * from " + ParametrosInventario.tabla_articulos; |
| 1780 | // | 1780 | // |
| 1781 | // // se llama en el gestor que se encargar de dibujar el txt con las | 1781 | // // se llama en el gestor que se encargar de dibujar el txt con las |
| 1782 | // // etiquetas de xml | 1782 | // // etiquetas de xml |
| 1783 | // GestorLogEventos logDatos = new GestorLogEventos(); | 1783 | // GestorLogEventos logDatos = new GestorLogEventos(); |
| 1784 | // logDatos.tipo_0 = Parametros.PREF_LOG_EVENTOS; | 1784 | // logDatos.tipo_0 = Parametros.PREF_LOG_EVENTOS; |
| 1785 | // logDatos.tipo_2 = Parametros.PREF_LOG_PROCESOS; | 1785 | // logDatos.tipo_2 = Parametros.PREF_LOG_PROCESOS; |
| 1786 | // logDatos.tipo_3 = Parametros.PREF_LOG_MENSAJES; | 1786 | // logDatos.tipo_3 = Parametros.PREF_LOG_MENSAJES; |
| 1787 | // logDatos.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 1787 | // logDatos.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 1788 | // logDatos.setUbicacion(ParametrosInventario.CARPETA_LOGDATOS); | 1788 | // logDatos.setUbicacion(ParametrosInventario.CARPETA_LOGDATOS); |
| 1789 | // | 1789 | // |
| 1790 | // GestorLogEventos logErrores = new GestorLogEventos(); | 1790 | // GestorLogEventos logErrores = new GestorLogEventos(); |
| 1791 | // logErrores.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 1791 | // logErrores.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 1792 | // logErrores.tipo_0 = Parametros.PREF_LOG_EVENTOS; | 1792 | // logErrores.tipo_0 = Parametros.PREF_LOG_EVENTOS; |
| 1793 | // logErrores.tipo_2 = Parametros.PREF_LOG_PROCESOS; | 1793 | // logErrores.tipo_2 = Parametros.PREF_LOG_PROCESOS; |
| 1794 | // logErrores.tipo_3 = Parametros.PREF_LOG_MENSAJES; | 1794 | // logErrores.tipo_3 = Parametros.PREF_LOG_MENSAJES; |
| 1795 | // logErrores.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 1795 | // logErrores.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 1796 | // | 1796 | // |
| 1797 | // String ruta = ParametrosInventario.CARPETA_LOGDATOS + "log.txt"; | 1797 | // String ruta = ParametrosInventario.CARPETA_LOGDATOS + "log.txt"; |
| 1798 | // logErrores.log("La ruta del logDatos es: " + ruta, 3); | 1798 | // logErrores.log("La ruta del logDatos es: " + ruta, 3); |
| 1799 | // File LogDatosAnterior = new File(ruta); | 1799 | // File LogDatosAnterior = new File(ruta); |
| 1800 | // LogDatosAnterior.delete(); | 1800 | // LogDatosAnterior.delete(); |
| 1801 | // LogDatosAnterior.deleteOnExit(); | 1801 | // LogDatosAnterior.deleteOnExit(); |
| 1802 | // | 1802 | // |
| 1803 | // logErrores.log("Comienza la exportacin de artculos", 2); | 1803 | // logErrores.log("Comienza la exportacin de artculos", 2); |
| 1804 | // | 1804 | // |
| 1805 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 1805 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 1806 | // Cursor c = dtb.rawQuery(query, null); | 1806 | // Cursor c = dtb.rawQuery(query, null); |
| 1807 | // | 1807 | // |
| 1808 | // /** | 1808 | // /** |
| 1809 | // * COMIENZA LA EXPORTACIN DE LA LA TABLA ARTCULOS | 1809 | // * COMIENZA LA EXPORTACIN DE LA LA TABLA ARTCULOS |
| 1810 | // */ | 1810 | // */ |
| 1811 | // | 1811 | // |
| 1812 | // try { | 1812 | // try { |
| 1813 | // if (c.moveToFirst()) { | 1813 | // if (c.moveToFirst()) { |
| 1814 | // | 1814 | // |
| 1815 | // | 1815 | // |
| 1816 | // System.out.println("*** DATOS="+ParametrosInventario.tabla_articulos); | 1816 | // System.out.println("*** DATOS="+ParametrosInventario.tabla_articulos); |
| 1817 | // logDatos.Logdatos(ParametrosInventario.tabla_articulos, null, 1); | 1817 | // logDatos.Logdatos(ParametrosInventario.tabla_articulos, null, 1); |
| 1818 | // int contador = 1; | 1818 | // int contador = 1; |
| 1819 | // do { | 1819 | // do { |
| 1820 | // | 1820 | // |
| 1821 | // String sector = c.getString(0); | 1821 | // String sector = c.getString(0); |
| 1822 | // String codigo = c.getString(1); | 1822 | // String codigo = c.getString(1); |
| 1823 | // String codigoBarra = c.getString(2); | 1823 | // String codigoBarra = c.getString(2); |
| 1824 | // String inventario = c.getString(3); | 1824 | // String inventario = c.getString(3); |
| 1825 | // String descripcion = c.getString(4); | 1825 | // String descripcion = c.getString(4); |
| 1826 | // String precioVenta = c.getString(5); | 1826 | // String precioVenta = c.getString(5); |
| 1827 | // String precioCosto = c.getString(6); | 1827 | // String precioCosto = c.getString(6); |
| 1828 | // String foto = c.getString(7); | 1828 | // String foto = c.getString(7); |
| 1829 | // String cantidad = c.getString(8); | 1829 | // String cantidad = c.getString(8); |
| 1830 | // String fechaInicio = c.getString(9); | 1830 | // String fechaInicio = c.getString(9); |
| 1831 | // String fechaFin = c.getString(10); | 1831 | // String fechaFin = c.getString(10); |
| 1832 | // String exisVenta = c.getString(11); | 1832 | // String exisVenta = c.getString(11); |
| 1833 | // String exisDeposito = c.getString(12); | 1833 | // String exisDeposito = c.getString(12); |
| 1834 | // String subtotal = c.getString(13); | 1834 | // String subtotal = c.getString(13); |
| 1835 | // | 1835 | // |
| 1836 | // String contadorString = String.valueOf(contador); | 1836 | // String contadorString = String.valueOf(contador); |
| 1837 | // | 1837 | // |
| 1838 | // logDatos.Logdatos(contadorString, null, 2); | 1838 | // logDatos.Logdatos(contadorString, null, 2); |
| 1839 | // logDatos.Logdatos(sector, | 1839 | // logDatos.Logdatos(sector, |
| 1840 | // ParametrosInventario.bal_bdd_articulo_sector, 3); | 1840 | // ParametrosInventario.bal_bdd_articulo_sector, 3); |
| 1841 | // logDatos.Logdatos(codigo, | 1841 | // logDatos.Logdatos(codigo, |
| 1842 | // ParametrosInventario.bal_bdd_articulo_codigo, 3); | 1842 | // ParametrosInventario.bal_bdd_articulo_codigo, 3); |
| 1843 | // logDatos.Logdatos(codigoBarra, | 1843 | // logDatos.Logdatos(codigoBarra, |
| 1844 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 1844 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 1845 | // 3); | 1845 | // 3); |
| 1846 | // logDatos.Logdatos(inventario, | 1846 | // logDatos.Logdatos(inventario, |
| 1847 | // ParametrosInventario.bal_bdd_articulo_inventario, 3); | 1847 | // ParametrosInventario.bal_bdd_articulo_inventario, 3); |
| 1848 | // logDatos.Logdatos(descripcion, | 1848 | // logDatos.Logdatos(descripcion, |
| 1849 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 1849 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 1850 | // 3); | 1850 | // 3); |
| 1851 | // logDatos.Logdatos(precioVenta, | 1851 | // logDatos.Logdatos(precioVenta, |
| 1852 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 1852 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 1853 | // 3); | 1853 | // 3); |
| 1854 | // logDatos.Logdatos(precioCosto, | 1854 | // logDatos.Logdatos(precioCosto, |
| 1855 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 1855 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 1856 | // 3); | 1856 | // 3); |
| 1857 | // logDatos.Logdatos(foto, | 1857 | // logDatos.Logdatos(foto, |
| 1858 | // ParametrosInventario.bal_bdd_articulo_foto, 3); | 1858 | // ParametrosInventario.bal_bdd_articulo_foto, 3); |
| 1859 | // logDatos.Logdatos(cantidad, | 1859 | // logDatos.Logdatos(cantidad, |
| 1860 | // ParametrosInventario.bal_bdd_articulo_cantidad, 3); | 1860 | // ParametrosInventario.bal_bdd_articulo_cantidad, 3); |
| 1861 | // logDatos.Logdatos(fechaInicio, | 1861 | // logDatos.Logdatos(fechaInicio, |
| 1862 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 1862 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 1863 | // 3); | 1863 | // 3); |
| 1864 | // logDatos.Logdatos(fechaFin, | 1864 | // logDatos.Logdatos(fechaFin, |
| 1865 | // ParametrosInventario.bal_bdd_articulo_fechaFin, 3); | 1865 | // ParametrosInventario.bal_bdd_articulo_fechaFin, 3); |
| 1866 | // | 1866 | // |
| 1867 | // | 1867 | // |
| 1868 | // logDatos.Logdatos(exisVenta, | 1868 | // logDatos.Logdatos(exisVenta, |
| 1869 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, 3); | 1869 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, 3); |
| 1870 | // logDatos.Logdatos(exisDeposito, | 1870 | // logDatos.Logdatos(exisDeposito, |
| 1871 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, 3); | 1871 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, 3); |
| 1872 | // | 1872 | // |
| 1873 | // | 1873 | // |
| 1874 | // logDatos.Logdatos(null, null, 21); | 1874 | // logDatos.Logdatos(null, null, 21); |
| 1875 | // contador++; | 1875 | // contador++; |
| 1876 | // | 1876 | // |
| 1877 | // } while (c.moveToNext()); | 1877 | // } while (c.moveToNext()); |
| 1878 | // | 1878 | // |
| 1879 | // logDatos.Logdatos(null, null, 11); | 1879 | // logDatos.Logdatos(null, null, 11); |
| 1880 | // | 1880 | // |
| 1881 | // } else { | 1881 | // } else { |
| 1882 | // logErrores.log("La tabla no tiene datos", 3); | 1882 | // logErrores.log("La tabla no tiene datos", 3); |
| 1883 | // } | 1883 | // } |
| 1884 | // | 1884 | // |
| 1885 | // } catch (Exception e1) { | 1885 | // } catch (Exception e1) { |
| 1886 | // logErrores.log( | 1886 | // logErrores.log( |
| 1887 | // "[-- 1046 --] ERROR EN LA EXPORTACION" + e1.toString(), 4); | 1887 | // "[-- 1046 --] ERROR EN LA EXPORTACION" + e1.toString(), 4); |
| 1888 | // logDatos.Logdatos(null, null, 11); | 1888 | // logDatos.Logdatos(null, null, 11); |
| 1889 | // } | 1889 | // } |
| 1890 | // | 1890 | // |
| 1891 | // dtb.close(); | 1891 | // dtb.close(); |
| 1892 | // | 1892 | // |
| 1893 | // /** | 1893 | // /** |
| 1894 | // * EXPORTACIN DE ARTCULO TERMINAD | 1894 | // * EXPORTACIN DE ARTCULO TERMINAD |
| 1895 | // */ | 1895 | // */ |
| 1896 | // | 1896 | // |
| 1897 | // /** | 1897 | // /** |
| 1898 | // * EXPORTACIN DE REFERENCIAS FINALIZA | 1898 | // * EXPORTACIN DE REFERENCIAS FINALIZA |
| 1899 | // */ | 1899 | // */ |
| 1900 | // | 1900 | // |
| 1901 | // logErrores.log("Comienza la exportacin de Referencias", 2); | 1901 | // logErrores.log("Comienza la exportacin de Referencias", 2); |
| 1902 | // | 1902 | // |
| 1903 | // String query_1 = "Select * from " | 1903 | // String query_1 = "Select * from " |
| 1904 | // + ParametrosInventario.tabla_referencias; | 1904 | // + ParametrosInventario.tabla_referencias; |
| 1905 | // SQLiteDatabase dtb_1 = this.getReadableDatabase(); | 1905 | // SQLiteDatabase dtb_1 = this.getReadableDatabase(); |
| 1906 | // Cursor c_1 = dtb_1.rawQuery(query_1, null); | 1906 | // Cursor c_1 = dtb_1.rawQuery(query_1, null); |
| 1907 | // | 1907 | // |
| 1908 | // try { | 1908 | // try { |
| 1909 | // if (c_1.moveToFirst()) { | 1909 | // if (c_1.moveToFirst()) { |
| 1910 | // | 1910 | // |
| 1911 | // logDatos.Logdatos(ParametrosInventario.tabla_referencias, null, | 1911 | // logDatos.Logdatos(ParametrosInventario.tabla_referencias, null, |
| 1912 | // 1); | 1912 | // 1); |
| 1913 | // int contador = 1; | 1913 | // int contador = 1; |
| 1914 | // do { | 1914 | // do { |
| 1915 | // | 1915 | // |
| 1916 | // String sector = c_1.getString(0); | 1916 | // String sector = c_1.getString(0); |
| 1917 | // String codigo = c_1.getString(1); | 1917 | // String codigo = c_1.getString(1); |
| 1918 | // String codigoBarra = c_1.getString(2); | 1918 | // String codigoBarra = c_1.getString(2); |
| 1919 | // String descripcion = c_1.getString(3); | 1919 | // String descripcion = c_1.getString(3); |
| 1920 | // String precioVenta = c_1.getString(4); | 1920 | // String precioVenta = c_1.getString(4); |
| 1921 | // String precioCosto = c_1.getString(5); | 1921 | // String precioCosto = c_1.getString(5); |
| 1922 | // String foto = c_1.getString(6); | 1922 | // String foto = c_1.getString(6); |
| 1923 | // | 1923 | // |
| 1924 | // String exisVenta = c_1.getString(7); | 1924 | // String exisVenta = c_1.getString(7); |
| 1925 | // String exisDeposito = c_1.getString(8); | 1925 | // String exisDeposito = c_1.getString(8); |
| 1926 | // | 1926 | // |
| 1927 | // String contadorString = String.valueOf(contador); | 1927 | // String contadorString = String.valueOf(contador); |
| 1928 | // | 1928 | // |
| 1929 | // logDatos.Logdatos(contadorString, null, 2); | 1929 | // logDatos.Logdatos(contadorString, null, 2); |
| 1930 | // logDatos.Logdatos(sector, | 1930 | // logDatos.Logdatos(sector, |
| 1931 | // ParametrosInventario.bal_bdd_referencia_sector, 3); | 1931 | // ParametrosInventario.bal_bdd_referencia_sector, 3); |
| 1932 | // logDatos.Logdatos(codigo, | 1932 | // logDatos.Logdatos(codigo, |
| 1933 | // ParametrosInventario.bal_bdd_referencia_codigo, 3); | 1933 | // ParametrosInventario.bal_bdd_referencia_codigo, 3); |
| 1934 | // logDatos.Logdatos( | 1934 | // logDatos.Logdatos( |
| 1935 | // codigoBarra, | 1935 | // codigoBarra, |
| 1936 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, | 1936 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 1937 | // 3); | 1937 | // 3); |
| 1938 | // logDatos.Logdatos( | 1938 | // logDatos.Logdatos( |
| 1939 | // descripcion, | 1939 | // descripcion, |
| 1940 | // ParametrosInventario.bal_bdd_referencia_descripcion, | 1940 | // ParametrosInventario.bal_bdd_referencia_descripcion, |
| 1941 | // 3); | 1941 | // 3); |
| 1942 | // logDatos.Logdatos( | 1942 | // logDatos.Logdatos( |
| 1943 | // precioVenta, | 1943 | // precioVenta, |
| 1944 | // ParametrosInventario.bal_bdd_referencia_precio_venta, | 1944 | // ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 1945 | // 3); | 1945 | // 3); |
| 1946 | // logDatos.Logdatos( | 1946 | // logDatos.Logdatos( |
| 1947 | // precioCosto, | 1947 | // precioCosto, |
| 1948 | // ParametrosInventario.bal_bdd_referencia_precio_costo, | 1948 | // ParametrosInventario.bal_bdd_referencia_precio_costo, |
| 1949 | // 3); | 1949 | // 3); |
| 1950 | // logDatos.Logdatos(foto, | 1950 | // logDatos.Logdatos(foto, |
| 1951 | // ParametrosInventario.bal_bdd_referencia_foto, 3); | 1951 | // ParametrosInventario.bal_bdd_referencia_foto, 3); |
| 1952 | // | 1952 | // |
| 1953 | // | 1953 | // |
| 1954 | // logDatos.Logdatos( | 1954 | // logDatos.Logdatos( |
| 1955 | // exisVenta, | 1955 | // exisVenta, |
| 1956 | // ParametrosInventario.bal_bdd_referencia_existencia_venta, | 1956 | // ParametrosInventario.bal_bdd_referencia_existencia_venta, |
| 1957 | // 3); | 1957 | // 3); |
| 1958 | // logDatos.Logdatos( | 1958 | // logDatos.Logdatos( |
| 1959 | // exisDeposito, | 1959 | // exisDeposito, |
| 1960 | // ParametrosInventario.bal_bdd_referencia_existencia_deposito, | 1960 | // ParametrosInventario.bal_bdd_referencia_existencia_deposito, |
| 1961 | // 3); | 1961 | // 3); |
| 1962 | // | 1962 | // |
| 1963 | // logDatos.Logdatos(null, null, 21); | 1963 | // logDatos.Logdatos(null, null, 21); |
| 1964 | // contador++; | 1964 | // contador++; |
| 1965 | // | 1965 | // |
| 1966 | // } while (c_1.moveToNext()); | 1966 | // } while (c_1.moveToNext()); |
| 1967 | // | 1967 | // |
| 1968 | // logDatos.Logdatos(null, null, 11); | 1968 | // logDatos.Logdatos(null, null, 11); |
| 1969 | // | 1969 | // |
| 1970 | // } else { | 1970 | // } else { |
| 1971 | // logErrores.log("La tabla no tiene datos", 3); | 1971 | // logErrores.log("La tabla no tiene datos", 3); |
| 1972 | // } | 1972 | // } |
| 1973 | // | 1973 | // |
| 1974 | // } catch (Exception e1) { | 1974 | // } catch (Exception e1) { |
| 1975 | // logErrores.log( | 1975 | // logErrores.log( |
| 1976 | // "[-- 1102 --]ERROR EN LA EXPORTACION" + e1.toString(), 4); | 1976 | // "[-- 1102 --]ERROR EN LA EXPORTACION" + e1.toString(), 4); |
| 1977 | // logDatos.Logdatos(null, null, 11); | 1977 | // logDatos.Logdatos(null, null, 11); |
| 1978 | // } | 1978 | // } |
| 1979 | // dtb_1.close(); | 1979 | // dtb_1.close(); |
| 1980 | // | 1980 | // |
| 1981 | // /** | 1981 | // /** |
| 1982 | // * EXPORTACIN DE REFERENCIAS FINALIZADA | 1982 | // * EXPORTACIN DE REFERENCIAS FINALIZADA |
| 1983 | // */ | 1983 | // */ |
| 1984 | // | 1984 | // |
| 1985 | // /** | 1985 | // /** |
| 1986 | // * COMIENZA LA EXPORTACIN DE INVENTARIOS | 1986 | // * COMIENZA LA EXPORTACIN DE INVENTARIOS |
| 1987 | // */ | 1987 | // */ |
| 1988 | // | 1988 | // |
| 1989 | // logErrores.log("Comienza la exportacin de Inventarios", 2); | 1989 | // logErrores.log("Comienza la exportacin de Inventarios", 2); |
| 1990 | // | 1990 | // |
| 1991 | // String query_2 = "Select * from " | 1991 | // String query_2 = "Select * from " |
| 1992 | // + ParametrosInventario.tabla_inventarios; | 1992 | // + ParametrosInventario.tabla_inventarios; |
| 1993 | // SQLiteDatabase dtb_2 = this.getReadableDatabase(); | 1993 | // SQLiteDatabase dtb_2 = this.getReadableDatabase(); |
| 1994 | // Cursor c_2 = dtb_2.rawQuery(query_2, null); | 1994 | // Cursor c_2 = dtb_2.rawQuery(query_2, null); |
| 1995 | // | 1995 | // |
| 1996 | // try { | 1996 | // try { |
| 1997 | // if (c_2.moveToFirst()) { | 1997 | // if (c_2.moveToFirst()) { |
| 1998 | // | 1998 | // |
| 1999 | // logDatos.Logdatos(ParametrosInventario.tabla_inventarios, null, | 1999 | // logDatos.Logdatos(ParametrosInventario.tabla_inventarios, null, |
| 2000 | // 1); | 2000 | // 1); |
| 2001 | // int contador = 1; | 2001 | // int contador = 1; |
| 2002 | // do { | 2002 | // do { |
| 2003 | // | 2003 | // |
| 2004 | // String numero = c_2.getString(0); | 2004 | // String numero = c_2.getString(0); |
| 2005 | // String descripcion = c_2.getString(1); | 2005 | // String descripcion = c_2.getString(1); |
| 2006 | // String fechaInicio = c_2.getString(2); | 2006 | // String fechaInicio = c_2.getString(2); |
| 2007 | // String fechaFin = c_2.getString(3); | 2007 | // String fechaFin = c_2.getString(3); |
| 2008 | // String estado = c_2.getString(4); | 2008 | // String estado = c_2.getString(4); |
| 2009 | // String cantidad = c_2.getString(5); | 2009 | // String cantidad = c_2.getString(5); |
| 2010 | // String subtotal = c_2.getString(6); | 2010 | // String subtotal = c_2.getString(6); |
| 2011 | // | 2011 | // |
| 2012 | // String contadorString = String.valueOf(contador); | 2012 | // String contadorString = String.valueOf(contador); |
| 2013 | // | 2013 | // |
| 2014 | // logDatos.Logdatos(contadorString, null, 2); | 2014 | // logDatos.Logdatos(contadorString, null, 2); |
| 2015 | // logDatos.Logdatos(numero, | 2015 | // logDatos.Logdatos(numero, |
| 2016 | // ParametrosInventario.bal_bdd_inventario_numero, 3); | 2016 | // ParametrosInventario.bal_bdd_inventario_numero, 3); |
| 2017 | // logDatos.Logdatos( | 2017 | // logDatos.Logdatos( |
| 2018 | // descripcion, | 2018 | // descripcion, |
| 2019 | // ParametrosInventario.bal_bdd_inventario_descripcion, | 2019 | // ParametrosInventario.bal_bdd_inventario_descripcion, |
| 2020 | // 3); | 2020 | // 3); |
| 2021 | // logDatos.Logdatos( | 2021 | // logDatos.Logdatos( |
| 2022 | // fechaInicio, | 2022 | // fechaInicio, |
| 2023 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, | 2023 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 2024 | // 3); | 2024 | // 3); |
| 2025 | // logDatos.Logdatos(fechaFin, | 2025 | // logDatos.Logdatos(fechaFin, |
| 2026 | // ParametrosInventario.bal_bdd_inventario_fechaFin, 3); | 2026 | // ParametrosInventario.bal_bdd_inventario_fechaFin, 3); |
| 2027 | // logDatos.Logdatos(estado, | 2027 | // logDatos.Logdatos(estado, |
| 2028 | // ParametrosInventario.bal_bdd_inventario_estado, 3); | 2028 | // ParametrosInventario.bal_bdd_inventario_estado, 3); |
| 2029 | // logDatos.Logdatos(cantidad, | 2029 | // logDatos.Logdatos(cantidad, |
| 2030 | // ParametrosInventario.bal_bdd_inventario_cantidad, 3); | 2030 | // ParametrosInventario.bal_bdd_inventario_cantidad, 3); |
| 2031 | // | 2031 | // |
| 2032 | // logDatos.Logdatos(null, null, 21); | 2032 | // logDatos.Logdatos(null, null, 21); |
| 2033 | // contador++; | 2033 | // contador++; |
| 2034 | // | 2034 | // |
| 2035 | // } while (c_2.moveToNext()); | 2035 | // } while (c_2.moveToNext()); |
| 2036 | // | 2036 | // |
| 2037 | // logDatos.Logdatos(null, null, 11); | 2037 | // logDatos.Logdatos(null, null, 11); |
| 2038 | // | 2038 | // |
| 2039 | // } else { | 2039 | // } else { |
| 2040 | // logErrores.log("La tabla no tiene datos", 3); | 2040 | // logErrores.log("La tabla no tiene datos", 3); |
| 2041 | // } | 2041 | // } |
| 2042 | // | 2042 | // |
| 2043 | // } catch (Exception e1) { | 2043 | // } catch (Exception e1) { |
| 2044 | // logErrores.log( | 2044 | // logErrores.log( |
| 2045 | // "[-- 1169 --]ERROR EN LA EXPORTACION" + e1.toString(), 4); | 2045 | // "[-- 1169 --]ERROR EN LA EXPORTACION" + e1.toString(), 4); |
| 2046 | // logDatos.Logdatos(null, null, 11); | 2046 | // logDatos.Logdatos(null, null, 11); |
| 2047 | // } | 2047 | // } |
| 2048 | // dtb_2.close(); | 2048 | // dtb_2.close(); |
| 2049 | // | 2049 | // |
| 2050 | // /** | 2050 | // /** |
| 2051 | // * EXPORTACIN DE INVENTARIOS FINALIZADA | 2051 | // * EXPORTACIN DE INVENTARIOS FINALIZADA |
| 2052 | // */ | 2052 | // */ |
| 2053 | // | 2053 | // |
| 2054 | // } | 2054 | // } |
| 2055 | // | 2055 | // |
| 2056 | // /** | 2056 | // /** |
| 2057 | // * Exporta la base de datos que contiene los valores medidos para los | 2057 | // * Exporta la base de datos que contiene los valores medidos para los |
| 2058 | // * inventarios realizados | 2058 | // * inventarios realizados |
| 2059 | // * <p> | 2059 | // * <p> |
| 2060 | // * 1 Creacion del nuevo documento | 2060 | // * 1 Creacion del nuevo documento |
| 2061 | // * <p> | 2061 | // * <p> |
| 2062 | // * 2 Creacion del elemento de cabecera | 2062 | // * 2 Creacion del elemento de cabecera |
| 2063 | // * <p> | 2063 | // * <p> |
| 2064 | // * 3 Abrimos la base de datos en modo lectura | 2064 | // * 3 Abrimos la base de datos en modo lectura |
| 2065 | // * <p> | 2065 | // * <p> |
| 2066 | // * 4 Para cada inventario de la lista | 2066 | // * 4 Para cada inventario de la lista |
| 2067 | // * <p> | 2067 | // * <p> |
| 2068 | // * 4.1 Creamos un elemento para el inventario | 2068 | // * 4.1 Creamos un elemento para el inventario |
| 2069 | // * <p> | 2069 | // * <p> |
| 2070 | // * 4.2 Recorro las columnas y creo los elementos de los datos | 2070 | // * 4.2 Recorro las columnas y creo los elementos de los datos |
| 2071 | // * <p> | 2071 | // * <p> |
| 2072 | // * 4.3 Buscamos los datos de los articulos | 2072 | // * 4.3 Buscamos los datos de los articulos |
| 2073 | // * <p> | 2073 | // * <p> |
| 2074 | // * 4.4 Creamos los elementos para cada artculo | 2074 | // * 4.4 Creamos los elementos para cada artculo |
| 2075 | // * <p> | 2075 | // * <p> |
| 2076 | // * 5 Guardamos el DOM como archivo XML | 2076 | // * 5 Guardamos el DOM como archivo XML |
| 2077 | // * <p> | 2077 | // * <p> |
| 2078 | // * 6 Mandamos el archivo en POST hacia el servidor | 2078 | // * 6 Mandamos el archivo en POST hacia el servidor |
| 2079 | // * | 2079 | // * |
| 2080 | // * @return TRUE si el export se realiza con xito | 2080 | // * @return TRUE si el export se realiza con xito |
| 2081 | // * @throws ExceptionBDD | 2081 | // * @throws ExceptionBDD |
| 2082 | // * En caso de fracaso, el error ser generado | 2082 | // * En caso de fracaso, el error ser generado |
| 2083 | // * @throws ExceptionHttpExchange | 2083 | // * @throws ExceptionHttpExchange |
| 2084 | // */ | 2084 | // */ |
| 2085 | // // Tiene en cuenta el nuevo formato para datos de inventario tambien | 2085 | // // Tiene en cuenta el nuevo formato para datos de inventario tambien |
| 2086 | // public boolean exportarTodasBaseDatosSQLite( | 2086 | // public boolean exportarTodasBaseDatosSQLite( |
| 2087 | // ArrayList<Integer> listaInventariosSeleccionados) | 2087 | // ArrayList<Integer> listaInventariosSeleccionados) |
| 2088 | // throws ExceptionBDD, ExceptionHttpExchange { | 2088 | // throws ExceptionBDD, ExceptionHttpExchange { |
| 2089 | // System.out.println("::: BaseDatos 1473 exportarBDSQLite"); | 2089 | // System.out.println("::: BaseDatos 1473 exportarBDSQLite"); |
| 2090 | // try { | 2090 | // try { |
| 2091 | // // Chequear | 2091 | // // Chequear |
| 2092 | // boolean hayAlMenosUno = false; | 2092 | // boolean hayAlMenosUno = false; |
| 2093 | // // String string_lista_inventarios = ""; | 2093 | // // String string_lista_inventarios = ""; |
| 2094 | // // for (int inv : listaInventariosSeleccionados) { | 2094 | // // for (int inv : listaInventariosSeleccionados) { |
| 2095 | // // string_lista_inventarios += String.valueOf(inv) + ","; | 2095 | // // string_lista_inventarios += String.valueOf(inv) + ","; |
| 2096 | // // } | 2096 | // // } |
| 2097 | // // string_lista_inventarios = string_lista_inventarios.substring(0, | 2097 | // // string_lista_inventarios = string_lista_inventarios.substring(0, |
| 2098 | // // string_lista_inventarios.length()-1); | 2098 | // // string_lista_inventarios.length()-1); |
| 2099 | // | 2099 | // |
| 2100 | // // 1 Creacion del nuevo documento | 2100 | // // 1 Creacion del nuevo documento |
| 2101 | // DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory.newInstance(); | 2101 | // DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory.newInstance(); |
| 2102 | // DocumentBuilder constructorDocumentos = fabricaDocumentos.newDocumentBuilder(); | 2102 | // DocumentBuilder constructorDocumentos = fabricaDocumentos.newDocumentBuilder(); |
| 2103 | // Document documento = constructorDocumentos.newDocument(); | 2103 | // Document documento = constructorDocumentos.newDocument(); |
| 2104 | // | 2104 | // |
| 2105 | // // Propiedades del DOM: | 2105 | // // Propiedades del DOM: |
| 2106 | // documento.setXmlVersion("1.0"); | 2106 | // documento.setXmlVersion("1.0"); |
| 2107 | // documento.setXmlStandalone(true); | 2107 | // documento.setXmlStandalone(true); |
| 2108 | // | 2108 | // |
| 2109 | // // 2 Creacion del elemento de cabecera | 2109 | // // 2 Creacion del elemento de cabecera |
| 2110 | // Element titulo = documento | 2110 | // Element titulo = documento |
| 2111 | // .createElement(ParametrosInventario.bal_xml_export_cabecera); | 2111 | // .createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 2112 | // | 2112 | // |
| 2113 | // // 3 Abrimos la base de datos en modo lectura: | 2113 | // // 3 Abrimos la base de datos en modo lectura: |
| 2114 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 2114 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 2115 | // System.out.println("::: BaseDatos 1501 "); | 2115 | // System.out.println("::: BaseDatos 1501 "); |
| 2116 | // | 2116 | // |
| 2117 | // | 2117 | // |
| 2118 | //// int radioButtonID = RadioGroupProductosNoContabilizados | 2118 | //// int radioButtonID = RadioGroupProductosNoContabilizados |
| 2119 | //// .getCheckedRadioButtonId(); | 2119 | //// .getCheckedRadioButtonId(); |
| 2120 | //// View radioButton = RadioGroupProductosNoContabilizados | 2120 | //// View radioButton = RadioGroupProductosNoContabilizados |
| 2121 | //// .findViewById(radioButtonID); | 2121 | //// .findViewById(radioButtonID); |
| 2122 | //// int idx = RadioGroupProductosNoContabilizados | 2122 | //// int idx = RadioGroupProductosNoContabilizados |
| 2123 | //// .indexOfChild(radioButton); | 2123 | //// .indexOfChild(radioButton); |
| 2124 | //// if (idx == 0) { | 2124 | //// if (idx == 0) { |
| 2125 | //// System.out.println("-----!!!!!!---!!!!!!!------------!!!!!--------------"); | 2125 | //// System.out.println("-----!!!!!!---!!!!!!!------------!!!!!--------------"); |
| 2126 | //// System.out.println("BASE DE DATOS SALE EN 1"); | 2126 | //// System.out.println("BASE DE DATOS SALE EN 1"); |
| 2127 | //// ProductosNoContabilizados = 1; | 2127 | //// ProductosNoContabilizados = 1; |
| 2128 | //// } else if (idx == 1) { | 2128 | //// } else if (idx == 1) { |
| 2129 | //// System.out.println("-----!!!!!!---!!!!!!!------------!!!!!--------------"); | 2129 | //// System.out.println("-----!!!!!!---!!!!!!!------------!!!!!--------------"); |
| 2130 | //// System.out.println("BASE DE DATOS SALE EN 2"); | 2130 | //// System.out.println("BASE DE DATOS SALE EN 2"); |
| 2131 | //// | 2131 | //// |
| 2132 | //// ProductosNoContabilizados = 2; | 2132 | //// ProductosNoContabilizados = 2; |
| 2133 | //// } | 2133 | //// } |
| 2134 | // | 2134 | // |
| 2135 | // //Actualizar un registro | 2135 | // //Actualizar un registro |
| 2136 | // | 2136 | // |
| 2137 | // System.out.println("PROD CONT SI O NO "+ParametrosInventario.ProductosNoContabilizados); | 2137 | // System.out.println("PROD CONT SI O NO "+ParametrosInventario.ProductosNoContabilizados); |
| 2138 | // // int radioButtonID = RadioGroupProductosNoContabilizados | 2138 | // // int radioButtonID = RadioGroupProductosNoContabilizados |
| 2139 | // // .getCheckedRadioButtonId(); | 2139 | // // .getCheckedRadioButtonId(); |
| 2140 | // //System.out.println("::: BD Prod. no contabilizados "+radioButtonID); | 2140 | // //System.out.println("::: BD Prod. no contabilizados "+radioButtonID); |
| 2141 | //// View radioButton = RadioGroupProductosNoContabilizados | 2141 | //// View radioButton = RadioGroupProductosNoContabilizados |
| 2142 | //// .findViewById(radioButtonID); | 2142 | //// .findViewById(radioButtonID); |
| 2143 | //// int idx = RadioGroupProductosNoContabilizados | 2143 | //// int idx = RadioGroupProductosNoContabilizados |
| 2144 | //// .indexOfChild(radioButton); | 2144 | //// .indexOfChild(radioButton); |
| 2145 | //// System.out.println("LALALALALALSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 2145 | //// System.out.println("LALALALALALSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 2146 | //// System.out.println(idx); | 2146 | //// System.out.println(idx); |
| 2147 | // // 4 Para cada inventario de la lista | 2147 | // // 4 Para cada inventario de la lista |
| 2148 | // for (Integer inv : listaInventariosSeleccionados) { | 2148 | // for (Integer inv : listaInventariosSeleccionados) { |
| 2149 | // | 2149 | // |
| 2150 | // String[] columnasDeseadasInventario = new String[] { | 2150 | // String[] columnasDeseadasInventario = new String[] { |
| 2151 | // ParametrosInventario.bal_bdd_inventario_numero, | 2151 | // ParametrosInventario.bal_bdd_inventario_numero, |
| 2152 | // ParametrosInventario.bal_bdd_inventario_prodcont, | 2152 | // ParametrosInventario.bal_bdd_inventario_prodcont, |
| 2153 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, | 2153 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 2154 | // ParametrosInventario.bal_bdd_inventario_fechaFin, | 2154 | // ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 2155 | // ParametrosInventario.bal_bdd_inventario_lugar, | 2155 | // ParametrosInventario.bal_bdd_inventario_lugar, |
| 2156 | // }; | 2156 | // }; |
| 2157 | // // Recuperamos los resultados: | 2157 | // // Recuperamos los resultados: |
| 2158 | // // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, | 2158 | // // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, |
| 2159 | // // columnasDeseadasInventario, null, null, null, null, null); | 2159 | // // columnasDeseadasInventario, null, null, null, null, null); |
| 2160 | // System.out.println("::: BaseDatos 1501 columna " + columnasDeseadasInventario); | 2160 | // System.out.println("::: BaseDatos 1501 columna " + columnasDeseadasInventario); |
| 2161 | // System.out.println("::: BaseDatos 1514 "); | 2161 | // System.out.println("::: BaseDatos 1514 "); |
| 2162 | // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, | 2162 | // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, |
| 2163 | // columnasDeseadasInventario, | 2163 | // columnasDeseadasInventario, |
| 2164 | // ParametrosInventario.bal_bdd_inventario_numero + " = " | 2164 | // ParametrosInventario.bal_bdd_inventario_numero + " = " |
| 2165 | // + String.valueOf(inv), null, null, null, null); | 2165 | // + String.valueOf(inv), null, null, null, null); |
| 2166 | // | 2166 | // |
| 2167 | // int cantidadColumnasInv = cInventarios.getColumnCount(); | 2167 | // int cantidadColumnasInv = cInventarios.getColumnCount(); |
| 2168 | // System.out.println("::: BaseDatos 1575 cantidadColumnasInv " + cantidadColumnasInv); | 2168 | // System.out.println("::: BaseDatos 1575 cantidadColumnasInv " + cantidadColumnasInv); |
| 2169 | // Element inventario;// ,articulo; | 2169 | // Element inventario;// ,articulo; |
| 2170 | // | 2170 | // |
| 2171 | // // Inicia el bucle | 2171 | // // Inicia el bucle |
| 2172 | // if (cInventarios.moveToFirst()) { | 2172 | // if (cInventarios.moveToFirst()) { |
| 2173 | // | 2173 | // |
| 2174 | // // int nroInvActual=cInventarios.getInt(0); | 2174 | // // int nroInvActual=cInventarios.getInt(0); |
| 2175 | // int nroInvActual = inv; | 2175 | // int nroInvActual = inv; |
| 2176 | // | 2176 | // |
| 2177 | // // No seria necesario este while | 2177 | // // No seria necesario este while |
| 2178 | // // while (cInventarios.isAfterLast() == false) { | 2178 | // // while (cInventarios.isAfterLast() == false) { |
| 2179 | // | 2179 | // |
| 2180 | // // Para cada inventario | 2180 | // // Para cada inventario |
| 2181 | // // inventario = | 2181 | // // inventario = |
| 2182 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_inventarios_nombre)); | 2182 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_inventarios_nombre)); |
| 2183 | // // 4.1 Creamos un elemento para el inventario | 2183 | // // 4.1 Creamos un elemento para el inventario |
| 2184 | // inventario = documento | 2184 | // inventario = documento |
| 2185 | // .createElement(Parametros.bal_xml_inventario_root); | 2185 | // .createElement(Parametros.bal_xml_inventario_root); |
| 2186 | // | 2186 | // |
| 2187 | // // 4.2 Recorro las columnas y creo los elementos de los | 2187 | // // 4.2 Recorro las columnas y creo los elementos de los |
| 2188 | // // datos | 2188 | // // datos |
| 2189 | // for (int i = 0; i < cantidadColumnasInv; i++) { | 2189 | // for (int i = 0; i < cantidadColumnasInv; i++) { |
| 2190 | // Element elemento = documento | 2190 | // Element elemento = documento |
| 2191 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 2191 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 2192 | // .bdd2xml(cInventarios.getColumnName(i))); | 2192 | // .bdd2xml(cInventarios.getColumnName(i))); |
| 2193 | // elemento.setTextContent(cInventarios.getString(i)); | 2193 | // elemento.setTextContent(cInventarios.getString(i)); |
| 2194 | // inventario.appendChild(elemento); | 2194 | // inventario.appendChild(elemento); |
| 2195 | // } | 2195 | // } |
| 2196 | // | 2196 | // |
| 2197 | // // Deberia ir aqui o mas abajo? | 2197 | // // Deberia ir aqui o mas abajo? |
| 2198 | // // titulo.appendChild(inventario); | 2198 | // // titulo.appendChild(inventario); |
| 2199 | // | 2199 | // |
| 2200 | // // Agregar los articulos | 2200 | // // Agregar los articulos |
| 2201 | // | 2201 | // |
| 2202 | // // Abrimos la base de datos en modo lectura: | 2202 | // // Abrimos la base de datos en modo lectura: |
| 2203 | // // SQLiteDatabase dtb = this.getReadableDatabase(); | 2203 | // // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 2204 | // | 2204 | // |
| 2205 | // // 4.3 Buscamos los datos de los articulos | 2205 | // // 4.3 Buscamos los datos de los articulos |
| 2206 | // String[] columnasDeseadas = new String[] { | 2206 | // String[] columnasDeseadas = new String[] { |
| 2207 | // ParametrosInventario.bal_bdd_articulo_sector, | 2207 | // ParametrosInventario.bal_bdd_articulo_sector, |
| 2208 | // ParametrosInventario.bal_bdd_articulo_codigo, | 2208 | // ParametrosInventario.bal_bdd_articulo_codigo, |
| 2209 | // // ParametrosInventario.bal_bdd_articulo_inventario, | 2209 | // // ParametrosInventario.bal_bdd_articulo_inventario, |
| 2210 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 2210 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 2211 | // ParametrosInventario.bal_bdd_articulo_subtotal, | 2211 | // ParametrosInventario.bal_bdd_articulo_subtotal, |
| 2212 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 2212 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 2213 | // ParametrosInventario.bal_bdd_articulo_fechaFin, | 2213 | // ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 2214 | // // ParametrosInventario.bal_bdd_articulo_foto, | 2214 | // // ParametrosInventario.bal_bdd_articulo_foto, |
| 2215 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 2215 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 2216 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 2216 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 2217 | // | 2217 | // |
| 2218 | // | 2218 | // |
| 2219 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 2219 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 2220 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito}; | 2220 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito}; |
| 2221 | // System.out.println("::: BaseDatos 1627"); | 2221 | // System.out.println("::: BaseDatos 1627"); |
| 2222 | // // Recuperamos los resultados: | 2222 | // // Recuperamos los resultados: |
| 2223 | // Cursor c = dtb.query(tabla_articulos_nombre, | 2223 | // Cursor c = dtb.query(tabla_articulos_nombre, |
| 2224 | // columnasDeseadas, | 2224 | // columnasDeseadas, |
| 2225 | // ParametrosInventario.bal_bdd_articulo_inventario | 2225 | // ParametrosInventario.bal_bdd_articulo_inventario |
| 2226 | // + " = " + String.valueOf(nroInvActual), | 2226 | // + " = " + String.valueOf(nroInvActual), |
| 2227 | // null, null, null, null); | 2227 | // null, null, null, null); |
| 2228 | // | 2228 | // |
| 2229 | // int cantidadColumnas = c.getColumnCount(); | 2229 | // int cantidadColumnas = c.getColumnCount(); |
| 2230 | // // Chequear | 2230 | // // Chequear |
| 2231 | // boolean tieneArticulos = false; | 2231 | // boolean tieneArticulos = false; |
| 2232 | // | 2232 | // |
| 2233 | // // Para cada articulo | 2233 | // // Para cada articulo |
| 2234 | // if (c.moveToFirst()) { | 2234 | // if (c.moveToFirst()) { |
| 2235 | // tieneArticulos = true; | 2235 | // tieneArticulos = true; |
| 2236 | // hayAlMenosUno = true; | 2236 | // hayAlMenosUno = true; |
| 2237 | // while (!c.isAfterLast()) { | 2237 | // while (!c.isAfterLast()) { |
| 2238 | // // Creamos el hijo ART | 2238 | // // Creamos el hijo ART |
| 2239 | // // Element medicion = | 2239 | // // Element medicion = |
| 2240 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_articulos_nombre)); | 2240 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_articulos_nombre)); |
| 2241 | // // 4.4 Creamos los elementos para el articulo | 2241 | // // 4.4 Creamos los elementos para el articulo |
| 2242 | // Element medicion = documento | 2242 | // Element medicion = documento |
| 2243 | // .createElement(Parametros.bal_xml_articulo_root); | 2243 | // .createElement(Parametros.bal_xml_articulo_root); |
| 2244 | // | 2244 | // |
| 2245 | // for (int i = 0; i < cantidadColumnas; i++) { | 2245 | // for (int i = 0; i < cantidadColumnas; i++) { |
| 2246 | // Element elemento = documento | 2246 | // Element elemento = documento |
| 2247 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 2247 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 2248 | // .bdd2xml(c.getColumnName(i))); | 2248 | // .bdd2xml(c.getColumnName(i))); |
| 2249 | // elemento.setTextContent(c.getString(i)); | 2249 | // elemento.setTextContent(c.getString(i)); |
| 2250 | // medicion.appendChild(elemento); | 2250 | // medicion.appendChild(elemento); |
| 2251 | // } | 2251 | // } |
| 2252 | // inventario.appendChild(medicion); | 2252 | // inventario.appendChild(medicion); |
| 2253 | // | 2253 | // |
| 2254 | // c.moveToNext(); | 2254 | // c.moveToNext(); |
| 2255 | // } | 2255 | // } |
| 2256 | // } | 2256 | // } |
| 2257 | // // Verificar | 2257 | // // Verificar |
| 2258 | // if (tieneArticulos) { | 2258 | // if (tieneArticulos) { |
| 2259 | // titulo.appendChild(inventario); | 2259 | // titulo.appendChild(inventario); |
| 2260 | // } | 2260 | // } |
| 2261 | // // cInventarios.moveToNext(); | 2261 | // // cInventarios.moveToNext(); |
| 2262 | // // Cierra el while, no seria necesario | 2262 | // // Cierra el while, no seria necesario |
| 2263 | // // } | 2263 | // // } |
| 2264 | // | 2264 | // |
| 2265 | // } | 2265 | // } |
| 2266 | // } | 2266 | // } |
| 2267 | // | 2267 | // |
| 2268 | // dtb.close(); | 2268 | // dtb.close(); |
| 2269 | // // Verificar | 2269 | // // Verificar |
| 2270 | // if (hayAlMenosUno) { | 2270 | // if (hayAlMenosUno) { |
| 2271 | // Calendar cal = Calendar.getInstance(); | 2271 | // Calendar cal = Calendar.getInstance(); |
| 2272 | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 2272 | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 2273 | // Element fec_ope = documento.createElement(ParametrosInventario.bal_xml_export_fec_ope); | 2273 | // Element fec_ope = documento.createElement(ParametrosInventario.bal_xml_export_fec_ope); |
| 2274 | // System.out.println(" Pasar fecha "); | 2274 | // System.out.println(" Pasar fecha "); |
| 2275 | // System.out.println(simpleDateFormat.format(cal.getTime())); | 2275 | // System.out.println(simpleDateFormat.format(cal.getTime())); |
| 2276 | // fec_ope.appendChild(documento.createTextNode(simpleDateFormat.format(cal.getTime()))); | 2276 | // fec_ope.appendChild(documento.createTextNode(simpleDateFormat.format(cal.getTime()))); |
| 2277 | // titulo.appendChild(fec_ope); | 2277 | // titulo.appendChild(fec_ope); |
| 2278 | // | 2278 | // |
| 2279 | // //documento.appendChild() | 2279 | // //documento.appendChild() |
| 2280 | // documento.appendChild(titulo); | 2280 | // documento.appendChild(titulo); |
| 2281 | // | 2281 | // |
| 2282 | // // 5 Guardamos el DOM como archivo XML | 2282 | // // 5 Guardamos el DOM como archivo XML |
| 2283 | // HttpWriter.transformerXml(documento, ParametrosInventario.URL_COPIA_XML_EXPORT); | 2283 | // HttpWriter.transformerXml(documento, ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 2284 | // | 2284 | // |
| 2285 | // // 6 Mandamos el archivo en POST hacia el servidor: | 2285 | // // 6 Mandamos el archivo en POST hacia el servidor: |
| 2286 | // HttpSender httpSender = new HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); | 2286 | // HttpSender httpSender = new HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); |
| 2287 | // System.out.println("::: el system :;:;:;"); | 2287 | // System.out.println("::: el system :;:;:;"); |
| 2288 | // return httpSender.send_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); | 2288 | // return httpSender.send_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 2289 | // | 2289 | // |
| 2290 | // } else { | 2290 | // } else { |
| 2291 | // return false; | 2291 | // return false; |
| 2292 | // } | 2292 | // } |
| 2293 | // | 2293 | // |
| 2294 | // } catch (Exception e) { | 2294 | // } catch (Exception e) { |
| 2295 | // System.out.println("::: entro al catch :;:;:;"); | 2295 | // System.out.println("::: entro al catch :;:;:;"); |
| 2296 | // GestorLogEventos log = new GestorLogEventos(); | 2296 | // GestorLogEventos log = new GestorLogEventos(); |
| 2297 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 2297 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 2298 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 2298 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 2299 | // log.log("[-- 1141 --]" + e.toString(), 4); | 2299 | // log.log("[-- 1141 --]" + e.toString(), 4); |
| 2300 | // | 2300 | // |
| 2301 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2301 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2302 | // "La exportacion de los datos de la Base De Datos fracaso"); | 2302 | // "La exportacion de los datos de la Base De Datos fracaso"); |
| 2303 | // } | 2303 | // } |
| 2304 | // } | 2304 | // } |
| 2305 | // | 2305 | // |
| 2306 | // public boolean exportarTodasBaseDatosSQLiteCompras( | 2306 | // public boolean exportarTodasBaseDatosSQLiteCompras( |
| 2307 | // ArrayList<Integer> listaInventariosSeleccionados) | 2307 | // ArrayList<Integer> listaInventariosSeleccionados) |
| 2308 | // throws ExceptionBDD, ExceptionHttpExchange { | 2308 | // throws ExceptionBDD, ExceptionHttpExchange { |
| 2309 | // System.out.println("::: BaseDatos 2263 exportarBDSQLiteCompras"); | 2309 | // System.out.println("::: BaseDatos 2263 exportarBDSQLiteCompras"); |
| 2310 | // System.out.println("ACA********************"); | 2310 | // System.out.println("ACA********************"); |
| 2311 | // try { | 2311 | // try { |
| 2312 | // boolean hayAlMenosUno = false; | 2312 | // boolean hayAlMenosUno = false; |
| 2313 | // // 1 Creacion del nuevo documento | 2313 | // // 1 Creacion del nuevo documento |
| 2314 | // DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory | 2314 | // DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory |
| 2315 | // .newInstance(); | 2315 | // .newInstance(); |
| 2316 | // DocumentBuilder constructorDocumentos = fabricaDocumentos | 2316 | // DocumentBuilder constructorDocumentos = fabricaDocumentos |
| 2317 | // .newDocumentBuilder(); | 2317 | // .newDocumentBuilder(); |
| 2318 | // Document documento = constructorDocumentos.newDocument(); | 2318 | // Document documento = constructorDocumentos.newDocument(); |
| 2319 | // // Propiedades del DOM: | 2319 | // // Propiedades del DOM: |
| 2320 | // documento.setXmlVersion("1.0"); | 2320 | // documento.setXmlVersion("1.0"); |
| 2321 | // documento.setXmlStandalone(true); | 2321 | // documento.setXmlStandalone(true); |
| 2322 | // // 2 Creacion del elemento de cabecera | 2322 | // // 2 Creacion del elemento de cabecera |
| 2323 | // Element titulo = documento | 2323 | // Element titulo = documento |
| 2324 | // .createElement(ParametrosInventario.bal_xml_export_cabecera); | 2324 | // .createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 2325 | // // 3 Abrimos la base de datos en modo lectura: | 2325 | // // 3 Abrimos la base de datos en modo lectura: |
| 2326 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 2326 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 2327 | // //Actualizar un registro | 2327 | // //Actualizar un registro |
| 2328 | // // 4 Para cada inventario de la lista | 2328 | // // 4 Para cada inventario de la lista |
| 2329 | // for (Integer inv : listaInventariosSeleccionados) { | 2329 | // for (Integer inv : listaInventariosSeleccionados) { |
| 2330 | // String[] columnasDeseadasInventario = new String[] { | 2330 | // String[] columnasDeseadasInventario = new String[] { |
| 2331 | // ParametrosInventario.bal_bdd_inventario_numero, | 2331 | // ParametrosInventario.bal_bdd_inventario_numero, |
| 2332 | // ParametrosInventario.bal_bdd_inventario_prodcont, | 2332 | // ParametrosInventario.bal_bdd_inventario_prodcont, |
| 2333 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, | 2333 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 2334 | // ParametrosInventario.bal_bdd_inventario_fechaFin, | 2334 | // ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 2335 | // ParametrosInventario.bal_bdd_inventario_lugar, | 2335 | // ParametrosInventario.bal_bdd_inventario_lugar, |
| 2336 | // }; | 2336 | // }; |
| 2337 | // System.out.println("::: BaseDatos 2315 exportarBDSQLiteCompras por recuperar resultados"); | 2337 | // System.out.println("::: BaseDatos 2315 exportarBDSQLiteCompras por recuperar resultados"); |
| 2338 | // System.out.println("::: BaseDatos 2315 exportarBDSQLiteCompras por recuperar resultados inv "+inv); | 2338 | // System.out.println("::: BaseDatos 2315 exportarBDSQLiteCompras por recuperar resultados inv "+inv); |
| 2339 | // // Recuperamos los resultados: | 2339 | // // Recuperamos los resultados: |
| 2340 | // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, | 2340 | // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, |
| 2341 | // columnasDeseadasInventario, | 2341 | // columnasDeseadasInventario, |
| 2342 | // ParametrosInventario.bal_bdd_inventario_numero + " = " | 2342 | // ParametrosInventario.bal_bdd_inventario_numero + " = " |
| 2343 | // + String.valueOf(inv), null, null, null, null); | 2343 | // + String.valueOf(inv), null, null, null, null); |
| 2344 | // | 2344 | // |
| 2345 | // | 2345 | // |
| 2346 | // | 2346 | // |
| 2347 | // int cantidadColumnasInv = cInventarios.getColumnCount(); | 2347 | // int cantidadColumnasInv = cInventarios.getColumnCount(); |
| 2348 | // Element inventario;// ,articulo; | 2348 | // Element inventario;// ,articulo; |
| 2349 | // // Inicia el bucle | 2349 | // // Inicia el bucle |
| 2350 | // if (cInventarios.moveToFirst()) { | 2350 | // if (cInventarios.moveToFirst()) { |
| 2351 | // // int nroInvActual=cInventarios.getInt(0); | 2351 | // // int nroInvActual=cInventarios.getInt(0); |
| 2352 | // int nroInvActual = inv; | 2352 | // int nroInvActual = inv; |
| 2353 | // // 4.1 Creamos un elemento para el inventario | 2353 | // // 4.1 Creamos un elemento para el inventario |
| 2354 | // inventario = documento | 2354 | // inventario = documento |
| 2355 | // .createElement(Parametros.bal_xml_inventario_root); | 2355 | // .createElement(Parametros.bal_xml_inventario_root); |
| 2356 | // // 4.2 Recorro las columnas y creo los elementos de los | 2356 | // // 4.2 Recorro las columnas y creo los elementos de los |
| 2357 | // // datos | 2357 | // // datos |
| 2358 | // for (int i = 0; i < cantidadColumnasInv; i++) { | 2358 | // for (int i = 0; i < cantidadColumnasInv; i++) { |
| 2359 | // Element elemento = documento | 2359 | // Element elemento = documento |
| 2360 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 2360 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 2361 | // .bdd2xml(cInventarios.getColumnName(i))); | 2361 | // .bdd2xml(cInventarios.getColumnName(i))); |
| 2362 | // elemento.setTextContent(cInventarios.getString(i)); | 2362 | // elemento.setTextContent(cInventarios.getString(i)); |
| 2363 | // inventario.appendChild(elemento); | 2363 | // inventario.appendChild(elemento); |
| 2364 | // } | 2364 | // } |
| 2365 | // // 4.3 Buscamos los datos de los articulos | 2365 | // // 4.3 Buscamos los datos de los articulos |
| 2366 | // String[] columnasDeseadas = new String[] { | 2366 | // String[] columnasDeseadas = new String[] { |
| 2367 | // ParametrosInventario.bal_bdd_articulo_sector, | 2367 | // ParametrosInventario.bal_bdd_articulo_sector, |
| 2368 | // ParametrosInventario.bal_bdd_articulo_codigo, | 2368 | // ParametrosInventario.bal_bdd_articulo_codigo, |
| 2369 | // // ParametrosInventario.bal_bdd_articulo_inventario, | 2369 | // // ParametrosInventario.bal_bdd_articulo_inventario, |
| 2370 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 2370 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 2371 | // //ParametrosInventario.bal_bdd_articulo_subtotal, | 2371 | // //ParametrosInventario.bal_bdd_articulo_subtotal, |
| 2372 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 2372 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 2373 | // ParametrosInventario.bal_bdd_articulo_fechaFin, | 2373 | // ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 2374 | // // ParametrosInventario.bal_bdd_articulo_foto, | 2374 | // // ParametrosInventario.bal_bdd_articulo_foto, |
| 2375 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 2375 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 2376 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 2376 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 2377 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 2377 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 2378 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito//, | 2378 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito//, |
| 2379 | // //ParametrosInventario.bal_bdd_compraproveedor_codigo | 2379 | // //ParametrosInventario.bal_bdd_compraproveedor_codigo |
| 2380 | // }; | 2380 | // }; |
| 2381 | // | 2381 | // |
| 2382 | // Cursor cValidarProve = dtb.rawQuery("SELECT * FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD ="+inv,null); | 2382 | // Cursor cValidarProve = dtb.rawQuery("SELECT * FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD ="+inv,null); |
| 2383 | // if (cValidarProve.moveToFirst()) { | 2383 | // if (cValidarProve.moveToFirst()) { |
| 2384 | // Cursor c = dtb.rawQuery("SELECT a.ART_SEC, a.ART_COD,a.ART_Q,a.ART_SUBTOT, a.ART_FEI,a.ART_FEF,a.ART_DESC," + | 2384 | // Cursor c = dtb.rawQuery("SELECT a.ART_SEC, a.ART_COD,a.ART_Q,a.ART_SUBTOT, a.ART_FEI,a.ART_FEF,a.ART_DESC," + |
| 2385 | // "a.ART_CB,a.ART_EV,a.ART_ED,b.COMPRA_PROVE_COD FROM ARTICULOS a " + | 2385 | // "a.ART_CB,a.ART_EV,a.ART_ED,b.COMPRA_PROVE_COD FROM ARTICULOS a " + |
| 2386 | // "INNER JOIN COMPRA_PROVEEDOR b ON a.ART_I=b.COMPRA_INV_COD WHERE a.ART_I="+inv,null); //a.ART_SUBTOT, | 2386 | // "INNER JOIN COMPRA_PROVEEDOR b ON a.ART_I=b.COMPRA_INV_COD WHERE a.ART_I="+inv,null); //a.ART_SUBTOT, |
| 2387 | // int cantidadColumnas = c.getColumnCount(); | 2387 | // int cantidadColumnas = c.getColumnCount(); |
| 2388 | // // Chequear | 2388 | // // Chequear |
| 2389 | // boolean tieneArticulos = false; | 2389 | // boolean tieneArticulos = false; |
| 2390 | // // Para cada articulo | 2390 | // // Para cada articulo |
| 2391 | // if (c.moveToFirst()) { | 2391 | // if (c.moveToFirst()) { |
| 2392 | // tieneArticulos = true; | 2392 | // tieneArticulos = true; |
| 2393 | // hayAlMenosUno = true; | 2393 | // hayAlMenosUno = true; |
| 2394 | // while (!c.isAfterLast()) { | 2394 | // while (!c.isAfterLast()) { |
| 2395 | // // Creamos el hijo ART | 2395 | // // Creamos el hijo ART |
| 2396 | // // Element medicion = | 2396 | // // Element medicion = |
| 2397 | // // 4.4 Creamos los elementos para el articulo | 2397 | // // 4.4 Creamos los elementos para el articulo |
| 2398 | // Element medicion = documento.createElement(Parametros.bal_xml_articulo_root); | 2398 | // Element medicion = documento.createElement(Parametros.bal_xml_articulo_root); |
| 2399 | // for (int i = 0; i < cantidadColumnas; i++) { | 2399 | // for (int i = 0; i < cantidadColumnas; i++) { |
| 2400 | // Element elemento = documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(c.getColumnName(i))); | 2400 | // Element elemento = documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(c.getColumnName(i))); |
| 2401 | // System.out.println("::: BD VER QUE TRAE ESTO getColumnName(i)== " + c.getColumnName(i)); | 2401 | // System.out.println("::: BD VER QUE TRAE ESTO getColumnName(i)== " + c.getColumnName(i)); |
| 2402 | // System.out.println("::: BD VER QUE TRAE ESTO getString(i)== " + c.getString(i)); | 2402 | // System.out.println("::: BD VER QUE TRAE ESTO getString(i)== " + c.getString(i)); |
| 2403 | // elemento.setTextContent(c.getString(i)); | 2403 | // elemento.setTextContent(c.getString(i)); |
| 2404 | // medicion.appendChild(elemento); | 2404 | // medicion.appendChild(elemento); |
| 2405 | // } | 2405 | // } |
| 2406 | // inventario.appendChild(medicion); | 2406 | // inventario.appendChild(medicion); |
| 2407 | // c.moveToNext(); | 2407 | // c.moveToNext(); |
| 2408 | // } | 2408 | // } |
| 2409 | // }else{ | 2409 | // }else{ |
| 2410 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2410 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2411 | // "No se encuentran articulos cargados para la exportacion.");//return false; | 2411 | // "No se encuentran articulos cargados para la exportacion.");//return false; |
| 2412 | // } | 2412 | // } |
| 2413 | // // Verificar | 2413 | // // Verificar |
| 2414 | // if (tieneArticulos) { | 2414 | // if (tieneArticulos) { |
| 2415 | // titulo.appendChild(inventario); | 2415 | // titulo.appendChild(inventario); |
| 2416 | // } | 2416 | // } |
| 2417 | // }else{ | 2417 | // }else{ |
| 2418 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2418 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2419 | // "No se ha seleccionado un proveedor para la exportacion.");//return false; | 2419 | // "No se ha seleccionado un proveedor para la exportacion.");//return false; |
| 2420 | // } | 2420 | // } |
| 2421 | // } | 2421 | // } |
| 2422 | // } | 2422 | // } |
| 2423 | // dtb.close(); | 2423 | // dtb.close(); |
| 2424 | // // Verificar | 2424 | // // Verificar |
| 2425 | // if (hayAlMenosUno) { | 2425 | // if (hayAlMenosUno) { |
| 2426 | // documento.appendChild(titulo); | 2426 | // documento.appendChild(titulo); |
| 2427 | // // 5 Guardamos el DOM como archivo XML | 2427 | // // 5 Guardamos el DOM como archivo XML |
| 2428 | // HttpWriter.transformerXml(documento, ParametrosInventario.URL_COPIA_XML_EXPORT); | 2428 | // HttpWriter.transformerXml(documento, ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 2429 | // // 6 Mandamos el archivo en POST hacia el servidor: | 2429 | // // 6 Mandamos el archivo en POST hacia el servidor: |
| 2430 | // HttpSender httpSender = new HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); | 2430 | // HttpSender httpSender = new HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); |
| 2431 | // return httpSender.send_compra_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); | 2431 | // return httpSender.send_compra_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 2432 | // } else { | 2432 | // } else { |
| 2433 | // return false; | 2433 | // return false; |
| 2434 | // } | 2434 | // } |
| 2435 | // | 2435 | // |
| 2436 | // } catch (Exception e) { | 2436 | // } catch (Exception e) { |
| 2437 | // GestorLogEventos log = new GestorLogEventos(); | 2437 | // GestorLogEventos log = new GestorLogEventos(); |
| 2438 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 2438 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 2439 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 2439 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 2440 | // log.log("[-- 1141 --]" + e.toString(), 4); | 2440 | // log.log("[-- 1141 --]" + e.toString(), 4); |
| 2441 | // System.out.println("ERRORRR" + e.toString()); | 2441 | // System.out.println("ERRORRR" + e.toString()); |
| 2442 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2442 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2443 | // "La exportacion de los datos de la Base De Datos fracaso"); | 2443 | // "La exportacion de los datos de la Base De Datos fracaso"); |
| 2444 | // } | 2444 | // } |
| 2445 | // } | 2445 | // } |
| 2446 | // | 2446 | // |
| 2447 | // /** | 2447 | // /** |
| 2448 | // * Genera los archivos XML de los inventarios a exportar por USB | 2448 | // * Genera los archivos XML de los inventarios a exportar por USB |
| 2449 | // * <p> | 2449 | // * <p> |
| 2450 | // * 1 Para cada inventario | 2450 | // * 1 Para cada inventario |
| 2451 | // * <p> | 2451 | // * <p> |
| 2452 | // * 1.1 Creacion del DOM | 2452 | // * 1.1 Creacion del DOM |
| 2453 | // * <p> | 2453 | // * <p> |
| 2454 | // * 1.2 Creacion del elemento raiz del DOM | 2454 | // * 1.2 Creacion del elemento raiz del DOM |
| 2455 | // * <p> | 2455 | // * <p> |
| 2456 | // * 1.3 Abrimos la base de datos en modo lectura | 2456 | // * 1.3 Abrimos la base de datos en modo lectura |
| 2457 | // * <p> | 2457 | // * <p> |
| 2458 | // * 1.4 Recuperamos los datos del inventario | 2458 | // * 1.4 Recuperamos los datos del inventario |
| 2459 | // * <p> | 2459 | // * <p> |
| 2460 | // * 1.5 Buscamos los articulos | 2460 | // * 1.5 Buscamos los articulos |
| 2461 | // * <p> | 2461 | // * <p> |
| 2462 | // * 1.6 Para cada articulo | 2462 | // * 1.6 Para cada articulo |
| 2463 | // * <p> | 2463 | // * <p> |
| 2464 | // * 1.6.1 Creamos el elmento de datos | 2464 | // * 1.6.1 Creamos el elmento de datos |
| 2465 | // * <p> | 2465 | // * <p> |
| 2466 | // * 1.7 Generacion del Arcchivo XML local | 2466 | // * 1.7 Generacion del Arcchivo XML local |
| 2467 | // * <p> | 2467 | // * <p> |
| 2468 | // * 1.8 Si estan creados todos los archivos, transformamos el | 2468 | // * 1.8 Si estan creados todos los archivos, transformamos el |
| 2469 | // * DOM a un documento | 2469 | // * DOM a un documento |
| 2470 | // * | 2470 | // * |
| 2471 | // * @param listaInventariosSeleccionados | 2471 | // * @param listaInventariosSeleccionados |
| 2472 | // * @throws ExceptionBDD | 2472 | // * @throws ExceptionBDD |
| 2473 | // */ | 2473 | // */ |
| 2474 | // // Nuevo formato desde 28/4/12 | 2474 | // // Nuevo formato desde 28/4/12 |
| 2475 | // public void exportarTodasBaseDatosSQLite_HaciaUsb( | 2475 | // public void exportarTodasBaseDatosSQLite_HaciaUsb( |
| 2476 | // ArrayList<Integer> listaInventariosSeleccionados) | 2476 | // ArrayList<Integer> listaInventariosSeleccionados) |
| 2477 | // throws ExceptionBDD { | 2477 | // throws ExceptionBDD { |
| 2478 | // System.out.println("::: BaseDatos 1741 exportarTodasBaseDatosSQLite_HaciaUsb"); | 2478 | // System.out.println("::: BaseDatos 1741 exportarTodasBaseDatosSQLite_HaciaUsb"); |
| 2479 | // try { | 2479 | // try { |
| 2480 | // boolean hayAlMenosUno = false; | 2480 | // boolean hayAlMenosUno = false; |
| 2481 | // // 1 Para cada inventario | 2481 | // // 1 Para cada inventario |
| 2482 | // for (int inv : listaInventariosSeleccionados) { | 2482 | // for (int inv : listaInventariosSeleccionados) { |
| 2483 | // | 2483 | // |
| 2484 | // // 1.1 Creacion del DOM | 2484 | // // 1.1 Creacion del DOM |
| 2485 | // DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory | 2485 | // DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory |
| 2486 | // .newInstance(); | 2486 | // .newInstance(); |
| 2487 | // // Arroja ParserConfigurationException | 2487 | // // Arroja ParserConfigurationException |
| 2488 | // DocumentBuilder constructorDocumentos = fabricaDocumentos | 2488 | // DocumentBuilder constructorDocumentos = fabricaDocumentos |
| 2489 | // .newDocumentBuilder(); | 2489 | // .newDocumentBuilder(); |
| 2490 | // Document documento = constructorDocumentos.newDocument(); | 2490 | // Document documento = constructorDocumentos.newDocument(); |
| 2491 | // | 2491 | // |
| 2492 | // // Propris du DOM: | 2492 | // // Propris du DOM: |
| 2493 | // documento.setXmlVersion("1.0"); | 2493 | // documento.setXmlVersion("1.0"); |
| 2494 | // documento.setXmlStandalone(true); | 2494 | // documento.setXmlStandalone(true); |
| 2495 | // | 2495 | // |
| 2496 | // // 1.2 Creacion del elemento raiz del DOM | 2496 | // // 1.2 Creacion del elemento raiz del DOM |
| 2497 | // Element titulo = documento | 2497 | // Element titulo = documento |
| 2498 | // .createElement(ParametrosInventario.bal_xml_export_cabecera); | 2498 | // .createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 2499 | // | 2499 | // |
| 2500 | // // 1.3 Abrimos la base de datos en modo lectura: | 2500 | // // 1.3 Abrimos la base de datos en modo lectura: |
| 2501 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 2501 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 2502 | // | 2502 | // |
| 2503 | // String[] columnasDeseadasInventario = new String[] { | 2503 | // String[] columnasDeseadasInventario = new String[] { |
| 2504 | // ParametrosInventario.bal_bdd_inventario_numero, | 2504 | // ParametrosInventario.bal_bdd_inventario_numero, |
| 2505 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, | 2505 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 2506 | // ParametrosInventario.bal_bdd_inventario_fechaFin, | 2506 | // ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 2507 | // ParametrosInventario.bal_bdd_inventario_lugar }; | 2507 | // ParametrosInventario.bal_bdd_inventario_lugar }; |
| 2508 | // | 2508 | // |
| 2509 | // // 1.4 Recuperamos los datos del inventario: | 2509 | // // 1.4 Recuperamos los datos del inventario: |
| 2510 | // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, | 2510 | // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, |
| 2511 | // columnasDeseadasInventario, | 2511 | // columnasDeseadasInventario, |
| 2512 | // ParametrosInventario.bal_bdd_inventario_numero + " = " | 2512 | // ParametrosInventario.bal_bdd_inventario_numero + " = " |
| 2513 | // + String.valueOf(inv), null, null, null, null); | 2513 | // + String.valueOf(inv), null, null, null, null); |
| 2514 | // | 2514 | // |
| 2515 | // int cantidadColumnasInv = cInventarios.getColumnCount(); | 2515 | // int cantidadColumnasInv = cInventarios.getColumnCount(); |
| 2516 | // | 2516 | // |
| 2517 | // Element inventarioActual;// ,articulo; | 2517 | // Element inventarioActual;// ,articulo; |
| 2518 | // boolean tieneArticulos = false; | 2518 | // boolean tieneArticulos = false; |
| 2519 | // if (cInventarios.moveToFirst()) { | 2519 | // if (cInventarios.moveToFirst()) { |
| 2520 | // // Element inventario = | 2520 | // // Element inventario = |
| 2521 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(ParametrosInventario.bal_bdd_inventario_numero)); | 2521 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(ParametrosInventario.bal_bdd_inventario_numero)); |
| 2522 | // inventarioActual = documento | 2522 | // inventarioActual = documento |
| 2523 | // .createElement(Parametros.bal_xml_inventario_root); | 2523 | // .createElement(Parametros.bal_xml_inventario_root); |
| 2524 | // | 2524 | // |
| 2525 | // // Recorro las columnas | 2525 | // // Recorro las columnas |
| 2526 | // for (int i = 0; i < cantidadColumnasInv; i++) { | 2526 | // for (int i = 0; i < cantidadColumnasInv; i++) { |
| 2527 | // // bdd2xml arroja Exception | 2527 | // // bdd2xml arroja Exception |
| 2528 | // Element elemento = documento | 2528 | // Element elemento = documento |
| 2529 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 2529 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 2530 | // .bdd2xml(cInventarios.getColumnName(i))); | 2530 | // .bdd2xml(cInventarios.getColumnName(i))); |
| 2531 | // elemento.setTextContent(cInventarios.getString(i)); | 2531 | // elemento.setTextContent(cInventarios.getString(i)); |
| 2532 | // inventarioActual.appendChild(elemento); | 2532 | // inventarioActual.appendChild(elemento); |
| 2533 | // } | 2533 | // } |
| 2534 | // | 2534 | // |
| 2535 | // String[] columnasDeseadas = new String[] { | 2535 | // String[] columnasDeseadas = new String[] { |
| 2536 | // ParametrosInventario.bal_bdd_articulo_sector, | 2536 | // ParametrosInventario.bal_bdd_articulo_sector, |
| 2537 | // ParametrosInventario.bal_bdd_articulo_codigo, | 2537 | // ParametrosInventario.bal_bdd_articulo_codigo, |
| 2538 | // // ParametrosInventario.bal_bdd_articulo_inventario, | 2538 | // // ParametrosInventario.bal_bdd_articulo_inventario, |
| 2539 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 2539 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 2540 | // ParametrosInventario.bal_bdd_articulo_subtotal, | 2540 | // ParametrosInventario.bal_bdd_articulo_subtotal, |
| 2541 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 2541 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 2542 | // ParametrosInventario.bal_bdd_articulo_fechaFin, | 2542 | // ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 2543 | // // ParametrosInventario.bal_bdd_articulo_foto, | 2543 | // // ParametrosInventario.bal_bdd_articulo_foto, |
| 2544 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 2544 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 2545 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 2545 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 2546 | // | 2546 | // |
| 2547 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 2547 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 2548 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 2548 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 2549 | // }; | 2549 | // }; |
| 2550 | // Cursor c = dtb.query(tabla_articulos_nombre, | 2550 | // Cursor c = dtb.query(tabla_articulos_nombre, |
| 2551 | // columnasDeseadas, | 2551 | // columnasDeseadas, |
| 2552 | // ParametrosInventario.bal_bdd_articulo_inventario | 2552 | // ParametrosInventario.bal_bdd_articulo_inventario |
| 2553 | // + "=" + String.valueOf(inv), null, null, | 2553 | // + "=" + String.valueOf(inv), null, null, |
| 2554 | // null, null); | 2554 | // null, null); |
| 2555 | // | 2555 | // |
| 2556 | // // Recuperamos los resultados: | 2556 | // // Recuperamos los resultados: |
| 2557 | // int cantidadColumnas = c.getColumnCount(); | 2557 | // int cantidadColumnas = c.getColumnCount(); |
| 2558 | // // boolean tieneArticulos=false; | 2558 | // // boolean tieneArticulos=false; |
| 2559 | // // 1.5 Buscamos los articulos | 2559 | // // 1.5 Buscamos los articulos |
| 2560 | // if (c.moveToFirst()) { | 2560 | // if (c.moveToFirst()) { |
| 2561 | // tieneArticulos = true; | 2561 | // tieneArticulos = true; |
| 2562 | // hayAlMenosUno = true; | 2562 | // hayAlMenosUno = true; |
| 2563 | // // Luego el detalle de los articulos: | 2563 | // // Luego el detalle de los articulos: |
| 2564 | // // 1.6 Para cada articulo | 2564 | // // 1.6 Para cada articulo |
| 2565 | // while (c.isAfterLast() == false) { | 2565 | // while (c.isAfterLast() == false) { |
| 2566 | // // 1.6.1 Creamos el elmento de datos | 2566 | // // 1.6.1 Creamos el elmento de datos |
| 2567 | // Element medicion = documento | 2567 | // Element medicion = documento |
| 2568 | // .createElement(Parametros.bal_xml_articulo_root); | 2568 | // .createElement(Parametros.bal_xml_articulo_root); |
| 2569 | // // Element medicion = | 2569 | // // Element medicion = |
| 2570 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(tabla_articulos_nombre)); | 2570 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(tabla_articulos_nombre)); |
| 2571 | // | 2571 | // |
| 2572 | // for (int i = 0; i < cantidadColumnas; i++) { | 2572 | // for (int i = 0; i < cantidadColumnas; i++) { |
| 2573 | // Element elemento = documento | 2573 | // Element elemento = documento |
| 2574 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 2574 | // .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 2575 | // .bdd2usb(c.getColumnName(i))); | 2575 | // .bdd2usb(c.getColumnName(i))); |
| 2576 | // elemento.setTextContent(c.getString(i)); | 2576 | // elemento.setTextContent(c.getString(i)); |
| 2577 | // medicion.appendChild(elemento); | 2577 | // medicion.appendChild(elemento); |
| 2578 | // } | 2578 | // } |
| 2579 | // inventarioActual.appendChild(medicion); | 2579 | // inventarioActual.appendChild(medicion); |
| 2580 | // | 2580 | // |
| 2581 | // c.moveToNext(); | 2581 | // c.moveToNext(); |
| 2582 | // } | 2582 | // } |
| 2583 | // } | 2583 | // } |
| 2584 | // // Verificar | 2584 | // // Verificar |
| 2585 | // if (tieneArticulos) { | 2585 | // if (tieneArticulos) { |
| 2586 | // titulo.appendChild(inventarioActual); | 2586 | // titulo.appendChild(inventarioActual); |
| 2587 | // } | 2587 | // } |
| 2588 | // } | 2588 | // } |
| 2589 | // // | 2589 | // // |
| 2590 | // dtb.close(); | 2590 | // dtb.close(); |
| 2591 | // | 2591 | // |
| 2592 | // // Verificar esto | 2592 | // // Verificar esto |
| 2593 | // // if(hayAlMenosUno) { | 2593 | // // if(hayAlMenosUno) { |
| 2594 | // if (tieneArticulos) { | 2594 | // if (tieneArticulos) { |
| 2595 | // documento.appendChild(titulo); | 2595 | // documento.appendChild(titulo); |
| 2596 | // } | 2596 | // } |
| 2597 | // | 2597 | // |
| 2598 | // // Sauvegarde du DOM dans un fichier XML | 2598 | // // Sauvegarde du DOM dans un fichier XML |
| 2599 | // // Construccion del nombre del archivode exportacion: n del | 2599 | // // Construccion del nombre del archivode exportacion: n del |
| 2600 | // // inventario sobre 4 digitos: | 2600 | // // inventario sobre 4 digitos: |
| 2601 | // // 1.7 Generacion del Arcchivo XML local | 2601 | // // 1.7 Generacion del Arcchivo XML local |
| 2602 | // String titulo_final; | 2602 | // String titulo_final; |
| 2603 | // | 2603 | // |
| 2604 | // if (inv < 0) { | 2604 | // if (inv < 0) { |
| 2605 | // String titulo_inicial = String.valueOf(Math.abs(inv)); | 2605 | // String titulo_inicial = String.valueOf(Math.abs(inv)); |
| 2606 | // titulo_final = "D";// +titulo_inicial; | 2606 | // titulo_final = "D";// +titulo_inicial; |
| 2607 | // for (int i = titulo_inicial.length(); i < 4; i++) { | 2607 | // for (int i = titulo_inicial.length(); i < 4; i++) { |
| 2608 | // titulo_final = titulo_final + "0";// ; + titulo_final; | 2608 | // titulo_final = titulo_final + "0";// ; + titulo_final; |
| 2609 | // | 2609 | // |
| 2610 | // } | 2610 | // } |
| 2611 | // titulo_final = titulo_final + titulo_inicial; | 2611 | // titulo_final = titulo_final + titulo_inicial; |
| 2612 | // } else { | 2612 | // } else { |
| 2613 | // String titulo_inicial = String.valueOf(inv); | 2613 | // String titulo_inicial = String.valueOf(inv); |
| 2614 | // titulo_final = titulo_inicial; | 2614 | // titulo_final = titulo_inicial; |
| 2615 | // for (int i = titulo_inicial.length(); i < 4; i++) { | 2615 | // for (int i = titulo_inicial.length(); i < 4; i++) { |
| 2616 | // titulo_final = "0" + titulo_final; | 2616 | // titulo_final = "0" + titulo_final; |
| 2617 | // } | 2617 | // } |
| 2618 | // } | 2618 | // } |
| 2619 | // | 2619 | // |
| 2620 | // File carpeta_usb_export = new File( | 2620 | // File carpeta_usb_export = new File( |
| 2621 | // ParametrosInventario.URL_CARPETA_USB_EXPORT + "/"); | 2621 | // ParametrosInventario.URL_CARPETA_USB_EXPORT + "/"); |
| 2622 | // File archivo_destino = new File(carpeta_usb_export.getPath() | 2622 | // File archivo_destino = new File(carpeta_usb_export.getPath() |
| 2623 | // + "/" + titulo_final + ".xml"); | 2623 | // + "/" + titulo_final + ".xml"); |
| 2624 | // | 2624 | // |
| 2625 | // // OLD | 2625 | // // OLD |
| 2626 | // // Si la carpeta no existe: | 2626 | // // Si la carpeta no existe: |
| 2627 | // // if (archivo_destino.exists() == false) { | 2627 | // // if (archivo_destino.exists() == false) { |
| 2628 | // // archivo_destino.mkdirs(); | 2628 | // // archivo_destino.mkdirs(); |
| 2629 | // // archivo_destino.createNewFile(); | 2629 | // // archivo_destino.createNewFile(); |
| 2630 | // // } | 2630 | // // } |
| 2631 | // // else { | 2631 | // // else { |
| 2632 | // // archivo_destino.delete(); | 2632 | // // archivo_destino.delete(); |
| 2633 | // // archivo_destino.createNewFile(); | 2633 | // // archivo_destino.createNewFile(); |
| 2634 | // // } | 2634 | // // } |
| 2635 | // // | 2635 | // // |
| 2636 | // | 2636 | // |
| 2637 | // // Si la carpeta no existe: | 2637 | // // Si la carpeta no existe: |
| 2638 | // if (archivo_destino.exists() == false) { | 2638 | // if (archivo_destino.exists() == false) { |
| 2639 | // // | 2639 | // // |
| 2640 | // if (tieneArticulos) { | 2640 | // if (tieneArticulos) { |
| 2641 | // // archivo_destino.mkdirs(); | 2641 | // // archivo_destino.mkdirs(); |
| 2642 | // if (carpeta_usb_export.exists() == false) { | 2642 | // if (carpeta_usb_export.exists() == false) { |
| 2643 | // carpeta_usb_export.mkdirs(); | 2643 | // carpeta_usb_export.mkdirs(); |
| 2644 | // } | 2644 | // } |
| 2645 | // // Arroja IOException | 2645 | // // Arroja IOException |
| 2646 | // archivo_destino.createNewFile(); | 2646 | // archivo_destino.createNewFile(); |
| 2647 | // } | 2647 | // } |
| 2648 | // } else { | 2648 | // } else { |
| 2649 | // archivo_destino.delete(); | 2649 | // archivo_destino.delete(); |
| 2650 | // // Verificar esto | 2650 | // // Verificar esto |
| 2651 | // if (tieneArticulos) { | 2651 | // if (tieneArticulos) { |
| 2652 | // if (carpeta_usb_export.exists() == false) { | 2652 | // if (carpeta_usb_export.exists() == false) { |
| 2653 | // carpeta_usb_export.mkdirs(); | 2653 | // carpeta_usb_export.mkdirs(); |
| 2654 | // } | 2654 | // } |
| 2655 | // | 2655 | // |
| 2656 | // archivo_destino.createNewFile(); | 2656 | // archivo_destino.createNewFile(); |
| 2657 | // } | 2657 | // } |
| 2658 | // } | 2658 | // } |
| 2659 | // // Verificar esto | 2659 | // // Verificar esto |
| 2660 | // if (tieneArticulos) { | 2660 | // if (tieneArticulos) { |
| 2661 | // // 1.8 Si estan creados todos los archivos, transformamos el | 2661 | // // 1.8 Si estan creados todos los archivos, transformamos el |
| 2662 | // // DOM a un documento | 2662 | // // DOM a un documento |
| 2663 | // HttpWriter.transformerXml(documento, | 2663 | // HttpWriter.transformerXml(documento, |
| 2664 | // archivo_destino.getAbsolutePath()); | 2664 | // archivo_destino.getAbsolutePath()); |
| 2665 | // } else { | 2665 | // } else { |
| 2666 | // // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2666 | // // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2667 | // // "No todos los inventarios tienen artculos"); | 2667 | // // "No todos los inventarios tienen artculos"); |
| 2668 | // } | 2668 | // } |
| 2669 | // } // end for | 2669 | // } // end for |
| 2670 | // if (!hayAlMenosUno) { | 2670 | // if (!hayAlMenosUno) { |
| 2671 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2671 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2672 | // "No hay inventarios con articulos"); | 2672 | // "No hay inventarios con articulos"); |
| 2673 | // } | 2673 | // } |
| 2674 | // // Agarramos la excepcion de IO | 2674 | // // Agarramos la excepcion de IO |
| 2675 | // | 2675 | // |
| 2676 | // } catch (IOException ioEx) { | 2676 | // } catch (IOException ioEx) { |
| 2677 | // | 2677 | // |
| 2678 | // GestorLogEventos log = new GestorLogEventos(); | 2678 | // GestorLogEventos log = new GestorLogEventos(); |
| 2679 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 2679 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 2680 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 2680 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 2681 | // log.log("[-- 1378 --]" + ioEx.toString(), 4); | 2681 | // log.log("[-- 1378 --]" + ioEx.toString(), 4); |
| 2682 | // | 2682 | // |
| 2683 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2683 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2684 | // "Error de IO al crear los archivos: " + ioEx.getMessage()); | 2684 | // "Error de IO al crear los archivos: " + ioEx.getMessage()); |
| 2685 | // } | 2685 | // } |
| 2686 | // // Agarramos la ParserConfigurationException | 2686 | // // Agarramos la ParserConfigurationException |
| 2687 | // catch (ParserConfigurationException pcEx) { | 2687 | // catch (ParserConfigurationException pcEx) { |
| 2688 | // | 2688 | // |
| 2689 | // GestorLogEventos log = new GestorLogEventos(); | 2689 | // GestorLogEventos log = new GestorLogEventos(); |
| 2690 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 2690 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 2691 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 2691 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 2692 | // log.log("[-- 1389 --]" + pcEx.toString(), 4); | 2692 | // log.log("[-- 1389 --]" + pcEx.toString(), 4); |
| 2693 | // | 2693 | // |
| 2694 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2694 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2695 | // "Error al crear la fabrica de documentos XML" | 2695 | // "Error al crear la fabrica de documentos XML" |
| 2696 | // + pcEx.getMessage()); | 2696 | // + pcEx.getMessage()); |
| 2697 | // // Finalmente agarramos la excepcion ms general | 2697 | // // Finalmente agarramos la excepcion ms general |
| 2698 | // } catch (Exception e) { | 2698 | // } catch (Exception e) { |
| 2699 | // | 2699 | // |
| 2700 | // GestorLogEventos log = new GestorLogEventos(); | 2700 | // GestorLogEventos log = new GestorLogEventos(); |
| 2701 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 2701 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 2702 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 2702 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 2703 | // log.log("[-- 1400 --]" + e.toString(), 4); | 2703 | // log.log("[-- 1400 --]" + e.toString(), 4); |
| 2704 | // | 2704 | // |
| 2705 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2705 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2706 | // "Error en la conversion de balizas: " + e.getMessage()); | 2706 | // "Error en la conversion de balizas: " + e.getMessage()); |
| 2707 | // } | 2707 | // } |
| 2708 | // } | 2708 | // } |
| 2709 | // | 2709 | // |
| 2710 | // // | 2710 | // // |
| 2711 | // | 2711 | // |
| 2712 | // // Formato viejo de XML no contempla fechas de inicio y fin de los archivos | 2712 | // // Formato viejo de XML no contempla fechas de inicio y fin de los archivos |
| 2713 | // // public boolean exportarTodasBaseDatosSQLite(ArrayList<Integer> | 2713 | // // public boolean exportarTodasBaseDatosSQLite(ArrayList<Integer> |
| 2714 | // // listaInventariosSeleccionados) throws ExceptionBDD, ExceptionHttpExchange | 2714 | // // listaInventariosSeleccionados) throws ExceptionBDD, ExceptionHttpExchange |
| 2715 | // // { | 2715 | // // { |
| 2716 | // // try { | 2716 | // // try { |
| 2717 | // // String string_lista_inventarios = ""; | 2717 | // // String string_lista_inventarios = ""; |
| 2718 | // // for (int inv : listaInventariosSeleccionados) { | 2718 | // // for (int inv : listaInventariosSeleccionados) { |
| 2719 | // // string_lista_inventarios += String.valueOf(inv) + ","; | 2719 | // // string_lista_inventarios += String.valueOf(inv) + ","; |
| 2720 | // // } | 2720 | // // } |
| 2721 | // // string_lista_inventarios = string_lista_inventarios.substring(0, | 2721 | // // string_lista_inventarios = string_lista_inventarios.substring(0, |
| 2722 | // // string_lista_inventarios.length()-1); | 2722 | // // string_lista_inventarios.length()-1); |
| 2723 | // // | 2723 | // // |
| 2724 | // // // Cration d'un nouveau DOM: | 2724 | // // // Cration d'un nouveau DOM: |
| 2725 | // // DocumentBuilderFactory fabricaDocumentos = | 2725 | // // DocumentBuilderFactory fabricaDocumentos = |
| 2726 | // // DocumentBuilderFactory.newInstance(); | 2726 | // // DocumentBuilderFactory.newInstance(); |
| 2727 | // // DocumentBuilder constructorDocumentos = | 2727 | // // DocumentBuilder constructorDocumentos = |
| 2728 | // // fabricaDocumentos.newDocumentBuilder(); | 2728 | // // fabricaDocumentos.newDocumentBuilder(); |
| 2729 | // // Document documento = constructorDocumentos.newDocument(); | 2729 | // // Document documento = constructorDocumentos.newDocument(); |
| 2730 | // // | 2730 | // // |
| 2731 | // // // Proprits du DOM: | 2731 | // // // Proprits du DOM: |
| 2732 | // // documento.setXmlVersion("1.0"); | 2732 | // // documento.setXmlVersion("1.0"); |
| 2733 | // // documento.setXmlStandalone(true); | 2733 | // // documento.setXmlStandalone(true); |
| 2734 | // // | 2734 | // // |
| 2735 | // // // Cration de l'arborescence du DOM: | 2735 | // // // Cration de l'arborescence du DOM: |
| 2736 | // // Element titulo = | 2736 | // // Element titulo = |
| 2737 | // // documento.createElement(ParametrosInventario.bal_xml_export_cabecera); | 2737 | // // documento.createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 2738 | // // | 2738 | // // |
| 2739 | // // //Abrimos la base de datos en modo lectura: | 2739 | // // //Abrimos la base de datos en modo lectura: |
| 2740 | // // SQLiteDatabase dtb = this.getReadableDatabase(); | 2740 | // // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 2741 | // // | 2741 | // // |
| 2742 | // // String[] columnasDeseadas = new String[] { | 2742 | // // String[] columnasDeseadas = new String[] { |
| 2743 | // // ParametrosInventario.bal_bdd_articulo_sector, | 2743 | // // ParametrosInventario.bal_bdd_articulo_sector, |
| 2744 | // // ParametrosInventario.bal_bdd_articulo_codigo, | 2744 | // // ParametrosInventario.bal_bdd_articulo_codigo, |
| 2745 | // // ParametrosInventario.bal_bdd_articulo_inventario, | 2745 | // // ParametrosInventario.bal_bdd_articulo_inventario, |
| 2746 | // // ParametrosInventario.bal_bdd_articulo_cantidad, | 2746 | // // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 2747 | // // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 2747 | // // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 2748 | // // ParametrosInventario.bal_bdd_articulo_foto, | 2748 | // // ParametrosInventario.bal_bdd_articulo_foto, |
| 2749 | // // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 2749 | // // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 2750 | // // ParametrosInventario.bal_bdd_articulo_descripcion | 2750 | // // ParametrosInventario.bal_bdd_articulo_descripcion |
| 2751 | // // }; | 2751 | // // }; |
| 2752 | // // Cursor c = dtb.query(tabla_articulos_nombre, columnasDeseadas, | 2752 | // // Cursor c = dtb.query(tabla_articulos_nombre, columnasDeseadas, |
| 2753 | // // ParametrosInventario.bal_bdd_articulo_inventario + " IN (" + | 2753 | // // ParametrosInventario.bal_bdd_articulo_inventario + " IN (" + |
| 2754 | // // string_lista_inventarios + ")", null, null, null, null); | 2754 | // // string_lista_inventarios + ")", null, null, null, null); |
| 2755 | // // | 2755 | // // |
| 2756 | // // // Recuperamos los resultados: | 2756 | // // // Recuperamos los resultados: |
| 2757 | // // int cantidadColumnas = c.getColumnCount(); | 2757 | // // int cantidadColumnas = c.getColumnCount(); |
| 2758 | // // | 2758 | // // |
| 2759 | // // if (c.moveToFirst()) { | 2759 | // // if (c.moveToFirst()) { |
| 2760 | // // while (c.isAfterLast() == false) { | 2760 | // // while (c.isAfterLast() == false) { |
| 2761 | // // | 2761 | // // |
| 2762 | // // Element medicion = | 2762 | // // Element medicion = |
| 2763 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_articulos_nombre)); | 2763 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_articulos_nombre)); |
| 2764 | // // | 2764 | // // |
| 2765 | // // for (int i = 0 ; i < cantidadColumnas ; i++) { | 2765 | // // for (int i = 0 ; i < cantidadColumnas ; i++) { |
| 2766 | // // Element elemento = | 2766 | // // Element elemento = |
| 2767 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(c.getColumnName(i))); | 2767 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(c.getColumnName(i))); |
| 2768 | // // elemento.setTextContent(c.getString(i)); | 2768 | // // elemento.setTextContent(c.getString(i)); |
| 2769 | // // medicion.appendChild(elemento); | 2769 | // // medicion.appendChild(elemento); |
| 2770 | // // } | 2770 | // // } |
| 2771 | // // titulo.appendChild(medicion); | 2771 | // // titulo.appendChild(medicion); |
| 2772 | // // | 2772 | // // |
| 2773 | // // c.moveToNext(); | 2773 | // // c.moveToNext(); |
| 2774 | // // } | 2774 | // // } |
| 2775 | // // } | 2775 | // // } |
| 2776 | // // | 2776 | // // |
| 2777 | // // dtb.close(); | 2777 | // // dtb.close(); |
| 2778 | // // | 2778 | // // |
| 2779 | // // documento.appendChild(titulo); | 2779 | // // documento.appendChild(titulo); |
| 2780 | // // | 2780 | // // |
| 2781 | // // // Sauvegarde du DOM dans un fichier XML | 2781 | // // // Sauvegarde du DOM dans un fichier XML |
| 2782 | // // HttpWriter.transformerXml(documento, | 2782 | // // HttpWriter.transformerXml(documento, |
| 2783 | // // ParametrosInventario.URL_COPIA_XML_EXPORT); | 2783 | // // ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 2784 | // // | 2784 | // // |
| 2785 | // // // Mandamos el archivo en POST hacia el servidor: | 2785 | // // // Mandamos el archivo en POST hacia el servidor: |
| 2786 | // // HttpSender httpSender = new | 2786 | // // HttpSender httpSender = new |
| 2787 | // // HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); | 2787 | // // HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); |
| 2788 | // // return httpSender.send_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); | 2788 | // // return httpSender.send_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 2789 | // // | 2789 | // // |
| 2790 | // // }catch(Exception e){ | 2790 | // // }catch(Exception e){ |
| 2791 | // // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2791 | // // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2792 | // // "La exportacion de los datos de la Base De Datos fracaso"); | 2792 | // // "La exportacion de los datos de la Base De Datos fracaso"); |
| 2793 | // // } | 2793 | // // } |
| 2794 | // // } | 2794 | // // } |
| 2795 | // | 2795 | // |
| 2796 | // // Old 28/4/2012 | 2796 | // // Old 28/4/2012 |
| 2797 | // // public void exportarTodasBaseDatosSQLite_HaciaUsb(ArrayList<Integer> | 2797 | // // public void exportarTodasBaseDatosSQLite_HaciaUsb(ArrayList<Integer> |
| 2798 | // // listaInventariosSeleccionados) throws ExceptionBDD { | 2798 | // // listaInventariosSeleccionados) throws ExceptionBDD { |
| 2799 | // // try { | 2799 | // // try { |
| 2800 | // // for (int inv : listaInventariosSeleccionados) { | 2800 | // // for (int inv : listaInventariosSeleccionados) { |
| 2801 | // // | 2801 | // // |
| 2802 | // // // Creation d'un nouveau DOM: | 2802 | // // // Creation d'un nouveau DOM: |
| 2803 | // // DocumentBuilderFactory fabricaDocumentos = | 2803 | // // DocumentBuilderFactory fabricaDocumentos = |
| 2804 | // // DocumentBuilderFactory.newInstance(); | 2804 | // // DocumentBuilderFactory.newInstance(); |
| 2805 | // // DocumentBuilder constructorDocumentos = | 2805 | // // DocumentBuilder constructorDocumentos = |
| 2806 | // // fabricaDocumentos.newDocumentBuilder(); | 2806 | // // fabricaDocumentos.newDocumentBuilder(); |
| 2807 | // // Document documento = constructorDocumentos.newDocument(); | 2807 | // // Document documento = constructorDocumentos.newDocument(); |
| 2808 | // // | 2808 | // // |
| 2809 | // // // Proprits du DOM: | 2809 | // // // Proprits du DOM: |
| 2810 | // // documento.setXmlVersion("1.0"); | 2810 | // // documento.setXmlVersion("1.0"); |
| 2811 | // // documento.setXmlStandalone(true); | 2811 | // // documento.setXmlStandalone(true); |
| 2812 | // // | 2812 | // // |
| 2813 | // // // Cration de l'arborescence du DOM: | 2813 | // // // Cration de l'arborescence du DOM: |
| 2814 | // // Element titulo = | 2814 | // // Element titulo = |
| 2815 | // // documento.createElement(ParametrosInventario.bal_xml_export_cabecera); | 2815 | // // documento.createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 2816 | // // | 2816 | // // |
| 2817 | // // //Abrimos la base de datos en modo lectura: | 2817 | // // //Abrimos la base de datos en modo lectura: |
| 2818 | // // SQLiteDatabase dtb = this.getReadableDatabase(); | 2818 | // // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 2819 | // // | 2819 | // // |
| 2820 | // // String[] columnasDeseadas = new String[] { | 2820 | // // String[] columnasDeseadas = new String[] { |
| 2821 | // // ParametrosInventario.bal_bdd_articulo_sector, | 2821 | // // ParametrosInventario.bal_bdd_articulo_sector, |
| 2822 | // // ParametrosInventario.bal_bdd_articulo_codigo, | 2822 | // // ParametrosInventario.bal_bdd_articulo_codigo, |
| 2823 | // // ParametrosInventario.bal_bdd_articulo_cantidad, | 2823 | // // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 2824 | // // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 2824 | // // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 2825 | // // ParametrosInventario.bal_bdd_articulo_fechaFin, | 2825 | // // ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 2826 | // // ParametrosInventario.bal_bdd_articulo_descripcion, | 2826 | // // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 2827 | // // ParametrosInventario.bal_bdd_articulo_codigo_barra | 2827 | // // ParametrosInventario.bal_bdd_articulo_codigo_barra |
| 2828 | // // }; | 2828 | // // }; |
| 2829 | // // Cursor c = dtb.query(tabla_articulos_nombre, columnasDeseadas, | 2829 | // // Cursor c = dtb.query(tabla_articulos_nombre, columnasDeseadas, |
| 2830 | // // ParametrosInventario.bal_bdd_articulo_inventario + "=" + | 2830 | // // ParametrosInventario.bal_bdd_articulo_inventario + "=" + |
| 2831 | // // String.valueOf(inv), null, null, null, null); | 2831 | // // String.valueOf(inv), null, null, null, null); |
| 2832 | // // | 2832 | // // |
| 2833 | // // // Recuperamos los resultados: | 2833 | // // // Recuperamos los resultados: |
| 2834 | // // int cantidadColumnas = c.getColumnCount(); | 2834 | // // int cantidadColumnas = c.getColumnCount(); |
| 2835 | // // | 2835 | // // |
| 2836 | // // if (c.moveToFirst()) { | 2836 | // // if (c.moveToFirst()) { |
| 2837 | // // | 2837 | // // |
| 2838 | // // // Ponemos el num de inventario en el encabezado: (Atencin, para USB!!!) | 2838 | // // // Ponemos el num de inventario en el encabezado: (Atencin, para USB!!!) |
| 2839 | // // Element inventario = | 2839 | // // Element inventario = |
| 2840 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(ParametrosInventario.bal_bdd_inventario_numero)); | 2840 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(ParametrosInventario.bal_bdd_inventario_numero)); |
| 2841 | // // inventario.setTextContent(String.valueOf(inv)); | 2841 | // // inventario.setTextContent(String.valueOf(inv)); |
| 2842 | // // titulo.appendChild(inventario); | 2842 | // // titulo.appendChild(inventario); |
| 2843 | // // | 2843 | // // |
| 2844 | // // // Luego el detalle de los articulos: | 2844 | // // // Luego el detalle de los articulos: |
| 2845 | // // while (c.isAfterLast() == false) { | 2845 | // // while (c.isAfterLast() == false) { |
| 2846 | // // | 2846 | // // |
| 2847 | // // Element medicion = | 2847 | // // Element medicion = |
| 2848 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(tabla_articulos_nombre)); | 2848 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(tabla_articulos_nombre)); |
| 2849 | // // | 2849 | // // |
| 2850 | // // for (int i = 0 ; i < cantidadColumnas ; i++) { | 2850 | // // for (int i = 0 ; i < cantidadColumnas ; i++) { |
| 2851 | // // Element elemento = | 2851 | // // Element elemento = |
| 2852 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(c.getColumnName(i))); | 2852 | // // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(c.getColumnName(i))); |
| 2853 | // // elemento.setTextContent(c.getString(i)); | 2853 | // // elemento.setTextContent(c.getString(i)); |
| 2854 | // // medicion.appendChild(elemento); | 2854 | // // medicion.appendChild(elemento); |
| 2855 | // // } | 2855 | // // } |
| 2856 | // // titulo.appendChild(medicion); | 2856 | // // titulo.appendChild(medicion); |
| 2857 | // // | 2857 | // // |
| 2858 | // // c.moveToNext(); | 2858 | // // c.moveToNext(); |
| 2859 | // // } | 2859 | // // } |
| 2860 | // // } | 2860 | // // } |
| 2861 | // // | 2861 | // // |
| 2862 | // // dtb.close(); | 2862 | // // dtb.close(); |
| 2863 | // // | 2863 | // // |
| 2864 | // // documento.appendChild(titulo); | 2864 | // // documento.appendChild(titulo); |
| 2865 | // // | 2865 | // // |
| 2866 | // // // Sauvegarde du DOM dans un fichier XML | 2866 | // // // Sauvegarde du DOM dans un fichier XML |
| 2867 | // // // Construccion del nombre del archivode exportacion: n del inventario | 2867 | // // // Construccion del nombre del archivode exportacion: n del inventario |
| 2868 | // // sobre 4 digitos: | 2868 | // // sobre 4 digitos: |
| 2869 | // // String titulo_inicial = String.valueOf(inv); | 2869 | // // String titulo_inicial = String.valueOf(inv); |
| 2870 | // // String titulo_final = titulo_inicial; | 2870 | // // String titulo_final = titulo_inicial; |
| 2871 | // // for (int i = titulo_inicial.length() ; i < 4 ; i++) { | 2871 | // // for (int i = titulo_inicial.length() ; i < 4 ; i++) { |
| 2872 | // // titulo_final = "0" + titulo_final; | 2872 | // // titulo_final = "0" + titulo_final; |
| 2873 | // // } | 2873 | // // } |
| 2874 | // // | 2874 | // // |
| 2875 | // // File carpeta_usb_export = new | 2875 | // // File carpeta_usb_export = new |
| 2876 | // // File(ParametrosInventario.URL_CARPETA_USB_EXPORT); | 2876 | // // File(ParametrosInventario.URL_CARPETA_USB_EXPORT); |
| 2877 | // // File archivo_destino = new File(carpeta_usb_export.getPath() + "/" + | 2877 | // // File archivo_destino = new File(carpeta_usb_export.getPath() + "/" + |
| 2878 | // // titulo_final + ".xml"); | 2878 | // // titulo_final + ".xml"); |
| 2879 | // // | 2879 | // // |
| 2880 | // // // Si la carpeta no existe: | 2880 | // // // Si la carpeta no existe: |
| 2881 | // // if (archivo_destino.exists() == false) { | 2881 | // // if (archivo_destino.exists() == false) { |
| 2882 | // // archivo_destino.mkdirs(); | 2882 | // // archivo_destino.mkdirs(); |
| 2883 | // // archivo_destino.createNewFile(); | 2883 | // // archivo_destino.createNewFile(); |
| 2884 | // // } | 2884 | // // } |
| 2885 | // // else { | 2885 | // // else { |
| 2886 | // // archivo_destino.delete(); | 2886 | // // archivo_destino.delete(); |
| 2887 | // // archivo_destino.createNewFile(); | 2887 | // // archivo_destino.createNewFile(); |
| 2888 | // // } | 2888 | // // } |
| 2889 | // // | 2889 | // // |
| 2890 | // // HttpWriter.transformerXml(documento, archivo_destino.getAbsolutePath()); | 2890 | // // HttpWriter.transformerXml(documento, archivo_destino.getAbsolutePath()); |
| 2891 | // // } // end for | 2891 | // // } // end for |
| 2892 | // // | 2892 | // // |
| 2893 | // // }catch(Exception e){ | 2893 | // // }catch(Exception e){ |
| 2894 | // // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 2894 | // // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 2895 | // // "La exportacion de los datos de la Base De Datos fracaso"); | 2895 | // // "La exportacion de los datos de la Base De Datos fracaso"); |
| 2896 | // // } | 2896 | // // } |
| 2897 | // // } | 2897 | // // } |
| 2898 | // // | 2898 | // // |
| 2899 | // | 2899 | // |
| 2900 | // | 2900 | // |
| 2901 | // | 2901 | // |
| 2902 | // /** | 2902 | // /** |
| 2903 | // * Agregar un articulo nuevo o actualiza la base de datos en la tabla de | 2903 | // * Agregar un articulo nuevo o actualiza la base de datos en la tabla de |
| 2904 | // * articulos | 2904 | // * articulos |
| 2905 | // * <p> | 2905 | // * <p> |
| 2906 | // * 1 Test de la preexistencia de la entrada | 2906 | // * 1 Test de la preexistencia de la entrada |
| 2907 | // * <p> | 2907 | // * <p> |
| 2908 | // * 1.1 Si la entrada ya existe, actualizamos los datos | 2908 | // * 1.1 Si la entrada ya existe, actualizamos los datos |
| 2909 | // * <p> | 2909 | // * <p> |
| 2910 | // * 2 Sino, abrimos la base de datos en modo escritura | 2910 | // * 2 Sino, abrimos la base de datos en modo escritura |
| 2911 | // * <p> | 2911 | // * <p> |
| 2912 | // * 3 Creamos el registro a insertar como objeto ContentValues | 2912 | // * 3 Creamos el registro a insertar como objeto ContentValues |
| 2913 | // * <p> | 2913 | // * <p> |
| 2914 | // * 4 Insertamos el registro en la base de datos | 2914 | // * 4 Insertamos el registro en la base de datos |
| 2915 | // * <p> | 2915 | // * <p> |
| 2916 | // * 5 Cierre | 2916 | // * 5 Cierre |
| 2917 | // * | 2917 | // * |
| 2918 | // * @param articulo | 2918 | // * @param articulo |
| 2919 | // * @throws ExceptionBDD | 2919 | // * @throws ExceptionBDD |
| 2920 | // */ | 2920 | // */ |
| 2921 | // | 2921 | // |
| 2922 | // public void insertArticuloEnBdd(Articulo articulo) throws ExceptionBDD { | 2922 | // public void insertArticuloEnBdd(Articulo articulo) throws ExceptionBDD { |
| 2923 | // try { | 2923 | // try { |
| 2924 | // System.out.println("::: BD 2119 Insert con cb"); | 2924 | // System.out.println("::: BD 2119 Insert con cb"); |
| 2925 | // // 1 Test de la preexistencia de la entrada: | 2925 | // // 1 Test de la preexistencia de la entrada: |
| 2926 | // | 2926 | // |
| 2927 | // /*Comprueba si esta marcado el parametro de balanza*/ | 2927 | // /*Comprueba si esta marcado el parametro de balanza*/ |
| 2928 | // boolean condicionBalanza = ParametrosInventario.balanza; | 2928 | // boolean condicionBalanza = ParametrosInventario.balanza; |
| 2929 | // | 2929 | // |
| 2930 | // System.out.println("::: BaseDatos 2253 condicionBalanza " + condicionBalanza ); | 2930 | // System.out.println("::: BaseDatos 2253 condicionBalanza " + condicionBalanza ); |
| 2931 | // | 2931 | // |
| 2932 | // if (selectArticuloConCodigos(articulo.getSector(), | 2932 | // if (selectArticuloConCodigos(articulo.getSector(), |
| 2933 | // articulo.getCodigo(), articulo.getInventario()) != null) // Si | 2933 | // articulo.getCodigo(), articulo.getInventario()) != null) // Si |
| 2934 | // // existe... | 2934 | // // existe... |
| 2935 | // { | 2935 | // { |
| 2936 | // // 1.1 Si la entrada ya existe, actualizamos los datos: | 2936 | // // 1.1 Si la entrada ya existe, actualizamos los datos: |
| 2937 | // updateArticulo(articulo); | 2937 | // updateArticulo(articulo); |
| 2938 | // return; | 2938 | // return; |
| 2939 | // } | 2939 | // } |
| 2940 | // | 2940 | // |
| 2941 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 2941 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 2942 | // System.out.println("::: BD 2119 Insert con cb " + ParametrosInventario.InventariosVentas); | 2942 | // System.out.println("::: BD 2119 Insert con cb " + ParametrosInventario.InventariosVentas); |
| 2943 | // | 2943 | // |
| 2944 | // if(condicionBalanza == true){ | 2944 | // if(condicionBalanza == true){ |
| 2945 | // if (ParametrosInventario.InventariosVentas == true) { | 2945 | // if (ParametrosInventario.InventariosVentas == true) { |
| 2946 | // int valorDepo = articulo.getDepsn(); | 2946 | // int valorDepo = articulo.getDepsn(); |
| 2947 | // System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); | 2947 | // System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); |
| 2948 | // // 2 Sino, abrimos la base de datos en modo escritura | 2948 | // // 2 Sino, abrimos la base de datos en modo escritura |
| 2949 | // // SQLiteDatabase dtb = this.getWritableDatabase(); | 2949 | // // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 2950 | // // Si hemos abierto correctamente la base de datos | 2950 | // // Si hemos abierto correctamente la base de datos |
| 2951 | // if (dtb != null) { | 2951 | // if (dtb != null) { |
| 2952 | // // 3 Creamos el registro a insertar como objeto ContentValues | 2952 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 2953 | // | 2953 | // |
| 2954 | // System.out.println("::: BaseDatos 2814 Sector " + articulo.getSector()); | 2954 | // System.out.println("::: BaseDatos 2814 Sector " + articulo.getSector()); |
| 2955 | // System.out.println("::: BaseDatos 2815 Codigo " + articulo.getCodigo()); | 2955 | // System.out.println("::: BaseDatos 2815 Codigo " + articulo.getCodigo()); |
| 2956 | // | 2956 | // |
| 2957 | // ContentValues nuevoRegistro = new ContentValues(); | 2957 | // ContentValues nuevoRegistro = new ContentValues(); |
| 2958 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 2958 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 2959 | // articulo.getSector()); | 2959 | // articulo.getSector()); |
| 2960 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 2960 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 2961 | // articulo.getCodigo()); | 2961 | // articulo.getCodigo()); |
| 2962 | // String codigo_a_modificar = ""; | 2962 | // String codigo_a_modificar = ""; |
| 2963 | // String cod1; | 2963 | // String cod1; |
| 2964 | // String codigoDeBarras =""; | 2964 | // String codigoDeBarras =""; |
| 2965 | // String obtenerPesaje =""; | 2965 | // String obtenerPesaje =""; |
| 2966 | // String corregirDecimales=""; | 2966 | // String corregirDecimales=""; |
| 2967 | // String descBarra; | 2967 | // String descBarra; |
| 2968 | // if(articulo.getInventario()==-1 || articulo.getInventario()==-2 || articulo.getInventario()==-3) { | 2968 | // if(articulo.getInventario()==-1 || articulo.getInventario()==-2 || articulo.getInventario()==-3) { |
| 2969 | // codigo_a_modificar = articulo.getCodigos_barras_string(); | 2969 | // codigo_a_modificar = articulo.getCodigos_barras_string(); |
| 2970 | // if(articulo.getCodigos_barras_completo().isEmpty()){ | 2970 | // if(articulo.getCodigos_barras_completo().isEmpty()){ |
| 2971 | // if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ | 2971 | // if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ |
| 2972 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 2972 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 2973 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ | 2973 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ |
| 2974 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 2974 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 2975 | // }else if(articulo.getBalanza()!=8){ | 2975 | // }else if(articulo.getBalanza()!=8){ |
| 2976 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 2976 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 2977 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ | 2977 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ |
| 2978 | //// corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 2978 | //// corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 2979 | //// String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); | 2979 | //// String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); |
| 2980 | //// String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); | 2980 | //// String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); |
| 2981 | //// codigoDeBarras = String.valueOf(parte1 +"."+ parte2); | 2981 | //// codigoDeBarras = String.valueOf(parte1 +"."+ parte2); |
| 2982 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 2982 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 2983 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ | 2983 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ |
| 2984 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 2984 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 2985 | // } | 2985 | // } |
| 2986 | // }else{ | 2986 | // }else{ |
| 2987 | // if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ | 2987 | // if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ |
| 2988 | // codigoDeBarras = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 2988 | // codigoDeBarras = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 2989 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ | 2989 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ |
| 2990 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 2990 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 2991 | // }else if(articulo.getBalanza()!=8){ | 2991 | // }else if(articulo.getBalanza()!=8){ |
| 2992 | // codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); | 2992 | // codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); |
| 2993 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ | 2993 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ |
| 2994 | // corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 2994 | // corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 2995 | // String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); | 2995 | // String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); |
| 2996 | // String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); | 2996 | // String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); |
| 2997 | // codigoDeBarras = String.valueOf(parte1 +"."+ parte2); | 2997 | // codigoDeBarras = String.valueOf(parte1 +"."+ parte2); |
| 2998 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ | 2998 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ |
| 2999 | // codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); | 2999 | // codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); |
| 3000 | // } | 3000 | // } |
| 3001 | // } | 3001 | // } |
| 3002 | // if(articulo.getBalanza()==8){ | 3002 | // if(articulo.getBalanza()==8){ |
| 3003 | // descBarra = articulo.getCodigos_barras_completo_string(); | 3003 | // descBarra = articulo.getCodigos_barras_completo_string(); |
| 3004 | // }else{ | 3004 | // }else{ |
| 3005 | // descBarra = String.valueOf(articulo.getCodigos_barras().get(0)); | 3005 | // descBarra = String.valueOf(articulo.getCodigos_barras().get(0)); |
| 3006 | // } | 3006 | // } |
| 3007 | // nuevoRegistro.put( | 3007 | // nuevoRegistro.put( |
| 3008 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3008 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3009 | // articulo.getCodigos_barras_string()); | 3009 | // articulo.getCodigos_barras_string()); |
| 3010 | // nuevoRegistro.put( | 3010 | // nuevoRegistro.put( |
| 3011 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 3011 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 3012 | // articulo.getCodigos_barras_completo_string()); | 3012 | // articulo.getCodigos_barras_completo_string()); |
| 3013 | // }else if(articulo.getInventario()>0){ | 3013 | // }else if(articulo.getInventario()>0){ |
| 3014 | // nuevoRegistro.put( | 3014 | // nuevoRegistro.put( |
| 3015 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3015 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3016 | // articulo.getCodigos_barras_string_inv()); | 3016 | // articulo.getCodigos_barras_string_inv()); |
| 3017 | // nuevoRegistro.put( | 3017 | // nuevoRegistro.put( |
| 3018 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 3018 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 3019 | // articulo.getCodigos_barras_string_inv()); | 3019 | // articulo.getCodigos_barras_string_inv()); |
| 3020 | // }else if(articulo.getInventario()<-3){ | 3020 | // }else if(articulo.getInventario()<-3){ |
| 3021 | // nuevoRegistro.put( | 3021 | // nuevoRegistro.put( |
| 3022 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3022 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3023 | // articulo.getCodigos_barras_string_inv()); | 3023 | // articulo.getCodigos_barras_string_inv()); |
| 3024 | // nuevoRegistro.put( | 3024 | // nuevoRegistro.put( |
| 3025 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 3025 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 3026 | // articulo.getCodigos_barras_string_inv()); | 3026 | // articulo.getCodigos_barras_string_inv()); |
| 3027 | // } | 3027 | // } |
| 3028 | // nuevoRegistro.put( | 3028 | // nuevoRegistro.put( |
| 3029 | // ParametrosInventario.bal_bdd_articulo_inventario, | 3029 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 3030 | // articulo.getInventario()); | 3030 | // articulo.getInventario()); |
| 3031 | // nuevoRegistro.put( | 3031 | // nuevoRegistro.put( |
| 3032 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 3032 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3033 | // articulo.getDescripcion()); | 3033 | // articulo.getDescripcion()); |
| 3034 | // nuevoRegistro.put( | 3034 | // nuevoRegistro.put( |
| 3035 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 3035 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3036 | // articulo.getPrecio_venta()); | 3036 | // articulo.getPrecio_venta()); |
| 3037 | // nuevoRegistro.put( | 3037 | // nuevoRegistro.put( |
| 3038 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 3038 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3039 | // articulo.getPrecio_costo()); | 3039 | // articulo.getPrecio_costo()); |
| 3040 | // /*Damian*/ | 3040 | // /*Damian*/ |
| 3041 | // nuevoRegistro.put( | 3041 | // nuevoRegistro.put( |
| 3042 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3042 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3043 | // articulo.getExis_venta()); | 3043 | // articulo.getExis_venta()); |
| 3044 | // nuevoRegistro.put( | 3044 | // nuevoRegistro.put( |
| 3045 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3045 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3046 | // articulo.getExis_deposito()); | 3046 | // articulo.getExis_deposito()); |
| 3047 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3047 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3048 | // articulo.getFoto()); | 3048 | // articulo.getFoto()); |
| 3049 | // if(articulo.getInventario()==-1 || articulo.getInventario()==-2) { | 3049 | // if(articulo.getInventario()==-1 || articulo.getInventario()==-2) { |
| 3050 | // if(articulo.getCodigos_barras_completo().isEmpty()){ | 3050 | // if(articulo.getCodigos_barras_completo().isEmpty()){ |
| 3051 | // obtenerPesaje = String.valueOf(articulo.getCantidad()); | 3051 | // obtenerPesaje = String.valueOf(articulo.getCantidad()); |
| 3052 | // }else{ | 3052 | // }else{ |
| 3053 | // if(articulo.getBalanza()==8){ | 3053 | // if(articulo.getBalanza()==8){ |
| 3054 | // obtenerPesaje = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 3054 | // obtenerPesaje = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 3055 | // }else{ | 3055 | // }else{ |
| 3056 | // obtenerPesaje = String.valueOf(articulo.getCantidad()); | 3056 | // obtenerPesaje = String.valueOf(articulo.getCantidad()); |
| 3057 | // } | 3057 | // } |
| 3058 | // } | 3058 | // } |
| 3059 | // nuevoRegistro.put( | 3059 | // nuevoRegistro.put( |
| 3060 | // ParametrosInventario.bal_bdd_articulo_pesaje, | 3060 | // ParametrosInventario.bal_bdd_articulo_pesaje, |
| 3061 | // obtenerPesaje); | 3061 | // obtenerPesaje); |
| 3062 | // | 3062 | // |
| 3063 | // System.out.println("::: QUIERO VER Q TRAE articulo.getCantidad() " + articulo.getCantidad()); | 3063 | // System.out.println("::: QUIERO VER Q TRAE articulo.getCantidad() " + articulo.getCantidad()); |
| 3064 | // nuevoRegistro.put( | 3064 | // nuevoRegistro.put( |
| 3065 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 3065 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3066 | // codigoDeBarras); | 3066 | // codigoDeBarras); |
| 3067 | // }else if(articulo.getInventario()>0){ | 3067 | // }else if(articulo.getInventario()>0){ |
| 3068 | // obtenerPesaje = "0"; | 3068 | // obtenerPesaje = "0"; |
| 3069 | // codigoDeBarras = "-1"; | 3069 | // codigoDeBarras = "-1"; |
| 3070 | // | 3070 | // |
| 3071 | // nuevoRegistro.put( | 3071 | // nuevoRegistro.put( |
| 3072 | // ParametrosInventario.bal_bdd_articulo_pesaje, | 3072 | // ParametrosInventario.bal_bdd_articulo_pesaje, |
| 3073 | // obtenerPesaje); | 3073 | // obtenerPesaje); |
| 3074 | // nuevoRegistro.put( | 3074 | // nuevoRegistro.put( |
| 3075 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 3075 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3076 | // codigoDeBarras); | 3076 | // codigoDeBarras); |
| 3077 | // }else if(articulo.getInventario()<-3){ | 3077 | // }else if(articulo.getInventario()<-3){ |
| 3078 | // obtenerPesaje = "0"; | 3078 | // obtenerPesaje = "0"; |
| 3079 | // codigoDeBarras = "-1"; | 3079 | // codigoDeBarras = "-1"; |
| 3080 | // | 3080 | // |
| 3081 | // nuevoRegistro.put( | 3081 | // nuevoRegistro.put( |
| 3082 | // ParametrosInventario.bal_bdd_articulo_pesaje, | 3082 | // ParametrosInventario.bal_bdd_articulo_pesaje, |
| 3083 | // obtenerPesaje); | 3083 | // obtenerPesaje); |
| 3084 | // nuevoRegistro.put( | 3084 | // nuevoRegistro.put( |
| 3085 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 3085 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3086 | // codigoDeBarras); | 3086 | // codigoDeBarras); |
| 3087 | // } | 3087 | // } |
| 3088 | // | 3088 | // |
| 3089 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, | 3089 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, |
| 3090 | // articulo.getBalanza()); | 3090 | // articulo.getBalanza()); |
| 3091 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, | 3091 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, |
| 3092 | // articulo.getDecimales()); | 3092 | // articulo.getDecimales()); |
| 3093 | // | 3093 | // |
| 3094 | // nuevoRegistro.put( | 3094 | // nuevoRegistro.put( |
| 3095 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3095 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3096 | // articulo.getFechaInicio()); | 3096 | // articulo.getFechaInicio()); |
| 3097 | // | 3097 | // |
| 3098 | // // 4 Insertamos el registro en la base de datos | 3098 | // // 4 Insertamos el registro en la base de datos |
| 3099 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 3099 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3100 | // nuevoRegistro); | 3100 | // nuevoRegistro); |
| 3101 | // | 3101 | // |
| 3102 | // // Test resultado INSERT: | 3102 | // // Test resultado INSERT: |
| 3103 | // if (resultado < 0) { | 3103 | // if (resultado < 0) { |
| 3104 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3104 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3105 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3105 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3106 | // } | 3106 | // } |
| 3107 | // | 3107 | // |
| 3108 | // } else { | 3108 | // } else { |
| 3109 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3109 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3110 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3110 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3111 | // } | 3111 | // } |
| 3112 | // | 3112 | // |
| 3113 | // | 3113 | // |
| 3114 | // }else { | 3114 | // }else { |
| 3115 | // // 2 Sino, abrimos la base de datos en modo escritura | 3115 | // // 2 Sino, abrimos la base de datos en modo escritura |
| 3116 | // // SQLiteDatabase dtb = this.getWritableDatabase(); | 3116 | // // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 3117 | // int valorDepo = articulo.getDepsn(); | 3117 | // int valorDepo = articulo.getDepsn(); |
| 3118 | // System.out.println("::::: BD 2209 valor depsn " + valorDepo); | 3118 | // System.out.println("::::: BD 2209 valor depsn " + valorDepo); |
| 3119 | // if(valorDepo == 1){ | 3119 | // if(valorDepo == 1){ |
| 3120 | // // 3 Creamos el registro a insertar como objeto ContentValues | 3120 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 3121 | // ContentValues nuevoRegistro = new ContentValues(); | 3121 | // ContentValues nuevoRegistro = new ContentValues(); |
| 3122 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 3122 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 3123 | // articulo.getSector()); | 3123 | // articulo.getSector()); |
| 3124 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3124 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3125 | // articulo.getCodigo()); | 3125 | // articulo.getCodigo()); |
| 3126 | // String codigo_a_modificar = articulo.getCodigos_barras_string(); | 3126 | // String codigo_a_modificar = articulo.getCodigos_barras_string(); |
| 3127 | // String codigoDeBarras =""; | 3127 | // String codigoDeBarras =""; |
| 3128 | // String obtenerPesaje =""; | 3128 | // String obtenerPesaje =""; |
| 3129 | // String corregirDecimales=""; | 3129 | // String corregirDecimales=""; |
| 3130 | // String descBarra; | 3130 | // String descBarra; |
| 3131 | // if(articulo.getCodigos_barras_completo().isEmpty()){ | 3131 | // if(articulo.getCodigos_barras_completo().isEmpty()){ |
| 3132 | // if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ | 3132 | // if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ |
| 3133 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 3133 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 3134 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ | 3134 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ |
| 3135 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 3135 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 3136 | // }else if(articulo.getBalanza()!=8){ | 3136 | // }else if(articulo.getBalanza()!=8){ |
| 3137 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 3137 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 3138 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ | 3138 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ |
| 3139 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 3139 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 3140 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ | 3140 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ |
| 3141 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 3141 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 3142 | // } | 3142 | // } |
| 3143 | // }else{ | 3143 | // }else{ |
| 3144 | // if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ | 3144 | // if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ |
| 3145 | // codigoDeBarras = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 3145 | // codigoDeBarras = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 3146 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ | 3146 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ |
| 3147 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); | 3147 | // codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 3148 | // }else if(articulo.getBalanza()!=8){ | 3148 | // }else if(articulo.getBalanza()!=8){ |
| 3149 | // codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); | 3149 | // codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); |
| 3150 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ | 3150 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ |
| 3151 | // corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 3151 | // corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 3152 | // String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); | 3152 | // String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); |
| 3153 | // String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); | 3153 | // String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); |
| 3154 | // codigoDeBarras = String.valueOf(parte1 +"."+ parte2); | 3154 | // codigoDeBarras = String.valueOf(parte1 +"."+ parte2); |
| 3155 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ | 3155 | // }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ |
| 3156 | // codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); | 3156 | // codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); |
| 3157 | // } | 3157 | // } |
| 3158 | // | 3158 | // |
| 3159 | // | 3159 | // |
| 3160 | // } | 3160 | // } |
| 3161 | // | 3161 | // |
| 3162 | // if(articulo.getBalanza()==8){ | 3162 | // if(articulo.getBalanza()==8){ |
| 3163 | // descBarra = articulo.getCodigos_barras_completo_string(); | 3163 | // descBarra = articulo.getCodigos_barras_completo_string(); |
| 3164 | // System.out.println("::: BaseDatos 2351 Cargando cb si es 8 " + descBarra); | 3164 | // System.out.println("::: BaseDatos 2351 Cargando cb si es 8 " + descBarra); |
| 3165 | // }else{ | 3165 | // }else{ |
| 3166 | // | 3166 | // |
| 3167 | // descBarra = String.valueOf(articulo.getCodigos_barras().get(0)); | 3167 | // descBarra = String.valueOf(articulo.getCodigos_barras().get(0)); |
| 3168 | // //descBarra = String.valueOf(articulo.getCodigos_barras()); | 3168 | // //descBarra = String.valueOf(articulo.getCodigos_barras()); |
| 3169 | // System.out.println("::: BaseDatos 2355 Cargando cb si no es 8 " + descBarra); | 3169 | // System.out.println("::: BaseDatos 2355 Cargando cb si no es 8 " + descBarra); |
| 3170 | // } | 3170 | // } |
| 3171 | // | 3171 | // |
| 3172 | // nuevoRegistro.put( | 3172 | // nuevoRegistro.put( |
| 3173 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3173 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3174 | // articulo.getCodigos_barras_string()); | 3174 | // articulo.getCodigos_barras_string()); |
| 3175 | // nuevoRegistro.put( | 3175 | // nuevoRegistro.put( |
| 3176 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 3176 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 3177 | // articulo.getCodigos_barras_string()); | 3177 | // articulo.getCodigos_barras_string()); |
| 3178 | // nuevoRegistro.put( | 3178 | // nuevoRegistro.put( |
| 3179 | // ParametrosInventario.bal_bdd_articulo_inventario, | 3179 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 3180 | // articulo.getInventario()); | 3180 | // articulo.getInventario()); |
| 3181 | // nuevoRegistro.put( | 3181 | // nuevoRegistro.put( |
| 3182 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 3182 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3183 | // articulo.getDescripcion()); | 3183 | // articulo.getDescripcion()); |
| 3184 | // nuevoRegistro.put( | 3184 | // nuevoRegistro.put( |
| 3185 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 3185 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3186 | // articulo.getPrecio_venta()); | 3186 | // articulo.getPrecio_venta()); |
| 3187 | // nuevoRegistro.put( | 3187 | // nuevoRegistro.put( |
| 3188 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 3188 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3189 | // articulo.getPrecio_costo()); | 3189 | // articulo.getPrecio_costo()); |
| 3190 | // /*Damian*/ | 3190 | // /*Damian*/ |
| 3191 | // nuevoRegistro.put( | 3191 | // nuevoRegistro.put( |
| 3192 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3192 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3193 | // articulo.getExis_venta()); | 3193 | // articulo.getExis_venta()); |
| 3194 | // nuevoRegistro.put( | 3194 | // nuevoRegistro.put( |
| 3195 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3195 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3196 | // articulo.getExis_deposito()); | 3196 | // articulo.getExis_deposito()); |
| 3197 | // | 3197 | // |
| 3198 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3198 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3199 | // articulo.getFoto()); | 3199 | // articulo.getFoto()); |
| 3200 | //// nuevoRegistro.put( | 3200 | //// nuevoRegistro.put( |
| 3201 | //// ParametrosInventario.bal_bdd_articulo_cantidad, | 3201 | //// ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3202 | //// articulo.getCantidad()); | 3202 | //// articulo.getCantidad()); |
| 3203 | //// | 3203 | //// |
| 3204 | // | 3204 | // |
| 3205 | // System.out.println("::: BaseDatos 2301 pudo pasar"); | 3205 | // System.out.println("::: BaseDatos 2301 pudo pasar"); |
| 3206 | // if(articulo.getCodigos_barras_completo().isEmpty()){ | 3206 | // if(articulo.getCodigos_barras_completo().isEmpty()){ |
| 3207 | // | 3207 | // |
| 3208 | // obtenerPesaje = String.valueOf(articulo.getCantidad()); | 3208 | // obtenerPesaje = String.valueOf(articulo.getCantidad()); |
| 3209 | // | 3209 | // |
| 3210 | // }else{ | 3210 | // }else{ |
| 3211 | // | 3211 | // |
| 3212 | // if(articulo.getBalanza()==8){ | 3212 | // if(articulo.getBalanza()==8){ |
| 3213 | // obtenerPesaje = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 3213 | // obtenerPesaje = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 3214 | // }else{ | 3214 | // }else{ |
| 3215 | // obtenerPesaje = String.valueOf(articulo.getCantidad()); | 3215 | // obtenerPesaje = String.valueOf(articulo.getCantidad()); |
| 3216 | // } | 3216 | // } |
| 3217 | // | 3217 | // |
| 3218 | // } | 3218 | // } |
| 3219 | // | 3219 | // |
| 3220 | // nuevoRegistro.put( | 3220 | // nuevoRegistro.put( |
| 3221 | // ParametrosInventario.bal_bdd_articulo_pesaje, | 3221 | // ParametrosInventario.bal_bdd_articulo_pesaje, |
| 3222 | // obtenerPesaje); | 3222 | // obtenerPesaje); |
| 3223 | // nuevoRegistro.put( | 3223 | // nuevoRegistro.put( |
| 3224 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 3224 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3225 | // codigoDeBarras); | 3225 | // codigoDeBarras); |
| 3226 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, | 3226 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, |
| 3227 | // articulo.getBalanza()); | 3227 | // articulo.getBalanza()); |
| 3228 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, | 3228 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, |
| 3229 | // articulo.getDecimales()); | 3229 | // articulo.getDecimales()); |
| 3230 | // | 3230 | // |
| 3231 | // nuevoRegistro.put( | 3231 | // nuevoRegistro.put( |
| 3232 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3232 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3233 | // articulo.getFechaInicio()); | 3233 | // articulo.getFechaInicio()); |
| 3234 | // | 3234 | // |
| 3235 | // // 4 Insertamos el registro en la base de datos | 3235 | // // 4 Insertamos el registro en la base de datos |
| 3236 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 3236 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3237 | // nuevoRegistro); | 3237 | // nuevoRegistro); |
| 3238 | // | 3238 | // |
| 3239 | // // Test resultado INSERT: | 3239 | // // Test resultado INSERT: |
| 3240 | // if (resultado < 0) { | 3240 | // if (resultado < 0) { |
| 3241 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3241 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3242 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3242 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3243 | // } | 3243 | // } |
| 3244 | // }else{ | 3244 | // }else{ |
| 3245 | // | 3245 | // |
| 3246 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); | 3246 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); |
| 3247 | // // Si hemos abierto correctamente la base de datos | 3247 | // // Si hemos abierto correctamente la base de datos |
| 3248 | // if (dtb != null) { | 3248 | // if (dtb != null) { |
| 3249 | // System.out.println("::: BD 2271 NO "); | 3249 | // System.out.println("::: BD 2271 NO "); |
| 3250 | // // 3 Creamos el registro a insertar como objeto ContentValues | 3250 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 3251 | // ContentValues nuevoRegistro = new ContentValues(); | 3251 | // ContentValues nuevoRegistro = new ContentValues(); |
| 3252 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 3252 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 3253 | // articulo.getSector()); | 3253 | // articulo.getSector()); |
| 3254 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3254 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3255 | // articulo.getCodigo()); | 3255 | // articulo.getCodigo()); |
| 3256 | // nuevoRegistro.put( | 3256 | // nuevoRegistro.put( |
| 3257 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3257 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3258 | // articulo.getCodigos_barras_string()); | 3258 | // articulo.getCodigos_barras_string()); |
| 3259 | // nuevoRegistro.put( | 3259 | // nuevoRegistro.put( |
| 3260 | // ParametrosInventario.bal_bdd_articulo_inventario, | 3260 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 3261 | // articulo.getInventario()); | 3261 | // articulo.getInventario()); |
| 3262 | // nuevoRegistro.put( | 3262 | // nuevoRegistro.put( |
| 3263 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 3263 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3264 | // articulo.getDescripcion()); | 3264 | // articulo.getDescripcion()); |
| 3265 | // nuevoRegistro.put( | 3265 | // nuevoRegistro.put( |
| 3266 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 3266 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3267 | // articulo.getPrecio_venta()); | 3267 | // articulo.getPrecio_venta()); |
| 3268 | // nuevoRegistro.put( | 3268 | // nuevoRegistro.put( |
| 3269 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 3269 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3270 | // articulo.getPrecio_costo()); | 3270 | // articulo.getPrecio_costo()); |
| 3271 | // /*Damian*/ | 3271 | // /*Damian*/ |
| 3272 | // nuevoRegistro.put( | 3272 | // nuevoRegistro.put( |
| 3273 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3273 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3274 | // articulo.getExis_venta()); | 3274 | // articulo.getExis_venta()); |
| 3275 | // nuevoRegistro.put( | 3275 | // nuevoRegistro.put( |
| 3276 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3276 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3277 | // articulo.getExis_deposito()); | 3277 | // articulo.getExis_deposito()); |
| 3278 | // nuevoRegistro.put( | 3278 | // nuevoRegistro.put( |
| 3279 | // ParametrosInventario.bal_bdd_articulo_depsn, | 3279 | // ParametrosInventario.bal_bdd_articulo_depsn, |
| 3280 | // articulo.getDepsn()); | 3280 | // articulo.getDepsn()); |
| 3281 | // | 3281 | // |
| 3282 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3282 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3283 | // articulo.getFoto()); | 3283 | // articulo.getFoto()); |
| 3284 | // nuevoRegistro.put( | 3284 | // nuevoRegistro.put( |
| 3285 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 3285 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3286 | // articulo.getCantidad()); | 3286 | // articulo.getCantidad()); |
| 3287 | // | 3287 | // |
| 3288 | // | 3288 | // |
| 3289 | // nuevoRegistro.put( | 3289 | // nuevoRegistro.put( |
| 3290 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3290 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3291 | // articulo.getFechaInicio()); | 3291 | // articulo.getFechaInicio()); |
| 3292 | // | 3292 | // |
| 3293 | // // 4 Insertamos el registro en la base de datos | 3293 | // // 4 Insertamos el registro en la base de datos |
| 3294 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 3294 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3295 | // nuevoRegistro); | 3295 | // nuevoRegistro); |
| 3296 | // | 3296 | // |
| 3297 | // // Test resultado INSERT: | 3297 | // // Test resultado INSERT: |
| 3298 | // if (resultado < 0) { | 3298 | // if (resultado < 0) { |
| 3299 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3299 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3300 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3300 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3301 | // } | 3301 | // } |
| 3302 | // | 3302 | // |
| 3303 | // } else { | 3303 | // } else { |
| 3304 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3304 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3305 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3305 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3306 | // } | 3306 | // } |
| 3307 | //// System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); | 3307 | //// System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); |
| 3308 | //// dtb.close(); | 3308 | //// dtb.close(); |
| 3309 | //// return; | 3309 | //// return; |
| 3310 | // } | 3310 | // } |
| 3311 | // | 3311 | // |
| 3312 | // dtb.close(); | 3312 | // dtb.close(); |
| 3313 | // return; | 3313 | // return; |
| 3314 | // | 3314 | // |
| 3315 | // } | 3315 | // } |
| 3316 | // | 3316 | // |
| 3317 | // }else{ | 3317 | // }else{ |
| 3318 | // | 3318 | // |
| 3319 | // if (ParametrosInventario.InventariosVentas == true) { | 3319 | // if (ParametrosInventario.InventariosVentas == true) { |
| 3320 | // | 3320 | // |
| 3321 | // int valorDepo = articulo.getDepsn(); | 3321 | // int valorDepo = articulo.getDepsn(); |
| 3322 | // System.out.println("::::: BD 2186 en ventas valor depsn " + valorDepo); | 3322 | // System.out.println("::::: BD 2186 en ventas valor depsn " + valorDepo); |
| 3323 | // | 3323 | // |
| 3324 | // System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); | 3324 | // System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); |
| 3325 | // // 2 Sino, abrimos la base de datos en modo escritura | 3325 | // // 2 Sino, abrimos la base de datos en modo escritura |
| 3326 | //// SQLiteDatabase dtb = this.getWritableDatabase(); | 3326 | //// SQLiteDatabase dtb = this.getWritableDatabase(); |
| 3327 | // | 3327 | // |
| 3328 | // // Si hemos abierto correctamente la base de datos | 3328 | // // Si hemos abierto correctamente la base de datos |
| 3329 | // if (dtb != null) { | 3329 | // if (dtb != null) { |
| 3330 | // System.out.println("::: BD 2139 ACA ENTRA SI ABRIO BIEN LA DB"); | 3330 | // System.out.println("::: BD 2139 ACA ENTRA SI ABRIO BIEN LA DB"); |
| 3331 | // // 3 Creamos el registro a insertar como objeto ContentValues | 3331 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 3332 | // ContentValues nuevoRegistro = new ContentValues(); | 3332 | // ContentValues nuevoRegistro = new ContentValues(); |
| 3333 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 3333 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 3334 | // articulo.getSector()); | 3334 | // articulo.getSector()); |
| 3335 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3335 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3336 | // articulo.getCodigo()); | 3336 | // articulo.getCodigo()); |
| 3337 | // nuevoRegistro.put( | 3337 | // nuevoRegistro.put( |
| 3338 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3338 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3339 | // articulo.getCodigos_barras_string()); | 3339 | // articulo.getCodigos_barras_string()); |
| 3340 | // nuevoRegistro.put( | 3340 | // nuevoRegistro.put( |
| 3341 | // ParametrosInventario.bal_bdd_articulo_inventario, | 3341 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 3342 | // articulo.getInventario()); | 3342 | // articulo.getInventario()); |
| 3343 | // nuevoRegistro.put( | 3343 | // nuevoRegistro.put( |
| 3344 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 3344 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3345 | // articulo.getDescripcion()); | 3345 | // articulo.getDescripcion()); |
| 3346 | // nuevoRegistro.put( | 3346 | // nuevoRegistro.put( |
| 3347 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 3347 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3348 | // articulo.getPrecio_venta()); | 3348 | // articulo.getPrecio_venta()); |
| 3349 | // nuevoRegistro.put( | 3349 | // nuevoRegistro.put( |
| 3350 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 3350 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3351 | // articulo.getPrecio_costo()); | 3351 | // articulo.getPrecio_costo()); |
| 3352 | // /*Damian*/ | 3352 | // /*Damian*/ |
| 3353 | // nuevoRegistro.put( | 3353 | // nuevoRegistro.put( |
| 3354 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3354 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3355 | // articulo.getExis_venta()); | 3355 | // articulo.getExis_venta()); |
| 3356 | // nuevoRegistro.put( | 3356 | // nuevoRegistro.put( |
| 3357 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3357 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3358 | // articulo.getExis_deposito()); | 3358 | // articulo.getExis_deposito()); |
| 3359 | // | 3359 | // |
| 3360 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3360 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3361 | // articulo.getFoto()); | 3361 | // articulo.getFoto()); |
| 3362 | // nuevoRegistro.put( | 3362 | // nuevoRegistro.put( |
| 3363 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 3363 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3364 | // articulo.getCantidad()); | 3364 | // articulo.getCantidad()); |
| 3365 | // | 3365 | // |
| 3366 | // | 3366 | // |
| 3367 | // nuevoRegistro.put( | 3367 | // nuevoRegistro.put( |
| 3368 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3368 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3369 | // articulo.getFechaInicio()); | 3369 | // articulo.getFechaInicio()); |
| 3370 | // | 3370 | // |
| 3371 | // // 4 Insertamos el registro en la base de datos | 3371 | // // 4 Insertamos el registro en la base de datos |
| 3372 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 3372 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3373 | // nuevoRegistro); | 3373 | // nuevoRegistro); |
| 3374 | // | 3374 | // |
| 3375 | // // Test resultado INSERT: | 3375 | // // Test resultado INSERT: |
| 3376 | // if (resultado < 0) { | 3376 | // if (resultado < 0) { |
| 3377 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3377 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3378 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3378 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3379 | // } | 3379 | // } |
| 3380 | // | 3380 | // |
| 3381 | // } else { | 3381 | // } else { |
| 3382 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3382 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3383 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3383 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3384 | // } | 3384 | // } |
| 3385 | // | 3385 | // |
| 3386 | // }else { | 3386 | // }else { |
| 3387 | // | 3387 | // |
| 3388 | // // 2 Sino, abrimos la base de datos en modo escritura | 3388 | // // 2 Sino, abrimos la base de datos en modo escritura |
| 3389 | //// SQLiteDatabase dtb = this.getWritableDatabase(); | 3389 | //// SQLiteDatabase dtb = this.getWritableDatabase(); |
| 3390 | // | 3390 | // |
| 3391 | // int valorDepo = articulo.getDepsn(); | 3391 | // int valorDepo = articulo.getDepsn(); |
| 3392 | // System.out.println("::::: BD 2209 valor depsn " + valorDepo); | 3392 | // System.out.println("::::: BD 2209 valor depsn " + valorDepo); |
| 3393 | // | 3393 | // |
| 3394 | // if(valorDepo == 1){ | 3394 | // if(valorDepo == 1){ |
| 3395 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION"); | 3395 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION"); |
| 3396 | // // Si hemos abierto correctamente la base de datos | 3396 | // // Si hemos abierto correctamente la base de datos |
| 3397 | // if (dtb != null) { | 3397 | // if (dtb != null) { |
| 3398 | // System.out.println("::: BD 2271 NO "); | 3398 | // System.out.println("::: BD 2271 NO "); |
| 3399 | // // 3 Creamos el registro a insertar como objeto ContentValues | 3399 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 3400 | // ContentValues nuevoRegistro = new ContentValues(); | 3400 | // ContentValues nuevoRegistro = new ContentValues(); |
| 3401 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 3401 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 3402 | // articulo.getSector()); | 3402 | // articulo.getSector()); |
| 3403 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3403 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3404 | // articulo.getCodigo()); | 3404 | // articulo.getCodigo()); |
| 3405 | // nuevoRegistro.put( | 3405 | // nuevoRegistro.put( |
| 3406 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3406 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3407 | // articulo.getCodigos_barras_string()); | 3407 | // articulo.getCodigos_barras_string()); |
| 3408 | // nuevoRegistro.put( | 3408 | // nuevoRegistro.put( |
| 3409 | // ParametrosInventario.bal_bdd_articulo_inventario, | 3409 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 3410 | // articulo.getInventario()); | 3410 | // articulo.getInventario()); |
| 3411 | // nuevoRegistro.put( | 3411 | // nuevoRegistro.put( |
| 3412 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 3412 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3413 | // articulo.getDescripcion()); | 3413 | // articulo.getDescripcion()); |
| 3414 | // nuevoRegistro.put( | 3414 | // nuevoRegistro.put( |
| 3415 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 3415 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3416 | // articulo.getPrecio_venta()); | 3416 | // articulo.getPrecio_venta()); |
| 3417 | // nuevoRegistro.put( | 3417 | // nuevoRegistro.put( |
| 3418 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 3418 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3419 | // articulo.getPrecio_costo()); | 3419 | // articulo.getPrecio_costo()); |
| 3420 | // /*Damian*/ | 3420 | // /*Damian*/ |
| 3421 | // nuevoRegistro.put( | 3421 | // nuevoRegistro.put( |
| 3422 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3422 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3423 | // articulo.getExis_venta()); | 3423 | // articulo.getExis_venta()); |
| 3424 | // nuevoRegistro.put( | 3424 | // nuevoRegistro.put( |
| 3425 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3425 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3426 | // articulo.getExis_deposito()); | 3426 | // articulo.getExis_deposito()); |
| 3427 | // nuevoRegistro.put( | 3427 | // nuevoRegistro.put( |
| 3428 | // ParametrosInventario.bal_bdd_articulo_depsn, | 3428 | // ParametrosInventario.bal_bdd_articulo_depsn, |
| 3429 | // articulo.getDepsn()); | 3429 | // articulo.getDepsn()); |
| 3430 | // | 3430 | // |
| 3431 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3431 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3432 | // articulo.getFoto()); | 3432 | // articulo.getFoto()); |
| 3433 | // nuevoRegistro.put( | 3433 | // nuevoRegistro.put( |
| 3434 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 3434 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3435 | // articulo.getCantidad()); | 3435 | // articulo.getCantidad()); |
| 3436 | // | 3436 | // |
| 3437 | // nuevoRegistro.put( | 3437 | // nuevoRegistro.put( |
| 3438 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3438 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3439 | // articulo.getFechaInicio()); | 3439 | // articulo.getFechaInicio()); |
| 3440 | // | 3440 | // |
| 3441 | // // 4 Insertamos el registro en la base de datos | 3441 | // // 4 Insertamos el registro en la base de datos |
| 3442 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 3442 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3443 | // nuevoRegistro); | 3443 | // nuevoRegistro); |
| 3444 | // | 3444 | // |
| 3445 | // // Test resultado INSERT: | 3445 | // // Test resultado INSERT: |
| 3446 | // if (resultado < 0) { | 3446 | // if (resultado < 0) { |
| 3447 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3447 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3448 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3448 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3449 | // } | 3449 | // } |
| 3450 | // | 3450 | // |
| 3451 | // } else { | 3451 | // } else { |
| 3452 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3452 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3453 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3453 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3454 | // } | 3454 | // } |
| 3455 | // }else{ | 3455 | // }else{ |
| 3456 | // | 3456 | // |
| 3457 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); | 3457 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); |
| 3458 | // // Si hemos abierto correctamente la base de datos | 3458 | // // Si hemos abierto correctamente la base de datos |
| 3459 | // if (dtb != null) { | 3459 | // if (dtb != null) { |
| 3460 | // System.out.println("::: BD 2271 NO "); | 3460 | // System.out.println("::: BD 2271 NO "); |
| 3461 | // // 3 Creamos el registro a insertar como objeto ContentValues | 3461 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 3462 | // ContentValues nuevoRegistro = new ContentValues(); | 3462 | // ContentValues nuevoRegistro = new ContentValues(); |
| 3463 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 3463 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 3464 | // articulo.getSector()); | 3464 | // articulo.getSector()); |
| 3465 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3465 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3466 | // articulo.getCodigo()); | 3466 | // articulo.getCodigo()); |
| 3467 | // nuevoRegistro.put( | 3467 | // nuevoRegistro.put( |
| 3468 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3468 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3469 | // articulo.getCodigos_barras_string()); | 3469 | // articulo.getCodigos_barras_string()); |
| 3470 | // nuevoRegistro.put( | 3470 | // nuevoRegistro.put( |
| 3471 | // ParametrosInventario.bal_bdd_articulo_inventario, | 3471 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 3472 | // articulo.getInventario()); | 3472 | // articulo.getInventario()); |
| 3473 | // nuevoRegistro.put( | 3473 | // nuevoRegistro.put( |
| 3474 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 3474 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3475 | // articulo.getDescripcion()); | 3475 | // articulo.getDescripcion()); |
| 3476 | // nuevoRegistro.put( | 3476 | // nuevoRegistro.put( |
| 3477 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 3477 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3478 | // articulo.getPrecio_venta()); | 3478 | // articulo.getPrecio_venta()); |
| 3479 | // nuevoRegistro.put( | 3479 | // nuevoRegistro.put( |
| 3480 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 3480 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3481 | // articulo.getPrecio_costo()); | 3481 | // articulo.getPrecio_costo()); |
| 3482 | // /*Damian*/ | 3482 | // /*Damian*/ |
| 3483 | // nuevoRegistro.put( | 3483 | // nuevoRegistro.put( |
| 3484 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3484 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3485 | // articulo.getExis_venta()); | 3485 | // articulo.getExis_venta()); |
| 3486 | // nuevoRegistro.put( | 3486 | // nuevoRegistro.put( |
| 3487 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3487 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3488 | // articulo.getExis_deposito()); | 3488 | // articulo.getExis_deposito()); |
| 3489 | // nuevoRegistro.put( | 3489 | // nuevoRegistro.put( |
| 3490 | // ParametrosInventario.bal_bdd_articulo_depsn, | 3490 | // ParametrosInventario.bal_bdd_articulo_depsn, |
| 3491 | // articulo.getDepsn()); | 3491 | // articulo.getDepsn()); |
| 3492 | // | 3492 | // |
| 3493 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3493 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3494 | // articulo.getFoto()); | 3494 | // articulo.getFoto()); |
| 3495 | // nuevoRegistro.put( | 3495 | // nuevoRegistro.put( |
| 3496 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 3496 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3497 | // articulo.getCantidad()); | 3497 | // articulo.getCantidad()); |
| 3498 | // | 3498 | // |
| 3499 | // | 3499 | // |
| 3500 | // nuevoRegistro.put( | 3500 | // nuevoRegistro.put( |
| 3501 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3501 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3502 | // articulo.getFechaInicio()); | 3502 | // articulo.getFechaInicio()); |
| 3503 | // | 3503 | // |
| 3504 | // // 4 Insertamos el registro en la base de datos | 3504 | // // 4 Insertamos el registro en la base de datos |
| 3505 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 3505 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3506 | // nuevoRegistro); | 3506 | // nuevoRegistro); |
| 3507 | // | 3507 | // |
| 3508 | // // Test resultado INSERT: | 3508 | // // Test resultado INSERT: |
| 3509 | // if (resultado < 0) { | 3509 | // if (resultado < 0) { |
| 3510 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3510 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3511 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3511 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3512 | // } | 3512 | // } |
| 3513 | // | 3513 | // |
| 3514 | // } else { | 3514 | // } else { |
| 3515 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3515 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3516 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3516 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3517 | // } | 3517 | // } |
| 3518 | //// System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); | 3518 | //// System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); |
| 3519 | //// dtb.close(); | 3519 | //// dtb.close(); |
| 3520 | //// return; | 3520 | //// return; |
| 3521 | // } | 3521 | // } |
| 3522 | // | 3522 | // |
| 3523 | // dtb.close(); | 3523 | // dtb.close(); |
| 3524 | // return; | 3524 | // return; |
| 3525 | // | 3525 | // |
| 3526 | // | 3526 | // |
| 3527 | // } | 3527 | // } |
| 3528 | // | 3528 | // |
| 3529 | // | 3529 | // |
| 3530 | // | 3530 | // |
| 3531 | // | 3531 | // |
| 3532 | // | 3532 | // |
| 3533 | // } | 3533 | // } |
| 3534 | // | 3534 | // |
| 3535 | // | 3535 | // |
| 3536 | //// if (ParametrosInventario.InventariosVentas == true) { | 3536 | //// if (ParametrosInventario.InventariosVentas == true) { |
| 3537 | //// | 3537 | //// |
| 3538 | //// int valorDepo = articulo.getDepsn(); | 3538 | //// int valorDepo = articulo.getDepsn(); |
| 3539 | //// System.out.println("::::: BD 2186 en ventas valor depsn " + valorDepo); | 3539 | //// System.out.println("::::: BD 2186 en ventas valor depsn " + valorDepo); |
| 3540 | //// | 3540 | //// |
| 3541 | //// System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); | 3541 | //// System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); |
| 3542 | //// // 2 Sino, abrimos la base de datos en modo escritura | 3542 | //// // 2 Sino, abrimos la base de datos en modo escritura |
| 3543 | ////// SQLiteDatabase dtb = this.getWritableDatabase(); | 3543 | ////// SQLiteDatabase dtb = this.getWritableDatabase(); |
| 3544 | //// | 3544 | //// |
| 3545 | //// // Si hemos abierto correctamente la base de datos | 3545 | //// // Si hemos abierto correctamente la base de datos |
| 3546 | //// if (dtb != null) { | 3546 | //// if (dtb != null) { |
| 3547 | //// System.out.println("::: BD 2139 ACA ENTRA SI ABRIO BIEN LA DB"); | 3547 | //// System.out.println("::: BD 2139 ACA ENTRA SI ABRIO BIEN LA DB"); |
| 3548 | //// // 3 Creamos el registro a insertar como objeto ContentValues | 3548 | //// // 3 Creamos el registro a insertar como objeto ContentValues |
| 3549 | //// ContentValues nuevoRegistro = new ContentValues(); | 3549 | //// ContentValues nuevoRegistro = new ContentValues(); |
| 3550 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 3550 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 3551 | //// articulo.getSector()); | 3551 | //// articulo.getSector()); |
| 3552 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3552 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3553 | //// articulo.getCodigo()); | 3553 | //// articulo.getCodigo()); |
| 3554 | //// nuevoRegistro.put( | 3554 | //// nuevoRegistro.put( |
| 3555 | //// ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3555 | //// ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3556 | //// articulo.getCodigos_barras_string()); | 3556 | //// articulo.getCodigos_barras_string()); |
| 3557 | //// nuevoRegistro.put( | 3557 | //// nuevoRegistro.put( |
| 3558 | //// ParametrosInventario.bal_bdd_articulo_inventario, | 3558 | //// ParametrosInventario.bal_bdd_articulo_inventario, |
| 3559 | //// articulo.getInventario()); | 3559 | //// articulo.getInventario()); |
| 3560 | //// nuevoRegistro.put( | 3560 | //// nuevoRegistro.put( |
| 3561 | //// ParametrosInventario.bal_bdd_articulo_descripcion, | 3561 | //// ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3562 | //// articulo.getDescripcion()); | 3562 | //// articulo.getDescripcion()); |
| 3563 | //// nuevoRegistro.put( | 3563 | //// nuevoRegistro.put( |
| 3564 | //// ParametrosInventario.bal_bdd_articulo_precio_venta, | 3564 | //// ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3565 | //// articulo.getPrecio_venta()); | 3565 | //// articulo.getPrecio_venta()); |
| 3566 | //// nuevoRegistro.put( | 3566 | //// nuevoRegistro.put( |
| 3567 | //// ParametrosInventario.bal_bdd_articulo_precio_costo, | 3567 | //// ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3568 | //// articulo.getPrecio_costo()); | 3568 | //// articulo.getPrecio_costo()); |
| 3569 | //// /*Damian*/ | 3569 | //// /*Damian*/ |
| 3570 | //// nuevoRegistro.put( | 3570 | //// nuevoRegistro.put( |
| 3571 | //// ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3571 | //// ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3572 | //// articulo.getExis_venta()); | 3572 | //// articulo.getExis_venta()); |
| 3573 | //// nuevoRegistro.put( | 3573 | //// nuevoRegistro.put( |
| 3574 | //// ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3574 | //// ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3575 | //// articulo.getExis_deposito()); | 3575 | //// articulo.getExis_deposito()); |
| 3576 | //// | 3576 | //// |
| 3577 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3577 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3578 | //// articulo.getFoto()); | 3578 | //// articulo.getFoto()); |
| 3579 | //// nuevoRegistro.put( | 3579 | //// nuevoRegistro.put( |
| 3580 | //// ParametrosInventario.bal_bdd_articulo_cantidad, | 3580 | //// ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3581 | //// articulo.getCantidad()); | 3581 | //// articulo.getCantidad()); |
| 3582 | //// | 3582 | //// |
| 3583 | //// | 3583 | //// |
| 3584 | //// nuevoRegistro.put( | 3584 | //// nuevoRegistro.put( |
| 3585 | //// ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3585 | //// ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3586 | //// articulo.getFechaInicio()); | 3586 | //// articulo.getFechaInicio()); |
| 3587 | //// | 3587 | //// |
| 3588 | //// // 4 Insertamos el registro en la base de datos | 3588 | //// // 4 Insertamos el registro en la base de datos |
| 3589 | //// long resultado = dtb.insert(tabla_articulos_nombre, null, | 3589 | //// long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3590 | //// nuevoRegistro); | 3590 | //// nuevoRegistro); |
| 3591 | //// | 3591 | //// |
| 3592 | //// // Test resultado INSERT: | 3592 | //// // Test resultado INSERT: |
| 3593 | //// if (resultado < 0) { | 3593 | //// if (resultado < 0) { |
| 3594 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3594 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3595 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); | 3595 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3596 | //// } | 3596 | //// } |
| 3597 | //// | 3597 | //// |
| 3598 | //// } else { | 3598 | //// } else { |
| 3599 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3599 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3600 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); | 3600 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3601 | //// } | 3601 | //// } |
| 3602 | //// | 3602 | //// |
| 3603 | //// | 3603 | //// |
| 3604 | //// | 3604 | //// |
| 3605 | //// | 3605 | //// |
| 3606 | //// }else{ | 3606 | //// }else{ |
| 3607 | //// | 3607 | //// |
| 3608 | //// // 2 Sino, abrimos la base de datos en modo escritura | 3608 | //// // 2 Sino, abrimos la base de datos en modo escritura |
| 3609 | ////// SQLiteDatabase dtb = this.getWritableDatabase(); | 3609 | ////// SQLiteDatabase dtb = this.getWritableDatabase(); |
| 3610 | //// | 3610 | //// |
| 3611 | //// int valorDepo = articulo.getDepsn(); | 3611 | //// int valorDepo = articulo.getDepsn(); |
| 3612 | //// System.out.println("::::: BD 2209 valor depsn " + valorDepo); | 3612 | //// System.out.println("::::: BD 2209 valor depsn " + valorDepo); |
| 3613 | //// | 3613 | //// |
| 3614 | //// | 3614 | //// |
| 3615 | //// | 3615 | //// |
| 3616 | //// if(valorDepo == 1){ | 3616 | //// if(valorDepo == 1){ |
| 3617 | //// System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION"); | 3617 | //// System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION"); |
| 3618 | //// // Si hemos abierto correctamente la base de datos | 3618 | //// // Si hemos abierto correctamente la base de datos |
| 3619 | //// if (dtb != null) { | 3619 | //// if (dtb != null) { |
| 3620 | //// System.out.println("::: BD 2271 NO "); | 3620 | //// System.out.println("::: BD 2271 NO "); |
| 3621 | //// // 3 Creamos el registro a insertar como objeto ContentValues | 3621 | //// // 3 Creamos el registro a insertar como objeto ContentValues |
| 3622 | //// ContentValues nuevoRegistro = new ContentValues(); | 3622 | //// ContentValues nuevoRegistro = new ContentValues(); |
| 3623 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 3623 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 3624 | //// articulo.getSector()); | 3624 | //// articulo.getSector()); |
| 3625 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3625 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3626 | //// articulo.getCodigo()); | 3626 | //// articulo.getCodigo()); |
| 3627 | //// nuevoRegistro.put( | 3627 | //// nuevoRegistro.put( |
| 3628 | //// ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3628 | //// ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3629 | //// articulo.getCodigos_barras_string()); | 3629 | //// articulo.getCodigos_barras_string()); |
| 3630 | //// nuevoRegistro.put( | 3630 | //// nuevoRegistro.put( |
| 3631 | //// ParametrosInventario.bal_bdd_articulo_inventario, | 3631 | //// ParametrosInventario.bal_bdd_articulo_inventario, |
| 3632 | //// articulo.getInventario()); | 3632 | //// articulo.getInventario()); |
| 3633 | //// nuevoRegistro.put( | 3633 | //// nuevoRegistro.put( |
| 3634 | //// ParametrosInventario.bal_bdd_articulo_descripcion, | 3634 | //// ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3635 | //// articulo.getDescripcion()); | 3635 | //// articulo.getDescripcion()); |
| 3636 | //// nuevoRegistro.put( | 3636 | //// nuevoRegistro.put( |
| 3637 | //// ParametrosInventario.bal_bdd_articulo_precio_venta, | 3637 | //// ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3638 | //// articulo.getPrecio_venta()); | 3638 | //// articulo.getPrecio_venta()); |
| 3639 | //// nuevoRegistro.put( | 3639 | //// nuevoRegistro.put( |
| 3640 | //// ParametrosInventario.bal_bdd_articulo_precio_costo, | 3640 | //// ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3641 | //// articulo.getPrecio_costo()); | 3641 | //// articulo.getPrecio_costo()); |
| 3642 | //// /*Damian*/ | 3642 | //// /*Damian*/ |
| 3643 | //// nuevoRegistro.put( | 3643 | //// nuevoRegistro.put( |
| 3644 | //// ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3644 | //// ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3645 | //// articulo.getExis_venta()); | 3645 | //// articulo.getExis_venta()); |
| 3646 | //// nuevoRegistro.put( | 3646 | //// nuevoRegistro.put( |
| 3647 | //// ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3647 | //// ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3648 | //// articulo.getExis_deposito()); | 3648 | //// articulo.getExis_deposito()); |
| 3649 | //// nuevoRegistro.put( | 3649 | //// nuevoRegistro.put( |
| 3650 | //// ParametrosInventario.bal_bdd_articulo_depsn, | 3650 | //// ParametrosInventario.bal_bdd_articulo_depsn, |
| 3651 | //// articulo.getDepsn()); | 3651 | //// articulo.getDepsn()); |
| 3652 | //// | 3652 | //// |
| 3653 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3653 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3654 | //// articulo.getFoto()); | 3654 | //// articulo.getFoto()); |
| 3655 | //// nuevoRegistro.put( | 3655 | //// nuevoRegistro.put( |
| 3656 | //// ParametrosInventario.bal_bdd_articulo_cantidad, | 3656 | //// ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3657 | //// articulo.getCantidad()); | 3657 | //// articulo.getCantidad()); |
| 3658 | //// | 3658 | //// |
| 3659 | //// | 3659 | //// |
| 3660 | //// nuevoRegistro.put( | 3660 | //// nuevoRegistro.put( |
| 3661 | //// ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3661 | //// ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3662 | //// articulo.getFechaInicio()); | 3662 | //// articulo.getFechaInicio()); |
| 3663 | //// | 3663 | //// |
| 3664 | //// // 4 Insertamos el registro en la base de datos | 3664 | //// // 4 Insertamos el registro en la base de datos |
| 3665 | //// long resultado = dtb.insert(tabla_articulos_nombre, null, | 3665 | //// long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3666 | //// nuevoRegistro); | 3666 | //// nuevoRegistro); |
| 3667 | //// | 3667 | //// |
| 3668 | //// // Test resultado INSERT: | 3668 | //// // Test resultado INSERT: |
| 3669 | //// if (resultado < 0) { | 3669 | //// if (resultado < 0) { |
| 3670 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3670 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3671 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); | 3671 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3672 | //// } | 3672 | //// } |
| 3673 | //// | 3673 | //// |
| 3674 | //// } else { | 3674 | //// } else { |
| 3675 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3675 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3676 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); | 3676 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3677 | //// } | 3677 | //// } |
| 3678 | //// }else{ | 3678 | //// }else{ |
| 3679 | //// | 3679 | //// |
| 3680 | //// System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); | 3680 | //// System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); |
| 3681 | //// // Si hemos abierto correctamente la base de datos | 3681 | //// // Si hemos abierto correctamente la base de datos |
| 3682 | //// if (dtb != null) { | 3682 | //// if (dtb != null) { |
| 3683 | //// System.out.println("::: BD 2271 NO "); | 3683 | //// System.out.println("::: BD 2271 NO "); |
| 3684 | //// // 3 Creamos el registro a insertar como objeto ContentValues | 3684 | //// // 3 Creamos el registro a insertar como objeto ContentValues |
| 3685 | //// ContentValues nuevoRegistro = new ContentValues(); | 3685 | //// ContentValues nuevoRegistro = new ContentValues(); |
| 3686 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 3686 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 3687 | //// articulo.getSector()); | 3687 | //// articulo.getSector()); |
| 3688 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3688 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3689 | //// articulo.getCodigo()); | 3689 | //// articulo.getCodigo()); |
| 3690 | //// nuevoRegistro.put( | 3690 | //// nuevoRegistro.put( |
| 3691 | //// ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3691 | //// ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3692 | //// articulo.getCodigos_barras_string()); | 3692 | //// articulo.getCodigos_barras_string()); |
| 3693 | //// nuevoRegistro.put( | 3693 | //// nuevoRegistro.put( |
| 3694 | //// ParametrosInventario.bal_bdd_articulo_inventario, | 3694 | //// ParametrosInventario.bal_bdd_articulo_inventario, |
| 3695 | //// articulo.getInventario()); | 3695 | //// articulo.getInventario()); |
| 3696 | //// nuevoRegistro.put( | 3696 | //// nuevoRegistro.put( |
| 3697 | //// ParametrosInventario.bal_bdd_articulo_descripcion, | 3697 | //// ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3698 | //// articulo.getDescripcion()); | 3698 | //// articulo.getDescripcion()); |
| 3699 | //// nuevoRegistro.put( | 3699 | //// nuevoRegistro.put( |
| 3700 | //// ParametrosInventario.bal_bdd_articulo_precio_venta, | 3700 | //// ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3701 | //// articulo.getPrecio_venta()); | 3701 | //// articulo.getPrecio_venta()); |
| 3702 | //// nuevoRegistro.put( | 3702 | //// nuevoRegistro.put( |
| 3703 | //// ParametrosInventario.bal_bdd_articulo_precio_costo, | 3703 | //// ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3704 | //// articulo.getPrecio_costo()); | 3704 | //// articulo.getPrecio_costo()); |
| 3705 | //// /*Damian*/ | 3705 | //// /*Damian*/ |
| 3706 | //// nuevoRegistro.put( | 3706 | //// nuevoRegistro.put( |
| 3707 | //// ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3707 | //// ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3708 | //// articulo.getExis_venta()); | 3708 | //// articulo.getExis_venta()); |
| 3709 | //// nuevoRegistro.put( | 3709 | //// nuevoRegistro.put( |
| 3710 | //// ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3710 | //// ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3711 | //// articulo.getExis_deposito()); | 3711 | //// articulo.getExis_deposito()); |
| 3712 | //// nuevoRegistro.put( | 3712 | //// nuevoRegistro.put( |
| 3713 | //// ParametrosInventario.bal_bdd_articulo_depsn, | 3713 | //// ParametrosInventario.bal_bdd_articulo_depsn, |
| 3714 | //// articulo.getDepsn()); | 3714 | //// articulo.getDepsn()); |
| 3715 | //// | 3715 | //// |
| 3716 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3716 | //// nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3717 | //// articulo.getFoto()); | 3717 | //// articulo.getFoto()); |
| 3718 | //// nuevoRegistro.put( | 3718 | //// nuevoRegistro.put( |
| 3719 | //// ParametrosInventario.bal_bdd_articulo_cantidad, | 3719 | //// ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3720 | //// articulo.getCantidad()); | 3720 | //// articulo.getCantidad()); |
| 3721 | //// | 3721 | //// |
| 3722 | //// | 3722 | //// |
| 3723 | //// nuevoRegistro.put( | 3723 | //// nuevoRegistro.put( |
| 3724 | //// ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3724 | //// ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3725 | //// articulo.getFechaInicio()); | 3725 | //// articulo.getFechaInicio()); |
| 3726 | //// | 3726 | //// |
| 3727 | //// // 4 Insertamos el registro en la base de datos | 3727 | //// // 4 Insertamos el registro en la base de datos |
| 3728 | //// long resultado = dtb.insert(tabla_articulos_nombre, null, | 3728 | //// long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3729 | //// nuevoRegistro); | 3729 | //// nuevoRegistro); |
| 3730 | //// | 3730 | //// |
| 3731 | //// // Test resultado INSERT: | 3731 | //// // Test resultado INSERT: |
| 3732 | //// if (resultado < 0) { | 3732 | //// if (resultado < 0) { |
| 3733 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3733 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3734 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); | 3734 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3735 | //// } | 3735 | //// } |
| 3736 | //// | 3736 | //// |
| 3737 | //// } else { | 3737 | //// } else { |
| 3738 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3738 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3739 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); | 3739 | //// "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3740 | //// } | 3740 | //// } |
| 3741 | ////// System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); | 3741 | ////// System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); |
| 3742 | ////// dtb.close(); | 3742 | ////// dtb.close(); |
| 3743 | ////// return; | 3743 | ////// return; |
| 3744 | //// } | 3744 | //// } |
| 3745 | //// | 3745 | //// |
| 3746 | //// dtb.close(); | 3746 | //// dtb.close(); |
| 3747 | //// return; | 3747 | //// return; |
| 3748 | //// | 3748 | //// |
| 3749 | //// //////////////////////////////////////// | 3749 | //// //////////////////////////////////////// |
| 3750 | //// } | 3750 | //// } |
| 3751 | // | 3751 | // |
| 3752 | // // 5 Cierre: | 3752 | // // 5 Cierre: |
| 3753 | // dtb.close(); | 3753 | // dtb.close(); |
| 3754 | // | 3754 | // |
| 3755 | // return; | 3755 | // return; |
| 3756 | // } catch (Exception e) { | 3756 | // } catch (Exception e) { |
| 3757 | // | 3757 | // |
| 3758 | // GestorLogEventos log = new GestorLogEventos(); | 3758 | // GestorLogEventos log = new GestorLogEventos(); |
| 3759 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 3759 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 3760 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 3760 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 3761 | // log.log("[-- 1688 --]" + e.toString(), 4); | 3761 | // log.log("[-- 1688 --]" + e.toString(), 4); |
| 3762 | // | 3762 | // |
| 3763 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3763 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3764 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3764 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3765 | // } | 3765 | // } |
| 3766 | // | 3766 | // |
| 3767 | // } | 3767 | // } |
| 3768 | // | 3768 | // |
| 3769 | // public void insertProveedorEnBdd(Proveedor proveedor) throws ExceptionBDD { | 3769 | // public void insertProveedorEnBdd(Proveedor proveedor) throws ExceptionBDD { |
| 3770 | // try { | 3770 | // try { |
| 3771 | // System.out.println("::: BD 2119 Insert proveedor con cb"); | 3771 | // System.out.println("::: BD 2119 Insert proveedor con cb"); |
| 3772 | // if (selectProveedorConCodigos(proveedor.getCodigo()) != null) // Si | 3772 | // if (selectProveedorConCodigos(proveedor.getCodigo()) != null) // Si |
| 3773 | // // existe... | 3773 | // // existe... |
| 3774 | // { | 3774 | // { |
| 3775 | // // 1.1 Si la entrada ya existe, actualizamos los datos: | 3775 | // // 1.1 Si la entrada ya existe, actualizamos los datos: |
| 3776 | // updateProveedor(proveedor); | 3776 | // updateProveedor(proveedor); |
| 3777 | // return; | 3777 | // return; |
| 3778 | // } | 3778 | // } |
| 3779 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 3779 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 3780 | // | 3780 | // |
| 3781 | // System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); | 3781 | // System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); |
| 3782 | // if (dtb != null) { | 3782 | // if (dtb != null) { |
| 3783 | // // 3 Creamos el registro a insertar como objeto ContentValues | 3783 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 3784 | // ContentValues nuevoRegistro = new ContentValues(); | 3784 | // ContentValues nuevoRegistro = new ContentValues(); |
| 3785 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_proveedores_codigo, | 3785 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_proveedores_codigo, |
| 3786 | // proveedor.getCodigo()); | 3786 | // proveedor.getCodigo()); |
| 3787 | // //nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3787 | // //nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3788 | // // articulo.getCodigo()); | 3788 | // // articulo.getCodigo()); |
| 3789 | // //String codigo_a_modificar = ""; | 3789 | // //String codigo_a_modificar = ""; |
| 3790 | // //String cod1; | 3790 | // //String cod1; |
| 3791 | // String codigo; | 3791 | // String codigo; |
| 3792 | // | 3792 | // |
| 3793 | // nuevoRegistro.put( | 3793 | // nuevoRegistro.put( |
| 3794 | // ParametrosInventario.bal_bdd_proveedores_codigo, | 3794 | // ParametrosInventario.bal_bdd_proveedores_codigo, |
| 3795 | // proveedor.getCodigo()); | 3795 | // proveedor.getCodigo()); |
| 3796 | //// nuevoRegistro.put( | 3796 | //// nuevoRegistro.put( |
| 3797 | //// ParametrosInventario.bal_bdd_articulo_descripcion, | 3797 | //// ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3798 | //// articulo.getDescripcion()); | 3798 | //// articulo.getDescripcion()); |
| 3799 | // | 3799 | // |
| 3800 | // // 4 Insertamos el registro en la base de datos | 3800 | // // 4 Insertamos el registro en la base de datos |
| 3801 | // long resultado = dtb.insert(tabla_proveedores_nombre, null, | 3801 | // long resultado = dtb.insert(tabla_proveedores_nombre, null, |
| 3802 | // nuevoRegistro); | 3802 | // nuevoRegistro); |
| 3803 | // | 3803 | // |
| 3804 | // // Test resultado INSERT: | 3804 | // // Test resultado INSERT: |
| 3805 | // if (resultado < 0) { | 3805 | // if (resultado < 0) { |
| 3806 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3806 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3807 | // "Imposible agregar el proveedor nuevo a la Base De Datos"); | 3807 | // "Imposible agregar el proveedor nuevo a la Base De Datos"); |
| 3808 | // } | 3808 | // } |
| 3809 | // | 3809 | // |
| 3810 | // } else { | 3810 | // } else { |
| 3811 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3811 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3812 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3812 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3813 | // } | 3813 | // } |
| 3814 | // | 3814 | // |
| 3815 | // // 5 Cierre: | 3815 | // // 5 Cierre: |
| 3816 | // dtb.close(); | 3816 | // dtb.close(); |
| 3817 | // return; | 3817 | // return; |
| 3818 | // } catch (Exception e) { | 3818 | // } catch (Exception e) { |
| 3819 | // GestorLogEventos log = new GestorLogEventos(); | 3819 | // GestorLogEventos log = new GestorLogEventos(); |
| 3820 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 3820 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 3821 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 3821 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 3822 | // log.log("[-- 1688 --]" + e.toString(), 4); | 3822 | // log.log("[-- 1688 --]" + e.toString(), 4); |
| 3823 | // | 3823 | // |
| 3824 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3824 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3825 | // "Imposible agregar el proveedor nuevo a la Base De Datos"); | 3825 | // "Imposible agregar el proveedor nuevo a la Base De Datos"); |
| 3826 | // } | 3826 | // } |
| 3827 | // } | 3827 | // } |
| 3828 | // | 3828 | // |
| 3829 | // public void insertArticuloEnBdd_conFechaFin(Articulo articulo) throws ExceptionBDD { | 3829 | // public void insertArticuloEnBdd_conFechaFin(Articulo articulo) throws ExceptionBDD { |
| 3830 | // try { | 3830 | // try { |
| 3831 | // System.out.println("::: BaseDatos 2435 insertArticuloEnBdd_conFechaFin"); | 3831 | // System.out.println("::: BaseDatos 2435 insertArticuloEnBdd_conFechaFin"); |
| 3832 | // // 1 Test de la preexistencia de la entrada: | 3832 | // // 1 Test de la preexistencia de la entrada: |
| 3833 | // | 3833 | // |
| 3834 | // if (selectArticuloConCodigos(articulo.getSector(), | 3834 | // if (selectArticuloConCodigos(articulo.getSector(), |
| 3835 | // articulo.getCodigo(), articulo.getInventario()) != null) | 3835 | // articulo.getCodigo(), articulo.getInventario()) != null) |
| 3836 | // // Si | 3836 | // // Si |
| 3837 | // // existe... | 3837 | // // existe... |
| 3838 | // { | 3838 | // { |
| 3839 | // // 1.1 Si la entrada ya existe, actualizamos los datos: | 3839 | // // 1.1 Si la entrada ya existe, actualizamos los datos: |
| 3840 | // System.out.println("::: BaseDatos 2435 insertArticuloEnBdd existe"); | 3840 | // System.out.println("::: BaseDatos 2435 insertArticuloEnBdd existe"); |
| 3841 | // | 3841 | // |
| 3842 | // updateArticulo(articulo); | 3842 | // updateArticulo(articulo); |
| 3843 | // return; | 3843 | // return; |
| 3844 | // } | 3844 | // } |
| 3845 | // System.out.println("::: BaseDatos 2435 insertArticuloEnBdd NO EXISTE"); | 3845 | // System.out.println("::: BaseDatos 2435 insertArticuloEnBdd NO EXISTE"); |
| 3846 | // | 3846 | // |
| 3847 | // // 2 Sino, abrimos la base de datos en modo escritura | 3847 | // // 2 Sino, abrimos la base de datos en modo escritura |
| 3848 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 3848 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 3849 | // | 3849 | // |
| 3850 | // // Si hemos abierto correctamente la base de datos | 3850 | // // Si hemos abierto correctamente la base de datos |
| 3851 | // if (dtb != null) { | 3851 | // if (dtb != null) { |
| 3852 | // // 3 Creamos el registro a insertar como objeto ContentValues | 3852 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 3853 | // ContentValues nuevoRegistro = new ContentValues(); | 3853 | // ContentValues nuevoRegistro = new ContentValues(); |
| 3854 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 3854 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 3855 | // articulo.getSector()); | 3855 | // articulo.getSector()); |
| 3856 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 3856 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 3857 | // articulo.getCodigo()); | 3857 | // articulo.getCodigo()); |
| 3858 | // nuevoRegistro.put( | 3858 | // nuevoRegistro.put( |
| 3859 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 3859 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 3860 | // articulo.getCodigos_barras_string()); | 3860 | // articulo.getCodigos_barras_string()); |
| 3861 | // nuevoRegistro.put( | 3861 | // nuevoRegistro.put( |
| 3862 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 3862 | // ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 3863 | // articulo.getCodigos_barras_completo_string()); | 3863 | // articulo.getCodigos_barras_completo_string()); |
| 3864 | // nuevoRegistro.put( | 3864 | // nuevoRegistro.put( |
| 3865 | // ParametrosInventario.bal_bdd_articulo_inventario, | 3865 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 3866 | // articulo.getInventario()); | 3866 | // articulo.getInventario()); |
| 3867 | // nuevoRegistro.put( | 3867 | // nuevoRegistro.put( |
| 3868 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 3868 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 3869 | // articulo.getDescripcion()); | 3869 | // articulo.getDescripcion()); |
| 3870 | // nuevoRegistro.put( | 3870 | // nuevoRegistro.put( |
| 3871 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 3871 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 3872 | // articulo.getPrecio_venta()); | 3872 | // articulo.getPrecio_venta()); |
| 3873 | // nuevoRegistro.put( | 3873 | // nuevoRegistro.put( |
| 3874 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 3874 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 3875 | // articulo.getPrecio_costo()); | 3875 | // articulo.getPrecio_costo()); |
| 3876 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 3876 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 3877 | // articulo.getFoto()); | 3877 | // articulo.getFoto()); |
| 3878 | // nuevoRegistro.put( | 3878 | // nuevoRegistro.put( |
| 3879 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 3879 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 3880 | // articulo.getCantidad()); | 3880 | // articulo.getCantidad()); |
| 3881 | // /*Damian*/ | 3881 | // /*Damian*/ |
| 3882 | // nuevoRegistro.put( | 3882 | // nuevoRegistro.put( |
| 3883 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 3883 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 3884 | // articulo.getExis_venta()); | 3884 | // articulo.getExis_venta()); |
| 3885 | // nuevoRegistro.put( | 3885 | // nuevoRegistro.put( |
| 3886 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 3886 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 3887 | // articulo.getExis_deposito()); | 3887 | // articulo.getExis_deposito()); |
| 3888 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, | 3888 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, |
| 3889 | // articulo.getBalanza()); | 3889 | // articulo.getBalanza()); |
| 3890 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, | 3890 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, |
| 3891 | // articulo.getDecimales()); | 3891 | // articulo.getDecimales()); |
| 3892 | // nuevoRegistro.put( | 3892 | // nuevoRegistro.put( |
| 3893 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 3893 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 3894 | // articulo.getFechaInicio()); | 3894 | // articulo.getFechaInicio()); |
| 3895 | // nuevoRegistro.put( | 3895 | // nuevoRegistro.put( |
| 3896 | // ParametrosInventario.bal_bdd_articulo_fechaFin, | 3896 | // ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 3897 | // articulo.getFechaFin()); | 3897 | // articulo.getFechaFin()); |
| 3898 | // System.out.println("::: BaseDatos articulo.getCodigo() " + articulo.getCodigo()); | 3898 | // System.out.println("::: BaseDatos articulo.getCodigo() " + articulo.getCodigo()); |
| 3899 | // // 4 Insertamos el registro en la base de datos | 3899 | // // 4 Insertamos el registro en la base de datos |
| 3900 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 3900 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 3901 | // nuevoRegistro); | 3901 | // nuevoRegistro); |
| 3902 | // | 3902 | // |
| 3903 | // // Test resultado INSERT: | 3903 | // // Test resultado INSERT: |
| 3904 | // if (resultado < 0) { | 3904 | // if (resultado < 0) { |
| 3905 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3905 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3906 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3906 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3907 | // } | 3907 | // } |
| 3908 | // | 3908 | // |
| 3909 | // } else { | 3909 | // } else { |
| 3910 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3910 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3911 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3911 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3912 | // } | 3912 | // } |
| 3913 | // | 3913 | // |
| 3914 | // // 5 Cierre: | 3914 | // // 5 Cierre: |
| 3915 | // dtb.close(); | 3915 | // dtb.close(); |
| 3916 | // | 3916 | // |
| 3917 | // return; | 3917 | // return; |
| 3918 | // } catch (Exception e) { | 3918 | // } catch (Exception e) { |
| 3919 | // | 3919 | // |
| 3920 | // GestorLogEventos log = new GestorLogEventos(); | 3920 | // GestorLogEventos log = new GestorLogEventos(); |
| 3921 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 3921 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 3922 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 3922 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 3923 | // log.log("[-- 1688 --]" + e.toString(), 4); | 3923 | // log.log("[-- 1688 --]" + e.toString(), 4); |
| 3924 | // | 3924 | // |
| 3925 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 3925 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 3926 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 3926 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 3927 | // } | 3927 | // } |
| 3928 | // | 3928 | // |
| 3929 | // } | 3929 | // } |
| 3930 | // | 3930 | // |
| 3931 | // /** | 3931 | // /** |
| 3932 | // * Agrega un articulo a las referencias | 3932 | // * Agrega un articulo a las referencias |
| 3933 | // * <p> | 3933 | // * <p> |
| 3934 | // * 1 Abrimos la base de datos en modo escritura | 3934 | // * 1 Abrimos la base de datos en modo escritura |
| 3935 | // * <p> | 3935 | // * <p> |
| 3936 | // * 2 Creamos el registro a insertar como objeto ContentValues | 3936 | // * 2 Creamos el registro a insertar como objeto ContentValues |
| 3937 | // * <p> | 3937 | // * <p> |
| 3938 | // * 3 Insertamos el registro en la base de datos | 3938 | // * 3 Insertamos el registro en la base de datos |
| 3939 | // * <p> | 3939 | // * <p> |
| 3940 | // * 4 Cierre | 3940 | // * 4 Cierre |
| 3941 | // * | 3941 | // * |
| 3942 | // * @param referencia | 3942 | // * @param referencia |
| 3943 | // * @throws ExceptionBDD | 3943 | // * @throws ExceptionBDD |
| 3944 | // */ | 3944 | // */ |
| 3945 | // public void insertReferenciaEnBdd(Articulo referencia) throws ExceptionBDD { | 3945 | // public void insertReferenciaEnBdd(Articulo referencia) throws ExceptionBDD { |
| 3946 | // try { | 3946 | // try { |
| 3947 | // System.out.println("::: BaseDatos 2541 insertReferenciaEnBdd"); | 3947 | // System.out.println("::: BaseDatos 2541 insertReferenciaEnBdd"); |
| 3948 | // // Test de la preexistencia de la entrada: | 3948 | // // Test de la preexistencia de la entrada: |
| 3949 | // // Si la entrada ya existe, actualizamos los datos: | 3949 | // // Si la entrada ya existe, actualizamos los datos: |
| 3950 | // // No deberia ser necesario por que se supone que es un articulo | 3950 | // // No deberia ser necesario por que se supone que es un articulo |
| 3951 | // // nuevo | 3951 | // // nuevo |
| 3952 | // // if (selectArticuloConCodigos(referencia.getSector(), | 3952 | // // if (selectArticuloConCodigos(referencia.getSector(), |
| 3953 | // // referencia.getCodigo(), referencia.getInventario()) != null) // | 3953 | // // referencia.getCodigo(), referencia.getInventario()) != null) // |
| 3954 | // // Si existe... | 3954 | // // Si existe... |
| 3955 | // // { | 3955 | // // { |
| 3956 | // // updateArticulo(referencia); | 3956 | // // updateArticulo(referencia); |
| 3957 | // // return; | 3957 | // // return; |
| 3958 | // // } | 3958 | // // } |
| 3959 | // | 3959 | // |
| 3960 | // // 1 Abrimos la base de datos en modo escritura | 3960 | // // 1 Abrimos la base de datos en modo escritura |
| 3961 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 3961 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 3962 | // | 3962 | // |
| 3963 | // // Si hemos abierto correctamente la base de datos | 3963 | // // Si hemos abierto correctamente la base de datos |
| 3964 | // if (dtb != null) { | 3964 | // if (dtb != null) { |
| 3965 | // // 2 Creamos el registro a insertar como objeto ContentValues | 3965 | // // 2 Creamos el registro a insertar como objeto ContentValues |
| 3966 | // ContentValues nuevoRegistro = new ContentValues(); | 3966 | // ContentValues nuevoRegistro = new ContentValues(); |
| 3967 | // nuevoRegistro.put( | 3967 | // nuevoRegistro.put( |
| 3968 | // ParametrosInventario.bal_bdd_referencia_sector, | 3968 | // ParametrosInventario.bal_bdd_referencia_sector, |
| 3969 | // referencia.getSector()); | 3969 | // referencia.getSector()); |
| 3970 | // nuevoRegistro.put( | 3970 | // nuevoRegistro.put( |
| 3971 | // ParametrosInventario.bal_bdd_referencia_codigo, | 3971 | // ParametrosInventario.bal_bdd_referencia_codigo, |
| 3972 | // referencia.getCodigo()); | 3972 | // referencia.getCodigo()); |
| 3973 | // nuevoRegistro.put( | 3973 | // nuevoRegistro.put( |
| 3974 | // ParametrosInventario.bal_bdd_referencia_balanza, | 3974 | // ParametrosInventario.bal_bdd_referencia_balanza, |
| 3975 | // referencia.getBalanza()); | 3975 | // referencia.getBalanza()); |
| 3976 | // nuevoRegistro.put( | 3976 | // nuevoRegistro.put( |
| 3977 | // ParametrosInventario.bal_bdd_referencia_decimales, | 3977 | // ParametrosInventario.bal_bdd_referencia_decimales, |
| 3978 | // referencia.getDecimales()); | 3978 | // referencia.getDecimales()); |
| 3979 | // /*Damian*/ | 3979 | // /*Damian*/ |
| 3980 | // nuevoRegistro.put( | 3980 | // nuevoRegistro.put( |
| 3981 | // ParametrosInventario.bal_bdd_referencia_existencia_venta, | 3981 | // ParametrosInventario.bal_bdd_referencia_existencia_venta, |
| 3982 | // referencia.getExis_venta()); | 3982 | // referencia.getExis_venta()); |
| 3983 | // nuevoRegistro.put( | 3983 | // nuevoRegistro.put( |
| 3984 | // ParametrosInventario.bal_bdd_referencia_existencia_deposito, | 3984 | // ParametrosInventario.bal_bdd_referencia_existencia_deposito, |
| 3985 | // referencia.getExis_deposito()); | 3985 | // referencia.getExis_deposito()); |
| 3986 | // | 3986 | // |
| 3987 | // /*21/11 Se agrega para que cuando se agrega un articulo que no existe en la base, le agregue al codigo de barras el mismo | 3987 | // /*21/11 Se agrega para que cuando se agrega un articulo que no existe en la base, le agregue al codigo de barras el mismo |
| 3988 | // * numero que de codigo y sector, para que al guardar un segundo articulo o mas que no esten en la base, no se produsca error o conflicto | 3988 | // * numero que de codigo y sector, para que al guardar un segundo articulo o mas que no esten en la base, no se produsca error o conflicto |
| 3989 | // * en la tabla por uno o mas codigos de barras vacios y se genere problemas de primera key.*/ | 3989 | // * en la tabla por uno o mas codigos de barras vacios y se genere problemas de primera key.*/ |
| 3990 | // if(referencia.getSector()<=-1 && referencia.getCodigo()<=-1 && referencia.getCodigos_barras_string()==""){ | 3990 | // if(referencia.getSector()<=-1 && referencia.getCodigo()<=-1 && referencia.getCodigos_barras_string()==""){ |
| 3991 | // nuevoRegistro.put( | 3991 | // nuevoRegistro.put( |
| 3992 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, | 3992 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 3993 | // referencia.getCodigo()); | 3993 | // referencia.getCodigo()); |
| 3994 | // }else{ | 3994 | // }else{ |
| 3995 | // nuevoRegistro.put( | 3995 | // nuevoRegistro.put( |
| 3996 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, | 3996 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 3997 | // referencia.getCodigos_barras_string()); | 3997 | // referencia.getCodigos_barras_string()); |
| 3998 | // } | 3998 | // } |
| 3999 | // | 3999 | // |
| 4000 | // /*nuevoRegistro.put( | 4000 | // /*nuevoRegistro.put( |
| 4001 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, | 4001 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 4002 | // referencia.getCodigos_barras_string()); | 4002 | // referencia.getCodigos_barras_string()); |
| 4003 | // */ | 4003 | // */ |
| 4004 | // | 4004 | // |
| 4005 | // nuevoRegistro.put( | 4005 | // nuevoRegistro.put( |
| 4006 | // ParametrosInventario.bal_bdd_referencia_descripcion, | 4006 | // ParametrosInventario.bal_bdd_referencia_descripcion, |
| 4007 | // referencia.getDescripcion()); | 4007 | // referencia.getDescripcion()); |
| 4008 | // nuevoRegistro.put( | 4008 | // nuevoRegistro.put( |
| 4009 | // ParametrosInventario.bal_bdd_referencia_precio_venta, | 4009 | // ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 4010 | // referencia.getPrecio_venta()); | 4010 | // referencia.getPrecio_venta()); |
| 4011 | // nuevoRegistro.put( | 4011 | // nuevoRegistro.put( |
| 4012 | // ParametrosInventario.bal_bdd_referencia_precio_costo, | 4012 | // ParametrosInventario.bal_bdd_referencia_precio_costo, |
| 4013 | // referencia.getPrecio_costo()); | 4013 | // referencia.getPrecio_costo()); |
| 4014 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_referencia_foto, | 4014 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_referencia_foto, |
| 4015 | // referencia.getFoto()); | 4015 | // referencia.getFoto()); |
| 4016 | // | 4016 | // |
| 4017 | // // 3 Insertamos el registro en la base de datos | 4017 | // // 3 Insertamos el registro en la base de datos |
| 4018 | // long resultado = dtb.insert(tabla_referencias_nombre, null, | 4018 | // long resultado = dtb.insert(tabla_referencias_nombre, null, |
| 4019 | // nuevoRegistro); | 4019 | // nuevoRegistro); |
| 4020 | // | 4020 | // |
| 4021 | // // Test resultado INSERT: | 4021 | // // Test resultado INSERT: |
| 4022 | // if (resultado < 0) { | 4022 | // if (resultado < 0) { |
| 4023 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4023 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4024 | // "Imposible agregar el referencia nuevo a la Base De Datos"); | 4024 | // "Imposible agregar el referencia nuevo a la Base De Datos"); |
| 4025 | // } | 4025 | // } |
| 4026 | // | 4026 | // |
| 4027 | // } else { | 4027 | // } else { |
| 4028 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4028 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4029 | // "Imposible agregar el referencia nuevo a la Base De Datos"); | 4029 | // "Imposible agregar el referencia nuevo a la Base De Datos"); |
| 4030 | // } | 4030 | // } |
| 4031 | // | 4031 | // |
| 4032 | // // 4 Cierre: | 4032 | // // 4 Cierre: |
| 4033 | // dtb.close(); | 4033 | // dtb.close(); |
| 4034 | // | 4034 | // |
| 4035 | // return; | 4035 | // return; |
| 4036 | // } catch (Exception e) { | 4036 | // } catch (Exception e) { |
| 4037 | // | 4037 | // |
| 4038 | // GestorLogEventos log = new GestorLogEventos(); | 4038 | // GestorLogEventos log = new GestorLogEventos(); |
| 4039 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4039 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4040 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4040 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4041 | // log.log("[-- 1775 --]" + e.toString(), 4); | 4041 | // log.log("[-- 1775 --]" + e.toString(), 4); |
| 4042 | // | 4042 | // |
| 4043 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4043 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4044 | // "Imposible agregar el referencia nuevo a la Base De Datos"); | 4044 | // "Imposible agregar el referencia nuevo a la Base De Datos"); |
| 4045 | // } | 4045 | // } |
| 4046 | // } | 4046 | // } |
| 4047 | // | 4047 | // |
| 4048 | // /** | 4048 | // /** |
| 4049 | // * Inserta un articulo nuevo en la BD (genera el sec-cod) | 4049 | // * Inserta un articulo nuevo en la BD (genera el sec-cod) |
| 4050 | // * <p> | 4050 | // * <p> |
| 4051 | // * 1 Buscamos nueva clave primaria {sector;codigo} | 4051 | // * 1 Buscamos nueva clave primaria {sector;codigo} |
| 4052 | // * <p> | 4052 | // * <p> |
| 4053 | // * 2 La seteamos al nuevo articulo | 4053 | // * 2 La seteamos al nuevo articulo |
| 4054 | // * <p> | 4054 | // * <p> |
| 4055 | // * 3 Lo insertamos en la BD | 4055 | // * 3 Lo insertamos en la BD |
| 4056 | // * | 4056 | // * |
| 4057 | // * @param articulo | 4057 | // * @param articulo |
| 4058 | // * @throws ExceptionBDD | 4058 | // * @throws ExceptionBDD |
| 4059 | // */ | 4059 | // */ |
| 4060 | // public void insertArticuloNuevoEnBdd(Articulo articulo) throws ExceptionBDD { | 4060 | // public void insertArticuloNuevoEnBdd(Articulo articulo) throws ExceptionBDD { |
| 4061 | // System.out.println("::: BaseDatos 2634 insertArticuloNuevoEnBdd"); | 4061 | // System.out.println("::: BaseDatos 2634 insertArticuloNuevoEnBdd"); |
| 4062 | // // 1 Buscamos nueva clave primaria {sector;codigo} | 4062 | // // 1 Buscamos nueva clave primaria {sector;codigo} |
| 4063 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 4063 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 4064 | // | 4064 | // |
| 4065 | // // En el caso de articulos nuevos creados por el usuario, el CODIGO ser | 4065 | // // En el caso de articulos nuevos creados por el usuario, el CODIGO ser |
| 4066 | // // negativo. | 4066 | // // negativo. |
| 4067 | // // Buscamos el ms negativo de todos: | 4067 | // // Buscamos el ms negativo de todos: |
| 4068 | // String seleccion[] = new String[] { ParametrosInventario.bal_bdd_articulo_codigo }; | 4068 | // String seleccion[] = new String[] { ParametrosInventario.bal_bdd_articulo_codigo }; |
| 4069 | // Cursor c = dtb.query(tabla_articulos_nombre, seleccion, null, null, | 4069 | // Cursor c = dtb.query(tabla_articulos_nombre, seleccion, null, null, |
| 4070 | // null, null, ParametrosInventario.bal_bdd_articulo_codigo | 4070 | // null, null, ParametrosInventario.bal_bdd_articulo_codigo |
| 4071 | // + " ASC", "1"); | 4071 | // + " ASC", "1"); |
| 4072 | // | 4072 | // |
| 4073 | // int nuevoIndice = -1; | 4073 | // int nuevoIndice = -1; |
| 4074 | // | 4074 | // |
| 4075 | // if (c.moveToFirst() == true) { | 4075 | // if (c.moveToFirst() == true) { |
| 4076 | // | 4076 | // |
| 4077 | // nuevoIndice = Math.min(-1, c.getInt(0) - 1); | 4077 | // nuevoIndice = Math.min(-1, c.getInt(0) - 1); |
| 4078 | // } | 4078 | // } |
| 4079 | // | 4079 | // |
| 4080 | // // Cierre: | 4080 | // // Cierre: |
| 4081 | // dtb.close(); | 4081 | // dtb.close(); |
| 4082 | // // 2 La seteamos al nuevo articulo | 4082 | // // 2 La seteamos al nuevo articulo |
| 4083 | // articulo.setCodigo(nuevoIndice); | 4083 | // articulo.setCodigo(nuevoIndice); |
| 4084 | // articulo.setSector(nuevoIndice); | 4084 | // articulo.setSector(nuevoIndice); |
| 4085 | // | 4085 | // |
| 4086 | // // 3 Lo insertamos en la BD | 4086 | // // 3 Lo insertamos en la BD |
| 4087 | // insertArticuloEnBdd(articulo); | 4087 | // insertArticuloEnBdd(articulo); |
| 4088 | // return; | 4088 | // return; |
| 4089 | // } | 4089 | // } |
| 4090 | // | 4090 | // |
| 4091 | // /** | 4091 | // /** |
| 4092 | // * Inserta una referencia nueva en la tabla (genera su sec-cod) | 4092 | // * Inserta una referencia nueva en la tabla (genera su sec-cod) |
| 4093 | // * <p> | 4093 | // * <p> |
| 4094 | // * 1 Buscamos nueva clave primaria {sector;codigo} | 4094 | // * 1 Buscamos nueva clave primaria {sector;codigo} |
| 4095 | // * <p> | 4095 | // * <p> |
| 4096 | // * 2 Seteamos los valores de la nueva clave | 4096 | // * 2 Seteamos los valores de la nueva clave |
| 4097 | // * <p> | 4097 | // * <p> |
| 4098 | // * 3 Insertamos en la BD | 4098 | // * 3 Insertamos en la BD |
| 4099 | // * | 4099 | // * |
| 4100 | // * @param referencia | 4100 | // * @param referencia |
| 4101 | // * @throws ExceptionBDD | 4101 | // * @throws ExceptionBDD |
| 4102 | // */ | 4102 | // */ |
| 4103 | // public void insertReferenciaNuevaEnBdd(Articulo referencia) | 4103 | // public void insertReferenciaNuevaEnBdd(Articulo referencia) |
| 4104 | // throws ExceptionBDD { | 4104 | // throws ExceptionBDD { |
| 4105 | // System.out.println("::: BD INSERT REFERENCIA"); | 4105 | // System.out.println("::: BD INSERT REFERENCIA"); |
| 4106 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 4106 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 4107 | // | 4107 | // |
| 4108 | // // 1 Buscamos nueva clave primaria {sector;codigo} | 4108 | // // 1 Buscamos nueva clave primaria {sector;codigo} |
| 4109 | // // En el caso de articulos nuevos creados por el usuario, el CODIGO ser | 4109 | // // En el caso de articulos nuevos creados por el usuario, el CODIGO ser |
| 4110 | // // negativo. | 4110 | // // negativo. |
| 4111 | // // Buscamos el ms negativo de todos: | 4111 | // // Buscamos el ms negativo de todos: |
| 4112 | // String seleccion[] = new String[] { ParametrosInventario.bal_bdd_referencia_codigo }; | 4112 | // String seleccion[] = new String[] { ParametrosInventario.bal_bdd_referencia_codigo }; |
| 4113 | // Cursor c = dtb.query(tabla_referencias_nombre, seleccion, null, null, | 4113 | // Cursor c = dtb.query(tabla_referencias_nombre, seleccion, null, null, |
| 4114 | // null, null, ParametrosInventario.bal_bdd_referencia_codigo | 4114 | // null, null, ParametrosInventario.bal_bdd_referencia_codigo |
| 4115 | // + " ASC", "1"); | 4115 | // + " ASC", "1"); |
| 4116 | // | 4116 | // |
| 4117 | // int nuevoIndice = -1; | 4117 | // int nuevoIndice = -1; |
| 4118 | // | 4118 | // |
| 4119 | // if (c.moveToFirst() == true) { | 4119 | // if (c.moveToFirst() == true) { |
| 4120 | // | 4120 | // |
| 4121 | // System.out.println("::: BaseDatos 3960 nuevoIndice " + nuevoIndice); | 4121 | // System.out.println("::: BaseDatos 3960 nuevoIndice " + nuevoIndice); |
| 4122 | // System.out.println("::: BaseDatos 3960 c.getInt(0) " + c.getInt(0)); | 4122 | // System.out.println("::: BaseDatos 3960 c.getInt(0) " + c.getInt(0)); |
| 4123 | // | 4123 | // |
| 4124 | // nuevoIndice = Math.min(-1, c.getInt(0) - 1); | 4124 | // nuevoIndice = Math.min(-1, c.getInt(0) - 1); |
| 4125 | // | 4125 | // |
| 4126 | // System.out.println("::: BaseDatos 3966 nuevoIndice despues del math " + nuevoIndice); | 4126 | // System.out.println("::: BaseDatos 3966 nuevoIndice despues del math " + nuevoIndice); |
| 4127 | // } | 4127 | // } |
| 4128 | // | 4128 | // |
| 4129 | // // Cierre: | 4129 | // // Cierre: |
| 4130 | // dtb.close(); | 4130 | // dtb.close(); |
| 4131 | // | 4131 | // |
| 4132 | // // 2 Seteamos los valores de la nueva clave | 4132 | // // 2 Seteamos los valores de la nueva clave |
| 4133 | // referencia.setCodigo(nuevoIndice); | 4133 | // referencia.setCodigo(nuevoIndice); |
| 4134 | // referencia.setSector(nuevoIndice); | 4134 | // referencia.setSector(nuevoIndice); |
| 4135 | // | 4135 | // |
| 4136 | // // 3 Insertamos en la BD | 4136 | // // 3 Insertamos en la BD |
| 4137 | // insertReferenciaEnBdd(referencia); | 4137 | // insertReferenciaEnBdd(referencia); |
| 4138 | // return; | 4138 | // return; |
| 4139 | // | 4139 | // |
| 4140 | // } | 4140 | // } |
| 4141 | // | 4141 | // |
| 4142 | // /** | 4142 | // /** |
| 4143 | // * Ejecuta las sentencias sql de la lista | 4143 | // * Ejecuta las sentencias sql de la lista |
| 4144 | // * <p> | 4144 | // * <p> |
| 4145 | // * 1 Abrimos la base de datos en modo escritura | 4145 | // * 1 Abrimos la base de datos en modo escritura |
| 4146 | // * <p> | 4146 | // * <p> |
| 4147 | // * 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" | 4147 | // * 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" |
| 4148 | // * <p> | 4148 | // * <p> |
| 4149 | // * 3 Cierre | 4149 | // * 3 Cierre |
| 4150 | // * | 4150 | // * |
| 4151 | // * @param listaSQL | 4151 | // * @param listaSQL |
| 4152 | // * @throws ExceptionBDD | 4152 | // * @throws ExceptionBDD |
| 4153 | // */ | 4153 | // */ |
| 4154 | // public void insertReferenciasConSQLEnBdd(ArrayList<String> listaSQL) | 4154 | // public void insertReferenciasConSQLEnBdd(ArrayList<String> listaSQL) |
| 4155 | // throws ExceptionBDD { | 4155 | // throws ExceptionBDD { |
| 4156 | // try { | 4156 | // try { |
| 4157 | // System.out.println("::: BaseDatos 2725 insertReferenciasConSQLEnBdd"); | 4157 | // System.out.println("::: BaseDatos 2725 insertReferenciasConSQLEnBdd"); |
| 4158 | // // 1 Abrimos la base de datos en modo escritura | 4158 | // // 1 Abrimos la base de datos en modo escritura |
| 4159 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 4159 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 4160 | // | 4160 | // |
| 4161 | // // Si hemos abierto correctamente la base de datos | 4161 | // // Si hemos abierto correctamente la base de datos |
| 4162 | // // 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" | 4162 | // // 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" |
| 4163 | // dtb.execSQL("BEGIN"); | 4163 | // dtb.execSQL("BEGIN"); |
| 4164 | // for (String requete : listaSQL) { | 4164 | // for (String requete : listaSQL) { |
| 4165 | // try { | 4165 | // try { |
| 4166 | // dtb.execSQL(requete); | 4166 | // dtb.execSQL(requete); |
| 4167 | // } catch (Exception e) { | 4167 | // } catch (Exception e) { |
| 4168 | // | 4168 | // |
| 4169 | // GestorLogEventos log = new GestorLogEventos(); | 4169 | // GestorLogEventos log = new GestorLogEventos(); |
| 4170 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4170 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4171 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4171 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4172 | // log.log("[-- 1899 --]" + e.toString(), 4); | 4172 | // log.log("[-- 1899 --]" + e.toString(), 4); |
| 4173 | // | 4173 | // |
| 4174 | // } | 4174 | // } |
| 4175 | // } | 4175 | // } |
| 4176 | // dtb.execSQL("COMMIT"); | 4176 | // dtb.execSQL("COMMIT"); |
| 4177 | // | 4177 | // |
| 4178 | // // 3 Cierre: | 4178 | // // 3 Cierre: |
| 4179 | // dtb.close(); | 4179 | // dtb.close(); |
| 4180 | // | 4180 | // |
| 4181 | // return; | 4181 | // return; |
| 4182 | // } catch (Exception e) { | 4182 | // } catch (Exception e) { |
| 4183 | // | 4183 | // |
| 4184 | // GestorLogEventos log = new GestorLogEventos(); | 4184 | // GestorLogEventos log = new GestorLogEventos(); |
| 4185 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4185 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4186 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4186 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4187 | // log.log("[-- 1913 --]" + e.toString(), 4); | 4187 | // log.log("[-- 1913 --]" + e.toString(), 4); |
| 4188 | // | 4188 | // |
| 4189 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4189 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4190 | // "Imposible agregar el articulo nuevo a la Base De Datos: " | 4190 | // "Imposible agregar el articulo nuevo a la Base De Datos: " |
| 4191 | // + e.toString()); | 4191 | // + e.toString()); |
| 4192 | // } | 4192 | // } |
| 4193 | // } | 4193 | // } |
| 4194 | // | 4194 | // |
| 4195 | // | 4195 | // |
| 4196 | // | 4196 | // |
| 4197 | // /** | 4197 | // /** |
| 4198 | // * Ejecuta las sentencias sql de la lista | 4198 | // * Ejecuta las sentencias sql de la lista |
| 4199 | // * <p> | 4199 | // * <p> |
| 4200 | // * 1 Abrimos la base de datos en modo escritura | 4200 | // * 1 Abrimos la base de datos en modo escritura |
| 4201 | // * <p> | 4201 | // * <p> |
| 4202 | // * 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" | 4202 | // * 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" |
| 4203 | // * <p> | 4203 | // * <p> |
| 4204 | // * 3 Cierre | 4204 | // * 3 Cierre |
| 4205 | // * | 4205 | // * |
| 4206 | // * @param listaSQL | 4206 | // * @param listaSQL |
| 4207 | // * @throws ExceptionBDD | 4207 | // * @throws ExceptionBDD |
| 4208 | // */ | 4208 | // */ |
| 4209 | // public void insertProveedoresConSQLEnBdd(ArrayList<String> listaSQL) | 4209 | // public void insertProveedoresConSQLEnBdd(ArrayList<String> listaSQL) |
| 4210 | // throws ExceptionBDD { | 4210 | // throws ExceptionBDD { |
| 4211 | // try { | 4211 | // try { |
| 4212 | // System.out.println("::: BaseDatos 2725 insertProveedoresConSQLEnBdd"); | 4212 | // System.out.println("::: BaseDatos 2725 insertProveedoresConSQLEnBdd"); |
| 4213 | // // 1 Abrimos la base de datos en modo escritura | 4213 | // // 1 Abrimos la base de datos en modo escritura |
| 4214 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 4214 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 4215 | // | 4215 | // |
| 4216 | // // Si hemos abierto correctamente la base de datos | 4216 | // // Si hemos abierto correctamente la base de datos |
| 4217 | // // 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" | 4217 | // // 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" |
| 4218 | // dtb.execSQL("BEGIN"); | 4218 | // dtb.execSQL("BEGIN"); |
| 4219 | // for (String requete : listaSQL) { | 4219 | // for (String requete : listaSQL) { |
| 4220 | // try { | 4220 | // try { |
| 4221 | // dtb.execSQL(requete); | 4221 | // dtb.execSQL(requete); |
| 4222 | // } catch (Exception e) { | 4222 | // } catch (Exception e) { |
| 4223 | // | 4223 | // |
| 4224 | // GestorLogEventos log = new GestorLogEventos(); | 4224 | // GestorLogEventos log = new GestorLogEventos(); |
| 4225 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4225 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4226 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4226 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4227 | // log.log("[-- 1899 --]" + e.toString(), 4); | 4227 | // log.log("[-- 1899 --]" + e.toString(), 4); |
| 4228 | // | 4228 | // |
| 4229 | // } | 4229 | // } |
| 4230 | // } | 4230 | // } |
| 4231 | // dtb.execSQL("COMMIT"); | 4231 | // dtb.execSQL("COMMIT"); |
| 4232 | // | 4232 | // |
| 4233 | // // 3 Cierre: | 4233 | // // 3 Cierre: |
| 4234 | // dtb.close(); | 4234 | // dtb.close(); |
| 4235 | // | 4235 | // |
| 4236 | // return; | 4236 | // return; |
| 4237 | // } catch (Exception e) { | 4237 | // } catch (Exception e) { |
| 4238 | // | 4238 | // |
| 4239 | // GestorLogEventos log = new GestorLogEventos(); | 4239 | // GestorLogEventos log = new GestorLogEventos(); |
| 4240 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4240 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4241 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4241 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4242 | // log.log("[-- 1913 --]" + e.toString(), 4); | 4242 | // log.log("[-- 1913 --]" + e.toString(), 4); |
| 4243 | // | 4243 | // |
| 4244 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4244 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4245 | // "Imposible agregar el articulo nuevo a la Base De Datos: " | 4245 | // "Imposible agregar el articulo nuevo a la Base De Datos: " |
| 4246 | // + e.toString()); | 4246 | // + e.toString()); |
| 4247 | // } | 4247 | // } |
| 4248 | // } | 4248 | // } |
| 4249 | // | 4249 | // |
| 4250 | // | 4250 | // |
| 4251 | // /** | 4251 | // /** |
| 4252 | // * Elimina todos los registros que se cargaron vacios | 4252 | // * Elimina todos los registros que se cargaron vacios |
| 4253 | // * <p> | 4253 | // * <p> |
| 4254 | // * 1 Abrimos la base de datos en modo escritura | 4254 | // * 1 Abrimos la base de datos en modo escritura |
| 4255 | // * <p> | 4255 | // * <p> |
| 4256 | // * 2 Cierre | 4256 | // * 2 Cierre |
| 4257 | // * | 4257 | // * |
| 4258 | // * @throws ExceptionBDD | 4258 | // * @throws ExceptionBDD |
| 4259 | // */ | 4259 | // */ |
| 4260 | // public void deleteProveedoresVacios() | 4260 | // public void deleteProveedoresVacios() |
| 4261 | // throws ExceptionBDD { | 4261 | // throws ExceptionBDD { |
| 4262 | // try { | 4262 | // try { |
| 4263 | // // 1 Abrimos la base de datos en modo escritura | 4263 | // // 1 Abrimos la base de datos en modo escritura |
| 4264 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 4264 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 4265 | // | 4265 | // |
| 4266 | // // Si hemos abierto correctamente la base de datos | 4266 | // // Si hemos abierto correctamente la base de datos |
| 4267 | // dtb.execSQL("DELETE FROM PROVEEDORES WHERE PROV_DESC IS NULL"); | 4267 | // dtb.execSQL("DELETE FROM PROVEEDORES WHERE PROV_DESC IS NULL"); |
| 4268 | // // 2 Cierre: | 4268 | // // 2 Cierre: |
| 4269 | // dtb.close(); | 4269 | // dtb.close(); |
| 4270 | // | 4270 | // |
| 4271 | // return; | 4271 | // return; |
| 4272 | // } catch (Exception e) { | 4272 | // } catch (Exception e) { |
| 4273 | // | 4273 | // |
| 4274 | // GestorLogEventos log = new GestorLogEventos(); | 4274 | // GestorLogEventos log = new GestorLogEventos(); |
| 4275 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4275 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4276 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4276 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4277 | // log.log("[-- 1913 --]" + e.toString(), 4); | 4277 | // log.log("[-- 1913 --]" + e.toString(), 4); |
| 4278 | // | 4278 | // |
| 4279 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 4279 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 4280 | // "No se pudo ejecutar el comando en la base de datos: " | 4280 | // "No se pudo ejecutar el comando en la base de datos: " |
| 4281 | // + e.toString()); | 4281 | // + e.toString()); |
| 4282 | // } | 4282 | // } |
| 4283 | // } | 4283 | // } |
| 4284 | // | 4284 | // |
| 4285 | // | 4285 | // |
| 4286 | // | 4286 | // |
| 4287 | // | 4287 | // |
| 4288 | // /** | 4288 | // /** |
| 4289 | // * Ejecuta la consulta en la BD | 4289 | // * Ejecuta la consulta en la BD |
| 4290 | // * <p> | 4290 | // * <p> |
| 4291 | // * 1 Abrimos la base de datos en modo escritura | 4291 | // * 1 Abrimos la base de datos en modo escritura |
| 4292 | // * <p> | 4292 | // * <p> |
| 4293 | // * 2 Ejecutamos la consulta | 4293 | // * 2 Ejecutamos la consulta |
| 4294 | // * <p> | 4294 | // * <p> |
| 4295 | // * 3 Cierre | 4295 | // * 3 Cierre |
| 4296 | // * | 4296 | // * |
| 4297 | // * @param consulta | 4297 | // * @param consulta |
| 4298 | // * @throws ExceptionBDD | 4298 | // * @throws ExceptionBDD |
| 4299 | // */ | 4299 | // */ |
| 4300 | // public void insertDesdeUSBEnBdd(String consulta) throws ExceptionBDD { | 4300 | // public void insertDesdeUSBEnBdd(String consulta) throws ExceptionBDD { |
| 4301 | // try { | 4301 | // try { |
| 4302 | // System.out.println("::: BD 2647 Inserta articulo desde usb"); | 4302 | // System.out.println("::: BD 2647 Inserta articulo desde usb"); |
| 4303 | // // Test de la preexistencia de la entrada: | 4303 | // // Test de la preexistencia de la entrada: |
| 4304 | // // Si la entrada ya existe, actualizamos los datos: | 4304 | // // Si la entrada ya existe, actualizamos los datos: |
| 4305 | // /* | 4305 | // /* |
| 4306 | // * if (selectArticuloConCodigos(articulo.getSector(), | 4306 | // * if (selectArticuloConCodigos(articulo.getSector(), |
| 4307 | // * articulo.getCodigo(), articulo.getInventario()) != null) // Si | 4307 | // * articulo.getCodigo(), articulo.getInventario()) != null) // Si |
| 4308 | // * existe... { updateArticulo(articulo); return; } | 4308 | // * existe... { updateArticulo(articulo); return; } |
| 4309 | // */ | 4309 | // */ |
| 4310 | // | 4310 | // |
| 4311 | // // 1 Abrimos la base de datos en modo escritura | 4311 | // // 1 Abrimos la base de datos en modo escritura |
| 4312 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 4312 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 4313 | // | 4313 | // |
| 4314 | // // Si hemos abierto correctamente la base de datos | 4314 | // // Si hemos abierto correctamente la base de datos |
| 4315 | // try { | 4315 | // try { |
| 4316 | // // 2 Ejecutamos la consulta | 4316 | // // 2 Ejecutamos la consulta |
| 4317 | // dtb.execSQL(consulta); | 4317 | // dtb.execSQL(consulta); |
| 4318 | // } catch (Exception e) { | 4318 | // } catch (Exception e) { |
| 4319 | // | 4319 | // |
| 4320 | // GestorLogEventos log = new GestorLogEventos(); | 4320 | // GestorLogEventos log = new GestorLogEventos(); |
| 4321 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4321 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4322 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4322 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4323 | // log.log("[-- 1955 --]" + e.toString(), 4); | 4323 | // log.log("[-- 1955 --]" + e.toString(), 4); |
| 4324 | // | 4324 | // |
| 4325 | // } | 4325 | // } |
| 4326 | // | 4326 | // |
| 4327 | // // 3 Cierre: | 4327 | // // 3 Cierre: |
| 4328 | // dtb.close(); | 4328 | // dtb.close(); |
| 4329 | // | 4329 | // |
| 4330 | // return; | 4330 | // return; |
| 4331 | // } catch (Exception e) { | 4331 | // } catch (Exception e) { |
| 4332 | // | 4332 | // |
| 4333 | // GestorLogEventos log = new GestorLogEventos(); | 4333 | // GestorLogEventos log = new GestorLogEventos(); |
| 4334 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4334 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4335 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4335 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4336 | // log.log("[-- 1967 --]" + e.toString(), 4); | 4336 | // log.log("[-- 1967 --]" + e.toString(), 4); |
| 4337 | // | 4337 | // |
| 4338 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4338 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4339 | // "Imposible agregar el articulo nuevo a la Base De Datos: " | 4339 | // "Imposible agregar el articulo nuevo a la Base De Datos: " |
| 4340 | // + e.toString()); | 4340 | // + e.toString()); |
| 4341 | // } | 4341 | // } |
| 4342 | // } | 4342 | // } |
| 4343 | // | 4343 | // |
| 4344 | // /** | 4344 | // /** |
| 4345 | // * Ejecuta todas las sentencias de la lista en la BD | 4345 | // * Ejecuta todas las sentencias de la lista en la BD |
| 4346 | // * <p> | 4346 | // * <p> |
| 4347 | // * 1 Abrimos la base de datos en modo escritura | 4347 | // * 1 Abrimos la base de datos en modo escritura |
| 4348 | // * <p> | 4348 | // * <p> |
| 4349 | // * 2 Ejecutamos las consultas | 4349 | // * 2 Ejecutamos las consultas |
| 4350 | // * <p> | 4350 | // * <p> |
| 4351 | // * 3 Cierre | 4351 | // * 3 Cierre |
| 4352 | // * | 4352 | // * |
| 4353 | // * @param listaSQL | 4353 | // * @param listaSQL |
| 4354 | // * @throws ExceptionBDD | 4354 | // * @throws ExceptionBDD |
| 4355 | // */ | 4355 | // */ |
| 4356 | // public void insertDesdeUSBEnBdd(ArrayList<String> listaSQL) | 4356 | // public void insertDesdeUSBEnBdd(ArrayList<String> listaSQL) |
| 4357 | // throws ExceptionBDD { | 4357 | // throws ExceptionBDD { |
| 4358 | // try { | 4358 | // try { |
| 4359 | // System.out.println("::: BaseDatos 2834 insertDesdeUSBEnBdd"); | 4359 | // System.out.println("::: BaseDatos 2834 insertDesdeUSBEnBdd"); |
| 4360 | // // Test de la preexistencia de la entrada: | 4360 | // // Test de la preexistencia de la entrada: |
| 4361 | // // Si la entrada ya existe, actualizamos los datos: | 4361 | // // Si la entrada ya existe, actualizamos los datos: |
| 4362 | // /* | 4362 | // /* |
| 4363 | // * if (selectArticuloConCodigos(articulo.getSector(), | 4363 | // * if (selectArticuloConCodigos(articulo.getSector(), |
| 4364 | // * articulo.getCodigo(), articulo.getInventario()) != null) // Si | 4364 | // * articulo.getCodigo(), articulo.getInventario()) != null) // Si |
| 4365 | // * existe... { updateArticulo(articulo); return; } | 4365 | // * existe... { updateArticulo(articulo); return; } |
| 4366 | // */ | 4366 | // */ |
| 4367 | // | 4367 | // |
| 4368 | // // 1 Abrimos la base de datos en modo escritura | 4368 | // // 1 Abrimos la base de datos en modo escritura |
| 4369 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 4369 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 4370 | // | 4370 | // |
| 4371 | // // Si hemos abierto correctamente la base de datos | 4371 | // // Si hemos abierto correctamente la base de datos |
| 4372 | // dtb.execSQL("BEGIN"); | 4372 | // dtb.execSQL("BEGIN"); |
| 4373 | // for (String requete : listaSQL) { | 4373 | // for (String requete : listaSQL) { |
| 4374 | // try { | 4374 | // try { |
| 4375 | // System.out.println("::: BD 2834 execsql"); | 4375 | // System.out.println("::: BD 2834 execsql"); |
| 4376 | // // 2 Ejecutamos las consultas | 4376 | // // 2 Ejecutamos las consultas |
| 4377 | // dtb.execSQL(requete); | 4377 | // dtb.execSQL(requete); |
| 4378 | // } catch (Exception e) { | 4378 | // } catch (Exception e) { |
| 4379 | // | 4379 | // |
| 4380 | // GestorLogEventos log = new GestorLogEventos(); | 4380 | // GestorLogEventos log = new GestorLogEventos(); |
| 4381 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4381 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4382 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4382 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4383 | // log.log("[-- 2013 --]" + e.toString(), 4); | 4383 | // log.log("[-- 2013 --]" + e.toString(), 4); |
| 4384 | // | 4384 | // |
| 4385 | // } | 4385 | // } |
| 4386 | // } | 4386 | // } |
| 4387 | // dtb.execSQL("COMMIT"); | 4387 | // dtb.execSQL("COMMIT"); |
| 4388 | // | 4388 | // |
| 4389 | // // 3 Cierre: | 4389 | // // 3 Cierre: |
| 4390 | // dtb.close(); | 4390 | // dtb.close(); |
| 4391 | // | 4391 | // |
| 4392 | // return; | 4392 | // return; |
| 4393 | // } catch (Exception e) { | 4393 | // } catch (Exception e) { |
| 4394 | // | 4394 | // |
| 4395 | // GestorLogEventos log = new GestorLogEventos(); | 4395 | // GestorLogEventos log = new GestorLogEventos(); |
| 4396 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4396 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4397 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4397 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4398 | // log.log("[-- 2058 --]" + e.toString(), 4); | 4398 | // log.log("[-- 2058 --]" + e.toString(), 4); |
| 4399 | // | 4399 | // |
| 4400 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4400 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4401 | // "Imposible agregar el articulo nuevo a la Base De Datos: " | 4401 | // "Imposible agregar el articulo nuevo a la Base De Datos: " |
| 4402 | // + e.toString()); | 4402 | // + e.toString()); |
| 4403 | // } | 4403 | // } |
| 4404 | // } | 4404 | // } |
| 4405 | // | 4405 | // |
| 4406 | // /** | 4406 | // /** |
| 4407 | // * Agregar un INVENTARIO a la base de datos (o lo actualiza si ya existe) | 4407 | // * Agregar un INVENTARIO a la base de datos (o lo actualiza si ya existe) |
| 4408 | // * <p> | 4408 | // * <p> |
| 4409 | // * 1 Si la entrada ya existe, actualizamos los datos | 4409 | // * 1 Si la entrada ya existe, actualizamos los datos |
| 4410 | // * <p> | 4410 | // * <p> |
| 4411 | // * 2 Sino, abrimos la base de datos en modo escritura | 4411 | // * 2 Sino, abrimos la base de datos en modo escritura |
| 4412 | // * <p> | 4412 | // * <p> |
| 4413 | // * 3 Insertamos el registro en la base de dato | 4413 | // * 3 Insertamos el registro en la base de dato |
| 4414 | // * <p> | 4414 | // * <p> |
| 4415 | // * 4 Cierre | 4415 | // * 4 Cierre |
| 4416 | // * | 4416 | // * |
| 4417 | // * @param inventario | 4417 | // * @param inventario |
| 4418 | // * Objeto que agregar en la base | 4418 | // * Objeto que agregar en la base |
| 4419 | // * @throws ExceptionBDD | 4419 | // * @throws ExceptionBDD |
| 4420 | // */ | 4420 | // */ |
| 4421 | // public void insertInventarioEnBdd(Inventario inventario) | 4421 | // public void insertInventarioEnBdd(Inventario inventario) |
| 4422 | // throws ExceptionBDD { | 4422 | // throws ExceptionBDD { |
| 4423 | // System.out.println("::: BD 2754 Inserta inventario "); | 4423 | // System.out.println("::: BD 2754 Inserta inventario "); |
| 4424 | // try { | 4424 | // try { |
| 4425 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; | 4425 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 4426 | // | 4426 | // |
| 4427 | // // Test de la preexistencia de la entrada: | 4427 | // // Test de la preexistencia de la entrada: |
| 4428 | // // 1 Si la entrada ya existe, actualizamos los datos: | 4428 | // // 1 Si la entrada ya existe, actualizamos los datos: |
| 4429 | // if (selectInventarioConNumero(inventario.getNumero()) != null) // Si | 4429 | // if (selectInventarioConNumero(inventario.getNumero()) != null) // Si |
| 4430 | // // existe... | 4430 | // // existe... |
| 4431 | // { | 4431 | // { |
| 4432 | // System.out.println("::: BD 2754 updateInventario"); | 4432 | // System.out.println("::: BD 2754 updateInventario"); |
| 4433 | // updateInventario(inventario); | 4433 | // updateInventario(inventario); |
| 4434 | // return; | 4434 | // return; |
| 4435 | // } | 4435 | // } |
| 4436 | // | 4436 | // |
| 4437 | // // 2 Sino, abrimos la base de datos en modo escritura | 4437 | // // 2 Sino, abrimos la base de datos en modo escritura |
| 4438 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 4438 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 4439 | // | 4439 | // |
| 4440 | // // Si hemos abierto correctamente la base de datos | 4440 | // // Si hemos abierto correctamente la base de datos |
| 4441 | // if (dtb != null) { | 4441 | // if (dtb != null) { |
| 4442 | // // Creamos el registro a insertar como objeto ContentValues | 4442 | // // Creamos el registro a insertar como objeto ContentValues |
| 4443 | // // ContentValues nuevoRegistro = new ContentValues(); | 4443 | // // ContentValues nuevoRegistro = new ContentValues(); |
| 4444 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_numero, | 4444 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_numero, |
| 4445 | // // inventario.getNumero()); | 4445 | // // inventario.getNumero()); |
| 4446 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_descripcion, | 4446 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_descripcion, |
| 4447 | // // inventario.getDescripcion()); | 4447 | // // inventario.getDescripcion()); |
| 4448 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_fecha, | 4448 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_fecha, |
| 4449 | // // inventario.getFecha()); | 4449 | // // inventario.getFecha()); |
| 4450 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_estado, | 4450 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_estado, |
| 4451 | // // inventario.getEstado()); | 4451 | // // inventario.getEstado()); |
| 4452 | // // 3 Insertamos el registro en la base de datos | 4452 | // // 3 Insertamos el registro en la base de datos |
| 4453 | // // long resultado = dtb.insert(tabla_inventarios_nombre, null, | 4453 | // // long resultado = dtb.insert(tabla_inventarios_nombre, null, |
| 4454 | // // nuevoRegistro); | 4454 | // // nuevoRegistro); |
| 4455 | // String descripcionCompleta = inventario.getDescripcion().trim(); | 4455 | // String descripcionCompleta = inventario.getDescripcion().trim(); |
| 4456 | // int n = descripcionCompleta.trim().length(); | 4456 | // int n = descripcionCompleta.trim().length(); |
| 4457 | // String obtenerDescripcion = descripcionCompleta.substring(0, (n - 3)); | 4457 | // String obtenerDescripcion = descripcionCompleta.substring(0, (n - 3)); |
| 4458 | // // char car=descripcionCompleta.charAt(n-1); | 4458 | // // char car=descripcionCompleta.charAt(n-1); |
| 4459 | // int variable_dep = 0; | 4459 | // int variable_dep = 0; |
| 4460 | //// if(car=='0'){ | 4460 | //// if(car=='0'){ |
| 4461 | //// variable_dep= -1; | 4461 | //// variable_dep= -1; |
| 4462 | //// }else if(car=='1'){ | 4462 | //// }else if(car=='1'){ |
| 4463 | //// variable_dep= -2; | 4463 | //// variable_dep= -2; |
| 4464 | //// }else{ | 4464 | //// }else{ |
| 4465 | // variable_dep =inventario.getLugar(); | 4465 | // variable_dep =inventario.getLugar(); |
| 4466 | //// } | 4466 | //// } |
| 4467 | // String str = ""; | 4467 | // String str = ""; |
| 4468 | // if(condicionRadio == true && inventario.getNumero()==-1){ | 4468 | // if(condicionRadio == true && inventario.getNumero()==-1){ |
| 4469 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 4469 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 4470 | //// condR=-1; | 4470 | //// condR=-1; |
| 4471 | // System.out.println("::: BD 2754 prepara el string para insertar inventario"); | 4471 | // System.out.println("::: BD 2754 prepara el string para insertar inventario"); |
| 4472 | // str = "INSERT INTO " + tabla_inventarios_nombre | 4472 | // str = "INSERT INTO " + tabla_inventarios_nombre |
| 4473 | // + " VALUES(" + inventario.getNumero() + "," + "'" | 4473 | // + " VALUES(" + inventario.getNumero() + "," + "'" |
| 4474 | // + obtenerDescripcion + "'," + "'" | 4474 | // + obtenerDescripcion + "'," + "'" |
| 4475 | //// + inventario.getDescripcion() + "'," + "'" | 4475 | //// + inventario.getDescripcion() + "'," + "'" |
| 4476 | // + inventario.getFechaInicio() + "'," + "'" | 4476 | // + inventario.getFechaInicio() + "'," + "'" |
| 4477 | // + inventario.getFechaFin() + "'," | 4477 | // + inventario.getFechaFin() + "'," |
| 4478 | // + inventario.getEstado() + "," + variable_dep+ "," +0 | 4478 | // + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 4479 | // + ")"; | 4479 | // + ")"; |
| 4480 | // System.out.println("::: D.V. QUIERO VER VARIABLE_DEP "+variable_dep); | 4480 | // System.out.println("::: D.V. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 4481 | // dtb.execSQL(str); | 4481 | // dtb.execSQL(str); |
| 4482 | // | 4482 | // |
| 4483 | // }else if(condicionRadio == false && inventario.getNumero()==-2){ | 4483 | // }else if(condicionRadio == false && inventario.getNumero()==-2){ |
| 4484 | // // Esta seleccionado deposito, esto debe continuar sin los campos de ventas | 4484 | // // Esta seleccionado deposito, esto debe continuar sin los campos de ventas |
| 4485 | //// condR=-2; | 4485 | //// condR=-2; |
| 4486 | // System.out.println("::: BD 2754 prepara el string para insertar inventario 2"); | 4486 | // System.out.println("::: BD 2754 prepara el string para insertar inventario 2"); |
| 4487 | // str = "INSERT INTO " + tabla_inventarios_nombre | 4487 | // str = "INSERT INTO " + tabla_inventarios_nombre |
| 4488 | // + " VALUES(" + inventario.getNumero() + "," + "'" | 4488 | // + " VALUES(" + inventario.getNumero() + "," + "'" |
| 4489 | // + obtenerDescripcion + "'," + "'" | 4489 | // + obtenerDescripcion + "'," + "'" |
| 4490 | //// + inventario.getDescripcion() + "'," + "'" | 4490 | //// + inventario.getDescripcion() + "'," + "'" |
| 4491 | // + inventario.getFechaInicio() + "'," + "'" | 4491 | // + inventario.getFechaInicio() + "'," + "'" |
| 4492 | // + inventario.getFechaFin() + "'," | 4492 | // + inventario.getFechaFin() + "'," |
| 4493 | // + inventario.getEstado() + "," + variable_dep+ "," +0 | 4493 | // + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 4494 | // + ")"; | 4494 | // + ")"; |
| 4495 | // System.out.println("::: D.D. QUIERO VER VARIABLE_DEP "+variable_dep); | 4495 | // System.out.println("::: D.D. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 4496 | // dtb.execSQL(str); | 4496 | // dtb.execSQL(str); |
| 4497 | // | 4497 | // |
| 4498 | // } | 4498 | // } |
| 4499 | // else if(condicionRadio == true && inventario.getNumero()>0){ | 4499 | // else if(condicionRadio == true && inventario.getNumero()>0){ |
| 4500 | // System.out.println("::: BD 2754 prepara el string para insertar inventario 3"); | 4500 | // System.out.println("::: BD 2754 prepara el string para insertar inventario 3"); |
| 4501 | // str = "INSERT INTO " + tabla_inventarios_nombre | 4501 | // str = "INSERT INTO " + tabla_inventarios_nombre |
| 4502 | // + " VALUES(" + inventario.getNumero() + "," + "'" | 4502 | // + " VALUES(" + inventario.getNumero() + "," + "'" |
| 4503 | // + obtenerDescripcion + "'," + "'" | 4503 | // + obtenerDescripcion + "'," + "'" |
| 4504 | //// + inventario.getDescripcion() + "'," + "'" | 4504 | //// + inventario.getDescripcion() + "'," + "'" |
| 4505 | // + inventario.getFechaInicio() + "'," + "'" | 4505 | // + inventario.getFechaInicio() + "'," + "'" |
| 4506 | // + inventario.getFechaFin() + "'," | 4506 | // + inventario.getFechaFin() + "'," |
| 4507 | // + inventario.getEstado() + "," + -1+ "," +0 | 4507 | // + inventario.getEstado() + "," + -1+ "," +0 |
| 4508 | // + ")"; | 4508 | // + ")"; |
| 4509 | // System.out.println("::: D.O. QUIERO VER VARIABLE_DEP "+variable_dep); | 4509 | // System.out.println("::: D.O. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 4510 | // dtb.execSQL(str); | 4510 | // dtb.execSQL(str); |
| 4511 | // } | 4511 | // } |
| 4512 | // else if(condicionRadio == false && inventario.getNumero()>0){ | 4512 | // else if(condicionRadio == false && inventario.getNumero()>0){ |
| 4513 | // System.out.println("::: BD 2754 prepara el string para insertar inventario 3"); | 4513 | // System.out.println("::: BD 2754 prepara el string para insertar inventario 3"); |
| 4514 | // str = "INSERT INTO " + tabla_inventarios_nombre | 4514 | // str = "INSERT INTO " + tabla_inventarios_nombre |
| 4515 | // + " VALUES(" + inventario.getNumero() + "," + "'" | 4515 | // + " VALUES(" + inventario.getNumero() + "," + "'" |
| 4516 | // + obtenerDescripcion + "'," + "'" | 4516 | // + obtenerDescripcion + "'," + "'" |
| 4517 | //// + inventario.getDescripcion() + "'," + "'" | 4517 | //// + inventario.getDescripcion() + "'," + "'" |
| 4518 | // + inventario.getFechaInicio() + "'," + "'" | 4518 | // + inventario.getFechaInicio() + "'," + "'" |
| 4519 | // + inventario.getFechaFin() + "'," | 4519 | // + inventario.getFechaFin() + "'," |
| 4520 | // + inventario.getEstado() + "," + -2 + "," +0 | 4520 | // + inventario.getEstado() + "," + -2 + "," +0 |
| 4521 | // + ")"; | 4521 | // + ")"; |
| 4522 | // System.out.println("::: D.O. QUIERO VER VARIABLE_DEP "+variable_dep); | 4522 | // System.out.println("::: D.O. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 4523 | // dtb.execSQL(str); | 4523 | // dtb.execSQL(str); |
| 4524 | // } | 4524 | // } |
| 4525 | //// System.out.println("::: BaseDatos 2929 variable_dep " + variable_dep); | 4525 | //// System.out.println("::: BaseDatos 2929 variable_dep " + variable_dep); |
| 4526 | //// System.out.println("::: BaseDatos 2929 inventario.getNumero() " + inventario.getNumero()); | 4526 | //// System.out.println("::: BaseDatos 2929 inventario.getNumero() " + inventario.getNumero()); |
| 4527 | //// String str = "INSERT INTO " + tabla_inventarios_nombre | 4527 | //// String str = "INSERT INTO " + tabla_inventarios_nombre |
| 4528 | //// + " VALUES(" + inventario.getNumero() + "," + "'" | 4528 | //// + " VALUES(" + inventario.getNumero() + "," + "'" |
| 4529 | //// + obtenerDescripcion + "'," + "'" | 4529 | //// + obtenerDescripcion + "'," + "'" |
| 4530 | ////// + inventario.getDescripcion() + "'," + "'" | 4530 | ////// + inventario.getDescripcion() + "'," + "'" |
| 4531 | //// + inventario.getFechaInicio() + "'," + "'" | 4531 | //// + inventario.getFechaInicio() + "'," + "'" |
| 4532 | //// + inventario.getFechaFin() + "'," | 4532 | //// + inventario.getFechaFin() + "'," |
| 4533 | //// + inventario.getEstado() + "," + variable_dep+ "," +0 | 4533 | //// + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 4534 | //// + ")"; | 4534 | //// + ")"; |
| 4535 | //// System.out.println("::: BD 2791 inserta string inv "+ str); | 4535 | //// System.out.println("::: BD 2791 inserta string inv "+ str); |
| 4536 | //// dtb.execSQL(str); | 4536 | //// dtb.execSQL(str); |
| 4537 | // // Test resultado INSERT: | 4537 | // // Test resultado INSERT: |
| 4538 | // // if (resultado < 0) { | 4538 | // // if (resultado < 0) { |
| 4539 | // // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4539 | // // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4540 | // // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 4540 | // // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 4541 | // // } | 4541 | // // } |
| 4542 | // } else { | 4542 | // } else { |
| 4543 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4543 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4544 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 4544 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 4545 | // } | 4545 | // } |
| 4546 | // // 4 Cierre: | 4546 | // // 4 Cierre: |
| 4547 | // dtb.close(); | 4547 | // dtb.close(); |
| 4548 | // | 4548 | // |
| 4549 | // return; | 4549 | // return; |
| 4550 | // } catch (Exception e) { | 4550 | // } catch (Exception e) { |
| 4551 | // | 4551 | // |
| 4552 | // GestorLogEventos log = new GestorLogEventos(); | 4552 | // GestorLogEventos log = new GestorLogEventos(); |
| 4553 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4553 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4554 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4554 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4555 | // log.log("[-- 2112 --]" + e.toString(), 4); | 4555 | // log.log("[-- 2112 --]" + e.toString(), 4); |
| 4556 | // | 4556 | // |
| 4557 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4557 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4558 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 4558 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 4559 | // } | 4559 | // } |
| 4560 | // } | 4560 | // } |
| 4561 | // | 4561 | // |
| 4562 | // /** | 4562 | // /** |
| 4563 | // * Agregar un INVENTARIO a la base de datos (o lo actualiza si ya existe) | 4563 | // * Agregar un INVENTARIO a la base de datos (o lo actualiza si ya existe) |
| 4564 | // * <p> | 4564 | // * <p> |
| 4565 | // * 1 Si la entrada ya existe, actualizamos los datos | 4565 | // * 1 Si la entrada ya existe, actualizamos los datos |
| 4566 | // * <p> | 4566 | // * <p> |
| 4567 | // * 2 Sino, abrimos la base de datos en modo escritura | 4567 | // * 2 Sino, abrimos la base de datos en modo escritura |
| 4568 | // * <p> | 4568 | // * <p> |
| 4569 | // * 3 Insertamos el registro en la base de dato | 4569 | // * 3 Insertamos el registro en la base de dato |
| 4570 | // * <p> | 4570 | // * <p> |
| 4571 | // * 4 Cierre | 4571 | // * 4 Cierre |
| 4572 | // * | 4572 | // * |
| 4573 | // * @param inventario | 4573 | // * @param inventario |
| 4574 | // * Objeto que agregar en la base | 4574 | // * Objeto que agregar en la base |
| 4575 | // * @throws ExceptionBDD | 4575 | // * @throws ExceptionBDD |
| 4576 | // */ | 4576 | // */ |
| 4577 | // public void insertInventarioComprasEnBdd(Inventario inventario) | 4577 | // public void insertInventarioComprasEnBdd(Inventario inventario) |
| 4578 | // throws ExceptionBDD { | 4578 | // throws ExceptionBDD { |
| 4579 | // System.out.println("::: BD 2754 Inserta inventario Compras"); | 4579 | // System.out.println("::: BD 2754 Inserta inventario Compras"); |
| 4580 | // try { | 4580 | // try { |
| 4581 | // // Test de la preexistencia de la entrada: | 4581 | // // Test de la preexistencia de la entrada: |
| 4582 | // // 1 Si la entrada ya existe, actualizamos los datos: | 4582 | // // 1 Si la entrada ya existe, actualizamos los datos: |
| 4583 | // if (selectInventarioConNumero(inventario.getNumero()) != null) // Si | 4583 | // if (selectInventarioConNumero(inventario.getNumero()) != null) // Si |
| 4584 | // // existe... | 4584 | // // existe... |
| 4585 | // { | 4585 | // { |
| 4586 | // updateInventarioCompras(inventario); | 4586 | // updateInventarioCompras(inventario); |
| 4587 | // return; | 4587 | // return; |
| 4588 | // } | 4588 | // } |
| 4589 | // // 2 Sino, abrimos la base de datos en modo escritura | 4589 | // // 2 Sino, abrimos la base de datos en modo escritura |
| 4590 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 4590 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 4591 | // // Si hemos abierto correctamente la base de datos | 4591 | // // Si hemos abierto correctamente la base de datos |
| 4592 | // if (dtb != null) { | 4592 | // if (dtb != null) { |
| 4593 | // String descripcionCompleta = inventario.getDescripcion().trim(); | 4593 | // String descripcionCompleta = inventario.getDescripcion().trim(); |
| 4594 | // int n = descripcionCompleta.trim().length(); | 4594 | // int n = descripcionCompleta.trim().length(); |
| 4595 | // String obtenerDescripcion = descripcionCompleta.substring(0,(n-3)); | 4595 | // String obtenerDescripcion = descripcionCompleta.substring(0,(n-3)); |
| 4596 | // char car=descripcionCompleta.charAt(n-1); | 4596 | // char car=descripcionCompleta.charAt(n-1); |
| 4597 | // int variable_dep = 3; | 4597 | // int variable_dep = 3; |
| 4598 | // String str = ""; | 4598 | // String str = ""; |
| 4599 | // | 4599 | // |
| 4600 | // if(inventario.getNumero()==-3){ | 4600 | // if(inventario.getNumero()==-3){ |
| 4601 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 4601 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 4602 | // str = "INSERT INTO " + tabla_inventarios_nombre | 4602 | // str = "INSERT INTO " + tabla_inventarios_nombre |
| 4603 | // + " VALUES(" + inventario.getNumero() + "," + "'" | 4603 | // + " VALUES(" + inventario.getNumero() + "," + "'" |
| 4604 | // + obtenerDescripcion + "'," + "'" | 4604 | // + obtenerDescripcion + "'," + "'" |
| 4605 | // + inventario.getFechaInicio() + "'," + "'" | 4605 | // + inventario.getFechaInicio() + "'," + "'" |
| 4606 | // + inventario.getFechaFin() + "'," | 4606 | // + inventario.getFechaFin() + "'," |
| 4607 | // + inventario.getEstado() + "," + variable_dep+ "," +0 | 4607 | // + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 4608 | // + ")"; | 4608 | // + ")"; |
| 4609 | // System.out.println("::: D.C. QUIERO VER VARIABLE_DEP "+variable_dep); | 4609 | // System.out.println("::: D.C. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 4610 | // dtb.execSQL(str); | 4610 | // dtb.execSQL(str); |
| 4611 | // } | 4611 | // } |
| 4612 | // } else { | 4612 | // } else { |
| 4613 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4613 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4614 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 4614 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 4615 | // } | 4615 | // } |
| 4616 | // // 4 Cierre: | 4616 | // // 4 Cierre: |
| 4617 | // dtb.close(); | 4617 | // dtb.close(); |
| 4618 | // return; | 4618 | // return; |
| 4619 | // } catch (Exception e) { | 4619 | // } catch (Exception e) { |
| 4620 | // GestorLogEventos log = new GestorLogEventos(); | 4620 | // GestorLogEventos log = new GestorLogEventos(); |
| 4621 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4621 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4622 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4622 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4623 | // log.log("[-- 2112 --]" + e.toString(), 4); | 4623 | // log.log("[-- 2112 --]" + e.toString(), 4); |
| 4624 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 4624 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 4625 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 4625 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 4626 | // } | 4626 | // } |
| 4627 | // } | 4627 | // } |
| 4628 | // | 4628 | // |
| 4629 | // /** | 4629 | // /** |
| 4630 | // * Recupera el objeto ARTICULO del inventario correspondiente con el codigo | 4630 | // * Recupera el objeto ARTICULO del inventario correspondiente con el codigo |
| 4631 | // * del mismo | 4631 | // * del mismo |
| 4632 | // * <p> | 4632 | // * <p> |
| 4633 | // * 1 Abrimos la base de datos en modo lectura | 4633 | // * 1 Abrimos la base de datos en modo lectura |
| 4634 | // * <p> | 4634 | // * <p> |
| 4635 | // * 2 Busqueda en la base | 4635 | // * 2 Busqueda en la base |
| 4636 | // * <p> | 4636 | // * <p> |
| 4637 | // * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el | 4637 | // * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el |
| 4638 | // * articulo | 4638 | // * articulo |
| 4639 | // * <p> | 4639 | // * <p> |
| 4640 | // * 4 Cerramos la BD | 4640 | // * 4 Cerramos la BD |
| 4641 | // * <p> | 4641 | // * <p> |
| 4642 | // * 5 Devolvemos el articulo | 4642 | // * 5 Devolvemos el articulo |
| 4643 | // * | 4643 | // * |
| 4644 | // * @param articulo_cod | 4644 | // * @param articulo_cod |
| 4645 | // * @return ARTICULO | 4645 | // * @return ARTICULO |
| 4646 | // * @throws ExceptionBDD | 4646 | // * @throws ExceptionBDD |
| 4647 | // */ | 4647 | // */ |
| 4648 | // public Articulo selectArticuloConCodigos(int articulo_sector, | 4648 | // public Articulo selectArticuloConCodigos(int articulo_sector, |
| 4649 | // int articulo_cod, int articulo_inv) throws ExceptionBDD { | 4649 | // int articulo_cod, int articulo_inv) throws ExceptionBDD { |
| 4650 | // System.out.println("::: BaseDatos 3010 selectArticuloConCodigos"); | 4650 | // System.out.println("::: BaseDatos 3010 selectArticuloConCodigos"); |
| 4651 | // try { | 4651 | // try { |
| 4652 | // // Salida: | 4652 | // // Salida: |
| 4653 | // Articulo articulo; | 4653 | // Articulo articulo; |
| 4654 | // System.out.println("::: BaseDatos selectArt " + articulo_sector +" "+ articulo_cod + " " + articulo_inv); | 4654 | // System.out.println("::: BaseDatos selectArt " + articulo_sector +" "+ articulo_cod + " " + articulo_inv); |
| 4655 | // // 1 Abrimos la base de datos en modo lectura: | 4655 | // // 1 Abrimos la base de datos en modo lectura: |
| 4656 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 4656 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 4657 | // // 2 Busqueda en la base: | 4657 | // // 2 Busqueda en la base: |
| 4658 | // String[] args = new String[] { String.valueOf(articulo_sector), | 4658 | // String[] args = new String[] { String.valueOf(articulo_sector), |
| 4659 | // String.valueOf(articulo_cod), String.valueOf(articulo_inv) }; | 4659 | // String.valueOf(articulo_cod), String.valueOf(articulo_inv) }; |
| 4660 | // Cursor c = dtb.query(tabla_articulos_nombre, null, | 4660 | // Cursor c = dtb.query(tabla_articulos_nombre, null, |
| 4661 | // ParametrosInventario.bal_bdd_articulo_sector + "=? AND " | 4661 | // ParametrosInventario.bal_bdd_articulo_sector + "=? AND " |
| 4662 | // + ParametrosInventario.bal_bdd_articulo_codigo | 4662 | // + ParametrosInventario.bal_bdd_articulo_codigo |
| 4663 | // + "=? AND " | 4663 | // + "=? AND " |
| 4664 | // + ParametrosInventario.bal_bdd_articulo_inventario | 4664 | // + ParametrosInventario.bal_bdd_articulo_inventario |
| 4665 | // + "=?", args, null, null, null); | 4665 | // + "=?", args, null, null, null); |
| 4666 | // if (c.moveToFirst()) { | 4666 | // if (c.moveToFirst()) { |
| 4667 | // articulo = new Articulo( | 4667 | // articulo = new Articulo( |
| 4668 | // articulo_sector, | 4668 | // articulo_sector, |
| 4669 | // articulo_cod, | 4669 | // articulo_cod, |
| 4670 | // c.getInt(c | 4670 | // c.getInt(c |
| 4671 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), | 4671 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), |
| 4672 | // c.getInt(c | 4672 | // c.getInt(c |
| 4673 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), | 4673 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), |
| 4674 | // new ArrayList<String>( | 4674 | // new ArrayList<String>( |
| 4675 | // Arrays.asList(c | 4675 | // Arrays.asList(c |
| 4676 | // .getString( | 4676 | // .getString( |
| 4677 | // c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)) | 4677 | // c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)) |
| 4678 | // .split(","))), | 4678 | // .split(","))), |
| 4679 | // new ArrayList<String>( | 4679 | // new ArrayList<String>( |
| 4680 | // Arrays.asList("0")), | 4680 | // Arrays.asList("0")), |
| 4681 | // c.getInt(c | 4681 | // c.getInt(c |
| 4682 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), | 4682 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), |
| 4683 | // c.getString(c | 4683 | // c.getString(c |
| 4684 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), | 4684 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), |
| 4685 | // c.getDouble(c | 4685 | // c.getDouble(c |
| 4686 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), | 4686 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), |
| 4687 | // c.getDouble(c | 4687 | // c.getDouble(c |
| 4688 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), | 4688 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), |
| 4689 | // c.getString(c | 4689 | // c.getString(c |
| 4690 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), | 4690 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), |
| 4691 | // c.getInt(c | 4691 | // c.getInt(c |
| 4692 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), | 4692 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), |
| 4693 | // c.getInt(c | 4693 | // c.getInt(c |
| 4694 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), | 4694 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), |
| 4695 | // c.getInt(c | 4695 | // c.getInt(c |
| 4696 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), | 4696 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), |
| 4697 | // c.getInt(c | 4697 | // c.getInt(c |
| 4698 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), | 4698 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), |
| 4699 | // c.getInt(c | 4699 | // c.getInt(c |
| 4700 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), | 4700 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), |
| 4701 | // c.getString(c | 4701 | // c.getString(c |
| 4702 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); | 4702 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); |
| 4703 | // | 4703 | // |
| 4704 | // | 4704 | // |
| 4705 | // } else { | 4705 | // } else { |
| 4706 | // articulo = null; | 4706 | // articulo = null; |
| 4707 | // System.out.println("::: BaseDatos VACIOOOOO 000000000000000000000000000000000000000"); | 4707 | // System.out.println("::: BaseDatos VACIOOOOO 000000000000000000000000000000000000000"); |
| 4708 | // } | 4708 | // } |
| 4709 | // // 4 Cerramos la BD | 4709 | // // 4 Cerramos la BD |
| 4710 | // // System.out.println(":::CIERRA"); | 4710 | // // System.out.println(":::CIERRA"); |
| 4711 | // dtb.close(); | 4711 | // dtb.close(); |
| 4712 | // // 5 Devolvemos el articulo | 4712 | // // 5 Devolvemos el articulo |
| 4713 | // return articulo; | 4713 | // return articulo; |
| 4714 | // } catch (Exception e) { | 4714 | // } catch (Exception e) { |
| 4715 | // | 4715 | // |
| 4716 | // GestorLogEventos log = new GestorLogEventos(); | 4716 | // GestorLogEventos log = new GestorLogEventos(); |
| 4717 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4717 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4718 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4718 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4719 | // log.log("[-- 2194 --]" + e.toString(), 4); | 4719 | // log.log("[-- 2194 --]" + e.toString(), 4); |
| 4720 | // | 4720 | // |
| 4721 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 4721 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 4722 | // "Imposible recuperar el ARTICULO cuyo codigo es: " | 4722 | // "Imposible recuperar el ARTICULO cuyo codigo es: " |
| 4723 | // + articulo_cod); | 4723 | // + articulo_cod); |
| 4724 | // } | 4724 | // } |
| 4725 | // } | 4725 | // } |
| 4726 | // | 4726 | // |
| 4727 | // public Proveedor selectProveedorConCodigos(int proveedor_cod) throws ExceptionBDD { | 4727 | // public Proveedor selectProveedorConCodigos(int proveedor_cod) throws ExceptionBDD { |
| 4728 | // System.out.println("::: BaseDatos 3010 selectProveedorConCodigos"); | 4728 | // System.out.println("::: BaseDatos 3010 selectProveedorConCodigos"); |
| 4729 | // try { | 4729 | // try { |
| 4730 | // // Salida: | 4730 | // // Salida: |
| 4731 | // Proveedor proveedor; | 4731 | // Proveedor proveedor; |
| 4732 | // System.out.println("::: BaseDatos selectArt " + proveedor_cod); | 4732 | // System.out.println("::: BaseDatos selectArt " + proveedor_cod); |
| 4733 | // // 1 Abrimos la base de datos en modo lectura: | 4733 | // // 1 Abrimos la base de datos en modo lectura: |
| 4734 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 4734 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 4735 | // // 2 Busqueda en la base: | 4735 | // // 2 Busqueda en la base: |
| 4736 | // String[] args = new String[] { String.valueOf(proveedor_cod)}; | 4736 | // String[] args = new String[] { String.valueOf(proveedor_cod)}; |
| 4737 | // Cursor c = dtb.query(tabla_proveedores_nombre, null, | 4737 | // Cursor c = dtb.query(tabla_proveedores_nombre, null, |
| 4738 | // ParametrosInventario.bal_bdd_proveedores_codigo + "=? ", args, null, null, null); | 4738 | // ParametrosInventario.bal_bdd_proveedores_codigo + "=? ", args, null, null, null); |
| 4739 | // if (c.moveToFirst()) { | 4739 | // if (c.moveToFirst()) { |
| 4740 | // proveedor = new Proveedor( | 4740 | // proveedor = new Proveedor( |
| 4741 | // proveedor_cod, | 4741 | // proveedor_cod, |
| 4742 | // c.getString(c | 4742 | // c.getString(c |
| 4743 | // .getColumnIndex(ParametrosInventario.bal_bdd_proveedores_descripcion))); | 4743 | // .getColumnIndex(ParametrosInventario.bal_bdd_proveedores_descripcion))); |
| 4744 | // } else { | 4744 | // } else { |
| 4745 | // proveedor = null; | 4745 | // proveedor = null; |
| 4746 | // System.out.println("::: BaseDatos VACIOOOOO 000000000000000000000000000000000000000"); | 4746 | // System.out.println("::: BaseDatos VACIOOOOO 000000000000000000000000000000000000000"); |
| 4747 | // } | 4747 | // } |
| 4748 | // // 4 Cerramos la BD | 4748 | // // 4 Cerramos la BD |
| 4749 | // // System.out.println(":::CIERRA"); | 4749 | // // System.out.println(":::CIERRA"); |
| 4750 | // dtb.close(); | 4750 | // dtb.close(); |
| 4751 | // | 4751 | // |
| 4752 | // return proveedor; | 4752 | // return proveedor; |
| 4753 | // } catch (Exception e) { | 4753 | // } catch (Exception e) { |
| 4754 | // | 4754 | // |
| 4755 | // GestorLogEventos log = new GestorLogEventos(); | 4755 | // GestorLogEventos log = new GestorLogEventos(); |
| 4756 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4756 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4757 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4757 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4758 | // log.log("[-- 2194 --]" + e.toString(), 4); | 4758 | // log.log("[-- 2194 --]" + e.toString(), 4); |
| 4759 | // | 4759 | // |
| 4760 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 4760 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 4761 | // "Imposible recuperar el ARTICULO cuyo codigo es: " | 4761 | // "Imposible recuperar el ARTICULO cuyo codigo es: " |
| 4762 | // + proveedor_cod); | 4762 | // + proveedor_cod); |
| 4763 | // } | 4763 | // } |
| 4764 | // } | 4764 | // } |
| 4765 | // | 4765 | // |
| 4766 | // /** | 4766 | // /** |
| 4767 | // * Recupera el Articulo con el codigo de barra de la tabla articulos | 4767 | // * Recupera el Articulo con el codigo de barra de la tabla articulos |
| 4768 | // * <p> | 4768 | // * <p> |
| 4769 | // * 1 Abrimos la base de datos en modo lectura | 4769 | // * 1 Abrimos la base de datos en modo lectura |
| 4770 | // * <p> | 4770 | // * <p> |
| 4771 | // * 2 Busqueda en la base | 4771 | // * 2 Busqueda en la base |
| 4772 | // * <p> | 4772 | // * <p> |
| 4773 | // * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el | 4773 | // * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el |
| 4774 | // * articulo | 4774 | // * articulo |
| 4775 | // * | 4775 | // * |
| 4776 | // * @param codigo_barra | 4776 | // * @param codigo_barra |
| 4777 | // * @return | 4777 | // * @return |
| 4778 | // * @throws ExceptionBDD | 4778 | // * @throws ExceptionBDD |
| 4779 | // */ | 4779 | // */ |
| 4780 | // public Articulo selectArticuloConCodigoBarra(String codigo_barra) | 4780 | // public Articulo selectArticuloConCodigoBarra(String codigo_barra) |
| 4781 | // throws ExceptionBDD { | 4781 | // throws ExceptionBDD { |
| 4782 | // System.out.println("::: BaseDatos 3108 selectArticuloConCodigoBarra"); | 4782 | // System.out.println("::: BaseDatos 3108 selectArticuloConCodigoBarra"); |
| 4783 | // try { | 4783 | // try { |
| 4784 | // // Salida: | 4784 | // // Salida: |
| 4785 | // Articulo articulo; | 4785 | // Articulo articulo; |
| 4786 | // | 4786 | // |
| 4787 | // // 1 Abrimos la base de datos en modo lectura: | 4787 | // // 1 Abrimos la base de datos en modo lectura: |
| 4788 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 4788 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 4789 | // | 4789 | // |
| 4790 | // // 2 Busqueda en la base: | 4790 | // // 2 Busqueda en la base: |
| 4791 | // String[] args = new String[] { codigo_barra }; | 4791 | // String[] args = new String[] { codigo_barra }; |
| 4792 | // Cursor c = dtb.query(tabla_articulos_nombre, null, | 4792 | // Cursor c = dtb.query(tabla_articulos_nombre, null, |
| 4793 | // ParametrosInventario.bal_bdd_articulo_codigo_barra + "=?", | 4793 | // ParametrosInventario.bal_bdd_articulo_codigo_barra + "=?", |
| 4794 | // args, null, null, null); | 4794 | // args, null, null, null); |
| 4795 | // | 4795 | // |
| 4796 | // // Nos aseguramos de que existe al menos un registro | 4796 | // // Nos aseguramos de que existe al menos un registro |
| 4797 | // if (c.moveToFirst()) { | 4797 | // if (c.moveToFirst()) { |
| 4798 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y | 4798 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y |
| 4799 | // // creamos el articulo | 4799 | // // creamos el articulo |
| 4800 | // articulo = new Articulo( | 4800 | // articulo = new Articulo( |
| 4801 | // c.getInt(c | 4801 | // c.getInt(c |
| 4802 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), | 4802 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), |
| 4803 | // c.getInt(c | 4803 | // c.getInt(c |
| 4804 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), | 4804 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), |
| 4805 | // c.getInt(c | 4805 | // c.getInt(c |
| 4806 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), | 4806 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), |
| 4807 | // c.getInt(c | 4807 | // c.getInt(c |
| 4808 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), | 4808 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), |
| 4809 | // new ArrayList<String>( | 4809 | // new ArrayList<String>( |
| 4810 | // Arrays.asList(c | 4810 | // Arrays.asList(c |
| 4811 | // .getString( | 4811 | // .getString( |
| 4812 | // c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)) | 4812 | // c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)) |
| 4813 | // .split(","))), | 4813 | // .split(","))), |
| 4814 | // new ArrayList<String>( | 4814 | // new ArrayList<String>( |
| 4815 | // Arrays.asList(c | 4815 | // Arrays.asList(c |
| 4816 | // .getString( | 4816 | // .getString( |
| 4817 | // c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra_completo)) | 4817 | // c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra_completo)) |
| 4818 | // .split(","))), | 4818 | // .split(","))), |
| 4819 | // c.getInt(c | 4819 | // c.getInt(c |
| 4820 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), | 4820 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), |
| 4821 | // c.getString(c | 4821 | // c.getString(c |
| 4822 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), | 4822 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), |
| 4823 | // c.getDouble(c | 4823 | // c.getDouble(c |
| 4824 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), | 4824 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), |
| 4825 | // c.getDouble(c | 4825 | // c.getDouble(c |
| 4826 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), | 4826 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), |
| 4827 | // c.getString(c | 4827 | // c.getString(c |
| 4828 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), | 4828 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), |
| 4829 | // c.getInt(c | 4829 | // c.getInt(c |
| 4830 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), | 4830 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), |
| 4831 | // c.getInt(c | 4831 | // c.getInt(c |
| 4832 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), | 4832 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), |
| 4833 | // c.getInt(c | 4833 | // c.getInt(c |
| 4834 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), | 4834 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), |
| 4835 | // c.getInt(c | 4835 | // c.getInt(c |
| 4836 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), | 4836 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), |
| 4837 | // c.getString(c | 4837 | // c.getString(c |
| 4838 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio)), | 4838 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio)), |
| 4839 | // c.getString(c | 4839 | // c.getString(c |
| 4840 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaFin))); | 4840 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaFin))); |
| 4841 | // } else { | 4841 | // } else { |
| 4842 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 4842 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 4843 | // "Imposible recuperar el ARTICULO cuyo codigo de barra es: " | 4843 | // "Imposible recuperar el ARTICULO cuyo codigo de barra es: " |
| 4844 | // + codigo_barra); | 4844 | // + codigo_barra); |
| 4845 | // } | 4845 | // } |
| 4846 | // dtb.close(); | 4846 | // dtb.close(); |
| 4847 | // return articulo; | 4847 | // return articulo; |
| 4848 | // } catch (Exception e) { | 4848 | // } catch (Exception e) { |
| 4849 | // | 4849 | // |
| 4850 | // GestorLogEventos log = new GestorLogEventos(); | 4850 | // GestorLogEventos log = new GestorLogEventos(); |
| 4851 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 4851 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 4852 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 4852 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 4853 | // log.log("[-- 2273 --]" + e.toString(), 4); | 4853 | // log.log("[-- 2273 --]" + e.toString(), 4); |
| 4854 | // | 4854 | // |
| 4855 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 4855 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 4856 | // "Imposible recuperar el ARTICULO cuyo codigo de barra es: " | 4856 | // "Imposible recuperar el ARTICULO cuyo codigo de barra es: " |
| 4857 | // + codigo_barra); | 4857 | // + codigo_barra); |
| 4858 | // } | 4858 | // } |
| 4859 | // } | 4859 | // } |
| 4860 | // | 4860 | // |
| 4861 | // /** | 4861 | // /** |
| 4862 | // * Busca en la tabla de referencias una referencia con codigo de barras | 4862 | // * Busca en la tabla de referencias una referencia con codigo de barras |
| 4863 | // * <p> | 4863 | // * <p> |
| 4864 | // * 1 Abrimos la base de datos en modo lectura | 4864 | // * 1 Abrimos la base de datos en modo lectura |
| 4865 | // * <p> | 4865 | // * <p> |
| 4866 | // * 2 Busqueda en la base | 4866 | // * 2 Busqueda en la base |
| 4867 | // * <p> | 4867 | // * <p> |
| 4868 | // * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el | 4868 | // * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el |
| 4869 | // * articulo de referencia a devolver | 4869 | // * articulo de referencia a devolver |
| 4870 | // * <p> | 4870 | // * <p> |
| 4871 | // * 4 Cerramos y devolvemos | 4871 | // * 4 Cerramos y devolvemos |
| 4872 | // * @param codigo_barra | 4872 | // * @param codigo_barra |
| 4873 | // * @return | 4873 | // * @return |
| 4874 | // * @throws ExceptionBDD | 4874 | // * @throws ExceptionBDD |
| 4875 | // */ | 4875 | // */ |
| 4876 | // public Articulo selectReferenciaConCodigoBarra(String codigo_barra) | 4876 | // public Articulo selectReferenciaConCodigoBarra(String codigo_barra) |
| 4877 | // throws ExceptionBDD { | 4877 | // throws ExceptionBDD { |
| 4878 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra"); | 4878 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra"); |
| 4879 | // // Salida: | 4879 | // // Salida: |
| 4880 | // Articulo referencia = null; | 4880 | // Articulo referencia = null; |
| 4881 | // // 1 Abrimos la base de datos en modo lectura: | 4881 | // // 1 Abrimos la base de datos en modo lectura: |
| 4882 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 4882 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 4883 | // // 2 Busqueda en la base: | 4883 | // // 2 Busqueda en la base: |
| 4884 | // String[] args = new String[] { codigo_barra }; | 4884 | // String[] args = new String[] { codigo_barra }; |
| 4885 | //// Cursor c = dtb.query(tabla_referencias_nombre,// null,// ParametrosInventario.bal_bdd_referencia_codigo_barra// + "%%", args, null, null, null); | 4885 | //// Cursor c = dtb.query(tabla_referencias_nombre,// null,// ParametrosInventario.bal_bdd_referencia_codigo_barra// + "%%", args, null, null, null); |
| 4886 | // codcompleto = codigo_barra; | 4886 | // codcompleto = codigo_barra; |
| 4887 | // Cursor c; | 4887 | // Cursor c; |
| 4888 | // boolean condicionBalanza = ParametrosInventario.balanza; | 4888 | // boolean condicionBalanza = ParametrosInventario.balanza; |
| 4889 | // String consulta = ""; | 4889 | // String consulta = ""; |
| 4890 | // /** | 4890 | // /** |
| 4891 | // * Se valida el largo del codigo de barras para aquellos que tienen menor cantidad de digitos | 4891 | // * Se valida el largo del codigo de barras para aquellos que tienen menor cantidad de digitos |
| 4892 | // **/ | 4892 | // **/ |
| 4893 | // if ((codigo_barra.length() != 13) || ( codigo_barra.contains("A") || codigo_barra.contains("B") || codigo_barra.contains("C") || codigo_barra.contains("D") || codigo_barra.contains("E") || codigo_barra.contains("F") | 4893 | // if ((codigo_barra.length() != 13) || ( codigo_barra.contains("A") || codigo_barra.contains("B") || codigo_barra.contains("C") || codigo_barra.contains("D") || codigo_barra.contains("E") || codigo_barra.contains("F") |
| 4894 | // || codigo_barra.contains("G") || codigo_barra.contains("H") || codigo_barra.contains("I") || codigo_barra.contains("J") || codigo_barra.contains("K") || codigo_barra.contains("L") || codigo_barra.contains("M") | 4894 | // || codigo_barra.contains("G") || codigo_barra.contains("H") || codigo_barra.contains("I") || codigo_barra.contains("J") || codigo_barra.contains("K") || codigo_barra.contains("L") || codigo_barra.contains("M") |
| 4895 | // || codigo_barra.contains("N") || codigo_barra.contains("O") || codigo_barra.contains("P") || codigo_barra.contains("Q") || codigo_barra.contains("R") || codigo_barra.contains("S") || codigo_barra.contains("T") | 4895 | // || codigo_barra.contains("N") || codigo_barra.contains("O") || codigo_barra.contains("P") || codigo_barra.contains("Q") || codigo_barra.contains("R") || codigo_barra.contains("S") || codigo_barra.contains("T") |
| 4896 | // || codigo_barra.contains("U") || codigo_barra.contains("V") || codigo_barra.contains("W") || codigo_barra.contains("X") || codigo_barra.contains("Y") || codigo_barra.contains("Z")|| codigo_barra.contains("."))) { | 4896 | // || codigo_barra.contains("U") || codigo_barra.contains("V") || codigo_barra.contains("W") || codigo_barra.contains("X") || codigo_barra.contains("Y") || codigo_barra.contains("Z")|| codigo_barra.contains("."))) { |
| 4897 | // | 4897 | // |
| 4898 | // condicionBalanza = false; | 4898 | // condicionBalanza = false; |
| 4899 | // | 4899 | // |
| 4900 | // } | 4900 | // } |
| 4901 | // if(codigo_barra.length()== 13){ | 4901 | // if(codigo_barra.length()== 13){ |
| 4902 | // if(condicionBalanza){ | 4902 | // if(condicionBalanza){ |
| 4903 | // String sSubCadena = codigo_barra.substring(0,2); | 4903 | // String sSubCadena = codigo_barra.substring(0,2); |
| 4904 | // int subCadena = Integer.parseInt(sSubCadena); | 4904 | // int subCadena = Integer.parseInt(sSubCadena); |
| 4905 | // String sCodigo = codigo_barra.substring(2,7); | 4905 | // String sCodigo = codigo_barra.substring(2,7); |
| 4906 | // String peso = codigo_barra.substring(7,12); | 4906 | // String peso = codigo_barra.substring(7,12); |
| 4907 | // System.out.println("::: BaseDatos selectReferencia 3282 Articulo codigo_barra valor a pasar "); | 4907 | // System.out.println("::: BaseDatos selectReferencia 3282 Articulo codigo_barra valor a pasar "); |
| 4908 | // pesoObtenido = peso; | 4908 | // pesoObtenido = peso; |
| 4909 | // String valor; | 4909 | // String valor; |
| 4910 | // String codCompleto=""; | 4910 | // String codCompleto=""; |
| 4911 | // switch (subCadena) { | 4911 | // switch (subCadena) { |
| 4912 | // case 20: | 4912 | // case 20: |
| 4913 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 2"); | 4913 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 2"); |
| 4914 | // valor = sCodigo; | 4914 | // valor = sCodigo; |
| 4915 | // dtb.execSQL("UPDATE REFERENCIAS SET REF_CBC='"+codcompleto+"' WHERE REF_CB='"+valor+"'"); | 4915 | // dtb.execSQL("UPDATE REFERENCIAS SET REF_CBC='"+codcompleto+"' WHERE REF_CB='"+valor+"'"); |
| 4916 | // consulta = "select * from " + tabla_referencias_nombre + " where " | 4916 | // consulta = "select * from " + tabla_referencias_nombre + " where " |
| 4917 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + valor + "'"; | 4917 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + valor + "'"; |
| 4918 | // c = dtb.rawQuery(consulta, null); | 4918 | // c = dtb.rawQuery(consulta, null); |
| 4919 | // // Nos aseguramos de que existe al menos un registro | 4919 | // // Nos aseguramos de que existe al menos un registro |
| 4920 | // if (c.moveToFirst()) { | 4920 | // if (c.moveToFirst()) { |
| 4921 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 3"); | 4921 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 3"); |
| 4922 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y// creamos el articulo de// referencia a devolver | 4922 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y// creamos el articulo de// referencia a devolver |
| 4923 | // referencia = new Articulo( | 4923 | // referencia = new Articulo( |
| 4924 | // c.getInt(c | 4924 | // c.getInt(c |
| 4925 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), | 4925 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), |
| 4926 | // c.getInt(c | 4926 | // c.getInt(c |
| 4927 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), | 4927 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), |
| 4928 | // c.getInt(c | 4928 | // c.getInt(c |
| 4929 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), | 4929 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), |
| 4930 | // c.getInt(c | 4930 | // c.getInt(c |
| 4931 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), | 4931 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), |
| 4932 | // new ArrayList<String>( | 4932 | // new ArrayList<String>( |
| 4933 | // Arrays.asList(c | 4933 | // Arrays.asList(c |
| 4934 | // .getString( | 4934 | // .getString( |
| 4935 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)) | 4935 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)) |
| 4936 | // .split(","))), | 4936 | // .split(","))), |
| 4937 | // new ArrayList<String>( | 4937 | // new ArrayList<String>( |
| 4938 | // Arrays.asList(c | 4938 | // Arrays.asList(c |
| 4939 | // .getString( | 4939 | // .getString( |
| 4940 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)) | 4940 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)) |
| 4941 | // .split(","))), | 4941 | // .split(","))), |
| 4942 | // -1, | 4942 | // -1, |
| 4943 | // c.getString(c | 4943 | // c.getString(c |
| 4944 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), | 4944 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), |
| 4945 | // c.getDouble(c | 4945 | // c.getDouble(c |
| 4946 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), | 4946 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), |
| 4947 | // c.getDouble(c | 4947 | // c.getDouble(c |
| 4948 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), | 4948 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), |
| 4949 | // c.getString(c | 4949 | // c.getString(c |
| 4950 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), | 4950 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), |
| 4951 | // -1,-1, | 4951 | // -1,-1, |
| 4952 | // c.getDouble(c | 4952 | // c.getDouble(c |
| 4953 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), | 4953 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), |
| 4954 | // c.getDouble(c | 4954 | // c.getDouble(c |
| 4955 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), | 4955 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), |
| 4956 | // c.getInt(c | 4956 | // c.getInt(c |
| 4957 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); | 4957 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); |
| 4958 | // } | 4958 | // } |
| 4959 | // else { | 4959 | // else { |
| 4960 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 4 "); | 4960 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 4 "); |
| 4961 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 4961 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 4962 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " | 4962 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " |
| 4963 | // + codigo_barra); | 4963 | // + codigo_barra); |
| 4964 | // } | 4964 | // } |
| 4965 | // break; | 4965 | // break; |
| 4966 | // default: | 4966 | // default: |
| 4967 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 5"); | 4967 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 5"); |
| 4968 | // valor = codigo_barra; | 4968 | // valor = codigo_barra; |
| 4969 | // dtb.execSQL("UPDATE REFERENCIAS SET REF_CBC='"+codcompleto+"' WHERE REF_CB='"+valor+"'"); | 4969 | // dtb.execSQL("UPDATE REFERENCIAS SET REF_CBC='"+codcompleto+"' WHERE REF_CB='"+valor+"'"); |
| 4970 | // consulta = "select * from " + tabla_referencias_nombre | 4970 | // consulta = "select * from " + tabla_referencias_nombre |
| 4971 | // + " where " | 4971 | // + " where " |
| 4972 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" | 4972 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" |
| 4973 | // + codigo_barra + "'"; | 4973 | // + codigo_barra + "'"; |
| 4974 | // System.out.println("::: BaseDatos 4163 consulta2 " + consulta); | 4974 | // System.out.println("::: BaseDatos 4163 consulta2 " + consulta); |
| 4975 | // c = dtb.rawQuery(consulta, null); | 4975 | // c = dtb.rawQuery(consulta, null); |
| 4976 | // System.out.println("::: BaseDatos 4163 c.moveToFirst() " + c.moveToFirst()); | 4976 | // System.out.println("::: BaseDatos 4163 c.moveToFirst() " + c.moveToFirst()); |
| 4977 | // // Nos aseguramos de que existe al menos un registro | 4977 | // // Nos aseguramos de que existe al menos un registro |
| 4978 | // if (c.moveToFirst()) { | 4978 | // if (c.moveToFirst()) { |
| 4979 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 6"); | 4979 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 6"); |
| 4980 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y | 4980 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y |
| 4981 | // // creamos el articulo de // referencia a devolver | 4981 | // // creamos el articulo de // referencia a devolver |
| 4982 | // referencia = new Articulo( | 4982 | // referencia = new Articulo( |
| 4983 | // c.getInt(c | 4983 | // c.getInt(c |
| 4984 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), | 4984 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), |
| 4985 | // c.getInt(c | 4985 | // c.getInt(c |
| 4986 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), | 4986 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), |
| 4987 | // c.getInt(c | 4987 | // c.getInt(c |
| 4988 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), | 4988 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), |
| 4989 | // c.getInt(c | 4989 | // c.getInt(c |
| 4990 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), | 4990 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), |
| 4991 | // new ArrayList<String>( | 4991 | // new ArrayList<String>( |
| 4992 | // Arrays.asList(c | 4992 | // Arrays.asList(c |
| 4993 | // .getString( | 4993 | // .getString( |
| 4994 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)) | 4994 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)) |
| 4995 | // .split(","))), | 4995 | // .split(","))), |
| 4996 | // new ArrayList<String>( | 4996 | // new ArrayList<String>( |
| 4997 | // Arrays.asList(c | 4997 | // Arrays.asList(c |
| 4998 | // .getString( | 4998 | // .getString( |
| 4999 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)) | 4999 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)) |
| 5000 | // .split(","))), | 5000 | // .split(","))), |
| 5001 | // -1, | 5001 | // -1, |
| 5002 | // c.getString(c | 5002 | // c.getString(c |
| 5003 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), | 5003 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), |
| 5004 | // | 5004 | // |
| 5005 | // c.getDouble(c | 5005 | // c.getDouble(c |
| 5006 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), | 5006 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), |
| 5007 | // c.getDouble(c | 5007 | // c.getDouble(c |
| 5008 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), | 5008 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), |
| 5009 | // c.getString(c | 5009 | // c.getString(c |
| 5010 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), | 5010 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), |
| 5011 | // -1,-1, | 5011 | // -1,-1, |
| 5012 | // c.getDouble(c | 5012 | // c.getDouble(c |
| 5013 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), | 5013 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), |
| 5014 | // c.getDouble(c | 5014 | // c.getDouble(c |
| 5015 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), | 5015 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), |
| 5016 | // c.getInt(c | 5016 | // c.getInt(c |
| 5017 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); | 5017 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); |
| 5018 | // } else { | 5018 | // } else { |
| 5019 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 7"); | 5019 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 7"); |
| 5020 | // // System.out.println("::: BaseDatos 3040 codigo_barra " + codigo_barra); | 5020 | // // System.out.println("::: BaseDatos 3040 codigo_barra " + codigo_barra); |
| 5021 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5021 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5022 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " | 5022 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " |
| 5023 | // + codigo_barra); | 5023 | // + codigo_barra); |
| 5024 | // } | 5024 | // } |
| 5025 | // break; | 5025 | // break; |
| 5026 | // } | 5026 | // } |
| 5027 | // }else{ | 5027 | // }else{ |
| 5028 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 8"); | 5028 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 8"); |
| 5029 | // consulta = "select * from " + tabla_referencias_nombre + " where " | 5029 | // consulta = "select * from " + tabla_referencias_nombre + " where " |
| 5030 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + codigo_barra + "'"; | 5030 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + codigo_barra + "'"; |
| 5031 | // System.out.println("consulta " + consulta); | 5031 | // System.out.println("consulta " + consulta); |
| 5032 | // c = dtb.rawQuery(consulta, null); | 5032 | // c = dtb.rawQuery(consulta, null); |
| 5033 | // // Nos aseguramos de que existe al menos un registro | 5033 | // // Nos aseguramos de que existe al menos un registro |
| 5034 | // if (c.moveToFirst()) { | 5034 | // if (c.moveToFirst()) { |
| 5035 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 9"); | 5035 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 9"); |
| 5036 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el articulo de referencia a devolver | 5036 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el articulo de referencia a devolver |
| 5037 | // referencia = new Articulo( | 5037 | // referencia = new Articulo( |
| 5038 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), | 5038 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), |
| 5039 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), | 5039 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), |
| 5040 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), | 5040 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), |
| 5041 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), | 5041 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), |
| 5042 | // new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)).split(","))), | 5042 | // new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)).split(","))), |
| 5043 | // new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)).split(","))), -1, | 5043 | // new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)).split(","))), -1, |
| 5044 | // c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), | 5044 | // c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), |
| 5045 | // c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), | 5045 | // c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), |
| 5046 | // c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), | 5046 | // c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), |
| 5047 | // c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), -1,-1, | 5047 | // c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), -1,-1, |
| 5048 | // c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), | 5048 | // c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), |
| 5049 | // c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), | 5049 | // c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), |
| 5050 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)),""); | 5050 | // c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)),""); |
| 5051 | // System.out.println(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)); | 5051 | // System.out.println(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)); |
| 5052 | // System.out.println(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)); | 5052 | // System.out.println(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)); |
| 5053 | // } else { | 5053 | // } else { |
| 5054 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 10"); | 5054 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 10"); |
| 5055 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5055 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5056 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); | 5056 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); |
| 5057 | // } | 5057 | // } |
| 5058 | // } | 5058 | // } |
| 5059 | // }else if(codigo_barra.length()!=13){ | 5059 | // }else if(codigo_barra.length()!=13){ |
| 5060 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 8"); | 5060 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 8"); |
| 5061 | // consulta = "select * from " + tabla_referencias_nombre | 5061 | // consulta = "select * from " + tabla_referencias_nombre |
| 5062 | // + " where " | 5062 | // + " where " |
| 5063 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" | 5063 | // + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" |
| 5064 | // + codigo_barra + "'"; | 5064 | // + codigo_barra + "'"; |
| 5065 | //// System.out.println("consulta " + consulta); | 5065 | //// System.out.println("consulta " + consulta); |
| 5066 | // c = dtb.rawQuery(consulta, null); | 5066 | // c = dtb.rawQuery(consulta, null); |
| 5067 | // // Nos aseguramos de que existe al menos un registro | 5067 | // // Nos aseguramos de que existe al menos un registro |
| 5068 | // if (c.moveToFirst()) { | 5068 | // if (c.moveToFirst()) { |
| 5069 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 9"); | 5069 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 9"); |
| 5070 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y | 5070 | // // 3 Recorremos el resultado (que debe ser nico normalmente) y |
| 5071 | // // creamos el articulo de | 5071 | // // creamos el articulo de |
| 5072 | // // referencia a devolver | 5072 | // // referencia a devolver |
| 5073 | // referencia = new Articulo( | 5073 | // referencia = new Articulo( |
| 5074 | // c.getInt(c | 5074 | // c.getInt(c |
| 5075 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), | 5075 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), |
| 5076 | // c.getInt(c | 5076 | // c.getInt(c |
| 5077 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), | 5077 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), |
| 5078 | // c.getInt(c | 5078 | // c.getInt(c |
| 5079 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), | 5079 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), |
| 5080 | // c.getInt(c | 5080 | // c.getInt(c |
| 5081 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), | 5081 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), |
| 5082 | // new ArrayList<String>( | 5082 | // new ArrayList<String>( |
| 5083 | // Arrays.asList(c | 5083 | // Arrays.asList(c |
| 5084 | // .getString( | 5084 | // .getString( |
| 5085 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)) | 5085 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)) |
| 5086 | // .split(","))), | 5086 | // .split(","))), |
| 5087 | // new ArrayList<String>( | 5087 | // new ArrayList<String>( |
| 5088 | // Arrays.asList(c | 5088 | // Arrays.asList(c |
| 5089 | // .getString( | 5089 | // .getString( |
| 5090 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)) | 5090 | // c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)) |
| 5091 | // .split(","))), | 5091 | // .split(","))), |
| 5092 | // -1, | 5092 | // -1, |
| 5093 | // c.getString(c | 5093 | // c.getString(c |
| 5094 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), | 5094 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), |
| 5095 | // c.getDouble(c | 5095 | // c.getDouble(c |
| 5096 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), | 5096 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), |
| 5097 | // c.getDouble(c | 5097 | // c.getDouble(c |
| 5098 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), | 5098 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), |
| 5099 | // c.getString(c | 5099 | // c.getString(c |
| 5100 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), | 5100 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), |
| 5101 | // -1,-1, | 5101 | // -1,-1, |
| 5102 | // c.getDouble(c | 5102 | // c.getDouble(c |
| 5103 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), | 5103 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), |
| 5104 | // c.getDouble(c | 5104 | // c.getDouble(c |
| 5105 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), | 5105 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), |
| 5106 | // c.getInt(c | 5106 | // c.getInt(c |
| 5107 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)),""); | 5107 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)),""); |
| 5108 | // System.out.println(c | 5108 | // System.out.println(c |
| 5109 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)); | 5109 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)); |
| 5110 | // System.out.println(c | 5110 | // System.out.println(c |
| 5111 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)); | 5111 | // .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)); |
| 5112 | // } else { | 5112 | // } else { |
| 5113 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 10"); | 5113 | // System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 10"); |
| 5114 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5114 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5115 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " | 5115 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " |
| 5116 | // + codigo_barra); | 5116 | // + codigo_barra); |
| 5117 | // } | 5117 | // } |
| 5118 | // } | 5118 | // } |
| 5119 | // // 4 Cerramos y devolvemos | 5119 | // // 4 Cerramos y devolvemos |
| 5120 | // dtb.close(); | 5120 | // dtb.close(); |
| 5121 | // return referencia; | 5121 | // return referencia; |
| 5122 | // } | 5122 | // } |
| 5123 | // public boolean FijarsesiEsta_o_nelArticulo(String codigo_barra) { | 5123 | // public boolean FijarsesiEsta_o_nelArticulo(String codigo_barra) { |
| 5124 | // System.out.println("::: BaseDatos 3264 FijarsesiEsta_o_nelArticulo"); | 5124 | // System.out.println("::: BaseDatos 3264 FijarsesiEsta_o_nelArticulo"); |
| 5125 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5125 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5126 | // | 5126 | // |
| 5127 | // // 2 Busqueda en la base: | 5127 | // // 2 Busqueda en la base: |
| 5128 | // String[] args = new String[] { codigo_barra }; | 5128 | // String[] args = new String[] { codigo_barra }; |
| 5129 | // Cursor c = dtb.query(tabla_referencias_nombre, null, | 5129 | // Cursor c = dtb.query(tabla_referencias_nombre, null, |
| 5130 | // ParametrosInventario.bal_bdd_referencia_codigo_barra + "=?", | 5130 | // ParametrosInventario.bal_bdd_referencia_codigo_barra + "=?", |
| 5131 | // args, null, null, null); | 5131 | // args, null, null, null); |
| 5132 | // if (c.moveToFirst()) { | 5132 | // if (c.moveToFirst()) { |
| 5133 | // return true; | 5133 | // return true; |
| 5134 | // } else { | 5134 | // } else { |
| 5135 | // return false; | 5135 | // return false; |
| 5136 | // } | 5136 | // } |
| 5137 | // } | 5137 | // } |
| 5138 | // /** | 5138 | // /** |
| 5139 | // * Funcion para buscar un articulo en las bases de datos locales, tanto de | 5139 | // * Funcion para buscar un articulo en las bases de datos locales, tanto de |
| 5140 | // * referencias como de articulos en el caso de que se haya cargado nuevo en | 5140 | // * referencias como de articulos en el caso de que se haya cargado nuevo en |
| 5141 | // * este momento | 5141 | // * este momento |
| 5142 | // * <p> | 5142 | // * <p> |
| 5143 | // * 1 Busca en las referencias | 5143 | // * 1 Busca en las referencias |
| 5144 | // * <p> | 5144 | // * <p> |
| 5145 | // * 2 Si no se encontro en las referencias, lo buscamos en la tabla de | 5145 | // * 2 Si no se encontro en las referencias, lo buscamos en la tabla de |
| 5146 | // * Articulos por codigo de barra | 5146 | // * Articulos por codigo de barra |
| 5147 | // * | 5147 | // * |
| 5148 | // * @param cod_barra | 5148 | // * @param cod_barra |
| 5149 | // * @return | 5149 | // * @return |
| 5150 | // * @throws ExceptionBDD | 5150 | // * @throws ExceptionBDD |
| 5151 | // */ | 5151 | // */ |
| 5152 | // public Articulo selectReferenciaArticuloConCodigoBarra(String cod_barra) | 5152 | // public Articulo selectReferenciaArticuloConCodigoBarra(String cod_barra) |
| 5153 | // throws ExceptionBDD { | 5153 | // throws ExceptionBDD { |
| 5154 | // System.out.println("::: BaseDatos 3296 selectReferenciaArticuloConCodigoBarra"); | 5154 | // System.out.println("::: BaseDatos 3296 selectReferenciaArticuloConCodigoBarra"); |
| 5155 | // Articulo articuloEncontrado; | 5155 | // Articulo articuloEncontrado; |
| 5156 | // try { | 5156 | // try { |
| 5157 | // // 1 Busca en las referencias | 5157 | // // 1 Busca en las referencias |
| 5158 | // articuloEncontrado = this.selectReferenciaConCodigoBarra(cod_barra); | 5158 | // articuloEncontrado = this.selectReferenciaConCodigoBarra(cod_barra); |
| 5159 | // } catch (ExceptionBDD e) { | 5159 | // } catch (ExceptionBDD e) { |
| 5160 | // GestorLogEventos log = new GestorLogEventos(); | 5160 | // GestorLogEventos log = new GestorLogEventos(); |
| 5161 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5161 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5162 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5162 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5163 | // log.log("[-- 2387 --]" + e.toString(), 4); | 5163 | // log.log("[-- 2387 --]" + e.toString(), 4); |
| 5164 | // // No se encontro en la tabla de referencias | 5164 | // // No se encontro en la tabla de referencias |
| 5165 | // try { | 5165 | // try { |
| 5166 | // // 2 Si no se encontro en las referencias, lo buscamos en la | 5166 | // // 2 Si no se encontro en las referencias, lo buscamos en la |
| 5167 | // // tabla de Articulos por codigo de barra | 5167 | // // tabla de Articulos por codigo de barra |
| 5168 | // articuloEncontrado = this | 5168 | // articuloEncontrado = this |
| 5169 | // .selectArticuloConCodigoBarra(cod_barra); | 5169 | // .selectArticuloConCodigoBarra(cod_barra); |
| 5170 | // } catch (ExceptionBDD ex) { | 5170 | // } catch (ExceptionBDD ex) { |
| 5171 | // GestorLogEventos log1 = new GestorLogEventos(); | 5171 | // GestorLogEventos log1 = new GestorLogEventos(); |
| 5172 | // log1.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5172 | // log1.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5173 | // log1.log(e.toString(), 4); | 5173 | // log1.log(e.toString(), 4); |
| 5174 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5174 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5175 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " | 5175 | // "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " |
| 5176 | // + cod_barra); | 5176 | // + cod_barra); |
| 5177 | // } | 5177 | // } |
| 5178 | // } | 5178 | // } |
| 5179 | // return articuloEncontrado; | 5179 | // return articuloEncontrado; |
| 5180 | // } | 5180 | // } |
| 5181 | // | 5181 | // |
| 5182 | // /** | 5182 | // /** |
| 5183 | // * Obtiene los ARTICULOS del inventario indicado en parametro | 5183 | // * Obtiene los ARTICULOS del inventario indicado en parametro |
| 5184 | // * <p> | 5184 | // * <p> |
| 5185 | // * 1 Abrimos la base de datos en modo lectura | 5185 | // * 1 Abrimos la base de datos en modo lectura |
| 5186 | // * <p> | 5186 | // * <p> |
| 5187 | // * 2 Sacamos todos los ARTICULOS que tienen el dicho numero de INVENTARIO | 5187 | // * 2 Sacamos todos los ARTICULOS que tienen el dicho numero de INVENTARIO |
| 5188 | // * <p> | 5188 | // * <p> |
| 5189 | // * 3 Para cada articlo lo Creamos | 5189 | // * 3 Para cada articlo lo Creamos |
| 5190 | // * <p> | 5190 | // * <p> |
| 5191 | // * 4 Lo agregamos a la lista de resultados | 5191 | // * 4 Lo agregamos a la lista de resultados |
| 5192 | // * <p> | 5192 | // * <p> |
| 5193 | // * 5 Cerramos la BD | 5193 | // * 5 Cerramos la BD |
| 5194 | // * | 5194 | // * |
| 5195 | // * @param numero_inventario | 5195 | // * @param numero_inventario |
| 5196 | // * @return | 5196 | // * @return |
| 5197 | // * @throws ExceptionBDD | 5197 | // * @throws ExceptionBDD |
| 5198 | // */ | 5198 | // */ |
| 5199 | // public ArrayList<ArticuloVisible> selectArticulosConNumeroInventario( | 5199 | // public ArrayList<ArticuloVisible> selectArticulosConNumeroInventario( |
| 5200 | // int numero_inventario) throws ExceptionBDD { | 5200 | // int numero_inventario) throws ExceptionBDD { |
| 5201 | // System.out.println("::: BaseDatos 3349 selectArticulosConNumeroInventario " + numero_inventario); | 5201 | // System.out.println("::: BaseDatos 3349 selectArticulosConNumeroInventario " + numero_inventario); |
| 5202 | // try { | 5202 | // try { |
| 5203 | // // Variable de retorno: | 5203 | // // Variable de retorno: |
| 5204 | // ArrayList<ArticuloVisible> result = new ArrayList<ArticuloVisible>(); | 5204 | // ArrayList<ArticuloVisible> result = new ArrayList<ArticuloVisible>(); |
| 5205 | // // 1 Abrimos la base de datos en modo lectura | 5205 | // // 1 Abrimos la base de datos en modo lectura |
| 5206 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5206 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5207 | // // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de | 5207 | // // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de |
| 5208 | // // INVENTARIO | 5208 | // // INVENTARIO |
| 5209 | // String[] args = new String[] { String.valueOf(numero_inventario) }; | 5209 | // String[] args = new String[] { String.valueOf(numero_inventario) }; |
| 5210 | // Cursor c = dtb.query(tabla_articulos_nombre, null, | 5210 | // Cursor c = dtb.query(tabla_articulos_nombre, null, |
| 5211 | // ParametrosInventario.bal_bdd_articulo_inventario + "=?", | 5211 | // ParametrosInventario.bal_bdd_articulo_inventario + "=?", |
| 5212 | // args, null, null, null); | 5212 | // args, null, null, null); |
| 5213 | // int contador = 0; | 5213 | // int contador = 0; |
| 5214 | // // Combinamos el sector y el codigo bajo formato: [sector]-[codigo] | 5214 | // // Combinamos el sector y el codigo bajo formato: [sector]-[codigo] |
| 5215 | // if (c.moveToFirst()) { | 5215 | // if (c.moveToFirst()) { |
| 5216 | // while (c.isAfterLast() == false) { | 5216 | // while (c.isAfterLast() == false) { |
| 5217 | // // 3 Para cada articlo lo Creamos | 5217 | // // 3 Para cada articlo lo Creamos |
| 5218 | // String codigo_barra = c | 5218 | // String codigo_barra = c |
| 5219 | // .getString(c | 5219 | // .getString(c |
| 5220 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)); | 5220 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)); |
| 5221 | // ArticuloVisible articulo = new ArticuloVisible( | 5221 | // ArticuloVisible articulo = new ArticuloVisible( |
| 5222 | // c.getInt(c | 5222 | // c.getInt(c |
| 5223 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), | 5223 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), |
| 5224 | // c.getInt(c | 5224 | // c.getInt(c |
| 5225 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), | 5225 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), |
| 5226 | // c.getInt(c | 5226 | // c.getInt(c |
| 5227 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), | 5227 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), |
| 5228 | // c.getInt(c | 5228 | // c.getInt(c |
| 5229 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), | 5229 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), |
| 5230 | // new ArrayList<String>(Arrays.asList(codigo_barra | 5230 | // new ArrayList<String>(Arrays.asList(codigo_barra |
| 5231 | // .split(","))), | 5231 | // .split(","))), |
| 5232 | // new ArrayList<String>(Arrays.asList(codigo_barra | 5232 | // new ArrayList<String>(Arrays.asList(codigo_barra |
| 5233 | // .split(","))), | 5233 | // .split(","))), |
| 5234 | // c.getInt(c | 5234 | // c.getInt(c |
| 5235 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), | 5235 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), |
| 5236 | // c.getString(c | 5236 | // c.getString(c |
| 5237 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), | 5237 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), |
| 5238 | // c.getDouble(c | 5238 | // c.getDouble(c |
| 5239 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), | 5239 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), |
| 5240 | // c.getDouble(c | 5240 | // c.getDouble(c |
| 5241 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), | 5241 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), |
| 5242 | // c.getString(c | 5242 | // c.getString(c |
| 5243 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), | 5243 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), |
| 5244 | // c.getFloat(c | 5244 | // c.getFloat(c |
| 5245 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), | 5245 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), |
| 5246 | // c.getFloat(c | 5246 | // c.getFloat(c |
| 5247 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), | 5247 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), |
| 5248 | // c.getInt(c | 5248 | // c.getInt(c |
| 5249 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), | 5249 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), |
| 5250 | // c.getInt(c | 5250 | // c.getInt(c |
| 5251 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), | 5251 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), |
| 5252 | // c.getInt(c | 5252 | // c.getInt(c |
| 5253 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), | 5253 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), |
| 5254 | // c.getString(c | 5254 | // c.getString(c |
| 5255 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); | 5255 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); |
| 5256 | // | 5256 | // |
| 5257 | // // 4 Lo agregamos a la lista de resultados | 5257 | // // 4 Lo agregamos a la lista de resultados |
| 5258 | // contador = contador + 1; | 5258 | // contador = contador + 1; |
| 5259 | //// if(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito))==0){ | 5259 | //// if(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito))==0){ |
| 5260 | ////// c.moveToNext(); | 5260 | ////// c.moveToNext(); |
| 5261 | //// System.out.println(":::: No quiero q haga nada"); | 5261 | //// System.out.println(":::: No quiero q haga nada"); |
| 5262 | //// }else{ | 5262 | //// }else{ |
| 5263 | //// result.add(articulo); | 5263 | //// result.add(articulo); |
| 5264 | //// c.moveToNext(); } | 5264 | //// c.moveToNext(); } |
| 5265 | // result.add(articulo); | 5265 | // result.add(articulo); |
| 5266 | // c.moveToNext(); | 5266 | // c.moveToNext(); |
| 5267 | // } | 5267 | // } |
| 5268 | // } | 5268 | // } |
| 5269 | // | 5269 | // |
| 5270 | // // 5 Cerramos la BD | 5270 | // // 5 Cerramos la BD |
| 5271 | // dtb.close(); | 5271 | // dtb.close(); |
| 5272 | // return result; | 5272 | // return result; |
| 5273 | // | 5273 | // |
| 5274 | // } catch (Exception e) { | 5274 | // } catch (Exception e) { |
| 5275 | // | 5275 | // |
| 5276 | // GestorLogEventos log = new GestorLogEventos(); | 5276 | // GestorLogEventos log = new GestorLogEventos(); |
| 5277 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5277 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5278 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5278 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5279 | // log.log("[-- 2490 --]" + e.toString(), 4); | 5279 | // log.log("[-- 2490 --]" + e.toString(), 4); |
| 5280 | // | 5280 | // |
| 5281 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5281 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5282 | // "Imposible obtener los ARTICULOS del INVENTARIO n" | 5282 | // "Imposible obtener los ARTICULOS del INVENTARIO n" |
| 5283 | // + numero_inventario); | 5283 | // + numero_inventario); |
| 5284 | // } | 5284 | // } |
| 5285 | // | 5285 | // |
| 5286 | // } | 5286 | // } |
| 5287 | // | 5287 | // |
| 5288 | // /*COMPRA*/ | 5288 | // /*COMPRA*/ |
| 5289 | // | 5289 | // |
| 5290 | // public ArrayList<ArticuloVisible> selectArticulosConNumeroInventarioCompra( | 5290 | // public ArrayList<ArticuloVisible> selectArticulosConNumeroInventarioCompra( |
| 5291 | // int numero_inventario) throws ExceptionBDD { | 5291 | // int numero_inventario) throws ExceptionBDD { |
| 5292 | // System.out.println("::: BaseDatos 5246 selectArticulosConNumeroInventarioCompra " + numero_inventario); | 5292 | // System.out.println("::: BaseDatos 5246 selectArticulosConNumeroInventarioCompra " + numero_inventario); |
| 5293 | // try { | 5293 | // try { |
| 5294 | // // Variable de retorno: | 5294 | // // Variable de retorno: |
| 5295 | // ArrayList<ArticuloVisible> result = new ArrayList<ArticuloVisible>(); | 5295 | // ArrayList<ArticuloVisible> result = new ArrayList<ArticuloVisible>(); |
| 5296 | // // 1 Abrimos la base de datos en modo lectura | 5296 | // // 1 Abrimos la base de datos en modo lectura |
| 5297 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5297 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5298 | // // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de | 5298 | // // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de |
| 5299 | // // INVENTARIO | 5299 | // // INVENTARIO |
| 5300 | // String[] args = new String[] { String.valueOf(numero_inventario) }; | 5300 | // String[] args = new String[] { String.valueOf(numero_inventario) }; |
| 5301 | // Cursor c = dtb.query(tabla_articulos_nombre, null, | 5301 | // Cursor c = dtb.query(tabla_articulos_nombre, null, |
| 5302 | // ParametrosInventario.bal_bdd_articulo_inventario + "=?", | 5302 | // ParametrosInventario.bal_bdd_articulo_inventario + "=?", |
| 5303 | // args, null, null, null); | 5303 | // args, null, null, null); |
| 5304 | // int contador = 0; | 5304 | // int contador = 0; |
| 5305 | // // Combinamos el sector y el codigo bajo formato: [sector]-[codigo] | 5305 | // // Combinamos el sector y el codigo bajo formato: [sector]-[codigo] |
| 5306 | // if (c.moveToFirst()) { | 5306 | // if (c.moveToFirst()) { |
| 5307 | // while (c.isAfterLast() == false) { | 5307 | // while (c.isAfterLast() == false) { |
| 5308 | // // 3 Para cada articlo lo Creamos | 5308 | // // 3 Para cada articlo lo Creamos |
| 5309 | // String codigo_barra = c | 5309 | // String codigo_barra = c |
| 5310 | // .getString(c | 5310 | // .getString(c |
| 5311 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)); | 5311 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)); |
| 5312 | // ArticuloVisible articulo = new ArticuloVisible( | 5312 | // ArticuloVisible articulo = new ArticuloVisible( |
| 5313 | // c.getInt(c | 5313 | // c.getInt(c |
| 5314 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), | 5314 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), |
| 5315 | // c.getInt(c | 5315 | // c.getInt(c |
| 5316 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), | 5316 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), |
| 5317 | // c.getInt(c | 5317 | // c.getInt(c |
| 5318 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), | 5318 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), |
| 5319 | // c.getInt(c | 5319 | // c.getInt(c |
| 5320 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), | 5320 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), |
| 5321 | // new ArrayList<String>(Arrays.asList(codigo_barra | 5321 | // new ArrayList<String>(Arrays.asList(codigo_barra |
| 5322 | // .split(","))), | 5322 | // .split(","))), |
| 5323 | // new ArrayList<String>(Arrays.asList(codigo_barra | 5323 | // new ArrayList<String>(Arrays.asList(codigo_barra |
| 5324 | // .split(","))), | 5324 | // .split(","))), |
| 5325 | // c.getInt(c | 5325 | // c.getInt(c |
| 5326 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), | 5326 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), |
| 5327 | // c.getString(c | 5327 | // c.getString(c |
| 5328 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), | 5328 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), |
| 5329 | // c.getDouble(c | 5329 | // c.getDouble(c |
| 5330 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), | 5330 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), |
| 5331 | // c.getDouble(c | 5331 | // c.getDouble(c |
| 5332 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), | 5332 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), |
| 5333 | // c.getString(c | 5333 | // c.getString(c |
| 5334 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), | 5334 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), |
| 5335 | // c.getFloat(c | 5335 | // c.getFloat(c |
| 5336 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), | 5336 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), |
| 5337 | // c.getFloat(c | 5337 | // c.getFloat(c |
| 5338 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), | 5338 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), |
| 5339 | // c.getInt(c | 5339 | // c.getInt(c |
| 5340 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), | 5340 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), |
| 5341 | // c.getInt(c | 5341 | // c.getInt(c |
| 5342 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), | 5342 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), |
| 5343 | // c.getInt(c | 5343 | // c.getInt(c |
| 5344 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), | 5344 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), |
| 5345 | // c.getString(c | 5345 | // c.getString(c |
| 5346 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); | 5346 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); |
| 5347 | // // 4 Lo agregamos a la lista de resultados | 5347 | // // 4 Lo agregamos a la lista de resultados |
| 5348 | // contador = contador + 1; | 5348 | // contador = contador + 1; |
| 5349 | //// if(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito))==0){ | 5349 | //// if(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito))==0){ |
| 5350 | ////// c.moveToNext(); | 5350 | ////// c.moveToNext(); |
| 5351 | //// System.out.println(":::: No quiero q haga nada"); | 5351 | //// System.out.println(":::: No quiero q haga nada"); |
| 5352 | //// }else{ | 5352 | //// }else{ |
| 5353 | //// result.add(articulo); | 5353 | //// result.add(articulo); |
| 5354 | //// c.moveToNext(); } | 5354 | //// c.moveToNext(); } |
| 5355 | // result.add(articulo); | 5355 | // result.add(articulo); |
| 5356 | // c.moveToNext(); | 5356 | // c.moveToNext(); |
| 5357 | // } | 5357 | // } |
| 5358 | // } | 5358 | // } |
| 5359 | // | 5359 | // |
| 5360 | // // 5 Cerramos la BD | 5360 | // // 5 Cerramos la BD |
| 5361 | // dtb.close(); | 5361 | // dtb.close(); |
| 5362 | // return result; | 5362 | // return result; |
| 5363 | // | 5363 | // |
| 5364 | // } catch (Exception e) { | 5364 | // } catch (Exception e) { |
| 5365 | // | 5365 | // |
| 5366 | // GestorLogEventos log = new GestorLogEventos(); | 5366 | // GestorLogEventos log = new GestorLogEventos(); |
| 5367 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5367 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5368 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5368 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5369 | // log.log("[-- 2490 --]" + e.toString(), 4); | 5369 | // log.log("[-- 2490 --]" + e.toString(), 4); |
| 5370 | // | 5370 | // |
| 5371 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5371 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5372 | // "Imposible obtener los ARTICULOS del INVENTARIO n" | 5372 | // "Imposible obtener los ARTICULOS del INVENTARIO n" |
| 5373 | // + numero_inventario); | 5373 | // + numero_inventario); |
| 5374 | // } | 5374 | // } |
| 5375 | // | 5375 | // |
| 5376 | // } | 5376 | // } |
| 5377 | // | 5377 | // |
| 5378 | // /** | 5378 | // /** |
| 5379 | // * Obtiene la lista de los pares (sector,codigo) de todos los ARTICULOS en | 5379 | // * Obtiene la lista de los pares (sector,codigo) de todos los ARTICULOS en |
| 5380 | // * curso que se encuentran en la base | 5380 | // * curso que se encuentran en la base |
| 5381 | // * <p> | 5381 | // * <p> |
| 5382 | // * 1 Abrimos la base de datos en modo lectura | 5382 | // * 1 Abrimos la base de datos en modo lectura |
| 5383 | // * <p> | 5383 | // * <p> |
| 5384 | // * 2 Ejecutamos la busqueda | 5384 | // * 2 Ejecutamos la busqueda |
| 5385 | // * <p> | 5385 | // * <p> |
| 5386 | // * 3 Para cada articulo encontrado generamos la combinacion de sector y | 5386 | // * 3 Para cada articulo encontrado generamos la combinacion de sector y |
| 5387 | // * codigo | 5387 | // * codigo |
| 5388 | // * <p> | 5388 | // * <p> |
| 5389 | // * 4 Cierre | 5389 | // * 4 Cierre |
| 5390 | // * | 5390 | // * |
| 5391 | // * @return Lista de los pares de codigos de cada articulo {sector ; codigo} | 5391 | // * @return Lista de los pares de codigos de cada articulo {sector ; codigo} |
| 5392 | // * @throws ExceptionBDD | 5392 | // * @throws ExceptionBDD |
| 5393 | // */ | 5393 | // */ |
| 5394 | // public ArrayList<HashMap<String, Integer>> selectArticulosCodigosEnBdd() | 5394 | // public ArrayList<HashMap<String, Integer>> selectArticulosCodigosEnBdd() |
| 5395 | // throws ExceptionBDD { | 5395 | // throws ExceptionBDD { |
| 5396 | // System.out.println("::: BaseDatos 3452 "); | 5396 | // System.out.println("::: BaseDatos 3452 "); |
| 5397 | // try { | 5397 | // try { |
| 5398 | // // Variable de respuesta: | 5398 | // // Variable de respuesta: |
| 5399 | // ArrayList<HashMap<String, Integer>> result = new ArrayList<HashMap<String, Integer>>(); | 5399 | // ArrayList<HashMap<String, Integer>> result = new ArrayList<HashMap<String, Integer>>(); |
| 5400 | // | 5400 | // |
| 5401 | // // 1 Abrimos la base de datos en modo lectura | 5401 | // // 1 Abrimos la base de datos en modo lectura |
| 5402 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5402 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5403 | // | 5403 | // |
| 5404 | // // Request: | 5404 | // // Request: |
| 5405 | // String[] cols = new String[] { | 5405 | // String[] cols = new String[] { |
| 5406 | // ParametrosInventario.bal_bdd_articulo_sector, | 5406 | // ParametrosInventario.bal_bdd_articulo_sector, |
| 5407 | // ParametrosInventario.bal_bdd_articulo_codigo }; | 5407 | // ParametrosInventario.bal_bdd_articulo_codigo }; |
| 5408 | // // 2 Ejecutamos la busqueda | 5408 | // // 2 Ejecutamos la busqueda |
| 5409 | // Cursor c = dtb.query(tabla_articulos_nombre, cols, null, null, | 5409 | // Cursor c = dtb.query(tabla_articulos_nombre, cols, null, null, |
| 5410 | // null, null, null); | 5410 | // null, null, null); |
| 5411 | // | 5411 | // |
| 5412 | // // Result: | 5412 | // // Result: |
| 5413 | // if (c.moveToFirst()) { | 5413 | // if (c.moveToFirst()) { |
| 5414 | // while (c.isAfterLast() == false) { | 5414 | // while (c.isAfterLast() == false) { |
| 5415 | // // 3 Para cada articulo encontrado generamos la combinacion | 5415 | // // 3 Para cada articulo encontrado generamos la combinacion |
| 5416 | // // de sector y codigo | 5416 | // // de sector y codigo |
| 5417 | // HashMap<String, Integer> hashmapArticulo = new HashMap<String, Integer>(); | 5417 | // HashMap<String, Integer> hashmapArticulo = new HashMap<String, Integer>(); |
| 5418 | // hashmapArticulo | 5418 | // hashmapArticulo |
| 5419 | // .put(ParametrosInventario.bal_bdd_articulo_sector, | 5419 | // .put(ParametrosInventario.bal_bdd_articulo_sector, |
| 5420 | // c.getInt(c | 5420 | // c.getInt(c |
| 5421 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector))); | 5421 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector))); |
| 5422 | // hashmapArticulo | 5422 | // hashmapArticulo |
| 5423 | // .put(ParametrosInventario.bal_bdd_articulo_codigo, | 5423 | // .put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 5424 | // c.getInt(c | 5424 | // c.getInt(c |
| 5425 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo))); | 5425 | // .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo))); |
| 5426 | // result.add(hashmapArticulo); | 5426 | // result.add(hashmapArticulo); |
| 5427 | // c.moveToNext(); | 5427 | // c.moveToNext(); |
| 5428 | // } | 5428 | // } |
| 5429 | // } else { | 5429 | // } else { |
| 5430 | // result = null; | 5430 | // result = null; |
| 5431 | // } | 5431 | // } |
| 5432 | // // 4 Cierre: | 5432 | // // 4 Cierre: |
| 5433 | // dtb.close(); | 5433 | // dtb.close(); |
| 5434 | // return result; | 5434 | // return result; |
| 5435 | // } catch (Exception e) { | 5435 | // } catch (Exception e) { |
| 5436 | // GestorLogEventos log = new GestorLogEventos(); | 5436 | // GestorLogEventos log = new GestorLogEventos(); |
| 5437 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5437 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5438 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5438 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5439 | // log.log("[-- 2563 --]" + e.toString(), 4); | 5439 | // log.log("[-- 2563 --]" + e.toString(), 4); |
| 5440 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5440 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5441 | // "Imposible inventariar todos los ARTICULOS de la Base De Datos"); | 5441 | // "Imposible inventariar todos los ARTICULOS de la Base De Datos"); |
| 5442 | // } | 5442 | // } |
| 5443 | // } | 5443 | // } |
| 5444 | // | 5444 | // |
| 5445 | // /** | 5445 | // /** |
| 5446 | // * Obtiene la lista de los codigos de todos los ARTICULOS que pertenecen a | 5446 | // * Obtiene la lista de los codigos de todos los ARTICULOS que pertenecen a |
| 5447 | // * un INVENTARIO en particular | 5447 | // * un INVENTARIO en particular |
| 5448 | // * <p> | 5448 | // * <p> |
| 5449 | // * 1 Abrimos la base de datos en modo lectura | 5449 | // * 1 Abrimos la base de datos en modo lectura |
| 5450 | // * <p> | 5450 | // * <p> |
| 5451 | // * 2 Sacamos todos los ARTICULOS que tienen el dicho numero de INVENTARIO | 5451 | // * 2 Sacamos todos los ARTICULOS que tienen el dicho numero de INVENTARIO |
| 5452 | // * <p> | 5452 | // * <p> |
| 5453 | // * 3 Combinamos el sector y el codigo bajo formato: [sector]-[codigo] | 5453 | // * 3 Combinamos el sector y el codigo bajo formato: [sector]-[codigo] |
| 5454 | // * <p> | 5454 | // * <p> |
| 5455 | // * 4 Agregamos el hashmap a la lista | 5455 | // * 4 Agregamos el hashmap a la lista |
| 5456 | // * <p> | 5456 | // * <p> |
| 5457 | // * 5 Cerramos la BD | 5457 | // * 5 Cerramos la BD |
| 5458 | // * | 5458 | // * |
| 5459 | // * @param numero_inventario | 5459 | // * @param numero_inventario |
| 5460 | // * @return ArrayList<(sector,codigo)> con cada respuesta bajo forma | 5460 | // * @return ArrayList<(sector,codigo)> con cada respuesta bajo forma |
| 5461 | // * [sector]-[codigo] en String | 5461 | // * [sector]-[codigo] en String |
| 5462 | // * @throws ExceptionBDD | 5462 | // * @throws ExceptionBDD |
| 5463 | // */ | 5463 | // */ |
| 5464 | // public ArrayList<HashMap<String, Integer>> selectArticulosCodigosConNumeroInventario( | 5464 | // public ArrayList<HashMap<String, Integer>> selectArticulosCodigosConNumeroInventario( |
| 5465 | // int numero_inventario) throws ExceptionBDD { | 5465 | // int numero_inventario) throws ExceptionBDD { |
| 5466 | // System.out.println("::: BaseDatos 3527"); | 5466 | // System.out.println("::: BaseDatos 3527"); |
| 5467 | // try { | 5467 | // try { |
| 5468 | // // Variable de retorno: | 5468 | // // Variable de retorno: |
| 5469 | // ArrayList<HashMap<String, Integer>> result = new ArrayList<HashMap<String, Integer>>(); | 5469 | // ArrayList<HashMap<String, Integer>> result = new ArrayList<HashMap<String, Integer>>(); |
| 5470 | // // 1 Abrimos la base de datos en modo lectura | 5470 | // // 1 Abrimos la base de datos en modo lectura |
| 5471 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5471 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5472 | // // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de | 5472 | // // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de |
| 5473 | // // INVENTARIO: | 5473 | // // INVENTARIO: |
| 5474 | // String[] cols = new String[] { | 5474 | // String[] cols = new String[] { |
| 5475 | // ParametrosInventario.bal_bdd_articulo_sector, | 5475 | // ParametrosInventario.bal_bdd_articulo_sector, |
| 5476 | // ParametrosInventario.bal_bdd_articulo_codigo }; | 5476 | // ParametrosInventario.bal_bdd_articulo_codigo }; |
| 5477 | // String[] args = new String[] { String.valueOf(numero_inventario) }; | 5477 | // String[] args = new String[] { String.valueOf(numero_inventario) }; |
| 5478 | // Cursor c = dtb.query(tabla_articulos_nombre, cols, | 5478 | // Cursor c = dtb.query(tabla_articulos_nombre, cols, |
| 5479 | // ParametrosInventario.bal_bdd_articulo_inventario + "=?", | 5479 | // ParametrosInventario.bal_bdd_articulo_inventario + "=?", |
| 5480 | // args, null, null, null); | 5480 | // args, null, null, null); |
| 5481 | // // 3 Combinamos el sector y el codigo bajo formato: | 5481 | // // 3 Combinamos el sector y el codigo bajo formato: |
| 5482 | // // [sector]-[codigo] | 5482 | // // [sector]-[codigo] |
| 5483 | // if (c.moveToFirst()) { | 5483 | // if (c.moveToFirst()) { |
| 5484 | // while (c.isAfterLast() == false) { | 5484 | // while (c.isAfterLast() == false) { |
| 5485 | // HashMap<String, Integer> hashmapArticulo = new HashMap<String, Integer>(); | 5485 | // HashMap<String, Integer> hashmapArticulo = new HashMap<String, Integer>(); |
| 5486 | // hashmapArticulo.put( | 5486 | // hashmapArticulo.put( |
| 5487 | // ParametrosInventario.bal_bdd_articulo_sector, | 5487 | // ParametrosInventario.bal_bdd_articulo_sector, |
| 5488 | // c.getInt(0)); | 5488 | // c.getInt(0)); |
| 5489 | // hashmapArticulo.put( | 5489 | // hashmapArticulo.put( |
| 5490 | // ParametrosInventario.bal_bdd_articulo_codigo, | 5490 | // ParametrosInventario.bal_bdd_articulo_codigo, |
| 5491 | // c.getInt(1)); | 5491 | // c.getInt(1)); |
| 5492 | // // 4 Agregamos el hashmap a la lista | 5492 | // // 4 Agregamos el hashmap a la lista |
| 5493 | // result.add(hashmapArticulo); | 5493 | // result.add(hashmapArticulo); |
| 5494 | // c.moveToNext(); | 5494 | // c.moveToNext(); |
| 5495 | // } | 5495 | // } |
| 5496 | // } | 5496 | // } |
| 5497 | // // 5 Cerramos la BD | 5497 | // // 5 Cerramos la BD |
| 5498 | // dtb.close(); | 5498 | // dtb.close(); |
| 5499 | // return result; | 5499 | // return result; |
| 5500 | // } catch (Exception e) { | 5500 | // } catch (Exception e) { |
| 5501 | // GestorLogEventos log = new GestorLogEventos(); | 5501 | // GestorLogEventos log = new GestorLogEventos(); |
| 5502 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5502 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5503 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5503 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5504 | // log.log("[-- 2634 --]" + e.toString(), 4); | 5504 | // log.log("[-- 2634 --]" + e.toString(), 4); |
| 5505 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5505 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5506 | // "Imposible obtener los articulos del inventario n" | 5506 | // "Imposible obtener los articulos del inventario n" |
| 5507 | // + numero_inventario); | 5507 | // + numero_inventario); |
| 5508 | // } | 5508 | // } |
| 5509 | // | 5509 | // |
| 5510 | // } | 5510 | // } |
| 5511 | // | 5511 | // |
| 5512 | // /** | 5512 | // /** |
| 5513 | // * Calcula cuantos articulos contiene cada inventario, los que ya han sido | 5513 | // * Calcula cuantos articulos contiene cada inventario, los que ya han sido |
| 5514 | // * contado y los que queda por contar | 5514 | // * contado y los que queda por contar |
| 5515 | // * <p> | 5515 | // * <p> |
| 5516 | // * 1 Abrimos la base de datos en modo lectura | 5516 | // * 1 Abrimos la base de datos en modo lectura |
| 5517 | // * <p> | 5517 | // * <p> |
| 5518 | // * 2 Clculo de cuantos articulos no han sido inventariado en este | 5518 | // * 2 Clculo de cuantos articulos no han sido inventariado en este |
| 5519 | // * inventario | 5519 | // * inventario |
| 5520 | // * <p> | 5520 | // * <p> |
| 5521 | // * 3 Clculo de todos los articulos que inventariar | 5521 | // * 3 Clculo de todos los articulos que inventariar |
| 5522 | // * <p> | 5522 | // * <p> |
| 5523 | // * 4 Construccin del ArrayList de resultado | 5523 | // * 4 Construccin del ArrayList de resultado |
| 5524 | // * <p> | 5524 | // * <p> |
| 5525 | // * 5 Cerramos la BD | 5525 | // * 5 Cerramos la BD |
| 5526 | // * | 5526 | // * |
| 5527 | // * @param numero_inventario | 5527 | // * @param numero_inventario |
| 5528 | // * Numero del inventario | 5528 | // * Numero del inventario |
| 5529 | // * @return ArrayList<Integer> segn el esquema: [narticulos en el | 5529 | // * @return ArrayList<Integer> segn el esquema: [narticulos en el |
| 5530 | // * inventario ; narticulos ya contados ; n articulos faltantes] | 5530 | // * inventario ; narticulos ya contados ; n articulos faltantes] |
| 5531 | // * @throws ExceptionBDD | 5531 | // * @throws ExceptionBDD |
| 5532 | // * En caso de fracaso | 5532 | // * En caso de fracaso |
| 5533 | // */ | 5533 | // */ |
| 5534 | // public ArrayList<Integer> selectEstadisticasConIdInventario( | 5534 | // public ArrayList<Integer> selectEstadisticasConIdInventario( |
| 5535 | // int numero_inventario) throws ExceptionBDD { | 5535 | // int numero_inventario) throws ExceptionBDD { |
| 5536 | // System.out.println("::: BaseDatos 3604"); | 5536 | // System.out.println("::: BaseDatos 3604"); |
| 5537 | // try { | 5537 | // try { |
| 5538 | // // Variable de retorno: | 5538 | // // Variable de retorno: |
| 5539 | // ArrayList<Integer> result = new ArrayList<Integer>(); | 5539 | // ArrayList<Integer> result = new ArrayList<Integer>(); |
| 5540 | // | 5540 | // |
| 5541 | // // 1 Abrimos la base de datos en modo lectura | 5541 | // // 1 Abrimos la base de datos en modo lectura |
| 5542 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5542 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5543 | // | 5543 | // |
| 5544 | // // 2 Clculo de cuantos articulos no han sido inventariado en este | 5544 | // // 2 Clculo de cuantos articulos no han sido inventariado en este |
| 5545 | // // inventario: | 5545 | // // inventario: |
| 5546 | // // (Se admite que un articulo que todavia no ha sido inventariado | 5546 | // // (Se admite que un articulo que todavia no ha sido inventariado |
| 5547 | // // tiene una cantidad de -1) | 5547 | // // tiene una cantidad de -1) |
| 5548 | // String consultaArticulosSinContar = "SELECT COUNT(*) " + "FROM " | 5548 | // String consultaArticulosSinContar = "SELECT COUNT(*) " + "FROM " |
| 5549 | // + tabla_articulos_nombre + " " + "WHERE " | 5549 | // + tabla_articulos_nombre + " " + "WHERE " |
| 5550 | // + ParametrosInventario.bal_bdd_articulo_cantidad + "<0 " | 5550 | // + ParametrosInventario.bal_bdd_articulo_cantidad + "<0 " |
| 5551 | // + "AND " + ParametrosInventario.bal_bdd_articulo_inventario | 5551 | // + "AND " + ParametrosInventario.bal_bdd_articulo_inventario |
| 5552 | // + "=" + numero_inventario + " "; | 5552 | // + "=" + numero_inventario + " "; |
| 5553 | // | 5553 | // |
| 5554 | // Cursor c1 = dtb.rawQuery(consultaArticulosSinContar, null); | 5554 | // Cursor c1 = dtb.rawQuery(consultaArticulosSinContar, null); |
| 5555 | // | 5555 | // |
| 5556 | // int articulosNonInventariados = 0; | 5556 | // int articulosNonInventariados = 0; |
| 5557 | // if (c1.moveToFirst()) { | 5557 | // if (c1.moveToFirst()) { |
| 5558 | // articulosNonInventariados = c1.getInt(0); | 5558 | // articulosNonInventariados = c1.getInt(0); |
| 5559 | // } | 5559 | // } |
| 5560 | // | 5560 | // |
| 5561 | // // 3 Clculo de todos los articulos que inventariar: | 5561 | // // 3 Clculo de todos los articulos que inventariar: |
| 5562 | // String consultaTodosArticulosInventario = "SELECT COUNT(*) " | 5562 | // String consultaTodosArticulosInventario = "SELECT COUNT(*) " |
| 5563 | // + "FROM " + tabla_articulos_nombre + " " + "WHERE " | 5563 | // + "FROM " + tabla_articulos_nombre + " " + "WHERE " |
| 5564 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 5564 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 5565 | // + numero_inventario + " "; | 5565 | // + numero_inventario + " "; |
| 5566 | // | 5566 | // |
| 5567 | // Cursor c2 = dtb.rawQuery(consultaTodosArticulosInventario, null); | 5567 | // Cursor c2 = dtb.rawQuery(consultaTodosArticulosInventario, null); |
| 5568 | // | 5568 | // |
| 5569 | // int articulosTotalesQueInventariar = 0; | 5569 | // int articulosTotalesQueInventariar = 0; |
| 5570 | // if (c2.moveToFirst()) { | 5570 | // if (c2.moveToFirst()) { |
| 5571 | // articulosTotalesQueInventariar = c2.getInt(0); | 5571 | // articulosTotalesQueInventariar = c2.getInt(0); |
| 5572 | // } | 5572 | // } |
| 5573 | // | 5573 | // |
| 5574 | // // 4 Construccin del ArrayList de resultado: | 5574 | // // 4 Construccin del ArrayList de resultado: |
| 5575 | // result.add(articulosTotalesQueInventariar); | 5575 | // result.add(articulosTotalesQueInventariar); |
| 5576 | // result.add(articulosTotalesQueInventariar | 5576 | // result.add(articulosTotalesQueInventariar |
| 5577 | // - articulosNonInventariados); | 5577 | // - articulosNonInventariados); |
| 5578 | // result.add(articulosNonInventariados); | 5578 | // result.add(articulosNonInventariados); |
| 5579 | // | 5579 | // |
| 5580 | // // 5 Cerramos la BD | 5580 | // // 5 Cerramos la BD |
| 5581 | // dtb.close(); | 5581 | // dtb.close(); |
| 5582 | // | 5582 | // |
| 5583 | // return result; | 5583 | // return result; |
| 5584 | // } catch (Exception e) { | 5584 | // } catch (Exception e) { |
| 5585 | // | 5585 | // |
| 5586 | // GestorLogEventos log = new GestorLogEventos(); | 5586 | // GestorLogEventos log = new GestorLogEventos(); |
| 5587 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5587 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5588 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5588 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5589 | // log.log("[-- 2719 --]" + e.toString(), 4); | 5589 | // log.log("[-- 2719 --]" + e.toString(), 4); |
| 5590 | // | 5590 | // |
| 5591 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5591 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5592 | // "Generacion de las estadisticas imposible"); | 5592 | // "Generacion de las estadisticas imposible"); |
| 5593 | // } | 5593 | // } |
| 5594 | // | 5594 | // |
| 5595 | // } | 5595 | // } |
| 5596 | // | 5596 | // |
| 5597 | // /** | 5597 | // /** |
| 5598 | // * Recupera el objeto INVENTARIO con el numero del mismo | 5598 | // * Recupera el objeto INVENTARIO con el numero del mismo |
| 5599 | // * <p> | 5599 | // * <p> |
| 5600 | // * 1 Abrimos la base de datos en modo lectura | 5600 | // * 1 Abrimos la base de datos en modo lectura |
| 5601 | // * <p> | 5601 | // * <p> |
| 5602 | // * 2 Busqueda en la base | 5602 | // * 2 Busqueda en la base |
| 5603 | // * <p> | 5603 | // * <p> |
| 5604 | // * 3 Recorremos el resultado (que debe ser unico normalmente) y creamos el | 5604 | // * 3 Recorremos el resultado (que debe ser unico normalmente) y creamos el |
| 5605 | // * Inventario | 5605 | // * Inventario |
| 5606 | // * <p> | 5606 | // * <p> |
| 5607 | // * 4 Cerramos la BD | 5607 | // * 4 Cerramos la BD |
| 5608 | // * | 5608 | // * |
| 5609 | // * @return INVENTARIO | 5609 | // * @return INVENTARIO |
| 5610 | // * @throws ExceptionBDD | 5610 | // * @throws ExceptionBDD |
| 5611 | // */ | 5611 | // */ |
| 5612 | // public Inventario selectInventarioConNumero(int inventario_num) | 5612 | // public Inventario selectInventarioConNumero(int inventario_num) |
| 5613 | // throws ExceptionBDD { | 5613 | // throws ExceptionBDD { |
| 5614 | // System.out.println("::: BaseDatos 3395 Selecciona inventario con numero"); | 5614 | // System.out.println("::: BaseDatos 3395 Selecciona inventario con numero"); |
| 5615 | // try { | 5615 | // try { |
| 5616 | // // Salida: | 5616 | // // Salida: |
| 5617 | // Inventario inventario = null; | 5617 | // Inventario inventario = null; |
| 5618 | // | 5618 | // |
| 5619 | // // 1 Abrimos la base de datos en modo lectura: | 5619 | // // 1 Abrimos la base de datos en modo lectura: |
| 5620 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5620 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5621 | // /* String name = null; | 5621 | // /* String name = null; |
| 5622 | // Cursor c = null; | 5622 | // Cursor c = null; |
| 5623 | // c = dtb.rawQuery("select name from person where id="+id, null); | 5623 | // c = dtb.rawQuery("select name from person where id="+id, null); |
| 5624 | // c.moveToFirst(); | 5624 | // c.moveToFirst(); |
| 5625 | // name = c.getString(c.getColumnIndex("name")); | 5625 | // name = c.getString(c.getColumnIndex("name")); |
| 5626 | // c.close(); | 5626 | // c.close(); |
| 5627 | //*/System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>> "+ inventario_num); | 5627 | //*/System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>> "+ inventario_num); |
| 5628 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); | 5628 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); |
| 5629 | // // 2 Busqueda en la base: | 5629 | // // 2 Busqueda en la base: |
| 5630 | // String[] args = new String[] { String.valueOf(inventario_num) }; | 5630 | // String[] args = new String[] { String.valueOf(inventario_num) }; |
| 5631 | // System.out.println("::: BaseDatos 3579 "); | 5631 | // System.out.println("::: BaseDatos 3579 "); |
| 5632 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, | 5632 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 5633 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 5633 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 5634 | // args, null, null, null); | 5634 | // args, null, null, null); |
| 5635 | // System.out.println("::: BaseDatos 3583 " + c); | 5635 | // System.out.println("::: BaseDatos 3583 " + c); |
| 5636 | // // Nos aseguramos de que existe al menos un registro | 5636 | // // Nos aseguramos de que existe al menos un registro |
| 5637 | // if (c.moveToFirst()) { | 5637 | // if (c.moveToFirst()) { |
| 5638 | // // 3 Recorremos el resultado (que debe ser unico normalmente) y | 5638 | // // 3 Recorremos el resultado (que debe ser unico normalmente) y |
| 5639 | // // creamos el Inventario | 5639 | // // creamos el Inventario |
| 5640 | // System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); | 5640 | // System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); |
| 5641 | // inventario = new Inventario( | 5641 | // inventario = new Inventario( |
| 5642 | // c.getInt(c | 5642 | // c.getInt(c |
| 5643 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 5643 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 5644 | // c.getString(c | 5644 | // c.getString(c |
| 5645 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), | 5645 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), |
| 5646 | // c.getString(c | 5646 | // c.getString(c |
| 5647 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), | 5647 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), |
| 5648 | // c.getString(c | 5648 | // c.getString(c |
| 5649 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), | 5649 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), |
| 5650 | // c.getInt(c | 5650 | // c.getInt(c |
| 5651 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), | 5651 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), |
| 5652 | // c.getInt(c | 5652 | // c.getInt(c |
| 5653 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); | 5653 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); |
| 5654 | // System.out.println("::: BaseDatos 3519 Listo"); | 5654 | // System.out.println("::: BaseDatos 3519 Listo"); |
| 5655 | // } else { | 5655 | // } else { |
| 5656 | // inventario = null; | 5656 | // inventario = null; |
| 5657 | // } | 5657 | // } |
| 5658 | // | 5658 | // |
| 5659 | // // 4 Cerramos la BD | 5659 | // // 4 Cerramos la BD |
| 5660 | // dtb.close(); | 5660 | // dtb.close(); |
| 5661 | // return inventario; | 5661 | // return inventario; |
| 5662 | // } catch (Exception e) { | 5662 | // } catch (Exception e) { |
| 5663 | // | 5663 | // |
| 5664 | // GestorLogEventos log = new GestorLogEventos(); | 5664 | // GestorLogEventos log = new GestorLogEventos(); |
| 5665 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5665 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5666 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5666 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5667 | // log.log("[-- 2787 --]" + e.toString(), 4); | 5667 | // log.log("[-- 2787 --]" + e.toString(), 4); |
| 5668 | // | 5668 | // |
| 5669 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5669 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5670 | // "Imposible recuperar el INVENTARIO cuyo numero es: " | 5670 | // "Imposible recuperar el INVENTARIO cuyo numero es: " |
| 5671 | // + inventario_num); | 5671 | // + inventario_num); |
| 5672 | // } | 5672 | // } |
| 5673 | // } | 5673 | // } |
| 5674 | // public Inventario selectInventarioConNumeroCompra(int inventario_num) | 5674 | // public Inventario selectInventarioConNumeroCompra(int inventario_num) |
| 5675 | // throws ExceptionBDD { | 5675 | // throws ExceptionBDD { |
| 5676 | // System.out.println("::: BaseDatos 3395 Selecciona inventario con numero"); | 5676 | // System.out.println("::: BaseDatos 3395 Selecciona inventario con numero"); |
| 5677 | // try { | 5677 | // try { |
| 5678 | // // Salida: | 5678 | // // Salida: |
| 5679 | // Inventario inventario = null; | 5679 | // Inventario inventario = null; |
| 5680 | // | 5680 | // |
| 5681 | // // 1 Abrimos la base de datos en modo lectura: | 5681 | // // 1 Abrimos la base de datos en modo lectura: |
| 5682 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5682 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5683 | // /* String name = null; | 5683 | // /* String name = null; |
| 5684 | // Cursor c = null; | 5684 | // Cursor c = null; |
| 5685 | // c = dtb.rawQuery("select name from person where id="+id, null); | 5685 | // c = dtb.rawQuery("select name from person where id="+id, null); |
| 5686 | // c.moveToFirst(); | 5686 | // c.moveToFirst(); |
| 5687 | // name = c.getString(c.getColumnIndex("name")); | 5687 | // name = c.getString(c.getColumnIndex("name")); |
| 5688 | // c.close(); | 5688 | // c.close(); |
| 5689 | //*/ | 5689 | //*/ |
| 5690 | // System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>> "+ inventario_num); | 5690 | // System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>> "+ inventario_num); |
| 5691 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); | 5691 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); |
| 5692 | // // 2 Busqueda en la base: | 5692 | // // 2 Busqueda en la base: |
| 5693 | // String[] args = new String[] { String.valueOf(inventario_num) }; | 5693 | // String[] args = new String[] { String.valueOf(inventario_num) }; |
| 5694 | // System.out.println("::: BaseDatos 3579 "); | 5694 | // System.out.println("::: BaseDatos 3579 "); |
| 5695 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, | 5695 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 5696 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 5696 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 5697 | // args, null, null, null); | 5697 | // args, null, null, null); |
| 5698 | // System.out.println("::: BaseDatos 3583 " + c); | 5698 | // System.out.println("::: BaseDatos 3583 " + c); |
| 5699 | // // Nos aseguramos de que existe al menos un registro | 5699 | // // Nos aseguramos de que existe al menos un registro |
| 5700 | // if (c.moveToFirst()) { | 5700 | // if (c.moveToFirst()) { |
| 5701 | // // 3 Recorremos el resultado (que debe ser unico normalmente) y | 5701 | // // 3 Recorremos el resultado (que debe ser unico normalmente) y |
| 5702 | // // creamos el Inventario | 5702 | // // creamos el Inventario |
| 5703 | // System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); | 5703 | // System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); |
| 5704 | // inventario = new Inventario( | 5704 | // inventario = new Inventario( |
| 5705 | // c.getInt(c | 5705 | // c.getInt(c |
| 5706 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 5706 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 5707 | // c.getString(c | 5707 | // c.getString(c |
| 5708 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), | 5708 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), |
| 5709 | // c.getString(c | 5709 | // c.getString(c |
| 5710 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), | 5710 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), |
| 5711 | // c.getString(c | 5711 | // c.getString(c |
| 5712 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), | 5712 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), |
| 5713 | // c.getInt(c | 5713 | // c.getInt(c |
| 5714 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), | 5714 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), |
| 5715 | // c.getInt(c | 5715 | // c.getInt(c |
| 5716 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); | 5716 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); |
| 5717 | // System.out.println("::: BaseDatos 3519 Listo"); | 5717 | // System.out.println("::: BaseDatos 3519 Listo"); |
| 5718 | // } else { | 5718 | // } else { |
| 5719 | // inventario = null; | 5719 | // inventario = null; |
| 5720 | // } | 5720 | // } |
| 5721 | // | 5721 | // |
| 5722 | // // 4 Cerramos la BD | 5722 | // // 4 Cerramos la BD |
| 5723 | // dtb.close(); | 5723 | // dtb.close(); |
| 5724 | // return inventario; | 5724 | // return inventario; |
| 5725 | // } catch (Exception e) { | 5725 | // } catch (Exception e) { |
| 5726 | // | 5726 | // |
| 5727 | // GestorLogEventos log = new GestorLogEventos(); | 5727 | // GestorLogEventos log = new GestorLogEventos(); |
| 5728 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5728 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5729 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5729 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5730 | // log.log("[-- 2787 --]" + e.toString(), 4); | 5730 | // log.log("[-- 2787 --]" + e.toString(), 4); |
| 5731 | // | 5731 | // |
| 5732 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5732 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5733 | // "Imposible recuperar el INVENTARIO cuyo numero es: " | 5733 | // "Imposible recuperar el INVENTARIO cuyo numero es: " |
| 5734 | // + inventario_num); | 5734 | // + inventario_num); |
| 5735 | // } | 5735 | // } |
| 5736 | // } | 5736 | // } |
| 5737 | // public Inventario selectInventarioConNumeroParametro(int inventario_num, int productos_conta) | 5737 | // public Inventario selectInventarioConNumeroParametro(int inventario_num, int productos_conta) |
| 5738 | // throws ExceptionBDD { | 5738 | // throws ExceptionBDD { |
| 5739 | // System.out.println("::: BaseDatos 3622 Selecciona inventario con numero y parametro"); | 5739 | // System.out.println("::: BaseDatos 3622 Selecciona inventario con numero y parametro"); |
| 5740 | // try { | 5740 | // try { |
| 5741 | // System.out.println("////////////////////////////////////////////////////////////////////"); | 5741 | // System.out.println("////////////////////////////////////////////////////////////////////"); |
| 5742 | // System.out.println("Productos conta "+ productos_conta ); | 5742 | // System.out.println("Productos conta "+ productos_conta ); |
| 5743 | // // Salida: | 5743 | // // Salida: |
| 5744 | // Inventario inventario = null; | 5744 | // Inventario inventario = null; |
| 5745 | // | 5745 | // |
| 5746 | // // 1 Abrimos la base de datos en modo lectura: | 5746 | // // 1 Abrimos la base de datos en modo lectura: |
| 5747 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5747 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5748 | // System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>>"); | 5748 | // System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>>"); |
| 5749 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); | 5749 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); |
| 5750 | // // 2 Busqueda en la base: | 5750 | // // 2 Busqueda en la base: |
| 5751 | // String[] args = new String[] { String.valueOf(inventario_num) }; | 5751 | // String[] args = new String[] { String.valueOf(inventario_num) }; |
| 5752 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, | 5752 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 5753 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 5753 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 5754 | // args, null, null, null); | 5754 | // args, null, null, null); |
| 5755 | // | 5755 | // |
| 5756 | // // Nos aseguramos de que existe al menos un registro | 5756 | // // Nos aseguramos de que existe al menos un registro |
| 5757 | // if (c.moveToFirst()) { | 5757 | // if (c.moveToFirst()) { |
| 5758 | // // 3 Recorremos el resultado (que debe ser unico normalmente) y | 5758 | // // 3 Recorremos el resultado (que debe ser unico normalmente) y |
| 5759 | // // creamos el Inventario | 5759 | // // creamos el Inventario |
| 5760 | // System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); | 5760 | // System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); |
| 5761 | // inventario = new Inventario( | 5761 | // inventario = new Inventario( |
| 5762 | // c.getInt(c | 5762 | // c.getInt(c |
| 5763 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 5763 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 5764 | // c.getString(c | 5764 | // c.getString(c |
| 5765 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), | 5765 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), |
| 5766 | // c.getString(c | 5766 | // c.getString(c |
| 5767 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), | 5767 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), |
| 5768 | // c.getString(c | 5768 | // c.getString(c |
| 5769 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), | 5769 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), |
| 5770 | // c.getInt(c | 5770 | // c.getInt(c |
| 5771 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), | 5771 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), |
| 5772 | // c.getInt(c | 5772 | // c.getInt(c |
| 5773 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); | 5773 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); |
| 5774 | // System.out.println("::: BaseDatos 3519 Listo"); | 5774 | // System.out.println("::: BaseDatos 3519 Listo"); |
| 5775 | // } else { | 5775 | // } else { |
| 5776 | // inventario = null; | 5776 | // inventario = null; |
| 5777 | // } | 5777 | // } |
| 5778 | // | 5778 | // |
| 5779 | // // 4 Cerramos la BD | 5779 | // // 4 Cerramos la BD |
| 5780 | // dtb.close(); | 5780 | // dtb.close(); |
| 5781 | // return inventario; | 5781 | // return inventario; |
| 5782 | // } catch (Exception e) { | 5782 | // } catch (Exception e) { |
| 5783 | // | 5783 | // |
| 5784 | // GestorLogEventos log = new GestorLogEventos(); | 5784 | // GestorLogEventos log = new GestorLogEventos(); |
| 5785 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5785 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5786 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5786 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5787 | // log.log("[-- 2787 --]" + e.toString(), 4); | 5787 | // log.log("[-- 2787 --]" + e.toString(), 4); |
| 5788 | // | 5788 | // |
| 5789 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 5789 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 5790 | // "Imposible recuperar el INVENTARIO cuyo numero es: " | 5790 | // "Imposible recuperar el INVENTARIO cuyo numero es: " |
| 5791 | // + inventario_num); | 5791 | // + inventario_num); |
| 5792 | // } | 5792 | // } |
| 5793 | // } | 5793 | // } |
| 5794 | // | 5794 | // |
| 5795 | // | 5795 | // |
| 5796 | // /** | 5796 | // /** |
| 5797 | // * Busca los inventarios en la bd | 5797 | // * Busca los inventarios en la bd |
| 5798 | // * <p> | 5798 | // * <p> |
| 5799 | // * 1 Abrimos la base de datos en modo lectura | 5799 | // * 1 Abrimos la base de datos en modo lectura |
| 5800 | // * <p> | 5800 | // * <p> |
| 5801 | // * 2 Buscamos todos los inventarios | 5801 | // * 2 Buscamos todos los inventarios |
| 5802 | // * <p> | 5802 | // * <p> |
| 5803 | // * 3 Genera el hashmap, uno por inventario | 5803 | // * 3 Genera el hashmap, uno por inventario |
| 5804 | // * <p> | 5804 | // * <p> |
| 5805 | // * 4 Agrega el hashmap en la entrada correspondiente a ese inventario | 5805 | // * 4 Agrega el hashmap en la entrada correspondiente a ese inventario |
| 5806 | // * <p> | 5806 | // * <p> |
| 5807 | // * 5 Cerramos conexiones | 5807 | // * 5 Cerramos conexiones |
| 5808 | // * | 5808 | // * |
| 5809 | // * @return un HashMap que guarda los inventarios por id de inventario | 5809 | // * @return un HashMap que guarda los inventarios por id de inventario |
| 5810 | // * @throws ExceptionBDD | 5810 | // * @throws ExceptionBDD |
| 5811 | // * si no encuentra inventarios | 5811 | // * si no encuentra inventarios |
| 5812 | // */ | 5812 | // */ |
| 5813 | // public HashMap<Integer, HashMap<String, String>> selectInventariosEnBdd() | 5813 | // public HashMap<Integer, HashMap<String, String>> selectInventariosEnBdd() |
| 5814 | // throws ExceptionBDD { | 5814 | // throws ExceptionBDD { |
| 5815 | // System.out.println("::: BaseDAtos Busca inventario con numero en la bdd"); | 5815 | // System.out.println("::: BaseDAtos Busca inventario con numero en la bdd"); |
| 5816 | // System.out.println("::: BaseDAtos 3772 selectInventariosEnBdd"); | 5816 | // System.out.println("::: BaseDAtos 3772 selectInventariosEnBdd"); |
| 5817 | // HashMap<Integer, HashMap<String, String>> tablaResultados = new HashMap<Integer, HashMap<String, String>>(); | 5817 | // HashMap<Integer, HashMap<String, String>> tablaResultados = new HashMap<Integer, HashMap<String, String>>(); |
| 5818 | // | 5818 | // |
| 5819 | // // 1 Abrimos la base de datos en modo lectura | 5819 | // // 1 Abrimos la base de datos en modo lectura |
| 5820 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5820 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5821 | // | 5821 | // |
| 5822 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; | 5822 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 5823 | // Cursor c; | 5823 | // Cursor c; |
| 5824 | // | 5824 | // |
| 5825 | // System.out.println("::: BaseDatos 3861 condicionRadio " + condicionRadio); | 5825 | // System.out.println("::: BaseDatos 3861 condicionRadio " + condicionRadio); |
| 5826 | // | 5826 | // |
| 5827 | // if(condicionRadio == true){ | 5827 | // if(condicionRadio == true){ |
| 5828 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 5828 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 5829 | //// condR=-1; | 5829 | //// condR=-1; |
| 5830 | // String whereClause = "inv_num=-1 or inv_lug=-1";// or inv_lug=-2 | 5830 | // String whereClause = "inv_num=-1 or inv_lug=-1";// or inv_lug=-2 |
| 5831 | // | 5831 | // |
| 5832 | // c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, | 5832 | // c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, |
| 5833 | // null, null + " ASC" ); | 5833 | // null, null + " ASC" ); |
| 5834 | // System.out.println("::: BaseDatos 3861 consulta " + c); | 5834 | // System.out.println("::: BaseDatos 3861 consulta " + c); |
| 5835 | // }else{ | 5835 | // }else{ |
| 5836 | // // Esta seleccionado deposito, esto debe continuar sin los campos de ventas | 5836 | // // Esta seleccionado deposito, esto debe continuar sin los campos de ventas |
| 5837 | //// condR=-2; | 5837 | //// condR=-2; |
| 5838 | // String whereClause = "inv_num=-2 or inv_lug=-2";// or inv_lug=-2 | 5838 | // String whereClause = "inv_num=-2 or inv_lug=-2";// or inv_lug=-2 |
| 5839 | // c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, | 5839 | // c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, |
| 5840 | // null, null + " ASC" ); | 5840 | // null, null + " ASC" ); |
| 5841 | // System.out.println("::: BaseDatos 3861 consulta " + c); | 5841 | // System.out.println("::: BaseDatos 3861 consulta " + c); |
| 5842 | // } | 5842 | // } |
| 5843 | // | 5843 | // |
| 5844 | // | 5844 | // |
| 5845 | // // 2 Buscamos todos los inventarios | 5845 | // // 2 Buscamos todos los inventarios |
| 5846 | //// Cursor c = dtb.query(tabla_inventarios_nombre, null, null, null, null, | 5846 | //// Cursor c = dtb.query(tabla_inventarios_nombre, null, null, null, null, |
| 5847 | //// null, ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 5847 | //// null, ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 5848 | // if (c.moveToFirst() == true) { | 5848 | // if (c.moveToFirst() == true) { |
| 5849 | // while (c.isAfterLast() == false) { | 5849 | // while (c.isAfterLast() == false) { |
| 5850 | // HashMap<String, String> tablaUnInventario = new HashMap<String, String>(); | 5850 | // HashMap<String, String> tablaUnInventario = new HashMap<String, String>(); |
| 5851 | // /** | 5851 | // /** |
| 5852 | // * 3 Genera el hashmap, uno por inventario | 5852 | // * 3 Genera el hashmap, uno por inventario |
| 5853 | // */ | 5853 | // */ |
| 5854 | // tablaUnInventario | 5854 | // tablaUnInventario |
| 5855 | // .put(ParametrosInventario.bal_bdd_inventario_numero, | 5855 | // .put(ParametrosInventario.bal_bdd_inventario_numero, |
| 5856 | // c.getString(c | 5856 | // c.getString(c |
| 5857 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); | 5857 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); |
| 5858 | // tablaUnInventario | 5858 | // tablaUnInventario |
| 5859 | // .put(ParametrosInventario.bal_bdd_inventario_descripcion, | 5859 | // .put(ParametrosInventario.bal_bdd_inventario_descripcion, |
| 5860 | // c.getString(c | 5860 | // c.getString(c |
| 5861 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion))); | 5861 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion))); |
| 5862 | // tablaUnInventario | 5862 | // tablaUnInventario |
| 5863 | // .put(ParametrosInventario.bal_bdd_inventario_fechaInicio, | 5863 | // .put(ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 5864 | // c.getString(c | 5864 | // c.getString(c |
| 5865 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio))); | 5865 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio))); |
| 5866 | // tablaUnInventario | 5866 | // tablaUnInventario |
| 5867 | // .put(ParametrosInventario.bal_bdd_inventario_fechaFin, | 5867 | // .put(ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 5868 | // c.getString(c | 5868 | // c.getString(c |
| 5869 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin))); | 5869 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin))); |
| 5870 | // tablaUnInventario | 5870 | // tablaUnInventario |
| 5871 | // .put(ParametrosInventario.bal_bdd_inventario_estado, | 5871 | // .put(ParametrosInventario.bal_bdd_inventario_estado, |
| 5872 | // String.valueOf(c.getInt(c | 5872 | // String.valueOf(c.getInt(c |
| 5873 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)))); | 5873 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)))); |
| 5874 | // /** | 5874 | // /** |
| 5875 | // * 4 Agrega el hashmap en la entrada correspondiente a ese | 5875 | // * 4 Agrega el hashmap en la entrada correspondiente a ese |
| 5876 | // * inventario | 5876 | // * inventario |
| 5877 | // */ | 5877 | // */ |
| 5878 | // System.out.println("::: BaseDatos 3838 "+tablaUnInventario | 5878 | // System.out.println("::: BaseDatos 3838 "+tablaUnInventario |
| 5879 | // .put(ParametrosInventario.bal_bdd_inventario_lugar, | 5879 | // .put(ParametrosInventario.bal_bdd_inventario_lugar, |
| 5880 | // String.valueOf(c.getInt(c | 5880 | // String.valueOf(c.getInt(c |
| 5881 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado))))); | 5881 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado))))); |
| 5882 | // tablaResultados | 5882 | // tablaResultados |
| 5883 | // .put(c.getInt(c | 5883 | // .put(c.getInt(c |
| 5884 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 5884 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 5885 | // tablaUnInventario); | 5885 | // tablaUnInventario); |
| 5886 | // | 5886 | // |
| 5887 | // System.out.println("::: BaseDatos 3847 ver q traeeeeee" + tablaResultados); | 5887 | // System.out.println("::: BaseDatos 3847 ver q traeeeeee" + tablaResultados); |
| 5888 | // System.out.println("::: BaseDatos 3848 ver q traeeeeee 2" + c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)); | 5888 | // System.out.println("::: BaseDatos 3848 ver q traeeeeee 2" + c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)); |
| 5889 | // c.moveToNext(); | 5889 | // c.moveToNext(); |
| 5890 | // } | 5890 | // } |
| 5891 | // } else { | 5891 | // } else { |
| 5892 | // throw new ExceptionBDD("INVENTARIO", 0); | 5892 | // throw new ExceptionBDD("INVENTARIO", 0); |
| 5893 | // } | 5893 | // } |
| 5894 | // // 5 Cerramos conexiones | 5894 | // // 5 Cerramos conexiones |
| 5895 | // c.close(); | 5895 | // c.close(); |
| 5896 | // dtb.close(); | 5896 | // dtb.close(); |
| 5897 | // return tablaResultados; | 5897 | // return tablaResultados; |
| 5898 | // } | 5898 | // } |
| 5899 | // | 5899 | // |
| 5900 | // /** | 5900 | // /** |
| 5901 | // * Devuelve la lista de los IDs de todos los inventarios cerrados y listos | 5901 | // * Devuelve la lista de los IDs de todos los inventarios cerrados y listos |
| 5902 | // * para ser exportados. | 5902 | // * para ser exportados. |
| 5903 | // * <p> | 5903 | // * <p> |
| 5904 | // * 1 Abrimos la base de datos en modo lectura | 5904 | // * 1 Abrimos la base de datos en modo lectura |
| 5905 | // * <p> | 5905 | // * <p> |
| 5906 | // * 2 Buscamos los inventarios con estado = a 0 | 5906 | // * 2 Buscamos los inventarios con estado = a 0 |
| 5907 | // * <p> | 5907 | // * <p> |
| 5908 | // * 3 Lo agregamos a la tabla de resultados | 5908 | // * 3 Lo agregamos a la tabla de resultados |
| 5909 | // * <p> | 5909 | // * <p> |
| 5910 | // * 4 Cerramos la BD | 5910 | // * 4 Cerramos la BD |
| 5911 | // * | 5911 | // * |
| 5912 | // * @return ArrayList<Integer> lista de los IDs, lista vaca si no hay | 5912 | // * @return ArrayList<Integer> lista de los IDs, lista vaca si no hay |
| 5913 | // * reultados | 5913 | // * reultados |
| 5914 | // * @throws ExceptionBDD | 5914 | // * @throws ExceptionBDD |
| 5915 | // * lanzada si no se encuentra la tabla en la base de datos | 5915 | // * lanzada si no se encuentra la tabla en la base de datos |
| 5916 | // */ | 5916 | // */ |
| 5917 | // public ArrayList<Integer> selectInventariosCerradosEnBddCompras() | 5917 | // public ArrayList<Integer> selectInventariosCerradosEnBddCompras() |
| 5918 | // throws ExceptionBDD { | 5918 | // throws ExceptionBDD { |
| 5919 | // System.out.println("::: BaseDatos 3921 selectInventariosCerradosEnBdd"); | 5919 | // System.out.println("::: BaseDatos 3921 selectInventariosCerradosEnBdd"); |
| 5920 | // ArrayList<Integer> tablaResultado = new ArrayList<Integer>(); | 5920 | // ArrayList<Integer> tablaResultado = new ArrayList<Integer>(); |
| 5921 | // // 1 Abrimos la base de datos en modo lectura | 5921 | // // 1 Abrimos la base de datos en modo lectura |
| 5922 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5922 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5923 | // | 5923 | // |
| 5924 | // String consul_where=""; | 5924 | // String consul_where=""; |
| 5925 | // System.out.println("::: BaseDatos 3928 esta marcado inventario venta"); | 5925 | // System.out.println("::: BaseDatos 3928 esta marcado inventario venta"); |
| 5926 | // //consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-3 or inv_lug=-3) "; | 5926 | // //consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-3 or inv_lug=-3) "; |
| 5927 | // consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num<=-3) "; | 5927 | // consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num<=-3) "; |
| 5928 | // | 5928 | // |
| 5929 | // // 2 Buscamos los inventarios con estado = a 0 | 5929 | // // 2 Buscamos los inventarios con estado = a 0 |
| 5930 | // try { | 5930 | // try { |
| 5931 | //// Cursor c = dtb.query(tabla_inventarios_nombre, null, | 5931 | //// Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 5932 | //// ParametrosInventario.bal_bdd_inventario_estado + "=0", | 5932 | //// ParametrosInventario.bal_bdd_inventario_estado + "=0", |
| 5933 | //// null, null, null, | 5933 | //// null, null, null, |
| 5934 | //// ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 5934 | //// ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 5935 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, | 5935 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 5936 | // consul_where, | 5936 | // consul_where, |
| 5937 | // null, null, null, | 5937 | // null, null, null, |
| 5938 | // ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 5938 | // ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 5939 | // if (c.moveToFirst() == true) { | 5939 | // if (c.moveToFirst() == true) { |
| 5940 | // while (c.isAfterLast() == false) { | 5940 | // while (c.isAfterLast() == false) { |
| 5941 | // // 3 Lo agregamos a la tabla de resultados | 5941 | // // 3 Lo agregamos a la tabla de resultados |
| 5942 | // tablaResultado | 5942 | // tablaResultado |
| 5943 | // .add(c.getInt(c | 5943 | // .add(c.getInt(c |
| 5944 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); | 5944 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); |
| 5945 | // c.moveToNext(); | 5945 | // c.moveToNext(); |
| 5946 | // } | 5946 | // } |
| 5947 | // } else { | 5947 | // } else { |
| 5948 | // | 5948 | // |
| 5949 | // return tablaResultado; | 5949 | // return tablaResultado; |
| 5950 | // } | 5950 | // } |
| 5951 | // // 4 Cerramos la BD | 5951 | // // 4 Cerramos la BD |
| 5952 | // c.close(); | 5952 | // c.close(); |
| 5953 | // } catch (Exception e) { | 5953 | // } catch (Exception e) { |
| 5954 | // | 5954 | // |
| 5955 | // GestorLogEventos log = new GestorLogEventos(); | 5955 | // GestorLogEventos log = new GestorLogEventos(); |
| 5956 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 5956 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 5957 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 5957 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 5958 | // log.log("[-- 2916 --]" + e.toString(), 4); | 5958 | // log.log("[-- 2916 --]" + e.toString(), 4); |
| 5959 | // | 5959 | // |
| 5960 | // throw new ExceptionBDD(tabla_inventarios_nombre, 0); | 5960 | // throw new ExceptionBDD(tabla_inventarios_nombre, 0); |
| 5961 | // } | 5961 | // } |
| 5962 | // | 5962 | // |
| 5963 | // | 5963 | // |
| 5964 | // System.out.println("::: BaseDatos 3942 tablaResultado " + tablaResultado); | 5964 | // System.out.println("::: BaseDatos 3942 tablaResultado " + tablaResultado); |
| 5965 | ////esto corrobora el ajuste que esta marcado en preferencias, si es contabilizado o no, y actualiza la tabla con ese valor | 5965 | ////esto corrobora el ajuste que esta marcado en preferencias, si es contabilizado o no, y actualiza la tabla con ese valor |
| 5966 | //// haciendo un update | 5966 | //// haciendo un update |
| 5967 | // System.out.println("::: BD ACTUALIZA INV DEPENDIENDO AJUSTE SELECCIONADO CONTABLILIZADO" | 5967 | // System.out.println("::: BD ACTUALIZA INV DEPENDIENDO AJUSTE SELECCIONADO CONTABLILIZADO" |
| 5968 | // + ParametrosInventario.ProductosNoContabilizados); | 5968 | // + ParametrosInventario.ProductosNoContabilizados); |
| 5969 | // if(ParametrosInventario.ProductosNoContabilizados == 1){ | 5969 | // if(ParametrosInventario.ProductosNoContabilizados == 1){ |
| 5970 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); | 5970 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); |
| 5971 | // }else{ | 5971 | // }else{ |
| 5972 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); | 5972 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); |
| 5973 | // } | 5973 | // } |
| 5974 | // dtb.close(); | 5974 | // dtb.close(); |
| 5975 | // return tablaResultado; | 5975 | // return tablaResultado; |
| 5976 | // } | 5976 | // } |
| 5977 | // | 5977 | // |
| 5978 | // public ArrayList<Integer> selectInventariosCerradosEnBdd() | 5978 | // public ArrayList<Integer> selectInventariosCerradosEnBdd() |
| 5979 | // throws ExceptionBDD { | 5979 | // throws ExceptionBDD { |
| 5980 | // System.out.println("::: BaseDatos 3921 selectInventariosCerradosEnBdd"); | 5980 | // System.out.println("::: BaseDatos 3921 selectInventariosCerradosEnBdd"); |
| 5981 | // ArrayList<Integer> tablaResultado = new ArrayList<Integer>(); | 5981 | // ArrayList<Integer> tablaResultado = new ArrayList<Integer>(); |
| 5982 | // | 5982 | // |
| 5983 | // // 1 Abrimos la base de datos en modo lectura | 5983 | // // 1 Abrimos la base de datos en modo lectura |
| 5984 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 5984 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 5985 | // | 5985 | // |
| 5986 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; | 5986 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 5987 | // | 5987 | // |
| 5988 | // String consul_where=""; | 5988 | // String consul_where=""; |
| 5989 | // int condR = 0; | 5989 | // int condR = 0; |
| 5990 | // if(condicionRadio == true){ | 5990 | // if(condicionRadio == true){ |
| 5991 | // condR=-1; | 5991 | // condR=-1; |
| 5992 | // }else{ | 5992 | // }else{ |
| 5993 | // condR=-2; | 5993 | // condR=-2; |
| 5994 | // } | 5994 | // } |
| 5995 | // if(condR == -1){ | 5995 | // if(condR == -1){ |
| 5996 | // System.out.println("::: BaseDatos 3928 esta marcado inventario venta"); | 5996 | // System.out.println("::: BaseDatos 3928 esta marcado inventario venta"); |
| 5997 | // consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-1 or inv_lug=-1) "; | 5997 | // consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-1 or inv_lug=-1) "; |
| 5998 | // }else if(condR == -2){ | 5998 | // }else if(condR == -2){ |
| 5999 | // System.out.println("::: BaseDatos 3928 esta marcado inventario por deposito"); | 5999 | // System.out.println("::: BaseDatos 3928 esta marcado inventario por deposito"); |
| 6000 | // consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-2 or inv_lug=-2) "; | 6000 | // consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-2 or inv_lug=-2) "; |
| 6001 | // } | 6001 | // } |
| 6002 | // | 6002 | // |
| 6003 | // // 2 Buscamos los inventarios con estado = a 0 | 6003 | // // 2 Buscamos los inventarios con estado = a 0 |
| 6004 | // try { | 6004 | // try { |
| 6005 | //// Cursor c = dtb.query(tabla_inventarios_nombre, null, | 6005 | //// Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 6006 | //// ParametrosInventario.bal_bdd_inventario_estado + "=0", | 6006 | //// ParametrosInventario.bal_bdd_inventario_estado + "=0", |
| 6007 | //// null, null, null, | 6007 | //// null, null, null, |
| 6008 | //// ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 6008 | //// ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 6009 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, | 6009 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 6010 | // consul_where, | 6010 | // consul_where, |
| 6011 | // null, null, null, | 6011 | // null, null, null, |
| 6012 | // ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 6012 | // ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 6013 | // if (c.moveToFirst() == true) { | 6013 | // if (c.moveToFirst() == true) { |
| 6014 | // while (c.isAfterLast() == false) { | 6014 | // while (c.isAfterLast() == false) { |
| 6015 | // // 3 Lo agregamos a la tabla de resultados | 6015 | // // 3 Lo agregamos a la tabla de resultados |
| 6016 | // tablaResultado | 6016 | // tablaResultado |
| 6017 | // .add(c.getInt(c | 6017 | // .add(c.getInt(c |
| 6018 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); | 6018 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); |
| 6019 | // c.moveToNext(); | 6019 | // c.moveToNext(); |
| 6020 | // } | 6020 | // } |
| 6021 | // } else { | 6021 | // } else { |
| 6022 | // | 6022 | // |
| 6023 | // return tablaResultado; | 6023 | // return tablaResultado; |
| 6024 | // } | 6024 | // } |
| 6025 | // // 4 Cerramos la BD | 6025 | // // 4 Cerramos la BD |
| 6026 | // c.close(); | 6026 | // c.close(); |
| 6027 | // } catch (Exception e) { | 6027 | // } catch (Exception e) { |
| 6028 | // | 6028 | // |
| 6029 | // GestorLogEventos log = new GestorLogEventos(); | 6029 | // GestorLogEventos log = new GestorLogEventos(); |
| 6030 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 6030 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 6031 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 6031 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 6032 | // log.log("[-- 2916 --]" + e.toString(), 4); | 6032 | // log.log("[-- 2916 --]" + e.toString(), 4); |
| 6033 | // | 6033 | // |
| 6034 | // throw new ExceptionBDD(tabla_inventarios_nombre, 0); | 6034 | // throw new ExceptionBDD(tabla_inventarios_nombre, 0); |
| 6035 | // } | 6035 | // } |
| 6036 | // | 6036 | // |
| 6037 | // | 6037 | // |
| 6038 | // System.out.println("::: BaseDatos 3942 tablaResultado " + tablaResultado); | 6038 | // System.out.println("::: BaseDatos 3942 tablaResultado " + tablaResultado); |
| 6039 | ////esto corrobora el ajuste que esta marcado en preferencias, si es contabilizado o no, y actualiza la tabla con ese valor | 6039 | ////esto corrobora el ajuste que esta marcado en preferencias, si es contabilizado o no, y actualiza la tabla con ese valor |
| 6040 | //// haciendo un update | 6040 | //// haciendo un update |
| 6041 | // System.out.println("::: BD ACTUALIZA INV DEPENDIENDO AJUSTE SELECCIONADO CONTABLILIZADO" | 6041 | // System.out.println("::: BD ACTUALIZA INV DEPENDIENDO AJUSTE SELECCIONADO CONTABLILIZADO" |
| 6042 | // + ParametrosInventario.ProductosNoContabilizados); | 6042 | // + ParametrosInventario.ProductosNoContabilizados); |
| 6043 | // if(ParametrosInventario.ProductosNoContabilizados == 1){ | 6043 | // if(ParametrosInventario.ProductosNoContabilizados == 1){ |
| 6044 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); | 6044 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); |
| 6045 | // }else{ | 6045 | // }else{ |
| 6046 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); | 6046 | // dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); |
| 6047 | // } | 6047 | // } |
| 6048 | // dtb.close(); | 6048 | // dtb.close(); |
| 6049 | // return tablaResultado; | 6049 | // return tablaResultado; |
| 6050 | // } | 6050 | // } |
| 6051 | // | 6051 | // |
| 6052 | // /** | 6052 | // /** |
| 6053 | // * Obtiene la lista de los numeros de todos los inventarios en curso que se | 6053 | // * Obtiene la lista de los numeros de todos los inventarios en curso que se |
| 6054 | // * encuentran en la base | 6054 | // * encuentran en la base |
| 6055 | // * <p> | 6055 | // * <p> |
| 6056 | // * 1 Abrimos la base de datos en modo lectura | 6056 | // * 1 Abrimos la base de datos en modo lectura |
| 6057 | // * <p> | 6057 | // * <p> |
| 6058 | // * 2 Ejecutamos la consulta | 6058 | // * 2 Ejecutamos la consulta |
| 6059 | // * <p> | 6059 | // * <p> |
| 6060 | // * 3 Agregamos cada numero a la lista | 6060 | // * 3 Agregamos cada numero a la lista |
| 6061 | // * <p> | 6061 | // * <p> |
| 6062 | // * 4 Cierre de BD | 6062 | // * 4 Cierre de BD |
| 6063 | // * | 6063 | // * |
| 6064 | // * @return ArrayList<Integer> | 6064 | // * @return ArrayList<Integer> |
| 6065 | // * @throws ExceptionBDD | 6065 | // * @throws ExceptionBDD |
| 6066 | // */ | 6066 | // */ |
| 6067 | // public ArrayList<Integer> selectInventariosNumerosEnBddCompras() | 6067 | // public ArrayList<Integer> selectInventariosNumerosEnBddCompras() |
| 6068 | // throws ExceptionBDD { | 6068 | // throws ExceptionBDD { |
| 6069 | // System.out.println("::: BaseDatos 3977 selectInventariosNumerosEnBddCompras"); | 6069 | // System.out.println("::: BaseDatos 3977 selectInventariosNumerosEnBddCompras"); |
| 6070 | // boolean condicionRadioSelect = ParametrosInventario.InventariosVentas; | 6070 | // boolean condicionRadioSelect = ParametrosInventario.InventariosVentas; |
| 6071 | // int condVtaDep = -3; | 6071 | // int condVtaDep = -3; |
| 6072 | // try { | 6072 | // try { |
| 6073 | // // Variable de respuesta: | 6073 | // // Variable de respuesta: |
| 6074 | // ArrayList<Integer> result = new ArrayList<Integer>(); | 6074 | // ArrayList<Integer> result = new ArrayList<Integer>(); |
| 6075 | // // 1 Abrimos la base de datos en modo lectura | 6075 | // // 1 Abrimos la base de datos en modo lectura |
| 6076 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 6076 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 6077 | // // Request: | 6077 | // // Request: |
| 6078 | // String[] col = new String[] { ParametrosInventario.bal_bdd_inventario_numero }; | 6078 | // String[] col = new String[] { ParametrosInventario.bal_bdd_inventario_numero }; |
| 6079 | // // 2 Ejecutamos la consulta | 6079 | // // 2 Ejecutamos la consulta |
| 6080 | // String tipoInventario = "INV_NUM=-3"; | 6080 | // String tipoInventario = "INV_NUM=-3"; |
| 6081 | // Cursor c = dtb.query(tabla_inventarios_nombre, col, tipoInventario , null, | 6081 | // Cursor c = dtb.query(tabla_inventarios_nombre, col, tipoInventario , null, |
| 6082 | // null, null, null); | 6082 | // null, null, null); |
| 6083 | // // Result: | 6083 | // // Result: |
| 6084 | // if (c.moveToFirst()) { | 6084 | // if (c.moveToFirst()) { |
| 6085 | // while (c.isAfterLast() == false) { | 6085 | // while (c.isAfterLast() == false) { |
| 6086 | // result.add(c.getInt(0)); | 6086 | // result.add(c.getInt(0)); |
| 6087 | // c.moveToNext(); | 6087 | // c.moveToNext(); |
| 6088 | // } | 6088 | // } |
| 6089 | // } else { | 6089 | // } else { |
| 6090 | // return result; | 6090 | // return result; |
| 6091 | // } | 6091 | // } |
| 6092 | // // 4 Cierre de BD | 6092 | // // 4 Cierre de BD |
| 6093 | // dtb.close(); | 6093 | // dtb.close(); |
| 6094 | // return result; | 6094 | // return result; |
| 6095 | // } catch (Exception e) { | 6095 | // } catch (Exception e) { |
| 6096 | // | 6096 | // |
| 6097 | // GestorLogEventos log = new GestorLogEventos(); | 6097 | // GestorLogEventos log = new GestorLogEventos(); |
| 6098 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 6098 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 6099 | // log.log("[-- 2976 --]" + e.toString(), 4); | 6099 | // log.log("[-- 2976 --]" + e.toString(), 4); |
| 6100 | // | 6100 | // |
| 6101 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 6101 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 6102 | // "Imposible inventariar todos los INVENTARIOS en curso"); | 6102 | // "Imposible inventariar todos los INVENTARIOS en curso"); |
| 6103 | // } | 6103 | // } |
| 6104 | // } | 6104 | // } |
| 6105 | // | 6105 | // |
| 6106 | // public ArrayList<Integer> selectInventariosNumerosEnBdd() | 6106 | // public ArrayList<Integer> selectInventariosNumerosEnBdd() |
| 6107 | // throws ExceptionBDD { | 6107 | // throws ExceptionBDD { |
| 6108 | // System.out.println("::: BaseDatos 3977 selectInventariosNumerosEnBdd"); | 6108 | // System.out.println("::: BaseDatos 3977 selectInventariosNumerosEnBdd"); |
| 6109 | // boolean condicionRadioSelect = ParametrosInventario.InventariosVentas; | 6109 | // boolean condicionRadioSelect = ParametrosInventario.InventariosVentas; |
| 6110 | // int condVtaDep = 0; | 6110 | // int condVtaDep = 0; |
| 6111 | //// System.out.println("::: BaseDatos 4032 condicionRadioSelect "+ condicionRadioSelect); | 6111 | //// System.out.println("::: BaseDatos 4032 condicionRadioSelect "+ condicionRadioSelect); |
| 6112 | // if(condicionRadioSelect==true){ | 6112 | // if(condicionRadioSelect==true){ |
| 6113 | // System.out.println("BD 4043 VENTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); | 6113 | // System.out.println("BD 4043 VENTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); |
| 6114 | // condVtaDep = -1; | 6114 | // condVtaDep = -1; |
| 6115 | // }else if (!condicionRadioSelect){ | 6115 | // }else if (!condicionRadioSelect){ |
| 6116 | // condVtaDep = -2; | 6116 | // condVtaDep = -2; |
| 6117 | // System.out.println("BD 4043 DEPOSITOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); | 6117 | // System.out.println("BD 4043 DEPOSITOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); |
| 6118 | // } | 6118 | // } |
| 6119 | // System.out.println("BD 4043 condVtaDep " + condVtaDep); | 6119 | // System.out.println("BD 4043 condVtaDep " + condVtaDep); |
| 6120 | // | 6120 | // |
| 6121 | // // if(condicionRadio==false && valorapasar==-1){ | 6121 | // // if(condicionRadio==false && valorapasar==-1){ |
| 6122 | //// //deposito | 6122 | //// //deposito |
| 6123 | //// System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 6123 | //// System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 6124 | //// c = dtb | 6124 | //// c = dtb |
| 6125 | //// .query(tabla_inventarios_nombre, | 6125 | //// .query(tabla_inventarios_nombre, |
| 6126 | //// new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 6126 | //// new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 6127 | //// ParametrosInventario.bal_bdd_inventario_numero + "=?", | 6127 | //// ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 6128 | //// new String[] {"-2"}, null, null, null); | 6128 | //// new String[] {"-2"}, null, null, null); |
| 6129 | //// }else{ | 6129 | //// }else{ |
| 6130 | //// //ventas | 6130 | //// //ventas |
| 6131 | //// System.out.println("VENTASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 6131 | //// System.out.println("VENTASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 6132 | //// c = dtb | 6132 | //// c = dtb |
| 6133 | //// .query(tabla_inventarios_nombre, | 6133 | //// .query(tabla_inventarios_nombre, |
| 6134 | //// new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 6134 | //// new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 6135 | //// ParametrosInventario.bal_bdd_inventario_numero + "=?", | 6135 | //// ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 6136 | //// new String[] { String.valueOf(id) }, null, null, null); | 6136 | //// new String[] { String.valueOf(id) }, null, null, null); |
| 6137 | //// } | 6137 | //// } |
| 6138 | // try { | 6138 | // try { |
| 6139 | // // Variable de respuesta: | 6139 | // // Variable de respuesta: |
| 6140 | // ArrayList<Integer> result = new ArrayList<Integer>(); | 6140 | // ArrayList<Integer> result = new ArrayList<Integer>(); |
| 6141 | // | 6141 | // |
| 6142 | // // 1 Abrimos la base de datos en modo lectura | 6142 | // // 1 Abrimos la base de datos en modo lectura |
| 6143 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 6143 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 6144 | // | 6144 | // |
| 6145 | // // Request: | 6145 | // // Request: |
| 6146 | // String[] col = new String[] { ParametrosInventario.bal_bdd_inventario_numero }; | 6146 | // String[] col = new String[] { ParametrosInventario.bal_bdd_inventario_numero }; |
| 6147 | // // 2 Ejecutamos la consulta | 6147 | // // 2 Ejecutamos la consulta |
| 6148 | // System.out.println("::: BaseDatos 4043 col ===== tabla_inventarios_nombre " + tabla_inventarios_nombre); | 6148 | // System.out.println("::: BaseDatos 4043 col ===== tabla_inventarios_nombre " + tabla_inventarios_nombre); |
| 6149 | //// Cursor c = ; | 6149 | //// Cursor c = ; |
| 6150 | // String tipoInventario = ""; | 6150 | // String tipoInventario = ""; |
| 6151 | // if(condVtaDep==-1){ | 6151 | // if(condVtaDep==-1){ |
| 6152 | // tipoInventario = "INV_NUM!=-2"; | 6152 | // tipoInventario = "INV_NUM!=-2"; |
| 6153 | //// c = dtb.query(tabla_inventarios_nombre, col, "INV_NUM!=-2", null, | 6153 | //// c = dtb.query(tabla_inventarios_nombre, col, "INV_NUM!=-2", null, |
| 6154 | //// null, null, null); | 6154 | //// null, null, null); |
| 6155 | // | 6155 | // |
| 6156 | // }else if(condVtaDep==-2){ | 6156 | // }else if(condVtaDep==-2){ |
| 6157 | //// c = dtb.query(tabla_inventarios_nombre, col, "INV_NUM!=-1", null, | 6157 | //// c = dtb.query(tabla_inventarios_nombre, col, "INV_NUM!=-1", null, |
| 6158 | //// null, null, null); | 6158 | //// null, null, null); |
| 6159 | // tipoInventario = "INV_NUM!=-1"; | 6159 | // tipoInventario = "INV_NUM!=-1"; |
| 6160 | // | 6160 | // |
| 6161 | // } | 6161 | // } |
| 6162 | // Cursor c = dtb.query(tabla_inventarios_nombre, col, tipoInventario , null, null, null, null); | 6162 | // Cursor c = dtb.query(tabla_inventarios_nombre, col, tipoInventario , null, null, null, null); |
| 6163 | //// Cursor c = dtb.query(tabla_inventarios_nombre, col, null, null, | 6163 | //// Cursor c = dtb.query(tabla_inventarios_nombre, col, null, null, |
| 6164 | //// null, null, null); | 6164 | //// null, null, null); |
| 6165 | // | 6165 | // |
| 6166 | // // Result: | 6166 | // // Result: |
| 6167 | // if (c.moveToFirst()) { | 6167 | // if (c.moveToFirst()) { |
| 6168 | // | 6168 | // |
| 6169 | // if(condVtaDep==-1){ | 6169 | // if(condVtaDep==-1){ |
| 6170 | // while (!c.isAfterLast()) { | 6170 | // while (!c.isAfterLast()) { |
| 6171 | // // 3 Agregamos cada numero a la lista | 6171 | // // 3 Agregamos cada numero a la lista |
| 6172 | // if(condVtaDep!=-2){ | 6172 | // if(condVtaDep!=-2){ |
| 6173 | // result.add(c.getInt(0)); | 6173 | // result.add(c.getInt(0)); |
| 6174 | // } | 6174 | // } |
| 6175 | // c.moveToNext(); | 6175 | // c.moveToNext(); |
| 6176 | // } | 6176 | // } |
| 6177 | // }else if(condVtaDep==-2){ | 6177 | // }else if(condVtaDep==-2){ |
| 6178 | // while (!c.isAfterLast()) { | 6178 | // while (!c.isAfterLast()) { |
| 6179 | // // 3 Agregamos cada numero a la lista | 6179 | // // 3 Agregamos cada numero a la lista |
| 6180 | // if(condVtaDep!=-1){ | 6180 | // if(condVtaDep!=-1){ |
| 6181 | // result.add(c.getInt(0)); | 6181 | // result.add(c.getInt(0)); |
| 6182 | // } | 6182 | // } |
| 6183 | // c.moveToNext(); | 6183 | // c.moveToNext(); |
| 6184 | // } | 6184 | // } |
| 6185 | // } | 6185 | // } |
| 6186 | // | 6186 | // |
| 6187 | //// while (c.isAfterLast() == false) { | 6187 | //// while (c.isAfterLast() == false) { |
| 6188 | //// // 3 Agregamos cada numero a la lista | 6188 | //// // 3 Agregamos cada numero a la lista |
| 6189 | //// System.out.println("::: BaseDatos 4043 Campo inv_lug " + c.getInt(0)); | 6189 | //// System.out.println("::: BaseDatos 4043 Campo inv_lug " + c.getInt(0)); |
| 6190 | //// if(condVtaDep==-1){ | 6190 | //// if(condVtaDep==-1){ |
| 6191 | //// System.out.println("::: BaseDatos 4043 entro en el -1 que guarda "); | 6191 | //// System.out.println("::: BaseDatos 4043 entro en el -1 que guarda "); |
| 6192 | //// } | 6192 | //// } |
| 6193 | //// result.add(c.getInt(0)); | 6193 | //// result.add(c.getInt(0)); |
| 6194 | //// System.out.println("::: BaseDatos 4043 result: " + result); | 6194 | //// System.out.println("::: BaseDatos 4043 result: " + result); |
| 6195 | //// c.moveToNext(); | 6195 | //// c.moveToNext(); |
| 6196 | //// } | 6196 | //// } |
| 6197 | //// System.out.println("::: BaseDatos 3717 result: " + result); | 6197 | //// System.out.println("::: BaseDatos 3717 result: " + result); |
| 6198 | // } else { | 6198 | // } else { |
| 6199 | // return result; | 6199 | // return result; |
| 6200 | // } | 6200 | // } |
| 6201 | // | 6201 | // |
| 6202 | // // 4 Cierre de BD | 6202 | // // 4 Cierre de BD |
| 6203 | // dtb.close(); | 6203 | // dtb.close(); |
| 6204 | // | 6204 | // |
| 6205 | // return result; | 6205 | // return result; |
| 6206 | // | 6206 | // |
| 6207 | // } catch (Exception e) { | 6207 | // } catch (Exception e) { |
| 6208 | // | 6208 | // |
| 6209 | // GestorLogEventos log = new GestorLogEventos(); | 6209 | // GestorLogEventos log = new GestorLogEventos(); |
| 6210 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 6210 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 6211 | // log.log("[-- 2976 --]" + e.toString(), 4); | 6211 | // log.log("[-- 2976 --]" + e.toString(), 4); |
| 6212 | // | 6212 | // |
| 6213 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 6213 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 6214 | // "Imposible inventariar todos los INVENTARIOS en curso"); | 6214 | // "Imposible inventariar todos los INVENTARIOS en curso"); |
| 6215 | // } | 6215 | // } |
| 6216 | // } | 6216 | // } |
| 6217 | // | 6217 | // |
| 6218 | // | 6218 | // |
| 6219 | // /** | 6219 | // /** |
| 6220 | // * Actualiza los datos de un ARTICULO pasado como parametro | 6220 | // * Actualiza los datos de un ARTICULO pasado como parametro |
| 6221 | // * <p> | 6221 | // * <p> |
| 6222 | // * 1 Abrimos la base de datos en modo escritura | 6222 | // * 1 Abrimos la base de datos en modo escritura |
| 6223 | // * <p> | 6223 | // * <p> |
| 6224 | // * 2 Creamos el registro a insertar como objeto ContentValues con los | 6224 | // * 2 Creamos el registro a insertar como objeto ContentValues con los |
| 6225 | // * valores correspondientes | 6225 | // * valores correspondientes |
| 6226 | // * <p> | 6226 | // * <p> |
| 6227 | // * 3 Insertamos el registro en la base de datos en modo actualizacion | 6227 | // * 3 Insertamos el registro en la base de datos en modo actualizacion |
| 6228 | // * <p> | 6228 | // * <p> |
| 6229 | // * 4 Cerramos la conexion | 6229 | // * 4 Cerramos la conexion |
| 6230 | // * | 6230 | // * |
| 6231 | // * @param articulo | 6231 | // * @param articulo |
| 6232 | // * @throws ExceptionBDD | 6232 | // * @throws ExceptionBDD |
| 6233 | // */ | 6233 | // */ |
| 6234 | // public void updateArticulo(Articulo articulo) throws ExceptionBDD { | 6234 | // public void updateArticulo(Articulo articulo) throws ExceptionBDD { |
| 6235 | // try { | 6235 | // try { |
| 6236 | // System.out.println("::: BaseDatos 3649 updateArticulo "); | 6236 | // System.out.println("::: BaseDatos 3649 updateArticulo "); |
| 6237 | // // Aca solamente hacemos update de fecha o cantidades o foto: | 6237 | // // Aca solamente hacemos update de fecha o cantidades o foto: |
| 6238 | // // ATENCION ATENCION ATENCION: | 6238 | // // ATENCION ATENCION ATENCION: |
| 6239 | // // El update implica la concatenacion de los codigos de barras de | 6239 | // // El update implica la concatenacion de los codigos de barras de |
| 6240 | // // los articulos identicos | 6240 | // // los articulos identicos |
| 6241 | // // con multiples codigos de barras SI LOS DOS ARTICULOS TIENEN CB | 6241 | // // con multiples codigos de barras SI LOS DOS ARTICULOS TIENEN CB |
| 6242 | // // DIFERENTES: | 6242 | // // DIFERENTES: |
| 6243 | // // Articulo articuloViejo = | 6243 | // // Articulo articuloViejo = |
| 6244 | // // selectArticuloConCodigos(articulo.getSector(), | 6244 | // // selectArticuloConCodigos(articulo.getSector(), |
| 6245 | // // articulo.getCodigo(), articulo.getInventario()); | 6245 | // // articulo.getCodigo(), articulo.getInventario()); |
| 6246 | // // String nueva_cadena_codigos_barras = | 6246 | // // String nueva_cadena_codigos_barras = |
| 6247 | // // articuloViejo.getCodigos_barras_string() + "," + | 6247 | // // articuloViejo.getCodigos_barras_string() + "," + |
| 6248 | // // articulo.getCodigos_barras_string(); | 6248 | // // articulo.getCodigos_barras_string(); |
| 6249 | // | 6249 | // |
| 6250 | // // 1 Abrimos la base de datos en modo escritura | 6250 | // // 1 Abrimos la base de datos en modo escritura |
| 6251 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 6251 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 6252 | // | 6252 | // |
| 6253 | // // Si hemos abierto correctamente la base de datos | 6253 | // // Si hemos abierto correctamente la base de datos |
| 6254 | // if (dtb != null) { | 6254 | // if (dtb != null) { |
| 6255 | // // 2 Creamos el registro a insertar como objeto ContentValues | 6255 | // // 2 Creamos el registro a insertar como objeto ContentValues |
| 6256 | // // con los valores correspondientes | 6256 | // // con los valores correspondientes |
| 6257 | // ContentValues nuevoRegistro = new ContentValues(); | 6257 | // ContentValues nuevoRegistro = new ContentValues(); |
| 6258 | // | 6258 | // |
| 6259 | // // !!!! En caso de update, reemplazamos los valores de CB con | 6259 | // // !!!! En caso de update, reemplazamos los valores de CB con |
| 6260 | // // los nuevos: | 6260 | // // los nuevos: |
| 6261 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo_barra, | 6261 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 6262 | // // nueva_cadena_codigos_barras); | 6262 | // // nueva_cadena_codigos_barras); |
| 6263 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_inventario, | 6263 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_inventario, |
| 6264 | // // articulo.getInventario()); | 6264 | // // articulo.getInventario()); |
| 6265 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_descripcion, | 6265 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_descripcion, |
| 6266 | // // articulo.getDescripcion()); | 6266 | // // articulo.getDescripcion()); |
| 6267 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_precio_venta, | 6267 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 6268 | // // articulo.getPrecio_venta()); | 6268 | // // articulo.getPrecio_venta()); |
| 6269 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_precio_costo, | 6269 | // // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 6270 | // // articulo.getPrecio_costo()); | 6270 | // // articulo.getPrecio_costo()); |
| 6271 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 6271 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 6272 | // articulo.getFoto()); | 6272 | // articulo.getFoto()); |
| 6273 | // nuevoRegistro.put( | 6273 | // nuevoRegistro.put( |
| 6274 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 6274 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 6275 | // articulo.getCantidad()); | 6275 | // articulo.getCantidad()); |
| 6276 | // nuevoRegistro.put( | 6276 | // nuevoRegistro.put( |
| 6277 | // ParametrosInventario.bal_bdd_articulo_subtotal, | 6277 | // ParametrosInventario.bal_bdd_articulo_subtotal, |
| 6278 | // articulo.getSubtotal()); | 6278 | // articulo.getSubtotal()); |
| 6279 | // | 6279 | // |
| 6280 | // // Cuidado, si el nuevo valor es "No Tomado" (cantidad Q = -1), | 6280 | // // Cuidado, si el nuevo valor es "No Tomado" (cantidad Q = -1), |
| 6281 | // // hay que suprimir la fecha en la BDD: | 6281 | // // hay que suprimir la fecha en la BDD: |
| 6282 | // | 6282 | // |
| 6283 | // // MODIFICACION DE FECHAS: | 6283 | // // MODIFICACION DE FECHAS: |
| 6284 | // // Fecha inicio: si no tiene valor en fecha inicio, le ponemos | 6284 | // // Fecha inicio: si no tiene valor en fecha inicio, le ponemos |
| 6285 | // // una: | 6285 | // // una: |
| 6286 | // String fechaI = articulo.getFechaInicio(); | 6286 | // String fechaI = articulo.getFechaInicio(); |
| 6287 | // if (fechaI.length() == 0) { | 6287 | // if (fechaI.length() == 0) { |
| 6288 | // articulo.setFechaInicio(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); | 6288 | // articulo.setFechaInicio(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| 6289 | // } | 6289 | // } |
| 6290 | // | 6290 | // |
| 6291 | // // Fecha fin: se modifica cada vez: | 6291 | // // Fecha fin: se modifica cada vez: |
| 6292 | // articulo.setFechaFin(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") | 6292 | // articulo.setFechaFin(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") |
| 6293 | // .format(new Date())); | 6293 | // .format(new Date())); |
| 6294 | // | 6294 | // |
| 6295 | // if (articulo.getCantidad() < 0) { | 6295 | // if (articulo.getCantidad() < 0) { |
| 6296 | // // Es no tomado | 6296 | // // Es no tomado |
| 6297 | // nuevoRegistro.put( | 6297 | // nuevoRegistro.put( |
| 6298 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 6298 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 6299 | // ""); | 6299 | // ""); |
| 6300 | // nuevoRegistro.put( | 6300 | // nuevoRegistro.put( |
| 6301 | // ParametrosInventario.bal_bdd_articulo_fechaFin, ""); | 6301 | // ParametrosInventario.bal_bdd_articulo_fechaFin, ""); |
| 6302 | // } else { | 6302 | // } else { |
| 6303 | // nuevoRegistro.put( | 6303 | // nuevoRegistro.put( |
| 6304 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 6304 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 6305 | // articulo.getFechaInicio()); | 6305 | // articulo.getFechaInicio()); |
| 6306 | // nuevoRegistro.put( | 6306 | // nuevoRegistro.put( |
| 6307 | // ParametrosInventario.bal_bdd_articulo_fechaFin, | 6307 | // ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 6308 | // articulo.getFechaFin()); | 6308 | // articulo.getFechaFin()); |
| 6309 | // } | 6309 | // } |
| 6310 | // | 6310 | // |
| 6311 | // // 3 Insertamos el registro en la base de datos en modo | 6311 | // // 3 Insertamos el registro en la base de datos en modo |
| 6312 | // // actualizacion | 6312 | // // actualizacion |
| 6313 | // int resultado = dtb | 6313 | // int resultado = dtb |
| 6314 | // .update(tabla_articulos_nombre, | 6314 | // .update(tabla_articulos_nombre, |
| 6315 | // nuevoRegistro, | 6315 | // nuevoRegistro, |
| 6316 | // ParametrosInventario.bal_bdd_articulo_sector | 6316 | // ParametrosInventario.bal_bdd_articulo_sector |
| 6317 | // + "=? AND " | 6317 | // + "=? AND " |
| 6318 | // + ParametrosInventario.bal_bdd_articulo_codigo | 6318 | // + ParametrosInventario.bal_bdd_articulo_codigo |
| 6319 | // + "=? AND " | 6319 | // + "=? AND " |
| 6320 | // + ParametrosInventario.bal_bdd_articulo_inventario | 6320 | // + ParametrosInventario.bal_bdd_articulo_inventario |
| 6321 | // + "=?", | 6321 | // + "=?", |
| 6322 | // new String[] { | 6322 | // new String[] { |
| 6323 | // String.valueOf(articulo.getSector()), | 6323 | // String.valueOf(articulo.getSector()), |
| 6324 | // String.valueOf(articulo.getCodigo()), | 6324 | // String.valueOf(articulo.getCodigo()), |
| 6325 | // String.valueOf(articulo.getInventario()) }); | 6325 | // String.valueOf(articulo.getInventario()) }); |
| 6326 | // System.out.println("****************GUARDA****************"); | 6326 | // System.out.println("****************GUARDA****************"); |
| 6327 | // // Test del resultado: | 6327 | // // Test del resultado: |
| 6328 | // if (resultado <= 0) { | 6328 | // if (resultado <= 0) { |
| 6329 | // | 6329 | // |
| 6330 | // | 6330 | // |
| 6331 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6331 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6332 | // "Imposible actualizar los datos del ARTICULO (1) cuyo codigo es: " | 6332 | // "Imposible actualizar los datos del ARTICULO (1) cuyo codigo es: " |
| 6333 | // + articulo.getSector() + "-" | 6333 | // + articulo.getSector() + "-" |
| 6334 | // + articulo.getCodigo()); | 6334 | // + articulo.getCodigo()); |
| 6335 | // } | 6335 | // } |
| 6336 | // } else { | 6336 | // } else { |
| 6337 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6337 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6338 | // "Imposible actualizar los datos del ARTICULO (2) cuyo codigo es: " | 6338 | // "Imposible actualizar los datos del ARTICULO (2) cuyo codigo es: " |
| 6339 | // + articulo.getSector() + "-" | 6339 | // + articulo.getSector() + "-" |
| 6340 | // + articulo.getCodigo()); | 6340 | // + articulo.getCodigo()); |
| 6341 | // } | 6341 | // } |
| 6342 | // | 6342 | // |
| 6343 | // // 4 Cerramos la conexion | 6343 | // // 4 Cerramos la conexion |
| 6344 | // dtb.close(); | 6344 | // dtb.close(); |
| 6345 | // | 6345 | // |
| 6346 | // } catch (Exception e) { | 6346 | // } catch (Exception e) { |
| 6347 | // | 6347 | // |
| 6348 | // GestorLogEventos log = new GestorLogEventos(); | 6348 | // GestorLogEventos log = new GestorLogEventos(); |
| 6349 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 6349 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 6350 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 6350 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 6351 | // log.log("[-- 3110 --]" + e.toString(), 4); | 6351 | // log.log("[-- 3110 --]" + e.toString(), 4); |
| 6352 | // | 6352 | // |
| 6353 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6353 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6354 | // "Imposible actualizar los datos del ARTICULO cuyo codigo es: " | 6354 | // "Imposible actualizar los datos del ARTICULO cuyo codigo es: " |
| 6355 | // + articulo.getSector() + "-" + articulo.getCodigo()); | 6355 | // + articulo.getSector() + "-" + articulo.getCodigo()); |
| 6356 | // } | 6356 | // } |
| 6357 | // } | 6357 | // } |
| 6358 | // public void updateProveedor(Proveedor proveedor) throws ExceptionBDD { | 6358 | // public void updateProveedor(Proveedor proveedor) throws ExceptionBDD { |
| 6359 | // try { | 6359 | // try { |
| 6360 | // System.out.println("::: BaseDatos 3649 updateArticulo "); | 6360 | // System.out.println("::: BaseDatos 3649 updateArticulo "); |
| 6361 | // // 1 Abrimos la base de datos en modo escritura | 6361 | // // 1 Abrimos la base de datos en modo escritura |
| 6362 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 6362 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 6363 | // // Si hemos abierto correctamente la base de datos | 6363 | // // Si hemos abierto correctamente la base de datos |
| 6364 | // if (dtb != null) { | 6364 | // if (dtb != null) { |
| 6365 | // // 2 Creamos el registro a insertar como objeto ContentValues | 6365 | // // 2 Creamos el registro a insertar como objeto ContentValues |
| 6366 | // // con los valores correspondientes | 6366 | // // con los valores correspondientes |
| 6367 | // ContentValues nuevoRegistro = new ContentValues(); | 6367 | // ContentValues nuevoRegistro = new ContentValues(); |
| 6368 | // // !!!! En caso de update, reemplazamos los valores de CB con | 6368 | // // !!!! En caso de update, reemplazamos los valores de CB con |
| 6369 | // // los nuevos: | 6369 | // // los nuevos: |
| 6370 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_proveedores_codigo, | 6370 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_proveedores_codigo, |
| 6371 | // proveedor.getCodigo()); | 6371 | // proveedor.getCodigo()); |
| 6372 | // nuevoRegistro.put( | 6372 | // nuevoRegistro.put( |
| 6373 | // ParametrosInventario.bal_bdd_proveedores_descripcion, | 6373 | // ParametrosInventario.bal_bdd_proveedores_descripcion, |
| 6374 | // proveedor.getNombre()); | 6374 | // proveedor.getNombre()); |
| 6375 | // // Cuidado, si el nuevo valor es "No Tomado" (cantidad Q = -1), | 6375 | // // Cuidado, si el nuevo valor es "No Tomado" (cantidad Q = -1), |
| 6376 | // // hay que suprimir la fecha en la BDD: | 6376 | // // hay que suprimir la fecha en la BDD: |
| 6377 | // // MODIFICACION DE FECHAS: | 6377 | // // MODIFICACION DE FECHAS: |
| 6378 | // // Fecha inicio: si no tiene valor en fecha inicio, le ponemos | 6378 | // // Fecha inicio: si no tiene valor en fecha inicio, le ponemos |
| 6379 | // // una: | 6379 | // // una: |
| 6380 | // // 3 Insertamos el registro en la base de datos en modo | 6380 | // // 3 Insertamos el registro en la base de datos en modo |
| 6381 | // // actualizacion | 6381 | // // actualizacion |
| 6382 | // int resultado = dtb | 6382 | // int resultado = dtb |
| 6383 | // .update(tabla_proveedores_nombre, | 6383 | // .update(tabla_proveedores_nombre, |
| 6384 | // nuevoRegistro, | 6384 | // nuevoRegistro, |
| 6385 | // ParametrosInventario.bal_bdd_proveedores_codigo | 6385 | // ParametrosInventario.bal_bdd_proveedores_codigo |
| 6386 | // + "=?", | 6386 | // + "=?", |
| 6387 | // new String[] { | 6387 | // new String[] { |
| 6388 | // String.valueOf(proveedor.getCodigo())}); | 6388 | // String.valueOf(proveedor.getCodigo())}); |
| 6389 | // // Test del resultado: | 6389 | // // Test del resultado: |
| 6390 | // if (resultado <= 0) { | 6390 | // if (resultado <= 0) { |
| 6391 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6391 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6392 | // "Imposible actualizar los datos del Proveedor(1) cuyo codigo es: " | 6392 | // "Imposible actualizar los datos del Proveedor(1) cuyo codigo es: " |
| 6393 | // + proveedor.getCodigo()); | 6393 | // + proveedor.getCodigo()); |
| 6394 | // } | 6394 | // } |
| 6395 | // } else { | 6395 | // } else { |
| 6396 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6396 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6397 | // "Imposible actualizar los datos del Proveedor (2) cuyo codigo es: " | 6397 | // "Imposible actualizar los datos del Proveedor (2) cuyo codigo es: " |
| 6398 | // + proveedor.getCodigo()); | 6398 | // + proveedor.getCodigo()); |
| 6399 | // } | 6399 | // } |
| 6400 | // // 4 Cerramos la conexion | 6400 | // // 4 Cerramos la conexion |
| 6401 | // dtb.close(); | 6401 | // dtb.close(); |
| 6402 | // | 6402 | // |
| 6403 | // } catch (Exception e) { | 6403 | // } catch (Exception e) { |
| 6404 | // GestorLogEventos log = new GestorLogEventos(); | 6404 | // GestorLogEventos log = new GestorLogEventos(); |
| 6405 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 6405 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 6406 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 6406 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 6407 | // log.log("[-- 3110 --]" + e.toString(), 4); | 6407 | // log.log("[-- 3110 --]" + e.toString(), 4); |
| 6408 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6408 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6409 | // "Imposible actualizar los datos del Proveedor cuyo codigo es: " | 6409 | // "Imposible actualizar los datos del Proveedor cuyo codigo es: " |
| 6410 | // + proveedor.getCodigo()); | 6410 | // + proveedor.getCodigo()); |
| 6411 | // } | 6411 | // } |
| 6412 | // } | 6412 | // } |
| 6413 | // /** | 6413 | // /** |
| 6414 | // * Actualiza los Codigos de barra de un articulo dado | 6414 | // * Actualiza los Codigos de barra de un articulo dado |
| 6415 | // * <p> | 6415 | // * <p> |
| 6416 | // * 1 Busca el articulo en la BD | 6416 | // * 1 Busca el articulo en la BD |
| 6417 | // * <p> | 6417 | // * <p> |
| 6418 | // * 2 Agrega los codigos de barras del articulo pasado al de la BD | 6418 | // * 2 Agrega los codigos de barras del articulo pasado al de la BD |
| 6419 | // * <p> | 6419 | // * <p> |
| 6420 | // * 3 Abrimos la base de datos en modo escritura | 6420 | // * 3 Abrimos la base de datos en modo escritura |
| 6421 | // * <p> | 6421 | // * <p> |
| 6422 | // * 4 Creamos el registro a insertar como objeto ContentValues | 6422 | // * 4 Creamos el registro a insertar como objeto ContentValues |
| 6423 | // * <p> | 6423 | // * <p> |
| 6424 | // * 5 Insertamos el registro en la base de datos | 6424 | // * 5 Insertamos el registro en la base de datos |
| 6425 | // * <p> | 6425 | // * <p> |
| 6426 | // * 6 Cerramos la BD | 6426 | // * 6 Cerramos la BD |
| 6427 | // * | 6427 | // * |
| 6428 | // * @param articulo | 6428 | // * @param articulo |
| 6429 | // * @throws ExceptionBDD | 6429 | // * @throws ExceptionBDD |
| 6430 | // */ | 6430 | // */ |
| 6431 | // public void updateCbArticulo(Articulo articulo) throws ExceptionBDD { | 6431 | // public void updateCbArticulo(Articulo articulo) throws ExceptionBDD { |
| 6432 | // System.out.println("::: BaseDatos 4177 updateCbArticulo"); | 6432 | // System.out.println("::: BaseDatos 4177 updateCbArticulo"); |
| 6433 | // try { | 6433 | // try { |
| 6434 | // // ATENCION ATENCION ATENCION: | 6434 | // // ATENCION ATENCION ATENCION: |
| 6435 | // // El update implica la concatenacion de los codigos de barras de | 6435 | // // El update implica la concatenacion de los codigos de barras de |
| 6436 | // // los | 6436 | // // los |
| 6437 | // // articulos identicos | 6437 | // // articulos identicos |
| 6438 | // // con multiples codigos de barras SI LOS DOS ARTICULOS TIENEN CB | 6438 | // // con multiples codigos de barras SI LOS DOS ARTICULOS TIENEN CB |
| 6439 | // // DIFERENTES: | 6439 | // // DIFERENTES: |
| 6440 | // // 1 Busca el articulo en la BD | 6440 | // // 1 Busca el articulo en la BD |
| 6441 | // Articulo articuloViejo = selectArticuloConCodigos( | 6441 | // Articulo articuloViejo = selectArticuloConCodigos( |
| 6442 | // articulo.getSector(), articulo.getCodigo(), | 6442 | // articulo.getSector(), articulo.getCodigo(), |
| 6443 | // articulo.getInventario()); | 6443 | // articulo.getInventario()); |
| 6444 | // // 2 Agrega los 2001167019254codigos de barras del articulo pasado al de la BD | 6444 | // // 2 Agrega los 2001167019254codigos de barras del articulo pasado al de la BD |
| 6445 | // String nueva_cadena_codigos_barras = articuloViejo | 6445 | // String nueva_cadena_codigos_barras = articuloViejo |
| 6446 | // .getCodigos_barras_string() | 6446 | // .getCodigos_barras_string() |
| 6447 | // + "," | 6447 | // + "," |
| 6448 | // + articulo.getCodigos_barras_string(); | 6448 | // + articulo.getCodigos_barras_string(); |
| 6449 | // | 6449 | // |
| 6450 | // // 3 Abrimos la base de datos en modo escritura | 6450 | // // 3 Abrimos la base de datos en modo escritura |
| 6451 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 6451 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 6452 | // | 6452 | // |
| 6453 | // // Si hemos abierto correctamente la base de datos | 6453 | // // Si hemos abierto correctamente la base de datos |
| 6454 | // if (dtb != null) { | 6454 | // if (dtb != null) { |
| 6455 | // // 4 Creamos el registro a insertar como objeto ContentValues | 6455 | // // 4 Creamos el registro a insertar como objeto ContentValues |
| 6456 | // ContentValues nuevoRegistro = new ContentValues(); | 6456 | // ContentValues nuevoRegistro = new ContentValues(); |
| 6457 | // | 6457 | // |
| 6458 | // // !!!! En caso de update, reemplazamos los valores de CB con | 6458 | // // !!!! En caso de update, reemplazamos los valores de CB con |
| 6459 | // // los nuevos: | 6459 | // // los nuevos: |
| 6460 | // nuevoRegistro.put( | 6460 | // nuevoRegistro.put( |
| 6461 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 6461 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 6462 | // nueva_cadena_codigos_barras); | 6462 | // nueva_cadena_codigos_barras); |
| 6463 | // nuevoRegistro.put( | 6463 | // nuevoRegistro.put( |
| 6464 | // ParametrosInventario.bal_bdd_articulo_inventario, | 6464 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 6465 | // articulo.getInventario()); | 6465 | // articulo.getInventario()); |
| 6466 | // nuevoRegistro.put( | 6466 | // nuevoRegistro.put( |
| 6467 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 6467 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 6468 | // articulo.getDescripcion()); | 6468 | // articulo.getDescripcion()); |
| 6469 | // nuevoRegistro.put( | 6469 | // nuevoRegistro.put( |
| 6470 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 6470 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 6471 | // articulo.getPrecio_venta()); | 6471 | // articulo.getPrecio_venta()); |
| 6472 | // nuevoRegistro.put( | 6472 | // nuevoRegistro.put( |
| 6473 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 6473 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 6474 | // articulo.getPrecio_costo()); | 6474 | // articulo.getPrecio_costo()); |
| 6475 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 6475 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 6476 | // articulo.getFoto()); | 6476 | // articulo.getFoto()); |
| 6477 | // nuevoRegistro.put( | 6477 | // nuevoRegistro.put( |
| 6478 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 6478 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 6479 | // articulo.getCantidad()); | 6479 | // articulo.getCantidad()); |
| 6480 | // nuevoRegistro.put( | 6480 | // nuevoRegistro.put( |
| 6481 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 6481 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 6482 | // articulo.getFechaInicio()); | 6482 | // articulo.getFechaInicio()); |
| 6483 | // nuevoRegistro.put( | 6483 | // nuevoRegistro.put( |
| 6484 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 6484 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 6485 | // articulo.getFechaInicio()); | 6485 | // articulo.getFechaInicio()); |
| 6486 | // /*Damian*/ | 6486 | // /*Damian*/ |
| 6487 | // nuevoRegistro.put( | 6487 | // nuevoRegistro.put( |
| 6488 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 6488 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 6489 | // articulo.getExis_venta()); | 6489 | // articulo.getExis_venta()); |
| 6490 | // nuevoRegistro.put( | 6490 | // nuevoRegistro.put( |
| 6491 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 6491 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 6492 | // articulo.getExis_deposito()); | 6492 | // articulo.getExis_deposito()); |
| 6493 | // | 6493 | // |
| 6494 | // // 5 Insertamos el registro en la base de datos | 6494 | // // 5 Insertamos el registro en la base de datos |
| 6495 | // int resultado = dtb | 6495 | // int resultado = dtb |
| 6496 | // .update(tabla_articulos_nombre, | 6496 | // .update(tabla_articulos_nombre, |
| 6497 | // nuevoRegistro, | 6497 | // nuevoRegistro, |
| 6498 | // ParametrosInventario.bal_bdd_articulo_sector | 6498 | // ParametrosInventario.bal_bdd_articulo_sector |
| 6499 | // + "=? AND " | 6499 | // + "=? AND " |
| 6500 | // + ParametrosInventario.bal_bdd_articulo_codigo | 6500 | // + ParametrosInventario.bal_bdd_articulo_codigo |
| 6501 | // + "=? AND " | 6501 | // + "=? AND " |
| 6502 | // + ParametrosInventario.bal_bdd_articulo_inventario | 6502 | // + ParametrosInventario.bal_bdd_articulo_inventario |
| 6503 | // + "=?", | 6503 | // + "=?", |
| 6504 | // new String[] { | 6504 | // new String[] { |
| 6505 | // String.valueOf(articulo.getSector()), | 6505 | // String.valueOf(articulo.getSector()), |
| 6506 | // String.valueOf(articulo.getCodigo()), | 6506 | // String.valueOf(articulo.getCodigo()), |
| 6507 | // String.valueOf(articulo.getInventario()) }); | 6507 | // String.valueOf(articulo.getInventario()) }); |
| 6508 | // | 6508 | // |
| 6509 | // // Test del resultado: | 6509 | // // Test del resultado: |
| 6510 | // if (resultado <= 0) { | 6510 | // if (resultado <= 0) { |
| 6511 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6511 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6512 | // "Imposible actualizar los datos del ARTICULO (1) cuyo codigo es: " | 6512 | // "Imposible actualizar los datos del ARTICULO (1) cuyo codigo es: " |
| 6513 | // + articulo.getSector() + "-" | 6513 | // + articulo.getSector() + "-" |
| 6514 | // + articulo.getCodigo()); | 6514 | // + articulo.getCodigo()); |
| 6515 | // } | 6515 | // } |
| 6516 | // } else { | 6516 | // } else { |
| 6517 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6517 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6518 | // "Imposible actualizar los datos del ARTICULO (2) cuyo codigo es: " | 6518 | // "Imposible actualizar los datos del ARTICULO (2) cuyo codigo es: " |
| 6519 | // + articulo.getSector() + "-" | 6519 | // + articulo.getSector() + "-" |
| 6520 | // + articulo.getCodigo()); | 6520 | // + articulo.getCodigo()); |
| 6521 | // } | 6521 | // } |
| 6522 | // // 6 Cerramos la BD | 6522 | // // 6 Cerramos la BD |
| 6523 | // dtb.close(); | 6523 | // dtb.close(); |
| 6524 | // | 6524 | // |
| 6525 | // } catch (Exception e) { | 6525 | // } catch (Exception e) { |
| 6526 | // | 6526 | // |
| 6527 | // GestorLogEventos log = new GestorLogEventos(); | 6527 | // GestorLogEventos log = new GestorLogEventos(); |
| 6528 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 6528 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 6529 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 6529 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 6530 | // log.log("[-- 3228 --]" + e.toString(), 4); | 6530 | // log.log("[-- 3228 --]" + e.toString(), 4); |
| 6531 | // | 6531 | // |
| 6532 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6532 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6533 | // "Imposible actualizar los datos del ARTICULO cuyo codigo es: " | 6533 | // "Imposible actualizar los datos del ARTICULO cuyo codigo es: " |
| 6534 | // + articulo.getSector() + "-" + articulo.getCodigo()); | 6534 | // + articulo.getSector() + "-" + articulo.getCodigo()); |
| 6535 | // | 6535 | // |
| 6536 | // } | 6536 | // } |
| 6537 | // } | 6537 | // } |
| 6538 | // | 6538 | // |
| 6539 | // /** | 6539 | // /** |
| 6540 | // * Actualiza los datos de un INVENTARIO | 6540 | // * Actualiza los datos de un INVENTARIO |
| 6541 | // * <p> | 6541 | // * <p> |
| 6542 | // * 1 Abrimos la base de datos en modo escritura | 6542 | // * 1 Abrimos la base de datos en modo escritura |
| 6543 | // * <p> | 6543 | // * <p> |
| 6544 | // * 2 Creamos el registro a actualizar como objeto ContentValues | 6544 | // * 2 Creamos el registro a actualizar como objeto ContentValues |
| 6545 | // * <p> | 6545 | // * <p> |
| 6546 | // * 3 Insertamos el registro para actualizar en la base de datos | 6546 | // * 3 Insertamos el registro para actualizar en la base de datos |
| 6547 | // * <p> | 6547 | // * <p> |
| 6548 | // * 4 Cerramos la BD | 6548 | // * 4 Cerramos la BD |
| 6549 | // * | 6549 | // * |
| 6550 | // * @param inventario | 6550 | // * @param inventario |
| 6551 | // * @throws ExceptionBDD | 6551 | // * @throws ExceptionBDD |
| 6552 | // */ | 6552 | // */ |
| 6553 | // public void updateInventario(Inventario inventario) throws ExceptionBDD { | 6553 | // public void updateInventario(Inventario inventario) throws ExceptionBDD { |
| 6554 | // try { | 6554 | // try { |
| 6555 | // System.out.println("::: BaseDatos 4300 updateInventario"); | 6555 | // System.out.println("::: BaseDatos 4300 updateInventario"); |
| 6556 | // // 1 Abrimos la base de datos en modo escritura | 6556 | // // 1 Abrimos la base de datos en modo escritura |
| 6557 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 6557 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 6558 | // | 6558 | // |
| 6559 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; | 6559 | // boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 6560 | // | 6560 | // |
| 6561 | // // Si hemos abierto correctamente la base de datos | 6561 | // // Si hemos abierto correctamente la base de datos |
| 6562 | // if (dtb != null) { | 6562 | // if (dtb != null) { |
| 6563 | // // 2 Creamos el registro a actualizar como objeto ContentValues | 6563 | // // 2 Creamos el registro a actualizar como objeto ContentValues |
| 6564 | // | 6564 | // |
| 6565 | // ContentValues nuevoRegistro = new ContentValues(); | 6565 | // ContentValues nuevoRegistro = new ContentValues(); |
| 6566 | // | 6566 | // |
| 6567 | // System.out.println("::: BaseDatos 4300 aca siiii condicionRadio " +condicionRadio +" inventario.getNumero() " +inventario.getNumero()); | 6567 | // System.out.println("::: BaseDatos 4300 aca siiii condicionRadio " +condicionRadio +" inventario.getNumero() " +inventario.getNumero()); |
| 6568 | // | 6568 | // |
| 6569 | // if(condicionRadio == true && inventario.getNumero()==-1){ | 6569 | // if(condicionRadio == true && inventario.getNumero()==-1){ |
| 6570 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 6570 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 6571 | //// condR=-1; | 6571 | //// condR=-1; |
| 6572 | // | 6572 | // |
| 6573 | // System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); | 6573 | // System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); |
| 6574 | //// ContentValues nuevoRegistro = new ContentValues(); | 6574 | //// ContentValues nuevoRegistro = new ContentValues(); |
| 6575 | // nuevoRegistro.put( | 6575 | // nuevoRegistro.put( |
| 6576 | // ParametrosInventario.bal_bdd_inventario_numero, | 6576 | // ParametrosInventario.bal_bdd_inventario_numero, |
| 6577 | // inventario.getNumero()); | 6577 | // inventario.getNumero()); |
| 6578 | // nuevoRegistro.put( | 6578 | // nuevoRegistro.put( |
| 6579 | // ParametrosInventario.bal_bdd_inventario_descripcion, | 6579 | // ParametrosInventario.bal_bdd_inventario_descripcion, |
| 6580 | // inventario.getDescripcion()); | 6580 | // inventario.getDescripcion()); |
| 6581 | // nuevoRegistro.put( | 6581 | // nuevoRegistro.put( |
| 6582 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, | 6582 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 6583 | // inventario.getFechaInicio()); | 6583 | // inventario.getFechaInicio()); |
| 6584 | // nuevoRegistro.put( | 6584 | // nuevoRegistro.put( |
| 6585 | // ParametrosInventario.bal_bdd_inventario_fechaFin, | 6585 | // ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 6586 | // inventario.getFechaFin()); | 6586 | // inventario.getFechaFin()); |
| 6587 | // nuevoRegistro.put( | 6587 | // nuevoRegistro.put( |
| 6588 | // ParametrosInventario.bal_bdd_inventario_estado, | 6588 | // ParametrosInventario.bal_bdd_inventario_estado, |
| 6589 | // inventario.getEstado()); | 6589 | // inventario.getEstado()); |
| 6590 | // nuevoRegistro.put( | 6590 | // nuevoRegistro.put( |
| 6591 | // ParametrosInventario.bal_bdd_inventario_lugar, | 6591 | // ParametrosInventario.bal_bdd_inventario_lugar, |
| 6592 | // inventario.getLugar()); | 6592 | // inventario.getLugar()); |
| 6593 | // | 6593 | // |
| 6594 | // int resultado = dtb | 6594 | // int resultado = dtb |
| 6595 | // .update(tabla_inventarios_nombre, nuevoRegistro, | 6595 | // .update(tabla_inventarios_nombre, nuevoRegistro, |
| 6596 | // ParametrosInventario.bal_bdd_inventario_numero | 6596 | // ParametrosInventario.bal_bdd_inventario_numero |
| 6597 | // + "=?", new String[] { String | 6597 | // + "=?", new String[] { String |
| 6598 | // .valueOf(inventario.getNumero()) }); | 6598 | // .valueOf(inventario.getNumero()) }); |
| 6599 | // | 6599 | // |
| 6600 | // // Test del resultado: | 6600 | // // Test del resultado: |
| 6601 | // if (resultado <= 0) { | 6601 | // if (resultado <= 0) { |
| 6602 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6602 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6603 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6603 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6604 | // + String.valueOf(inventario.getNumero())); | 6604 | // + String.valueOf(inventario.getNumero())); |
| 6605 | // } | 6605 | // } |
| 6606 | // }else if(condicionRadio == false && inventario.getNumero()==-2){ | 6606 | // }else if(condicionRadio == false && inventario.getNumero()==-2){ |
| 6607 | // // Esta seleccionado deposito, esto debe continuar sin los campos de ventas | 6607 | // // Esta seleccionado deposito, esto debe continuar sin los campos de ventas |
| 6608 | //// condR=-2; | 6608 | //// condR=-2; |
| 6609 | // | 6609 | // |
| 6610 | // System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); | 6610 | // System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); |
| 6611 | //// ContentValues nuevoRegistro = new ContentValues(); | 6611 | //// ContentValues nuevoRegistro = new ContentValues(); |
| 6612 | // nuevoRegistro.put( | 6612 | // nuevoRegistro.put( |
| 6613 | // ParametrosInventario.bal_bdd_inventario_numero, | 6613 | // ParametrosInventario.bal_bdd_inventario_numero, |
| 6614 | // inventario.getNumero()); | 6614 | // inventario.getNumero()); |
| 6615 | // nuevoRegistro.put( | 6615 | // nuevoRegistro.put( |
| 6616 | // ParametrosInventario.bal_bdd_inventario_descripcion, | 6616 | // ParametrosInventario.bal_bdd_inventario_descripcion, |
| 6617 | // inventario.getDescripcion()); | 6617 | // inventario.getDescripcion()); |
| 6618 | // nuevoRegistro.put( | 6618 | // nuevoRegistro.put( |
| 6619 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, | 6619 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 6620 | // inventario.getFechaInicio()); | 6620 | // inventario.getFechaInicio()); |
| 6621 | // nuevoRegistro.put( | 6621 | // nuevoRegistro.put( |
| 6622 | // ParametrosInventario.bal_bdd_inventario_fechaFin, | 6622 | // ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 6623 | // inventario.getFechaFin()); | 6623 | // inventario.getFechaFin()); |
| 6624 | // nuevoRegistro.put( | 6624 | // nuevoRegistro.put( |
| 6625 | // ParametrosInventario.bal_bdd_inventario_estado, | 6625 | // ParametrosInventario.bal_bdd_inventario_estado, |
| 6626 | // inventario.getEstado()); | 6626 | // inventario.getEstado()); |
| 6627 | // nuevoRegistro.put( | 6627 | // nuevoRegistro.put( |
| 6628 | // ParametrosInventario.bal_bdd_inventario_lugar, | 6628 | // ParametrosInventario.bal_bdd_inventario_lugar, |
| 6629 | // inventario.getLugar()); | 6629 | // inventario.getLugar()); |
| 6630 | // | 6630 | // |
| 6631 | // int resultado = dtb | 6631 | // int resultado = dtb |
| 6632 | // .update(tabla_inventarios_nombre, nuevoRegistro, | 6632 | // .update(tabla_inventarios_nombre, nuevoRegistro, |
| 6633 | // ParametrosInventario.bal_bdd_inventario_numero | 6633 | // ParametrosInventario.bal_bdd_inventario_numero |
| 6634 | // + "=?", new String[] { String | 6634 | // + "=?", new String[] { String |
| 6635 | // .valueOf(inventario.getNumero()) }); | 6635 | // .valueOf(inventario.getNumero()) }); |
| 6636 | // | 6636 | // |
| 6637 | // // Test del resultado: | 6637 | // // Test del resultado: |
| 6638 | // if (resultado <= 0) { | 6638 | // if (resultado <= 0) { |
| 6639 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6639 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6640 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6640 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6641 | // + String.valueOf(inventario.getNumero())); | 6641 | // + String.valueOf(inventario.getNumero())); |
| 6642 | // } | 6642 | // } |
| 6643 | // } | 6643 | // } |
| 6644 | //// | 6644 | //// |
| 6645 | //// System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); | 6645 | //// System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); |
| 6646 | //// ContentValues nuevoRegistro = new ContentValues(); | 6646 | //// ContentValues nuevoRegistro = new ContentValues(); |
| 6647 | //// nuevoRegistro.put( | 6647 | //// nuevoRegistro.put( |
| 6648 | //// ParametrosInventario.bal_bdd_inventario_numero, | 6648 | //// ParametrosInventario.bal_bdd_inventario_numero, |
| 6649 | //// inventario.getNumero()); | 6649 | //// inventario.getNumero()); |
| 6650 | //// nuevoRegistro.put( | 6650 | //// nuevoRegistro.put( |
| 6651 | //// ParametrosInventario.bal_bdd_inventario_descripcion, | 6651 | //// ParametrosInventario.bal_bdd_inventario_descripcion, |
| 6652 | //// inventario.getDescripcion()); | 6652 | //// inventario.getDescripcion()); |
| 6653 | //// nuevoRegistro.put( | 6653 | //// nuevoRegistro.put( |
| 6654 | //// ParametrosInventario.bal_bdd_inventario_fechaInicio, | 6654 | //// ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 6655 | //// inventario.getFechaInicio()); | 6655 | //// inventario.getFechaInicio()); |
| 6656 | //// nuevoRegistro.put( | 6656 | //// nuevoRegistro.put( |
| 6657 | //// ParametrosInventario.bal_bdd_inventario_fechaFin, | 6657 | //// ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 6658 | //// inventario.getFechaFin()); | 6658 | //// inventario.getFechaFin()); |
| 6659 | //// nuevoRegistro.put( | 6659 | //// nuevoRegistro.put( |
| 6660 | //// ParametrosInventario.bal_bdd_inventario_estado, | 6660 | //// ParametrosInventario.bal_bdd_inventario_estado, |
| 6661 | //// inventario.getEstado()); | 6661 | //// inventario.getEstado()); |
| 6662 | //// nuevoRegistro.put( | 6662 | //// nuevoRegistro.put( |
| 6663 | //// ParametrosInventario.bal_bdd_inventario_lugar, | 6663 | //// ParametrosInventario.bal_bdd_inventario_lugar, |
| 6664 | //// inventario.getLugar()); | 6664 | //// inventario.getLugar()); |
| 6665 | // | 6665 | // |
| 6666 | // // 3 Insertamos el registro para actualizar en la base de datos | 6666 | // // 3 Insertamos el registro para actualizar en la base de datos |
| 6667 | //// int resultado = dtb | 6667 | //// int resultado = dtb |
| 6668 | //// .update(tabla_inventarios_nombre, nuevoRegistro, | 6668 | //// .update(tabla_inventarios_nombre, nuevoRegistro, |
| 6669 | //// ParametrosInventario.bal_bdd_inventario_numero | 6669 | //// ParametrosInventario.bal_bdd_inventario_numero |
| 6670 | //// + "=?", new String[] { String | 6670 | //// + "=?", new String[] { String |
| 6671 | //// .valueOf(inventario.getNumero()) }); | 6671 | //// .valueOf(inventario.getNumero()) }); |
| 6672 | //// | 6672 | //// |
| 6673 | //// // Test del resultado: | 6673 | //// // Test del resultado: |
| 6674 | //// if (resultado <= 0) { | 6674 | //// if (resultado <= 0) { |
| 6675 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6675 | //// throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6676 | //// "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6676 | //// "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6677 | //// + String.valueOf(inventario.getNumero())); | 6677 | //// + String.valueOf(inventario.getNumero())); |
| 6678 | //// } | 6678 | //// } |
| 6679 | // } else { | 6679 | // } else { |
| 6680 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6680 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6681 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6681 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6682 | // + String.valueOf(inventario.getNumero())); | 6682 | // + String.valueOf(inventario.getNumero())); |
| 6683 | // } | 6683 | // } |
| 6684 | // // 4 Cerramos la BD | 6684 | // // 4 Cerramos la BD |
| 6685 | // dtb.close(); | 6685 | // dtb.close(); |
| 6686 | // | 6686 | // |
| 6687 | // } catch (Exception e) { | 6687 | // } catch (Exception e) { |
| 6688 | // | 6688 | // |
| 6689 | // GestorLogEventos log = new GestorLogEventos(); | 6689 | // GestorLogEventos log = new GestorLogEventos(); |
| 6690 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 6690 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 6691 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 6691 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 6692 | // log.log("[-- 3305 --]" + e.toString(), 4); | 6692 | // log.log("[-- 3305 --]" + e.toString(), 4); |
| 6693 | // | 6693 | // |
| 6694 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6694 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6695 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6695 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6696 | // + String.valueOf(inventario.getNumero())); | 6696 | // + String.valueOf(inventario.getNumero())); |
| 6697 | // | 6697 | // |
| 6698 | // } | 6698 | // } |
| 6699 | // } | 6699 | // } |
| 6700 | // | 6700 | // |
| 6701 | // public void updateInventarioCompras(Inventario inventario) throws ExceptionBDD { | 6701 | // public void updateInventarioCompras(Inventario inventario) throws ExceptionBDD { |
| 6702 | // try { | 6702 | // try { |
| 6703 | // System.out.println("::: BaseDatos 4300 updateInventarioCompras"); | 6703 | // System.out.println("::: BaseDatos 4300 updateInventarioCompras"); |
| 6704 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 6704 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 6705 | // //boolean condicionRadio = ParametrosInventario.InventariosVentas; | 6705 | // //boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 6706 | // | 6706 | // |
| 6707 | // if (dtb != null) { | 6707 | // if (dtb != null) { |
| 6708 | // ContentValues nuevoRegistro = new ContentValues(); | 6708 | // ContentValues nuevoRegistro = new ContentValues(); |
| 6709 | // //if(condicionRadio == true && inventario.getNumero()==-1){ | 6709 | // //if(condicionRadio == true && inventario.getNumero()==-1){ |
| 6710 | // if(inventario.getNumero()==-3){ | 6710 | // if(inventario.getNumero()==-3){ |
| 6711 | // | 6711 | // |
| 6712 | // nuevoRegistro.put( | 6712 | // nuevoRegistro.put( |
| 6713 | // ParametrosInventario.bal_bdd_inventario_numero, | 6713 | // ParametrosInventario.bal_bdd_inventario_numero, |
| 6714 | // inventario.getNumero()); | 6714 | // inventario.getNumero()); |
| 6715 | // nuevoRegistro.put( | 6715 | // nuevoRegistro.put( |
| 6716 | // ParametrosInventario.bal_bdd_inventario_descripcion, | 6716 | // ParametrosInventario.bal_bdd_inventario_descripcion, |
| 6717 | // inventario.getDescripcion()); | 6717 | // inventario.getDescripcion()); |
| 6718 | // nuevoRegistro.put( | 6718 | // nuevoRegistro.put( |
| 6719 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, | 6719 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 6720 | // inventario.getFechaInicio()); | 6720 | // inventario.getFechaInicio()); |
| 6721 | // nuevoRegistro.put( | 6721 | // nuevoRegistro.put( |
| 6722 | // ParametrosInventario.bal_bdd_inventario_fechaFin, | 6722 | // ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 6723 | // inventario.getFechaFin()); | 6723 | // inventario.getFechaFin()); |
| 6724 | // nuevoRegistro.put( | 6724 | // nuevoRegistro.put( |
| 6725 | // ParametrosInventario.bal_bdd_inventario_estado, | 6725 | // ParametrosInventario.bal_bdd_inventario_estado, |
| 6726 | // inventario.getEstado()); | 6726 | // inventario.getEstado()); |
| 6727 | // nuevoRegistro.put( | 6727 | // nuevoRegistro.put( |
| 6728 | // ParametrosInventario.bal_bdd_inventario_lugar, | 6728 | // ParametrosInventario.bal_bdd_inventario_lugar, |
| 6729 | // inventario.getLugar()); | 6729 | // inventario.getLugar()); |
| 6730 | // | 6730 | // |
| 6731 | // int resultado = dtb | 6731 | // int resultado = dtb |
| 6732 | // .update(tabla_inventarios_nombre, nuevoRegistro, | 6732 | // .update(tabla_inventarios_nombre, nuevoRegistro, |
| 6733 | // ParametrosInventario.bal_bdd_inventario_numero | 6733 | // ParametrosInventario.bal_bdd_inventario_numero |
| 6734 | // + "=?", new String[] { String | 6734 | // + "=?", new String[] { String |
| 6735 | // .valueOf(inventario.getNumero()) }); | 6735 | // .valueOf(inventario.getNumero()) }); |
| 6736 | // | 6736 | // |
| 6737 | // // Test del resultado: | 6737 | // // Test del resultado: |
| 6738 | // if (resultado <= 0) { | 6738 | // if (resultado <= 0) { |
| 6739 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6739 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6740 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6740 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6741 | // + String.valueOf(inventario.getNumero())); | 6741 | // + String.valueOf(inventario.getNumero())); |
| 6742 | // } | 6742 | // } |
| 6743 | // } | 6743 | // } |
| 6744 | // } else { | 6744 | // } else { |
| 6745 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6745 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6746 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6746 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6747 | // + String.valueOf(inventario.getNumero())); | 6747 | // + String.valueOf(inventario.getNumero())); |
| 6748 | // } | 6748 | // } |
| 6749 | // // 4 Cerramos la BD | 6749 | // // 4 Cerramos la BD |
| 6750 | // dtb.close(); | 6750 | // dtb.close(); |
| 6751 | // | 6751 | // |
| 6752 | // } catch (Exception e) { | 6752 | // } catch (Exception e) { |
| 6753 | // | 6753 | // |
| 6754 | // GestorLogEventos log = new GestorLogEventos(); | 6754 | // GestorLogEventos log = new GestorLogEventos(); |
| 6755 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 6755 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 6756 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 6756 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 6757 | // log.log("[-- 3305 --]" + e.toString(), 4); | 6757 | // log.log("[-- 3305 --]" + e.toString(), 4); |
| 6758 | // | 6758 | // |
| 6759 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6759 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6760 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6760 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6761 | // + String.valueOf(inventario.getNumero())); | 6761 | // + String.valueOf(inventario.getNumero())); |
| 6762 | // | 6762 | // |
| 6763 | // } | 6763 | // } |
| 6764 | // } | 6764 | // } |
| 6765 | // | 6765 | // |
| 6766 | // | 6766 | // |
| 6767 | // public void updateInventario(int num_inventario, int estado_nuevo) | 6767 | // public void updateInventario(int num_inventario, int estado_nuevo) |
| 6768 | // throws ExceptionBDD { | 6768 | // throws ExceptionBDD { |
| 6769 | // System.out.println("::: BaseDatos 4378 updateInventario"); | 6769 | // System.out.println("::: BaseDatos 4378 updateInventario"); |
| 6770 | // try { | 6770 | // try { |
| 6771 | // // 1 Abrimos la base de datos en modo escritura | 6771 | // // 1 Abrimos la base de datos en modo escritura |
| 6772 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 6772 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 6773 | // System.out.println("::: BaseDatos 4378 estado_nuevo " + estado_nuevo); | 6773 | // System.out.println("::: BaseDatos 4378 estado_nuevo " + estado_nuevo); |
| 6774 | // System.out.println("::: BaseDatos 4378 num_inventario " + num_inventario); | 6774 | // System.out.println("::: BaseDatos 4378 num_inventario " + num_inventario); |
| 6775 | // // Si hemos abierto correctamente la base de datos | 6775 | // // Si hemos abierto correctamente la base de datos |
| 6776 | // if (dtb != null) { | 6776 | // if (dtb != null) { |
| 6777 | // // 2 Creamos el registro a actualizar como objeto ContentValues | 6777 | // // 2 Creamos el registro a actualizar como objeto ContentValues |
| 6778 | // ContentValues nuevoRegistro = new ContentValues(); | 6778 | // ContentValues nuevoRegistro = new ContentValues(); |
| 6779 | // nuevoRegistro.put( | 6779 | // nuevoRegistro.put( |
| 6780 | // ParametrosInventario.bal_bdd_inventario_estado, | 6780 | // ParametrosInventario.bal_bdd_inventario_estado, |
| 6781 | // estado_nuevo); | 6781 | // estado_nuevo); |
| 6782 | // nuevoRegistro.put( | 6782 | // nuevoRegistro.put( |
| 6783 | // ParametrosInventario.bal_bdd_inventario_fechaFin, | 6783 | // ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 6784 | // new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") | 6784 | // new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") |
| 6785 | // .format(new Date())); | 6785 | // .format(new Date())); |
| 6786 | // // 3 Actualizamos el registro en la base de datos | 6786 | // // 3 Actualizamos el registro en la base de datos |
| 6787 | // int resultado = dtb.update(tabla_inventarios_nombre, | 6787 | // int resultado = dtb.update(tabla_inventarios_nombre, |
| 6788 | // nuevoRegistro, | 6788 | // nuevoRegistro, |
| 6789 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 6789 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 6790 | // new String[] { String.valueOf(num_inventario) }); | 6790 | // new String[] { String.valueOf(num_inventario) }); |
| 6791 | // | 6791 | // |
| 6792 | // // Test del resultado: | 6792 | // // Test del resultado: |
| 6793 | // if (resultado <= 0) { | 6793 | // if (resultado <= 0) { |
| 6794 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6794 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6795 | // "(1) Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6795 | // "(1) Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6796 | // + String.valueOf(num_inventario)); | 6796 | // + String.valueOf(num_inventario)); |
| 6797 | // } | 6797 | // } |
| 6798 | // } else { | 6798 | // } else { |
| 6799 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6799 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6800 | // "(2) Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6800 | // "(2) Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6801 | // + String.valueOf(num_inventario)); | 6801 | // + String.valueOf(num_inventario)); |
| 6802 | // } | 6802 | // } |
| 6803 | // // 4 Cerramos la BD | 6803 | // // 4 Cerramos la BD |
| 6804 | // dtb.close(); | 6804 | // dtb.close(); |
| 6805 | // | 6805 | // |
| 6806 | // } catch (Exception e) { | 6806 | // } catch (Exception e) { |
| 6807 | // | 6807 | // |
| 6808 | // GestorLogEventos log = new GestorLogEventos(); | 6808 | // GestorLogEventos log = new GestorLogEventos(); |
| 6809 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 6809 | // log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 6810 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 6810 | // log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 6811 | // log.log("[-- 3370 --]" + e.toString(), 4); | 6811 | // log.log("[-- 3370 --]" + e.toString(), 4); |
| 6812 | // | 6812 | // |
| 6813 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 6813 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 6814 | // "(3) Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 6814 | // "(3) Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 6815 | // + String.valueOf(num_inventario)); | 6815 | // + String.valueOf(num_inventario)); |
| 6816 | // | 6816 | // |
| 6817 | // } | 6817 | // } |
| 6818 | // } | 6818 | // } |
| 6819 | // | 6819 | // |
| 6820 | // public ArrayList<Referencia> getArticulosAll() { | 6820 | // public ArrayList<Referencia> getArticulosAll() { |
| 6821 | // System.out.println("::: BaseDatos 4429 getArticulosAll"); | 6821 | // System.out.println("::: BaseDatos 4429 getArticulosAll"); |
| 6822 | // ArrayList Referencias = new ArrayList<Referencia>(); | 6822 | // ArrayList Referencias = new ArrayList<Referencia>(); |
| 6823 | // String query_1 = "Select * from " | 6823 | // String query_1 = "Select * from " |
| 6824 | // + ParametrosInventario.tabla_referencias; | 6824 | // + ParametrosInventario.tabla_referencias; |
| 6825 | // SQLiteDatabase dtb_1 = this.getReadableDatabase(); | 6825 | // SQLiteDatabase dtb_1 = this.getReadableDatabase(); |
| 6826 | // Cursor c_1 = dtb_1.rawQuery(query_1, null); | 6826 | // Cursor c_1 = dtb_1.rawQuery(query_1, null); |
| 6827 | // | 6827 | // |
| 6828 | // try { | 6828 | // try { |
| 6829 | // if (c_1.moveToFirst()) { | 6829 | // if (c_1.moveToFirst()) { |
| 6830 | // | 6830 | // |
| 6831 | // do { | 6831 | // do { |
| 6832 | // | 6832 | // |
| 6833 | // /*String sector = c_1.getString(0); | 6833 | // /*String sector = c_1.getString(0); |
| 6834 | // String codigo = c_1.getString(1); | 6834 | // String codigo = c_1.getString(1); |
| 6835 | // String codigoBarra = c_1.getString(2); | 6835 | // String codigoBarra = c_1.getString(2); |
| 6836 | // String descripcion = c_1.getString(3); | 6836 | // String descripcion = c_1.getString(3); |
| 6837 | // String precioVenta = c_1.getString(4); | 6837 | // String precioVenta = c_1.getString(4); |
| 6838 | // String precioCosto = c_1.getString(5); | 6838 | // String precioCosto = c_1.getString(5); |
| 6839 | // String foto = c_1.getString(6); | 6839 | // String foto = c_1.getString(6); |
| 6840 | //*/ | 6840 | //*/ |
| 6841 | // String sector = c_1.getString(0); | 6841 | // String sector = c_1.getString(0); |
| 6842 | // String codigo = c_1.getString(1); | 6842 | // String codigo = c_1.getString(1); |
| 6843 | // String balanza = c_1.getString(2); | 6843 | // String balanza = c_1.getString(2); |
| 6844 | // String decimales = c_1.getString(3); | 6844 | // String decimales = c_1.getString(3); |
| 6845 | // String exisventa = c_1.getString(4); | 6845 | // String exisventa = c_1.getString(4); |
| 6846 | // String exisdep = c_1.getString(5); | 6846 | // String exisdep = c_1.getString(5); |
| 6847 | // String codigoBarra = c_1.getString(6); | 6847 | // String codigoBarra = c_1.getString(6); |
| 6848 | // String codigoBarraC = c_1.getString(7); | 6848 | // String codigoBarraC = c_1.getString(7); |
| 6849 | // String descripcion = c_1.getString(8); | 6849 | // String descripcion = c_1.getString(8); |
| 6850 | // String precioVenta = c_1.getString(9); | 6850 | // String precioVenta = c_1.getString(9); |
| 6851 | // String precioCosto = c_1.getString(10); | 6851 | // String precioCosto = c_1.getString(10); |
| 6852 | // String depsn = c_1.getString(11); | 6852 | // String depsn = c_1.getString(11); |
| 6853 | // //String foto = c_1.getString(12); | 6853 | // //String foto = c_1.getString(12); |
| 6854 | // String foto = ""; | 6854 | // String foto = ""; |
| 6855 | // | 6855 | // |
| 6856 | // /* System.out.println("::: BaseDatos getArticulosAll do sector " + sector); | 6856 | // /* System.out.println("::: BaseDatos getArticulosAll do sector " + sector); |
| 6857 | // System.out.println("::: BaseDatos getArticulosAll do codigo " + codigo); | 6857 | // System.out.println("::: BaseDatos getArticulosAll do codigo " + codigo); |
| 6858 | // System.out.println("::: BaseDatos getArticulosAll do balanza " + balanza); | 6858 | // System.out.println("::: BaseDatos getArticulosAll do balanza " + balanza); |
| 6859 | // System.out.println("::: BaseDatos getArticulosAll do decimales " + decimales); | 6859 | // System.out.println("::: BaseDatos getArticulosAll do decimales " + decimales); |
| 6860 | // System.out.println("::: BaseDatos getArticulosAll do exisventa " + exisventa); | 6860 | // System.out.println("::: BaseDatos getArticulosAll do exisventa " + exisventa); |
| 6861 | // System.out.println("::: BaseDatos getArticulosAll do exisdep " + exisdep); | 6861 | // System.out.println("::: BaseDatos getArticulosAll do exisdep " + exisdep); |
| 6862 | // System.out.println("::: BaseDatos getArticulosAll do codigoBarra " + codigoBarra); | 6862 | // System.out.println("::: BaseDatos getArticulosAll do codigoBarra " + codigoBarra); |
| 6863 | // System.out.println("::: BaseDatos getArticulosAll do descripcion " + descripcion); | 6863 | // System.out.println("::: BaseDatos getArticulosAll do descripcion " + descripcion); |
| 6864 | // System.out.println("::: BaseDatos getArticulosAll do precioVenta " + precioVenta); | 6864 | // System.out.println("::: BaseDatos getArticulosAll do precioVenta " + precioVenta); |
| 6865 | // System.out.println("::: BaseDatos getArticulosAll do precioCosto " + precioCosto); | 6865 | // System.out.println("::: BaseDatos getArticulosAll do precioCosto " + precioCosto); |
| 6866 | // System.out.println("::: BaseDatos getArticulosAll do depsn " + depsn); | 6866 | // System.out.println("::: BaseDatos getArticulosAll do depsn " + depsn); |
| 6867 | // // System.out.println("::: BaseDatos getArticulosAll do foto " + foto); | 6867 | // // System.out.println("::: BaseDatos getArticulosAll do foto " + foto); |
| 6868 | //*/ | 6868 | //*/ |
| 6869 | // // String exisVenta = c_1.getString(7); | 6869 | // // String exisVenta = c_1.getString(7); |
| 6870 | // // String exisDeposito = c_1.getString(8); | 6870 | // // String exisDeposito = c_1.getString(8); |
| 6871 | // | 6871 | // |
| 6872 | // Referencia referencia = new Referencia(); | 6872 | // Referencia referencia = new Referencia(); |
| 6873 | // referencia.setSector(Integer.parseInt(sector)); | 6873 | // referencia.setSector(Integer.parseInt(sector)); |
| 6874 | // referencia.setArticulo(Integer.parseInt(codigo)); | 6874 | // referencia.setArticulo(Integer.parseInt(codigo)); |
| 6875 | // referencia.setBalanza(Integer.parseInt(balanza)); | 6875 | // referencia.setBalanza(Integer.parseInt(balanza)); |
| 6876 | // referencia.setDecimales(Integer.parseInt(decimales)); | 6876 | // referencia.setDecimales(Integer.parseInt(decimales)); |
| 6877 | // referencia.setCodigo_barra(codigoBarra); | 6877 | // referencia.setCodigo_barra(codigoBarra); |
| 6878 | // referencia.setDescripcion(descripcion); | 6878 | // referencia.setDescripcion(descripcion); |
| 6879 | // referencia.setPrecio_venta(Double.parseDouble(precioVenta)); | 6879 | // referencia.setPrecio_venta(Double.parseDouble(precioVenta)); |
| 6880 | // referencia.setPrecio_costo(Double.parseDouble(precioCosto)); | 6880 | // referencia.setPrecio_costo(Double.parseDouble(precioCosto)); |
| 6881 | // | 6881 | // |
| 6882 | // referencia.setExis_venta(Double.parseDouble(exisventa)); | 6882 | // referencia.setExis_venta(Double.parseDouble(exisventa)); |
| 6883 | // referencia.setExis_deposito(Double.parseDouble(exisdep)); | 6883 | // referencia.setExis_deposito(Double.parseDouble(exisdep)); |
| 6884 | // referencia.setFoto(foto); | 6884 | // referencia.setFoto(foto); |
| 6885 | // //System.out.println("::: BaseDatos Referencia " + referencia); | 6885 | // //System.out.println("::: BaseDatos Referencia " + referencia); |
| 6886 | // Referencias.add(referencia); | 6886 | // Referencias.add(referencia); |
| 6887 | // } while (c_1.moveToNext()); | 6887 | // } while (c_1.moveToNext()); |
| 6888 | // } | 6888 | // } |
| 6889 | // | 6889 | // |
| 6890 | // } catch (Exception e1) { | 6890 | // } catch (Exception e1) { |
| 6891 | // | 6891 | // |
| 6892 | // } | 6892 | // } |
| 6893 | // dtb_1.close(); | 6893 | // dtb_1.close(); |
| 6894 | // | 6894 | // |
| 6895 | // return Referencias; | 6895 | // return Referencias; |
| 6896 | // | 6896 | // |
| 6897 | // } | 6897 | // } |
| 6898 | // | 6898 | // |
| 6899 | // /** | 6899 | // /** |
| 6900 | // * Busca los inventarios en la bd | 6900 | // * Busca los inventarios en la bd |
| 6901 | // * <p> | 6901 | // * <p> |
| 6902 | // * 1 Abrimos la base de datos en modo lectura | 6902 | // * 1 Abrimos la base de datos en modo lectura |
| 6903 | // * <p> | 6903 | // * <p> |
| 6904 | // * 2 Buscamos todos los inventarios | 6904 | // * 2 Buscamos todos los inventarios |
| 6905 | // * <p> | 6905 | // * <p> |
| 6906 | // * 3 Genera el hashmap, uno por inventario | 6906 | // * 3 Genera el hashmap, uno por inventario |
| 6907 | // * <p> | 6907 | // * <p> |
| 6908 | // * 4 Agrega el hashmap en la entrada correspondiente a ese inventario | 6908 | // * 4 Agrega el hashmap en la entrada correspondiente a ese inventario |
| 6909 | // * <p> | 6909 | // * <p> |
| 6910 | // * 5 Cerramos conexiones | 6910 | // * 5 Cerramos conexiones |
| 6911 | // * | 6911 | // * |
| 6912 | // * @return un HashMap que guarda los inventarios por id de inventario | 6912 | // * @return un HashMap que guarda los inventarios por id de inventario |
| 6913 | // * @throws ExceptionBDD | 6913 | // * @throws ExceptionBDD |
| 6914 | // * si no encuentra inventarios | 6914 | // * si no encuentra inventarios |
| 6915 | // */ | 6915 | // */ |
| 6916 | // public HashMap<Integer, HashMap<String, String>> selectInventariosCompraEnBdd() | 6916 | // public HashMap<Integer, HashMap<String, String>> selectInventariosCompraEnBdd() |
| 6917 | // throws ExceptionBDD { | 6917 | // throws ExceptionBDD { |
| 6918 | // System.out.println("::: BaseDAtos 5956 selectInventariosCompraEnBdd"); | 6918 | // System.out.println("::: BaseDAtos 5956 selectInventariosCompraEnBdd"); |
| 6919 | // HashMap<Integer, HashMap<String, String>> tablaResultados = new HashMap<Integer, HashMap<String, String>>(); | 6919 | // HashMap<Integer, HashMap<String, String>> tablaResultados = new HashMap<Integer, HashMap<String, String>>(); |
| 6920 | // // 1 Abrimos la base de datos en modo lectura | 6920 | // // 1 Abrimos la base de datos en modo lectura |
| 6921 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 6921 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 6922 | // Cursor c; | 6922 | // Cursor c; |
| 6923 | // String whereClause = "inv_lug=3";// | 6923 | // String whereClause = "inv_lug=3";// |
| 6924 | // c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, | 6924 | // c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, |
| 6925 | // null, "INV_NUM"+ " ASC" ); | 6925 | // null, "INV_NUM"+ " ASC" ); |
| 6926 | // // 2 Buscamos todos los inventarios | 6926 | // // 2 Buscamos todos los inventarios |
| 6927 | // if (c.moveToFirst()) { | 6927 | // if (c.moveToFirst()) { |
| 6928 | // while (!c.isAfterLast()) { | 6928 | // while (!c.isAfterLast()) { |
| 6929 | // HashMap<String, String> tablaUnInventario = new HashMap<String, String>(); | 6929 | // HashMap<String, String> tablaUnInventario = new HashMap<String, String>(); |
| 6930 | // /* | 6930 | // /* |
| 6931 | // * 3 Genera el hashmap, uno por inventario | 6931 | // * 3 Genera el hashmap, uno por inventario |
| 6932 | // */ | 6932 | // */ |
| 6933 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_numero, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); | 6933 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_numero, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); |
| 6934 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_descripcion, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion))); | 6934 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_descripcion, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion))); |
| 6935 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_fechaInicio, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio))); | 6935 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_fechaInicio, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio))); |
| 6936 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_fechaFin, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin))); | 6936 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_fechaFin, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin))); |
| 6937 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_estado, String.valueOf(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)))); | 6937 | // tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_estado, String.valueOf(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)))); |
| 6938 | // /* | 6938 | // /* |
| 6939 | // * 4 Agrega el hashmap en la entrada correspondiente a ese | 6939 | // * 4 Agrega el hashmap en la entrada correspondiente a ese |
| 6940 | // * inventario | 6940 | // * inventario |
| 6941 | // */ | 6941 | // */ |
| 6942 | // tablaResultados | 6942 | // tablaResultados |
| 6943 | // .put(c.getInt(c | 6943 | // .put(c.getInt(c |
| 6944 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 6944 | // .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 6945 | // tablaUnInventario); | 6945 | // tablaUnInventario); |
| 6946 | // c.moveToNext(); | 6946 | // c.moveToNext(); |
| 6947 | // } | 6947 | // } |
| 6948 | // } else { | 6948 | // } else { |
| 6949 | // throw new ExceptionBDD("INVENTARIO", 0); | 6949 | // throw new ExceptionBDD("INVENTARIO", 0); |
| 6950 | // } | 6950 | // } |
| 6951 | // // 5 Cerramos conexiones | 6951 | // // 5 Cerramos conexiones |
| 6952 | // c.close(); | 6952 | // c.close(); |
| 6953 | // dtb.close(); | 6953 | // dtb.close(); |
| 6954 | // return tablaResultados; | 6954 | // return tablaResultados; |
| 6955 | // } | 6955 | // } |
| 6956 | // | 6956 | // |
| 6957 | // //SE COMENTA POR QUE NO LO LLAMA NADIE | 6957 | // //SE COMENTA POR QUE NO LO LLAMA NADIE |
| 6958 | // public String proveedorAsignado(int id_inventario) throws ExceptionBDD { | 6958 | // public String proveedorAsignado(int id_inventario) throws ExceptionBDD { |
| 6959 | // System.out.println("::: BaseDatos 6764 corroborar si tiene un proveedor asignado"); | 6959 | // System.out.println("::: BaseDatos 6764 corroborar si tiene un proveedor asignado"); |
| 6960 | // // 1 Abrimos la base de datos en modo lectura | 6960 | // // 1 Abrimos la base de datos en modo lectura |
| 6961 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 6961 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 6962 | // Cursor c; | 6962 | // Cursor c; |
| 6963 | // Cursor cc; | 6963 | // Cursor cc; |
| 6964 | // String codigo_devolver = ""; | 6964 | // String codigo_devolver = ""; |
| 6965 | // String nombre_devolver = ""; | 6965 | // String nombre_devolver = ""; |
| 6966 | // c= dtb.rawQuery("SELECT COMPRA_PROVE_COD FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD="+id_inventario, null); | 6966 | // c= dtb.rawQuery("SELECT COMPRA_PROVE_COD FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD="+id_inventario, null); |
| 6967 | // // 3 Evaluamos el resultado y si es 1 devolvemos true | 6967 | // // 3 Evaluamos el resultado y si es 1 devolvemos true |
| 6968 | // if (c.moveToFirst()) { | 6968 | // if (c.moveToFirst()) { |
| 6969 | // do { | 6969 | // do { |
| 6970 | // codigo_devolver= c.getString(0); | 6970 | // codigo_devolver= c.getString(0); |
| 6971 | // } while(c.moveToNext()); | 6971 | // } while(c.moveToNext()); |
| 6972 | // cc= dtb.rawQuery("SELECT PROV_DESC FROM PROVEEDORES WHERE PROV_COD="+codigo_devolver, null); | 6972 | // cc= dtb.rawQuery("SELECT PROV_DESC FROM PROVEEDORES WHERE PROV_COD="+codigo_devolver, null); |
| 6973 | // | 6973 | // |
| 6974 | // if (cc.moveToFirst()) { | 6974 | // if (cc.moveToFirst()) { |
| 6975 | // do { | 6975 | // do { |
| 6976 | // nombre_devolver= cc.getString(0); | 6976 | // nombre_devolver= cc.getString(0); |
| 6977 | // } while(cc.moveToNext()); | 6977 | // } while(cc.moveToNext()); |
| 6978 | // return nombre_devolver; | 6978 | // return nombre_devolver; |
| 6979 | // }else{ | 6979 | // }else{ |
| 6980 | // nombre_devolver = "ELEGIR PROVEEDOR"; | 6980 | // nombre_devolver = "ELEGIR PROVEEDOR"; |
| 6981 | // c.close(); | 6981 | // c.close(); |
| 6982 | // cc.close(); | 6982 | // cc.close(); |
| 6983 | // return nombre_devolver; | 6983 | // return nombre_devolver; |
| 6984 | // } | 6984 | // } |
| 6985 | // } else { | 6985 | // } else { |
| 6986 | // nombre_devolver = "ELEGIR PROVEEDOR"; | 6986 | // nombre_devolver = "ELEGIR PROVEEDOR"; |
| 6987 | // c.close(); | 6987 | // c.close(); |
| 6988 | // //cc.close(); | 6988 | // //cc.close(); |
| 6989 | // return nombre_devolver; | 6989 | // return nombre_devolver; |
| 6990 | // } | 6990 | // } |
| 6991 | // | 6991 | // |
| 6992 | // } | 6992 | // } |
| 6993 | // | 6993 | // |
| 6994 | // public boolean verificaBaseNueva(){ | 6994 | // public boolean verificaBaseNueva(){ |
| 6995 | // /*SE REALIZA UNA CONSULTA SOLAMENTE PARA VERIFICAR QUE SI LA BASE ES NUEVA, NO CREE UN INVENTARIO SIN | 6995 | // /*SE REALIZA UNA CONSULTA SOLAMENTE PARA VERIFICAR QUE SI LA BASE ES NUEVA, NO CREE UN INVENTARIO SIN |
| 6996 | // * ANTES QUE EL USUARIO USE EL INVENTARIO DINAMICO DE COMPRAS. VERIFICANDO QUE NO HAYA UN SOLO INVENTARIO | 6996 | // * ANTES QUE EL USUARIO USE EL INVENTARIO DINAMICO DE COMPRAS. VERIFICANDO QUE NO HAYA UN SOLO INVENTARIO |
| 6997 | // * EN LA PARTE DE COMPRAS PREGUNTANDO DESDE EL -3 PARA ABAJO*/ | 6997 | // * EN LA PARTE DE COMPRAS PREGUNTANDO DESDE EL -3 PARA ABAJO*/ |
| 6998 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 6998 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 6999 | // Cursor cvalidar; | 6999 | // Cursor cvalidar; |
| 7000 | // cvalidar= dtb.rawQuery("SELECT * FROM INVENTARIOS WHERE INV_NUM <=-3", null); | 7000 | // cvalidar= dtb.rawQuery("SELECT * FROM INVENTARIOS WHERE INV_NUM <=-3", null); |
| 7001 | // if (cvalidar.moveToFirst() == true) { | 7001 | // if (cvalidar.moveToFirst() == true) { |
| 7002 | // return true; | 7002 | // return true; |
| 7003 | // }else{ | 7003 | // }else{ |
| 7004 | // return false; | 7004 | // return false; |
| 7005 | // } | 7005 | // } |
| 7006 | // } | 7006 | // } |
| 7007 | // | 7007 | // |
| 7008 | // public void verComprasExistentes (Inventario inventario)throws ExceptionBDD{ | 7008 | // public void verComprasExistentes (Inventario inventario)throws ExceptionBDD{ |
| 7009 | // System.out.println("::: BaseDatos 6782"); | 7009 | // System.out.println("::: BaseDatos 6782"); |
| 7010 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 7010 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 7011 | // Cursor c; | 7011 | // Cursor c; |
| 7012 | // Cursor cc; | 7012 | // Cursor cc; |
| 7013 | // int inventario_encontrado = 0; | 7013 | // int inventario_encontrado = 0; |
| 7014 | // c= dtb.rawQuery("select * from INVENTARIOS WHERE INV_LUG=3 ORDER BY INV_NUM ASC LIMIT 1", null); | 7014 | // c= dtb.rawQuery("select * from INVENTARIOS WHERE INV_LUG=3 ORDER BY INV_NUM ASC LIMIT 1", null); |
| 7015 | // if (c.moveToFirst() == true) { | 7015 | // if (c.moveToFirst() == true) { |
| 7016 | // do { | 7016 | // do { |
| 7017 | // inventario_encontrado= Integer.parseInt(c.getString(0)); | 7017 | // inventario_encontrado= Integer.parseInt(c.getString(0)); |
| 7018 | // } while(c.moveToNext()); | 7018 | // } while(c.moveToNext()); |
| 7019 | // inventario_encontrado = inventario_encontrado - 1; | 7019 | // inventario_encontrado = inventario_encontrado - 1; |
| 7020 | // | 7020 | // |
| 7021 | // SQLiteDatabase dtbw = this.getWritableDatabase(); | 7021 | // SQLiteDatabase dtbw = this.getWritableDatabase(); |
| 7022 | // // Si hemos abierto correctamente la base de datos | 7022 | // // Si hemos abierto correctamente la base de datos |
| 7023 | // if (dtbw != null) { | 7023 | // if (dtbw != null) { |
| 7024 | // String descripcionCompleta = inventario.getDescripcion().trim(); | 7024 | // String descripcionCompleta = inventario.getDescripcion().trim(); |
| 7025 | // int n = descripcionCompleta.trim().length(); | 7025 | // int n = descripcionCompleta.trim().length(); |
| 7026 | // String obtenerDescripcion = descripcionCompleta.substring(0,(n-3)); | 7026 | // String obtenerDescripcion = descripcionCompleta.substring(0,(n-3)); |
| 7027 | // char car=descripcionCompleta.charAt(n-1); | 7027 | // char car=descripcionCompleta.charAt(n-1); |
| 7028 | // int variable_dep = 3; | 7028 | // int variable_dep = 3; |
| 7029 | // String str = ""; | 7029 | // String str = ""; |
| 7030 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 7030 | // // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 7031 | // str = "INSERT INTO " + tabla_inventarios_nombre | 7031 | // str = "INSERT INTO " + tabla_inventarios_nombre |
| 7032 | // + " VALUES(" + inventario_encontrado + "," + "'" | 7032 | // + " VALUES(" + inventario_encontrado + "," + "'" |
| 7033 | // + obtenerDescripcion + "'," + "'" | 7033 | // + obtenerDescripcion + "'," + "'" |
| 7034 | // + inventario.getFechaInicio() + "'," + "'" | 7034 | // + inventario.getFechaInicio() + "'," + "'" |
| 7035 | // + inventario.getFechaFin() + "'," | 7035 | // + inventario.getFechaFin() + "'," |
| 7036 | // + inventario.getEstado() + "," + variable_dep+ "," +0 | 7036 | // + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 7037 | // + ")"; | 7037 | // + ")"; |
| 7038 | // System.out.println("::: D.C. QUIERO VER VARIABLE_DEP "+variable_dep); | 7038 | // System.out.println("::: D.C. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 7039 | // dtb.execSQL(str); | 7039 | // dtb.execSQL(str); |
| 7040 | // //} | 7040 | // //} |
| 7041 | // } else { | 7041 | // } else { |
| 7042 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 7042 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 7043 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 7043 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 7044 | // } | 7044 | // } |
| 7045 | // } else { | 7045 | // } else { |
| 7046 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 7046 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 7047 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 7047 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 7048 | // } | 7048 | // } |
| 7049 | // | 7049 | // |
| 7050 | // } | 7050 | // } |
| 7051 | 7051 | ||
| 7052 | 7052 | ||
| 7053 | import android.content.ContentValues; | 7053 | import android.content.ContentValues; |
| 7054 | import android.content.Context; | 7054 | import android.content.Context; |
| 7055 | import android.database.Cursor; | 7055 | import android.database.Cursor; |
| 7056 | import android.database.sqlite.SQLiteDatabase; | 7056 | import android.database.sqlite.SQLiteDatabase; |
| 7057 | import android.database.sqlite.SQLiteDatabase.CursorFactory; | 7057 | import android.database.sqlite.SQLiteDatabase.CursorFactory; |
| 7058 | import android.database.sqlite.SQLiteOpenHelper; | 7058 | import android.database.sqlite.SQLiteOpenHelper; |
| 7059 | import android.widget.RadioGroup; | 7059 | import android.widget.RadioGroup; |
| 7060 | 7060 | ||
| 7061 | import com.focasoftware.deboinventario.Articulo; | 7061 | import com.focasoftware.deboinventario.Articulo; |
| 7062 | import com.focasoftware.deboinventario.ExceptionBDD; | 7062 | import com.focasoftware.deboinventario.ExceptionBDD; |
| 7063 | import com.focasoftware.deboinventario.ExceptionHttpExchange; | 7063 | import com.focasoftware.deboinventario.ExceptionHttpExchange; |
| 7064 | import com.focasoftware.deboinventario.GestorLogEventos; | 7064 | import com.focasoftware.deboinventario.GestorLogEventos; |
| 7065 | import com.focasoftware.deboinventario.HttpSender; | 7065 | import com.focasoftware.deboinventario.HttpSender; |
| 7066 | import com.focasoftware.deboinventario.HttpWriter; | 7066 | import com.focasoftware.deboinventario.HttpWriter; |
| 7067 | import com.focasoftware.deboinventario.Parametros; | 7067 | import com.focasoftware.deboinventario.Parametros; |
| 7068 | 7068 | ||
| 7069 | import org.w3c.dom.Document; | 7069 | import org.w3c.dom.Document; |
| 7070 | import org.w3c.dom.Element; | 7070 | import org.w3c.dom.Element; |
| 7071 | 7071 | ||
| 7072 | import java.io.File; | 7072 | import java.io.File; |
| 7073 | import java.io.IOException; | 7073 | import java.io.IOException; |
| 7074 | import java.text.SimpleDateFormat; | 7074 | import java.text.SimpleDateFormat; |
| 7075 | import java.util.ArrayList; | 7075 | import java.util.ArrayList; |
| 7076 | import java.util.Arrays; | 7076 | import java.util.Arrays; |
| 7077 | import java.util.Calendar; | 7077 | import java.util.Calendar; |
| 7078 | import java.util.Date; | 7078 | import java.util.Date; |
| 7079 | import java.util.HashMap; | 7079 | import java.util.HashMap; |
| 7080 | 7080 | ||
| 7081 | import javax.xml.parsers.DocumentBuilder; | 7081 | import javax.xml.parsers.DocumentBuilder; |
| 7082 | import javax.xml.parsers.DocumentBuilderFactory; | 7082 | import javax.xml.parsers.DocumentBuilderFactory; |
| 7083 | import javax.xml.parsers.ParserConfigurationException; | 7083 | import javax.xml.parsers.ParserConfigurationException; |
| 7084 | |||
| 7085 | import static com.focasoftware.deboinventario.ParametrosInventario.URL_COPIA_XML_EXPORT_RUTA; | ||
| 7084 | // ABALEGNO 17/10/2014 | 7086 | // ABALEGNO 17/10/2014 |
| 7085 | //import android.provider.Telephony.Mms.Part; | 7087 | //import android.provider.Telephony.Mms.Part; |
| 7086 | 7088 | ||
| 7087 | /** | 7089 | /** |
| 7088 | * Clase que maneja las conexiones y todas las operaciones de las Bases de | 7090 | * Clase que maneja las conexiones y todas las operaciones de las Bases de |
| 7089 | * Datos. | 7091 | * Datos. |
| 7090 | * | 7092 | * |
| 7091 | * @author GuillermoR | 7093 | * @author GuillermoR |
| 7092 | * | 7094 | * |
| 7093 | */ | 7095 | */ |
| 7094 | 7096 | ||
| 7095 | public class BaseDatos extends SQLiteOpenHelper { | 7097 | public class BaseDatos extends SQLiteOpenHelper { |
| 7096 | 7098 | ||
| 7097 | // ************************* | 7099 | // ************************* |
| 7098 | // ************************* | 7100 | // ************************* |
| 7099 | // **** ATRIBUTOS **** | 7101 | // **** ATRIBUTOS **** |
| 7100 | // ************************* | 7102 | // ************************* |
| 7101 | // ************************* | 7103 | // ************************* |
| 7102 | // | 7104 | // |
| 7103 | 7105 | ||
| 7104 | /** | 7106 | /** |
| 7105 | * Nombres de las Tablas de la base de datos parametrizadas | 7107 | * Nombres de las Tablas de la base de datos parametrizadas |
| 7106 | */ | 7108 | */ |
| 7107 | 7109 | ||
| 7108 | private String tabla_articulos_nombre = ParametrosInventario.tabla_articulos; | 7110 | private String tabla_articulos_nombre = ParametrosInventario.tabla_articulos; |
| 7109 | private String tabla_inventarios_nombre = ParametrosInventario.tabla_inventarios; | 7111 | private String tabla_inventarios_nombre = ParametrosInventario.tabla_inventarios; |
| 7110 | private String tabla_referencias_nombre = ParametrosInventario.tabla_referencias; | 7112 | private String tabla_referencias_nombre = ParametrosInventario.tabla_referencias; |
| 7111 | 7113 | ||
| 7112 | private String tabla_proveedores_nombre = ParametrosInventario.tabla_proveedores; | 7114 | private String tabla_proveedores_nombre = ParametrosInventario.tabla_proveedores; |
| 7113 | private String tabla_compraproveedor_nombre = ParametrosInventario.tabla_compra_proveedor; | 7115 | private String tabla_compraproveedor_nombre = ParametrosInventario.tabla_compra_proveedor; |
| 7114 | 7116 | ||
| 7115 | private RadioGroup RadioGroupProductosNoContabilizados; | 7117 | private RadioGroup RadioGroupProductosNoContabilizados; |
| 7116 | private int ProductosNoContabilizados; | 7118 | private int ProductosNoContabilizados; |
| 7117 | 7119 | ||
| 7118 | private int condR =0; | 7120 | private int condR =0; |
| 7119 | 7121 | ||
| 7120 | /*Variable para cuando esta activada la balanza*/ | 7122 | /*Variable para cuando esta activada la balanza*/ |
| 7121 | private String codcompleto = ""; | 7123 | private String codcompleto = ""; |
| 7122 | private String pesoObtenido = ""; | 7124 | private String pesoObtenido = ""; |
| 7123 | 7125 | ||
| 7124 | /** | 7126 | /** |
| 7125 | * Variables para almacenar las SQLs de Creaci๏ฟฝn de las tablas: | 7127 | * Variables para almacenar las SQLs de Creaci๏ฟฝn de las tablas: |
| 7126 | */ | 7128 | */ |
| 7127 | private String sqlCreateTablaArticulos = "CREATE TABLE IF NOT EXISTS " | 7129 | private String sqlCreateTablaArticulos = "CREATE TABLE IF NOT EXISTS " |
| 7128 | + tabla_articulos_nombre + " (" | 7130 | + tabla_articulos_nombre + " (" |
| 7129 | + ParametrosInventario.bal_bdd_articulo_sector + " INTEGER" + ", " | 7131 | + ParametrosInventario.bal_bdd_articulo_sector + " INTEGER" + ", " |
| 7130 | + ParametrosInventario.bal_bdd_articulo_codigo + " INTEGER" + ", " | 7132 | + ParametrosInventario.bal_bdd_articulo_codigo + " INTEGER" + ", " |
| 7131 | + ParametrosInventario.bal_bdd_articulo_balanza + " INTEGER" + ", " | 7133 | + ParametrosInventario.bal_bdd_articulo_balanza + " INTEGER" + ", " |
| 7132 | + ParametrosInventario.bal_bdd_articulo_decimales + " INTEGER" + ", " | 7134 | + ParametrosInventario.bal_bdd_articulo_decimales + " INTEGER" + ", " |
| 7133 | + ParametrosInventario.bal_bdd_articulo_codigo_barra | 7135 | + ParametrosInventario.bal_bdd_articulo_codigo_barra |
| 7134 | + " VARCHAR(150) DEFAULT '' " + ", " | 7136 | + " VARCHAR(150) DEFAULT '' " + ", " |
| 7135 | + ParametrosInventario.bal_bdd_articulo_codigo_barra_completo | 7137 | + ParametrosInventario.bal_bdd_articulo_codigo_barra_completo |
| 7136 | + " VARCHAR(150) DEFAULT '' " + ", " | 7138 | + " VARCHAR(150) DEFAULT '' " + ", " |
| 7137 | + ParametrosInventario.bal_bdd_articulo_inventario + " INTEGER" | 7139 | + ParametrosInventario.bal_bdd_articulo_inventario + " INTEGER" |
| 7138 | + ", " + ParametrosInventario.bal_bdd_articulo_descripcion | 7140 | + ", " + ParametrosInventario.bal_bdd_articulo_descripcion |
| 7139 | + " VARCHAR(50)" + ", " | 7141 | + " VARCHAR(50)" + ", " |
| 7140 | + ParametrosInventario.bal_bdd_articulo_precio_venta + " REAL" | 7142 | + ParametrosInventario.bal_bdd_articulo_precio_venta + " REAL" |
| 7141 | + ", " + ParametrosInventario.bal_bdd_articulo_precio_costo | 7143 | + ", " + ParametrosInventario.bal_bdd_articulo_precio_costo |
| 7142 | + " REAL" + ", " + ParametrosInventario.bal_bdd_articulo_foto | 7144 | + " REAL" + ", " + ParametrosInventario.bal_bdd_articulo_foto |
| 7143 | + " VARCHAR(100)" + ", " | 7145 | + " VARCHAR(100)" + ", " |
| 7144 | + ParametrosInventario.bal_bdd_articulo_cantidad + " FLOAT" | 7146 | + ParametrosInventario.bal_bdd_articulo_cantidad + " FLOAT" |
| 7145 | + ", " | 7147 | + ", " |
| 7146 | + ParametrosInventario.bal_bdd_articulo_subtotal + " FLOAT" | 7148 | + ParametrosInventario.bal_bdd_articulo_subtotal + " FLOAT" |
| 7147 | + ", " | 7149 | + ", " |
| 7148 | + ParametrosInventario.bal_bdd_articulo_pesaje + " FLOAT" | 7150 | + ParametrosInventario.bal_bdd_articulo_pesaje + " FLOAT" |
| 7149 | + ", " | 7151 | + ", " |
| 7150 | + ParametrosInventario.bal_bdd_articulo_existencia_venta + " REAL" | 7152 | + ParametrosInventario.bal_bdd_articulo_existencia_venta + " REAL" |
| 7151 | + ", " | 7153 | + ", " |
| 7152 | + ParametrosInventario.bal_bdd_articulo_existencia_deposito + " REAL" | 7154 | + ParametrosInventario.bal_bdd_articulo_existencia_deposito + " REAL" |
| 7153 | + ", " | 7155 | + ", " |
| 7154 | + ParametrosInventario.bal_bdd_articulo_depsn | 7156 | + ParametrosInventario.bal_bdd_articulo_depsn |
| 7155 | + " INTEGER" + ", " | 7157 | + " INTEGER" + ", " |
| 7156 | + ParametrosInventario.bal_bdd_articulo_fechaInicio | 7158 | + ParametrosInventario.bal_bdd_articulo_fechaInicio |
| 7157 | + " VARCHAR(24)" + ", " | 7159 | + " VARCHAR(24)" + ", " |
| 7158 | + ParametrosInventario.bal_bdd_articulo_fechaFin + " VARCHAR(24)" | 7160 | + ParametrosInventario.bal_bdd_articulo_fechaFin + " VARCHAR(24)" |
| 7159 | + ", " + "PRIMARY KEY (" | 7161 | + ", " + "PRIMARY KEY (" |
| 7160 | + ParametrosInventario.bal_bdd_articulo_sector + ", " | 7162 | + ParametrosInventario.bal_bdd_articulo_sector + ", " |
| 7161 | + ParametrosInventario.bal_bdd_articulo_codigo + ", " | 7163 | + ParametrosInventario.bal_bdd_articulo_codigo + ", " |
| 7162 | + ParametrosInventario.bal_bdd_articulo_inventario + ")" + " )"; | 7164 | + ParametrosInventario.bal_bdd_articulo_inventario + ")" + " )"; |
| 7163 | 7165 | ||
| 7164 | /** | 7166 | /** |
| 7165 | * Creacion de la tabla proveedores: | 7167 | * Creacion de la tabla proveedores: |
| 7166 | */ | 7168 | */ |
| 7167 | private String sqlCreateTablaProveedores = "CREATE TABLE IF NOT EXISTS " | 7169 | private String sqlCreateTablaProveedores = "CREATE TABLE IF NOT EXISTS " |
| 7168 | + tabla_proveedores_nombre + " (" | 7170 | + tabla_proveedores_nombre + " (" |
| 7169 | + ParametrosInventario.bal_bdd_proveedores_codigo + " INTEGER" + ", " | 7171 | + ParametrosInventario.bal_bdd_proveedores_codigo + " INTEGER" + ", " |
| 7170 | + ParametrosInventario.bal_bdd_proveedores_descripcion | 7172 | + ParametrosInventario.bal_bdd_proveedores_descripcion |
| 7171 | + " VARCHAR(150) NULL " + ", " + "PRIMARY KEY (" | 7173 | + " VARCHAR(150) NULL " + ", " + "PRIMARY KEY (" |
| 7172 | + ParametrosInventario.bal_bdd_proveedores_codigo + ")" + " )"; | 7174 | + ParametrosInventario.bal_bdd_proveedores_codigo + ")" + " )"; |
| 7173 | 7175 | ||
| 7174 | /** | 7176 | /** |
| 7175 | * Creacion de la tabla COMPRA_PROVEEDOR para relacionar la compra con un proveedor: | 7177 | * Creacion de la tabla COMPRA_PROVEEDOR para relacionar la compra con un proveedor: |
| 7176 | */ | 7178 | */ |
| 7177 | private String sqlCreateTablaCompraProveedor = "CREATE TABLE IF NOT EXISTS " | 7179 | private String sqlCreateTablaCompraProveedor = "CREATE TABLE IF NOT EXISTS " |
| 7178 | + tabla_compraproveedor_nombre + " (" | 7180 | + tabla_compraproveedor_nombre + " (" |
| 7179 | + ParametrosInventario.bal_bdd_compraproveedor_inventario + " INTEGER" + ", " | 7181 | + ParametrosInventario.bal_bdd_compraproveedor_inventario + " INTEGER" + ", " |
| 7180 | + ParametrosInventario.bal_bdd_compraproveedor_codigo | 7182 | + ParametrosInventario.bal_bdd_compraproveedor_codigo |
| 7181 | + " INTEGER )"; | 7183 | + " INTEGER )"; |
| 7182 | 7184 | ||
| 7183 | 7185 | ||
| 7184 | private String sqlCreateTablaInventarios = "CREATE TABLE IF NOT EXISTS " | 7186 | private String sqlCreateTablaInventarios = "CREATE TABLE IF NOT EXISTS " |
| 7185 | + tabla_inventarios_nombre + " (" | 7187 | + tabla_inventarios_nombre + " (" |
| 7186 | + ParametrosInventario.bal_bdd_inventario_numero + " INTEGER" | 7188 | + ParametrosInventario.bal_bdd_inventario_numero + " INTEGER" |
| 7187 | + ", " + ParametrosInventario.bal_bdd_inventario_descripcion | 7189 | + ", " + ParametrosInventario.bal_bdd_inventario_descripcion |
| 7188 | + " VARCHAR(50)" + ", " | 7190 | + " VARCHAR(50)" + ", " |
| 7189 | + ParametrosInventario.bal_bdd_inventario_fechaInicio | 7191 | + ParametrosInventario.bal_bdd_inventario_fechaInicio |
| 7190 | + " VARCHAR(24)" + ", " | 7192 | + " VARCHAR(24)" + ", " |
| 7191 | + ParametrosInventario.bal_bdd_inventario_fechaFin + " VARCHAR(24)" | 7193 | + ParametrosInventario.bal_bdd_inventario_fechaFin + " VARCHAR(24)" |
| 7192 | + ", " + ParametrosInventario.bal_bdd_inventario_estado | 7194 | + ", " + ParametrosInventario.bal_bdd_inventario_estado |
| 7193 | + " INTEGER" + ", " + ParametrosInventario.bal_bdd_inventario_lugar | 7195 | + " INTEGER" + ", " + ParametrosInventario.bal_bdd_inventario_lugar |
| 7194 | + " INTEGER" + ", " | 7196 | + " INTEGER" + ", " |
| 7195 | + ParametrosInventario.bal_bdd_inventario_prodcont | 7197 | + ParametrosInventario.bal_bdd_inventario_prodcont |
| 7196 | + " INTEGER" + ", "+ "PRIMARY KEY (" | 7198 | + " INTEGER" + ", "+ "PRIMARY KEY (" |
| 7197 | + ParametrosInventario.bal_bdd_inventario_numero + ")" + " )"; | 7199 | + ParametrosInventario.bal_bdd_inventario_numero + ")" + " )"; |
| 7198 | 7200 | ||
| 7199 | private String sqlCreateTablaReferencias = "CREATE TABLE IF NOT EXISTS " | 7201 | private String sqlCreateTablaReferencias = "CREATE TABLE IF NOT EXISTS " |
| 7200 | + tabla_referencias_nombre + " (" | 7202 | + tabla_referencias_nombre + " (" |
| 7201 | + ParametrosInventario.bal_bdd_referencia_sector + " INTEGER" | 7203 | + ParametrosInventario.bal_bdd_referencia_sector + " INTEGER" |
| 7202 | + ", " + ParametrosInventario.bal_bdd_referencia_codigo | 7204 | + ", " + ParametrosInventario.bal_bdd_referencia_codigo |
| 7203 | + " INTEGER" + ", " | 7205 | + " INTEGER" + ", " |
| 7204 | + ParametrosInventario.bal_bdd_referencia_balanza | 7206 | + ParametrosInventario.bal_bdd_referencia_balanza |
| 7205 | + " INTEGER" + ", " | 7207 | + " INTEGER" + ", " |
| 7206 | + ParametrosInventario.bal_bdd_referencia_decimales | 7208 | + ParametrosInventario.bal_bdd_referencia_decimales |
| 7207 | + " INTEGER" + ", " | 7209 | + " INTEGER" + ", " |
| 7208 | + ParametrosInventario.bal_bdd_referencia_existencia_venta | 7210 | + ParametrosInventario.bal_bdd_referencia_existencia_venta |
| 7209 | + " REAL" + ", " | 7211 | + " REAL" + ", " |
| 7210 | + ParametrosInventario.bal_bdd_referencia_existencia_deposito | 7212 | + ParametrosInventario.bal_bdd_referencia_existencia_deposito |
| 7211 | + " REAL" + ", " | 7213 | + " REAL" + ", " |
| 7212 | + ParametrosInventario.bal_bdd_referencia_codigo_barra | 7214 | + ParametrosInventario.bal_bdd_referencia_codigo_barra |
| 7213 | + " VARCHAR(150)" + ", " | 7215 | + " VARCHAR(150)" + ", " |
| 7214 | + ParametrosInventario.bal_bdd_referencia_codigo_barra_completo | 7216 | + ParametrosInventario.bal_bdd_referencia_codigo_barra_completo |
| 7215 | + " VARCHAR(150)" + ", " | 7217 | + " VARCHAR(150)" + ", " |
| 7216 | + ParametrosInventario.bal_bdd_referencia_descripcion | 7218 | + ParametrosInventario.bal_bdd_referencia_descripcion |
| 7217 | + " VARCHAR(50)" + ", " | 7219 | + " VARCHAR(50)" + ", " |
| 7218 | + ParametrosInventario.bal_bdd_referencia_precio_venta | 7220 | + ParametrosInventario.bal_bdd_referencia_precio_venta |
| 7219 | + " REAL" | 7221 | + " REAL" |
| 7220 | + ", " | 7222 | + ", " |
| 7221 | + ParametrosInventario.bal_bdd_referencia_precio_costo | 7223 | + ParametrosInventario.bal_bdd_referencia_precio_costo |
| 7222 | + " REAL" + ", " | 7224 | + " REAL" + ", " |
| 7223 | + ParametrosInventario.bal_bdd_referencia_depsn | 7225 | + ParametrosInventario.bal_bdd_referencia_depsn |
| 7224 | + " INTEGER" + ", " | 7226 | + " INTEGER" + ", " |
| 7225 | + ParametrosInventario.bal_bdd_referencia_foto | 7227 | + ParametrosInventario.bal_bdd_referencia_foto |
| 7226 | + " VARCHAR(100)" + ", " + "PRIMARY KEY (" | 7228 | + " VARCHAR(100)" + ", " + "PRIMARY KEY (" |
| 7227 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + ")" + " )"; | 7229 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + ")" + " )"; |
| 7228 | 7230 | ||
| 7229 | private String sqlCreateTableLocales = "CREATE TABLE IF NOT EXISTS [" | 7231 | private String sqlCreateTableLocales = "CREATE TABLE IF NOT EXISTS [" |
| 7230 | + ParametrosInventario.tabla_local + "] ( " + "[" | 7232 | + ParametrosInventario.tabla_local + "] ( " + "[" |
| 7231 | + ParametrosInventario.bal_bdd_local_idLocal | 7233 | + ParametrosInventario.bal_bdd_local_idLocal |
| 7232 | + "] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," + "[" | 7234 | + "] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," + "[" |
| 7233 | + ParametrosInventario.bal_bdd_local_nombre | 7235 | + ParametrosInventario.bal_bdd_local_nombre |
| 7234 | + "] VARCHAR(25) DEFAULT ''," + "[" | 7236 | + "] VARCHAR(25) DEFAULT ''," + "[" |
| 7235 | + ParametrosInventario.bal_bdd_local_descripcion | 7237 | + ParametrosInventario.bal_bdd_local_descripcion |
| 7236 | + "] VARCHAR(512) DEFAULT ''" + ")"; | 7238 | + "] VARCHAR(512) DEFAULT ''" + ")"; |
| 7237 | 7239 | ||
| 7238 | // ***************************** | 7240 | // ***************************** |
| 7239 | // ***************************** | 7241 | // ***************************** |
| 7240 | // **** CONSTRUCTORES **** | 7242 | // **** CONSTRUCTORES **** |
| 7241 | // ***************************** | 7243 | // ***************************** |
| 7242 | // ***************************** | 7244 | // ***************************** |
| 7243 | 7245 | ||
| 7244 | /** | 7246 | /** |
| 7245 | * Constructor de la clase BaseDatos | 7247 | * Constructor de la clase BaseDatos |
| 7246 | * | 7248 | * |
| 7247 | * @param contexto | 7249 | * @param contexto |
| 7248 | * @param nombre | 7250 | * @param nombre |
| 7249 | * @param factory | 7251 | * @param factory |
| 7250 | * @param version | 7252 | * @param version |
| 7251 | */ | 7253 | */ |
| 7252 | public BaseDatos(Context contexto, String nombre, CursorFactory factory, | 7254 | public BaseDatos(Context contexto, String nombre, CursorFactory factory, |
| 7253 | int version) { | 7255 | int version) { |
| 7254 | super(contexto, ParametrosInventario.BDD_NOMBRE, null, | 7256 | super(contexto, ParametrosInventario.BDD_NOMBRE, null, |
| 7255 | ParametrosInventario.BDD_VERSION); | 7257 | ParametrosInventario.BDD_VERSION); |
| 7256 | } | 7258 | } |
| 7257 | 7259 | ||
| 7258 | /** | 7260 | /** |
| 7259 | * Constructor de la clase BaseDatos con 2 parametros | 7261 | * Constructor de la clase BaseDatos con 2 parametros |
| 7260 | * | 7262 | * |
| 7261 | * @param contexto | 7263 | * @param contexto |
| 7262 | */ | 7264 | */ |
| 7263 | public BaseDatos(Context contexto) { | 7265 | public BaseDatos(Context contexto) { |
| 7264 | this(contexto, ParametrosInventario.BDD_NOMBRE, null, | 7266 | this(contexto, ParametrosInventario.BDD_NOMBRE, null, |
| 7265 | ParametrosInventario.BDD_VERSION); | 7267 | ParametrosInventario.BDD_VERSION); |
| 7266 | System.out.println("::: BaseDatos 177 Version en BD " + ParametrosInventario.VERSION); | 7268 | System.out.println("::: BaseDatos 177 Version en BD " + ParametrosInventario.VERSION); |
| 7267 | } | 7269 | } |
| 7268 | 7270 | ||
| 7269 | // *********************** | 7271 | // *********************** |
| 7270 | // *********************** | 7272 | // *********************** |
| 7271 | // **** METODOS **** | 7273 | // **** METODOS **** |
| 7272 | // *********************** | 7274 | // *********************** |
| 7273 | // *********************** | 7275 | // *********************** |
| 7274 | /** | 7276 | /** |
| 7275 | * Al llamarse este metodo se crean las tablas de nuevo? | 7277 | * Al llamarse este metodo se crean las tablas de nuevo? |
| 7276 | */ | 7278 | */ |
| 7277 | @Override | 7279 | @Override |
| 7278 | public void onCreate(SQLiteDatabase db) { | 7280 | public void onCreate(SQLiteDatabase db) { |
| 7279 | // Se ejecuta la sentencia SQL de creaci๏ฟฝn de la tabla | 7281 | // Se ejecuta la sentencia SQL de creaci๏ฟฝn de la tabla |
| 7280 | db.execSQL(sqlCreateTablaArticulos); | 7282 | db.execSQL(sqlCreateTablaArticulos); |
| 7281 | db.execSQL(sqlCreateTablaInventarios); | 7283 | db.execSQL(sqlCreateTablaInventarios); |
| 7282 | db.execSQL(sqlCreateTablaReferencias); | 7284 | db.execSQL(sqlCreateTablaReferencias); |
| 7283 | db.execSQL(sqlCreateTableLocales); | 7285 | db.execSQL(sqlCreateTableLocales); |
| 7284 | db.execSQL(sqlCreateTablaProveedores); | 7286 | db.execSQL(sqlCreateTablaProveedores); |
| 7285 | db.execSQL(sqlCreateTablaCompraProveedor); | 7287 | db.execSQL(sqlCreateTablaCompraProveedor); |
| 7286 | } | 7288 | } |
| 7287 | 7289 | ||
| 7288 | /** | 7290 | /** |
| 7289 | * Funcion para crear desde cero y vaciar las tablas de articulos e | 7291 | * Funcion para crear desde cero y vaciar las tablas de articulos e |
| 7290 | * inventarios | 7292 | * inventarios |
| 7291 | * <p> | 7293 | * <p> |
| 7292 | * 1๏ฟฝ Las borramos | 7294 | * 1๏ฟฝ Las borramos |
| 7293 | * <p> | 7295 | * <p> |
| 7294 | * 2๏ฟฝ Las creamos de nuevo | 7296 | * 2๏ฟฝ Las creamos de nuevo |
| 7295 | */ | 7297 | */ |
| 7296 | public void reiniciarArticulosInventarios() { | 7298 | public void reiniciarArticulosInventarios() { |
| 7297 | System.out.println("::: BaseDatos 206 reiniciarArticulosInventarios"); | 7299 | System.out.println("::: BaseDatos 206 reiniciarArticulosInventarios"); |
| 7298 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7300 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7299 | 7301 | ||
| 7300 | // 1๏ฟฝ Las borramos | 7302 | // 1๏ฟฝ Las borramos |
| 7301 | dtb.execSQL("DROP TABLE IF EXISTS " + tabla_articulos_nombre); | 7303 | dtb.execSQL("DROP TABLE IF EXISTS " + tabla_articulos_nombre); |
| 7302 | dtb.execSQL("DROP TABLE IF EXISTS " + tabla_inventarios_nombre); | 7304 | dtb.execSQL("DROP TABLE IF EXISTS " + tabla_inventarios_nombre); |
| 7303 | 7305 | ||
| 7304 | // 2๏ฟฝ Las creamos de nuevo | 7306 | // 2๏ฟฝ Las creamos de nuevo |
| 7305 | dtb.execSQL(sqlCreateTablaArticulos); | 7307 | dtb.execSQL(sqlCreateTablaArticulos); |
| 7306 | dtb.execSQL(sqlCreateTablaInventarios); | 7308 | dtb.execSQL(sqlCreateTablaInventarios); |
| 7307 | 7309 | ||
| 7308 | dtb.close(); | 7310 | dtb.close(); |
| 7309 | 7311 | ||
| 7310 | } | 7312 | } |
| 7311 | 7313 | ||
| 7312 | public void crearTablaLocales() { | 7314 | public void crearTablaLocales() { |
| 7313 | System.out.println("::: BaseDatos 222 crearTablaLocales"); | 7315 | System.out.println("::: BaseDatos 222 crearTablaLocales"); |
| 7314 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7316 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7315 | dtb.execSQL(sqlCreateTableLocales); | 7317 | dtb.execSQL(sqlCreateTableLocales); |
| 7316 | dtb.close(); | 7318 | dtb.close(); |
| 7317 | } | 7319 | } |
| 7318 | 7320 | ||
| 7319 | public void guardarLocal(Local pLocal) { | 7321 | public void guardarLocal(Local pLocal) { |
| 7320 | try { | 7322 | try { |
| 7321 | System.out.println("::: BaseDatos 230 guardarLocal"); | 7323 | System.out.println("::: BaseDatos 230 guardarLocal"); |
| 7322 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7324 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7323 | if (dtb != null) { | 7325 | if (dtb != null) { |
| 7324 | 7326 | ||
| 7325 | ContentValues nuevoRegistro = new ContentValues(); | 7327 | ContentValues nuevoRegistro = new ContentValues(); |
| 7326 | nuevoRegistro.put(ParametrosInventario.bal_bdd_local_nombre, | 7328 | nuevoRegistro.put(ParametrosInventario.bal_bdd_local_nombre, |
| 7327 | pLocal.getNombre()); | 7329 | pLocal.getNombre()); |
| 7328 | nuevoRegistro.put( | 7330 | nuevoRegistro.put( |
| 7329 | ParametrosInventario.bal_bdd_local_descripcion, | 7331 | ParametrosInventario.bal_bdd_local_descripcion, |
| 7330 | pLocal.getDescripcion()); | 7332 | pLocal.getDescripcion()); |
| 7331 | 7333 | ||
| 7332 | // 4๏ฟฝ Insertamos el registro en la base de datos | 7334 | // 4๏ฟฝ Insertamos el registro en la base de datos |
| 7333 | long resultado = dtb.insert(ParametrosInventario.tabla_local, | 7335 | long resultado = dtb.insert(ParametrosInventario.tabla_local, |
| 7334 | null, nuevoRegistro); | 7336 | null, nuevoRegistro); |
| 7335 | 7337 | ||
| 7336 | // Test resultado INSERT: | 7338 | // Test resultado INSERT: |
| 7337 | if (resultado < 0) { | 7339 | if (resultado < 0) { |
| 7338 | 7340 | ||
| 7339 | } | 7341 | } |
| 7340 | 7342 | ||
| 7341 | } else { | 7343 | } else { |
| 7342 | 7344 | ||
| 7343 | } | 7345 | } |
| 7344 | 7346 | ||
| 7345 | // 5๏ฟฝ Cierre: | 7347 | // 5๏ฟฝ Cierre: |
| 7346 | dtb.close(); | 7348 | dtb.close(); |
| 7347 | 7349 | ||
| 7348 | return; | 7350 | return; |
| 7349 | } catch (Exception e) { | 7351 | } catch (Exception e) { |
| 7350 | 7352 | ||
| 7351 | } | 7353 | } |
| 7352 | 7354 | ||
| 7353 | } | 7355 | } |
| 7354 | 7356 | ||
| 7355 | public void actualizarLocal(Local pLocal) { | 7357 | public void actualizarLocal(Local pLocal) { |
| 7356 | try { | 7358 | try { |
| 7357 | System.out.println("::: BaseDatos 266 actualizarLocal"); | 7359 | System.out.println("::: BaseDatos 266 actualizarLocal"); |
| 7358 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7360 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7359 | 7361 | ||
| 7360 | ContentValues registro = new ContentValues(); | 7362 | ContentValues registro = new ContentValues(); |
| 7361 | registro.put(ParametrosInventario.bal_bdd_local_nombre, | 7363 | registro.put(ParametrosInventario.bal_bdd_local_nombre, |
| 7362 | pLocal.getNombre()); | 7364 | pLocal.getNombre()); |
| 7363 | registro.put(ParametrosInventario.bal_bdd_local_descripcion, | 7365 | registro.put(ParametrosInventario.bal_bdd_local_descripcion, |
| 7364 | pLocal.getDescripcion()); | 7366 | pLocal.getDescripcion()); |
| 7365 | 7367 | ||
| 7366 | // 4๏ฟฝ Insertamos el registro en la base de datos | 7368 | // 4๏ฟฝ Insertamos el registro en la base de datos |
| 7367 | long resultado = dtb.update(ParametrosInventario.tabla_local, | 7369 | long resultado = dtb.update(ParametrosInventario.tabla_local, |
| 7368 | registro, ParametrosInventario.bal_bdd_local_idLocal | 7370 | registro, ParametrosInventario.bal_bdd_local_idLocal |
| 7369 | + " = " + pLocal.getIdLocal(), null); | 7371 | + " = " + pLocal.getIdLocal(), null); |
| 7370 | // 5๏ฟฝ Cierre: | 7372 | // 5๏ฟฝ Cierre: |
| 7371 | dtb.close(); | 7373 | dtb.close(); |
| 7372 | 7374 | ||
| 7373 | return; | 7375 | return; |
| 7374 | } catch (Exception e) { | 7376 | } catch (Exception e) { |
| 7375 | 7377 | ||
| 7376 | } | 7378 | } |
| 7377 | 7379 | ||
| 7378 | } | 7380 | } |
| 7379 | 7381 | ||
| 7380 | public Local ObtenerLocal_x_Id(int pIdLocal) throws ExceptionBDD { | 7382 | public Local ObtenerLocal_x_Id(int pIdLocal) throws ExceptionBDD { |
| 7381 | try { | 7383 | try { |
| 7382 | System.out.println("::: BaseDatos 291 ObtenerLocal_x_Id"); | 7384 | System.out.println("::: BaseDatos 291 ObtenerLocal_x_Id"); |
| 7383 | // 1๏ฟฝ Abrimos la base de datos en modo lectura | 7385 | // 1๏ฟฝ Abrimos la base de datos en modo lectura |
| 7384 | SQLiteDatabase dtb = this.getReadableDatabase(); | 7386 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 7385 | 7387 | ||
| 7386 | String sql = "SELECT * FROM " + ParametrosInventario.tabla_local | 7388 | String sql = "SELECT * FROM " + ParametrosInventario.tabla_local |
| 7387 | + " WHERE " + ParametrosInventario.bal_bdd_local_idLocal | 7389 | + " WHERE " + ParametrosInventario.bal_bdd_local_idLocal |
| 7388 | + " = " + pIdLocal; | 7390 | + " = " + pIdLocal; |
| 7389 | Cursor c = dtb.rawQuery(sql, null); | 7391 | Cursor c = dtb.rawQuery(sql, null); |
| 7390 | Local local = new Local(null, null); | 7392 | Local local = new Local(null, null); |
| 7391 | // Result: | 7393 | // Result: |
| 7392 | if (c.moveToFirst()) { | 7394 | if (c.moveToFirst()) { |
| 7393 | while (c.isAfterLast() == false) { | 7395 | while (c.isAfterLast() == false) { |
| 7394 | // 3๏ฟฝ Agregamos cada numero a la lista | 7396 | // 3๏ฟฝ Agregamos cada numero a la lista |
| 7395 | int idLocal = c | 7397 | int idLocal = c |
| 7396 | .getInt(c | 7398 | .getInt(c |
| 7397 | .getColumnIndex(ParametrosInventario.bal_bdd_local_idLocal)); | 7399 | .getColumnIndex(ParametrosInventario.bal_bdd_local_idLocal)); |
| 7398 | String nombreLocal = c | 7400 | String nombreLocal = c |
| 7399 | .getString(c | 7401 | .getString(c |
| 7400 | .getColumnIndex(ParametrosInventario.bal_bdd_local_nombre)); | 7402 | .getColumnIndex(ParametrosInventario.bal_bdd_local_nombre)); |
| 7401 | String descripcionLocal = c | 7403 | String descripcionLocal = c |
| 7402 | .getString(c | 7404 | .getString(c |
| 7403 | .getColumnIndex(ParametrosInventario.bal_bdd_local_descripcion)); | 7405 | .getColumnIndex(ParametrosInventario.bal_bdd_local_descripcion)); |
| 7404 | 7406 | ||
| 7405 | local.setIdLocal(idLocal); | 7407 | local.setIdLocal(idLocal); |
| 7406 | local.setDescripcion(descripcionLocal); | 7408 | local.setDescripcion(descripcionLocal); |
| 7407 | local.setNombre(nombreLocal); | 7409 | local.setNombre(nombreLocal); |
| 7408 | 7410 | ||
| 7409 | c.moveToNext(); | 7411 | c.moveToNext(); |
| 7410 | } | 7412 | } |
| 7411 | } else { | 7413 | } else { |
| 7412 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 7414 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 7413 | "Imposible obtener el local."); | 7415 | "Imposible obtener el local."); |
| 7414 | } | 7416 | } |
| 7415 | 7417 | ||
| 7416 | // 4๏ฟฝ Cierre de BD | 7418 | // 4๏ฟฝ Cierre de BD |
| 7417 | dtb.close(); | 7419 | dtb.close(); |
| 7418 | return local; | 7420 | return local; |
| 7419 | } catch (Exception e) { | 7421 | } catch (Exception e) { |
| 7420 | 7422 | ||
| 7421 | GestorLogEventos log = new GestorLogEventos(); | 7423 | GestorLogEventos log = new GestorLogEventos(); |
| 7422 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 7424 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 7423 | log.log("[-- 2976 --]" + e.toString(), 4); | 7425 | log.log("[-- 2976 --]" + e.toString(), 4); |
| 7424 | 7426 | ||
| 7425 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 7427 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 7426 | "Imposible obtener los locales"); | 7428 | "Imposible obtener los locales"); |
| 7427 | } | 7429 | } |
| 7428 | } | 7430 | } |
| 7429 | 7431 | ||
| 7430 | public ArrayList<Local> ObtenerTodosLocales() throws ExceptionBDD { | 7432 | public ArrayList<Local> ObtenerTodosLocales() throws ExceptionBDD { |
| 7431 | try { | 7433 | try { |
| 7432 | System.out.println("::: BaseDatos 341 ObtenerTodosLocales"); | 7434 | System.out.println("::: BaseDatos 341 ObtenerTodosLocales"); |
| 7433 | // Variable de respuesta: | 7435 | // Variable de respuesta: |
| 7434 | ArrayList<Local> LocalesRetornables = new ArrayList<Local>(); | 7436 | ArrayList<Local> LocalesRetornables = new ArrayList<Local>(); |
| 7435 | 7437 | ||
| 7436 | // 1๏ฟฝ Abrimos la base de datos en modo lectura | 7438 | // 1๏ฟฝ Abrimos la base de datos en modo lectura |
| 7437 | SQLiteDatabase dtb = this.getReadableDatabase(); | 7439 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 7438 | 7440 | ||
| 7439 | // Request: | 7441 | // Request: |
| 7440 | String[] col = new String[] { | 7442 | String[] col = new String[] { |
| 7441 | ParametrosInventario.bal_bdd_local_idLocal, | 7443 | ParametrosInventario.bal_bdd_local_idLocal, |
| 7442 | ParametrosInventario.bal_bdd_local_nombre, | 7444 | ParametrosInventario.bal_bdd_local_nombre, |
| 7443 | ParametrosInventario.bal_bdd_local_descripcion }; | 7445 | ParametrosInventario.bal_bdd_local_descripcion }; |
| 7444 | // 2๏ฟฝ Ejecutamos la consulta | 7446 | // 2๏ฟฝ Ejecutamos la consulta |
| 7445 | Cursor c = dtb.query(ParametrosInventario.tabla_local, col, null, | 7447 | Cursor c = dtb.query(ParametrosInventario.tabla_local, col, null, |
| 7446 | null, null, null, null); | 7448 | null, null, null, null); |
| 7447 | 7449 | ||
| 7448 | // Result: | 7450 | // Result: |
| 7449 | if (c.moveToFirst()) { | 7451 | if (c.moveToFirst()) { |
| 7450 | do { | 7452 | do { |
| 7451 | 7453 | ||
| 7452 | // 3๏ฟฝ Agregamos cada numero a la lista | 7454 | // 3๏ฟฝ Agregamos cada numero a la lista |
| 7453 | int idLocal = c | 7455 | int idLocal = c |
| 7454 | .getInt(c | 7456 | .getInt(c |
| 7455 | .getColumnIndex(ParametrosInventario.bal_bdd_local_idLocal)); | 7457 | .getColumnIndex(ParametrosInventario.bal_bdd_local_idLocal)); |
| 7456 | String nombreLocal = c | 7458 | String nombreLocal = c |
| 7457 | .getString(c | 7459 | .getString(c |
| 7458 | .getColumnIndex(ParametrosInventario.bal_bdd_local_nombre)); | 7460 | .getColumnIndex(ParametrosInventario.bal_bdd_local_nombre)); |
| 7459 | String descripcionLocal = c | 7461 | String descripcionLocal = c |
| 7460 | .getString(c | 7462 | .getString(c |
| 7461 | .getColumnIndex(ParametrosInventario.bal_bdd_local_descripcion)); | 7463 | .getColumnIndex(ParametrosInventario.bal_bdd_local_descripcion)); |
| 7462 | Local loc = new Local(nombreLocal, descripcionLocal, | 7464 | Local loc = new Local(nombreLocal, descripcionLocal, |
| 7463 | idLocal); | 7465 | idLocal); |
| 7464 | LocalesRetornables.add(loc); | 7466 | LocalesRetornables.add(loc); |
| 7465 | 7467 | ||
| 7466 | } while (c.moveToNext()); | 7468 | } while (c.moveToNext()); |
| 7467 | } | 7469 | } |
| 7468 | dtb.close(); | 7470 | dtb.close(); |
| 7469 | return LocalesRetornables; | 7471 | return LocalesRetornables; |
| 7470 | } catch (Exception e) { | 7472 | } catch (Exception e) { |
| 7471 | 7473 | ||
| 7472 | GestorLogEventos log = new GestorLogEventos(); | 7474 | GestorLogEventos log = new GestorLogEventos(); |
| 7473 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 7475 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 7474 | log.log("[-- 2976 --]" + e.toString(), 4); | 7476 | log.log("[-- 2976 --]" + e.toString(), 4); |
| 7475 | 7477 | ||
| 7476 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 7478 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 7477 | "Imposible obtener los locales"); | 7479 | "Imposible obtener los locales"); |
| 7478 | } | 7480 | } |
| 7479 | } | 7481 | } |
| 7480 | 7482 | ||
| 7481 | /** | 7483 | /** |
| 7482 | * Al actualizar la version se regeneran las tablas.๏ฟฝSe guarda la | 7484 | * Al actualizar la version se regeneran las tablas.๏ฟฝSe guarda la |
| 7483 | * informacion anterior? | 7485 | * informacion anterior? |
| 7484 | * <p> | 7486 | * <p> |
| 7485 | * 1๏ฟฝ Iniciamos la transaccion: | 7487 | * 1๏ฟฝ Iniciamos la transaccion: |
| 7486 | * <p> | 7488 | * <p> |
| 7487 | * 2๏ฟฝ Cambiamos los nombres de las tablas que existen hacia temp | 7489 | * 2๏ฟฝ Cambiamos los nombres de las tablas que existen hacia temp |
| 7488 | * <p> | 7490 | * <p> |
| 7489 | * 3๏ฟฝ Creamos las tablas | 7491 | * 3๏ฟฝ Creamos las tablas |
| 7490 | * <p> | 7492 | * <p> |
| 7491 | * 4๏ฟฝ Se eliminan las tablas temporarias | 7493 | * 4๏ฟฝ Se eliminan las tablas temporarias |
| 7492 | * <p> | 7494 | * <p> |
| 7493 | * 5๏ฟฝ Se concluye el upgrade | 7495 | * 5๏ฟฝ Se concluye el upgrade |
| 7494 | */ | 7496 | */ |
| 7495 | 7497 | ||
| 7496 | @Override | 7498 | @Override |
| 7497 | public void onUpgrade(SQLiteDatabase db, int versionAnterior, | 7499 | public void onUpgrade(SQLiteDatabase db, int versionAnterior, |
| 7498 | int versionNueva) { | 7500 | int versionNueva) { |
| 7499 | System.out.println("::: BaseDatos 408 onUpgrade"); | 7501 | System.out.println("::: BaseDatos 408 onUpgrade"); |
| 7500 | // 1๏ฟฝ Iniciamos la transaccion: | 7502 | // 1๏ฟฝ Iniciamos la transaccion: |
| 7501 | db.beginTransaction(); | 7503 | db.beginTransaction(); |
| 7502 | 7504 | ||
| 7503 | // 2๏ฟฝ Cambiamos los nombres de las tablas que existen hacia temp: | 7505 | // 2๏ฟฝ Cambiamos los nombres de las tablas que existen hacia temp: |
| 7504 | db.execSQL("ALTER TABLE " + tabla_articulos_nombre + " RENAME TO temp_" | 7506 | db.execSQL("ALTER TABLE " + tabla_articulos_nombre + " RENAME TO temp_" |
| 7505 | + tabla_articulos_nombre); | 7507 | + tabla_articulos_nombre); |
| 7506 | db.execSQL("ALTER TABLE " + tabla_inventarios_nombre | 7508 | db.execSQL("ALTER TABLE " + tabla_inventarios_nombre |
| 7507 | + " RENAME TO temp_" + tabla_inventarios_nombre); | 7509 | + " RENAME TO temp_" + tabla_inventarios_nombre); |
| 7508 | 7510 | ||
| 7509 | // 3๏ฟฝ Creamos las tablas: | 7511 | // 3๏ฟฝ Creamos las tablas: |
| 7510 | db.execSQL(sqlCreateTablaArticulos); | 7512 | db.execSQL(sqlCreateTablaArticulos); |
| 7511 | db.execSQL(sqlCreateTablaInventarios); | 7513 | db.execSQL(sqlCreateTablaInventarios); |
| 7512 | 7514 | ||
| 7513 | //lo de abajo estaba descomentado 999 | 7515 | //lo de abajo estaba descomentado 999 |
| 7514 | db.execSQL(sqlCreateTablaReferencias); | 7516 | db.execSQL(sqlCreateTablaReferencias); |
| 7515 | db.execSQL(sqlCreateTablaProveedores); | 7517 | db.execSQL(sqlCreateTablaProveedores); |
| 7516 | db.execSQL(sqlCreateTablaCompraProveedor); | 7518 | db.execSQL(sqlCreateTablaCompraProveedor); |
| 7517 | // Recopiamos los datos de las tablas: | 7519 | // Recopiamos los datos de las tablas: |
| 7518 | /* | 7520 | /* |
| 7519 | * db.execSQL("INSERT INTO " + tabla_articulos_nombre + " " + | 7521 | * db.execSQL("INSERT INTO " + tabla_articulos_nombre + " " + |
| 7520 | * "SELECT * from temp_" + tabla_articulos_nombre ); | 7522 | * "SELECT * from temp_" + tabla_articulos_nombre ); |
| 7521 | */ | 7523 | */ |
| 7522 | /* | 7524 | /* |
| 7523 | * db.execSQL("INSERT INTO " + tabla_inventarios_nombre + " " + | 7525 | * db.execSQL("INSERT INTO " + tabla_inventarios_nombre + " " + |
| 7524 | * "SELECT * from temp_" + tabla_inventarios_nombre ); | 7526 | * "SELECT * from temp_" + tabla_inventarios_nombre ); |
| 7525 | */ | 7527 | */ |
| 7526 | // 4๏ฟฝ Se elimina las tablas temporarias: | 7528 | // 4๏ฟฝ Se elimina las tablas temporarias: |
| 7527 | db.execSQL("DROP TABLE IF EXISTS temp_" + tabla_articulos_nombre); | 7529 | db.execSQL("DROP TABLE IF EXISTS temp_" + tabla_articulos_nombre); |
| 7528 | db.execSQL("DROP TABLE IF EXISTS temp_" + tabla_inventarios_nombre); | 7530 | db.execSQL("DROP TABLE IF EXISTS temp_" + tabla_inventarios_nombre); |
| 7529 | 7531 | ||
| 7530 | // 5๏ฟฝ Se concluye el upgrade: | 7532 | // 5๏ฟฝ Se concluye el upgrade: |
| 7531 | db.setTransactionSuccessful(); | 7533 | db.setTransactionSuccessful(); |
| 7532 | db.endTransaction(); | 7534 | db.endTransaction(); |
| 7533 | } | 7535 | } |
| 7534 | 7536 | ||
| 7535 | /** | 7537 | /** |
| 7536 | * Borra los datos de una cierta tabla pasada como parametro Hardcodeado | 7538 | * Borra los datos de una cierta tabla pasada como parametro Hardcodeado |
| 7537 | * para que si es la de referencias y no se desea borrar todo se borre solo | 7539 | * para que si es la de referencias y no se desea borrar todo se borre solo |
| 7538 | * los articulos no nuevos (codigo y sector > 0) | 7540 | * los articulos no nuevos (codigo y sector > 0) |
| 7539 | * <p> | 7541 | * <p> |
| 7540 | * 1๏ฟฝ Abrimos la base | 7542 | * 1๏ฟฝ Abrimos la base |
| 7541 | * <p> | 7543 | * <p> |
| 7542 | * 2๏ฟฝSuprimimos todas (o algunas de) las entradas de las tablas, sin | 7544 | * 2๏ฟฝSuprimimos todas (o algunas de) las entradas de las tablas, sin |
| 7543 | * suprimir las tablas | 7545 | * suprimir las tablas |
| 7544 | * <p> | 7546 | * <p> |
| 7545 | * | 7547 | * |
| 7546 | * @param nombre_tabla | 7548 | * @param nombre_tabla |
| 7547 | * @param borrarTodo | 7549 | * @param borrarTodo |
| 7548 | * @throws ExceptionBDD | 7550 | * @throws ExceptionBDD |
| 7549 | */ | 7551 | */ |
| 7550 | public void borrarDatosBDD(String nombre_tabla, boolean borrarTodo) | 7552 | public void borrarDatosBDD(String nombre_tabla, boolean borrarTodo) |
| 7551 | throws ExceptionBDD { | 7553 | throws ExceptionBDD { |
| 7552 | try { | 7554 | try { |
| 7553 | System.out.println("::: BaseDatos 461 borrarDatosBDD"); | 7555 | System.out.println("::: BaseDatos 461 borrarDatosBDD"); |
| 7554 | // 1๏ฟฝ Abrimos la base: | 7556 | // 1๏ฟฝ Abrimos la base: |
| 7555 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7557 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7556 | 7558 | ||
| 7557 | String sentencia; | 7559 | String sentencia; |
| 7558 | 7560 | ||
| 7559 | if (nombre_tabla.compareTo(tabla_referencias_nombre) == 0 | 7561 | if (nombre_tabla.compareTo(tabla_referencias_nombre) == 0 |
| 7560 | && borrarTodo == false) { | 7562 | && borrarTodo == false) { |
| 7561 | 7563 | ||
| 7562 | sentencia = "DELETE FROM " + nombre_tabla + " WHERE " | 7564 | sentencia = "DELETE FROM " + nombre_tabla + " WHERE " |
| 7563 | + ParametrosInventario.bal_bdd_referencia_codigo | 7565 | + ParametrosInventario.bal_bdd_referencia_codigo |
| 7564 | + " >= 0 AND " | 7566 | + " >= 0 AND " |
| 7565 | + ParametrosInventario.bal_bdd_referencia_sector | 7567 | + ParametrosInventario.bal_bdd_referencia_sector |
| 7566 | + " >= 0 "; | 7568 | + " >= 0 "; |
| 7567 | 7569 | ||
| 7568 | } else { | 7570 | } else { |
| 7569 | 7571 | ||
| 7570 | sentencia = "DELETE FROM " + nombre_tabla; | 7572 | sentencia = "DELETE FROM " + nombre_tabla; |
| 7571 | 7573 | ||
| 7572 | } | 7574 | } |
| 7573 | // 2๏ฟฝSuprimimos todas las entradas de las tablas, sin suprimir las | 7575 | // 2๏ฟฝSuprimimos todas las entradas de las tablas, sin suprimir las |
| 7574 | // tablas: | 7576 | // tablas: |
| 7575 | dtb.execSQL(sentencia); | 7577 | dtb.execSQL(sentencia); |
| 7576 | // | 7578 | // |
| 7577 | // dtb.execSQL("DROP TABLE IF EXISTS " + nombre_tabla); | 7579 | // dtb.execSQL("DROP TABLE IF EXISTS " + nombre_tabla); |
| 7578 | // | 7580 | // |
| 7579 | // if (nombre_tabla.compareTo(tabla_articulos_nombre) == 0) { | 7581 | // if (nombre_tabla.compareTo(tabla_articulos_nombre) == 0) { |
| 7580 | // dtb.execSQL(sqlCreateTablaArticulos); | 7582 | // dtb.execSQL(sqlCreateTablaArticulos); |
| 7581 | // } | 7583 | // } |
| 7582 | // else if (nombre_tabla.compareTo(tabla_inventarios_nombre) == 0) { | 7584 | // else if (nombre_tabla.compareTo(tabla_inventarios_nombre) == 0) { |
| 7583 | // dtb.execSQL(sqlCreateTablaInventarios); | 7585 | // dtb.execSQL(sqlCreateTablaInventarios); |
| 7584 | // } | 7586 | // } |
| 7585 | // else if (nombre_tabla.compareTo(tabla_referencias_nombre) == 0) { | 7587 | // else if (nombre_tabla.compareTo(tabla_referencias_nombre) == 0) { |
| 7586 | // dtb.execSQL(sqlCreateTablaReferencias); | 7588 | // dtb.execSQL(sqlCreateTablaReferencias); |
| 7587 | // } | 7589 | // } |
| 7588 | 7590 | ||
| 7589 | // Cierre: | 7591 | // Cierre: |
| 7590 | dtb.close(); | 7592 | dtb.close(); |
| 7591 | 7593 | ||
| 7592 | } catch (Exception e) { | 7594 | } catch (Exception e) { |
| 7593 | 7595 | ||
| 7594 | // ///////////GESTOR DE LOG/////////////////// | 7596 | // ///////////GESTOR DE LOG/////////////////// |
| 7595 | GestorLogEventos log = new GestorLogEventos(); | 7597 | GestorLogEventos log = new GestorLogEventos(); |
| 7596 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 7598 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 7597 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 7599 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 7598 | log.log("[-- 301--]" | 7600 | log.log("[-- 301--]" |
| 7599 | + "Imposible suprimir el contenido de las tablas: " | 7601 | + "Imposible suprimir el contenido de las tablas: " |
| 7600 | + e.toString(), 4); | 7602 | + e.toString(), 4); |
| 7601 | // /////////////////////////////////////////// | 7603 | // /////////////////////////////////////////// |
| 7602 | 7604 | ||
| 7603 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 7605 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 7604 | "Imposible suprimir el contenido de las tablas: " | 7606 | "Imposible suprimir el contenido de las tablas: " |
| 7605 | + e.toString()); | 7607 | + e.toString()); |
| 7606 | } | 7608 | } |
| 7607 | } | 7609 | } |
| 7608 | 7610 | ||
| 7609 | /** | 7611 | /** |
| 7610 | * Borra el articulo sector-codigo del inventario con nro de inventario = a | 7612 | * Borra el articulo sector-codigo del inventario con nro de inventario = a |
| 7611 | * inventario | 7613 | * inventario |
| 7612 | * <p> | 7614 | * <p> |
| 7613 | * 1๏ฟฝ Abrimos la base: | 7615 | * 1๏ฟฝ Abrimos la base: |
| 7614 | * <p> | 7616 | * <p> |
| 7615 | * 2๏ฟฝ Suprimimos la entrada correspondiente los articulos | 7617 | * 2๏ฟฝ Suprimimos la entrada correspondiente los articulos |
| 7616 | * <p> | 7618 | * <p> |
| 7617 | * 3๏ฟฝ Cierre de la bd | 7619 | * 3๏ฟฝ Cierre de la bd |
| 7618 | * | 7620 | * |
| 7619 | * @param sector | 7621 | * @param sector |
| 7620 | * @param codigo | 7622 | * @param codigo |
| 7621 | * @param inventario | 7623 | * @param inventario |
| 7622 | * @throws ExceptionBDD | 7624 | * @throws ExceptionBDD |
| 7623 | */ | 7625 | */ |
| 7624 | public void borrarArcticuloInventario(int sector, int codigo, int inventario) | 7626 | public void borrarArcticuloInventario(int sector, int codigo, int inventario) |
| 7625 | throws ExceptionBDD { | 7627 | throws ExceptionBDD { |
| 7626 | try { | 7628 | try { |
| 7627 | System.out.println("::: BaseDatos 535 borrarArcticuloInventario"); | 7629 | System.out.println("::: BaseDatos 535 borrarArcticuloInventario"); |
| 7628 | // 1๏ฟฝ Abrimos la base: | 7630 | // 1๏ฟฝ Abrimos la base: |
| 7629 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7631 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7630 | 7632 | ||
| 7631 | // 2๏ฟฝ Suprimimos la entrada correspondiente a los articulos | 7633 | // 2๏ฟฝ Suprimimos la entrada correspondiente a los articulos |
| 7632 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 7634 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 7633 | + ParametrosInventario.bal_bdd_articulo_codigo + "=" | 7635 | + ParametrosInventario.bal_bdd_articulo_codigo + "=" |
| 7634 | + String.valueOf(codigo) + " AND " | 7636 | + String.valueOf(codigo) + " AND " |
| 7635 | + ParametrosInventario.bal_bdd_articulo_sector + "=" | 7637 | + ParametrosInventario.bal_bdd_articulo_sector + "=" |
| 7636 | + String.valueOf(sector) + " AND " | 7638 | + String.valueOf(sector) + " AND " |
| 7637 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 7639 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 7638 | + String.valueOf(inventario)); | 7640 | + String.valueOf(inventario)); |
| 7639 | 7641 | ||
| 7640 | // 3๏ฟฝ Cierre de la bd | 7642 | // 3๏ฟฝ Cierre de la bd |
| 7641 | dtb.close(); | 7643 | dtb.close(); |
| 7642 | 7644 | ||
| 7643 | } catch (Exception e) { | 7645 | } catch (Exception e) { |
| 7644 | 7646 | ||
| 7645 | GestorLogEventos log = new GestorLogEventos(); | 7647 | GestorLogEventos log = new GestorLogEventos(); |
| 7646 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 7648 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 7647 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 7649 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 7648 | log.log("[-- 349 --]" + e.toString(), 4); | 7650 | log.log("[-- 349 --]" + e.toString(), 4); |
| 7649 | 7651 | ||
| 7650 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 7652 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 7651 | "Imposible suprimir el articulo del inventario"); | 7653 | "Imposible suprimir el articulo del inventario"); |
| 7652 | 7654 | ||
| 7653 | } | 7655 | } |
| 7654 | 7656 | ||
| 7655 | } | 7657 | } |
| 7656 | 7658 | ||
| 7657 | /** | 7659 | /** |
| 7658 | * Elimina el inventario con id_inventario y sus articulos | 7660 | * Elimina el inventario con id_inventario y sus articulos |
| 7659 | * <p> | 7661 | * <p> |
| 7660 | * 1 Abrimos la base | 7662 | * 1 Abrimos la base |
| 7661 | * <p> | 7663 | * <p> |
| 7662 | * 2 Suprimimos la entrada correspondiente los articulos y luego el | 7664 | * 2 Suprimimos la entrada correspondiente los articulos y luego el |
| 7663 | * inventario | 7665 | * inventario |
| 7664 | * <p> | 7666 | * <p> |
| 7665 | * 3 Cierre de la BD | 7667 | * 3 Cierre de la BD |
| 7666 | * | 7668 | * |
| 7667 | * @param id_inventario | 7669 | * @param id_inventario |
| 7668 | * @throws ExceptionBDD | 7670 | * @throws ExceptionBDD |
| 7669 | */ | 7671 | */ |
| 7670 | public void borrarInventarioConArticulos(int id_inventario) | 7672 | public void borrarInventarioConArticulos(int id_inventario) |
| 7671 | throws ExceptionBDD { | 7673 | throws ExceptionBDD { |
| 7672 | try { | 7674 | try { |
| 7673 | System.out.println("::: BaseDatos 581 borrarInventarioConArticulos"); | 7675 | System.out.println("::: BaseDatos 581 borrarInventarioConArticulos"); |
| 7674 | boolean condicionRadio = ParametrosInventario.InventariosVentas; | 7676 | boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 7675 | // 1 Abrimos la base: | 7677 | // 1 Abrimos la base: |
| 7676 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7678 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7677 | 7679 | ||
| 7678 | if(condicionRadio==true && id_inventario==-1){ | 7680 | if(condicionRadio==true && id_inventario==-1){ |
| 7679 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 7681 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 7680 | + ParametrosInventario.bal_bdd_inventario_numero + "=" | 7682 | + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 7681 | + String.valueOf(id_inventario)); | 7683 | + String.valueOf(id_inventario)); |
| 7682 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 7684 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 7683 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 7685 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 7684 | + String.valueOf(id_inventario)); | 7686 | + String.valueOf(id_inventario)); |
| 7685 | }else if(condicionRadio==false && id_inventario==-2){ | 7687 | }else if(condicionRadio==false && id_inventario==-2){ |
| 7686 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 7688 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 7687 | + ParametrosInventario.bal_bdd_inventario_numero + "=" | 7689 | + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 7688 | + String.valueOf(id_inventario)); | 7690 | + String.valueOf(id_inventario)); |
| 7689 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 7691 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 7690 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 7692 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 7691 | + String.valueOf(id_inventario)); | 7693 | + String.valueOf(id_inventario)); |
| 7692 | }else if(id_inventario==-3){ | 7694 | }else if(id_inventario==-3){ |
| 7693 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 7695 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 7694 | + ParametrosInventario.bal_bdd_inventario_numero + "=" | 7696 | + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 7695 | + String.valueOf(id_inventario)); | 7697 | + String.valueOf(id_inventario)); |
| 7696 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 7698 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 7697 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 7699 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 7698 | + String.valueOf(id_inventario)); | 7700 | + String.valueOf(id_inventario)); |
| 7699 | dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre+ " WHERE COMPRA_INV_COD=" | 7701 | dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre+ " WHERE COMPRA_INV_COD=" |
| 7700 | + String.valueOf(id_inventario)); | 7702 | + String.valueOf(id_inventario)); |
| 7701 | }else if(id_inventario<-3){ | 7703 | }else if(id_inventario<-3){ |
| 7702 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 7704 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 7703 | + ParametrosInventario.bal_bdd_inventario_numero + "=" | 7705 | + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 7704 | + String.valueOf(id_inventario)); | 7706 | + String.valueOf(id_inventario)); |
| 7705 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 7707 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 7706 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 7708 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 7707 | + String.valueOf(id_inventario)); | 7709 | + String.valueOf(id_inventario)); |
| 7708 | dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre+ " WHERE COMPRA_INV_COD=" | 7710 | dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre+ " WHERE COMPRA_INV_COD=" |
| 7709 | + String.valueOf(id_inventario)); | 7711 | + String.valueOf(id_inventario)); |
| 7710 | }else if(id_inventario>0){ | 7712 | }else if(id_inventario>0){ |
| 7711 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 7713 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 7712 | + ParametrosInventario.bal_bdd_inventario_numero + "=" | 7714 | + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 7713 | + String.valueOf(id_inventario)); | 7715 | + String.valueOf(id_inventario)); |
| 7714 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 7716 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 7715 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 7717 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 7716 | + String.valueOf(id_inventario)); | 7718 | + String.valueOf(id_inventario)); |
| 7717 | } | 7719 | } |
| 7718 | // // 2 Suprimimos la entrada correspondiente los articulos y luego el | 7720 | // // 2 Suprimimos la entrada correspondiente los articulos y luego el |
| 7719 | // // inventario | 7721 | // // inventario |
| 7720 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 7722 | // dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 7721 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" | 7723 | // + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 7722 | // + String.valueOf(id_inventario)); | 7724 | // + String.valueOf(id_inventario)); |
| 7723 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 7725 | // dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 7724 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 7726 | // + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 7725 | // + String.valueOf(id_inventario)); | 7727 | // + String.valueOf(id_inventario)); |
| 7726 | // 3 Cierre de la BD | 7728 | // 3 Cierre de la BD |
| 7727 | dtb.close(); | 7729 | dtb.close(); |
| 7728 | 7730 | ||
| 7729 | } catch (Exception e) { | 7731 | } catch (Exception e) { |
| 7730 | 7732 | ||
| 7731 | GestorLogEventos log = new GestorLogEventos(); | 7733 | GestorLogEventos log = new GestorLogEventos(); |
| 7732 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 7734 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 7733 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 7735 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 7734 | log.log("[-- 394 --]" + e.toString(), 4); | 7736 | log.log("[-- 394 --]" + e.toString(), 4); |
| 7735 | 7737 | ||
| 7736 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 7738 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 7737 | "Imposible suprimir el contenido de las tablas"); | 7739 | "Imposible suprimir el contenido de las tablas"); |
| 7738 | } | 7740 | } |
| 7739 | 7741 | ||
| 7740 | } | 7742 | } |
| 7741 | 7743 | ||
| 7742 | public void borrarInventarioConArticulosCompras(int id_inventario) | 7744 | public void borrarInventarioConArticulosCompras(int id_inventario) |
| 7743 | throws ExceptionBDD { | 7745 | throws ExceptionBDD { |
| 7744 | try { | 7746 | try { |
| 7745 | System.out.println("::: BaseDatos 581 borrarInventarioConArticulos"); | 7747 | System.out.println("::: BaseDatos 581 borrarInventarioConArticulos"); |
| 7746 | boolean condicionRadio = ParametrosInventario.InventariosVentas; | 7748 | boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 7747 | // 1 Abrimos la base: | 7749 | // 1 Abrimos la base: |
| 7748 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7750 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7749 | 7751 | ||
| 7750 | if(id_inventario==-3){ | 7752 | if(id_inventario==-3){ |
| 7751 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " | 7753 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre + " WHERE " |
| 7752 | + ParametrosInventario.bal_bdd_inventario_numero + "=" | 7754 | + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 7753 | + String.valueOf(id_inventario)); | 7755 | + String.valueOf(id_inventario)); |
| 7754 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " | 7756 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre + " WHERE " |
| 7755 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 7757 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 7756 | + String.valueOf(id_inventario)); | 7758 | + String.valueOf(id_inventario)); |
| 7757 | dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre + " WHERE " | 7759 | dtb.execSQL("DELETE FROM " + tabla_compraproveedor_nombre + " WHERE " |
| 7758 | + ParametrosInventario.bal_bdd_inventario_numero + "=" | 7760 | + ParametrosInventario.bal_bdd_inventario_numero + "=" |
| 7759 | + String.valueOf(id_inventario)); | 7761 | + String.valueOf(id_inventario)); |
| 7760 | System.out.println("::: BORRO SEGURO"); | 7762 | System.out.println("::: BORRO SEGURO"); |
| 7761 | } | 7763 | } |
| 7762 | 7764 | ||
| 7763 | // 3 Cierre de la BD | 7765 | // 3 Cierre de la BD |
| 7764 | dtb.close(); | 7766 | dtb.close(); |
| 7765 | } catch (Exception e) { | 7767 | } catch (Exception e) { |
| 7766 | 7768 | ||
| 7767 | GestorLogEventos log = new GestorLogEventos(); | 7769 | GestorLogEventos log = new GestorLogEventos(); |
| 7768 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 7770 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 7769 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 7771 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 7770 | log.log("[-- 394 --]" + e.toString(), 4); | 7772 | log.log("[-- 394 --]" + e.toString(), 4); |
| 7771 | 7773 | ||
| 7772 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 7774 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 7773 | "Imposible suprimir el contenido de las tablas"); | 7775 | "Imposible suprimir el contenido de las tablas"); |
| 7774 | } | 7776 | } |
| 7775 | 7777 | ||
| 7776 | } | 7778 | } |
| 7777 | 7779 | ||
| 7778 | /** | 7780 | /** |
| 7779 | * Borra los inventarios de la lista con sus articulos | 7781 | * Borra los inventarios de la lista con sus articulos |
| 7780 | * <p> | 7782 | * <p> |
| 7781 | * 1 Abrimos la base | 7783 | * 1 Abrimos la base |
| 7782 | * <p> | 7784 | * <p> |
| 7783 | * 2 Para cada inventario : Suprimimos la entrada correspondiente al | 7785 | * 2 Para cada inventario : Suprimimos la entrada correspondiente al |
| 7784 | * inventario y articulos | 7786 | * inventario y articulos |
| 7785 | * <p> | 7787 | * <p> |
| 7786 | * 3 Cierre | 7788 | * 3 Cierre |
| 7787 | * | 7789 | * |
| 7788 | * @param lista_inventarios | 7790 | * @param lista_inventarios |
| 7789 | * @throws ExceptionBDD | 7791 | * @throws ExceptionBDD |
| 7790 | */ | 7792 | */ |
| 7791 | public void borrarInventarioConArticulos( | 7793 | public void borrarInventarioConArticulos( |
| 7792 | ArrayList<Integer> lista_inventarios) throws ExceptionBDD { | 7794 | ArrayList<Integer> lista_inventarios) throws ExceptionBDD { |
| 7793 | try { | 7795 | try { |
| 7794 | System.out.println("::: BaseDatos 626 borrarInventarioConArticulos"); | 7796 | System.out.println("::: BaseDatos 626 borrarInventarioConArticulos"); |
| 7795 | // 1 Abrimos la base: | 7797 | // 1 Abrimos la base: |
| 7796 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7798 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7797 | 7799 | ||
| 7798 | // 2 Para cada inventario : Suprimimos la entrada correspondiente | 7800 | // 2 Para cada inventario : Suprimimos la entrada correspondiente |
| 7799 | // al inventario y articulos | 7801 | // al inventario y articulos |
| 7800 | for (int numero : lista_inventarios) { | 7802 | for (int numero : lista_inventarios) { |
| 7801 | try { | 7803 | try { |
| 7802 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre | 7804 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre |
| 7803 | + " WHERE " | 7805 | + " WHERE " |
| 7804 | + ParametrosInventario.bal_bdd_inventario_numero | 7806 | + ParametrosInventario.bal_bdd_inventario_numero |
| 7805 | + "=" + String.valueOf(numero)); | 7807 | + "=" + String.valueOf(numero)); |
| 7806 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre | 7808 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre |
| 7807 | + " WHERE " | 7809 | + " WHERE " |
| 7808 | + ParametrosInventario.bal_bdd_articulo_inventario | 7810 | + ParametrosInventario.bal_bdd_articulo_inventario |
| 7809 | + "=" + String.valueOf(numero)); | 7811 | + "=" + String.valueOf(numero)); |
| 7810 | } catch (Exception e) { | 7812 | } catch (Exception e) { |
| 7811 | 7813 | ||
| 7812 | GestorLogEventos log = new GestorLogEventos(); | 7814 | GestorLogEventos log = new GestorLogEventos(); |
| 7813 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 7815 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 7814 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 7816 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 7815 | log.log("[-- 438 --]" + e.toString(), 4); | 7817 | log.log("[-- 438 --]" + e.toString(), 4); |
| 7816 | 7818 | ||
| 7817 | } | 7819 | } |
| 7818 | } | 7820 | } |
| 7819 | 7821 | ||
| 7820 | // 3 Cierre: | 7822 | // 3 Cierre: |
| 7821 | dtb.close(); | 7823 | dtb.close(); |
| 7822 | 7824 | ||
| 7823 | } catch (Exception e) { | 7825 | } catch (Exception e) { |
| 7824 | 7826 | ||
| 7825 | GestorLogEventos log = new GestorLogEventos(); | 7827 | GestorLogEventos log = new GestorLogEventos(); |
| 7826 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 7828 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 7827 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 7829 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 7828 | log.log("[-- 451 --]" + e.toString(), 4); | 7830 | log.log("[-- 451 --]" + e.toString(), 4); |
| 7829 | 7831 | ||
| 7830 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 7832 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 7831 | "Imposible suprimir el contenido de las tablas"); | 7833 | "Imposible suprimir el contenido de las tablas"); |
| 7832 | } | 7834 | } |
| 7833 | 7835 | ||
| 7834 | } | 7836 | } |
| 7835 | 7837 | ||
| 7836 | /** | 7838 | /** |
| 7837 | * Limpia los inventarios y articulos de la BD | 7839 | * Limpia los inventarios y articulos de la BD |
| 7838 | * <p> | 7840 | * <p> |
| 7839 | * 1 Abrimos la base | 7841 | * 1 Abrimos la base |
| 7840 | * <p> | 7842 | * <p> |
| 7841 | * 2 Suprimimos todas las entradas de las tablas, sin suprimir las tablas | 7843 | * 2 Suprimimos todas las entradas de las tablas, sin suprimir las tablas |
| 7842 | * <p> | 7844 | * <p> |
| 7843 | * 3 Cierre | 7845 | * 3 Cierre |
| 7844 | * | 7846 | * |
| 7845 | * @throws ExceptionBDD | 7847 | * @throws ExceptionBDD |
| 7846 | */ | 7848 | */ |
| 7847 | public void borrarInventariosYArticulosEnBDD_y_tambien_locales() | 7849 | public void borrarInventariosYArticulosEnBDD_y_tambien_locales() |
| 7848 | throws ExceptionBDD { | 7850 | throws ExceptionBDD { |
| 7849 | try { | 7851 | try { |
| 7850 | System.out.println("::: BaseDatos 682 borrarInventariosYArticulosEnBDD_y_tambien_locales"); | 7852 | System.out.println("::: BaseDatos 682 borrarInventariosYArticulosEnBDD_y_tambien_locales"); |
| 7851 | // 1 Abrimos la base: | 7853 | // 1 Abrimos la base: |
| 7852 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7854 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7853 | 7855 | ||
| 7854 | // 2 Suprimimos todas las entradas de las tablas, sin suprimir las | 7856 | // 2 Suprimimos todas las entradas de las tablas, sin suprimir las |
| 7855 | // tablas: | 7857 | // tablas: |
| 7856 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre); | 7858 | dtb.execSQL("DELETE FROM " + tabla_articulos_nombre); |
| 7857 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre); | 7859 | dtb.execSQL("DELETE FROM " + tabla_inventarios_nombre); |
| 7858 | dtb.execSQL("DROP TABLE IF EXISTS " | 7860 | dtb.execSQL("DROP TABLE IF EXISTS " |
| 7859 | + ParametrosInventario.tabla_local); | 7861 | + ParametrosInventario.tabla_local); |
| 7860 | dtb.execSQL(sqlCreateTableLocales); | 7862 | dtb.execSQL(sqlCreateTableLocales); |
| 7861 | dtb.execSQL("DROP DATABASE DB_INVENT;"); | 7863 | dtb.execSQL("DROP DATABASE DB_INVENT;"); |
| 7862 | // 3 Cierre: | 7864 | // 3 Cierre: |
| 7863 | dtb.close(); | 7865 | dtb.close(); |
| 7864 | 7866 | ||
| 7865 | } catch (Exception e) { | 7867 | } catch (Exception e) { |
| 7866 | 7868 | ||
| 7867 | GestorLogEventos log = new GestorLogEventos(); | 7869 | GestorLogEventos log = new GestorLogEventos(); |
| 7868 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 7870 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 7869 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 7871 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 7870 | log.log("[-- 488 --]" + e.toString(), 4); | 7872 | log.log("[-- 488 --]" + e.toString(), 4); |
| 7871 | 7873 | ||
| 7872 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 7874 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 7873 | "Tabla no encontrada en la base de datos"); | 7875 | "Tabla no encontrada en la base de datos"); |
| 7874 | } | 7876 | } |
| 7875 | } | 7877 | } |
| 7876 | 7878 | ||
| 7877 | /** | 7879 | /** |
| 7878 | * Busca en las referencias articulos con descripciones parecidas a las | 7880 | * Busca en las referencias articulos con descripciones parecidas a las |
| 7879 | * pasadas en la cadena de parametro | 7881 | * pasadas en la cadena de parametro |
| 7880 | * <p> | 7882 | * <p> |
| 7881 | * 1 Abrimos la base | 7883 | * 1 Abrimos la base |
| 7882 | * <p> | 7884 | * <p> |
| 7883 | * 2Procesar la cadena de busqueda (un espacio blanco cuenta como un &&): | 7885 | * 2Procesar la cadena de busqueda (un espacio blanco cuenta como un &&): |
| 7884 | * Reemplazamos los multiples espacios blancos por 1 solo | 7886 | * Reemplazamos los multiples espacios blancos por 1 solo |
| 7885 | * <p> | 7887 | * <p> |
| 7886 | * 3 Partimos el string en una tabla segun el caracter ' ' | 7888 | * 3 Partimos el string en una tabla segun el caracter ' ' |
| 7887 | * <p> | 7889 | * <p> |
| 7888 | * 4 Construimos la consulta SQL | 7890 | * 4 Construimos la consulta SQL |
| 7889 | * <p> | 7891 | * <p> |
| 7890 | * 5 Buscar en las referencias el articulo | 7892 | * 5 Buscar en las referencias el articulo |
| 7891 | * <p> | 7893 | * <p> |
| 7892 | * 6 Control respuestas | 7894 | * 6 Control respuestas |
| 7893 | * <p> | 7895 | * <p> |
| 7894 | * 7 Lectura de los resultados | 7896 | * 7 Lectura de los resultados |
| 7895 | * <p> | 7897 | * <p> |
| 7896 | * 8 Cerramos la BD | 7898 | * 8 Cerramos la BD |
| 7897 | * | 7899 | * |
| 7898 | * @param busqueda | 7900 | * @param busqueda |
| 7899 | * @return | 7901 | * @return |
| 7900 | * @throws ExceptionBDD | 7902 | * @throws ExceptionBDD |
| 7901 | */ | 7903 | */ |
| 7902 | public ArrayList<HashMap<Integer, Object>> buscarEnReferencias( | 7904 | public ArrayList<HashMap<Integer, Object>> buscarEnReferencias( |
| 7903 | String busqueda) throws ExceptionBDD { | 7905 | String busqueda) throws ExceptionBDD { |
| 7904 | // toModify; | 7906 | // toModify; |
| 7905 | try { | 7907 | try { |
| 7906 | System.out.println("::: BaseDatos 738 buscarEnReferencias"); | 7908 | System.out.println("::: BaseDatos 738 buscarEnReferencias"); |
| 7907 | // Variable de retorno:Revisar esto | 7909 | // Variable de retorno:Revisar esto |
| 7908 | ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); | 7910 | ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); |
| 7909 | 7911 | ||
| 7910 | // 1 Abrimos la base: | 7912 | // 1 Abrimos la base: |
| 7911 | SQLiteDatabase dtb = this.getWritableDatabase(); | 7913 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 7912 | 7914 | ||
| 7913 | // 2Procesar la cadena de busqueda (un espacio blanco cuenta como | 7915 | // 2Procesar la cadena de busqueda (un espacio blanco cuenta como |
| 7914 | // un | 7916 | // un |
| 7915 | // &&): | 7917 | // &&): |
| 7916 | // Reemplazamos los multiples espacios blancos por 1 solo: | 7918 | // Reemplazamos los multiples espacios blancos por 1 solo: |
| 7917 | busqueda = busqueda.replaceAll("\\s+", " "); | 7919 | busqueda = busqueda.replaceAll("\\s+", " "); |
| 7918 | 7920 | ||
| 7919 | // 3 Partimos el string en una tabla segun el caracter ' ': | 7921 | // 3 Partimos el string en una tabla segun el caracter ' ': |
| 7920 | String tabla_busqueda[] = busqueda.split("\\s"); | 7922 | String tabla_busqueda[] = busqueda.split("\\s"); |
| 7921 | 7923 | ||
| 7922 | // 4 Construimos la consulta SQL: | 7924 | // 4 Construimos la consulta SQL: |
| 7923 | String consulta_SQL = ""; | 7925 | String consulta_SQL = ""; |
| 7924 | for (String s : tabla_busqueda) { | 7926 | for (String s : tabla_busqueda) { |
| 7925 | consulta_SQL += ParametrosInventario.bal_bdd_referencia_descripcion | 7927 | consulta_SQL += ParametrosInventario.bal_bdd_referencia_descripcion |
| 7926 | + " LIKE '%" + s + "%' AND "; | 7928 | + " LIKE '%" + s + "%' AND "; |
| 7927 | } | 7929 | } |
| 7928 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 7930 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 7929 | // consulta_SQL += "AND " + | 7931 | // consulta_SQL += "AND " + |
| 7930 | // ParametrosInventario.bal_bdd_articulo_inventario + "=" + | 7932 | // ParametrosInventario.bal_bdd_articulo_inventario + "=" + |
| 7931 | // num_inventario; | 7933 | // num_inventario; |
| 7932 | 7934 | ||
| 7933 | // 5 Buscar en las referencias el articulo | 7935 | // 5 Buscar en las referencias el articulo |
| 7934 | // Mas columnas, o todo | 7936 | // Mas columnas, o todo |
| 7935 | String col[] = new String[] { | 7937 | String col[] = new String[] { |
| 7936 | ParametrosInventario.bal_bdd_referencia_sector, | 7938 | ParametrosInventario.bal_bdd_referencia_sector, |
| 7937 | ParametrosInventario.bal_bdd_referencia_codigo, | 7939 | ParametrosInventario.bal_bdd_referencia_codigo, |
| 7938 | ParametrosInventario.bal_bdd_referencia_descripcion | 7940 | ParametrosInventario.bal_bdd_referencia_descripcion |
| 7939 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, | 7941 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 7940 | // ParametrosInventario.bal_bdd_referencia_precio_venta, | 7942 | // ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 7941 | // ParametrosInventario.bal_bdd_referencia_precio_costo | 7943 | // ParametrosInventario.bal_bdd_referencia_precio_costo |
| 7942 | }; | 7944 | }; |
| 7943 | 7945 | ||
| 7944 | Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, | 7946 | Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, |
| 7945 | null, ParametrosInventario.bal_bdd_referencia_codigo + "," | 7947 | null, ParametrosInventario.bal_bdd_referencia_codigo + "," |
| 7946 | + ParametrosInventario.bal_bdd_referencia_sector, | 7948 | + ParametrosInventario.bal_bdd_referencia_sector, |
| 7947 | null, ParametrosInventario.bal_bdd_referencia_descripcion); | 7949 | null, ParametrosInventario.bal_bdd_referencia_descripcion); |
| 7948 | 7950 | ||
| 7949 | // 6 Control respuestas: | 7951 | // 6 Control respuestas: |
| 7950 | if (c.getCount() <= 0) { | 7952 | if (c.getCount() <= 0) { |
| 7951 | dtb.close(); | 7953 | dtb.close(); |
| 7952 | return lista_resultado; | 7954 | return lista_resultado; |
| 7953 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 7955 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 7954 | dtb.close(); | 7956 | dtb.close(); |
| 7955 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 7957 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 7956 | } | 7958 | } |
| 7957 | // ArticuloVisible nvoArt; | 7959 | // ArticuloVisible nvoArt; |
| 7958 | // int codigo,sector; | 7960 | // int codigo,sector; |
| 7959 | // String desc,codigoBarra; | 7961 | // String desc,codigoBarra; |
| 7960 | // double precioVenta, precioCosto; | 7962 | // double precioVenta, precioCosto; |
| 7961 | // ArrayList<String> losCodigosBarras; | 7963 | // ArrayList<String> losCodigosBarras; |
| 7962 | // 7 Lectura de los resultados: | 7964 | // 7 Lectura de los resultados: |
| 7963 | if (c.moveToFirst()) { | 7965 | if (c.moveToFirst()) { |
| 7964 | // System.out.println(":::ACA SI ENTROOOOOOO"); | 7966 | // System.out.println(":::ACA SI ENTROOOOOOO"); |
| 7965 | while (c.isAfterLast() == false) { | 7967 | while (c.isAfterLast() == false) { |
| 7966 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 7968 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 7967 | // Crear un articulo con los datos extraidos | 7969 | // Crear un articulo con los datos extraidos |
| 7968 | // codigo=c.getInt(0); | 7970 | // codigo=c.getInt(0); |
| 7969 | // sector=c.getInt(1); | 7971 | // sector=c.getInt(1); |
| 7970 | // desc=c.getString(2); | 7972 | // desc=c.getString(2); |
| 7971 | // codigoBarra=c.getString(3); | 7973 | // codigoBarra=c.getString(3); |
| 7972 | // precioVenta=c.getDouble(4); | 7974 | // precioVenta=c.getDouble(4); |
| 7973 | // precioCosto=c.getDouble(5); | 7975 | // precioCosto=c.getDouble(5); |
| 7974 | // losCodigosBarras= new ArrayList<String>(); | 7976 | // losCodigosBarras= new ArrayList<String>(); |
| 7975 | // losCodigosBarras.add(codigoBarra); | 7977 | // losCodigosBarras.add(codigoBarra); |
| 7976 | // nvoArt=new ArticuloVisible(sector, codigo, | 7978 | // nvoArt=new ArticuloVisible(sector, codigo, |
| 7977 | // losCodigosBarras, 0, desc, precioVenta, precioCosto, "", | 7979 | // losCodigosBarras, 0, desc, precioVenta, precioCosto, "", |
| 7978 | // -1, "", true); | 7980 | // -1, "", true); |
| 7979 | // Meterlo en el hash map | 7981 | // Meterlo en el hash map |
| 7980 | hashmap.put(ParametrosInventario.clave_art_sector, | 7982 | hashmap.put(ParametrosInventario.clave_art_sector, |
| 7981 | c.getInt(0)); | 7983 | c.getInt(0)); |
| 7982 | hashmap.put(ParametrosInventario.clave_art_codigo, | 7984 | hashmap.put(ParametrosInventario.clave_art_codigo, |
| 7983 | c.getInt(1)); | 7985 | c.getInt(1)); |
| 7984 | hashmap.put(ParametrosInventario.clave_art_nombre, | 7986 | hashmap.put(ParametrosInventario.clave_art_nombre, |
| 7985 | c.getString(2)); | 7987 | c.getString(2)); |
| 7986 | lista_resultado.add(hashmap); | 7988 | lista_resultado.add(hashmap); |
| 7987 | // System.out.println(":::"+lista_resultado); | 7989 | // System.out.println(":::"+lista_resultado); |
| 7988 | c.moveToNext(); | 7990 | c.moveToNext(); |
| 7989 | } | 7991 | } |
| 7990 | // 8 Cerramos la BD | 7992 | // 8 Cerramos la BD |
| 7991 | dtb.close(); | 7993 | dtb.close(); |
| 7992 | return lista_resultado; | 7994 | return lista_resultado; |
| 7993 | } else { | 7995 | } else { |
| 7994 | dtb.close(); | 7996 | dtb.close(); |
| 7995 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 7997 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 7996 | } | 7998 | } |
| 7997 | } catch (Exception e) { | 7999 | } catch (Exception e) { |
| 7998 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 8000 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 7999 | "Error en la busqueda: " + busqueda); | 8001 | "Error en la busqueda: " + busqueda); |
| 8000 | } | 8002 | } |
| 8001 | 8003 | ||
| 8002 | } | 8004 | } |
| 8003 | 8005 | ||
| 8004 | /** | 8006 | /** |
| 8005 | * Busca en las referencias articulos con descripciones parecidas a las | 8007 | * Busca en las referencias articulos con descripciones parecidas a las |
| 8006 | * pasadas en la cadena de parametro | 8008 | * pasadas en la cadena de parametro |
| 8007 | * <p> | 8009 | * <p> |
| 8008 | * 1 Abrimos la base | 8010 | * 1 Abrimos la base |
| 8009 | * <p> | 8011 | * <p> |
| 8010 | * 2Procesar la cadena de busqueda (un espacio blanco cuenta como un &&): | 8012 | * 2Procesar la cadena de busqueda (un espacio blanco cuenta como un &&): |
| 8011 | * Reemplazamos los multiples espacios blancos por 1 solo | 8013 | * Reemplazamos los multiples espacios blancos por 1 solo |
| 8012 | * <p> | 8014 | * <p> |
| 8013 | * 3 Partimos el string en una tabla segun el caracter ' ' | 8015 | * 3 Partimos el string en una tabla segun el caracter ' ' |
| 8014 | * <p> | 8016 | * <p> |
| 8015 | * 4 Construimos la consulta SQL | 8017 | * 4 Construimos la consulta SQL |
| 8016 | * <p> | 8018 | * <p> |
| 8017 | * 5 Buscar en las referencias el articulo | 8019 | * 5 Buscar en las referencias el articulo |
| 8018 | * <p> | 8020 | * <p> |
| 8019 | * 6 Control respuestas | 8021 | * 6 Control respuestas |
| 8020 | * <p> | 8022 | * <p> |
| 8021 | * 7 Lectura de los resultados | 8023 | * 7 Lectura de los resultados |
| 8022 | * <p> | 8024 | * <p> |
| 8023 | * 8 Cerramos la BD | 8025 | * 8 Cerramos la BD |
| 8024 | * | 8026 | * |
| 8025 | * @param busqueda | 8027 | * @param busqueda |
| 8026 | * @return | 8028 | * @return |
| 8027 | * @throws ExceptionBDD | 8029 | * @throws ExceptionBDD |
| 8028 | */ | 8030 | */ |
| 8029 | public ArrayList<HashMap<Integer, Object>> buscarEnReferenciasPorCodigoODescripcion( | 8031 | public ArrayList<HashMap<Integer, Object>> buscarEnReferenciasPorCodigoODescripcion( |
| 8030 | String busqueda) throws ExceptionBDD { | 8032 | String busqueda) throws ExceptionBDD { |
| 8031 | // toModify; | 8033 | // toModify; |
| 8032 | try { | 8034 | try { |
| 8033 | System.out.println("::: BaseDatos 738 buscarEnReferencias"); | 8035 | System.out.println("::: BaseDatos 738 buscarEnReferencias"); |
| 8034 | // Variable de retorno:Revisar esto | 8036 | // Variable de retorno:Revisar esto |
| 8035 | ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); | 8037 | ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); |
| 8036 | 8038 | ||
| 8037 | // 1 Abrimos la base: | 8039 | // 1 Abrimos la base: |
| 8038 | SQLiteDatabase dtb = this.getWritableDatabase(); | 8040 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 8039 | 8041 | ||
| 8040 | // 2Procesar la cadena de busqueda (un espacio blanco cuenta como | 8042 | // 2Procesar la cadena de busqueda (un espacio blanco cuenta como |
| 8041 | // un | 8043 | // un |
| 8042 | // &&): | 8044 | // &&): |
| 8043 | // Reemplazamos los multiples espacios blancos por 1 solo: | 8045 | // Reemplazamos los multiples espacios blancos por 1 solo: |
| 8044 | 8046 | ||
| 8045 | String consulta_SQL = ""; | 8047 | String consulta_SQL = ""; |
| 8046 | if(busqueda.matches("^\\d{1,5}$")){ | 8048 | if(busqueda.matches("^\\d{1,5}$")){ |
| 8047 | consulta_SQL = ParametrosInventario.bal_bdd_referencia_codigo + " = '" + busqueda + "'"; | 8049 | consulta_SQL = ParametrosInventario.bal_bdd_referencia_codigo + " = '" + busqueda + "'"; |
| 8048 | } else { | 8050 | } else { |
| 8049 | busqueda = busqueda.replaceAll("\\s+", " "); | 8051 | busqueda = busqueda.replaceAll("\\s+", " "); |
| 8050 | 8052 | ||
| 8051 | // 3 Partimos el string en una tabla segun el caracter ' ': | 8053 | // 3 Partimos el string en una tabla segun el caracter ' ': |
| 8052 | String tabla_busqueda[] = busqueda.split("\\s"); | 8054 | String tabla_busqueda[] = busqueda.split("\\s"); |
| 8053 | 8055 | ||
| 8054 | // 4 Construimos la consulta SQL: | 8056 | // 4 Construimos la consulta SQL: |
| 8055 | for (String s : tabla_busqueda) { | 8057 | for (String s : tabla_busqueda) { |
| 8056 | consulta_SQL += ParametrosInventario.bal_bdd_referencia_descripcion | 8058 | consulta_SQL += ParametrosInventario.bal_bdd_referencia_descripcion |
| 8057 | + " LIKE '%" + s + "%' AND "; | 8059 | + " LIKE '%" + s + "%' AND "; |
| 8058 | } | 8060 | } |
| 8059 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 8061 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 8060 | // consulta_SQL += "AND " + | 8062 | // consulta_SQL += "AND " + |
| 8061 | // ParametrosInventario.bal_bdd_articulo_inventario + "=" + | 8063 | // ParametrosInventario.bal_bdd_articulo_inventario + "=" + |
| 8062 | // num_inventario; | 8064 | // num_inventario; |
| 8063 | } | 8065 | } |
| 8064 | 8066 | ||
| 8065 | // 5 Buscar en las referencias el articulo | 8067 | // 5 Buscar en las referencias el articulo |
| 8066 | // Mas columnas, o todo | 8068 | // Mas columnas, o todo |
| 8067 | String col[] = new String[] { | 8069 | String col[] = new String[] { |
| 8068 | ParametrosInventario.bal_bdd_referencia_sector, | 8070 | ParametrosInventario.bal_bdd_referencia_sector, |
| 8069 | ParametrosInventario.bal_bdd_referencia_codigo, | 8071 | ParametrosInventario.bal_bdd_referencia_codigo, |
| 8070 | ParametrosInventario.bal_bdd_referencia_descripcion | 8072 | ParametrosInventario.bal_bdd_referencia_descripcion |
| 8071 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, | 8073 | // ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 8072 | // ParametrosInventario.bal_bdd_referencia_precio_venta, | 8074 | // ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 8073 | // ParametrosInventario.bal_bdd_referencia_precio_costo | 8075 | // ParametrosInventario.bal_bdd_referencia_precio_costo |
| 8074 | }; | 8076 | }; |
| 8075 | 8077 | ||
| 8076 | Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, | 8078 | Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, |
| 8077 | null, ParametrosInventario.bal_bdd_referencia_codigo + "," | 8079 | null, ParametrosInventario.bal_bdd_referencia_codigo + "," |
| 8078 | + ParametrosInventario.bal_bdd_referencia_sector, | 8080 | + ParametrosInventario.bal_bdd_referencia_sector, |
| 8079 | null, ParametrosInventario.bal_bdd_referencia_descripcion); | 8081 | null, ParametrosInventario.bal_bdd_referencia_descripcion); |
| 8080 | 8082 | ||
| 8081 | // 6 Control respuestas: | 8083 | // 6 Control respuestas: |
| 8082 | if (c.getCount() <= 0) { | 8084 | if (c.getCount() <= 0) { |
| 8083 | dtb.close(); | 8085 | dtb.close(); |
| 8084 | return lista_resultado; | 8086 | return lista_resultado; |
| 8085 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 8087 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 8086 | dtb.close(); | 8088 | dtb.close(); |
| 8087 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 8089 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 8088 | } | 8090 | } |
| 8089 | // ArticuloVisible nvoArt; | 8091 | // ArticuloVisible nvoArt; |
| 8090 | // int codigo,sector; | 8092 | // int codigo,sector; |
| 8091 | // String desc,codigoBarra; | 8093 | // String desc,codigoBarra; |
| 8092 | // double precioVenta, precioCosto; | 8094 | // double precioVenta, precioCosto; |
| 8093 | // ArrayList<String> losCodigosBarras; | 8095 | // ArrayList<String> losCodigosBarras; |
| 8094 | // 7 Lectura de los resultados: | 8096 | // 7 Lectura de los resultados: |
| 8095 | if (c.moveToFirst()) { | 8097 | if (c.moveToFirst()) { |
| 8096 | // System.out.println(":::ACA SI ENTROOOOOOO"); | 8098 | // System.out.println(":::ACA SI ENTROOOOOOO"); |
| 8097 | while (c.isAfterLast() == false) { | 8099 | while (c.isAfterLast() == false) { |
| 8098 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 8100 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 8099 | // Crear un articulo con los datos extraidos | 8101 | // Crear un articulo con los datos extraidos |
| 8100 | // codigo=c.getInt(0); | 8102 | // codigo=c.getInt(0); |
| 8101 | // sector=c.getInt(1); | 8103 | // sector=c.getInt(1); |
| 8102 | // desc=c.getString(2); | 8104 | // desc=c.getString(2); |
| 8103 | // codigoBarra=c.getString(3); | 8105 | // codigoBarra=c.getString(3); |
| 8104 | // precioVenta=c.getDouble(4); | 8106 | // precioVenta=c.getDouble(4); |
| 8105 | // precioCosto=c.getDouble(5); | 8107 | // precioCosto=c.getDouble(5); |
| 8106 | // losCodigosBarras= new ArrayList<String>(); | 8108 | // losCodigosBarras= new ArrayList<String>(); |
| 8107 | // losCodigosBarras.add(codigoBarra); | 8109 | // losCodigosBarras.add(codigoBarra); |
| 8108 | // nvoArt=new ArticuloVisible(sector, codigo, | 8110 | // nvoArt=new ArticuloVisible(sector, codigo, |
| 8109 | // losCodigosBarras, 0, desc, precioVenta, precioCosto, "", | 8111 | // losCodigosBarras, 0, desc, precioVenta, precioCosto, "", |
| 8110 | // -1, "", true); | 8112 | // -1, "", true); |
| 8111 | // Meterlo en el hash map | 8113 | // Meterlo en el hash map |
| 8112 | hashmap.put(ParametrosInventario.clave_art_sector, | 8114 | hashmap.put(ParametrosInventario.clave_art_sector, |
| 8113 | c.getInt(0)); | 8115 | c.getInt(0)); |
| 8114 | hashmap.put(ParametrosInventario.clave_art_codigo, | 8116 | hashmap.put(ParametrosInventario.clave_art_codigo, |
| 8115 | c.getInt(1)); | 8117 | c.getInt(1)); |
| 8116 | hashmap.put(ParametrosInventario.clave_art_nombre, | 8118 | hashmap.put(ParametrosInventario.clave_art_nombre, |
| 8117 | c.getString(2)); | 8119 | c.getString(2)); |
| 8118 | lista_resultado.add(hashmap); | 8120 | lista_resultado.add(hashmap); |
| 8119 | // System.out.println(":::"+lista_resultado); | 8121 | // System.out.println(":::"+lista_resultado); |
| 8120 | c.moveToNext(); | 8122 | c.moveToNext(); |
| 8121 | } | 8123 | } |
| 8122 | // 8 Cerramos la BD | 8124 | // 8 Cerramos la BD |
| 8123 | dtb.close(); | 8125 | dtb.close(); |
| 8124 | return lista_resultado; | 8126 | return lista_resultado; |
| 8125 | } else { | 8127 | } else { |
| 8126 | dtb.close(); | 8128 | dtb.close(); |
| 8127 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 8129 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 8128 | } | 8130 | } |
| 8129 | } catch (Exception e) { | 8131 | } catch (Exception e) { |
| 8130 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 8132 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 8131 | "Error en la busqueda: " + busqueda); | 8133 | "Error en la busqueda: " + busqueda); |
| 8132 | } | 8134 | } |
| 8133 | 8135 | ||
| 8134 | } | 8136 | } |
| 8135 | 8137 | ||
| 8136 | 8138 | ||
| 8137 | /* | 8139 | /* |
| 8138 | 8140 | ||
| 8139 | 8141 | ||
| 8140 | 8142 | ||
| 8141 | */ | 8143 | */ |
| 8142 | 8144 | ||
| 8143 | public boolean buscarArticulosNoTomadosBD(int inventario_curso)throws ExceptionBDD{ | 8145 | public boolean buscarArticulosNoTomadosBD(int inventario_curso)throws ExceptionBDD{ |
| 8144 | SQLiteDatabase dtb = this.getWritableDatabase(); | 8146 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 8145 | // 2 Construimos la consulta SQL: | 8147 | // 2 Construimos la consulta SQL: |
| 8146 | Cursor c; | 8148 | Cursor c; |
| 8147 | ArrayList<HashMap<Integer, Object>> art_no_tomados = new ArrayList<HashMap<Integer, Object>>(); | 8149 | ArrayList<HashMap<Integer, Object>> art_no_tomados = new ArrayList<HashMap<Integer, Object>>(); |
| 8148 | c= dtb.rawQuery("SELECT * FROM ARTICULOS WHERE ART_I="+inventario_curso + " AND ART_Q IN (-1,0)", null); | 8150 | c= dtb.rawQuery("SELECT * FROM ARTICULOS WHERE ART_I="+inventario_curso + " AND ART_Q IN (-1,0)", null); |
| 8149 | if (c.moveToFirst() == true) { | 8151 | if (c.moveToFirst() == true) { |
| 8150 | System.out.println("::: BD HAY ARTICULOS NO TOMADOS"); | 8152 | System.out.println("::: BD HAY ARTICULOS NO TOMADOS"); |
| 8151 | return true; | 8153 | return true; |
| 8152 | } else { | 8154 | } else { |
| 8153 | System.out.println("::: BD TODOS LOS ARTICULOS TIENEN COSAS"); | 8155 | System.out.println("::: BD TODOS LOS ARTICULOS TIENEN COSAS"); |
| 8154 | return false; | 8156 | return false; |
| 8155 | } | 8157 | } |
| 8156 | } | 8158 | } |
| 8157 | 8159 | ||
| 8158 | /* | 8160 | /* |
| 8159 | * | 8161 | * |
| 8160 | * Busca los proveedores existentes | 8162 | * Busca los proveedores existentes |
| 8161 | * */ | 8163 | * */ |
| 8162 | 8164 | ||
| 8163 | public ArrayList<String> buscarEnProveedores( | 8165 | public ArrayList<String> buscarEnProveedores( |
| 8164 | String valor) throws ExceptionBDD { | 8166 | String valor) throws ExceptionBDD { |
| 8165 | try { | 8167 | try { |
| 8166 | System.out.println("::: BaseDatos 738 buscarEnProveedores"); | 8168 | System.out.println("::: BaseDatos 738 buscarEnProveedores"); |
| 8167 | //ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); | 8169 | //ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); |
| 8168 | ArrayList<String> lista_resultado = new ArrayList<String>(); | 8170 | ArrayList<String> lista_resultado = new ArrayList<String>(); |
| 8169 | SQLiteDatabase dtb = this.getWritableDatabase(); | 8171 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 8170 | if(valor==""){ | 8172 | if(valor==""){ |
| 8171 | valor = valor.replaceAll("\\s+", " "); | 8173 | valor = valor.replaceAll("\\s+", " "); |
| 8172 | String tabla_busqueda[] = valor.split("\\s"); | 8174 | String tabla_busqueda[] = valor.split("\\s"); |
| 8173 | String consulta_SQL = ""; | 8175 | String consulta_SQL = ""; |
| 8174 | for (String s : tabla_busqueda) { | 8176 | for (String s : tabla_busqueda) { |
| 8175 | consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion | 8177 | consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion |
| 8176 | + " LIKE '%" + s + "%' AND "; | 8178 | + " LIKE '%" + s + "%' AND "; |
| 8177 | } | 8179 | } |
| 8178 | //consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 8180 | //consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 8179 | consulta_SQL = ""; | 8181 | consulta_SQL = ""; |
| 8180 | String col[] = new String[] { | 8182 | String col[] = new String[] { |
| 8181 | ParametrosInventario.bal_bdd_proveedores_descripcion | 8183 | ParametrosInventario.bal_bdd_proveedores_descripcion |
| 8182 | }; | 8184 | }; |
| 8183 | Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, | 8185 | Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, |
| 8184 | null, ParametrosInventario.bal_bdd_proveedores_codigo + "," | 8186 | null, ParametrosInventario.bal_bdd_proveedores_codigo + "," |
| 8185 | + ParametrosInventario.bal_bdd_proveedores_descripcion, | 8187 | + ParametrosInventario.bal_bdd_proveedores_descripcion, |
| 8186 | null, ParametrosInventario.bal_bdd_proveedores_descripcion); | 8188 | null, ParametrosInventario.bal_bdd_proveedores_descripcion); |
| 8187 | 8189 | ||
| 8188 | // 6 Control respuestas: | 8190 | // 6 Control respuestas: |
| 8189 | if (c.getCount() <= 0) { | 8191 | if (c.getCount() <= 0) { |
| 8190 | dtb.close(); | 8192 | dtb.close(); |
| 8191 | return lista_resultado; | 8193 | return lista_resultado; |
| 8192 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 8194 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 8193 | dtb.close(); | 8195 | dtb.close(); |
| 8194 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 8196 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 8195 | } | 8197 | } |
| 8196 | // 7 Lectura de los resultados: | 8198 | // 7 Lectura de los resultados: |
| 8197 | if (c.moveToFirst()) { | 8199 | if (c.moveToFirst()) { |
| 8198 | while (c.isAfterLast() == false) { | 8200 | while (c.isAfterLast() == false) { |
| 8199 | 8201 | ||
| 8200 | // lista_resultado.add(ParametrosInventario.clave_prov_cod, | 8202 | // lista_resultado.add(ParametrosInventario.clave_prov_cod, |
| 8201 | // c.getString(0)); | 8203 | // c.getString(0)); |
| 8202 | lista_resultado.add(c.getString(0)); | 8204 | lista_resultado.add(c.getString(0)); |
| 8203 | System.out.println("::: listaresultado " +lista_resultado ); | 8205 | System.out.println("::: listaresultado " +lista_resultado ); |
| 8204 | 8206 | ||
| 8205 | c.moveToNext(); | 8207 | c.moveToNext(); |
| 8206 | } | 8208 | } |
| 8207 | // 8 Cerramos la BD | 8209 | // 8 Cerramos la BD |
| 8208 | dtb.close(); | 8210 | dtb.close(); |
| 8209 | return lista_resultado; | 8211 | return lista_resultado; |
| 8210 | } else { | 8212 | } else { |
| 8211 | dtb.close(); | 8213 | dtb.close(); |
| 8212 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 8214 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 8213 | } | 8215 | } |
| 8214 | }else{ | 8216 | }else{ |
| 8215 | valor = valor.replaceAll("\\s+", " "); | 8217 | valor = valor.replaceAll("\\s+", " "); |
| 8216 | String tabla_busqueda[] = valor.split("\\s"); | 8218 | String tabla_busqueda[] = valor.split("\\s"); |
| 8217 | String consulta_SQL = ""; | 8219 | String consulta_SQL = ""; |
| 8218 | for (String s : tabla_busqueda) { | 8220 | for (String s : tabla_busqueda) { |
| 8219 | consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion | 8221 | consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion |
| 8220 | + " LIKE '%" + s + "%' AND "; | 8222 | + " LIKE '%" + s + "%' AND "; |
| 8221 | } | 8223 | } |
| 8222 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 8224 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 8223 | String col[] = new String[] { | 8225 | String col[] = new String[] { |
| 8224 | ParametrosInventario.bal_bdd_proveedores_descripcion | 8226 | ParametrosInventario.bal_bdd_proveedores_descripcion |
| 8225 | }; | 8227 | }; |
| 8226 | Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, | 8228 | Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, |
| 8227 | null, ParametrosInventario.bal_bdd_proveedores_codigo + "," | 8229 | null, ParametrosInventario.bal_bdd_proveedores_codigo + "," |
| 8228 | + ParametrosInventario.bal_bdd_proveedores_descripcion, | 8230 | + ParametrosInventario.bal_bdd_proveedores_descripcion, |
| 8229 | null, ParametrosInventario.bal_bdd_proveedores_descripcion); | 8231 | null, ParametrosInventario.bal_bdd_proveedores_descripcion); |
| 8230 | 8232 | ||
| 8231 | 8233 | ||
| 8232 | // 6 Control respuestas: | 8234 | // 6 Control respuestas: |
| 8233 | if (c.getCount() <= 0) { | 8235 | if (c.getCount() <= 0) { |
| 8234 | dtb.close(); | 8236 | dtb.close(); |
| 8235 | return lista_resultado; | 8237 | return lista_resultado; |
| 8236 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 8238 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 8237 | dtb.close(); | 8239 | dtb.close(); |
| 8238 | //throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 8240 | //throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 8239 | return lista_resultado; | 8241 | return lista_resultado; |
| 8240 | } | 8242 | } |
| 8241 | // 7 Lectura de los resultados: | 8243 | // 7 Lectura de los resultados: |
| 8242 | if (c.moveToFirst()) { | 8244 | if (c.moveToFirst()) { |
| 8243 | while (c.isAfterLast() == false) { | 8245 | while (c.isAfterLast() == false) { |
| 8244 | // lista_resultado.add(ParametrosInventario.clave_prov_cod, | 8246 | // lista_resultado.add(ParametrosInventario.clave_prov_cod, |
| 8245 | // c.getString(0)); | 8247 | // c.getString(0)); |
| 8246 | lista_resultado.add(c.getString(0)); | 8248 | lista_resultado.add(c.getString(0)); |
| 8247 | System.out.println("::: listaresultado " +lista_resultado ); | 8249 | System.out.println("::: listaresultado " +lista_resultado ); |
| 8248 | c.moveToNext(); | 8250 | c.moveToNext(); |
| 8249 | } | 8251 | } |
| 8250 | // 8 Cerramos la BD | 8252 | // 8 Cerramos la BD |
| 8251 | dtb.close(); | 8253 | dtb.close(); |
| 8252 | return lista_resultado; | 8254 | return lista_resultado; |
| 8253 | } else { | 8255 | } else { |
| 8254 | dtb.close(); | 8256 | dtb.close(); |
| 8255 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 8257 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 8256 | } | 8258 | } |
| 8257 | } | 8259 | } |
| 8258 | } catch (Exception e) { | 8260 | } catch (Exception e) { |
| 8259 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 8261 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 8260 | "Error en la busqueda: " + valor); | 8262 | "Error en la busqueda: " + valor); |
| 8261 | } | 8263 | } |
| 8262 | } | 8264 | } |
| 8263 | /* | 8265 | /* |
| 8264 | * | 8266 | * |
| 8265 | * Busca el codigo del proveedor mediante el nombre, y guarda el codigo en una tabla que relaciona el inventario de compra | 8267 | * Busca el codigo del proveedor mediante el nombre, y guarda el codigo en una tabla que relaciona el inventario de compra |
| 8266 | * */ | 8268 | * */ |
| 8267 | 8269 | ||
| 8268 | public ArrayList<String> cargarProveedor( | 8270 | public ArrayList<String> cargarProveedor( |
| 8269 | String valor,String proveedor_id) throws ExceptionBDD { | 8271 | String valor,String proveedor_id) throws ExceptionBDD { |
| 8270 | try { | 8272 | try { |
| 8271 | System.out.println("::: BaseDatos 738 buscarEnProveedores"); | 8273 | System.out.println("::: BaseDatos 738 buscarEnProveedores"); |
| 8272 | ArrayList<String> lista_resultado = new ArrayList<String>(); | 8274 | ArrayList<String> lista_resultado = new ArrayList<String>(); |
| 8273 | SQLiteDatabase dtb = this.getWritableDatabase(); | 8275 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 8274 | valor = valor.replaceAll("\\s+", " "); | 8276 | valor = valor.replaceAll("\\s+", " "); |
| 8275 | int codigoProve = 0; | 8277 | int codigoProve = 0; |
| 8276 | String tabla_busqueda[] = valor.split("\\s"); | 8278 | String tabla_busqueda[] = valor.split("\\s"); |
| 8277 | String consulta_SQL = ""; | 8279 | String consulta_SQL = ""; |
| 8278 | for (String s : tabla_busqueda) { | 8280 | for (String s : tabla_busqueda) { |
| 8279 | consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion | 8281 | consulta_SQL += ParametrosInventario.bal_bdd_proveedores_descripcion |
| 8280 | + " LIKE '%" + s + "%' AND "; | 8282 | + " LIKE '%" + s + "%' AND "; |
| 8281 | } | 8283 | } |
| 8282 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 8284 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 8283 | String col[] = new String[] { | 8285 | String col[] = new String[] { |
| 8284 | ParametrosInventario.bal_bdd_proveedores_codigo | 8286 | ParametrosInventario.bal_bdd_proveedores_codigo |
| 8285 | }; | 8287 | }; |
| 8286 | Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, | 8288 | Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, |
| 8287 | null, ParametrosInventario.bal_bdd_proveedores_codigo + "," | 8289 | null, ParametrosInventario.bal_bdd_proveedores_codigo + "," |
| 8288 | + ParametrosInventario.bal_bdd_proveedores_descripcion, | 8290 | + ParametrosInventario.bal_bdd_proveedores_descripcion, |
| 8289 | null, ParametrosInventario.bal_bdd_proveedores_descripcion); | 8291 | null, ParametrosInventario.bal_bdd_proveedores_descripcion); |
| 8290 | // 6 Control respuestas: | 8292 | // 6 Control respuestas: |
| 8291 | if (c.getCount() <= 0) { | 8293 | if (c.getCount() <= 0) { |
| 8292 | dtb.close(); | 8294 | dtb.close(); |
| 8293 | return lista_resultado; | 8295 | return lista_resultado; |
| 8294 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 8296 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 8295 | dtb.close(); | 8297 | dtb.close(); |
| 8296 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 8298 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 8297 | } | 8299 | } |
| 8298 | // 7 Lectura de los resultados: | 8300 | // 7 Lectura de los resultados: |
| 8299 | if (c.moveToFirst()) { | 8301 | if (c.moveToFirst()) { |
| 8300 | while (c.isAfterLast() == false) { | 8302 | while (c.isAfterLast() == false) { |
| 8301 | // lista_resultado.add(ParametrosInventario.clave_prov_cod,c.getString(0)); | 8303 | // lista_resultado.add(ParametrosInventario.clave_prov_cod,c.getString(0)); |
| 8302 | lista_resultado.add(c.getString(0)); | 8304 | lista_resultado.add(c.getString(0)); |
| 8303 | codigoProve = c.getInt(0); | 8305 | codigoProve = c.getInt(0); |
| 8304 | dtb.execSQL("DELETE FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD="+proveedor_id); | 8306 | dtb.execSQL("DELETE FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD="+proveedor_id); |
| 8305 | dtb.execSQL("INSERT INTO COMPRA_PROVEEDOR(COMPRA_INV_COD,COMPRA_PROVE_COD) VALUES ("+proveedor_id+","+codigoProve+") "); | 8307 | dtb.execSQL("INSERT INTO COMPRA_PROVEEDOR(COMPRA_INV_COD,COMPRA_PROVE_COD) VALUES ("+proveedor_id+","+codigoProve+") "); |
| 8306 | c.moveToNext(); | 8308 | c.moveToNext(); |
| 8307 | } | 8309 | } |
| 8308 | // 8 Cerramos la BD | 8310 | // 8 Cerramos la BD |
| 8309 | dtb.close(); | 8311 | dtb.close(); |
| 8310 | return lista_resultado; | 8312 | return lista_resultado; |
| 8311 | } else { | 8313 | } else { |
| 8312 | dtb.close(); | 8314 | dtb.close(); |
| 8313 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 8315 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 8314 | } | 8316 | } |
| 8315 | } catch (Exception e) { | 8317 | } catch (Exception e) { |
| 8316 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 8318 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 8317 | "Error en la busqueda: " + valor); | 8319 | "Error en la busqueda: " + valor); |
| 8318 | } | 8320 | } |
| 8319 | } | 8321 | } |
| 8320 | /** | 8322 | /** |
| 8321 | * Busca el articulo unSector-unCodigo en las referencias | 8323 | * Busca el articulo unSector-unCodigo en las referencias |
| 8322 | * <p> | 8324 | * <p> |
| 8323 | * 1 Abrimos la base | 8325 | * 1 Abrimos la base |
| 8324 | * <p> | 8326 | * <p> |
| 8325 | * 2 Construimos la consulta SQL | 8327 | * 2 Construimos la consulta SQL |
| 8326 | * <p> | 8328 | * <p> |
| 8327 | * 3 Buscar en las referencias el articulo | 8329 | * 3 Buscar en las referencias el articulo |
| 8328 | * <p> | 8330 | * <p> |
| 8329 | * 4 Control respuestas | 8331 | * 4 Control respuestas |
| 8330 | * <p> | 8332 | * <p> |
| 8331 | * 5 Lectura de los resultados | 8333 | * 5 Lectura de los resultados |
| 8332 | * <p> | 8334 | * <p> |
| 8333 | * 6 Crear un articulo con los datos extraidos | 8335 | * 6 Crear un articulo con los datos extraidos |
| 8334 | * <p> | 8336 | * <p> |
| 8335 | * 7 Cerramos la BD | 8337 | * 7 Cerramos la BD |
| 8336 | * | 8338 | * |
| 8337 | * @param unCodigo | 8339 | * @param unCodigo |
| 8338 | * @param unSector | 8340 | * @param unSector |
| 8339 | * @return el articulo encontrado | 8341 | * @return el articulo encontrado |
| 8340 | * @throws ExceptionBDD | 8342 | * @throws ExceptionBDD |
| 8341 | * si no encuentra | 8343 | * si no encuentra |
| 8342 | */ | 8344 | */ |
| 8343 | public ArticuloVisible buscarArticuloEnReferencias(int unCodigo, | 8345 | public ArticuloVisible buscarArticuloEnReferencias(int unCodigo, |
| 8344 | int unSector) throws ExceptionBDD { | 8346 | int unSector) throws ExceptionBDD { |
| 8345 | ArticuloVisible result = null; | 8347 | ArticuloVisible result = null; |
| 8346 | System.out.println("::: BaseDatos 866 buscarArticuloEnReferencias"); | 8348 | System.out.println("::: BaseDatos 866 buscarArticuloEnReferencias"); |
| 8347 | try { | 8349 | try { |
| 8348 | // 1 Abrimos la base: | 8350 | // 1 Abrimos la base: |
| 8349 | SQLiteDatabase dtb = this.getWritableDatabase(); | 8351 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 8350 | // 2 Construimos la consulta SQL: | 8352 | // 2 Construimos la consulta SQL: |
| 8351 | String consulta_SQL = ""; | 8353 | String consulta_SQL = ""; |
| 8352 | 8354 | ||
| 8353 | consulta_SQL = ParametrosInventario.bal_bdd_referencia_codigo | 8355 | consulta_SQL = ParametrosInventario.bal_bdd_referencia_codigo |
| 8354 | + " = " + String.valueOf(unCodigo) + " AND " | 8356 | + " = " + String.valueOf(unCodigo) + " AND " |
| 8355 | + ParametrosInventario.bal_bdd_referencia_sector + " = " | 8357 | + ParametrosInventario.bal_bdd_referencia_sector + " = " |
| 8356 | + String.valueOf(unSector); | 8358 | + String.valueOf(unSector); |
| 8357 | 8359 | ||
| 8358 | // 3 Buscar en las referencias el articulo | 8360 | // 3 Buscar en las referencias el articulo |
| 8359 | // Mas columnas, o todo | 8361 | // Mas columnas, o todo |
| 8360 | String col[] = new String[] { | 8362 | String col[] = new String[] { |
| 8361 | ParametrosInventario.bal_bdd_referencia_sector, | 8363 | ParametrosInventario.bal_bdd_referencia_sector, |
| 8362 | ParametrosInventario.bal_bdd_referencia_codigo, | 8364 | ParametrosInventario.bal_bdd_referencia_codigo, |
| 8363 | ParametrosInventario.bal_bdd_referencia_balanza, | 8365 | ParametrosInventario.bal_bdd_referencia_balanza, |
| 8364 | ParametrosInventario.bal_bdd_referencia_decimales, | 8366 | ParametrosInventario.bal_bdd_referencia_decimales, |
| 8365 | ParametrosInventario.bal_bdd_referencia_descripcion, | 8367 | ParametrosInventario.bal_bdd_referencia_descripcion, |
| 8366 | ParametrosInventario.bal_bdd_referencia_codigo_barra, | 8368 | ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 8367 | ParametrosInventario.bal_bdd_referencia_codigo_barra_completo, | 8369 | ParametrosInventario.bal_bdd_referencia_codigo_barra_completo, |
| 8368 | ParametrosInventario.bal_bdd_referencia_precio_venta, | 8370 | ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 8369 | ParametrosInventario.bal_bdd_referencia_precio_costo , | 8371 | ParametrosInventario.bal_bdd_referencia_precio_costo , |
| 8370 | ParametrosInventario.bal_bdd_referencia_existencia_venta, | 8372 | ParametrosInventario.bal_bdd_referencia_existencia_venta, |
| 8371 | ParametrosInventario.bal_bdd_referencia_existencia_deposito, | 8373 | ParametrosInventario.bal_bdd_referencia_existencia_deposito, |
| 8372 | ParametrosInventario.bal_bdd_referencia_depsn,}; | 8374 | ParametrosInventario.bal_bdd_referencia_depsn,}; |
| 8373 | System.out.println("::: BD 873 valor depsn " + ParametrosInventario.bal_bdd_referencia_depsn); | 8375 | System.out.println("::: BD 873 valor depsn " + ParametrosInventario.bal_bdd_referencia_depsn); |
| 8374 | 8376 | ||
| 8375 | Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, | 8377 | Cursor c = dtb.query(tabla_referencias_nombre, col, consulta_SQL, |
| 8376 | null, null, null, null); | 8378 | null, null, null, null); |
| 8377 | 8379 | ||
| 8378 | // 4 Control respuestas: | 8380 | // 4 Control respuestas: |
| 8379 | if (c.getCount() <= 0) { | 8381 | if (c.getCount() <= 0) { |
| 8380 | dtb.close(); | 8382 | dtb.close(); |
| 8381 | return result; | 8383 | return result; |
| 8382 | } | 8384 | } |
| 8383 | 8385 | ||
| 8384 | // ArticuloVisible nvoArt; | 8386 | // ArticuloVisible nvoArt; |
| 8385 | int codigo, sector, depsn,balanza,decimales; | 8387 | int codigo, sector, depsn,balanza,decimales; |
| 8386 | String desc, codigoBarra,codigoBarraCompleto; | 8388 | String desc, codigoBarra,codigoBarraCompleto; |
| 8387 | double precioVenta, precioCosto, exisventa, exisdeposito; | 8389 | double precioVenta, precioCosto, exisventa, exisdeposito; |
| 8388 | ArrayList<String> losCodigosBarras; | 8390 | ArrayList<String> losCodigosBarras; |
| 8389 | ArrayList<String> losCodigosBarrasCompleto; | 8391 | ArrayList<String> losCodigosBarrasCompleto; |
| 8390 | // 5 Lectura de los resultados: | 8392 | // 5 Lectura de los resultados: |
| 8391 | if (c.moveToFirst()) { | 8393 | if (c.moveToFirst()) { |
| 8392 | // Deberia ser uno solo | 8394 | // Deberia ser uno solo |
| 8393 | // while (c.isAfterLast() == false) { | 8395 | // while (c.isAfterLast() == false) { |
| 8394 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 8396 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 8395 | // 6 Crear un articulo con los datos extraidos | 8397 | // 6 Crear un articulo con los datos extraidos |
| 8396 | sector = c.getInt(0); | 8398 | sector = c.getInt(0); |
| 8397 | codigo = c.getInt(1); | 8399 | codigo = c.getInt(1); |
| 8398 | balanza = c.getInt(2); | 8400 | balanza = c.getInt(2); |
| 8399 | decimales = c.getInt(3); | 8401 | decimales = c.getInt(3); |
| 8400 | desc = c.getString(4); | 8402 | desc = c.getString(4); |
| 8401 | codigoBarra = c.getString(5); | 8403 | codigoBarra = c.getString(5); |
| 8402 | codigoBarraCompleto = c.getString(6); | 8404 | codigoBarraCompleto = c.getString(6); |
| 8403 | precioVenta = c.getDouble(7); | 8405 | precioVenta = c.getDouble(7); |
| 8404 | precioCosto = c.getDouble(8); | 8406 | precioCosto = c.getDouble(8); |
| 8405 | exisventa = c.getDouble(9); | 8407 | exisventa = c.getDouble(9); |
| 8406 | exisdeposito = c.getDouble(10); | 8408 | exisdeposito = c.getDouble(10); |
| 8407 | depsn = c.getInt(11); | 8409 | depsn = c.getInt(11); |
| 8408 | System.out.println("::: BD 907 hasta aca llega el valor depsn " + depsn); | 8410 | System.out.println("::: BD 907 hasta aca llega el valor depsn " + depsn); |
| 8409 | losCodigosBarras = new ArrayList<String>(); | 8411 | losCodigosBarras = new ArrayList<String>(); |
| 8410 | losCodigosBarrasCompleto = new ArrayList<String>(); | 8412 | losCodigosBarrasCompleto = new ArrayList<String>(); |
| 8411 | losCodigosBarras.add(codigoBarra); | 8413 | losCodigosBarras.add(codigoBarra); |
| 8412 | result = new ArticuloVisible(sector, codigo, balanza,decimales, losCodigosBarras,losCodigosBarrasCompleto, | 8414 | result = new ArticuloVisible(sector, codigo, balanza,decimales, losCodigosBarras,losCodigosBarrasCompleto, |
| 8413 | 0, desc, precioVenta, precioCosto, "", -1,-1,exisventa,exisdeposito,depsn, "", true); | 8415 | 0, desc, precioVenta, precioCosto, "", -1,-1,exisventa,exisdeposito,depsn, "", true); |
| 8414 | /////////////////////////////////////////// | 8416 | /////////////////////////////////////////// |
| 8415 | // c.moveToNext(); | 8417 | // c.moveToNext(); |
| 8416 | // } | 8418 | // } |
| 8417 | // 7 Cerramos la BD | 8419 | // 7 Cerramos la BD |
| 8418 | dtb.close(); | 8420 | dtb.close(); |
| 8419 | return result; | 8421 | return result; |
| 8420 | } else { | 8422 | } else { |
| 8421 | dtb.close(); | 8423 | dtb.close(); |
| 8422 | return result; | 8424 | return result; |
| 8423 | // throw new | 8425 | // throw new |
| 8424 | // ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 8426 | // ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 8425 | } | 8427 | } |
| 8426 | } catch (Exception e) { | 8428 | } catch (Exception e) { |
| 8427 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 8429 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 8428 | "Error en la busqueda: " + unSector + "-" + unCodigo); | 8430 | "Error en la busqueda: " + unSector + "-" + unCodigo); |
| 8429 | } | 8431 | } |
| 8430 | 8432 | ||
| 8431 | } | 8433 | } |
| 8432 | 8434 | ||
| 8433 | 8435 | ||
| 8434 | public Proveedor buscarProveedor(int unCodigo) throws ExceptionBDD { | 8436 | public Proveedor buscarProveedor(int unCodigo) throws ExceptionBDD { |
| 8435 | Proveedor result = null; | 8437 | Proveedor result = null; |
| 8436 | System.out.println("::: BaseDatos 866 buscarProveedor"); | 8438 | System.out.println("::: BaseDatos 866 buscarProveedor"); |
| 8437 | try { | 8439 | try { |
| 8438 | // 1 Abrimos la base: | 8440 | // 1 Abrimos la base: |
| 8439 | SQLiteDatabase dtb = this.getWritableDatabase(); | 8441 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 8440 | // 2 Construimos la consulta SQL: | 8442 | // 2 Construimos la consulta SQL: |
| 8441 | String consulta_SQL = ""; | 8443 | String consulta_SQL = ""; |
| 8442 | 8444 | ||
| 8443 | consulta_SQL = ParametrosInventario.bal_bdd_proveedores_codigo | 8445 | consulta_SQL = ParametrosInventario.bal_bdd_proveedores_codigo |
| 8444 | + " = " + String.valueOf(unCodigo); | 8446 | + " = " + String.valueOf(unCodigo); |
| 8445 | 8447 | ||
| 8446 | // 3 Buscar en las referencias el articulo | 8448 | // 3 Buscar en las referencias el articulo |
| 8447 | // Mas columnas, o todo | 8449 | // Mas columnas, o todo |
| 8448 | String col[] = new String[] { | 8450 | String col[] = new String[] { |
| 8449 | ParametrosInventario.bal_bdd_proveedores_codigo, | 8451 | ParametrosInventario.bal_bdd_proveedores_codigo, |
| 8450 | ParametrosInventario.bal_bdd_proveedores_descripcion | 8452 | ParametrosInventario.bal_bdd_proveedores_descripcion |
| 8451 | }; | 8453 | }; |
| 8452 | Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, | 8454 | Cursor c = dtb.query(tabla_proveedores_nombre, col, consulta_SQL, |
| 8453 | null, null, null, null); | 8455 | null, null, null, null); |
| 8454 | 8456 | ||
| 8455 | // 4 Control respuestas: | 8457 | // 4 Control respuestas: |
| 8456 | if (c.getCount() <= 0) { | 8458 | if (c.getCount() <= 0) { |
| 8457 | dtb.close(); | 8459 | dtb.close(); |
| 8458 | return result; | 8460 | return result; |
| 8459 | } | 8461 | } |
| 8460 | 8462 | ||
| 8461 | int codigo; | 8463 | int codigo; |
| 8462 | String nombre; | 8464 | String nombre; |
| 8463 | // 5 Lectura de los resultados: | 8465 | // 5 Lectura de los resultados: |
| 8464 | if (c.moveToFirst()) { | 8466 | if (c.moveToFirst()) { |
| 8465 | // Deberia ser uno solo | 8467 | // Deberia ser uno solo |
| 8466 | // while (c.isAfterLast() == false) { | 8468 | // while (c.isAfterLast() == false) { |
| 8467 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 8469 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 8468 | // 6 Crear un articulo con los datos extraidos | 8470 | // 6 Crear un articulo con los datos extraidos |
| 8469 | codigo = c.getInt(0); | 8471 | codigo = c.getInt(0); |
| 8470 | nombre = c.getString(1); | 8472 | nombre = c.getString(1); |
| 8471 | System.out.println("::: BD 907 hasta aca llega el valor depsn "); | 8473 | System.out.println("::: BD 907 hasta aca llega el valor depsn "); |
| 8472 | result = new Proveedor(codigo,nombre); | 8474 | result = new Proveedor(codigo,nombre); |
| 8473 | 8475 | ||
| 8474 | dtb.close(); | 8476 | dtb.close(); |
| 8475 | return result; | 8477 | return result; |
| 8476 | } else { | 8478 | } else { |
| 8477 | dtb.close(); | 8479 | dtb.close(); |
| 8478 | return result; | 8480 | return result; |
| 8479 | // throw new | 8481 | // throw new |
| 8480 | // ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 8482 | // ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 8481 | } | 8483 | } |
| 8482 | } catch (Exception e) { | 8484 | } catch (Exception e) { |
| 8483 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 8485 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 8484 | "Error en la busqueda: " + unCodigo); | 8486 | "Error en la busqueda: " + unCodigo); |
| 8485 | } | 8487 | } |
| 8486 | 8488 | ||
| 8487 | } | 8489 | } |
| 8488 | 8490 | ||
| 8489 | /** | 8491 | /** |
| 8490 | * Busca por parecido de descripcion en el num_inventario | 8492 | * Busca por parecido de descripcion en el num_inventario |
| 8491 | * <p> | 8493 | * <p> |
| 8492 | * 1 Abrimos la base | 8494 | * 1 Abrimos la base |
| 8493 | * <p> | 8495 | * <p> |
| 8494 | * 2 Procesar la cadena de busqueda (un espacio blanco cuenta como un | 8496 | * 2 Procesar la cadena de busqueda (un espacio blanco cuenta como un |
| 8495 | * &&:Reemplazamos los multiples espacios blancos por 1 solo | 8497 | * &&:Reemplazamos los multiples espacios blancos por 1 solo |
| 8496 | * <p> | 8498 | * <p> |
| 8497 | * 3 Partimos el string en una tabla segun el caracter ' ' | 8499 | * 3 Partimos el string en una tabla segun el caracter ' ' |
| 8498 | * <p> | 8500 | * <p> |
| 8499 | * 4 Construimos la consulta SQL | 8501 | * 4 Construimos la consulta SQL |
| 8500 | * <p> | 8502 | * <p> |
| 8501 | * 5 Buscar en el inventario especificado el articulo | 8503 | * 5 Buscar en el inventario especificado el articulo |
| 8502 | * <p> | 8504 | * <p> |
| 8503 | * 6 Control respuestas | 8505 | * 6 Control respuestas |
| 8504 | * <p> | 8506 | * <p> |
| 8505 | * 7 Lectura de los resultados | 8507 | * 7 Lectura de los resultados |
| 8506 | * <p> | 8508 | * <p> |
| 8507 | * 8 Cerramos la BD | 8509 | * 8 Cerramos la BD |
| 8508 | * | 8510 | * |
| 8509 | * @param num_inventario | 8511 | * @param num_inventario |
| 8510 | * @param busqueda | 8512 | * @param busqueda |
| 8511 | * @return | 8513 | * @return |
| 8512 | * @throws ExceptionBDD | 8514 | * @throws ExceptionBDD |
| 8513 | */ | 8515 | */ |
| 8514 | public ArrayList<HashMap<Integer, Object>> buscar(int num_inventario, | 8516 | public ArrayList<HashMap<Integer, Object>> buscar(int num_inventario, |
| 8515 | String busqueda) throws ExceptionBDD { | 8517 | String busqueda) throws ExceptionBDD { |
| 8516 | System.out.println("::: BaseDatos 972 buscar"); | 8518 | System.out.println("::: BaseDatos 972 buscar"); |
| 8517 | try { | 8519 | try { |
| 8518 | // Variable de retorno: | 8520 | // Variable de retorno: |
| 8519 | ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); | 8521 | ArrayList<HashMap<Integer, Object>> lista_resultado = new ArrayList<HashMap<Integer, Object>>(); |
| 8520 | 8522 | ||
| 8521 | // 1 Abrimos la base: | 8523 | // 1 Abrimos la base: |
| 8522 | SQLiteDatabase dtb = this.getWritableDatabase(); | 8524 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 8523 | 8525 | ||
| 8524 | // 2 Procesar la cadena de busqueda (un espacio blanco cuenta como | 8526 | // 2 Procesar la cadena de busqueda (un espacio blanco cuenta como |
| 8525 | // un | 8527 | // un |
| 8526 | // &&): | 8528 | // &&): |
| 8527 | // Reemplazamos los multiples espacios blancos por 1 solo: | 8529 | // Reemplazamos los multiples espacios blancos por 1 solo: |
| 8528 | busqueda = busqueda.replaceAll("\\s+", " "); | 8530 | busqueda = busqueda.replaceAll("\\s+", " "); |
| 8529 | 8531 | ||
| 8530 | // 3 Partimos el string en una tabla segn el caracter ' ': | 8532 | // 3 Partimos el string en una tabla segn el caracter ' ': |
| 8531 | String tabla_busqueda[] = busqueda.split("\\s"); | 8533 | String tabla_busqueda[] = busqueda.split("\\s"); |
| 8532 | 8534 | ||
| 8533 | // 4 Construimos la consulta SQL: | 8535 | // 4 Construimos la consulta SQL: |
| 8534 | String consulta_SQL = ""; | 8536 | String consulta_SQL = ""; |
| 8535 | for (String s : tabla_busqueda) { | 8537 | for (String s : tabla_busqueda) { |
| 8536 | consulta_SQL += ParametrosInventario.bal_bdd_articulo_descripcion | 8538 | consulta_SQL += ParametrosInventario.bal_bdd_articulo_descripcion |
| 8537 | + " LIKE '%" + s + "%' AND "; | 8539 | + " LIKE '%" + s + "%' AND "; |
| 8538 | } | 8540 | } |
| 8539 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); | 8541 | consulta_SQL = consulta_SQL.substring(0, consulta_SQL.length() - 4); |
| 8540 | consulta_SQL += "AND " | 8542 | consulta_SQL += "AND " |
| 8541 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 8543 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 8542 | + num_inventario; | 8544 | + num_inventario; |
| 8543 | 8545 | ||
| 8544 | // 5 Buscar en el inventario especificado el articulo: | 8546 | // 5 Buscar en el inventario especificado el articulo: |
| 8545 | String col[] = new String[] { | 8547 | String col[] = new String[] { |
| 8546 | ParametrosInventario.bal_bdd_articulo_sector, | 8548 | ParametrosInventario.bal_bdd_articulo_sector, |
| 8547 | ParametrosInventario.bal_bdd_articulo_codigo, | 8549 | ParametrosInventario.bal_bdd_articulo_codigo, |
| 8548 | ParametrosInventario.bal_bdd_articulo_descripcion }; | 8550 | ParametrosInventario.bal_bdd_articulo_descripcion }; |
| 8549 | 8551 | ||
| 8550 | Cursor c = dtb.query(tabla_articulos_nombre, col, consulta_SQL, | 8552 | Cursor c = dtb.query(tabla_articulos_nombre, col, consulta_SQL, |
| 8551 | null, null, null, | 8553 | null, null, null, |
| 8552 | ParametrosInventario.bal_bdd_articulo_descripcion); | 8554 | ParametrosInventario.bal_bdd_articulo_descripcion); |
| 8553 | 8555 | ||
| 8554 | // 6 Control respuestas: | 8556 | // 6 Control respuestas: |
| 8555 | if (c.getCount() <= 0) { | 8557 | if (c.getCount() <= 0) { |
| 8556 | dtb.close(); | 8558 | dtb.close(); |
| 8557 | return lista_resultado; | 8559 | return lista_resultado; |
| 8558 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { | 8560 | } else if (c.getCount() > ParametrosInventario.MAX_SQL_RESPUESTAS) { |
| 8559 | dtb.close(); | 8561 | dtb.close(); |
| 8560 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); | 8562 | throw new ExceptionBDD(ExceptionBDD.ERROR_TOO_MANY_RESULTS); |
| 8561 | } | 8563 | } |
| 8562 | 8564 | ||
| 8563 | // 7 Lectura de los resultados: | 8565 | // 7 Lectura de los resultados: |
| 8564 | if (c.moveToFirst()) { | 8566 | if (c.moveToFirst()) { |
| 8565 | while (c.isAfterLast() == false) { | 8567 | while (c.isAfterLast() == false) { |
| 8566 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); | 8568 | HashMap<Integer, Object> hashmap = new HashMap<Integer, Object>(); |
| 8567 | 8569 | ||
| 8568 | hashmap.put(ParametrosInventario.clave_art_sector, | 8570 | hashmap.put(ParametrosInventario.clave_art_sector, |
| 8569 | c.getInt(0)); | 8571 | c.getInt(0)); |
| 8570 | hashmap.put(ParametrosInventario.clave_art_codigo, | 8572 | hashmap.put(ParametrosInventario.clave_art_codigo, |
| 8571 | c.getInt(1)); | 8573 | c.getInt(1)); |
| 8572 | hashmap.put(ParametrosInventario.clave_art_nombre, | 8574 | hashmap.put(ParametrosInventario.clave_art_nombre, |
| 8573 | c.getString(2)); | 8575 | c.getString(2)); |
| 8574 | 8576 | ||
| 8575 | lista_resultado.add(hashmap); | 8577 | lista_resultado.add(hashmap); |
| 8576 | 8578 | ||
| 8577 | c.moveToNext(); | 8579 | c.moveToNext(); |
| 8578 | } | 8580 | } |
| 8579 | // 8 Cerramos la BD | 8581 | // 8 Cerramos la BD |
| 8580 | dtb.close(); | 8582 | dtb.close(); |
| 8581 | return lista_resultado; | 8583 | return lista_resultado; |
| 8582 | } else { | 8584 | } else { |
| 8583 | dtb.close(); | 8585 | dtb.close(); |
| 8584 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); | 8586 | throw new ExceptionBDD(ExceptionBDD.ERROR_NO_RESULT_UNEXPECTED); |
| 8585 | } | 8587 | } |
| 8586 | } catch (Exception e) { | 8588 | } catch (Exception e) { |
| 8587 | 8589 | ||
| 8588 | GestorLogEventos log = new GestorLogEventos(); | 8590 | GestorLogEventos log = new GestorLogEventos(); |
| 8589 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 8591 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 8590 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 8592 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 8591 | log.log("[-- 818 --]" + e.toString(), 4); | 8593 | log.log("[-- 818 --]" + e.toString(), 4); |
| 8592 | 8594 | ||
| 8593 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 8595 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 8594 | "Error en la busqueda: " + busqueda); | 8596 | "Error en la busqueda: " + busqueda); |
| 8595 | } | 8597 | } |
| 8596 | } | 8598 | } |
| 8597 | 8599 | ||
| 8598 | /** | 8600 | /** |
| 8599 | * Regenera las tablas de articulos e inventarios. Si se ha cambiado la | 8601 | * Regenera las tablas de articulos e inventarios. Si se ha cambiado la |
| 8600 | * sentencia de creacion, se creana segun la nueva estriuctura 1 Abrimos la | 8602 | * sentencia de creacion, se creana segun la nueva estriuctura 1 Abrimos la |
| 8601 | * base 2 Suprimimos todas las entradas de las tablas, sin suprimir las 3 | 8603 | * base 2 Suprimimos todas las entradas de las tablas, sin suprimir las 3 |
| 8602 | * Se elimina la version anterior de la tabla 4 Se crea la nueva version de | 8604 | * Se elimina la version anterior de la tabla 4 Se crea la nueva version de |
| 8603 | * la tabla 5 Cierre | 8605 | * la tabla 5 Cierre |
| 8604 | * | 8606 | * |
| 8605 | * @throws ExceptionBDD | 8607 | * @throws ExceptionBDD |
| 8606 | */ | 8608 | */ |
| 8607 | public void destruirYReconstruir() throws ExceptionBDD { | 8609 | public void destruirYReconstruir() throws ExceptionBDD { |
| 8608 | try { | 8610 | try { |
| 8609 | System.out.println("::: BaseDatos 1065 destruirYReconstruir"); | 8611 | System.out.println("::: BaseDatos 1065 destruirYReconstruir"); |
| 8610 | // 1 Abrimos la base: | 8612 | // 1 Abrimos la base: |
| 8611 | SQLiteDatabase db = this.getWritableDatabase(); | 8613 | SQLiteDatabase db = this.getWritableDatabase(); |
| 8612 | 8614 | ||
| 8613 | // 2 Suprimimos todas las entradas de las tablas, sin suprimir las | 8615 | // 2 Suprimimos todas las entradas de las tablas, sin suprimir las |
| 8614 | // tablas: | 8616 | // tablas: |
| 8615 | db.execSQL("DELETE FROM " + tabla_articulos_nombre); | 8617 | db.execSQL("DELETE FROM " + tabla_articulos_nombre); |
| 8616 | db.execSQL("DELETE FROM " + tabla_inventarios_nombre); | 8618 | db.execSQL("DELETE FROM " + tabla_inventarios_nombre); |
| 8617 | 8619 | ||
| 8618 | // 3 Se elimina la versin anterior de la tabla | 8620 | // 3 Se elimina la versin anterior de la tabla |
| 8619 | db.execSQL("DROP TABLE IF EXISTS " + tabla_articulos_nombre); | 8621 | db.execSQL("DROP TABLE IF EXISTS " + tabla_articulos_nombre); |
| 8620 | db.execSQL("DROP TABLE IF EXISTS " + tabla_inventarios_nombre); | 8622 | db.execSQL("DROP TABLE IF EXISTS " + tabla_inventarios_nombre); |
| 8621 | 8623 | ||
| 8622 | // 4 Se crea la nueva version de la tabla | 8624 | // 4 Se crea la nueva version de la tabla |
| 8623 | db.execSQL(sqlCreateTablaArticulos); | 8625 | db.execSQL(sqlCreateTablaArticulos); |
| 8624 | db.execSQL(sqlCreateTablaInventarios); | 8626 | db.execSQL(sqlCreateTablaInventarios); |
| 8625 | 8627 | ||
| 8626 | // 5 Cierre: | 8628 | // 5 Cierre: |
| 8627 | db.close(); | 8629 | db.close(); |
| 8628 | 8630 | ||
| 8629 | } catch (Exception e) { | 8631 | } catch (Exception e) { |
| 8630 | 8632 | ||
| 8631 | GestorLogEventos log = new GestorLogEventos(); | 8633 | GestorLogEventos log = new GestorLogEventos(); |
| 8632 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 8634 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 8633 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 8635 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 8634 | log.log("[-- 859 --]" + e.toString(), 4); | 8636 | log.log("[-- 859 --]" + e.toString(), 4); |
| 8635 | 8637 | ||
| 8636 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 8638 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 8637 | "Imposible de hacer RESET"); | 8639 | "Imposible de hacer RESET"); |
| 8638 | } | 8640 | } |
| 8639 | } | 8641 | } |
| 8640 | 8642 | ||
| 8641 | public void borrarArticuloCompra(int cod_sector, int cod_art, int inventario_numero_en_curso){ | 8643 | public void borrarArticuloCompra(int cod_sector, int cod_art, int inventario_numero_en_curso){ |
| 8642 | try { | 8644 | try { |
| 8643 | System.out.println("::: BaseDatos 1459 borrarArticuloCompra"); | 8645 | System.out.println("::: BaseDatos 1459 borrarArticuloCompra"); |
| 8644 | // 1 Abrimos la base: | 8646 | // 1 Abrimos la base: |
| 8645 | SQLiteDatabase db = this.getWritableDatabase(); | 8647 | SQLiteDatabase db = this.getWritableDatabase(); |
| 8646 | // 2 Suprimimos todas las entradas de las tablas, sin suprimir las | 8648 | // 2 Suprimimos todas las entradas de las tablas, sin suprimir las |
| 8647 | // tablas: | 8649 | // tablas: |
| 8648 | db.execSQL("DELETE FROM ARTICULOS WHERE ART_SEC="+ cod_sector | 8650 | db.execSQL("DELETE FROM ARTICULOS WHERE ART_SEC="+ cod_sector |
| 8649 | + " AND ART_COD="+ cod_art | 8651 | + " AND ART_COD="+ cod_art |
| 8650 | + " AND ART_I= "+inventario_numero_en_curso); | 8652 | + " AND ART_I= "+inventario_numero_en_curso); |
| 8651 | // 3 Se elimina la versin anterior de la tabla | 8653 | // 3 Se elimina la versin anterior de la tabla |
| 8652 | // 5 Cierre: | 8654 | // 5 Cierre: |
| 8653 | db.close(); | 8655 | db.close(); |
| 8654 | } catch (Exception e) { | 8656 | } catch (Exception e) { |
| 8655 | GestorLogEventos log = new GestorLogEventos(); | 8657 | GestorLogEventos log = new GestorLogEventos(); |
| 8656 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 8658 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 8657 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 8659 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 8658 | log.log("[-- 859 --]" + e.toString(), 4); | 8660 | log.log("[-- 859 --]" + e.toString(), 4); |
| 8659 | //throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 8661 | //throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 8660 | // "Imposible de hacer RESET"); | 8662 | // "Imposible de hacer RESET"); |
| 8661 | } | 8663 | } |
| 8662 | } | 8664 | } |
| 8663 | 8665 | ||
| 8664 | /** | 8666 | /** |
| 8665 | * Regenera la tabla que se le pasa como parametro 1 Abrimos la base 2 | 8667 | * Regenera la tabla que se le pasa como parametro 1 Abrimos la base 2 |
| 8666 | * Suprimimos todas las entradas de la tabla 3 Suprimimos la tabla que se | 8668 | * Suprimimos todas las entradas de la tabla 3 Suprimimos la tabla que se |
| 8667 | * paso 4 Se crea la nueva versin de la tabla 5 Cierre | 8669 | * paso 4 Se crea la nueva versin de la tabla 5 Cierre |
| 8668 | * | 8670 | * |
| 8669 | * @param tabla | 8671 | * @param tabla |
| 8670 | * @throws ExceptionBDD | 8672 | * @throws ExceptionBDD |
| 8671 | */ | 8673 | */ |
| 8672 | public void destruirYReconstruir(String tabla) throws ExceptionBDD { | 8674 | public void destruirYReconstruir(String tabla) throws ExceptionBDD { |
| 8673 | try { | 8675 | try { |
| 8674 | System.out.println("::: BaseDatos 1107 destruirYReconstruir"); | 8676 | System.out.println("::: BaseDatos 1107 destruirYReconstruir"); |
| 8675 | // 1 Abrimos la base: | 8677 | // 1 Abrimos la base: |
| 8676 | SQLiteDatabase dtb = this.getWritableDatabase(); | 8678 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 8677 | 8679 | ||
| 8678 | // 2 Suprimimos todas las entradas de la tabla | 8680 | // 2 Suprimimos todas las entradas de la tabla |
| 8679 | dtb.execSQL("DELETE FROM " + tabla); | 8681 | dtb.execSQL("DELETE FROM " + tabla); |
| 8680 | 8682 | ||
| 8681 | // 3 Suprimimos la tabla que se paso | 8683 | // 3 Suprimimos la tabla que se paso |
| 8682 | dtb.execSQL("DROP TABLE IF EXISTS " + tabla); | 8684 | dtb.execSQL("DROP TABLE IF EXISTS " + tabla); |
| 8683 | 8685 | ||
| 8684 | // 4 Se crea la nueva versin de la tabla | 8686 | // 4 Se crea la nueva versin de la tabla |
| 8685 | if (tabla.compareTo(tabla_articulos_nombre) == 0) { | 8687 | if (tabla.compareTo(tabla_articulos_nombre) == 0) { |
| 8686 | dtb.execSQL(sqlCreateTablaArticulos); | 8688 | dtb.execSQL(sqlCreateTablaArticulos); |
| 8687 | } else if (tabla.compareTo(tabla_inventarios_nombre) == 0) { | 8689 | } else if (tabla.compareTo(tabla_inventarios_nombre) == 0) { |
| 8688 | dtb.execSQL(sqlCreateTablaInventarios); | 8690 | dtb.execSQL(sqlCreateTablaInventarios); |
| 8689 | } | 8691 | } |
| 8690 | 8692 | ||
| 8691 | // 5 Cierre: | 8693 | // 5 Cierre: |
| 8692 | dtb.close(); | 8694 | dtb.close(); |
| 8693 | 8695 | ||
| 8694 | } catch (Exception e) { | 8696 | } catch (Exception e) { |
| 8695 | 8697 | ||
| 8696 | GestorLogEventos log = new GestorLogEventos(); | 8698 | GestorLogEventos log = new GestorLogEventos(); |
| 8697 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 8699 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 8698 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 8700 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 8699 | log.log("[-- 900 --]" + e.toString(), 4); | 8701 | log.log("[-- 900 --]" + e.toString(), 4); |
| 8700 | 8702 | ||
| 8701 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 8703 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 8702 | "Imposible de hacer RESET"); | 8704 | "Imposible de hacer RESET"); |
| 8703 | } | 8705 | } |
| 8704 | 8706 | ||
| 8705 | } | 8707 | } |
| 8706 | 8708 | ||
| 8707 | /** | 8709 | /** |
| 8708 | * Verifica el estado del inventario por su id para ver si esta abierto 1 | 8710 | * Verifica el estado del inventario por su id para ver si esta abierto 1 |
| 8709 | * Abrimos la base de datos en modo lectura 2 Buscamos el inventario con | 8711 | * Abrimos la base de datos en modo lectura 2 Buscamos el inventario con |
| 8710 | * ese id en la tabla de inventarios 3 Evaluamos el resultado y si es 1 | 8712 | * ese id en la tabla de inventarios 3 Evaluamos el resultado y si es 1 |
| 8711 | * devolvemos true | 8713 | * devolvemos true |
| 8712 | * | 8714 | * |
| 8713 | * @param id | 8715 | * @param id |
| 8714 | * @return true si el inventario esta abierto | 8716 | * @return true si el inventario esta abierto |
| 8715 | * @throws ExceptionBDD | 8717 | * @throws ExceptionBDD |
| 8716 | * si el inventario no existe | 8718 | * si el inventario no existe |
| 8717 | */ | 8719 | */ |
| 8718 | public boolean estaAbiertoInventarioConId(int id) throws ExceptionBDD { | 8720 | public boolean estaAbiertoInventarioConId(int id) throws ExceptionBDD { |
| 8719 | System.out.println("::: BaseDatos 1152 estaAbiertoInventarioConId"); | 8721 | System.out.println("::: BaseDatos 1152 estaAbiertoInventarioConId"); |
| 8720 | // 1 Abrimos la base de datos en modo lectura | 8722 | // 1 Abrimos la base de datos en modo lectura |
| 8721 | SQLiteDatabase dtb = this.getReadableDatabase(); | 8723 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 8722 | System.out.println("::: BaseDatos 1155 que id es " + String.valueOf(id)); | 8724 | System.out.println("::: BaseDatos 1155 que id es " + String.valueOf(id)); |
| 8723 | 8725 | ||
| 8724 | 8726 | ||
| 8725 | /*hardcode mas o menos*/ | 8727 | /*hardcode mas o menos*/ |
| 8726 | /*COMO NO PUEDO TRAER EL VALOR DE -2 DEL INVENTARIO POR DEPOSITO Y SIEMPRE | 8728 | /*COMO NO PUEDO TRAER EL VALOR DE -2 DEL INVENTARIO POR DEPOSITO Y SIEMPRE |
| 8727 | * VIENE -1, HAGO UN IF PREGUNTANDO DE SI EL CHECK DE VENTAS ES FALSO Y EL ID | 8729 | * VIENE -1, HAGO UN IF PREGUNTANDO DE SI EL CHECK DE VENTAS ES FALSO Y EL ID |
| 8728 | * PASADO ES -1 LE ASIGNE A LO BRUTO UN -2 PARA PODER TRABAJAR*/ | 8730 | * PASADO ES -1 LE ASIGNE A LO BRUTO UN -2 PARA PODER TRABAJAR*/ |
| 8729 | boolean condicionRadio = ParametrosInventario.InventariosVentas; | 8731 | boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 8730 | Cursor c; | 8732 | Cursor c; |
| 8731 | System.out.println("::: BaseDatos condicionRadio " + condicionRadio + " " + String.valueOf(id)); | 8733 | System.out.println("::: BaseDatos condicionRadio " + condicionRadio + " " + String.valueOf(id)); |
| 8732 | int valorapasar = Integer.parseInt(String.valueOf(id)); | 8734 | int valorapasar = Integer.parseInt(String.valueOf(id)); |
| 8733 | if(condicionRadio==false && valorapasar==-1){ | 8735 | if(condicionRadio==false && valorapasar==-1){ |
| 8734 | //deposito | 8736 | //deposito |
| 8735 | System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 8737 | System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 8736 | c = dtb | 8738 | c = dtb |
| 8737 | .query(tabla_inventarios_nombre, | 8739 | .query(tabla_inventarios_nombre, |
| 8738 | new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 8740 | new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 8739 | ParametrosInventario.bal_bdd_inventario_numero + "=?", | 8741 | ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 8740 | new String[] {"-2"}, null, null, null); | 8742 | new String[] {"-2"}, null, null, null); |
| 8741 | }else{ | 8743 | }else{ |
| 8742 | //ventas | 8744 | //ventas |
| 8743 | System.out.println("VENTASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 8745 | System.out.println("VENTASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 8744 | c = dtb | 8746 | c = dtb |
| 8745 | .query(tabla_inventarios_nombre, | 8747 | .query(tabla_inventarios_nombre, |
| 8746 | new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 8748 | new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 8747 | ParametrosInventario.bal_bdd_inventario_numero + "=?", | 8749 | ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 8748 | new String[] { String.valueOf(id) }, null, null, null); | 8750 | new String[] { String.valueOf(id) }, null, null, null); |
| 8749 | } | 8751 | } |
| 8750 | 8752 | ||
| 8751 | 8753 | ||
| 8752 | /**/ | 8754 | /**/ |
| 8753 | // 2 Buscamos el inventario con ese id en la tabla de inventarios | 8755 | // 2 Buscamos el inventario con ese id en la tabla de inventarios |
| 8754 | // Cursor c = dtb | 8756 | // Cursor c = dtb |
| 8755 | // .query(tabla_inventarios_nombre, | 8757 | // .query(tabla_inventarios_nombre, |
| 8756 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 8758 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 8757 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 8759 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 8758 | // new String[] { String.valueOf(id) }, null, null, null); | 8760 | // new String[] { String.valueOf(id) }, null, null, null); |
| 8759 | 8761 | ||
| 8760 | // 3 Evaluamos el resultado y si es 1 devolvemos true | 8762 | // 3 Evaluamos el resultado y si es 1 devolvemos true |
| 8761 | if (c.moveToFirst() == true) { | 8763 | if (c.moveToFirst() == true) { |
| 8762 | if (c.getInt(0) == 1) { | 8764 | if (c.getInt(0) == 1) { |
| 8763 | return true; | 8765 | return true; |
| 8764 | } else { | 8766 | } else { |
| 8765 | return false; | 8767 | return false; |
| 8766 | } | 8768 | } |
| 8767 | 8769 | ||
| 8768 | } else { | 8770 | } else { |
| 8769 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 8771 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 8770 | "El INVENTARIO con NUMERO=" + String.valueOf(id) | 8772 | "El INVENTARIO con NUMERO=" + String.valueOf(id) |
| 8771 | + " no existe"); | 8773 | + " no existe"); |
| 8772 | } | 8774 | } |
| 8773 | } | 8775 | } |
| 8774 | 8776 | ||
| 8775 | public boolean estaAbiertoInventarioComprasConId(int id) throws ExceptionBDD { | 8777 | public boolean estaAbiertoInventarioComprasConId(int id) throws ExceptionBDD { |
| 8776 | System.out.println("::: BaseDatos 1152 estaAbiertoInventarioComprasConId"); | 8778 | System.out.println("::: BaseDatos 1152 estaAbiertoInventarioComprasConId"); |
| 8777 | // 1 Abrimos la base de datos en modo lectura | 8779 | // 1 Abrimos la base de datos en modo lectura |
| 8778 | 8780 | ||
| 8779 | SQLiteDatabase dtb = this.getReadableDatabase(); | 8781 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 8780 | Cursor c; | 8782 | Cursor c; |
| 8781 | //int valorapasar = Integer.parseInt(String.valueOf(id)); | 8783 | //int valorapasar = Integer.parseInt(String.valueOf(id)); |
| 8782 | //if(valorapasar==-3){ | 8784 | //if(valorapasar==-3){ |
| 8783 | //deposito | 8785 | //deposito |
| 8784 | System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 8786 | System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 8785 | //c = dtb.query(tabla_inventarios_nombre, | 8787 | //c = dtb.query(tabla_inventarios_nombre, |
| 8786 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 8788 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 8787 | // ParametrosInventario.bal_bdd_inventario_numero + "="+ id, | 8789 | // ParametrosInventario.bal_bdd_inventario_numero + "="+ id, |
| 8788 | // new String[] {"-2"}, null, null, null);} | 8790 | // new String[] {"-2"}, null, null, null);} |
| 8789 | //select count(INV_NUM) from INVENTARIOS WHERE INV_NUM=-6 | 8791 | //select count(INV_NUM) from INVENTARIOS WHERE INV_NUM=-6 |
| 8790 | //c= dtb.rawQuery("select * from "+tabla_inventarios_nombre+" WHERE "+ParametrosInventario.bal_bdd_inventario_numero | 8792 | //c= dtb.rawQuery("select * from "+tabla_inventarios_nombre+" WHERE "+ParametrosInventario.bal_bdd_inventario_numero |
| 8791 | // +"="+id, null); | 8793 | // +"="+id, null); |
| 8792 | 8794 | ||
| 8793 | c = dtb | 8795 | c = dtb |
| 8794 | .query(tabla_inventarios_nombre, | 8796 | .query(tabla_inventarios_nombre, |
| 8795 | new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 8797 | new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 8796 | ParametrosInventario.bal_bdd_inventario_numero + "=?", | 8798 | ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 8797 | new String[] { String.valueOf(id) }, null, null, null); | 8799 | new String[] { String.valueOf(id) }, null, null, null); |
| 8798 | 8800 | ||
| 8799 | System.out.println("::: BaseDatos c.getInt(0) que traeeee "); | 8801 | System.out.println("::: BaseDatos c.getInt(0) que traeeee "); |
| 8800 | // System.out.println("::: BaseDatos c.getInt(0) que traeeee " + c.getString(0)); | 8802 | // System.out.println("::: BaseDatos c.getInt(0) que traeeee " + c.getString(0)); |
| 8801 | // 3 Evaluamos el resultado y si es 1 devolvemos true | 8803 | // 3 Evaluamos el resultado y si es 1 devolvemos true |
| 8802 | 8804 | ||
| 8803 | 8805 | ||
| 8804 | // 3 Evaluamos el resultado y si es 1 devolvemos true | 8806 | // 3 Evaluamos el resultado y si es 1 devolvemos true |
| 8805 | if (c.moveToFirst() == true) { | 8807 | if (c.moveToFirst() == true) { |
| 8806 | if (c.getInt(0) == 1) { | 8808 | if (c.getInt(0) == 1) { |
| 8807 | return true; | 8809 | return true; |
| 8808 | } else { | 8810 | } else { |
| 8809 | return false; | 8811 | return false; |
| 8810 | } | 8812 | } |
| 8811 | //return true; | 8813 | //return true; |
| 8812 | } else { | 8814 | } else { |
| 8813 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 8815 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 8814 | "El INVENTARIO con NUMERO=" + String.valueOf(id) | 8816 | "El INVENTARIO con NUMERO=" + String.valueOf(id) |
| 8815 | + " no existe"); | 8817 | + " no existe"); |
| 8816 | } | 8818 | } |
| 8817 | } | 8819 | } |
| 8818 | 8820 | ||
| 8819 | 8821 | ||
| 8820 | public void SelectTotal() throws IOException { | 8822 | public void SelectTotal() throws IOException { |
| 8821 | System.out.println("::: BaseDatos 1179 SelectTotal"); | 8823 | System.out.println("::: BaseDatos 1179 SelectTotal"); |
| 8822 | 8824 | ||
| 8823 | /** | 8825 | /** |
| 8824 | * EN ESTA FUNCIN SE CREAR UNA EXPORTACIN DE SEGURIDAD DE LA BASE DE | 8826 | * EN ESTA FUNCIN SE CREAR UNA EXPORTACIN DE SEGURIDAD DE LA BASE DE |
| 8825 | * DATOS | 8827 | * DATOS |
| 8826 | */ | 8828 | */ |
| 8827 | 8829 | ||
| 8828 | /** | 8830 | /** |
| 8829 | * COMIENZO LA CONFIGURACIN DE DONDE IR LOS DATOS | 8831 | * COMIENZO LA CONFIGURACIN DE DONDE IR LOS DATOS |
| 8830 | */ | 8832 | */ |
| 8831 | 8833 | ||
| 8832 | String query = "Select * from " + ParametrosInventario.tabla_articulos; | 8834 | String query = "Select * from " + ParametrosInventario.tabla_articulos; |
| 8833 | 8835 | ||
| 8834 | // se llama en el gestor que se encargar de dibujar el txt con las | 8836 | // se llama en el gestor que se encargar de dibujar el txt con las |
| 8835 | // etiquetas de xml | 8837 | // etiquetas de xml |
| 8836 | GestorLogEventos logDatos = new GestorLogEventos(); | 8838 | GestorLogEventos logDatos = new GestorLogEventos(); |
| 8837 | logDatos.tipo_0 = Parametros.PREF_LOG_EVENTOS; | 8839 | logDatos.tipo_0 = Parametros.PREF_LOG_EVENTOS; |
| 8838 | logDatos.tipo_2 = Parametros.PREF_LOG_PROCESOS; | 8840 | logDatos.tipo_2 = Parametros.PREF_LOG_PROCESOS; |
| 8839 | logDatos.tipo_3 = Parametros.PREF_LOG_MENSAJES; | 8841 | logDatos.tipo_3 = Parametros.PREF_LOG_MENSAJES; |
| 8840 | logDatos.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 8842 | logDatos.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 8841 | logDatos.setUbicacion(ParametrosInventario.CARPETA_LOGDATOS); | 8843 | logDatos.setUbicacion(ParametrosInventario.CARPETA_LOGDATOS); |
| 8842 | 8844 | ||
| 8843 | GestorLogEventos logErrores = new GestorLogEventos(); | 8845 | GestorLogEventos logErrores = new GestorLogEventos(); |
| 8844 | logErrores.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 8846 | logErrores.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 8845 | logErrores.tipo_0 = Parametros.PREF_LOG_EVENTOS; | 8847 | logErrores.tipo_0 = Parametros.PREF_LOG_EVENTOS; |
| 8846 | logErrores.tipo_2 = Parametros.PREF_LOG_PROCESOS; | 8848 | logErrores.tipo_2 = Parametros.PREF_LOG_PROCESOS; |
| 8847 | logErrores.tipo_3 = Parametros.PREF_LOG_MENSAJES; | 8849 | logErrores.tipo_3 = Parametros.PREF_LOG_MENSAJES; |
| 8848 | logErrores.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 8850 | logErrores.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 8849 | 8851 | ||
| 8850 | String ruta = ParametrosInventario.CARPETA_LOGDATOS + "log.txt"; | 8852 | String ruta = ParametrosInventario.CARPETA_LOGDATOS + "log.txt"; |
| 8851 | logErrores.log("La ruta del logDatos es: " + ruta, 3); | 8853 | logErrores.log("La ruta del logDatos es: " + ruta, 3); |
| 8852 | File LogDatosAnterior = new File(ruta); | 8854 | File LogDatosAnterior = new File(ruta); |
| 8853 | LogDatosAnterior.delete(); | 8855 | LogDatosAnterior.delete(); |
| 8854 | LogDatosAnterior.deleteOnExit(); | 8856 | LogDatosAnterior.deleteOnExit(); |
| 8855 | 8857 | ||
| 8856 | logErrores.log("Comienza la exportacin de artculos", 2); | 8858 | logErrores.log("Comienza la exportacin de artculos", 2); |
| 8857 | 8859 | ||
| 8858 | SQLiteDatabase dtb = this.getReadableDatabase(); | 8860 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 8859 | Cursor c = dtb.rawQuery(query, null); | 8861 | Cursor c = dtb.rawQuery(query, null); |
| 8860 | 8862 | ||
| 8861 | /** | 8863 | /** |
| 8862 | * COMIENZA LA EXPORTACIN DE LA LA TABLA ARTCULOS | 8864 | * COMIENZA LA EXPORTACIN DE LA LA TABLA ARTCULOS |
| 8863 | */ | 8865 | */ |
| 8864 | 8866 | ||
| 8865 | try { | 8867 | try { |
| 8866 | if (c.moveToFirst()) { | 8868 | if (c.moveToFirst()) { |
| 8867 | 8869 | ||
| 8868 | 8870 | ||
| 8869 | System.out.println("*** DATOS="+ParametrosInventario.tabla_articulos); | 8871 | System.out.println("*** DATOS="+ParametrosInventario.tabla_articulos); |
| 8870 | logDatos.Logdatos(ParametrosInventario.tabla_articulos, null, 1); | 8872 | logDatos.Logdatos(ParametrosInventario.tabla_articulos, null, 1); |
| 8871 | int contador = 1; | 8873 | int contador = 1; |
| 8872 | do { | 8874 | do { |
| 8873 | 8875 | ||
| 8874 | String sector = c.getString(0); | 8876 | String sector = c.getString(0); |
| 8875 | String codigo = c.getString(1); | 8877 | String codigo = c.getString(1); |
| 8876 | String codigoBarra = c.getString(2); | 8878 | String codigoBarra = c.getString(2); |
| 8877 | String inventario = c.getString(3); | 8879 | String inventario = c.getString(3); |
| 8878 | String descripcion = c.getString(4); | 8880 | String descripcion = c.getString(4); |
| 8879 | String precioVenta = c.getString(5); | 8881 | String precioVenta = c.getString(5); |
| 8880 | String precioCosto = c.getString(6); | 8882 | String precioCosto = c.getString(6); |
| 8881 | String foto = c.getString(7); | 8883 | String foto = c.getString(7); |
| 8882 | String cantidad = c.getString(8); | 8884 | String cantidad = c.getString(8); |
| 8883 | String fechaInicio = c.getString(9); | 8885 | String fechaInicio = c.getString(9); |
| 8884 | String fechaFin = c.getString(10); | 8886 | String fechaFin = c.getString(10); |
| 8885 | String exisVenta = c.getString(11); | 8887 | String exisVenta = c.getString(11); |
| 8886 | String exisDeposito = c.getString(12); | 8888 | String exisDeposito = c.getString(12); |
| 8887 | String subtotal = c.getString(13); | 8889 | String subtotal = c.getString(13); |
| 8888 | 8890 | ||
| 8889 | String contadorString = String.valueOf(contador); | 8891 | String contadorString = String.valueOf(contador); |
| 8890 | 8892 | ||
| 8891 | logDatos.Logdatos(contadorString, null, 2); | 8893 | logDatos.Logdatos(contadorString, null, 2); |
| 8892 | logDatos.Logdatos(sector, | 8894 | logDatos.Logdatos(sector, |
| 8893 | ParametrosInventario.bal_bdd_articulo_sector, 3); | 8895 | ParametrosInventario.bal_bdd_articulo_sector, 3); |
| 8894 | logDatos.Logdatos(codigo, | 8896 | logDatos.Logdatos(codigo, |
| 8895 | ParametrosInventario.bal_bdd_articulo_codigo, 3); | 8897 | ParametrosInventario.bal_bdd_articulo_codigo, 3); |
| 8896 | logDatos.Logdatos(codigoBarra, | 8898 | logDatos.Logdatos(codigoBarra, |
| 8897 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 8899 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 8898 | 3); | 8900 | 3); |
| 8899 | logDatos.Logdatos(inventario, | 8901 | logDatos.Logdatos(inventario, |
| 8900 | ParametrosInventario.bal_bdd_articulo_inventario, 3); | 8902 | ParametrosInventario.bal_bdd_articulo_inventario, 3); |
| 8901 | logDatos.Logdatos(descripcion, | 8903 | logDatos.Logdatos(descripcion, |
| 8902 | ParametrosInventario.bal_bdd_articulo_descripcion, | 8904 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 8903 | 3); | 8905 | 3); |
| 8904 | logDatos.Logdatos(precioVenta, | 8906 | logDatos.Logdatos(precioVenta, |
| 8905 | ParametrosInventario.bal_bdd_articulo_precio_venta, | 8907 | ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 8906 | 3); | 8908 | 3); |
| 8907 | logDatos.Logdatos(precioCosto, | 8909 | logDatos.Logdatos(precioCosto, |
| 8908 | ParametrosInventario.bal_bdd_articulo_precio_costo, | 8910 | ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 8909 | 3); | 8911 | 3); |
| 8910 | logDatos.Logdatos(foto, | 8912 | logDatos.Logdatos(foto, |
| 8911 | ParametrosInventario.bal_bdd_articulo_foto, 3); | 8913 | ParametrosInventario.bal_bdd_articulo_foto, 3); |
| 8912 | logDatos.Logdatos(cantidad, | 8914 | logDatos.Logdatos(cantidad, |
| 8913 | ParametrosInventario.bal_bdd_articulo_cantidad, 3); | 8915 | ParametrosInventario.bal_bdd_articulo_cantidad, 3); |
| 8914 | logDatos.Logdatos(fechaInicio, | 8916 | logDatos.Logdatos(fechaInicio, |
| 8915 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 8917 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 8916 | 3); | 8918 | 3); |
| 8917 | logDatos.Logdatos(fechaFin, | 8919 | logDatos.Logdatos(fechaFin, |
| 8918 | ParametrosInventario.bal_bdd_articulo_fechaFin, 3); | 8920 | ParametrosInventario.bal_bdd_articulo_fechaFin, 3); |
| 8919 | 8921 | ||
| 8920 | 8922 | ||
| 8921 | logDatos.Logdatos(exisVenta, | 8923 | logDatos.Logdatos(exisVenta, |
| 8922 | ParametrosInventario.bal_bdd_articulo_existencia_venta, 3); | 8924 | ParametrosInventario.bal_bdd_articulo_existencia_venta, 3); |
| 8923 | logDatos.Logdatos(exisDeposito, | 8925 | logDatos.Logdatos(exisDeposito, |
| 8924 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, 3); | 8926 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, 3); |
| 8925 | 8927 | ||
| 8926 | 8928 | ||
| 8927 | logDatos.Logdatos(null, null, 21); | 8929 | logDatos.Logdatos(null, null, 21); |
| 8928 | contador++; | 8930 | contador++; |
| 8929 | 8931 | ||
| 8930 | } while (c.moveToNext()); | 8932 | } while (c.moveToNext()); |
| 8931 | 8933 | ||
| 8932 | logDatos.Logdatos(null, null, 11); | 8934 | logDatos.Logdatos(null, null, 11); |
| 8933 | 8935 | ||
| 8934 | } else { | 8936 | } else { |
| 8935 | logErrores.log("La tabla no tiene datos", 3); | 8937 | logErrores.log("La tabla no tiene datos", 3); |
| 8936 | } | 8938 | } |
| 8937 | 8939 | ||
| 8938 | } catch (Exception e1) { | 8940 | } catch (Exception e1) { |
| 8939 | logErrores.log( | 8941 | logErrores.log( |
| 8940 | "[-- 1046 --] ERROR EN LA EXPORTACION" + e1.toString(), 4); | 8942 | "[-- 1046 --] ERROR EN LA EXPORTACION" + e1.toString(), 4); |
| 8941 | logDatos.Logdatos(null, null, 11); | 8943 | logDatos.Logdatos(null, null, 11); |
| 8942 | } | 8944 | } |
| 8943 | 8945 | ||
| 8944 | dtb.close(); | 8946 | dtb.close(); |
| 8945 | 8947 | ||
| 8946 | /** | 8948 | /** |
| 8947 | * EXPORTACIN DE ARTCULO TERMINAD | 8949 | * EXPORTACIN DE ARTCULO TERMINAD |
| 8948 | */ | 8950 | */ |
| 8949 | 8951 | ||
| 8950 | /** | 8952 | /** |
| 8951 | * EXPORTACIN DE REFERENCIAS FINALIZA | 8953 | * EXPORTACIN DE REFERENCIAS FINALIZA |
| 8952 | */ | 8954 | */ |
| 8953 | 8955 | ||
| 8954 | logErrores.log("Comienza la exportacin de Referencias", 2); | 8956 | logErrores.log("Comienza la exportacin de Referencias", 2); |
| 8955 | 8957 | ||
| 8956 | String query_1 = "Select * from " | 8958 | String query_1 = "Select * from " |
| 8957 | + ParametrosInventario.tabla_referencias; | 8959 | + ParametrosInventario.tabla_referencias; |
| 8958 | SQLiteDatabase dtb_1 = this.getReadableDatabase(); | 8960 | SQLiteDatabase dtb_1 = this.getReadableDatabase(); |
| 8959 | Cursor c_1 = dtb_1.rawQuery(query_1, null); | 8961 | Cursor c_1 = dtb_1.rawQuery(query_1, null); |
| 8960 | 8962 | ||
| 8961 | try { | 8963 | try { |
| 8962 | if (c_1.moveToFirst()) { | 8964 | if (c_1.moveToFirst()) { |
| 8963 | 8965 | ||
| 8964 | logDatos.Logdatos(ParametrosInventario.tabla_referencias, null, | 8966 | logDatos.Logdatos(ParametrosInventario.tabla_referencias, null, |
| 8965 | 1); | 8967 | 1); |
| 8966 | int contador = 1; | 8968 | int contador = 1; |
| 8967 | do { | 8969 | do { |
| 8968 | 8970 | ||
| 8969 | String sector = c_1.getString(0); | 8971 | String sector = c_1.getString(0); |
| 8970 | String codigo = c_1.getString(1); | 8972 | String codigo = c_1.getString(1); |
| 8971 | String codigoBarra = c_1.getString(2); | 8973 | String codigoBarra = c_1.getString(2); |
| 8972 | String descripcion = c_1.getString(3); | 8974 | String descripcion = c_1.getString(3); |
| 8973 | String precioVenta = c_1.getString(4); | 8975 | String precioVenta = c_1.getString(4); |
| 8974 | String precioCosto = c_1.getString(5); | 8976 | String precioCosto = c_1.getString(5); |
| 8975 | String foto = c_1.getString(6); | 8977 | String foto = c_1.getString(6); |
| 8976 | 8978 | ||
| 8977 | String exisVenta = c_1.getString(7); | 8979 | String exisVenta = c_1.getString(7); |
| 8978 | String exisDeposito = c_1.getString(8); | 8980 | String exisDeposito = c_1.getString(8); |
| 8979 | 8981 | ||
| 8980 | String contadorString = String.valueOf(contador); | 8982 | String contadorString = String.valueOf(contador); |
| 8981 | 8983 | ||
| 8982 | logDatos.Logdatos(contadorString, null, 2); | 8984 | logDatos.Logdatos(contadorString, null, 2); |
| 8983 | logDatos.Logdatos(sector, | 8985 | logDatos.Logdatos(sector, |
| 8984 | ParametrosInventario.bal_bdd_referencia_sector, 3); | 8986 | ParametrosInventario.bal_bdd_referencia_sector, 3); |
| 8985 | logDatos.Logdatos(codigo, | 8987 | logDatos.Logdatos(codigo, |
| 8986 | ParametrosInventario.bal_bdd_referencia_codigo, 3); | 8988 | ParametrosInventario.bal_bdd_referencia_codigo, 3); |
| 8987 | logDatos.Logdatos( | 8989 | logDatos.Logdatos( |
| 8988 | codigoBarra, | 8990 | codigoBarra, |
| 8989 | ParametrosInventario.bal_bdd_referencia_codigo_barra, | 8991 | ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 8990 | 3); | 8992 | 3); |
| 8991 | logDatos.Logdatos( | 8993 | logDatos.Logdatos( |
| 8992 | descripcion, | 8994 | descripcion, |
| 8993 | ParametrosInventario.bal_bdd_referencia_descripcion, | 8995 | ParametrosInventario.bal_bdd_referencia_descripcion, |
| 8994 | 3); | 8996 | 3); |
| 8995 | logDatos.Logdatos( | 8997 | logDatos.Logdatos( |
| 8996 | precioVenta, | 8998 | precioVenta, |
| 8997 | ParametrosInventario.bal_bdd_referencia_precio_venta, | 8999 | ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 8998 | 3); | 9000 | 3); |
| 8999 | logDatos.Logdatos( | 9001 | logDatos.Logdatos( |
| 9000 | precioCosto, | 9002 | precioCosto, |
| 9001 | ParametrosInventario.bal_bdd_referencia_precio_costo, | 9003 | ParametrosInventario.bal_bdd_referencia_precio_costo, |
| 9002 | 3); | 9004 | 3); |
| 9003 | logDatos.Logdatos(foto, | 9005 | logDatos.Logdatos(foto, |
| 9004 | ParametrosInventario.bal_bdd_referencia_foto, 3); | 9006 | ParametrosInventario.bal_bdd_referencia_foto, 3); |
| 9005 | 9007 | ||
| 9006 | 9008 | ||
| 9007 | logDatos.Logdatos( | 9009 | logDatos.Logdatos( |
| 9008 | exisVenta, | 9010 | exisVenta, |
| 9009 | ParametrosInventario.bal_bdd_referencia_existencia_venta, | 9011 | ParametrosInventario.bal_bdd_referencia_existencia_venta, |
| 9010 | 3); | 9012 | 3); |
| 9011 | logDatos.Logdatos( | 9013 | logDatos.Logdatos( |
| 9012 | exisDeposito, | 9014 | exisDeposito, |
| 9013 | ParametrosInventario.bal_bdd_referencia_existencia_deposito, | 9015 | ParametrosInventario.bal_bdd_referencia_existencia_deposito, |
| 9014 | 3); | 9016 | 3); |
| 9015 | 9017 | ||
| 9016 | logDatos.Logdatos(null, null, 21); | 9018 | logDatos.Logdatos(null, null, 21); |
| 9017 | contador++; | 9019 | contador++; |
| 9018 | 9020 | ||
| 9019 | } while (c_1.moveToNext()); | 9021 | } while (c_1.moveToNext()); |
| 9020 | 9022 | ||
| 9021 | logDatos.Logdatos(null, null, 11); | 9023 | logDatos.Logdatos(null, null, 11); |
| 9022 | 9024 | ||
| 9023 | } else { | 9025 | } else { |
| 9024 | logErrores.log("La tabla no tiene datos", 3); | 9026 | logErrores.log("La tabla no tiene datos", 3); |
| 9025 | } | 9027 | } |
| 9026 | 9028 | ||
| 9027 | } catch (Exception e1) { | 9029 | } catch (Exception e1) { |
| 9028 | logErrores.log( | 9030 | logErrores.log( |
| 9029 | "[-- 1102 --]ERROR EN LA EXPORTACION" + e1.toString(), 4); | 9031 | "[-- 1102 --]ERROR EN LA EXPORTACION" + e1.toString(), 4); |
| 9030 | logDatos.Logdatos(null, null, 11); | 9032 | logDatos.Logdatos(null, null, 11); |
| 9031 | } | 9033 | } |
| 9032 | dtb_1.close(); | 9034 | dtb_1.close(); |
| 9033 | 9035 | ||
| 9034 | /** | 9036 | /** |
| 9035 | * EXPORTACIN DE REFERENCIAS FINALIZADA | 9037 | * EXPORTACIN DE REFERENCIAS FINALIZADA |
| 9036 | */ | 9038 | */ |
| 9037 | 9039 | ||
| 9038 | /** | 9040 | /** |
| 9039 | * COMIENZA LA EXPORTACIN DE INVENTARIOS | 9041 | * COMIENZA LA EXPORTACIN DE INVENTARIOS |
| 9040 | */ | 9042 | */ |
| 9041 | 9043 | ||
| 9042 | logErrores.log("Comienza la exportacin de Inventarios", 2); | 9044 | logErrores.log("Comienza la exportacin de Inventarios", 2); |
| 9043 | 9045 | ||
| 9044 | String query_2 = "Select * from " | 9046 | String query_2 = "Select * from " |
| 9045 | + ParametrosInventario.tabla_inventarios; | 9047 | + ParametrosInventario.tabla_inventarios; |
| 9046 | SQLiteDatabase dtb_2 = this.getReadableDatabase(); | 9048 | SQLiteDatabase dtb_2 = this.getReadableDatabase(); |
| 9047 | Cursor c_2 = dtb_2.rawQuery(query_2, null); | 9049 | Cursor c_2 = dtb_2.rawQuery(query_2, null); |
| 9048 | 9050 | ||
| 9049 | try { | 9051 | try { |
| 9050 | if (c_2.moveToFirst()) { | 9052 | if (c_2.moveToFirst()) { |
| 9051 | 9053 | ||
| 9052 | logDatos.Logdatos(ParametrosInventario.tabla_inventarios, null, | 9054 | logDatos.Logdatos(ParametrosInventario.tabla_inventarios, null, |
| 9053 | 1); | 9055 | 1); |
| 9054 | int contador = 1; | 9056 | int contador = 1; |
| 9055 | do { | 9057 | do { |
| 9056 | 9058 | ||
| 9057 | String numero = c_2.getString(0); | 9059 | String numero = c_2.getString(0); |
| 9058 | String descripcion = c_2.getString(1); | 9060 | String descripcion = c_2.getString(1); |
| 9059 | String fechaInicio = c_2.getString(2); | 9061 | String fechaInicio = c_2.getString(2); |
| 9060 | String fechaFin = c_2.getString(3); | 9062 | String fechaFin = c_2.getString(3); |
| 9061 | String estado = c_2.getString(4); | 9063 | String estado = c_2.getString(4); |
| 9062 | String cantidad = c_2.getString(5); | 9064 | String cantidad = c_2.getString(5); |
| 9063 | String subtotal = c_2.getString(6); | 9065 | String subtotal = c_2.getString(6); |
| 9064 | 9066 | ||
| 9065 | String contadorString = String.valueOf(contador); | 9067 | String contadorString = String.valueOf(contador); |
| 9066 | 9068 | ||
| 9067 | logDatos.Logdatos(contadorString, null, 2); | 9069 | logDatos.Logdatos(contadorString, null, 2); |
| 9068 | logDatos.Logdatos(numero, | 9070 | logDatos.Logdatos(numero, |
| 9069 | ParametrosInventario.bal_bdd_inventario_numero, 3); | 9071 | ParametrosInventario.bal_bdd_inventario_numero, 3); |
| 9070 | logDatos.Logdatos( | 9072 | logDatos.Logdatos( |
| 9071 | descripcion, | 9073 | descripcion, |
| 9072 | ParametrosInventario.bal_bdd_inventario_descripcion, | 9074 | ParametrosInventario.bal_bdd_inventario_descripcion, |
| 9073 | 3); | 9075 | 3); |
| 9074 | logDatos.Logdatos( | 9076 | logDatos.Logdatos( |
| 9075 | fechaInicio, | 9077 | fechaInicio, |
| 9076 | ParametrosInventario.bal_bdd_inventario_fechaInicio, | 9078 | ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 9077 | 3); | 9079 | 3); |
| 9078 | logDatos.Logdatos(fechaFin, | 9080 | logDatos.Logdatos(fechaFin, |
| 9079 | ParametrosInventario.bal_bdd_inventario_fechaFin, 3); | 9081 | ParametrosInventario.bal_bdd_inventario_fechaFin, 3); |
| 9080 | logDatos.Logdatos(estado, | 9082 | logDatos.Logdatos(estado, |
| 9081 | ParametrosInventario.bal_bdd_inventario_estado, 3); | 9083 | ParametrosInventario.bal_bdd_inventario_estado, 3); |
| 9082 | logDatos.Logdatos(cantidad, | 9084 | logDatos.Logdatos(cantidad, |
| 9083 | ParametrosInventario.bal_bdd_inventario_cantidad, 3); | 9085 | ParametrosInventario.bal_bdd_inventario_cantidad, 3); |
| 9084 | 9086 | ||
| 9085 | logDatos.Logdatos(null, null, 21); | 9087 | logDatos.Logdatos(null, null, 21); |
| 9086 | contador++; | 9088 | contador++; |
| 9087 | 9089 | ||
| 9088 | } while (c_2.moveToNext()); | 9090 | } while (c_2.moveToNext()); |
| 9089 | 9091 | ||
| 9090 | logDatos.Logdatos(null, null, 11); | 9092 | logDatos.Logdatos(null, null, 11); |
| 9091 | 9093 | ||
| 9092 | } else { | 9094 | } else { |
| 9093 | logErrores.log("La tabla no tiene datos", 3); | 9095 | logErrores.log("La tabla no tiene datos", 3); |
| 9094 | } | 9096 | } |
| 9095 | 9097 | ||
| 9096 | } catch (Exception e1) { | 9098 | } catch (Exception e1) { |
| 9097 | logErrores.log( | 9099 | logErrores.log( |
| 9098 | "[-- 1169 --]ERROR EN LA EXPORTACION" + e1.toString(), 4); | 9100 | "[-- 1169 --]ERROR EN LA EXPORTACION" + e1.toString(), 4); |
| 9099 | logDatos.Logdatos(null, null, 11); | 9101 | logDatos.Logdatos(null, null, 11); |
| 9100 | } | 9102 | } |
| 9101 | dtb_2.close(); | 9103 | dtb_2.close(); |
| 9102 | 9104 | ||
| 9103 | /** | 9105 | /** |
| 9104 | * EXPORTACIN DE INVENTARIOS FINALIZADA | 9106 | * EXPORTACIN DE INVENTARIOS FINALIZADA |
| 9105 | */ | 9107 | */ |
| 9106 | 9108 | ||
| 9107 | } | 9109 | } |
| 9108 | 9110 | ||
| 9109 | /** | 9111 | /** |
| 9110 | * Exporta la base de datos que contiene los valores medidos para los | 9112 | * Exporta la base de datos que contiene los valores medidos para los |
| 9111 | * inventarios realizados | 9113 | * inventarios realizados |
| 9112 | * <p> | 9114 | * <p> |
| 9113 | * 1 Creacion del nuevo documento | 9115 | * 1 Creacion del nuevo documento |
| 9114 | * <p> | 9116 | * <p> |
| 9115 | * 2 Creacion del elemento de cabecera | 9117 | * 2 Creacion del elemento de cabecera |
| 9116 | * <p> | 9118 | * <p> |
| 9117 | * 3 Abrimos la base de datos en modo lectura | 9119 | * 3 Abrimos la base de datos en modo lectura |
| 9118 | * <p> | 9120 | * <p> |
| 9119 | * 4 Para cada inventario de la lista | 9121 | * 4 Para cada inventario de la lista |
| 9120 | * <p> | 9122 | * <p> |
| 9121 | * 4.1 Creamos un elemento para el inventario | 9123 | * 4.1 Creamos un elemento para el inventario |
| 9122 | * <p> | 9124 | * <p> |
| 9123 | * 4.2 Recorro las columnas y creo los elementos de los datos | 9125 | * 4.2 Recorro las columnas y creo los elementos de los datos |
| 9124 | * <p> | 9126 | * <p> |
| 9125 | * 4.3 Buscamos los datos de los articulos | 9127 | * 4.3 Buscamos los datos de los articulos |
| 9126 | * <p> | 9128 | * <p> |
| 9127 | * 4.4 Creamos los elementos para cada artculo | 9129 | * 4.4 Creamos los elementos para cada artculo |
| 9128 | * <p> | 9130 | * <p> |
| 9129 | * 5 Guardamos el DOM como archivo XML | 9131 | * 5 Guardamos el DOM como archivo XML |
| 9130 | * <p> | 9132 | * <p> |
| 9131 | * 6 Mandamos el archivo en POST hacia el servidor | 9133 | * 6 Mandamos el archivo en POST hacia el servidor |
| 9132 | * | 9134 | * |
| 9133 | * @return TRUE si el export se realiza con xito | 9135 | * @return TRUE si el export se realiza con xito |
| 9134 | * @throws ExceptionBDD | 9136 | * @throws ExceptionBDD |
| 9135 | * En caso de fracaso, el error ser generado | 9137 | * En caso de fracaso, el error ser generado |
| 9136 | * @throws ExceptionHttpExchange | 9138 | * @throws ExceptionHttpExchange |
| 9137 | */ | 9139 | */ |
| 9138 | // Tiene en cuenta el nuevo formato para datos de inventario tambien | 9140 | // Tiene en cuenta el nuevo formato para datos de inventario tambien |
| 9139 | public boolean exportarTodasBaseDatosSQLite( | 9141 | public boolean exportarTodasBaseDatosSQLite( |
| 9140 | ArrayList<Integer> listaInventariosSeleccionados) | 9142 | ArrayList<Integer> listaInventariosSeleccionados) |
| 9141 | throws ExceptionBDD, ExceptionHttpExchange { | 9143 | throws ExceptionBDD, ExceptionHttpExchange { |
| 9142 | System.out.println("::: BaseDatos 1473 exportarBDSQLite"); | 9144 | System.out.println("::: BaseDatos 1473 exportarBDSQLite"); |
| 9143 | try { | 9145 | try { |
| 9144 | // Chequear | 9146 | // Chequear |
| 9145 | boolean hayAlMenosUno = false; | 9147 | boolean hayAlMenosUno = false; |
| 9146 | // String string_lista_inventarios = ""; | 9148 | // String string_lista_inventarios = ""; |
| 9147 | // for (int inv : listaInventariosSeleccionados) { | 9149 | // for (int inv : listaInventariosSeleccionados) { |
| 9148 | // string_lista_inventarios += String.valueOf(inv) + ","; | 9150 | // string_lista_inventarios += String.valueOf(inv) + ","; |
| 9149 | // } | 9151 | // } |
| 9150 | // string_lista_inventarios = string_lista_inventarios.substring(0, | 9152 | // string_lista_inventarios = string_lista_inventarios.substring(0, |
| 9151 | // string_lista_inventarios.length()-1); | 9153 | // string_lista_inventarios.length()-1); |
| 9152 | 9154 | ||
| 9153 | // 1 Creacion del nuevo documento | 9155 | // 1 Creacion del nuevo documento |
| 9154 | DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory.newInstance(); | 9156 | DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory.newInstance(); |
| 9155 | DocumentBuilder constructorDocumentos = fabricaDocumentos.newDocumentBuilder(); | 9157 | DocumentBuilder constructorDocumentos = fabricaDocumentos.newDocumentBuilder(); |
| 9156 | Document documento = constructorDocumentos.newDocument(); | 9158 | Document documento = constructorDocumentos.newDocument(); |
| 9157 | 9159 | ||
| 9158 | // Propiedades del DOM: | 9160 | // Propiedades del DOM: |
| 9159 | documento.setXmlVersion("1.0"); | 9161 | documento.setXmlVersion("1.0"); |
| 9160 | documento.setXmlStandalone(true); | 9162 | documento.setXmlStandalone(true); |
| 9161 | 9163 | ||
| 9162 | // 2 Creacion del elemento de cabecera | 9164 | // 2 Creacion del elemento de cabecera |
| 9163 | Element titulo = documento | 9165 | Element titulo = documento |
| 9164 | .createElement(ParametrosInventario.bal_xml_export_cabecera); | 9166 | .createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 9165 | 9167 | ||
| 9166 | // 3 Abrimos la base de datos en modo lectura: | 9168 | // 3 Abrimos la base de datos en modo lectura: |
| 9167 | SQLiteDatabase dtb = this.getReadableDatabase(); | 9169 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 9168 | System.out.println("::: BaseDatos 1501 "); | 9170 | System.out.println("::: BaseDatos 1501 "); |
| 9169 | 9171 | ||
| 9170 | 9172 | ||
| 9171 | // int radioButtonID = RadioGroupProductosNoContabilizados | 9173 | // int radioButtonID = RadioGroupProductosNoContabilizados |
| 9172 | // .getCheckedRadioButtonId(); | 9174 | // .getCheckedRadioButtonId(); |
| 9173 | // View radioButton = RadioGroupProductosNoContabilizados | 9175 | // View radioButton = RadioGroupProductosNoContabilizados |
| 9174 | // .findViewById(radioButtonID); | 9176 | // .findViewById(radioButtonID); |
| 9175 | // int idx = RadioGroupProductosNoContabilizados | 9177 | // int idx = RadioGroupProductosNoContabilizados |
| 9176 | // .indexOfChild(radioButton); | 9178 | // .indexOfChild(radioButton); |
| 9177 | // if (idx == 0) { | 9179 | // if (idx == 0) { |
| 9178 | // System.out.println("-----!!!!!!---!!!!!!!------------!!!!!--------------"); | 9180 | // System.out.println("-----!!!!!!---!!!!!!!------------!!!!!--------------"); |
| 9179 | // System.out.println("BASE DE DATOS SALE EN 1"); | 9181 | // System.out.println("BASE DE DATOS SALE EN 1"); |
| 9180 | // ProductosNoContabilizados = 1; | 9182 | // ProductosNoContabilizados = 1; |
| 9181 | // } else if (idx == 1) { | 9183 | // } else if (idx == 1) { |
| 9182 | // System.out.println("-----!!!!!!---!!!!!!!------------!!!!!--------------"); | 9184 | // System.out.println("-----!!!!!!---!!!!!!!------------!!!!!--------------"); |
| 9183 | // System.out.println("BASE DE DATOS SALE EN 2"); | 9185 | // System.out.println("BASE DE DATOS SALE EN 2"); |
| 9184 | // | 9186 | // |
| 9185 | // ProductosNoContabilizados = 2; | 9187 | // ProductosNoContabilizados = 2; |
| 9186 | // } | 9188 | // } |
| 9187 | 9189 | ||
| 9188 | //Actualizar un registro | 9190 | //Actualizar un registro |
| 9189 | 9191 | ||
| 9190 | System.out.println("PROD CONT SI O NO "+ParametrosInventario.ProductosNoContabilizados); | 9192 | System.out.println("PROD CONT SI O NO "+ParametrosInventario.ProductosNoContabilizados); |
| 9191 | // int radioButtonID = RadioGroupProductosNoContabilizados | 9193 | // int radioButtonID = RadioGroupProductosNoContabilizados |
| 9192 | // .getCheckedRadioButtonId(); | 9194 | // .getCheckedRadioButtonId(); |
| 9193 | //System.out.println("::: BD Prod. no contabilizados "+radioButtonID); | 9195 | //System.out.println("::: BD Prod. no contabilizados "+radioButtonID); |
| 9194 | // View radioButton = RadioGroupProductosNoContabilizados | 9196 | // View radioButton = RadioGroupProductosNoContabilizados |
| 9195 | // .findViewById(radioButtonID); | 9197 | // .findViewById(radioButtonID); |
| 9196 | // int idx = RadioGroupProductosNoContabilizados | 9198 | // int idx = RadioGroupProductosNoContabilizados |
| 9197 | // .indexOfChild(radioButton); | 9199 | // .indexOfChild(radioButton); |
| 9198 | // System.out.println("LALALALALALSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 9200 | // System.out.println("LALALALALALSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 9199 | // System.out.println(idx); | 9201 | // System.out.println(idx); |
| 9200 | // 4 Para cada inventario de la lista | 9202 | // 4 Para cada inventario de la lista |
| 9201 | for (Integer inv : listaInventariosSeleccionados) { | 9203 | for (Integer inv : listaInventariosSeleccionados) { |
| 9202 | 9204 | ||
| 9203 | String[] columnasDeseadasInventario = new String[] { | 9205 | String[] columnasDeseadasInventario = new String[] { |
| 9204 | ParametrosInventario.bal_bdd_inventario_numero, | 9206 | ParametrosInventario.bal_bdd_inventario_numero, |
| 9205 | ParametrosInventario.bal_bdd_inventario_prodcont, | 9207 | ParametrosInventario.bal_bdd_inventario_prodcont, |
| 9206 | ParametrosInventario.bal_bdd_inventario_fechaInicio, | 9208 | ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 9207 | ParametrosInventario.bal_bdd_inventario_fechaFin, | 9209 | ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 9208 | ParametrosInventario.bal_bdd_inventario_lugar, | 9210 | ParametrosInventario.bal_bdd_inventario_lugar, |
| 9209 | }; | 9211 | }; |
| 9210 | // Recuperamos los resultados: | 9212 | // Recuperamos los resultados: |
| 9211 | // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, | 9213 | // Cursor cInventarios = dtb.query(tabla_inventarios_nombre, |
| 9212 | // columnasDeseadasInventario, null, null, null, null, null); | 9214 | // columnasDeseadasInventario, null, null, null, null, null); |
| 9213 | System.out.println("::: BaseDatos 1501 columna " + columnasDeseadasInventario); | 9215 | System.out.println("::: BaseDatos 1501 columna " + columnasDeseadasInventario); |
| 9214 | System.out.println("::: BaseDatos 1514 "); | 9216 | System.out.println("::: BaseDatos 1514 "); |
| 9215 | Cursor cInventarios = dtb.query(tabla_inventarios_nombre, | 9217 | Cursor cInventarios = dtb.query(tabla_inventarios_nombre, |
| 9216 | columnasDeseadasInventario, | 9218 | columnasDeseadasInventario, |
| 9217 | ParametrosInventario.bal_bdd_inventario_numero + " = " | 9219 | ParametrosInventario.bal_bdd_inventario_numero + " = " |
| 9218 | + String.valueOf(inv), null, null, null, null); | 9220 | + String.valueOf(inv), null, null, null, null); |
| 9219 | 9221 | ||
| 9220 | int cantidadColumnasInv = cInventarios.getColumnCount(); | 9222 | int cantidadColumnasInv = cInventarios.getColumnCount(); |
| 9221 | System.out.println("::: BaseDatos 1575 cantidadColumnasInv " + cantidadColumnasInv); | 9223 | System.out.println("::: BaseDatos 1575 cantidadColumnasInv " + cantidadColumnasInv); |
| 9222 | Element inventario;// ,articulo; | 9224 | Element inventario;// ,articulo; |
| 9223 | 9225 | ||
| 9224 | // Inicia el bucle | 9226 | // Inicia el bucle |
| 9225 | if (cInventarios.moveToFirst()) { | 9227 | if (cInventarios.moveToFirst()) { |
| 9226 | 9228 | ||
| 9227 | // int nroInvActual=cInventarios.getInt(0); | 9229 | // int nroInvActual=cInventarios.getInt(0); |
| 9228 | int nroInvActual = inv; | 9230 | int nroInvActual = inv; |
| 9229 | 9231 | ||
| 9230 | // No seria necesario este while | 9232 | // No seria necesario este while |
| 9231 | // while (cInventarios.isAfterLast() == false) { | 9233 | // while (cInventarios.isAfterLast() == false) { |
| 9232 | 9234 | ||
| 9233 | // Para cada inventario | 9235 | // Para cada inventario |
| 9234 | // inventario = | 9236 | // inventario = |
| 9235 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_inventarios_nombre)); | 9237 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_inventarios_nombre)); |
| 9236 | // 4.1 Creamos un elemento para el inventario | 9238 | // 4.1 Creamos un elemento para el inventario |
| 9237 | inventario = documento | 9239 | inventario = documento |
| 9238 | .createElement(Parametros.bal_xml_inventario_root); | 9240 | .createElement(Parametros.bal_xml_inventario_root); |
| 9239 | 9241 | ||
| 9240 | // 4.2 Recorro las columnas y creo los elementos de los | 9242 | // 4.2 Recorro las columnas y creo los elementos de los |
| 9241 | // datos | 9243 | // datos |
| 9242 | for (int i = 0; i < cantidadColumnasInv; i++) { | 9244 | for (int i = 0; i < cantidadColumnasInv; i++) { |
| 9243 | Element elemento = documento | 9245 | Element elemento = documento |
| 9244 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 9246 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 9245 | .bdd2xml(cInventarios.getColumnName(i))); | 9247 | .bdd2xml(cInventarios.getColumnName(i))); |
| 9246 | elemento.setTextContent(cInventarios.getString(i)); | 9248 | elemento.setTextContent(cInventarios.getString(i)); |
| 9247 | inventario.appendChild(elemento); | 9249 | inventario.appendChild(elemento); |
| 9248 | } | 9250 | } |
| 9249 | 9251 | ||
| 9250 | // Deberia ir aqui o mas abajo? | 9252 | // Deberia ir aqui o mas abajo? |
| 9251 | // titulo.appendChild(inventario); | 9253 | // titulo.appendChild(inventario); |
| 9252 | 9254 | ||
| 9253 | // Agregar los articulos | 9255 | // Agregar los articulos |
| 9254 | 9256 | ||
| 9255 | // Abrimos la base de datos en modo lectura: | 9257 | // Abrimos la base de datos en modo lectura: |
| 9256 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 9258 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 9257 | 9259 | ||
| 9258 | // 4.3 Buscamos los datos de los articulos | 9260 | // 4.3 Buscamos los datos de los articulos |
| 9259 | String[] columnasDeseadas = new String[] { | 9261 | String[] columnasDeseadas = new String[] { |
| 9260 | ParametrosInventario.bal_bdd_articulo_sector, | 9262 | ParametrosInventario.bal_bdd_articulo_sector, |
| 9261 | ParametrosInventario.bal_bdd_articulo_codigo, | 9263 | ParametrosInventario.bal_bdd_articulo_codigo, |
| 9262 | // ParametrosInventario.bal_bdd_articulo_inventario, | 9264 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 9263 | ParametrosInventario.bal_bdd_articulo_cantidad, | 9265 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 9264 | ParametrosInventario.bal_bdd_articulo_subtotal, | 9266 | ParametrosInventario.bal_bdd_articulo_subtotal, |
| 9265 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 9267 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 9266 | ParametrosInventario.bal_bdd_articulo_fechaFin, | 9268 | ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 9267 | // ParametrosInventario.bal_bdd_articulo_foto, | 9269 | // ParametrosInventario.bal_bdd_articulo_foto, |
| 9268 | ParametrosInventario.bal_bdd_articulo_descripcion, | 9270 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 9269 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 9271 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 9270 | 9272 | ||
| 9271 | 9273 | ||
| 9272 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 9274 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 9273 | ParametrosInventario.bal_bdd_articulo_existencia_deposito}; | 9275 | ParametrosInventario.bal_bdd_articulo_existencia_deposito}; |
| 9274 | System.out.println("::: BaseDatos 1627"); | 9276 | System.out.println("::: BaseDatos 1627"); |
| 9275 | // Recuperamos los resultados: | 9277 | // Recuperamos los resultados: |
| 9276 | Cursor c = dtb.query(tabla_articulos_nombre, | 9278 | Cursor c = dtb.query(tabla_articulos_nombre, |
| 9277 | columnasDeseadas, | 9279 | columnasDeseadas, |
| 9278 | ParametrosInventario.bal_bdd_articulo_inventario | 9280 | ParametrosInventario.bal_bdd_articulo_inventario |
| 9279 | + " = " + String.valueOf(nroInvActual), | 9281 | + " = " + String.valueOf(nroInvActual), |
| 9280 | null, null, null, null); | 9282 | null, null, null, null); |
| 9281 | 9283 | ||
| 9282 | int cantidadColumnas = c.getColumnCount(); | 9284 | int cantidadColumnas = c.getColumnCount(); |
| 9283 | // Chequear | 9285 | // Chequear |
| 9284 | boolean tieneArticulos = false; | 9286 | boolean tieneArticulos = false; |
| 9285 | 9287 | ||
| 9286 | // Para cada articulo | 9288 | // Para cada articulo |
| 9287 | if (c.moveToFirst()) { | 9289 | if (c.moveToFirst()) { |
| 9288 | tieneArticulos = true; | 9290 | tieneArticulos = true; |
| 9289 | hayAlMenosUno = true; | 9291 | hayAlMenosUno = true; |
| 9290 | while (!c.isAfterLast()) { | 9292 | while (!c.isAfterLast()) { |
| 9291 | // Creamos el hijo ART | 9293 | // Creamos el hijo ART |
| 9292 | // Element medicion = | 9294 | // Element medicion = |
| 9293 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_articulos_nombre)); | 9295 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_articulos_nombre)); |
| 9294 | // 4.4 Creamos los elementos para el articulo | 9296 | // 4.4 Creamos los elementos para el articulo |
| 9295 | Element medicion = documento | 9297 | Element medicion = documento |
| 9296 | .createElement(Parametros.bal_xml_articulo_root); | 9298 | .createElement(Parametros.bal_xml_articulo_root); |
| 9297 | 9299 | ||
| 9298 | for (int i = 0; i < cantidadColumnas; i++) { | 9300 | for (int i = 0; i < cantidadColumnas; i++) { |
| 9299 | Element elemento = documento | 9301 | Element elemento = documento |
| 9300 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 9302 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 9301 | .bdd2xml(c.getColumnName(i))); | 9303 | .bdd2xml(c.getColumnName(i))); |
| 9302 | elemento.setTextContent(c.getString(i)); | 9304 | elemento.setTextContent(c.getString(i)); |
| 9303 | medicion.appendChild(elemento); | 9305 | medicion.appendChild(elemento); |
| 9304 | } | 9306 | } |
| 9305 | inventario.appendChild(medicion); | 9307 | inventario.appendChild(medicion); |
| 9306 | 9308 | ||
| 9307 | c.moveToNext(); | 9309 | c.moveToNext(); |
| 9308 | } | 9310 | } |
| 9309 | } | 9311 | } |
| 9310 | // Verificar | 9312 | // Verificar |
| 9311 | if (tieneArticulos) { | 9313 | if (tieneArticulos) { |
| 9312 | titulo.appendChild(inventario); | 9314 | titulo.appendChild(inventario); |
| 9313 | } | 9315 | } |
| 9314 | // cInventarios.moveToNext(); | 9316 | // cInventarios.moveToNext(); |
| 9315 | // Cierra el while, no seria necesario | 9317 | // Cierra el while, no seria necesario |
| 9316 | // } | 9318 | // } |
| 9317 | 9319 | ||
| 9318 | } | 9320 | } |
| 9319 | } | 9321 | } |
| 9320 | 9322 | ||
| 9321 | dtb.close(); | 9323 | dtb.close(); |
| 9322 | // Verificar | 9324 | // Verificar |
| 9323 | if (hayAlMenosUno) { | 9325 | if (hayAlMenosUno) { |
| 9324 | Calendar cal = Calendar.getInstance(); | 9326 | Calendar cal = Calendar.getInstance(); |
| 9325 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 9327 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 9326 | Element fec_ope = documento.createElement(ParametrosInventario.bal_xml_export_fec_ope); | 9328 | Element fec_ope = documento.createElement(ParametrosInventario.bal_xml_export_fec_ope); |
| 9327 | System.out.println(" Pasar fecha "); | 9329 | System.out.println(" Pasar fecha "); |
| 9328 | System.out.println(simpleDateFormat.format(cal.getTime())); | 9330 | System.out.println(simpleDateFormat.format(cal.getTime())); |
| 9329 | fec_ope.appendChild(documento.createTextNode(simpleDateFormat.format(cal.getTime()))); | 9331 | fec_ope.appendChild(documento.createTextNode(simpleDateFormat.format(cal.getTime()))); |
| 9330 | titulo.appendChild(fec_ope); | 9332 | titulo.appendChild(fec_ope); |
| 9331 | 9333 | ||
| 9332 | //documento.appendChild() | 9334 | //documento.appendChild() |
| 9333 | documento.appendChild(titulo); | 9335 | documento.appendChild(titulo); |
| 9334 | 9336 | ||
| 9335 | // 5 Guardamos el DOM como archivo XML | 9337 | // 5 Guardamos el DOM como archivo XML |
| 9336 | HttpWriter.transformerXml(documento, ParametrosInventario.URL_COPIA_XML_EXPORT); | 9338 | HttpWriter.transformerXml(documento, URL_COPIA_XML_EXPORT_RUTA); |
| 9337 | 9339 | ||
| 9338 | // 6 Mandamos el archivo en POST hacia el servidor: | 9340 | // 6 Mandamos el archivo en POST hacia el servidor: |
| 9339 | HttpSender httpSender = new HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); | 9341 | HttpSender httpSender = new HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); |
| 9340 | System.out.println("::: el system :;:;:;"); | 9342 | System.out.println("::: el system :;:;:;"); |
| 9341 | return httpSender.send_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); | 9343 | return httpSender.send_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 9342 | 9344 | ||
| 9343 | } else { | 9345 | } else { |
| 9344 | return false; | 9346 | return false; |
| 9345 | } | 9347 | } |
| 9346 | 9348 | ||
| 9347 | } catch (Exception e) { | 9349 | } catch (Exception e) { |
| 9348 | System.out.println("::: entro al catch :;:;:;"); | 9350 | System.out.println("::: entro al catch :;:;:;"); |
| 9349 | GestorLogEventos log = new GestorLogEventos(); | 9351 | GestorLogEventos log = new GestorLogEventos(); |
| 9350 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 9352 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 9351 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 9353 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 9352 | log.log("[-- 1141 --]" + e.toString(), 4); | 9354 | log.log("[-- 1141 --]" + e.toString(), 4); |
| 9353 | 9355 | ||
| 9354 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9356 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9355 | "La exportacion de los datos de la Base De Datos fracaso"); | 9357 | "La exportacion de los datos de la Base De Datos fracaso"); |
| 9356 | } | 9358 | } |
| 9357 | } | 9359 | } |
| 9358 | 9360 | ||
| 9359 | public boolean exportarTodasBaseDatosSQLiteCompras( | 9361 | public boolean exportarTodasBaseDatosSQLiteCompras( |
| 9360 | ArrayList<Integer> listaInventariosSeleccionados) | 9362 | ArrayList<Integer> listaInventariosSeleccionados) |
| 9361 | throws ExceptionBDD, ExceptionHttpExchange { | 9363 | throws ExceptionBDD, ExceptionHttpExchange { |
| 9362 | System.out.println("::: BaseDatos 2263 exportarBDSQLiteCompras"); | 9364 | System.out.println("::: BaseDatos 2263 exportarBDSQLiteCompras"); |
| 9363 | System.out.println("ACA********************"); | 9365 | System.out.println("ACA********************"); |
| 9364 | try { | 9366 | try { |
| 9365 | boolean hayAlMenosUno = false; | 9367 | boolean hayAlMenosUno = false; |
| 9366 | // 1 Creacion del nuevo documento | 9368 | // 1 Creacion del nuevo documento |
| 9367 | DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory | 9369 | DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory |
| 9368 | .newInstance(); | 9370 | .newInstance(); |
| 9369 | DocumentBuilder constructorDocumentos = fabricaDocumentos | 9371 | DocumentBuilder constructorDocumentos = fabricaDocumentos |
| 9370 | .newDocumentBuilder(); | 9372 | .newDocumentBuilder(); |
| 9371 | Document documento = constructorDocumentos.newDocument(); | 9373 | Document documento = constructorDocumentos.newDocument(); |
| 9372 | // Propiedades del DOM: | 9374 | // Propiedades del DOM: |
| 9373 | documento.setXmlVersion("1.0"); | 9375 | documento.setXmlVersion("1.0"); |
| 9374 | documento.setXmlStandalone(true); | 9376 | documento.setXmlStandalone(true); |
| 9375 | // 2 Creacion del elemento de cabecera | 9377 | // 2 Creacion del elemento de cabecera |
| 9376 | Element titulo = documento | 9378 | Element titulo = documento |
| 9377 | .createElement(ParametrosInventario.bal_xml_export_cabecera); | 9379 | .createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 9378 | // 3 Abrimos la base de datos en modo lectura: | 9380 | // 3 Abrimos la base de datos en modo lectura: |
| 9379 | SQLiteDatabase dtb = this.getReadableDatabase(); | 9381 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 9380 | //Actualizar un registro | 9382 | //Actualizar un registro |
| 9381 | // 4 Para cada inventario de la lista | 9383 | // 4 Para cada inventario de la lista |
| 9382 | for (Integer inv : listaInventariosSeleccionados) { | 9384 | for (Integer inv : listaInventariosSeleccionados) { |
| 9383 | String[] columnasDeseadasInventario = new String[] { | 9385 | String[] columnasDeseadasInventario = new String[] { |
| 9384 | ParametrosInventario.bal_bdd_inventario_numero, | 9386 | ParametrosInventario.bal_bdd_inventario_numero, |
| 9385 | ParametrosInventario.bal_bdd_inventario_prodcont, | 9387 | ParametrosInventario.bal_bdd_inventario_prodcont, |
| 9386 | ParametrosInventario.bal_bdd_inventario_fechaInicio, | 9388 | ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 9387 | ParametrosInventario.bal_bdd_inventario_fechaFin, | 9389 | ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 9388 | ParametrosInventario.bal_bdd_inventario_lugar, | 9390 | ParametrosInventario.bal_bdd_inventario_lugar, |
| 9389 | }; | 9391 | }; |
| 9390 | System.out.println("::: BaseDatos 2315 exportarBDSQLiteCompras por recuperar resultados"); | 9392 | System.out.println("::: BaseDatos 2315 exportarBDSQLiteCompras por recuperar resultados"); |
| 9391 | System.out.println("::: BaseDatos 2315 exportarBDSQLiteCompras por recuperar resultados inv "+inv); | 9393 | System.out.println("::: BaseDatos 2315 exportarBDSQLiteCompras por recuperar resultados inv "+inv); |
| 9392 | // Recuperamos los resultados: | 9394 | // Recuperamos los resultados: |
| 9393 | Cursor cInventarios = dtb.query(tabla_inventarios_nombre, | 9395 | Cursor cInventarios = dtb.query(tabla_inventarios_nombre, |
| 9394 | columnasDeseadasInventario, | 9396 | columnasDeseadasInventario, |
| 9395 | ParametrosInventario.bal_bdd_inventario_numero + " = " | 9397 | ParametrosInventario.bal_bdd_inventario_numero + " = " |
| 9396 | + String.valueOf(inv), null, null, null, null); | 9398 | + String.valueOf(inv), null, null, null, null); |
| 9397 | 9399 | ||
| 9398 | 9400 | ||
| 9399 | 9401 | ||
| 9400 | int cantidadColumnasInv = cInventarios.getColumnCount(); | 9402 | int cantidadColumnasInv = cInventarios.getColumnCount(); |
| 9401 | Element inventario;// ,articulo; | 9403 | Element inventario;// ,articulo; |
| 9402 | // Inicia el bucle | 9404 | // Inicia el bucle |
| 9403 | if (cInventarios.moveToFirst()) { | 9405 | if (cInventarios.moveToFirst()) { |
| 9404 | // int nroInvActual=cInventarios.getInt(0); | 9406 | // int nroInvActual=cInventarios.getInt(0); |
| 9405 | int nroInvActual = inv; | 9407 | int nroInvActual = inv; |
| 9406 | // 4.1 Creamos un elemento para el inventario | 9408 | // 4.1 Creamos un elemento para el inventario |
| 9407 | inventario = documento | 9409 | inventario = documento |
| 9408 | .createElement(Parametros.bal_xml_inventario_root); | 9410 | .createElement(Parametros.bal_xml_inventario_root); |
| 9409 | // 4.2 Recorro las columnas y creo los elementos de los | 9411 | // 4.2 Recorro las columnas y creo los elementos de los |
| 9410 | // datos | 9412 | // datos |
| 9411 | for (int i = 0; i < cantidadColumnasInv; i++) { | 9413 | for (int i = 0; i < cantidadColumnasInv; i++) { |
| 9412 | Element elemento = documento | 9414 | Element elemento = documento |
| 9413 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 9415 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 9414 | .bdd2xml(cInventarios.getColumnName(i))); | 9416 | .bdd2xml(cInventarios.getColumnName(i))); |
| 9415 | elemento.setTextContent(cInventarios.getString(i)); | 9417 | elemento.setTextContent(cInventarios.getString(i)); |
| 9416 | inventario.appendChild(elemento); | 9418 | inventario.appendChild(elemento); |
| 9417 | } | 9419 | } |
| 9418 | // 4.3 Buscamos los datos de los articulos | 9420 | // 4.3 Buscamos los datos de los articulos |
| 9419 | String[] columnasDeseadas = new String[] { | 9421 | String[] columnasDeseadas = new String[] { |
| 9420 | ParametrosInventario.bal_bdd_articulo_sector, | 9422 | ParametrosInventario.bal_bdd_articulo_sector, |
| 9421 | ParametrosInventario.bal_bdd_articulo_codigo, | 9423 | ParametrosInventario.bal_bdd_articulo_codigo, |
| 9422 | // ParametrosInventario.bal_bdd_articulo_inventario, | 9424 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 9423 | ParametrosInventario.bal_bdd_articulo_cantidad, | 9425 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 9424 | //ParametrosInventario.bal_bdd_articulo_subtotal, | 9426 | //ParametrosInventario.bal_bdd_articulo_subtotal, |
| 9425 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 9427 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 9426 | ParametrosInventario.bal_bdd_articulo_fechaFin, | 9428 | ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 9427 | // ParametrosInventario.bal_bdd_articulo_foto, | 9429 | // ParametrosInventario.bal_bdd_articulo_foto, |
| 9428 | ParametrosInventario.bal_bdd_articulo_descripcion, | 9430 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 9429 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 9431 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 9430 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 9432 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 9431 | ParametrosInventario.bal_bdd_articulo_existencia_deposito//, | 9433 | ParametrosInventario.bal_bdd_articulo_existencia_deposito//, |
| 9432 | //ParametrosInventario.bal_bdd_compraproveedor_codigo | 9434 | //ParametrosInventario.bal_bdd_compraproveedor_codigo |
| 9433 | }; | 9435 | }; |
| 9434 | 9436 | ||
| 9435 | Cursor cValidarProve = dtb.rawQuery("SELECT * FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD ="+inv,null); | 9437 | Cursor cValidarProve = dtb.rawQuery("SELECT * FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD ="+inv,null); |
| 9436 | if (cValidarProve.moveToFirst()) { | 9438 | if (cValidarProve.moveToFirst()) { |
| 9437 | Cursor c = dtb.rawQuery("SELECT a.ART_SEC, a.ART_COD,a.ART_Q,a.ART_SUBTOT, a.ART_FEI,a.ART_FEF,a.ART_DESC," + | 9439 | Cursor c = dtb.rawQuery("SELECT a.ART_SEC, a.ART_COD,a.ART_Q,a.ART_SUBTOT, a.ART_FEI,a.ART_FEF,a.ART_DESC," + |
| 9438 | "a.ART_CB,a.ART_EV,a.ART_ED,b.COMPRA_PROVE_COD FROM ARTICULOS a " + | 9440 | "a.ART_CB,a.ART_EV,a.ART_ED,b.COMPRA_PROVE_COD FROM ARTICULOS a " + |
| 9439 | "INNER JOIN COMPRA_PROVEEDOR b ON a.ART_I=b.COMPRA_INV_COD WHERE a.ART_I="+inv,null); //a.ART_SUBTOT, | 9441 | "INNER JOIN COMPRA_PROVEEDOR b ON a.ART_I=b.COMPRA_INV_COD WHERE a.ART_I="+inv,null); //a.ART_SUBTOT, |
| 9440 | int cantidadColumnas = c.getColumnCount(); | 9442 | int cantidadColumnas = c.getColumnCount(); |
| 9441 | // Chequear | 9443 | // Chequear |
| 9442 | boolean tieneArticulos = false; | 9444 | boolean tieneArticulos = false; |
| 9443 | // Para cada articulo | 9445 | // Para cada articulo |
| 9444 | if (c.moveToFirst()) { | 9446 | if (c.moveToFirst()) { |
| 9445 | tieneArticulos = true; | 9447 | tieneArticulos = true; |
| 9446 | hayAlMenosUno = true; | 9448 | hayAlMenosUno = true; |
| 9447 | while (c.isAfterLast() == false) { | 9449 | while (c.isAfterLast() == false) { |
| 9448 | // Creamos el hijo ART | 9450 | // Creamos el hijo ART |
| 9449 | // Element medicion = | 9451 | // Element medicion = |
| 9450 | // 4.4 Creamos los elementos para el articulo | 9452 | // 4.4 Creamos los elementos para el articulo |
| 9451 | Element medicion = documento.createElement(Parametros.bal_xml_articulo_root); | 9453 | Element medicion = documento.createElement(Parametros.bal_xml_articulo_root); |
| 9452 | for (int i = 0; i < cantidadColumnas; i++) { | 9454 | for (int i = 0; i < cantidadColumnas; i++) { |
| 9453 | Element elemento = documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(c.getColumnName(i))); | 9455 | Element elemento = documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(c.getColumnName(i))); |
| 9454 | System.out.println("::: BD VER QUE TRAE ESTO getColumnName(i)== " + c.getColumnName(i)); | 9456 | System.out.println("::: BD VER QUE TRAE ESTO getColumnName(i)== " + c.getColumnName(i)); |
| 9455 | System.out.println("::: BD VER QUE TRAE ESTO getString(i)== " + c.getString(i)); | 9457 | System.out.println("::: BD VER QUE TRAE ESTO getString(i)== " + c.getString(i)); |
| 9456 | elemento.setTextContent(c.getString(i)); | 9458 | elemento.setTextContent(c.getString(i)); |
| 9457 | medicion.appendChild(elemento); | 9459 | medicion.appendChild(elemento); |
| 9458 | } | 9460 | } |
| 9459 | inventario.appendChild(medicion); | 9461 | inventario.appendChild(medicion); |
| 9460 | c.moveToNext(); | 9462 | c.moveToNext(); |
| 9461 | } | 9463 | } |
| 9462 | }else{ | 9464 | }else{ |
| 9463 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9465 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9464 | "No se encuentran articulos cargados para la exportacion.");//return false; | 9466 | "No se encuentran articulos cargados para la exportacion.");//return false; |
| 9465 | } | 9467 | } |
| 9466 | // Verificar | 9468 | // Verificar |
| 9467 | if (tieneArticulos) { | 9469 | if (tieneArticulos) { |
| 9468 | titulo.appendChild(inventario); | 9470 | titulo.appendChild(inventario); |
| 9469 | } | 9471 | } |
| 9470 | }else{ | 9472 | }else{ |
| 9471 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9473 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9472 | "No se ha seleccionado un proveedor para la exportacion.");//return false; | 9474 | "No se ha seleccionado un proveedor para la exportacion.");//return false; |
| 9473 | } | 9475 | } |
| 9474 | } | 9476 | } |
| 9475 | } | 9477 | } |
| 9476 | dtb.close(); | 9478 | dtb.close(); |
| 9477 | // Verificar | 9479 | // Verificar |
| 9478 | if (hayAlMenosUno) { | 9480 | if (hayAlMenosUno) { |
| 9479 | documento.appendChild(titulo); | 9481 | documento.appendChild(titulo); |
| 9480 | // 5 Guardamos el DOM como archivo XML | 9482 | // 5 Guardamos el DOM como archivo XML |
| 9481 | HttpWriter.transformerXml(documento, ParametrosInventario.URL_COPIA_XML_EXPORT); | 9483 | HttpWriter.transformerXml(documento, URL_COPIA_XML_EXPORT_RUTA); |
| 9482 | // 6 Mandamos el archivo en POST hacia el servidor: | 9484 | // 6 Mandamos el archivo en POST hacia el servidor: |
| 9483 | HttpSender httpSender = new HttpSender( | 9485 | HttpSender httpSender = new HttpSender( |
| 9484 | Parametros.CODIGO_SOFT_DEBOINVENTARIO); | 9486 | Parametros.CODIGO_SOFT_DEBOINVENTARIO); |
| 9485 | return httpSender | 9487 | return httpSender |
| 9486 | .send_compra_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); | 9488 | .send_compra_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 9487 | } else { | 9489 | } else { |
| 9488 | return false; | 9490 | return false; |
| 9489 | } | 9491 | } |
| 9490 | 9492 | ||
| 9491 | } catch (Exception e) { | 9493 | } catch (Exception e) { |
| 9492 | GestorLogEventos log = new GestorLogEventos(); | 9494 | GestorLogEventos log = new GestorLogEventos(); |
| 9493 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 9495 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 9494 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 9496 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 9495 | log.log("[-- 1141 --]" + e.toString(), 4); | 9497 | log.log("[-- 1141 --]" + e.toString(), 4); |
| 9496 | System.out.println("ERRORRR" + e.toString()); | 9498 | System.out.println("ERRORRR" + e.toString()); |
| 9497 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9499 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9498 | "La exportacion de los datos de la Base De Datos fracaso"); | 9500 | "La exportacion de los datos de la Base De Datos fracaso"); |
| 9499 | } | 9501 | } |
| 9500 | } | 9502 | } |
| 9501 | 9503 | ||
| 9502 | /** | 9504 | /** |
| 9503 | * Genera los archivos XML de los inventarios a exportar por USB | 9505 | * Genera los archivos XML de los inventarios a exportar por USB |
| 9504 | * <p> | 9506 | * <p> |
| 9505 | * 1 Para cada inventario | 9507 | * 1 Para cada inventario |
| 9506 | * <p> | 9508 | * <p> |
| 9507 | * 1.1 Creacion del DOM | 9509 | * 1.1 Creacion del DOM |
| 9508 | * <p> | 9510 | * <p> |
| 9509 | * 1.2 Creacion del elemento raiz del DOM | 9511 | * 1.2 Creacion del elemento raiz del DOM |
| 9510 | * <p> | 9512 | * <p> |
| 9511 | * 1.3 Abrimos la base de datos en modo lectura | 9513 | * 1.3 Abrimos la base de datos en modo lectura |
| 9512 | * <p> | 9514 | * <p> |
| 9513 | * 1.4 Recuperamos los datos del inventario | 9515 | * 1.4 Recuperamos los datos del inventario |
| 9514 | * <p> | 9516 | * <p> |
| 9515 | * 1.5 Buscamos los articulos | 9517 | * 1.5 Buscamos los articulos |
| 9516 | * <p> | 9518 | * <p> |
| 9517 | * 1.6 Para cada articulo | 9519 | * 1.6 Para cada articulo |
| 9518 | * <p> | 9520 | * <p> |
| 9519 | * 1.6.1 Creamos el elmento de datos | 9521 | * 1.6.1 Creamos el elmento de datos |
| 9520 | * <p> | 9522 | * <p> |
| 9521 | * 1.7 Generacion del Arcchivo XML local | 9523 | * 1.7 Generacion del Arcchivo XML local |
| 9522 | * <p> | 9524 | * <p> |
| 9523 | * 1.8 Si estan creados todos los archivos, transformamos el | 9525 | * 1.8 Si estan creados todos los archivos, transformamos el |
| 9524 | * DOM a un documento | 9526 | * DOM a un documento |
| 9525 | * | 9527 | * |
| 9526 | * @param listaInventariosSeleccionados | 9528 | * @param listaInventariosSeleccionados |
| 9527 | * @throws ExceptionBDD | 9529 | * @throws ExceptionBDD |
| 9528 | */ | 9530 | */ |
| 9529 | // Nuevo formato desde 28/4/12 | 9531 | // Nuevo formato desde 28/4/12 |
| 9530 | public void exportarTodasBaseDatosSQLite_HaciaUsb( | 9532 | public void exportarTodasBaseDatosSQLite_HaciaUsb( |
| 9531 | ArrayList<Integer> listaInventariosSeleccionados) | 9533 | ArrayList<Integer> listaInventariosSeleccionados) |
| 9532 | throws ExceptionBDD { | 9534 | throws ExceptionBDD { |
| 9533 | System.out.println("::: BaseDatos 1741 exportarTodasBaseDatosSQLite_HaciaUsb"); | 9535 | System.out.println("::: BaseDatos 1741 exportarTodasBaseDatosSQLite_HaciaUsb"); |
| 9534 | try { | 9536 | try { |
| 9535 | boolean hayAlMenosUno = false; | 9537 | boolean hayAlMenosUno = false; |
| 9536 | // 1 Para cada inventario | 9538 | // 1 Para cada inventario |
| 9537 | for (int inv : listaInventariosSeleccionados) { | 9539 | for (int inv : listaInventariosSeleccionados) { |
| 9538 | 9540 | ||
| 9539 | // 1.1 Creacion del DOM | 9541 | // 1.1 Creacion del DOM |
| 9540 | DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory | 9542 | DocumentBuilderFactory fabricaDocumentos = DocumentBuilderFactory |
| 9541 | .newInstance(); | 9543 | .newInstance(); |
| 9542 | // Arroja ParserConfigurationException | 9544 | // Arroja ParserConfigurationException |
| 9543 | DocumentBuilder constructorDocumentos = fabricaDocumentos | 9545 | DocumentBuilder constructorDocumentos = fabricaDocumentos |
| 9544 | .newDocumentBuilder(); | 9546 | .newDocumentBuilder(); |
| 9545 | Document documento = constructorDocumentos.newDocument(); | 9547 | Document documento = constructorDocumentos.newDocument(); |
| 9546 | 9548 | ||
| 9547 | // Propris du DOM: | 9549 | // Propris du DOM: |
| 9548 | documento.setXmlVersion("1.0"); | 9550 | documento.setXmlVersion("1.0"); |
| 9549 | documento.setXmlStandalone(true); | 9551 | documento.setXmlStandalone(true); |
| 9550 | 9552 | ||
| 9551 | // 1.2 Creacion del elemento raiz del DOM | 9553 | // 1.2 Creacion del elemento raiz del DOM |
| 9552 | Element titulo = documento | 9554 | Element titulo = documento |
| 9553 | .createElement(ParametrosInventario.bal_xml_export_cabecera); | 9555 | .createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 9554 | 9556 | ||
| 9555 | // 1.3 Abrimos la base de datos en modo lectura: | 9557 | // 1.3 Abrimos la base de datos en modo lectura: |
| 9556 | SQLiteDatabase dtb = this.getReadableDatabase(); | 9558 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 9557 | 9559 | ||
| 9558 | String[] columnasDeseadasInventario = new String[] { | 9560 | String[] columnasDeseadasInventario = new String[] { |
| 9559 | ParametrosInventario.bal_bdd_inventario_numero, | 9561 | ParametrosInventario.bal_bdd_inventario_numero, |
| 9560 | ParametrosInventario.bal_bdd_inventario_fechaInicio, | 9562 | ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 9561 | ParametrosInventario.bal_bdd_inventario_fechaFin, | 9563 | ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 9562 | ParametrosInventario.bal_bdd_inventario_lugar }; | 9564 | ParametrosInventario.bal_bdd_inventario_lugar }; |
| 9563 | 9565 | ||
| 9564 | // 1.4 Recuperamos los datos del inventario: | 9566 | // 1.4 Recuperamos los datos del inventario: |
| 9565 | Cursor cInventarios = dtb.query(tabla_inventarios_nombre, | 9567 | Cursor cInventarios = dtb.query(tabla_inventarios_nombre, |
| 9566 | columnasDeseadasInventario, | 9568 | columnasDeseadasInventario, |
| 9567 | ParametrosInventario.bal_bdd_inventario_numero + " = " | 9569 | ParametrosInventario.bal_bdd_inventario_numero + " = " |
| 9568 | + String.valueOf(inv), null, null, null, null); | 9570 | + String.valueOf(inv), null, null, null, null); |
| 9569 | 9571 | ||
| 9570 | int cantidadColumnasInv = cInventarios.getColumnCount(); | 9572 | int cantidadColumnasInv = cInventarios.getColumnCount(); |
| 9571 | 9573 | ||
| 9572 | Element inventarioActual;// ,articulo; | 9574 | Element inventarioActual;// ,articulo; |
| 9573 | boolean tieneArticulos = false; | 9575 | boolean tieneArticulos = false; |
| 9574 | if (cInventarios.moveToFirst()) { | 9576 | if (cInventarios.moveToFirst()) { |
| 9575 | // Element inventario = | 9577 | // Element inventario = |
| 9576 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(ParametrosInventario.bal_bdd_inventario_numero)); | 9578 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(ParametrosInventario.bal_bdd_inventario_numero)); |
| 9577 | inventarioActual = documento | 9579 | inventarioActual = documento |
| 9578 | .createElement(Parametros.bal_xml_inventario_root); | 9580 | .createElement(Parametros.bal_xml_inventario_root); |
| 9579 | 9581 | ||
| 9580 | // Recorro las columnas | 9582 | // Recorro las columnas |
| 9581 | for (int i = 0; i < cantidadColumnasInv; i++) { | 9583 | for (int i = 0; i < cantidadColumnasInv; i++) { |
| 9582 | // bdd2xml arroja Exception | 9584 | // bdd2xml arroja Exception |
| 9583 | Element elemento = documento | 9585 | Element elemento = documento |
| 9584 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 9586 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 9585 | .bdd2xml(cInventarios.getColumnName(i))); | 9587 | .bdd2xml(cInventarios.getColumnName(i))); |
| 9586 | elemento.setTextContent(cInventarios.getString(i)); | 9588 | elemento.setTextContent(cInventarios.getString(i)); |
| 9587 | inventarioActual.appendChild(elemento); | 9589 | inventarioActual.appendChild(elemento); |
| 9588 | } | 9590 | } |
| 9589 | 9591 | ||
| 9590 | String[] columnasDeseadas = new String[] { | 9592 | String[] columnasDeseadas = new String[] { |
| 9591 | ParametrosInventario.bal_bdd_articulo_sector, | 9593 | ParametrosInventario.bal_bdd_articulo_sector, |
| 9592 | ParametrosInventario.bal_bdd_articulo_codigo, | 9594 | ParametrosInventario.bal_bdd_articulo_codigo, |
| 9593 | // ParametrosInventario.bal_bdd_articulo_inventario, | 9595 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 9594 | ParametrosInventario.bal_bdd_articulo_cantidad, | 9596 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 9595 | ParametrosInventario.bal_bdd_articulo_subtotal, | 9597 | ParametrosInventario.bal_bdd_articulo_subtotal, |
| 9596 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 9598 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 9597 | ParametrosInventario.bal_bdd_articulo_fechaFin, | 9599 | ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 9598 | // ParametrosInventario.bal_bdd_articulo_foto, | 9600 | // ParametrosInventario.bal_bdd_articulo_foto, |
| 9599 | ParametrosInventario.bal_bdd_articulo_descripcion, | 9601 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 9600 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 9602 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 9601 | 9603 | ||
| 9602 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 9604 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 9603 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 9605 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 9604 | }; | 9606 | }; |
| 9605 | Cursor c = dtb.query(tabla_articulos_nombre, | 9607 | Cursor c = dtb.query(tabla_articulos_nombre, |
| 9606 | columnasDeseadas, | 9608 | columnasDeseadas, |
| 9607 | ParametrosInventario.bal_bdd_articulo_inventario | 9609 | ParametrosInventario.bal_bdd_articulo_inventario |
| 9608 | + "=" + String.valueOf(inv), null, null, | 9610 | + "=" + String.valueOf(inv), null, null, |
| 9609 | null, null); | 9611 | null, null); |
| 9610 | 9612 | ||
| 9611 | // Recuperamos los resultados: | 9613 | // Recuperamos los resultados: |
| 9612 | int cantidadColumnas = c.getColumnCount(); | 9614 | int cantidadColumnas = c.getColumnCount(); |
| 9613 | // boolean tieneArticulos=false; | 9615 | // boolean tieneArticulos=false; |
| 9614 | // 1.5 Buscamos los articulos | 9616 | // 1.5 Buscamos los articulos |
| 9615 | if (c.moveToFirst()) { | 9617 | if (c.moveToFirst()) { |
| 9616 | tieneArticulos = true; | 9618 | tieneArticulos = true; |
| 9617 | hayAlMenosUno = true; | 9619 | hayAlMenosUno = true; |
| 9618 | // Luego el detalle de los articulos: | 9620 | // Luego el detalle de los articulos: |
| 9619 | // 1.6 Para cada articulo | 9621 | // 1.6 Para cada articulo |
| 9620 | while (c.isAfterLast() == false) { | 9622 | while (c.isAfterLast() == false) { |
| 9621 | // 1.6.1 Creamos el elmento de datos | 9623 | // 1.6.1 Creamos el elmento de datos |
| 9622 | Element medicion = documento | 9624 | Element medicion = documento |
| 9623 | .createElement(Parametros.bal_xml_articulo_root); | 9625 | .createElement(Parametros.bal_xml_articulo_root); |
| 9624 | // Element medicion = | 9626 | // Element medicion = |
| 9625 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(tabla_articulos_nombre)); | 9627 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(tabla_articulos_nombre)); |
| 9626 | 9628 | ||
| 9627 | for (int i = 0; i < cantidadColumnas; i++) { | 9629 | for (int i = 0; i < cantidadColumnas; i++) { |
| 9628 | Element elemento = documento | 9630 | Element elemento = documento |
| 9629 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS | 9631 | .createElement(ParametrosInventario.CONVERSOR_BALIZAS |
| 9630 | .bdd2usb(c.getColumnName(i))); | 9632 | .bdd2usb(c.getColumnName(i))); |
| 9631 | elemento.setTextContent(c.getString(i)); | 9633 | elemento.setTextContent(c.getString(i)); |
| 9632 | medicion.appendChild(elemento); | 9634 | medicion.appendChild(elemento); |
| 9633 | } | 9635 | } |
| 9634 | inventarioActual.appendChild(medicion); | 9636 | inventarioActual.appendChild(medicion); |
| 9635 | 9637 | ||
| 9636 | c.moveToNext(); | 9638 | c.moveToNext(); |
| 9637 | } | 9639 | } |
| 9638 | } | 9640 | } |
| 9639 | // Verificar | 9641 | // Verificar |
| 9640 | if (tieneArticulos) { | 9642 | if (tieneArticulos) { |
| 9641 | titulo.appendChild(inventarioActual); | 9643 | titulo.appendChild(inventarioActual); |
| 9642 | } | 9644 | } |
| 9643 | } | 9645 | } |
| 9644 | // | 9646 | // |
| 9645 | dtb.close(); | 9647 | dtb.close(); |
| 9646 | 9648 | ||
| 9647 | // Verificar esto | 9649 | // Verificar esto |
| 9648 | // if(hayAlMenosUno) { | 9650 | // if(hayAlMenosUno) { |
| 9649 | if (tieneArticulos) { | 9651 | if (tieneArticulos) { |
| 9650 | documento.appendChild(titulo); | 9652 | documento.appendChild(titulo); |
| 9651 | } | 9653 | } |
| 9652 | 9654 | ||
| 9653 | // Sauvegarde du DOM dans un fichier XML | 9655 | // Sauvegarde du DOM dans un fichier XML |
| 9654 | // Construccion del nombre del archivode exportacion: n del | 9656 | // Construccion del nombre del archivode exportacion: n del |
| 9655 | // inventario sobre 4 digitos: | 9657 | // inventario sobre 4 digitos: |
| 9656 | // 1.7 Generacion del Arcchivo XML local | 9658 | // 1.7 Generacion del Arcchivo XML local |
| 9657 | String titulo_final; | 9659 | String titulo_final; |
| 9658 | 9660 | ||
| 9659 | if (inv < 0) { | 9661 | if (inv < 0) { |
| 9660 | String titulo_inicial = String.valueOf(Math.abs(inv)); | 9662 | String titulo_inicial = String.valueOf(Math.abs(inv)); |
| 9661 | titulo_final = "D";// +titulo_inicial; | 9663 | titulo_final = "D";// +titulo_inicial; |
| 9662 | for (int i = titulo_inicial.length(); i < 4; i++) { | 9664 | for (int i = titulo_inicial.length(); i < 4; i++) { |
| 9663 | titulo_final = titulo_final + "0";// ; + titulo_final; | 9665 | titulo_final = titulo_final + "0";// ; + titulo_final; |
| 9664 | 9666 | ||
| 9665 | } | 9667 | } |
| 9666 | titulo_final = titulo_final + titulo_inicial; | 9668 | titulo_final = titulo_final + titulo_inicial; |
| 9667 | } else { | 9669 | } else { |
| 9668 | String titulo_inicial = String.valueOf(inv); | 9670 | String titulo_inicial = String.valueOf(inv); |
| 9669 | titulo_final = titulo_inicial; | 9671 | titulo_final = titulo_inicial; |
| 9670 | for (int i = titulo_inicial.length(); i < 4; i++) { | 9672 | for (int i = titulo_inicial.length(); i < 4; i++) { |
| 9671 | titulo_final = "0" + titulo_final; | 9673 | titulo_final = "0" + titulo_final; |
| 9672 | } | 9674 | } |
| 9673 | } | 9675 | } |
| 9674 | 9676 | ||
| 9675 | File carpeta_usb_export = new File( | 9677 | File carpeta_usb_export = new File( |
| 9676 | ParametrosInventario.URL_CARPETA_USB_EXPORT + "/"); | 9678 | ParametrosInventario.URL_CARPETA_USB_EXPORT + "/"); |
| 9677 | File archivo_destino = new File(carpeta_usb_export.getPath() | 9679 | File archivo_destino = new File(carpeta_usb_export.getPath() |
| 9678 | + "/" + titulo_final + ".xml"); | 9680 | + "/" + titulo_final + ".xml"); |
| 9679 | 9681 | ||
| 9680 | // OLD | 9682 | // OLD |
| 9681 | // Si la carpeta no existe: | 9683 | // Si la carpeta no existe: |
| 9682 | // if (archivo_destino.exists() == false) { | 9684 | // if (archivo_destino.exists() == false) { |
| 9683 | // archivo_destino.mkdirs(); | 9685 | // archivo_destino.mkdirs(); |
| 9684 | // archivo_destino.createNewFile(); | 9686 | // archivo_destino.createNewFile(); |
| 9685 | // } | 9687 | // } |
| 9686 | // else { | 9688 | // else { |
| 9687 | // archivo_destino.delete(); | 9689 | // archivo_destino.delete(); |
| 9688 | // archivo_destino.createNewFile(); | 9690 | // archivo_destino.createNewFile(); |
| 9689 | // } | 9691 | // } |
| 9690 | // | 9692 | // |
| 9691 | 9693 | ||
| 9692 | // Si la carpeta no existe: | 9694 | // Si la carpeta no existe: |
| 9693 | if (archivo_destino.exists() == false) { | 9695 | if (archivo_destino.exists() == false) { |
| 9694 | // | 9696 | // |
| 9695 | if (tieneArticulos) { | 9697 | if (tieneArticulos) { |
| 9696 | // archivo_destino.mkdirs(); | 9698 | // archivo_destino.mkdirs(); |
| 9697 | if (carpeta_usb_export.exists() == false) { | 9699 | if (carpeta_usb_export.exists() == false) { |
| 9698 | carpeta_usb_export.mkdirs(); | 9700 | carpeta_usb_export.mkdirs(); |
| 9699 | } | 9701 | } |
| 9700 | // Arroja IOException | 9702 | // Arroja IOException |
| 9701 | archivo_destino.createNewFile(); | 9703 | archivo_destino.createNewFile(); |
| 9702 | } | 9704 | } |
| 9703 | } else { | 9705 | } else { |
| 9704 | archivo_destino.delete(); | 9706 | archivo_destino.delete(); |
| 9705 | // Verificar esto | 9707 | // Verificar esto |
| 9706 | if (tieneArticulos) { | 9708 | if (tieneArticulos) { |
| 9707 | if (carpeta_usb_export.exists() == false) { | 9709 | if (carpeta_usb_export.exists() == false) { |
| 9708 | carpeta_usb_export.mkdirs(); | 9710 | carpeta_usb_export.mkdirs(); |
| 9709 | } | 9711 | } |
| 9710 | 9712 | ||
| 9711 | archivo_destino.createNewFile(); | 9713 | archivo_destino.createNewFile(); |
| 9712 | } | 9714 | } |
| 9713 | } | 9715 | } |
| 9714 | // Verificar esto | 9716 | // Verificar esto |
| 9715 | if (tieneArticulos) { | 9717 | if (tieneArticulos) { |
| 9716 | // 1.8 Si estan creados todos los archivos, transformamos el | 9718 | // 1.8 Si estan creados todos los archivos, transformamos el |
| 9717 | // DOM a un documento | 9719 | // DOM a un documento |
| 9718 | HttpWriter.transformerXml(documento, | 9720 | HttpWriter.transformerXml(documento,URL_COPIA_XML_EXPORT_RUTA); |
| 9719 | archivo_destino.getAbsolutePath()); | ||
| 9720 | } else { | 9721 | } else { |
| 9721 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9722 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9722 | // "No todos los inventarios tienen artculos"); | 9723 | // "No todos los inventarios tienen artculos"); |
| 9723 | } | 9724 | } |
| 9724 | } // end for | 9725 | } // end for |
| 9725 | if (!hayAlMenosUno) { | 9726 | if (!hayAlMenosUno) { |
| 9726 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9727 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9727 | "No hay inventarios con articulos"); | 9728 | "No hay inventarios con articulos"); |
| 9728 | } | 9729 | } |
| 9729 | // Agarramos la excepcion de IO | 9730 | // Agarramos la excepcion de IO |
| 9730 | 9731 | ||
| 9731 | } catch (IOException ioEx) { | 9732 | } catch (IOException ioEx) { |
| 9732 | 9733 | ||
| 9733 | GestorLogEventos log = new GestorLogEventos(); | 9734 | GestorLogEventos log = new GestorLogEventos(); |
| 9734 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 9735 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 9735 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 9736 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 9736 | log.log("[-- 1378 --]" + ioEx.toString(), 4); | 9737 | log.log("[-- 1378 --]" + ioEx.toString(), 4); |
| 9737 | 9738 | ||
| 9738 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9739 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9739 | "Error de IO al crear los archivos: " + ioEx.getMessage()); | 9740 | "Error de IO al crear los archivos: " + ioEx.getMessage()); |
| 9740 | } | 9741 | } |
| 9741 | // Agarramos la ParserConfigurationException | 9742 | // Agarramos la ParserConfigurationException |
| 9742 | catch (ParserConfigurationException pcEx) { | 9743 | catch (ParserConfigurationException pcEx) { |
| 9743 | 9744 | ||
| 9744 | GestorLogEventos log = new GestorLogEventos(); | 9745 | GestorLogEventos log = new GestorLogEventos(); |
| 9745 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 9746 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 9746 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 9747 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 9747 | log.log("[-- 1389 --]" + pcEx.toString(), 4); | 9748 | log.log("[-- 1389 --]" + pcEx.toString(), 4); |
| 9748 | 9749 | ||
| 9749 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9750 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9750 | "Error al crear la fabrica de documentos XML" | 9751 | "Error al crear la fabrica de documentos XML" |
| 9751 | + pcEx.getMessage()); | 9752 | + pcEx.getMessage()); |
| 9752 | // Finalmente agarramos la excepcion ms general | 9753 | // Finalmente agarramos la excepcion ms general |
| 9753 | } catch (Exception e) { | 9754 | } catch (Exception e) { |
| 9754 | 9755 | ||
| 9755 | GestorLogEventos log = new GestorLogEventos(); | 9756 | GestorLogEventos log = new GestorLogEventos(); |
| 9756 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 9757 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 9757 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 9758 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 9758 | log.log("[-- 1400 --]" + e.toString(), 4); | 9759 | log.log("[-- 1400 --]" + e.toString(), 4); |
| 9759 | 9760 | ||
| 9760 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9761 | throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9761 | "Error en la conversion de balizas: " + e.getMessage()); | 9762 | "Error en la conversion de balizas: " + e.getMessage()); |
| 9762 | } | 9763 | } |
| 9763 | } | 9764 | } |
| 9764 | 9765 | ||
| 9765 | // | 9766 | // |
| 9766 | 9767 | ||
| 9767 | // Formato viejo de XML no contempla fechas de inicio y fin de los archivos | 9768 | // Formato viejo de XML no contempla fechas de inicio y fin de los archivos |
| 9768 | // public boolean exportarTodasBaseDatosSQLite(ArrayList<Integer> | 9769 | // public boolean exportarTodasBaseDatosSQLite(ArrayList<Integer> |
| 9769 | // listaInventariosSeleccionados) throws ExceptionBDD, ExceptionHttpExchange | 9770 | // listaInventariosSeleccionados) throws ExceptionBDD, ExceptionHttpExchange |
| 9770 | // { | 9771 | // { |
| 9771 | // try { | 9772 | // try { |
| 9772 | // String string_lista_inventarios = ""; | 9773 | // String string_lista_inventarios = ""; |
| 9773 | // for (int inv : listaInventariosSeleccionados) { | 9774 | // for (int inv : listaInventariosSeleccionados) { |
| 9774 | // string_lista_inventarios += String.valueOf(inv) + ","; | 9775 | // string_lista_inventarios += String.valueOf(inv) + ","; |
| 9775 | // } | 9776 | // } |
| 9776 | // string_lista_inventarios = string_lista_inventarios.substring(0, | 9777 | // string_lista_inventarios = string_lista_inventarios.substring(0, |
| 9777 | // string_lista_inventarios.length()-1); | 9778 | // string_lista_inventarios.length()-1); |
| 9778 | // | 9779 | // |
| 9779 | // // Cration d'un nouveau DOM: | 9780 | // // Cration d'un nouveau DOM: |
| 9780 | // DocumentBuilderFactory fabricaDocumentos = | 9781 | // DocumentBuilderFactory fabricaDocumentos = |
| 9781 | // DocumentBuilderFactory.newInstance(); | 9782 | // DocumentBuilderFactory.newInstance(); |
| 9782 | // DocumentBuilder constructorDocumentos = | 9783 | // DocumentBuilder constructorDocumentos = |
| 9783 | // fabricaDocumentos.newDocumentBuilder(); | 9784 | // fabricaDocumentos.newDocumentBuilder(); |
| 9784 | // Document documento = constructorDocumentos.newDocument(); | 9785 | // Document documento = constructorDocumentos.newDocument(); |
| 9785 | // | 9786 | // |
| 9786 | // // Proprits du DOM: | 9787 | // // Proprits du DOM: |
| 9787 | // documento.setXmlVersion("1.0"); | 9788 | // documento.setXmlVersion("1.0"); |
| 9788 | // documento.setXmlStandalone(true); | 9789 | // documento.setXmlStandalone(true); |
| 9789 | // | 9790 | // |
| 9790 | // // Cration de l'arborescence du DOM: | 9791 | // // Cration de l'arborescence du DOM: |
| 9791 | // Element titulo = | 9792 | // Element titulo = |
| 9792 | // documento.createElement(ParametrosInventario.bal_xml_export_cabecera); | 9793 | // documento.createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 9793 | // | 9794 | // |
| 9794 | // //Abrimos la base de datos en modo lectura: | 9795 | // //Abrimos la base de datos en modo lectura: |
| 9795 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 9796 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 9796 | // | 9797 | // |
| 9797 | // String[] columnasDeseadas = new String[] { | 9798 | // String[] columnasDeseadas = new String[] { |
| 9798 | // ParametrosInventario.bal_bdd_articulo_sector, | 9799 | // ParametrosInventario.bal_bdd_articulo_sector, |
| 9799 | // ParametrosInventario.bal_bdd_articulo_codigo, | 9800 | // ParametrosInventario.bal_bdd_articulo_codigo, |
| 9800 | // ParametrosInventario.bal_bdd_articulo_inventario, | 9801 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 9801 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 9802 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 9802 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 9803 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 9803 | // ParametrosInventario.bal_bdd_articulo_foto, | 9804 | // ParametrosInventario.bal_bdd_articulo_foto, |
| 9804 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 9805 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 9805 | // ParametrosInventario.bal_bdd_articulo_descripcion | 9806 | // ParametrosInventario.bal_bdd_articulo_descripcion |
| 9806 | // }; | 9807 | // }; |
| 9807 | // Cursor c = dtb.query(tabla_articulos_nombre, columnasDeseadas, | 9808 | // Cursor c = dtb.query(tabla_articulos_nombre, columnasDeseadas, |
| 9808 | // ParametrosInventario.bal_bdd_articulo_inventario + " IN (" + | 9809 | // ParametrosInventario.bal_bdd_articulo_inventario + " IN (" + |
| 9809 | // string_lista_inventarios + ")", null, null, null, null); | 9810 | // string_lista_inventarios + ")", null, null, null, null); |
| 9810 | // | 9811 | // |
| 9811 | // // Recuperamos los resultados: | 9812 | // // Recuperamos los resultados: |
| 9812 | // int cantidadColumnas = c.getColumnCount(); | 9813 | // int cantidadColumnas = c.getColumnCount(); |
| 9813 | // | 9814 | // |
| 9814 | // if (c.moveToFirst()) { | 9815 | // if (c.moveToFirst()) { |
| 9815 | // while (c.isAfterLast() == false) { | 9816 | // while (c.isAfterLast() == false) { |
| 9816 | // | 9817 | // |
| 9817 | // Element medicion = | 9818 | // Element medicion = |
| 9818 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_articulos_nombre)); | 9819 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(tabla_articulos_nombre)); |
| 9819 | // | 9820 | // |
| 9820 | // for (int i = 0 ; i < cantidadColumnas ; i++) { | 9821 | // for (int i = 0 ; i < cantidadColumnas ; i++) { |
| 9821 | // Element elemento = | 9822 | // Element elemento = |
| 9822 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(c.getColumnName(i))); | 9823 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2xml(c.getColumnName(i))); |
| 9823 | // elemento.setTextContent(c.getString(i)); | 9824 | // elemento.setTextContent(c.getString(i)); |
| 9824 | // medicion.appendChild(elemento); | 9825 | // medicion.appendChild(elemento); |
| 9825 | // } | 9826 | // } |
| 9826 | // titulo.appendChild(medicion); | 9827 | // titulo.appendChild(medicion); |
| 9827 | // | 9828 | // |
| 9828 | // c.moveToNext(); | 9829 | // c.moveToNext(); |
| 9829 | // } | 9830 | // } |
| 9830 | // } | 9831 | // } |
| 9831 | // | 9832 | // |
| 9832 | // dtb.close(); | 9833 | // dtb.close(); |
| 9833 | // | 9834 | // |
| 9834 | // documento.appendChild(titulo); | 9835 | // documento.appendChild(titulo); |
| 9835 | // | 9836 | // |
| 9836 | // // Sauvegarde du DOM dans un fichier XML | 9837 | // // Sauvegarde du DOM dans un fichier XML |
| 9837 | // HttpWriter.transformerXml(documento, | 9838 | // HttpWriter.transformerXml(documento, |
| 9838 | // ParametrosInventario.URL_COPIA_XML_EXPORT); | 9839 | // ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 9839 | // | 9840 | // |
| 9840 | // // Mandamos el archivo en POST hacia el servidor: | 9841 | // // Mandamos el archivo en POST hacia el servidor: |
| 9841 | // HttpSender httpSender = new | 9842 | // HttpSender httpSender = new |
| 9842 | // HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); | 9843 | // HttpSender(Parametros.CODIGO_SOFT_DEBOINVENTARIO); |
| 9843 | // return httpSender.send_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); | 9844 | // return httpSender.send_xml(ParametrosInventario.URL_COPIA_XML_EXPORT); |
| 9844 | // | 9845 | // |
| 9845 | // }catch(Exception e){ | 9846 | // }catch(Exception e){ |
| 9846 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9847 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9847 | // "La exportacion de los datos de la Base De Datos fracaso"); | 9848 | // "La exportacion de los datos de la Base De Datos fracaso"); |
| 9848 | // } | 9849 | // } |
| 9849 | // } | 9850 | // } |
| 9850 | 9851 | ||
| 9851 | // Old 28/4/2012 | 9852 | // Old 28/4/2012 |
| 9852 | // public void exportarTodasBaseDatosSQLite_HaciaUsb(ArrayList<Integer> | 9853 | // public void exportarTodasBaseDatosSQLite_HaciaUsb(ArrayList<Integer> |
| 9853 | // listaInventariosSeleccionados) throws ExceptionBDD { | 9854 | // listaInventariosSeleccionados) throws ExceptionBDD { |
| 9854 | // try { | 9855 | // try { |
| 9855 | // for (int inv : listaInventariosSeleccionados) { | 9856 | // for (int inv : listaInventariosSeleccionados) { |
| 9856 | // | 9857 | // |
| 9857 | // // Creation d'un nouveau DOM: | 9858 | // // Creation d'un nouveau DOM: |
| 9858 | // DocumentBuilderFactory fabricaDocumentos = | 9859 | // DocumentBuilderFactory fabricaDocumentos = |
| 9859 | // DocumentBuilderFactory.newInstance(); | 9860 | // DocumentBuilderFactory.newInstance(); |
| 9860 | // DocumentBuilder constructorDocumentos = | 9861 | // DocumentBuilder constructorDocumentos = |
| 9861 | // fabricaDocumentos.newDocumentBuilder(); | 9862 | // fabricaDocumentos.newDocumentBuilder(); |
| 9862 | // Document documento = constructorDocumentos.newDocument(); | 9863 | // Document documento = constructorDocumentos.newDocument(); |
| 9863 | // | 9864 | // |
| 9864 | // // Proprits du DOM: | 9865 | // // Proprits du DOM: |
| 9865 | // documento.setXmlVersion("1.0"); | 9866 | // documento.setXmlVersion("1.0"); |
| 9866 | // documento.setXmlStandalone(true); | 9867 | // documento.setXmlStandalone(true); |
| 9867 | // | 9868 | // |
| 9868 | // // Cration de l'arborescence du DOM: | 9869 | // // Cration de l'arborescence du DOM: |
| 9869 | // Element titulo = | 9870 | // Element titulo = |
| 9870 | // documento.createElement(ParametrosInventario.bal_xml_export_cabecera); | 9871 | // documento.createElement(ParametrosInventario.bal_xml_export_cabecera); |
| 9871 | // | 9872 | // |
| 9872 | // //Abrimos la base de datos en modo lectura: | 9873 | // //Abrimos la base de datos en modo lectura: |
| 9873 | // SQLiteDatabase dtb = this.getReadableDatabase(); | 9874 | // SQLiteDatabase dtb = this.getReadableDatabase(); |
| 9874 | // | 9875 | // |
| 9875 | // String[] columnasDeseadas = new String[] { | 9876 | // String[] columnasDeseadas = new String[] { |
| 9876 | // ParametrosInventario.bal_bdd_articulo_sector, | 9877 | // ParametrosInventario.bal_bdd_articulo_sector, |
| 9877 | // ParametrosInventario.bal_bdd_articulo_codigo, | 9878 | // ParametrosInventario.bal_bdd_articulo_codigo, |
| 9878 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 9879 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 9879 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 9880 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 9880 | // ParametrosInventario.bal_bdd_articulo_fechaFin, | 9881 | // ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 9881 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 9882 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 9882 | // ParametrosInventario.bal_bdd_articulo_codigo_barra | 9883 | // ParametrosInventario.bal_bdd_articulo_codigo_barra |
| 9883 | // }; | 9884 | // }; |
| 9884 | // Cursor c = dtb.query(tabla_articulos_nombre, columnasDeseadas, | 9885 | // Cursor c = dtb.query(tabla_articulos_nombre, columnasDeseadas, |
| 9885 | // ParametrosInventario.bal_bdd_articulo_inventario + "=" + | 9886 | // ParametrosInventario.bal_bdd_articulo_inventario + "=" + |
| 9886 | // String.valueOf(inv), null, null, null, null); | 9887 | // String.valueOf(inv), null, null, null, null); |
| 9887 | // | 9888 | // |
| 9888 | // // Recuperamos los resultados: | 9889 | // // Recuperamos los resultados: |
| 9889 | // int cantidadColumnas = c.getColumnCount(); | 9890 | // int cantidadColumnas = c.getColumnCount(); |
| 9890 | // | 9891 | // |
| 9891 | // if (c.moveToFirst()) { | 9892 | // if (c.moveToFirst()) { |
| 9892 | // | 9893 | // |
| 9893 | // // Ponemos el num de inventario en el encabezado: (Atencin, para USB!!!) | 9894 | // // Ponemos el num de inventario en el encabezado: (Atencin, para USB!!!) |
| 9894 | // Element inventario = | 9895 | // Element inventario = |
| 9895 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(ParametrosInventario.bal_bdd_inventario_numero)); | 9896 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(ParametrosInventario.bal_bdd_inventario_numero)); |
| 9896 | // inventario.setTextContent(String.valueOf(inv)); | 9897 | // inventario.setTextContent(String.valueOf(inv)); |
| 9897 | // titulo.appendChild(inventario); | 9898 | // titulo.appendChild(inventario); |
| 9898 | // | 9899 | // |
| 9899 | // // Luego el detalle de los articulos: | 9900 | // // Luego el detalle de los articulos: |
| 9900 | // while (c.isAfterLast() == false) { | 9901 | // while (c.isAfterLast() == false) { |
| 9901 | // | 9902 | // |
| 9902 | // Element medicion = | 9903 | // Element medicion = |
| 9903 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(tabla_articulos_nombre)); | 9904 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(tabla_articulos_nombre)); |
| 9904 | // | 9905 | // |
| 9905 | // for (int i = 0 ; i < cantidadColumnas ; i++) { | 9906 | // for (int i = 0 ; i < cantidadColumnas ; i++) { |
| 9906 | // Element elemento = | 9907 | // Element elemento = |
| 9907 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(c.getColumnName(i))); | 9908 | // documento.createElement(ParametrosInventario.CONVERSOR_BALIZAS.bdd2usb(c.getColumnName(i))); |
| 9908 | // elemento.setTextContent(c.getString(i)); | 9909 | // elemento.setTextContent(c.getString(i)); |
| 9909 | // medicion.appendChild(elemento); | 9910 | // medicion.appendChild(elemento); |
| 9910 | // } | 9911 | // } |
| 9911 | // titulo.appendChild(medicion); | 9912 | // titulo.appendChild(medicion); |
| 9912 | // | 9913 | // |
| 9913 | // c.moveToNext(); | 9914 | // c.moveToNext(); |
| 9914 | // } | 9915 | // } |
| 9915 | // } | 9916 | // } |
| 9916 | // | 9917 | // |
| 9917 | // dtb.close(); | 9918 | // dtb.close(); |
| 9918 | // | 9919 | // |
| 9919 | // documento.appendChild(titulo); | 9920 | // documento.appendChild(titulo); |
| 9920 | // | 9921 | // |
| 9921 | // // Sauvegarde du DOM dans un fichier XML | 9922 | // // Sauvegarde du DOM dans un fichier XML |
| 9922 | // // Construccion del nombre del archivode exportacion: n del inventario | 9923 | // // Construccion del nombre del archivode exportacion: n del inventario |
| 9923 | // sobre 4 digitos: | 9924 | // sobre 4 digitos: |
| 9924 | // String titulo_inicial = String.valueOf(inv); | 9925 | // String titulo_inicial = String.valueOf(inv); |
| 9925 | // String titulo_final = titulo_inicial; | 9926 | // String titulo_final = titulo_inicial; |
| 9926 | // for (int i = titulo_inicial.length() ; i < 4 ; i++) { | 9927 | // for (int i = titulo_inicial.length() ; i < 4 ; i++) { |
| 9927 | // titulo_final = "0" + titulo_final; | 9928 | // titulo_final = "0" + titulo_final; |
| 9928 | // } | 9929 | // } |
| 9929 | // | 9930 | // |
| 9930 | // File carpeta_usb_export = new | 9931 | // File carpeta_usb_export = new |
| 9931 | // File(ParametrosInventario.URL_CARPETA_USB_EXPORT); | 9932 | // File(ParametrosInventario.URL_CARPETA_USB_EXPORT); |
| 9932 | // File archivo_destino = new File(carpeta_usb_export.getPath() + "/" + | 9933 | // File archivo_destino = new File(carpeta_usb_export.getPath() + "/" + |
| 9933 | // titulo_final + ".xml"); | 9934 | // titulo_final + ".xml"); |
| 9934 | // | 9935 | // |
| 9935 | // // Si la carpeta no existe: | 9936 | // // Si la carpeta no existe: |
| 9936 | // if (archivo_destino.exists() == false) { | 9937 | // if (archivo_destino.exists() == false) { |
| 9937 | // archivo_destino.mkdirs(); | 9938 | // archivo_destino.mkdirs(); |
| 9938 | // archivo_destino.createNewFile(); | 9939 | // archivo_destino.createNewFile(); |
| 9939 | // } | 9940 | // } |
| 9940 | // else { | 9941 | // else { |
| 9941 | // archivo_destino.delete(); | 9942 | // archivo_destino.delete(); |
| 9942 | // archivo_destino.createNewFile(); | 9943 | // archivo_destino.createNewFile(); |
| 9943 | // } | 9944 | // } |
| 9944 | // | 9945 | // |
| 9945 | // HttpWriter.transformerXml(documento, archivo_destino.getAbsolutePath()); | 9946 | // HttpWriter.transformerXml(documento, archivo_destino.getAbsolutePath()); |
| 9946 | // } // end for | 9947 | // } // end for |
| 9947 | // | 9948 | // |
| 9948 | // }catch(Exception e){ | 9949 | // }catch(Exception e){ |
| 9949 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, | 9950 | // throw new ExceptionBDD(ExceptionBDD.EXPORT_FRACASADO, |
| 9950 | // "La exportacion de los datos de la Base De Datos fracaso"); | 9951 | // "La exportacion de los datos de la Base De Datos fracaso"); |
| 9951 | // } | 9952 | // } |
| 9952 | // } | 9953 | // } |
| 9953 | // | 9954 | // |
| 9954 | 9955 | ||
| 9955 | 9956 | ||
| 9956 | 9957 | ||
| 9957 | /** | 9958 | /** |
| 9958 | * Agregar un articulo nuevo o actualiza la base de datos en la tabla de | 9959 | * Agregar un articulo nuevo o actualiza la base de datos en la tabla de |
| 9959 | * articulos | 9960 | * articulos |
| 9960 | * <p> | 9961 | * <p> |
| 9961 | * 1 Test de la preexistencia de la entrada | 9962 | * 1 Test de la preexistencia de la entrada |
| 9962 | * <p> | 9963 | * <p> |
| 9963 | * 1.1 Si la entrada ya existe, actualizamos los datos | 9964 | * 1.1 Si la entrada ya existe, actualizamos los datos |
| 9964 | * <p> | 9965 | * <p> |
| 9965 | * 2 Sino, abrimos la base de datos en modo escritura | 9966 | * 2 Sino, abrimos la base de datos en modo escritura |
| 9966 | * <p> | 9967 | * <p> |
| 9967 | * 3 Creamos el registro a insertar como objeto ContentValues | 9968 | * 3 Creamos el registro a insertar como objeto ContentValues |
| 9968 | * <p> | 9969 | * <p> |
| 9969 | * 4 Insertamos el registro en la base de datos | 9970 | * 4 Insertamos el registro en la base de datos |
| 9970 | * <p> | 9971 | * <p> |
| 9971 | * 5 Cierre | 9972 | * 5 Cierre |
| 9972 | * | 9973 | * |
| 9973 | * @param articulo | 9974 | * @param articulo |
| 9974 | * @throws ExceptionBDD | 9975 | * @throws ExceptionBDD |
| 9975 | */ | 9976 | */ |
| 9976 | 9977 | ||
| 9977 | public void insertArticuloEnBdd(Articulo articulo) throws ExceptionBDD { | 9978 | public void insertArticuloEnBdd(Articulo articulo) throws ExceptionBDD { |
| 9978 | try { | 9979 | try { |
| 9979 | System.out.println("::: BD 2119 Insert con cb"); | 9980 | System.out.println("::: BD 2119 Insert con cb"); |
| 9980 | // 1 Test de la preexistencia de la entrada: | 9981 | // 1 Test de la preexistencia de la entrada: |
| 9981 | 9982 | ||
| 9982 | /*Comprueba si esta marcado el parametro de balanza*/ | 9983 | /*Comprueba si esta marcado el parametro de balanza*/ |
| 9983 | boolean condicionBalanza = ParametrosInventario.balanza; | 9984 | boolean condicionBalanza = ParametrosInventario.balanza; |
| 9984 | 9985 | ||
| 9985 | System.out.println("::: BaseDatos 2253 condicionBalanza " + condicionBalanza ); | 9986 | System.out.println("::: BaseDatos 2253 condicionBalanza " + condicionBalanza ); |
| 9986 | 9987 | ||
| 9987 | if (selectArticuloConCodigos(articulo.getSector(), | 9988 | if (selectArticuloConCodigos(articulo.getSector(), |
| 9988 | articulo.getCodigo(), articulo.getInventario()) != null) // Si | 9989 | articulo.getCodigo(), articulo.getInventario()) != null) // Si |
| 9989 | // existe... | 9990 | // existe... |
| 9990 | { | 9991 | { |
| 9991 | // 1.1 Si la entrada ya existe, actualizamos los datos: | 9992 | // 1.1 Si la entrada ya existe, actualizamos los datos: |
| 9992 | updateArticulo(articulo); | 9993 | updateArticulo(articulo); |
| 9993 | return; | 9994 | return; |
| 9994 | } | 9995 | } |
| 9995 | 9996 | ||
| 9996 | SQLiteDatabase dtb = this.getWritableDatabase(); | 9997 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 9997 | System.out.println("::: BD 2119 Insert con cb " + ParametrosInventario.InventariosVentas); | 9998 | System.out.println("::: BD 2119 Insert con cb " + ParametrosInventario.InventariosVentas); |
| 9998 | 9999 | ||
| 9999 | if(condicionBalanza == true){ | 10000 | if(condicionBalanza == true){ |
| 10000 | if (ParametrosInventario.InventariosVentas == true) { | 10001 | if (ParametrosInventario.InventariosVentas == true) { |
| 10001 | int valorDepo = articulo.getDepsn(); | 10002 | int valorDepo = articulo.getDepsn(); |
| 10002 | System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); | 10003 | System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); |
| 10003 | // 2 Sino, abrimos la base de datos en modo escritura | 10004 | // 2 Sino, abrimos la base de datos en modo escritura |
| 10004 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 10005 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 10005 | // Si hemos abierto correctamente la base de datos | 10006 | // Si hemos abierto correctamente la base de datos |
| 10006 | if (dtb != null) { | 10007 | if (dtb != null) { |
| 10007 | // 3 Creamos el registro a insertar como objeto ContentValues | 10008 | // 3 Creamos el registro a insertar como objeto ContentValues |
| 10008 | 10009 | ||
| 10009 | System.out.println("::: BaseDatos 2814 Sector " + articulo.getSector()); | 10010 | System.out.println("::: BaseDatos 2814 Sector " + articulo.getSector()); |
| 10010 | System.out.println("::: BaseDatos 2815 Codigo " + articulo.getCodigo()); | 10011 | System.out.println("::: BaseDatos 2815 Codigo " + articulo.getCodigo()); |
| 10011 | 10012 | ||
| 10012 | ContentValues nuevoRegistro = new ContentValues(); | 10013 | ContentValues nuevoRegistro = new ContentValues(); |
| 10013 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10014 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10014 | articulo.getSector()); | 10015 | articulo.getSector()); |
| 10015 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10016 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10016 | articulo.getCodigo()); | 10017 | articulo.getCodigo()); |
| 10017 | String codigo_a_modificar = ""; | 10018 | String codigo_a_modificar = ""; |
| 10018 | String cod1; | 10019 | String cod1; |
| 10019 | String codigoDeBarras =""; | 10020 | String codigoDeBarras =""; |
| 10020 | String obtenerPesaje =""; | 10021 | String obtenerPesaje =""; |
| 10021 | String corregirDecimales=""; | 10022 | String corregirDecimales=""; |
| 10022 | String descBarra; | 10023 | String descBarra; |
| 10023 | if(articulo.getInventario()==-1 || articulo.getInventario()==-2 || articulo.getInventario()==-3) { | 10024 | if(articulo.getInventario()==-1 || articulo.getInventario()==-2 || articulo.getInventario()==-3) { |
| 10024 | codigo_a_modificar = articulo.getCodigos_barras_string(); | 10025 | codigo_a_modificar = articulo.getCodigos_barras_string(); |
| 10025 | if(articulo.getCodigos_barras_completo().isEmpty()){ | 10026 | if(articulo.getCodigos_barras_completo().isEmpty()){ |
| 10026 | if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ | 10027 | if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ |
| 10027 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10028 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10028 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ | 10029 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ |
| 10029 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10030 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10030 | }else if(articulo.getBalanza()!=8){ | 10031 | }else if(articulo.getBalanza()!=8){ |
| 10031 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10032 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10032 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ | 10033 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ |
| 10033 | // corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 10034 | // corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 10034 | // String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); | 10035 | // String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); |
| 10035 | // String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); | 10036 | // String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); |
| 10036 | // codigoDeBarras = String.valueOf(parte1 +"."+ parte2); | 10037 | // codigoDeBarras = String.valueOf(parte1 +"."+ parte2); |
| 10037 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10038 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10038 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ | 10039 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ |
| 10039 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10040 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10040 | } | 10041 | } |
| 10041 | }else{ | 10042 | }else{ |
| 10042 | if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ | 10043 | if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ |
| 10043 | codigoDeBarras = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 10044 | codigoDeBarras = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 10044 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ | 10045 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ |
| 10045 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10046 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10046 | }else if(articulo.getBalanza()!=8){ | 10047 | }else if(articulo.getBalanza()!=8){ |
| 10047 | codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); | 10048 | codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); |
| 10048 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ | 10049 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ |
| 10049 | corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 10050 | corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 10050 | String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); | 10051 | String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); |
| 10051 | String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); | 10052 | String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); |
| 10052 | codigoDeBarras = String.valueOf(parte1 +"."+ parte2); | 10053 | codigoDeBarras = String.valueOf(parte1 +"."+ parte2); |
| 10053 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ | 10054 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ |
| 10054 | codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); | 10055 | codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); |
| 10055 | } | 10056 | } |
| 10056 | } | 10057 | } |
| 10057 | if(articulo.getBalanza()==8){ | 10058 | if(articulo.getBalanza()==8){ |
| 10058 | descBarra = articulo.getCodigos_barras_completo_string(); | 10059 | descBarra = articulo.getCodigos_barras_completo_string(); |
| 10059 | }else{ | 10060 | }else{ |
| 10060 | descBarra = String.valueOf(articulo.getCodigos_barras().get(0)); | 10061 | descBarra = String.valueOf(articulo.getCodigos_barras().get(0)); |
| 10061 | } | 10062 | } |
| 10062 | nuevoRegistro.put( | 10063 | nuevoRegistro.put( |
| 10063 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10064 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10064 | articulo.getCodigos_barras_string()); | 10065 | articulo.getCodigos_barras_string()); |
| 10065 | nuevoRegistro.put( | 10066 | nuevoRegistro.put( |
| 10066 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 10067 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 10067 | articulo.getCodigos_barras_completo_string()); | 10068 | articulo.getCodigos_barras_completo_string()); |
| 10068 | }else if(articulo.getInventario()>0){ | 10069 | }else if(articulo.getInventario()>0){ |
| 10069 | nuevoRegistro.put( | 10070 | nuevoRegistro.put( |
| 10070 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10071 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10071 | articulo.getCodigos_barras_string_inv()); | 10072 | articulo.getCodigos_barras_string_inv()); |
| 10072 | nuevoRegistro.put( | 10073 | nuevoRegistro.put( |
| 10073 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 10074 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 10074 | articulo.getCodigos_barras_string_inv()); | 10075 | articulo.getCodigos_barras_string_inv()); |
| 10075 | }else if(articulo.getInventario()<-3){ | 10076 | }else if(articulo.getInventario()<-3){ |
| 10076 | nuevoRegistro.put( | 10077 | nuevoRegistro.put( |
| 10077 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10078 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10078 | articulo.getCodigos_barras_string_inv()); | 10079 | articulo.getCodigos_barras_string_inv()); |
| 10079 | nuevoRegistro.put( | 10080 | nuevoRegistro.put( |
| 10080 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 10081 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 10081 | articulo.getCodigos_barras_string_inv()); | 10082 | articulo.getCodigos_barras_string_inv()); |
| 10082 | } | 10083 | } |
| 10083 | nuevoRegistro.put( | 10084 | nuevoRegistro.put( |
| 10084 | ParametrosInventario.bal_bdd_articulo_inventario, | 10085 | ParametrosInventario.bal_bdd_articulo_inventario, |
| 10085 | articulo.getInventario()); | 10086 | articulo.getInventario()); |
| 10086 | nuevoRegistro.put( | 10087 | nuevoRegistro.put( |
| 10087 | ParametrosInventario.bal_bdd_articulo_descripcion, | 10088 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10088 | articulo.getDescripcion()); | 10089 | articulo.getDescripcion()); |
| 10089 | nuevoRegistro.put( | 10090 | nuevoRegistro.put( |
| 10090 | ParametrosInventario.bal_bdd_articulo_precio_venta, | 10091 | ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10091 | articulo.getPrecio_venta()); | 10092 | articulo.getPrecio_venta()); |
| 10092 | nuevoRegistro.put( | 10093 | nuevoRegistro.put( |
| 10093 | ParametrosInventario.bal_bdd_articulo_precio_costo, | 10094 | ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10094 | articulo.getPrecio_costo()); | 10095 | articulo.getPrecio_costo()); |
| 10095 | /*Damian*/ | 10096 | /*Damian*/ |
| 10096 | nuevoRegistro.put( | 10097 | nuevoRegistro.put( |
| 10097 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10098 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10098 | articulo.getExis_venta()); | 10099 | articulo.getExis_venta()); |
| 10099 | nuevoRegistro.put( | 10100 | nuevoRegistro.put( |
| 10100 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10101 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10101 | articulo.getExis_deposito()); | 10102 | articulo.getExis_deposito()); |
| 10102 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10103 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10103 | articulo.getFoto()); | 10104 | articulo.getFoto()); |
| 10104 | if(articulo.getInventario()==-1 || articulo.getInventario()==-2) { | 10105 | if(articulo.getInventario()==-1 || articulo.getInventario()==-2) { |
| 10105 | if(articulo.getCodigos_barras_completo().isEmpty()){ | 10106 | if(articulo.getCodigos_barras_completo().isEmpty()){ |
| 10106 | obtenerPesaje = String.valueOf(articulo.getCantidad()); | 10107 | obtenerPesaje = String.valueOf(articulo.getCantidad()); |
| 10107 | }else{ | 10108 | }else{ |
| 10108 | if(articulo.getBalanza()==8){ | 10109 | if(articulo.getBalanza()==8){ |
| 10109 | obtenerPesaje = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 10110 | obtenerPesaje = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 10110 | }else{ | 10111 | }else{ |
| 10111 | obtenerPesaje = String.valueOf(articulo.getCantidad()); | 10112 | obtenerPesaje = String.valueOf(articulo.getCantidad()); |
| 10112 | } | 10113 | } |
| 10113 | } | 10114 | } |
| 10114 | nuevoRegistro.put( | 10115 | nuevoRegistro.put( |
| 10115 | ParametrosInventario.bal_bdd_articulo_pesaje, | 10116 | ParametrosInventario.bal_bdd_articulo_pesaje, |
| 10116 | obtenerPesaje); | 10117 | obtenerPesaje); |
| 10117 | 10118 | ||
| 10118 | System.out.println("::: QUIERO VER Q TRAE articulo.getCantidad() " + articulo.getCantidad()); | 10119 | System.out.println("::: QUIERO VER Q TRAE articulo.getCantidad() " + articulo.getCantidad()); |
| 10119 | nuevoRegistro.put( | 10120 | nuevoRegistro.put( |
| 10120 | ParametrosInventario.bal_bdd_articulo_cantidad, | 10121 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10121 | codigoDeBarras); | 10122 | codigoDeBarras); |
| 10122 | }else if(articulo.getInventario()>0){ | 10123 | }else if(articulo.getInventario()>0){ |
| 10123 | obtenerPesaje = "0"; | 10124 | obtenerPesaje = "0"; |
| 10124 | codigoDeBarras = "-1"; | 10125 | codigoDeBarras = "-1"; |
| 10125 | 10126 | ||
| 10126 | nuevoRegistro.put( | 10127 | nuevoRegistro.put( |
| 10127 | ParametrosInventario.bal_bdd_articulo_pesaje, | 10128 | ParametrosInventario.bal_bdd_articulo_pesaje, |
| 10128 | obtenerPesaje); | 10129 | obtenerPesaje); |
| 10129 | nuevoRegistro.put( | 10130 | nuevoRegistro.put( |
| 10130 | ParametrosInventario.bal_bdd_articulo_cantidad, | 10131 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10131 | codigoDeBarras); | 10132 | codigoDeBarras); |
| 10132 | }else if(articulo.getInventario()<-3){ | 10133 | }else if(articulo.getInventario()<-3){ |
| 10133 | obtenerPesaje = "0"; | 10134 | obtenerPesaje = "0"; |
| 10134 | codigoDeBarras = "-1"; | 10135 | codigoDeBarras = "-1"; |
| 10135 | 10136 | ||
| 10136 | nuevoRegistro.put( | 10137 | nuevoRegistro.put( |
| 10137 | ParametrosInventario.bal_bdd_articulo_pesaje, | 10138 | ParametrosInventario.bal_bdd_articulo_pesaje, |
| 10138 | obtenerPesaje); | 10139 | obtenerPesaje); |
| 10139 | nuevoRegistro.put( | 10140 | nuevoRegistro.put( |
| 10140 | ParametrosInventario.bal_bdd_articulo_cantidad, | 10141 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10141 | codigoDeBarras); | 10142 | codigoDeBarras); |
| 10142 | } | 10143 | } |
| 10143 | 10144 | ||
| 10144 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, | 10145 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, |
| 10145 | articulo.getBalanza()); | 10146 | articulo.getBalanza()); |
| 10146 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, | 10147 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, |
| 10147 | articulo.getDecimales()); | 10148 | articulo.getDecimales()); |
| 10148 | 10149 | ||
| 10149 | nuevoRegistro.put( | 10150 | nuevoRegistro.put( |
| 10150 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10151 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10151 | articulo.getFechaInicio()); | 10152 | articulo.getFechaInicio()); |
| 10152 | 10153 | ||
| 10153 | // 4 Insertamos el registro en la base de datos | 10154 | // 4 Insertamos el registro en la base de datos |
| 10154 | long resultado = dtb.insert(tabla_articulos_nombre, null, | 10155 | long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10155 | nuevoRegistro); | 10156 | nuevoRegistro); |
| 10156 | 10157 | ||
| 10157 | // Test resultado INSERT: | 10158 | // Test resultado INSERT: |
| 10158 | if (resultado < 0) { | 10159 | if (resultado < 0) { |
| 10159 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10160 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10160 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10161 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10161 | } | 10162 | } |
| 10162 | 10163 | ||
| 10163 | } else { | 10164 | } else { |
| 10164 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10165 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10165 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10166 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10166 | } | 10167 | } |
| 10167 | 10168 | ||
| 10168 | 10169 | ||
| 10169 | }else { | 10170 | }else { |
| 10170 | // 2 Sino, abrimos la base de datos en modo escritura | 10171 | // 2 Sino, abrimos la base de datos en modo escritura |
| 10171 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 10172 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 10172 | int valorDepo = articulo.getDepsn(); | 10173 | int valorDepo = articulo.getDepsn(); |
| 10173 | System.out.println("::::: BD 2209 valor depsn " + valorDepo); | 10174 | System.out.println("::::: BD 2209 valor depsn " + valorDepo); |
| 10174 | if(valorDepo == 1){ | 10175 | if(valorDepo == 1){ |
| 10175 | // 3 Creamos el registro a insertar como objeto ContentValues | 10176 | // 3 Creamos el registro a insertar como objeto ContentValues |
| 10176 | ContentValues nuevoRegistro = new ContentValues(); | 10177 | ContentValues nuevoRegistro = new ContentValues(); |
| 10177 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10178 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10178 | articulo.getSector()); | 10179 | articulo.getSector()); |
| 10179 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10180 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10180 | articulo.getCodigo()); | 10181 | articulo.getCodigo()); |
| 10181 | String codigo_a_modificar = articulo.getCodigos_barras_string(); | 10182 | String codigo_a_modificar = articulo.getCodigos_barras_string(); |
| 10182 | String codigoDeBarras =""; | 10183 | String codigoDeBarras =""; |
| 10183 | String obtenerPesaje =""; | 10184 | String obtenerPesaje =""; |
| 10184 | String corregirDecimales=""; | 10185 | String corregirDecimales=""; |
| 10185 | String descBarra; | 10186 | String descBarra; |
| 10186 | if(articulo.getCodigos_barras_completo().isEmpty()){ | 10187 | if(articulo.getCodigos_barras_completo().isEmpty()){ |
| 10187 | if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ | 10188 | if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ |
| 10188 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10189 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10189 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ | 10190 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ |
| 10190 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10191 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10191 | }else if(articulo.getBalanza()!=8){ | 10192 | }else if(articulo.getBalanza()!=8){ |
| 10192 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10193 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10193 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ | 10194 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ |
| 10194 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10195 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10195 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ | 10196 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ |
| 10196 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10197 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10197 | } | 10198 | } |
| 10198 | }else{ | 10199 | }else{ |
| 10199 | if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ | 10200 | if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()!=3){ |
| 10200 | codigoDeBarras = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 10201 | codigoDeBarras = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 10201 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ | 10202 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()!=3){ |
| 10202 | codigoDeBarras = String.valueOf(articulo.getCantidad()); | 10203 | codigoDeBarras = String.valueOf(articulo.getCantidad()); |
| 10203 | }else if(articulo.getBalanza()!=8){ | 10204 | }else if(articulo.getBalanza()!=8){ |
| 10204 | codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); | 10205 | codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); |
| 10205 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ | 10206 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()== -1.0 && articulo.getDecimales()==3){ |
| 10206 | corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 10207 | corregirDecimales = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 10207 | String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); | 10208 | String parte1 = articulo.getCodigos_barras_completo().get(0).substring(7,9); |
| 10208 | String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); | 10209 | String parte2 = articulo.getCodigos_barras_completo().get(0).substring(9,12); |
| 10209 | codigoDeBarras = String.valueOf(parte1 +"."+ parte2); | 10210 | codigoDeBarras = String.valueOf(parte1 +"."+ parte2); |
| 10210 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ | 10211 | }else if(articulo.getBalanza()==8 && articulo.getCantidad()!= -1.0 && articulo.getDecimales()==3){ |
| 10211 | codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); | 10212 | codigoDeBarras = String.valueOf(articulo.getCodigos_barras()); |
| 10212 | } | 10213 | } |
| 10213 | 10214 | ||
| 10214 | 10215 | ||
| 10215 | } | 10216 | } |
| 10216 | 10217 | ||
| 10217 | if(articulo.getBalanza()==8){ | 10218 | if(articulo.getBalanza()==8){ |
| 10218 | descBarra = articulo.getCodigos_barras_completo_string(); | 10219 | descBarra = articulo.getCodigos_barras_completo_string(); |
| 10219 | System.out.println("::: BaseDatos 2351 Cargando cb si es 8 " + descBarra); | 10220 | System.out.println("::: BaseDatos 2351 Cargando cb si es 8 " + descBarra); |
| 10220 | }else{ | 10221 | }else{ |
| 10221 | 10222 | ||
| 10222 | descBarra = String.valueOf(articulo.getCodigos_barras().get(0)); | 10223 | descBarra = String.valueOf(articulo.getCodigos_barras().get(0)); |
| 10223 | //descBarra = String.valueOf(articulo.getCodigos_barras()); | 10224 | //descBarra = String.valueOf(articulo.getCodigos_barras()); |
| 10224 | System.out.println("::: BaseDatos 2355 Cargando cb si no es 8 " + descBarra); | 10225 | System.out.println("::: BaseDatos 2355 Cargando cb si no es 8 " + descBarra); |
| 10225 | } | 10226 | } |
| 10226 | 10227 | ||
| 10227 | nuevoRegistro.put( | 10228 | nuevoRegistro.put( |
| 10228 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10229 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10229 | articulo.getCodigos_barras_string()); | 10230 | articulo.getCodigos_barras_string()); |
| 10230 | nuevoRegistro.put( | 10231 | nuevoRegistro.put( |
| 10231 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 10232 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 10232 | articulo.getCodigos_barras_string()); | 10233 | articulo.getCodigos_barras_string()); |
| 10233 | nuevoRegistro.put( | 10234 | nuevoRegistro.put( |
| 10234 | ParametrosInventario.bal_bdd_articulo_inventario, | 10235 | ParametrosInventario.bal_bdd_articulo_inventario, |
| 10235 | articulo.getInventario()); | 10236 | articulo.getInventario()); |
| 10236 | nuevoRegistro.put( | 10237 | nuevoRegistro.put( |
| 10237 | ParametrosInventario.bal_bdd_articulo_descripcion, | 10238 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10238 | articulo.getDescripcion()); | 10239 | articulo.getDescripcion()); |
| 10239 | nuevoRegistro.put( | 10240 | nuevoRegistro.put( |
| 10240 | ParametrosInventario.bal_bdd_articulo_precio_venta, | 10241 | ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10241 | articulo.getPrecio_venta()); | 10242 | articulo.getPrecio_venta()); |
| 10242 | nuevoRegistro.put( | 10243 | nuevoRegistro.put( |
| 10243 | ParametrosInventario.bal_bdd_articulo_precio_costo, | 10244 | ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10244 | articulo.getPrecio_costo()); | 10245 | articulo.getPrecio_costo()); |
| 10245 | /*Damian*/ | 10246 | /*Damian*/ |
| 10246 | nuevoRegistro.put( | 10247 | nuevoRegistro.put( |
| 10247 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10248 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10248 | articulo.getExis_venta()); | 10249 | articulo.getExis_venta()); |
| 10249 | nuevoRegistro.put( | 10250 | nuevoRegistro.put( |
| 10250 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10251 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10251 | articulo.getExis_deposito()); | 10252 | articulo.getExis_deposito()); |
| 10252 | 10253 | ||
| 10253 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10254 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10254 | articulo.getFoto()); | 10255 | articulo.getFoto()); |
| 10255 | // nuevoRegistro.put( | 10256 | // nuevoRegistro.put( |
| 10256 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 10257 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10257 | // articulo.getCantidad()); | 10258 | // articulo.getCantidad()); |
| 10258 | // | 10259 | // |
| 10259 | 10260 | ||
| 10260 | System.out.println("::: BaseDatos 2301 pudo pasar"); | 10261 | System.out.println("::: BaseDatos 2301 pudo pasar"); |
| 10261 | if(articulo.getCodigos_barras_completo().isEmpty()){ | 10262 | if(articulo.getCodigos_barras_completo().isEmpty()){ |
| 10262 | 10263 | ||
| 10263 | obtenerPesaje = String.valueOf(articulo.getCantidad()); | 10264 | obtenerPesaje = String.valueOf(articulo.getCantidad()); |
| 10264 | 10265 | ||
| 10265 | }else{ | 10266 | }else{ |
| 10266 | 10267 | ||
| 10267 | if(articulo.getBalanza()==8){ | 10268 | if(articulo.getBalanza()==8){ |
| 10268 | obtenerPesaje = articulo.getCodigos_barras_completo().get(0).substring(7,12); | 10269 | obtenerPesaje = articulo.getCodigos_barras_completo().get(0).substring(7,12); |
| 10269 | }else{ | 10270 | }else{ |
| 10270 | obtenerPesaje = String.valueOf(articulo.getCantidad()); | 10271 | obtenerPesaje = String.valueOf(articulo.getCantidad()); |
| 10271 | } | 10272 | } |
| 10272 | 10273 | ||
| 10273 | } | 10274 | } |
| 10274 | 10275 | ||
| 10275 | nuevoRegistro.put( | 10276 | nuevoRegistro.put( |
| 10276 | ParametrosInventario.bal_bdd_articulo_pesaje, | 10277 | ParametrosInventario.bal_bdd_articulo_pesaje, |
| 10277 | obtenerPesaje); | 10278 | obtenerPesaje); |
| 10278 | nuevoRegistro.put( | 10279 | nuevoRegistro.put( |
| 10279 | ParametrosInventario.bal_bdd_articulo_cantidad, | 10280 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10280 | codigoDeBarras); | 10281 | codigoDeBarras); |
| 10281 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, | 10282 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, |
| 10282 | articulo.getBalanza()); | 10283 | articulo.getBalanza()); |
| 10283 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, | 10284 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, |
| 10284 | articulo.getDecimales()); | 10285 | articulo.getDecimales()); |
| 10285 | 10286 | ||
| 10286 | nuevoRegistro.put( | 10287 | nuevoRegistro.put( |
| 10287 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10288 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10288 | articulo.getFechaInicio()); | 10289 | articulo.getFechaInicio()); |
| 10289 | 10290 | ||
| 10290 | // 4 Insertamos el registro en la base de datos | 10291 | // 4 Insertamos el registro en la base de datos |
| 10291 | long resultado = dtb.insert(tabla_articulos_nombre, null, | 10292 | long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10292 | nuevoRegistro); | 10293 | nuevoRegistro); |
| 10293 | 10294 | ||
| 10294 | // Test resultado INSERT: | 10295 | // Test resultado INSERT: |
| 10295 | if (resultado < 0) { | 10296 | if (resultado < 0) { |
| 10296 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10297 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10297 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10298 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10298 | } | 10299 | } |
| 10299 | }else{ | 10300 | }else{ |
| 10300 | 10301 | ||
| 10301 | System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); | 10302 | System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); |
| 10302 | // Si hemos abierto correctamente la base de datos | 10303 | // Si hemos abierto correctamente la base de datos |
| 10303 | if (dtb != null) { | 10304 | if (dtb != null) { |
| 10304 | System.out.println("::: BD 2271 NO "); | 10305 | System.out.println("::: BD 2271 NO "); |
| 10305 | // 3 Creamos el registro a insertar como objeto ContentValues | 10306 | // 3 Creamos el registro a insertar como objeto ContentValues |
| 10306 | ContentValues nuevoRegistro = new ContentValues(); | 10307 | ContentValues nuevoRegistro = new ContentValues(); |
| 10307 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10308 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10308 | articulo.getSector()); | 10309 | articulo.getSector()); |
| 10309 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10310 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10310 | articulo.getCodigo()); | 10311 | articulo.getCodigo()); |
| 10311 | nuevoRegistro.put( | 10312 | nuevoRegistro.put( |
| 10312 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10313 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10313 | articulo.getCodigos_barras_string()); | 10314 | articulo.getCodigos_barras_string()); |
| 10314 | nuevoRegistro.put( | 10315 | nuevoRegistro.put( |
| 10315 | ParametrosInventario.bal_bdd_articulo_inventario, | 10316 | ParametrosInventario.bal_bdd_articulo_inventario, |
| 10316 | articulo.getInventario()); | 10317 | articulo.getInventario()); |
| 10317 | nuevoRegistro.put( | 10318 | nuevoRegistro.put( |
| 10318 | ParametrosInventario.bal_bdd_articulo_descripcion, | 10319 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10319 | articulo.getDescripcion()); | 10320 | articulo.getDescripcion()); |
| 10320 | nuevoRegistro.put( | 10321 | nuevoRegistro.put( |
| 10321 | ParametrosInventario.bal_bdd_articulo_precio_venta, | 10322 | ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10322 | articulo.getPrecio_venta()); | 10323 | articulo.getPrecio_venta()); |
| 10323 | nuevoRegistro.put( | 10324 | nuevoRegistro.put( |
| 10324 | ParametrosInventario.bal_bdd_articulo_precio_costo, | 10325 | ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10325 | articulo.getPrecio_costo()); | 10326 | articulo.getPrecio_costo()); |
| 10326 | /*Damian*/ | 10327 | /*Damian*/ |
| 10327 | nuevoRegistro.put( | 10328 | nuevoRegistro.put( |
| 10328 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10329 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10329 | articulo.getExis_venta()); | 10330 | articulo.getExis_venta()); |
| 10330 | nuevoRegistro.put( | 10331 | nuevoRegistro.put( |
| 10331 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10332 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10332 | articulo.getExis_deposito()); | 10333 | articulo.getExis_deposito()); |
| 10333 | nuevoRegistro.put( | 10334 | nuevoRegistro.put( |
| 10334 | ParametrosInventario.bal_bdd_articulo_depsn, | 10335 | ParametrosInventario.bal_bdd_articulo_depsn, |
| 10335 | articulo.getDepsn()); | 10336 | articulo.getDepsn()); |
| 10336 | 10337 | ||
| 10337 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10338 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10338 | articulo.getFoto()); | 10339 | articulo.getFoto()); |
| 10339 | nuevoRegistro.put( | 10340 | nuevoRegistro.put( |
| 10340 | ParametrosInventario.bal_bdd_articulo_cantidad, | 10341 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10341 | articulo.getCantidad()); | 10342 | articulo.getCantidad()); |
| 10342 | 10343 | ||
| 10343 | 10344 | ||
| 10344 | nuevoRegistro.put( | 10345 | nuevoRegistro.put( |
| 10345 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10346 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10346 | articulo.getFechaInicio()); | 10347 | articulo.getFechaInicio()); |
| 10347 | 10348 | ||
| 10348 | // 4 Insertamos el registro en la base de datos | 10349 | // 4 Insertamos el registro en la base de datos |
| 10349 | long resultado = dtb.insert(tabla_articulos_nombre, null, | 10350 | long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10350 | nuevoRegistro); | 10351 | nuevoRegistro); |
| 10351 | 10352 | ||
| 10352 | // Test resultado INSERT: | 10353 | // Test resultado INSERT: |
| 10353 | if (resultado < 0) { | 10354 | if (resultado < 0) { |
| 10354 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10355 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10355 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10356 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10356 | } | 10357 | } |
| 10357 | 10358 | ||
| 10358 | } else { | 10359 | } else { |
| 10359 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10360 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10360 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10361 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10361 | } | 10362 | } |
| 10362 | // System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); | 10363 | // System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); |
| 10363 | // dtb.close(); | 10364 | // dtb.close(); |
| 10364 | // return; | 10365 | // return; |
| 10365 | } | 10366 | } |
| 10366 | 10367 | ||
| 10367 | dtb.close(); | 10368 | dtb.close(); |
| 10368 | return; | 10369 | return; |
| 10369 | 10370 | ||
| 10370 | } | 10371 | } |
| 10371 | 10372 | ||
| 10372 | }else{ | 10373 | }else{ |
| 10373 | 10374 | ||
| 10374 | if (ParametrosInventario.InventariosVentas == true) { | 10375 | if (ParametrosInventario.InventariosVentas == true) { |
| 10375 | 10376 | ||
| 10376 | int valorDepo = articulo.getDepsn(); | 10377 | int valorDepo = articulo.getDepsn(); |
| 10377 | System.out.println("::::: BD 2186 en ventas valor depsn " + valorDepo); | 10378 | System.out.println("::::: BD 2186 en ventas valor depsn " + valorDepo); |
| 10378 | 10379 | ||
| 10379 | System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); | 10380 | System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); |
| 10380 | // 2 Sino, abrimos la base de datos en modo escritura | 10381 | // 2 Sino, abrimos la base de datos en modo escritura |
| 10381 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 10382 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 10382 | 10383 | ||
| 10383 | // Si hemos abierto correctamente la base de datos | 10384 | // Si hemos abierto correctamente la base de datos |
| 10384 | if (dtb != null) { | 10385 | if (dtb != null) { |
| 10385 | System.out.println("::: BD 2139 ACA ENTRA SI ABRIO BIEN LA DB"); | 10386 | System.out.println("::: BD 2139 ACA ENTRA SI ABRIO BIEN LA DB"); |
| 10386 | // 3 Creamos el registro a insertar como objeto ContentValues | 10387 | // 3 Creamos el registro a insertar como objeto ContentValues |
| 10387 | ContentValues nuevoRegistro = new ContentValues(); | 10388 | ContentValues nuevoRegistro = new ContentValues(); |
| 10388 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10389 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10389 | articulo.getSector()); | 10390 | articulo.getSector()); |
| 10390 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10391 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10391 | articulo.getCodigo()); | 10392 | articulo.getCodigo()); |
| 10392 | nuevoRegistro.put( | 10393 | nuevoRegistro.put( |
| 10393 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10394 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10394 | articulo.getCodigos_barras_string()); | 10395 | articulo.getCodigos_barras_string()); |
| 10395 | nuevoRegistro.put( | 10396 | nuevoRegistro.put( |
| 10396 | ParametrosInventario.bal_bdd_articulo_inventario, | 10397 | ParametrosInventario.bal_bdd_articulo_inventario, |
| 10397 | articulo.getInventario()); | 10398 | articulo.getInventario()); |
| 10398 | nuevoRegistro.put( | 10399 | nuevoRegistro.put( |
| 10399 | ParametrosInventario.bal_bdd_articulo_descripcion, | 10400 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10400 | articulo.getDescripcion()); | 10401 | articulo.getDescripcion()); |
| 10401 | nuevoRegistro.put( | 10402 | nuevoRegistro.put( |
| 10402 | ParametrosInventario.bal_bdd_articulo_precio_venta, | 10403 | ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10403 | articulo.getPrecio_venta()); | 10404 | articulo.getPrecio_venta()); |
| 10404 | nuevoRegistro.put( | 10405 | nuevoRegistro.put( |
| 10405 | ParametrosInventario.bal_bdd_articulo_precio_costo, | 10406 | ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10406 | articulo.getPrecio_costo()); | 10407 | articulo.getPrecio_costo()); |
| 10407 | /*Damian*/ | 10408 | /*Damian*/ |
| 10408 | nuevoRegistro.put( | 10409 | nuevoRegistro.put( |
| 10409 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10410 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10410 | articulo.getExis_venta()); | 10411 | articulo.getExis_venta()); |
| 10411 | nuevoRegistro.put( | 10412 | nuevoRegistro.put( |
| 10412 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10413 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10413 | articulo.getExis_deposito()); | 10414 | articulo.getExis_deposito()); |
| 10414 | 10415 | ||
| 10415 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10416 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10416 | articulo.getFoto()); | 10417 | articulo.getFoto()); |
| 10417 | nuevoRegistro.put( | 10418 | nuevoRegistro.put( |
| 10418 | ParametrosInventario.bal_bdd_articulo_cantidad, | 10419 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10419 | articulo.getCantidad()); | 10420 | articulo.getCantidad()); |
| 10420 | 10421 | ||
| 10421 | 10422 | ||
| 10422 | nuevoRegistro.put( | 10423 | nuevoRegistro.put( |
| 10423 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10424 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10424 | articulo.getFechaInicio()); | 10425 | articulo.getFechaInicio()); |
| 10425 | 10426 | ||
| 10426 | // 4 Insertamos el registro en la base de datos | 10427 | // 4 Insertamos el registro en la base de datos |
| 10427 | long resultado = dtb.insert(tabla_articulos_nombre, null, | 10428 | long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10428 | nuevoRegistro); | 10429 | nuevoRegistro); |
| 10429 | 10430 | ||
| 10430 | // Test resultado INSERT: | 10431 | // Test resultado INSERT: |
| 10431 | if (resultado < 0) { | 10432 | if (resultado < 0) { |
| 10432 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10433 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10433 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10434 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10434 | } | 10435 | } |
| 10435 | 10436 | ||
| 10436 | } else { | 10437 | } else { |
| 10437 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10438 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10438 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10439 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10439 | } | 10440 | } |
| 10440 | 10441 | ||
| 10441 | }else { | 10442 | }else { |
| 10442 | 10443 | ||
| 10443 | // 2 Sino, abrimos la base de datos en modo escritura | 10444 | // 2 Sino, abrimos la base de datos en modo escritura |
| 10444 | // SQLiteDatabase dtb = this.getWritableDatabase(); | 10445 | // SQLiteDatabase dtb = this.getWritableDatabase(); |
| 10445 | 10446 | ||
| 10446 | int valorDepo = articulo.getDepsn(); | 10447 | int valorDepo = articulo.getDepsn(); |
| 10447 | System.out.println("::::: BD 2209 valor depsn " + valorDepo); | 10448 | System.out.println("::::: BD 2209 valor depsn " + valorDepo); |
| 10448 | 10449 | ||
| 10449 | if(valorDepo == 1){ | 10450 | if(valorDepo == 1){ |
| 10450 | System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION"); | 10451 | System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION"); |
| 10451 | // Si hemos abierto correctamente la base de datos | 10452 | // Si hemos abierto correctamente la base de datos |
| 10452 | if (dtb != null) { | 10453 | if (dtb != null) { |
| 10453 | System.out.println("::: BD 2271 NO "); | 10454 | System.out.println("::: BD 2271 NO "); |
| 10454 | // 3 Creamos el registro a insertar como objeto ContentValues | 10455 | // 3 Creamos el registro a insertar como objeto ContentValues |
| 10455 | ContentValues nuevoRegistro = new ContentValues(); | 10456 | ContentValues nuevoRegistro = new ContentValues(); |
| 10456 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10457 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10457 | articulo.getSector()); | 10458 | articulo.getSector()); |
| 10458 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10459 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10459 | articulo.getCodigo()); | 10460 | articulo.getCodigo()); |
| 10460 | nuevoRegistro.put( | 10461 | nuevoRegistro.put( |
| 10461 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10462 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10462 | articulo.getCodigos_barras_string()); | 10463 | articulo.getCodigos_barras_string()); |
| 10463 | nuevoRegistro.put( | 10464 | nuevoRegistro.put( |
| 10464 | ParametrosInventario.bal_bdd_articulo_inventario, | 10465 | ParametrosInventario.bal_bdd_articulo_inventario, |
| 10465 | articulo.getInventario()); | 10466 | articulo.getInventario()); |
| 10466 | nuevoRegistro.put( | 10467 | nuevoRegistro.put( |
| 10467 | ParametrosInventario.bal_bdd_articulo_descripcion, | 10468 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10468 | articulo.getDescripcion()); | 10469 | articulo.getDescripcion()); |
| 10469 | nuevoRegistro.put( | 10470 | nuevoRegistro.put( |
| 10470 | ParametrosInventario.bal_bdd_articulo_precio_venta, | 10471 | ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10471 | articulo.getPrecio_venta()); | 10472 | articulo.getPrecio_venta()); |
| 10472 | nuevoRegistro.put( | 10473 | nuevoRegistro.put( |
| 10473 | ParametrosInventario.bal_bdd_articulo_precio_costo, | 10474 | ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10474 | articulo.getPrecio_costo()); | 10475 | articulo.getPrecio_costo()); |
| 10475 | /*Damian*/ | 10476 | /*Damian*/ |
| 10476 | nuevoRegistro.put( | 10477 | nuevoRegistro.put( |
| 10477 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10478 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10478 | articulo.getExis_venta()); | 10479 | articulo.getExis_venta()); |
| 10479 | nuevoRegistro.put( | 10480 | nuevoRegistro.put( |
| 10480 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10481 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10481 | articulo.getExis_deposito()); | 10482 | articulo.getExis_deposito()); |
| 10482 | nuevoRegistro.put( | 10483 | nuevoRegistro.put( |
| 10483 | ParametrosInventario.bal_bdd_articulo_depsn, | 10484 | ParametrosInventario.bal_bdd_articulo_depsn, |
| 10484 | articulo.getDepsn()); | 10485 | articulo.getDepsn()); |
| 10485 | 10486 | ||
| 10486 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10487 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10487 | articulo.getFoto()); | 10488 | articulo.getFoto()); |
| 10488 | nuevoRegistro.put( | 10489 | nuevoRegistro.put( |
| 10489 | ParametrosInventario.bal_bdd_articulo_cantidad, | 10490 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10490 | articulo.getCantidad()); | 10491 | articulo.getCantidad()); |
| 10491 | 10492 | ||
| 10492 | nuevoRegistro.put( | 10493 | nuevoRegistro.put( |
| 10493 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10494 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10494 | articulo.getFechaInicio()); | 10495 | articulo.getFechaInicio()); |
| 10495 | 10496 | ||
| 10496 | // 4 Insertamos el registro en la base de datos | 10497 | // 4 Insertamos el registro en la base de datos |
| 10497 | long resultado = dtb.insert(tabla_articulos_nombre, null, | 10498 | long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10498 | nuevoRegistro); | 10499 | nuevoRegistro); |
| 10499 | 10500 | ||
| 10500 | // Test resultado INSERT: | 10501 | // Test resultado INSERT: |
| 10501 | if (resultado < 0) { | 10502 | if (resultado < 0) { |
| 10502 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10503 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10503 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10504 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10504 | } | 10505 | } |
| 10505 | 10506 | ||
| 10506 | } else { | 10507 | } else { |
| 10507 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10508 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10508 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10509 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10509 | } | 10510 | } |
| 10510 | }else{ | 10511 | }else{ |
| 10511 | 10512 | ||
| 10512 | System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); | 10513 | System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); |
| 10513 | // Si hemos abierto correctamente la base de datos | 10514 | // Si hemos abierto correctamente la base de datos |
| 10514 | if (dtb != null) { | 10515 | if (dtb != null) { |
| 10515 | System.out.println("::: BD 2271 NO "); | 10516 | System.out.println("::: BD 2271 NO "); |
| 10516 | // 3 Creamos el registro a insertar como objeto ContentValues | 10517 | // 3 Creamos el registro a insertar como objeto ContentValues |
| 10517 | ContentValues nuevoRegistro = new ContentValues(); | 10518 | ContentValues nuevoRegistro = new ContentValues(); |
| 10518 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10519 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10519 | articulo.getSector()); | 10520 | articulo.getSector()); |
| 10520 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10521 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10521 | articulo.getCodigo()); | 10522 | articulo.getCodigo()); |
| 10522 | nuevoRegistro.put( | 10523 | nuevoRegistro.put( |
| 10523 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10524 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10524 | articulo.getCodigos_barras_string()); | 10525 | articulo.getCodigos_barras_string()); |
| 10525 | nuevoRegistro.put( | 10526 | nuevoRegistro.put( |
| 10526 | ParametrosInventario.bal_bdd_articulo_inventario, | 10527 | ParametrosInventario.bal_bdd_articulo_inventario, |
| 10527 | articulo.getInventario()); | 10528 | articulo.getInventario()); |
| 10528 | nuevoRegistro.put( | 10529 | nuevoRegistro.put( |
| 10529 | ParametrosInventario.bal_bdd_articulo_descripcion, | 10530 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10530 | articulo.getDescripcion()); | 10531 | articulo.getDescripcion()); |
| 10531 | nuevoRegistro.put( | 10532 | nuevoRegistro.put( |
| 10532 | ParametrosInventario.bal_bdd_articulo_precio_venta, | 10533 | ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10533 | articulo.getPrecio_venta()); | 10534 | articulo.getPrecio_venta()); |
| 10534 | nuevoRegistro.put( | 10535 | nuevoRegistro.put( |
| 10535 | ParametrosInventario.bal_bdd_articulo_precio_costo, | 10536 | ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10536 | articulo.getPrecio_costo()); | 10537 | articulo.getPrecio_costo()); |
| 10537 | /*Damian*/ | 10538 | /*Damian*/ |
| 10538 | nuevoRegistro.put( | 10539 | nuevoRegistro.put( |
| 10539 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10540 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10540 | articulo.getExis_venta()); | 10541 | articulo.getExis_venta()); |
| 10541 | nuevoRegistro.put( | 10542 | nuevoRegistro.put( |
| 10542 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10543 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10543 | articulo.getExis_deposito()); | 10544 | articulo.getExis_deposito()); |
| 10544 | nuevoRegistro.put( | 10545 | nuevoRegistro.put( |
| 10545 | ParametrosInventario.bal_bdd_articulo_depsn, | 10546 | ParametrosInventario.bal_bdd_articulo_depsn, |
| 10546 | articulo.getDepsn()); | 10547 | articulo.getDepsn()); |
| 10547 | 10548 | ||
| 10548 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10549 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10549 | articulo.getFoto()); | 10550 | articulo.getFoto()); |
| 10550 | nuevoRegistro.put( | 10551 | nuevoRegistro.put( |
| 10551 | ParametrosInventario.bal_bdd_articulo_cantidad, | 10552 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10552 | articulo.getCantidad()); | 10553 | articulo.getCantidad()); |
| 10553 | 10554 | ||
| 10554 | 10555 | ||
| 10555 | nuevoRegistro.put( | 10556 | nuevoRegistro.put( |
| 10556 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10557 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10557 | articulo.getFechaInicio()); | 10558 | articulo.getFechaInicio()); |
| 10558 | 10559 | ||
| 10559 | // 4 Insertamos el registro en la base de datos | 10560 | // 4 Insertamos el registro en la base de datos |
| 10560 | long resultado = dtb.insert(tabla_articulos_nombre, null, | 10561 | long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10561 | nuevoRegistro); | 10562 | nuevoRegistro); |
| 10562 | 10563 | ||
| 10563 | // Test resultado INSERT: | 10564 | // Test resultado INSERT: |
| 10564 | if (resultado < 0) { | 10565 | if (resultado < 0) { |
| 10565 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10566 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10566 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10567 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10567 | } | 10568 | } |
| 10568 | 10569 | ||
| 10569 | } else { | 10570 | } else { |
| 10570 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10571 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10571 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10572 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10572 | } | 10573 | } |
| 10573 | // System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); | 10574 | // System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); |
| 10574 | // dtb.close(); | 10575 | // dtb.close(); |
| 10575 | // return; | 10576 | // return; |
| 10576 | } | 10577 | } |
| 10577 | 10578 | ||
| 10578 | dtb.close(); | 10579 | dtb.close(); |
| 10579 | return; | 10580 | return; |
| 10580 | 10581 | ||
| 10581 | 10582 | ||
| 10582 | } | 10583 | } |
| 10583 | 10584 | ||
| 10584 | 10585 | ||
| 10585 | 10586 | ||
| 10586 | 10587 | ||
| 10587 | 10588 | ||
| 10588 | } | 10589 | } |
| 10589 | 10590 | ||
| 10590 | 10591 | ||
| 10591 | // if (ParametrosInventario.InventariosVentas == true) { | 10592 | // if (ParametrosInventario.InventariosVentas == true) { |
| 10592 | // | 10593 | // |
| 10593 | // int valorDepo = articulo.getDepsn(); | 10594 | // int valorDepo = articulo.getDepsn(); |
| 10594 | // System.out.println("::::: BD 2186 en ventas valor depsn " + valorDepo); | 10595 | // System.out.println("::::: BD 2186 en ventas valor depsn " + valorDepo); |
| 10595 | // | 10596 | // |
| 10596 | // System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); | 10597 | // System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); |
| 10597 | // // 2 Sino, abrimos la base de datos en modo escritura | 10598 | // // 2 Sino, abrimos la base de datos en modo escritura |
| 10598 | //// SQLiteDatabase dtb = this.getWritableDatabase(); | 10599 | //// SQLiteDatabase dtb = this.getWritableDatabase(); |
| 10599 | // | 10600 | // |
| 10600 | // // Si hemos abierto correctamente la base de datos | 10601 | // // Si hemos abierto correctamente la base de datos |
| 10601 | // if (dtb != null) { | 10602 | // if (dtb != null) { |
| 10602 | // System.out.println("::: BD 2139 ACA ENTRA SI ABRIO BIEN LA DB"); | 10603 | // System.out.println("::: BD 2139 ACA ENTRA SI ABRIO BIEN LA DB"); |
| 10603 | // // 3 Creamos el registro a insertar como objeto ContentValues | 10604 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 10604 | // ContentValues nuevoRegistro = new ContentValues(); | 10605 | // ContentValues nuevoRegistro = new ContentValues(); |
| 10605 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10606 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10606 | // articulo.getSector()); | 10607 | // articulo.getSector()); |
| 10607 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10608 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10608 | // articulo.getCodigo()); | 10609 | // articulo.getCodigo()); |
| 10609 | // nuevoRegistro.put( | 10610 | // nuevoRegistro.put( |
| 10610 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10611 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10611 | // articulo.getCodigos_barras_string()); | 10612 | // articulo.getCodigos_barras_string()); |
| 10612 | // nuevoRegistro.put( | 10613 | // nuevoRegistro.put( |
| 10613 | // ParametrosInventario.bal_bdd_articulo_inventario, | 10614 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 10614 | // articulo.getInventario()); | 10615 | // articulo.getInventario()); |
| 10615 | // nuevoRegistro.put( | 10616 | // nuevoRegistro.put( |
| 10616 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 10617 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10617 | // articulo.getDescripcion()); | 10618 | // articulo.getDescripcion()); |
| 10618 | // nuevoRegistro.put( | 10619 | // nuevoRegistro.put( |
| 10619 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 10620 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10620 | // articulo.getPrecio_venta()); | 10621 | // articulo.getPrecio_venta()); |
| 10621 | // nuevoRegistro.put( | 10622 | // nuevoRegistro.put( |
| 10622 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 10623 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10623 | // articulo.getPrecio_costo()); | 10624 | // articulo.getPrecio_costo()); |
| 10624 | // /*Damian*/ | 10625 | // /*Damian*/ |
| 10625 | // nuevoRegistro.put( | 10626 | // nuevoRegistro.put( |
| 10626 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10627 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10627 | // articulo.getExis_venta()); | 10628 | // articulo.getExis_venta()); |
| 10628 | // nuevoRegistro.put( | 10629 | // nuevoRegistro.put( |
| 10629 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10630 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10630 | // articulo.getExis_deposito()); | 10631 | // articulo.getExis_deposito()); |
| 10631 | // | 10632 | // |
| 10632 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10633 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10633 | // articulo.getFoto()); | 10634 | // articulo.getFoto()); |
| 10634 | // nuevoRegistro.put( | 10635 | // nuevoRegistro.put( |
| 10635 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 10636 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10636 | // articulo.getCantidad()); | 10637 | // articulo.getCantidad()); |
| 10637 | // | 10638 | // |
| 10638 | // | 10639 | // |
| 10639 | // nuevoRegistro.put( | 10640 | // nuevoRegistro.put( |
| 10640 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10641 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10641 | // articulo.getFechaInicio()); | 10642 | // articulo.getFechaInicio()); |
| 10642 | // | 10643 | // |
| 10643 | // // 4 Insertamos el registro en la base de datos | 10644 | // // 4 Insertamos el registro en la base de datos |
| 10644 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 10645 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10645 | // nuevoRegistro); | 10646 | // nuevoRegistro); |
| 10646 | // | 10647 | // |
| 10647 | // // Test resultado INSERT: | 10648 | // // Test resultado INSERT: |
| 10648 | // if (resultado < 0) { | 10649 | // if (resultado < 0) { |
| 10649 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10650 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10650 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 10651 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10651 | // } | 10652 | // } |
| 10652 | // | 10653 | // |
| 10653 | // } else { | 10654 | // } else { |
| 10654 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10655 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10655 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 10656 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10656 | // } | 10657 | // } |
| 10657 | // | 10658 | // |
| 10658 | // | 10659 | // |
| 10659 | // | 10660 | // |
| 10660 | // | 10661 | // |
| 10661 | // }else{ | 10662 | // }else{ |
| 10662 | // | 10663 | // |
| 10663 | // // 2 Sino, abrimos la base de datos en modo escritura | 10664 | // // 2 Sino, abrimos la base de datos en modo escritura |
| 10664 | //// SQLiteDatabase dtb = this.getWritableDatabase(); | 10665 | //// SQLiteDatabase dtb = this.getWritableDatabase(); |
| 10665 | // | 10666 | // |
| 10666 | // int valorDepo = articulo.getDepsn(); | 10667 | // int valorDepo = articulo.getDepsn(); |
| 10667 | // System.out.println("::::: BD 2209 valor depsn " + valorDepo); | 10668 | // System.out.println("::::: BD 2209 valor depsn " + valorDepo); |
| 10668 | // | 10669 | // |
| 10669 | // | 10670 | // |
| 10670 | // | 10671 | // |
| 10671 | // if(valorDepo == 1){ | 10672 | // if(valorDepo == 1){ |
| 10672 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION"); | 10673 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION"); |
| 10673 | // // Si hemos abierto correctamente la base de datos | 10674 | // // Si hemos abierto correctamente la base de datos |
| 10674 | // if (dtb != null) { | 10675 | // if (dtb != null) { |
| 10675 | // System.out.println("::: BD 2271 NO "); | 10676 | // System.out.println("::: BD 2271 NO "); |
| 10676 | // // 3 Creamos el registro a insertar como objeto ContentValues | 10677 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 10677 | // ContentValues nuevoRegistro = new ContentValues(); | 10678 | // ContentValues nuevoRegistro = new ContentValues(); |
| 10678 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10679 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10679 | // articulo.getSector()); | 10680 | // articulo.getSector()); |
| 10680 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10681 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10681 | // articulo.getCodigo()); | 10682 | // articulo.getCodigo()); |
| 10682 | // nuevoRegistro.put( | 10683 | // nuevoRegistro.put( |
| 10683 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10684 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10684 | // articulo.getCodigos_barras_string()); | 10685 | // articulo.getCodigos_barras_string()); |
| 10685 | // nuevoRegistro.put( | 10686 | // nuevoRegistro.put( |
| 10686 | // ParametrosInventario.bal_bdd_articulo_inventario, | 10687 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 10687 | // articulo.getInventario()); | 10688 | // articulo.getInventario()); |
| 10688 | // nuevoRegistro.put( | 10689 | // nuevoRegistro.put( |
| 10689 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 10690 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10690 | // articulo.getDescripcion()); | 10691 | // articulo.getDescripcion()); |
| 10691 | // nuevoRegistro.put( | 10692 | // nuevoRegistro.put( |
| 10692 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 10693 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10693 | // articulo.getPrecio_venta()); | 10694 | // articulo.getPrecio_venta()); |
| 10694 | // nuevoRegistro.put( | 10695 | // nuevoRegistro.put( |
| 10695 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 10696 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10696 | // articulo.getPrecio_costo()); | 10697 | // articulo.getPrecio_costo()); |
| 10697 | // /*Damian*/ | 10698 | // /*Damian*/ |
| 10698 | // nuevoRegistro.put( | 10699 | // nuevoRegistro.put( |
| 10699 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10700 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10700 | // articulo.getExis_venta()); | 10701 | // articulo.getExis_venta()); |
| 10701 | // nuevoRegistro.put( | 10702 | // nuevoRegistro.put( |
| 10702 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10703 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10703 | // articulo.getExis_deposito()); | 10704 | // articulo.getExis_deposito()); |
| 10704 | // nuevoRegistro.put( | 10705 | // nuevoRegistro.put( |
| 10705 | // ParametrosInventario.bal_bdd_articulo_depsn, | 10706 | // ParametrosInventario.bal_bdd_articulo_depsn, |
| 10706 | // articulo.getDepsn()); | 10707 | // articulo.getDepsn()); |
| 10707 | // | 10708 | // |
| 10708 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10709 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10709 | // articulo.getFoto()); | 10710 | // articulo.getFoto()); |
| 10710 | // nuevoRegistro.put( | 10711 | // nuevoRegistro.put( |
| 10711 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 10712 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10712 | // articulo.getCantidad()); | 10713 | // articulo.getCantidad()); |
| 10713 | // | 10714 | // |
| 10714 | // | 10715 | // |
| 10715 | // nuevoRegistro.put( | 10716 | // nuevoRegistro.put( |
| 10716 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10717 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10717 | // articulo.getFechaInicio()); | 10718 | // articulo.getFechaInicio()); |
| 10718 | // | 10719 | // |
| 10719 | // // 4 Insertamos el registro en la base de datos | 10720 | // // 4 Insertamos el registro en la base de datos |
| 10720 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 10721 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10721 | // nuevoRegistro); | 10722 | // nuevoRegistro); |
| 10722 | // | 10723 | // |
| 10723 | // // Test resultado INSERT: | 10724 | // // Test resultado INSERT: |
| 10724 | // if (resultado < 0) { | 10725 | // if (resultado < 0) { |
| 10725 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10726 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10726 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 10727 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10727 | // } | 10728 | // } |
| 10728 | // | 10729 | // |
| 10729 | // } else { | 10730 | // } else { |
| 10730 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10731 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10731 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 10732 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10732 | // } | 10733 | // } |
| 10733 | // }else{ | 10734 | // }else{ |
| 10734 | // | 10735 | // |
| 10735 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); | 10736 | // System.out.println("::: BD 2271 NO TIENE QUE ENTRAR CONDICION PERO ENTROOOOOOOOOOOOOOOOOOO"); |
| 10736 | // // Si hemos abierto correctamente la base de datos | 10737 | // // Si hemos abierto correctamente la base de datos |
| 10737 | // if (dtb != null) { | 10738 | // if (dtb != null) { |
| 10738 | // System.out.println("::: BD 2271 NO "); | 10739 | // System.out.println("::: BD 2271 NO "); |
| 10739 | // // 3 Creamos el registro a insertar como objeto ContentValues | 10740 | // // 3 Creamos el registro a insertar como objeto ContentValues |
| 10740 | // ContentValues nuevoRegistro = new ContentValues(); | 10741 | // ContentValues nuevoRegistro = new ContentValues(); |
| 10741 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10742 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10742 | // articulo.getSector()); | 10743 | // articulo.getSector()); |
| 10743 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10744 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10744 | // articulo.getCodigo()); | 10745 | // articulo.getCodigo()); |
| 10745 | // nuevoRegistro.put( | 10746 | // nuevoRegistro.put( |
| 10746 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10747 | // ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10747 | // articulo.getCodigos_barras_string()); | 10748 | // articulo.getCodigos_barras_string()); |
| 10748 | // nuevoRegistro.put( | 10749 | // nuevoRegistro.put( |
| 10749 | // ParametrosInventario.bal_bdd_articulo_inventario, | 10750 | // ParametrosInventario.bal_bdd_articulo_inventario, |
| 10750 | // articulo.getInventario()); | 10751 | // articulo.getInventario()); |
| 10751 | // nuevoRegistro.put( | 10752 | // nuevoRegistro.put( |
| 10752 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 10753 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10753 | // articulo.getDescripcion()); | 10754 | // articulo.getDescripcion()); |
| 10754 | // nuevoRegistro.put( | 10755 | // nuevoRegistro.put( |
| 10755 | // ParametrosInventario.bal_bdd_articulo_precio_venta, | 10756 | // ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10756 | // articulo.getPrecio_venta()); | 10757 | // articulo.getPrecio_venta()); |
| 10757 | // nuevoRegistro.put( | 10758 | // nuevoRegistro.put( |
| 10758 | // ParametrosInventario.bal_bdd_articulo_precio_costo, | 10759 | // ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10759 | // articulo.getPrecio_costo()); | 10760 | // articulo.getPrecio_costo()); |
| 10760 | // /*Damian*/ | 10761 | // /*Damian*/ |
| 10761 | // nuevoRegistro.put( | 10762 | // nuevoRegistro.put( |
| 10762 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10763 | // ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10763 | // articulo.getExis_venta()); | 10764 | // articulo.getExis_venta()); |
| 10764 | // nuevoRegistro.put( | 10765 | // nuevoRegistro.put( |
| 10765 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10766 | // ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10766 | // articulo.getExis_deposito()); | 10767 | // articulo.getExis_deposito()); |
| 10767 | // nuevoRegistro.put( | 10768 | // nuevoRegistro.put( |
| 10768 | // ParametrosInventario.bal_bdd_articulo_depsn, | 10769 | // ParametrosInventario.bal_bdd_articulo_depsn, |
| 10769 | // articulo.getDepsn()); | 10770 | // articulo.getDepsn()); |
| 10770 | // | 10771 | // |
| 10771 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10772 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10772 | // articulo.getFoto()); | 10773 | // articulo.getFoto()); |
| 10773 | // nuevoRegistro.put( | 10774 | // nuevoRegistro.put( |
| 10774 | // ParametrosInventario.bal_bdd_articulo_cantidad, | 10775 | // ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10775 | // articulo.getCantidad()); | 10776 | // articulo.getCantidad()); |
| 10776 | // | 10777 | // |
| 10777 | // | 10778 | // |
| 10778 | // nuevoRegistro.put( | 10779 | // nuevoRegistro.put( |
| 10779 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10780 | // ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10780 | // articulo.getFechaInicio()); | 10781 | // articulo.getFechaInicio()); |
| 10781 | // | 10782 | // |
| 10782 | // // 4 Insertamos el registro en la base de datos | 10783 | // // 4 Insertamos el registro en la base de datos |
| 10783 | // long resultado = dtb.insert(tabla_articulos_nombre, null, | 10784 | // long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10784 | // nuevoRegistro); | 10785 | // nuevoRegistro); |
| 10785 | // | 10786 | // |
| 10786 | // // Test resultado INSERT: | 10787 | // // Test resultado INSERT: |
| 10787 | // if (resultado < 0) { | 10788 | // if (resultado < 0) { |
| 10788 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10789 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10789 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 10790 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10790 | // } | 10791 | // } |
| 10791 | // | 10792 | // |
| 10792 | // } else { | 10793 | // } else { |
| 10793 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10794 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10794 | // "Imposible agregar el articulo nuevo a la Base De Datos"); | 10795 | // "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10795 | // } | 10796 | // } |
| 10796 | //// System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); | 10797 | //// System.out.println("::: BD 2271 NO TIENE QUE GUARDAR"); |
| 10797 | //// dtb.close(); | 10798 | //// dtb.close(); |
| 10798 | //// return; | 10799 | //// return; |
| 10799 | // } | 10800 | // } |
| 10800 | // | 10801 | // |
| 10801 | // dtb.close(); | 10802 | // dtb.close(); |
| 10802 | // return; | 10803 | // return; |
| 10803 | // | 10804 | // |
| 10804 | // //////////////////////////////////////// | 10805 | // //////////////////////////////////////// |
| 10805 | // } | 10806 | // } |
| 10806 | 10807 | ||
| 10807 | // 5 Cierre: | 10808 | // 5 Cierre: |
| 10808 | dtb.close(); | 10809 | dtb.close(); |
| 10809 | 10810 | ||
| 10810 | return; | 10811 | return; |
| 10811 | } catch (Exception e) { | 10812 | } catch (Exception e) { |
| 10812 | 10813 | ||
| 10813 | GestorLogEventos log = new GestorLogEventos(); | 10814 | GestorLogEventos log = new GestorLogEventos(); |
| 10814 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 10815 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 10815 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 10816 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 10816 | log.log("[-- 1688 --]" + e.toString(), 4); | 10817 | log.log("[-- 1688 --]" + e.toString(), 4); |
| 10817 | 10818 | ||
| 10818 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10819 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10819 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10820 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10820 | } | 10821 | } |
| 10821 | 10822 | ||
| 10822 | } | 10823 | } |
| 10823 | 10824 | ||
| 10824 | public void insertProveedorEnBdd(Proveedor proveedor) throws ExceptionBDD { | 10825 | public void insertProveedorEnBdd(Proveedor proveedor) throws ExceptionBDD { |
| 10825 | try { | 10826 | try { |
| 10826 | System.out.println("::: BD 2119 Insert proveedor con cb"); | 10827 | System.out.println("::: BD 2119 Insert proveedor con cb"); |
| 10827 | if (selectProveedorConCodigos(proveedor.getCodigo()) != null) // Si | 10828 | if (selectProveedorConCodigos(proveedor.getCodigo()) != null) // Si |
| 10828 | // existe... | 10829 | // existe... |
| 10829 | { | 10830 | { |
| 10830 | // 1.1 Si la entrada ya existe, actualizamos los datos: | 10831 | // 1.1 Si la entrada ya existe, actualizamos los datos: |
| 10831 | updateProveedor(proveedor); | 10832 | updateProveedor(proveedor); |
| 10832 | return; | 10833 | return; |
| 10833 | } | 10834 | } |
| 10834 | SQLiteDatabase dtb = this.getWritableDatabase(); | 10835 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 10835 | 10836 | ||
| 10836 | System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); | 10837 | System.out.println("::: BD 2139 ACA ENTRA SI ES VENTAS TRUE"); |
| 10837 | if (dtb != null) { | 10838 | if (dtb != null) { |
| 10838 | // 3 Creamos el registro a insertar como objeto ContentValues | 10839 | // 3 Creamos el registro a insertar como objeto ContentValues |
| 10839 | ContentValues nuevoRegistro = new ContentValues(); | 10840 | ContentValues nuevoRegistro = new ContentValues(); |
| 10840 | nuevoRegistro.put(ParametrosInventario.bal_bdd_proveedores_codigo, | 10841 | nuevoRegistro.put(ParametrosInventario.bal_bdd_proveedores_codigo, |
| 10841 | proveedor.getCodigo()); | 10842 | proveedor.getCodigo()); |
| 10842 | //nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10843 | //nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10843 | // articulo.getCodigo()); | 10844 | // articulo.getCodigo()); |
| 10844 | //String codigo_a_modificar = ""; | 10845 | //String codigo_a_modificar = ""; |
| 10845 | //String cod1; | 10846 | //String cod1; |
| 10846 | String codigo; | 10847 | String codigo; |
| 10847 | 10848 | ||
| 10848 | nuevoRegistro.put( | 10849 | nuevoRegistro.put( |
| 10849 | ParametrosInventario.bal_bdd_proveedores_codigo, | 10850 | ParametrosInventario.bal_bdd_proveedores_codigo, |
| 10850 | proveedor.getCodigo()); | 10851 | proveedor.getCodigo()); |
| 10851 | // nuevoRegistro.put( | 10852 | // nuevoRegistro.put( |
| 10852 | // ParametrosInventario.bal_bdd_articulo_descripcion, | 10853 | // ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10853 | // articulo.getDescripcion()); | 10854 | // articulo.getDescripcion()); |
| 10854 | 10855 | ||
| 10855 | // 4 Insertamos el registro en la base de datos | 10856 | // 4 Insertamos el registro en la base de datos |
| 10856 | long resultado = dtb.insert(tabla_proveedores_nombre, null, | 10857 | long resultado = dtb.insert(tabla_proveedores_nombre, null, |
| 10857 | nuevoRegistro); | 10858 | nuevoRegistro); |
| 10858 | 10859 | ||
| 10859 | // Test resultado INSERT: | 10860 | // Test resultado INSERT: |
| 10860 | if (resultado < 0) { | 10861 | if (resultado < 0) { |
| 10861 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10862 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10862 | "Imposible agregar el proveedor nuevo a la Base De Datos"); | 10863 | "Imposible agregar el proveedor nuevo a la Base De Datos"); |
| 10863 | } | 10864 | } |
| 10864 | 10865 | ||
| 10865 | } else { | 10866 | } else { |
| 10866 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10867 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10867 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10868 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10868 | } | 10869 | } |
| 10869 | 10870 | ||
| 10870 | // 5 Cierre: | 10871 | // 5 Cierre: |
| 10871 | dtb.close(); | 10872 | dtb.close(); |
| 10872 | return; | 10873 | return; |
| 10873 | } catch (Exception e) { | 10874 | } catch (Exception e) { |
| 10874 | GestorLogEventos log = new GestorLogEventos(); | 10875 | GestorLogEventos log = new GestorLogEventos(); |
| 10875 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 10876 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 10876 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 10877 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 10877 | log.log("[-- 1688 --]" + e.toString(), 4); | 10878 | log.log("[-- 1688 --]" + e.toString(), 4); |
| 10878 | 10879 | ||
| 10879 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10880 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10880 | "Imposible agregar el proveedor nuevo a la Base De Datos"); | 10881 | "Imposible agregar el proveedor nuevo a la Base De Datos"); |
| 10881 | } | 10882 | } |
| 10882 | } | 10883 | } |
| 10883 | 10884 | ||
| 10884 | public void insertArticuloEnBdd_conFechaFin(Articulo articulo) throws ExceptionBDD { | 10885 | public void insertArticuloEnBdd_conFechaFin(Articulo articulo) throws ExceptionBDD { |
| 10885 | try { | 10886 | try { |
| 10886 | System.out.println("::: BaseDatos 2435 insertArticuloEnBdd_conFechaFin"); | 10887 | System.out.println("::: BaseDatos 2435 insertArticuloEnBdd_conFechaFin"); |
| 10887 | // 1 Test de la preexistencia de la entrada: | 10888 | // 1 Test de la preexistencia de la entrada: |
| 10888 | 10889 | ||
| 10889 | if (selectArticuloConCodigos(articulo.getSector(), | 10890 | if (selectArticuloConCodigos(articulo.getSector(), |
| 10890 | articulo.getCodigo(), articulo.getInventario()) != null) | 10891 | articulo.getCodigo(), articulo.getInventario()) != null) |
| 10891 | // Si | 10892 | // Si |
| 10892 | // existe... | 10893 | // existe... |
| 10893 | { | 10894 | { |
| 10894 | // 1.1 Si la entrada ya existe, actualizamos los datos: | 10895 | // 1.1 Si la entrada ya existe, actualizamos los datos: |
| 10895 | System.out.println("::: BaseDatos 2435 insertArticuloEnBdd existe"); | 10896 | System.out.println("::: BaseDatos 2435 insertArticuloEnBdd existe"); |
| 10896 | 10897 | ||
| 10897 | updateArticulo(articulo); | 10898 | updateArticulo(articulo); |
| 10898 | return; | 10899 | return; |
| 10899 | } | 10900 | } |
| 10900 | System.out.println("::: BaseDatos 2435 insertArticuloEnBdd NO EXISTE"); | 10901 | System.out.println("::: BaseDatos 2435 insertArticuloEnBdd NO EXISTE"); |
| 10901 | 10902 | ||
| 10902 | // 2 Sino, abrimos la base de datos en modo escritura | 10903 | // 2 Sino, abrimos la base de datos en modo escritura |
| 10903 | SQLiteDatabase dtb = this.getWritableDatabase(); | 10904 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 10904 | 10905 | ||
| 10905 | // Si hemos abierto correctamente la base de datos | 10906 | // Si hemos abierto correctamente la base de datos |
| 10906 | if (dtb != null) { | 10907 | if (dtb != null) { |
| 10907 | // 3 Creamos el registro a insertar como objeto ContentValues | 10908 | // 3 Creamos el registro a insertar como objeto ContentValues |
| 10908 | ContentValues nuevoRegistro = new ContentValues(); | 10909 | ContentValues nuevoRegistro = new ContentValues(); |
| 10909 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, | 10910 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_sector, |
| 10910 | articulo.getSector()); | 10911 | articulo.getSector()); |
| 10911 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, | 10912 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 10912 | articulo.getCodigo()); | 10913 | articulo.getCodigo()); |
| 10913 | nuevoRegistro.put( | 10914 | nuevoRegistro.put( |
| 10914 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 10915 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 10915 | articulo.getCodigos_barras_string()); | 10916 | articulo.getCodigos_barras_string()); |
| 10916 | nuevoRegistro.put( | 10917 | nuevoRegistro.put( |
| 10917 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, | 10918 | ParametrosInventario.bal_bdd_articulo_codigo_barra_completo, |
| 10918 | articulo.getCodigos_barras_completo_string()); | 10919 | articulo.getCodigos_barras_completo_string()); |
| 10919 | nuevoRegistro.put( | 10920 | nuevoRegistro.put( |
| 10920 | ParametrosInventario.bal_bdd_articulo_inventario, | 10921 | ParametrosInventario.bal_bdd_articulo_inventario, |
| 10921 | articulo.getInventario()); | 10922 | articulo.getInventario()); |
| 10922 | nuevoRegistro.put( | 10923 | nuevoRegistro.put( |
| 10923 | ParametrosInventario.bal_bdd_articulo_descripcion, | 10924 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 10924 | articulo.getDescripcion()); | 10925 | articulo.getDescripcion()); |
| 10925 | nuevoRegistro.put( | 10926 | nuevoRegistro.put( |
| 10926 | ParametrosInventario.bal_bdd_articulo_precio_venta, | 10927 | ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 10927 | articulo.getPrecio_venta()); | 10928 | articulo.getPrecio_venta()); |
| 10928 | nuevoRegistro.put( | 10929 | nuevoRegistro.put( |
| 10929 | ParametrosInventario.bal_bdd_articulo_precio_costo, | 10930 | ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 10930 | articulo.getPrecio_costo()); | 10931 | articulo.getPrecio_costo()); |
| 10931 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 10932 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 10932 | articulo.getFoto()); | 10933 | articulo.getFoto()); |
| 10933 | nuevoRegistro.put( | 10934 | nuevoRegistro.put( |
| 10934 | ParametrosInventario.bal_bdd_articulo_cantidad, | 10935 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 10935 | articulo.getCantidad()); | 10936 | articulo.getCantidad()); |
| 10936 | /*Damian*/ | 10937 | /*Damian*/ |
| 10937 | nuevoRegistro.put( | 10938 | nuevoRegistro.put( |
| 10938 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 10939 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 10939 | articulo.getExis_venta()); | 10940 | articulo.getExis_venta()); |
| 10940 | nuevoRegistro.put( | 10941 | nuevoRegistro.put( |
| 10941 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 10942 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 10942 | articulo.getExis_deposito()); | 10943 | articulo.getExis_deposito()); |
| 10943 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, | 10944 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_balanza, |
| 10944 | articulo.getBalanza()); | 10945 | articulo.getBalanza()); |
| 10945 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, | 10946 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_decimales, |
| 10946 | articulo.getDecimales()); | 10947 | articulo.getDecimales()); |
| 10947 | nuevoRegistro.put( | 10948 | nuevoRegistro.put( |
| 10948 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 10949 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 10949 | articulo.getFechaInicio()); | 10950 | articulo.getFechaInicio()); |
| 10950 | nuevoRegistro.put( | 10951 | nuevoRegistro.put( |
| 10951 | ParametrosInventario.bal_bdd_articulo_fechaFin, | 10952 | ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 10952 | articulo.getFechaFin()); | 10953 | articulo.getFechaFin()); |
| 10953 | System.out.println("::: BaseDatos articulo.getCodigo() " + articulo.getCodigo()); | 10954 | System.out.println("::: BaseDatos articulo.getCodigo() " + articulo.getCodigo()); |
| 10954 | // 4 Insertamos el registro en la base de datos | 10955 | // 4 Insertamos el registro en la base de datos |
| 10955 | long resultado = dtb.insert(tabla_articulos_nombre, null, | 10956 | long resultado = dtb.insert(tabla_articulos_nombre, null, |
| 10956 | nuevoRegistro); | 10957 | nuevoRegistro); |
| 10957 | 10958 | ||
| 10958 | // Test resultado INSERT: | 10959 | // Test resultado INSERT: |
| 10959 | if (resultado < 0) { | 10960 | if (resultado < 0) { |
| 10960 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10961 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10961 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10962 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10962 | } | 10963 | } |
| 10963 | 10964 | ||
| 10964 | } else { | 10965 | } else { |
| 10965 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10966 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10966 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10967 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10967 | } | 10968 | } |
| 10968 | 10969 | ||
| 10969 | // 5 Cierre: | 10970 | // 5 Cierre: |
| 10970 | dtb.close(); | 10971 | dtb.close(); |
| 10971 | 10972 | ||
| 10972 | return; | 10973 | return; |
| 10973 | } catch (Exception e) { | 10974 | } catch (Exception e) { |
| 10974 | 10975 | ||
| 10975 | GestorLogEventos log = new GestorLogEventos(); | 10976 | GestorLogEventos log = new GestorLogEventos(); |
| 10976 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 10977 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 10977 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 10978 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 10978 | log.log("[-- 1688 --]" + e.toString(), 4); | 10979 | log.log("[-- 1688 --]" + e.toString(), 4); |
| 10979 | 10980 | ||
| 10980 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 10981 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 10981 | "Imposible agregar el articulo nuevo a la Base De Datos"); | 10982 | "Imposible agregar el articulo nuevo a la Base De Datos"); |
| 10982 | } | 10983 | } |
| 10983 | 10984 | ||
| 10984 | } | 10985 | } |
| 10985 | 10986 | ||
| 10986 | /** | 10987 | /** |
| 10987 | * Agrega un articulo a las referencias | 10988 | * Agrega un articulo a las referencias |
| 10988 | * <p> | 10989 | * <p> |
| 10989 | * 1 Abrimos la base de datos en modo escritura | 10990 | * 1 Abrimos la base de datos en modo escritura |
| 10990 | * <p> | 10991 | * <p> |
| 10991 | * 2 Creamos el registro a insertar como objeto ContentValues | 10992 | * 2 Creamos el registro a insertar como objeto ContentValues |
| 10992 | * <p> | 10993 | * <p> |
| 10993 | * 3 Insertamos el registro en la base de datos | 10994 | * 3 Insertamos el registro en la base de datos |
| 10994 | * <p> | 10995 | * <p> |
| 10995 | * 4 Cierre | 10996 | * 4 Cierre |
| 10996 | * | 10997 | * |
| 10997 | * @param referencia | 10998 | * @param referencia |
| 10998 | * @throws ExceptionBDD | 10999 | * @throws ExceptionBDD |
| 10999 | */ | 11000 | */ |
| 11000 | public void insertReferenciaEnBdd(Articulo referencia) throws ExceptionBDD { | 11001 | public void insertReferenciaEnBdd(Articulo referencia) throws ExceptionBDD { |
| 11001 | try { | 11002 | try { |
| 11002 | System.out.println("::: BaseDatos 2541 insertReferenciaEnBdd"); | 11003 | System.out.println("::: BaseDatos 2541 insertReferenciaEnBdd"); |
| 11003 | // Test de la preexistencia de la entrada: | 11004 | // Test de la preexistencia de la entrada: |
| 11004 | // Si la entrada ya existe, actualizamos los datos: | 11005 | // Si la entrada ya existe, actualizamos los datos: |
| 11005 | // No deberia ser necesario por que se supone que es un articulo | 11006 | // No deberia ser necesario por que se supone que es un articulo |
| 11006 | // nuevo | 11007 | // nuevo |
| 11007 | // if (selectArticuloConCodigos(referencia.getSector(), | 11008 | // if (selectArticuloConCodigos(referencia.getSector(), |
| 11008 | // referencia.getCodigo(), referencia.getInventario()) != null) // | 11009 | // referencia.getCodigo(), referencia.getInventario()) != null) // |
| 11009 | // Si existe... | 11010 | // Si existe... |
| 11010 | // { | 11011 | // { |
| 11011 | // updateArticulo(referencia); | 11012 | // updateArticulo(referencia); |
| 11012 | // return; | 11013 | // return; |
| 11013 | // } | 11014 | // } |
| 11014 | 11015 | ||
| 11015 | // 1 Abrimos la base de datos en modo escritura | 11016 | // 1 Abrimos la base de datos en modo escritura |
| 11016 | SQLiteDatabase dtb = this.getWritableDatabase(); | 11017 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 11017 | 11018 | ||
| 11018 | // Si hemos abierto correctamente la base de datos | 11019 | // Si hemos abierto correctamente la base de datos |
| 11019 | if (dtb != null) { | 11020 | if (dtb != null) { |
| 11020 | // 2 Creamos el registro a insertar como objeto ContentValues | 11021 | // 2 Creamos el registro a insertar como objeto ContentValues |
| 11021 | ContentValues nuevoRegistro = new ContentValues(); | 11022 | ContentValues nuevoRegistro = new ContentValues(); |
| 11022 | nuevoRegistro.put( | 11023 | nuevoRegistro.put( |
| 11023 | ParametrosInventario.bal_bdd_referencia_sector, | 11024 | ParametrosInventario.bal_bdd_referencia_sector, |
| 11024 | referencia.getSector()); | 11025 | referencia.getSector()); |
| 11025 | nuevoRegistro.put( | 11026 | nuevoRegistro.put( |
| 11026 | ParametrosInventario.bal_bdd_referencia_codigo, | 11027 | ParametrosInventario.bal_bdd_referencia_codigo, |
| 11027 | referencia.getCodigo()); | 11028 | referencia.getCodigo()); |
| 11028 | nuevoRegistro.put( | 11029 | nuevoRegistro.put( |
| 11029 | ParametrosInventario.bal_bdd_referencia_balanza, | 11030 | ParametrosInventario.bal_bdd_referencia_balanza, |
| 11030 | referencia.getBalanza()); | 11031 | referencia.getBalanza()); |
| 11031 | nuevoRegistro.put( | 11032 | nuevoRegistro.put( |
| 11032 | ParametrosInventario.bal_bdd_referencia_decimales, | 11033 | ParametrosInventario.bal_bdd_referencia_decimales, |
| 11033 | referencia.getDecimales()); | 11034 | referencia.getDecimales()); |
| 11034 | /*Damian*/ | 11035 | /*Damian*/ |
| 11035 | nuevoRegistro.put( | 11036 | nuevoRegistro.put( |
| 11036 | ParametrosInventario.bal_bdd_referencia_existencia_venta, | 11037 | ParametrosInventario.bal_bdd_referencia_existencia_venta, |
| 11037 | referencia.getExis_venta()); | 11038 | referencia.getExis_venta()); |
| 11038 | nuevoRegistro.put( | 11039 | nuevoRegistro.put( |
| 11039 | ParametrosInventario.bal_bdd_referencia_existencia_deposito, | 11040 | ParametrosInventario.bal_bdd_referencia_existencia_deposito, |
| 11040 | referencia.getExis_deposito()); | 11041 | referencia.getExis_deposito()); |
| 11041 | 11042 | ||
| 11042 | /*21/11 Se agrega para que cuando se agrega un articulo que no existe en la base, le agregue al codigo de barras el mismo | 11043 | /*21/11 Se agrega para que cuando se agrega un articulo que no existe en la base, le agregue al codigo de barras el mismo |
| 11043 | * numero que de codigo y sector, para que al guardar un segundo articulo o mas que no esten en la base, no se produsca error o conflicto | 11044 | * numero que de codigo y sector, para que al guardar un segundo articulo o mas que no esten en la base, no se produsca error o conflicto |
| 11044 | * en la tabla por uno o mas codigos de barras vacios y se genere problemas de primera key.*/ | 11045 | * en la tabla por uno o mas codigos de barras vacios y se genere problemas de primera key.*/ |
| 11045 | if(referencia.getSector()<=-1 && referencia.getCodigo()<=-1 && referencia.getCodigos_barras_string()==""){ | 11046 | if(referencia.getSector()<=-1 && referencia.getCodigo()<=-1 && referencia.getCodigos_barras_string()==""){ |
| 11046 | nuevoRegistro.put( | 11047 | nuevoRegistro.put( |
| 11047 | ParametrosInventario.bal_bdd_referencia_codigo_barra, | 11048 | ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 11048 | referencia.getCodigo()); | 11049 | referencia.getCodigo()); |
| 11049 | }else{ | 11050 | }else{ |
| 11050 | nuevoRegistro.put( | 11051 | nuevoRegistro.put( |
| 11051 | ParametrosInventario.bal_bdd_referencia_codigo_barra, | 11052 | ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 11052 | referencia.getCodigos_barras_string()); | 11053 | referencia.getCodigos_barras_string()); |
| 11053 | } | 11054 | } |
| 11054 | 11055 | ||
| 11055 | /*nuevoRegistro.put( | 11056 | /*nuevoRegistro.put( |
| 11056 | ParametrosInventario.bal_bdd_referencia_codigo_barra, | 11057 | ParametrosInventario.bal_bdd_referencia_codigo_barra, |
| 11057 | referencia.getCodigos_barras_string()); | 11058 | referencia.getCodigos_barras_string()); |
| 11058 | */ | 11059 | */ |
| 11059 | 11060 | ||
| 11060 | nuevoRegistro.put( | 11061 | nuevoRegistro.put( |
| 11061 | ParametrosInventario.bal_bdd_referencia_descripcion, | 11062 | ParametrosInventario.bal_bdd_referencia_descripcion, |
| 11062 | referencia.getDescripcion()); | 11063 | referencia.getDescripcion()); |
| 11063 | nuevoRegistro.put( | 11064 | nuevoRegistro.put( |
| 11064 | ParametrosInventario.bal_bdd_referencia_precio_venta, | 11065 | ParametrosInventario.bal_bdd_referencia_precio_venta, |
| 11065 | referencia.getPrecio_venta()); | 11066 | referencia.getPrecio_venta()); |
| 11066 | nuevoRegistro.put( | 11067 | nuevoRegistro.put( |
| 11067 | ParametrosInventario.bal_bdd_referencia_precio_costo, | 11068 | ParametrosInventario.bal_bdd_referencia_precio_costo, |
| 11068 | referencia.getPrecio_costo()); | 11069 | referencia.getPrecio_costo()); |
| 11069 | nuevoRegistro.put(ParametrosInventario.bal_bdd_referencia_foto, | 11070 | nuevoRegistro.put(ParametrosInventario.bal_bdd_referencia_foto, |
| 11070 | referencia.getFoto()); | 11071 | referencia.getFoto()); |
| 11071 | 11072 | ||
| 11072 | // 3 Insertamos el registro en la base de datos | 11073 | // 3 Insertamos el registro en la base de datos |
| 11073 | long resultado = dtb.insert(tabla_referencias_nombre, null, | 11074 | long resultado = dtb.insert(tabla_referencias_nombre, null, |
| 11074 | nuevoRegistro); | 11075 | nuevoRegistro); |
| 11075 | 11076 | ||
| 11076 | // Test resultado INSERT: | 11077 | // Test resultado INSERT: |
| 11077 | if (resultado < 0) { | 11078 | if (resultado < 0) { |
| 11078 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11079 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11079 | "Imposible agregar el referencia nuevo a la Base De Datos"); | 11080 | "Imposible agregar el referencia nuevo a la Base De Datos"); |
| 11080 | } | 11081 | } |
| 11081 | 11082 | ||
| 11082 | } else { | 11083 | } else { |
| 11083 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11084 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11084 | "Imposible agregar el referencia nuevo a la Base De Datos"); | 11085 | "Imposible agregar el referencia nuevo a la Base De Datos"); |
| 11085 | } | 11086 | } |
| 11086 | 11087 | ||
| 11087 | // 4 Cierre: | 11088 | // 4 Cierre: |
| 11088 | dtb.close(); | 11089 | dtb.close(); |
| 11089 | 11090 | ||
| 11090 | return; | 11091 | return; |
| 11091 | } catch (Exception e) { | 11092 | } catch (Exception e) { |
| 11092 | 11093 | ||
| 11093 | GestorLogEventos log = new GestorLogEventos(); | 11094 | GestorLogEventos log = new GestorLogEventos(); |
| 11094 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11095 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11095 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11096 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11096 | log.log("[-- 1775 --]" + e.toString(), 4); | 11097 | log.log("[-- 1775 --]" + e.toString(), 4); |
| 11097 | 11098 | ||
| 11098 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11099 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11099 | "Imposible agregar el referencia nuevo a la Base De Datos"); | 11100 | "Imposible agregar el referencia nuevo a la Base De Datos"); |
| 11100 | } | 11101 | } |
| 11101 | } | 11102 | } |
| 11102 | 11103 | ||
| 11103 | /** | 11104 | /** |
| 11104 | * Inserta un articulo nuevo en la BD (genera el sec-cod) | 11105 | * Inserta un articulo nuevo en la BD (genera el sec-cod) |
| 11105 | * <p> | 11106 | * <p> |
| 11106 | * 1 Buscamos nueva clave primaria {sector;codigo} | 11107 | * 1 Buscamos nueva clave primaria {sector;codigo} |
| 11107 | * <p> | 11108 | * <p> |
| 11108 | * 2 La seteamos al nuevo articulo | 11109 | * 2 La seteamos al nuevo articulo |
| 11109 | * <p> | 11110 | * <p> |
| 11110 | * 3 Lo insertamos en la BD | 11111 | * 3 Lo insertamos en la BD |
| 11111 | * | 11112 | * |
| 11112 | * @param articulo | 11113 | * @param articulo |
| 11113 | * @throws ExceptionBDD | 11114 | * @throws ExceptionBDD |
| 11114 | */ | 11115 | */ |
| 11115 | public void insertArticuloNuevoEnBdd(Articulo articulo) throws ExceptionBDD { | 11116 | public void insertArticuloNuevoEnBdd(Articulo articulo) throws ExceptionBDD { |
| 11116 | System.out.println("::: BaseDatos 2634 insertArticuloNuevoEnBdd"); | 11117 | System.out.println("::: BaseDatos 2634 insertArticuloNuevoEnBdd"); |
| 11117 | // 1 Buscamos nueva clave primaria {sector;codigo} | 11118 | // 1 Buscamos nueva clave primaria {sector;codigo} |
| 11118 | SQLiteDatabase dtb = this.getReadableDatabase(); | 11119 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 11119 | 11120 | ||
| 11120 | // En el caso de articulos nuevos creados por el usuario, el CODIGO ser | 11121 | // En el caso de articulos nuevos creados por el usuario, el CODIGO ser |
| 11121 | // negativo. | 11122 | // negativo. |
| 11122 | // Buscamos el ms negativo de todos: | 11123 | // Buscamos el ms negativo de todos: |
| 11123 | String seleccion[] = new String[] { ParametrosInventario.bal_bdd_articulo_codigo }; | 11124 | String seleccion[] = new String[] { ParametrosInventario.bal_bdd_articulo_codigo }; |
| 11124 | Cursor c = dtb.query(tabla_articulos_nombre, seleccion, null, null, | 11125 | Cursor c = dtb.query(tabla_articulos_nombre, seleccion, null, null, |
| 11125 | null, null, ParametrosInventario.bal_bdd_articulo_codigo | 11126 | null, null, ParametrosInventario.bal_bdd_articulo_codigo |
| 11126 | + " ASC", "1"); | 11127 | + " ASC", "1"); |
| 11127 | 11128 | ||
| 11128 | int nuevoIndice = -1; | 11129 | int nuevoIndice = -1; |
| 11129 | 11130 | ||
| 11130 | if (c.moveToFirst() == true) { | 11131 | if (c.moveToFirst() == true) { |
| 11131 | 11132 | ||
| 11132 | nuevoIndice = Math.min(-1, c.getInt(0) - 1); | 11133 | nuevoIndice = Math.min(-1, c.getInt(0) - 1); |
| 11133 | } | 11134 | } |
| 11134 | 11135 | ||
| 11135 | // Cierre: | 11136 | // Cierre: |
| 11136 | dtb.close(); | 11137 | dtb.close(); |
| 11137 | // 2 La seteamos al nuevo articulo | 11138 | // 2 La seteamos al nuevo articulo |
| 11138 | articulo.setCodigo(nuevoIndice); | 11139 | articulo.setCodigo(nuevoIndice); |
| 11139 | articulo.setSector(nuevoIndice); | 11140 | articulo.setSector(nuevoIndice); |
| 11140 | 11141 | ||
| 11141 | // 3 Lo insertamos en la BD | 11142 | // 3 Lo insertamos en la BD |
| 11142 | insertArticuloEnBdd(articulo); | 11143 | insertArticuloEnBdd(articulo); |
| 11143 | return; | 11144 | return; |
| 11144 | } | 11145 | } |
| 11145 | 11146 | ||
| 11146 | /** | 11147 | /** |
| 11147 | * Inserta una referencia nueva en la tabla (genera su sec-cod) | 11148 | * Inserta una referencia nueva en la tabla (genera su sec-cod) |
| 11148 | * <p> | 11149 | * <p> |
| 11149 | * 1 Buscamos nueva clave primaria {sector;codigo} | 11150 | * 1 Buscamos nueva clave primaria {sector;codigo} |
| 11150 | * <p> | 11151 | * <p> |
| 11151 | * 2 Seteamos los valores de la nueva clave | 11152 | * 2 Seteamos los valores de la nueva clave |
| 11152 | * <p> | 11153 | * <p> |
| 11153 | * 3 Insertamos en la BD | 11154 | * 3 Insertamos en la BD |
| 11154 | * | 11155 | * |
| 11155 | * @param referencia | 11156 | * @param referencia |
| 11156 | * @throws ExceptionBDD | 11157 | * @throws ExceptionBDD |
| 11157 | */ | 11158 | */ |
| 11158 | public void insertReferenciaNuevaEnBdd(Articulo referencia) | 11159 | public void insertReferenciaNuevaEnBdd(Articulo referencia) |
| 11159 | throws ExceptionBDD { | 11160 | throws ExceptionBDD { |
| 11160 | System.out.println("::: BD INSERT REFERENCIA"); | 11161 | System.out.println("::: BD INSERT REFERENCIA"); |
| 11161 | SQLiteDatabase dtb = this.getReadableDatabase(); | 11162 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 11162 | 11163 | ||
| 11163 | // 1 Buscamos nueva clave primaria {sector;codigo} | 11164 | // 1 Buscamos nueva clave primaria {sector;codigo} |
| 11164 | // En el caso de articulos nuevos creados por el usuario, el CODIGO ser | 11165 | // En el caso de articulos nuevos creados por el usuario, el CODIGO ser |
| 11165 | // negativo. | 11166 | // negativo. |
| 11166 | // Buscamos el ms negativo de todos: | 11167 | // Buscamos el ms negativo de todos: |
| 11167 | String seleccion[] = new String[] { ParametrosInventario.bal_bdd_referencia_codigo }; | 11168 | String seleccion[] = new String[] { ParametrosInventario.bal_bdd_referencia_codigo }; |
| 11168 | Cursor c = dtb.query(tabla_referencias_nombre, seleccion, null, null, | 11169 | Cursor c = dtb.query(tabla_referencias_nombre, seleccion, null, null, |
| 11169 | null, null, ParametrosInventario.bal_bdd_referencia_codigo | 11170 | null, null, ParametrosInventario.bal_bdd_referencia_codigo |
| 11170 | + " ASC", "1"); | 11171 | + " ASC", "1"); |
| 11171 | 11172 | ||
| 11172 | int nuevoIndice = -1; | 11173 | int nuevoIndice = -1; |
| 11173 | 11174 | ||
| 11174 | if (c.moveToFirst() == true) { | 11175 | if (c.moveToFirst() == true) { |
| 11175 | 11176 | ||
| 11176 | System.out.println("::: BaseDatos 3960 nuevoIndice " + nuevoIndice); | 11177 | System.out.println("::: BaseDatos 3960 nuevoIndice " + nuevoIndice); |
| 11177 | System.out.println("::: BaseDatos 3960 c.getInt(0) " + c.getInt(0)); | 11178 | System.out.println("::: BaseDatos 3960 c.getInt(0) " + c.getInt(0)); |
| 11178 | 11179 | ||
| 11179 | nuevoIndice = Math.min(-1, c.getInt(0) - 1); | 11180 | nuevoIndice = Math.min(-1, c.getInt(0) - 1); |
| 11180 | 11181 | ||
| 11181 | System.out.println("::: BaseDatos 3966 nuevoIndice despues del math " + nuevoIndice); | 11182 | System.out.println("::: BaseDatos 3966 nuevoIndice despues del math " + nuevoIndice); |
| 11182 | } | 11183 | } |
| 11183 | 11184 | ||
| 11184 | // Cierre: | 11185 | // Cierre: |
| 11185 | dtb.close(); | 11186 | dtb.close(); |
| 11186 | 11187 | ||
| 11187 | // 2 Seteamos los valores de la nueva clave | 11188 | // 2 Seteamos los valores de la nueva clave |
| 11188 | referencia.setCodigo(nuevoIndice); | 11189 | referencia.setCodigo(nuevoIndice); |
| 11189 | referencia.setSector(nuevoIndice); | 11190 | referencia.setSector(nuevoIndice); |
| 11190 | 11191 | ||
| 11191 | // 3 Insertamos en la BD | 11192 | // 3 Insertamos en la BD |
| 11192 | insertReferenciaEnBdd(referencia); | 11193 | insertReferenciaEnBdd(referencia); |
| 11193 | return; | 11194 | return; |
| 11194 | 11195 | ||
| 11195 | } | 11196 | } |
| 11196 | 11197 | ||
| 11197 | /** | 11198 | /** |
| 11198 | * Ejecuta las sentencias sql de la lista | 11199 | * Ejecuta las sentencias sql de la lista |
| 11199 | * <p> | 11200 | * <p> |
| 11200 | * 1 Abrimos la base de datos en modo escritura | 11201 | * 1 Abrimos la base de datos en modo escritura |
| 11201 | * <p> | 11202 | * <p> |
| 11202 | * 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" | 11203 | * 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" |
| 11203 | * <p> | 11204 | * <p> |
| 11204 | * 3 Cierre | 11205 | * 3 Cierre |
| 11205 | * | 11206 | * |
| 11206 | * @param listaSQL | 11207 | * @param listaSQL |
| 11207 | * @throws ExceptionBDD | 11208 | * @throws ExceptionBDD |
| 11208 | */ | 11209 | */ |
| 11209 | public void insertReferenciasConSQLEnBdd(ArrayList<String> listaSQL) | 11210 | public void insertReferenciasConSQLEnBdd(ArrayList<String> listaSQL) |
| 11210 | throws ExceptionBDD { | 11211 | throws ExceptionBDD { |
| 11211 | try { | 11212 | try { |
| 11212 | System.out.println("::: BaseDatos 2725 insertReferenciasConSQLEnBdd"); | 11213 | System.out.println("::: BaseDatos 2725 insertReferenciasConSQLEnBdd"); |
| 11213 | // 1 Abrimos la base de datos en modo escritura | 11214 | // 1 Abrimos la base de datos en modo escritura |
| 11214 | SQLiteDatabase dtb = this.getWritableDatabase(); | 11215 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 11215 | 11216 | ||
| 11216 | // Si hemos abierto correctamente la base de datos | 11217 | // Si hemos abierto correctamente la base de datos |
| 11217 | // 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" | 11218 | // 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" |
| 11218 | dtb.execSQL("BEGIN"); | 11219 | dtb.execSQL("BEGIN"); |
| 11219 | for (String requete : listaSQL) { | 11220 | for (String requete : listaSQL) { |
| 11220 | try { | 11221 | try { |
| 11221 | dtb.execSQL(requete); | 11222 | dtb.execSQL(requete); |
| 11222 | } catch (Exception e) { | 11223 | } catch (Exception e) { |
| 11223 | 11224 | ||
| 11224 | GestorLogEventos log = new GestorLogEventos(); | 11225 | GestorLogEventos log = new GestorLogEventos(); |
| 11225 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11226 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11226 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11227 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11227 | log.log("[-- 1899 --]" + e.toString(), 4); | 11228 | log.log("[-- 1899 --]" + e.toString(), 4); |
| 11228 | 11229 | ||
| 11229 | } | 11230 | } |
| 11230 | } | 11231 | } |
| 11231 | dtb.execSQL("COMMIT"); | 11232 | dtb.execSQL("COMMIT"); |
| 11232 | 11233 | ||
| 11233 | // 3 Cierre: | 11234 | // 3 Cierre: |
| 11234 | dtb.close(); | 11235 | dtb.close(); |
| 11235 | 11236 | ||
| 11236 | return; | 11237 | return; |
| 11237 | } catch (Exception e) { | 11238 | } catch (Exception e) { |
| 11238 | 11239 | ||
| 11239 | GestorLogEventos log = new GestorLogEventos(); | 11240 | GestorLogEventos log = new GestorLogEventos(); |
| 11240 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11241 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11241 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11242 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11242 | log.log("[-- 1913 --]" + e.toString(), 4); | 11243 | log.log("[-- 1913 --]" + e.toString(), 4); |
| 11243 | 11244 | ||
| 11244 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11245 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11245 | "Imposible agregar el articulo nuevo a la Base De Datos: " | 11246 | "Imposible agregar el articulo nuevo a la Base De Datos: " |
| 11246 | + e.toString()); | 11247 | + e.toString()); |
| 11247 | } | 11248 | } |
| 11248 | } | 11249 | } |
| 11249 | 11250 | ||
| 11250 | 11251 | ||
| 11251 | 11252 | ||
| 11252 | /** | 11253 | /** |
| 11253 | * Ejecuta las sentencias sql de la lista | 11254 | * Ejecuta las sentencias sql de la lista |
| 11254 | * <p> | 11255 | * <p> |
| 11255 | * 1 Abrimos la base de datos en modo escritura | 11256 | * 1 Abrimos la base de datos en modo escritura |
| 11256 | * <p> | 11257 | * <p> |
| 11257 | * 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" | 11258 | * 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" |
| 11258 | * <p> | 11259 | * <p> |
| 11259 | * 3 Cierre | 11260 | * 3 Cierre |
| 11260 | * | 11261 | * |
| 11261 | * @param listaSQL | 11262 | * @param listaSQL |
| 11262 | * @throws ExceptionBDD | 11263 | * @throws ExceptionBDD |
| 11263 | */ | 11264 | */ |
| 11264 | public void insertProveedoresConSQLEnBdd(ArrayList<String> listaSQL) | 11265 | public void insertProveedoresConSQLEnBdd(ArrayList<String> listaSQL) |
| 11265 | throws ExceptionBDD { | 11266 | throws ExceptionBDD { |
| 11266 | try { | 11267 | try { |
| 11267 | System.out.println("::: BaseDatos 2725 insertProveedoresConSQLEnBdd"); | 11268 | System.out.println("::: BaseDatos 2725 insertProveedoresConSQLEnBdd"); |
| 11268 | // 1 Abrimos la base de datos en modo escritura | 11269 | // 1 Abrimos la base de datos en modo escritura |
| 11269 | SQLiteDatabase dtb = this.getWritableDatabase(); | 11270 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 11270 | 11271 | ||
| 11271 | // Si hemos abierto correctamente la base de datos | 11272 | // Si hemos abierto correctamente la base de datos |
| 11272 | // 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" | 11273 | // 2 Ejecutamos las sentencias entre un "BEGIN" y un "COMMIT" |
| 11273 | dtb.execSQL("BEGIN"); | 11274 | dtb.execSQL("BEGIN"); |
| 11274 | for (String requete : listaSQL) { | 11275 | for (String requete : listaSQL) { |
| 11275 | try { | 11276 | try { |
| 11276 | dtb.execSQL(requete); | 11277 | dtb.execSQL(requete); |
| 11277 | } catch (Exception e) { | 11278 | } catch (Exception e) { |
| 11278 | 11279 | ||
| 11279 | GestorLogEventos log = new GestorLogEventos(); | 11280 | GestorLogEventos log = new GestorLogEventos(); |
| 11280 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11281 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11281 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11282 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11282 | log.log("[-- 1899 --]" + e.toString(), 4); | 11283 | log.log("[-- 1899 --]" + e.toString(), 4); |
| 11283 | 11284 | ||
| 11284 | } | 11285 | } |
| 11285 | } | 11286 | } |
| 11286 | dtb.execSQL("COMMIT"); | 11287 | dtb.execSQL("COMMIT"); |
| 11287 | 11288 | ||
| 11288 | // 3 Cierre: | 11289 | // 3 Cierre: |
| 11289 | dtb.close(); | 11290 | dtb.close(); |
| 11290 | 11291 | ||
| 11291 | return; | 11292 | return; |
| 11292 | } catch (Exception e) { | 11293 | } catch (Exception e) { |
| 11293 | 11294 | ||
| 11294 | GestorLogEventos log = new GestorLogEventos(); | 11295 | GestorLogEventos log = new GestorLogEventos(); |
| 11295 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11296 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11296 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11297 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11297 | log.log("[-- 1913 --]" + e.toString(), 4); | 11298 | log.log("[-- 1913 --]" + e.toString(), 4); |
| 11298 | 11299 | ||
| 11299 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11300 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11300 | "Imposible agregar el articulo nuevo a la Base De Datos: " | 11301 | "Imposible agregar el articulo nuevo a la Base De Datos: " |
| 11301 | + e.toString()); | 11302 | + e.toString()); |
| 11302 | } | 11303 | } |
| 11303 | } | 11304 | } |
| 11304 | 11305 | ||
| 11305 | 11306 | ||
| 11306 | /** | 11307 | /** |
| 11307 | * Elimina todos los registros que se cargaron vacios | 11308 | * Elimina todos los registros que se cargaron vacios |
| 11308 | * <p> | 11309 | * <p> |
| 11309 | * 1 Abrimos la base de datos en modo escritura | 11310 | * 1 Abrimos la base de datos en modo escritura |
| 11310 | * <p> | 11311 | * <p> |
| 11311 | * 2 Cierre | 11312 | * 2 Cierre |
| 11312 | * | 11313 | * |
| 11313 | * @throws ExceptionBDD | 11314 | * @throws ExceptionBDD |
| 11314 | */ | 11315 | */ |
| 11315 | public void deleteProveedoresVacios() | 11316 | public void deleteProveedoresVacios() |
| 11316 | throws ExceptionBDD { | 11317 | throws ExceptionBDD { |
| 11317 | try { | 11318 | try { |
| 11318 | // 1 Abrimos la base de datos en modo escritura | 11319 | // 1 Abrimos la base de datos en modo escritura |
| 11319 | SQLiteDatabase dtb = this.getWritableDatabase(); | 11320 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 11320 | 11321 | ||
| 11321 | // Si hemos abierto correctamente la base de datos | 11322 | // Si hemos abierto correctamente la base de datos |
| 11322 | dtb.execSQL("DELETE FROM PROVEEDORES WHERE PROV_DESC IS NULL"); | 11323 | dtb.execSQL("DELETE FROM PROVEEDORES WHERE PROV_DESC IS NULL"); |
| 11323 | // 2 Cierre: | 11324 | // 2 Cierre: |
| 11324 | dtb.close(); | 11325 | dtb.close(); |
| 11325 | 11326 | ||
| 11326 | return; | 11327 | return; |
| 11327 | } catch (Exception e) { | 11328 | } catch (Exception e) { |
| 11328 | 11329 | ||
| 11329 | GestorLogEventos log = new GestorLogEventos(); | 11330 | GestorLogEventos log = new GestorLogEventos(); |
| 11330 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11331 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11331 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11332 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11332 | log.log("[-- 1913 --]" + e.toString(), 4); | 11333 | log.log("[-- 1913 --]" + e.toString(), 4); |
| 11333 | 11334 | ||
| 11334 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, | 11335 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_DELETE, |
| 11335 | "No se pudo ejecutar el comando en la base de datos: " | 11336 | "No se pudo ejecutar el comando en la base de datos: " |
| 11336 | + e.toString()); | 11337 | + e.toString()); |
| 11337 | } | 11338 | } |
| 11338 | } | 11339 | } |
| 11339 | 11340 | ||
| 11340 | 11341 | ||
| 11341 | 11342 | ||
| 11342 | 11343 | ||
| 11343 | /** | 11344 | /** |
| 11344 | * Ejecuta la consulta en la BD | 11345 | * Ejecuta la consulta en la BD |
| 11345 | * <p> | 11346 | * <p> |
| 11346 | * 1 Abrimos la base de datos en modo escritura | 11347 | * 1 Abrimos la base de datos en modo escritura |
| 11347 | * <p> | 11348 | * <p> |
| 11348 | * 2 Ejecutamos la consulta | 11349 | * 2 Ejecutamos la consulta |
| 11349 | * <p> | 11350 | * <p> |
| 11350 | * 3 Cierre | 11351 | * 3 Cierre |
| 11351 | * | 11352 | * |
| 11352 | * @param consulta | 11353 | * @param consulta |
| 11353 | * @throws ExceptionBDD | 11354 | * @throws ExceptionBDD |
| 11354 | */ | 11355 | */ |
| 11355 | public void insertDesdeUSBEnBdd(String consulta) throws ExceptionBDD { | 11356 | public void insertDesdeUSBEnBdd(String consulta) throws ExceptionBDD { |
| 11356 | try { | 11357 | try { |
| 11357 | System.out.println("::: BD 2647 Inserta articulo desde usb"); | 11358 | System.out.println("::: BD 2647 Inserta articulo desde usb"); |
| 11358 | // Test de la preexistencia de la entrada: | 11359 | // Test de la preexistencia de la entrada: |
| 11359 | // Si la entrada ya existe, actualizamos los datos: | 11360 | // Si la entrada ya existe, actualizamos los datos: |
| 11360 | /* | 11361 | /* |
| 11361 | * if (selectArticuloConCodigos(articulo.getSector(), | 11362 | * if (selectArticuloConCodigos(articulo.getSector(), |
| 11362 | * articulo.getCodigo(), articulo.getInventario()) != null) // Si | 11363 | * articulo.getCodigo(), articulo.getInventario()) != null) // Si |
| 11363 | * existe... { updateArticulo(articulo); return; } | 11364 | * existe... { updateArticulo(articulo); return; } |
| 11364 | */ | 11365 | */ |
| 11365 | 11366 | ||
| 11366 | // 1 Abrimos la base de datos en modo escritura | 11367 | // 1 Abrimos la base de datos en modo escritura |
| 11367 | SQLiteDatabase dtb = this.getWritableDatabase(); | 11368 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 11368 | 11369 | ||
| 11369 | // Si hemos abierto correctamente la base de datos | 11370 | // Si hemos abierto correctamente la base de datos |
| 11370 | try { | 11371 | try { |
| 11371 | // 2 Ejecutamos la consulta | 11372 | // 2 Ejecutamos la consulta |
| 11372 | dtb.execSQL(consulta); | 11373 | dtb.execSQL(consulta); |
| 11373 | } catch (Exception e) { | 11374 | } catch (Exception e) { |
| 11374 | 11375 | ||
| 11375 | GestorLogEventos log = new GestorLogEventos(); | 11376 | GestorLogEventos log = new GestorLogEventos(); |
| 11376 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11377 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11377 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11378 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11378 | log.log("[-- 1955 --]" + e.toString(), 4); | 11379 | log.log("[-- 1955 --]" + e.toString(), 4); |
| 11379 | 11380 | ||
| 11380 | } | 11381 | } |
| 11381 | 11382 | ||
| 11382 | // 3 Cierre: | 11383 | // 3 Cierre: |
| 11383 | dtb.close(); | 11384 | dtb.close(); |
| 11384 | 11385 | ||
| 11385 | return; | 11386 | return; |
| 11386 | } catch (Exception e) { | 11387 | } catch (Exception e) { |
| 11387 | 11388 | ||
| 11388 | GestorLogEventos log = new GestorLogEventos(); | 11389 | GestorLogEventos log = new GestorLogEventos(); |
| 11389 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11390 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11390 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11391 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11391 | log.log("[-- 1967 --]" + e.toString(), 4); | 11392 | log.log("[-- 1967 --]" + e.toString(), 4); |
| 11392 | 11393 | ||
| 11393 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11394 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11394 | "Imposible agregar el articulo nuevo a la Base De Datos: " | 11395 | "Imposible agregar el articulo nuevo a la Base De Datos: " |
| 11395 | + e.toString()); | 11396 | + e.toString()); |
| 11396 | } | 11397 | } |
| 11397 | } | 11398 | } |
| 11398 | 11399 | ||
| 11399 | /** | 11400 | /** |
| 11400 | * Ejecuta todas las sentencias de la lista en la BD | 11401 | * Ejecuta todas las sentencias de la lista en la BD |
| 11401 | * <p> | 11402 | * <p> |
| 11402 | * 1 Abrimos la base de datos en modo escritura | 11403 | * 1 Abrimos la base de datos en modo escritura |
| 11403 | * <p> | 11404 | * <p> |
| 11404 | * 2 Ejecutamos las consultas | 11405 | * 2 Ejecutamos las consultas |
| 11405 | * <p> | 11406 | * <p> |
| 11406 | * 3 Cierre | 11407 | * 3 Cierre |
| 11407 | * | 11408 | * |
| 11408 | * @param listaSQL | 11409 | * @param listaSQL |
| 11409 | * @throws ExceptionBDD | 11410 | * @throws ExceptionBDD |
| 11410 | */ | 11411 | */ |
| 11411 | public void insertDesdeUSBEnBdd(ArrayList<String> listaSQL) | 11412 | public void insertDesdeUSBEnBdd(ArrayList<String> listaSQL) |
| 11412 | throws ExceptionBDD { | 11413 | throws ExceptionBDD { |
| 11413 | try { | 11414 | try { |
| 11414 | System.out.println("::: BaseDatos 2834 insertDesdeUSBEnBdd"); | 11415 | System.out.println("::: BaseDatos 2834 insertDesdeUSBEnBdd"); |
| 11415 | // Test de la preexistencia de la entrada: | 11416 | // Test de la preexistencia de la entrada: |
| 11416 | // Si la entrada ya existe, actualizamos los datos: | 11417 | // Si la entrada ya existe, actualizamos los datos: |
| 11417 | /* | 11418 | /* |
| 11418 | * if (selectArticuloConCodigos(articulo.getSector(), | 11419 | * if (selectArticuloConCodigos(articulo.getSector(), |
| 11419 | * articulo.getCodigo(), articulo.getInventario()) != null) // Si | 11420 | * articulo.getCodigo(), articulo.getInventario()) != null) // Si |
| 11420 | * existe... { updateArticulo(articulo); return; } | 11421 | * existe... { updateArticulo(articulo); return; } |
| 11421 | */ | 11422 | */ |
| 11422 | 11423 | ||
| 11423 | // 1 Abrimos la base de datos en modo escritura | 11424 | // 1 Abrimos la base de datos en modo escritura |
| 11424 | SQLiteDatabase dtb = this.getWritableDatabase(); | 11425 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 11425 | 11426 | ||
| 11426 | // Si hemos abierto correctamente la base de datos | 11427 | // Si hemos abierto correctamente la base de datos |
| 11427 | dtb.execSQL("BEGIN"); | 11428 | dtb.execSQL("BEGIN"); |
| 11428 | for (String requete : listaSQL) { | 11429 | for (String requete : listaSQL) { |
| 11429 | try { | 11430 | try { |
| 11430 | System.out.println("::: BD 2834 execsql"); | 11431 | System.out.println("::: BD 2834 execsql"); |
| 11431 | // 2 Ejecutamos las consultas | 11432 | // 2 Ejecutamos las consultas |
| 11432 | dtb.execSQL(requete); | 11433 | dtb.execSQL(requete); |
| 11433 | } catch (Exception e) { | 11434 | } catch (Exception e) { |
| 11434 | 11435 | ||
| 11435 | GestorLogEventos log = new GestorLogEventos(); | 11436 | GestorLogEventos log = new GestorLogEventos(); |
| 11436 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11437 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11437 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11438 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11438 | log.log("[-- 2013 --]" + e.toString(), 4); | 11439 | log.log("[-- 2013 --]" + e.toString(), 4); |
| 11439 | 11440 | ||
| 11440 | } | 11441 | } |
| 11441 | } | 11442 | } |
| 11442 | dtb.execSQL("COMMIT"); | 11443 | dtb.execSQL("COMMIT"); |
| 11443 | 11444 | ||
| 11444 | // 3 Cierre: | 11445 | // 3 Cierre: |
| 11445 | dtb.close(); | 11446 | dtb.close(); |
| 11446 | 11447 | ||
| 11447 | return; | 11448 | return; |
| 11448 | } catch (Exception e) { | 11449 | } catch (Exception e) { |
| 11449 | 11450 | ||
| 11450 | GestorLogEventos log = new GestorLogEventos(); | 11451 | GestorLogEventos log = new GestorLogEventos(); |
| 11451 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11452 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11452 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11453 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11453 | log.log("[-- 2058 --]" + e.toString(), 4); | 11454 | log.log("[-- 2058 --]" + e.toString(), 4); |
| 11454 | 11455 | ||
| 11455 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11456 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11456 | "Imposible agregar el articulo nuevo a la Base De Datos: " | 11457 | "Imposible agregar el articulo nuevo a la Base De Datos: " |
| 11457 | + e.toString()); | 11458 | + e.toString()); |
| 11458 | } | 11459 | } |
| 11459 | } | 11460 | } |
| 11460 | 11461 | ||
| 11461 | /** | 11462 | /** |
| 11462 | * Agregar un INVENTARIO a la base de datos (o lo actualiza si ya existe) | 11463 | * Agregar un INVENTARIO a la base de datos (o lo actualiza si ya existe) |
| 11463 | * <p> | 11464 | * <p> |
| 11464 | * 1 Si la entrada ya existe, actualizamos los datos | 11465 | * 1 Si la entrada ya existe, actualizamos los datos |
| 11465 | * <p> | 11466 | * <p> |
| 11466 | * 2 Sino, abrimos la base de datos en modo escritura | 11467 | * 2 Sino, abrimos la base de datos en modo escritura |
| 11467 | * <p> | 11468 | * <p> |
| 11468 | * 3 Insertamos el registro en la base de dato | 11469 | * 3 Insertamos el registro en la base de dato |
| 11469 | * <p> | 11470 | * <p> |
| 11470 | * 4 Cierre | 11471 | * 4 Cierre |
| 11471 | * | 11472 | * |
| 11472 | * @param inventario | 11473 | * @param inventario |
| 11473 | * Objeto que agregar en la base | 11474 | * Objeto que agregar en la base |
| 11474 | * @throws ExceptionBDD | 11475 | * @throws ExceptionBDD |
| 11475 | */ | 11476 | */ |
| 11476 | public void insertInventarioEnBdd(Inventario inventario) | 11477 | public void insertInventarioEnBdd(Inventario inventario) |
| 11477 | throws ExceptionBDD { | 11478 | throws ExceptionBDD { |
| 11478 | System.out.println("::: BD 2754 Inserta inventario "); | 11479 | System.out.println("::: BD 2754 Inserta inventario "); |
| 11479 | try { | 11480 | try { |
| 11480 | boolean condicionRadio = ParametrosInventario.InventariosVentas; | 11481 | boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 11481 | 11482 | ||
| 11482 | // Test de la preexistencia de la entrada: | 11483 | // Test de la preexistencia de la entrada: |
| 11483 | // 1 Si la entrada ya existe, actualizamos los datos: | 11484 | // 1 Si la entrada ya existe, actualizamos los datos: |
| 11484 | if (selectInventarioConNumero(inventario.getNumero()) != null) // Si | 11485 | if (selectInventarioConNumero(inventario.getNumero()) != null) // Si |
| 11485 | // existe... | 11486 | // existe... |
| 11486 | { | 11487 | { |
| 11487 | System.out.println("::: BD 2754 updateInventario"); | 11488 | System.out.println("::: BD 2754 updateInventario"); |
| 11488 | updateInventario(inventario); | 11489 | updateInventario(inventario); |
| 11489 | return; | 11490 | return; |
| 11490 | } | 11491 | } |
| 11491 | 11492 | ||
| 11492 | // 2 Sino, abrimos la base de datos en modo escritura | 11493 | // 2 Sino, abrimos la base de datos en modo escritura |
| 11493 | SQLiteDatabase dtb = this.getWritableDatabase(); | 11494 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 11494 | 11495 | ||
| 11495 | // Si hemos abierto correctamente la base de datos | 11496 | // Si hemos abierto correctamente la base de datos |
| 11496 | if (dtb != null) { | 11497 | if (dtb != null) { |
| 11497 | // Creamos el registro a insertar como objeto ContentValues | 11498 | // Creamos el registro a insertar como objeto ContentValues |
| 11498 | // ContentValues nuevoRegistro = new ContentValues(); | 11499 | // ContentValues nuevoRegistro = new ContentValues(); |
| 11499 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_numero, | 11500 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_numero, |
| 11500 | // inventario.getNumero()); | 11501 | // inventario.getNumero()); |
| 11501 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_descripcion, | 11502 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_descripcion, |
| 11502 | // inventario.getDescripcion()); | 11503 | // inventario.getDescripcion()); |
| 11503 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_fecha, | 11504 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_fecha, |
| 11504 | // inventario.getFecha()); | 11505 | // inventario.getFecha()); |
| 11505 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_estado, | 11506 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_inventario_estado, |
| 11506 | // inventario.getEstado()); | 11507 | // inventario.getEstado()); |
| 11507 | // 3 Insertamos el registro en la base de datos | 11508 | // 3 Insertamos el registro en la base de datos |
| 11508 | // long resultado = dtb.insert(tabla_inventarios_nombre, null, | 11509 | // long resultado = dtb.insert(tabla_inventarios_nombre, null, |
| 11509 | // nuevoRegistro); | 11510 | // nuevoRegistro); |
| 11510 | String descripcionCompleta = inventario.getDescripcion().trim(); | 11511 | String descripcionCompleta = inventario.getDescripcion().trim(); |
| 11511 | int n = descripcionCompleta.trim().length(); | 11512 | int n = descripcionCompleta.trim().length(); |
| 11512 | String obtenerDescripcion = descripcionCompleta.substring(0, (n - 3)); | 11513 | String obtenerDescripcion = descripcionCompleta.substring(0, (n - 3)); |
| 11513 | // char car=descripcionCompleta.charAt(n-1); | 11514 | // char car=descripcionCompleta.charAt(n-1); |
| 11514 | int variable_dep = 0; | 11515 | int variable_dep = 0; |
| 11515 | // if(car=='0'){ | 11516 | // if(car=='0'){ |
| 11516 | // variable_dep= -1; | 11517 | // variable_dep= -1; |
| 11517 | // }else if(car=='1'){ | 11518 | // }else if(car=='1'){ |
| 11518 | // variable_dep= -2; | 11519 | // variable_dep= -2; |
| 11519 | // }else{ | 11520 | // }else{ |
| 11520 | variable_dep =inventario.getLugar(); | 11521 | variable_dep =inventario.getLugar(); |
| 11521 | // } | 11522 | // } |
| 11522 | String str = ""; | 11523 | String str = ""; |
| 11523 | if(condicionRadio == true && inventario.getNumero()==-1){ | 11524 | if(condicionRadio == true && inventario.getNumero()==-1){ |
| 11524 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 11525 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 11525 | // condR=-1; | 11526 | // condR=-1; |
| 11526 | System.out.println("::: BD 2754 prepara el string para insertar inventario"); | 11527 | System.out.println("::: BD 2754 prepara el string para insertar inventario"); |
| 11527 | str = "INSERT INTO " + tabla_inventarios_nombre | 11528 | str = "INSERT INTO " + tabla_inventarios_nombre |
| 11528 | + " VALUES(" + inventario.getNumero() + "," + "'" | 11529 | + " VALUES(" + inventario.getNumero() + "," + "'" |
| 11529 | + obtenerDescripcion + "'," + "'" | 11530 | + obtenerDescripcion + "'," + "'" |
| 11530 | // + inventario.getDescripcion() + "'," + "'" | 11531 | // + inventario.getDescripcion() + "'," + "'" |
| 11531 | + inventario.getFechaInicio() + "'," + "'" | 11532 | + inventario.getFechaInicio() + "'," + "'" |
| 11532 | + inventario.getFechaFin() + "'," | 11533 | + inventario.getFechaFin() + "'," |
| 11533 | + inventario.getEstado() + "," + variable_dep+ "," +0 | 11534 | + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 11534 | + ")"; | 11535 | + ")"; |
| 11535 | System.out.println("::: D.V. QUIERO VER VARIABLE_DEP "+variable_dep); | 11536 | System.out.println("::: D.V. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 11536 | dtb.execSQL(str); | 11537 | dtb.execSQL(str); |
| 11537 | 11538 | ||
| 11538 | }else if(condicionRadio == false && inventario.getNumero()==-2){ | 11539 | }else if(condicionRadio == false && inventario.getNumero()==-2){ |
| 11539 | // Esta seleccionado deposito, esto debe continuar sin los campos de ventas | 11540 | // Esta seleccionado deposito, esto debe continuar sin los campos de ventas |
| 11540 | // condR=-2; | 11541 | // condR=-2; |
| 11541 | System.out.println("::: BD 2754 prepara el string para insertar inventario 2"); | 11542 | System.out.println("::: BD 2754 prepara el string para insertar inventario 2"); |
| 11542 | str = "INSERT INTO " + tabla_inventarios_nombre | 11543 | str = "INSERT INTO " + tabla_inventarios_nombre |
| 11543 | + " VALUES(" + inventario.getNumero() + "," + "'" | 11544 | + " VALUES(" + inventario.getNumero() + "," + "'" |
| 11544 | + obtenerDescripcion + "'," + "'" | 11545 | + obtenerDescripcion + "'," + "'" |
| 11545 | // + inventario.getDescripcion() + "'," + "'" | 11546 | // + inventario.getDescripcion() + "'," + "'" |
| 11546 | + inventario.getFechaInicio() + "'," + "'" | 11547 | + inventario.getFechaInicio() + "'," + "'" |
| 11547 | + inventario.getFechaFin() + "'," | 11548 | + inventario.getFechaFin() + "'," |
| 11548 | + inventario.getEstado() + "," + variable_dep+ "," +0 | 11549 | + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 11549 | + ")"; | 11550 | + ")"; |
| 11550 | System.out.println("::: D.D. QUIERO VER VARIABLE_DEP "+variable_dep); | 11551 | System.out.println("::: D.D. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 11551 | dtb.execSQL(str); | 11552 | dtb.execSQL(str); |
| 11552 | 11553 | ||
| 11553 | } | 11554 | } |
| 11554 | else if(condicionRadio == true && inventario.getNumero()>0){ | 11555 | else if(condicionRadio == true && inventario.getNumero()>0){ |
| 11555 | System.out.println("::: BD 2754 prepara el string para insertar inventario 3"); | 11556 | System.out.println("::: BD 2754 prepara el string para insertar inventario 3"); |
| 11556 | str = "INSERT INTO " + tabla_inventarios_nombre | 11557 | str = "INSERT INTO " + tabla_inventarios_nombre |
| 11557 | + " VALUES(" + inventario.getNumero() + "," + "'" | 11558 | + " VALUES(" + inventario.getNumero() + "," + "'" |
| 11558 | + obtenerDescripcion + "'," + "'" | 11559 | + obtenerDescripcion + "'," + "'" |
| 11559 | // + inventario.getDescripcion() + "'," + "'" | 11560 | // + inventario.getDescripcion() + "'," + "'" |
| 11560 | + inventario.getFechaInicio() + "'," + "'" | 11561 | + inventario.getFechaInicio() + "'," + "'" |
| 11561 | + inventario.getFechaFin() + "'," | 11562 | + inventario.getFechaFin() + "'," |
| 11562 | + inventario.getEstado() + "," + -1+ "," +0 | 11563 | + inventario.getEstado() + "," + -1+ "," +0 |
| 11563 | + ")"; | 11564 | + ")"; |
| 11564 | System.out.println("::: D.O. QUIERO VER VARIABLE_DEP "+variable_dep); | 11565 | System.out.println("::: D.O. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 11565 | dtb.execSQL(str); | 11566 | dtb.execSQL(str); |
| 11566 | } | 11567 | } |
| 11567 | else if(condicionRadio == false && inventario.getNumero()>0){ | 11568 | else if(condicionRadio == false && inventario.getNumero()>0){ |
| 11568 | System.out.println("::: BD 2754 prepara el string para insertar inventario 3"); | 11569 | System.out.println("::: BD 2754 prepara el string para insertar inventario 3"); |
| 11569 | str = "INSERT INTO " + tabla_inventarios_nombre | 11570 | str = "INSERT INTO " + tabla_inventarios_nombre |
| 11570 | + " VALUES(" + inventario.getNumero() + "," + "'" | 11571 | + " VALUES(" + inventario.getNumero() + "," + "'" |
| 11571 | + obtenerDescripcion + "'," + "'" | 11572 | + obtenerDescripcion + "'," + "'" |
| 11572 | // + inventario.getDescripcion() + "'," + "'" | 11573 | // + inventario.getDescripcion() + "'," + "'" |
| 11573 | + inventario.getFechaInicio() + "'," + "'" | 11574 | + inventario.getFechaInicio() + "'," + "'" |
| 11574 | + inventario.getFechaFin() + "'," | 11575 | + inventario.getFechaFin() + "'," |
| 11575 | + inventario.getEstado() + "," + -2 + "," +0 | 11576 | + inventario.getEstado() + "," + -2 + "," +0 |
| 11576 | + ")"; | 11577 | + ")"; |
| 11577 | System.out.println("::: D.O. QUIERO VER VARIABLE_DEP "+variable_dep); | 11578 | System.out.println("::: D.O. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 11578 | dtb.execSQL(str); | 11579 | dtb.execSQL(str); |
| 11579 | } | 11580 | } |
| 11580 | // System.out.println("::: BaseDatos 2929 variable_dep " + variable_dep); | 11581 | // System.out.println("::: BaseDatos 2929 variable_dep " + variable_dep); |
| 11581 | // System.out.println("::: BaseDatos 2929 inventario.getNumero() " + inventario.getNumero()); | 11582 | // System.out.println("::: BaseDatos 2929 inventario.getNumero() " + inventario.getNumero()); |
| 11582 | // String str = "INSERT INTO " + tabla_inventarios_nombre | 11583 | // String str = "INSERT INTO " + tabla_inventarios_nombre |
| 11583 | // + " VALUES(" + inventario.getNumero() + "," + "'" | 11584 | // + " VALUES(" + inventario.getNumero() + "," + "'" |
| 11584 | // + obtenerDescripcion + "'," + "'" | 11585 | // + obtenerDescripcion + "'," + "'" |
| 11585 | //// + inventario.getDescripcion() + "'," + "'" | 11586 | //// + inventario.getDescripcion() + "'," + "'" |
| 11586 | // + inventario.getFechaInicio() + "'," + "'" | 11587 | // + inventario.getFechaInicio() + "'," + "'" |
| 11587 | // + inventario.getFechaFin() + "'," | 11588 | // + inventario.getFechaFin() + "'," |
| 11588 | // + inventario.getEstado() + "," + variable_dep+ "," +0 | 11589 | // + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 11589 | // + ")"; | 11590 | // + ")"; |
| 11590 | // System.out.println("::: BD 2791 inserta string inv "+ str); | 11591 | // System.out.println("::: BD 2791 inserta string inv "+ str); |
| 11591 | // dtb.execSQL(str); | 11592 | // dtb.execSQL(str); |
| 11592 | // Test resultado INSERT: | 11593 | // Test resultado INSERT: |
| 11593 | // if (resultado < 0) { | 11594 | // if (resultado < 0) { |
| 11594 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11595 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11595 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 11596 | // "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 11596 | // } | 11597 | // } |
| 11597 | } else { | 11598 | } else { |
| 11598 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11599 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11599 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 11600 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 11600 | } | 11601 | } |
| 11601 | // 4 Cierre: | 11602 | // 4 Cierre: |
| 11602 | dtb.close(); | 11603 | dtb.close(); |
| 11603 | 11604 | ||
| 11604 | return; | 11605 | return; |
| 11605 | } catch (Exception e) { | 11606 | } catch (Exception e) { |
| 11606 | 11607 | ||
| 11607 | GestorLogEventos log = new GestorLogEventos(); | 11608 | GestorLogEventos log = new GestorLogEventos(); |
| 11608 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11609 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11609 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11610 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11610 | log.log("[-- 2112 --]" + e.toString(), 4); | 11611 | log.log("[-- 2112 --]" + e.toString(), 4); |
| 11611 | 11612 | ||
| 11612 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11613 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11613 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 11614 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 11614 | } | 11615 | } |
| 11615 | } | 11616 | } |
| 11616 | 11617 | ||
| 11617 | /** | 11618 | /** |
| 11618 | * Agregar un INVENTARIO a la base de datos (o lo actualiza si ya existe) | 11619 | * Agregar un INVENTARIO a la base de datos (o lo actualiza si ya existe) |
| 11619 | * <p> | 11620 | * <p> |
| 11620 | * 1 Si la entrada ya existe, actualizamos los datos | 11621 | * 1 Si la entrada ya existe, actualizamos los datos |
| 11621 | * <p> | 11622 | * <p> |
| 11622 | * 2 Sino, abrimos la base de datos en modo escritura | 11623 | * 2 Sino, abrimos la base de datos en modo escritura |
| 11623 | * <p> | 11624 | * <p> |
| 11624 | * 3 Insertamos el registro en la base de dato | 11625 | * 3 Insertamos el registro en la base de dato |
| 11625 | * <p> | 11626 | * <p> |
| 11626 | * 4 Cierre | 11627 | * 4 Cierre |
| 11627 | * | 11628 | * |
| 11628 | * @param inventario | 11629 | * @param inventario |
| 11629 | * Objeto que agregar en la base | 11630 | * Objeto que agregar en la base |
| 11630 | * @throws ExceptionBDD | 11631 | * @throws ExceptionBDD |
| 11631 | */ | 11632 | */ |
| 11632 | public void insertInventarioComprasEnBdd(Inventario inventario) | 11633 | public void insertInventarioComprasEnBdd(Inventario inventario) |
| 11633 | throws ExceptionBDD { | 11634 | throws ExceptionBDD { |
| 11634 | System.out.println("::: BD 2754 Inserta inventario Compras"); | 11635 | System.out.println("::: BD 2754 Inserta inventario Compras"); |
| 11635 | try { | 11636 | try { |
| 11636 | // Test de la preexistencia de la entrada: | 11637 | // Test de la preexistencia de la entrada: |
| 11637 | // 1 Si la entrada ya existe, actualizamos los datos: | 11638 | // 1 Si la entrada ya existe, actualizamos los datos: |
| 11638 | if (selectInventarioConNumero(inventario.getNumero()) != null) // Si | 11639 | if (selectInventarioConNumero(inventario.getNumero()) != null) // Si |
| 11639 | // existe... | 11640 | // existe... |
| 11640 | { | 11641 | { |
| 11641 | updateInventarioCompras(inventario); | 11642 | updateInventarioCompras(inventario); |
| 11642 | return; | 11643 | return; |
| 11643 | } | 11644 | } |
| 11644 | // 2 Sino, abrimos la base de datos en modo escritura | 11645 | // 2 Sino, abrimos la base de datos en modo escritura |
| 11645 | SQLiteDatabase dtb = this.getWritableDatabase(); | 11646 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 11646 | // Si hemos abierto correctamente la base de datos | 11647 | // Si hemos abierto correctamente la base de datos |
| 11647 | if (dtb != null) { | 11648 | if (dtb != null) { |
| 11648 | String descripcionCompleta = inventario.getDescripcion().trim(); | 11649 | String descripcionCompleta = inventario.getDescripcion().trim(); |
| 11649 | int n = descripcionCompleta.trim().length(); | 11650 | int n = descripcionCompleta.trim().length(); |
| 11650 | String obtenerDescripcion = descripcionCompleta.substring(0,(n-3)); | 11651 | String obtenerDescripcion = descripcionCompleta.substring(0,(n-3)); |
| 11651 | char car=descripcionCompleta.charAt(n-1); | 11652 | char car=descripcionCompleta.charAt(n-1); |
| 11652 | int variable_dep = 3; | 11653 | int variable_dep = 3; |
| 11653 | String str = ""; | 11654 | String str = ""; |
| 11654 | 11655 | ||
| 11655 | if(inventario.getNumero()==-3){ | 11656 | if(inventario.getNumero()==-3){ |
| 11656 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 11657 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 11657 | str = "INSERT INTO " + tabla_inventarios_nombre | 11658 | str = "INSERT INTO " + tabla_inventarios_nombre |
| 11658 | + " VALUES(" + inventario.getNumero() + "," + "'" | 11659 | + " VALUES(" + inventario.getNumero() + "," + "'" |
| 11659 | + obtenerDescripcion + "'," + "'" | 11660 | + obtenerDescripcion + "'," + "'" |
| 11660 | + inventario.getFechaInicio() + "'," + "'" | 11661 | + inventario.getFechaInicio() + "'," + "'" |
| 11661 | + inventario.getFechaFin() + "'," | 11662 | + inventario.getFechaFin() + "'," |
| 11662 | + inventario.getEstado() + "," + variable_dep+ "," +0 | 11663 | + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 11663 | + ")"; | 11664 | + ")"; |
| 11664 | System.out.println("::: D.C. QUIERO VER VARIABLE_DEP "+variable_dep); | 11665 | System.out.println("::: D.C. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 11665 | dtb.execSQL(str); | 11666 | dtb.execSQL(str); |
| 11666 | } | 11667 | } |
| 11667 | } else { | 11668 | } else { |
| 11668 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11669 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11669 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 11670 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 11670 | } | 11671 | } |
| 11671 | // 4 Cierre: | 11672 | // 4 Cierre: |
| 11672 | dtb.close(); | 11673 | dtb.close(); |
| 11673 | return; | 11674 | return; |
| 11674 | } catch (Exception e) { | 11675 | } catch (Exception e) { |
| 11675 | GestorLogEventos log = new GestorLogEventos(); | 11676 | GestorLogEventos log = new GestorLogEventos(); |
| 11676 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11677 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11677 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11678 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11678 | log.log("[-- 2112 --]" + e.toString(), 4); | 11679 | log.log("[-- 2112 --]" + e.toString(), 4); |
| 11679 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 11680 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 11680 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 11681 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 11681 | } | 11682 | } |
| 11682 | } | 11683 | } |
| 11683 | 11684 | ||
| 11684 | /** | 11685 | /** |
| 11685 | * Recupera el objeto ARTICULO del inventario correspondiente con el codigo | 11686 | * Recupera el objeto ARTICULO del inventario correspondiente con el codigo |
| 11686 | * del mismo | 11687 | * del mismo |
| 11687 | * <p> | 11688 | * <p> |
| 11688 | * 1 Abrimos la base de datos en modo lectura | 11689 | * 1 Abrimos la base de datos en modo lectura |
| 11689 | * <p> | 11690 | * <p> |
| 11690 | * 2 Busqueda en la base | 11691 | * 2 Busqueda en la base |
| 11691 | * <p> | 11692 | * <p> |
| 11692 | * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el | 11693 | * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el |
| 11693 | * articulo | 11694 | * articulo |
| 11694 | * <p> | 11695 | * <p> |
| 11695 | * 4 Cerramos la BD | 11696 | * 4 Cerramos la BD |
| 11696 | * <p> | 11697 | * <p> |
| 11697 | * 5 Devolvemos el articulo | 11698 | * 5 Devolvemos el articulo |
| 11698 | * | 11699 | * |
| 11699 | * @param articulo_cod | 11700 | * @param articulo_cod |
| 11700 | * @return ARTICULO | 11701 | * @return ARTICULO |
| 11701 | * @throws ExceptionBDD | 11702 | * @throws ExceptionBDD |
| 11702 | */ | 11703 | */ |
| 11703 | public Articulo selectArticuloConCodigos(int articulo_sector, | 11704 | public Articulo selectArticuloConCodigos(int articulo_sector, |
| 11704 | int articulo_cod, int articulo_inv) throws ExceptionBDD { | 11705 | int articulo_cod, int articulo_inv) throws ExceptionBDD { |
| 11705 | System.out.println("::: BaseDatos 3010 selectArticuloConCodigos"); | 11706 | System.out.println("::: BaseDatos 3010 selectArticuloConCodigos"); |
| 11706 | try { | 11707 | try { |
| 11707 | // Salida: | 11708 | // Salida: |
| 11708 | Articulo articulo; | 11709 | Articulo articulo; |
| 11709 | System.out.println("::: BaseDatos selectArt " + articulo_sector +" "+ articulo_cod + " " + articulo_inv); | 11710 | System.out.println("::: BaseDatos selectArt " + articulo_sector +" "+ articulo_cod + " " + articulo_inv); |
| 11710 | // 1 Abrimos la base de datos en modo lectura: | 11711 | // 1 Abrimos la base de datos en modo lectura: |
| 11711 | SQLiteDatabase dtb = this.getReadableDatabase(); | 11712 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 11712 | // 2 Busqueda en la base: | 11713 | // 2 Busqueda en la base: |
| 11713 | String[] args = new String[] { String.valueOf(articulo_sector), | 11714 | String[] args = new String[] { String.valueOf(articulo_sector), |
| 11714 | String.valueOf(articulo_cod), String.valueOf(articulo_inv) }; | 11715 | String.valueOf(articulo_cod), String.valueOf(articulo_inv) }; |
| 11715 | Cursor c = dtb.query(tabla_articulos_nombre, null, | 11716 | Cursor c = dtb.query(tabla_articulos_nombre, null, |
| 11716 | ParametrosInventario.bal_bdd_articulo_sector + "=? AND " | 11717 | ParametrosInventario.bal_bdd_articulo_sector + "=? AND " |
| 11717 | + ParametrosInventario.bal_bdd_articulo_codigo | 11718 | + ParametrosInventario.bal_bdd_articulo_codigo |
| 11718 | + "=? AND " | 11719 | + "=? AND " |
| 11719 | + ParametrosInventario.bal_bdd_articulo_inventario | 11720 | + ParametrosInventario.bal_bdd_articulo_inventario |
| 11720 | + "=?", args, null, null, null); | 11721 | + "=?", args, null, null, null); |
| 11721 | if (c.moveToFirst()) { | 11722 | if (c.moveToFirst()) { |
| 11722 | articulo = new Articulo( | 11723 | articulo = new Articulo( |
| 11723 | articulo_sector, | 11724 | articulo_sector, |
| 11724 | articulo_cod, | 11725 | articulo_cod, |
| 11725 | c.getInt(c | 11726 | c.getInt(c |
| 11726 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), | 11727 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), |
| 11727 | c.getInt(c | 11728 | c.getInt(c |
| 11728 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), | 11729 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), |
| 11729 | new ArrayList<String>( | 11730 | new ArrayList<String>( |
| 11730 | Arrays.asList(c | 11731 | Arrays.asList(c |
| 11731 | .getString( | 11732 | .getString( |
| 11732 | c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)) | 11733 | c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)) |
| 11733 | .split(","))), | 11734 | .split(","))), |
| 11734 | new ArrayList<String>( | 11735 | new ArrayList<String>( |
| 11735 | Arrays.asList("0")), | 11736 | Arrays.asList("0")), |
| 11736 | c.getInt(c | 11737 | c.getInt(c |
| 11737 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), | 11738 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), |
| 11738 | c.getString(c | 11739 | c.getString(c |
| 11739 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), | 11740 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), |
| 11740 | c.getDouble(c | 11741 | c.getDouble(c |
| 11741 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), | 11742 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), |
| 11742 | c.getDouble(c | 11743 | c.getDouble(c |
| 11743 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), | 11744 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), |
| 11744 | c.getString(c | 11745 | c.getString(c |
| 11745 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), | 11746 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), |
| 11746 | c.getInt(c | 11747 | c.getInt(c |
| 11747 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), | 11748 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), |
| 11748 | c.getInt(c | 11749 | c.getInt(c |
| 11749 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), | 11750 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), |
| 11750 | c.getInt(c | 11751 | c.getInt(c |
| 11751 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), | 11752 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), |
| 11752 | c.getInt(c | 11753 | c.getInt(c |
| 11753 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), | 11754 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), |
| 11754 | c.getInt(c | 11755 | c.getInt(c |
| 11755 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), | 11756 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), |
| 11756 | c.getString(c | 11757 | c.getString(c |
| 11757 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); | 11758 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); |
| 11758 | 11759 | ||
| 11759 | 11760 | ||
| 11760 | } else { | 11761 | } else { |
| 11761 | articulo = null; | 11762 | articulo = null; |
| 11762 | System.out.println("::: BaseDatos VACIOOOOO 000000000000000000000000000000000000000"); | 11763 | System.out.println("::: BaseDatos VACIOOOOO 000000000000000000000000000000000000000"); |
| 11763 | } | 11764 | } |
| 11764 | // 4 Cerramos la BD | 11765 | // 4 Cerramos la BD |
| 11765 | // System.out.println(":::CIERRA"); | 11766 | // System.out.println(":::CIERRA"); |
| 11766 | dtb.close(); | 11767 | dtb.close(); |
| 11767 | // 5 Devolvemos el articulo | 11768 | // 5 Devolvemos el articulo |
| 11768 | return articulo; | 11769 | return articulo; |
| 11769 | } catch (Exception e) { | 11770 | } catch (Exception e) { |
| 11770 | 11771 | ||
| 11771 | GestorLogEventos log = new GestorLogEventos(); | 11772 | GestorLogEventos log = new GestorLogEventos(); |
| 11772 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11773 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11773 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11774 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11774 | log.log("[-- 2194 --]" + e.toString(), 4); | 11775 | log.log("[-- 2194 --]" + e.toString(), 4); |
| 11775 | 11776 | ||
| 11776 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 11777 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 11777 | "Imposible recuperar el ARTICULO cuyo codigo es: " | 11778 | "Imposible recuperar el ARTICULO cuyo codigo es: " |
| 11778 | + articulo_cod); | 11779 | + articulo_cod); |
| 11779 | } | 11780 | } |
| 11780 | } | 11781 | } |
| 11781 | 11782 | ||
| 11782 | public Proveedor selectProveedorConCodigos(int proveedor_cod) throws ExceptionBDD { | 11783 | public Proveedor selectProveedorConCodigos(int proveedor_cod) throws ExceptionBDD { |
| 11783 | System.out.println("::: BaseDatos 3010 selectProveedorConCodigos"); | 11784 | System.out.println("::: BaseDatos 3010 selectProveedorConCodigos"); |
| 11784 | try { | 11785 | try { |
| 11785 | // Salida: | 11786 | // Salida: |
| 11786 | Proveedor proveedor; | 11787 | Proveedor proveedor; |
| 11787 | System.out.println("::: BaseDatos selectArt " + proveedor_cod); | 11788 | System.out.println("::: BaseDatos selectArt " + proveedor_cod); |
| 11788 | // 1 Abrimos la base de datos en modo lectura: | 11789 | // 1 Abrimos la base de datos en modo lectura: |
| 11789 | SQLiteDatabase dtb = this.getReadableDatabase(); | 11790 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 11790 | // 2 Busqueda en la base: | 11791 | // 2 Busqueda en la base: |
| 11791 | String[] args = new String[] { String.valueOf(proveedor_cod)}; | 11792 | String[] args = new String[] { String.valueOf(proveedor_cod)}; |
| 11792 | Cursor c = dtb.query(tabla_proveedores_nombre, null, | 11793 | Cursor c = dtb.query(tabla_proveedores_nombre, null, |
| 11793 | ParametrosInventario.bal_bdd_proveedores_codigo + "=? ", args, null, null, null); | 11794 | ParametrosInventario.bal_bdd_proveedores_codigo + "=? ", args, null, null, null); |
| 11794 | if (c.moveToFirst()) { | 11795 | if (c.moveToFirst()) { |
| 11795 | proveedor = new Proveedor( | 11796 | proveedor = new Proveedor( |
| 11796 | proveedor_cod, | 11797 | proveedor_cod, |
| 11797 | c.getString(c | 11798 | c.getString(c |
| 11798 | .getColumnIndex(ParametrosInventario.bal_bdd_proveedores_descripcion))); | 11799 | .getColumnIndex(ParametrosInventario.bal_bdd_proveedores_descripcion))); |
| 11799 | } else { | 11800 | } else { |
| 11800 | proveedor = null; | 11801 | proveedor = null; |
| 11801 | System.out.println("::: BaseDatos VACIOOOOO 000000000000000000000000000000000000000"); | 11802 | System.out.println("::: BaseDatos VACIOOOOO 000000000000000000000000000000000000000"); |
| 11802 | } | 11803 | } |
| 11803 | // 4 Cerramos la BD | 11804 | // 4 Cerramos la BD |
| 11804 | // System.out.println(":::CIERRA"); | 11805 | // System.out.println(":::CIERRA"); |
| 11805 | dtb.close(); | 11806 | dtb.close(); |
| 11806 | 11807 | ||
| 11807 | return proveedor; | 11808 | return proveedor; |
| 11808 | } catch (Exception e) { | 11809 | } catch (Exception e) { |
| 11809 | 11810 | ||
| 11810 | GestorLogEventos log = new GestorLogEventos(); | 11811 | GestorLogEventos log = new GestorLogEventos(); |
| 11811 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11812 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11812 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11813 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11813 | log.log("[-- 2194 --]" + e.toString(), 4); | 11814 | log.log("[-- 2194 --]" + e.toString(), 4); |
| 11814 | 11815 | ||
| 11815 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 11816 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 11816 | "Imposible recuperar el ARTICULO cuyo codigo es: " | 11817 | "Imposible recuperar el ARTICULO cuyo codigo es: " |
| 11817 | + proveedor_cod); | 11818 | + proveedor_cod); |
| 11818 | } | 11819 | } |
| 11819 | } | 11820 | } |
| 11820 | 11821 | ||
| 11821 | /** | 11822 | /** |
| 11822 | * Recupera el Articulo con el codigo de barra de la tabla articulos | 11823 | * Recupera el Articulo con el codigo de barra de la tabla articulos |
| 11823 | * <p> | 11824 | * <p> |
| 11824 | * 1 Abrimos la base de datos en modo lectura | 11825 | * 1 Abrimos la base de datos en modo lectura |
| 11825 | * <p> | 11826 | * <p> |
| 11826 | * 2 Busqueda en la base | 11827 | * 2 Busqueda en la base |
| 11827 | * <p> | 11828 | * <p> |
| 11828 | * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el | 11829 | * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el |
| 11829 | * articulo | 11830 | * articulo |
| 11830 | * | 11831 | * |
| 11831 | * @param codigo_barra | 11832 | * @param codigo_barra |
| 11832 | * @return | 11833 | * @return |
| 11833 | * @throws ExceptionBDD | 11834 | * @throws ExceptionBDD |
| 11834 | */ | 11835 | */ |
| 11835 | public Articulo selectArticuloConCodigoBarra(String codigo_barra) | 11836 | public Articulo selectArticuloConCodigoBarra(String codigo_barra) |
| 11836 | throws ExceptionBDD { | 11837 | throws ExceptionBDD { |
| 11837 | System.out.println("::: BaseDatos 3108 selectArticuloConCodigoBarra"); | 11838 | System.out.println("::: BaseDatos 3108 selectArticuloConCodigoBarra"); |
| 11838 | try { | 11839 | try { |
| 11839 | // Salida: | 11840 | // Salida: |
| 11840 | Articulo articulo; | 11841 | Articulo articulo; |
| 11841 | 11842 | ||
| 11842 | // 1 Abrimos la base de datos en modo lectura: | 11843 | // 1 Abrimos la base de datos en modo lectura: |
| 11843 | SQLiteDatabase dtb = this.getReadableDatabase(); | 11844 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 11844 | 11845 | ||
| 11845 | // 2 Busqueda en la base: | 11846 | // 2 Busqueda en la base: |
| 11846 | String[] args = new String[] { codigo_barra }; | 11847 | String[] args = new String[] { codigo_barra }; |
| 11847 | Cursor c = dtb.query(tabla_articulos_nombre, null, | 11848 | Cursor c = dtb.query(tabla_articulos_nombre, null, |
| 11848 | ParametrosInventario.bal_bdd_articulo_codigo_barra + "=?", | 11849 | ParametrosInventario.bal_bdd_articulo_codigo_barra + "=?", |
| 11849 | args, null, null, null); | 11850 | args, null, null, null); |
| 11850 | 11851 | ||
| 11851 | // Nos aseguramos de que existe al menos un registro | 11852 | // Nos aseguramos de que existe al menos un registro |
| 11852 | if (c.moveToFirst()) { | 11853 | if (c.moveToFirst()) { |
| 11853 | // 3 Recorremos el resultado (que debe ser nico normalmente) y | 11854 | // 3 Recorremos el resultado (que debe ser nico normalmente) y |
| 11854 | // creamos el articulo | 11855 | // creamos el articulo |
| 11855 | articulo = new Articulo( | 11856 | articulo = new Articulo( |
| 11856 | c.getInt(c | 11857 | c.getInt(c |
| 11857 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), | 11858 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), |
| 11858 | c.getInt(c | 11859 | c.getInt(c |
| 11859 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), | 11860 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), |
| 11860 | c.getInt(c | 11861 | c.getInt(c |
| 11861 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), | 11862 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), |
| 11862 | c.getInt(c | 11863 | c.getInt(c |
| 11863 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), | 11864 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), |
| 11864 | new ArrayList<String>( | 11865 | new ArrayList<String>( |
| 11865 | Arrays.asList(c | 11866 | Arrays.asList(c |
| 11866 | .getString( | 11867 | .getString( |
| 11867 | c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)) | 11868 | c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)) |
| 11868 | .split(","))), | 11869 | .split(","))), |
| 11869 | new ArrayList<String>( | 11870 | new ArrayList<String>( |
| 11870 | Arrays.asList(c | 11871 | Arrays.asList(c |
| 11871 | .getString( | 11872 | .getString( |
| 11872 | c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra_completo)) | 11873 | c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra_completo)) |
| 11873 | .split(","))), | 11874 | .split(","))), |
| 11874 | c.getInt(c | 11875 | c.getInt(c |
| 11875 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), | 11876 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), |
| 11876 | c.getString(c | 11877 | c.getString(c |
| 11877 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), | 11878 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), |
| 11878 | c.getDouble(c | 11879 | c.getDouble(c |
| 11879 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), | 11880 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), |
| 11880 | c.getDouble(c | 11881 | c.getDouble(c |
| 11881 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), | 11882 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), |
| 11882 | c.getString(c | 11883 | c.getString(c |
| 11883 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), | 11884 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), |
| 11884 | c.getInt(c | 11885 | c.getInt(c |
| 11885 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), | 11886 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), |
| 11886 | c.getInt(c | 11887 | c.getInt(c |
| 11887 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), | 11888 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), |
| 11888 | c.getInt(c | 11889 | c.getInt(c |
| 11889 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), | 11890 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), |
| 11890 | c.getInt(c | 11891 | c.getInt(c |
| 11891 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), | 11892 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), |
| 11892 | c.getString(c | 11893 | c.getString(c |
| 11893 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio)), | 11894 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio)), |
| 11894 | c.getString(c | 11895 | c.getString(c |
| 11895 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaFin))); | 11896 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaFin))); |
| 11896 | } else { | 11897 | } else { |
| 11897 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 11898 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 11898 | "Imposible recuperar el ARTICULO cuyo codigo de barra es: " | 11899 | "Imposible recuperar el ARTICULO cuyo codigo de barra es: " |
| 11899 | + codigo_barra); | 11900 | + codigo_barra); |
| 11900 | } | 11901 | } |
| 11901 | dtb.close(); | 11902 | dtb.close(); |
| 11902 | return articulo; | 11903 | return articulo; |
| 11903 | } catch (Exception e) { | 11904 | } catch (Exception e) { |
| 11904 | 11905 | ||
| 11905 | GestorLogEventos log = new GestorLogEventos(); | 11906 | GestorLogEventos log = new GestorLogEventos(); |
| 11906 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 11907 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 11907 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 11908 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 11908 | log.log("[-- 2273 --]" + e.toString(), 4); | 11909 | log.log("[-- 2273 --]" + e.toString(), 4); |
| 11909 | 11910 | ||
| 11910 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 11911 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 11911 | "Imposible recuperar el ARTICULO cuyo codigo de barra es: " | 11912 | "Imposible recuperar el ARTICULO cuyo codigo de barra es: " |
| 11912 | + codigo_barra); | 11913 | + codigo_barra); |
| 11913 | } | 11914 | } |
| 11914 | } | 11915 | } |
| 11915 | 11916 | ||
| 11916 | /** | 11917 | /** |
| 11917 | * Busca en la tabla de referencias una referencia con codigo de barras | 11918 | * Busca en la tabla de referencias una referencia con codigo de barras |
| 11918 | * <p> | 11919 | * <p> |
| 11919 | * 1 Abrimos la base de datos en modo lectura | 11920 | * 1 Abrimos la base de datos en modo lectura |
| 11920 | * <p> | 11921 | * <p> |
| 11921 | * 2 Busqueda en la base | 11922 | * 2 Busqueda en la base |
| 11922 | * <p> | 11923 | * <p> |
| 11923 | * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el | 11924 | * 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el |
| 11924 | * articulo de referencia a devolver | 11925 | * articulo de referencia a devolver |
| 11925 | * <p> | 11926 | * <p> |
| 11926 | * 4 Cerramos y devolvemos | 11927 | * 4 Cerramos y devolvemos |
| 11927 | * @param codigo_barra | 11928 | * @param codigo_barra |
| 11928 | * @return | 11929 | * @return |
| 11929 | * @throws ExceptionBDD | 11930 | * @throws ExceptionBDD |
| 11930 | */ | 11931 | */ |
| 11931 | public Articulo selectReferenciaConCodigoBarra(String codigo_barra) throws ExceptionBDD { | 11932 | public Articulo selectReferenciaConCodigoBarra(String codigo_barra) throws ExceptionBDD { |
| 11932 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra"); | 11933 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra"); |
| 11933 | // Salida: | 11934 | // Salida: |
| 11934 | Articulo referencia = null; | 11935 | Articulo referencia = null; |
| 11935 | // 1 Abrimos la base de datos en modo lectura: | 11936 | // 1 Abrimos la base de datos en modo lectura: |
| 11936 | SQLiteDatabase dtb = this.getReadableDatabase(); | 11937 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 11937 | // 2 Busqueda en la base: | 11938 | // 2 Busqueda en la base: |
| 11938 | String[] args = new String[] { codigo_barra }; | 11939 | String[] args = new String[] { codigo_barra }; |
| 11939 | // Cursor c = dtb.query(tabla_referencias_nombre,// null,// ParametrosInventario.bal_bdd_referencia_codigo_barra// + "%%", args, null, null, null); | 11940 | // Cursor c = dtb.query(tabla_referencias_nombre,// null,// ParametrosInventario.bal_bdd_referencia_codigo_barra// + "%%", args, null, null, null); |
| 11940 | codcompleto = codigo_barra; | 11941 | codcompleto = codigo_barra; |
| 11941 | Cursor c; | 11942 | Cursor c; |
| 11942 | boolean condicionBalanza = ParametrosInventario.balanza; | 11943 | boolean condicionBalanza = ParametrosInventario.balanza; |
| 11943 | String consulta = ""; | 11944 | String consulta = ""; |
| 11944 | /** | 11945 | /** |
| 11945 | * Se valida el largo del codigo de barras para aquellos que tienen menor cantidad de digitos | 11946 | * Se valida el largo del codigo de barras para aquellos que tienen menor cantidad de digitos |
| 11946 | **/ | 11947 | **/ |
| 11947 | if(codigo_barra.length()== 13){ | 11948 | if(codigo_barra.length()== 13){ |
| 11948 | if(condicionBalanza){ | 11949 | if(condicionBalanza){ |
| 11949 | String sSubCadena = codigo_barra.substring(0,2); | 11950 | String sSubCadena = codigo_barra.substring(0,2); |
| 11950 | int subCadena = Integer.parseInt(sSubCadena); | 11951 | int subCadena = Integer.parseInt(sSubCadena); |
| 11951 | String sCodigo = codigo_barra.substring(2,7); | 11952 | String sCodigo = codigo_barra.substring(2,7); |
| 11952 | String peso = codigo_barra.substring(7,12); | 11953 | String peso = codigo_barra.substring(7,12); |
| 11953 | System.out.println("::: BaseDatos selectReferencia 3282 Articulo codigo_barra valor a pasar "); | 11954 | System.out.println("::: BaseDatos selectReferencia 3282 Articulo codigo_barra valor a pasar "); |
| 11954 | pesoObtenido = peso; | 11955 | pesoObtenido = peso; |
| 11955 | String valor; | 11956 | String valor; |
| 11956 | String codCompleto=""; | 11957 | String codCompleto=""; |
| 11957 | switch (subCadena) { | 11958 | switch (subCadena) { |
| 11958 | case 20: | 11959 | case 20: |
| 11959 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 2"); | 11960 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 2"); |
| 11960 | valor = sCodigo; | 11961 | valor = sCodigo; |
| 11961 | dtb.execSQL("UPDATE REFERENCIAS SET REF_CBC='"+codcompleto+"' WHERE REF_CB='"+valor+"'"); | 11962 | dtb.execSQL("UPDATE REFERENCIAS SET REF_CBC='"+codcompleto+"' WHERE REF_CB='"+valor+"'"); |
| 11962 | consulta = "select * from " + tabla_referencias_nombre + " where " | 11963 | consulta = "select * from " + tabla_referencias_nombre + " where " |
| 11963 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + valor + "'"; | 11964 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + valor + "'"; |
| 11964 | c = dtb.rawQuery(consulta, null); | 11965 | c = dtb.rawQuery(consulta, null); |
| 11965 | // Nos aseguramos de que existe al menos un registro | 11966 | // Nos aseguramos de que existe al menos un registro |
| 11966 | if (c.moveToFirst()) { | 11967 | if (c.moveToFirst()) { |
| 11967 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 3"); | 11968 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 3"); |
| 11968 | // 3 Recorremos el resultado (que debe ser nico normalmente) y// creamos el articulo de// referencia a devolver | 11969 | // 3 Recorremos el resultado (que debe ser nico normalmente) y// creamos el articulo de// referencia a devolver |
| 11969 | referencia = new Articulo( | 11970 | referencia = new Articulo( |
| 11970 | c.getInt(c | 11971 | c.getInt(c |
| 11971 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), | 11972 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), |
| 11972 | c.getInt(c | 11973 | c.getInt(c |
| 11973 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), | 11974 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), |
| 11974 | c.getInt(c | 11975 | c.getInt(c |
| 11975 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), | 11976 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), |
| 11976 | c.getInt(c | 11977 | c.getInt(c |
| 11977 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), | 11978 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), |
| 11978 | new ArrayList<String>( | 11979 | new ArrayList<String>( |
| 11979 | Arrays.asList(c | 11980 | Arrays.asList(c |
| 11980 | .getString( | 11981 | .getString( |
| 11981 | c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)) | 11982 | c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)) |
| 11982 | .split(","))), | 11983 | .split(","))), |
| 11983 | new ArrayList<String>( | 11984 | new ArrayList<String>( |
| 11984 | Arrays.asList(c | 11985 | Arrays.asList(c |
| 11985 | .getString( | 11986 | .getString( |
| 11986 | c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)) | 11987 | c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)) |
| 11987 | .split(","))), | 11988 | .split(","))), |
| 11988 | -1, | 11989 | -1, |
| 11989 | c.getString(c | 11990 | c.getString(c |
| 11990 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), | 11991 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), |
| 11991 | c.getDouble(c | 11992 | c.getDouble(c |
| 11992 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), | 11993 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), |
| 11993 | c.getDouble(c | 11994 | c.getDouble(c |
| 11994 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), | 11995 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), |
| 11995 | c.getString(c | 11996 | c.getString(c |
| 11996 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), | 11997 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), |
| 11997 | -1,-1, | 11998 | -1,-1, |
| 11998 | c.getDouble(c | 11999 | c.getDouble(c |
| 11999 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), | 12000 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), |
| 12000 | c.getDouble(c | 12001 | c.getDouble(c |
| 12001 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), | 12002 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), |
| 12002 | c.getInt(c | 12003 | c.getInt(c |
| 12003 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); | 12004 | .getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); |
| 12004 | } | 12005 | } |
| 12005 | else { | 12006 | else { |
| 12006 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 4 "); | 12007 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 4 "); |
| 12007 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12008 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12008 | "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); | 12009 | "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); |
| 12009 | } | 12010 | } |
| 12010 | break; | 12011 | break; |
| 12011 | default: | 12012 | default: |
| 12012 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 5"); | 12013 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 5"); |
| 12013 | valor = codigo_barra; | 12014 | valor = codigo_barra; |
| 12014 | dtb.execSQL("UPDATE REFERENCIAS SET REF_CBC='"+codcompleto+"' WHERE REF_CB='"+valor+"'"); | 12015 | dtb.execSQL("UPDATE REFERENCIAS SET REF_CBC='"+codcompleto+"' WHERE REF_CB='"+valor+"'"); |
| 12015 | consulta = "select * from " + tabla_referencias_nombre | 12016 | consulta = "select * from " + tabla_referencias_nombre |
| 12016 | + " where " | 12017 | + " where " |
| 12017 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" | 12018 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" |
| 12018 | + codigo_barra + "'"; | 12019 | + codigo_barra + "'"; |
| 12019 | System.out.println("::: BaseDatos 4163 consulta2 " + consulta); | 12020 | System.out.println("::: BaseDatos 4163 consulta2 " + consulta); |
| 12020 | c = dtb.rawQuery(consulta, null); | 12021 | c = dtb.rawQuery(consulta, null); |
| 12021 | System.out.println("::: BaseDatos 4163 c.moveToFirst() " + c.moveToFirst()); | 12022 | System.out.println("::: BaseDatos 4163 c.moveToFirst() " + c.moveToFirst()); |
| 12022 | // Nos aseguramos de que existe al menos un registro | 12023 | // Nos aseguramos de que existe al menos un registro |
| 12023 | if (c.moveToFirst()) { | 12024 | if (c.moveToFirst()) { |
| 12024 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 6"); | 12025 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 6"); |
| 12025 | // 3 Recorremos el resultado (que debe ser nico normalmente) y | 12026 | // 3 Recorremos el resultado (que debe ser nico normalmente) y |
| 12026 | // creamos el articulo de // referencia a devolver | 12027 | // creamos el articulo de // referencia a devolver |
| 12027 | referencia = new Articulo( | 12028 | referencia = new Articulo( |
| 12028 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), | 12029 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), |
| 12029 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), | 12030 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), |
| 12030 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), | 12031 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), |
| 12031 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), | 12032 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), |
| 12032 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)).split(","))), | 12033 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)).split(","))), |
| 12033 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)).split(","))), -1, | 12034 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)).split(","))), -1, |
| 12034 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), | 12035 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), |
| 12035 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), | 12036 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), |
| 12036 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), | 12037 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), |
| 12037 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), -1,-1, | 12038 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), -1,-1, |
| 12038 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), | 12039 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), |
| 12039 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), | 12040 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), |
| 12040 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); | 12041 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); |
| 12041 | } else { | 12042 | } else { |
| 12042 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 7"); | 12043 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 7"); |
| 12043 | // System.out.println("::: BaseDatos 3040 codigo_barra " + codigo_barra); | 12044 | // System.out.println("::: BaseDatos 3040 codigo_barra " + codigo_barra); |
| 12044 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12045 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12045 | "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); | 12046 | "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); |
| 12046 | } | 12047 | } |
| 12047 | break; | 12048 | break; |
| 12048 | } | 12049 | } |
| 12049 | }else{ | 12050 | }else{ |
| 12050 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 8"); | 12051 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 8"); |
| 12051 | consulta = "select * from " + tabla_referencias_nombre + " where " | 12052 | consulta = "select * from " + tabla_referencias_nombre + " where " |
| 12052 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + codigo_barra + "'"; | 12053 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + codigo_barra + "'"; |
| 12053 | System.out.println("consulta " + consulta); | 12054 | System.out.println("consulta " + consulta); |
| 12054 | c = dtb.rawQuery(consulta, null); | 12055 | c = dtb.rawQuery(consulta, null); |
| 12055 | // Nos aseguramos de que existe al menos un registro | 12056 | // Nos aseguramos de que existe al menos un registro |
| 12056 | if (c.moveToFirst()) { | 12057 | if (c.moveToFirst()) { |
| 12057 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 9"); | 12058 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 9"); |
| 12058 | // 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el articulo de referencia a devolver | 12059 | // 3 Recorremos el resultado (que debe ser nico normalmente) y creamos el articulo de referencia a devolver |
| 12059 | referencia = new Articulo( | 12060 | referencia = new Articulo( |
| 12060 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), | 12061 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), |
| 12061 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), | 12062 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), |
| 12062 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), | 12063 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), |
| 12063 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), | 12064 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), |
| 12064 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)).split(","))), | 12065 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)).split(","))), |
| 12065 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)).split(","))), -1, | 12066 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)).split(","))), -1, |
| 12066 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), | 12067 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), |
| 12067 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), | 12068 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), |
| 12068 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), | 12069 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), |
| 12069 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), -1,-1, | 12070 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), -1,-1, |
| 12070 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), | 12071 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), |
| 12071 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), | 12072 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), |
| 12072 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)),""); | 12073 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)),""); |
| 12073 | System.out.println(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)); | 12074 | System.out.println(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)); |
| 12074 | System.out.println(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)); | 12075 | System.out.println(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)); |
| 12075 | } else { | 12076 | } else { |
| 12076 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 10"); | 12077 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 10"); |
| 12077 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12078 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12078 | "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); | 12079 | "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); |
| 12079 | } | 12080 | } |
| 12080 | } | 12081 | } |
| 12081 | }else if(codigo_barra.length()!=13){ | 12082 | }else if(codigo_barra.length()!=13){ |
| 12082 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 8"); | 12083 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 8"); |
| 12083 | consulta = "select * from " + tabla_referencias_nombre + " where " | 12084 | consulta = "select * from " + tabla_referencias_nombre + " where " |
| 12084 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + codigo_barra + "'"; | 12085 | + ParametrosInventario.bal_bdd_referencia_codigo_barra + " = '" + codigo_barra + "'"; |
| 12085 | // System.out.println("consulta " + consulta); | 12086 | // System.out.println("consulta " + consulta); |
| 12086 | c = dtb.rawQuery(consulta, null); | 12087 | c = dtb.rawQuery(consulta, null); |
| 12087 | // Nos aseguramos de que existe al menos un registro | 12088 | // Nos aseguramos de que existe al menos un registro |
| 12088 | if (c.moveToFirst()) { | 12089 | if (c.moveToFirst()) { |
| 12089 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 9"); | 12090 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 9"); |
| 12090 | // 3 Recorremos el resultado (que debe ser nico normalmente) y | 12091 | // 3 Recorremos el resultado (que debe ser nico normalmente) y |
| 12091 | // creamos el articulo de | 12092 | // creamos el articulo de |
| 12092 | // referencia a devolver | 12093 | // referencia a devolver |
| 12093 | referencia = new Articulo( | 12094 | referencia = new Articulo( |
| 12094 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), | 12095 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_sector)), |
| 12095 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), | 12096 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo)), |
| 12096 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), | 12097 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_balanza)), |
| 12097 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), | 12098 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_decimales)), |
| 12098 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)).split(","))), | 12099 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra)).split(","))), |
| 12099 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)).split(","))), -1, | 12100 | new ArrayList<String>(Arrays.asList(c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_codigo_barra_completo)).split(","))), -1, |
| 12100 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), | 12101 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_descripcion)), |
| 12101 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), | 12102 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_venta)), |
| 12102 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), | 12103 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_precio_costo)), |
| 12103 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), -1,-1, | 12104 | c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_foto)), -1,-1, |
| 12104 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), | 12105 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_venta)), |
| 12105 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), | 12106 | c.getDouble(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_existencia_deposito)), |
| 12106 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); | 12107 | c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_referencia_depsn)), ""); |
| 12107 | } else { | 12108 | } else { |
| 12108 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 10"); | 12109 | System.out.println("::: BaseDatos 3040 selectReferenciaConCodigoBarra 10"); |
| 12109 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12110 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12110 | "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); | 12111 | "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + codigo_barra); |
| 12111 | } | 12112 | } |
| 12112 | } | 12113 | } |
| 12113 | // 4 Cerramos y devolvemos | 12114 | // 4 Cerramos y devolvemos |
| 12114 | dtb.close(); | 12115 | dtb.close(); |
| 12115 | return referencia; | 12116 | return referencia; |
| 12116 | } | 12117 | } |
| 12117 | public boolean FijarsesiEsta_o_nelArticulo(String codigo_barra) { | 12118 | public boolean FijarsesiEsta_o_nelArticulo(String codigo_barra) { |
| 12118 | System.out.println("::: BaseDatos 3264 FijarsesiEsta_o_nelArticulo"); | 12119 | System.out.println("::: BaseDatos 3264 FijarsesiEsta_o_nelArticulo"); |
| 12119 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12120 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12120 | 12121 | ||
| 12121 | // 2 Busqueda en la base: | 12122 | // 2 Busqueda en la base: |
| 12122 | String[] args = new String[] { codigo_barra }; | 12123 | String[] args = new String[] { codigo_barra }; |
| 12123 | Cursor c = dtb.query(tabla_referencias_nombre, null, | 12124 | Cursor c = dtb.query(tabla_referencias_nombre, null, |
| 12124 | ParametrosInventario.bal_bdd_referencia_codigo_barra + "=?", args, null, null, null); | 12125 | ParametrosInventario.bal_bdd_referencia_codigo_barra + "=?", args, null, null, null); |
| 12125 | if (c.moveToFirst()) { | 12126 | if (c.moveToFirst()) { |
| 12126 | return true; | 12127 | return true; |
| 12127 | } else { | 12128 | } else { |
| 12128 | return false; | 12129 | return false; |
| 12129 | } | 12130 | } |
| 12130 | } | 12131 | } |
| 12131 | /** | 12132 | /** |
| 12132 | * Funcion para buscar un articulo en las bases de datos locales, tanto de | 12133 | * Funcion para buscar un articulo en las bases de datos locales, tanto de |
| 12133 | * referencias como de articulos en el caso de que se haya cargado nuevo en | 12134 | * referencias como de articulos en el caso de que se haya cargado nuevo en |
| 12134 | * este momento | 12135 | * este momento |
| 12135 | * <p> | 12136 | * <p> |
| 12136 | * 1 Busca en las referencias | 12137 | * 1 Busca en las referencias |
| 12137 | * <p> | 12138 | * <p> |
| 12138 | * 2 Si no se encontro en las referencias, lo buscamos en la tabla de | 12139 | * 2 Si no se encontro en las referencias, lo buscamos en la tabla de |
| 12139 | * Articulos por codigo de barra | 12140 | * Articulos por codigo de barra |
| 12140 | * | 12141 | * |
| 12141 | * @param cod_barra | 12142 | * @param cod_barra |
| 12142 | * @return | 12143 | * @return |
| 12143 | * @throws ExceptionBDD | 12144 | * @throws ExceptionBDD |
| 12144 | */ | 12145 | */ |
| 12145 | public Articulo selectReferenciaArticuloConCodigoBarra(String cod_barra) throws ExceptionBDD { | 12146 | public Articulo selectReferenciaArticuloConCodigoBarra(String cod_barra) throws ExceptionBDD { |
| 12146 | System.out.println("::: BaseDatos 3296 selectReferenciaArticuloConCodigoBarra"); | 12147 | System.out.println("::: BaseDatos 3296 selectReferenciaArticuloConCodigoBarra"); |
| 12147 | Articulo articuloEncontrado; | 12148 | Articulo articuloEncontrado; |
| 12148 | try { | 12149 | try { |
| 12149 | // 1 Busca en las referencias | 12150 | // 1 Busca en las referencias |
| 12150 | articuloEncontrado = this.selectReferenciaConCodigoBarra(cod_barra); | 12151 | articuloEncontrado = this.selectReferenciaConCodigoBarra(cod_barra); |
| 12151 | } catch (ExceptionBDD e) { | 12152 | } catch (ExceptionBDD e) { |
| 12152 | GestorLogEventos log = new GestorLogEventos(); | 12153 | GestorLogEventos log = new GestorLogEventos(); |
| 12153 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12154 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12154 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12155 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12155 | log.log("[-- 2387 --]" + e.toString(), 4); | 12156 | log.log("[-- 2387 --]" + e.toString(), 4); |
| 12156 | // No se encontro en la tabla de referencias | 12157 | // No se encontro en la tabla de referencias |
| 12157 | try { | 12158 | try { |
| 12158 | // 2 Si no se encontro en las referencias, lo buscamos en la | 12159 | // 2 Si no se encontro en las referencias, lo buscamos en la |
| 12159 | // tabla de Articulos por codigo de barra | 12160 | // tabla de Articulos por codigo de barra |
| 12160 | articuloEncontrado = this.selectArticuloConCodigoBarra(cod_barra); | 12161 | articuloEncontrado = this.selectArticuloConCodigoBarra(cod_barra); |
| 12161 | } catch (ExceptionBDD ex) { | 12162 | } catch (ExceptionBDD ex) { |
| 12162 | GestorLogEventos log1 = new GestorLogEventos(); | 12163 | GestorLogEventos log1 = new GestorLogEventos(); |
| 12163 | log1.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12164 | log1.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12164 | log1.log(e.toString(), 4); | 12165 | log1.log(e.toString(), 4); |
| 12165 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + cod_barra); | 12166 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, "Imposible recuperar la REFERENCIA cuyo codigo de barra es: " + cod_barra); |
| 12166 | } | 12167 | } |
| 12167 | } | 12168 | } |
| 12168 | return articuloEncontrado; | 12169 | return articuloEncontrado; |
| 12169 | } | 12170 | } |
| 12170 | 12171 | ||
| 12171 | /** | 12172 | /** |
| 12172 | * Obtiene los ARTICULOS del inventario indicado en parametro | 12173 | * Obtiene los ARTICULOS del inventario indicado en parametro |
| 12173 | * <p> | 12174 | * <p> |
| 12174 | * 1 Abrimos la base de datos en modo lectura | 12175 | * 1 Abrimos la base de datos en modo lectura |
| 12175 | * <p> | 12176 | * <p> |
| 12176 | * 2 Sacamos todos los ARTICULOS que tienen el dicho numero de INVENTARIO | 12177 | * 2 Sacamos todos los ARTICULOS que tienen el dicho numero de INVENTARIO |
| 12177 | * <p> | 12178 | * <p> |
| 12178 | * 3 Para cada articlo lo Creamos | 12179 | * 3 Para cada articlo lo Creamos |
| 12179 | * <p> | 12180 | * <p> |
| 12180 | * 4 Lo agregamos a la lista de resultados | 12181 | * 4 Lo agregamos a la lista de resultados |
| 12181 | * <p> | 12182 | * <p> |
| 12182 | * 5 Cerramos la BD | 12183 | * 5 Cerramos la BD |
| 12183 | * | 12184 | * |
| 12184 | * @param numero_inventario | 12185 | * @param numero_inventario |
| 12185 | * @return | 12186 | * @return |
| 12186 | * @throws ExceptionBDD | 12187 | * @throws ExceptionBDD |
| 12187 | */ | 12188 | */ |
| 12188 | public ArrayList<ArticuloVisible> selectArticulosConNumeroInventario(int numero_inventario) throws ExceptionBDD { | 12189 | public ArrayList<ArticuloVisible> selectArticulosConNumeroInventario(int numero_inventario) throws ExceptionBDD { |
| 12189 | System.out.println("::: BaseDatos 3349 selectArticulosConNumeroInventario " + numero_inventario); | 12190 | System.out.println("::: BaseDatos 3349 selectArticulosConNumeroInventario " + numero_inventario); |
| 12190 | try { | 12191 | try { |
| 12191 | // Variable de retorno: | 12192 | // Variable de retorno: |
| 12192 | ArrayList<ArticuloVisible> result = new ArrayList<ArticuloVisible>(); | 12193 | ArrayList<ArticuloVisible> result = new ArrayList<ArticuloVisible>(); |
| 12193 | // 1 Abrimos la base de datos en modo lectura | 12194 | // 1 Abrimos la base de datos en modo lectura |
| 12194 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12195 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12195 | // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de | 12196 | // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de |
| 12196 | // INVENTARIO | 12197 | // INVENTARIO |
| 12197 | String[] args = new String[] { String.valueOf(numero_inventario) }; | 12198 | String[] args = new String[] { String.valueOf(numero_inventario) }; |
| 12198 | Cursor c = dtb.query(tabla_articulos_nombre, null, | 12199 | Cursor c = dtb.query(tabla_articulos_nombre, null, |
| 12199 | ParametrosInventario.bal_bdd_articulo_inventario + "=?", | 12200 | ParametrosInventario.bal_bdd_articulo_inventario + "=?", |
| 12200 | args, null, null, null); | 12201 | args, null, null, null); |
| 12201 | int contador = 0; | 12202 | int contador = 0; |
| 12202 | // Combinamos el sector y el codigo bajo formato: [sector]-[codigo] | 12203 | // Combinamos el sector y el codigo bajo formato: [sector]-[codigo] |
| 12203 | if (c.moveToFirst()) { | 12204 | if (c.moveToFirst()) { |
| 12204 | while (c.isAfterLast() == false) { | 12205 | while (c.isAfterLast() == false) { |
| 12205 | // 3 Para cada articlo lo Creamos | 12206 | // 3 Para cada articlo lo Creamos |
| 12206 | String codigo_barra = c | 12207 | String codigo_barra = c |
| 12207 | .getString(c | 12208 | .getString(c |
| 12208 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)); | 12209 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)); |
| 12209 | ArticuloVisible articulo = new ArticuloVisible( | 12210 | ArticuloVisible articulo = new ArticuloVisible( |
| 12210 | c.getInt(c | 12211 | c.getInt(c |
| 12211 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), | 12212 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), |
| 12212 | c.getInt(c | 12213 | c.getInt(c |
| 12213 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), | 12214 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), |
| 12214 | c.getInt(c | 12215 | c.getInt(c |
| 12215 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), | 12216 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), |
| 12216 | c.getInt(c | 12217 | c.getInt(c |
| 12217 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), | 12218 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), |
| 12218 | new ArrayList<String>(Arrays.asList(codigo_barra | 12219 | new ArrayList<String>(Arrays.asList(codigo_barra |
| 12219 | .split(","))), | 12220 | .split(","))), |
| 12220 | new ArrayList<String>(Arrays.asList(codigo_barra | 12221 | new ArrayList<String>(Arrays.asList(codigo_barra |
| 12221 | .split(","))), | 12222 | .split(","))), |
| 12222 | c.getInt(c | 12223 | c.getInt(c |
| 12223 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), | 12224 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), |
| 12224 | c.getString(c | 12225 | c.getString(c |
| 12225 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), | 12226 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), |
| 12226 | c.getDouble(c | 12227 | c.getDouble(c |
| 12227 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), | 12228 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), |
| 12228 | c.getDouble(c | 12229 | c.getDouble(c |
| 12229 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), | 12230 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), |
| 12230 | c.getString(c | 12231 | c.getString(c |
| 12231 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), | 12232 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), |
| 12232 | c.getFloat(c | 12233 | c.getFloat(c |
| 12233 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), | 12234 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), |
| 12234 | c.getFloat(c | 12235 | c.getFloat(c |
| 12235 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), | 12236 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), |
| 12236 | c.getInt(c | 12237 | c.getInt(c |
| 12237 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), | 12238 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), |
| 12238 | c.getInt(c | 12239 | c.getInt(c |
| 12239 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), | 12240 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), |
| 12240 | c.getInt(c | 12241 | c.getInt(c |
| 12241 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), | 12242 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), |
| 12242 | c.getString(c | 12243 | c.getString(c |
| 12243 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); | 12244 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); |
| 12244 | 12245 | ||
| 12245 | // 4 Lo agregamos a la lista de resultados | 12246 | // 4 Lo agregamos a la lista de resultados |
| 12246 | contador = contador + 1; | 12247 | contador = contador + 1; |
| 12247 | // if(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito))==0){ | 12248 | // if(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito))==0){ |
| 12248 | //// c.moveToNext(); | 12249 | //// c.moveToNext(); |
| 12249 | // System.out.println(":::: No quiero q haga nada"); | 12250 | // System.out.println(":::: No quiero q haga nada"); |
| 12250 | // }else{ | 12251 | // }else{ |
| 12251 | // result.add(articulo); | 12252 | // result.add(articulo); |
| 12252 | // c.moveToNext(); } | 12253 | // c.moveToNext(); } |
| 12253 | result.add(articulo); | 12254 | result.add(articulo); |
| 12254 | c.moveToNext(); | 12255 | c.moveToNext(); |
| 12255 | } | 12256 | } |
| 12256 | } | 12257 | } |
| 12257 | 12258 | ||
| 12258 | // 5 Cerramos la BD | 12259 | // 5 Cerramos la BD |
| 12259 | dtb.close(); | 12260 | dtb.close(); |
| 12260 | return result; | 12261 | return result; |
| 12261 | 12262 | ||
| 12262 | } catch (Exception e) { | 12263 | } catch (Exception e) { |
| 12263 | 12264 | ||
| 12264 | GestorLogEventos log = new GestorLogEventos(); | 12265 | GestorLogEventos log = new GestorLogEventos(); |
| 12265 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12266 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12266 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12267 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12267 | log.log("[-- 2490 --]" + e.toString(), 4); | 12268 | log.log("[-- 2490 --]" + e.toString(), 4); |
| 12268 | 12269 | ||
| 12269 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12270 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12270 | "Imposible obtener los ARTICULOS del INVENTARIO n" | 12271 | "Imposible obtener los ARTICULOS del INVENTARIO n" |
| 12271 | + numero_inventario); | 12272 | + numero_inventario); |
| 12272 | } | 12273 | } |
| 12273 | 12274 | ||
| 12274 | } | 12275 | } |
| 12275 | 12276 | ||
| 12276 | /*COMPRA*/ | 12277 | /*COMPRA*/ |
| 12277 | 12278 | ||
| 12278 | public ArrayList<ArticuloVisible> selectArticulosConNumeroInventarioCompra( | 12279 | public ArrayList<ArticuloVisible> selectArticulosConNumeroInventarioCompra( |
| 12279 | int numero_inventario) throws ExceptionBDD { | 12280 | int numero_inventario) throws ExceptionBDD { |
| 12280 | System.out.println("::: BaseDatos 5246 selectArticulosConNumeroInventarioCompra " + numero_inventario); | 12281 | System.out.println("::: BaseDatos 5246 selectArticulosConNumeroInventarioCompra " + numero_inventario); |
| 12281 | try { | 12282 | try { |
| 12282 | // Variable de retorno: | 12283 | // Variable de retorno: |
| 12283 | ArrayList<ArticuloVisible> result = new ArrayList<ArticuloVisible>(); | 12284 | ArrayList<ArticuloVisible> result = new ArrayList<ArticuloVisible>(); |
| 12284 | // 1 Abrimos la base de datos en modo lectura | 12285 | // 1 Abrimos la base de datos en modo lectura |
| 12285 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12286 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12286 | // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de | 12287 | // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de |
| 12287 | // INVENTARIO | 12288 | // INVENTARIO |
| 12288 | String[] args = new String[] { String.valueOf(numero_inventario) }; | 12289 | String[] args = new String[] { String.valueOf(numero_inventario) }; |
| 12289 | Cursor c = dtb.query(tabla_articulos_nombre, null, | 12290 | Cursor c = dtb.query(tabla_articulos_nombre, null, |
| 12290 | ParametrosInventario.bal_bdd_articulo_inventario + "=?", | 12291 | ParametrosInventario.bal_bdd_articulo_inventario + "=?", |
| 12291 | args, null, null, null); | 12292 | args, null, null, null); |
| 12292 | int contador = 0; | 12293 | int contador = 0; |
| 12293 | // Combinamos el sector y el codigo bajo formato: [sector]-[codigo] | 12294 | // Combinamos el sector y el codigo bajo formato: [sector]-[codigo] |
| 12294 | if (c.moveToFirst()) { | 12295 | if (c.moveToFirst()) { |
| 12295 | while (c.isAfterLast() == false) { | 12296 | while (c.isAfterLast() == false) { |
| 12296 | // 3 Para cada articlo lo Creamos | 12297 | // 3 Para cada articlo lo Creamos |
| 12297 | String codigo_barra = c | 12298 | String codigo_barra = c |
| 12298 | .getString(c | 12299 | .getString(c |
| 12299 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)); | 12300 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo_barra)); |
| 12300 | ArticuloVisible articulo = new ArticuloVisible( | 12301 | ArticuloVisible articulo = new ArticuloVisible( |
| 12301 | c.getInt(c | 12302 | c.getInt(c |
| 12302 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), | 12303 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector)), |
| 12303 | c.getInt(c | 12304 | c.getInt(c |
| 12304 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), | 12305 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo)), |
| 12305 | c.getInt(c | 12306 | c.getInt(c |
| 12306 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), | 12307 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_balanza)), |
| 12307 | c.getInt(c | 12308 | c.getInt(c |
| 12308 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), | 12309 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_decimales)), |
| 12309 | new ArrayList<String>(Arrays.asList(codigo_barra | 12310 | new ArrayList<String>(Arrays.asList(codigo_barra |
| 12310 | .split(","))), | 12311 | .split(","))), |
| 12311 | new ArrayList<String>(Arrays.asList(codigo_barra | 12312 | new ArrayList<String>(Arrays.asList(codigo_barra |
| 12312 | .split(","))), | 12313 | .split(","))), |
| 12313 | c.getInt(c | 12314 | c.getInt(c |
| 12314 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), | 12315 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_inventario)), |
| 12315 | c.getString(c | 12316 | c.getString(c |
| 12316 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), | 12317 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_descripcion)), |
| 12317 | c.getDouble(c | 12318 | c.getDouble(c |
| 12318 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), | 12319 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_venta)), |
| 12319 | c.getDouble(c | 12320 | c.getDouble(c |
| 12320 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), | 12321 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_precio_costo)), |
| 12321 | c.getString(c | 12322 | c.getString(c |
| 12322 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), | 12323 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_foto)), |
| 12323 | c.getFloat(c | 12324 | c.getFloat(c |
| 12324 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), | 12325 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_cantidad)), |
| 12325 | c.getFloat(c | 12326 | c.getFloat(c |
| 12326 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), | 12327 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_subtotal)), |
| 12327 | c.getInt(c | 12328 | c.getInt(c |
| 12328 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), | 12329 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_venta)), |
| 12329 | c.getInt(c | 12330 | c.getInt(c |
| 12330 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), | 12331 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito)), |
| 12331 | c.getInt(c | 12332 | c.getInt(c |
| 12332 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), | 12333 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_depsn)), |
| 12333 | c.getString(c | 12334 | c.getString(c |
| 12334 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); | 12335 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_fechaInicio))); |
| 12335 | // 4 Lo agregamos a la lista de resultados | 12336 | // 4 Lo agregamos a la lista de resultados |
| 12336 | contador = contador + 1; | 12337 | contador = contador + 1; |
| 12337 | // if(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito))==0){ | 12338 | // if(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_articulo_existencia_deposito))==0){ |
| 12338 | //// c.moveToNext(); | 12339 | //// c.moveToNext(); |
| 12339 | // System.out.println(":::: No quiero q haga nada"); | 12340 | // System.out.println(":::: No quiero q haga nada"); |
| 12340 | // }else{ | 12341 | // }else{ |
| 12341 | // result.add(articulo); | 12342 | // result.add(articulo); |
| 12342 | // c.moveToNext(); } | 12343 | // c.moveToNext(); } |
| 12343 | result.add(articulo); | 12344 | result.add(articulo); |
| 12344 | c.moveToNext(); | 12345 | c.moveToNext(); |
| 12345 | } | 12346 | } |
| 12346 | } | 12347 | } |
| 12347 | 12348 | ||
| 12348 | // 5 Cerramos la BD | 12349 | // 5 Cerramos la BD |
| 12349 | dtb.close(); | 12350 | dtb.close(); |
| 12350 | return result; | 12351 | return result; |
| 12351 | 12352 | ||
| 12352 | } catch (Exception e) { | 12353 | } catch (Exception e) { |
| 12353 | 12354 | ||
| 12354 | GestorLogEventos log = new GestorLogEventos(); | 12355 | GestorLogEventos log = new GestorLogEventos(); |
| 12355 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12356 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12356 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12357 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12357 | log.log("[-- 2490 --]" + e.toString(), 4); | 12358 | log.log("[-- 2490 --]" + e.toString(), 4); |
| 12358 | 12359 | ||
| 12359 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12360 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12360 | "Imposible obtener los ARTICULOS del INVENTARIO n" | 12361 | "Imposible obtener los ARTICULOS del INVENTARIO n" |
| 12361 | + numero_inventario); | 12362 | + numero_inventario); |
| 12362 | } | 12363 | } |
| 12363 | 12364 | ||
| 12364 | } | 12365 | } |
| 12365 | 12366 | ||
| 12366 | /** | 12367 | /** |
| 12367 | * Obtiene la lista de los pares (sector,codigo) de todos los ARTICULOS en | 12368 | * Obtiene la lista de los pares (sector,codigo) de todos los ARTICULOS en |
| 12368 | * curso que se encuentran en la base | 12369 | * curso que se encuentran en la base |
| 12369 | * <p> | 12370 | * <p> |
| 12370 | * 1 Abrimos la base de datos en modo lectura | 12371 | * 1 Abrimos la base de datos en modo lectura |
| 12371 | * <p> | 12372 | * <p> |
| 12372 | * 2 Ejecutamos la busqueda | 12373 | * 2 Ejecutamos la busqueda |
| 12373 | * <p> | 12374 | * <p> |
| 12374 | * 3 Para cada articulo encontrado generamos la combinacion de sector y | 12375 | * 3 Para cada articulo encontrado generamos la combinacion de sector y |
| 12375 | * codigo | 12376 | * codigo |
| 12376 | * <p> | 12377 | * <p> |
| 12377 | * 4 Cierre | 12378 | * 4 Cierre |
| 12378 | * | 12379 | * |
| 12379 | * @return Lista de los pares de codigos de cada articulo {sector ; codigo} | 12380 | * @return Lista de los pares de codigos de cada articulo {sector ; codigo} |
| 12380 | * @throws ExceptionBDD | 12381 | * @throws ExceptionBDD |
| 12381 | */ | 12382 | */ |
| 12382 | public ArrayList<HashMap<String, Integer>> selectArticulosCodigosEnBdd() | 12383 | public ArrayList<HashMap<String, Integer>> selectArticulosCodigosEnBdd() |
| 12383 | throws ExceptionBDD { | 12384 | throws ExceptionBDD { |
| 12384 | System.out.println("::: BaseDatos 3452 "); | 12385 | System.out.println("::: BaseDatos 3452 "); |
| 12385 | try { | 12386 | try { |
| 12386 | // Variable de respuesta: | 12387 | // Variable de respuesta: |
| 12387 | ArrayList<HashMap<String, Integer>> result = new ArrayList<HashMap<String, Integer>>(); | 12388 | ArrayList<HashMap<String, Integer>> result = new ArrayList<HashMap<String, Integer>>(); |
| 12388 | 12389 | ||
| 12389 | // 1 Abrimos la base de datos en modo lectura | 12390 | // 1 Abrimos la base de datos en modo lectura |
| 12390 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12391 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12391 | 12392 | ||
| 12392 | // Request: | 12393 | // Request: |
| 12393 | String[] cols = new String[] { | 12394 | String[] cols = new String[] { |
| 12394 | ParametrosInventario.bal_bdd_articulo_sector, | 12395 | ParametrosInventario.bal_bdd_articulo_sector, |
| 12395 | ParametrosInventario.bal_bdd_articulo_codigo }; | 12396 | ParametrosInventario.bal_bdd_articulo_codigo }; |
| 12396 | // 2 Ejecutamos la busqueda | 12397 | // 2 Ejecutamos la busqueda |
| 12397 | Cursor c = dtb.query(tabla_articulos_nombre, cols, null, null, | 12398 | Cursor c = dtb.query(tabla_articulos_nombre, cols, null, null, |
| 12398 | null, null, null); | 12399 | null, null, null); |
| 12399 | 12400 | ||
| 12400 | // Result: | 12401 | // Result: |
| 12401 | if (c.moveToFirst()) { | 12402 | if (c.moveToFirst()) { |
| 12402 | while (c.isAfterLast() == false) { | 12403 | while (c.isAfterLast() == false) { |
| 12403 | // 3 Para cada articulo encontrado generamos la combinacion | 12404 | // 3 Para cada articulo encontrado generamos la combinacion |
| 12404 | // de sector y codigo | 12405 | // de sector y codigo |
| 12405 | HashMap<String, Integer> hashmapArticulo = new HashMap<String, Integer>(); | 12406 | HashMap<String, Integer> hashmapArticulo = new HashMap<String, Integer>(); |
| 12406 | hashmapArticulo | 12407 | hashmapArticulo |
| 12407 | .put(ParametrosInventario.bal_bdd_articulo_sector, | 12408 | .put(ParametrosInventario.bal_bdd_articulo_sector, |
| 12408 | c.getInt(c | 12409 | c.getInt(c |
| 12409 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector))); | 12410 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_sector))); |
| 12410 | hashmapArticulo | 12411 | hashmapArticulo |
| 12411 | .put(ParametrosInventario.bal_bdd_articulo_codigo, | 12412 | .put(ParametrosInventario.bal_bdd_articulo_codigo, |
| 12412 | c.getInt(c | 12413 | c.getInt(c |
| 12413 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo))); | 12414 | .getColumnIndex(ParametrosInventario.bal_bdd_articulo_codigo))); |
| 12414 | result.add(hashmapArticulo); | 12415 | result.add(hashmapArticulo); |
| 12415 | c.moveToNext(); | 12416 | c.moveToNext(); |
| 12416 | } | 12417 | } |
| 12417 | } else { | 12418 | } else { |
| 12418 | result = null; | 12419 | result = null; |
| 12419 | } | 12420 | } |
| 12420 | // 4 Cierre: | 12421 | // 4 Cierre: |
| 12421 | dtb.close(); | 12422 | dtb.close(); |
| 12422 | return result; | 12423 | return result; |
| 12423 | } catch (Exception e) { | 12424 | } catch (Exception e) { |
| 12424 | GestorLogEventos log = new GestorLogEventos(); | 12425 | GestorLogEventos log = new GestorLogEventos(); |
| 12425 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12426 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12426 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12427 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12427 | log.log("[-- 2563 --]" + e.toString(), 4); | 12428 | log.log("[-- 2563 --]" + e.toString(), 4); |
| 12428 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12429 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12429 | "Imposible inventariar todos los ARTICULOS de la Base De Datos"); | 12430 | "Imposible inventariar todos los ARTICULOS de la Base De Datos"); |
| 12430 | } | 12431 | } |
| 12431 | } | 12432 | } |
| 12432 | 12433 | ||
| 12433 | /** | 12434 | /** |
| 12434 | * Obtiene la lista de los codigos de todos los ARTICULOS que pertenecen a | 12435 | * Obtiene la lista de los codigos de todos los ARTICULOS que pertenecen a |
| 12435 | * un INVENTARIO en particular | 12436 | * un INVENTARIO en particular |
| 12436 | * <p> | 12437 | * <p> |
| 12437 | * 1 Abrimos la base de datos en modo lectura | 12438 | * 1 Abrimos la base de datos en modo lectura |
| 12438 | * <p> | 12439 | * <p> |
| 12439 | * 2 Sacamos todos los ARTICULOS que tienen el dicho numero de INVENTARIO | 12440 | * 2 Sacamos todos los ARTICULOS que tienen el dicho numero de INVENTARIO |
| 12440 | * <p> | 12441 | * <p> |
| 12441 | * 3 Combinamos el sector y el codigo bajo formato: [sector]-[codigo] | 12442 | * 3 Combinamos el sector y el codigo bajo formato: [sector]-[codigo] |
| 12442 | * <p> | 12443 | * <p> |
| 12443 | * 4 Agregamos el hashmap a la lista | 12444 | * 4 Agregamos el hashmap a la lista |
| 12444 | * <p> | 12445 | * <p> |
| 12445 | * 5 Cerramos la BD | 12446 | * 5 Cerramos la BD |
| 12446 | * | 12447 | * |
| 12447 | * @param numero_inventario | 12448 | * @param numero_inventario |
| 12448 | * @return ArrayList<(sector,codigo)> con cada respuesta bajo forma | 12449 | * @return ArrayList<(sector,codigo)> con cada respuesta bajo forma |
| 12449 | * [sector]-[codigo] en String | 12450 | * [sector]-[codigo] en String |
| 12450 | * @throws ExceptionBDD | 12451 | * @throws ExceptionBDD |
| 12451 | */ | 12452 | */ |
| 12452 | public ArrayList<HashMap<String, Integer>> selectArticulosCodigosConNumeroInventario( | 12453 | public ArrayList<HashMap<String, Integer>> selectArticulosCodigosConNumeroInventario( |
| 12453 | int numero_inventario) throws ExceptionBDD { | 12454 | int numero_inventario) throws ExceptionBDD { |
| 12454 | System.out.println("::: BaseDatos 3527"); | 12455 | System.out.println("::: BaseDatos 3527"); |
| 12455 | try { | 12456 | try { |
| 12456 | // Variable de retorno: | 12457 | // Variable de retorno: |
| 12457 | ArrayList<HashMap<String, Integer>> result = new ArrayList<HashMap<String, Integer>>(); | 12458 | ArrayList<HashMap<String, Integer>> result = new ArrayList<HashMap<String, Integer>>(); |
| 12458 | // 1 Abrimos la base de datos en modo lectura | 12459 | // 1 Abrimos la base de datos en modo lectura |
| 12459 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12460 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12460 | // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de | 12461 | // 2 Sacamos todos los ARTICULOS que tienen el dicho numero de |
| 12461 | // INVENTARIO: | 12462 | // INVENTARIO: |
| 12462 | String[] cols = new String[] { | 12463 | String[] cols = new String[] { |
| 12463 | ParametrosInventario.bal_bdd_articulo_sector, | 12464 | ParametrosInventario.bal_bdd_articulo_sector, |
| 12464 | ParametrosInventario.bal_bdd_articulo_codigo }; | 12465 | ParametrosInventario.bal_bdd_articulo_codigo }; |
| 12465 | String[] args = new String[] { String.valueOf(numero_inventario) }; | 12466 | String[] args = new String[] { String.valueOf(numero_inventario) }; |
| 12466 | Cursor c = dtb.query(tabla_articulos_nombre, cols, | 12467 | Cursor c = dtb.query(tabla_articulos_nombre, cols, |
| 12467 | ParametrosInventario.bal_bdd_articulo_inventario + "=?", | 12468 | ParametrosInventario.bal_bdd_articulo_inventario + "=?", |
| 12468 | args, null, null, null); | 12469 | args, null, null, null); |
| 12469 | // 3 Combinamos el sector y el codigo bajo formato: | 12470 | // 3 Combinamos el sector y el codigo bajo formato: |
| 12470 | // [sector]-[codigo] | 12471 | // [sector]-[codigo] |
| 12471 | if (c.moveToFirst()) { | 12472 | if (c.moveToFirst()) { |
| 12472 | while (c.isAfterLast() == false) { | 12473 | while (c.isAfterLast() == false) { |
| 12473 | HashMap<String, Integer> hashmapArticulo = new HashMap<String, Integer>(); | 12474 | HashMap<String, Integer> hashmapArticulo = new HashMap<String, Integer>(); |
| 12474 | hashmapArticulo.put( | 12475 | hashmapArticulo.put( |
| 12475 | ParametrosInventario.bal_bdd_articulo_sector, | 12476 | ParametrosInventario.bal_bdd_articulo_sector, |
| 12476 | c.getInt(0)); | 12477 | c.getInt(0)); |
| 12477 | hashmapArticulo.put( | 12478 | hashmapArticulo.put( |
| 12478 | ParametrosInventario.bal_bdd_articulo_codigo, | 12479 | ParametrosInventario.bal_bdd_articulo_codigo, |
| 12479 | c.getInt(1)); | 12480 | c.getInt(1)); |
| 12480 | // 4 Agregamos el hashmap a la lista | 12481 | // 4 Agregamos el hashmap a la lista |
| 12481 | result.add(hashmapArticulo); | 12482 | result.add(hashmapArticulo); |
| 12482 | c.moveToNext(); | 12483 | c.moveToNext(); |
| 12483 | } | 12484 | } |
| 12484 | } | 12485 | } |
| 12485 | // 5 Cerramos la BD | 12486 | // 5 Cerramos la BD |
| 12486 | dtb.close(); | 12487 | dtb.close(); |
| 12487 | return result; | 12488 | return result; |
| 12488 | } catch (Exception e) { | 12489 | } catch (Exception e) { |
| 12489 | GestorLogEventos log = new GestorLogEventos(); | 12490 | GestorLogEventos log = new GestorLogEventos(); |
| 12490 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12491 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12491 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12492 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12492 | log.log("[-- 2634 --]" + e.toString(), 4); | 12493 | log.log("[-- 2634 --]" + e.toString(), 4); |
| 12493 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12494 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12494 | "Imposible obtener los articulos del inventario n" | 12495 | "Imposible obtener los articulos del inventario n" |
| 12495 | + numero_inventario); | 12496 | + numero_inventario); |
| 12496 | } | 12497 | } |
| 12497 | 12498 | ||
| 12498 | } | 12499 | } |
| 12499 | 12500 | ||
| 12500 | /** | 12501 | /** |
| 12501 | * Calcula cuantos articulos contiene cada inventario, los que ya han sido | 12502 | * Calcula cuantos articulos contiene cada inventario, los que ya han sido |
| 12502 | * contado y los que queda por contar | 12503 | * contado y los que queda por contar |
| 12503 | * <p> | 12504 | * <p> |
| 12504 | * 1 Abrimos la base de datos en modo lectura | 12505 | * 1 Abrimos la base de datos en modo lectura |
| 12505 | * <p> | 12506 | * <p> |
| 12506 | * 2 Clculo de cuantos articulos no han sido inventariado en este | 12507 | * 2 Clculo de cuantos articulos no han sido inventariado en este |
| 12507 | * inventario | 12508 | * inventario |
| 12508 | * <p> | 12509 | * <p> |
| 12509 | * 3 Clculo de todos los articulos que inventariar | 12510 | * 3 Clculo de todos los articulos que inventariar |
| 12510 | * <p> | 12511 | * <p> |
| 12511 | * 4 Construccin del ArrayList de resultado | 12512 | * 4 Construccin del ArrayList de resultado |
| 12512 | * <p> | 12513 | * <p> |
| 12513 | * 5 Cerramos la BD | 12514 | * 5 Cerramos la BD |
| 12514 | * | 12515 | * |
| 12515 | * @param numero_inventario | 12516 | * @param numero_inventario |
| 12516 | * Numero del inventario | 12517 | * Numero del inventario |
| 12517 | * @return ArrayList<Integer> segn el esquema: [narticulos en el | 12518 | * @return ArrayList<Integer> segn el esquema: [narticulos en el |
| 12518 | * inventario ; narticulos ya contados ; n articulos faltantes] | 12519 | * inventario ; narticulos ya contados ; n articulos faltantes] |
| 12519 | * @throws ExceptionBDD | 12520 | * @throws ExceptionBDD |
| 12520 | * En caso de fracaso | 12521 | * En caso de fracaso |
| 12521 | */ | 12522 | */ |
| 12522 | public ArrayList<Integer> selectEstadisticasConIdInventario( | 12523 | public ArrayList<Integer> selectEstadisticasConIdInventario( |
| 12523 | int numero_inventario) throws ExceptionBDD { | 12524 | int numero_inventario) throws ExceptionBDD { |
| 12524 | System.out.println("::: BaseDatos 3604"); | 12525 | System.out.println("::: BaseDatos 3604"); |
| 12525 | try { | 12526 | try { |
| 12526 | // Variable de retorno: | 12527 | // Variable de retorno: |
| 12527 | ArrayList<Integer> result = new ArrayList<Integer>(); | 12528 | ArrayList<Integer> result = new ArrayList<Integer>(); |
| 12528 | 12529 | ||
| 12529 | // 1 Abrimos la base de datos en modo lectura | 12530 | // 1 Abrimos la base de datos en modo lectura |
| 12530 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12531 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12531 | 12532 | ||
| 12532 | // 2 Clculo de cuantos articulos no han sido inventariado en este | 12533 | // 2 Clculo de cuantos articulos no han sido inventariado en este |
| 12533 | // inventario: | 12534 | // inventario: |
| 12534 | // (Se admite que un articulo que todavia no ha sido inventariado | 12535 | // (Se admite que un articulo que todavia no ha sido inventariado |
| 12535 | // tiene una cantidad de -1) | 12536 | // tiene una cantidad de -1) |
| 12536 | String consultaArticulosSinContar = "SELECT COUNT(*) " + "FROM " | 12537 | String consultaArticulosSinContar = "SELECT COUNT(*) " + "FROM " |
| 12537 | + tabla_articulos_nombre + " " + "WHERE " | 12538 | + tabla_articulos_nombre + " " + "WHERE " |
| 12538 | + ParametrosInventario.bal_bdd_articulo_cantidad + "<0 " | 12539 | + ParametrosInventario.bal_bdd_articulo_cantidad + "<0 " |
| 12539 | + "AND " + ParametrosInventario.bal_bdd_articulo_inventario | 12540 | + "AND " + ParametrosInventario.bal_bdd_articulo_inventario |
| 12540 | + "=" + numero_inventario + " "; | 12541 | + "=" + numero_inventario + " "; |
| 12541 | 12542 | ||
| 12542 | Cursor c1 = dtb.rawQuery(consultaArticulosSinContar, null); | 12543 | Cursor c1 = dtb.rawQuery(consultaArticulosSinContar, null); |
| 12543 | 12544 | ||
| 12544 | int articulosNonInventariados = 0; | 12545 | int articulosNonInventariados = 0; |
| 12545 | if (c1.moveToFirst()) { | 12546 | if (c1.moveToFirst()) { |
| 12546 | articulosNonInventariados = c1.getInt(0); | 12547 | articulosNonInventariados = c1.getInt(0); |
| 12547 | } | 12548 | } |
| 12548 | 12549 | ||
| 12549 | // 3 Clculo de todos los articulos que inventariar: | 12550 | // 3 Clculo de todos los articulos que inventariar: |
| 12550 | String consultaTodosArticulosInventario = "SELECT COUNT(*) " | 12551 | String consultaTodosArticulosInventario = "SELECT COUNT(*) " |
| 12551 | + "FROM " + tabla_articulos_nombre + " " + "WHERE " | 12552 | + "FROM " + tabla_articulos_nombre + " " + "WHERE " |
| 12552 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" | 12553 | + ParametrosInventario.bal_bdd_articulo_inventario + "=" |
| 12553 | + numero_inventario + " "; | 12554 | + numero_inventario + " "; |
| 12554 | 12555 | ||
| 12555 | Cursor c2 = dtb.rawQuery(consultaTodosArticulosInventario, null); | 12556 | Cursor c2 = dtb.rawQuery(consultaTodosArticulosInventario, null); |
| 12556 | 12557 | ||
| 12557 | int articulosTotalesQueInventariar = 0; | 12558 | int articulosTotalesQueInventariar = 0; |
| 12558 | if (c2.moveToFirst()) { | 12559 | if (c2.moveToFirst()) { |
| 12559 | articulosTotalesQueInventariar = c2.getInt(0); | 12560 | articulosTotalesQueInventariar = c2.getInt(0); |
| 12560 | } | 12561 | } |
| 12561 | 12562 | ||
| 12562 | // 4 Construccin del ArrayList de resultado: | 12563 | // 4 Construccin del ArrayList de resultado: |
| 12563 | result.add(articulosTotalesQueInventariar); | 12564 | result.add(articulosTotalesQueInventariar); |
| 12564 | result.add(articulosTotalesQueInventariar | 12565 | result.add(articulosTotalesQueInventariar |
| 12565 | - articulosNonInventariados); | 12566 | - articulosNonInventariados); |
| 12566 | result.add(articulosNonInventariados); | 12567 | result.add(articulosNonInventariados); |
| 12567 | 12568 | ||
| 12568 | // 5 Cerramos la BD | 12569 | // 5 Cerramos la BD |
| 12569 | dtb.close(); | 12570 | dtb.close(); |
| 12570 | 12571 | ||
| 12571 | return result; | 12572 | return result; |
| 12572 | } catch (Exception e) { | 12573 | } catch (Exception e) { |
| 12573 | 12574 | ||
| 12574 | GestorLogEventos log = new GestorLogEventos(); | 12575 | GestorLogEventos log = new GestorLogEventos(); |
| 12575 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12576 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12576 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12577 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12577 | log.log("[-- 2719 --]" + e.toString(), 4); | 12578 | log.log("[-- 2719 --]" + e.toString(), 4); |
| 12578 | 12579 | ||
| 12579 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12580 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12580 | "Generacion de las estadisticas imposible"); | 12581 | "Generacion de las estadisticas imposible"); |
| 12581 | } | 12582 | } |
| 12582 | 12583 | ||
| 12583 | } | 12584 | } |
| 12584 | 12585 | ||
| 12585 | /** | 12586 | /** |
| 12586 | * Recupera el objeto INVENTARIO con el numero del mismo | 12587 | * Recupera el objeto INVENTARIO con el numero del mismo |
| 12587 | * <p> | 12588 | * <p> |
| 12588 | * 1 Abrimos la base de datos en modo lectura | 12589 | * 1 Abrimos la base de datos en modo lectura |
| 12589 | * <p> | 12590 | * <p> |
| 12590 | * 2 Busqueda en la base | 12591 | * 2 Busqueda en la base |
| 12591 | * <p> | 12592 | * <p> |
| 12592 | * 3 Recorremos el resultado (que debe ser unico normalmente) y creamos el | 12593 | * 3 Recorremos el resultado (que debe ser unico normalmente) y creamos el |
| 12593 | * Inventario | 12594 | * Inventario |
| 12594 | * <p> | 12595 | * <p> |
| 12595 | * 4 Cerramos la BD | 12596 | * 4 Cerramos la BD |
| 12596 | * | 12597 | * |
| 12597 | * @return INVENTARIO | 12598 | * @return INVENTARIO |
| 12598 | * @throws ExceptionBDD | 12599 | * @throws ExceptionBDD |
| 12599 | */ | 12600 | */ |
| 12600 | public Inventario selectInventarioConNumero(int inventario_num) | 12601 | public Inventario selectInventarioConNumero(int inventario_num) |
| 12601 | throws ExceptionBDD { | 12602 | throws ExceptionBDD { |
| 12602 | System.out.println("::: BaseDatos 3395 Selecciona inventario con numero"); | 12603 | System.out.println("::: BaseDatos 3395 Selecciona inventario con numero"); |
| 12603 | try { | 12604 | try { |
| 12604 | // Salida: | 12605 | // Salida: |
| 12605 | Inventario inventario = null; | 12606 | Inventario inventario = null; |
| 12606 | 12607 | ||
| 12607 | // 1 Abrimos la base de datos en modo lectura: | 12608 | // 1 Abrimos la base de datos en modo lectura: |
| 12608 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12609 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12609 | /* String name = null; | 12610 | /* String name = null; |
| 12610 | Cursor c = null; | 12611 | Cursor c = null; |
| 12611 | c = dtb.rawQuery("select name from person where id="+id, null); | 12612 | c = dtb.rawQuery("select name from person where id="+id, null); |
| 12612 | c.moveToFirst(); | 12613 | c.moveToFirst(); |
| 12613 | name = c.getString(c.getColumnIndex("name")); | 12614 | name = c.getString(c.getColumnIndex("name")); |
| 12614 | c.close(); | 12615 | c.close(); |
| 12615 | */System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>> "+ inventario_num); | 12616 | */System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>> "+ inventario_num); |
| 12616 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); | 12617 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); |
| 12617 | // 2 Busqueda en la base: | 12618 | // 2 Busqueda en la base: |
| 12618 | String[] args = new String[] { String.valueOf(inventario_num) }; | 12619 | String[] args = new String[] { String.valueOf(inventario_num) }; |
| 12619 | System.out.println("::: BaseDatos 3579 "); | 12620 | System.out.println("::: BaseDatos 3579 "); |
| 12620 | Cursor c = dtb.query(tabla_inventarios_nombre, null, | 12621 | Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 12621 | ParametrosInventario.bal_bdd_inventario_numero + "=?", | 12622 | ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 12622 | args, null, null, null); | 12623 | args, null, null, null); |
| 12623 | System.out.println("::: BaseDatos 3583 " + c); | 12624 | System.out.println("::: BaseDatos 3583 " + c); |
| 12624 | // Nos aseguramos de que existe al menos un registro | 12625 | // Nos aseguramos de que existe al menos un registro |
| 12625 | if (c.moveToFirst()) { | 12626 | if (c.moveToFirst()) { |
| 12626 | // 3 Recorremos el resultado (que debe ser unico normalmente) y | 12627 | // 3 Recorremos el resultado (que debe ser unico normalmente) y |
| 12627 | // creamos el Inventario | 12628 | // creamos el Inventario |
| 12628 | System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); | 12629 | System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); |
| 12629 | inventario = new Inventario( | 12630 | inventario = new Inventario( |
| 12630 | c.getInt(c | 12631 | c.getInt(c |
| 12631 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 12632 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 12632 | c.getString(c | 12633 | c.getString(c |
| 12633 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), | 12634 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), |
| 12634 | c.getString(c | 12635 | c.getString(c |
| 12635 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), | 12636 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), |
| 12636 | c.getString(c | 12637 | c.getString(c |
| 12637 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), | 12638 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), |
| 12638 | c.getInt(c | 12639 | c.getInt(c |
| 12639 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), | 12640 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), |
| 12640 | c.getInt(c | 12641 | c.getInt(c |
| 12641 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); | 12642 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); |
| 12642 | System.out.println("::: BaseDatos 3519 Listo"); | 12643 | System.out.println("::: BaseDatos 3519 Listo"); |
| 12643 | } else { | 12644 | } else { |
| 12644 | inventario = null; | 12645 | inventario = null; |
| 12645 | } | 12646 | } |
| 12646 | 12647 | ||
| 12647 | // 4 Cerramos la BD | 12648 | // 4 Cerramos la BD |
| 12648 | dtb.close(); | 12649 | dtb.close(); |
| 12649 | return inventario; | 12650 | return inventario; |
| 12650 | } catch (Exception e) { | 12651 | } catch (Exception e) { |
| 12651 | 12652 | ||
| 12652 | GestorLogEventos log = new GestorLogEventos(); | 12653 | GestorLogEventos log = new GestorLogEventos(); |
| 12653 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12654 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12654 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12655 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12655 | log.log("[-- 2787 --]" + e.toString(), 4); | 12656 | log.log("[-- 2787 --]" + e.toString(), 4); |
| 12656 | 12657 | ||
| 12657 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12658 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12658 | "Imposible recuperar el INVENTARIO cuyo numero es: " | 12659 | "Imposible recuperar el INVENTARIO cuyo numero es: " |
| 12659 | + inventario_num); | 12660 | + inventario_num); |
| 12660 | } | 12661 | } |
| 12661 | } | 12662 | } |
| 12662 | public Inventario selectInventarioConNumeroCompra(int inventario_num) | 12663 | public Inventario selectInventarioConNumeroCompra(int inventario_num) |
| 12663 | throws ExceptionBDD { | 12664 | throws ExceptionBDD { |
| 12664 | System.out.println("::: BaseDatos 3395 Selecciona inventario con numero"); | 12665 | System.out.println("::: BaseDatos 3395 Selecciona inventario con numero"); |
| 12665 | try { | 12666 | try { |
| 12666 | // Salida: | 12667 | // Salida: |
| 12667 | Inventario inventario = null; | 12668 | Inventario inventario = null; |
| 12668 | 12669 | ||
| 12669 | // 1 Abrimos la base de datos en modo lectura: | 12670 | // 1 Abrimos la base de datos en modo lectura: |
| 12670 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12671 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12671 | /* String name = null; | 12672 | /* String name = null; |
| 12672 | Cursor c = null; | 12673 | Cursor c = null; |
| 12673 | c = dtb.rawQuery("select name from person where id="+id, null); | 12674 | c = dtb.rawQuery("select name from person where id="+id, null); |
| 12674 | c.moveToFirst(); | 12675 | c.moveToFirst(); |
| 12675 | name = c.getString(c.getColumnIndex("name")); | 12676 | name = c.getString(c.getColumnIndex("name")); |
| 12676 | c.close(); | 12677 | c.close(); |
| 12677 | */ | 12678 | */ |
| 12678 | System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>> "+ inventario_num); | 12679 | System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>> "+ inventario_num); |
| 12679 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); | 12680 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); |
| 12680 | // 2 Busqueda en la base: | 12681 | // 2 Busqueda en la base: |
| 12681 | String[] args = new String[] { String.valueOf(inventario_num) }; | 12682 | String[] args = new String[] { String.valueOf(inventario_num) }; |
| 12682 | System.out.println("::: BaseDatos 3579 "); | 12683 | System.out.println("::: BaseDatos 3579 "); |
| 12683 | Cursor c = dtb.query(tabla_inventarios_nombre, null, | 12684 | Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 12684 | ParametrosInventario.bal_bdd_inventario_numero + "=?", | 12685 | ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 12685 | args, null, null, null); | 12686 | args, null, null, null); |
| 12686 | System.out.println("::: BaseDatos 3583 " + c); | 12687 | System.out.println("::: BaseDatos 3583 " + c); |
| 12687 | // Nos aseguramos de que existe al menos un registro | 12688 | // Nos aseguramos de que existe al menos un registro |
| 12688 | if (c.moveToFirst()) { | 12689 | if (c.moveToFirst()) { |
| 12689 | // 3 Recorremos el resultado (que debe ser unico normalmente) y | 12690 | // 3 Recorremos el resultado (que debe ser unico normalmente) y |
| 12690 | // creamos el Inventario | 12691 | // creamos el Inventario |
| 12691 | System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); | 12692 | System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); |
| 12692 | inventario = new Inventario( | 12693 | inventario = new Inventario( |
| 12693 | c.getInt(c | 12694 | c.getInt(c |
| 12694 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 12695 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 12695 | c.getString(c | 12696 | c.getString(c |
| 12696 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), | 12697 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), |
| 12697 | c.getString(c | 12698 | c.getString(c |
| 12698 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), | 12699 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), |
| 12699 | c.getString(c | 12700 | c.getString(c |
| 12700 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), | 12701 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), |
| 12701 | c.getInt(c | 12702 | c.getInt(c |
| 12702 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), | 12703 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), |
| 12703 | c.getInt(c | 12704 | c.getInt(c |
| 12704 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); | 12705 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); |
| 12705 | System.out.println("::: BaseDatos 3519 Listo"); | 12706 | System.out.println("::: BaseDatos 3519 Listo"); |
| 12706 | } else { | 12707 | } else { |
| 12707 | inventario = null; | 12708 | inventario = null; |
| 12708 | } | 12709 | } |
| 12709 | 12710 | ||
| 12710 | // 4 Cerramos la BD | 12711 | // 4 Cerramos la BD |
| 12711 | dtb.close(); | 12712 | dtb.close(); |
| 12712 | return inventario; | 12713 | return inventario; |
| 12713 | } catch (Exception e) { | 12714 | } catch (Exception e) { |
| 12714 | 12715 | ||
| 12715 | GestorLogEventos log = new GestorLogEventos(); | 12716 | GestorLogEventos log = new GestorLogEventos(); |
| 12716 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12717 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12717 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12718 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12718 | log.log("[-- 2787 --]" + e.toString(), 4); | 12719 | log.log("[-- 2787 --]" + e.toString(), 4); |
| 12719 | 12720 | ||
| 12720 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12721 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12721 | "Imposible recuperar el INVENTARIO cuyo numero es: " | 12722 | "Imposible recuperar el INVENTARIO cuyo numero es: " |
| 12722 | + inventario_num); | 12723 | + inventario_num); |
| 12723 | } | 12724 | } |
| 12724 | } | 12725 | } |
| 12725 | public Inventario selectInventarioConNumeroParametro(int inventario_num, int productos_conta) | 12726 | public Inventario selectInventarioConNumeroParametro(int inventario_num, int productos_conta) |
| 12726 | throws ExceptionBDD { | 12727 | throws ExceptionBDD { |
| 12727 | System.out.println("::: BaseDatos 3622 Selecciona inventario con numero y parametro"); | 12728 | System.out.println("::: BaseDatos 3622 Selecciona inventario con numero y parametro"); |
| 12728 | try { | 12729 | try { |
| 12729 | System.out.println("////////////////////////////////////////////////////////////////////"); | 12730 | System.out.println("////////////////////////////////////////////////////////////////////"); |
| 12730 | System.out.println("Productos conta "+ productos_conta ); | 12731 | System.out.println("Productos conta "+ productos_conta ); |
| 12731 | // Salida: | 12732 | // Salida: |
| 12732 | Inventario inventario = null; | 12733 | Inventario inventario = null; |
| 12733 | 12734 | ||
| 12734 | // 1 Abrimos la base de datos en modo lectura: | 12735 | // 1 Abrimos la base de datos en modo lectura: |
| 12735 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12736 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12736 | System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>>"); | 12737 | System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::>>"); |
| 12737 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); | 12738 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); |
| 12738 | // 2 Busqueda en la base: | 12739 | // 2 Busqueda en la base: |
| 12739 | String[] args = new String[] { String.valueOf(inventario_num) }; | 12740 | String[] args = new String[] { String.valueOf(inventario_num) }; |
| 12740 | Cursor c = dtb.query(tabla_inventarios_nombre, null, | 12741 | Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 12741 | ParametrosInventario.bal_bdd_inventario_numero + "=?", | 12742 | ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 12742 | args, null, null, null); | 12743 | args, null, null, null); |
| 12743 | 12744 | ||
| 12744 | // Nos aseguramos de que existe al menos un registro | 12745 | // Nos aseguramos de que existe al menos un registro |
| 12745 | if (c.moveToFirst()) { | 12746 | if (c.moveToFirst()) { |
| 12746 | // 3 Recorremos el resultado (que debe ser unico normalmente) y | 12747 | // 3 Recorremos el resultado (que debe ser unico normalmente) y |
| 12747 | // creamos el Inventario | 12748 | // creamos el Inventario |
| 12748 | System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); | 12749 | System.out.println("::: BaseDatos 3519 va a seleccionar el inventario "); |
| 12749 | inventario = new Inventario( | 12750 | inventario = new Inventario( |
| 12750 | c.getInt(c | 12751 | c.getInt(c |
| 12751 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 12752 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 12752 | c.getString(c | 12753 | c.getString(c |
| 12753 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), | 12754 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion)), |
| 12754 | c.getString(c | 12755 | c.getString(c |
| 12755 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), | 12756 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio)), |
| 12756 | c.getString(c | 12757 | c.getString(c |
| 12757 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), | 12758 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin)), |
| 12758 | c.getInt(c | 12759 | c.getInt(c |
| 12759 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), | 12760 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)), |
| 12760 | c.getInt(c | 12761 | c.getInt(c |
| 12761 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); | 12762 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_lugar))); |
| 12762 | System.out.println("::: BaseDatos 3519 Listo"); | 12763 | System.out.println("::: BaseDatos 3519 Listo"); |
| 12763 | } else { | 12764 | } else { |
| 12764 | inventario = null; | 12765 | inventario = null; |
| 12765 | } | 12766 | } |
| 12766 | 12767 | ||
| 12767 | // 4 Cerramos la BD | 12768 | // 4 Cerramos la BD |
| 12768 | dtb.close(); | 12769 | dtb.close(); |
| 12769 | return inventario; | 12770 | return inventario; |
| 12770 | } catch (Exception e) { | 12771 | } catch (Exception e) { |
| 12771 | 12772 | ||
| 12772 | GestorLogEventos log = new GestorLogEventos(); | 12773 | GestorLogEventos log = new GestorLogEventos(); |
| 12773 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12774 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12774 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12775 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12775 | log.log("[-- 2787 --]" + e.toString(), 4); | 12776 | log.log("[-- 2787 --]" + e.toString(), 4); |
| 12776 | 12777 | ||
| 12777 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 12778 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 12778 | "Imposible recuperar el INVENTARIO cuyo numero es: " | 12779 | "Imposible recuperar el INVENTARIO cuyo numero es: " |
| 12779 | + inventario_num); | 12780 | + inventario_num); |
| 12780 | } | 12781 | } |
| 12781 | } | 12782 | } |
| 12782 | 12783 | ||
| 12783 | 12784 | ||
| 12784 | /** | 12785 | /** |
| 12785 | * Busca los inventarios en la bd | 12786 | * Busca los inventarios en la bd |
| 12786 | * <p> | 12787 | * <p> |
| 12787 | * 1 Abrimos la base de datos en modo lectura | 12788 | * 1 Abrimos la base de datos en modo lectura |
| 12788 | * <p> | 12789 | * <p> |
| 12789 | * 2 Buscamos todos los inventarios | 12790 | * 2 Buscamos todos los inventarios |
| 12790 | * <p> | 12791 | * <p> |
| 12791 | * 3 Genera el hashmap, uno por inventario | 12792 | * 3 Genera el hashmap, uno por inventario |
| 12792 | * <p> | 12793 | * <p> |
| 12793 | * 4 Agrega el hashmap en la entrada correspondiente a ese inventario | 12794 | * 4 Agrega el hashmap en la entrada correspondiente a ese inventario |
| 12794 | * <p> | 12795 | * <p> |
| 12795 | * 5 Cerramos conexiones | 12796 | * 5 Cerramos conexiones |
| 12796 | * | 12797 | * |
| 12797 | * @return un HashMap que guarda los inventarios por id de inventario | 12798 | * @return un HashMap que guarda los inventarios por id de inventario |
| 12798 | * @throws ExceptionBDD | 12799 | * @throws ExceptionBDD |
| 12799 | * si no encuentra inventarios | 12800 | * si no encuentra inventarios |
| 12800 | */ | 12801 | */ |
| 12801 | public HashMap<Integer, HashMap<String, String>> selectInventariosEnBdd() | 12802 | public HashMap<Integer, HashMap<String, String>> selectInventariosEnBdd() |
| 12802 | throws ExceptionBDD { | 12803 | throws ExceptionBDD { |
| 12803 | System.out.println("::: BaseDAtos Busca inventario con numero en la bdd"); | 12804 | System.out.println("::: BaseDAtos Busca inventario con numero en la bdd"); |
| 12804 | System.out.println("::: BaseDAtos 3772 selectInventariosEnBdd"); | 12805 | System.out.println("::: BaseDAtos 3772 selectInventariosEnBdd"); |
| 12805 | HashMap<Integer, HashMap<String, String>> tablaResultados = new HashMap<Integer, HashMap<String, String>>(); | 12806 | HashMap<Integer, HashMap<String, String>> tablaResultados = new HashMap<Integer, HashMap<String, String>>(); |
| 12806 | 12807 | ||
| 12807 | // 1 Abrimos la base de datos en modo lectura | 12808 | // 1 Abrimos la base de datos en modo lectura |
| 12808 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12809 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12809 | 12810 | ||
| 12810 | boolean condicionRadio = ParametrosInventario.InventariosVentas; | 12811 | boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 12811 | Cursor c; | 12812 | Cursor c; |
| 12812 | 12813 | ||
| 12813 | System.out.println("::: BaseDatos 3861 condicionRadio " + condicionRadio); | 12814 | System.out.println("::: BaseDatos 3861 condicionRadio " + condicionRadio); |
| 12814 | 12815 | ||
| 12815 | if(condicionRadio == true){ | 12816 | if(condicionRadio == true){ |
| 12816 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 12817 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 12817 | // condR=-1; | 12818 | // condR=-1; |
| 12818 | String whereClause = "inv_num=-1 or inv_lug=-1";// or inv_lug=-2 | 12819 | String whereClause = "inv_num=-1 or inv_lug=-1";// or inv_lug=-2 |
| 12819 | 12820 | ||
| 12820 | c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, | 12821 | c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, |
| 12821 | null, null + " ASC" ); | 12822 | null, null + " ASC" ); |
| 12822 | System.out.println("::: BaseDatos 3861 consulta " + c); | 12823 | System.out.println("::: BaseDatos 3861 consulta " + c); |
| 12823 | }else{ | 12824 | }else{ |
| 12824 | // Esta seleccionado deposito, esto debe continuar sin los campos de ventas | 12825 | // Esta seleccionado deposito, esto debe continuar sin los campos de ventas |
| 12825 | // condR=-2; | 12826 | // condR=-2; |
| 12826 | String whereClause = "inv_num=-2 or inv_lug=-2";// or inv_lug=-2 | 12827 | String whereClause = "inv_num=-2 or inv_lug=-2";// or inv_lug=-2 |
| 12827 | c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, | 12828 | c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, |
| 12828 | null, null + " ASC" ); | 12829 | null, null + " ASC" ); |
| 12829 | System.out.println("::: BaseDatos 3861 consulta " + c); | 12830 | System.out.println("::: BaseDatos 3861 consulta " + c); |
| 12830 | } | 12831 | } |
| 12831 | 12832 | ||
| 12832 | 12833 | ||
| 12833 | // 2 Buscamos todos los inventarios | 12834 | // 2 Buscamos todos los inventarios |
| 12834 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, null, null, null, | 12835 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, null, null, null, |
| 12835 | // null, ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 12836 | // null, ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 12836 | if (c.moveToFirst() == true) { | 12837 | if (c.moveToFirst() == true) { |
| 12837 | while (c.isAfterLast() == false) { | 12838 | while (c.isAfterLast() == false) { |
| 12838 | HashMap<String, String> tablaUnInventario = new HashMap<String, String>(); | 12839 | HashMap<String, String> tablaUnInventario = new HashMap<String, String>(); |
| 12839 | /** | 12840 | /** |
| 12840 | * 3 Genera el hashmap, uno por inventario | 12841 | * 3 Genera el hashmap, uno por inventario |
| 12841 | */ | 12842 | */ |
| 12842 | tablaUnInventario | 12843 | tablaUnInventario |
| 12843 | .put(ParametrosInventario.bal_bdd_inventario_numero, | 12844 | .put(ParametrosInventario.bal_bdd_inventario_numero, |
| 12844 | c.getString(c | 12845 | c.getString(c |
| 12845 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); | 12846 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); |
| 12846 | tablaUnInventario | 12847 | tablaUnInventario |
| 12847 | .put(ParametrosInventario.bal_bdd_inventario_descripcion, | 12848 | .put(ParametrosInventario.bal_bdd_inventario_descripcion, |
| 12848 | c.getString(c | 12849 | c.getString(c |
| 12849 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion))); | 12850 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion))); |
| 12850 | tablaUnInventario | 12851 | tablaUnInventario |
| 12851 | .put(ParametrosInventario.bal_bdd_inventario_fechaInicio, | 12852 | .put(ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 12852 | c.getString(c | 12853 | c.getString(c |
| 12853 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio))); | 12854 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio))); |
| 12854 | tablaUnInventario | 12855 | tablaUnInventario |
| 12855 | .put(ParametrosInventario.bal_bdd_inventario_fechaFin, | 12856 | .put(ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 12856 | c.getString(c | 12857 | c.getString(c |
| 12857 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin))); | 12858 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin))); |
| 12858 | tablaUnInventario | 12859 | tablaUnInventario |
| 12859 | .put(ParametrosInventario.bal_bdd_inventario_estado, | 12860 | .put(ParametrosInventario.bal_bdd_inventario_estado, |
| 12860 | String.valueOf(c.getInt(c | 12861 | String.valueOf(c.getInt(c |
| 12861 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)))); | 12862 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)))); |
| 12862 | /** | 12863 | /** |
| 12863 | * 4 Agrega el hashmap en la entrada correspondiente a ese | 12864 | * 4 Agrega el hashmap en la entrada correspondiente a ese |
| 12864 | * inventario | 12865 | * inventario |
| 12865 | */ | 12866 | */ |
| 12866 | System.out.println("::: BaseDatos 3838 "+tablaUnInventario | 12867 | System.out.println("::: BaseDatos 3838 "+tablaUnInventario |
| 12867 | .put(ParametrosInventario.bal_bdd_inventario_lugar, | 12868 | .put(ParametrosInventario.bal_bdd_inventario_lugar, |
| 12868 | String.valueOf(c.getInt(c | 12869 | String.valueOf(c.getInt(c |
| 12869 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado))))); | 12870 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado))))); |
| 12870 | tablaResultados | 12871 | tablaResultados |
| 12871 | .put(c.getInt(c | 12872 | .put(c.getInt(c |
| 12872 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 12873 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 12873 | tablaUnInventario); | 12874 | tablaUnInventario); |
| 12874 | 12875 | ||
| 12875 | System.out.println("::: BaseDatos 3847 ver q traeeeeee" + tablaResultados); | 12876 | System.out.println("::: BaseDatos 3847 ver q traeeeeee" + tablaResultados); |
| 12876 | System.out.println("::: BaseDatos 3848 ver q traeeeeee 2" + c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)); | 12877 | System.out.println("::: BaseDatos 3848 ver q traeeeeee 2" + c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)); |
| 12877 | c.moveToNext(); | 12878 | c.moveToNext(); |
| 12878 | } | 12879 | } |
| 12879 | } else { | 12880 | } else { |
| 12880 | throw new ExceptionBDD("INVENTARIO", 0); | 12881 | throw new ExceptionBDD("INVENTARIO", 0); |
| 12881 | } | 12882 | } |
| 12882 | // 5 Cerramos conexiones | 12883 | // 5 Cerramos conexiones |
| 12883 | c.close(); | 12884 | c.close(); |
| 12884 | dtb.close(); | 12885 | dtb.close(); |
| 12885 | return tablaResultados; | 12886 | return tablaResultados; |
| 12886 | } | 12887 | } |
| 12887 | 12888 | ||
| 12888 | /** | 12889 | /** |
| 12889 | * Devuelve la lista de los IDs de todos los inventarios cerrados y listos | 12890 | * Devuelve la lista de los IDs de todos los inventarios cerrados y listos |
| 12890 | * para ser exportados. | 12891 | * para ser exportados. |
| 12891 | * <p> | 12892 | * <p> |
| 12892 | * 1 Abrimos la base de datos en modo lectura | 12893 | * 1 Abrimos la base de datos en modo lectura |
| 12893 | * <p> | 12894 | * <p> |
| 12894 | * 2 Buscamos los inventarios con estado = a 0 | 12895 | * 2 Buscamos los inventarios con estado = a 0 |
| 12895 | * <p> | 12896 | * <p> |
| 12896 | * 3 Lo agregamos a la tabla de resultados | 12897 | * 3 Lo agregamos a la tabla de resultados |
| 12897 | * <p> | 12898 | * <p> |
| 12898 | * 4 Cerramos la BD | 12899 | * 4 Cerramos la BD |
| 12899 | * | 12900 | * |
| 12900 | * @return ArrayList<Integer> lista de los IDs, lista vaca si no hay | 12901 | * @return ArrayList<Integer> lista de los IDs, lista vaca si no hay |
| 12901 | * reultados | 12902 | * reultados |
| 12902 | * @throws ExceptionBDD | 12903 | * @throws ExceptionBDD |
| 12903 | * lanzada si no se encuentra la tabla en la base de datos | 12904 | * lanzada si no se encuentra la tabla en la base de datos |
| 12904 | */ | 12905 | */ |
| 12905 | public ArrayList<Integer> selectInventariosCerradosEnBddCompras() | 12906 | public ArrayList<Integer> selectInventariosCerradosEnBddCompras() |
| 12906 | throws ExceptionBDD { | 12907 | throws ExceptionBDD { |
| 12907 | System.out.println("::: BaseDatos 3921 selectInventariosCerradosEnBdd"); | 12908 | System.out.println("::: BaseDatos 3921 selectInventariosCerradosEnBdd"); |
| 12908 | ArrayList<Integer> tablaResultado = new ArrayList<Integer>(); | 12909 | ArrayList<Integer> tablaResultado = new ArrayList<Integer>(); |
| 12909 | // 1 Abrimos la base de datos en modo lectura | 12910 | // 1 Abrimos la base de datos en modo lectura |
| 12910 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12911 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12911 | 12912 | ||
| 12912 | String consul_where=""; | 12913 | String consul_where=""; |
| 12913 | System.out.println("::: BaseDatos 3928 esta marcado inventario venta"); | 12914 | System.out.println("::: BaseDatos 3928 esta marcado inventario venta"); |
| 12914 | //consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-3 or inv_lug=-3) "; | 12915 | //consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-3 or inv_lug=-3) "; |
| 12915 | consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num<=-3) "; | 12916 | consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num<=-3) "; |
| 12916 | 12917 | ||
| 12917 | // 2 Buscamos los inventarios con estado = a 0 | 12918 | // 2 Buscamos los inventarios con estado = a 0 |
| 12918 | try { | 12919 | try { |
| 12919 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, | 12920 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 12920 | // ParametrosInventario.bal_bdd_inventario_estado + "=0", | 12921 | // ParametrosInventario.bal_bdd_inventario_estado + "=0", |
| 12921 | // null, null, null, | 12922 | // null, null, null, |
| 12922 | // ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 12923 | // ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 12923 | Cursor c = dtb.query(tabla_inventarios_nombre, null, | 12924 | Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 12924 | consul_where, | 12925 | consul_where, |
| 12925 | null, null, null, | 12926 | null, null, null, |
| 12926 | ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 12927 | ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 12927 | if (c.moveToFirst() == true) { | 12928 | if (c.moveToFirst() == true) { |
| 12928 | while (c.isAfterLast() == false) { | 12929 | while (c.isAfterLast() == false) { |
| 12929 | // 3 Lo agregamos a la tabla de resultados | 12930 | // 3 Lo agregamos a la tabla de resultados |
| 12930 | tablaResultado | 12931 | tablaResultado |
| 12931 | .add(c.getInt(c | 12932 | .add(c.getInt(c |
| 12932 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); | 12933 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); |
| 12933 | c.moveToNext(); | 12934 | c.moveToNext(); |
| 12934 | } | 12935 | } |
| 12935 | } else { | 12936 | } else { |
| 12936 | 12937 | ||
| 12937 | return tablaResultado; | 12938 | return tablaResultado; |
| 12938 | } | 12939 | } |
| 12939 | // 4 Cerramos la BD | 12940 | // 4 Cerramos la BD |
| 12940 | c.close(); | 12941 | c.close(); |
| 12941 | } catch (Exception e) { | 12942 | } catch (Exception e) { |
| 12942 | 12943 | ||
| 12943 | GestorLogEventos log = new GestorLogEventos(); | 12944 | GestorLogEventos log = new GestorLogEventos(); |
| 12944 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 12945 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 12945 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 12946 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 12946 | log.log("[-- 2916 --]" + e.toString(), 4); | 12947 | log.log("[-- 2916 --]" + e.toString(), 4); |
| 12947 | 12948 | ||
| 12948 | throw new ExceptionBDD(tabla_inventarios_nombre, 0); | 12949 | throw new ExceptionBDD(tabla_inventarios_nombre, 0); |
| 12949 | } | 12950 | } |
| 12950 | 12951 | ||
| 12951 | 12952 | ||
| 12952 | System.out.println("::: BaseDatos 3942 tablaResultado " + tablaResultado); | 12953 | System.out.println("::: BaseDatos 3942 tablaResultado " + tablaResultado); |
| 12953 | //esto corrobora el ajuste que esta marcado en preferencias, si es contabilizado o no, y actualiza la tabla con ese valor | 12954 | //esto corrobora el ajuste que esta marcado en preferencias, si es contabilizado o no, y actualiza la tabla con ese valor |
| 12954 | // haciendo un update | 12955 | // haciendo un update |
| 12955 | System.out.println("::: BD ACTUALIZA INV DEPENDIENDO AJUSTE SELECCIONADO CONTABLILIZADO" | 12956 | System.out.println("::: BD ACTUALIZA INV DEPENDIENDO AJUSTE SELECCIONADO CONTABLILIZADO" |
| 12956 | + ParametrosInventario.ProductosNoContabilizados); | 12957 | + ParametrosInventario.ProductosNoContabilizados); |
| 12957 | if(ParametrosInventario.ProductosNoContabilizados == 1){ | 12958 | if(ParametrosInventario.ProductosNoContabilizados == 1){ |
| 12958 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); | 12959 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); |
| 12959 | }else{ | 12960 | }else{ |
| 12960 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); | 12961 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); |
| 12961 | } | 12962 | } |
| 12962 | dtb.close(); | 12963 | dtb.close(); |
| 12963 | return tablaResultado; | 12964 | return tablaResultado; |
| 12964 | } | 12965 | } |
| 12965 | 12966 | ||
| 12966 | public ArrayList<Integer> selectInventariosCerradosEnBdd() | 12967 | public ArrayList<Integer> selectInventariosCerradosEnBdd() |
| 12967 | throws ExceptionBDD { | 12968 | throws ExceptionBDD { |
| 12968 | System.out.println("::: BaseDatos 3921 selectInventariosCerradosEnBdd"); | 12969 | System.out.println("::: BaseDatos 3921 selectInventariosCerradosEnBdd"); |
| 12969 | ArrayList<Integer> tablaResultado = new ArrayList<Integer>(); | 12970 | ArrayList<Integer> tablaResultado = new ArrayList<Integer>(); |
| 12970 | 12971 | ||
| 12971 | // 1 Abrimos la base de datos en modo lectura | 12972 | // 1 Abrimos la base de datos en modo lectura |
| 12972 | SQLiteDatabase dtb = this.getReadableDatabase(); | 12973 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 12973 | 12974 | ||
| 12974 | boolean condicionRadio = ParametrosInventario.InventariosVentas; | 12975 | boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 12975 | 12976 | ||
| 12976 | String consul_where=""; | 12977 | String consul_where=""; |
| 12977 | int condR = 0; | 12978 | int condR = 0; |
| 12978 | if(condicionRadio == true){ | 12979 | if(condicionRadio == true){ |
| 12979 | condR=-1; | 12980 | condR=-1; |
| 12980 | }else{ | 12981 | }else{ |
| 12981 | condR=-2; | 12982 | condR=-2; |
| 12982 | } | 12983 | } |
| 12983 | if(condR == -1){ | 12984 | if(condR == -1){ |
| 12984 | System.out.println("::: BaseDatos 3928 esta marcado inventario venta"); | 12985 | System.out.println("::: BaseDatos 3928 esta marcado inventario venta"); |
| 12985 | consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-1 or inv_lug=-1) "; | 12986 | consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-1 or inv_lug=-1) "; |
| 12986 | }else if(condR == -2){ | 12987 | }else if(condR == -2){ |
| 12987 | System.out.println("::: BaseDatos 3928 esta marcado inventario por deposito"); | 12988 | System.out.println("::: BaseDatos 3928 esta marcado inventario por deposito"); |
| 12988 | consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-2 or inv_lug=-2) "; | 12989 | consul_where =ParametrosInventario.bal_bdd_inventario_estado + "=0 and (inv_num=-2 or inv_lug=-2) "; |
| 12989 | } | 12990 | } |
| 12990 | 12991 | ||
| 12991 | // 2 Buscamos los inventarios con estado = a 0 | 12992 | // 2 Buscamos los inventarios con estado = a 0 |
| 12992 | try { | 12993 | try { |
| 12993 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, | 12994 | // Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 12994 | // ParametrosInventario.bal_bdd_inventario_estado + "=0", | 12995 | // ParametrosInventario.bal_bdd_inventario_estado + "=0", |
| 12995 | // null, null, null, | 12996 | // null, null, null, |
| 12996 | // ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 12997 | // ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 12997 | Cursor c = dtb.query(tabla_inventarios_nombre, null, | 12998 | Cursor c = dtb.query(tabla_inventarios_nombre, null, |
| 12998 | consul_where, | 12999 | consul_where, |
| 12999 | null, null, null, | 13000 | null, null, null, |
| 13000 | ParametrosInventario.bal_bdd_inventario_numero + " ASC"); | 13001 | ParametrosInventario.bal_bdd_inventario_numero + " ASC"); |
| 13001 | if (c.moveToFirst() == true) { | 13002 | if (c.moveToFirst() == true) { |
| 13002 | while (c.isAfterLast() == false) { | 13003 | while (c.isAfterLast() == false) { |
| 13003 | // 3 Lo agregamos a la tabla de resultados | 13004 | // 3 Lo agregamos a la tabla de resultados |
| 13004 | tablaResultado | 13005 | tablaResultado |
| 13005 | .add(c.getInt(c | 13006 | .add(c.getInt(c |
| 13006 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); | 13007 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); |
| 13007 | c.moveToNext(); | 13008 | c.moveToNext(); |
| 13008 | } | 13009 | } |
| 13009 | } else { | 13010 | } else { |
| 13010 | 13011 | ||
| 13011 | return tablaResultado; | 13012 | return tablaResultado; |
| 13012 | } | 13013 | } |
| 13013 | // 4 Cerramos la BD | 13014 | // 4 Cerramos la BD |
| 13014 | c.close(); | 13015 | c.close(); |
| 13015 | } catch (Exception e) { | 13016 | } catch (Exception e) { |
| 13016 | 13017 | ||
| 13017 | GestorLogEventos log = new GestorLogEventos(); | 13018 | GestorLogEventos log = new GestorLogEventos(); |
| 13018 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 13019 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 13019 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 13020 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 13020 | log.log("[-- 2916 --]" + e.toString(), 4); | 13021 | log.log("[-- 2916 --]" + e.toString(), 4); |
| 13021 | 13022 | ||
| 13022 | throw new ExceptionBDD(tabla_inventarios_nombre, 0); | 13023 | throw new ExceptionBDD(tabla_inventarios_nombre, 0); |
| 13023 | } | 13024 | } |
| 13024 | 13025 | ||
| 13025 | 13026 | ||
| 13026 | System.out.println("::: BaseDatos 3942 tablaResultado " + tablaResultado); | 13027 | System.out.println("::: BaseDatos 3942 tablaResultado " + tablaResultado); |
| 13027 | //esto corrobora el ajuste que esta marcado en preferencias, si es contabilizado o no, y actualiza la tabla con ese valor | 13028 | //esto corrobora el ajuste que esta marcado en preferencias, si es contabilizado o no, y actualiza la tabla con ese valor |
| 13028 | // haciendo un update | 13029 | // haciendo un update |
| 13029 | System.out.println("::: BD ACTUALIZA INV DEPENDIENDO AJUSTE SELECCIONADO CONTABLILIZADO" | 13030 | System.out.println("::: BD ACTUALIZA INV DEPENDIENDO AJUSTE SELECCIONADO CONTABLILIZADO" |
| 13030 | + ParametrosInventario.ProductosNoContabilizados); | 13031 | + ParametrosInventario.ProductosNoContabilizados); |
| 13031 | if(ParametrosInventario.ProductosNoContabilizados == 1){ | 13032 | if(ParametrosInventario.ProductosNoContabilizados == 1){ |
| 13032 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); | 13033 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=1"); |
| 13033 | }else{ | 13034 | }else{ |
| 13034 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); | 13035 | dtb.execSQL("UPDATE INVENTARIOS SET INV_PRODCONT=0"); |
| 13035 | } | 13036 | } |
| 13036 | dtb.close(); | 13037 | dtb.close(); |
| 13037 | return tablaResultado; | 13038 | return tablaResultado; |
| 13038 | } | 13039 | } |
| 13039 | 13040 | ||
| 13040 | /** | 13041 | /** |
| 13041 | * Obtiene la lista de los numeros de todos los inventarios en curso que se | 13042 | * Obtiene la lista de los numeros de todos los inventarios en curso que se |
| 13042 | * encuentran en la base | 13043 | * encuentran en la base |
| 13043 | * <p> | 13044 | * <p> |
| 13044 | * 1 Abrimos la base de datos en modo lectura | 13045 | * 1 Abrimos la base de datos en modo lectura |
| 13045 | * <p> | 13046 | * <p> |
| 13046 | * 2 Ejecutamos la consulta | 13047 | * 2 Ejecutamos la consulta |
| 13047 | * <p> | 13048 | * <p> |
| 13048 | * 3 Agregamos cada numero a la lista | 13049 | * 3 Agregamos cada numero a la lista |
| 13049 | * <p> | 13050 | * <p> |
| 13050 | * 4 Cierre de BD | 13051 | * 4 Cierre de BD |
| 13051 | * | 13052 | * |
| 13052 | * @return ArrayList<Integer> | 13053 | * @return ArrayList<Integer> |
| 13053 | * @throws ExceptionBDD | 13054 | * @throws ExceptionBDD |
| 13054 | */ | 13055 | */ |
| 13055 | public ArrayList<Integer> selectInventariosNumerosEnBddCompras() | 13056 | public ArrayList<Integer> selectInventariosNumerosEnBddCompras() |
| 13056 | throws ExceptionBDD { | 13057 | throws ExceptionBDD { |
| 13057 | System.out.println("::: BaseDatos 3977 selectInventariosNumerosEnBddCompras"); | 13058 | System.out.println("::: BaseDatos 3977 selectInventariosNumerosEnBddCompras"); |
| 13058 | boolean condicionRadioSelect = ParametrosInventario.InventariosVentas; | 13059 | boolean condicionRadioSelect = ParametrosInventario.InventariosVentas; |
| 13059 | int condVtaDep = -3; | 13060 | int condVtaDep = -3; |
| 13060 | try { | 13061 | try { |
| 13061 | // Variable de respuesta: | 13062 | // Variable de respuesta: |
| 13062 | ArrayList<Integer> result = new ArrayList<Integer>(); | 13063 | ArrayList<Integer> result = new ArrayList<Integer>(); |
| 13063 | // 1 Abrimos la base de datos en modo lectura | 13064 | // 1 Abrimos la base de datos en modo lectura |
| 13064 | SQLiteDatabase dtb = this.getReadableDatabase(); | 13065 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 13065 | // Request: | 13066 | // Request: |
| 13066 | String[] col = new String[] { ParametrosInventario.bal_bdd_inventario_numero }; | 13067 | String[] col = new String[] { ParametrosInventario.bal_bdd_inventario_numero }; |
| 13067 | // 2 Ejecutamos la consulta | 13068 | // 2 Ejecutamos la consulta |
| 13068 | String tipoInventario = "INV_NUM=-3"; | 13069 | String tipoInventario = "INV_NUM=-3"; |
| 13069 | Cursor c = dtb.query(tabla_inventarios_nombre, col, tipoInventario , null, | 13070 | Cursor c = dtb.query(tabla_inventarios_nombre, col, tipoInventario , null, |
| 13070 | null, null, null); | 13071 | null, null, null); |
| 13071 | // Result: | 13072 | // Result: |
| 13072 | if (c.moveToFirst()) { | 13073 | if (c.moveToFirst()) { |
| 13073 | while (c.isAfterLast() == false) { | 13074 | while (c.isAfterLast() == false) { |
| 13074 | result.add(c.getInt(0)); | 13075 | result.add(c.getInt(0)); |
| 13075 | c.moveToNext(); | 13076 | c.moveToNext(); |
| 13076 | } | 13077 | } |
| 13077 | } else { | 13078 | } else { |
| 13078 | return result; | 13079 | return result; |
| 13079 | } | 13080 | } |
| 13080 | // 4 Cierre de BD | 13081 | // 4 Cierre de BD |
| 13081 | dtb.close(); | 13082 | dtb.close(); |
| 13082 | return result; | 13083 | return result; |
| 13083 | } catch (Exception e) { | 13084 | } catch (Exception e) { |
| 13084 | 13085 | ||
| 13085 | GestorLogEventos log = new GestorLogEventos(); | 13086 | GestorLogEventos log = new GestorLogEventos(); |
| 13086 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 13087 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 13087 | log.log("[-- 2976 --]" + e.toString(), 4); | 13088 | log.log("[-- 2976 --]" + e.toString(), 4); |
| 13088 | 13089 | ||
| 13089 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 13090 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 13090 | "Imposible inventariar todos los INVENTARIOS en curso"); | 13091 | "Imposible inventariar todos los INVENTARIOS en curso"); |
| 13091 | } | 13092 | } |
| 13092 | } | 13093 | } |
| 13093 | 13094 | ||
| 13094 | public ArrayList<Integer> selectInventariosNumerosEnBdd() | 13095 | public ArrayList<Integer> selectInventariosNumerosEnBdd() |
| 13095 | throws ExceptionBDD { | 13096 | throws ExceptionBDD { |
| 13096 | System.out.println("::: BaseDatos 3977 selectInventariosNumerosEnBdd"); | 13097 | System.out.println("::: BaseDatos 3977 selectInventariosNumerosEnBdd"); |
| 13097 | boolean condicionRadioSelect = ParametrosInventario.InventariosVentas; | 13098 | boolean condicionRadioSelect = ParametrosInventario.InventariosVentas; |
| 13098 | int condVtaDep = 0; | 13099 | int condVtaDep = 0; |
| 13099 | // System.out.println("::: BaseDatos 4032 condicionRadioSelect "+ condicionRadioSelect); | 13100 | // System.out.println("::: BaseDatos 4032 condicionRadioSelect "+ condicionRadioSelect); |
| 13100 | if(condicionRadioSelect==true){ | 13101 | if(condicionRadioSelect==true){ |
| 13101 | System.out.println("BD 4043 VENTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); | 13102 | System.out.println("BD 4043 VENTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); |
| 13102 | condVtaDep = -1; | 13103 | condVtaDep = -1; |
| 13103 | }else if (!condicionRadioSelect){ | 13104 | }else if (!condicionRadioSelect){ |
| 13104 | condVtaDep = -2; | 13105 | condVtaDep = -2; |
| 13105 | System.out.println("BD 4043 DEPOSITOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); | 13106 | System.out.println("BD 4043 DEPOSITOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); |
| 13106 | } | 13107 | } |
| 13107 | System.out.println("BD 4043 condVtaDep " + condVtaDep); | 13108 | System.out.println("BD 4043 condVtaDep " + condVtaDep); |
| 13108 | 13109 | ||
| 13109 | // if(condicionRadio==false && valorapasar==-1){ | 13110 | // if(condicionRadio==false && valorapasar==-1){ |
| 13110 | // //deposito | 13111 | // //deposito |
| 13111 | // System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 13112 | // System.out.println("DEPOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 13112 | // c = dtb | 13113 | // c = dtb |
| 13113 | // .query(tabla_inventarios_nombre, | 13114 | // .query(tabla_inventarios_nombre, |
| 13114 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 13115 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 13115 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 13116 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 13116 | // new String[] {"-2"}, null, null, null); | 13117 | // new String[] {"-2"}, null, null, null); |
| 13117 | // }else{ | 13118 | // }else{ |
| 13118 | // //ventas | 13119 | // //ventas |
| 13119 | // System.out.println("VENTASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); | 13120 | // System.out.println("VENTASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); |
| 13120 | // c = dtb | 13121 | // c = dtb |
| 13121 | // .query(tabla_inventarios_nombre, | 13122 | // .query(tabla_inventarios_nombre, |
| 13122 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, | 13123 | // new String[] { ParametrosInventario.bal_bdd_inventario_estado }, |
| 13123 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", | 13124 | // ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 13124 | // new String[] { String.valueOf(id) }, null, null, null); | 13125 | // new String[] { String.valueOf(id) }, null, null, null); |
| 13125 | // } | 13126 | // } |
| 13126 | try { | 13127 | try { |
| 13127 | // Variable de respuesta: | 13128 | // Variable de respuesta: |
| 13128 | ArrayList<Integer> result = new ArrayList<Integer>(); | 13129 | ArrayList<Integer> result = new ArrayList<Integer>(); |
| 13129 | 13130 | ||
| 13130 | // 1 Abrimos la base de datos en modo lectura | 13131 | // 1 Abrimos la base de datos en modo lectura |
| 13131 | SQLiteDatabase dtb = this.getReadableDatabase(); | 13132 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 13132 | 13133 | ||
| 13133 | // Request: | 13134 | // Request: |
| 13134 | String[] col = new String[] { ParametrosInventario.bal_bdd_inventario_numero }; | 13135 | String[] col = new String[] { ParametrosInventario.bal_bdd_inventario_numero }; |
| 13135 | // 2 Ejecutamos la consulta | 13136 | // 2 Ejecutamos la consulta |
| 13136 | System.out.println("::: BaseDatos 4043 col ===== tabla_inventarios_nombre " + tabla_inventarios_nombre); | 13137 | System.out.println("::: BaseDatos 4043 col ===== tabla_inventarios_nombre " + tabla_inventarios_nombre); |
| 13137 | // Cursor c = ; | 13138 | // Cursor c = ; |
| 13138 | String tipoInventario = ""; | 13139 | String tipoInventario = ""; |
| 13139 | if(condVtaDep==-1){ | 13140 | if(condVtaDep==-1){ |
| 13140 | tipoInventario = "INV_NUM!=-2"; | 13141 | tipoInventario = "INV_NUM!=-2"; |
| 13141 | // c = dtb.query(tabla_inventarios_nombre, col, "INV_NUM!=-2", null, | 13142 | // c = dtb.query(tabla_inventarios_nombre, col, "INV_NUM!=-2", null, |
| 13142 | // null, null, null); | 13143 | // null, null, null); |
| 13143 | 13144 | ||
| 13144 | }else if(condVtaDep==-2){ | 13145 | }else if(condVtaDep==-2){ |
| 13145 | // c = dtb.query(tabla_inventarios_nombre, col, "INV_NUM!=-1", null, | 13146 | // c = dtb.query(tabla_inventarios_nombre, col, "INV_NUM!=-1", null, |
| 13146 | // null, null, null); | 13147 | // null, null, null); |
| 13147 | tipoInventario = "INV_NUM!=-1"; | 13148 | tipoInventario = "INV_NUM!=-1"; |
| 13148 | 13149 | ||
| 13149 | } | 13150 | } |
| 13150 | Cursor c = dtb.query(tabla_inventarios_nombre, col, tipoInventario , null, null, null, null); | 13151 | Cursor c = dtb.query(tabla_inventarios_nombre, col, tipoInventario , null, null, null, null); |
| 13151 | // Cursor c = dtb.query(tabla_inventarios_nombre, col, null, null, | 13152 | // Cursor c = dtb.query(tabla_inventarios_nombre, col, null, null, |
| 13152 | // null, null, null); | 13153 | // null, null, null); |
| 13153 | 13154 | ||
| 13154 | // Result: | 13155 | // Result: |
| 13155 | if (c.moveToFirst()) { | 13156 | if (c.moveToFirst()) { |
| 13156 | 13157 | ||
| 13157 | if(condVtaDep==-1){ | 13158 | if(condVtaDep==-1){ |
| 13158 | while (!c.isAfterLast()) { | 13159 | while (!c.isAfterLast()) { |
| 13159 | // 3 Agregamos cada numero a la lista | 13160 | // 3 Agregamos cada numero a la lista |
| 13160 | if(condVtaDep!=-2){ | 13161 | if(condVtaDep!=-2){ |
| 13161 | result.add(c.getInt(0)); | 13162 | result.add(c.getInt(0)); |
| 13162 | } | 13163 | } |
| 13163 | c.moveToNext(); | 13164 | c.moveToNext(); |
| 13164 | } | 13165 | } |
| 13165 | }else if(condVtaDep==-2){ | 13166 | }else if(condVtaDep==-2){ |
| 13166 | while (!c.isAfterLast()) { | 13167 | while (!c.isAfterLast()) { |
| 13167 | // 3 Agregamos cada numero a la lista | 13168 | // 3 Agregamos cada numero a la lista |
| 13168 | if(condVtaDep!=-1){ | 13169 | if(condVtaDep!=-1){ |
| 13169 | result.add(c.getInt(0)); | 13170 | result.add(c.getInt(0)); |
| 13170 | } | 13171 | } |
| 13171 | c.moveToNext(); | 13172 | c.moveToNext(); |
| 13172 | } | 13173 | } |
| 13173 | } | 13174 | } |
| 13174 | 13175 | ||
| 13175 | // while (c.isAfterLast() == false) { | 13176 | // while (c.isAfterLast() == false) { |
| 13176 | // // 3 Agregamos cada numero a la lista | 13177 | // // 3 Agregamos cada numero a la lista |
| 13177 | // System.out.println("::: BaseDatos 4043 Campo inv_lug " + c.getInt(0)); | 13178 | // System.out.println("::: BaseDatos 4043 Campo inv_lug " + c.getInt(0)); |
| 13178 | // if(condVtaDep==-1){ | 13179 | // if(condVtaDep==-1){ |
| 13179 | // System.out.println("::: BaseDatos 4043 entro en el -1 que guarda "); | 13180 | // System.out.println("::: BaseDatos 4043 entro en el -1 que guarda "); |
| 13180 | // } | 13181 | // } |
| 13181 | // result.add(c.getInt(0)); | 13182 | // result.add(c.getInt(0)); |
| 13182 | // System.out.println("::: BaseDatos 4043 result: " + result); | 13183 | // System.out.println("::: BaseDatos 4043 result: " + result); |
| 13183 | // c.moveToNext(); | 13184 | // c.moveToNext(); |
| 13184 | // } | 13185 | // } |
| 13185 | // System.out.println("::: BaseDatos 3717 result: " + result); | 13186 | // System.out.println("::: BaseDatos 3717 result: " + result); |
| 13186 | } else { | 13187 | } else { |
| 13187 | return result; | 13188 | return result; |
| 13188 | } | 13189 | } |
| 13189 | 13190 | ||
| 13190 | // 4 Cierre de BD | 13191 | // 4 Cierre de BD |
| 13191 | dtb.close(); | 13192 | dtb.close(); |
| 13192 | 13193 | ||
| 13193 | return result; | 13194 | return result; |
| 13194 | 13195 | ||
| 13195 | } catch (Exception e) { | 13196 | } catch (Exception e) { |
| 13196 | 13197 | ||
| 13197 | GestorLogEventos log = new GestorLogEventos(); | 13198 | GestorLogEventos log = new GestorLogEventos(); |
| 13198 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 13199 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 13199 | log.log("[-- 2976 --]" + e.toString(), 4); | 13200 | log.log("[-- 2976 --]" + e.toString(), 4); |
| 13200 | 13201 | ||
| 13201 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, | 13202 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_SELECT, |
| 13202 | "Imposible inventariar todos los INVENTARIOS en curso"); | 13203 | "Imposible inventariar todos los INVENTARIOS en curso"); |
| 13203 | } | 13204 | } |
| 13204 | } | 13205 | } |
| 13205 | 13206 | ||
| 13206 | 13207 | ||
| 13207 | /** | 13208 | /** |
| 13208 | * Actualiza los datos de un ARTICULO pasado como parametro | 13209 | * Actualiza los datos de un ARTICULO pasado como parametro |
| 13209 | * <p> | 13210 | * <p> |
| 13210 | * 1 Abrimos la base de datos en modo escritura | 13211 | * 1 Abrimos la base de datos en modo escritura |
| 13211 | * <p> | 13212 | * <p> |
| 13212 | * 2 Creamos el registro a insertar como objeto ContentValues con los | 13213 | * 2 Creamos el registro a insertar como objeto ContentValues con los |
| 13213 | * valores correspondientes | 13214 | * valores correspondientes |
| 13214 | * <p> | 13215 | * <p> |
| 13215 | * 3 Insertamos el registro en la base de datos en modo actualizacion | 13216 | * 3 Insertamos el registro en la base de datos en modo actualizacion |
| 13216 | * <p> | 13217 | * <p> |
| 13217 | * 4 Cerramos la conexion | 13218 | * 4 Cerramos la conexion |
| 13218 | * | 13219 | * |
| 13219 | * @param articulo | 13220 | * @param articulo |
| 13220 | * @throws ExceptionBDD | 13221 | * @throws ExceptionBDD |
| 13221 | */ | 13222 | */ |
| 13222 | public void updateArticulo(Articulo articulo) throws ExceptionBDD { | 13223 | public void updateArticulo(Articulo articulo) throws ExceptionBDD { |
| 13223 | try { | 13224 | try { |
| 13224 | System.out.println("::: BaseDatos 3649 updateArticulo "); | 13225 | System.out.println("::: BaseDatos 3649 updateArticulo "); |
| 13225 | // Aca solamente hacemos update de fecha o cantidades o foto: | 13226 | // Aca solamente hacemos update de fecha o cantidades o foto: |
| 13226 | // ATENCION ATENCION ATENCION: | 13227 | // ATENCION ATENCION ATENCION: |
| 13227 | // El update implica la concatenacion de los codigos de barras de | 13228 | // El update implica la concatenacion de los codigos de barras de |
| 13228 | // los articulos identicos | 13229 | // los articulos identicos |
| 13229 | // con multiples codigos de barras SI LOS DOS ARTICULOS TIENEN CB | 13230 | // con multiples codigos de barras SI LOS DOS ARTICULOS TIENEN CB |
| 13230 | // DIFERENTES: | 13231 | // DIFERENTES: |
| 13231 | // Articulo articuloViejo = | 13232 | // Articulo articuloViejo = |
| 13232 | // selectArticuloConCodigos(articulo.getSector(), | 13233 | // selectArticuloConCodigos(articulo.getSector(), |
| 13233 | // articulo.getCodigo(), articulo.getInventario()); | 13234 | // articulo.getCodigo(), articulo.getInventario()); |
| 13234 | // String nueva_cadena_codigos_barras = | 13235 | // String nueva_cadena_codigos_barras = |
| 13235 | // articuloViejo.getCodigos_barras_string() + "," + | 13236 | // articuloViejo.getCodigos_barras_string() + "," + |
| 13236 | // articulo.getCodigos_barras_string(); | 13237 | // articulo.getCodigos_barras_string(); |
| 13237 | 13238 | ||
| 13238 | // 1 Abrimos la base de datos en modo escritura | 13239 | // 1 Abrimos la base de datos en modo escritura |
| 13239 | SQLiteDatabase dtb = this.getWritableDatabase(); | 13240 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 13240 | 13241 | ||
| 13241 | // Si hemos abierto correctamente la base de datos | 13242 | // Si hemos abierto correctamente la base de datos |
| 13242 | if (dtb != null) { | 13243 | if (dtb != null) { |
| 13243 | // 2 Creamos el registro a insertar como objeto ContentValues | 13244 | // 2 Creamos el registro a insertar como objeto ContentValues |
| 13244 | // con los valores correspondientes | 13245 | // con los valores correspondientes |
| 13245 | ContentValues nuevoRegistro = new ContentValues(); | 13246 | ContentValues nuevoRegistro = new ContentValues(); |
| 13246 | 13247 | ||
| 13247 | // !!!! En caso de update, reemplazamos los valores de CB con | 13248 | // !!!! En caso de update, reemplazamos los valores de CB con |
| 13248 | // los nuevos: | 13249 | // los nuevos: |
| 13249 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo_barra, | 13250 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 13250 | // nueva_cadena_codigos_barras); | 13251 | // nueva_cadena_codigos_barras); |
| 13251 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_inventario, | 13252 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_inventario, |
| 13252 | // articulo.getInventario()); | 13253 | // articulo.getInventario()); |
| 13253 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_descripcion, | 13254 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_descripcion, |
| 13254 | // articulo.getDescripcion()); | 13255 | // articulo.getDescripcion()); |
| 13255 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_precio_venta, | 13256 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 13256 | // articulo.getPrecio_venta()); | 13257 | // articulo.getPrecio_venta()); |
| 13257 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_precio_costo, | 13258 | // nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 13258 | // articulo.getPrecio_costo()); | 13259 | // articulo.getPrecio_costo()); |
| 13259 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 13260 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 13260 | articulo.getFoto()); | 13261 | articulo.getFoto()); |
| 13261 | nuevoRegistro.put( | 13262 | nuevoRegistro.put( |
| 13262 | ParametrosInventario.bal_bdd_articulo_cantidad, | 13263 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 13263 | articulo.getCantidad()); | 13264 | articulo.getCantidad()); |
| 13264 | nuevoRegistro.put( | 13265 | nuevoRegistro.put( |
| 13265 | ParametrosInventario.bal_bdd_articulo_subtotal, | 13266 | ParametrosInventario.bal_bdd_articulo_subtotal, |
| 13266 | articulo.getSubtotal()); | 13267 | articulo.getSubtotal()); |
| 13267 | 13268 | ||
| 13268 | // Cuidado, si el nuevo valor es "No Tomado" (cantidad Q = -1), | 13269 | // Cuidado, si el nuevo valor es "No Tomado" (cantidad Q = -1), |
| 13269 | // hay que suprimir la fecha en la BDD: | 13270 | // hay que suprimir la fecha en la BDD: |
| 13270 | 13271 | ||
| 13271 | // MODIFICACION DE FECHAS: | 13272 | // MODIFICACION DE FECHAS: |
| 13272 | // Fecha inicio: si no tiene valor en fecha inicio, le ponemos | 13273 | // Fecha inicio: si no tiene valor en fecha inicio, le ponemos |
| 13273 | // una: | 13274 | // una: |
| 13274 | String fechaI = articulo.getFechaInicio(); | 13275 | String fechaI = articulo.getFechaInicio(); |
| 13275 | if (fechaI.length() == 0) { | 13276 | if (fechaI.length() == 0) { |
| 13276 | articulo.setFechaInicio(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); | 13277 | articulo.setFechaInicio(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| 13277 | } | 13278 | } |
| 13278 | 13279 | ||
| 13279 | // Fecha fin: se modifica cada vez: | 13280 | // Fecha fin: se modifica cada vez: |
| 13280 | articulo.setFechaFin(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") | 13281 | articulo.setFechaFin(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") |
| 13281 | .format(new Date())); | 13282 | .format(new Date())); |
| 13282 | 13283 | ||
| 13283 | if (articulo.getCantidad() < 0) { | 13284 | if (articulo.getCantidad() < 0) { |
| 13284 | // Es no tomado | 13285 | // Es no tomado |
| 13285 | nuevoRegistro.put( | 13286 | nuevoRegistro.put( |
| 13286 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 13287 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 13287 | ""); | 13288 | ""); |
| 13288 | nuevoRegistro.put( | 13289 | nuevoRegistro.put( |
| 13289 | ParametrosInventario.bal_bdd_articulo_fechaFin, ""); | 13290 | ParametrosInventario.bal_bdd_articulo_fechaFin, ""); |
| 13290 | } else { | 13291 | } else { |
| 13291 | nuevoRegistro.put( | 13292 | nuevoRegistro.put( |
| 13292 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 13293 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 13293 | articulo.getFechaInicio()); | 13294 | articulo.getFechaInicio()); |
| 13294 | nuevoRegistro.put( | 13295 | nuevoRegistro.put( |
| 13295 | ParametrosInventario.bal_bdd_articulo_fechaFin, | 13296 | ParametrosInventario.bal_bdd_articulo_fechaFin, |
| 13296 | articulo.getFechaFin()); | 13297 | articulo.getFechaFin()); |
| 13297 | } | 13298 | } |
| 13298 | 13299 | ||
| 13299 | // 3 Insertamos el registro en la base de datos en modo | 13300 | // 3 Insertamos el registro en la base de datos en modo |
| 13300 | // actualizacion | 13301 | // actualizacion |
| 13301 | int resultado = dtb | 13302 | int resultado = dtb |
| 13302 | .update(tabla_articulos_nombre, | 13303 | .update(tabla_articulos_nombre, |
| 13303 | nuevoRegistro, | 13304 | nuevoRegistro, |
| 13304 | ParametrosInventario.bal_bdd_articulo_sector | 13305 | ParametrosInventario.bal_bdd_articulo_sector |
| 13305 | + "=? AND " | 13306 | + "=? AND " |
| 13306 | + ParametrosInventario.bal_bdd_articulo_codigo | 13307 | + ParametrosInventario.bal_bdd_articulo_codigo |
| 13307 | + "=? AND " | 13308 | + "=? AND " |
| 13308 | + ParametrosInventario.bal_bdd_articulo_inventario | 13309 | + ParametrosInventario.bal_bdd_articulo_inventario |
| 13309 | + "=?", | 13310 | + "=?", |
| 13310 | new String[] { | 13311 | new String[] { |
| 13311 | String.valueOf(articulo.getSector()), | 13312 | String.valueOf(articulo.getSector()), |
| 13312 | String.valueOf(articulo.getCodigo()), | 13313 | String.valueOf(articulo.getCodigo()), |
| 13313 | String.valueOf(articulo.getInventario()) }); | 13314 | String.valueOf(articulo.getInventario()) }); |
| 13314 | System.out.println("****************GUARDA****************"); | 13315 | System.out.println("****************GUARDA****************"); |
| 13315 | // Test del resultado: | 13316 | // Test del resultado: |
| 13316 | if (resultado <= 0) { | 13317 | if (resultado <= 0) { |
| 13317 | 13318 | ||
| 13318 | 13319 | ||
| 13319 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13320 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13320 | "Imposible actualizar los datos del ARTICULO (1) cuyo codigo es: " | 13321 | "Imposible actualizar los datos del ARTICULO (1) cuyo codigo es: " |
| 13321 | + articulo.getSector() + "-" | 13322 | + articulo.getSector() + "-" |
| 13322 | + articulo.getCodigo()); | 13323 | + articulo.getCodigo()); |
| 13323 | } | 13324 | } |
| 13324 | } else { | 13325 | } else { |
| 13325 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13326 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13326 | "Imposible actualizar los datos del ARTICULO (2) cuyo codigo es: " | 13327 | "Imposible actualizar los datos del ARTICULO (2) cuyo codigo es: " |
| 13327 | + articulo.getSector() + "-" | 13328 | + articulo.getSector() + "-" |
| 13328 | + articulo.getCodigo()); | 13329 | + articulo.getCodigo()); |
| 13329 | } | 13330 | } |
| 13330 | 13331 | ||
| 13331 | // 4 Cerramos la conexion | 13332 | // 4 Cerramos la conexion |
| 13332 | dtb.close(); | 13333 | dtb.close(); |
| 13333 | 13334 | ||
| 13334 | } catch (Exception e) { | 13335 | } catch (Exception e) { |
| 13335 | 13336 | ||
| 13336 | GestorLogEventos log = new GestorLogEventos(); | 13337 | GestorLogEventos log = new GestorLogEventos(); |
| 13337 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 13338 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 13338 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 13339 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 13339 | log.log("[-- 3110 --]" + e.toString(), 4); | 13340 | log.log("[-- 3110 --]" + e.toString(), 4); |
| 13340 | 13341 | ||
| 13341 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13342 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13342 | "Imposible actualizar los datos del ARTICULO cuyo codigo es: " | 13343 | "Imposible actualizar los datos del ARTICULO cuyo codigo es: " |
| 13343 | + articulo.getSector() + "-" + articulo.getCodigo()); | 13344 | + articulo.getSector() + "-" + articulo.getCodigo()); |
| 13344 | } | 13345 | } |
| 13345 | } | 13346 | } |
| 13346 | public void updateProveedor(Proveedor proveedor) throws ExceptionBDD { | 13347 | public void updateProveedor(Proveedor proveedor) throws ExceptionBDD { |
| 13347 | try { | 13348 | try { |
| 13348 | System.out.println("::: BaseDatos 3649 updateArticulo "); | 13349 | System.out.println("::: BaseDatos 3649 updateArticulo "); |
| 13349 | // 1 Abrimos la base de datos en modo escritura | 13350 | // 1 Abrimos la base de datos en modo escritura |
| 13350 | SQLiteDatabase dtb = this.getWritableDatabase(); | 13351 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 13351 | // Si hemos abierto correctamente la base de datos | 13352 | // Si hemos abierto correctamente la base de datos |
| 13352 | if (dtb != null) { | 13353 | if (dtb != null) { |
| 13353 | // 2 Creamos el registro a insertar como objeto ContentValues | 13354 | // 2 Creamos el registro a insertar como objeto ContentValues |
| 13354 | // con los valores correspondientes | 13355 | // con los valores correspondientes |
| 13355 | ContentValues nuevoRegistro = new ContentValues(); | 13356 | ContentValues nuevoRegistro = new ContentValues(); |
| 13356 | // !!!! En caso de update, reemplazamos los valores de CB con | 13357 | // !!!! En caso de update, reemplazamos los valores de CB con |
| 13357 | // los nuevos: | 13358 | // los nuevos: |
| 13358 | nuevoRegistro.put(ParametrosInventario.bal_bdd_proveedores_codigo, | 13359 | nuevoRegistro.put(ParametrosInventario.bal_bdd_proveedores_codigo, |
| 13359 | proveedor.getCodigo()); | 13360 | proveedor.getCodigo()); |
| 13360 | nuevoRegistro.put( | 13361 | nuevoRegistro.put( |
| 13361 | ParametrosInventario.bal_bdd_proveedores_descripcion, | 13362 | ParametrosInventario.bal_bdd_proveedores_descripcion, |
| 13362 | proveedor.getNombre()); | 13363 | proveedor.getNombre()); |
| 13363 | // Cuidado, si el nuevo valor es "No Tomado" (cantidad Q = -1), | 13364 | // Cuidado, si el nuevo valor es "No Tomado" (cantidad Q = -1), |
| 13364 | // hay que suprimir la fecha en la BDD: | 13365 | // hay que suprimir la fecha en la BDD: |
| 13365 | // MODIFICACION DE FECHAS: | 13366 | // MODIFICACION DE FECHAS: |
| 13366 | // Fecha inicio: si no tiene valor en fecha inicio, le ponemos | 13367 | // Fecha inicio: si no tiene valor en fecha inicio, le ponemos |
| 13367 | // una: | 13368 | // una: |
| 13368 | // 3 Insertamos el registro en la base de datos en modo | 13369 | // 3 Insertamos el registro en la base de datos en modo |
| 13369 | // actualizacion | 13370 | // actualizacion |
| 13370 | int resultado = dtb | 13371 | int resultado = dtb |
| 13371 | .update(tabla_proveedores_nombre, | 13372 | .update(tabla_proveedores_nombre, |
| 13372 | nuevoRegistro, | 13373 | nuevoRegistro, |
| 13373 | ParametrosInventario.bal_bdd_proveedores_codigo | 13374 | ParametrosInventario.bal_bdd_proveedores_codigo |
| 13374 | + "=?", | 13375 | + "=?", |
| 13375 | new String[] { | 13376 | new String[] { |
| 13376 | String.valueOf(proveedor.getCodigo())}); | 13377 | String.valueOf(proveedor.getCodigo())}); |
| 13377 | // Test del resultado: | 13378 | // Test del resultado: |
| 13378 | if (resultado <= 0) { | 13379 | if (resultado <= 0) { |
| 13379 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13380 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13380 | "Imposible actualizar los datos del Proveedor(1) cuyo codigo es: " | 13381 | "Imposible actualizar los datos del Proveedor(1) cuyo codigo es: " |
| 13381 | + proveedor.getCodigo()); | 13382 | + proveedor.getCodigo()); |
| 13382 | } | 13383 | } |
| 13383 | } else { | 13384 | } else { |
| 13384 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13385 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13385 | "Imposible actualizar los datos del Proveedor (2) cuyo codigo es: " | 13386 | "Imposible actualizar los datos del Proveedor (2) cuyo codigo es: " |
| 13386 | + proveedor.getCodigo()); | 13387 | + proveedor.getCodigo()); |
| 13387 | } | 13388 | } |
| 13388 | // 4 Cerramos la conexion | 13389 | // 4 Cerramos la conexion |
| 13389 | dtb.close(); | 13390 | dtb.close(); |
| 13390 | 13391 | ||
| 13391 | } catch (Exception e) { | 13392 | } catch (Exception e) { |
| 13392 | GestorLogEventos log = new GestorLogEventos(); | 13393 | GestorLogEventos log = new GestorLogEventos(); |
| 13393 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 13394 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 13394 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 13395 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 13395 | log.log("[-- 3110 --]" + e.toString(), 4); | 13396 | log.log("[-- 3110 --]" + e.toString(), 4); |
| 13396 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13397 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13397 | "Imposible actualizar los datos del Proveedor cuyo codigo es: " | 13398 | "Imposible actualizar los datos del Proveedor cuyo codigo es: " |
| 13398 | + proveedor.getCodigo()); | 13399 | + proveedor.getCodigo()); |
| 13399 | } | 13400 | } |
| 13400 | } | 13401 | } |
| 13401 | /** | 13402 | /** |
| 13402 | * Actualiza los Codigos de barra de un articulo dado | 13403 | * Actualiza los Codigos de barra de un articulo dado |
| 13403 | * <p> | 13404 | * <p> |
| 13404 | * 1 Busca el articulo en la BD | 13405 | * 1 Busca el articulo en la BD |
| 13405 | * <p> | 13406 | * <p> |
| 13406 | * 2 Agrega los codigos de barras del articulo pasado al de la BD | 13407 | * 2 Agrega los codigos de barras del articulo pasado al de la BD |
| 13407 | * <p> | 13408 | * <p> |
| 13408 | * 3 Abrimos la base de datos en modo escritura | 13409 | * 3 Abrimos la base de datos en modo escritura |
| 13409 | * <p> | 13410 | * <p> |
| 13410 | * 4 Creamos el registro a insertar como objeto ContentValues | 13411 | * 4 Creamos el registro a insertar como objeto ContentValues |
| 13411 | * <p> | 13412 | * <p> |
| 13412 | * 5 Insertamos el registro en la base de datos | 13413 | * 5 Insertamos el registro en la base de datos |
| 13413 | * <p> | 13414 | * <p> |
| 13414 | * 6 Cerramos la BD | 13415 | * 6 Cerramos la BD |
| 13415 | * | 13416 | * |
| 13416 | * @param articulo | 13417 | * @param articulo |
| 13417 | * @throws ExceptionBDD | 13418 | * @throws ExceptionBDD |
| 13418 | */ | 13419 | */ |
| 13419 | public void updateCbArticulo(Articulo articulo) throws ExceptionBDD { | 13420 | public void updateCbArticulo(Articulo articulo) throws ExceptionBDD { |
| 13420 | System.out.println("::: BaseDatos 4177 updateCbArticulo"); | 13421 | System.out.println("::: BaseDatos 4177 updateCbArticulo"); |
| 13421 | try { | 13422 | try { |
| 13422 | // ATENCION ATENCION ATENCION: | 13423 | // ATENCION ATENCION ATENCION: |
| 13423 | // El update implica la concatenacion de los codigos de barras de | 13424 | // El update implica la concatenacion de los codigos de barras de |
| 13424 | // los | 13425 | // los |
| 13425 | // articulos identicos | 13426 | // articulos identicos |
| 13426 | // con multiples codigos de barras SI LOS DOS ARTICULOS TIENEN CB | 13427 | // con multiples codigos de barras SI LOS DOS ARTICULOS TIENEN CB |
| 13427 | // DIFERENTES: | 13428 | // DIFERENTES: |
| 13428 | // 1 Busca el articulo en la BD | 13429 | // 1 Busca el articulo en la BD |
| 13429 | Articulo articuloViejo = selectArticuloConCodigos( | 13430 | Articulo articuloViejo = selectArticuloConCodigos( |
| 13430 | articulo.getSector(), articulo.getCodigo(), | 13431 | articulo.getSector(), articulo.getCodigo(), |
| 13431 | articulo.getInventario()); | 13432 | articulo.getInventario()); |
| 13432 | // 2 Agrega los 2001167019254codigos de barras del articulo pasado al de la BD | 13433 | // 2 Agrega los 2001167019254codigos de barras del articulo pasado al de la BD |
| 13433 | String nueva_cadena_codigos_barras = articuloViejo | 13434 | String nueva_cadena_codigos_barras = articuloViejo |
| 13434 | .getCodigos_barras_string() | 13435 | .getCodigos_barras_string() |
| 13435 | + "," | 13436 | + "," |
| 13436 | + articulo.getCodigos_barras_string(); | 13437 | + articulo.getCodigos_barras_string(); |
| 13437 | 13438 | ||
| 13438 | // 3 Abrimos la base de datos en modo escritura | 13439 | // 3 Abrimos la base de datos en modo escritura |
| 13439 | SQLiteDatabase dtb = this.getWritableDatabase(); | 13440 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 13440 | 13441 | ||
| 13441 | // Si hemos abierto correctamente la base de datos | 13442 | // Si hemos abierto correctamente la base de datos |
| 13442 | if (dtb != null) { | 13443 | if (dtb != null) { |
| 13443 | // 4 Creamos el registro a insertar como objeto ContentValues | 13444 | // 4 Creamos el registro a insertar como objeto ContentValues |
| 13444 | ContentValues nuevoRegistro = new ContentValues(); | 13445 | ContentValues nuevoRegistro = new ContentValues(); |
| 13445 | 13446 | ||
| 13446 | // !!!! En caso de update, reemplazamos los valores de CB con | 13447 | // !!!! En caso de update, reemplazamos los valores de CB con |
| 13447 | // los nuevos: | 13448 | // los nuevos: |
| 13448 | nuevoRegistro.put( | 13449 | nuevoRegistro.put( |
| 13449 | ParametrosInventario.bal_bdd_articulo_codigo_barra, | 13450 | ParametrosInventario.bal_bdd_articulo_codigo_barra, |
| 13450 | nueva_cadena_codigos_barras); | 13451 | nueva_cadena_codigos_barras); |
| 13451 | nuevoRegistro.put( | 13452 | nuevoRegistro.put( |
| 13452 | ParametrosInventario.bal_bdd_articulo_inventario, | 13453 | ParametrosInventario.bal_bdd_articulo_inventario, |
| 13453 | articulo.getInventario()); | 13454 | articulo.getInventario()); |
| 13454 | nuevoRegistro.put( | 13455 | nuevoRegistro.put( |
| 13455 | ParametrosInventario.bal_bdd_articulo_descripcion, | 13456 | ParametrosInventario.bal_bdd_articulo_descripcion, |
| 13456 | articulo.getDescripcion()); | 13457 | articulo.getDescripcion()); |
| 13457 | nuevoRegistro.put( | 13458 | nuevoRegistro.put( |
| 13458 | ParametrosInventario.bal_bdd_articulo_precio_venta, | 13459 | ParametrosInventario.bal_bdd_articulo_precio_venta, |
| 13459 | articulo.getPrecio_venta()); | 13460 | articulo.getPrecio_venta()); |
| 13460 | nuevoRegistro.put( | 13461 | nuevoRegistro.put( |
| 13461 | ParametrosInventario.bal_bdd_articulo_precio_costo, | 13462 | ParametrosInventario.bal_bdd_articulo_precio_costo, |
| 13462 | articulo.getPrecio_costo()); | 13463 | articulo.getPrecio_costo()); |
| 13463 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, | 13464 | nuevoRegistro.put(ParametrosInventario.bal_bdd_articulo_foto, |
| 13464 | articulo.getFoto()); | 13465 | articulo.getFoto()); |
| 13465 | nuevoRegistro.put( | 13466 | nuevoRegistro.put( |
| 13466 | ParametrosInventario.bal_bdd_articulo_cantidad, | 13467 | ParametrosInventario.bal_bdd_articulo_cantidad, |
| 13467 | articulo.getCantidad()); | 13468 | articulo.getCantidad()); |
| 13468 | nuevoRegistro.put( | 13469 | nuevoRegistro.put( |
| 13469 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 13470 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 13470 | articulo.getFechaInicio()); | 13471 | articulo.getFechaInicio()); |
| 13471 | nuevoRegistro.put( | 13472 | nuevoRegistro.put( |
| 13472 | ParametrosInventario.bal_bdd_articulo_fechaInicio, | 13473 | ParametrosInventario.bal_bdd_articulo_fechaInicio, |
| 13473 | articulo.getFechaInicio()); | 13474 | articulo.getFechaInicio()); |
| 13474 | /*Damian*/ | 13475 | /*Damian*/ |
| 13475 | nuevoRegistro.put( | 13476 | nuevoRegistro.put( |
| 13476 | ParametrosInventario.bal_bdd_articulo_existencia_venta, | 13477 | ParametrosInventario.bal_bdd_articulo_existencia_venta, |
| 13477 | articulo.getExis_venta()); | 13478 | articulo.getExis_venta()); |
| 13478 | nuevoRegistro.put( | 13479 | nuevoRegistro.put( |
| 13479 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, | 13480 | ParametrosInventario.bal_bdd_articulo_existencia_deposito, |
| 13480 | articulo.getExis_deposito()); | 13481 | articulo.getExis_deposito()); |
| 13481 | 13482 | ||
| 13482 | // 5 Insertamos el registro en la base de datos | 13483 | // 5 Insertamos el registro en la base de datos |
| 13483 | int resultado = dtb | 13484 | int resultado = dtb |
| 13484 | .update(tabla_articulos_nombre, | 13485 | .update(tabla_articulos_nombre, |
| 13485 | nuevoRegistro, | 13486 | nuevoRegistro, |
| 13486 | ParametrosInventario.bal_bdd_articulo_sector | 13487 | ParametrosInventario.bal_bdd_articulo_sector |
| 13487 | + "=? AND " | 13488 | + "=? AND " |
| 13488 | + ParametrosInventario.bal_bdd_articulo_codigo | 13489 | + ParametrosInventario.bal_bdd_articulo_codigo |
| 13489 | + "=? AND " | 13490 | + "=? AND " |
| 13490 | + ParametrosInventario.bal_bdd_articulo_inventario | 13491 | + ParametrosInventario.bal_bdd_articulo_inventario |
| 13491 | + "=?", | 13492 | + "=?", |
| 13492 | new String[] { | 13493 | new String[] { |
| 13493 | String.valueOf(articulo.getSector()), | 13494 | String.valueOf(articulo.getSector()), |
| 13494 | String.valueOf(articulo.getCodigo()), | 13495 | String.valueOf(articulo.getCodigo()), |
| 13495 | String.valueOf(articulo.getInventario()) }); | 13496 | String.valueOf(articulo.getInventario()) }); |
| 13496 | 13497 | ||
| 13497 | // Test del resultado: | 13498 | // Test del resultado: |
| 13498 | if (resultado <= 0) { | 13499 | if (resultado <= 0) { |
| 13499 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13500 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13500 | "Imposible actualizar los datos del ARTICULO (1) cuyo codigo es: " | 13501 | "Imposible actualizar los datos del ARTICULO (1) cuyo codigo es: " |
| 13501 | + articulo.getSector() + "-" | 13502 | + articulo.getSector() + "-" |
| 13502 | + articulo.getCodigo()); | 13503 | + articulo.getCodigo()); |
| 13503 | } | 13504 | } |
| 13504 | } else { | 13505 | } else { |
| 13505 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13506 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13506 | "Imposible actualizar los datos del ARTICULO (2) cuyo codigo es: " | 13507 | "Imposible actualizar los datos del ARTICULO (2) cuyo codigo es: " |
| 13507 | + articulo.getSector() + "-" | 13508 | + articulo.getSector() + "-" |
| 13508 | + articulo.getCodigo()); | 13509 | + articulo.getCodigo()); |
| 13509 | } | 13510 | } |
| 13510 | // 6 Cerramos la BD | 13511 | // 6 Cerramos la BD |
| 13511 | dtb.close(); | 13512 | dtb.close(); |
| 13512 | 13513 | ||
| 13513 | } catch (Exception e) { | 13514 | } catch (Exception e) { |
| 13514 | 13515 | ||
| 13515 | GestorLogEventos log = new GestorLogEventos(); | 13516 | GestorLogEventos log = new GestorLogEventos(); |
| 13516 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 13517 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 13517 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 13518 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 13518 | log.log("[-- 3228 --]" + e.toString(), 4); | 13519 | log.log("[-- 3228 --]" + e.toString(), 4); |
| 13519 | 13520 | ||
| 13520 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13521 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13521 | "Imposible actualizar los datos del ARTICULO cuyo codigo es: " | 13522 | "Imposible actualizar los datos del ARTICULO cuyo codigo es: " |
| 13522 | + articulo.getSector() + "-" + articulo.getCodigo()); | 13523 | + articulo.getSector() + "-" + articulo.getCodigo()); |
| 13523 | 13524 | ||
| 13524 | } | 13525 | } |
| 13525 | } | 13526 | } |
| 13526 | 13527 | ||
| 13527 | /** | 13528 | /** |
| 13528 | * Actualiza los datos de un INVENTARIO | 13529 | * Actualiza los datos de un INVENTARIO |
| 13529 | * <p> | 13530 | * <p> |
| 13530 | * 1 Abrimos la base de datos en modo escritura | 13531 | * 1 Abrimos la base de datos en modo escritura |
| 13531 | * <p> | 13532 | * <p> |
| 13532 | * 2 Creamos el registro a actualizar como objeto ContentValues | 13533 | * 2 Creamos el registro a actualizar como objeto ContentValues |
| 13533 | * <p> | 13534 | * <p> |
| 13534 | * 3 Insertamos el registro para actualizar en la base de datos | 13535 | * 3 Insertamos el registro para actualizar en la base de datos |
| 13535 | * <p> | 13536 | * <p> |
| 13536 | * 4 Cerramos la BD | 13537 | * 4 Cerramos la BD |
| 13537 | * | 13538 | * |
| 13538 | * @param inventario | 13539 | * @param inventario |
| 13539 | * @throws ExceptionBDD | 13540 | * @throws ExceptionBDD |
| 13540 | */ | 13541 | */ |
| 13541 | public void updateInventario(Inventario inventario) throws ExceptionBDD { | 13542 | public void updateInventario(Inventario inventario) throws ExceptionBDD { |
| 13542 | try { | 13543 | try { |
| 13543 | System.out.println("::: BaseDatos 4300 updateInventario"); | 13544 | System.out.println("::: BaseDatos 4300 updateInventario"); |
| 13544 | // 1 Abrimos la base de datos en modo escritura | 13545 | // 1 Abrimos la base de datos en modo escritura |
| 13545 | SQLiteDatabase dtb = this.getWritableDatabase(); | 13546 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 13546 | 13547 | ||
| 13547 | boolean condicionRadio = ParametrosInventario.InventariosVentas; | 13548 | boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 13548 | 13549 | ||
| 13549 | // Si hemos abierto correctamente la base de datos | 13550 | // Si hemos abierto correctamente la base de datos |
| 13550 | if (dtb != null) { | 13551 | if (dtb != null) { |
| 13551 | // 2 Creamos el registro a actualizar como objeto ContentValues | 13552 | // 2 Creamos el registro a actualizar como objeto ContentValues |
| 13552 | 13553 | ||
| 13553 | ContentValues nuevoRegistro = new ContentValues(); | 13554 | ContentValues nuevoRegistro = new ContentValues(); |
| 13554 | 13555 | ||
| 13555 | System.out.println("::: BaseDatos 4300 aca siiii condicionRadio " +condicionRadio +" inventario.getNumero() " +inventario.getNumero()); | 13556 | System.out.println("::: BaseDatos 4300 aca siiii condicionRadio " +condicionRadio +" inventario.getNumero() " +inventario.getNumero()); |
| 13556 | 13557 | ||
| 13557 | if(condicionRadio == true && inventario.getNumero()==-1){ | 13558 | if(condicionRadio == true && inventario.getNumero()==-1){ |
| 13558 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 13559 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 13559 | // condR=-1; | 13560 | // condR=-1; |
| 13560 | 13561 | ||
| 13561 | System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); | 13562 | System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); |
| 13562 | // ContentValues nuevoRegistro = new ContentValues(); | 13563 | // ContentValues nuevoRegistro = new ContentValues(); |
| 13563 | nuevoRegistro.put( | 13564 | nuevoRegistro.put( |
| 13564 | ParametrosInventario.bal_bdd_inventario_numero, | 13565 | ParametrosInventario.bal_bdd_inventario_numero, |
| 13565 | inventario.getNumero()); | 13566 | inventario.getNumero()); |
| 13566 | nuevoRegistro.put( | 13567 | nuevoRegistro.put( |
| 13567 | ParametrosInventario.bal_bdd_inventario_descripcion, | 13568 | ParametrosInventario.bal_bdd_inventario_descripcion, |
| 13568 | inventario.getDescripcion()); | 13569 | inventario.getDescripcion()); |
| 13569 | nuevoRegistro.put( | 13570 | nuevoRegistro.put( |
| 13570 | ParametrosInventario.bal_bdd_inventario_fechaInicio, | 13571 | ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 13571 | inventario.getFechaInicio()); | 13572 | inventario.getFechaInicio()); |
| 13572 | nuevoRegistro.put( | 13573 | nuevoRegistro.put( |
| 13573 | ParametrosInventario.bal_bdd_inventario_fechaFin, | 13574 | ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 13574 | inventario.getFechaFin()); | 13575 | inventario.getFechaFin()); |
| 13575 | nuevoRegistro.put( | 13576 | nuevoRegistro.put( |
| 13576 | ParametrosInventario.bal_bdd_inventario_estado, | 13577 | ParametrosInventario.bal_bdd_inventario_estado, |
| 13577 | inventario.getEstado()); | 13578 | inventario.getEstado()); |
| 13578 | nuevoRegistro.put( | 13579 | nuevoRegistro.put( |
| 13579 | ParametrosInventario.bal_bdd_inventario_lugar, | 13580 | ParametrosInventario.bal_bdd_inventario_lugar, |
| 13580 | inventario.getLugar()); | 13581 | inventario.getLugar()); |
| 13581 | 13582 | ||
| 13582 | int resultado = dtb | 13583 | int resultado = dtb |
| 13583 | .update(tabla_inventarios_nombre, nuevoRegistro, | 13584 | .update(tabla_inventarios_nombre, nuevoRegistro, |
| 13584 | ParametrosInventario.bal_bdd_inventario_numero | 13585 | ParametrosInventario.bal_bdd_inventario_numero |
| 13585 | + "=?", new String[] { String | 13586 | + "=?", new String[] { String |
| 13586 | .valueOf(inventario.getNumero()) }); | 13587 | .valueOf(inventario.getNumero()) }); |
| 13587 | 13588 | ||
| 13588 | // Test del resultado: | 13589 | // Test del resultado: |
| 13589 | if (resultado <= 0) { | 13590 | if (resultado <= 0) { |
| 13590 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13591 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13591 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13592 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13592 | + String.valueOf(inventario.getNumero())); | 13593 | + String.valueOf(inventario.getNumero())); |
| 13593 | } | 13594 | } |
| 13594 | }else if(condicionRadio == false && inventario.getNumero()==-2){ | 13595 | }else if(condicionRadio == false && inventario.getNumero()==-2){ |
| 13595 | // Esta seleccionado deposito, esto debe continuar sin los campos de ventas | 13596 | // Esta seleccionado deposito, esto debe continuar sin los campos de ventas |
| 13596 | // condR=-2; | 13597 | // condR=-2; |
| 13597 | 13598 | ||
| 13598 | System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); | 13599 | System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); |
| 13599 | // ContentValues nuevoRegistro = new ContentValues(); | 13600 | // ContentValues nuevoRegistro = new ContentValues(); |
| 13600 | nuevoRegistro.put( | 13601 | nuevoRegistro.put( |
| 13601 | ParametrosInventario.bal_bdd_inventario_numero, | 13602 | ParametrosInventario.bal_bdd_inventario_numero, |
| 13602 | inventario.getNumero()); | 13603 | inventario.getNumero()); |
| 13603 | nuevoRegistro.put( | 13604 | nuevoRegistro.put( |
| 13604 | ParametrosInventario.bal_bdd_inventario_descripcion, | 13605 | ParametrosInventario.bal_bdd_inventario_descripcion, |
| 13605 | inventario.getDescripcion()); | 13606 | inventario.getDescripcion()); |
| 13606 | nuevoRegistro.put( | 13607 | nuevoRegistro.put( |
| 13607 | ParametrosInventario.bal_bdd_inventario_fechaInicio, | 13608 | ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 13608 | inventario.getFechaInicio()); | 13609 | inventario.getFechaInicio()); |
| 13609 | nuevoRegistro.put( | 13610 | nuevoRegistro.put( |
| 13610 | ParametrosInventario.bal_bdd_inventario_fechaFin, | 13611 | ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 13611 | inventario.getFechaFin()); | 13612 | inventario.getFechaFin()); |
| 13612 | nuevoRegistro.put( | 13613 | nuevoRegistro.put( |
| 13613 | ParametrosInventario.bal_bdd_inventario_estado, | 13614 | ParametrosInventario.bal_bdd_inventario_estado, |
| 13614 | inventario.getEstado()); | 13615 | inventario.getEstado()); |
| 13615 | nuevoRegistro.put( | 13616 | nuevoRegistro.put( |
| 13616 | ParametrosInventario.bal_bdd_inventario_lugar, | 13617 | ParametrosInventario.bal_bdd_inventario_lugar, |
| 13617 | inventario.getLugar()); | 13618 | inventario.getLugar()); |
| 13618 | 13619 | ||
| 13619 | int resultado = dtb | 13620 | int resultado = dtb |
| 13620 | .update(tabla_inventarios_nombre, nuevoRegistro, | 13621 | .update(tabla_inventarios_nombre, nuevoRegistro, |
| 13621 | ParametrosInventario.bal_bdd_inventario_numero | 13622 | ParametrosInventario.bal_bdd_inventario_numero |
| 13622 | + "=?", new String[] { String | 13623 | + "=?", new String[] { String |
| 13623 | .valueOf(inventario.getNumero()) }); | 13624 | .valueOf(inventario.getNumero()) }); |
| 13624 | 13625 | ||
| 13625 | // Test del resultado: | 13626 | // Test del resultado: |
| 13626 | if (resultado <= 0) { | 13627 | if (resultado <= 0) { |
| 13627 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13628 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13628 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13629 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13629 | + String.valueOf(inventario.getNumero())); | 13630 | + String.valueOf(inventario.getNumero())); |
| 13630 | } | 13631 | } |
| 13631 | } | 13632 | } |
| 13632 | // | 13633 | // |
| 13633 | // System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); | 13634 | // System.out.println("::: BaseDatos 4468 inventario.getNumero() " + inventario.getNumero()); |
| 13634 | // ContentValues nuevoRegistro = new ContentValues(); | 13635 | // ContentValues nuevoRegistro = new ContentValues(); |
| 13635 | // nuevoRegistro.put( | 13636 | // nuevoRegistro.put( |
| 13636 | // ParametrosInventario.bal_bdd_inventario_numero, | 13637 | // ParametrosInventario.bal_bdd_inventario_numero, |
| 13637 | // inventario.getNumero()); | 13638 | // inventario.getNumero()); |
| 13638 | // nuevoRegistro.put( | 13639 | // nuevoRegistro.put( |
| 13639 | // ParametrosInventario.bal_bdd_inventario_descripcion, | 13640 | // ParametrosInventario.bal_bdd_inventario_descripcion, |
| 13640 | // inventario.getDescripcion()); | 13641 | // inventario.getDescripcion()); |
| 13641 | // nuevoRegistro.put( | 13642 | // nuevoRegistro.put( |
| 13642 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, | 13643 | // ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 13643 | // inventario.getFechaInicio()); | 13644 | // inventario.getFechaInicio()); |
| 13644 | // nuevoRegistro.put( | 13645 | // nuevoRegistro.put( |
| 13645 | // ParametrosInventario.bal_bdd_inventario_fechaFin, | 13646 | // ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 13646 | // inventario.getFechaFin()); | 13647 | // inventario.getFechaFin()); |
| 13647 | // nuevoRegistro.put( | 13648 | // nuevoRegistro.put( |
| 13648 | // ParametrosInventario.bal_bdd_inventario_estado, | 13649 | // ParametrosInventario.bal_bdd_inventario_estado, |
| 13649 | // inventario.getEstado()); | 13650 | // inventario.getEstado()); |
| 13650 | // nuevoRegistro.put( | 13651 | // nuevoRegistro.put( |
| 13651 | // ParametrosInventario.bal_bdd_inventario_lugar, | 13652 | // ParametrosInventario.bal_bdd_inventario_lugar, |
| 13652 | // inventario.getLugar()); | 13653 | // inventario.getLugar()); |
| 13653 | 13654 | ||
| 13654 | // 3 Insertamos el registro para actualizar en la base de datos | 13655 | // 3 Insertamos el registro para actualizar en la base de datos |
| 13655 | // int resultado = dtb | 13656 | // int resultado = dtb |
| 13656 | // .update(tabla_inventarios_nombre, nuevoRegistro, | 13657 | // .update(tabla_inventarios_nombre, nuevoRegistro, |
| 13657 | // ParametrosInventario.bal_bdd_inventario_numero | 13658 | // ParametrosInventario.bal_bdd_inventario_numero |
| 13658 | // + "=?", new String[] { String | 13659 | // + "=?", new String[] { String |
| 13659 | // .valueOf(inventario.getNumero()) }); | 13660 | // .valueOf(inventario.getNumero()) }); |
| 13660 | // | 13661 | // |
| 13661 | // // Test del resultado: | 13662 | // // Test del resultado: |
| 13662 | // if (resultado <= 0) { | 13663 | // if (resultado <= 0) { |
| 13663 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13664 | // throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13664 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13665 | // "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13665 | // + String.valueOf(inventario.getNumero())); | 13666 | // + String.valueOf(inventario.getNumero())); |
| 13666 | // } | 13667 | // } |
| 13667 | } else { | 13668 | } else { |
| 13668 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13669 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13669 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13670 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13670 | + String.valueOf(inventario.getNumero())); | 13671 | + String.valueOf(inventario.getNumero())); |
| 13671 | } | 13672 | } |
| 13672 | // 4 Cerramos la BD | 13673 | // 4 Cerramos la BD |
| 13673 | dtb.close(); | 13674 | dtb.close(); |
| 13674 | 13675 | ||
| 13675 | } catch (Exception e) { | 13676 | } catch (Exception e) { |
| 13676 | 13677 | ||
| 13677 | GestorLogEventos log = new GestorLogEventos(); | 13678 | GestorLogEventos log = new GestorLogEventos(); |
| 13678 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 13679 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 13679 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 13680 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 13680 | log.log("[-- 3305 --]" + e.toString(), 4); | 13681 | log.log("[-- 3305 --]" + e.toString(), 4); |
| 13681 | 13682 | ||
| 13682 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13683 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13683 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13684 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13684 | + String.valueOf(inventario.getNumero())); | 13685 | + String.valueOf(inventario.getNumero())); |
| 13685 | 13686 | ||
| 13686 | } | 13687 | } |
| 13687 | } | 13688 | } |
| 13688 | 13689 | ||
| 13689 | public void updateInventarioCompras(Inventario inventario) throws ExceptionBDD { | 13690 | public void updateInventarioCompras(Inventario inventario) throws ExceptionBDD { |
| 13690 | try { | 13691 | try { |
| 13691 | System.out.println("::: BaseDatos 4300 updateInventarioCompras"); | 13692 | System.out.println("::: BaseDatos 4300 updateInventarioCompras"); |
| 13692 | SQLiteDatabase dtb = this.getWritableDatabase(); | 13693 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 13693 | //boolean condicionRadio = ParametrosInventario.InventariosVentas; | 13694 | //boolean condicionRadio = ParametrosInventario.InventariosVentas; |
| 13694 | 13695 | ||
| 13695 | if (dtb != null) { | 13696 | if (dtb != null) { |
| 13696 | ContentValues nuevoRegistro = new ContentValues(); | 13697 | ContentValues nuevoRegistro = new ContentValues(); |
| 13697 | //if(condicionRadio == true && inventario.getNumero()==-1){ | 13698 | //if(condicionRadio == true && inventario.getNumero()==-1){ |
| 13698 | if(inventario.getNumero()==-3){ | 13699 | if(inventario.getNumero()==-3){ |
| 13699 | 13700 | ||
| 13700 | nuevoRegistro.put( | 13701 | nuevoRegistro.put( |
| 13701 | ParametrosInventario.bal_bdd_inventario_numero, | 13702 | ParametrosInventario.bal_bdd_inventario_numero, |
| 13702 | inventario.getNumero()); | 13703 | inventario.getNumero()); |
| 13703 | nuevoRegistro.put( | 13704 | nuevoRegistro.put( |
| 13704 | ParametrosInventario.bal_bdd_inventario_descripcion, | 13705 | ParametrosInventario.bal_bdd_inventario_descripcion, |
| 13705 | inventario.getDescripcion()); | 13706 | inventario.getDescripcion()); |
| 13706 | nuevoRegistro.put( | 13707 | nuevoRegistro.put( |
| 13707 | ParametrosInventario.bal_bdd_inventario_fechaInicio, | 13708 | ParametrosInventario.bal_bdd_inventario_fechaInicio, |
| 13708 | inventario.getFechaInicio()); | 13709 | inventario.getFechaInicio()); |
| 13709 | nuevoRegistro.put( | 13710 | nuevoRegistro.put( |
| 13710 | ParametrosInventario.bal_bdd_inventario_fechaFin, | 13711 | ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 13711 | inventario.getFechaFin()); | 13712 | inventario.getFechaFin()); |
| 13712 | nuevoRegistro.put( | 13713 | nuevoRegistro.put( |
| 13713 | ParametrosInventario.bal_bdd_inventario_estado, | 13714 | ParametrosInventario.bal_bdd_inventario_estado, |
| 13714 | inventario.getEstado()); | 13715 | inventario.getEstado()); |
| 13715 | nuevoRegistro.put( | 13716 | nuevoRegistro.put( |
| 13716 | ParametrosInventario.bal_bdd_inventario_lugar, | 13717 | ParametrosInventario.bal_bdd_inventario_lugar, |
| 13717 | inventario.getLugar()); | 13718 | inventario.getLugar()); |
| 13718 | 13719 | ||
| 13719 | int resultado = dtb | 13720 | int resultado = dtb |
| 13720 | .update(tabla_inventarios_nombre, nuevoRegistro, | 13721 | .update(tabla_inventarios_nombre, nuevoRegistro, |
| 13721 | ParametrosInventario.bal_bdd_inventario_numero | 13722 | ParametrosInventario.bal_bdd_inventario_numero |
| 13722 | + "=?", new String[] { String | 13723 | + "=?", new String[] { String |
| 13723 | .valueOf(inventario.getNumero()) }); | 13724 | .valueOf(inventario.getNumero()) }); |
| 13724 | 13725 | ||
| 13725 | // Test del resultado: | 13726 | // Test del resultado: |
| 13726 | if (resultado <= 0) { | 13727 | if (resultado <= 0) { |
| 13727 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13728 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13728 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13729 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13729 | + String.valueOf(inventario.getNumero())); | 13730 | + String.valueOf(inventario.getNumero())); |
| 13730 | } | 13731 | } |
| 13731 | } | 13732 | } |
| 13732 | } else { | 13733 | } else { |
| 13733 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13734 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13734 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13735 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13735 | + String.valueOf(inventario.getNumero())); | 13736 | + String.valueOf(inventario.getNumero())); |
| 13736 | } | 13737 | } |
| 13737 | // 4 Cerramos la BD | 13738 | // 4 Cerramos la BD |
| 13738 | dtb.close(); | 13739 | dtb.close(); |
| 13739 | 13740 | ||
| 13740 | } catch (Exception e) { | 13741 | } catch (Exception e) { |
| 13741 | 13742 | ||
| 13742 | GestorLogEventos log = new GestorLogEventos(); | 13743 | GestorLogEventos log = new GestorLogEventos(); |
| 13743 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 13744 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 13744 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 13745 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 13745 | log.log("[-- 3305 --]" + e.toString(), 4); | 13746 | log.log("[-- 3305 --]" + e.toString(), 4); |
| 13746 | 13747 | ||
| 13747 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13748 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13748 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13749 | "Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13749 | + String.valueOf(inventario.getNumero())); | 13750 | + String.valueOf(inventario.getNumero())); |
| 13750 | 13751 | ||
| 13751 | } | 13752 | } |
| 13752 | } | 13753 | } |
| 13753 | 13754 | ||
| 13754 | 13755 | ||
| 13755 | public void updateInventario(int num_inventario, int estado_nuevo) | 13756 | public void updateInventario(int num_inventario, int estado_nuevo) |
| 13756 | throws ExceptionBDD { | 13757 | throws ExceptionBDD { |
| 13757 | System.out.println("::: BaseDatos 4378 updateInventario"); | 13758 | System.out.println("::: BaseDatos 4378 updateInventario"); |
| 13758 | try { | 13759 | try { |
| 13759 | // 1 Abrimos la base de datos en modo escritura | 13760 | // 1 Abrimos la base de datos en modo escritura |
| 13760 | SQLiteDatabase dtb = this.getWritableDatabase(); | 13761 | SQLiteDatabase dtb = this.getWritableDatabase(); |
| 13761 | System.out.println("::: BaseDatos 4378 estado_nuevo " + estado_nuevo); | 13762 | System.out.println("::: BaseDatos 4378 estado_nuevo " + estado_nuevo); |
| 13762 | System.out.println("::: BaseDatos 4378 num_inventario " + num_inventario); | 13763 | System.out.println("::: BaseDatos 4378 num_inventario " + num_inventario); |
| 13763 | // Si hemos abierto correctamente la base de datos | 13764 | // Si hemos abierto correctamente la base de datos |
| 13764 | if (dtb != null) { | 13765 | if (dtb != null) { |
| 13765 | // 2 Creamos el registro a actualizar como objeto ContentValues | 13766 | // 2 Creamos el registro a actualizar como objeto ContentValues |
| 13766 | ContentValues nuevoRegistro = new ContentValues(); | 13767 | ContentValues nuevoRegistro = new ContentValues(); |
| 13767 | nuevoRegistro.put( | 13768 | nuevoRegistro.put( |
| 13768 | ParametrosInventario.bal_bdd_inventario_estado, | 13769 | ParametrosInventario.bal_bdd_inventario_estado, |
| 13769 | estado_nuevo); | 13770 | estado_nuevo); |
| 13770 | nuevoRegistro.put( | 13771 | nuevoRegistro.put( |
| 13771 | ParametrosInventario.bal_bdd_inventario_fechaFin, | 13772 | ParametrosInventario.bal_bdd_inventario_fechaFin, |
| 13772 | new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") | 13773 | new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") |
| 13773 | .format(new Date())); | 13774 | .format(new Date())); |
| 13774 | // 3 Actualizamos el registro en la base de datos | 13775 | // 3 Actualizamos el registro en la base de datos |
| 13775 | int resultado = dtb.update(tabla_inventarios_nombre, | 13776 | int resultado = dtb.update(tabla_inventarios_nombre, |
| 13776 | nuevoRegistro, | 13777 | nuevoRegistro, |
| 13777 | ParametrosInventario.bal_bdd_inventario_numero + "=?", | 13778 | ParametrosInventario.bal_bdd_inventario_numero + "=?", |
| 13778 | new String[] { String.valueOf(num_inventario) }); | 13779 | new String[] { String.valueOf(num_inventario) }); |
| 13779 | 13780 | ||
| 13780 | // Test del resultado: | 13781 | // Test del resultado: |
| 13781 | if (resultado <= 0) { | 13782 | if (resultado <= 0) { |
| 13782 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13783 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13783 | "(1) Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13784 | "(1) Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13784 | + String.valueOf(num_inventario)); | 13785 | + String.valueOf(num_inventario)); |
| 13785 | } | 13786 | } |
| 13786 | } else { | 13787 | } else { |
| 13787 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13788 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13788 | "(2) Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13789 | "(2) Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13789 | + String.valueOf(num_inventario)); | 13790 | + String.valueOf(num_inventario)); |
| 13790 | } | 13791 | } |
| 13791 | // 4 Cerramos la BD | 13792 | // 4 Cerramos la BD |
| 13792 | dtb.close(); | 13793 | dtb.close(); |
| 13793 | 13794 | ||
| 13794 | } catch (Exception e) { | 13795 | } catch (Exception e) { |
| 13795 | 13796 | ||
| 13796 | GestorLogEventos log = new GestorLogEventos(); | 13797 | GestorLogEventos log = new GestorLogEventos(); |
| 13797 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); | 13798 | log.setUbicacion(ParametrosInventario.CARPETA_LOGTABLET); |
| 13798 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; | 13799 | log.tipo_4 = Parametros.PREF_LOG_EXCEPCIONES; |
| 13799 | log.log("[-- 3370 --]" + e.toString(), 4); | 13800 | log.log("[-- 3370 --]" + e.toString(), 4); |
| 13800 | 13801 | ||
| 13801 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, | 13802 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_UPDATE, |
| 13802 | "(3) Imposible actualizar los datos del INVENTARIO cuyo numero es: " | 13803 | "(3) Imposible actualizar los datos del INVENTARIO cuyo numero es: " |
| 13803 | + String.valueOf(num_inventario)); | 13804 | + String.valueOf(num_inventario)); |
| 13804 | 13805 | ||
| 13805 | } | 13806 | } |
| 13806 | } | 13807 | } |
| 13807 | 13808 | ||
| 13808 | public ArrayList<Referencia> getArticulosAll() { | 13809 | public ArrayList<Referencia> getArticulosAll() { |
| 13809 | System.out.println("::: BaseDatos 4429 getArticulosAll"); | 13810 | System.out.println("::: BaseDatos 4429 getArticulosAll"); |
| 13810 | ArrayList Referencias = new ArrayList<Referencia>(); | 13811 | ArrayList Referencias = new ArrayList<Referencia>(); |
| 13811 | String query_1 = "Select * from " | 13812 | String query_1 = "Select * from " |
| 13812 | + ParametrosInventario.tabla_referencias; | 13813 | + ParametrosInventario.tabla_referencias; |
| 13813 | SQLiteDatabase dtb_1 = this.getReadableDatabase(); | 13814 | SQLiteDatabase dtb_1 = this.getReadableDatabase(); |
| 13814 | Cursor c_1 = dtb_1.rawQuery(query_1, null); | 13815 | Cursor c_1 = dtb_1.rawQuery(query_1, null); |
| 13815 | 13816 | ||
| 13816 | try { | 13817 | try { |
| 13817 | if (c_1.moveToFirst()) { | 13818 | if (c_1.moveToFirst()) { |
| 13818 | 13819 | ||
| 13819 | do { | 13820 | do { |
| 13820 | 13821 | ||
| 13821 | /*String sector = c_1.getString(0); | 13822 | /*String sector = c_1.getString(0); |
| 13822 | String codigo = c_1.getString(1); | 13823 | String codigo = c_1.getString(1); |
| 13823 | String codigoBarra = c_1.getString(2); | 13824 | String codigoBarra = c_1.getString(2); |
| 13824 | String descripcion = c_1.getString(3); | 13825 | String descripcion = c_1.getString(3); |
| 13825 | String precioVenta = c_1.getString(4); | 13826 | String precioVenta = c_1.getString(4); |
| 13826 | String precioCosto = c_1.getString(5); | 13827 | String precioCosto = c_1.getString(5); |
| 13827 | String foto = c_1.getString(6); | 13828 | String foto = c_1.getString(6); |
| 13828 | */ | 13829 | */ |
| 13829 | String sector = c_1.getString(0); | 13830 | String sector = c_1.getString(0); |
| 13830 | String codigo = c_1.getString(1); | 13831 | String codigo = c_1.getString(1); |
| 13831 | String balanza = c_1.getString(2); | 13832 | String balanza = c_1.getString(2); |
| 13832 | String decimales = c_1.getString(3); | 13833 | String decimales = c_1.getString(3); |
| 13833 | String exisventa = c_1.getString(4); | 13834 | String exisventa = c_1.getString(4); |
| 13834 | String exisdep = c_1.getString(5); | 13835 | String exisdep = c_1.getString(5); |
| 13835 | String codigoBarra = c_1.getString(6); | 13836 | String codigoBarra = c_1.getString(6); |
| 13836 | String codigoBarraC = c_1.getString(7); | 13837 | String codigoBarraC = c_1.getString(7); |
| 13837 | String descripcion = c_1.getString(8); | 13838 | String descripcion = c_1.getString(8); |
| 13838 | String precioVenta = c_1.getString(9); | 13839 | String precioVenta = c_1.getString(9); |
| 13839 | String precioCosto = c_1.getString(10); | 13840 | String precioCosto = c_1.getString(10); |
| 13840 | String depsn = c_1.getString(11); | 13841 | String depsn = c_1.getString(11); |
| 13841 | //String foto = c_1.getString(12); | 13842 | //String foto = c_1.getString(12); |
| 13842 | String foto = ""; | 13843 | String foto = ""; |
| 13843 | 13844 | ||
| 13844 | /* System.out.println("::: BaseDatos getArticulosAll do sector " + sector); | 13845 | /* System.out.println("::: BaseDatos getArticulosAll do sector " + sector); |
| 13845 | System.out.println("::: BaseDatos getArticulosAll do codigo " + codigo); | 13846 | System.out.println("::: BaseDatos getArticulosAll do codigo " + codigo); |
| 13846 | System.out.println("::: BaseDatos getArticulosAll do balanza " + balanza); | 13847 | System.out.println("::: BaseDatos getArticulosAll do balanza " + balanza); |
| 13847 | System.out.println("::: BaseDatos getArticulosAll do decimales " + decimales); | 13848 | System.out.println("::: BaseDatos getArticulosAll do decimales " + decimales); |
| 13848 | System.out.println("::: BaseDatos getArticulosAll do exisventa " + exisventa); | 13849 | System.out.println("::: BaseDatos getArticulosAll do exisventa " + exisventa); |
| 13849 | System.out.println("::: BaseDatos getArticulosAll do exisdep " + exisdep); | 13850 | System.out.println("::: BaseDatos getArticulosAll do exisdep " + exisdep); |
| 13850 | System.out.println("::: BaseDatos getArticulosAll do codigoBarra " + codigoBarra); | 13851 | System.out.println("::: BaseDatos getArticulosAll do codigoBarra " + codigoBarra); |
| 13851 | System.out.println("::: BaseDatos getArticulosAll do descripcion " + descripcion); | 13852 | System.out.println("::: BaseDatos getArticulosAll do descripcion " + descripcion); |
| 13852 | System.out.println("::: BaseDatos getArticulosAll do precioVenta " + precioVenta); | 13853 | System.out.println("::: BaseDatos getArticulosAll do precioVenta " + precioVenta); |
| 13853 | System.out.println("::: BaseDatos getArticulosAll do precioCosto " + precioCosto); | 13854 | System.out.println("::: BaseDatos getArticulosAll do precioCosto " + precioCosto); |
| 13854 | System.out.println("::: BaseDatos getArticulosAll do depsn " + depsn); | 13855 | System.out.println("::: BaseDatos getArticulosAll do depsn " + depsn); |
| 13855 | // System.out.println("::: BaseDatos getArticulosAll do foto " + foto); | 13856 | // System.out.println("::: BaseDatos getArticulosAll do foto " + foto); |
| 13856 | */ | 13857 | */ |
| 13857 | // String exisVenta = c_1.getString(7); | 13858 | // String exisVenta = c_1.getString(7); |
| 13858 | // String exisDeposito = c_1.getString(8); | 13859 | // String exisDeposito = c_1.getString(8); |
| 13859 | 13860 | ||
| 13860 | Referencia referencia = new Referencia(); | 13861 | Referencia referencia = new Referencia(); |
| 13861 | referencia.setSector(Integer.parseInt(sector)); | 13862 | referencia.setSector(Integer.parseInt(sector)); |
| 13862 | referencia.setArticulo(Integer.parseInt(codigo)); | 13863 | referencia.setArticulo(Integer.parseInt(codigo)); |
| 13863 | referencia.setBalanza(Integer.parseInt(balanza)); | 13864 | referencia.setBalanza(Integer.parseInt(balanza)); |
| 13864 | referencia.setDecimales(Integer.parseInt(decimales)); | 13865 | referencia.setDecimales(Integer.parseInt(decimales)); |
| 13865 | referencia.setCodigo_barra(codigoBarra); | 13866 | referencia.setCodigo_barra(codigoBarra); |
| 13866 | referencia.setDescripcion(descripcion); | 13867 | referencia.setDescripcion(descripcion); |
| 13867 | referencia.setPrecio_venta(Double.parseDouble(precioVenta)); | 13868 | referencia.setPrecio_venta(Double.parseDouble(precioVenta)); |
| 13868 | referencia.setPrecio_costo(Double.parseDouble(precioCosto)); | 13869 | referencia.setPrecio_costo(Double.parseDouble(precioCosto)); |
| 13869 | 13870 | ||
| 13870 | referencia.setExis_venta(Double.parseDouble(exisventa)); | 13871 | referencia.setExis_venta(Double.parseDouble(exisventa)); |
| 13871 | referencia.setExis_deposito(Double.parseDouble(exisdep)); | 13872 | referencia.setExis_deposito(Double.parseDouble(exisdep)); |
| 13872 | referencia.setFoto(foto); | 13873 | referencia.setFoto(foto); |
| 13873 | //System.out.println("::: BaseDatos Referencia " + referencia); | 13874 | //System.out.println("::: BaseDatos Referencia " + referencia); |
| 13874 | Referencias.add(referencia); | 13875 | Referencias.add(referencia); |
| 13875 | } while (c_1.moveToNext()); | 13876 | } while (c_1.moveToNext()); |
| 13876 | } | 13877 | } |
| 13877 | 13878 | ||
| 13878 | } catch (Exception e1) { | 13879 | } catch (Exception e1) { |
| 13879 | 13880 | ||
| 13880 | } | 13881 | } |
| 13881 | dtb_1.close(); | 13882 | dtb_1.close(); |
| 13882 | 13883 | ||
| 13883 | return Referencias; | 13884 | return Referencias; |
| 13884 | 13885 | ||
| 13885 | } | 13886 | } |
| 13886 | 13887 | ||
| 13887 | /** | 13888 | /** |
| 13888 | * Busca los inventarios en la bd | 13889 | * Busca los inventarios en la bd |
| 13889 | * <p> | 13890 | * <p> |
| 13890 | * 1 Abrimos la base de datos en modo lectura | 13891 | * 1 Abrimos la base de datos en modo lectura |
| 13891 | * <p> | 13892 | * <p> |
| 13892 | * 2 Buscamos todos los inventarios | 13893 | * 2 Buscamos todos los inventarios |
| 13893 | * <p> | 13894 | * <p> |
| 13894 | * 3 Genera el hashmap, uno por inventario | 13895 | * 3 Genera el hashmap, uno por inventario |
| 13895 | * <p> | 13896 | * <p> |
| 13896 | * 4 Agrega el hashmap en la entrada correspondiente a ese inventario | 13897 | * 4 Agrega el hashmap en la entrada correspondiente a ese inventario |
| 13897 | * <p> | 13898 | * <p> |
| 13898 | * 5 Cerramos conexiones | 13899 | * 5 Cerramos conexiones |
| 13899 | * | 13900 | * |
| 13900 | * @return un HashMap que guarda los inventarios por id de inventario | 13901 | * @return un HashMap que guarda los inventarios por id de inventario |
| 13901 | * @throws ExceptionBDD | 13902 | * @throws ExceptionBDD |
| 13902 | * si no encuentra inventarios | 13903 | * si no encuentra inventarios |
| 13903 | */ | 13904 | */ |
| 13904 | public HashMap<Integer, HashMap<String, String>> selectInventariosCompraEnBdd() | 13905 | public HashMap<Integer, HashMap<String, String>> selectInventariosCompraEnBdd() |
| 13905 | throws ExceptionBDD { | 13906 | throws ExceptionBDD { |
| 13906 | System.out.println("::: BaseDAtos 5956 selectInventariosCompraEnBdd"); | 13907 | System.out.println("::: BaseDAtos 5956 selectInventariosCompraEnBdd"); |
| 13907 | HashMap<Integer, HashMap<String, String>> tablaResultados = new HashMap<Integer, HashMap<String, String>>(); | 13908 | HashMap<Integer, HashMap<String, String>> tablaResultados = new HashMap<Integer, HashMap<String, String>>(); |
| 13908 | // 1 Abrimos la base de datos en modo lectura | 13909 | // 1 Abrimos la base de datos en modo lectura |
| 13909 | SQLiteDatabase dtb = this.getReadableDatabase(); | 13910 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 13910 | Cursor c; | 13911 | Cursor c; |
| 13911 | String whereClause = "inv_lug=3";// | 13912 | String whereClause = "inv_lug=3";// |
| 13912 | c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, | 13913 | c = dtb.query(tabla_inventarios_nombre, null , whereClause, null, null, |
| 13913 | null, "INV_NUM"+ " ASC" ); | 13914 | null, "INV_NUM"+ " ASC" ); |
| 13914 | // 2 Buscamos todos los inventarios | 13915 | // 2 Buscamos todos los inventarios |
| 13915 | if (c.moveToFirst()) { | 13916 | if (c.moveToFirst()) { |
| 13916 | while (!c.isAfterLast()) { | 13917 | while (!c.isAfterLast()) { |
| 13917 | HashMap<String, String> tablaUnInventario = new HashMap<String, String>(); | 13918 | HashMap<String, String> tablaUnInventario = new HashMap<String, String>(); |
| 13918 | /* | 13919 | /* |
| 13919 | * 3 Genera el hashmap, uno por inventario | 13920 | * 3 Genera el hashmap, uno por inventario |
| 13920 | */ | 13921 | */ |
| 13921 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_numero, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); | 13922 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_numero, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero))); |
| 13922 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_descripcion, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion))); | 13923 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_descripcion, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_descripcion))); |
| 13923 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_fechaInicio, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio))); | 13924 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_fechaInicio, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaInicio))); |
| 13924 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_fechaFin, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin))); | 13925 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_fechaFin, c.getString(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_fechaFin))); |
| 13925 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_estado, String.valueOf(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)))); | 13926 | tablaUnInventario.put(ParametrosInventario.bal_bdd_inventario_estado, String.valueOf(c.getInt(c.getColumnIndex(ParametrosInventario.bal_bdd_inventario_estado)))); |
| 13926 | /* | 13927 | /* |
| 13927 | * 4 Agrega el hashmap en la entrada correspondiente a ese | 13928 | * 4 Agrega el hashmap en la entrada correspondiente a ese |
| 13928 | * inventario | 13929 | * inventario |
| 13929 | */ | 13930 | */ |
| 13930 | tablaResultados | 13931 | tablaResultados |
| 13931 | .put(c.getInt(c | 13932 | .put(c.getInt(c |
| 13932 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), | 13933 | .getColumnIndex(ParametrosInventario.bal_bdd_inventario_numero)), |
| 13933 | tablaUnInventario); | 13934 | tablaUnInventario); |
| 13934 | c.moveToNext(); | 13935 | c.moveToNext(); |
| 13935 | } | 13936 | } |
| 13936 | } else { | 13937 | } else { |
| 13937 | throw new ExceptionBDD("INVENTARIO", 0); | 13938 | throw new ExceptionBDD("INVENTARIO", 0); |
| 13938 | } | 13939 | } |
| 13939 | // 5 Cerramos conexiones | 13940 | // 5 Cerramos conexiones |
| 13940 | c.close(); | 13941 | c.close(); |
| 13941 | dtb.close(); | 13942 | dtb.close(); |
| 13942 | return tablaResultados; | 13943 | return tablaResultados; |
| 13943 | } | 13944 | } |
| 13944 | 13945 | ||
| 13945 | //SE COMENTA POR QUE NO LO LLAMA NADIE | 13946 | //SE COMENTA POR QUE NO LO LLAMA NADIE |
| 13946 | public String proveedorAsignado(int id_inventario) throws ExceptionBDD { | 13947 | public String proveedorAsignado(int id_inventario) throws ExceptionBDD { |
| 13947 | System.out.println("::: BaseDatos 6764 corroborar si tiene un proveedor asignado"); | 13948 | System.out.println("::: BaseDatos 6764 corroborar si tiene un proveedor asignado"); |
| 13948 | // 1 Abrimos la base de datos en modo lectura | 13949 | // 1 Abrimos la base de datos en modo lectura |
| 13949 | SQLiteDatabase dtb = this.getReadableDatabase(); | 13950 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 13950 | Cursor c; | 13951 | Cursor c; |
| 13951 | Cursor cc; | 13952 | Cursor cc; |
| 13952 | String codigo_devolver = ""; | 13953 | String codigo_devolver = ""; |
| 13953 | String nombre_devolver = ""; | 13954 | String nombre_devolver = ""; |
| 13954 | c= dtb.rawQuery("SELECT COMPRA_PROVE_COD FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD="+id_inventario, null); | 13955 | c= dtb.rawQuery("SELECT COMPRA_PROVE_COD FROM COMPRA_PROVEEDOR WHERE COMPRA_INV_COD="+id_inventario, null); |
| 13955 | // 3 Evaluamos el resultado y si es 1 devolvemos true | 13956 | // 3 Evaluamos el resultado y si es 1 devolvemos true |
| 13956 | if (c.moveToFirst()) { | 13957 | if (c.moveToFirst()) { |
| 13957 | do { | 13958 | do { |
| 13958 | codigo_devolver= c.getString(0); | 13959 | codigo_devolver= c.getString(0); |
| 13959 | } while(c.moveToNext()); | 13960 | } while(c.moveToNext()); |
| 13960 | cc= dtb.rawQuery("SELECT PROV_DESC FROM PROVEEDORES WHERE PROV_COD="+codigo_devolver, null); | 13961 | cc= dtb.rawQuery("SELECT PROV_DESC FROM PROVEEDORES WHERE PROV_COD="+codigo_devolver, null); |
| 13961 | 13962 | ||
| 13962 | if (cc.moveToFirst()) { | 13963 | if (cc.moveToFirst()) { |
| 13963 | do { | 13964 | do { |
| 13964 | nombre_devolver= cc.getString(0); | 13965 | nombre_devolver= cc.getString(0); |
| 13965 | } while(cc.moveToNext()); | 13966 | } while(cc.moveToNext()); |
| 13966 | return nombre_devolver; | 13967 | return nombre_devolver; |
| 13967 | }else{ | 13968 | }else{ |
| 13968 | nombre_devolver = "ELEGIR PROVEEDOR"; | 13969 | nombre_devolver = "ELEGIR PROVEEDOR"; |
| 13969 | c.close(); | 13970 | c.close(); |
| 13970 | cc.close(); | 13971 | cc.close(); |
| 13971 | return nombre_devolver; | 13972 | return nombre_devolver; |
| 13972 | } | 13973 | } |
| 13973 | } else { | 13974 | } else { |
| 13974 | nombre_devolver = "ELEGIR PROVEEDOR"; | 13975 | nombre_devolver = "ELEGIR PROVEEDOR"; |
| 13975 | c.close(); | 13976 | c.close(); |
| 13976 | //cc.close(); | 13977 | //cc.close(); |
| 13977 | return nombre_devolver; | 13978 | return nombre_devolver; |
| 13978 | } | 13979 | } |
| 13979 | 13980 | ||
| 13980 | } | 13981 | } |
| 13981 | 13982 | ||
| 13982 | public boolean verificaBaseNueva(){ | 13983 | public boolean verificaBaseNueva(){ |
| 13983 | /*SE REALIZA UNA CONSULTA SOLAMENTE PARA VERIFICAR QUE SI LA BASE ES NUEVA, NO CREE UN INVENTARIO SIN | 13984 | /*SE REALIZA UNA CONSULTA SOLAMENTE PARA VERIFICAR QUE SI LA BASE ES NUEVA, NO CREE UN INVENTARIO SIN |
| 13984 | * ANTES QUE EL USUARIO USE EL INVENTARIO DINAMICO DE COMPRAS. VERIFICANDO QUE NO HAYA UN SOLO INVENTARIO | 13985 | * ANTES QUE EL USUARIO USE EL INVENTARIO DINAMICO DE COMPRAS. VERIFICANDO QUE NO HAYA UN SOLO INVENTARIO |
| 13985 | * EN LA PARTE DE COMPRAS PREGUNTANDO DESDE EL -3 PARA ABAJO*/ | 13986 | * EN LA PARTE DE COMPRAS PREGUNTANDO DESDE EL -3 PARA ABAJO*/ |
| 13986 | SQLiteDatabase dtb = this.getReadableDatabase(); | 13987 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 13987 | Cursor cvalidar; | 13988 | Cursor cvalidar; |
| 13988 | cvalidar= dtb.rawQuery("SELECT * FROM INVENTARIOS WHERE INV_NUM <=-3", null); | 13989 | cvalidar= dtb.rawQuery("SELECT * FROM INVENTARIOS WHERE INV_NUM <=-3", null); |
| 13989 | if (cvalidar.moveToFirst() == true) { | 13990 | if (cvalidar.moveToFirst() == true) { |
| 13990 | return true; | 13991 | return true; |
| 13991 | }else{ | 13992 | }else{ |
| 13992 | return false; | 13993 | return false; |
| 13993 | } | 13994 | } |
| 13994 | } | 13995 | } |
| 13995 | 13996 | ||
| 13996 | public void verComprasExistentes (Inventario inventario)throws ExceptionBDD{ | 13997 | public void verComprasExistentes (Inventario inventario)throws ExceptionBDD{ |
| 13997 | System.out.println("::: BaseDatos 6782"); | 13998 | System.out.println("::: BaseDatos 6782"); |
| 13998 | SQLiteDatabase dtb = this.getReadableDatabase(); | 13999 | SQLiteDatabase dtb = this.getReadableDatabase(); |
| 13999 | Cursor c; | 14000 | Cursor c; |
| 14000 | Cursor cc; | 14001 | Cursor cc; |
| 14001 | int inventario_encontrado = 0; | 14002 | int inventario_encontrado = 0; |
| 14002 | c= dtb.rawQuery("select * from INVENTARIOS WHERE INV_LUG=3 ORDER BY INV_NUM ASC LIMIT 1", null); | 14003 | c= dtb.rawQuery("select * from INVENTARIOS WHERE INV_LUG=3 ORDER BY INV_NUM ASC LIMIT 1", null); |
| 14003 | if (c.moveToFirst() == true) { | 14004 | if (c.moveToFirst() == true) { |
| 14004 | do { | 14005 | do { |
| 14005 | inventario_encontrado= Integer.parseInt(c.getString(0)); | 14006 | inventario_encontrado= Integer.parseInt(c.getString(0)); |
| 14006 | } while(c.moveToNext()); | 14007 | } while(c.moveToNext()); |
| 14007 | inventario_encontrado = inventario_encontrado - 1; | 14008 | inventario_encontrado = inventario_encontrado - 1; |
| 14008 | 14009 | ||
| 14009 | SQLiteDatabase dtbw = this.getWritableDatabase(); | 14010 | SQLiteDatabase dtbw = this.getWritableDatabase(); |
| 14010 | // Si hemos abierto correctamente la base de datos | 14011 | // Si hemos abierto correctamente la base de datos |
| 14011 | if (dtbw != null) { | 14012 | if (dtbw != null) { |
| 14012 | String descripcionCompleta = inventario.getDescripcion().trim(); | 14013 | String descripcionCompleta = inventario.getDescripcion().trim(); |
| 14013 | int n = descripcionCompleta.trim().length(); | 14014 | int n = descripcionCompleta.trim().length(); |
| 14014 | String obtenerDescripcion = descripcionCompleta.substring(0,(n-3)); | 14015 | String obtenerDescripcion = descripcionCompleta.substring(0,(n-3)); |
| 14015 | char car=descripcionCompleta.charAt(n-1); | 14016 | char car=descripcionCompleta.charAt(n-1); |
| 14016 | int variable_dep = 3; | 14017 | int variable_dep = 3; |
| 14017 | String str = ""; | 14018 | String str = ""; |
| 14018 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito | 14019 | // Esta seleccionado ventas, esto debe continuar sin los campos de deposito |
| 14019 | str = "INSERT INTO " + tabla_inventarios_nombre | 14020 | str = "INSERT INTO " + tabla_inventarios_nombre |
| 14020 | + " VALUES(" + inventario_encontrado + "," + "'" | 14021 | + " VALUES(" + inventario_encontrado + "," + "'" |
| 14021 | + obtenerDescripcion + "'," + "'" | 14022 | + obtenerDescripcion + "'," + "'" |
| 14022 | + inventario.getFechaInicio() + "'," + "'" | 14023 | + inventario.getFechaInicio() + "'," + "'" |
| 14023 | + inventario.getFechaFin() + "'," | 14024 | + inventario.getFechaFin() + "'," |
| 14024 | + inventario.getEstado() + "," + variable_dep+ "," +0 | 14025 | + inventario.getEstado() + "," + variable_dep+ "," +0 |
| 14025 | + ")"; | 14026 | + ")"; |
| 14026 | System.out.println("::: D.C. QUIERO VER VARIABLE_DEP "+variable_dep); | 14027 | System.out.println("::: D.C. QUIERO VER VARIABLE_DEP "+variable_dep); |
| 14027 | dtb.execSQL(str); | 14028 | dtb.execSQL(str); |
| 14028 | //} | 14029 | //} |
| 14029 | } else { | 14030 | } else { |
| 14030 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 14031 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 14031 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 14032 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 14032 | } | 14033 | } |
| 14033 | } else { | 14034 | } else { |
| 14034 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, | 14035 | throw new ExceptionBDD(ExceptionBDD.ERROR_TIPO_INSERT, |
| 14035 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); | 14036 | "Imposible agregar el INVENTARIO nuevo a la Base De Datos"); |
| 14036 | } | 14037 | } |
| 14037 | 14038 | ||
| 14038 | } | 14039 | } |
app/src/main/java/com/focasoftware/deboinventario/HttpWriter.java
| 1 | package com.focasoftware.deboinventario; | 1 | package com.focasoftware.deboinventario; |
| 2 | 2 | ||
| 3 | import android.os.Environment; | 3 | import android.os.Environment; |
| 4 | import org.w3c.dom.Document; | 4 | import org.w3c.dom.Document; |
| 5 | 5 | ||
| 6 | import java.io.BufferedReader; | 6 | import java.io.BufferedReader; |
| 7 | import java.io.File; | 7 | import java.io.File; |
| 8 | import java.io.FileInputStream; | 8 | import java.io.FileInputStream; |
| 9 | import java.io.FileOutputStream; | 9 | import java.io.FileOutputStream; |
| 10 | import java.io.IOException; | 10 | import java.io.IOException; |
| 11 | import java.io.InputStreamReader; | 11 | import java.io.InputStreamReader; |
| 12 | import java.io.OutputStreamWriter; | 12 | import java.io.OutputStreamWriter; |
| 13 | import java.nio.file.Files; | 13 | import java.nio.file.Files; |
| 14 | import java.nio.file.Path; | 14 | import java.nio.file.Path; |
| 15 | import java.nio.file.Paths; | 15 | import java.nio.file.Paths; |
| 16 | import java.util.Objects; | 16 | import java.util.Objects; |
| 17 | 17 | ||
| 18 | import javax.xml.transform.OutputKeys; | 18 | import javax.xml.transform.OutputKeys; |
| 19 | import javax.xml.transform.Result; | 19 | import javax.xml.transform.Result; |
| 20 | import javax.xml.transform.Source; | 20 | import javax.xml.transform.Source; |
| 21 | import javax.xml.transform.Transformer; | 21 | import javax.xml.transform.Transformer; |
| 22 | import javax.xml.transform.TransformerFactory; | 22 | import javax.xml.transform.TransformerFactory; |
| 23 | import javax.xml.transform.dom.DOMSource; | 23 | import javax.xml.transform.dom.DOMSource; |
| 24 | import javax.xml.transform.stream.StreamResult; | 24 | import javax.xml.transform.stream.StreamResult; |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * Clase para convertir un documento en forma de DOM a un archivo XML para su posterior | 27 | * Clase para convertir un documento en forma de DOM a un archivo XML para su posterior |
| 28 | * uso o envo | 28 | * uso o envo |
| 29 | * @author GuillermoR | 29 | * @author GuillermoR |
| 30 | * | 30 | * |
| 31 | */ | 31 | */ |
| 32 | public class HttpWriter{ | 32 | public class HttpWriter{ |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| 37 | * Convierte un documento DOM en un archivo XML a la direccion y nombre | 37 | * Convierte un documento DOM en un archivo XML a la direccion y nombre |
| 38 | * indicados en el url | 38 | * indicados en el url |
| 39 | * <p>1 Creacion del fuente del DOM | 39 | * <p>1 Creacion del fuente del DOM |
| 40 | * <p>2 Creacion del fichero de salida | 40 | * <p>2 Creacion del fichero de salida |
| 41 | * <p>3 Configuracion del transformador de documento | 41 | * <p>3 Configuracion del transformador de documento |
| 42 | * <p>4 Realizamos la transformacion | 42 | * <p>4 Realizamos la transformacion |
| 43 | * | 43 | * |
| 44 | */ | 44 | */ |
| 45 | public static void transformerXml(Document document, String urlArchivo){ | 45 | public static void transformerXml(Document document, String urlArchivo){ |
| 46 | 46 | ||
| 47 | try { | 47 | try { |
| 48 | //1 Creacion del fuente del DOM | 48 | //1 Creacion del fuente del DOM |
| 49 | Source source = new DOMSource(document); | 49 | Source source = new DOMSource(document); |
| 50 | 50 | ||
| 51 | //2 Creacion del fichero de salida | 51 | //2 Creacion del fichero de salida |
| 52 | //urlArchivo="/mnt/sdcard/data/data/com.foca.deboInventario"; | 52 | |
| 53 | File archivo = new File(urlArchivo); | 53 | File archivo = new File(urlArchivo); |
| 54 | File parent = new File(archivo.getParent()); | 54 | File parent = new File(String.valueOf(archivo)); |
| 55 | if (!parent.exists()) { | 55 | if (!parent.exists()) { |
| 56 | archivo.mkdirs(); | 56 | archivo.mkdirs(); |
| 57 | } | 57 | } |
| 58 | //Result resultat = new StreamResult(archivo); | 58 | //Result resultat = new StreamResult(archivo); |
| 59 | 59 | ||
| 60 | //3 Configuracion del transformador de documento | 60 | //3 Configuracion del transformador de documento |
| 61 | TransformerFactory fabricaTransformacion = TransformerFactory.newInstance(); | 61 | TransformerFactory fabricaTransformacion = TransformerFactory.newInstance(); |
| 62 | Transformer transformador = fabricaTransformacion.newTransformer(); | 62 | Transformer transformador = fabricaTransformacion.newTransformer(); |
| 63 | transformador.setOutputProperty(OutputKeys.INDENT, "yes"); | 63 | transformador.setOutputProperty(OutputKeys.INDENT, "yes"); |
| 64 | transformador.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1"); | 64 | transformador.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1"); |
| 65 | StreamResult resultat = new StreamResult(new File(parent, "/deboInventarioExport.xml").getPath()); | 65 | StreamResult resultat = new StreamResult(new File(parent + "/", "deboInventarioExport.xml").getPath()); |
| 66 | //4 Realizamos la transformacion | 66 | //4 Realizamos la transformacion |
| 67 | transformador.transform(source, resultat); | 67 | transformador.transform(source, resultat); |
| 68 | 68 | ||
| 69 | }catch(Exception e){ | 69 | }catch(Exception e){ |
| 70 | e.printStackTrace(); | 70 | e.printStackTrace(); |
| 71 | } | 71 | } |
| 72 | } | 72 | } |
| 73 | // public static void transformerXml(Document document, String urlArchivo) { | 73 | // public static void transformerXml(Document document, String urlArchivo) { |
| 74 | // try { | 74 | // try { |
| 75 | // //1 Creacion del fuente del DOM | 75 | // //1 Creacion del fuente del DOM |
| 76 | // Source source = new DOMSource(document); | 76 | // Source source = new DOMSource(document); |
| 77 | // | 77 | // |
| 78 | // //2 Creacion del fichero de salida | 78 | // //2 Creacion del fichero de salida |
| 79 | // File archivo = new File(urlArchivo); | 79 | // File archivo = new File(urlArchivo); |
| 80 | // File parent = new File(archivo.getParent()); | 80 | // File parent = new File(archivo.getParent()); |
| 81 | // if (!parent.exists()) { | 81 | // if (!parent.exists()) { |
| 82 | // archivo.mkdirs(); | 82 | // archivo.mkdirs(); |
| 83 | // } | 83 | // } |
| 84 | // | 84 | // |
| 85 | // | 85 | // |
| 86 | // //3 Configuracion del transformador de documento | 86 | // //3 Configuracion del transformador de documento |
| 87 | // TransformerFactory fabricaTransformacion = TransformerFactory.newInstance(); | 87 | // TransformerFactory fabricaTransformacion = TransformerFactory.newInstance(); |
| 88 | // Transformer transformador = fabricaTransformacion.newTransformer(); | 88 | // Transformer transformador = fabricaTransformacion.newTransformer(); |
| 89 | // transformador.setOutputProperty(OutputKeys.INDENT, "yes"); | 89 | // transformador.setOutputProperty(OutputKeys.INDENT, "yes"); |
| 90 | // transformador.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1"); | 90 | // transformador.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1"); |
| 91 | // StreamResult resultat = new StreamResult(new File(parent+"/", "deboInventarioExport.xml").getPath()); | 91 | // StreamResult resultat = new StreamResult(new File(parent+"/", "deboInventarioExport.xml").getPath()); |
| 92 | // //4 Realizamos la transformacion | 92 | // //4 Realizamos la transformacion |
| 93 | // transformador.transform(source, resultat); | 93 | // transformador.transform(source, resultat); |
| 94 | // | 94 | // |
| 95 | // }catch(Exception e){ | 95 | // }catch(Exception e){ |
| 96 | // e.printStackTrace(); | 96 | // e.printStackTrace(); |
| 97 | // } | 97 | // } |
| 98 | // } | 98 | // } |
| 99 | 99 | ||
| 100 | /* | 100 | /* |
| 101 | @Override | 101 | @Override |
| 102 | public void onCreate(Bundle savedInstanceState) | 102 | public void onCreate(Bundle savedInstanceState) |
| 103 | { | 103 | { |
| 104 | // Por fin creamos la pgina: | 104 | // Por fin creamos la pgina: |
| 105 | super.onCreate(savedInstanceState); | 105 | super.onCreate(savedInstanceState); |
| 106 | 106 | ||
| 107 | try{ | 107 | try{ |
| 108 | hash1.put("ID_MED","1"); | 108 | hash1.put("ID_MED","1"); |
| 109 | hash1.put("PER","2011/07"); | 109 | hash1.put("PER","2011/07"); |
| 110 | hash1.put("LEAN", "1000"); | 110 | hash1.put("LEAN", "1000"); |
| 111 | hash1.put("LEAC","2000"); | 111 | hash1.put("LEAC","2000"); |
| 112 | hash1.put("VAL","123456"); | 112 | hash1.put("VAL","123456"); |
| 113 | hash1.put("FECHA_TOMA", "2011/08/15 11:30:25"); | 113 | hash1.put("FECHA_TOMA", "2011/08/15 11:30:25"); |
| 114 | hash1.put("ID_ERROR","0"); | 114 | hash1.put("ID_ERROR","0"); |
| 115 | hash1.put("OBSERVACION",""); | 115 | hash1.put("OBSERVACION",""); |
| 116 | hash1.put("ID_OPE", "1"); | 116 | hash1.put("ID_OPE", "1"); |
| 117 | 117 | ||
| 118 | listaTodasMediciones.put("1",hash1); | 118 | listaTodasMediciones.put("1",hash1); |
| 119 | //listaTodasMediciones.put("2",hash2); | 119 | //listaTodasMediciones.put("2",hash2); |
| 120 | //listaTodasMediciones.put("3",hash3); | 120 | //listaTodasMediciones.put("3",hash3); |
| 121 | 121 | ||
| 122 | // Cration d'un nouveau DOM | 122 | // Cration d'un nouveau DOM |
| 123 | DocumentBuilderFactory fabrique = DocumentBuilderFactory.newInstance(); | 123 | DocumentBuilderFactory fabrique = DocumentBuilderFactory.newInstance(); |
| 124 | DocumentBuilder constructeur = fabrique.newDocumentBuilder(); | 124 | DocumentBuilder constructeur = fabrique.newDocumentBuilder(); |
| 125 | Document document = constructeur.newDocument(); | 125 | Document document = constructeur.newDocument(); |
| 126 | 126 | ||
| 127 | // Proprits du DOM | 127 | // Proprits du DOM |
| 128 | document.setXmlVersion("1.0"); | 128 | document.setXmlVersion("1.0"); |
| 129 | document.setXmlStandalone(true); | 129 | document.setXmlStandalone(true); |
| 130 | 130 | ||
| 131 | // Cration de l'arborescence du DOM | 131 | // Cration de l'arborescence du DOM |
| 132 | //Element raiz = document.createElement("WEBs"); | 132 | //Element raiz = document.createElement("WEBs"); |
| 133 | 133 | ||
| 134 | Element titulo = document.createElement("VI_AGUA_FROM_TABLET"); | 134 | Element titulo = document.createElement("VI_AGUA_FROM_TABLET"); |
| 135 | //raiz.appendChild(titulo); | 135 | //raiz.appendChild(titulo); |
| 136 | 136 | ||
| 137 | Enumeration<String> enumeration = listaTodasMediciones.keys(); | 137 | Enumeration<String> enumeration = listaTodasMediciones.keys(); |
| 138 | while (enumeration.hasMoreElements() == true) { | 138 | while (enumeration.hasMoreElements() == true) { |
| 139 | String key = enumeration.nextElement(); | 139 | String key = enumeration.nextElement(); |
| 140 | Hashtable<String,String> hash = listaTodasMediciones.get(key); | 140 | Hashtable<String,String> hash = listaTodasMediciones.get(key); |
| 141 | 141 | ||
| 142 | Element medicion = document.createElement("MEDICION"); | 142 | Element medicion = document.createElement("MEDICION"); |
| 143 | Enumeration<String> e = hash.keys(); | 143 | Enumeration<String> e = hash.keys(); |
| 144 | while (e.hasMoreElements() == true) { | 144 | while (e.hasMoreElements() == true) { |
| 145 | String key2 = e.nextElement(); | 145 | String key2 = e.nextElement(); |
| 146 | String value2 = hash.get(key2); | 146 | String value2 = hash.get(key2); |
| 147 | Element elemento = document.createElement(key2); | 147 | Element elemento = document.createElement(key2); |
| 148 | elemento.setTextContent(value2); | 148 | elemento.setTextContent(value2); |
| 149 | medicion.appendChild(elemento); | 149 | medicion.appendChild(elemento); |
| 150 | } | 150 | } |
| 151 | titulo.appendChild(medicion); | 151 | titulo.appendChild(medicion); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | //raiz.appendChild(titulo); | 154 | //raiz.appendChild(titulo); |
| 155 | document.appendChild(titulo); //raiz); | 155 | document.appendChild(titulo); //raiz); |
| 156 | 156 | ||
| 157 | //Sauvegarde du DOM dans un fichier XML | 157 | //Sauvegarde du DOM dans un fichier XML |
| 158 | transformerXml(document, ParametrosAgua.URL_DOCUMENTO_XML); | 158 | transformerXml(document, ParametrosAgua.URL_DOCUMENTO_XML); |
| 159 | 159 | ||
| 160 | HttpSender sender = new HttpSender(Parametros.CODIGO_SOFT_DEBOAGUA); | 160 | HttpSender sender = new HttpSender(Parametros.CODIGO_SOFT_DEBOAGUA); |
| 161 | sender.send_xml(ParametrosAgua.URL_DOCUMENTO_XML); | 161 | sender.send_xml(ParametrosAgua.URL_DOCUMENTO_XML); |
| 162 | 162 | ||
| 163 | }catch(Exception e){ | 163 | }catch(Exception e){ |
| 164 | e.printStackTrace(); | 164 | e.printStackTrace(); |
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | */ | 167 | */ |
| 168 | } | 168 | } |
| 169 | 169 |
app/src/main/java/com/focasoftware/deboinventario/ParametrosInventario.java
| 1 | package com.focasoftware.deboinventario; | 1 | package com.focasoftware.deboinventario; |
| 2 | 2 | ||
| 3 | import android.os.Environment; | 3 | import android.os.Environment; |
| 4 | 4 | ||
| 5 | import androidx.annotation.NonNull; | 5 | import androidx.annotation.NonNull; |
| 6 | import androidx.annotation.Nullable; | 6 | import androidx.annotation.Nullable; |
| 7 | 7 | ||
| 8 | import java.io.File; | 8 | import java.io.File; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| 11 | * Clase donde se almacenan los parmetros generales de la aplicacin. Contiene | 11 | * Clase donde se almacenan los parmetros generales de la aplicacin. Contiene |
| 12 | * en su mayora campos estticos para poder acceder a ellos desde toda la | 12 | * en su mayora campos estticos para poder acceder a ellos desde toda la |
| 13 | * aplicacin. | 13 | * aplicacin. |
| 14 | * | 14 | * |
| 15 | * @author GuillermoR | 15 | * @author GuillermoR |
| 16 | * | 16 | * |
| 17 | */ | 17 | */ |
| 18 | public class ParametrosInventario { | 18 | public class ParametrosInventario { |
| 19 | /** | 19 | /** |
| 20 | * Parametro de control para el modo debug IMPORTANTE SU ESTADO | 20 | * Parametro de control para el modo debug IMPORTANTE SU ESTADO |
| 21 | */ | 21 | */ |
| 22 | public static boolean MODO_DEBUG = false; | 22 | public static boolean MODO_DEBUG = false; |
| 23 | public static boolean PREF_CAMARA = false; | 23 | public static boolean PREF_CAMARA = false; |
| 24 | 24 | ||
| 25 | @NonNull | 25 | @NonNull |
| 26 | public static String ID_TABLET = "99"; | 26 | public static String ID_TABLET = "99"; |
| 27 | 27 | ||
| 28 | public final static String no_disponible = "N/D"; | 28 | public final static String no_disponible = "N/D"; |
| 29 | public final static String tablet_mostrar_existencia = "tablet_mostrar_existencia"; | 29 | public final static String tablet_mostrar_existencia = "tablet_mostrar_existencia"; |
| 30 | public static boolean mostrar_existencia = true; | 30 | public static boolean mostrar_existencia = true; |
| 31 | 31 | ||
| 32 | public static final String intent_codigo = "INTENT_CODIGO"; | 32 | public static final String intent_codigo = "INTENT_CODIGO"; |
| 33 | public final static String foto_uri = "FOTO_URI"; | 33 | public final static String foto_uri = "FOTO_URI"; |
| 34 | public final static String foto_calidad = "FOTO_CALIDAD"; | 34 | public final static String foto_calidad = "FOTO_CALIDAD"; |
| 35 | public final static int PREF_MAX_COMPRA_ABIERTAS = 10; | 35 | public final static int PREF_MAX_COMPRA_ABIERTAS = 10; |
| 36 | public final static int MAX_SQL_RESPUESTAS = 200; | 36 | public final static int MAX_SQL_RESPUESTAS = 200; |
| 37 | 37 | ||
| 38 | public final static int TAMANO_MAX_CANTIDAD = 8; | 38 | public final static int TAMANO_MAX_CANTIDAD = 8; |
| 39 | 39 | ||
| 40 | public final static int TAMANO_PAQUETES_XML = 400; | 40 | public final static int TAMANO_PAQUETES_XML = 400; |
| 41 | 41 | ||
| 42 | public final static int INVENTARIO_ABIERTO = 1; | 42 | public final static int INVENTARIO_ABIERTO = 1; |
| 43 | public final static int INVENTARIO_CERRADO = 0; | 43 | public final static int INVENTARIO_CERRADO = 0; |
| 44 | 44 | ||
| 45 | public static final float TALLA_TEXTO = 16; | 45 | public static final float TALLA_TEXTO = 16; |
| 46 | 46 | ||
| 47 | public static final int REQUEST_CODIGO_BARRA = 310; | 47 | public static final int REQUEST_CODIGO_BARRA = 310; |
| 48 | public static final int REQUEST_FOTO = 320; | 48 | public static final int REQUEST_FOTO = 320; |
| 49 | public static final int REQUEST_INVENTARIO = 330; | 49 | public static final int REQUEST_INVENTARIO = 330; |
| 50 | public static final int REQUEST_INVENTARIO_DINAMICO = 340; | 50 | public static final int REQUEST_INVENTARIO_DINAMICO = 340; |
| 51 | public static final int REQUEST_INVENTARIO_COMPRAS = 345; | 51 | public static final int REQUEST_INVENTARIO_COMPRAS = 345; |
| 52 | public static final int REQUEST_DETALLES_ART = 350; | 52 | public static final int REQUEST_DETALLES_ART = 350; |
| 53 | 53 | ||
| 54 | public static final int filtro_sector = 7001; | 54 | public static final int filtro_sector = 7001; |
| 55 | public static final int filtro_inventario = 7002; | 55 | public static final int filtro_inventario = 7002; |
| 56 | public static final int filtro_precio = 7003; | 56 | public static final int filtro_precio = 7003; |
| 57 | 57 | ||
| 58 | public static final String preferencias_camara_scanner = "preferencias_camara_scanner"; | 58 | public static final String preferencias_camara_scanner = "preferencias_camara_scanner"; |
| 59 | 59 | ||
| 60 | public static final String preferencias_stock_alatoma = "preferencias_stock_alatoma"; | 60 | public static final String preferencias_stock_alatoma = "preferencias_stock_alatoma"; |
| 61 | 61 | ||
| 62 | public static final String URL_CARPETA_FOTOS = "/data/data/com.foca.deboInventario/fotos/"; | 62 | public static final String URL_CARPETA_FOTOS = "/sdcard/Documents/fotos/"; |
| 63 | public static final String URL_CARPETA_USB = "/data/data/com.foca.deboInventario/usb/"; | 63 | public static final String URL_CARPETA_USB = "/sdcard/Documents/usb/"; |
| 64 | public static final String URL_CARPETA_USB_EXPORT = "/data/data/com.foca.deboInventario/usb/export/"; | 64 | public static final String URL_CARPETA_USB_EXPORT = "/sdcard/Documents/usb/export/"; |
| 65 | public static final String URL_CARPETA_USB_IMPORT = "/data/data/com.foca.deboInventario/usb/import/"; | 65 | public static final String URL_CARPETA_USB_IMPORT = "/sdcard/Documents/usb/import/"; |
| 66 | public static final String URL_CARPETA_DATABASES = "/data/data/com.foca.deboInventario/databases/"; | 66 | public static final String URL_CARPETA_DATABASES = "/sdcard/Documents/databases/"; |
| 67 | 67 | ||
| 68 | // public final static String URL_ARCHIVO_LOG = "/data/data/com.foca.deboInventario/log.txt"; | 68 | public final static String URL_ARCHIVO_LOG = "/sdcard/Documents/log.txt"; |
| 69 | public final static String URL_ARCHIVO_LOG = "/mnt/sdcard/data/data/com.foca.deboInventario/log.txt"; | 69 | public final static String URL_COPIA_XML_EXPORT ="/sdcard/Documents/deboInventarioExport.xml"; |
| 70 | public final static String URL_COPIA_XML_EXPORT ="/mnt/sdcard/data/data/com.foca.deboInventario/deboInventarioExport.xml"; | 70 | public final static String URL_COPIA_XML_EXPORT_RUTA ="/sdcard/Documents/"; |
| 71 | //public final static String URL_COPIA_XML_EXPORT ="/data/data/com.foca.deboInventario/deboInventarioExport.xml"; | 71 | public final static String URI_USB = "/sdcard/Documents/test/"; |
| 72 | public final static String URI_USB = "/data/data/com.foca.deboInventario/test/"; | ||
| 73 | 72 | ||
| 74 | 73 | ||
| 75 | // public static final String URL_CARPETA_FOTOS = "/data/data/com.foca.deboInventario/fotos/"; | 74 | // public static final String URL_CARPETA_FOTOS = "/data/data/com.foca.deboInventario/fotos/"; |
| 76 | // public static final String URL_CARPETA_USB = "/data/data/com.foca.deboInventario/usb/"; | 75 | // public static final String URL_CARPETA_USB = "/data/data/com.foca.deboInventario/usb/"; |
| 77 | // public static final String URL_CARPETA_USB_EXPORT = "/data/data/com.foca.deboInventario/usb/export/"; | 76 | // public static final String URL_CARPETA_USB_EXPORT = "/data/data/com.foca.deboInventario/usb/export/"; |
| 78 | // public static final String URL_CARPETA_USB_IMPORT = "/data/data/com.foca.deboInventario/usb/import/"; | 77 | // public static final String URL_CARPETA_USB_IMPORT = "/data/data/com.foca.deboInventario/usb/import/"; |
| 79 | // public static final String URL_CARPETA_DATABASES = "/data/data/com.foca.deboInventario/databases/"; | 78 | // public static final String URL_CARPETA_DATABASES = "/data/data/com.foca.deboInventario/databases/"; |
| 80 | // | 79 | // |
| 81 | // public final static String URL_ARCHIVO_LOG = "/data/data/com.foca.deboInventario/log.txt"; | 80 | // public final static String URL_ARCHIVO_LOG = "/data/data/com.foca.deboInventario/log.txt"; |
| 82 | // public final static String URL_COPIA_XML_EXPORT ="/data/data/com.foca.deboInventario/deboInventarioExport.xml"; | 81 | // public final static String URL_COPIA_XML_EXPORT ="/data/data/com.foca.deboInventario/deboInventarioExport.xml"; |
| 83 | // public final static String URI_USB = "/data/data/com.foca.deboInventario/test/"; | 82 | // public final static String URI_USB = "/data/data/com.foca.deboInventario/test/"; |
| 84 | 83 | ||
| 85 | public static File SdCard = Environment.getExternalStorageDirectory(); | 84 | public static File SdCard = Environment.getExternalStorageDirectory(); |
| 86 | @NonNull | 85 | @NonNull |
| 87 | public static String Stringsdcard = SdCard.toString(); | 86 | public static String Stringsdcard = SdCard.toString(); |
| 88 | @NonNull | 87 | @NonNull |
| 89 | public static String CARPETA_DEBOINVENTARIO = Stringsdcard | 88 | public static String CARPETA_DEBOINVENTARIO = Stringsdcard |
| 90 | + "/deboInventario/"; | 89 | + "/deboInventario/"; |
| 91 | @Nullable | 90 | @Nullable |
| 92 | public static String CARPETA_ATABLET = Stringsdcard | 91 | public static String CARPETA_ATABLET = Stringsdcard |
| 93 | + "/deboInventario/aTablet/"; | 92 | + "/deboInventario/aTablet/"; |
| 94 | @Nullable | 93 | @Nullable |
| 95 | public static String CARPETA_DESDETABLET = Stringsdcard | 94 | public static String CARPETA_DESDETABLET = Stringsdcard |
| 96 | + "/deboInventario/desdeTablet/"; | 95 | + "/deboInventario/desdeTablet/"; |
| 97 | @Nullable | 96 | @Nullable |
| 98 | public static String CARPETA_MAETABLET = Stringsdcard | 97 | public static String CARPETA_MAETABLET = Stringsdcard |
| 99 | + "/deboInventario/maeTablet/"; | 98 | + "/deboInventario/maeTablet/"; |
| 100 | @Nullable | 99 | @Nullable |
| 101 | public static String CARPETA_LOGTABLET = Stringsdcard | 100 | public static String CARPETA_LOGTABLET = Stringsdcard |
| 102 | + "/deboInventario/logTablet/"; | 101 | + "/deboInventario/logTablet/"; |
| 103 | @Nullable | 102 | @Nullable |
| 104 | public static String CARPETA_LOGDATOS = Stringsdcard | 103 | public static String CARPETA_LOGDATOS = Stringsdcard |
| 105 | + "/deboInventario/logDatos/"; | 104 | + "/deboInventario/logDatos/"; |
| 106 | 105 | ||
| 107 | public static boolean InventariosVentas = true; | 106 | public static boolean InventariosVentas = true; |
| 108 | public static boolean InventariosDeposito = false; | 107 | public static boolean InventariosDeposito = false; |
| 109 | public static boolean CamHabScanner = true; | 108 | public static boolean CamHabScanner = true; |
| 110 | public static boolean LecturaEntrada = false; | 109 | public static boolean LecturaEntrada = false; |
| 111 | public static int ProductosNoContabilizados = 1; | 110 | public static int ProductosNoContabilizados = 1; |
| 112 | public static boolean StockToma = true; | 111 | public static boolean StockToma = true; |
| 113 | 112 | ||
| 114 | public static boolean balanza = true; | 113 | public static boolean balanza = true; |
| 115 | 114 | ||
| 116 | public static int InventarioVentas = 1; | 115 | public static int InventarioVentas = 1; |
| 117 | 116 | ||
| 118 | public static int radVen = 1; | 117 | public static int radVen = 1; |
| 119 | 118 | ||
| 120 | public static int radDep = 2; | 119 | public static int radDep = 2; |
| 121 | 120 | ||
| 122 | public static int StockalaToma = 1; | 121 | public static int StockalaToma = 1; |
| 123 | 122 | ||
| 124 | // public static String PREF_IMPORT = CARPETA_ATABLET; | 123 | // public static String PREF_IMPORT = CARPETA_ATABLET; |
| 125 | // public static String PREF_USB_EXPORT = CARPETA_DESDETABLET; | 124 | // public static String PREF_USB_EXPORT = CARPETA_DESDETABLET; |
| 126 | @NonNull | 125 | @NonNull |
| 127 | public static String Dispositivo_Import = "Dispositivo"; | 126 | public static String Dispositivo_Import = "Dispositivo"; |
| 128 | @NonNull | 127 | @NonNull |
| 129 | public static String Dispositivo_Export = "Dispositivo"; | 128 | public static String Dispositivo_Export = "Dispositivo"; |
| 130 | 129 | ||
| 131 | // public final static String PREF_USB_IMPORT_MAESTRO = | 130 | // public final static String PREF_USB_IMPORT_MAESTRO = |
| 132 | // "/udisk/deboInventario/maeTablet/"; | 131 | // "/udisk/deboInventario/maeTablet/"; |
| 133 | // public final static String PREF_FLASH_IMPORT_MAESTRO = | 132 | // public final static String PREF_FLASH_IMPORT_MAESTRO = |
| 134 | // "/flash/deboInventario/maeTablet/"; | 133 | // "/flash/deboInventario/maeTablet/"; |
| 135 | // public final static String PREF_SDCARD_IMPORT_MAESTRO = | 134 | // public final static String PREF_SDCARD_IMPORT_MAESTRO = |
| 136 | // CARPETA_MAETABLET; | 135 | // CARPETA_MAETABLET; |
| 137 | // public final static String UNIDAD_ALMACENAMIENTO_FLASH = "/flash"; | 136 | // public final static String UNIDAD_ALMACENAMIENTO_FLASH = "/flash"; |
| 138 | // public final static String UNIDAD_ALMACENAMIENTO_UDISK = "/udisk"; | 137 | // public final static String UNIDAD_ALMACENAMIENTO_UDISK = "/udisk"; |
| 139 | public final static String UNIDAD_ALMACENAMIENTO_SDCARD = Stringsdcard; | 138 | public final static String UNIDAD_ALMACENAMIENTO_SDCARD = Stringsdcard; |
| 140 | public final static String PREF_USB_IMPORT_MAESTRO_NOMBRE = "maestro.xml"; | 139 | public final static String PREF_USB_IMPORT_MAESTRO_NOMBRE = "maestro.xml"; |
| 141 | 140 | ||
| 142 | public final static int BDD_VERSION = 14; | 141 | public final static int BDD_VERSION = 14; |
| 143 | public final static String VERSION = BDD_VERSION + ".0.15"; | 142 | public final static String VERSION = BDD_VERSION + ".0.15"; |
| 144 | public final static String BDD_NOMBRE = "DB_INVENT"; | 143 | public final static String BDD_NOMBRE = "DB_INVENT"; |
| 145 | 144 | ||
| 146 | public static final String elementos_seleccionados = "INVENTARIOS_SELECCIONADOS"; | 145 | public static final String elementos_seleccionados = "INVENTARIOS_SELECCIONADOS"; |
| 147 | 146 | ||
| 148 | // Codigos de fonciones: | 147 | // Codigos de fonciones: |
| 149 | public final static int FONCION_CARGAR_INVENTARIOS = 31; | 148 | public final static int FONCION_CARGAR_INVENTARIOS = 31; |
| 150 | public final static int FONCION_CARGAR_ARTICULOS = 32; | 149 | public final static int FONCION_CARGAR_ARTICULOS = 32; |
| 151 | public final static int FONCION_CARGAR_REFERENCIAS = 37; | 150 | public final static int FONCION_CARGAR_REFERENCIAS = 37; |
| 152 | public final static int FONCION_CARGAR_REFERENCIAS_POR_PARTES = 38; | 151 | public final static int FONCION_CARGAR_REFERENCIAS_POR_PARTES = 38; |
| 153 | public final static int FONCION_CARGAR_FOTO = 33; | 152 | public final static int FONCION_CARGAR_FOTO = 33; |
| 154 | // public final static int FONCION_CARGAR_TODOS_OPERADORES = 11; | 153 | // public final static int FONCION_CARGAR_TODOS_OPERADORES = 11; |
| 155 | // public final static int FONCION_CARGAR_DETALLES_RUTA = 12; | 154 | // public final static int FONCION_CARGAR_DETALLES_RUTA = 12; |
| 156 | 155 | ||
| 157 | // BUNDLES Y EXTRAS: | 156 | // BUNDLES Y EXTRAS: |
| 158 | public final static String extra_numeroInventario = "NUMERO_INVENTARIO"; | 157 | public final static String extra_numeroInventario = "NUMERO_INVENTARIO"; |
| 159 | public final static String extra_numeroInventarioDinVta = "NUMERO_INVENTARIO_DINAMICO_VENTA"; | 158 | public final static String extra_numeroInventarioDinVta = "NUMERO_INVENTARIO_DINAMICO_VENTA"; |
| 160 | public final static String extra_numeroInventarioDinDepo = "NUMERO_INVENTARIO_DINAMICO_DEPOSITO"; | 159 | public final static String extra_numeroInventarioDinDepo = "NUMERO_INVENTARIO_DINAMICO_DEPOSITO"; |
| 161 | public final static String extra_numeroInventarioCompra = "NUMERO_INVENTARIO_DINAMICO_COMPRA"; | 160 | public final static String extra_numeroInventarioCompra = "NUMERO_INVENTARIO_DINAMICO_COMPRA"; |
| 162 | public final static String extra_bandera_invs_dinamicos = "CARGA_NUEVOS_INVS_DINAMICOS"; | 161 | public final static String extra_bandera_invs_dinamicos = "CARGA_NUEVOS_INVS_DINAMICOS"; |
| 163 | public final static String extra_listaArticulos = "LISTA_ARTICULOS"; | 162 | public final static String extra_listaArticulos = "LISTA_ARTICULOS"; |
| 164 | public final static String extra_codigo = "ART_CODIGO"; | 163 | public final static String extra_codigo = "ART_CODIGO"; |
| 165 | public final static String extra_sector = "ART_SECTOR"; | 164 | public final static String extra_sector = "ART_SECTOR"; |
| 166 | public final static String extra_codBar = "ART_COD_BAR"; | 165 | public final static String extra_codBar = "ART_COD_BAR"; |
| 167 | public final static String extra_inventario = "ART_I"; | 166 | public final static String extra_inventario = "ART_I"; |
| 168 | 167 | ||
| 169 | public final static int extra_valor_bandera_invs_dinamicos_si = 1; | 168 | public final static int extra_valor_bandera_invs_dinamicos_si = 1; |
| 170 | public final static int extra_valor_bandera_invs_dinamicos_no = 0; | 169 | public final static int extra_valor_bandera_invs_dinamicos_no = 0; |
| 171 | 170 | ||
| 172 | // Codigos de ID: | 171 | // Codigos de ID: |
| 173 | // public final static int ID_CURSORS = 11000; | 172 | // public final static int ID_CURSORS = 11000; |
| 174 | public final static int ID_BOTONES = 12000; | 173 | public final static int ID_BOTONES = 12000; |
| 175 | public final static int ID_CHECKBOXES = 13000; | 174 | public final static int ID_CHECKBOXES = 13000; |
| 176 | public final static int ID_LINEAS = 14000; | 175 | public final static int ID_LINEAS = 14000; |
| 177 | public final static int ID_LINEA_DINAMICO = -1; | 176 | public final static int ID_LINEA_DINAMICO = -1; |
| 178 | 177 | ||
| 179 | // ID inventarios dinmicos | 178 | // ID inventarios dinmicos |
| 180 | public final static int ID_INV_DIN_VTA = -1; | 179 | public final static int ID_INV_DIN_VTA = -1; |
| 181 | public final static int ID_INV_DIN_DEP = -2; | 180 | public final static int ID_INV_DIN_DEP = -2; |
| 182 | public final static int ID_INV_COMPRAS = -3; | 181 | public final static int ID_INV_COMPRAS = -3; |
| 183 | 182 | ||
| 184 | public final static int COD_LUGAR_INVENTARIO_VENTA = 0; | 183 | public final static int COD_LUGAR_INVENTARIO_VENTA = 0; |
| 185 | public final static int COD_LUGAR_INVENTARIO_DEPO = 1; | 184 | public final static int COD_LUGAR_INVENTARIO_DEPO = 1; |
| 186 | 185 | ||
| 187 | // PREFERENCIAS: | 186 | // PREFERENCIAS: |
| 188 | public final static String preferencias_en_curso = "EN_CURSO"; | 187 | public final static String preferencias_en_curso = "EN_CURSO"; |
| 189 | 188 | ||
| 190 | // CLAVES PARA HASHMAP: | 189 | // CLAVES PARA HASHMAP: |
| 191 | public final static int clave_art_sector = 1; | 190 | public final static int clave_art_sector = 1; |
| 192 | public final static int clave_art_codigo = 2; | 191 | public final static int clave_art_codigo = 2; |
| 193 | public final static int clave_art_nombre = 3; | 192 | public final static int clave_art_nombre = 3; |
| 194 | 193 | ||
| 195 | 194 | ||
| 196 | // CLAVES PARA HASHMAP Proveedores: | 195 | // CLAVES PARA HASHMAP Proveedores: |
| 197 | public final static int clave_prov_cod = 1; | 196 | public final static int clave_prov_cod = 1; |
| 198 | public final static int clave_prov_desc = 2; | 197 | public final static int clave_prov_desc = 2; |
| 199 | 198 | ||
| 200 | // ///////////////////////// | 199 | // ///////////////////////// |
| 201 | // BALIZAS // | 200 | // BALIZAS // |
| 202 | // ///////////////////////// | 201 | // ///////////////////////// |
| 203 | 202 | ||
| 204 | /* GLOBAL: */ | 203 | /* GLOBAL: */ |
| 205 | public final static String bal_xml_export_cabecera = "TABLET_EXPORT_INVENTARIO"; | 204 | public final static String bal_xml_export_cabecera = "TABLET_EXPORT_INVENTARIO"; |
| 206 | 205 | ||
| 207 | /* BASE DE DATOS: */ | 206 | /* BASE DE DATOS: */ |
| 208 | /* Articulos: */ | 207 | /* Articulos: */ |
| 209 | public final static String tabla_articulos = "ARTICULOS"; | 208 | public final static String tabla_articulos = "ARTICULOS"; |
| 210 | 209 | ||
| 211 | public final static String bal_bdd_articulo_sector = "ART_SEC"; | 210 | public final static String bal_bdd_articulo_sector = "ART_SEC"; |
| 212 | public final static String bal_bdd_articulo_codigo = "ART_COD"; | 211 | public final static String bal_bdd_articulo_codigo = "ART_COD"; |
| 213 | public final static String bal_bdd_articulo_balanza = "ART_BAL"; | 212 | public final static String bal_bdd_articulo_balanza = "ART_BAL"; |
| 214 | public final static String bal_bdd_articulo_decimales = "ART_DE"; | 213 | public final static String bal_bdd_articulo_decimales = "ART_DE"; |
| 215 | public final static String bal_bdd_articulo_codigo_barra = "ART_CB"; | 214 | public final static String bal_bdd_articulo_codigo_barra = "ART_CB"; |
| 216 | public final static String bal_bdd_articulo_codigo_barra_completo = "ART_CBC"; | 215 | public final static String bal_bdd_articulo_codigo_barra_completo = "ART_CBC"; |
| 217 | public final static String bal_bdd_articulo_inventario = "ART_I"; | 216 | public final static String bal_bdd_articulo_inventario = "ART_I"; |
| 218 | public final static String bal_bdd_articulo_descripcion = "ART_DESC"; | 217 | public final static String bal_bdd_articulo_descripcion = "ART_DESC"; |
| 219 | public final static String bal_bdd_articulo_precio_venta = "ART_PRE_VTA"; | 218 | public final static String bal_bdd_articulo_precio_venta = "ART_PRE_VTA"; |
| 220 | public final static String bal_bdd_articulo_precio_costo = "ART_PRE_COS"; | 219 | public final static String bal_bdd_articulo_precio_costo = "ART_PRE_COS"; |
| 221 | public final static String bal_bdd_articulo_foto = "ART_FOTO"; | 220 | public final static String bal_bdd_articulo_foto = "ART_FOTO"; |
| 222 | public final static String bal_bdd_articulo_cantidad = "ART_Q"; | 221 | public final static String bal_bdd_articulo_cantidad = "ART_Q"; |
| 223 | public final static String bal_bdd_articulo_subtotal = "ART_SUBTOT"; | 222 | public final static String bal_bdd_articulo_subtotal = "ART_SUBTOT"; |
| 224 | 223 | ||
| 225 | public final static String bal_xml_export_fec_ope = "FEC_OPE"; | 224 | public final static String bal_xml_export_fec_ope = "FEC_OPE"; |
| 226 | 225 | ||
| 227 | public final static String bal_bdd_articulo_pesaje = "ART_P"; | 226 | public final static String bal_bdd_articulo_pesaje = "ART_P"; |
| 228 | 227 | ||
| 229 | public final static String bal_bdd_articulo_fechaInicio = "ART_FEI"; | 228 | public final static String bal_bdd_articulo_fechaInicio = "ART_FEI"; |
| 230 | public final static String bal_bdd_articulo_fechaFin = "ART_FEF"; | 229 | public final static String bal_bdd_articulo_fechaFin = "ART_FEF"; |
| 231 | 230 | ||
| 232 | public final static String bal_bdd_articulo_existencia_venta = "ART_EV"; | 231 | public final static String bal_bdd_articulo_existencia_venta = "ART_EV"; |
| 233 | public final static String bal_bdd_articulo_existencia_deposito = "ART_ED"; | 232 | public final static String bal_bdd_articulo_existencia_deposito = "ART_ED"; |
| 234 | public final static String bal_bdd_articulo_depsn = "ART_DEPSN"; | 233 | public final static String bal_bdd_articulo_depsn = "ART_DEPSN"; |
| 235 | 234 | ||
| 236 | 235 | ||
| 237 | /* Inventarios: */ | 236 | /* Inventarios: */ |
| 238 | public final static String tabla_inventarios = "INVENTARIOS"; | 237 | public final static String tabla_inventarios = "INVENTARIOS"; |
| 239 | 238 | ||
| 240 | public final static String bal_bdd_inventario_numero = "INV_NUM"; | 239 | public final static String bal_bdd_inventario_numero = "INV_NUM"; |
| 241 | public final static String bal_bdd_inventario_prodcont = "INV_PRODCONT"; | 240 | public final static String bal_bdd_inventario_prodcont = "INV_PRODCONT"; |
| 242 | 241 | ||
| 243 | // public final static String bal_bdd_inventario_dep = "INV_DEP"; | 242 | // public final static String bal_bdd_inventario_dep = "INV_DEP"; |
| 244 | 243 | ||
| 245 | public final static String bal_bdd_inventario_descripcion = "INV_DESC"; | 244 | public final static String bal_bdd_inventario_descripcion = "INV_DESC"; |
| 246 | public final static String bal_bdd_inventario_fechaInicio = "INV_FEI"; | 245 | public final static String bal_bdd_inventario_fechaInicio = "INV_FEI"; |
| 247 | public final static String bal_bdd_inventario_fechaFin = "INV_FEF"; | 246 | public final static String bal_bdd_inventario_fechaFin = "INV_FEF"; |
| 248 | public final static String bal_bdd_inventario_estado = "INV_EST"; | 247 | public final static String bal_bdd_inventario_estado = "INV_EST"; |
| 249 | public final static String bal_bdd_inventario_cantidad = "INV_CAN"; | 248 | public final static String bal_bdd_inventario_cantidad = "INV_CAN"; |
| 250 | public final static String bal_bdd_inventario_lugar = "INV_LUG"; | 249 | public final static String bal_bdd_inventario_lugar = "INV_LUG"; |
| 251 | public final static String bal_bdd_inventario_clase = "INV_CLA"; | 250 | public final static String bal_bdd_inventario_clase = "INV_CLA"; |
| 252 | 251 | ||
| 253 | /* Proveedores: */ | 252 | /* Proveedores: */ |
| 254 | public final static String tabla_proveedores = "PROVEEDORES"; | 253 | public final static String tabla_proveedores = "PROVEEDORES"; |
| 255 | public final static String tabla_compra_proveedor = "COMPRA_PROVEEDOR"; | 254 | public final static String tabla_compra_proveedor = "COMPRA_PROVEEDOR"; |
| 256 | 255 | ||
| 257 | public final static String bal_bdd_proveedores_codigo = "PROV_COD"; | 256 | public final static String bal_bdd_proveedores_codigo = "PROV_COD"; |
| 258 | public final static String bal_bdd_proveedores_descripcion = "PROV_DESC"; | 257 | public final static String bal_bdd_proveedores_descripcion = "PROV_DESC"; |
| 259 | public final static String bal_bdd_compraproveedor_inventario = "COMPRA_INV_COD"; | 258 | public final static String bal_bdd_compraproveedor_inventario = "COMPRA_INV_COD"; |
| 260 | public final static String bal_bdd_compraproveedor_codigo = "COMPRA_PROVE_COD"; | 259 | public final static String bal_bdd_compraproveedor_codigo = "COMPRA_PROVE_COD"; |
| 261 | 260 | ||
| 262 | /* Articulos: */ | 261 | /* Articulos: */ |
| 263 | public final static String tabla_referencias = "REFERENCIAS"; | 262 | public final static String tabla_referencias = "REFERENCIAS"; |
| 264 | 263 | ||
| 265 | /*Referencias para el codigo de barra completo, decimales, y valor de unidad/balanza */ | 264 | /*Referencias para el codigo de barra completo, decimales, y valor de unidad/balanza */ |
| 266 | public final static String bal_bdd_referencia_decimales = "REF_DE"; | 265 | public final static String bal_bdd_referencia_decimales = "REF_DE"; |
| 267 | public final static String bal_bdd_referencia_codigo_barra_completo = "REF_CBC"; | 266 | public final static String bal_bdd_referencia_codigo_barra_completo = "REF_CBC"; |
| 268 | public final static String bal_bdd_referencia_balanza = "REF_BAL"; | 267 | public final static String bal_bdd_referencia_balanza = "REF_BAL"; |
| 269 | public final static String bal_bdd_referencia_sector = "REF_SEC"; | 268 | public final static String bal_bdd_referencia_sector = "REF_SEC"; |
| 270 | public final static String bal_bdd_referencia_codigo = "REF_COD"; | 269 | public final static String bal_bdd_referencia_codigo = "REF_COD"; |
| 271 | public final static String bal_bdd_referencia_codigo_barra = "REF_CB"; | 270 | public final static String bal_bdd_referencia_codigo_barra = "REF_CB"; |
| 272 | public final static String bal_bdd_referencia_descripcion = "REF_DESC"; | 271 | public final static String bal_bdd_referencia_descripcion = "REF_DESC"; |
| 273 | public final static String bal_bdd_referencia_precio_venta = "REF_PRE_VTA"; | 272 | public final static String bal_bdd_referencia_precio_venta = "REF_PRE_VTA"; |
| 274 | public final static String bal_bdd_referencia_precio_costo = "REF_PRE_COS"; | 273 | public final static String bal_bdd_referencia_precio_costo = "REF_PRE_COS"; |
| 275 | public final static String bal_bdd_referencia_foto = "REF_FOTO"; | 274 | public final static String bal_bdd_referencia_foto = "REF_FOTO"; |
| 276 | public final static String bal_bdd_referencia_cantidad = "REF_Q"; | 275 | public final static String bal_bdd_referencia_cantidad = "REF_Q"; |
| 277 | public final static String bal_bdd_referencia_existencia_venta = "REF_EV"; | 276 | public final static String bal_bdd_referencia_existencia_venta = "REF_EV"; |
| 278 | public final static String bal_bdd_referencia_existencia_deposito = "REF_ED"; | 277 | public final static String bal_bdd_referencia_existencia_deposito = "REF_ED"; |
| 279 | public final static String bal_bdd_referencia_depsn = "REF_DEPSN"; | 278 | public final static String bal_bdd_referencia_depsn = "REF_DEPSN"; |
| 280 | 279 | ||
| 281 | public final static String tabla_local = "LOCAL"; | 280 | public final static String tabla_local = "LOCAL"; |
| 282 | 281 | ||
| 283 | public final static String bal_bdd_local_idLocal = "id_local"; | 282 | public final static String bal_bdd_local_idLocal = "id_local"; |
| 284 | public final static String bal_bdd_local_nombre = "nombre"; | 283 | public final static String bal_bdd_local_nombre = "nombre"; |
| 285 | public final static String bal_bdd_local_descripcion = "descripcion"; | 284 | public final static String bal_bdd_local_descripcion = "descripcion"; |
| 286 | 285 | ||
| 287 | @NonNull | 286 | @NonNull |
| 288 | public static BalizasConversor CONVERSOR_BALIZAS = new BalizasConversor(); | 287 | public static BalizasConversor CONVERSOR_BALIZAS = new BalizasConversor(); |
| 289 | static { | 288 | static { |
| 290 | 289 | ||
| 291 | CONVERSOR_BALIZAS.put(tabla_inventarios, | 290 | CONVERSOR_BALIZAS.put(tabla_inventarios, |
| 292 | Parametros.bal_xml_inventario_root, | 291 | Parametros.bal_xml_inventario_root, |
| 293 | Parametros.bal_usb_inventario_root); | 292 | Parametros.bal_usb_inventario_root); |
| 294 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_numero, | 293 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_numero, |
| 295 | Parametros.bal_xml_inventario_numero, | 294 | Parametros.bal_xml_inventario_numero, |
| 296 | Parametros.bal_usb_inventario_numero); | 295 | Parametros.bal_usb_inventario_numero); |
| 297 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_prodcont, | 296 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_prodcont, |
| 298 | Parametros.bal_xml_inventario_prodcont, | 297 | Parametros.bal_xml_inventario_prodcont, |
| 299 | Parametros.bal_usb_inventario_prodcont); | 298 | Parametros.bal_usb_inventario_prodcont); |
| 300 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_descripcion, | 299 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_descripcion, |
| 301 | Parametros.bal_xml_inventario_descripcion, | 300 | Parametros.bal_xml_inventario_descripcion, |
| 302 | Parametros.bal_usb_inventario_descripcion); | 301 | Parametros.bal_usb_inventario_descripcion); |
| 303 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_fechaInicio, | 302 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_fechaInicio, |
| 304 | Parametros.bal_xml_inventario_fechaInicio, | 303 | Parametros.bal_xml_inventario_fechaInicio, |
| 305 | Parametros.bal_usb_inventario_fechaInicio); | 304 | Parametros.bal_usb_inventario_fechaInicio); |
| 306 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_fechaFin, | 305 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_fechaFin, |
| 307 | Parametros.bal_xml_inventario_fechaFin, | 306 | Parametros.bal_xml_inventario_fechaFin, |
| 308 | Parametros.bal_usb_inventario_fechaFin); | 307 | Parametros.bal_usb_inventario_fechaFin); |
| 309 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_lugar, | 308 | CONVERSOR_BALIZAS.put(bal_bdd_inventario_lugar, |
| 310 | Parametros.bal_xml_inventario_lugar, | 309 | Parametros.bal_xml_inventario_lugar, |
| 311 | Parametros.bal_usb_inventario_lugar); | 310 | Parametros.bal_usb_inventario_lugar); |
| 312 | 311 | ||
| 313 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_balanza, | 312 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_balanza, |
| 314 | Parametros.bal_xml_articulo_balanza, | 313 | Parametros.bal_xml_articulo_balanza, |
| 315 | Parametros.bal_usb_articulo_balanza); | 314 | Parametros.bal_usb_articulo_balanza); |
| 316 | 315 | ||
| 317 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_decimales, | 316 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_decimales, |
| 318 | Parametros.bal_xml_articulo_decimales, | 317 | Parametros.bal_xml_articulo_decimales, |
| 319 | Parametros.bal_usb_articulo_decimales); | 318 | Parametros.bal_usb_articulo_decimales); |
| 320 | 319 | ||
| 321 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_codigo_barra, | 320 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_codigo_barra, |
| 322 | Parametros.bal_xml_articulo_codigo_barra, | 321 | Parametros.bal_xml_articulo_codigo_barra, |
| 323 | Parametros.bal_usb_articulo_codigo_barra); | 322 | Parametros.bal_usb_articulo_codigo_barra); |
| 324 | 323 | ||
| 325 | 324 | ||
| 326 | CONVERSOR_BALIZAS.put(tabla_articulos, | 325 | CONVERSOR_BALIZAS.put(tabla_articulos, |
| 327 | Parametros.bal_xml_articulo_root, | 326 | Parametros.bal_xml_articulo_root, |
| 328 | Parametros.bal_usb_articulo_root); | 327 | Parametros.bal_usb_articulo_root); |
| 329 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_sector, | 328 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_sector, |
| 330 | Parametros.bal_xml_articulo_sector, | 329 | Parametros.bal_xml_articulo_sector, |
| 331 | Parametros.bal_usb_articulo_sector); | 330 | Parametros.bal_usb_articulo_sector); |
| 332 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_codigo, | 331 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_codigo, |
| 333 | Parametros.bal_xml_articulo_codigo, | 332 | Parametros.bal_xml_articulo_codigo, |
| 334 | Parametros.bal_usb_articulo_codigo); | 333 | Parametros.bal_usb_articulo_codigo); |
| 335 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_codigo_barra, | 334 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_codigo_barra, |
| 336 | Parametros.bal_xml_articulo_codigo_barra, | 335 | Parametros.bal_xml_articulo_codigo_barra, |
| 337 | Parametros.bal_usb_articulo_codigo_barra); | 336 | Parametros.bal_usb_articulo_codigo_barra); |
| 338 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_inventario, | 337 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_inventario, |
| 339 | Parametros.bal_xml_articulo_inventario, | 338 | Parametros.bal_xml_articulo_inventario, |
| 340 | Parametros.bal_usb_articulo_inventario); | 339 | Parametros.bal_usb_articulo_inventario); |
| 341 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_descripcion, | 340 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_descripcion, |
| 342 | Parametros.bal_xml_articulo_descripcion, | 341 | Parametros.bal_xml_articulo_descripcion, |
| 343 | Parametros.bal_usb_articulo_descripcion); | 342 | Parametros.bal_usb_articulo_descripcion); |
| 344 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_precio_venta, | 343 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_precio_venta, |
| 345 | Parametros.bal_xml_articulo_precio_venta, | 344 | Parametros.bal_xml_articulo_precio_venta, |
| 346 | Parametros.bal_usb_articulo_precio_venta); | 345 | Parametros.bal_usb_articulo_precio_venta); |
| 347 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_precio_costo, | 346 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_precio_costo, |
| 348 | Parametros.bal_xml_articulo_precio_costo, | 347 | Parametros.bal_xml_articulo_precio_costo, |
| 349 | Parametros.bal_usb_articulo_precio_costo); | 348 | Parametros.bal_usb_articulo_precio_costo); |
| 350 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_foto, | 349 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_foto, |
| 351 | Parametros.bal_xml_articulo_foto, | 350 | Parametros.bal_xml_articulo_foto, |
| 352 | Parametros.bal_usb_articulo_foto); | 351 | Parametros.bal_usb_articulo_foto); |
| 353 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_cantidad, | 352 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_cantidad, |
| 354 | Parametros.bal_xml_articulo_cantidad, | 353 | Parametros.bal_xml_articulo_cantidad, |
| 355 | Parametros.bal_usb_articulo_cantidad); | 354 | Parametros.bal_usb_articulo_cantidad); |
| 356 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_subtotal, | 355 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_subtotal, |
| 357 | Parametros.bal_xml_articulo_subtotal, | 356 | Parametros.bal_xml_articulo_subtotal, |
| 358 | Parametros.bal_usb_articulo_subtotal); | 357 | Parametros.bal_usb_articulo_subtotal); |
| 359 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_fechaInicio, | 358 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_fechaInicio, |
| 360 | Parametros.bal_xml_articulo_fechaInicio, | 359 | Parametros.bal_xml_articulo_fechaInicio, |
| 361 | Parametros.bal_usb_articulo_fechaInicio); | 360 | Parametros.bal_usb_articulo_fechaInicio); |
| 362 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_fechaFin, | 361 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_fechaFin, |
| 363 | Parametros.bal_xml_articulo_fechaFin, | 362 | Parametros.bal_xml_articulo_fechaFin, |
| 364 | Parametros.bal_usb_articulo_fechaFin); | 363 | Parametros.bal_usb_articulo_fechaFin); |
| 365 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_existencia_venta, | 364 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_existencia_venta, |
| 366 | Parametros.bal_xml_articulo_existencia_venta, | 365 | Parametros.bal_xml_articulo_existencia_venta, |
| 367 | Parametros.bal_usb_articulo_existencia_venta); | 366 | Parametros.bal_usb_articulo_existencia_venta); |
| 368 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_existencia_deposito, | 367 | CONVERSOR_BALIZAS.put(bal_bdd_articulo_existencia_deposito, |
| 369 | Parametros.bal_xml_articulo_existencia_deposito, | 368 | Parametros.bal_xml_articulo_existencia_deposito, |
| 370 | Parametros.bal_usb_articulo_existencia_deposito); | 369 | Parametros.bal_usb_articulo_existencia_deposito); |
| 371 | 370 | ||
| 372 | 371 | ||
| 373 | CONVERSOR_BALIZAS.put(tabla_referencias, | 372 | CONVERSOR_BALIZAS.put(tabla_referencias, |
| 374 | Parametros.bal_xml_referencia_root, | 373 | Parametros.bal_xml_referencia_root, |
| 375 | Parametros.bal_usb_referencia_root); | 374 | Parametros.bal_usb_referencia_root); |
| 376 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_sector, | 375 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_sector, |
| 377 | Parametros.bal_xml_articulo_sector, | 376 | Parametros.bal_xml_articulo_sector, |
| 378 | Parametros.bal_usb_articulo_sector); | 377 | Parametros.bal_usb_articulo_sector); |
| 379 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_codigo, | 378 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_codigo, |
| 380 | Parametros.bal_xml_articulo_codigo, | 379 | Parametros.bal_xml_articulo_codigo, |
| 381 | Parametros.bal_usb_articulo_codigo); | 380 | Parametros.bal_usb_articulo_codigo); |
| 382 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_codigo_barra, | 381 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_codigo_barra, |
| 383 | Parametros.bal_xml_articulo_codigo_barra, | 382 | Parametros.bal_xml_articulo_codigo_barra, |
| 384 | Parametros.bal_usb_articulo_codigo_barra); | 383 | Parametros.bal_usb_articulo_codigo_barra); |
| 385 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_descripcion, | 384 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_descripcion, |
| 386 | Parametros.bal_xml_articulo_descripcion, | 385 | Parametros.bal_xml_articulo_descripcion, |
| 387 | Parametros.bal_usb_articulo_descripcion); | 386 | Parametros.bal_usb_articulo_descripcion); |
| 388 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_precio_venta, | 387 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_precio_venta, |
| 389 | Parametros.bal_xml_articulo_precio_venta, | 388 | Parametros.bal_xml_articulo_precio_venta, |
| 390 | Parametros.bal_usb_articulo_precio_venta); | 389 | Parametros.bal_usb_articulo_precio_venta); |
| 391 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_precio_costo, | 390 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_precio_costo, |
| 392 | Parametros.bal_xml_articulo_precio_costo, | 391 | Parametros.bal_xml_articulo_precio_costo, |
| 393 | Parametros.bal_usb_articulo_precio_costo); | 392 | Parametros.bal_usb_articulo_precio_costo); |
| 394 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_foto, | 393 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_foto, |
| 395 | Parametros.bal_xml_articulo_foto, | 394 | Parametros.bal_xml_articulo_foto, |
| 396 | Parametros.bal_usb_articulo_foto); | 395 | Parametros.bal_usb_articulo_foto); |
| 397 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_cantidad, | 396 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_cantidad, |
| 398 | Parametros.bal_xml_articulo_cantidad, | 397 | Parametros.bal_xml_articulo_cantidad, |
| 399 | Parametros.bal_usb_articulo_cantidad); | 398 | Parametros.bal_usb_articulo_cantidad); |
| 400 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_existencia_venta, | 399 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_existencia_venta, |
| 401 | Parametros.bal_xml_articulo_existencia_venta, | 400 | Parametros.bal_xml_articulo_existencia_venta, |
| 402 | Parametros.bal_usb_articulo_existencia_venta); | 401 | Parametros.bal_usb_articulo_existencia_venta); |
| 403 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_existencia_deposito, | 402 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_existencia_deposito, |
| 404 | Parametros.bal_xml_articulo_existencia_deposito, | 403 | Parametros.bal_xml_articulo_existencia_deposito, |
| 405 | Parametros.bal_usb_articulo_existencia_deposito); | 404 | Parametros.bal_usb_articulo_existencia_deposito); |
| 406 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_depsn, | 405 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_depsn, |
| 407 | Parametros.bal_xml_articulo_depsn, | 406 | Parametros.bal_xml_articulo_depsn, |
| 408 | Parametros.bal_usb_articulo_depsn); | 407 | Parametros.bal_usb_articulo_depsn); |
| 409 | /*Balizas para el pesaje y la cantidad de decimales*/ | 408 | /*Balizas para el pesaje y la cantidad de decimales*/ |
| 410 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_decimales, | 409 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_decimales, |
| 411 | Parametros.bal_xml_articulo_decimales, | 410 | Parametros.bal_xml_articulo_decimales, |
| 412 | Parametros.bal_usb_articulo_decimales); | 411 | Parametros.bal_usb_articulo_decimales); |
| 413 | 412 | ||
| 414 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_balanza, | 413 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_balanza, |
| 415 | Parametros.bal_xml_articulo_balanza, | 414 | Parametros.bal_xml_articulo_balanza, |
| 416 | Parametros.bal_usb_articulo_balanza); | 415 | Parametros.bal_usb_articulo_balanza); |
| 417 | 416 | ||
| 418 | /*Se crea campo nuevo codigo barra completo*/ | 417 | /*Se crea campo nuevo codigo barra completo*/ |
| 419 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_codigo_barra_completo, | 418 | CONVERSOR_BALIZAS.put(bal_bdd_referencia_codigo_barra_completo, |
| 420 | Parametros.bal_xml_articulo_codigo_barra_completo, | 419 | Parametros.bal_xml_articulo_codigo_barra_completo, |
| 421 | Parametros.bal_usb_articulo_codigo_barra_completo); | 420 | Parametros.bal_usb_articulo_codigo_barra_completo); |
| 422 | 421 | ||
| 423 | /* ---------------- */ | 422 | /* ---------------- */ |
| 424 | CONVERSOR_BALIZAS.put(tabla_proveedores, | 423 | CONVERSOR_BALIZAS.put(tabla_proveedores, |
| 425 | Parametros.bal_xml_proveedores_root, | 424 | Parametros.bal_xml_proveedores_root, |
| 426 | Parametros.bal_usb_proveedores_root); | 425 | Parametros.bal_usb_proveedores_root); |
| 427 | CONVERSOR_BALIZAS.put(bal_bdd_proveedores_codigo, | 426 | CONVERSOR_BALIZAS.put(bal_bdd_proveedores_codigo, |
| 428 | Parametros.bal_xml_proveedores_codigo, | 427 | Parametros.bal_xml_proveedores_codigo, |
| 429 | Parametros.bal_usb_proveedores_codigo); | 428 | Parametros.bal_usb_proveedores_codigo); |
| 430 | CONVERSOR_BALIZAS.put(bal_bdd_proveedores_descripcion, | 429 | CONVERSOR_BALIZAS.put(bal_bdd_proveedores_descripcion, |
| 431 | Parametros.bal_xml_proveedores_descripcion, | 430 | Parametros.bal_xml_proveedores_descripcion, |
| 432 | Parametros.bal_usb_proveedores_descripcion); | 431 | Parametros.bal_usb_proveedores_descripcion); |
| 433 | 432 | ||
| 434 | CONVERSOR_BALIZAS.put(tabla_compra_proveedor, | 433 | CONVERSOR_BALIZAS.put(tabla_compra_proveedor, |
| 435 | Parametros.bal_xml_compra_proveedores_root, | 434 | Parametros.bal_xml_compra_proveedores_root, |
| 436 | Parametros.bal_usb_compra_proveedores_root); | 435 | Parametros.bal_usb_compra_proveedores_root); |
| 437 | CONVERSOR_BALIZAS.put(bal_bdd_compraproveedor_codigo, | 436 | CONVERSOR_BALIZAS.put(bal_bdd_compraproveedor_codigo, |
| 438 | Parametros.bal_xml_compra_proveedores_codigo, | 437 | Parametros.bal_xml_compra_proveedores_codigo, |
| 439 | Parametros.bal_usb_compra_proveedores_codigo ); | 438 | Parametros.bal_usb_compra_proveedores_codigo ); |
| 440 | CONVERSOR_BALIZAS.put(bal_bdd_compraproveedor_inventario, | 439 | CONVERSOR_BALIZAS.put(bal_bdd_compraproveedor_inventario, |
| 441 | Parametros.bal_xml_compra_proveedores_inv, | 440 | Parametros.bal_xml_compra_proveedores_inv, |
| 442 | Parametros.bal_usb_compra_proveedores_inv); | 441 | Parametros.bal_usb_compra_proveedores_inv); |
| 443 | 442 | ||
| 444 | } | 443 | } |
| 445 | 444 | ||
| 446 | 445 | ||
| 447 | // COMUNICACION HTTP: | 446 | // COMUNICACION HTTP: |
| 448 | public final static String CODIGO_FONC_INVENTARIOS = "1"; | 447 | public final static String CODIGO_FONC_INVENTARIOS = "1"; |
| 449 | public final static String CODIGO_FONC_ARTICULOS = "3"; | 448 | public final static String CODIGO_FONC_ARTICULOS = "3"; |
| 450 | public final static String CODIGO_FONC_FOTO = "4"; | 449 | public final static String CODIGO_FONC_FOTO = "4"; |
| 451 | public final static String CODIGO_FONC_REFERENCIAS_CANTIDAD = "5"; | 450 | public final static String CODIGO_FONC_REFERENCIAS_CANTIDAD = "5"; |
| 452 | public final static String CODIGO_FONC_REFERENCIAS = "7"; | 451 | public final static String CODIGO_FONC_REFERENCIAS = "7"; |
| 453 | public final static String CODIGO_FONC_REFERENCIAS_POR_PARTES = "8"; | 452 | public final static String CODIGO_FONC_REFERENCIAS_POR_PARTES = "8"; |
| 454 | public final static String CODIGO_FONC_EXPORT_DATOS = "11"; | 453 | public final static String CODIGO_FONC_EXPORT_DATOS = "11"; |
| 455 | public final static String CODIGO_FONC_EXPORT_FOTOS = "12"; | 454 | public final static String CODIGO_FONC_EXPORT_FOTOS = "12"; |
| 456 | public final static String CODIGO_FONC_EXPORT_LOG = "13"; | 455 | public final static String CODIGO_FONC_EXPORT_LOG = "13"; |
| 457 | public final static String CODIGO_FONC_PROVEEDORES_CANTIDAD = "16"; | 456 | public final static String CODIGO_FONC_PROVEEDORES_CANTIDAD = "16"; |
| 458 | //public final static String CODIGO_FONC_EXPORT_COMPRAS = "17"; | 457 | //public final static String CODIGO_FONC_EXPORT_COMPRAS = "17"; |
| 459 | 458 | ||
| 460 | public final static int RETURN_ART_ELIM = 10; | 459 | public final static int RETURN_ART_ELIM = 10; |
| 461 | 460 | ||
| 462 | public final static int RETURN_ART_ELIM_FALLO = 20; | 461 | public final static int RETURN_ART_ELIM_FALLO = 20; |
| 463 | 462 | ||
| 464 | } | 463 | } |
app_kioskosYes_Tablet7.rar
No preview for this file type
local.properties
| File was created | 1 | ## This file must *NOT* be checked into Version Control Systems, | |
| 2 | # as it contains information specific to your local configuration. | ||
| 3 | # | ||
| 4 | # Location of the SDK. This is only used by Gradle. | ||
| 5 | # For customization when using a Version Control System, please read the | ||
| 6 | # header note. | ||
| 7 | #Fri Jul 03 11:42:48 ART 2020 | ||
| 8 | sdk.dir=C\:\\Users\\mauricio sanchez\\AppData\\Local\\Android\\Sdk | ||
| 9 |