Commit be3b7b8379eb7270ca91858b56670bab94d91506
1 parent
89988103b2
Exists in
master
21092020 0900
Showing
25 changed files
with
646 additions
and
564 deletions
Show diff stats
.idea/codeStyles/Project.xml
| 1 | <component name="ProjectCodeStyleConfiguration"> | 1 | <component name="ProjectCodeStyleConfiguration"> |
| 2 | <code_scheme name="Project" version="173"> | 2 | <code_scheme name="Project" version="173"> |
| 3 | <JetCodeStyleSettings> | 3 | <JetCodeStyleSettings> |
| 4 | <option name="PACKAGES_TO_USE_STAR_IMPORTS"> | 4 | <option name="PACKAGES_TO_USE_STAR_IMPORTS"> |
| 5 | <value> | 5 | <value> |
| 6 | <package name="java.util" alias="false" withSubpackages="false" /> | 6 | <package name="java.util" alias="false" withSubpackages="false" /> |
| 7 | <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" /> | 7 | <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" /> |
| 8 | <package name="io.ktor" alias="false" withSubpackages="true" /> | 8 | <package name="io.ktor" alias="false" withSubpackages="true" /> |
| 9 | </value> | 9 | </value> |
| 10 | </option> | 10 | </option> |
| 11 | <option name="PACKAGES_IMPORT_LAYOUT"> | 11 | <option name="PACKAGES_IMPORT_LAYOUT"> |
| 12 | <value> | 12 | <value> |
| 13 | <package name="" alias="false" withSubpackages="true" /> | 13 | <package name="" alias="false" withSubpackages="true" /> |
| 14 | <package name="java" alias="false" withSubpackages="true" /> | 14 | <package name="java" alias="false" withSubpackages="true" /> |
| 15 | <package name="javax" alias="false" withSubpackages="true" /> | 15 | <package name="javax" alias="false" withSubpackages="true" /> |
| 16 | <package name="kotlin" alias="false" withSubpackages="true" /> | 16 | <package name="kotlin" alias="false" withSubpackages="true" /> |
| 17 | <package name="" alias="true" withSubpackages="true" /> | 17 | <package name="" alias="true" withSubpackages="true" /> |
| 18 | </value> | 18 | </value> |
| 19 | </option> | 19 | </option> |
| 20 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> | 20 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> |
| 21 | </JetCodeStyleSettings> | 21 | </JetCodeStyleSettings> |
| 22 | <codeStyleSettings language="XML"> | 22 | <codeStyleSettings language="XML"> |
| 23 | <indentOptions> | 23 | <indentOptions> |
| 24 | <option name="CONTINUATION_INDENT_SIZE" value="4" /> | 24 | <option name="CONTINUATION_INDENT_SIZE" value="4" /> |
| 25 | </indentOptions> | 25 | </indentOptions> |
| 26 | <arrangement> | 26 | <arrangement> |
| 27 | <rules> | 27 | <rules> |
| 28 | <section> | 28 | <section> |
| 29 | <rule> | 29 | <rule> |
| 30 | <match> | 30 | <match> |
| 31 | <AND> | 31 | <AND> |
| 32 | <NAME>xmlns:android</NAME> | 32 | <NAME>xmlns:android</NAME> |
| 33 | <XML_ATTRIBUTE /> | 33 | <XML_ATTRIBUTE /> |
| 34 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 34 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
| 35 | </AND> | 35 | </AND> |
| 36 | </match> | 36 | </match> |
| 37 | </rule> | 37 | </rule> |
| 38 | </section> | 38 | </section> |
| 39 | <section> | 39 | <section> |
| 40 | <rule> | 40 | <rule> |
| 41 | <match> | 41 | <match> |
| 42 | <AND> | 42 | <AND> |
| 43 | <NAME>xmlns:.*</NAME> | 43 | <NAME>xmlns:.*</NAME> |
| 44 | <XML_ATTRIBUTE /> | 44 | <XML_ATTRIBUTE /> |
| 45 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 45 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
| 46 | </AND> | 46 | </AND> |
| 47 | </match> | 47 | </match> |
| 48 | <order>BY_NAME</order> | 48 | <order>BY_NAME</order> |
| 49 | </rule> | 49 | </rule> |
| 50 | </section> | 50 | </section> |
| 51 | <section> | 51 | <section> |
| 52 | <rule> | 52 | <rule> |
| 53 | <match> | 53 | <match> |
| 54 | <AND> | 54 | <AND> |
| 55 | <NAME>.*:id</NAME> | 55 | <NAME>.*:id</NAME> |
| 56 | <XML_ATTRIBUTE /> | 56 | <XML_ATTRIBUTE /> |
| 57 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | 57 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
| 58 | </AND> | 58 | </AND> |
| 59 | </match> | 59 | </match> |
| 60 | </rule> | 60 | </rule> |
| 61 | </section> | 61 | </section> |
| 62 | <section> | 62 | <section> |
| 63 | <rule> | 63 | <rule> |
| 64 | <match> | 64 | <match> |
| 65 | <AND> | 65 | <AND> |
| 66 | <NAME>.*:name</NAME> | 66 | <NAME>.*:name</NAME> |
| 67 | <XML_ATTRIBUTE /> | 67 | <XML_ATTRIBUTE /> |
| 68 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | 68 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
| 69 | </AND> | 69 | </AND> |
| 70 | </match> | 70 | </match> |
| 71 | </rule> | 71 | </rule> |
| 72 | </section> | 72 | </section> |
| 73 | <section> | 73 | <section> |
| 74 | <rule> | 74 | <rule> |
| 75 | <match> | 75 | <match> |
| 76 | <AND> | 76 | <AND> |
| 77 | <NAME>name</NAME> | 77 | <NAME>name</NAME> |
| 78 | <XML_ATTRIBUTE /> | 78 | <XML_ATTRIBUTE /> |
| 79 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 79 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
| 80 | </AND> | 80 | </AND> |
| 81 | </match> | 81 | </match> |
| 82 | </rule> | 82 | </rule> |
| 83 | </section> | 83 | </section> |
| 84 | <section> | 84 | <section> |
| 85 | <rule> | 85 | <rule> |
| 86 | <match> | 86 | <match> |
| 87 | <AND> | 87 | <AND> |
| 88 | <NAME>style</NAME> | 88 | <NAME>style</NAME> |
| 89 | <XML_ATTRIBUTE /> | 89 | <XML_ATTRIBUTE /> |
| 90 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 90 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
| 91 | </AND> | 91 | </AND> |
| 92 | </match> | 92 | </match> |
| 93 | </rule> | 93 | </rule> |
| 94 | </section> | 94 | </section> |
| 95 | <section> | 95 | <section> |
| 96 | <rule> | 96 | <rule> |
| 97 | <match> | 97 | <match> |
| 98 | <AND> | 98 | <AND> |
| 99 | <NAME>.*</NAME> | 99 | <NAME>.*</NAME> |
| 100 | <XML_ATTRIBUTE /> | 100 | <XML_ATTRIBUTE /> |
| 101 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 101 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
| 102 | </AND> | 102 | </AND> |
| 103 | </match> | 103 | </match> |
| 104 | <order>BY_NAME</order> | 104 | <order>BY_NAME</order> |
| 105 | </rule> | 105 | </rule> |
| 106 | </section> | 106 | </section> |
| 107 | <section> | 107 | <section> |
| 108 | <rule> | 108 | <rule> |
| 109 | <match> | 109 | <match> |
| 110 | <AND> | 110 | <AND> |
| 111 | <NAME>.*</NAME> | 111 | <NAME>.*</NAME> |
| 112 | <XML_ATTRIBUTE /> | 112 | <XML_ATTRIBUTE /> |
| 113 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | 113 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
| 114 | </AND> | 114 | </AND> |
| 115 | </match> | 115 | </match> |
| 116 | <order>ANDROID_ATTRIBUTE_ORDER</order> | 116 | <order>ANDROID_ATTRIBUTE_ORDER</order> |
| 117 | </rule> | 117 | </rule> |
| 118 | </section> | 118 | </section> |
| 119 | <section> | 119 | <section> |
| 120 | <rule> | 120 | <rule> |
| 121 | <match> | 121 | <match> |
| 122 | <AND> | 122 | <AND> |
| 123 | <NAME>.*</NAME> | 123 | <NAME>.*</NAME> |
| 124 | <XML_ATTRIBUTE /> | 124 | <XML_ATTRIBUTE /> |
| 125 | <XML_NAMESPACE>.*</XML_NAMESPACE> | 125 | <XML_NAMESPACE>.*</XML_NAMESPACE> |
| 126 | </AND> | 126 | </AND> |
| 127 | </match> | 127 | </match> |
| 128 | <order>BY_NAME</order> | 128 | <order>BY_NAME</order> |
| 129 | </rule> | 129 | </rule> |
| 130 | </section> | 130 | </section> |
| 131 | </rules> | 131 | </rules> |
| 132 | </arrangement> | 132 | </arrangement> |
| 133 | </codeStyleSettings> | 133 | </codeStyleSettings> |
| 134 | <codeStyleSettings language="kotlin"> | 134 | <codeStyleSettings language="kotlin"> |
| 135 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> | 135 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> |
| 136 | <option name="RIGHT_MARGIN" value="200" /> | ||
| 137 | <option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" /> | ||
| 138 | <option name="WRAP_ON_TYPING" value="0" /> | ||
| 136 | </codeStyleSettings> | 139 | </codeStyleSettings> |
| 137 | </code_scheme> | 140 | </code_scheme> |
| 138 | </component> | 141 | </component> |
.idea/codeStyles/codeStyleConfig.xml
| 1 | <component name="ProjectCodeStyleConfiguration"> | 1 | <component name="ProjectCodeStyleConfiguration"> |
| 2 | <state> | 2 | <state> |
| 3 | <option name="USE_PER_PROJECT_SETTINGS" value="true" /> | 3 | <option name="USE_PER_PROJECT_SETTINGS" value="true" /> |
| 4 | <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" /> | ||
| 5 | </state> | 4 | </state> |
| 6 | </component> | 5 | </component> |
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
| 1 | package com.focasoftware.deboinventariov20.DB.DAO | 1 | package com.focasoftware.deboinventariov20.DB.DAO |
| 2 | 2 | ||
| 3 | import androidx.room.Dao | 3 | import androidx.room.Dao |
| 4 | import androidx.room.Insert | 4 | import androidx.room.Insert |
| 5 | import androidx.room.OnConflictStrategy | 5 | import androidx.room.OnConflictStrategy |
| 6 | import androidx.room.Query | 6 | import androidx.room.Query |
| 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_ART | 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_ART |
| 8 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_B | 8 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_B |
| 9 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_H | 9 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_H |
| 10 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_SERV_INV | 10 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_SERV_INV |
| 11 | import com.focasoftware.deboinventariov20.Model.Articles | 11 | import com.focasoftware.deboinventariov20.Model.Articles |
| 12 | import com.focasoftware.deboinventariov20.Model.InvBody | 12 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 13 | import com.focasoftware.deboinventariov20.Model.InvHead | 13 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 14 | import com.focasoftware.deboinventariov20.Model.ServeInv | 14 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 15 | 15 | ||
| 16 | @Dao | 16 | @Dao |
| 17 | interface ArticulosDAO { | 17 | interface ArticulosDAO { |
| 18 | 18 | ||
| 19 | // TABLA ARTICULOS | 19 | // TABLA ARTICULOS |
| 20 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 20 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
| 21 | suspend fun insertArticulos(articulos: Articles?) | 21 | suspend fun insertArticulos(articulos: Articles?) |
| 22 | 22 | ||
| 23 | @Query("SELECT * FROM $TABLA_ART ORDER BY DETART DESC") | 23 | @Query("SELECT * FROM $TABLA_ART ORDER BY DETART DESC") |
| 24 | suspend fun findAllArticulos(): List<Articles> | 24 | suspend fun findAllArticulos(): List<Articles> |
| 25 | 25 | ||
| 26 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DETART LIKE '%' || :description || '%' GROUP BY DETART ORDER BY DETART") | 26 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DETART LIKE '%' || :description || '%' GROUP BY DETART ORDER BY DETART") |
| 27 | suspend fun findArticuloByDesc(description: String?, dep: Boolean): List<Articles> | 27 | suspend fun findArticuloByDesc(description: String?, dep: Boolean): List<Articles> |
| 28 | 28 | ||
| 29 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(CODBAR) = :codBarra") | 29 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(CODBAR) = :codBarra") |
| 30 | suspend fun findArticuloByCodBar(codBarra: String, dep: Boolean): Articles | 30 | suspend fun findArticuloByCodBar(codBarra: String, dep: Boolean): Articles |
| 31 | 31 | ||
| 32 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(COO) LIKE :CodOrigen") | 32 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(COO) LIKE :CodOrigen") |
| 33 | suspend fun findArticuloByCodOri(CodOrigen: String?, dep: Boolean): List<Articles> | 33 | suspend fun findArticuloByCodOri(CodOrigen: String?, dep: Boolean): List<Articles> |
| 34 | 34 | ||
| 35 | @Query("DELETE FROM $TABLA_ART") | 35 | @Query("DELETE FROM $TABLA_ART") |
| 36 | suspend fun deleteAllArticulos() | 36 | suspend fun deleteAllArticulos() |
| 37 | 37 | ||
| 38 | @Query("SELECT * FROM $TABLA_ART WHERE CODSEC=:sector AND CODART=:codigo") | 38 | @Query("SELECT * FROM $TABLA_ART WHERE CODSEC=:sector AND CODART=:codigo") |
| 39 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? | 39 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | @Dao | 42 | @Dao |
| 43 | interface InvHeadDAO { | 43 | interface InvHeadDAO { |
| 44 | @Insert() | 44 | @Insert() |
| 45 | suspend fun insertInvHead(invHead: InvHead?) | 45 | suspend fun insertInvHead(invHead: InvHead?) |
| 46 | 46 | ||
| 47 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") | 47 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") |
| 48 | suspend fun findLastInv(): Int | 48 | suspend fun findLastInv(): Int |
| 49 | 49 | ||
| 50 | @Query("DELETE FROM $TABLA_INV_H") | 50 | @Query("DELETE FROM $TABLA_INV_H") |
| 51 | suspend fun deleteAllArticulos() | 51 | suspend fun deleteAllArticulos() |
| 52 | 52 | ||
| 53 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 53 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
| 54 | suspend fun deleteinvHead(inven: Int) | 54 | suspend fun deleteinvHead(inven: Long) |
| 55 | 55 | ||
| 56 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") | 56 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") |
| 57 | suspend fun fetchAllInvHead(): List<InvHead> | 57 | suspend fun fetchAllInvHead(): List<InvHead> |
| 58 | 58 | ||
| 59 | @Query("SELECT INV_LUG FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 59 | @Query("SELECT INV_LUG FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
| 60 | suspend fun fetchAreaInvH (inven: Int): Boolean | 60 | suspend fun fetchAreaInvH (inven: Long): Boolean |
| 61 | 61 | ||
| 62 | @Query("SELECT INV_PRODCONT FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 62 | @Query("SELECT INV_PRODCONT FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
| 63 | suspend fun consultaCantidadInvH (inven: Int): Int | 63 | suspend fun consultaCantidadInvH (inven: Long): Int |
| 64 | 64 | ||
| 65 | @Query("UPDATE $TABLA_INV_H SET INV_PRODCONT=:cant WHERE INV_NUM=:inven") | 65 | @Query("UPDATE $TABLA_INV_H SET INV_PRODCONT=:cant WHERE INV_NUM=:inven") |
| 66 | suspend fun updateInvBody(inven: Int,cant: Int) | 66 | suspend fun updateInvBody(inven: Long,cant: Int) |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | @Dao | 69 | @Dao |
| 70 | interface InvBodyDAO { | 70 | interface InvBodyDAO { |
| 71 | @Insert() | 71 | @Insert() |
| 72 | suspend fun insertInvBody(invBody: InvBody?) | 72 | suspend fun insertInvBody(invBody: InvBody?) |
| 73 | 73 | ||
| 74 | @Query("DELETE FROM $TABLA_INV_B") | 74 | @Query("DELETE FROM $TABLA_INV_B") |
| 75 | suspend fun deleteAllInvBody() | 75 | suspend fun deleteAllInvBody() |
| 76 | 76 | ||
| 77 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") | 77 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") |
| 78 | suspend fun deleteInvBody(inven: Int) | 78 | suspend fun deleteInvBody(inven: Long) |
| 79 | 79 | ||
| 80 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") | 80 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") |
| 81 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) | 81 | suspend fun UpdateInvBody(cant: Float, sec: Long, cod: Long) |
| 82 | 82 | ||
| 83 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") | 83 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") |
| 84 | suspend fun fetchAllInvBody(inven: Int): List<InvBody> | 84 | suspend fun fetchAllInvBody(inven: Int): List<InvBody> |
| 85 | 85 | ||
| 86 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 86 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
| 87 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody | 87 | suspend fun fetchArtInInvBody(sector: Long, codigo: Long, numInventario: Long): InvBody |
| 88 | 88 | ||
| 89 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 89 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
| 90 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int | 90 | suspend fun deleteItemFromInvBody(sector: Long, codigo: Long, numInventario: Long): Int |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | @Dao | 93 | @Dao |
| 94 | interface ServeInvDao { | 94 | interface ServeInvDao { |
| 95 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 95 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
| 96 | fun insertServer(servidor: ServeInv) | 96 | fun insertServer(servidor: ServeInv) |
| 97 | 97 | ||
| 98 | @Query("SELECT * FROM $TABLA_SERV_INV ORDER BY SER_NUM") | 98 | @Query("SELECT * FROM $TABLA_SERV_INV ORDER BY SER_NUM") |
| 99 | suspend fun fetchAllServers(): List<ServeInv> | 99 | suspend fun fetchAllServers(): List<ServeInv> |
| 100 | 100 | ||
| 101 | @Query("DELETE FROM $TABLA_SERV_INV WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") | 101 | @Query("DELETE FROM $TABLA_SERV_INV WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") |
| 102 | suspend fun deleteServer(description: String, dir: String) | 102 | suspend fun deleteServer(description: String, dir: String) |
| 103 | 103 | ||
| 104 | @Query("SELECT SER_NUM FROM $TABLA_SERV_INV ORDER BY SER_NUM DESC") | 104 | @Query("SELECT SER_NUM FROM $TABLA_SERV_INV ORDER BY SER_NUM DESC") |
| 105 | suspend fun findLastServer(): Int | 105 | suspend fun findLastServer(): Int |
| 106 | 106 | ||
| 107 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") | 107 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") |
| 108 | suspend fun UpdateServerPreInZero() | 108 | suspend fun UpdateServerPreInZero() |
| 109 | 109 | ||
| 110 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_NUM = :numero") | 110 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_NUM = :numero") |
| 111 | suspend fun UpdateServerPre(numero: Int) | 111 | suspend fun UpdateServerPre(numero: Int) |
| 112 | 112 | ||
| 113 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE= 1") | 113 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE= 1") |
| 114 | suspend fun fetchServerPreOne(): ServeInv | 114 | suspend fun fetchServerPreOne(): ServeInv |
| 115 | |||
| 116 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_NUM = :numero") | ||
| 117 | suspend fun fetchServer(numero: Int): ServeInv | ||
| 115 | } | 118 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/SplashActivity.kt
| 1 | package com.focasoftware.deboinventariov20.UI | 1 | package com.focasoftware.deboinventariov20.UI |
| 2 | 2 | ||
| 3 | import android.app.Activity | 3 | import android.app.Activity |
| 4 | import android.content.Intent | 4 | import android.content.Intent |
| 5 | import android.os.Bundle | 5 | import android.os.Bundle |
| 6 | import com.focasoftware.deboinventariov20.R | 6 | import com.focasoftware.deboinventariov20.R |
| 7 | 7 | ||
| 8 | class SplashActivity : Activity() { | 8 | class SplashActivity : Activity() { |
| 9 | 9 | ||
| 10 | override fun onCreate(savedInstanceState: Bundle?) { | 10 | override fun onCreate(savedInstanceState: Bundle?) { |
| 11 | super.onCreate(savedInstanceState) | 11 | super.onCreate(savedInstanceState) |
| 12 | setContentView(R.layout.activity_splash) | 12 | setContentView(R.layout.activity_splash) |
| 13 | //window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | 13 | //window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
| 14 | 14 | ||
| 15 | val bac = object : Thread(){ | 15 | val bac = object : Thread(){ |
| 16 | override fun run(){ | 16 | override fun run(){ |
| 17 | try { | 17 | try { |
| 18 | Thread.sleep(5) | 18 | Thread.sleep(3000) |
| 19 | val intent = Intent(baseContext, MainActivity:: class.java) | 19 | val intent = Intent(baseContext, MainActivity:: class.java) |
| 20 | startActivity(intent) | 20 | startActivity(intent) |
| 21 | finish() | 21 | finish() |
| 22 | } catch (e : Exception){ | 22 | } catch (e : Exception){ |
| 23 | e.printStackTrace() | 23 | e.printStackTrace() |
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | bac.start() | 27 | bac.start() |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | 30 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/Utils/Utils.kt
| 1 | package com.focasoftware.deboinventariov20.UI.Utils | 1 | package com.focasoftware.deboinventariov20.UI.Utils |
| 2 | 2 | ||
| 3 | import android.app.AlertDialog | 3 | import android.app.AlertDialog |
| 4 | import android.app.Dialog | 4 | import android.app.Dialog |
| 5 | import android.content.Context | 5 | import android.content.Context |
| 6 | import android.os.Bundle | 6 | import android.os.Bundle |
| 7 | import androidx.fragment.app.DialogFragment | 7 | import androidx.fragment.app.DialogFragment |
| 8 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 8 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 9 | import kotlinx.coroutines.Dispatchers | 9 | import kotlinx.coroutines.Dispatchers |
| 10 | import kotlinx.coroutines.GlobalScope | 10 | import kotlinx.coroutines.GlobalScope |
| 11 | import kotlinx.coroutines.async | 11 | import kotlinx.coroutines.async |
| 12 | import java.io.IOException | 12 | import java.io.IOException |
| 13 | import java.net.UnknownHostException | 13 | import java.net.UnknownHostException |
| 14 | 14 | ||
| 15 | fun modificarCantidadEnCabecera(inventarioActual: Int, b: Boolean,context: Context) { | 15 | fun modificarCantidadEnCabecera(inventarioActual: Int, b: Boolean, context: Context) { |
| 16 | GlobalScope.async(Dispatchers.IO) { | 16 | GlobalScope.async(Dispatchers.IO) { |
| 17 | var cantProductos = 0 | 17 | var cantProductos = 0 |
| 18 | cantProductos = AppDb.getAppDb(context)!!.InvHeadDAO()!!.consultaCantidadInvH(inventarioActual) | 18 | cantProductos = |
| 19 | AppDb.getAppDb(context)!!.InvHeadDAO()!!.consultaCantidadInvH(inventarioActual.toLong()) | ||
| 19 | if (b) { | 20 | if (b) { |
| 20 | AppDb.getAppDb(context)!!.InvHeadDAO()!!.updateInvBody(inventarioActual, cantProductos + 1) | 21 | AppDb.getAppDb(context)!!.InvHeadDAO()!! |
| 22 | .updateInvBody(inventarioActual.toLong(), cantProductos + 1) | ||
| 21 | } else { | 23 | } else { |
| 22 | AppDb.getAppDb(context)!!.InvHeadDAO()!!.updateInvBody(inventarioActual, cantProductos - 1) | 24 | AppDb.getAppDb(context)!!.InvHeadDAO()!! |
| 25 | .updateInvBody(inventarioActual.toLong(), cantProductos - 1) | ||
| 23 | } | 26 | } |
| 24 | } | 27 | } |
| 25 | } | 28 | } |
| 26 | 29 | ||
| 27 | open class AlertDialogBorrarInv : DialogFragment() { | 30 | open class AlertDialogBorrarInv : DialogFragment() { |
| 28 | 31 | ||
| 29 | interface OnBorrarInvClickListener { | 32 | interface OnBorrarInvClickListener { |
| 30 | fun onPositiveClick() | 33 | fun onPositiveClick() |
| 31 | fun onCancelClick() | 34 | fun onCancelClick() |
| 32 | } | 35 | } |
| 33 | 36 | ||
| 34 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 37 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 35 | return activity?.let { | 38 | return activity?.let { |
| 36 | val title = "Borrar Inventario" | 39 | val title = "Borrar Inventario" |
| 37 | val content = "¿Seguro que desea Borrar el inventario?" | 40 | val content = "¿Seguro que desea Borrar el inventario?" |
| 38 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | 41 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) |
| 39 | builder.setTitle(title).setMessage(content) | 42 | builder.setTitle(title).setMessage(content) |
| 40 | .setPositiveButton(android.R.string.ok) { _, _ -> | 43 | .setPositiveButton(android.R.string.ok) { _, _ -> |
| 41 | val listener = activity as OnBorrarInvClickListener? | 44 | val listener = activity as OnBorrarInvClickListener? |
| 42 | listener!!.onPositiveClick() | 45 | listener!!.onPositiveClick() |
| 43 | } | 46 | } |
| 44 | .setNegativeButton(android.R.string.cancel) { _, _ -> | 47 | .setNegativeButton(android.R.string.cancel) { _, _ -> |
| 45 | val listener = activity as OnBorrarInvClickListener? | 48 | val listener = activity as OnBorrarInvClickListener? |
| 46 | listener!!.onCancelClick() | 49 | listener!!.onCancelClick() |
| 47 | } | 50 | } |
| 48 | return builder.create() | 51 | return builder.create() |
| 49 | } ?: throw IllegalStateException("Activity cannot be null") | 52 | } ?: throw IllegalStateException("Activity cannot be null") |
| 50 | } | 53 | } |
| 51 | public fun Int.twoDigits() = | 54 | } |
| 52 | if (this <= 9) "0$this" else this.toString()} | ||
| 53 | 55 | ||
| 54 | public class NoEncontradoSimple : DialogFragment() { | 56 | class NoEncontradoSimple : DialogFragment() { |
| 55 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 57 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 56 | return activity?.let { | 58 | return activity?.let { |
| 57 | val title = "" | 59 | val title = "" |
| 58 | val content = "¡El producto buscado NO fue encontrado!" | 60 | val content = "¡El producto buscado NO fue encontrado!" |
| 59 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | 61 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) |
| 60 | builder.setTitle(title).setMessage(content).setPositiveButton(android.R.string.ok) { _, _ -> | 62 | builder.setTitle(title).setMessage(content) |
| 61 | //Todo OK click | 63 | .setPositiveButton(android.R.string.ok) { _, _ -> } |
| 64 | return builder.create() | ||
| 65 | } ?: throw IllegalStateException("Activity cannot be null") | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | class noServerConf : DialogFragment() { | ||
| 70 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
| 71 | return activity?.let { | ||
| 72 | val title = "" | ||
| 73 | val content = "¡Antes de importar debe configurar un servidor!" | ||
| 74 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
| 75 | builder.setTitle(title).setMessage(content) | ||
| 76 | .setPositiveButton(android.R.string.ok) { _, _ -> | ||
| 77 | activity?.onBackPressed() | ||
| 62 | } | 78 | } |
| 63 | 79 | ||
| 64 | return builder.create() | 80 | return builder.create() |
| 65 | } ?: throw IllegalStateException("Activity cannot be null") | 81 | } ?: throw IllegalStateException("Activity cannot be null") |
| 66 | } | 82 | } |
| 67 | } | 83 | } |
| 68 | public class noServerConf : DialogFragment() { | ||
| 69 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
| 70 | return activity?.let { | ||
| 71 | val title = "" | ||
| 72 | val content = "¡Antes de importar debe configurar un servidor!" | ||
| 73 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
| 74 | builder.setTitle(title).setMessage(content) | ||
| 75 | .setPositiveButton(android.R.string.ok) { _, _ -> | ||
| 76 | activity?.onBackPressed(); | ||
| 77 | } | ||
| 78 | 84 | ||
| 79 | return builder.create() | ||
| 80 | } ?: throw IllegalStateException("Activity cannot be null") | ||
| 81 | } | ||
| 82 | } | ||
| 83 | fun isConnectedToThisServer(host: String): Boolean { | 85 | fun isConnectedToThisServer(host: String): Boolean { |
| 84 | 86 | ||
| 85 | val runtime = Runtime.getRuntime() | 87 | val runtime = Runtime.getRuntime() |
| 86 | try { | 88 | try { |
| 87 | val ipProcess = runtime.exec("/system/bin/ping -c 1 $host") | 89 | val ipProcess = runtime.exec("/system/bin/ping -c 1 $host") |
| 88 | val exitValue = ipProcess.waitFor() | 90 | val exitValue = ipProcess.waitFor() |
| 89 | ipProcess.destroy() | 91 | ipProcess.destroy() |
| 90 | return exitValue == 0 | 92 | return exitValue == 0 |
| 91 | } catch (e: UnknownHostException) { | 93 | } catch (e: UnknownHostException) { |
| 92 | e.printStackTrace() | 94 | e.printStackTrace() |
| 93 | } catch (e: IOException) { | 95 | } catch (e: IOException) { |
| 94 | e.printStackTrace() | 96 | e.printStackTrace() |
| 95 | } catch (e: InterruptedException) { | 97 | } catch (e: InterruptedException) { |
| 96 | e.printStackTrace() | 98 | e.printStackTrace() |
| 97 | } | 99 | } |
| 98 | 100 | ||
| 99 | return false | 101 | return false |
| 100 | } | 102 | } |
| 103 | class serverValido : DialogFragment() { | ||
| 104 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
| 105 | return activity?.let { | ||
| 106 | val title = "" | ||
| 107 | val content = "¡La IP del servidor es correcta!" | ||
| 108 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
| 109 | builder.setTitle(title).setMessage(content) | ||
| 110 | .setPositiveButton(android.R.string.ok) { _, _ -> } | ||
| 111 | return builder.create() |
app/src/main/java/com/focasoftware/deboinventariov20/UI/actualizacionMaestros/ActuaMaestrosFragment.kt
| 1 | package com.focasoftware.deboinventariov20.UI.actualizacionMaestros | 1 | package com.focasoftware.deboinventariov20.UI.actualizacionMaestros |
| 2 | 2 | ||
| 3 | import android.os.Bundle | 3 | import android.os.Bundle |
| 4 | import android.view.LayoutInflater | 4 | import android.view.LayoutInflater |
| 5 | import android.view.View | 5 | import android.view.View |
| 6 | import android.view.ViewGroup | 6 | import android.view.ViewGroup |
| 7 | import android.widget.Button | 7 | import android.widget.Button |
| 8 | import androidx.fragment.app.Fragment | 8 | import androidx.fragment.app.Fragment |
| 9 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 9 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 10 | import com.focasoftware.deboinventariov20.Model.Articles | 10 | import com.focasoftware.deboinventariov20.Model.Articles |
| 11 | import com.focasoftware.deboinventariov20.Model.ProductosService | 11 | import com.focasoftware.deboinventariov20.Model.ProductosService |
| 12 | import com.focasoftware.deboinventariov20.Model.ServeInv | 12 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 13 | import com.focasoftware.deboinventariov20.R | 13 | import com.focasoftware.deboinventariov20.R |
| 14 | import com.focasoftware.deboinventariov20.UI.Utils.noServerConf | 14 | import com.focasoftware.deboinventariov20.UI.Utils.noServerConf |
| 15 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* | 15 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* |
| 16 | import kotlinx.coroutines.* | 16 | import kotlinx.coroutines.* |
| 17 | import kotlinx.coroutines.Dispatchers.IO | 17 | import kotlinx.coroutines.Dispatchers.IO |
| 18 | import kotlinx.coroutines.Dispatchers.Main | 18 | import kotlinx.coroutines.Dispatchers.Main |
| 19 | import java.util.ArrayList | 19 | import java.util.ArrayList |
| 20 | 20 | ||
| 21 | var BASE_URL = "" | 21 | var BASE_URL = "" |
| 22 | 22 | ||
| 23 | class ActuaMaestrosFragment : Fragment() { | 23 | class ActuaMaestrosFragment : Fragment() { |
| 24 | 24 | ||
| 25 | override fun onCreate(savedInstanceState: Bundle?) { | 25 | override fun onCreate(savedInstanceState: Bundle?) { |
| 26 | super.onCreate(savedInstanceState) | 26 | super.onCreate(savedInstanceState) |
| 27 | |||
| 27 | GlobalScope.launch(Main) { | 28 | GlobalScope.launch(Main) { |
| 28 | val serverPre = fetchServerPreOne() | 29 | val serverPre = fetchServerPreOne() |
| 29 | if (serverPre!!.direccion.isNullOrEmpty()) { | 30 | if (serverPre!!.direccion.isNullOrEmpty()) { |
| 30 | val modalDialog = noServerConf() | 31 | val modalDialog = noServerConf() |
| 31 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 32 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 32 | } else { | 33 | } else { |
| 33 | BASE_URL = serverPre.direccion.toString()+":"+serverPre.puerto.toString()+"/" | 34 | BASE_URL = serverPre.direccion.toString()+":"+serverPre.puerto.toString()+"/" |
| 35 | tvServerConectado.text="Conectado al servidor: ${serverPre.descripcion}" | ||
| 34 | } | 36 | } |
| 35 | } | 37 | } |
| 38 | |||
| 36 | // mostrarArticulos() | 39 | // mostrarArticulos() |
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | private suspend fun fetchServerPreOne(): ServeInv? { | 42 | private suspend fun fetchServerPreOne(): ServeInv? { |
| 40 | return GlobalScope.async(IO) { | 43 | return GlobalScope.async(IO) { |
| 41 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() | 44 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() |
| 42 | }.await() | 45 | }.await() |
| 43 | } | 46 | } |
| 44 | 47 | ||
| 45 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 48 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 46 | // Inflate the layout for this fragment | 49 | // Inflate the layout for this fragment |
| 47 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) | 50 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) |
| 48 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) | 51 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) |
| 52 | |||
| 49 | bConfirmarAct.setOnClickListener { | 53 | bConfirmarAct.setOnClickListener { |
| 50 | loading_view.visibility = View.VISIBLE | 54 | loading_view.visibility = View.VISIBLE |
| 51 | countriesList.text = "Obteniendo artículos del servidor $BASE_URL, aguarde por favor." | 55 | countriesList.text = "Obteniendo artículos del servidor, aguarde por favor." |
| 52 | GlobalScope.launch(Main) { | 56 | GlobalScope.launch(Main) { |
| 53 | obtenerArticulos() | 57 | obtenerArticulos() |
| 54 | } | 58 | } |
| 55 | } | 59 | } |
| 56 | return v | 60 | return v |
| 57 | } | 61 | } |
| 58 | 62 | ||
| 59 | private suspend fun obtenerArticulos() { | 63 | private suspend fun obtenerArticulos() { |
| 60 | 64 | ||
| 61 | val productosService = ProductosService.getProductosService() | 65 | val productosService = ProductosService.getProductosService() |
| 62 | var index: Long = 1 | 66 | var index: Long = 1 |
| 63 | withContext(IO) { | 67 | withContext(IO) { |
| 64 | val job = CoroutineScope(IO).launch { | 68 | val job = CoroutineScope(IO).launch { |
| 65 | // TODO: BORRO TODO LOS ARTICULOS DE LA BASE PARA CARGARLOS DE NUEVO | 69 | // TODO: BORRO TODO LOS ARTICULOS DE LA BASE PARA CARGARLOS DE NUEVO |
| 66 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.deleteAllArticulos() | 70 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.deleteAllArticulos() |
| 67 | 71 | ||
| 68 | val response = productosService.getProductos() | 72 | val response = productosService.getProductos() |
| 69 | if (response.isSuccessful) { | 73 | if (response.isSuccessful) { |
| 70 | 74 | ||
| 71 | for (pro in response.body()!!) { | 75 | for (pro in response.body()!!) { |
| 72 | val artiAcargar = Articles(pro.sector, | 76 | val artiAcargar = Articles(pro.sector, |
| 73 | pro.codigo, | 77 | pro.codigo, |
| 74 | pro.descripcion, | 78 | pro.descripcion, |
| 75 | pro.codBar, | 79 | pro.codBar, |
| 76 | pro.codOrigen, | 80 | pro.codOrigen, |
| 77 | pro.precio, | 81 | pro.precio, |
| 78 | pro.costo, | 82 | pro.costo, |
| 79 | pro.exiVenta, | 83 | pro.exiVenta, |
| 80 | pro.exiDeposito, | 84 | pro.exiDeposito, |
| 81 | pro.de, | 85 | pro.de, |
| 82 | pro.balanza, | 86 | pro.balanza, |
| 83 | pro.depSn, | 87 | pro.depSn, |
| 84 | pro.imagen) | 88 | pro.imagen) |
| 85 | index += index | 89 | index += index |
| 86 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.insertArticulos(artiAcargar) | 90 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.insertArticulos(artiAcargar) |
| 87 | } | 91 | } |
| 88 | withContext(Main) { | 92 | withContext(Main) { |
| 89 | countriesList.visibility = View.VISIBLE | 93 | countriesList.visibility = View.VISIBLE |
| 90 | countriesList.text = "¡Datos Importados Correctamente!" | 94 | countriesList.text = "¡Datos Importados Correctamente!" |
| 91 | loading_view.visibility = View.GONE | 95 | loading_view.visibility = View.GONE |
| 92 | } | 96 | } |
| 93 | }else{ | 97 | }else{ |
| 94 | withContext(Main) { | 98 | withContext(Main) { |
| 95 | countriesList.visibility = View.VISIBLE | 99 | countriesList.visibility = View.VISIBLE |
| 96 | countriesList.text = "¡Error!" | 100 | countriesList.text = "¡Error!" |
| 97 | loading_view.visibility = View.GONE | 101 | loading_view.visibility = View.GONE |
| 98 | } | 102 | } |
| 99 | } | 103 | } |
| 100 | } | 104 | } |
| 101 | if (job == null) { | 105 | if (job == null) { |
| 102 | withContext(Main) { | 106 | withContext(Main) { |
| 103 | countriesList.visibility = View.VISIBLE | 107 | countriesList.visibility = View.VISIBLE |
| 104 | countriesList.text = "No se puedo realizar la conexión al Servidor" | 108 | countriesList.text = "No se puedo realizar la conexión al Servidor" |
| 105 | loading_view.visibility = View.GONE | 109 | loading_view.visibility = View.GONE |
| 106 | } | 110 | } |
| 107 | } | 111 | } |
| 108 | } | 112 | } |
| 109 | 113 | ||
| 110 | 114 | ||
| 111 | // withContext(Dispatchers.Main) { | 115 | // withContext(Dispatchers.Main) { |
| 112 | // if (response.isSuccessful) { | 116 | // if (response.isSuccessful) { |
| 113 | // val call = WebService | 117 | // val call = WebService |
| 114 | // .instance | 118 | // .instance |
| 115 | // ?.createService(WebServiceApi::class.java) | 119 | // ?.createService(WebServiceApi::class.java) |
| 116 | // ?.articulos | 120 | // ?.articulos |
| 117 | // call?.enqueue(object : Callback<List<productos?>?> { | 121 | // call?.enqueue(object : Callback<List<productos?>?> { |
| 118 | // override fun onResponse( | 122 | // override fun onResponse( |
| 119 | // call: Call<List<productos?>?>, | 123 | // call: Call<List<productos?>?>, |
| 120 | // response: Response<List<productos?>?> | 124 | // response: Response<List<productos?>?> |
| 121 | // ) { | 125 | // ) { |
| 122 | // if (response.code() == 200) { | 126 | // if (response.code() == 200) { |
| 123 | // for (i in response.body()!!.indices) { | 127 | // for (i in response.body()!!.indices) { |
| 124 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) | 128 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) |
| 125 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") | 129 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") |
| 126 | //// Log.d( | 130 | //// Log.d( |
| 127 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector | 131 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector |
| 128 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion | 132 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion |
| 129 | //// ) | 133 | //// ) |
| 130 | // mostrarArticulos() | 134 | // mostrarArticulos() |
| 131 | // } | 135 | // } |
| 132 | // } else if (response.code() == 404) { | 136 | // } else if (response.code() == 404) { |
| 133 | // Log.d("TAG1", "No hay cursos") | 137 | // Log.d("TAG1", "No hay cursos") |
| 134 | // } | 138 | // } |
| 135 | // | 139 | // |
| 136 | // } | 140 | // } |
| 137 | // | 141 | // |
| 138 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} | 142 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} |
| 139 | // }) | 143 | // }) |
| 140 | } | 144 | } |
| 141 | 145 | ||
| 142 | fun mostrarArticulos() { | 146 | fun mostrarArticulos() { |
| 143 | val Job = GlobalScope.launch { | 147 | val Job = GlobalScope.launch { |
| 144 | var listArticulos: List<Articles>? = null | 148 | var listArticulos: List<Articles>? = null |
| 145 | var temp: String = "" | 149 | var temp: String = "" |
| 146 | listArticulos = AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() | 150 | listArticulos = AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() |
| 147 | if (listArticulos != null) { | 151 | if (listArticulos != null) { |
| 148 | 152 | ||
| 149 | for (i in listArticulos.indices) temp += listArticulos[i].codigo.toString() | 153 | for (i in listArticulos.indices) temp += listArticulos[i].codigo.toString() |
| 150 | } | 154 | } |
| 151 | withContext(Dispatchers.Main) { | 155 | withContext(Dispatchers.Main) { |
| 152 | countriesList.visibility = View.VISIBLE | 156 | countriesList.visibility = View.VISIBLE |
| 153 | loading_view.visibility = View.GONE | 157 | loading_view.visibility = View.GONE |
| 154 | countriesList?.text = temp | 158 | countriesList?.text = temp |
| 155 | } | 159 | } |
| 156 | } | 160 | } |
| 157 | // for (professor in listArticulos!!) { | 161 | // for (professor in listArticulos!!) { |
| 158 | // editT.text= professor.id.toString() | 162 | // editT.text= professor.id.toString() |
| 159 | // } | 163 | // } |
| 160 | } | 164 | } |
| 161 | |||
| 162 | |||
| 163 | // fun observeViewModel() { | ||
| 164 | // | ||
| 165 | // val productosService = ProductosService.getProductosService() | ||
| 166 | // var job: Job? = null | ||
| 167 | // | ||
| 168 | // | ||
| 169 | // //countriesList.text="Procesando..." | ||
| 170 | // //countriesList.visibility = View.VISIBLE | ||
| 171 | // // GlobalScope1.launch(Dispatchers.IO) { | ||
| 172 | // val response = productosService.getProductos() | ||
| 173 | // if (response.isSuccessful) { | ||
| 174 | //// countriesList.layoutManager = LinearLayoutManager(context) | ||
| 175 | //// countriesList.itemAnimator = DefaultItemAnimator() | ||
| 176 | // | ||
| 177 | //// ProductAdapter.updateCountries(it) | ||
| 178 | // // cargarArticulos(response.body()) | ||
| 179 | // | ||
| 180 | // | ||
| 181 | // val artiAcargar: Articulos? = null | ||
| 182 | // var index: Long = 1 | ||
| 183 | // | ||
| 184 | // for (pro in response.body()!!) { | ||
| 185 | // //artiAcargar.id =index+1 | ||
| 186 | // artiAcargar!!.sector = pro.sector | ||
| 187 | // artiAcargar.codigo = pro.codigo | ||
| 188 | // artiAcargar.descripcion = pro.descripcion | ||
| 189 | // artiAcargar.codBar = pro.codBar | ||
| 190 | // artiAcargar.precio = pro.precio | ||
| 191 | // artiAcargar.costo = pro.costo | ||
| 192 | // artiAcargar.balanza = pro.balanza | ||
| 193 | // artiAcargar.depSn = pro.depSn | ||
| 194 | // artiAcargar.imagen = pro.imagen | ||
| 195 | // index += index | ||
| 196 | // | ||
| 197 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | ||
| 198 | // .insertArticulos(artiAcargar) | ||
| 199 | // } | ||
| 200 | // } | ||
| 201 | // // } | ||
| 202 | // | ||
| 203 | // //job.cancel() | ||
| 204 | // | ||
| 205 | // | ||
| 206 | // } | ||
| 207 | |||
| 208 | // fun cargarArticulos(Productos: List<Productos>?) { | ||
| 209 | // val artiAcargar: Articulos? = null | ||
| 210 | // var index: Long = 1 | ||
| 211 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { | ||
| 212 | // for (pro in Productos!!) { | ||
| 213 | // //artiAcargar.id =index+1 | ||
| 214 | // artiAcargar!!.sector = pro.sector | ||
| 215 | // artiAcargar.codigo = pro.codigo | ||
| 216 | // artiAcargar.descripcion = pro.descripcion | ||
| 217 | // artiAcargar.codBar = pro.codBar | ||
| 218 | // artiAcargar.precio = pro.precio | ||
| 219 | // artiAcargar.costo = pro.costo | ||
| 220 | // artiAcargar.balanza = pro.balanza | ||
| 221 | // artiAcargar.depSn = pro.depSn | ||
| 222 | // artiAcargar.imagen = pro.imagen | ||
| 223 | // index += index | ||
| 224 | // | ||
| 225 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | ||
| 226 | // .insertArticulos(artiAcargar) | ||
| 227 | // } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/configuracion/ConfiguracionFragment.kt
| 1 | package com.focasoftware.deboinventariov20.UI.configuracion | 1 | package com.focasoftware.deboinventariov20.UI.configuracion |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import android.content.SharedPreferences | 4 | import android.content.SharedPreferences |
| 5 | import android.os.Bundle | 5 | import android.os.Bundle |
| 6 | import android.view.LayoutInflater | 6 | import android.view.LayoutInflater |
| 7 | import android.view.View | 7 | import android.view.View |
| 8 | import android.view.ViewGroup | 8 | import android.view.ViewGroup |
| 9 | import android.widget.* | 9 | import android.widget.* |
| 10 | import androidx.fragment.app.Fragment | 10 | import androidx.fragment.app.Fragment |
| 11 | import androidx.fragment.app.FragmentActivity | 11 | import androidx.fragment.app.FragmentActivity |
| 12 | import androidx.lifecycle.lifecycleScope | 12 | import androidx.lifecycle.lifecycleScope |
| 13 | import androidx.navigation.NavController | 13 | import androidx.navigation.NavController |
| 14 | import androidx.navigation.Navigation | 14 | import androidx.navigation.Navigation |
| 15 | import androidx.navigation.fragment.findNavController | 15 | import androidx.navigation.fragment.findNavController |
| 16 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 16 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 17 | import com.focasoftware.deboinventariov20.Model.ServeInv | 17 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 18 | import com.focasoftware.deboinventariov20.R | 18 | import com.focasoftware.deboinventariov20.R |
| 19 | import com.focasoftware.deboinventariov20.UI.Utils.isConnectedToThisServer | 19 | import com.focasoftware.deboinventariov20.UI.Utils.isConnectedToThisServer |
| 20 | import com.focasoftware.deboinventariov20.UI.Utils.serverNoValido | ||
| 21 | import com.focasoftware.deboinventariov20.UI.Utils.serverValido | ||
| 20 | import kotlinx.android.synthetic.main.fragment_configuracion.* | 22 | import kotlinx.android.synthetic.main.fragment_configuracion.* |
| 21 | import kotlinx.coroutines.* | 23 | import kotlinx.coroutines.* |
| 22 | import kotlinx.coroutines.Dispatchers.Main | 24 | import kotlinx.coroutines.Dispatchers.Main |
| 23 | 25 | ||
| 24 | class ConfiguracionFragment : Fragment() { | 26 | class ConfiguracionFragment : Fragment() { |
| 25 | 27 | ||
| 26 | lateinit var sharedPreferences: SharedPreferences | 28 | lateinit var sharedPreferences: SharedPreferences |
| 27 | private lateinit var navController: NavController | 29 | private lateinit var navController: NavController |
| 28 | var itemSelect: Int = 0 | 30 | var itemSelect: Int = 0 |
| 29 | var indexSelect: Int = 0 | 31 | var indexSelect: Int = 0 |
| 30 | 32 | ||
| 31 | override fun onCreate(savedInstanceState: Bundle?) { | 33 | override fun onCreate(savedInstanceState: Bundle?) { |
| 32 | super.onCreate(savedInstanceState) | 34 | super.onCreate(savedInstanceState) |
| 33 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 35 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 34 | } | 36 | } |
| 35 | 37 | ||
| 36 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 38 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 37 | super.onViewCreated(view, savedInstanceState) | 39 | super.onViewCreated(view, savedInstanceState) |
| 38 | navController = Navigation.findNavController(view) | 40 | navController = Navigation.findNavController(view) |
| 41 | |||
| 39 | GlobalScope.launch(Main) { | 42 | GlobalScope.launch(Main) { |
| 40 | val listServer = mutableListOf<String>() | 43 | val listServer = mutableListOf<String>() |
| 41 | for (server in getDescServers()) { | 44 | for (server in getDescServers()) { |
| 42 | listServer.add((if (server.servNum < 9) "0" + server.servNum.toString() else server.servNum.toString()) + " - " + server.descripcion.toString()) | 45 | listServer.add((if (server.servNum < 9) "0" + server.servNum.toString() else server.servNum.toString()) + " - " + server.descripcion.toString()) |
| 43 | } | 46 | } |
| 44 | val adapterSpServer = ArrayAdapter( | 47 | val adapterSpServer = ArrayAdapter( |
| 45 | requireContext(), | 48 | requireContext(), |
| 46 | R.layout.support_simple_spinner_dropdown_item, | 49 | R.layout.support_simple_spinner_dropdown_item, |
| 47 | listServer | 50 | listServer |
| 48 | ) | 51 | ) |
| 49 | spServidor.adapter = adapterSpServer | 52 | spServidor.adapter = adapterSpServer |
| 50 | if (sharedPreferences.contains("ServerPredeterminado")) { | 53 | if (sharedPreferences.contains("ServerPredeterminado")) { |
| 51 | spServidor.setSelection( | 54 | spServidor.setSelection( |
| 52 | sharedPreferences.getString("ServerPredeterminado", "").toString().toInt() | 55 | sharedPreferences.getString("ServerPredeterminado", "").toString().toInt() |
| 53 | ) | 56 | ) |
| 54 | } else (spServidor.setSelection(0)) | 57 | } else (spServidor.setSelection(0)) |
| 55 | } | 58 | } |
| 56 | } | 59 | } |
| 57 | 60 | ||
| 58 | override fun onCreateView( | 61 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 59 | inflater: LayoutInflater, | ||
| 60 | container: ViewGroup?, | ||
| 61 | savedInstanceState: Bundle? | ||
| 62 | ): View? { | ||
| 63 | 62 | ||
| 64 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) | 63 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) |
| 65 | val etRuta = v.findViewById<EditText>(R.id.etRuta) | 64 | val etRuta = v.findViewById<EditText>(R.id.etRuta) |
| 66 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) | 65 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) |
| 67 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) | 66 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) |
| 68 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) | 67 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) |
| 69 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) | 68 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) |
| 70 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) | 69 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) |
| 71 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) | 70 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) |
| 72 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) | 71 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) |
| 73 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) | 72 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) |
| 74 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) | 73 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) |
| 75 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) | 74 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) |
| 76 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) | 75 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) |
| 77 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) | 76 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) |
| 78 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) | 77 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) |
| 79 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) | 78 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) |
| 80 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) | 79 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) |
| 81 | 80 | ||
| 82 | if (sharedPreferences.contains("etRuta")) if (sharedPreferences.contains("rbProInclu")) { | 81 | if (sharedPreferences.contains("etRuta")) if (sharedPreferences.contains("rbProInclu")) { |
| 83 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { | 82 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { |
| 84 | rbProInclu.isChecked = false | 83 | rbProInclu.isChecked = false |
| 85 | rbProNoInclu.isChecked = true | 84 | rbProNoInclu.isChecked = true |
| 86 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { | 85 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { |
| 87 | rbProInclu.isChecked = true | 86 | rbProInclu.isChecked = true |
| 88 | rbProNoInclu.isChecked = false | 87 | rbProNoInclu.isChecked = false |
| 89 | } | 88 | } |
| 90 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") | 89 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") |
| 91 | 90 | ||
| 92 | if (sharedPreferences.contains("rbProNoInclu")) { | 91 | if (sharedPreferences.contains("rbProNoInclu")) { |
| 93 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { | 92 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { |
| 94 | rbProNoInclu.isChecked = false | 93 | rbProNoInclu.isChecked = false |
| 95 | rbProInclu.isChecked = true | 94 | rbProInclu.isChecked = true |
| 96 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { | 95 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { |
| 97 | rbProNoInclu.isChecked = true | 96 | rbProNoInclu.isChecked = true |
| 98 | rbProInclu.isChecked = false | 97 | rbProInclu.isChecked = false |
| 99 | } | 98 | } |
| 100 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") | 99 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") |
| 101 | 100 | ||
| 102 | if (sharedPreferences.contains("cbHabiLectura")) { | 101 | if (sharedPreferences.contains("cbHabiLectura")) { |
| 103 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { | 102 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { |
| 104 | cbHabiLectura.isChecked = false | 103 | cbHabiLectura.isChecked = false |
| 105 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { | 104 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { |
| 106 | cbHabiLectura.isChecked = true | 105 | cbHabiLectura.isChecked = true |
| 107 | } | 106 | } |
| 108 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") | 107 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") |
| 109 | 108 | ||
| 110 | if (sharedPreferences.contains("cbMostrarStock")) { | 109 | if (sharedPreferences.contains("cbMostrarStock")) { |
| 111 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { | 110 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { |
| 112 | cbMostrarStock.isChecked = false | 111 | cbMostrarStock.isChecked = false |
| 113 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { | 112 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { |
| 114 | cbMostrarStock.isChecked = true | 113 | cbMostrarStock.isChecked = true |
| 115 | } | 114 | } |
| 116 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") | 115 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") |
| 117 | 116 | ||
| 118 | if (sharedPreferences.contains("rbVentas")) { | 117 | if (sharedPreferences.contains("rbVentas")) { |
| 119 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { | 118 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { |
| 120 | rbVentas.isChecked = false | 119 | rbVentas.isChecked = false |
| 121 | rbDeposito.isChecked = true | 120 | rbDeposito.isChecked = true |
| 122 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { | 121 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { |
| 123 | rbVentas.isChecked = true | 122 | rbVentas.isChecked = true |
| 124 | rbDeposito.isChecked = false | 123 | rbDeposito.isChecked = false |
| 125 | } | 124 | } |
| 126 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") | 125 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") |
| 127 | 126 | ||
| 128 | if (sharedPreferences.contains("rbDeposito")) { | 127 | if (sharedPreferences.contains("rbDeposito")) { |
| 129 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { | 128 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { |
| 130 | rbDeposito.isChecked = false | 129 | rbDeposito.isChecked = false |
| 131 | rbVentas.isChecked = true | 130 | rbVentas.isChecked = true |
| 132 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { | 131 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { |
| 133 | rbDeposito.isChecked = true | 132 | rbDeposito.isChecked = true |
| 134 | rbVentas.isChecked = false | 133 | rbVentas.isChecked = false |
| 135 | } | 134 | } |
| 136 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") | 135 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") |
| 137 | 136 | ||
| 138 | if (sharedPreferences.contains("rbCodigoDebo")) { | 137 | if (sharedPreferences.contains("rbCodigoDebo")) { |
| 139 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { | 138 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { |
| 140 | rbCodigoDebo.isChecked = false | 139 | rbCodigoDebo.isChecked = false |
| 141 | rbCodigoOrigen.isChecked = false | 140 | rbCodigoOrigen.isChecked = false |
| 142 | rbCodigoBarras.isChecked = false | 141 | rbCodigoBarras.isChecked = false |
| 143 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { | 142 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { |
| 144 | rbCodigoDebo.isChecked = true | 143 | rbCodigoDebo.isChecked = true |
| 145 | rbCodigoOrigen.isChecked = false | 144 | rbCodigoOrigen.isChecked = false |
| 146 | rbCodigoBarras.isChecked = false | 145 | rbCodigoBarras.isChecked = false |
| 147 | } | 146 | } |
| 148 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") | 147 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") |
| 149 | 148 | ||
| 150 | if (sharedPreferences.contains("rbCodigoOrigen")) { | 149 | if (sharedPreferences.contains("rbCodigoOrigen")) { |
| 151 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { | 150 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { |
| 152 | rbCodigoOrigen.isChecked = false | 151 | rbCodigoOrigen.isChecked = false |
| 153 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { | 152 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { |
| 154 | rbCodigoOrigen.isChecked = true | 153 | rbCodigoOrigen.isChecked = true |
| 155 | } | 154 | } |
| 156 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") | 155 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") |
| 157 | 156 | ||
| 158 | if (sharedPreferences.contains("rbCodigoBarras")) { | 157 | if (sharedPreferences.contains("rbCodigoBarras")) { |
| 159 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { | 158 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { |
| 160 | rbCodigoBarras.isChecked = false | 159 | rbCodigoBarras.isChecked = false |
| 161 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { | 160 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { |
| 162 | rbCodigoBarras.isChecked = true | 161 | rbCodigoBarras.isChecked = true |
| 163 | } | 162 | } |
| 164 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") | 163 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") |
| 165 | 164 | ||
| 166 | if (sharedPreferences.contains("cbMostrarExistencia")) { | 165 | if (sharedPreferences.contains("cbMostrarExistencia")) { |
| 167 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { | 166 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { |
| 168 | cbMostrarExistencia.isChecked = false | 167 | cbMostrarExistencia.isChecked = false |
| 169 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { | 168 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { |
| 170 | cbMostrarExistencia.isChecked = true | 169 | cbMostrarExistencia.isChecked = true |
| 171 | } | 170 | } |
| 172 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") | 171 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") |
| 173 | 172 | ||
| 174 | if (sharedPreferences.contains("cbMostrarPrecio")) { | 173 | if (sharedPreferences.contains("cbMostrarPrecio")) { |
| 175 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { | 174 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { |
| 176 | cbMostrarPrecio.isChecked = false | 175 | cbMostrarPrecio.isChecked = false |
| 177 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { | 176 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { |
| 178 | cbMostrarPrecio.isChecked = true | 177 | cbMostrarPrecio.isChecked = true |
| 179 | } | 178 | } |
| 180 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") | 179 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") |
| 181 | 180 | ||
| 182 | btnGuardar.setOnClickListener { | 181 | btnGuardar.setOnClickListener { |
| 183 | guardarPreferencias() | 182 | guardarPreferencias() |
| 184 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG) | 183 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG) |
| 185 | .show() | 184 | .show() |
| 186 | navController.navigate(R.id.action_configuracionFragment_to_mainFragment2) | 185 | navController.navigate(R.id.action_configuracionFragment_to_mainFragment2) |
| 187 | } | 186 | } |
| 188 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } | 187 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } |
| 189 | 188 | ||
| 190 | btnValidarServidor.setOnClickListener { | ||
| 191 | GlobalScope.launch(Main) { | ||
| 192 | val serverPre = fetchServerPreOne() | ||
| 193 | if (isConnectedToThisServer(serverPre!!.direccion.toString().substring(7,serverPre.direccion.toString().length))) { | ||
| 194 | Toast.makeText(requireContext(), "¡Dirección Valida!", Toast.LENGTH_LONG).show() | ||
| 195 | } else { | ||
| 196 | Toast.makeText(requireContext(), "¡Verifique la Dirección!", Toast.LENGTH_LONG) | ||
| 197 | .show() | ||
| 198 | } | ||
| 199 | } | ||
| 200 | } | ||
| 201 | |||
| 202 | spServidor.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { | 189 | spServidor.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { |
| 203 | override fun onNothingSelected(parent: AdapterView<*>?) {} | 190 | override fun onNothingSelected(parent: AdapterView<*>?) {} |
| 204 | override fun onItemSelected( | 191 | override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { |
| 205 | parent: AdapterView<*>?, | ||
| 206 | view: View?, | ||
| 207 | position: Int, | ||
| 208 | id: Long | ||
| 209 | ) { | ||
| 210 | itemSelect = parent!!.getItemAtPosition(position).toString().substring(0, 2).toInt() | 192 | itemSelect = parent!!.getItemAtPosition(position).toString().substring(0, 2).toInt() |
| 211 | indexSelect = position | 193 | indexSelect = position |
| 212 | } | 194 | } |
| 213 | } | 195 | } |
| 196 | |||
| 197 | btnValidarServidor.setOnClickListener { | ||
| 198 | GlobalScope.launch(Main) { | ||
| 199 | |||
| 200 | val serverPre = fetchServer() | ||
| 201 | if (serverPre != null) { | ||
| 202 | if (isConnectedToThisServer(serverPre.direccion.toString().substring(7, serverPre.direccion.toString().length))) { | ||
| 203 | val modalDialog = serverValido() | ||
| 204 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
| 205 | } else { | ||
| 206 | val modalDialog = serverNoValido() | ||
| 207 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
| 208 | } | ||
| 209 | } | ||
| 210 | } | ||
| 211 | } | ||
| 212 | |||
| 214 | return v | 213 | return v |
| 215 | } | 214 | } |
| 216 | 215 | ||
| 216 | private suspend fun fetchServer(): ServeInv? { | ||
| 217 | return GlobalScope.async(Dispatchers.IO) { | ||
| 218 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServer(itemSelect) | ||
| 219 | }.await() | ||
| 220 | } | ||
| 221 | |||
| 217 | suspend fun getDescServers(): List<ServeInv> { | 222 | suspend fun getDescServers(): List<ServeInv> { |
| 218 | return GlobalScope.async(Dispatchers.IO) { | 223 | return GlobalScope.async(Dispatchers.IO) { |
| 219 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() | 224 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() |
| 220 | }.await() | 225 | }.await() |
| 221 | } | 226 | } |
| 222 | 227 | ||
| 223 | fun guardarPreferencias() { | 228 | fun guardarPreferencias() { |
| 224 | // try { | 229 | try { |
| 225 | val editor = sharedPreferences.edit() | 230 | val editor = sharedPreferences.edit() |
| 226 | 231 | ||
| 227 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) | 232 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) |
| 228 | 233 | ||
| 229 | if (rbProInclu.isChecked) editor?.putString( | 234 | if (rbProInclu.isChecked) editor?.putString( |
| 230 | "rbProInclu", | 235 | "rbProInclu", |
| 231 | "1" | 236 | "1" |
| 232 | ) else editor?.putString("rbProInclu", "0") | 237 | ) else editor?.putString("rbProInclu", "0") |
| 233 | if (rbProNoInclu.isChecked) editor?.putString( | 238 | if (rbProNoInclu.isChecked) editor?.putString( |
| 234 | "rbProNoInclu", | 239 | "rbProNoInclu", |
| 235 | "1" | 240 | "1" |
| 236 | ) else editor?.putString("rbProNoInclu", "0") | 241 | ) else editor?.putString("rbProNoInclu", "0") |
| 237 | 242 | ||
| 238 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString( | 243 | if (cbHabiLectura.isChecked) editor?.putString( |
| 239 | "cbHabiLectura", | 244 | "cbHabiLectura", |
| 240 | "0" | 245 | "1" |
| 241 | ) | 246 | ) else editor?.putString( |
| 242 | if (cbMostrarStock.isChecked) editor?.putString( | 247 | "cbHabiLectura", |
| 243 | "cbMostrarStock", | 248 | "0" |
| 244 | "1" | 249 | ) |
| 245 | ) else editor?.putString("cbMostrarStock", "0") | 250 | if (cbMostrarStock.isChecked) editor?.putString( |
| 246 | if (rbVentas.isChecked) editor?.putString( | 251 | "cbMostrarStock", |
| 247 | "rbVentas", | 252 | "1" |
| 248 | "1" | 253 | ) else editor?.putString("cbMostrarStock", "0") |
| 249 | ) else editor?.putString("rbVentas", "0") | 254 | if (rbVentas.isChecked) editor?.putString( |
| 250 | if (rbDeposito.isChecked) editor?.putString( | 255 | "rbVentas", |
| 251 | "rbDeposito", | 256 | "1" |
| 252 | "1" | 257 | ) else editor?.putString("rbVentas", "0") |
| 253 | ) else editor?.putString("rbDeposito", "0") | 258 | if (rbDeposito.isChecked) editor?.putString( |
| 254 | if (rbCodigoDebo.isChecked) editor?.putString( | 259 | "rbDeposito", |
| 255 | "rbCodigoDebo", | 260 | "1" |
| 256 | "1" | 261 | ) else editor?.putString("rbDeposito", "0") |
| 257 | ) else editor?.putString("rbCodigoDebo", "0") | 262 | if (rbCodigoDebo.isChecked) editor?.putString( |
| 258 | if (rbCodigoOrigen.isChecked) editor?.putString( | 263 | "rbCodigoDebo", |
| 259 | "rbCodigoOrigen", | 264 | "1" |
| 260 | "1" | 265 | ) else editor?.putString("rbCodigoDebo", "0") |
| 261 | ) else editor?.putString("rbCodigoOrigen", "0") | 266 | if (rbCodigoOrigen.isChecked) editor?.putString( |
| 262 | if (rbCodigoBarras.isChecked) editor?.putString( | 267 | "rbCodigoOrigen", |
| 263 | "rbCodigoBarras", | 268 | "1" |
| 264 | "1" | 269 | ) else editor?.putString("rbCodigoOrigen", "0") |
| 265 | ) else editor?.putString("rbCodigoBarras", "0") | 270 | if (rbCodigoBarras.isChecked) editor?.putString( |
| 266 | if (cbMostrarExistencia.isChecked) editor?.putString( | 271 | "rbCodigoBarras", |
| 267 | "cbMostrarExistencia", | 272 | "1" |
| 268 | "1" | 273 | ) else editor?.putString("rbCodigoBarras", "0") |
| 269 | ) else editor?.putString("cbMostrarExistencia", "0") | 274 | if (cbMostrarExistencia.isChecked) editor?.putString( |
| 270 | if (cbMostrarPrecio.isChecked) editor?.putString( | 275 | "cbMostrarExistencia", |
| 271 | "cbMostrarPrecio", | 276 | "1" |
| 272 | "1" | 277 | ) else editor?.putString("cbMostrarExistencia", "0") |
| 273 | ) else editor?.putString("cbMostrarPrecio", "0") | 278 | if (cbMostrarPrecio.isChecked) editor?.putString( |
| 274 | editor?.putString("ServerPredeterminado", indexSelect.toString()) | 279 | "cbMostrarPrecio", |
| 275 | updateServerPreInZero() | 280 | "1" |
| 276 | updateServerPre(itemSelect) | 281 | ) else editor?.putString("cbMostrarPrecio", "0") |
| 277 | 282 | editor?.putString("ServerPredeterminado", indexSelect.toString()) | |
| 278 | editor?.apply() | 283 | updateServerPreInZero() |
| 279 | editor.commit() | 284 | updateServerPre(itemSelect) |
| 280 | 285 | ||
| 281 | // } catch (e: Exception) { | 286 | editor?.apply() |
| 282 | // Toast.makeText(requireContext(), "Error ", Toast.LENGTH_LONG).show() | 287 | editor.commit() |
| 283 | // e.printStackTrace() | 288 | |
| 284 | // } | 289 | } catch (e: Exception) { |
| 290 | Toast.makeText(requireContext(), "Error ", Toast.LENGTH_LONG).show() | ||
| 291 | e.printStackTrace() | ||
| 292 | } | ||
| 285 | } | 293 | } |
| 286 | 294 | ||
| 287 | private fun updateServerPreInZero() { | 295 | private fun updateServerPreInZero() { |
| 288 | lifecycleScope.launch { | 296 | lifecycleScope.launch { |
| 289 | withContext(Dispatchers.IO) { | 297 | withContext(Dispatchers.IO) { |
| 290 | val activity: FragmentActivity? = activity | 298 | val activity: FragmentActivity? = activity |
| 291 | if (activity != null && isAdded) { | 299 | if (activity != null && isAdded) { |
| 292 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPreInZero() | 300 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPreInZero() |
| 293 | } | 301 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripCorigenFragment/CodigoOriFragment.kt
| 1 | package com.focasoftware.deboinventariov20.UI.descripCorigenFragment | 1 | package com.focasoftware.deboinventariov20.UI.descripCorigenFragment |
| 2 | 2 | ||
| 3 | import android.app.AlertDialog | 3 | import android.app.AlertDialog |
| 4 | import android.content.Context | 4 | import android.content.Context |
| 5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
| 6 | import android.graphics.Canvas | 6 | import android.graphics.Canvas |
| 7 | import android.graphics.Color | 7 | import android.graphics.Color |
| 8 | import android.graphics.drawable.ColorDrawable | 8 | import android.graphics.drawable.ColorDrawable |
| 9 | import android.os.Bundle | 9 | import android.os.Bundle |
| 10 | import android.text.Editable | ||
| 10 | import android.text.InputType | 11 | import android.text.InputType |
| 12 | import android.text.TextWatcher | ||
| 11 | import androidx.fragment.app.Fragment | 13 | import androidx.fragment.app.Fragment |
| 12 | import android.view.LayoutInflater | 14 | import android.view.LayoutInflater |
| 13 | import android.view.View | 15 | import android.view.View |
| 14 | import android.view.ViewGroup | 16 | import android.view.ViewGroup |
| 15 | import android.view.WindowManager | 17 | import android.view.WindowManager |
| 16 | import android.view.inputmethod.InputMethodManager | 18 | import android.view.inputmethod.InputMethodManager |
| 17 | import androidx.fragment.app.FragmentActivity | 19 | import androidx.fragment.app.FragmentActivity |
| 18 | import androidx.lifecycle.lifecycleScope | 20 | import androidx.lifecycle.lifecycleScope |
| 19 | import androidx.navigation.NavController | 21 | import androidx.navigation.NavController |
| 20 | import androidx.navigation.Navigation | 22 | import androidx.navigation.Navigation |
| 21 | import androidx.recyclerview.widget.ItemTouchHelper | 23 | import androidx.recyclerview.widget.ItemTouchHelper |
| 22 | import androidx.recyclerview.widget.LinearLayoutManager | 24 | import androidx.recyclerview.widget.LinearLayoutManager |
| 23 | import androidx.recyclerview.widget.RecyclerView | 25 | import androidx.recyclerview.widget.RecyclerView |
| 24 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 26 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 25 | import com.focasoftware.deboinventariov20.Model.Articles | 27 | import com.focasoftware.deboinventariov20.Model.Articles |
| 26 | import com.focasoftware.deboinventariov20.Model.InvBody | 28 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 27 | import com.focasoftware.deboinventariov20.R | 29 | import com.focasoftware.deboinventariov20.R |
| 28 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | 30 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
| 29 | import com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment | 31 | import com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment |
| 30 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| 31 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.btnAceptar | 33 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.btnAceptar |
| 32 | import kotlinx.android.synthetic.main.login_dialog.view.* | 34 | import kotlinx.android.synthetic.main.login_dialog.view.* |
| 33 | import kotlinx.coroutines.* | 35 | import kotlinx.coroutines.* |
| 34 | 36 | ||
| 35 | // | 37 | // |
| 36 | class CodigoOriFragment : Fragment() { | 38 | class CodigoOriFragment : Fragment() { |
| 37 | 39 | ||
| 38 | private lateinit var artAcargar2: List<Articles> | 40 | private lateinit var artAcargar2: List<Articles> |
| 39 | private var listArticulos: List<Articles>? = null | 41 | private var listArticulos: List<Articles>? = null |
| 40 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | 42 | lateinit var viewAdapter2: RecyclerView.Adapter<*> |
| 41 | private lateinit var viewManager2: RecyclerView.LayoutManager | 43 | private lateinit var viewManager2: RecyclerView.LayoutManager |
| 42 | private lateinit var rcCodigoOri: RecyclerView | 44 | private lateinit var rcCodigoOri: RecyclerView |
| 43 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | 45 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) |
| 44 | private var cantidad = 0F | 46 | private var cantidad = 0F |
| 45 | private var numeroInventario = 0 | 47 | private var numeroInventario = 0 |
| 46 | lateinit var navController: NavController | 48 | lateinit var navController: NavController |
| 47 | lateinit var sharedPreferences: SharedPreferences | 49 | lateinit var sharedPreferences: SharedPreferences |
| 48 | private var artCargadoEnBD: InvBody? = null | 50 | private var artCargadoEnBD: InvBody? = null |
| 51 | lateinit var mDialogViewM: View | ||
| 49 | 52 | ||
| 50 | override fun onCreate(savedInstanceState: Bundle?) { | 53 | override fun onCreate(savedInstanceState: Bundle?) { |
| 51 | super.onCreate(savedInstanceState) | 54 | super.onCreate(savedInstanceState) |
| 52 | 55 | ||
| 53 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 56 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 54 | arguments.apply { | 57 | arguments.apply { |
| 55 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | 58 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> |
| 56 | numeroInventario = requireArguments().getInt("numeroInv") | 59 | numeroInventario = requireArguments().getInt("numeroInv") |
| 57 | } | 60 | } |
| 58 | 61 | ||
| 59 | } | 62 | } |
| 60 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 63 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 61 | super.onViewCreated(view, savedInstanceState) | 64 | super.onViewCreated(view, savedInstanceState) |
| 62 | navController = Navigation.findNavController(view) | 65 | navController = Navigation.findNavController(view) |
| 63 | showSoftKeyboard(view) | 66 | showSoftKeyboard(view) |
| 64 | } | 67 | } |
| 65 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 68 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 66 | val v = inflater.inflate(R.layout.fragment_codigo_ori, container, false) | 69 | val v = inflater.inflate(R.layout.fragment_codigo_ori, container, false) |
| 67 | rcCodigoOri = v.findViewById(R.id.rcCodigoOri) | 70 | rcCodigoOri = v.findViewById(R.id.rcCodigoOri) |
| 68 | 71 | ||
| 69 | IngresarRecicler(artAcargar2) | 72 | IngresarRecicler(artAcargar2) |
| 70 | showSoftKeyboard(v) | 73 | showSoftKeyboard(v) |
| 71 | // btnSalir.setOnClickListener { | 74 | // btnSalir.setOnClickListener { |
| 72 | // activity?.onBackPressed(); | 75 | // activity?.onBackPressed(); |
| 73 | //// VolverAinventario() | 76 | //// VolverAinventario() |
| 74 | // } | 77 | // } |
| 75 | return v | 78 | return v |
| 76 | } | 79 | } |
| 77 | 80 | ||
| 78 | private fun showSoftKeyboard(view: View) { | 81 | private fun showSoftKeyboard(view: View) { |
| 79 | if (view.requestFocus()) { | 82 | if (view.requestFocus()) { |
| 80 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | 83 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager |
| 81 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) | 84 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) |
| 82 | } | 85 | } |
| 83 | } | 86 | } |
| 84 | 87 | ||
| 85 | fun IngresarRecicler(articulos: List<Articles>) { | 88 | fun IngresarRecicler(articulos: List<Articles>) { |
| 86 | 89 | ||
| 87 | viewAdapter2 = CodigoOrigenAdapter(requireContext(),articulos) | 90 | viewAdapter2 = CodigoOrigenAdapter(requireContext(),articulos) |
| 88 | viewManager2 = LinearLayoutManager(requireContext()) | 91 | viewManager2 = LinearLayoutManager(requireContext()) |
| 89 | 92 | ||
| 90 | rcCodigoOri.apply { | 93 | rcCodigoOri.apply { |
| 91 | adapter = viewAdapter2 | 94 | adapter = viewAdapter2 |
| 92 | layoutManager = viewManager2 | 95 | layoutManager = viewManager2 |
| 93 | } | 96 | } |
| 94 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | 97 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { |
| 95 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 98 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
| 96 | return false | 99 | return false |
| 97 | } | 100 | } |
| 98 | 101 | ||
| 99 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 102 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
| 100 | 103 | ||
| 101 | GlobalScope.launch(Dispatchers.Main) { | 104 | GlobalScope.launch(Dispatchers.Main) { |
| 102 | //TODO BUSCO EN BASE DE DATOS | 105 | //TODO BUSCO EN BASE DE DATOS |
| 103 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), | 106 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), |
| 104 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), | 107 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), |
| 105 | numeroInventario.toString()) | 108 | numeroInventario.toString()) |
| 106 | if (artCargadoEnBD == null) { | 109 | if (artCargadoEnBD == null) { |
| 107 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | 110 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) |
| 108 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | 111 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) |
| 109 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO | 112 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO |
| 110 | if ((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==1 || (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==3 || (viewAdapter2 as CodigoOrigenAdapter).items2?.get( | 113 | if ((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==1 || (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==3 || (viewAdapter2 as CodigoOrigenAdapter).items2?.get( |
| 111 | viewHolder.layoutPosition)!!.balanza==7) | 114 | viewHolder.layoutPosition)!!.balanza==7) |
| 112 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER | 115 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER |
| 113 | 116 | ||
| 114 | mDialogView.tvTitulo.text = "${(viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" | 117 | mDialogView.tvTitulo.text = "${(viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" |
| 115 | val mAlertDialog = mBuilder.show() | 118 | val mAlertDialog = mBuilder.show() |
| 116 | mDialogView.etCantidad.requestFocus() | 119 | mDialogView.etCantidad.requestFocus() |
| 117 | mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 120 | mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 118 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 121 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 119 | mDialogView.btnAceptar.setOnClickListener { | 122 | mDialogView.btnAceptar.setOnClickListener { |
| 120 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | 123 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 121 | mDialogView.etCantidad.error = "No vacio" | 124 | mDialogView.etCantidad.error = "No vacio" |
| 122 | mDialogView.etCantidad.requestFocus() | 125 | mDialogView.etCantidad.requestFocus() |
| 123 | mDialogView.etCantidad.hint = "Ingrese un valor" | 126 | mDialogView.etCantidad.hint = "Ingrese un valor" |
| 124 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | 127 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 125 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | 128 | cantidad = mDialogView.etCantidad.text.toString().toFloat() |
| 126 | val body = InvBody(numeroInventario, | 129 | val body = InvBody(numeroInventario, |
| 127 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, | 130 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, |
| 128 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | 131 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD |
| 129 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, | 132 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, |
| 130 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, | 133 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, |
| 131 | cantidad.toString(), | 134 | cantidad.toString(), |
| 132 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, | 135 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, |
| 133 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, | 136 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, |
| 134 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | 137 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 135 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | 138 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 136 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, | 139 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, |
| 137 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, | 140 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, |
| 138 | InventarioFragment().ObtenerFechaActual(), | 141 | InventarioFragment().ObtenerFechaActual(), |
| 139 | InventarioFragment().ObtenerFechaActual()) | 142 | InventarioFragment().ObtenerFechaActual()) |
| 140 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | 143 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
| 141 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) | 144 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) |
| 142 | // VolverAinventario() | 145 | // VolverAinventario() |
| 143 | activity?.onBackPressed() | 146 | activity?.onBackPressed() |
| 144 | mAlertDialog.dismiss() | 147 | mAlertDialog.dismiss() |
| 145 | } | 148 | } |
| 146 | } | 149 | } |
| 147 | } else if (artCargadoEnBD != null) { | 150 | } else if (artCargadoEnBD != null) { |
| 148 | 151 | ||
| 149 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 152 | mDialogViewM = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| 150 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) | 153 | val mBuilder = AlertDialog.Builder(context).setView(mDialogViewM).setCancelable(false) |
| 151 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER | 154 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogViewM.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER |
| 152 | mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | 155 | mDialogViewM.tvTitulo2.text="${artCargadoEnBD!!.descripcion}" |
| 156 | mDialogViewM.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | ||
| 153 | 157 | ||
| 154 | val mAlertDialog = mBuilder.show() | 158 | val mAlertDialog = mBuilder.show() |
| 155 | mDialogView.tvNuevaCantidad.requestFocus() | 159 | mDialogViewM.tvNuevaCantidad.requestFocus() |
| 156 | 160 | mDialogViewM.tvNuevaCantidad.addTextChangedListener(textWatcher) | |
| 157 | 161 | ||
| 158 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 162 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 159 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 163 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 160 | 164 | ||
| 161 | mDialogView.rbSumar.setOnClickListener { | 165 | mDialogViewM.rbSumar.setOnClickListener { |
| 162 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 166 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 163 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat())) | 167 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvCantInicial.text.toString().toFloat() + mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) |
| 164 | mDialogView.tvNuevaCantidad.isEnabled=false | 168 | // mDialogView.tvNuevaCantidad.isEnabled=false |
| 165 | } | 169 | } |
| 166 | } | 170 | } |
| 167 | mDialogView.rbRestar.setOnClickListener { | 171 | mDialogViewM.rbRestar.setOnClickListener { |
| 168 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 172 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 169 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 173 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { |
| 170 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 174 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) |
| 171 | mDialogView.tvNuevaCantidad.isEnabled = false | 175 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 172 | }else{ | 176 | }else{ |
| 173 | mDialogView.tvResultado.text="" | 177 | mDialogViewM.tvResultado.text="" |
| 174 | mDialogView.tvResultado.error = "Operación No Valida" | 178 | mDialogViewM.tvResultado.error = "Operación No Valida" |
| 175 | mDialogView.tvResultado.requestFocus() | 179 | mDialogViewM.tvResultado.requestFocus() |
| 176 | mDialogView.tvResultado.hint = "Error" | 180 | mDialogViewM.tvResultado.hint = "Error" |
| 177 | } | 181 | } |
| 178 | } | 182 | } |
| 179 | } | 183 | } |
| 180 | mDialogView.rbMdodificar.setOnClickListener { | 184 | mDialogViewM.rbMdodificar.setOnClickListener { |
| 181 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 185 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 182 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat())) | 186 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) |
| 183 | mDialogView.tvNuevaCantidad.isEnabled = false | 187 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 184 | } | 188 | } |
| 185 | } | 189 | } |
| 186 | mDialogView.btnAceptar.setOnClickListener { | 190 | mDialogViewM.btnAceptar.setOnClickListener { |
| 187 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | 191 | if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || !mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 188 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | 192 | if (mDialogViewM.tvResultado.text.isNotEmpty() || !mDialogViewM.tvResultado.text.isBlank()) { |
| 189 | 193 | ||
| 190 | updateCantidad((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), | 194 | updateCantidad((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), |
| 191 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), | 195 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), |
| 192 | mDialogView.tvResultado.text.toString().toFloat()) | 196 | mDialogViewM.tvResultado.text.toString().toFloat()) |
| 193 | // VolverAinventario() | 197 | // VolverAinventario() |
| 194 | activity?.onBackPressed(); | 198 | activity?.onBackPressed(); |
| 195 | mAlertDialog.dismiss() | 199 | mAlertDialog.dismiss() |
| 196 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 200 | } else if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 197 | mDialogView.tvResultado.error = "Operación Requerida" | 201 | mDialogViewM.tvResultado.error = "Operación Requerida" |
| 198 | mDialogView.tvResultado.requestFocus() | 202 | mDialogViewM.tvResultado.requestFocus() |
| 199 | mDialogView.tvResultado.hint = "Seleccione Operación" | 203 | mDialogViewM.tvResultado.hint = "Seleccione Operación" |
| 200 | } | 204 | } |
| 201 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 205 | } else if (mDialogViewM.tvNuevaCantidad.text.isEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 202 | mDialogView.tvNuevaCantidad.error = "Completar" | 206 | mDialogViewM.tvNuevaCantidad.error = "Completar" |
| 203 | mDialogView.tvNuevaCantidad.requestFocus() | 207 | mDialogViewM.tvNuevaCantidad.requestFocus() |
| 204 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | 208 | mDialogViewM.tvNuevaCantidad.hint = "Ingrese un valor" |
| 205 | } | 209 | } |
| 206 | } | 210 | } |
| 207 | mDialogView.dialogCancelBtn.setOnClickListener { | 211 | mDialogViewM.dialogCancelBtn.setOnClickListener { |
| 208 | activity?.onBackPressed(); | 212 | activity?.onBackPressed(); |
| 209 | mAlertDialog.dismiss() | 213 | mAlertDialog.dismiss() |
| 210 | } | 214 | } |
| 211 | } | 215 | } |
| 212 | } | 216 | } |
| 213 | } | 217 | } |
| 214 | 218 | ||
| 215 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 219 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
| 216 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 220 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 217 | val itemView = viewHolder.itemView | 221 | val itemView = viewHolder.itemView |
| 218 | 222 | ||
| 219 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 223 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
| 220 | 224 | ||
| 221 | if (dX > 0) { | 225 | if (dX > 0) { |
| 222 | 226 | ||
| 223 | c.drawColor(Color.RED) | 227 | c.drawColor(Color.RED) |
| 224 | } else if (dX < 0) { | 228 | } else if (dX < 0) { |
| 225 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | 229 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) |
| 226 | c.drawColor(Color.YELLOW) | 230 | c.drawColor(Color.YELLOW) |
| 227 | } | 231 | } |
| 228 | swipeBackground.draw(c) | 232 | swipeBackground.draw(c) |
| 229 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 233 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 230 | } | 234 | } |
| 231 | } | 235 | } |
| 232 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | 236 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) |
| 233 | itemTouchHelper2.attachToRecyclerView(rcCodigoOri) | 237 | itemTouchHelper2.attachToRecyclerView(rcCodigoOri) |
| 234 | 238 | ||
| 235 | } | 239 | } |
| 236 | 240 | ||
| 237 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 241 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
| 238 | lifecycleScope.launch { | 242 | lifecycleScope.launch { |
| 239 | withContext(Dispatchers.IO) { | 243 | withContext(Dispatchers.IO) { |
| 240 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 244 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
| 241 | } | 245 | } |
| 242 | } | 246 | } |
| 243 | } | 247 | } |
| 244 | 248 | ||
| 245 | // fun VolverAinventario() { | ||
| 246 | // | ||
| 247 | // val editor = sharedPreferences.edit() | ||
| 248 | // editor?.putString("Inventario", numeroInventario.toString()) | ||
| 249 | // editor?.apply() | ||
| 250 | // editor.commit() | ||
| 251 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | ||
| 252 | // } | ||
| 253 | |||
| 254 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { | 249 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { |
| 255 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 250 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 256 | var busqueda: InvBody? = null | 251 | var busqueda: InvBody? = null |
| 257 | return GlobalScope.async(Dispatchers.IO) { | 252 | return GlobalScope.async(Dispatchers.IO) { |
| 258 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario) | 253 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector.toLong(), codigo.toLong(), numInventario.toLong()) |
| 259 | return@async busqueda | 254 | return@async busqueda |
| 260 | }.await() | 255 | }.await() |
| 261 | } | 256 | } |
| 262 | 257 | ||
| 263 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 258 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
| 264 | lifecycleScope.launch { | 259 | lifecycleScope.launch { |
| 265 | withContext(Dispatchers.IO) { | 260 | withContext(Dispatchers.IO) { |
| 266 | val activity: FragmentActivity? = activity | 261 | val activity: FragmentActivity? = activity |
| 267 | if (activity != null && isAdded) { | 262 | if (activity != null && isAdded) { |
| 268 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | 263 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector.toLong(), codigo.toLong()) |
| 269 | } | 264 | } |
| 270 | } | 265 | } |
| 271 | } | 266 | } |
| 272 | } | 267 | } |
| 268 | private val textWatcher = object : TextWatcher { | ||
| 269 | override fun afterTextChanged(s: Editable?) { | ||
| 270 | } | ||
| 271 | |||
| 272 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { | ||
| 273 | } | ||
| 273 | 274 | ||
| 275 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { | ||
| 276 | if (mDialogViewM.rbSumar.isChecked) { | ||
| 277 | // mDialogView.tvNuevaCantidad.isEnabled=false | ||
| 278 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat() + mDialogViewM.tvCantInicial.text.toString().toFloat()) | ||
| 279 | } | ||
| 280 | if (mDialogViewM.rbRestar.isChecked) { | ||
| 281 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
| 282 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { | ||
| 283 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) | ||
| 284 | // mDialogView.tvNuevaCantidad.isEnabled = false | ||
| 285 | } else { | ||
| 286 | mDialogViewM.tvResultado.text = "" | ||
| 287 | mDialogViewM.tvResultado.error = "Operación No Valida" | ||
| 288 | mDialogViewM.tvResultado.requestFocus() | ||
| 289 | mDialogViewM.tvResultado.hint = "Error" | ||
| 290 | } | ||
| 291 | } | ||
| 292 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripcionFragment/DescripcionFragment.kt
| 1 | package com.focasoftware.deboinventariov20.UI.descripcionFragment | 1 | package com.focasoftware.deboinventariov20.UI.descripcionFragment |
| 2 | 2 | ||
| 3 | import android.app.AlertDialog | 3 | import android.app.AlertDialog |
| 4 | import android.content.Context | 4 | import android.content.Context |
| 5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
| 6 | import android.graphics.Canvas | 6 | import android.graphics.Canvas |
| 7 | import android.graphics.Color | 7 | import android.graphics.Color |
| 8 | import android.graphics.drawable.ColorDrawable | 8 | import android.graphics.drawable.ColorDrawable |
| 9 | import android.os.Bundle | 9 | import android.os.Bundle |
| 10 | import android.text.Editable | ||
| 10 | import android.text.InputType | 11 | import android.text.InputType |
| 12 | import android.text.TextWatcher | ||
| 11 | import android.view.LayoutInflater | 13 | import android.view.LayoutInflater |
| 12 | import android.view.View | 14 | import android.view.View |
| 13 | import android.view.ViewGroup | 15 | import android.view.ViewGroup |
| 14 | import android.view.WindowManager | 16 | import android.view.WindowManager |
| 15 | import android.view.inputmethod.InputMethodManager | 17 | import android.view.inputmethod.InputMethodManager |
| 16 | import androidx.fragment.app.Fragment | 18 | import androidx.fragment.app.Fragment |
| 17 | import androidx.fragment.app.FragmentActivity | 19 | import androidx.fragment.app.FragmentActivity |
| 18 | import androidx.lifecycle.lifecycleScope | 20 | import androidx.lifecycle.lifecycleScope |
| 19 | import androidx.navigation.NavController | 21 | import androidx.navigation.NavController |
| 20 | import androidx.navigation.Navigation | 22 | import androidx.navigation.Navigation |
| 21 | import androidx.recyclerview.widget.ItemTouchHelper | 23 | import androidx.recyclerview.widget.ItemTouchHelper |
| 22 | import androidx.recyclerview.widget.LinearLayoutManager | 24 | import androidx.recyclerview.widget.LinearLayoutManager |
| 23 | import androidx.recyclerview.widget.RecyclerView | 25 | import androidx.recyclerview.widget.RecyclerView |
| 24 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 26 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 25 | import com.focasoftware.deboinventariov20.Model.Articles | 27 | import com.focasoftware.deboinventariov20.Model.Articles |
| 26 | import com.focasoftware.deboinventariov20.Model.InvBody | 28 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 27 | import com.focasoftware.deboinventariov20.R | 29 | import com.focasoftware.deboinventariov20.R |
| 28 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | 30 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
| 29 | import com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment | 31 | import com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment |
| 30 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| 31 | import kotlinx.android.synthetic.main.login_dialog.view.* | 33 | import kotlinx.android.synthetic.main.login_dialog.view.* |
| 32 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | 34 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar |
| 33 | import kotlinx.coroutines.* | 35 | import kotlinx.coroutines.* |
| 34 | 36 | ||
| 35 | 37 | ||
| 36 | class DescripcionFragment : Fragment() { | 38 | class DescripcionFragment : Fragment() { |
| 37 | private var artAcargar2: List<Articles>? = null | 39 | private var artAcargar2: List<Articles>? = null |
| 38 | private var listArticulos2: List<Articles>? = null | 40 | private var listArticulos2: List<Articles>? = null |
| 39 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | 41 | lateinit var viewAdapter2: RecyclerView.Adapter<*> |
| 40 | private lateinit var viewManager2: RecyclerView.LayoutManager | 42 | private lateinit var viewManager2: RecyclerView.LayoutManager |
| 41 | private lateinit var rcDescripcion: RecyclerView | 43 | private lateinit var rcDescripcion: RecyclerView |
| 42 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | 44 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) |
| 43 | private var cantidad = 0F | 45 | private var cantidad = 0F |
| 44 | private var numeroInventario = 0 | 46 | private var numeroInventario = 0 |
| 45 | lateinit var navController: NavController | 47 | lateinit var navController: NavController |
| 46 | lateinit var sharedPreferences: SharedPreferences | 48 | lateinit var sharedPreferences: SharedPreferences |
| 47 | private var artCargadoEnBD: InvBody? = null | 49 | private var artCargadoEnBD: InvBody? = null |
| 50 | lateinit var mDialogViewM: View | ||
| 48 | 51 | ||
| 49 | override fun onCreate(savedInstanceState: Bundle?) { | 52 | override fun onCreate(savedInstanceState: Bundle?) { |
| 50 | super.onCreate(savedInstanceState) | 53 | super.onCreate(savedInstanceState) |
| 51 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 54 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 52 | arguments.apply { | 55 | arguments.apply { |
| 53 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | 56 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> |
| 54 | numeroInventario = requireArguments().getInt("numeroInv") | 57 | numeroInventario = requireArguments().getInt("numeroInv") |
| 55 | } | 58 | } |
| 56 | 59 | ||
| 57 | } | 60 | } |
| 61 | |||
| 58 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 62 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 59 | super.onViewCreated(view, savedInstanceState) | 63 | super.onViewCreated(view, savedInstanceState) |
| 60 | navController = Navigation.findNavController(view) | 64 | navController = Navigation.findNavController(view) |
| 61 | showSoftKeyboard(view) | 65 | showSoftKeyboard(view) |
| 62 | } | 66 | } |
| 67 | |||
| 63 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 68 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 64 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) | 69 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) |
| 65 | rcDescripcion = v.findViewById(R.id.rcDescripcion) | 70 | rcDescripcion = v.findViewById(R.id.rcDescripcion) |
| 66 | // val btnSalir = v.findViewById<Button>(R.id.btnSalir) | ||
| 67 | |||
| 68 | |||
| 69 | IngresarRecicler(artAcargar2) | 71 | IngresarRecicler(artAcargar2) |
| 70 | showSoftKeyboard(v) | 72 | showSoftKeyboard(v) |
| 71 | // btnSalir.setOnClickListener { | 73 | |
| 72 | // activity?.onBackPressed(); | ||
| 73 | //// VolverAinventario() | ||
| 74 | // } | ||
| 75 | return v | 74 | return v |
| 76 | } | 75 | } |
| 77 | 76 | ||
| 78 | private fun showSoftKeyboard(view: View) { | 77 | private fun showSoftKeyboard(view: View) { |
| 79 | if (view.requestFocus()) { | 78 | if (view.requestFocus()) { |
| 80 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | 79 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager |
| 81 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) | 80 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) |
| 82 | } | 81 | } |
| 83 | } | 82 | } |
| 84 | 83 | ||
| 85 | fun IngresarRecicler(articulos: List<Articles>?) { | 84 | fun IngresarRecicler(articulos: List<Articles>?) { |
| 86 | 85 | ||
| 87 | viewAdapter2 = DescripcionListAdapter(articulos) | 86 | viewAdapter2 = DescripcionListAdapter(articulos) |
| 88 | viewManager2 = LinearLayoutManager(requireContext()) | 87 | viewManager2 = LinearLayoutManager(requireContext()) |
| 89 | 88 | ||
| 90 | rcDescripcion.apply { | 89 | rcDescripcion.apply { |
| 91 | adapter = viewAdapter2 | 90 | adapter = viewAdapter2 |
| 92 | layoutManager = viewManager2 | 91 | layoutManager = viewManager2 |
| 93 | } | 92 | } |
| 94 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | 93 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { |
| 95 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 94 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
| 96 | return false | 95 | return false |
| 97 | } | 96 | } |
| 98 | 97 | ||
| 99 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 98 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
| 100 | 99 | ||
| 101 | GlobalScope.launch(Dispatchers.Main) { | 100 | GlobalScope.launch(Dispatchers.Main) { |
| 102 | //TODO BUSCO EN BASE DE DATOS | 101 | //TODO BUSCO EN BASE DE DATOS |
| 103 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), | 102 | artCargadoEnBD = buscarCodigoDeboEnBD( |
| 104 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), numeroInventario.toString()) | 103 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), |
| 104 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), numeroInventario.toString() | ||
| 105 | ) | ||
| 105 | if (artCargadoEnBD == null) { | 106 | if (artCargadoEnBD == null) { |
| 106 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | 107 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) |
| 107 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | 108 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) |
| 108 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO | 109 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO |
| 109 | if ((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==1 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==3 || (viewAdapter2 as DescripcionListAdapter).items2?.get( | 110 | if ((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 1 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 3 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 7) |
| 110 | viewHolder.layoutPosition)!!.balanza==7) | 111 | mDialogView.etCantidad.inputType = InputType.TYPE_CLASS_NUMBER |
| 111 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER | ||
| 112 | |||
| 113 | 112 | ||
| 114 | mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" | 113 | mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" |
| 115 | val mAlertDialog = mBuilder.show() | 114 | val mAlertDialog = mBuilder.show() |
| 115 | |||
| 116 | mDialogView.etCantidad.requestFocus() | 116 | mDialogView.etCantidad.requestFocus() |
| 117 | mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 117 | mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 118 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 118 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 119 | |||
| 119 | mDialogView.btnAceptar.setOnClickListener { | 120 | mDialogView.btnAceptar.setOnClickListener { |
| 120 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | 121 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 121 | mDialogView.etCantidad.error = "No vacio" | 122 | mDialogView.etCantidad.error = "No vacio" |
| 122 | mDialogView.etCantidad.requestFocus() | 123 | mDialogView.etCantidad.requestFocus() |
| 123 | mDialogView.etCantidad.hint = "Ingrese un valor" | 124 | mDialogView.etCantidad.hint = "Ingrese un valor" |
| 124 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | 125 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 125 | cantidad =String.format("%.2f", mDialogView.etCantidad.text.toString().toFloat()).toFloat() | 126 | cantidad = String.format("%.2f", mDialogView.etCantidad.text.toString().toFloat()).toFloat() |
| 126 | val body = InvBody(numeroInventario, | 127 | val body = InvBody( |
| 128 | numeroInventario, | ||
| 127 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, | 129 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, |
| 128 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | 130 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD |
| 129 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, | 131 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, |
| 130 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, | 132 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, |
| 131 | cantidad.toString(), | 133 | cantidad.toString(), |
| 132 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, | 134 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, |
| 133 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, | 135 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, |
| 134 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | 136 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 135 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | 137 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 136 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, | 138 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, |
| 137 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, | 139 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, |
| 138 | InventarioFragment().ObtenerFechaActual(), | 140 | InventarioFragment().ObtenerFechaActual(), |
| 139 | InventarioFragment().ObtenerFechaActual()) | 141 | InventarioFragment().ObtenerFechaActual() |
| 142 | ) | ||
| 140 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | 143 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
| 141 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) | 144 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) |
| 142 | // VolverAinventario() | 145 | // VolverAinventario() |
| 143 | activity?.onBackPressed() | 146 | activity?.onBackPressed() |
| 144 | mAlertDialog.dismiss() | 147 | mAlertDialog.dismiss() |
| 145 | } | 148 | } |
| 146 | } | 149 | } |
| 147 | } else if (artCargadoEnBD != null) { | 150 | } else if (artCargadoEnBD != null) { |
| 148 | 151 | ||
| 149 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 152 | mDialogViewM = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| 150 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) | 153 | val mBuilder = AlertDialog.Builder(context).setView(mDialogViewM).setCancelable(false) |
| 151 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER | 154 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7") |
| 152 | mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | 155 | ) mDialogViewM.tvNuevaCantidad.inputType = InputType.TYPE_CLASS_NUMBER |
| 156 | mDialogViewM.tvTitulo2.text="${artCargadoEnBD!!.descripcion}" | ||
| 157 | mDialogViewM.tvCantInicial.text = String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | ||
| 153 | 158 | ||
| 154 | val mAlertDialog = mBuilder.show() | 159 | val mAlertDialog = mBuilder.show() |
| 155 | mDialogView.tvNuevaCantidad.requestFocus() | 160 | mDialogViewM.tvNuevaCantidad.requestFocus() |
| 156 | 161 | ||
| 157 | 162 | ||
| 158 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 163 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 159 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 164 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 160 | 165 | ||
| 161 | mDialogView.rbSumar.setOnClickListener { | 166 | mDialogViewM.tvNuevaCantidad.addTextChangedListener(textWatcher) |
| 162 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 167 | |
| 163 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat())) | 168 | mDialogViewM.rbSumar.setOnClickListener { |
| 164 | mDialogView.tvNuevaCantidad.isEnabled=false | 169 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 170 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvCantInicial.text.toString().toFloat() + mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) | ||
| 171 | // mDialogViewM.tvNuevaCantidad.isEnabled = false | ||
| 165 | } | 172 | } |
| 166 | } | 173 | } |
| 167 | mDialogView.rbRestar.setOnClickListener { | 174 | mDialogViewM.rbRestar.setOnClickListener { |
| 168 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 175 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 169 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 176 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { |
| 170 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 177 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) |
| 171 | mDialogView.tvNuevaCantidad.isEnabled = false | 178 | // mDialogViewM.tvNuevaCantidad.isEnabled = false |
| 172 | }else{ | 179 | } else { |
| 173 | mDialogView.tvResultado.text="" | 180 | mDialogViewM.tvResultado.text = "" |
| 174 | mDialogView.tvResultado.error = "Operación No Valida" | 181 | mDialogViewM.tvResultado.error = "Operación No Valida" |
| 175 | mDialogView.tvResultado.requestFocus() | 182 | mDialogViewM.tvResultado.requestFocus() |
| 176 | mDialogView.tvResultado.hint = "Error" | 183 | mDialogViewM.tvResultado.hint = "Error" |
| 177 | } | 184 | } |
| 178 | } | 185 | } |
| 179 | } | 186 | } |
| 180 | mDialogView.rbMdodificar.setOnClickListener { | 187 | mDialogViewM.rbMdodificar.setOnClickListener { |
| 181 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 188 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 182 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat())) | 189 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) |
| 183 | mDialogView.tvNuevaCantidad.isEnabled = false | 190 | // mDialogViewM.tvNuevaCantidad.isEnabled = false |
| 184 | } | 191 | } |
| 185 | } | 192 | } |
| 186 | mDialogView.btnAceptar.setOnClickListener { | 193 | mDialogViewM.btnAceptar.setOnClickListener { |
| 187 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | 194 | if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || !mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 188 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | 195 | if (mDialogViewM.tvResultado.text.isNotEmpty() || !mDialogViewM.tvResultado.text.isBlank()) { |
| 189 | 196 | ||
| 190 | updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), | 197 | updateCantidad( |
| 191 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), | 198 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), |
| 192 | mDialogView.tvResultado.text.toString().toFloat()) | 199 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), |
| 193 | // VolverAinventario() | 200 | mDialogViewM.tvResultado.text.toString().toFloat() |
| 194 | activity?.onBackPressed(); | 201 | ) |
| 195 | mAlertDialog.dismiss() | 202 | activity?.onBackPressed() |
| 196 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 203 | mAlertDialog.dismiss() |
| 197 | mDialogView.tvResultado.error = "Operación Requerida" | 204 | } else if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 198 | mDialogView.tvResultado.requestFocus() | 205 | mDialogViewM.tvResultado.error = "Operación Requerida" |
| 199 | mDialogView.tvResultado.hint = "Seleccione Operación" | 206 | mDialogViewM.tvResultado.requestFocus() |
| 207 | mDialogViewM.tvResultado.hint = "Seleccione Operación" | ||
| 208 | } | ||
| 209 | } else if (mDialogViewM.tvNuevaCantidad.text.isEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { | ||
| 210 | mDialogViewM.tvNuevaCantidad.error = "Completar" | ||
| 211 | mDialogViewM.tvNuevaCantidad.requestFocus() | ||
| 212 | mDialogViewM.tvNuevaCantidad.hint = "Ingrese un valor" | ||
| 200 | } | 213 | } |
| 201 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
| 202 | mDialogView.tvNuevaCantidad.error = "Completar" | ||
| 203 | mDialogView.tvNuevaCantidad.requestFocus() | ||
| 204 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | ||
| 205 | } | ||
| 206 | } | 214 | } |
| 207 | mDialogView.dialogCancelBtn.setOnClickListener { | 215 | mDialogViewM.dialogCancelBtn.setOnClickListener { |
| 208 | activity?.onBackPressed(); | 216 | activity?.onBackPressed() |
| 209 | mAlertDialog.dismiss() | 217 | mAlertDialog.dismiss() |
| 210 | } | 218 | } |
| 211 | } | 219 | } |
| 212 | } | 220 | } |
| 213 | } | 221 | } |
| 214 | 222 | ||
| 215 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 223 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
| 216 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 224 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 217 | val itemView = viewHolder.itemView | 225 | val itemView = viewHolder.itemView |
| 218 | 226 | ||
| 219 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 227 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
| 220 | 228 | ||
| 221 | if (dX > 0) { | 229 | if (dX > 0) { |
| 222 | 230 | ||
| 223 | c.drawColor(Color.RED) | 231 | c.drawColor(Color.RED) |
| 224 | } else if (dX < 0) { | 232 | } else if (dX < 0) { |
| 225 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | 233 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) |
| 226 | c.drawColor(Color.YELLOW) | 234 | c.drawColor(Color.YELLOW) |
| 227 | } | 235 | } |
| 228 | swipeBackground.draw(c) | 236 | swipeBackground.draw(c) |
| 229 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 237 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 230 | } | 238 | } |
| 231 | } | 239 | } |
| 232 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | 240 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) |
| 233 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) | 241 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) |
| 234 | |||
| 235 | } | 242 | } |
| 236 | 243 | ||
| 237 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 244 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
| 238 | lifecycleScope.launch { | 245 | lifecycleScope.launch { |
| 239 | withContext(Dispatchers.IO) { | 246 | withContext(Dispatchers.IO) { |
| 240 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 247 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
| 241 | } | 248 | } |
| 242 | } | 249 | } |
| 243 | } | 250 | } |
| 244 | 251 | ||
| 245 | // fun VolverAinventario() { | ||
| 246 | // | ||
| 247 | // val editor = sharedPreferences.edit() | ||
| 248 | // editor?.putString("Inventario", numeroInventario.toString()) | ||
| 249 | // editor?.apply() | ||
| 250 | // editor.commit() | ||
| 251 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | ||
| 252 | // } | ||
| 253 | |||
| 254 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { | 252 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { |
| 255 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 253 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 256 | var busqueda: InvBody? = null | 254 | var busqueda: InvBody? = null |
| 257 | return GlobalScope.async(Dispatchers.IO) { | 255 | return GlobalScope.async(Dispatchers.IO) { |
| 258 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario) | 256 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector.toLong(), codigo.toLong(), numInventario.toLong()) |
| 259 | return@async busqueda | 257 | return@async busqueda |
| 260 | }.await() | 258 | }.await() |
| 261 | } | 259 | } |
| 262 | 260 | ||
| 263 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 261 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
| 264 | lifecycleScope.launch { | 262 | lifecycleScope.launch { |
| 265 | withContext(Dispatchers.IO) { | 263 | withContext(Dispatchers.IO) { |
| 266 | val activity: FragmentActivity? = activity | 264 | val activity: FragmentActivity? = activity |
| 267 | if (activity != null && isAdded) { | 265 | if (activity != null && isAdded) { |
| 268 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | 266 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector.toLong(), codigo.toLong()) |
| 267 | } | ||
| 268 | } | ||
| 269 | } | ||
| 270 | } | ||
| 271 | |||
| 272 | private val textWatcher = object : TextWatcher { | ||
| 273 | override fun afterTextChanged(s: Editable?) { | ||
| 274 | } | ||
| 275 | |||
| 276 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { | ||
| 277 | } | ||
| 278 | |||
| 279 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { | ||
| 280 | if (mDialogViewM.rbSumar.isChecked) { | ||
| 281 | // mDialogView.tvNuevaCantidad.isEnabled=false | ||
| 282 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat() + mDialogViewM.tvCantInicial.text.toString().toFloat()) | ||
| 283 | } | ||
| 284 | if (mDialogViewM.rbRestar.isChecked) { | ||
| 285 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
app/src/main/java/com/focasoftware/deboinventariov20/UI/inventario/InventarioFragment.kt
| 1 | package com.focasoftware.deboinventariov20.UI.inventario | 1 | package com.focasoftware.deboinventariov20.UI.inventario |
| 2 | 2 | ||
| 3 | import android.annotation.SuppressLint | 3 | import android.annotation.SuppressLint |
| 4 | import android.app.AlertDialog | 4 | import android.app.AlertDialog |
| 5 | import android.app.Dialog | ||
| 5 | import android.content.Context | 6 | import android.content.Context |
| 6 | import android.content.Context.INPUT_METHOD_SERVICE | 7 | import android.content.Context.INPUT_METHOD_SERVICE |
| 7 | import android.content.DialogInterface | 8 | import android.content.DialogInterface |
| 8 | import android.content.SharedPreferences | 9 | import android.content.SharedPreferences |
| 9 | import android.graphics.Canvas | 10 | import android.graphics.Canvas |
| 10 | import android.graphics.Color | 11 | import android.graphics.Color |
| 11 | import android.graphics.drawable.Drawable | 12 | import android.graphics.drawable.Drawable |
| 12 | import android.os.Bundle | 13 | import android.os.Bundle |
| 14 | import android.text.Editable | ||
| 13 | import android.text.InputType.TYPE_CLASS_NUMBER | 15 | import android.text.InputType.TYPE_CLASS_NUMBER |
| 16 | import android.text.TextWatcher | ||
| 14 | import android.view.* | 17 | import android.view.* |
| 15 | import android.view.inputmethod.InputMethodManager | 18 | import android.view.inputmethod.InputMethodManager |
| 16 | import android.widget.EditText | 19 | import android.widget.EditText |
| 17 | import android.widget.TextView | 20 | import android.widget.TextView |
| 18 | import android.widget.Toast | 21 | import android.widget.Toast |
| 19 | import androidx.core.content.ContextCompat | 22 | import androidx.core.content.ContextCompat |
| 20 | import androidx.core.os.bundleOf | 23 | import androidx.core.os.bundleOf |
| 21 | import androidx.fragment.app.Fragment | 24 | import androidx.fragment.app.Fragment |
| 22 | import androidx.lifecycle.lifecycleScope | 25 | import androidx.lifecycle.lifecycleScope |
| 23 | import androidx.navigation.NavController | 26 | import androidx.navigation.NavController |
| 24 | import androidx.navigation.Navigation | 27 | import androidx.navigation.Navigation |
| 25 | import androidx.recyclerview.widget.ItemTouchHelper | 28 | import androidx.recyclerview.widget.ItemTouchHelper |
| 26 | import androidx.recyclerview.widget.LinearLayoutManager | 29 | import androidx.recyclerview.widget.LinearLayoutManager |
| 27 | import androidx.recyclerview.widget.RecyclerView | 30 | import androidx.recyclerview.widget.RecyclerView |
| 28 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 31 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 29 | import com.focasoftware.deboinventariov20.Model.Articles | 32 | import com.focasoftware.deboinventariov20.Model.Articles |
| 30 | import com.focasoftware.deboinventariov20.Model.InvBody | 33 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 31 | import com.focasoftware.deboinventariov20.Model.InvHead | 34 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 32 | import com.focasoftware.deboinventariov20.R | 35 | import com.focasoftware.deboinventariov20.R |
| 33 | import com.focasoftware.deboinventariov20.UI.Utils.NoEncontradoSimple | 36 | import com.focasoftware.deboinventariov20.UI.Utils.NoEncontradoSimple |
| 34 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | 37 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
| 35 | import kotlinx.android.synthetic.main.fragment_inventario.* | 38 | import kotlinx.android.synthetic.main.fragment_inventario.* |
| 36 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 39 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| 37 | import kotlinx.android.synthetic.main.login_dialog.view.* | 40 | import kotlinx.android.synthetic.main.login_dialog.view.* |
| 38 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | 41 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar |
| 39 | import kotlinx.coroutines.* | 42 | import kotlinx.coroutines.* |
| 40 | import kotlinx.coroutines.Dispatchers.IO | 43 | import kotlinx.coroutines.Dispatchers.IO |
| 41 | import java.time.LocalDateTime | 44 | import java.time.LocalDateTime |
| 42 | import java.time.format.DateTimeFormatter | 45 | import java.time.format.DateTimeFormatter |
| 43 | import java.util.* | 46 | import java.util.* |
| 44 | 47 | ||
| 45 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { | 48 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { |
| 46 | 49 | ||
| 47 | private lateinit var sharedPreferences: SharedPreferences | 50 | private lateinit var sharedPreferences: SharedPreferences |
| 48 | private var iArea: Boolean = false | 51 | private var iArea: Boolean = false |
| 49 | private lateinit var invHead: InvHead | 52 | private lateinit var invHead: InvHead |
| 50 | private lateinit var rcInventarios: RecyclerView | 53 | private lateinit var rcInventarios: RecyclerView |
| 51 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 54 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
| 52 | private lateinit var viewManager: RecyclerView.LayoutManager | 55 | private lateinit var viewManager: RecyclerView.LayoutManager |
| 53 | private lateinit var sChangeUpper: String | 56 | private lateinit var sChangeUpper: String |
| 54 | private var listArticulos = ArrayList<ItemsRecycler>() | 57 | private var listArticulos = ArrayList<ItemsRecycler>() |
| 55 | private lateinit var navController: NavController | 58 | private lateinit var navController: NavController |
| 56 | var InventarioNuevo: Int = 0 | 59 | var InventarioNuevo: Int = 0 |
| 57 | private var iEstado = 0 | 60 | private var iEstado = 0 |
| 58 | private var iBusquedaPor = 0 | 61 | private var iBusquedaPor = 0 |
| 59 | private var fCant = 0F | 62 | private var fCant = 0F |
| 60 | private var bFirst = false | 63 | private var bFirst = false |
| 61 | private lateinit var deleteIcon: Drawable | 64 | private lateinit var deleteIcon: Drawable |
| 65 | lateinit var mDialogView: View | ||
| 62 | 66 | ||
| 63 | @SuppressLint("MissingPermission") | 67 | @SuppressLint("MissingPermission") |
| 64 | override fun onCreate(savedInstanceState: Bundle?) { | 68 | override fun onCreate(savedInstanceState: Bundle?) { |
| 65 | super.onCreate(savedInstanceState) | 69 | super.onCreate(savedInstanceState) |
| 66 | 70 | ||
| 67 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 71 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 68 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { | 72 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { |
| 69 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() | 73 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() |
| 70 | val editor = sharedPreferences.edit() | 74 | val editor = sharedPreferences.edit() |
| 71 | editor?.putString("Inventario", "-1") | 75 | editor?.putString("Inventario", "-1") |
| 72 | editor?.apply() | 76 | editor?.apply() |
| 73 | editor.commit() | 77 | editor.commit() |
| 74 | } | 78 | } |
| 75 | // val c = Calendar.getInstance() | 79 | // val c = Calendar.getInstance() |
| 76 | // c[2009, 9, 9, 12, 0] = 0 | 80 | // c[2009, 9, 9, 12, 0] = 0 |
| 77 | // val am: AlarmManager = requireActivity().getSystemService(Context.ALARM_SERVICE) as AlarmManager | 81 | // val am: AlarmManager = requireActivity().getSystemService(Context.ALARM_SERVICE) as AlarmManager |
| 78 | // am.setTime(c.timeInMillis) | 82 | // am.setTime(c.timeInMillis) |
| 79 | } | 83 | } |
| 80 | // private fun setupTimeZone(timeZoneName: String) { | 84 | // private fun setupTimeZone(timeZoneName: String) { |
| 81 | // val am = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager | 85 | // val am = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager |
| 82 | // am.setTimeZone("Europe/Madrid") | 86 | // am.setTimeZone("Europe/Madrid") |
| 83 | // } | 87 | // } |
| 84 | 88 | ||
| 85 | 89 | ||
| 86 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 90 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 87 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) | 91 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) |
| 88 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 92 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 89 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) | 93 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) |
| 90 | rcInventarios = v.findViewById(R.id.rcInventarios) | 94 | rcInventarios = v.findViewById(R.id.rcInventarios) |
| 91 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) | 95 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) |
| 92 | 96 | ||
| 93 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO | 97 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO |
| 94 | GlobalScope.launch(Dispatchers.Main) { | 98 | GlobalScope.launch(Dispatchers.Main) { |
| 95 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO | 99 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO |
| 96 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 | 100 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 |
| 97 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO | 101 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO |
| 98 | invHead = InvHead(InventarioNuevo, if (!SerchArea()) "Ventas" else "Deposito", 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, SerchArea(), AjusteProductos(), ProdNoCont()) | 102 | invHead = InvHead(InventarioNuevo, if (!SerchArea()) "Ventas" else "Deposito", 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, SerchArea(), AjusteProductos(), ProdNoCont()) |
| 99 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) | 103 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) |
| 100 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 104 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
| 101 | } | 105 | } |
| 102 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) | 106 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) |
| 103 | listArticulos.clear() | 107 | listArticulos.clear() |
| 104 | CargarDeBdInventario(InventarioNuevo) | 108 | CargarDeBdInventario(InventarioNuevo) |
| 105 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 109 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
| 106 | } | 110 | } |
| 107 | 111 | ||
| 108 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> | 112 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> |
| 109 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { | 113 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { |
| 110 | sChangeUpper = tCodigoBarras.text.toString() | 114 | sChangeUpper = tCodigoBarras.text.toString() |
| 111 | var indiceDelArtEncontrado = 0 | 115 | var indiceDelArtEncontrado = 0 |
| 112 | 116 | ||
| 113 | if (tCodigoBarras.text.isNullOrBlank() ) { | 117 | if (tCodigoBarras.text.isNullOrBlank() ) { |
| 114 | tCodigoBarras.error = "No puede estar vacio" | 118 | tCodigoBarras.error = "No puede estar vacio" |
| 115 | tCodigoBarras.requestFocus() | 119 | tCodigoBarras.requestFocus() |
| 116 | tCodigoBarras.hint = "No puede estar vacio" | 120 | tCodigoBarras.hint = "No puede estar vacio" |
| 117 | }else if (tCodigoBarras.text.toString().length<4 && iEstado==2) { | 121 | }else if (tCodigoBarras.text.toString().length<4 && iEstado==2) { |
| 118 | tCodigoBarras.error = "Minimo 4 caracteres" | 122 | tCodigoBarras.error = "Minimo 4 caracteres" |
| 119 | tCodigoBarras.requestFocus() | 123 | tCodigoBarras.requestFocus() |
| 120 | tCodigoBarras.hint = "4 Minimo" | 124 | tCodigoBarras.hint = "4 Minimo" |
| 121 | 125 | ||
| 122 | } else { | 126 | } else { |
| 123 | 127 | ||
| 124 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | 128 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS |
| 125 | when (iBusquedaPor) { | 129 | when (iBusquedaPor) { |
| 126 | 0 -> { | 130 | 0 -> { |
| 127 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 131 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
| 128 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 132 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 129 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 133 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 130 | 134 | ||
| 131 | GlobalScope.launch(Dispatchers.Main) { | 135 | GlobalScope.launch(Dispatchers.Main) { |
| 132 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | 136 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice |
| 133 | //TODO (Si no lo encuentra devuelve -1) | 137 | //TODO (Si no lo encuentra devuelve -1) |
| 134 | if (indiceDelArtEncontrado != -1) { | 138 | if (indiceDelArtEncontrado != -1) { |
| 135 | if (swSumaUno!!.isChecked) { | 139 | if (swSumaUno!!.isChecked) { |
| 136 | // fCant = 0F | 140 | // fCant = 0F |
| 137 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 141 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 138 | // fCant += 1F | 142 | // fCant += 1F |
| 139 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 143 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
| 140 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), | 144 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), |
| 141 | listArticulos[indiceDelArtEncontrado].codigo.toString(), | 145 | listArticulos[indiceDelArtEncontrado].codigo.toString(), |
| 142 | listArticulos[indiceDelArtEncontrado].cantTomada + 1) | 146 | listArticulos[indiceDelArtEncontrado].cantTomada + 1) |
| 143 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 147 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
| 144 | listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada + 1 | 148 | listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada + 1 |
| 145 | viewAdapter.notifyDataSetChanged() | 149 | viewAdapter.notifyDataSetChanged() |
| 146 | } else { | 150 | } else { |
| 147 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) | 151 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) |
| 148 | } | 152 | } |
| 149 | 153 | ||
| 150 | } else if (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | 154 | } else if (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD |
| 151 | //TODO BUSCO EN BASE DE DATOS | 155 | //TODO BUSCO EN BASE DE DATOS |
| 152 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 156 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
| 153 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | 157 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE |
| 154 | } | 158 | } |
| 155 | tCodigoBarras.focusable = View.FOCUSABLE | 159 | tCodigoBarras.focusable = View.FOCUSABLE |
| 156 | tCodigoBarras.setText("") | 160 | tCodigoBarras.setText("") |
| 157 | tCodigoBarras.selectAll() | 161 | tCodigoBarras.selectAll() |
| 158 | } | 162 | } |
| 159 | return@setOnKeyListener true | 163 | return@setOnKeyListener true |
| 160 | 164 | ||
| 161 | 165 | ||
| 162 | } | 166 | } |
| 163 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | 167 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** |
| 164 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 168 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
| 165 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 169 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 166 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 170 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 167 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | 171 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice |
| 168 | // //TODO Si no lo encuentra devuelve -1 | 172 | // //TODO Si no lo encuentra devuelve -1 |
| 169 | // if (indiceDelArtEncontrado != -1) { | 173 | // if (indiceDelArtEncontrado != -1) { |
| 170 | //// if (swSumaUno!!.isChecked) { | 174 | //// if (swSumaUno!!.isChecked) { |
| 171 | //// fCant = 0F | 175 | //// fCant = 0F |
| 172 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 176 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 173 | //// fCant += 1F | 177 | //// fCant += 1F |
| 174 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 178 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 175 | //// viewAdapter.notifyDataSetChanged() | 179 | //// viewAdapter.notifyDataSetChanged() |
| 176 | //// } else { | 180 | //// } else { |
| 177 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 181 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 178 | // MaterialDialog(requireContext()).show { | 182 | // MaterialDialog(requireContext()).show { |
| 179 | // title(R.string.sTituloNueva) | 183 | // title(R.string.sTituloNueva) |
| 180 | // message(R.string.sCantidadNueva) | 184 | // message(R.string.sCantidadNueva) |
| 181 | // input { materialDialog, charSequence -> | 185 | // input { materialDialog, charSequence -> |
| 182 | // fCant = 0F | 186 | // fCant = 0F |
| 183 | // fCant = charSequence.toString().toFloat() | 187 | // fCant = charSequence.toString().toFloat() |
| 184 | // } | 188 | // } |
| 185 | // positiveButton(R.string.btnOk) { | 189 | // positiveButton(R.string.btnOk) { |
| 186 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 190 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 187 | // viewAdapter.notifyDataSetChanged() | 191 | // viewAdapter.notifyDataSetChanged() |
| 188 | // dismiss() | 192 | // dismiss() |
| 189 | // } | 193 | // } |
| 190 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 194 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 191 | //// } | 195 | //// } |
| 192 | // | 196 | // |
| 193 | // } else if | 197 | // } else if |
| 194 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | 198 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD |
| 195 | GlobalScope.launch(Dispatchers.Main) { | 199 | GlobalScope.launch(Dispatchers.Main) { |
| 196 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 200 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
| 197 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | 201 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) |
| 198 | } | 202 | } |
| 199 | 203 | ||
| 200 | iBusquedaPor = 0 | 204 | iBusquedaPor = 0 |
| 201 | // } | 205 | // } |
| 202 | 206 | ||
| 203 | return@setOnKeyListener true | 207 | return@setOnKeyListener true |
| 204 | } | 208 | } |
| 205 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | 209 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** |
| 206 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 210 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 207 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 211 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 208 | 212 | ||
| 209 | // GlobalScope.launch(Dispatchers.Main) { | 213 | // GlobalScope.launch(Dispatchers.Main) { |
| 210 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 2)//TODO Si encuentra el articulo en el RV devuelve el indice | 214 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 2)//TODO Si encuentra el articulo en el RV devuelve el indice |
| 211 | //// //TODO Si no lo encuentra devuelve -1 | 215 | //// //TODO Si no lo encuentra devuelve -1 |
| 212 | // if (indiceDelArtEncontrado != -1) { | 216 | // if (indiceDelArtEncontrado != -1) { |
| 213 | // if (swSumaUno!!.isChecked) { | 217 | // if (swSumaUno!!.isChecked) { |
| 214 | // fCant = 0F | 218 | // fCant = 0F |
| 215 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 219 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 216 | // fCant += 1F | 220 | // fCant += 1F |
| 217 | // //TODO ACTUALIZO LA CANTIDAD EN LA BD | 221 | // //TODO ACTUALIZO LA CANTIDAD EN LA BD |
| 218 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 222 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 219 | // //TODO ACTUALIZO LA CANTIDAD EN EL RV | 223 | // //TODO ACTUALIZO LA CANTIDAD EN EL RV |
| 220 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 224 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 221 | // viewAdapter.notifyDataSetChanged() | 225 | // viewAdapter.notifyDataSetChanged() |
| 222 | // } else { | 226 | // } else { |
| 223 | // dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) | 227 | // dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) |
| 224 | // } | 228 | // } |
| 225 | // } else { | 229 | // } else { |
| 226 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 230 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| 227 | // val mBuilder = | 231 | // val mBuilder = |
| 228 | // AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | 232 | // AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") |
| 229 | // .setCancelable(false) | 233 | // .setCancelable(false) |
| 230 | // mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | 234 | // mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() |
| 231 | // val mAlertDialog = mBuilder.show() | 235 | // val mAlertDialog = mBuilder.show() |
| 232 | // mDialogView.rbSumar.setOnClickListener { | 236 | // mDialogView.rbSumar.setOnClickListener { |
| 233 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 237 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 234 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 238 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 235 | // } | 239 | // } |
| 236 | // } | 240 | // } |
| 237 | // mDialogView.rbRestar.setOnClickListener { | 241 | // mDialogView.rbRestar.setOnClickListener { |
| 238 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 242 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 239 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 243 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
| 240 | // mDialogView.tvgenerico4.text = | 244 | // mDialogView.tvgenerico4.text = |
| 241 | // (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 245 | // (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 242 | // } | 246 | // } |
| 243 | // } | 247 | // } |
| 244 | // } | 248 | // } |
| 245 | // mDialogView.rbMdodificar.setOnClickListener { | 249 | // mDialogView.rbMdodificar.setOnClickListener { |
| 246 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 250 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 247 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 251 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 248 | // } | 252 | // } |
| 249 | // } | 253 | // } |
| 250 | // mDialogView.btnAceptar.setOnClickListener { | 254 | // mDialogView.btnAceptar.setOnClickListener { |
| 251 | // mAlertDialog.dismiss() | 255 | // mAlertDialog.dismiss() |
| 252 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() | 256 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() |
| 253 | // fCant = 0F | 257 | // fCant = 0F |
| 254 | // fCant = name | 258 | // fCant = name |
| 255 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 259 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 256 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 260 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 257 | // viewAdapter.notifyDataSetChanged() | 261 | // viewAdapter.notifyDataSetChanged() |
| 258 | // } | 262 | // } |
| 259 | // mDialogView.dialogCancelBtn.setOnClickListener { | 263 | // mDialogView.dialogCancelBtn.setOnClickListener { |
| 260 | // mAlertDialog.dismiss() | 264 | // mAlertDialog.dismiss() |
| 261 | // } | 265 | // } |
| 262 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 266 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 263 | // val type = InputType.TYPE_CLASS_NUMBER | 267 | // val type = InputType.TYPE_CLASS_NUMBER |
| 264 | // MaterialDialog(requireContext()).show { | 268 | // MaterialDialog(requireContext()).show { |
| 265 | // | 269 | // |
| 266 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | 270 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
| 267 | // message(R.string.sCantidadNueva) | 271 | // message(R.string.sCantidadNueva) |
| 268 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 272 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
| 269 | // fCant = 0F | 273 | // fCant = 0F |
| 270 | // fCant = charSequence.toString().toFloat() | 274 | // fCant = charSequence.toString().toFloat() |
| 271 | // } | 275 | // } |
| 272 | // positiveButton(R.string.btnOk) { | 276 | // positiveButton(R.string.btnOk) { |
| 273 | // //TODO ACTUALIZO CANTIADAD EN BD | 277 | // //TODO ACTUALIZO CANTIADAD EN BD |
| 274 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 278 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 275 | // //TODO ACTUALIZO CANTIDAD EN RV | 279 | // //TODO ACTUALIZO CANTIDAD EN RV |
| 276 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 280 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 277 | // viewAdapter.notifyDataSetChanged() | 281 | // viewAdapter.notifyDataSetChanged() |
| 278 | // dismiss() | 282 | // dismiss() |
| 279 | // } | 283 | // } |
| 280 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 284 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 281 | // } | 285 | // } |
| 282 | // } else if (indiceDelArtEncontrado == -1) { | 286 | // } else if (indiceDelArtEncontrado == -1) { |
| 283 | // no lo encontro en el RV, lo va a buscar en al BD | 287 | // no lo encontro en el RV, lo va a buscar en al BD |
| 284 | 288 | ||
| 285 | GlobalScope.launch(Dispatchers.Main) { | 289 | GlobalScope.launch(Dispatchers.Main) { |
| 286 | //TODO BUSCO EN BASE DE DATOS | 290 | //TODO BUSCO EN BASE DE DATOS |
| 287 | val artEncontrado = buscarCodiogoOriEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 291 | val artEncontrado = buscarCodiogoOriEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
| 288 | ContinuarCargaCodigoOri(artEncontrado ) | 292 | ContinuarCargaCodigoOri(artEncontrado ) |
| 289 | } | 293 | } |
| 290 | iBusquedaPor = 0 | 294 | iBusquedaPor = 0 |
| 291 | // } | 295 | // } |
| 292 | // } | 296 | // } |
| 293 | return@setOnKeyListener true | 297 | return@setOnKeyListener true |
| 294 | } | 298 | } |
| 295 | } | 299 | } |
| 296 | } | 300 | } |
| 297 | } | 301 | } |
| 298 | return@setOnKeyListener false | 302 | return@setOnKeyListener false |
| 299 | } | 303 | } |
| 300 | return v | 304 | return v |
| 301 | } | 305 | } |
| 302 | 306 | ||
| 303 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 307 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 304 | super.onViewCreated(view, savedInstanceState) | 308 | super.onViewCreated(view, savedInstanceState) |
| 305 | navController = Navigation.findNavController(view) | 309 | navController = Navigation.findNavController(view) |
| 306 | etCodigoBarras.requestFocus() | 310 | etCodigoBarras.requestFocus() |
| 307 | // val modalDialog = NoEncontradoSimple() | 311 | // val modalDialog = NoEncontradoSimple() |
| 308 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 312 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 309 | 313 | ||
| 310 | btnBorrarInv.setOnClickListener { | 314 | btnBorrarInv.setOnClickListener { |
| 311 | AlertDialog.Builder(requireContext()).setTitle("Eliminación de Inventarios").setMessage("¿Confirma que desea eliminar el inventario?") | 315 | AlertDialog.Builder(requireContext()).setTitle("Eliminación de Inventarios").setMessage("¿Confirma que desea eliminar el inventario?") |
| 312 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | 316 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> |
| 313 | BorrarInvActual() | 317 | BorrarInvActual() |
| 314 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | 318 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() |
| 315 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 319 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
| 316 | InventarioNuevo = 0 | 320 | InventarioNuevo = 0 |
| 317 | 321 | ||
| 318 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> | 322 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> |
| 319 | //botón cancel pulsado | 323 | //botón cancel pulsado |
| 320 | }).show() | 324 | }).show() |
| 321 | } | 325 | } |
| 322 | 326 | ||
| 323 | btnExportarInv.setOnClickListener { | 327 | btnExportarInv.setOnClickListener { |
| 324 | AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar) | 328 | AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar) |
| 325 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | 329 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> |
| 326 | BorrarInvActual() | 330 | BorrarInvActual() |
| 327 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | 331 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() |
| 328 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 332 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
| 329 | InventarioNuevo = 0 | 333 | InventarioNuevo = 0 |
| 330 | 334 | ||
| 331 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> }).show() | 335 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> }).show() |
| 332 | } | 336 | } |
| 333 | ivCamara.setOnClickListener { | 337 | ivCamara.setOnClickListener { |
| 334 | if (!bFirst) { | 338 | if (!bFirst) { |
| 335 | iEstado = 1 | 339 | iEstado = 1 |
| 336 | bFirst = true | 340 | bFirst = true |
| 337 | } | 341 | } |
| 338 | 342 | ||
| 339 | when (iEstado) { | 343 | when (iEstado) { |
| 340 | 0 -> { | 344 | 0 -> { |
| 341 | ivCamara.setImageResource(R.drawable.codbar) | 345 | ivCamara.setImageResource(R.drawable.codbar) |
| 342 | etCodigoBarras.hint = "Busqueda por C. Barras" | 346 | etCodigoBarras.hint = "Busqueda por C. Barras" |
| 343 | swSumaUno.visibility = View.VISIBLE | 347 | swSumaUno.visibility = View.VISIBLE |
| 344 | iBusquedaPor = 0 | 348 | iBusquedaPor = 0 |
| 345 | iEstado = 1 | 349 | iEstado = 1 |
| 346 | } | 350 | } |
| 347 | 1 -> { | 351 | 1 -> { |
| 348 | ivCamara.setImageResource(R.drawable.desc) | 352 | ivCamara.setImageResource(R.drawable.desc) |
| 349 | etCodigoBarras.hint = "Busqueda por Descripción" | 353 | etCodigoBarras.hint = "Busqueda por Descripción" |
| 350 | swSumaUno.visibility = View.GONE | 354 | swSumaUno.visibility = View.GONE |
| 351 | iBusquedaPor = 1 | 355 | iBusquedaPor = 1 |
| 352 | iEstado = 2 | 356 | iEstado = 2 |
| 353 | } | 357 | } |
| 354 | 2 -> { | 358 | 2 -> { |
| 355 | ivCamara.setImageResource(R.drawable.cod_origen) | 359 | ivCamara.setImageResource(R.drawable.cod_origen) |
| 356 | etCodigoBarras.hint = "Busqueda por C. Origen" | 360 | etCodigoBarras.hint = "Busqueda por C. Origen" |
| 357 | swSumaUno.visibility = View.GONE | 361 | swSumaUno.visibility = View.GONE |
| 358 | iBusquedaPor = 2 | 362 | iBusquedaPor = 2 |
| 359 | iEstado = 0 | 363 | iEstado = 0 |
| 360 | } | 364 | } |
| 361 | } | 365 | } |
| 362 | } | 366 | } |
| 363 | } | 367 | } |
| 364 | 368 | ||
| 365 | private fun BorrarInvActual() { | 369 | private fun BorrarInvActual() { |
| 366 | lifecycleScope.launch { | 370 | lifecycleScope.launch { |
| 367 | withContext(Dispatchers.IO) { | 371 | withContext(Dispatchers.IO) { |
| 368 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) | 372 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo.toLong()) |
| 369 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) | 373 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo.toLong()) |
| 370 | } | 374 | } |
| 371 | } | 375 | } |
| 372 | } | 376 | } |
| 373 | 377 | ||
| 374 | private fun CargarDeBdInventario(ultimoInv: Int) { | 378 | private fun CargarDeBdInventario(ultimoInv: Int) { |
| 375 | GlobalScope.launch(Dispatchers.Main) { | 379 | GlobalScope.launch(Dispatchers.Main) { |
| 376 | val invbody = cargarInventario(ultimoInv) | 380 | val invbody = cargarInventario(ultimoInv) |
| 377 | for ((i, _) in invbody!!.withIndex()) { | 381 | for ((i, _) in invbody!!.withIndex()) { |
| 378 | val art = Articles(invbody[i].sector, | 382 | val art = Articles(invbody[i].sector, |
| 379 | invbody[i].codigo, | 383 | invbody[i].codigo, |
| 380 | invbody[i].descripcion, | 384 | invbody[i].descripcion, |
| 381 | invbody[i].codBar, | 385 | invbody[i].codBar, |
| 382 | invbody[i].codOrigen, | 386 | invbody[i].codOrigen, |
| 383 | invbody[i].precio, | 387 | invbody[i].precio, |
| 384 | invbody[i].costo, | 388 | invbody[i].costo, |
| 385 | "", | 389 | "", |
| 386 | "", | 390 | "", |
| 387 | "", | 391 | "", |
| 388 | invbody[i].balanza, | 392 | invbody[i].balanza, |
| 389 | invbody[i].depSn, | 393 | invbody[i].depSn, |
| 390 | invbody[i].costo) | 394 | invbody[i].costo) |
| 391 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) | 395 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) |
| 392 | } | 396 | } |
| 393 | } | 397 | } |
| 394 | } | 398 | } |
| 395 | 399 | ||
| 396 | private fun ContinuarCargaCodigoOri(artAcargar:List<Articles>) { | 400 | private fun ContinuarCargaCodigoOri(artAcargar:List<Articles>) { |
| 397 | 401 | ||
| 398 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | 402 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD |
| 399 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 403 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
| 400 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 404 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 401 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 405 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 402 | 406 | ||
| 403 | var bundle = Bundle() | 407 | var bundle = Bundle() |
| 404 | bundle = bundleOf("ArrayDesc" to artAcargar) | 408 | bundle = bundleOf("ArrayDesc" to artAcargar) |
| 405 | bundle.putInt("numeroInv", InventarioNuevo) | 409 | bundle.putInt("numeroInv", InventarioNuevo) |
| 406 | navController.navigate(R.id.action_inventarioFragment_to_codigoOriFragment, bundle) | 410 | navController.navigate(R.id.action_inventarioFragment_to_codigoOriFragment, bundle) |
| 407 | 411 | ||
| 408 | } else {//TODO si no lo encuentra en la BD | 412 | } else {//TODO si no lo encuentra en la BD |
| 409 | val modalDialog = NoEncontradoSimple() | 413 | val modalDialog = NoEncontradoSimple() |
| 410 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 414 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 411 | } | 415 | } |
| 412 | etCodigoBarras.focusable = View.FOCUSABLE | 416 | etCodigoBarras.focusable = View.FOCUSABLE |
| 413 | etCodigoBarras.setText("") | 417 | etCodigoBarras.setText("") |
| 414 | etCodigoBarras.selectAll() | 418 | etCodigoBarras.selectAll() |
| 415 | } | 419 | } |
| 416 | 420 | ||
| 417 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { | 421 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { |
| 418 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS | 422 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS |
| 419 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV | 423 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV |
| 420 | 424 | ||
| 421 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | 425 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD |
| 422 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 426 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
| 423 | // fCant = 0F | 427 | // fCant = 0F |
| 424 | // fCant += 1F | 428 | // fCant += 1F |
| 425 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 429 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
| 426 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 430 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
| 427 | // artAcargar[0].codigo, | 431 | // artAcargar[0].codigo, |
| 428 | // artAcargar[0].descripcion, | 432 | // artAcargar[0].descripcion, |
| 429 | // artAcargar[0].codBar, | 433 | // artAcargar[0].codBar, |
| 430 | // artAcargar[0].codOrigen, | 434 | // artAcargar[0].codOrigen, |
| 431 | // artAcargar[0].precio, | 435 | // artAcargar[0].precio, |
| 432 | // artAcargar[0].costo, | 436 | // artAcargar[0].costo, |
| 433 | // "", | 437 | // "", |
| 434 | // "", | 438 | // "", |
| 435 | // "", | 439 | // "", |
| 436 | // artAcargar[0].balanza, | 440 | // artAcargar[0].balanza, |
| 437 | // artAcargar[0].depSn, | 441 | // artAcargar[0].depSn, |
| 438 | // "") | 442 | // "") |
| 439 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 443 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
| 440 | // cargarArtEnBd(acargarPorDesc, fCant) | 444 | // cargarArtEnBd(acargarPorDesc, fCant) |
| 441 | // cargarRecicler(acargarPorDesc, fCant) | 445 | // cargarRecicler(acargarPorDesc, fCant) |
| 442 | // } else { | 446 | // } else { |
| 443 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 447 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
| 444 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 448 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 445 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 449 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 446 | var bundle = Bundle() | 450 | var bundle = Bundle() |
| 447 | bundle = bundleOf("ArrayDesc" to artAcargar) | 451 | bundle = bundleOf("ArrayDesc" to artAcargar) |
| 448 | bundle.putInt("numeroInv", InventarioNuevo) | 452 | bundle.putInt("numeroInv", InventarioNuevo) |
| 449 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 453 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
| 450 | //navController.backStack.removeLast() | 454 | //navController.backStack.removeLast() |
| 451 | // } | 455 | // } |
| 452 | // } else {//SI NO ESTA +1 | 456 | // } else {//SI NO ESTA +1 |
| 453 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 457 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
| 454 | // fCant = listArticulos[0].cantTomada | 458 | // fCant = listArticulos[0].cantTomada |
| 455 | // MaterialDialog(requireContext()).show { | 459 | // MaterialDialog(requireContext()).show { |
| 456 | // title(R.string.sTituloNueva) | 460 | // title(R.string.sTituloNueva) |
| 457 | // message(R.string.sCantidadNueva) | 461 | // message(R.string.sCantidadNueva) |
| 458 | // input { materialDialog, charSequence -> | 462 | // input { materialDialog, charSequence -> |
| 459 | // fCant = 0F | 463 | // fCant = 0F |
| 460 | // fCant = charSequence.toString().toFloat() | 464 | // fCant = charSequence.toString().toFloat() |
| 461 | // } | 465 | // } |
| 462 | // positiveButton(R.string.btnOk) { | 466 | // positiveButton(R.string.btnOk) { |
| 463 | // listArticulos[0].cantTomada = fCant | 467 | // listArticulos[0].cantTomada = fCant |
| 464 | // viewAdapter.notifyDataSetChanged() | 468 | // viewAdapter.notifyDataSetChanged() |
| 465 | // dismiss() | 469 | // dismiss() |
| 466 | // } | 470 | // } |
| 467 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 471 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 468 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 472 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
| 469 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 473 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
| 470 | // artAcargar[0].codigo, | 474 | // artAcargar[0].codigo, |
| 471 | // artAcargar[0].descripcion, | 475 | // artAcargar[0].descripcion, |
| 472 | // artAcargar[0].codBar, | 476 | // artAcargar[0].codBar, |
| 473 | // artAcargar[0].cod_origen, | 477 | // artAcargar[0].cod_origen, |
| 474 | // artAcargar[0].precio, | 478 | // artAcargar[0].precio, |
| 475 | // artAcargar[0].costo, | 479 | // artAcargar[0].costo, |
| 476 | // artAcargar[0].balanza, | 480 | // artAcargar[0].balanza, |
| 477 | // artAcargar[0].depSn, | 481 | // artAcargar[0].depSn, |
| 478 | // "") | 482 | // "") |
| 479 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 483 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
| 480 | // cargarArtEnBd(acargarPorDesc, fCant) | 484 | // cargarArtEnBd(acargarPorDesc, fCant) |
| 481 | // cargarRecicler(acargarPorDesc, fCant) | 485 | // cargarRecicler(acargarPorDesc, fCant) |
| 482 | // } else { | 486 | // } else { |
| 483 | // var bundle = Bundle() | 487 | // var bundle = Bundle() |
| 484 | // bundle = bundleOf("ArrayDesc" to artAcargar) | 488 | // bundle = bundleOf("ArrayDesc" to artAcargar) |
| 485 | // bundle.putInt("numeroInv", InventarioNuevo) | 489 | // bundle.putInt("numeroInv", InventarioNuevo) |
| 486 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 490 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
| 487 | // } | 491 | // } |
| 488 | // } | 492 | // } |
| 489 | } else {//TODO si no lo encuentra en la BD | 493 | } else {//TODO si no lo encuentra en la BD |
| 490 | val modalDialog = NoEncontradoSimple() | 494 | val modalDialog = NoEncontradoSimple() |
| 491 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 495 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 492 | } | 496 | } |
| 493 | etCodigoBarras.focusable = View.FOCUSABLE | 497 | etCodigoBarras.focusable = View.FOCUSABLE |
| 494 | etCodigoBarras.setText("") | 498 | etCodigoBarras.setText("") |
| 495 | etCodigoBarras.selectAll() | 499 | etCodigoBarras.selectAll() |
| 496 | } | 500 | } |
| 497 | 501 | ||
| 498 | private fun ContinuarCargaCB(artAcargar: Articles?) { | 502 | private fun ContinuarCargaCB(artAcargar: Articles?) { |
| 499 | 503 | ||
| 500 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD | 504 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD |
| 501 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 | 505 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 |
| 502 | fCant = 0F | 506 | fCant = 0F |
| 503 | fCant += 1F | 507 | fCant += 1F |
| 504 | cargarArtEnBd(artAcargar, String.format("%.3f", fCant)) | 508 | cargarArtEnBd(artAcargar, String.format("%.3f", fCant)) |
| 505 | cargarRecicler(artAcargar, fCant) | 509 | cargarRecicler(artAcargar, fCant) |
| 506 | } else {//TODO: SI NO ESTA +1 PREGUNTA CANTIDAD | 510 | } else {//TODO: SI NO ESTA +1 PREGUNTA CANTIDAD |
| 507 | 511 | ||
| 508 | DialogingresarCantidad(requireContext(), artAcargar) | 512 | DialogingresarCantidad(requireContext(), artAcargar) |
| 509 | 513 | ||
| 510 | } | 514 | } |
| 511 | } else {// TODO si no lo encuentra en la BD | 515 | } else {// TODO si no lo encuentra en la BD |
| 512 | val modalDialog = NoEncontradoSimple() | 516 | val modalDialog = NoEncontradoSimple() |
| 513 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 517 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 514 | } | 518 | } |
| 515 | etCodigoBarras.focusable = View.FOCUSABLE | 519 | etCodigoBarras.focusable = View.FOCUSABLE |
| 516 | etCodigoBarras.setText("") | 520 | etCodigoBarras.setText("") |
| 517 | etCodigoBarras.selectAll() | 521 | etCodigoBarras.selectAll() |
| 518 | } | 522 | } |
| 519 | 523 | ||
| 520 | fun DialogingresarCantidad(cnxt: Context, artAcargar: Articles?): Float { | 524 | fun DialogingresarCantidad(cnxt: Context, artAcargar: Articles?): Float { |
| 521 | var cantidad = 0F | 525 | var cantidad = 0F |
| 522 | val mDialogView = LayoutInflater.from(cnxt).inflate(R.layout.ingresar_cantidad, null) | 526 | val mDialogView = LayoutInflater.from(cnxt).inflate(R.layout.ingresar_cantidad, null) |
| 523 | val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView).setCancelable(false) | 527 | val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView).setCancelable(false) |
| 524 | if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER | 528 | if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER |
| 525 | mDialogView.tvTitulo.text = artAcargar.descripcion.toString() | 529 | mDialogView.tvTitulo.text = artAcargar.descripcion.toString() |
| 526 | val mAlertDialog = mBuilder.show() | 530 | val mAlertDialog = mBuilder.show() |
| 531 | |||
| 527 | mDialogView.etCantidad.requestFocus() | 532 | mDialogView.etCantidad.requestFocus() |
| 528 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 533 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 529 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 534 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 530 | 535 | ||
| 531 | |||
| 532 | mDialogView.btnAceptar.setOnClickListener { | 536 | mDialogView.btnAceptar.setOnClickListener { |
| 533 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | 537 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 534 | mDialogView.etCantidad.error = "No vacio" | 538 | mDialogView.etCantidad.error = "No vacio" |
| 535 | mDialogView.etCantidad.requestFocus() | 539 | mDialogView.etCantidad.requestFocus() |
| 536 | mDialogView.etCantidad.hint = "Ingrese un valor" | 540 | mDialogView.etCantidad.hint = "Ingrese un valor" |
| 537 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | 541 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 538 | mAlertDialog.dismiss() | 542 | mAlertDialog.dismiss() |
| 539 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | 543 | cantidad = mDialogView.etCantidad.text.toString().toFloat() |
| 540 | cargarArtEnBd(artAcargar, String.format("%.2f", cantidad)) | 544 | cargarArtEnBd(artAcargar, String.format("%.2f", cantidad)) |
| 541 | cargarRecicler(artAcargar, cantidad) | 545 | cargarRecicler(artAcargar, cantidad) |
| 542 | modificarCantidadEnCabecera(InventarioNuevo, true, requireContext()) | 546 | modificarCantidadEnCabecera(InventarioNuevo, true, requireContext()) |
| 543 | } | 547 | } |
| 544 | } | 548 | } |
| 545 | return cantidad | 549 | return cantidad |
| 546 | } | 550 | } |
| 547 | 551 | ||
| 548 | fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) { | 552 | fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) { |
| 549 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 553 | |
| 550 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[indiceDelArtEncontrado].descripcion} se encuentra cargado.").setCancelable(cancelable) | 554 | mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| 555 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(cancelable) | ||
| 551 | // TODO: SI PERMITE QUE INGRESE DECIMALES | 556 | // TODO: SI PERMITE QUE INGRESE DECIMALES |
| 552 | if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER | 557 | if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER |
| 553 | 558 | mDialogView.tvTitulo2.text="${listArticulos[indiceDelArtEncontrado].descripcion}" | |
| 554 | mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada) | 559 | mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada) |
| 555 | val mAlertDialog = mBuilder.show() | 560 | val mAlertDialog = mBuilder.show() |
| 556 | mDialogView.tvNuevaCantidad.requestFocus() | 561 | mDialogView.tvNuevaCantidad.requestFocus() |
| 557 | 562 | ||
| 558 | 563 | ||
| 559 | 564 | ||
| 560 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 565 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 561 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 566 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 562 | 567 | ||
| 568 | mDialogView.tvNuevaCantidad.addTextChangedListener(textWatcher) | ||
| 569 | |||
| 563 | mDialogView.rbSumar.setOnClickListener { | 570 | mDialogView.rbSumar.setOnClickListener { |
| 564 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 571 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 565 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 572 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
| 566 | mDialogView.tvNuevaCantidad.isEnabled = false | 573 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 567 | } | 574 | } |
| 568 | } | 575 | } |
| 569 | mDialogView.rbRestar.setOnClickListener { | 576 | mDialogView.rbRestar.setOnClickListener { |
| 570 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 577 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 571 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 578 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
| 572 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 579 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
| 573 | mDialogView.tvNuevaCantidad.isEnabled = false | 580 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 574 | } else { | 581 | } else { |
| 575 | mDialogView.tvResultado.text = "" | 582 | mDialogView.tvResultado.text = "" |
| 576 | mDialogView.tvResultado.error = "Operación No Valida" | 583 | mDialogView.tvResultado.error = "Operación No Valida" |
| 577 | mDialogView.tvResultado.requestFocus() | 584 | mDialogView.tvResultado.requestFocus() |
| 578 | mDialogView.tvResultado.hint = "Error" | 585 | mDialogView.tvResultado.hint = "Error" |
| 579 | } | 586 | } |
| 580 | } | 587 | } |
| 581 | } | 588 | } |
| 582 | mDialogView.rbMdodificar.setOnClickListener { | 589 | mDialogView.rbMdodificar.setOnClickListener { |
| 583 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 590 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 584 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 591 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
| 585 | mDialogView.tvNuevaCantidad.isEnabled = false | 592 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 586 | } | 593 | } |
| 587 | } | 594 | } |
| 588 | mDialogView.btnAceptar.setOnClickListener { | 595 | mDialogView.btnAceptar.setOnClickListener { |
| 589 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | 596 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { |
| 590 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | 597 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { |
| 591 | mAlertDialog.dismiss() | 598 | mAlertDialog.dismiss() |
| 592 | listArticulos[indiceDelArtEncontrado].cantTomada = String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() | 599 | listArticulos[indiceDelArtEncontrado].cantTomada = String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() |
| 593 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), | 600 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), |
| 594 | listArticulos[indiceDelArtEncontrado].codigo.toString(), | 601 | listArticulos[indiceDelArtEncontrado].codigo.toString(), |
| 595 | String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat()) | 602 | String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat()) |
| 596 | 603 | ||
| 597 | viewAdapter.notifyDataSetChanged() | 604 | viewAdapter.notifyDataSetChanged() |
| 598 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 605 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { |
| 599 | mDialogView.tvResultado.error = "Operación Requerida" | 606 | mDialogView.tvResultado.error = "Operación Requerida" |
| 600 | mDialogView.tvResultado.requestFocus() | 607 | mDialogView.tvResultado.requestFocus() |
| 601 | mDialogView.tvResultado.hint = "Seleccione Operación" | 608 | mDialogView.tvResultado.hint = "Seleccione Operación" |
| 602 | } | 609 | } |
| 603 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 610 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { |
| 604 | mDialogView.tvNuevaCantidad.error = "Completar" | 611 | mDialogView.tvNuevaCantidad.error = "Completar" |
| 605 | mDialogView.tvNuevaCantidad.requestFocus() | 612 | mDialogView.tvNuevaCantidad.requestFocus() |
| 606 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | 613 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" |
| 607 | } | 614 | } |
| 608 | } | 615 | } |
| 609 | mDialogView.dialogCancelBtn.setOnClickListener { | 616 | mDialogView.dialogCancelBtn.setOnClickListener { |
| 610 | mAlertDialog.dismiss() | 617 | mAlertDialog.dismiss() |
| 611 | } | 618 | } |
| 612 | } | 619 | } |
| 613 | 620 | ||
| 614 | suspend fun buscarCodiogoOriEnBD(CodOri: String): List<Articles> { | 621 | suspend fun buscarCodiogoOriEnBD(CodOri: String): List<Articles> { |
| 615 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 622 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 616 | var busqueda: List<Articles> | 623 | var busqueda: List<Articles> |
| 617 | return GlobalScope.async(Dispatchers.IO) { | 624 | return GlobalScope.async(Dispatchers.IO) { |
| 618 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodOri(CodOri, SerchAreaInventario()) | 625 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodOri(CodOri, SerchAreaInventario()) |
| 619 | return@async busqueda | 626 | return@async busqueda |
| 620 | }.await() | 627 | }.await() |
| 621 | } | 628 | } |
| 622 | 629 | ||
| 623 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { | 630 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { |
| 624 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 631 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 625 | var busqueda: Articles? = null | 632 | var busqueda: Articles? = null |
| 626 | return GlobalScope.async(IO) { | 633 | return GlobalScope.async(IO) { |
| 627 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, SerchAreaInventario()) | 634 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, SerchAreaInventario()) |
| 628 | return@async busqueda | 635 | return@async busqueda |
| 629 | }.await() | 636 | }.await() |
| 630 | } | 637 | } |
| 631 | 638 | ||
| 632 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { | 639 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { |
| 633 | //TODO BUSQUEDA POR DESCRIPCION | 640 | //TODO BUSQUEDA POR DESCRIPCION |
| 634 | var busqueda: List<Articles>? = null | 641 | var busqueda: List<Articles>? = null |
| 635 | return GlobalScope.async(Dispatchers.IO) { | 642 | return GlobalScope.async(Dispatchers.IO) { |
| 636 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, SerchAreaInventario()) | 643 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, SerchAreaInventario()) |
| 637 | return@async busqueda | 644 | return@async busqueda |
| 638 | }.await() | 645 | }.await() |
| 639 | } | 646 | } |
| 640 | 647 | ||
| 641 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { | 648 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { |
| 642 | //TODO BUSQUEDA POR DESCRIPCION | 649 | //TODO BUSQUEDA POR DESCRIPCION |
| 643 | var result: Int | 650 | var result: Int |
| 644 | return GlobalScope.async(IO) { | 651 | return GlobalScope.async(IO) { |
| 645 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo, inventario) | 652 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector.toLong(), codigo.toLong(), inventario.toLong()) |
| 646 | return@async result | 653 | return@async result |
| 647 | }.await() | 654 | }.await() |
| 648 | } | 655 | } |
| 649 | 656 | ||
| 650 | private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | 657 | private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { |
| 651 | return GlobalScope.async(IO) { | 658 | return GlobalScope.async(IO) { |
| 652 | var indice = 0 | 659 | var indice = 0 |
| 653 | var bEncontrado = false | 660 | var bEncontrado = false |
| 654 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | 661 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS |
| 655 | // TODO CAMBIO DE CB A CODIGO DEBO | 662 | // TODO CAMBIO DE CB A CODIGO DEBO |
| 656 | val any = cambioCBporCodigoDebo(codigoBarras) | 663 | val any = cambioCBporCodigoDebo(codigoBarras) |
| 657 | if (any != null) { | 664 | if (any != null) { |
| 658 | for (item in listArticulos) { | 665 | for (item in listArticulos) { |
| 659 | if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { | 666 | if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { |
| 660 | bEncontrado = true | 667 | bEncontrado = true |
| 661 | break | 668 | break |
| 662 | } | 669 | } |
| 663 | indice += 1 | 670 | indice += 1 |
| 664 | } | 671 | } |
| 665 | } | 672 | } |
| 666 | 673 | ||
| 667 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | 674 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION |
| 668 | for (item in listArticulos) { | 675 | for (item in listArticulos) { |
| 669 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 676 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
| 670 | bEncontrado = true | 677 | bEncontrado = true |
| 671 | break | 678 | break |
| 672 | } | 679 | } |
| 673 | indice += 1 | 680 | indice += 1 |
| 674 | } | 681 | } |
| 675 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | 682 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN |
| 676 | for (item in listArticulos) { | 683 | for (item in listArticulos) { |
| 677 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 684 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
| 678 | bEncontrado = true | 685 | bEncontrado = true |
| 679 | break | 686 | break |
| 680 | } | 687 | } |
| 681 | indice += 1 | 688 | indice += 1 |
| 682 | } | 689 | } |
| 683 | } | 690 | } |
| 684 | return@async if (bEncontrado) indice else -1 | 691 | return@async if (bEncontrado) indice else -1 |
| 685 | }.await() | 692 | }.await() |
| 686 | } | 693 | } |
| 687 | 694 | ||
| 688 | suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { | 695 | suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { |
| 689 | //TODO BUSQUEDA POR DESCRIPCION | 696 | //TODO BUSQUEDA POR DESCRIPCION |
| 690 | var busqueda: Articles? = null | 697 | var busqueda: Articles? = null |
| 691 | return GlobalScope.async(IO) { | 698 | return GlobalScope.async(IO) { |
| 692 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchArea()) | 699 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchAreaInventario()) |
| 693 | return@async busqueda | 700 | return@async busqueda |
| 694 | }.await() | 701 | }.await() |
| 695 | } | 702 | } |
| 696 | 703 | ||
| 697 | private fun cargarArtEnBd(articulos: Articles, cant: String) { | 704 | private fun cargarArtEnBd(articulos: Articles, cant: String) { |
| 698 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD | 705 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD |
| 699 | articulos.sector, | 706 | articulos.sector, |
| 700 | articulos.codigo, | 707 | articulos.codigo, |
| 701 | articulos.descripcion, | 708 | articulos.descripcion, |
| 702 | cant, | 709 | cant, |
| 703 | articulos.codBar, | 710 | articulos.codBar, |
| 704 | articulos.codOrigen, | 711 | articulos.codOrigen, |
| 705 | articulos.precio, | 712 | articulos.precio, |
| 706 | articulos.precio, | 713 | articulos.precio, |
| 707 | articulos.balanza, | 714 | articulos.balanza, |
| 708 | articulos.depSn, | 715 | articulos.depSn, |
| 709 | ObtenerFechaActual(), | 716 | ObtenerFechaActual(), |
| 710 | ObtenerFechaActual()) | 717 | ObtenerFechaActual()) |
| 711 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS | 718 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS |
| 712 | } | 719 | } |
| 713 | 720 | ||
| 714 | fun cargarRecicler(articulos: Articles, cant: Float) { | 721 | fun cargarRecicler(articulos: Articles, cant: Float) { |
| 715 | //TODO CARGO EN LE RV | 722 | //TODO CARGO EN LE RV |
| 716 | val item = ItemsRecycler(if (articulos.sector.toString().toInt()<9) "0${articulos.sector.toString()}" else articulos.sector.toString() | 723 | val item = ItemsRecycler(if (articulos.sector.toString().toInt()<9) "0${articulos.sector.toString()}" else articulos.sector.toString() |
| 717 | , articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen, articulos.balanza.toString(), articulos.de.toString()) | 724 | , articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen, articulos.balanza.toString(), articulos.de.toString()) |
| 718 | listArticulos.add(item) | 725 | listArticulos.add(item) |
| 719 | 726 | ||
| 720 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) | 727 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) |
| 721 | viewManager = LinearLayoutManager(requireContext()) | 728 | viewManager = LinearLayoutManager(requireContext()) |
| 722 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 729 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
| 723 | rcInventarios.apply { | 730 | rcInventarios.apply { |
| 724 | adapter = viewAdapter | 731 | adapter = viewAdapter |
| 725 | layoutManager = viewManager | 732 | layoutManager = viewManager |
| 726 | } | 733 | } |
| 727 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 734 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
| 728 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 735 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
| 729 | return false | 736 | return false |
| 730 | } | 737 | } |
| 731 | 738 | ||
| 732 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | 739 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
| 733 | 740 | ||
| 734 | GlobalScope.launch(Dispatchers.Main) { | 741 | GlobalScope.launch(Dispatchers.Main) { |
| 735 | borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) | 742 | borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) |
| 736 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | 743 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) |
| 737 | viewAdapter.notifyDataSetChanged() | 744 | viewAdapter.notifyDataSetChanged() |
| 738 | modificarCantidadEnCabecera(InventarioNuevo, false, requireContext()) | 745 | modificarCantidadEnCabecera(InventarioNuevo, false, requireContext()) |
| 739 | } | 746 | } |
| 740 | } | 747 | } |
| 741 | 748 | ||
| 742 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 749 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
| 743 | val itemView = viewHolder.itemView | 750 | val itemView = viewHolder.itemView |
| 744 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 751 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
| 745 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 752 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
| 746 | 753 | ||
| 747 | if (dX > 0) { | 754 | if (dX > 0) { |
| 748 | 755 | ||
| 749 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 756 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
| 750 | else c.drawColor(Color.RED) | 757 | else c.drawColor(Color.RED) |
| 751 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 758 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
| 752 | } else { | 759 | } else { |
| 753 | } | 760 | } |
| 754 | 761 | ||
| 755 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 762 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 756 | deleteIcon.draw(c) | 763 | deleteIcon.draw(c) |
| 757 | } | 764 | } |
| 758 | } | 765 | } |
| 759 | 766 | ||
| 760 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 767 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
| 761 | itemTouchHelper.attachToRecyclerView(rcInventarios) | 768 | itemTouchHelper.attachToRecyclerView(rcInventarios) |
| 762 | } | 769 | } |
| 763 | 770 | ||
| 764 | private fun ProdNoCont(): Int? { | 771 | private fun ProdNoCont(): Int? { |
| 765 | var mostrarStock = 0 | 772 | var mostrarStock = 0 |
| 766 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 | 773 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 |
| 767 | return mostrarStock | 774 | return mostrarStock |
| 768 | } | 775 | } |
| 769 | 776 | ||
| 770 | private fun AjusteProductos(): Int? { | 777 | private fun AjusteProductos(): Int? { |
| 771 | var prodInclu = 0 | 778 | var prodInclu = 0 |
| 772 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 | 779 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 |
| 773 | 780 | ||
| 774 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 | 781 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 |
| 775 | return prodInclu | 782 | return prodInclu |
| 776 | } | 783 | } |
| 777 | 784 | ||
| 778 | private fun SerchArea(): Boolean { | 785 | private fun SerchArea(): Boolean { |
| 779 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea =false | 786 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea =false |
| 780 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = true | 787 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = true |
| 781 | return iArea | 788 | return iArea |
| 782 | } | 789 | } |
| 790 | |||
| 783 | suspend fun SerchAreaInventario(): Boolean { | 791 | suspend fun SerchAreaInventario(): Boolean { |
| 784 | return GlobalScope.async(IO) { | 792 | return GlobalScope.async(IO) { |
| 785 | return@async AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.fetchAreaInvH(InventarioNuevo) | 793 | return@async AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.fetchAreaInvH(InventarioNuevo.toLong()) |
| 786 | }.await() | 794 | }.await() |
| 787 | 795 | ||
| 788 | } | 796 | } |
| 797 | |||
| 789 | fun ObtenerFechaActual(): String? { | 798 | fun ObtenerFechaActual(): String? { |
| 790 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD | 799 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD |
| 791 | val current = LocalDateTime.now() | 800 | val current = LocalDateTime.now() |
| 792 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") | 801 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") |
| 793 | val dFechaHora = current.format(formatter) | 802 | val dFechaHora = current.format(formatter) |
| 794 | return dFechaHora.toString() | 803 | return dFechaHora.toString() |
| 795 | } | 804 | } |
| 796 | 805 | ||
| 797 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 806 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
| 798 | lifecycleScope.launch { | 807 | lifecycleScope.launch { |
| 799 | withContext(Dispatchers.IO) { | 808 | withContext(Dispatchers.IO) { |
| 800 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 809 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
| 801 | } | 810 | } |
| 802 | } | 811 | } |
| 803 | } | 812 | } |
| 804 | 813 | ||
| 805 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 814 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
| 806 | lifecycleScope.launch { | 815 | lifecycleScope.launch { |
| 807 | withContext(Dispatchers.IO) { | 816 | withContext(Dispatchers.IO) { |
| 808 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | 817 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector.toLong(), codigo.toLong()) |
| 809 | } | 818 | } |
| 810 | } | 819 | } |
| 811 | } | 820 | } |
| 812 | 821 | ||
| 813 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { | 822 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { |
| 814 | return GlobalScope.async(Dispatchers.IO) { | 823 | return GlobalScope.async(Dispatchers.IO) { |
| 815 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) | 824 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) |
| 816 | }.await() | 825 | }.await() |
| 817 | } | 826 | } |
| 818 | 827 | ||
| 819 | override fun onImageDotsClick(sector: String?, codigo: String?) { | 828 | override fun onImageDotsClick(sector: String?, codigo: String?) { |
| 820 | val bundle = Bundle() | 829 | val bundle = Bundle() |
| 821 | bundle.putString("sector", sector!!.toInt().toString()) | 830 | bundle.putString("sector", sector!!.toInt().toString()) |
| 822 | bundle.putString("codigo", codigo) | 831 | bundle.putString("codigo", codigo) |
| 823 | bundle.putInt("numeroInv", InventarioNuevo) | 832 | bundle.putInt("numeroInv", InventarioNuevo) |
| 824 | navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) | 833 | navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) |
| 825 | } | 834 | } |
| 826 | 835 | ||
| 827 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { | 836 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { |
| 828 | dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true) | 837 | dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true) |
| 829 | } | 838 | } |
| 839 | |||
| 840 | private val textWatcher = object : TextWatcher { | ||
| 841 | override fun afterTextChanged(s: Editable?) { | ||
| 842 | } | ||
| 843 | |||
| 844 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { | ||
| 845 | } | ||
| 846 | |||
| 847 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { | ||
| 848 | if(mDialogView.rbSumar.isChecked){ | ||
| 849 | // mDialogView.tvNuevaCantidad.isEnabled=false | ||
| 850 | mDialogView.tvResultado.text=String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()+ mDialogView.tvCantInicial.text.toString().toFloat()) | ||
| 851 | } | ||
| 852 | if(mDialogView.rbRestar.isChecked) { | ||
| 853 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
| 854 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
| 855 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
| 856 | // mDialogView.tvNuevaCantidad.isEnabled = false | ||
| 857 | } else { | ||
| 858 | mDialogView.tvResultado.text = "" | ||
| 859 | mDialogView.tvResultado.error = "Operación No Valida" | ||
| 860 | mDialogView.tvResultado.requestFocus() | ||
| 861 | mDialogView.tvResultado.hint = "Error" | ||
| 862 | } | ||
| 863 | } | ||
| 864 | } | ||
| 865 | if(mDialogView.rbMdodificar.isChecked) { | ||
| 866 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
| 867 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
| 868 | // mDialogView.tvNuevaCantidad.isEnabled = false | ||
| 869 | } | ||
| 870 | } | ||
| 871 | |||
| 872 | } | ||
| 873 | } | ||
| 830 | } | 874 | } |
| 831 | 875 | ||
| 832 | 876 | ||
| 833 | 877 | ||
| 834 | 878 | ||
| 835 | 879 | ||
| 836 | 880 | ||
| 837 | 881 | ||
| 838 | 882 | ||
| 839 | 883 | ||
| 840 | 884 | ||
| 841 | 885 | ||
| 842 | 886 | ||
| 843 | 887 | ||
| 844 | 888 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/main/InventarioListAdapter.kt
| 1 | package com.focasoftware.deboinventariov20.UI.main | 1 | package com.focasoftware.deboinventariov20.UI.main |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import android.view.LayoutInflater | 4 | import android.view.LayoutInflater |
| 5 | import android.view.View | 5 | import android.view.View |
| 6 | import android.view.ViewGroup | 6 | import android.view.ViewGroup |
| 7 | import android.widget.Filter | 7 | import android.widget.Filter |
| 8 | import android.widget.Filterable | 8 | import android.widget.Filterable |
| 9 | import androidx.recyclerview.widget.RecyclerView | 9 | import androidx.recyclerview.widget.RecyclerView |
| 10 | import com.focasoftware.deboinventariov20.Model.InvHead | 10 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 11 | import com.focasoftware.deboinventariov20.R | 11 | import com.focasoftware.deboinventariov20.R |
| 12 | import com.focasoftware.deboinventariov20.UI.Utils.BaseViewHolder | 12 | import com.focasoftware.deboinventariov20.UI.Utils.BaseViewHolder |
| 13 | import kotlinx.android.synthetic.main.item_principal.view.* | 13 | import kotlinx.android.synthetic.main.item_principal.view.* |
| 14 | import java.util.* | 14 | import java.util.* |
| 15 | import kotlin.collections.ArrayList | 15 | import kotlin.collections.ArrayList |
| 16 | 16 | ||
| 17 | class InventarioListAdapter(private val context: Context, private val inv: List<InvHead>, private val itemClickListener: OnInventarioClickListener) : | 17 | class InventarioListAdapter(private val context: Context, private val inv: List<InvHead>, private val itemClickListener: OnInventarioClickListener) : |
| 18 | RecyclerView.Adapter<BaseViewHolder<*>>(), Filterable { | 18 | RecyclerView.Adapter<BaseViewHolder<*>>() { |
| 19 | var invFiltrados: List<InvHead> | 19 | |
| 20 | init { | ||
| 21 | invFiltrados=inv | ||
| 22 | } | ||
| 23 | interface OnInventarioClickListener { | 20 | interface OnInventarioClickListener { |
| 24 | fun onItemClick(inventario: String?) | 21 | fun onItemClick(inventario: String?) |
| 25 | } | 22 | } |
| 26 | 23 | ||
| 27 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) | 24 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) |
| 28 | 25 | ||
| 29 | override fun getItemCount() = inv.size | 26 | override fun getItemCount() = inv.size |
| 30 | 27 | ||
| 31 | 28 | ||
| 32 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { | 29 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { |
| 33 | override fun bind(item: InvHead, position: Int) { | 30 | override fun bind(item: InvHead, position: Int) { |
| 34 | itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} | 31 | itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} |
| 35 | itemView.tvPrincipalinventario.text = if ( item.invNum < 10) "0${ item.invNum.toString()}" else item.invNum.toString() | 32 | itemView.tvPrincipalinventario.text = if ( item.invNum < 10) "0${ item.invNum.toString()}" else item.invNum.toString() |
| 36 | 33 | ||
| 37 | itemView.tvDescription.text=item.descripcion.toString() | 34 | itemView.tvDescription.text=item.descripcion.toString() |
| 38 | itemView.tvFecha.text=item.fechaInicio.toString() | 35 | itemView.tvFecha.text=item.fechaInicio.toString() |
| 39 | itemView.tvCantContada.text=item.prodContados.toString() | 36 | itemView.tvCantContada.text=item.prodContados.toString() |
| 40 | } | 37 | } |
| 41 | } | 38 | } |
| 42 | 39 | ||
| 43 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | 40 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { |
| 44 | when (holder) { | 41 | when (holder) { |
| 45 | is ItemsViewHolder -> holder.bind(inv[position], position) | 42 | is ItemsViewHolder -> holder.bind(inv[position], position) |
| 46 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") | 43 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") |
| 47 | } | 44 | } |
| 48 | } | 45 | } |
| 49 | |||
| 50 | override fun getFilter(): Filter { | ||
| 51 | return object : Filter() { | ||
| 52 | override fun performFiltering(charSequence: CharSequence): FilterResults { | ||
| 53 | val charString = charSequence.toString() | ||
| 54 | |||
| 55 | invFiltrados = if (charString.isEmpty()) { | ||
| 56 | inv | ||
| 57 | } else { | ||
| 58 | val filteredList = ArrayList<InvHead>() | ||
| 59 | |||
| 60 | for (row in inv) { | ||
| 61 | if (row.lugar.toString().contains(charString.toLowerCase(Locale.ROOT))) { | ||
| 62 | filteredList.add(row) | ||
| 63 | } | ||
| 64 | |||
| 65 | } | ||
| 66 | filteredList | ||
| 67 | } | ||
| 68 | val filterResults = FilterResults() | ||
| 69 | filterResults.values=invFiltrados | ||
| 70 | return filterResults | ||
| 71 | } | ||
| 72 | |||
| 73 | override fun publishResults(charSequence: CharSequence?, filterResults: FilterResults?) { | ||
| 74 | invFiltrados = filterResults!!.values as ArrayList<InvHead> | ||
| 75 | notifyDataSetChanged() | ||
| 76 | } | ||
| 77 | } | ||
| 78 | } | ||
| 79 | } | 46 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/main/MainFragment.kt
| 1 | package com.focasoftware.deboinventariov20.UI.main | 1 | package com.focasoftware.deboinventariov20.UI.main |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import android.content.SharedPreferences | 4 | import android.content.SharedPreferences |
| 5 | import android.os.Bundle | 5 | import android.os.Bundle |
| 6 | import android.view.LayoutInflater | 6 | import android.view.LayoutInflater |
| 7 | import android.view.View | 7 | import android.view.View |
| 8 | import android.view.ViewGroup | 8 | import android.view.ViewGroup |
| 9 | import android.widget.CheckBox | 9 | import android.widget.CheckBox |
| 10 | import android.widget.ImageButton | 10 | import android.widget.ImageButton |
| 11 | import android.widget.TextView | 11 | import android.widget.TextView |
| 12 | import androidx.fragment.app.Fragment | 12 | import androidx.fragment.app.Fragment |
| 13 | import androidx.navigation.NavController | 13 | import androidx.navigation.NavController |
| 14 | import androidx.navigation.Navigation | 14 | import androidx.navigation.Navigation |
| 15 | import androidx.recyclerview.widget.LinearLayoutManager | 15 | import androidx.recyclerview.widget.LinearLayoutManager |
| 16 | import androidx.recyclerview.widget.RecyclerView | 16 | import androidx.recyclerview.widget.RecyclerView |
| 17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 18 | import com.focasoftware.deboinventariov20.Model.InvHead | 18 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 19 | import com.focasoftware.deboinventariov20.R | 19 | import com.focasoftware.deboinventariov20.R |
| 20 | import kotlinx.coroutines.Dispatchers | 20 | import kotlinx.coroutines.Dispatchers |
| 21 | import kotlinx.coroutines.GlobalScope | 21 | import kotlinx.coroutines.GlobalScope |
| 22 | import kotlinx.coroutines.async | 22 | import kotlinx.coroutines.async |
| 23 | import kotlinx.coroutines.launch | 23 | import kotlinx.coroutines.launch |
| 24 | import java.time.LocalDateTime | ||
| 24 | import java.util.* | 25 | import java.util.* |
| 25 | 26 | ||
| 26 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { | 27 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { |
| 27 | private lateinit var inventarios: List<InvHead> | 28 | private lateinit var inventarios: List<InvHead> |
| 28 | private lateinit var ordenado: List<InvHead> | 29 | private lateinit var ordenado: List<InvHead> |
| 29 | private lateinit var rcInventario: RecyclerView | 30 | private lateinit var rcInventario: RecyclerView |
| 30 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 31 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
| 31 | private lateinit var viewManager: RecyclerView.LayoutManager | 32 | private lateinit var viewManager: RecyclerView.LayoutManager |
| 32 | private var listIvn2 = ArrayList<InvHead>() | 33 | private var listIvn2 = ArrayList<InvHead>() |
| 33 | private lateinit var navController: NavController | 34 | private lateinit var navController: NavController |
| 34 | private lateinit var sharedPreferences: SharedPreferences | 35 | private lateinit var sharedPreferences: SharedPreferences |
| 35 | private var cantidadInventarios: Int = 0 | 36 | private var cantidadInventarios: Int = 0 |
| 36 | 37 | ||
| 37 | override fun onCreate(savedInstanceState: Bundle?) { | 38 | override fun onCreate(savedInstanceState: Bundle?) { |
| 38 | super.onCreate(savedInstanceState) | 39 | super.onCreate(savedInstanceState) |
| 39 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 40 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 41 | |||
| 40 | } | 42 | } |
| 41 | 43 | ||
| 42 | override fun onCreateView( | 44 | override fun onCreateView( |
| 43 | inflater: LayoutInflater, | 45 | inflater: LayoutInflater, |
| 44 | container: ViewGroup?, | 46 | container: ViewGroup?, |
| 45 | savedInstanceState: Bundle? | 47 | savedInstanceState: Bundle? |
| 46 | ): View? { | 48 | ): View? { |
| 47 | var bAbiertoCerrado = false | 49 | var bAbiertoCerrado = false |
| 48 | val v = inflater.inflate(R.layout.fragment_main, container, false) | 50 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
| 49 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) | 51 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) |
| 50 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) | 52 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) |
| 51 | val ivSort19 = v.findViewById<ImageButton>(R.id.ivSort19) | 53 | val ivSort19 = v.findViewById<ImageButton>(R.id.ivSort19) |
| 52 | val ivSort91 = v.findViewById<ImageButton>(R.id.ivSort91) | 54 | val ivSort91 = v.findViewById<ImageButton>(R.id.ivSort91) |
| 53 | val cbVentas = v.findViewById<CheckBox>(R.id.cbVentas) | 55 | val cbVentas = v.findViewById<CheckBox>(R.id.cbVentas) |
| 54 | val cbDeposito = v.findViewById<CheckBox>(R.id.cbDeposito) | 56 | val cbDeposito = v.findViewById<CheckBox>(R.id.cbDeposito) |
| 55 | val tvTipo = v.findViewById<TextView>(R.id.tvTipo) | 57 | val tvTipo = v.findViewById<TextView>(R.id.tvTipo) |
| 56 | rcInventario = v.findViewById(R.id.rcInventario) | 58 | rcInventario = v.findViewById(R.id.rcInventario) |
| 57 | 59 | ||
| 58 | GlobalScope.launch(Dispatchers.Main) { | 60 | GlobalScope.launch(Dispatchers.Main) { |
| 59 | inventarios = buscarEnBDInvHead() | 61 | inventarios = buscarEnBDInvHead() |
| 60 | for ((i, item) in inventarios.withIndex()) { | 62 | for ((i, item) in inventarios.withIndex()) { |
| 61 | val inv = InvHead( | 63 | val inv = InvHead( |
| 62 | inventarios[i].invNum, | 64 | inventarios[i].invNum, |
| 63 | inventarios[i].descripcion, | 65 | inventarios[i].descripcion, |
| 64 | inventarios[i].estado, | 66 | inventarios[i].estado, |
| 65 | inventarios[i].fechaInicio, | 67 | inventarios[i].fechaInicio, |
| 66 | inventarios[i].fechaFinal, | 68 | inventarios[i].fechaFinal, |
| 67 | inventarios[i].prodContados, | 69 | inventarios[i].prodContados, |
| 68 | inventarios[i].lugar, | 70 | inventarios[i].lugar, |
| 69 | inventarios[i].stDesc, | 71 | inventarios[i].stDesc, |
| 70 | inventarios[i].proNoCont | 72 | inventarios[i].proNoCont |
| 71 | ) | 73 | ) |
| 72 | cargarRecicler(inv) | 74 | cargarRecicler(inv) |
| 73 | cantidadInventarios = i + 1 | 75 | cantidadInventarios = i + 1 |
| 74 | } | 76 | } |
| 75 | tvInvDinamicos.text = "Inventarios Dinamicos ($cantidadInventarios) +" | 77 | tvInvDinamicos.text = "Inventarios Dinamicos ($cantidadInventarios) +" |
| 76 | tvInvDinamicos.setOnClickListener { | 78 | tvInvDinamicos.setOnClickListener { |
| 77 | if (!bAbiertoCerrado) { | 79 | if (!bAbiertoCerrado) { |
| 78 | bAbiertoCerrado = true | 80 | bAbiertoCerrado = true |
| 79 | txtDeposito.visibility = View.GONE | 81 | txtDeposito.visibility = View.GONE |
| 80 | rcInventario.visibility = View.VISIBLE | 82 | rcInventario.visibility = View.VISIBLE |
| 81 | ivSort91.visibility = View.INVISIBLE | 83 | ivSort91.visibility = View.INVISIBLE |
| 82 | ivSort19.visibility = View.VISIBLE | 84 | ivSort19.visibility = View.VISIBLE |
| 83 | cbVentas.visibility = View.VISIBLE | 85 | cbVentas.visibility = View.VISIBLE |
| 84 | cbDeposito.visibility = View.VISIBLE | 86 | cbDeposito.visibility = View.VISIBLE |
| 85 | tvTipo.visibility = View.VISIBLE | 87 | tvTipo.visibility = View.VISIBLE |
| 86 | tvInvDinamicos.text = | 88 | tvInvDinamicos.text = |
| 87 | "Inventarios Dinamicos ($cantidadInventarios) -" | 89 | "Inventarios Dinamicos ($cantidadInventarios) -" |
| 88 | } else { | 90 | } else { |
| 89 | bAbiertoCerrado = false | 91 | bAbiertoCerrado = false |
| 90 | rcInventario.visibility = View.GONE | 92 | rcInventario.visibility = View.GONE |
| 91 | ivSort91.visibility = View.GONE | 93 | ivSort91.visibility = View.GONE |
| 92 | ivSort19.visibility = View.GONE | 94 | ivSort19.visibility = View.GONE |
| 93 | txtDeposito.visibility = View.VISIBLE | 95 | txtDeposito.visibility = View.VISIBLE |
| 94 | cbVentas.visibility = View.GONE | 96 | cbVentas.visibility = View.GONE |
| 95 | cbDeposito.visibility = View.GONE | 97 | cbDeposito.visibility = View.GONE |
| 96 | tvTipo.visibility = View.GONE | 98 | tvTipo.visibility = View.GONE |
| 97 | tvInvDinamicos.text = | 99 | tvInvDinamicos.text = |
| 98 | "Inventarios Dinamicos ($cantidadInventarios) +" | 100 | "Inventarios Dinamicos ($cantidadInventarios) +" |
| 99 | } | 101 | } |
| 100 | } | 102 | } |
| 103 | ordenado = inventarios.sortedBy { | ||
| 104 | it.invNum | ||
| 105 | } | ||
| 101 | ivSort19.setOnClickListener { | 106 | ivSort19.setOnClickListener { |
| 102 | ordenado = inventarios.sortedByDescending { | 107 | ordenado = inventarios.sortedByDescending { |
| 103 | it.invNum | 108 | it.invNum |
| 104 | } | 109 | } |
| 110 | cbDeposito.isChecked=true | ||
| 111 | cbVentas.isChecked=true | ||
| 105 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 112 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
| 106 | viewManager = LinearLayoutManager(requireContext()) | 113 | viewManager = LinearLayoutManager(requireContext()) |
| 107 | 114 | ||
| 108 | rcInventario.apply { | 115 | rcInventario.apply { |
| 109 | adapter = viewAdapter | 116 | adapter = viewAdapter |
| 110 | layoutManager = viewManager | 117 | layoutManager = viewManager |
| 111 | } | 118 | } |
| 112 | viewAdapter.notifyDataSetChanged() | 119 | viewAdapter.notifyDataSetChanged() |
| 113 | ivSort19.visibility = View.INVISIBLE | 120 | ivSort19.visibility = View.INVISIBLE |
| 114 | ivSort91.visibility = View.VISIBLE | 121 | ivSort91.visibility = View.VISIBLE |
| 115 | } | 122 | } |
| 116 | ivSort91.setOnClickListener { | 123 | ivSort91.setOnClickListener { |
| 117 | ordenado = inventarios.sortedBy { | 124 | ordenado = inventarios.sortedBy { |
| 118 | it.invNum | 125 | it.invNum |
| 119 | } | 126 | } |
| 127 | cbDeposito.isChecked=true | ||
| 128 | cbVentas.isChecked=true | ||
| 120 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 129 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
| 121 | viewManager = LinearLayoutManager(requireContext()) | 130 | viewManager = LinearLayoutManager(requireContext()) |
| 122 | 131 | ||
| 123 | rcInventario.apply { | 132 | rcInventario.apply { |
| 124 | adapter = viewAdapter | 133 | adapter = viewAdapter |
| 125 | layoutManager = viewManager | 134 | layoutManager = viewManager |
| 126 | } | 135 | } |
| 127 | viewAdapter.notifyDataSetChanged() | 136 | viewAdapter.notifyDataSetChanged() |
| 128 | ivSort91.visibility = View.INVISIBLE | 137 | ivSort91.visibility = View.INVISIBLE |
| 129 | ivSort19.visibility = View.VISIBLE | 138 | ivSort19.visibility = View.VISIBLE |
| 130 | } | 139 | } |
| 131 | } | 140 | } |
| 132 | 141 | ||
| 133 | cbVentas.setOnClickListener { | 142 | cbVentas.setOnClickListener { |
| 134 | if (cbVentas.isChecked) { | 143 | if (!cbVentas.isChecked) { |
| 144 | cbDeposito.isChecked=true | ||
| 145 | listIvn2.clear() | ||
| 146 | ordenado.forEach { | ||
| 147 | if (it.lugar==true) { | ||
| 148 | listIvn2.add(it) | ||
| 149 | } | ||
| 150 | } | ||
| 151 | } else { | ||
| 152 | listIvn2.clear() | ||
| 153 | listIvn2.addAll(ordenado) | ||
| 154 | } | ||
| 155 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this@MainFragment) | ||
| 156 | viewManager = LinearLayoutManager(requireContext()) | ||
| 157 | rcInventario.apply { | ||
| 158 | adapter = viewAdapter | ||
| 159 | layoutManager = viewManager | ||
| 160 | } | ||
| 161 | viewAdapter.notifyDataSetChanged() | ||
| 162 | } | ||
| 163 | |||
| 164 | cbDeposito.setOnClickListener { | ||
| 165 | if (!cbDeposito.isChecked) { | ||
| 166 | cbVentas.isChecked=true | ||
| 135 | listIvn2.clear() | 167 | listIvn2.clear() |
| 136 | inventarios.forEach { | 168 | ordenado.forEach { |
| 137 | if (it.lugar==false) { | 169 | if (it.lugar==false) { |
| 138 | listIvn2.add(it) | 170 | listIvn2.add(it) |
| 139 | } | 171 | } |
| 140 | } | 172 | } |
| 141 | } else { | 173 | } else { |
| 142 | listIvn2.clear() | 174 | listIvn2.clear() |
| 143 | listIvn2.addAll(inventarios) | 175 | listIvn2.addAll(ordenado) |
| 144 | } | 176 | } |
| 177 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this@MainFragment) | ||
| 178 | viewManager = LinearLayoutManager(requireContext()) | ||
| 145 | rcInventario.apply { | 179 | rcInventario.apply { |
| 146 | adapter = viewAdapter | 180 | adapter = viewAdapter |
| 147 | layoutManager = viewManager | 181 | layoutManager = viewManager |
| 148 | } | 182 | } |
| 149 | viewAdapter.notifyDataSetChanged() | 183 | viewAdapter.notifyDataSetChanged() |
| 150 | } | 184 | } |
| 151 | return v | 185 | return v |
| 152 | } | 186 | } |
| 153 | 187 | ||
| 154 | suspend fun buscarEnBDInvHead(): List<InvHead> { | 188 | suspend fun buscarEnBDInvHead(): List<InvHead> { |
| 155 | //TODO BUSQUEDA POR DESCRIPCION | 189 | //TODO BUSQUEDA POR DESCRIPCION |
| 156 | var busqueda: List<InvHead> | 190 | var busqueda: List<InvHead> |
| 157 | return GlobalScope.async(Dispatchers.IO) { | 191 | return GlobalScope.async(Dispatchers.IO) { |
| 158 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | 192 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() |
| 159 | return@async busqueda | 193 | return@async busqueda |
| 160 | }.await() | 194 | }.await() |
| 161 | } | 195 | } |
| 162 | 196 | ||
| 163 | fun cargarRecicler(inv: InvHead) { | 197 | fun cargarRecicler(inv: InvHead) { |
| 164 | //TODO CARGO EN LE RV | 198 | //TODO CARGO EN LE RV |
| 165 | 199 | ||
| 166 | // val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | 200 | // val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() |
| 167 | // val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | 201 | // val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") |
| 168 | 202 | ||
| 169 | // listIvn.add(item) | 203 | // listIvn.add(item) |
| 170 | listIvn2.add(inv) | 204 | listIvn2.add(inv) |
| 171 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) | 205 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) |
| 172 | viewManager = LinearLayoutManager(requireContext()) | 206 | viewManager = LinearLayoutManager(requireContext()) |
| 173 | 207 | ||
| 174 | rcInventario.apply { | 208 | rcInventario.apply { |
| 175 | adapter = viewAdapter | 209 | adapter = viewAdapter |
| 176 | layoutManager = viewManager | 210 | layoutManager = viewManager |
| 177 | } | 211 | } |
| 178 | } | 212 | } |
| 179 | 213 | ||
| 180 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 214 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 181 | super.onViewCreated(view, savedInstanceState) | 215 | super.onViewCreated(view, savedInstanceState) |
| 182 | navController = Navigation.findNavController(view) | 216 | navController = Navigation.findNavController(view) |
| 183 | listIvn2.clear() | 217 | listIvn2.clear() |
| 184 | } | 218 | } |
| 185 | 219 | ||
| 186 | override fun onItemClick(inventario: String?) { | 220 | override fun onItemClick(inventario: String?) { |
| 187 | 221 | ||
| 188 | val editor = sharedPreferences.edit() | 222 | val editor = sharedPreferences.edit() |
| 189 | // var invSel: String = inventario.toString() | 223 | // var invSel: String = inventario.toString() |
| 190 | // invSel = invSel.substring(3, 5) | 224 | // invSel = invSel.substring(3, 5) |
| 191 | editor?.putString("Inventario", inventario) | 225 | editor?.putString("Inventario", inventario) |
| 192 | editor?.apply() | 226 | editor?.apply() |
| 193 | editor.commit() | 227 | editor.commit() |
| 194 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | 228 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) |
| 195 | } | 229 | } |
| 196 | 230 | ||
| 197 | 231 | ||
| 198 | } | 232 | } |
| 199 | 233 | ||
| 200 | 234 |
app/src/main/res/drawable/logo_splash.jpeg
14.3 KB
app/src/main/res/drawable/suitedebo.png
6.74 KB
app/src/main/res/layout-land/fragment_servidores.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | tools:context=".UI.servidores.ServidoresFragment"> | 7 | tools:context=".UI.servidores.ServidoresFragment"> |
| 8 | 8 | ||
| 9 | <androidx.appcompat.widget.AppCompatTextView | 9 | <androidx.appcompat.widget.AppCompatTextView |
| 10 | android:id="@+id/tvTitutloServer" | 10 | android:id="@+id/tvTitutloServer" |
| 11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 12 | android:layout_height="90dp" | 12 | android:layout_height="90dp" |
| 13 | android:layout_marginStart="8dp" | 13 | android:layout_marginStart="8dp" |
| 14 | android:layout_marginTop="15dp" | 14 | android:layout_marginTop="15dp" |
| 15 | android:layout_marginEnd="8dp" | 15 | android:layout_marginEnd="8dp" |
| 16 | android:autoSizeMaxTextSize="100sp" | 16 | android:autoSizeMaxTextSize="100sp" |
| 17 | android:autoSizeMinTextSize="20sp" | 17 | android:autoSizeMinTextSize="20sp" |
| 18 | android:autoSizeStepGranularity="5sp" | 18 | android:autoSizeStepGranularity="5sp" |
| 19 | android:autoSizeTextType="uniform" | 19 | android:autoSizeTextType="uniform" |
| 20 | android:gravity="center" | 20 | android:gravity="center" |
| 21 | android:lines="1" | 21 | android:lines="1" |
| 22 | android:text="@string/tvTitutloServer" | 22 | android:text="@string/tvTitutloServer" |
| 23 | android:textColor="@color/colorAccent" | 23 | android:textColor="@color/colorAccent" |
| 24 | app:fontFamily="sans-serif-condensed" | 24 | app:fontFamily="sans-serif-condensed" |
| 25 | app:layout_constraintEnd_toEndOf="parent" | 25 | app:layout_constraintEnd_toEndOf="parent" |
| 26 | app:layout_constraintStart_toStartOf="parent" | 26 | app:layout_constraintStart_toStartOf="parent" |
| 27 | app:layout_constraintTop_toTopOf="parent" /> | 27 | app:layout_constraintTop_toTopOf="parent" /> |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | <TextView | 30 | <TextView |
| 31 | android:id="@+id/tvNomServer" | 31 | android:id="@+id/tvNomServer" |
| 32 | android:layout_width="match_parent" | 32 | android:layout_width="match_parent" |
| 33 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
| 34 | android:layout_margin="10dp" | 34 | android:layout_margin="10dp" |
| 35 | android:gravity="start" | 35 | android:gravity="start" |
| 36 | android:lines="1" | 36 | android:lines="1" |
| 37 | android:text="@string/tvNomServer" | 37 | android:text="@string/tvNomServer" |
| 38 | android:textColor="@android:color/black" | 38 | android:textColor="@android:color/black" |
| 39 | android:textSize="@dimen/SubTitulos" | 39 | android:textSize="@dimen/SubTitulos" |
| 40 | android:textStyle="bold|italic" | 40 | android:textStyle="bold|italic" |
| 41 | app:fontFamily="sans-serif-condensed" | 41 | app:fontFamily="sans-serif-condensed" |
| 42 | app:layout_constraintEnd_toEndOf="parent" | 42 | app:layout_constraintEnd_toEndOf="parent" |
| 43 | app:layout_constraintStart_toStartOf="parent" | 43 | app:layout_constraintStart_toStartOf="parent" |
| 44 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> | 44 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> |
| 45 | 45 | ||
| 46 | <EditText | 46 | <EditText |
| 47 | android:id="@+id/etNombreServidor" | 47 | android:id="@+id/etNombreServidor" |
| 48 | android:layout_width="match_parent" | 48 | android:layout_width="match_parent" |
| 49 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
| 50 | android:layout_margin="10dp" | 50 | android:layout_margin="10dp" |
| 51 | android:autofillHints="" | 51 | android:autofillHints="" |
| 52 | android:clickable="true" | 52 | android:clickable="true" |
| 53 | android:ems="10" | 53 | android:ems="10" |
| 54 | android:focusable="true" | 54 | android:focusable="true" |
| 55 | android:hint="Servidor Local" | 55 | android:hint="Servidor Local" |
| 56 | android:inputType="text" | 56 | android:inputType="text" |
| 57 | android:lines="1" | 57 | android:lines="1" |
| 58 | android:textSize="15sp" | 58 | android:textSize="15sp" |
| 59 | app:layout_constraintEnd_toEndOf="parent" | 59 | app:layout_constraintEnd_toEndOf="parent" |
| 60 | app:layout_constraintStart_toStartOf="parent" | 60 | app:layout_constraintStart_toStartOf="parent" |
| 61 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | 61 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> |
| 62 | 62 | ||
| 63 | <TextView | 63 | <TextView |
| 64 | android:id="@+id/tvDirServer" | 64 | android:id="@+id/tvDirServer" |
| 65 | android:layout_width="wrap_content" | 65 | android:layout_width="wrap_content" |
| 66 | android:layout_height="wrap_content" | 66 | android:layout_height="wrap_content" |
| 67 | android:layout_margin="10dp" | 67 | android:layout_margin="10dp" |
| 68 | android:gravity="start" | 68 | android:gravity="start" |
| 69 | android:lines="1" | 69 | android:lines="1" |
| 70 | android:text="@string/tvDirServer" | 70 | android:text="@string/tvDirServer" |
| 71 | android:textColor="@android:color/black" | 71 | android:textColor="@android:color/black" |
| 72 | android:textSize="@dimen/SubTitulos" | 72 | android:textSize="@dimen/SubTitulos" |
| 73 | android:textStyle="bold|italic" | 73 | android:textStyle="bold|italic" |
| 74 | app:fontFamily="sans-serif-condensed" | 74 | app:fontFamily="sans-serif-condensed" |
| 75 | app:layout_constraintStart_toStartOf="parent" | 75 | app:layout_constraintStart_toStartOf="parent" |
| 76 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> | 76 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> |
| 77 | 77 | ||
| 78 | <EditText | 78 | <EditText |
| 79 | android:id="@+id/etDireccionServidor" | 79 | android:id="@+id/etDireccionServidor" |
| 80 | android:layout_width="130dp" | 80 | android:layout_width="130dp" |
| 81 | android:layout_height="wrap_content" | 81 | android:layout_height="wrap_content" |
| 82 | |||
| 83 | android:clickable="true" | 82 | android:clickable="true" |
| 84 | android:ems="10" | 83 | android:ems="10" |
| 85 | android:focusable="true" | 84 | android:focusable="true" |
| 86 | android:hint="192.168.100.100" | 85 | android:hint="192.168.100.100" |
| 87 | android:inputType="text" | 86 | android:inputType="phone" |
| 88 | android:lines="1" | 87 | android:lines="1" |
| 89 | android:textSize="15sp" | 88 | android:textSize="15sp" |
| 90 | app:layout_constraintBaseline_toBaselineOf="@+id/tvDirServer" | 89 | app:layout_constraintBaseline_toBaselineOf="@+id/tvDirServer" |
| 91 | app:layout_constraintStart_toEndOf="@+id/tvDirServer" /> | 90 | app:layout_constraintStart_toEndOf="@+id/tvDirServer" /> |
| 92 | 91 | ||
| 93 | <TextView | ||
| 94 | android:id="@+id/tvPuerto" | ||
| 95 | android:layout_width="wrap_content" | ||
| 96 | android:layout_height="wrap_content" | ||
| 97 | android:layout_marginStart="10dp" | ||
| 98 | android:layout_marginTop="10dp" | ||
| 99 | android:gravity="start" | ||
| 100 | android:lines="1" | ||
| 101 | android:text="Puerto:" | ||
| 102 | android:textColor="@android:color/black" | ||
| 103 | android:textSize="@dimen/SubTitulos" | ||
| 104 | android:textStyle="bold|italic" | ||
| 105 | app:fontFamily="sans-serif-condensed" | ||
| 106 | app:layout_constraintStart_toEndOf="@+id/etDireccionServidor" | ||
| 107 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> | ||
| 108 | 92 | ||
| 109 | <EditText | 93 | <EditText |
| 110 | android:id="@+id/etPuerto" | 94 | android:id="@+id/etPuerto" |
| 111 | android:layout_width="80dp" | 95 | android:layout_width="80dp" |
| 112 | android:layout_height="wrap_content" | 96 | android:layout_height="wrap_content" |
| 113 | android:clickable="true" | 97 | android:clickable="true" |
| 114 | android:ems="10" | 98 | android:ems="10" |
| 115 | android:focusable="true" | 99 | android:focusable="true" |
| 116 | android:hint="9999" | 100 | android:hint="Puerto" |
| 117 | android:inputType="text" | 101 | android:inputType="number" |
| 118 | android:lines="1" | 102 | android:lines="1" |
| 119 | android:textSize="15sp" | 103 | android:textSize="15sp" |
| 120 | app:layout_constraintBaseline_toBaselineOf="@+id/tvPuerto" | 104 | app:layout_constraintBaseline_toBaselineOf="@+id/etDireccionServidor" |
| 121 | app:layout_constraintStart_toEndOf="@+id/tvPuerto" | 105 | app:layout_constraintStart_toEndOf="@+id/etDireccionServidor" |
| 122 | android:autofillHints="" /> | 106 | android:autofillHints="" /> |
| 123 | 107 | ||
| 124 | 108 | ||
| 125 | <androidx.recyclerview.widget.RecyclerView | 109 | <androidx.recyclerview.widget.RecyclerView |
| 126 | android:id="@+id/rvServidores" | 110 | android:id="@+id/rvServidores" |
| 127 | android:layout_width="match_parent" | 111 | android:layout_width="match_parent" |
| 128 | android:layout_height="0dp" | 112 | android:layout_height="0dp" |
| 129 | android:layout_marginTop="10dp" | 113 | android:layout_marginTop="10dp" |
| 130 | android:background="@android:color/darker_gray" | 114 | android:background="@android:color/darker_gray" |
| 131 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" | 115 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" |
| 132 | app:layout_constraintEnd_toEndOf="parent" | 116 | app:layout_constraintEnd_toEndOf="parent" |
| 133 | app:layout_constraintStart_toStartOf="parent" | 117 | app:layout_constraintStart_toStartOf="parent" |
| 134 | app:layout_constraintTop_toBottomOf="@+id/etPuerto" | 118 | app:layout_constraintTop_toBottomOf="@+id/etPuerto" |
| 135 | app:layout_goneMarginEnd="10dp" | 119 | app:layout_goneMarginEnd="10dp" |
| 136 | tools:listitem="@layout/item_servidores" /> | 120 | tools:listitem="@layout/item_servidores" /> |
| 137 | 121 | ||
| 138 | <Button | 122 | <Button |
| 139 | android:id="@+id/btnGuardarServidores" | 123 | android:id="@+id/btnGuardarServidores" |
| 140 | android:layout_width="0dp" | 124 | android:layout_width="0dp" |
| 141 | android:layout_height="wrap_content" | 125 | android:layout_height="wrap_content" |
| 142 | android:layout_marginTop="10dp" | 126 | android:layout_marginTop="10dp" |
| 143 | android:layout_marginEnd="10dp" | 127 | android:layout_marginEnd="10dp" |
| 144 | android:background="@drawable/boton_borde_redondeado" | 128 | android:background="@drawable/boton_borde_redondeado" |
| 145 | android:padding="10dp" | 129 | android:padding="10dp" |
| 146 | android:text="@string/btnGuardarServidores" | 130 | android:text="@string/btnGuardarServidores" |
| 147 | android:textColor="@android:color/white" | 131 | android:textColor="@android:color/white" |
| 148 | app:layout_constraintBottom_toBottomOf="parent" | 132 | app:layout_constraintBottom_toBottomOf="parent" |
| 149 | app:layout_constraintEnd_toEndOf="parent" | 133 | app:layout_constraintEnd_toEndOf="parent" |
| 150 | app:layout_constraintStart_toStartOf="parent" | 134 | app:layout_constraintStart_toStartOf="parent" |
| 151 | app:layout_constraintTop_toBottomOf="@+id/rvServidores" /> | 135 | app:layout_constraintTop_toBottomOf="@+id/rvServidores" /> |
| 152 | 136 | ||
| 153 | </androidx.constraintlayout.widget.ConstraintLayout> | 137 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 154 | 138 |
app/src/main/res/layout/activity_splash.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | android:background="#E6E6E6" | ||
| 8 | |||
| 7 | tools:context=".UI.SplashActivity"> | 9 | tools:context=".UI.SplashActivity"> |
| 8 | 10 | ||
| 9 | 11 | ||
| 10 | <androidx.appcompat.widget.AppCompatTextView | 12 | <androidx.appcompat.widget.AppCompatTextView |
| 11 | android:id="@+id/textView2" | 13 | android:id="@+id/textView2" |
| 12 | android:layout_width="match_parent" | 14 | android:layout_width="match_parent" |
| 13 | android:layout_height="100dp" | 15 | android:layout_height="100dp" |
| 14 | android:layout_margin="20dp" | 16 | android:layout_margin="20dp" |
| 15 | android:autoSizeMaxTextSize="1000sp" | 17 | android:autoSizeMaxTextSize="1000sp" |
| 16 | android:autoSizeMinTextSize="30sp" | 18 | android:autoSizeMinTextSize="30sp" |
| 17 | android:autoSizeStepGranularity="5sp" | 19 | android:autoSizeStepGranularity="5sp" |
| 18 | android:autoSizeTextType="uniform" | 20 | android:autoSizeTextType="uniform" |
| 19 | android:gravity="center" | 21 | android:gravity="center" |
| 20 | android:lines="1" | 22 | android:lines="1" |
| 21 | android:text="@string/bien" | 23 | android:text="@string/bien" |
| 22 | android:textColor="@color/colorAccent" | 24 | android:textColor="@color/colorAccent" |
| 23 | app:fontFamily="sans-serif-condensed" | 25 | app:fontFamily="sans-serif-condensed" |
| 24 | app:layout_constraintBottom_toTopOf="@+id/imageView" | 26 | app:layout_constraintBottom_toTopOf="@+id/imageView" |
| 25 | app:layout_constraintEnd_toEndOf="parent" | 27 | app:layout_constraintEnd_toEndOf="parent" |
| 26 | app:layout_constraintStart_toStartOf="parent" | 28 | app:layout_constraintStart_toStartOf="parent" |
| 27 | app:layout_constraintTop_toTopOf="parent" /> | 29 | app:layout_constraintTop_toTopOf="parent" /> |
| 28 | 30 | ||
| 29 | <ImageView | 31 | <ImageView |
| 30 | android:id="@+id/imageView" | 32 | android:id="@+id/imageView" |
| 31 | android:layout_width="wrap_content" | 33 | android:layout_width="wrap_content" |
| 32 | android:layout_height="wrap_content" | 34 | android:layout_height="wrap_content" |
| 35 | |||
| 33 | android:contentDescription="@string/todo" | 36 | android:contentDescription="@string/todo" |
| 34 | android:src="@drawable/ic_launcher_background" | 37 | android:src="@drawable/logo_splash" |
| 35 | app:layout_constraintBottom_toTopOf="@id/textView3" | 38 | app:layout_constraintBottom_toTopOf="@id/textView4" |
| 36 | app:layout_constraintEnd_toEndOf="parent" | 39 | app:layout_constraintEnd_toEndOf="parent" |
| 37 | app:layout_constraintStart_toStartOf="parent" | 40 | app:layout_constraintStart_toStartOf="parent" |
| 38 | app:layout_constraintTop_toBottomOf="@+id/textView2" | 41 | app:layout_constraintTop_toBottomOf="@+id/textView2" |
| 39 | app:srcCompat="@drawable/suitedebo" /> | 42 | /> |
| 43 | |||
| 44 | |||
| 40 | 45 | ||
| 41 | 46 | ||
| 42 | <TextView | ||
| 43 | android:id="@+id/textView3" | ||
| 44 | android:layout_width="match_parent" | ||
| 45 | android:layout_height="100dp" | ||
| 46 | android:layout_margin="20dp" | ||
| 47 | android:autoSizeMaxTextSize="1000sp" | ||
| 48 | android:autoSizeMinTextSize="30sp" | ||
| 49 | android:autoSizeStepGranularity="5sp" | ||
| 50 | android:autoSizeTextType="uniform" | ||
| 51 | android:gravity="center" | ||
| 52 | android:lines="1" | ||
| 53 | android:text="@string/debo" | ||
| 54 | android:textColor="@color/colorAccent" | ||
| 55 | app:fontFamily="sans-serif-condensed" | ||
| 56 | app:layout_constraintBottom_toTopOf="@+id/textView4" | ||
| 57 | app:layout_constraintEnd_toEndOf="parent" | ||
| 58 | app:layout_constraintStart_toStartOf="parent" | ||
| 59 | app:layout_constraintTop_toBottomOf="@+id/imageView" /> | ||
| 60 | 47 | ||
| 61 | <androidx.appcompat.widget.AppCompatTextView | 48 | <androidx.appcompat.widget.AppCompatTextView |
| 62 | android:id="@+id/textView4" | 49 | android:id="@+id/textView4" |
| 63 | android:layout_width="match_parent" | 50 | android:layout_width="match_parent" |
| 64 | android:layout_height="110dp" | 51 | android:layout_height="110dp" |
| 65 | android:layout_margin="20dp" | 52 | android:layout_margin="20dp" |
| 66 | android:autoSizeMaxTextSize="1000sp" | 53 | android:autoSizeMaxTextSize="1000sp" |
| 67 | android:autoSizeMinTextSize="30sp" | 54 | android:autoSizeMinTextSize="30sp" |
| 68 | android:autoSizeStepGranularity="5sp" | 55 | android:autoSizeStepGranularity="5sp" |
| 69 | android:autoSizeTextType="uniform" | 56 | android:autoSizeTextType="uniform" |
| 70 | android:gravity="center" | 57 | android:gravity="center" |
| 71 | android:lines="1" | 58 | android:lines="1" |
| 72 | android:text="@string/inventario" | 59 | android:text="@string/inventario" |
| 73 | android:textColor="@color/colorAccent" | 60 | android:textColor="@color/colorAccent" |
| 74 | app:fontFamily="sans-serif-condensed" | 61 | app:fontFamily="sans-serif-condensed" |
app/src/main/res/layout/fragment_actua_maestros.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | tools:context=".UI.actualizacionMaestros.ActuaMaestrosFragment"> | 7 | tools:context=".UI.actualizacionMaestros.ActuaMaestrosFragment"> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
| 11 | android:id="@+id/tvActMaestros" | 11 | android:id="@+id/tvActMaestros" |
| 12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
| 13 | android:layout_height="wrap_content" | 13 | android:layout_height="wrap_content" |
| 14 | android:layout_marginTop="@dimen/MarginTopTitulos" | 14 | android:layout_marginTop="@dimen/MarginTopTitulos" |
| 15 | android:gravity="center" | 15 | android:gravity="center" |
| 16 | 16 | ||
| 17 | android:text="@string/tvActMaestros" | 17 | android:text="@string/tvActMaestros" |
| 18 | android:textColor="@color/colorAccent" | 18 | android:textColor="@color/colorAccent" |
| 19 | android:textSize="@dimen/Titulos" | 19 | android:textSize="@dimen/Titulos" |
| 20 | app:fontFamily="sans-serif-condensed" | 20 | app:fontFamily="sans-serif-condensed" |
| 21 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" | 21 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" |
| 22 | app:layout_constraintEnd_toEndOf="parent" | 22 | app:layout_constraintEnd_toEndOf="parent" |
| 23 | app:layout_constraintStart_toStartOf="parent" | 23 | app:layout_constraintStart_toStartOf="parent" |
| 24 | app:layout_constraintTop_toTopOf="parent" /> | 24 | app:layout_constraintTop_toTopOf="parent" /> |
| 25 | 25 | ||
| 26 | <TextView | 26 | <TextView |
| 27 | android:id="@+id/tvSeleccioneServidor" | 27 | android:id="@+id/tvSeleccioneServidor" |
| 28 | android:layout_width="0dp" | 28 | android:layout_width="0dp" |
| 29 | android:layout_height="wrap_content" | 29 | android:layout_height="wrap_content" |
| 30 | android:layout_margin="30dp" | 30 | android:layout_margin="30dp" |
| 31 | android:gravity="center" | 31 | android:gravity="center" |
| 32 | android:lines="2" | 32 | android:lines="2" |
| 33 | android:text="@string/tvMedio" | 33 | android:text="@string/tvMedio" |
| 34 | android:textColor="@android:color/black" | 34 | android:textColor="@android:color/black" |
| 35 | android:textSize="@dimen/SubTitulos" | 35 | android:textSize="@dimen/SubTitulos" |
| 36 | app:fontFamily="sans-serif-condensed" | 36 | app:fontFamily="sans-serif-condensed" |
| 37 | app:layout_constraintEnd_toEndOf="parent" | 37 | app:layout_constraintEnd_toEndOf="parent" |
| 38 | app:layout_constraintStart_toStartOf="parent" | 38 | app:layout_constraintStart_toStartOf="parent" |
| 39 | app:layout_constraintTop_toBottomOf="@+id/tvActMaestros" /> | 39 | app:layout_constraintTop_toBottomOf="@+id/tvActMaestros" /> |
| 40 | 40 | ||
| 41 | <RadioGroup | 41 | <RadioGroup |
| 42 | android:id="@+id/rgTipoActualizacion" | 42 | android:id="@+id/rgTipoActualizacion" |
| 43 | android:layout_width="0dp" | 43 | android:layout_width="0dp" |
| 44 | android:layout_height="wrap_content" | 44 | android:layout_height="wrap_content" |
| 45 | android:layout_margin="25dp" | 45 | android:layout_margin="25dp" |
| 46 | android:gravity="center" | 46 | android:gravity="center" |
| 47 | android:orientation="horizontal" | 47 | android:orientation="horizontal" |
| 48 | app:layout_constraintEnd_toEndOf="parent" | 48 | app:layout_constraintEnd_toEndOf="parent" |
| 49 | app:layout_constraintStart_toStartOf="parent" | 49 | app:layout_constraintStart_toStartOf="parent" |
| 50 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor"> | 50 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor"> |
| 51 | 51 | ||
| 52 | <RadioButton | 52 | <RadioButton |
| 53 | android:id="@+id/obPorWifi" | 53 | android:id="@+id/obPorWifi" |
| 54 | android:layout_width="wrap_content" | 54 | android:layout_width="wrap_content" |
| 55 | android:layout_height="wrap_content" | 55 | android:layout_height="wrap_content" |
| 56 | android:layout_margin="5dp" | 56 | android:layout_margin="5dp" |
| 57 | android:checked="true" | 57 | android:checked="true" |
| 58 | android:padding="5dp" | 58 | android:padding="5dp" |
| 59 | android:text="@string/obPorWifi" | 59 | android:text="@string/obPorWifi" |
| 60 | android:textSize="@dimen/NormalText" /> | 60 | android:textSize="@dimen/NormalText" /> |
| 61 | 61 | ||
| 62 | <RadioButton | 62 | <RadioButton |
| 63 | android:id="@+id/obViaArchivo" | 63 | android:id="@+id/obViaArchivo" |
| 64 | android:layout_width="wrap_content" | 64 | android:layout_width="wrap_content" |
| 65 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
| 66 | android:layout_margin="5dp" | 66 | android:layout_margin="5dp" |
| 67 | android:checked="false" | 67 | android:checked="false" |
| 68 | android:padding="5dp" | 68 | android:padding="5dp" |
| 69 | android:text="@string/obViaArchivo" | 69 | android:text="@string/obViaArchivo" |
| 70 | android:textSize="@dimen/NormalText" /> | 70 | android:textSize="@dimen/NormalText" /> |
| 71 | 71 | ||
| 72 | 72 | ||
| 73 | </RadioGroup> | 73 | </RadioGroup> |
| 74 | 74 | ||
| 75 | <TextView | ||
| 76 | android:id="@+id/tvServerConectado" | ||
| 77 | android:layout_width="match_parent" | ||
| 78 | android:layout_height="wrap_content" | ||
| 79 | android:layout_margin="30dp" | ||
| 80 | android:gravity="center" | ||
| 81 | android:lines="2" | ||
| 82 | android:text="" | ||
| 83 | android:textColor="@android:color/black" | ||
| 84 | android:textSize="@dimen/SubTitulos" | ||
| 85 | app:fontFamily="sans-serif-condensed" | ||
| 86 | app:layout_constraintBottom_toTopOf="@+id/countriesList" | ||
| 87 | app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" /> | ||
| 75 | 88 | ||
| 76 | <TextView | 89 | <TextView |
| 77 | android:id="@+id/countriesList" | 90 | android:id="@+id/countriesList" |
| 78 | android:layout_width="0dp" | 91 | android:layout_width="0dp" |
| 79 | android:layout_height="wrap_content" | 92 | android:layout_height="wrap_content" |
| 80 | android:layout_marginTop="@dimen/MarginTopTitulos" | 93 | android:layout_marginTop="@dimen/MarginTopTitulos" |
| 81 | android:gravity="center" | 94 | android:gravity="center" |
| 82 | android:text="" | 95 | android:text="" |
| 83 | android:textColor="@android:color/black" | 96 | android:textColor="@android:color/black" |
| 84 | android:textSize="@dimen/SubTitulos" | 97 | android:textSize="@dimen/SubTitulos" |
| 85 | android:visibility="visible" | 98 | android:visibility="visible" |
| 86 | app:fontFamily="sans-serif-condensed" | 99 | app:fontFamily="sans-serif-condensed" |
| 87 | app:layout_constraintBottom_toTopOf="@+id/btnConfirmarAct" | 100 | app:layout_constraintBottom_toTopOf="@+id/btnConfirmarAct" |
| 88 | app:layout_constraintEnd_toEndOf="parent" | 101 | app:layout_constraintEnd_toEndOf="parent" |
| 89 | app:layout_constraintHorizontal_bias="0.0" | 102 | app:layout_constraintHorizontal_bias="0.0" |
| 90 | app:layout_constraintStart_toStartOf="parent" | 103 | app:layout_constraintStart_toStartOf="parent" |
| 91 | app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" | 104 | app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" |
| 92 | app:layout_constraintVertical_bias="0.0" /> | 105 | app:layout_constraintVertical_bias="0.106" /> |
| 93 | 106 | ||
| 94 | <Button | 107 | <Button |
| 95 | android:id="@+id/btnConfirmarAct" | 108 | android:id="@+id/btnConfirmarAct" |
| 96 | android:layout_width="0dp" | 109 | android:layout_width="0dp" |
| 97 | android:layout_height="wrap_content" | 110 | android:layout_height="wrap_content" |
| 98 | android:layout_margin="20dp" | 111 | android:layout_margin="20dp" |
| 99 | android:text="@string/btnConfirmarAct" | 112 | android:text="@string/btnConfirmarAct" |
| 100 | android:textSize="@dimen/NormalText" | 113 | android:textSize="@dimen/NormalText" |
| 101 | android:textColor="@android:color/white" | 114 | android:textColor="@android:color/white" |
| 102 | android:padding="10dp" | 115 | android:padding="10dp" |
| 103 | android:background="@drawable/boton_borde_redondeado" | 116 | android:background="@drawable/boton_borde_redondeado" |
| 104 | app:layout_constraintBottom_toBottomOf="parent" | 117 | app:layout_constraintBottom_toBottomOf="parent" |
| 105 | app:layout_constraintEnd_toEndOf="parent" | 118 | app:layout_constraintEnd_toEndOf="parent" |
| 106 | app:layout_constraintStart_toStartOf="parent" /> | 119 | app:layout_constraintStart_toStartOf="parent" /> |
| 107 | 120 | ||
| 108 | 121 | ||
| 109 | <ProgressBar | 122 | <ProgressBar |
| 110 | android:id="@+id/loading_view" | 123 | android:id="@+id/loading_view" |
| 111 | android:layout_width="wrap_content" | 124 | android:layout_width="wrap_content" |
| 112 | android:layout_height="wrap_content" | 125 | android:layout_height="wrap_content" |
| 113 | android:layout_marginStart="8dp" | 126 | android:layout_marginStart="8dp" |
| 114 | android:layout_marginLeft="8dp" | 127 | android:layout_marginLeft="8dp" |
| 115 | android:layout_marginTop="8dp" | 128 | android:layout_marginTop="8dp" |
| 116 | android:layout_marginEnd="8dp" | 129 | android:layout_marginEnd="8dp" |
| 117 | android:layout_marginRight="8dp" | 130 | android:layout_marginRight="8dp" |
| 118 | android:layout_marginBottom="8dp" | 131 | android:layout_marginBottom="8dp" |
| 119 | android:visibility="gone" | 132 | android:visibility="gone" |
| 120 | app:layout_constraintBottom_toBottomOf="parent" | 133 | app:layout_constraintBottom_toBottomOf="parent" |
| 121 | app:layout_constraintEnd_toEndOf="parent" | 134 | app:layout_constraintEnd_toEndOf="parent" |
| 122 | app:layout_constraintStart_toStartOf="parent" | 135 | app:layout_constraintStart_toStartOf="parent" |
| 123 | app:layout_constraintTop_toTopOf="parent" /> | 136 | app:layout_constraintTop_toTopOf="parent" /> |
| 124 | 137 | ||
| 125 | </androidx.constraintlayout.widget.ConstraintLayout> | 138 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 126 | 139 |
app/src/main/res/layout/fragment_configuracion.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="wrap_content" | 6 | android:layout_height="wrap_content" |
| 7 | tools:context=".UI.configuracion.ConfiguracionFragment"> | 7 | tools:context=".UI.configuracion.ConfiguracionFragment"> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
| 11 | android:id="@+id/textView2" | 11 | android:id="@+id/textView2" |
| 12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
| 13 | android:layout_height="wrap_content" | 13 | android:layout_height="wrap_content" |
| 14 | 14 | ||
| 15 | android:layout_marginTop="@dimen/MarginTopTitulos" | 15 | android:layout_marginTop="@dimen/MarginTopTitulos" |
| 16 | android:gravity="center" | 16 | android:gravity="center" |
| 17 | 17 | ||
| 18 | android:lines="1" | 18 | android:lines="1" |
| 19 | android:text="@string/tvTituloConf" | 19 | android:text="@string/tvTituloConf" |
| 20 | android:textColor="@color/colorAccent" | 20 | android:textColor="@color/colorAccent" |
| 21 | android:textSize="@dimen/Titulos" | 21 | android:textSize="@dimen/Titulos" |
| 22 | app:fontFamily="sans-serif-condensed" | 22 | app:fontFamily="sans-serif-condensed" |
| 23 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" | 23 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" |
| 24 | app:layout_constraintEnd_toEndOf="parent" | 24 | app:layout_constraintEnd_toEndOf="parent" |
| 25 | app:layout_constraintStart_toStartOf="parent" | 25 | app:layout_constraintStart_toStartOf="parent" |
| 26 | app:layout_constraintTop_toTopOf="parent" /> | 26 | app:layout_constraintTop_toTopOf="parent" /> |
| 27 | 27 | ||
| 28 | <TextView | 28 | <TextView |
| 29 | android:id="@+id/tvSeleccioneServidor" | 29 | android:id="@+id/tvSeleccioneServidor" |
| 30 | android:layout_width="0dp" | 30 | android:layout_width="0dp" |
| 31 | android:layout_height="wrap_content" | 31 | android:layout_height="wrap_content" |
| 32 | 32 | ||
| 33 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 33 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 34 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 34 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
| 35 | android:gravity="start" | 35 | android:gravity="start" |
| 36 | android:lines="1" | 36 | android:lines="1" |
| 37 | android:text="@string/tvSeleccioneServidor" | 37 | android:text="@string/tvSeleccioneServidor" |
| 38 | android:textColor="@android:color/black" | 38 | android:textColor="@android:color/black" |
| 39 | android:textSize="@dimen/SubTitulos" | 39 | android:textSize="@dimen/SubTitulos" |
| 40 | app:fontFamily="sans-serif-condensed" | 40 | app:fontFamily="sans-serif-condensed" |
| 41 | app:layout_constraintBottom_toTopOf="@+id/spServidor" | 41 | app:layout_constraintBottom_toTopOf="@+id/spServidor" |
| 42 | app:layout_constraintEnd_toEndOf="parent" | 42 | app:layout_constraintEnd_toEndOf="parent" |
| 43 | app:layout_constraintStart_toStartOf="parent" | 43 | app:layout_constraintStart_toStartOf="parent" |
| 44 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | 44 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
| 45 | 45 | ||
| 46 | <Spinner | 46 | <Spinner |
| 47 | android:id="@+id/spServidor" | 47 | android:id="@+id/spServidor" |
| 48 | style="@android:style/Widget.Holo.Light.Spinner" | 48 | style="@android:style/Widget.Holo.Light.Spinner" |
| 49 | android:layout_width="0dp" | 49 | android:layout_width="0dp" |
| 50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
| 51 | android:elevation="5dp" | 51 | android:elevation="5dp" |
| 52 | 52 | ||
| 53 | android:textSize="@dimen/NormalText" | 53 | android:textSize="@dimen/NormalText" |
| 54 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 54 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
| 55 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" | 55 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" |
| 56 | app:layout_constraintHorizontal_chainStyle="packed" | 56 | app:layout_constraintHorizontal_chainStyle="packed" |
| 57 | app:layout_constraintStart_toStartOf="parent" | 57 | app:layout_constraintStart_toStartOf="parent" |
| 58 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" | 58 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" |
| 59 | /> | 59 | /> |
| 60 | 60 | ||
| 61 | <Button | 61 | <Button |
| 62 | android:id="@+id/btnValidarServidor" | 62 | android:id="@+id/btnValidarServidor" |
| 63 | android:layout_width="wrap_content" | 63 | android:layout_width="wrap_content" |
| 64 | android:layout_height="wrap_content" | 64 | android:layout_height="wrap_content" |
| 65 | android:textColor="@android:color/white" | 65 | android:textColor="@android:color/white" |
| 66 | android:padding="10dp" | 66 | android:padding="10dp" |
| 67 | android:background="@drawable/boton_borde_redondeado" | 67 | android:background="@drawable/boton_borde_redondeado" |
| 68 | android:text="@string/btnValidarServidor" | 68 | android:text="@string/btnValidarServidor" |
| 69 | android:textSize="@dimen/NormalText" | 69 | android:textSize="@dimen/NormalText" |
| 70 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 70 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
| 71 | app:layout_constraintEnd_toEndOf="parent" | 71 | app:layout_constraintEnd_toEndOf="parent" |
| 72 | app:layout_constraintHorizontal_chainStyle="packed" | 72 | app:layout_constraintHorizontal_chainStyle="packed" |
| 73 | app:layout_constraintStart_toEndOf="@id/spServidor" | 73 | app:layout_constraintStart_toEndOf="@id/spServidor" |
| 74 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> | 74 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> |
| 75 | 75 | ||
| 76 | <Button | 76 | <Button |
| 77 | android:id="@+id/btnAgregarServidor" | 77 | android:id="@+id/btnAgregarServidor" |
| 78 | android:layout_width="0dp" | 78 | android:layout_width="0dp" |
| 79 | android:layout_height="wrap_content" | 79 | android:layout_height="wrap_content" |
| 80 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 80 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 81 | android:layout_marginEnd="@dimen/MarginBotAgreSer" | 81 | android:layout_marginEnd="@dimen/MarginBotAgreSer" |
| 82 | android:text="@string/btnAgregarServidor" | 82 | android:text="@string/btnAgregarServidor" |
| 83 | android:textSize="@dimen/NormalText" | 83 | android:textSize="@dimen/NormalText" |
| 84 | android:textColor="@android:color/white" | 84 | android:textColor="@android:color/white" |
| 85 | android:padding="10dp" | 85 | android:padding="10dp" |
| 86 | android:background="@drawable/boton_borde_redondeado" | 86 | android:background="@drawable/boton_borde_redondeado" |
| 87 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" | 87 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" |
| 88 | app:layout_constraintEnd_toEndOf="parent" | 88 | app:layout_constraintEnd_toEndOf="parent" |
| 89 | app:layout_constraintStart_toStartOf="parent" | 89 | app:layout_constraintStart_toStartOf="parent" |
| 90 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> | 90 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> |
| 91 | 91 | ||
| 92 | 92 | ||
| 93 | <TextView | 93 | <TextView |
| 94 | android:id="@+id/tvUbicacionCarpetas" | 94 | android:id="@+id/tvUbicacionCarpetas" |
| 95 | android:layout_width="0dp" | 95 | android:layout_width="0dp" |
| 96 | android:layout_height="wrap_content" | 96 | android:layout_height="wrap_content" |
| 97 | 97 | android:visibility="gone" | |
| 98 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 98 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 99 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 99 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
| 100 | android:gravity="start" | 100 | android:gravity="start" |
| 101 | android:lines="1" | 101 | android:lines="1" |
| 102 | android:text="@string/tvUbicacionCarpetas" | 102 | android:text="@string/tvUbicacionCarpetas" |
| 103 | android:textColor="@android:color/black" | 103 | android:textColor="@android:color/black" |
| 104 | android:textSize="@dimen/SubTitulos" | 104 | android:textSize="@dimen/SubTitulos" |
| 105 | app:fontFamily="sans-serif-condensed" | 105 | app:fontFamily="sans-serif-condensed" |
| 106 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" | 106 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" |
| 107 | app:layout_constraintEnd_toEndOf="parent" | 107 | app:layout_constraintEnd_toEndOf="parent" |
| 108 | app:layout_constraintStart_toStartOf="parent" | 108 | app:layout_constraintStart_toStartOf="parent" |
| 109 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> | 109 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> |
| 110 | 110 | ||
| 111 | <ImageButton | 111 | <ImageButton |
| 112 | android:id="@+id/ibSearch" | 112 | android:id="@+id/ibSearch" |
| 113 | android:layout_width="36dp" | 113 | android:layout_width="36dp" |
| 114 | android:layout_height="37dp" | 114 | android:layout_height="37dp" |
| 115 | android:layout_margin="10dp" | 115 | android:layout_margin="10dp" |
| 116 | android:src="@drawable/search" | 116 | android:src="@drawable/search" |
| 117 | android:textColor="@android:color/white" | 117 | android:textColor="@android:color/white" |
| 118 | android:padding="10dp" | 118 | android:padding="10dp" |
| 119 | android:visibility="gone" | ||
| 119 | android:background="@drawable/boton_borde_redondeado" | 120 | android:background="@drawable/boton_borde_redondeado" |
| 120 | app:layout_constraintEnd_toStartOf="@+id/etRuta" | 121 | app:layout_constraintEnd_toStartOf="@+id/etRuta" |
| 121 | app:layout_constraintStart_toStartOf="parent" | 122 | app:layout_constraintStart_toStartOf="parent" |
| 122 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 123 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
| 123 | 124 | ||
| 124 | <EditText | 125 | <EditText |
| 125 | android:id="@+id/etRuta" | 126 | android:id="@+id/etRuta" |
| 126 | android:layout_width="0dp" | 127 | android:layout_width="0dp" |
| 127 | android:layout_height="wrap_content" | 128 | android:layout_height="wrap_content" |
| 128 | android:layout_marginTop="10dp" | 129 | android:layout_marginTop="10dp" |
| 129 | android:layout_marginEnd="10dp" | 130 | android:layout_marginEnd="10dp" |
| 130 | android:clickable="true" | 131 | android:clickable="true" |
| 131 | android:ems="10" | 132 | android:ems="10" |
| 132 | android:focusable="true" | 133 | android:focusable="true" |
| 134 | android:visibility="gone" | ||
| 133 | android:inputType="textPersonName" | 135 | android:inputType="textPersonName" |
| 134 | android:lines="1" | 136 | android:lines="1" |
| 135 | android:text="" | 137 | android:text="" |
| 136 | android:textSize="@dimen/NormalText" | 138 | android:textSize="@dimen/NormalText" |
| 137 | app:layout_constraintEnd_toEndOf="parent" | 139 | app:layout_constraintEnd_toEndOf="parent" |
| 138 | app:layout_constraintStart_toEndOf="@id/ibSearch" | 140 | app:layout_constraintStart_toEndOf="@id/ibSearch" |
| 139 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 141 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
| 140 | 142 | ||
| 141 | <TextView | 143 | <TextView |
| 142 | android:id="@+id/tvActuFecha" | 144 | android:id="@+id/tvActuFecha" |
| 143 | android:layout_width="0dp" | 145 | android:layout_width="0dp" |
| 144 | android:layout_height="wrap_content" | 146 | android:layout_height="wrap_content" |
| 145 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 147 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 146 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 148 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
| 147 | android:gravity="start" | 149 | android:gravity="start" |
| 148 | android:lines="1" | 150 | android:lines="1" |
| 149 | android:text="@string/tvTituloArea" | 151 | android:text="@string/tvTituloArea" |
| 150 | android:textColor="@android:color/black" | 152 | android:textColor="@android:color/black" |
| 151 | android:textSize="@dimen/SubTitulos" | 153 | android:textSize="@dimen/SubTitulos" |
| 152 | app:fontFamily="sans-serif-condensed" | 154 | app:fontFamily="sans-serif-condensed" |
| 153 | app:layout_constraintEnd_toEndOf="parent" | 155 | app:layout_constraintEnd_toEndOf="parent" |
| 154 | app:layout_constraintStart_toStartOf="parent" | 156 | app:layout_constraintStart_toStartOf="parent" |
| 155 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> | 157 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> |
| 156 | 158 | ||
| 157 | <RadioGroup | 159 | <RadioGroup |
| 158 | android:id="@+id/rgFechaHora" | 160 | android:id="@+id/rgFechaHora" |
| 159 | android:layout_width="0dp" | 161 | android:layout_width="0dp" |
| 160 | android:layout_height="wrap_content" | 162 | android:layout_height="wrap_content" |
| 161 | 163 | ||
| 162 | android:gravity="center" | 164 | android:gravity="center" |
| 163 | android:orientation="horizontal" | 165 | android:orientation="horizontal" |
| 164 | app:layout_constraintEnd_toEndOf="parent" | 166 | app:layout_constraintEnd_toEndOf="parent" |
| 165 | app:layout_constraintStart_toStartOf="parent" | 167 | app:layout_constraintStart_toStartOf="parent" |
| 166 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> | 168 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> |
| 167 | 169 | ||
| 168 | <RadioButton | 170 | <RadioButton |
| 169 | android:id="@+id/rbVentas" | 171 | android:id="@+id/rbVentas" |
| 170 | android:layout_width="wrap_content" | 172 | android:layout_width="wrap_content" |
| 171 | android:layout_height="wrap_content" | 173 | android:layout_height="wrap_content" |
| 172 | android:layout_margin="5dp" | 174 | android:layout_margin="5dp" |
| 173 | android:checked="true" | 175 | android:checked="true" |
| 174 | android:padding="5dp" | 176 | android:padding="5dp" |
| 175 | android:text="@string/rbVentas" | 177 | android:text="@string/rbVentas" |
| 176 | android:textSize="@dimen/NormalText" /> | 178 | android:textSize="@dimen/NormalText" /> |
| 177 | 179 | ||
| 178 | <RadioButton | 180 | <RadioButton |
| 179 | android:id="@+id/rbDeposito" | 181 | android:id="@+id/rbDeposito" |
| 180 | android:layout_width="wrap_content" | 182 | android:layout_width="wrap_content" |
| 181 | android:layout_height="wrap_content" | 183 | android:layout_height="wrap_content" |
| 182 | android:layout_margin="5dp" | 184 | android:layout_margin="5dp" |
| 183 | android:checked="false" | 185 | android:checked="false" |
| 184 | android:padding="5dp" | 186 | android:padding="5dp" |
| 185 | android:text="@string/rbDeposito" | 187 | android:text="@string/rbDeposito" |
| 186 | android:textSize="@dimen/NormalText" /> | 188 | android:textSize="@dimen/NormalText" /> |
| 187 | 189 | ||
| 188 | </RadioGroup> | 190 | </RadioGroup> |
| 189 | 191 | ||
| 190 | <TextView | 192 | <TextView |
| 191 | android:id="@+id/tvLosProductos" | 193 | android:id="@+id/tvLosProductos" |
| 192 | android:layout_width="0dp" | 194 | android:layout_width="0dp" |
| 193 | android:layout_height="wrap_content" | 195 | android:layout_height="wrap_content" |
| 194 | 196 | ||
| 195 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 197 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 196 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 198 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
| 197 | android:gravity="start" | 199 | android:gravity="start" |
| 198 | android:lines="1" | 200 | android:lines="1" |
| 199 | android:text="@string/tvLosProductos" | 201 | android:text="@string/tvLosProductos" |
| 200 | android:textColor="@android:color/black" | 202 | android:textColor="@android:color/black" |
| 201 | android:textSize="@dimen/SubTitulos" | 203 | android:textSize="@dimen/SubTitulos" |
| 202 | app:fontFamily="sans-serif-condensed" | 204 | app:fontFamily="sans-serif-condensed" |
| 203 | app:layout_constraintEnd_toEndOf="parent" | 205 | app:layout_constraintEnd_toEndOf="parent" |
| 204 | app:layout_constraintStart_toStartOf="parent" | 206 | app:layout_constraintStart_toStartOf="parent" |
| 205 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 207 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
| 206 | 208 | ||
| 207 | <RadioGroup | 209 | <RadioGroup |
| 208 | android:id="@+id/rgLosProductos" | 210 | android:id="@+id/rgLosProductos" |
| 209 | android:layout_width="0dp" | 211 | android:layout_width="0dp" |
| 210 | android:layout_height="wrap_content" | 212 | android:layout_height="wrap_content" |
| 211 | 213 | ||
| 212 | android:gravity="center" | 214 | android:gravity="center" |
| 213 | android:orientation="vertical" | 215 | android:orientation="vertical" |
| 214 | app:layout_constraintEnd_toEndOf="parent" | 216 | app:layout_constraintEnd_toEndOf="parent" |
| 215 | app:layout_constraintStart_toStartOf="parent" | 217 | app:layout_constraintStart_toStartOf="parent" |
| 216 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> | 218 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> |
| 217 | 219 | ||
| 218 | <RadioButton | 220 | <RadioButton |
| 219 | android:id="@+id/rbProInclu" | 221 | android:id="@+id/rbProInclu" |
| 220 | android:layout_width="match_parent" | 222 | android:layout_width="match_parent" |
| 221 | android:layout_height="wrap_content" | 223 | android:layout_height="wrap_content" |
| 222 | 224 | ||
| 223 | android:layout_margin="@dimen/PadingCbyRb" | 225 | android:layout_margin="@dimen/PadingCbyRb" |
| 224 | android:checked="true" | 226 | android:checked="true" |
| 225 | android:padding="@dimen/PadingCbyRb" | 227 | android:padding="@dimen/PadingCbyRb" |
| 226 | android:text="@string/rbProInclu" | 228 | android:text="@string/rbProInclu" |
| 227 | android:textSize="@dimen/NormalText" /> | 229 | android:textSize="@dimen/NormalText" /> |
| 228 | 230 | ||
| 229 | <RadioButton | 231 | <RadioButton |
| 230 | android:id="@+id/rbProNoInclu" | 232 | android:id="@+id/rbProNoInclu" |
| 231 | android:layout_width="match_parent" | 233 | android:layout_width="match_parent" |
| 232 | android:layout_height="wrap_content" | 234 | android:layout_height="wrap_content" |
| 233 | android:layout_margin="@dimen/PadingCbyRb" | 235 | android:layout_margin="@dimen/PadingCbyRb" |
| 234 | android:checked="false" | 236 | android:checked="false" |
| 235 | android:padding="@dimen/PadingCbyRb" | 237 | android:padding="@dimen/PadingCbyRb" |
| 236 | android:text="@string/rbProNoInclu" | 238 | android:text="@string/rbProNoInclu" |
| 237 | android:textSize="@dimen/NormalText" /> | 239 | android:textSize="@dimen/NormalText" /> |
| 238 | 240 | ||
| 239 | </RadioGroup> | 241 | </RadioGroup> |
| 240 | 242 | ||
| 241 | <CheckBox | 243 | <CheckBox |
| 242 | android:id="@+id/cbHabiLectura" | 244 | android:id="@+id/cbHabiLectura" |
| 243 | android:layout_width="0dp" | 245 | android:layout_width="0dp" |
| 244 | android:layout_height="wrap_content" | 246 | android:layout_height="wrap_content" |
| 245 | android:layout_margin="@dimen/PadingCbyRb" | 247 | android:layout_margin="@dimen/PadingCbyRb" |
| 246 | android:padding="@dimen/PadingCbyRb" | 248 | android:padding="@dimen/PadingCbyRb" |
| 247 | android:text="@string/cbHabiLectura" | 249 | android:text="@string/cbHabiLectura" |
| 248 | android:textSize="@dimen/NormalText" | 250 | android:textSize="@dimen/NormalText" |
| 249 | app:layout_constraintEnd_toEndOf="parent" | 251 | app:layout_constraintEnd_toEndOf="parent" |
| 250 | app:layout_constraintStart_toStartOf="parent" | 252 | app:layout_constraintStart_toStartOf="parent" |
| 251 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> | 253 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> |
| 252 | 254 | ||
| 253 | <CheckBox | 255 | <CheckBox |
| 254 | android:id="@+id/cbMostrarStock" | 256 | android:id="@+id/cbMostrarStock" |
| 255 | android:layout_width="0dp" | 257 | android:layout_width="0dp" |
| 256 | android:layout_height="wrap_content" | 258 | android:layout_height="wrap_content" |
| 257 | android:layout_margin="@dimen/PadingCbyRb" | 259 | android:layout_margin="@dimen/PadingCbyRb" |
| 258 | android:padding="@dimen/PadingCbyRb" | 260 | android:padding="@dimen/PadingCbyRb" |
| 259 | android:text="@string/cbMostrarStock" | 261 | android:text="@string/cbMostrarStock" |
| 260 | android:textSize="@dimen/NormalText" | 262 | android:textSize="@dimen/NormalText" |
| 261 | app:layout_constraintEnd_toEndOf="parent" | 263 | app:layout_constraintEnd_toEndOf="parent" |
| 262 | app:layout_constraintStart_toStartOf="parent" | 264 | app:layout_constraintStart_toStartOf="parent" |
| 263 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> | 265 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> |
| 264 | 266 | ||
| 265 | <TextView | 267 | <TextView |
| 266 | android:id="@+id/tvColumMostrar" | 268 | android:id="@+id/tvColumMostrar" |
| 267 | android:layout_width="0dp" | 269 | android:layout_width="0dp" |
| 268 | android:layout_height="wrap_content" | 270 | android:layout_height="wrap_content" |
| 269 | 271 | ||
| 270 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 272 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 271 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 273 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
| 272 | android:gravity="start" | 274 | android:gravity="start" |
| 273 | android:lines="1" | 275 | android:lines="1" |
| 274 | android:text="@string/tvColumMostrar" | 276 | android:text="@string/tvColumMostrar" |
| 275 | android:textColor="@android:color/black" | 277 | android:textColor="@android:color/black" |
| 276 | android:textSize="@dimen/SubTitulos" | 278 | android:textSize="@dimen/SubTitulos" |
| 277 | app:fontFamily="sans-serif-condensed" | 279 | app:fontFamily="sans-serif-condensed" |
| 278 | app:layout_constraintEnd_toEndOf="parent" | 280 | app:layout_constraintEnd_toEndOf="parent" |
| 279 | app:layout_constraintStart_toStartOf="parent" | 281 | app:layout_constraintStart_toStartOf="parent" |
| 280 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> | 282 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> |
| 281 | 283 | ||
| 282 | <RadioGroup | 284 | <RadioGroup |
| 283 | android:id="@+id/rgCodigosMostrar" | 285 | android:id="@+id/rgCodigosMostrar" |
| 284 | android:layout_width="0dp" | 286 | android:layout_width="0dp" |
| 285 | android:layout_height="wrap_content" | 287 | android:layout_height="wrap_content" |
| 286 | 288 | ||
| 287 | android:gravity="center" | 289 | android:gravity="center" |
| 288 | android:orientation="horizontal" | 290 | android:orientation="horizontal" |
| 289 | app:layout_constraintEnd_toEndOf="parent" | 291 | app:layout_constraintEnd_toEndOf="parent" |
| 290 | app:layout_constraintStart_toStartOf="parent" | 292 | app:layout_constraintStart_toStartOf="parent" |
| 291 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> | 293 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> |
| 292 | 294 | ||
| 293 | <RadioButton | 295 | <RadioButton |
| 294 | android:id="@+id/rbCodigoDebo" | 296 | android:id="@+id/rbCodigoDebo" |
| 295 | android:layout_width="wrap_content" | 297 | android:layout_width="wrap_content" |
| 296 | android:layout_height="wrap_content" | 298 | android:layout_height="wrap_content" |
| 297 | android:layout_margin="5dp" | 299 | android:layout_margin="5dp" |
| 298 | android:checked="true" | 300 | android:checked="true" |
| 299 | android:padding="5dp" | 301 | android:padding="5dp" |
| 300 | android:text="@string/rbCodigoDebo" | 302 | android:text="@string/rbCodigoDebo" |
| 301 | android:textSize="@dimen/NormalText" /> | 303 | android:textSize="@dimen/NormalText" /> |
| 302 | 304 | ||
| 303 | <RadioButton | 305 | <RadioButton |
| 304 | android:id="@+id/rbCodigoOrigen" | 306 | android:id="@+id/rbCodigoOrigen" |
| 305 | android:layout_width="wrap_content" | 307 | android:layout_width="wrap_content" |
| 306 | android:layout_height="wrap_content" | 308 | android:layout_height="wrap_content" |
| 307 | android:layout_margin="5dp" | 309 | android:layout_margin="5dp" |
| 308 | android:checked="false" | 310 | android:checked="false" |
| 309 | android:padding="5dp" | 311 | android:padding="5dp" |
| 310 | android:text="@string/rbCodigoOrigen" | 312 | android:text="@string/rbCodigoOrigen" |
| 311 | android:textSize="@dimen/NormalText" /> | 313 | android:textSize="@dimen/NormalText" /> |
| 312 | 314 | ||
| 313 | <RadioButton | 315 | <RadioButton |
| 314 | android:id="@+id/rbCodigoBarras" | 316 | android:id="@+id/rbCodigoBarras" |
| 315 | android:layout_width="wrap_content" | 317 | android:layout_width="wrap_content" |
| 316 | android:layout_height="wrap_content" | 318 | android:layout_height="wrap_content" |
| 317 | android:layout_margin="5dp" | 319 | android:layout_margin="5dp" |
| 318 | android:padding="5dp" | 320 | android:padding="5dp" |
| 319 | android:text="@string/rbCodigoBarras" | 321 | android:text="@string/rbCodigoBarras" |
| 320 | android:textSize="@dimen/NormalText" /> | 322 | android:textSize="@dimen/NormalText" /> |
| 321 | </RadioGroup> | 323 | </RadioGroup> |
| 322 | 324 | ||
| 323 | <CheckBox | 325 | <CheckBox |
| 324 | android:id="@+id/cbMostrarExistencia" | 326 | android:id="@+id/cbMostrarExistencia" |
| 325 | android:layout_width="wrap_content" | 327 | android:layout_width="wrap_content" |
| 326 | android:layout_height="wrap_content" | 328 | android:layout_height="wrap_content" |
| 327 | android:layout_margin="@dimen/PadingCbyRb" | 329 | android:layout_margin="@dimen/PadingCbyRb" |
| 328 | android:padding="@dimen/PadingCbyRb" | 330 | android:padding="@dimen/PadingCbyRb" |
| 329 | android:text="@string/cbMostrarExistencia" | 331 | android:text="@string/cbMostrarExistencia" |
| 330 | android:textSize="@dimen/NormalText" | 332 | android:textSize="@dimen/NormalText" |
| 331 | android:checked="false" | 333 | android:checked="false" |
| 332 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" | 334 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" |
| 333 | app:layout_constraintStart_toStartOf="parent" | 335 | app:layout_constraintStart_toStartOf="parent" |
| 334 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 336 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
| 335 | 337 | ||
| 336 | <CheckBox | 338 | <CheckBox |
| 337 | android:id="@+id/cbMostrarPrecio" | 339 | android:id="@+id/cbMostrarPrecio" |
| 338 | android:layout_width="wrap_content" | 340 | android:layout_width="wrap_content" |
| 339 | android:layout_height="wrap_content" | 341 | android:layout_height="wrap_content" |
| 340 | android:layout_margin="@dimen/PadingCbyRb" | 342 | android:layout_margin="@dimen/PadingCbyRb" |
| 341 | android:padding="@dimen/PadingCbyRb" | 343 | android:padding="@dimen/PadingCbyRb" |
| 342 | android:text="@string/cbMostrarPrecio" | 344 | android:text="@string/cbMostrarPrecio" |
| 343 | android:textSize="@dimen/NormalText" | 345 | android:textSize="@dimen/NormalText" |
| 344 | android:checked="false" | 346 | android:checked="false" |
| 345 | app:layout_constraintEnd_toEndOf="parent" | 347 | app:layout_constraintEnd_toEndOf="parent" |
| 346 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" | 348 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" |
| 347 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 349 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
| 348 | 350 | ||
| 349 | <Button | 351 | <Button |
| 350 | android:id="@+id/btnGuardar" | 352 | android:id="@+id/btnGuardar" |
| 351 | android:layout_width="wrap_content" | 353 | android:layout_width="wrap_content" |
| 352 | android:layout_height="wrap_content" | 354 | android:layout_height="wrap_content" |
| 353 | android:text="@string/btnGuardar" | 355 | android:text="@string/btnGuardar" |
| 354 | android:textSize="@dimen/NormalText" | 356 | android:textSize="@dimen/NormalText" |
| 355 | app:layout_constraintEnd_toEndOf="parent" | 357 | app:layout_constraintEnd_toEndOf="parent" |
| 356 | android:textColor="@android:color/white" | 358 | android:textColor="@android:color/white" |
| 357 | android:padding="10dp" | 359 | android:padding="10dp" |
| 358 | android:background="@drawable/boton_borde_redondeado" | 360 | android:background="@drawable/boton_borde_redondeado" |
| 359 | app:layout_constraintStart_toStartOf="parent" | 361 | app:layout_constraintStart_toStartOf="parent" |
| 360 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> | 362 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> |
| 361 | 363 | ||
| 362 | </androidx.constraintlayout.widget.ConstraintLayout> | 364 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 363 | 365 | ||
| 364 | 366 |
app/src/main/res/layout/fragment_detalle_art.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | android:id="@+id/nsPedidosDatos" | 4 | android:id="@+id/nsPedidosDatos" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent"> | 6 | android:layout_height="match_parent"> |
| 7 | 7 | ||
| 8 | <androidx.cardview.widget.CardView | 8 | <androidx.cardview.widget.CardView |
| 9 | android:id="@+id/cvItem1" | 9 | android:id="@+id/cvItem1" |
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
| 12 | android:layout_marginStart="5dp" | 12 | android:layout_marginStart="5dp" |
| 13 | android:layout_marginTop="5dp" | 13 | android:layout_marginTop="5dp" |
| 14 | android:layout_marginEnd="5dp" | 14 | android:layout_marginEnd="5dp" |
| 15 | app:cardBackgroundColor="@android:color/darker_gray" | 15 | app:cardBackgroundColor="@android:color/darker_gray" |
| 16 | app:cardCornerRadius="4dp" | 16 | app:cardCornerRadius="25dp" |
| 17 | app:cardElevation="4dp" | 17 | app:cardElevation="10dp" |
| 18 | app:layout_constraintEnd_toEndOf="parent" | 18 | app:layout_constraintEnd_toEndOf="parent" |
| 19 | app:layout_constraintStart_toStartOf="parent" | 19 | app:layout_constraintStart_toStartOf="parent" |
| 20 | app:layout_constraintTop_toTopOf="parent"> | 20 | app:layout_constraintTop_toTopOf="parent"> |
| 21 | 21 | ||
| 22 | <androidx.constraintlayout.widget.ConstraintLayout | 22 | <androidx.constraintlayout.widget.ConstraintLayout |
| 23 | android:id="@+id/clayout" | 23 | android:id="@+id/clayout" |
| 24 | android:layout_width="match_parent" | 24 | android:layout_width="match_parent" |
| 25 | android:layout_height="match_parent"> | 25 | android:layout_height="match_parent"> |
| 26 | 26 | ||
| 27 | <TextView | 27 | <TextView |
| 28 | android:id="@+id/tvTime" | 28 | android:id="@+id/tvTime" |
| 29 | android:layout_width="0dp" | 29 | android:layout_width="0dp" |
| 30 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
| 31 | android:layout_marginTop="15dp" | 31 | android:layout_marginTop="15dp" |
| 32 | android:gravity="center" | 32 | android:gravity="center_horizontal" |
| 33 | android:orientation="horizontal" | ||
| 33 | android:text="Detalle del artículo" | 34 | android:text="Detalle del artículo" |
| 34 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 35 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 35 | android:textSize="@dimen/Titulos" | 36 | android:textSize="@dimen/Titulos" |
| 36 | android:textStyle="bold" | 37 | android:textStyle="bold" |
| 37 | app:layout_constraintEnd_toEndOf="parent" | 38 | app:layout_constraintEnd_toEndOf="parent" |
| 38 | app:layout_constraintStart_toStartOf="parent" | 39 | app:layout_constraintStart_toStartOf="parent" |
| 39 | app:layout_constraintTop_toTopOf="parent" /> | 40 | app:layout_constraintTop_toTopOf="parent" /> |
| 40 | 41 | ||
| 41 | <TextView | 42 | <TextView |
| 42 | android:id="@+id/textView19" | 43 | android:id="@+id/textView6" |
| 43 | android:layout_width="wrap_content" | 44 | android:layout_width="wrap_content" |
| 44 | android:layout_height="wrap_content" | 45 | android:layout_height="wrap_content" |
| 45 | android:layout_marginStart="5dp" | 46 | android:layout_marginStart="5dp" |
| 46 | android:layout_marginTop="10dp" | 47 | android:layout_marginTop="10dp" |
| 47 | android:text="Sector:" | 48 | android:text="Descripción:" |
| 48 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 49 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 49 | android:textSize="15sp" | 50 | android:textSize="14sp" |
| 50 | app:layout_constraintEnd_toStartOf="@id/tvSector" | 51 | app:layout_constraintEnd_toStartOf="@id/tvDescripcion" |
| 51 | app:layout_constraintStart_toStartOf="parent" | 52 | app:layout_constraintStart_toStartOf="parent" |
| 52 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | 53 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> |
| 53 | 54 | ||
| 54 | <TextView | 55 | <TextView |
| 55 | android:id="@+id/tvSector" | 56 | android:id="@+id/tvDescripcion" |
| 56 | android:layout_width="0dp" | 57 | android:layout_width="0dp" |
| 57 | android:layout_height="wrap_content" | 58 | android:layout_height="wrap_content" |
| 59 | android:layout_marginStart="5dp" | ||
| 60 | android:layout_marginTop="10dp" | ||
| 61 | android:lines="2" | ||
| 58 | android:text="" | 62 | android:text="" |
| 59 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 63 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 60 | android:textSize="18sp" | 64 | android:textSize="18sp" |
| 61 | app:layout_constraintBaseline_toBaselineOf="@+id/textView19" | 65 | android:textStyle="bold" |
| 62 | app:layout_constraintEnd_toStartOf="@id/textView18" | 66 | app:layout_constraintBaseline_toBaselineOf="@+id/textView6" |
| 63 | app:layout_constraintStart_toEndOf="@id/textView19" /> | 67 | app:layout_constraintEnd_toEndOf="parent" |
| 68 | app:layout_constraintStart_toEndOf="@+id/textView6" /> | ||
| 69 | |||
| 64 | 70 | ||
| 65 | <TextView | 71 | <TextView |
| 66 | android:id="@+id/textView18" | 72 | android:id="@+id/textView18" |
| 67 | android:layout_width="wrap_content" | 73 | android:layout_width="wrap_content" |
| 68 | android:layout_height="wrap_content" | 74 | android:layout_height="wrap_content" |
| 75 | android:layout_marginStart="5dp" | ||
| 69 | android:layout_marginTop="10dp" | 76 | android:layout_marginTop="10dp" |
| 70 | android:text="Código:" | 77 | android:text="Código:" |
| 71 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 78 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 72 | android:textSize="15sp" | 79 | android:textSize="15sp" |
| 73 | app:layout_constraintEnd_toStartOf="@id/tvCodigo" | 80 | app:layout_constraintStart_toStartOf="parent" |
| 74 | app:layout_constraintStart_toEndOf="@id/tvSector" | 81 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> |
| 75 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
| 76 | 82 | ||
| 77 | <TextView | 83 | <TextView |
| 78 | android:id="@+id/tvCodigo" | 84 | android:id="@+id/tvSector" |
| 79 | android:layout_width="0dp" | 85 | android:layout_width="0dp" |
| 80 | android:layout_height="wrap_content" | 86 | android:layout_height="wrap_content" |
| 81 | android:text="" | 87 | android:layout_marginStart="5dp" |
| 88 | android:layout_marginTop="10dp" | ||
| 89 | android:text="99" | ||
| 82 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 90 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 83 | android:textSize="18sp" | 91 | android:textSize="18sp" |
| 92 | android:textStyle="bold" | ||
| 84 | app:layout_constraintBaseline_toBaselineOf="@+id/textView18" | 93 | app:layout_constraintBaseline_toBaselineOf="@+id/textView18" |
| 85 | app:layout_constraintEnd_toStartOf="@+id/textView3" | 94 | app:layout_constraintStart_toEndOf="@+id/textView18" /> |
| 86 | app:layout_constraintStart_toEndOf="@id/textView18" /> | ||
| 87 | 95 | ||
| 88 | <TextView | 96 | <TextView |
| 89 | android:id="@+id/textView3" | 97 | android:id="@+id/tvCodigo" |
| 90 | android:layout_width="wrap_content" | ||
| 91 | android:layout_height="wrap_content" | ||
| 92 | android:layout_marginTop="10dp" | ||
| 93 | android:text="Depósito:" | ||
| 94 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| 95 | android:textSize="15sp" | ||
| 96 | app:layout_constraintEnd_toStartOf="@id/tvDeposito" | ||
| 97 | app:layout_constraintStart_toEndOf="@id/tvCodigo" | ||
| 98 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
| 99 | |||
| 100 | <TextView | ||
| 101 | android:id="@+id/tvDeposito" | ||
| 102 | android:layout_width="0dp" | 98 | android:layout_width="0dp" |
| 103 | android:layout_height="wrap_content" | 99 | android:layout_height="wrap_content" |
| 104 | android:text="" | 100 | android:layout_marginStart="5dp" |
| 101 | android:layout_marginTop="10dp" | ||
| 102 | android:text="99999" | ||
| 105 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 103 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 106 | android:textSize="18sp" | 104 | android:textSize="18sp" |
| 107 | app:layout_constraintBaseline_toBaselineOf="@+id/textView3" | 105 | android:textStyle="bold" |
| 108 | app:layout_constraintEnd_toEndOf="parent" | 106 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" |
| 109 | app:layout_constraintStart_toEndOf="@id/textView3" /> | 107 | app:layout_constraintStart_toEndOf="@id/tvSector" /> |
| 108 | |||
| 110 | 109 | ||
| 111 | <TextView | 110 | <TextView |
| 112 | android:id="@+id/textView6" | 111 | android:id="@+id/textView1" |
| 113 | android:layout_width="wrap_content" | 112 | android:layout_width="0dp" |
| 114 | android:layout_height="wrap_content" | 113 | android:layout_height="wrap_content" |
| 115 | android:layout_marginStart="5dp" | 114 | android:layout_marginStart="5dp" |
| 116 | android:layout_marginTop="10dp" | 115 | android:layout_marginTop="10dp" |
| 117 | android:text="Descripción:" | 116 | android:text="Código barras:" |
| 118 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 117 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 119 | android:textSize="14sp" | 118 | android:textSize="15sp" |
| 120 | app:layout_constraintEnd_toStartOf="@id/tvDescripcion" | 119 | app:layout_constraintBaseline_toBaselineOf="@+id/tvCodigo" |
| 121 | app:layout_constraintStart_toStartOf="parent" | 120 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" /> |
| 122 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | ||
| 123 | 121 | ||
| 124 | <TextView | 122 | <TextView |
| 125 | android:id="@+id/tvDescripcion" | 123 | android:id="@+id/tvCodigoBarras" |
| 126 | android:layout_width="0dp" | 124 | android:layout_width="wrap_content" |
| 127 | android:layout_height="wrap_content" | 125 | android:layout_height="wrap_content" |
| 128 | android:layout_marginStart="5dp" | 126 | android:layout_marginStart="5dp" |
| 129 | android:layout_marginTop="10dp" | 127 | android:text="1234567890123" |
| 130 | android:lines="2" | ||
| 131 | android:text="" | ||
| 132 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 128 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 133 | android:textSize="18sp" | 129 | android:textSize="18sp" |
| 134 | app:layout_constraintEnd_toEndOf="parent" | 130 | android:textStyle="bold" |
| 135 | app:layout_constraintStart_toEndOf="@+id/textView6" | 131 | app:layout_constraintBaseline_toBaselineOf="@+id/textView1" |
| 136 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 132 | app:layout_constraintStart_toEndOf="@id/textView1" /> |
| 137 | 133 | ||
| 138 | <TextView | 134 | <TextView |
| 139 | android:id="@+id/textView1" | 135 | android:id="@+id/textView2" |
| 140 | android:layout_width="wrap_content" | 136 | android:layout_width="wrap_content" |
| 141 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
| 142 | android:layout_marginStart="5dp" | 138 | android:layout_marginStart="5dp" |
| 143 | android:layout_marginTop="10dp" | 139 | android:layout_marginTop="10dp" |
| 144 | android:text="C. de barras:" | 140 | android:text="Código origen:" |
| 145 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 141 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 146 | android:textSize="15sp" | 142 | android:textSize="15sp" |
| 147 | app:layout_constraintEnd_toStartOf="@id/tvCodigoBarras" | ||
| 148 | app:layout_constraintStart_toStartOf="parent" | 143 | app:layout_constraintStart_toStartOf="parent" |
| 149 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | 144 | app:layout_constraintTop_toBottomOf="@+id/textView18" /> |
| 145 | |||
| 150 | 146 | ||
| 151 | <TextView | 147 | <TextView |
| 152 | android:id="@+id/tvCodigoBarras" | 148 | android:id="@+id/tvCodigoOrigen" |
| 153 | android:layout_width="0dp" | 149 | android:layout_width="wrap_content" |
| 154 | android:layout_height="wrap_content" | 150 | android:layout_height="wrap_content" |
| 155 | android:text="" | 151 | android:layout_marginStart="5dp" |
| 152 | android:layout_marginTop="10dp" | ||
| 153 | android:text="9999999999" | ||
| 156 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 154 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 157 | android:textSize="18sp" | 155 | android:textSize="18sp" |
| 158 | app:layout_constraintBaseline_toBaselineOf="@+id/textView1" | 156 | android:textStyle="bold" |
| 159 | app:layout_constraintEnd_toStartOf="@id/textView2" | 157 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" |
| 160 | app:layout_constraintStart_toEndOf="@id/textView1" /> | 158 | app:layout_constraintStart_toEndOf="@+id/textView2" |
| 159 | app:layout_constraintTop_toBottomOf="@+id/textView18" /> | ||
| 161 | 160 | ||
| 162 | <TextView | 161 | <TextView |
| 163 | android:id="@+id/textView2" | 162 | android:id="@+id/textView3" |
| 164 | android:layout_width="wrap_content" | 163 | android:layout_width="wrap_content" |
| 165 | android:layout_height="wrap_content" | 164 | android:layout_height="wrap_content" |
| 165 | android:layout_marginStart="5dp" | ||
| 166 | android:layout_marginTop="10dp" | 166 | android:layout_marginTop="10dp" |
| 167 | android:text="C. origen:" | 167 | android:text="Depósito:" |
| 168 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 168 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 169 | android:textSize="15sp" | 169 | android:textSize="15sp" |
| 170 | app:layout_constraintEnd_toStartOf="@id/tvCodigoOrigen" | 170 | app:layout_constraintStart_toEndOf="@+id/tvCodigoOrigen" |
| 171 | app:layout_constraintStart_toEndOf="@id/tvCodigoBarras" | 171 | app:layout_constraintTop_toBottomOf="@+id/textView1" /> |
| 172 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | ||
| 173 | 172 | ||
| 174 | <TextView | 173 | <TextView |
| 175 | android:id="@+id/tvCodigoOrigen" | 174 | android:id="@+id/tvDeposito" |
| 176 | android:layout_width="0dp" | 175 | android:layout_width="wrap_content" |
| 177 | android:layout_height="wrap_content" | 176 | android:layout_height="wrap_content" |
| 178 | android:text="" | 177 | android:layout_marginStart="5dp" |
| 178 | android:text="SI" | ||
| 179 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 179 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 180 | android:textSize="18sp" | 180 | android:textSize="18sp" |
| 181 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" | 181 | android:textStyle="bold" |
| 182 | app:layout_constraintEnd_toEndOf="parent" | 182 | app:layout_constraintBaseline_toBaselineOf="@+id/textView3" |
| 183 | app:layout_constraintStart_toEndOf="@id/textView2" /> | 183 | app:layout_constraintStart_toEndOf="@+id/textView3" /> |
| 184 | |||
| 185 | 184 | ||
| 186 | <TextView | 185 | <TextView |
| 187 | android:id="@+id/textView5" | 186 | android:id="@+id/textView9" |
| 188 | android:layout_width="wrap_content" | 187 | android:layout_width="wrap_content" |
| 189 | android:layout_height="wrap_content" | 188 | android:layout_height="wrap_content" |
| 190 | android:layout_marginStart="5dp" | 189 | android:layout_marginStart="5dp" |
| 191 | android:layout_marginTop="10dp" | 190 | android:layout_marginTop="10dp" |
| 192 | android:text="Exi.venta:" | 191 | android:text="Precio:" |
| 193 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 192 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 194 | android:textSize="15sp" | 193 | android:textSize="15sp" |
| 195 | app:layout_constraintEnd_toStartOf="@id/tvExiVenta" | ||
| 196 | app:layout_constraintStart_toStartOf="parent" | 194 | app:layout_constraintStart_toStartOf="parent" |
| 197 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | 195 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
| 198 | 196 | ||
| 199 | <TextView | 197 | <TextView |
| 200 | android:id="@+id/tvExiVenta" | 198 | android:id="@+id/tvPrecio" |
| 201 | android:layout_width="0dp" | 199 | android:layout_width="wrap_content" |
| 202 | android:layout_height="wrap_content" | 200 | android:layout_height="wrap_content" |
| 203 | android:text="" | 201 | android:layout_marginStart="5dp" |
| 202 | android:layout_marginTop="10dp" | ||
| 203 | android:text="100.99" | ||
| 204 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 204 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 205 | android:textSize="18sp" | 205 | android:textSize="18sp" |
| 206 | app:layout_constraintBaseline_toBaselineOf="@+id/textView5" | 206 | android:textStyle="bold" |
| 207 | app:layout_constraintEnd_toStartOf="@id/textView7" | 207 | app:layout_constraintBaseline_toBaselineOf="@+id/textView9" |
| 208 | app:layout_constraintStart_toEndOf="@id/textView5" /> | 208 | app:layout_constraintStart_toEndOf="@+id/textView9" /> |
| 209 | 209 | ||
| 210 | <TextView | 210 | <TextView |
| 211 | android:id="@+id/textView7" | 211 | android:id="@+id/textView8" |
| 212 | android:layout_width="wrap_content" | 212 | android:layout_width="wrap_content" |
| 213 | android:layout_height="wrap_content" | 213 | android:layout_height="wrap_content" |
| 214 | android:layout_marginStart="5dp" | ||
| 214 | android:layout_marginTop="10dp" | 215 | android:layout_marginTop="10dp" |
| 215 | android:text="Exi.dep:" | 216 | android:text="Costo:" |
| 216 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 217 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 217 | android:textSize="15sp" | 218 | android:textSize="15sp" |
| 218 | app:layout_constraintEnd_toStartOf="@id/tvExiDeposito" | 219 | app:layout_constraintStart_toEndOf="@+id/tvPrecio" |
| 219 | app:layout_constraintStart_toEndOf="@id/tvExiVenta" | 220 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoOrigen" /> |
| 220 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | ||
| 221 | 221 | ||
| 222 | <TextView | 222 | <TextView |
| 223 | android:id="@+id/tvExiDeposito" | 223 | android:id="@+id/tvCosto" |
| 224 | android:layout_width="0dp" | 224 | android:layout_width="wrap_content" |
| 225 | android:layout_height="wrap_content" | 225 | android:layout_height="wrap_content" |
| 226 | android:text="" | 226 | android:layout_marginStart="5dp" |
| 227 | android:layout_marginTop="10dp" | ||
| 228 | android:text="22.99" | ||
| 227 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 229 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 228 | android:textSize="18sp" | 230 | android:textSize="18sp" |
| 229 | app:layout_constraintBaseline_toBaselineOf="@+id/textView7" | 231 | android:textStyle="bold" |
| 230 | app:layout_constraintEnd_toStartOf="@+id/textView9" | 232 | app:layout_constraintBaseline_toBaselineOf="@+id/textView8" |
| 231 | app:layout_constraintStart_toEndOf="@id/textView7" /> | 233 | app:layout_constraintStart_toEndOf="@+id/textView8" |
| 234 | app:layout_constraintTop_toBottomOf="@+id/tvDeposito" /> | ||
| 232 | 235 | ||
| 233 | <TextView | 236 | <TextView |
| 234 | android:id="@+id/textView9" | 237 | android:id="@+id/textView5" |
| 235 | android:layout_width="wrap_content" | 238 | android:layout_width="wrap_content" |
| 236 | android:layout_height="wrap_content" | 239 | android:layout_height="wrap_content" |
| 240 | android:layout_marginStart="5dp" | ||
| 237 | android:layout_marginTop="10dp" | 241 | android:layout_marginTop="10dp" |
| 238 | android:text="Precio:" | 242 | android:text="Existencia en venta:" |
| 239 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 243 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 240 | android:textSize="15sp" | 244 | android:textSize="15sp" |
| 241 | app:layout_constraintEnd_toStartOf="@id/tvPrecio" | 245 | app:layout_constraintStart_toStartOf="parent" |
| 242 | app:layout_constraintStart_toEndOf="@id/tvExiDeposito" | 246 | app:layout_constraintTop_toBottomOf="@+id/textView9" /> |
| 243 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | ||
| 244 | 247 | ||
| 245 | <TextView | 248 | <TextView |
| 246 | android:id="@+id/tvPrecio" | 249 | android:id="@+id/tvExiVenta" |
| 247 | android:layout_width="0dp" | 250 | android:layout_width="wrap_content" |
| 248 | android:layout_height="wrap_content" | 251 | android:layout_height="wrap_content" |
| 249 | android:text="" | 252 | android:layout_marginStart="5dp" |
| 253 | android:layout_marginTop="10dp" | ||
| 254 | android:text="100" | ||
| 250 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 255 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 251 | android:textSize="18sp" | 256 | android:textSize="18sp" |
| 252 | app:layout_constraintBaseline_toBaselineOf="@+id/textView9" | 257 | android:textStyle="bold" |
| 253 | app:layout_constraintEnd_toEndOf="parent" | 258 | app:layout_constraintBaseline_toBaselineOf="@+id/textView5" |
| 254 | app:layout_constraintStart_toEndOf="@id/textView9" /> | 259 | app:layout_constraintStart_toEndOf="@+id/textView5" /> |
| 260 | |||
| 255 | <TextView | 261 | <TextView |
| 256 | android:id="@+id/textView8" | 262 | android:id="@+id/textView7" |
| 257 | android:layout_width="wrap_content" | 263 | android:layout_width="wrap_content" |
| 258 | android:layout_height="wrap_content" | 264 | android:layout_height="wrap_content" |
| 259 | android:layout_marginStart="5dp" | 265 | android:layout_marginStart="5dp" |
| 260 | android:layout_marginTop="10dp" | 266 | android:layout_marginTop="10dp" |
| 261 | android:text="Costo:" | 267 | android:text="Existencia en deposito:" |
| 262 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 268 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 263 | android:textSize="15sp" | 269 | android:textSize="15sp" |
| 264 | app:layout_constraintEnd_toStartOf="@+id/tvCosto" | 270 | app:layout_constraintStart_toEndOf="@+id/tvExiVenta" |
| 265 | app:layout_constraintStart_toStartOf="parent" | 271 | app:layout_constraintTop_toBottomOf="@+id/textView8" /> |
| 266 | app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" /> | ||
| 267 | 272 | ||
| 268 | <TextView | 273 | <TextView |
| 269 | android:id="@+id/tvCosto" | 274 | android:id="@+id/tvExiDeposito" |
| 270 | android:layout_width="wrap_content" | 275 | android:layout_width="wrap_content" |
| 271 | android:layout_height="wrap_content" | 276 | android:layout_height="wrap_content" |
| 272 | android:text="22.99" | 277 | android:layout_marginStart="5dp" |
| 278 | android:layout_marginTop="10dp" | ||
| 279 | android:text="777" | ||
| 273 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 280 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 274 | android:textSize="18sp" | 281 | android:textSize="18sp" |
| 275 | app:layout_constraintBaseline_toBaselineOf="@+id/textView8" | 282 | android:textStyle="bold" |
| 276 | app:layout_constraintEnd_toStartOf="@+id/textView10" | 283 | app:layout_constraintBaseline_toBaselineOf="@+id/textView7" |
| 277 | app:layout_constraintStart_toEndOf="@+id/textView8" | 284 | app:layout_constraintStart_toEndOf="@+id/textView7" |
| 278 | app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" /> | 285 | app:layout_constraintTop_toBottomOf="@+id/tvCosto" /> |
| 286 | |||
| 279 | 287 | ||
| 280 | <TextView | 288 | <TextView |
| 281 | android:id="@+id/textView10" | 289 | android:id="@+id/textView10" |
| 282 | android:layout_width="wrap_content" | 290 | android:layout_width="wrap_content" |
| 283 | android:layout_height="wrap_content" | 291 | android:layout_height="wrap_content" |
| 284 | android:layout_marginStart="5dp" | 292 | android:layout_marginStart="5dp" |
| 285 | android:layout_marginTop="10dp" | 293 | android:layout_marginTop="10dp" |
| 286 | android:text="Unidad de Venta:" | 294 | android:text="Unidad de venta:" |
| 287 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 295 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 288 | android:textSize="15sp" | 296 | android:textSize="15sp" |
| 289 | app:layout_constraintEnd_toStartOf="@id/tvBal" | 297 | app:layout_constraintStart_toStartOf="parent" |
| 290 | app:layout_constraintStart_toEndOf="@id/tvCosto" | 298 | app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" /> |
| 291 | app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" /> | ||
| 292 | 299 | ||
| 293 | <TextView | 300 | <TextView |
| 294 | android:id="@+id/tvBal" | 301 | android:id="@+id/tvBal" |
| 295 | android:layout_width="0dp" | 302 | android:layout_width="wrap_content" |
| 296 | android:layout_height="wrap_content" | 303 | android:layout_height="wrap_content" |
| 304 | android:layout_marginStart="3dp" | ||
| 297 | android:text="CENT. CUBICOS" | 305 | android:text="CENT. CUBICOS" |
| 298 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 306 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 299 | android:textSize="18sp" | 307 | android:textSize="18sp" |
| 300 | app:layout_constraintBaseline_toBaselineOf="@+id/textView10" | 308 | app:layout_constraintBaseline_toBaselineOf="@+id/textView10" |
| 301 | app:layout_constraintEnd_toEndOf="parent" | ||
| 302 | app:layout_constraintStart_toEndOf="@+id/textView10" /> | 309 | app:layout_constraintStart_toEndOf="@+id/textView10" /> |
| 303 | 310 | ||
| 304 | 311 | ||
| 305 | <TextView | 312 | <TextView |
| 306 | android:id="@+id/textView11" | 313 | android:id="@+id/textView11" |
| 307 | android:layout_width="wrap_content" | 314 | android:layout_width="wrap_content" |
app/src/main/res/layout/fragment_servidores.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | tools:context=".UI.servidores.ServidoresFragment"> | 7 | tools:context=".UI.servidores.ServidoresFragment"> |
| 8 | 8 | ||
| 9 | <androidx.appcompat.widget.AppCompatTextView | 9 | <androidx.appcompat.widget.AppCompatTextView |
| 10 | android:id="@+id/tvTitutloServer" | 10 | android:id="@+id/tvTitutloServer" |
| 11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 12 | android:layout_height="90dp" | 12 | android:layout_height="90dp" |
| 13 | android:layout_marginStart="8dp" | 13 | android:layout_marginStart="8dp" |
| 14 | android:layout_marginTop="15dp" | 14 | android:layout_marginTop="15dp" |
| 15 | android:layout_marginEnd="8dp" | 15 | android:layout_marginEnd="8dp" |
| 16 | android:autoSizeMaxTextSize="100sp" | 16 | android:autoSizeMaxTextSize="100sp" |
| 17 | android:autoSizeMinTextSize="20sp" | 17 | android:autoSizeMinTextSize="20sp" |
| 18 | android:autoSizeStepGranularity="5sp" | 18 | android:autoSizeStepGranularity="5sp" |
| 19 | android:autoSizeTextType="uniform" | 19 | android:autoSizeTextType="uniform" |
| 20 | android:gravity="center" | 20 | android:gravity="center" |
| 21 | android:lines="1" | 21 | android:lines="1" |
| 22 | android:text="@string/tvTitutloServer" | 22 | android:text="@string/tvTitutloServer" |
| 23 | android:textColor="@color/colorAccent" | 23 | android:textColor="@color/colorAccent" |
| 24 | app:fontFamily="sans-serif-condensed" | 24 | app:fontFamily="sans-serif-condensed" |
| 25 | app:layout_constraintEnd_toEndOf="parent" | 25 | app:layout_constraintEnd_toEndOf="parent" |
| 26 | app:layout_constraintStart_toStartOf="parent" | 26 | app:layout_constraintStart_toStartOf="parent" |
| 27 | app:layout_constraintTop_toTopOf="parent" /> | 27 | app:layout_constraintTop_toTopOf="parent" /> |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | <TextView | 30 | <TextView |
| 31 | android:id="@+id/tvNomServer" | 31 | android:id="@+id/tvNomServer" |
| 32 | android:layout_width="match_parent" | 32 | android:layout_width="match_parent" |
| 33 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
| 34 | android:layout_margin="10dp" | 34 | android:layout_margin="10dp" |
| 35 | android:gravity="start" | 35 | android:gravity="start" |
| 36 | android:lines="1" | 36 | android:lines="1" |
| 37 | android:text="@string/tvNomServer" | 37 | android:text="@string/tvNomServer" |
| 38 | android:textColor="@android:color/black" | 38 | android:textColor="@android:color/black" |
| 39 | android:textSize="@dimen/SubTitulos" | 39 | android:textSize="@dimen/SubTitulos" |
| 40 | android:textStyle="bold|italic" | 40 | android:textStyle="bold|italic" |
| 41 | app:fontFamily="sans-serif-condensed" | 41 | app:fontFamily="sans-serif-condensed" |
| 42 | app:layout_constraintEnd_toEndOf="parent" | 42 | app:layout_constraintEnd_toEndOf="parent" |
| 43 | app:layout_constraintStart_toStartOf="parent" | 43 | app:layout_constraintStart_toStartOf="parent" |
| 44 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> | 44 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> |
| 45 | 45 | ||
| 46 | <EditText | 46 | <EditText |
| 47 | android:id="@+id/etNombreServidor" | 47 | android:id="@+id/etNombreServidor" |
| 48 | android:layout_width="match_parent" | 48 | android:layout_width="match_parent" |
| 49 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
| 50 | android:layout_margin="10dp" | 50 | android:layout_margin="10dp" |
| 51 | android:autofillHints="" | 51 | android:autofillHints="" |
| 52 | android:clickable="true" | 52 | android:clickable="true" |
| 53 | android:ems="10" | 53 | android:ems="10" |
| 54 | android:focusable="true" | 54 | android:focusable="true" |
| 55 | android:hint="Servidor Local" | 55 | android:hint="Servidor Local" |
| 56 | android:inputType="text" | 56 | android:inputType="text" |
| 57 | android:lines="1" | 57 | android:lines="1" |
| 58 | android:textSize="15sp" | 58 | android:textSize="15sp" |
| 59 | app:layout_constraintEnd_toEndOf="parent" | 59 | app:layout_constraintEnd_toEndOf="parent" |
| 60 | app:layout_constraintStart_toStartOf="parent" | 60 | app:layout_constraintStart_toStartOf="parent" |
| 61 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | 61 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> |
| 62 | 62 | ||
| 63 | <TextView | 63 | <TextView |
| 64 | android:id="@+id/tvDirServer" | 64 | android:id="@+id/tvDirServer" |
| 65 | android:layout_width="wrap_content" | 65 | android:layout_width="wrap_content" |
| 66 | android:layout_height="wrap_content" | 66 | android:layout_height="wrap_content" |
| 67 | android:layout_margin="10dp" | 67 | android:layout_margin="10dp" |
| 68 | android:gravity="start" | 68 | android:gravity="start" |
| 69 | android:lines="1" | 69 | android:lines="1" |
| 70 | android:text="@string/tvDirServer" | 70 | android:text="@string/tvDirServer" |
| 71 | android:textColor="@android:color/black" | 71 | android:textColor="@android:color/black" |
| 72 | android:textSize="@dimen/SubTitulos" | 72 | android:textSize="@dimen/SubTitulos" |
| 73 | android:textStyle="bold|italic" | 73 | android:textStyle="bold|italic" |
| 74 | app:fontFamily="sans-serif-condensed" | 74 | app:fontFamily="sans-serif-condensed" |
| 75 | app:layout_constraintStart_toStartOf="parent" | 75 | app:layout_constraintStart_toStartOf="parent" |
| 76 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> | 76 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> |
| 77 | 77 | ||
| 78 | <EditText | 78 | <EditText |
| 79 | android:id="@+id/etDireccionServidor" | 79 | android:id="@+id/etDireccionServidor" |
| 80 | android:layout_width="130dp" | 80 | android:layout_width="130dp" |
| 81 | android:layout_height="wrap_content" | 81 | android:layout_height="wrap_content" |
| 82 | |||
| 83 | android:clickable="true" | 82 | android:clickable="true" |
| 84 | android:ems="10" | 83 | android:ems="10" |
| 85 | android:focusable="true" | 84 | android:focusable="true" |
| 86 | android:hint="192.168.100.100" | 85 | android:hint="192.168.100.100" |
| 87 | android:inputType="text" | 86 | android:inputType="phone" |
| 88 | android:lines="1" | 87 | android:lines="1" |
| 89 | android:textSize="15sp" | 88 | android:textSize="15sp" |
| 90 | app:layout_constraintBaseline_toBaselineOf="@+id/tvDirServer" | 89 | app:layout_constraintBaseline_toBaselineOf="@+id/tvDirServer" |
| 91 | app:layout_constraintStart_toEndOf="@+id/tvDirServer" /> | 90 | app:layout_constraintStart_toEndOf="@+id/tvDirServer" /> |
| 92 | 91 | ||
| 93 | <TextView | ||
| 94 | android:id="@+id/tvPuerto" | ||
| 95 | android:layout_width="wrap_content" | ||
| 96 | android:layout_height="wrap_content" | ||
| 97 | android:layout_marginStart="10dp" | ||
| 98 | android:layout_marginTop="10dp" | ||
| 99 | android:gravity="start" | ||
| 100 | android:lines="1" | ||
| 101 | android:text="Puerto:" | ||
| 102 | android:textColor="@android:color/black" | ||
| 103 | android:textSize="@dimen/SubTitulos" | ||
| 104 | android:textStyle="bold|italic" | ||
| 105 | app:fontFamily="sans-serif-condensed" | ||
| 106 | app:layout_constraintStart_toEndOf="@+id/etDireccionServidor" | ||
| 107 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> | ||
| 108 | 92 | ||
| 109 | <EditText | 93 | <EditText |
| 110 | android:id="@+id/etPuerto" | 94 | android:id="@+id/etPuerto" |
| 111 | android:layout_width="80dp" | 95 | android:layout_width="80dp" |
| 112 | android:layout_height="wrap_content" | 96 | android:layout_height="wrap_content" |
| 113 | android:clickable="true" | 97 | android:clickable="true" |
| 114 | android:ems="10" | 98 | android:ems="10" |
| 115 | android:focusable="true" | 99 | android:focusable="true" |
| 116 | android:hint="9999" | 100 | android:hint="Puerto" |
| 117 | android:inputType="text" | 101 | android:inputType="number" |
| 118 | android:lines="1" | 102 | android:lines="1" |
| 119 | android:textSize="15sp" | 103 | android:textSize="15sp" |
| 120 | app:layout_constraintBaseline_toBaselineOf="@+id/tvPuerto" | 104 | app:layout_constraintBaseline_toBaselineOf="@+id/etDireccionServidor" |
| 121 | app:layout_constraintStart_toEndOf="@+id/tvPuerto" | 105 | app:layout_constraintStart_toEndOf="@+id/etDireccionServidor" |
| 122 | android:autofillHints="" /> | 106 | android:autofillHints="" /> |
| 123 | 107 | ||
| 124 | 108 | ||
| 125 | <androidx.recyclerview.widget.RecyclerView | 109 | <androidx.recyclerview.widget.RecyclerView |
| 126 | android:id="@+id/rvServidores" | 110 | android:id="@+id/rvServidores" |
| 127 | android:layout_width="match_parent" | 111 | android:layout_width="match_parent" |
| 128 | android:layout_height="0dp" | 112 | android:layout_height="0dp" |
| 129 | android:layout_marginTop="10dp" | 113 | android:layout_marginTop="10dp" |
| 130 | android:background="@android:color/darker_gray" | 114 | android:background="@android:color/darker_gray" |
| 131 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" | 115 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" |
| 132 | app:layout_constraintEnd_toEndOf="parent" | 116 | app:layout_constraintEnd_toEndOf="parent" |
| 133 | app:layout_constraintStart_toStartOf="parent" | 117 | app:layout_constraintStart_toStartOf="parent" |
| 134 | app:layout_constraintTop_toBottomOf="@+id/etPuerto" | 118 | app:layout_constraintTop_toBottomOf="@+id/etPuerto" |
| 135 | app:layout_goneMarginEnd="10dp" | 119 | app:layout_goneMarginEnd="10dp" |
| 136 | tools:listitem="@layout/item_servidores" /> | 120 | tools:listitem="@layout/item_servidores" /> |
| 137 | 121 | ||
| 138 | <Button | 122 | <Button |
| 139 | android:id="@+id/btnGuardarServidores" | 123 | android:id="@+id/btnGuardarServidores" |
| 140 | android:layout_width="0dp" | 124 | android:layout_width="0dp" |
| 141 | android:layout_height="wrap_content" | 125 | android:layout_height="wrap_content" |
| 142 | android:layout_marginTop="10dp" | 126 | android:layout_marginTop="10dp" |
| 143 | android:layout_marginEnd="10dp" | 127 | android:layout_marginEnd="10dp" |
| 144 | android:background="@drawable/boton_borde_redondeado" | 128 | android:background="@drawable/boton_borde_redondeado" |
| 145 | android:padding="10dp" | 129 | android:padding="10dp" |
| 146 | android:text="@string/btnGuardarServidores" | 130 | android:text="@string/btnGuardarServidores" |
| 147 | android:textColor="@android:color/white" | 131 | android:textColor="@android:color/white" |
| 148 | app:layout_constraintBottom_toBottomOf="parent" | 132 | app:layout_constraintBottom_toBottomOf="parent" |
| 149 | app:layout_constraintEnd_toEndOf="parent" | 133 | app:layout_constraintEnd_toEndOf="parent" |
| 150 | app:layout_constraintStart_toStartOf="parent" | 134 | app:layout_constraintStart_toStartOf="parent" |
| 151 | app:layout_constraintTop_toBottomOf="@+id/rvServidores" /> | 135 | app:layout_constraintTop_toBottomOf="@+id/rvServidores" /> |
| 152 | 136 | ||
| 153 | </androidx.constraintlayout.widget.ConstraintLayout> | 137 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 154 | 138 |
app/src/main/res/layout/ingresar_cantidad.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.cardview.widget.CardView | 2 | <androidx.cardview.widget.CardView |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
| 6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
| 7 | android:layout_height="wrap_content" | 7 | android:layout_height="wrap_content" |
| 8 | app:cardCornerRadius="10dp" | 8 | app:cardCornerRadius="10dp" |
| 9 | app:cardElevation="5dp" | 9 | app:cardElevation="5dp" |
| 10 | 10 | ||
| 11 | tools:ignore="PrivateResource"> | 11 | tools:ignore="PrivateResource"> |
| 12 | <!-- android:background="@drawable/md_transparent"--> | 12 | <!-- android:background="@drawable/md_transparent"--> |
| 13 | 13 | ||
| 14 | <androidx.constraintlayout.widget.ConstraintLayout | 14 | <androidx.constraintlayout.widget.ConstraintLayout |
| 15 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
| 16 | android:layout_height="match_parent"> | 16 | android:layout_height="match_parent"> |
| 17 | 17 | ||
| 18 | <LinearLayout | 18 | <LinearLayout |
| 19 | android:id="@+id/barraSuperior" | 19 | android:id="@+id/barraSuperior" |
| 20 | android:layout_width="0dp" | 20 | android:layout_width="0dp" |
| 21 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
| 22 | android:background="@color/colorPrimaryDark" | 22 | android:background="@color/colorPrimaryDark" |
| 23 | android:orientation="horizontal" | 23 | android:orientation="horizontal" |
| 24 | app:layout_constraintLeft_toLeftOf="parent" | 24 | app:layout_constraintLeft_toLeftOf="parent" |
| 25 | app:layout_constraintRight_toRightOf="parent" | 25 | app:layout_constraintRight_toRightOf="parent" |
| 26 | app:layout_constraintTop_toTopOf="parent" | 26 | app:layout_constraintTop_toTopOf="parent" |
| 27 | app:layout_constraintTop_toBottomOf="@+id/lySegundo"> | 27 | app:layout_constraintTop_toBottomOf="@+id/lySegundo"> |
| 28 | 28 | ||
| 29 | <androidx.appcompat.widget.AppCompatTextView | 29 | <androidx.appcompat.widget.AppCompatTextView |
| 30 | android:id="@+id/tvTitulo" | 30 | android:id="@+id/tvTitulo" |
| 31 | android:layout_width="0dp" | 31 | android:layout_width="0dp" |
| 32 | android:layout_height="wrap_content" | 32 | android:layout_height="wrap_content" |
| 33 | android:layout_margin="10dp" | 33 | android:layout_margin="10dp" |
| 34 | android:layout_marginStart="5dp" | 34 | android:layout_marginStart="5dp" |
| 35 | android:layout_marginTop="10dp" | 35 | android:layout_marginTop="10dp" |
| 36 | android:layout_weight="1" | 36 | android:layout_weight="1" |
| 37 | android:text="@string/adv" | 37 | android:text="@string/adv" |
| 38 | android:textAlignment="center" | 38 | android:textAlignment="center" |
| 39 | android:textColor="@android:color/white" | 39 | android:textColor="@android:color/white" |
| 40 | android:textSize="25sp" /> | 40 | android:textSize="25sp" /> |
| 41 | </LinearLayout> | 41 | </LinearLayout> |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | <LinearLayout | 44 | <LinearLayout |
| 45 | android:id="@+id/lySegundo" | 45 | android:id="@+id/lySegundo" |
| 46 | android:layout_width="match_parent" | 46 | android:layout_width="match_parent" |
| 47 | android:layout_height="wrap_content" | 47 | android:layout_height="wrap_content" |
| 48 | android:orientation="vertical" | 48 | android:orientation="vertical" |
| 49 | android:padding="12dp" | 49 | android:padding="12dp" |
| 50 | app:layout_constraintLeft_toLeftOf="parent" | 50 | app:layout_constraintLeft_toLeftOf="parent" |
| 51 | app:layout_constraintRight_toRightOf="parent" | 51 | app:layout_constraintRight_toRightOf="parent" |
| 52 | app:layout_constraintTop_toBottomOf="@id/barraSuperior"> | 52 | app:layout_constraintTop_toBottomOf="@id/barraSuperior"> |
| 53 | 53 | ||
| 54 | 54 | ||
| 55 | <EditText | 55 | <EditText |
| 56 | android:id="@+id/etCantidad" | 56 | android:id="@+id/etCantidad" |
| 57 | android:layout_width="match_parent" | 57 | android:layout_width="match_parent" |
| 58 | android:layout_height="wrap_content" | 58 | android:layout_height="wrap_content" |
| 59 | android:clickable="true" | 59 | android:clickable="true" |
| 60 | android:ems="10" | 60 | android:ems="10" |
| 61 | android:focusable="true" | 61 | android:focusable="true" |
| 62 | android:gravity="center" | 62 | android:gravity="center" |
| 63 | android:inputType="numberDecimal" | 63 | android:inputType="numberDecimal" |
| 64 | android:maxLength="8" | 64 | android:maxLength="8" |
| 65 | android:text="" | 65 | android:text="" |
| 66 | android:hint="Ingrese Cantidad" | ||
| 66 | android:textSize="20sp" /> | 67 | android:textSize="20sp" /> |
| 67 | 68 | ||
| 68 | 69 | ||
| 69 | <androidx.appcompat.widget.AppCompatButton | 70 | <androidx.appcompat.widget.AppCompatButton |
| 70 | android:id="@+id/btnAceptar" | 71 | android:id="@+id/btnAceptar" |
| 71 | android:layout_width="match_parent" | 72 | android:layout_width="match_parent" |
| 72 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
| 73 | android:layout_margin="10dp" | 74 | android:layout_margin="10dp" |
| 74 | android:layout_marginBottom="20dp" | 75 | android:layout_marginBottom="20dp" |
| 75 | android:clickable="true" | 76 | android:clickable="true" |
| 76 | android:focusable="true" | 77 | android:focusable="true" |
| 77 | android:textColor="@android:color/white" | 78 | android:textColor="@android:color/white" |
| 78 | android:padding="10dp" | 79 | android:padding="10dp" |
| 79 | android:background="@drawable/boton_borde_redondeado" | 80 | android:background="@drawable/boton_borde_redondeado" |
| 80 | android:text="@string/btnOk" | 81 | android:text="@string/btnOk" |
| 81 | android:textAlignment="center" | 82 | android:textAlignment="center" |
| 82 | android:textSize="20sp" | 83 | android:textSize="20sp" |
| 83 | android:textStyle="bold" | 84 | android:textStyle="bold" |
| 84 | app:cardBackgroundColor="@android:color/darker_gray" | 85 | app:cardBackgroundColor="@android:color/darker_gray" |
| 85 | app:cardUseCompatPadding="true" /> | 86 | app:cardUseCompatPadding="true" /> |
| 86 | 87 | ||
| 87 | 88 | ||
| 88 | </LinearLayout> | 89 | </LinearLayout> |
| 89 | 90 | ||
| 90 | 91 | ||
| 91 | </androidx.constraintlayout.widget.ConstraintLayout> | 92 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 92 | </androidx.cardview.widget.CardView> | 93 | </androidx.cardview.widget.CardView> |
app/src/main/res/layout/item_codigo_origen.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="wrap_content" | 5 | android:layout_height="wrap_content" |
| 6 | android:layout_margin="5dp" | 6 | android:layout_margin="5dp" |
| 7 | app:cardCornerRadius="2dp" | 7 | app:cardCornerRadius="2dp" |
| 8 | app:cardElevation="10dp" | 8 | app:cardElevation="10dp" |
| 9 | app:contentPadding="5dp" | 9 | app:contentPadding="5dp" |
| 10 | app:cardPreventCornerOverlap="false"> | 10 | app:cardPreventCornerOverlap="false"> |
| 11 | 11 | ||
| 12 | <androidx.constraintlayout.widget.ConstraintLayout | 12 | <androidx.constraintlayout.widget.ConstraintLayout |
| 13 | android:layout_width="match_parent" | 13 | android:layout_width="match_parent" |
| 14 | android:layout_height="wrap_content"> | 14 | android:layout_height="wrap_content"> |
| 15 | 15 | ||
| 16 | <TextView | 16 | <TextView |
| 17 | android:id="@+id/textView2" | 17 | android:id="@+id/textView2" |
| 18 | android:layout_width="wrap_content" | 18 | android:layout_width="wrap_content" |
| 19 | android:layout_height="wrap_content" | 19 | android:layout_height="wrap_content" |
| 20 | android:layout_marginStart="5dp" | 20 | android:layout_marginStart="5dp" |
| 21 | android:text="Código:" | 21 | android:text="Código:" |
| 22 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 22 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
| 23 | android:textSize="14sp" | 23 | android:textSize="14sp" |
| 24 | app:layout_constraintEnd_toStartOf="@+id/tvSector" | 24 | app:layout_constraintEnd_toStartOf="@+id/tvSector" |
| 25 | app:layout_constraintHorizontal_bias="0.01" | 25 | app:layout_constraintHorizontal_bias="0.01" |
| 26 | app:layout_constraintHorizontal_chainStyle="packed" | 26 | app:layout_constraintHorizontal_chainStyle="packed" |
| 27 | app:layout_constraintStart_toStartOf="parent" | 27 | app:layout_constraintStart_toStartOf="parent" |
| 28 | app:layout_constraintTop_toTopOf="parent" /> | 28 | app:layout_constraintTop_toTopOf="parent" /> |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | <TextView | 31 | <TextView |
| 32 | android:id="@+id/tvSector" | 32 | android:id="@+id/tvSector" |
| 33 | android:layout_width="wrap_content" | 33 | android:layout_width="wrap_content" |
| 34 | android:layout_height="match_parent" | 34 | android:layout_height="match_parent" |
| 35 | android:layout_marginStart="8dp" | 35 | android:layout_marginStart="8dp" |
| 36 | android:text="9999" | 36 | android:text="9999" |
| 37 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 37 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 38 | android:textColorHint="@android:color/black" | 38 | android:textColorHint="@android:color/black" |
| 39 | android:textSize="14sp" | 39 | android:textSize="14sp" |
| 40 | android:textStyle="bold" | 40 | android:textStyle="bold" |
| 41 | app:layout_constraintHorizontal_chainStyle="packed" | 41 | app:layout_constraintHorizontal_chainStyle="packed" |
| 42 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" | 42 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" |
| 43 | app:layout_constraintEnd_toStartOf="@+id/tvCodigo" | 43 | app:layout_constraintEnd_toStartOf="@+id/tvCodigo" |
| 44 | app:layout_constraintStart_toEndOf="@+id/textView2" /> | 44 | app:layout_constraintStart_toEndOf="@+id/textView2" /> |
| 45 | <TextView | 45 | <TextView |
| 46 | android:id="@+id/tvCodigo" | 46 | android:id="@+id/tvCodigo" |
| 47 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
| 48 | android:layout_height="match_parent" | 48 | android:layout_height="match_parent" |
| 49 | android:layout_marginStart="8dp" | 49 | android:layout_marginStart="8dp" |
| 50 | android:text="99999999" | 50 | android:text="99999999" |
| 51 | app:layout_constraintHorizontal_chainStyle="packed" | 51 | app:layout_constraintHorizontal_chainStyle="packed" |
| 52 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 52 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 53 | android:textColorHint="@android:color/black" | 53 | android:textColorHint="@android:color/black" |
| 54 | android:textSize="14sp" | 54 | android:textSize="14sp" |
| 55 | android:textStyle="bold" | 55 | android:textStyle="bold" |
| 56 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" | 56 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" |
| 57 | app:layout_constraintEnd_toStartOf="@+id/textView5" | 57 | app:layout_constraintEnd_toStartOf="@+id/textView5" |
| 58 | app:layout_constraintStart_toEndOf="@+id/tvSector" /> | 58 | app:layout_constraintStart_toEndOf="@+id/tvSector" /> |
| 59 | 59 | ||
| 60 | <TextView | 60 | <TextView |
| 61 | android:id="@+id/textView5" | 61 | android:id="@+id/textView5" |
| 62 | android:layout_width="wrap_content" | 62 | android:layout_width="wrap_content" |
| 63 | android:layout_height="wrap_content" | 63 | android:layout_height="wrap_content" |
| 64 | android:layout_marginStart="8dp" | 64 | android:layout_marginStart="8dp" |
| 65 | android:text="Cantidad:" | 65 | android:text="Cantidad:" |
| 66 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 66 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
| 67 | android:textSize="14sp" | 67 | android:textSize="14sp" |
| 68 | android:visibility="gone" | 68 | android:visibility="gone" |
| 69 | app:layout_constraintTop_toTopOf="parent" | 69 | app:layout_constraintTop_toTopOf="parent" |
| 70 | app:layout_constraintEnd_toStartOf="@+id/tvCodigoBarras" | 70 | app:layout_constraintEnd_toStartOf="@+id/tvCodigoBarras" |
| 71 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" /> | 71 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" /> |
| 72 | 72 | ||
| 73 | <TextView | 73 | <TextView |
| 74 | android:id="@+id/tvCantidad" | 74 | android:id="@+id/tvCantidad" |
| 75 | android:layout_width="wrap_content" | 75 | android:layout_width="wrap_content" |
| 76 | android:layout_height="match_parent" | 76 | android:layout_height="match_parent" |
| 77 | android:layout_marginStart="8dp" | 77 | android:layout_marginStart="8dp" |
| 78 | android:text="Otros Códigos:" | 78 | android:text="Código Origen:" |
| 79 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 79 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 80 | android:textSize="14sp" | 80 | android:textSize="14sp" |
| 81 | android:textStyle="bold" | 81 | android:textStyle="bold" |
| 82 | android:visibility="visible" | 82 | android:visibility="visible" |
| 83 | app:layout_constraintEnd_toStartOf="@id/tvCodigoOrigen" | 83 | app:layout_constraintEnd_toStartOf="@id/tvCodigoOrigen" |
| 84 | app:layout_constraintStart_toEndOf="@id/textView5" | 84 | app:layout_constraintStart_toEndOf="@id/textView5" |
| 85 | app:layout_constraintTop_toTopOf="parent" /> | 85 | app:layout_constraintTop_toTopOf="parent" /> |
| 86 | 86 | ||
| 87 | <TextView | 87 | <TextView |
| 88 | android:id="@+id/tvCodigoOrigen" | 88 | android:id="@+id/tvCodigoOrigen" |
| 89 | android:layout_width="0dp" | 89 | android:layout_width="0dp" |
| 90 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
| 91 | android:layout_marginStart="3dp" | 91 | android:layout_marginStart="3dp" |
| 92 | android:maxLines="2" | 92 | android:maxLines="2" |
| 93 | android:text="" | 93 | android:text="" |
| 94 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 94 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 95 | android:textSize="14sp" | 95 | android:textSize="14sp" |
| 96 | android:visibility="visible" | 96 | android:visibility="visible" |
| 97 | android:textStyle="bold" | 97 | android:textStyle="bold" |
| 98 | app:layout_constraintEnd_toEndOf="parent" | 98 | app:layout_constraintEnd_toEndOf="parent" |
| 99 | app:layout_constraintStart_toEndOf="@+id/tvCantidad" | 99 | app:layout_constraintStart_toEndOf="@+id/tvCantidad" |
| 100 | app:layout_constraintTop_toTopOf="parent"/> | 100 | app:layout_constraintTop_toTopOf="parent"/> |
| 101 | 101 | ||
| 102 | <ImageView | 102 | <ImageView |
| 103 | android:id="@+id/ivHolder" | 103 | android:id="@+id/ivHolder" |
| 104 | android:layout_width="30dp" | 104 | android:layout_width="30dp" |
| 105 | android:layout_height="30dp" | 105 | android:layout_height="30dp" |
| 106 | android:visibility="gone" | 106 | android:visibility="gone" |
| 107 | android:src="@drawable/more" | 107 | android:src="@drawable/more" |
| 108 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" | 108 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" |
| 109 | app:layout_constraintEnd_toEndOf="parent" | 109 | app:layout_constraintEnd_toEndOf="parent" |
| 110 | app:layout_constraintHorizontal_bias="0.968" | 110 | app:layout_constraintHorizontal_bias="0.968" |
| 111 | app:layout_constraintStart_toEndOf="@+id/tvCodigoBarras" | 111 | app:layout_constraintStart_toEndOf="@+id/tvCodigoBarras" |
| 112 | app:layout_constraintTop_toTopOf="parent" | 112 | app:layout_constraintTop_toTopOf="parent" |
| 113 | app:layout_constraintVertical_bias="0.0" /> | 113 | app:layout_constraintVertical_bias="0.0" /> |
| 114 | 114 | ||
| 115 | <TextView | 115 | <TextView |
| 116 | android:id="@+id/textView85" | 116 | android:id="@+id/textView85" |
| 117 | android:layout_width="wrap_content" | 117 | android:layout_width="wrap_content" |
| 118 | android:layout_height="wrap_content" | 118 | android:layout_height="wrap_content" |
| 119 | android:layout_marginStart="5dp" | 119 | android:layout_marginStart="5dp" |
| 120 | android:layout_marginTop="8dp" | 120 | android:layout_marginTop="8dp" |
| 121 | android:text="Desc:" | 121 | android:text="Desc:" |
| 122 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 122 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
| 123 | android:textSize="14sp" | 123 | android:textSize="14sp" |
| 124 | app:layout_constraintEnd_toStartOf="@+id/tvDescripcion" | 124 | app:layout_constraintEnd_toStartOf="@+id/tvDescripcion" |
| 125 | app:layout_constraintHorizontal_bias="0.0" | 125 | app:layout_constraintHorizontal_bias="0.0" |
| 126 | app:layout_constraintHorizontal_chainStyle="packed" | 126 | app:layout_constraintHorizontal_chainStyle="packed" |
| 127 | app:layout_constraintStart_toStartOf="parent" | 127 | app:layout_constraintStart_toStartOf="parent" |
| 128 | app:layout_constraintTop_toBottomOf="@id/tvCodigo" /> | 128 | app:layout_constraintTop_toBottomOf="@id/tvCodigo" /> |
| 129 | 129 | ||
| 130 | <TextView | 130 | <TextView |
| 131 | android:id="@+id/tvDescripcion" | 131 | android:id="@+id/tvDescripcion" |
| 132 | android:layout_width="0dp" | 132 | android:layout_width="0dp" |
| 133 | android:layout_height="wrap_content" | 133 | android:layout_height="wrap_content" |
| 134 | android:layout_marginStart="3dp" | 134 | android:layout_marginStart="3dp" |
| 135 | android:layout_marginTop="8dp" | 135 | android:layout_marginTop="8dp" |
| 136 | android:maxLines="2" | 136 | android:maxLines="2" |
| 137 | android:text="abcdefghijklmnñopqrstuvwxyz0123456789abcdefghijklmnñopqrstuvwxyz" | 137 | android:text="abcdefghijklmnñopqrstuvwxyz0123456789abcdefghijklmnñopqrstuvwxyz" |
| 138 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 138 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 139 | android:textSize="14sp" | 139 | android:textSize="14sp" |
| 140 | android:textStyle="bold" | 140 | android:textStyle="bold" |
| 141 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" | 141 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" |
| 142 | app:layout_constraintEnd_toEndOf="parent" | 142 | app:layout_constraintEnd_toEndOf="parent" |
| 143 | app:layout_constraintStart_toEndOf="@+id/textView85" | 143 | app:layout_constraintStart_toEndOf="@+id/textView85" |
| 144 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 144 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
| 145 | 145 | ||
| 146 | 146 | ||
| 147 | </androidx.constraintlayout.widget.ConstraintLayout> | 147 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 148 | 148 | ||
| 149 | </androidx.cardview.widget.CardView> | 149 | </androidx.cardview.widget.CardView> |
app/src/main/res/layout/item_descripcion.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="wrap_content" | 5 | android:layout_height="wrap_content" |
| 6 | android:layout_margin="5dp" | 6 | android:layout_margin="5dp" |
| 7 | app:cardCornerRadius="2dp" | 7 | app:cardCornerRadius="2dp" |
| 8 | app:cardElevation="10dp" | 8 | app:cardElevation="10dp" |
| 9 | app:contentPadding="5dp" | 9 | app:contentPadding="5dp" |
| 10 | app:cardPreventCornerOverlap="false"> | 10 | app:cardPreventCornerOverlap="false"> |
| 11 | 11 | ||
| 12 | <androidx.constraintlayout.widget.ConstraintLayout | 12 | <androidx.constraintlayout.widget.ConstraintLayout |
| 13 | android:layout_width="match_parent" | 13 | android:layout_width="match_parent" |
| 14 | android:layout_height="wrap_content"> | 14 | android:layout_height="wrap_content"> |
| 15 | 15 | ||
| 16 | <TextView | 16 | <TextView |
| 17 | android:id="@+id/textView2" | 17 | android:id="@+id/textView2" |
| 18 | android:layout_width="wrap_content" | 18 | android:layout_width="wrap_content" |
| 19 | android:layout_height="wrap_content" | 19 | android:layout_height="wrap_content" |
| 20 | android:layout_marginStart="5dp" | 20 | android:layout_marginStart="5dp" |
| 21 | android:text="Código:" | 21 | android:text="Código:" |
| 22 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 22 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
| 23 | android:textSize="14sp" | 23 | android:textSize="14sp" |
| 24 | app:layout_constraintEnd_toStartOf="@+id/tvSector" | 24 | app:layout_constraintEnd_toStartOf="@+id/tvSector" |
| 25 | app:layout_constraintHorizontal_bias="0.01" | 25 | app:layout_constraintHorizontal_bias="0.01" |
| 26 | app:layout_constraintHorizontal_chainStyle="packed" | 26 | app:layout_constraintHorizontal_chainStyle="packed" |
| 27 | app:layout_constraintStart_toStartOf="parent" | 27 | app:layout_constraintStart_toStartOf="parent" |
| 28 | app:layout_constraintTop_toTopOf="parent" /> | 28 | app:layout_constraintTop_toTopOf="parent" /> |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | <TextView | 31 | <TextView |
| 32 | android:id="@+id/tvSector" | 32 | android:id="@+id/tvSector" |
| 33 | android:layout_width="wrap_content" | 33 | android:layout_width="wrap_content" |
| 34 | android:layout_height="match_parent" | 34 | android:layout_height="match_parent" |
| 35 | android:layout_marginStart="8dp" | 35 | android:layout_marginStart="8dp" |
| 36 | android:text="9999" | 36 | android:text="9999" |
| 37 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 37 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 38 | android:textColorHint="@android:color/black" | 38 | android:textColorHint="@android:color/black" |
| 39 | android:textSize="14sp" | 39 | android:textSize="14sp" |
| 40 | android:textStyle="bold" | 40 | android:textStyle="bold" |
| 41 | app:layout_constraintHorizontal_chainStyle="packed" | 41 | app:layout_constraintHorizontal_chainStyle="packed" |
| 42 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" | 42 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" |
| 43 | app:layout_constraintEnd_toStartOf="@+id/tvCodigo" | 43 | app:layout_constraintEnd_toStartOf="@+id/tvCodigo" |
| 44 | app:layout_constraintStart_toEndOf="@+id/textView2" /> | 44 | app:layout_constraintStart_toEndOf="@+id/textView2" /> |
| 45 | <TextView | 45 | <TextView |
| 46 | android:id="@+id/tvCodigo" | 46 | android:id="@+id/tvCodigo" |
| 47 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
| 48 | android:layout_height="match_parent" | 48 | android:layout_height="match_parent" |
| 49 | android:layout_marginStart="8dp" | 49 | android:layout_marginStart="8dp" |
| 50 | android:text="99999999" | 50 | android:text="99999999" |
| 51 | app:layout_constraintHorizontal_chainStyle="packed" | 51 | app:layout_constraintHorizontal_chainStyle="packed" |
| 52 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 52 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 53 | android:textColorHint="@android:color/black" | 53 | android:textColorHint="@android:color/black" |
| 54 | android:textSize="14sp" | 54 | android:textSize="14sp" |
| 55 | android:textStyle="bold" | 55 | android:textStyle="bold" |
| 56 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" | 56 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" |
| 57 | app:layout_constraintEnd_toStartOf="@+id/textView5" | 57 | app:layout_constraintEnd_toStartOf="@+id/textView5" |
| 58 | app:layout_constraintStart_toEndOf="@+id/tvSector" /> | 58 | app:layout_constraintStart_toEndOf="@+id/tvSector" /> |
| 59 | 59 | ||
| 60 | <TextView | 60 | <TextView |
| 61 | android:id="@+id/textView5" | 61 | android:id="@+id/textView5" |
| 62 | android:layout_width="wrap_content" | 62 | android:layout_width="wrap_content" |
| 63 | android:layout_height="wrap_content" | 63 | android:layout_height="wrap_content" |
| 64 | android:layout_marginStart="8dp" | 64 | android:layout_marginStart="8dp" |
| 65 | android:text="Cantidad:" | 65 | android:text="Cantidad:" |
| 66 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 66 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
| 67 | android:textSize="14sp" | 67 | android:textSize="14sp" |
| 68 | android:visibility="gone" | 68 | android:visibility="gone" |
| 69 | app:layout_constraintTop_toTopOf="parent" | 69 | app:layout_constraintTop_toTopOf="parent" |
| 70 | app:layout_constraintEnd_toStartOf="@+id/tvCodigoBarras" | 70 | app:layout_constraintEnd_toStartOf="@+id/tvCodigoBarras" |
| 71 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" /> | 71 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" /> |
| 72 | 72 | ||
| 73 | <TextView | 73 | <TextView |
| 74 | android:id="@+id/tvCantidad" | 74 | android:id="@+id/tvCantidad" |
| 75 | android:layout_width="wrap_content" | 75 | android:layout_width="wrap_content" |
| 76 | android:layout_height="match_parent" | 76 | android:layout_height="match_parent" |
| 77 | android:layout_marginStart="8dp" | 77 | android:layout_marginStart="8dp" |
| 78 | android:text="Otros Códigos:" | 78 | android:text="Código Barras:" |
| 79 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 79 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 80 | android:textSize="14sp" | 80 | android:textSize="14sp" |
| 81 | android:textStyle="bold" | 81 | android:textStyle="bold" |
| 82 | android:visibility="visible" | 82 | android:visibility="visible" |
| 83 | app:layout_constraintEnd_toStartOf="@id/tvCodigoBarras" | 83 | app:layout_constraintEnd_toStartOf="@id/tvCodigoBarras" |
| 84 | app:layout_constraintStart_toEndOf="@id/textView5" | 84 | app:layout_constraintStart_toEndOf="@id/textView5" |
| 85 | app:layout_constraintTop_toTopOf="parent" /> | 85 | app:layout_constraintTop_toTopOf="parent" /> |
| 86 | 86 | ||
| 87 | <TextView | 87 | <TextView |
| 88 | android:id="@+id/tvCodigoBarras" | 88 | android:id="@+id/tvCodigoBarras" |
| 89 | android:layout_width="0dp" | 89 | android:layout_width="0dp" |
| 90 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
| 91 | android:layout_marginStart="3dp" | 91 | android:layout_marginStart="3dp" |
| 92 | android:maxLines="2" | 92 | android:maxLines="2" |
| 93 | android:text="" | 93 | android:text="" |
| 94 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 94 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 95 | android:textSize="14sp" | 95 | android:textSize="14sp" |
| 96 | android:visibility="visible" | 96 | android:visibility="visible" |
| 97 | android:textStyle="bold" | 97 | android:textStyle="bold" |
| 98 | app:layout_constraintEnd_toEndOf="parent" | 98 | app:layout_constraintEnd_toEndOf="parent" |
| 99 | app:layout_constraintStart_toEndOf="@+id/tvCantidad" | 99 | app:layout_constraintStart_toEndOf="@+id/tvCantidad" |
| 100 | app:layout_constraintTop_toTopOf="parent"/> | 100 | app:layout_constraintTop_toTopOf="parent"/> |
| 101 | 101 | ||
| 102 | <ImageView | 102 | <ImageView |
| 103 | android:id="@+id/ivHolder" | 103 | android:id="@+id/ivHolder" |
| 104 | android:layout_width="30dp" | 104 | android:layout_width="30dp" |
| 105 | android:layout_height="30dp" | 105 | android:layout_height="30dp" |
| 106 | android:visibility="gone" | 106 | android:visibility="gone" |
| 107 | android:src="@drawable/more" | 107 | android:src="@drawable/more" |
| 108 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" | 108 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" |
| 109 | app:layout_constraintEnd_toEndOf="parent" | 109 | app:layout_constraintEnd_toEndOf="parent" |
| 110 | app:layout_constraintHorizontal_bias="0.968" | 110 | app:layout_constraintHorizontal_bias="0.968" |
| 111 | app:layout_constraintStart_toEndOf="@+id/tvCodigoBarras" | 111 | app:layout_constraintStart_toEndOf="@+id/tvCodigoBarras" |
| 112 | app:layout_constraintTop_toTopOf="parent" | 112 | app:layout_constraintTop_toTopOf="parent" |
| 113 | app:layout_constraintVertical_bias="0.0" /> | 113 | app:layout_constraintVertical_bias="0.0" /> |
| 114 | 114 | ||
| 115 | <TextView | 115 | <TextView |
| 116 | android:id="@+id/textView85" | 116 | android:id="@+id/textView85" |
| 117 | android:layout_width="wrap_content" | 117 | android:layout_width="wrap_content" |
| 118 | android:layout_height="wrap_content" | 118 | android:layout_height="wrap_content" |
| 119 | android:layout_marginStart="5dp" | 119 | android:layout_marginStart="5dp" |
| 120 | android:layout_marginTop="8dp" | 120 | android:layout_marginTop="8dp" |
| 121 | android:text="Desc:" | 121 | android:text="Desc:" |
| 122 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 122 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
| 123 | android:textSize="14sp" | 123 | android:textSize="14sp" |
| 124 | app:layout_constraintEnd_toStartOf="@+id/tvDescripcion" | 124 | app:layout_constraintEnd_toStartOf="@+id/tvDescripcion" |
| 125 | app:layout_constraintHorizontal_bias="0.0" | 125 | app:layout_constraintHorizontal_bias="0.0" |
| 126 | app:layout_constraintHorizontal_chainStyle="packed" | 126 | app:layout_constraintHorizontal_chainStyle="packed" |
| 127 | app:layout_constraintStart_toStartOf="parent" | 127 | app:layout_constraintStart_toStartOf="parent" |
| 128 | app:layout_constraintTop_toBottomOf="@id/tvCodigo" /> | 128 | app:layout_constraintTop_toBottomOf="@id/tvCodigo" /> |
| 129 | 129 | ||
| 130 | <TextView | 130 | <TextView |
| 131 | android:id="@+id/tvDescripcion" | 131 | android:id="@+id/tvDescripcion" |
| 132 | android:layout_width="0dp" | 132 | android:layout_width="0dp" |
| 133 | android:layout_height="wrap_content" | 133 | android:layout_height="wrap_content" |
| 134 | android:layout_marginStart="3dp" | 134 | android:layout_marginStart="3dp" |
| 135 | android:layout_marginTop="8dp" | 135 | android:layout_marginTop="8dp" |
| 136 | android:maxLines="2" | 136 | android:maxLines="2" |
| 137 | android:text="abcdefghijklmnñopqrstuvwxyz0123456789abcdefghijklmnñopqrstuvwxyz" | 137 | android:text="abcdefghijklmnñopqrstuvwxyz0123456789abcdefghijklmnñopqrstuvwxyz" |
| 138 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 138 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 139 | android:textSize="14sp" | 139 | android:textSize="14sp" |
| 140 | android:textStyle="bold" | 140 | android:textStyle="bold" |
| 141 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" | 141 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" |
| 142 | app:layout_constraintEnd_toEndOf="parent" | 142 | app:layout_constraintEnd_toEndOf="parent" |
| 143 | app:layout_constraintStart_toEndOf="@+id/textView85" | 143 | app:layout_constraintStart_toEndOf="@+id/textView85" |
| 144 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 144 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
| 145 | 145 | ||
| 146 | 146 | ||
| 147 | </androidx.constraintlayout.widget.ConstraintLayout> | 147 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 148 | 148 | ||
| 149 | </androidx.cardview.widget.CardView> | 149 | </androidx.cardview.widget.CardView> |
app/src/main/res/layout/login_dialog.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="wrap_content" | 5 | android:layout_height="wrap_content" |
| 6 | android:orientation="vertical" | 6 | android:orientation="vertical" |
| 7 | android:padding="10dp"> | 7 | android:padding="10dp"> |
| 8 | 8 | ||
| 9 | <LinearLayout | ||
| 10 | android:id="@+id/barraSuperior" | ||
| 11 | android:layout_width="0dp" | ||
| 12 | android:layout_height="wrap_content" | ||
| 13 | android:background="@color/colorPrimaryDark" | ||
| 14 | android:orientation="horizontal" | ||
| 15 | app:layout_constraintEnd_toEndOf="parent" | ||
| 16 | app:layout_constraintStart_toStartOf="parent" | ||
| 17 | app:layout_constraintTop_toTopOf="parent"> | ||
| 18 | |||
| 19 | <androidx.appcompat.widget.AppCompatTextView | ||
| 20 | android:id="@+id/tvTitulo2" | ||
| 21 | android:layout_width="0dp" | ||
| 22 | android:layout_height="wrap_content" | ||
| 23 | android:layout_margin="10dp" | ||
| 24 | android:layout_marginStart="5dp" | ||
| 25 | android:layout_marginTop="10dp" | ||
| 26 | android:layout_weight="1" | ||
| 27 | android:text="@string/adv" | ||
| 28 | android:background="@drawable/boton_borde_redondeado" | ||
| 29 | android:textAlignment="center" | ||
| 30 | android:textColor="@android:color/white" | ||
| 31 | android:textSize="25sp" /> | ||
| 32 | </LinearLayout> | ||
| 33 | |||
| 9 | <TextView | 34 | <TextView |
| 10 | android:id="@+id/dialogNameEt" | 35 | android:id="@+id/dialogNameEt" |
| 11 | android:layout_width="wrap_content" | 36 | android:layout_width="wrap_content" |
| 12 | android:layout_height="wrap_content" | 37 | android:layout_height="wrap_content" |
| 13 | android:layout_margin="5dp" | 38 | android:layout_margin="5dp" |
| 14 | android:text="Cantidad actual:" | 39 | android:text="Conteo actual :" |
| 15 | android:textSize="20sp" | 40 | android:textSize="20sp" |
| 16 | app:layout_constraintEnd_toStartOf="@id/tvCantInicial" | 41 | app:layout_constraintEnd_toStartOf="@id/tvCantInicial" |
| 17 | app:layout_constraintHorizontal_bias="0.0" | 42 | app:layout_constraintHorizontal_bias="0.0" |
| 18 | app:layout_constraintHorizontal_chainStyle="packed" | 43 | app:layout_constraintHorizontal_chainStyle="packed" |
| 19 | app:layout_constraintStart_toStartOf="parent" | 44 | app:layout_constraintStart_toStartOf="parent" |
| 20 | app:layout_constraintTop_toTopOf="parent" /> | 45 | app:layout_constraintTop_toBottomOf="@id/barraSuperior"/> |
| 21 | 46 | ||
| 22 | <TextView | 47 | <TextView |
| 23 | android:id="@+id/tvCantInicial" | 48 | android:id="@+id/tvCantInicial" |
| 24 | android:layout_width="wrap_content" | 49 | android:layout_width="wrap_content" |
| 25 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
| 26 | android:layout_margin="5dp" | 51 | android:layout_margin="5dp" |
| 27 | android:text="" | 52 | android:text="" |
| 28 | android:textSize="20sp" | 53 | android:textSize="20sp" |
| 29 | app:layout_constraintBaseline_toBaselineOf="@+id/dialogNameEt" | 54 | app:layout_constraintBaseline_toBaselineOf="@+id/dialogNameEt" |
| 30 | app:layout_constraintEnd_toEndOf="parent" | 55 | app:layout_constraintEnd_toEndOf="parent" |
| 31 | app:layout_constraintHorizontal_chainStyle="packed" | 56 | app:layout_constraintHorizontal_chainStyle="packed" |
| 32 | app:layout_constraintStart_toEndOf="@id/dialogNameEt" /> | 57 | app:layout_constraintStart_toEndOf="@id/dialogNameEt" /> |
| 33 | 58 | ||
| 34 | <TextView | 59 | <TextView |
| 35 | android:id="@+id/tvgenerico" | 60 | android:id="@+id/tvgenerico" |
| 36 | android:layout_width="wrap_content" | 61 | android:layout_width="wrap_content" |
| 37 | android:layout_height="wrap_content" | 62 | android:layout_height="wrap_content" |
| 38 | android:layout_margin="5dp" | 63 | android:layout_margin="5dp" |
| 39 | android:text="Nueva cantidad:" | 64 | android:text="Nueva cantidad:" |
| 65 | android:textStyle="bold" | ||
| 40 | android:textSize="20sp" | 66 | android:textSize="20sp" |
| 41 | app:layout_constraintStart_toStartOf="parent" | 67 | app:layout_constraintStart_toStartOf="parent" |
| 42 | app:layout_constraintTop_toBottomOf="@+id/tvCantInicial" /> | 68 | app:layout_constraintTop_toBottomOf="@+id/tvCantInicial" /> |
| 43 | 69 | ||
| 44 | <EditText | 70 | <EditText |
| 45 | android:id="@+id/tvNuevaCantidad" | 71 | android:id="@+id/tvNuevaCantidad" |
| 46 | android:layout_width="0dp" | 72 | android:layout_width="0dp" |
| 47 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
| 48 | android:autofillHints="" | 74 | android:autofillHints="" |
| 49 | android:hint="" | 75 | android:hint="" |
| 50 | android:focusable="true" | 76 | android:focusable="true" |
| 51 | android:clickable="true" | 77 | android:clickable="true" |
| 52 | android:inputType="numberDecimal" | 78 | android:inputType="numberDecimal" |
| 53 | app:layout_constraintBaseline_toBaselineOf="@+id/tvgenerico" | 79 | app:layout_constraintBaseline_toBaselineOf="@+id/tvgenerico" |
| 54 | app:layout_constraintEnd_toEndOf="parent" | 80 | app:layout_constraintEnd_toEndOf="parent" |
| 55 | app:layout_constraintStart_toEndOf="@id/tvgenerico" /> | 81 | app:layout_constraintStart_toEndOf="@id/tvgenerico" /> |
| 56 | 82 | ||
| 57 | <TextView | 83 | <TextView |
| 58 | android:id="@+id/tvgenerico2" | 84 | android:id="@+id/tvgenerico2" |
| 59 | android:layout_width="wrap_content" | 85 | android:layout_width="wrap_content" |
| 60 | android:layout_height="wrap_content" | 86 | android:layout_height="wrap_content" |
| 61 | android:layout_margin="5dp" | 87 | android:layout_margin="5dp" |
| 62 | android:gravity="center" | 88 | android:gravity="center" |
| 63 | android:text="@string/tvSeleccion" | 89 | android:text="@string/tvSeleccion" |
| 64 | android:textSize="20sp" | 90 | android:textSize="20sp" |
| 65 | android:visibility="gone" | 91 | android:visibility="gone" |
| 66 | app:layout_constraintStart_toStartOf="parent" | 92 | app:layout_constraintStart_toStartOf="parent" |
| 67 | app:layout_constraintTop_toBottomOf="@+id/tvgenerico" /> | 93 | app:layout_constraintTop_toBottomOf="@+id/tvgenerico" /> |
| 68 | 94 | ||
| 69 | <RadioGroup | 95 | <RadioGroup |
| 70 | android:id="@+id/rgFechaHora" | 96 | android:id="@+id/rgFechaHora" |
| 71 | android:layout_width="wrap_content" | 97 | android:layout_width="wrap_content" |
| 72 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
| 73 | android:gravity="start" | 99 | android:gravity="start" |
| 74 | android:orientation="horizontal" | 100 | android:orientation="horizontal" |
| 75 | app:layout_constraintEnd_toEndOf="parent" | 101 | app:layout_constraintEnd_toEndOf="parent" |
| 76 | app:layout_constraintHorizontal_bias="0.0" | 102 | app:layout_constraintHorizontal_bias="0.0" |
| 77 | app:layout_constraintStart_toStartOf="parent" | 103 | app:layout_constraintStart_toStartOf="parent" |
| 78 | app:layout_constraintTop_toBottomOf="@+id/tvgenerico2"> | 104 | app:layout_constraintTop_toBottomOf="@+id/tvgenerico2"> |
| 79 | 105 | ||
| 80 | <RadioButton | 106 | <RadioButton |
| 81 | android:id="@+id/rbSumar" | 107 | android:id="@+id/rbSumar" |
| 82 | android:layout_width="wrap_content" | 108 | android:layout_width="wrap_content" |
| 83 | android:layout_height="wrap_content" | 109 | android:layout_height="wrap_content" |
| 84 | android:layout_margin="5dp" | 110 | android:layout_margin="5dp" |
| 85 | android:checked="false" | 111 | android:checked="true" |
| 86 | |||
| 87 | android:text="@string/rbSumar" | 112 | android:text="@string/rbSumar" |
| 88 | android:textSize="@dimen/text_size2" /> | 113 | android:textSize="@dimen/text_size2" /> |
| 89 | 114 | ||
| 90 | <RadioButton | 115 | <RadioButton |
| 91 | android:id="@+id/rbMdodificar" | 116 | android:id="@+id/rbMdodificar" |
| 92 | android:layout_width="wrap_content" | 117 | android:layout_width="wrap_content" |
| 93 | android:layout_height="wrap_content" | 118 | android:layout_height="wrap_content" |
| 94 | android:layout_margin="5dp" | 119 | android:layout_margin="5dp" |
| 95 | android:checked="false" | 120 | android:checked="false" |
| 96 | android:text="@string/rbModificar" | 121 | android:text="@string/rbModificar" |
| 97 | android:textSize="@dimen/text_size2" /> | 122 | android:textSize="@dimen/text_size2" /> |
| 98 | 123 | ||
| 99 | <RadioButton | 124 | <RadioButton |
| 100 | android:id="@+id/rbRestar" | 125 | android:id="@+id/rbRestar" |
| 101 | android:layout_width="wrap_content" | 126 | android:layout_width="wrap_content" |
| 102 | android:layout_height="wrap_content" | 127 | android:layout_height="wrap_content" |
| 103 | android:layout_margin="5dp" | 128 | android:layout_margin="5dp" |
| 104 | android:checked="false" | 129 | android:checked="false" |
| 105 | android:padding="5dp" | 130 | android:padding="5dp" |
| 106 | android:text="@string/rbRestar" | 131 | android:text="@string/rbRestar" |
| 107 | android:textSize="@dimen/text_size2" /> | 132 | android:textSize="@dimen/text_size2" /> |
| 108 | 133 | ||
| 109 | </RadioGroup> | 134 | </RadioGroup> |
| 110 | 135 | ||
| 111 | <TextView | 136 | <TextView |
| 112 | android:id="@+id/tvgenerico3" | 137 | android:id="@+id/tvgenerico3" |
| 113 | android:layout_width="wrap_content" | 138 | android:layout_width="wrap_content" |
| 114 | android:layout_height="wrap_content" | 139 | android:layout_height="wrap_content" |
| 115 | android:layout_margin="5dp" | 140 | android:layout_margin="5dp" |
| 116 | android:gravity="center" | 141 | android:gravity="center" |
| 117 | android:text="@string/tvResultado" | 142 | android:text="Resultado :" |
| 143 | android:textStyle="bold" | ||
| 118 | android:textSize="20sp" | 144 | android:textSize="20sp" |
| 119 | app:layout_constraintEnd_toEndOf="parent" | 145 | app:layout_constraintEnd_toEndOf="parent" |
| 120 | app:layout_constraintHorizontal_bias="0.0" | 146 | app:layout_constraintHorizontal_bias="0.0" |
| 121 | app:layout_constraintStart_toStartOf="parent" | 147 | app:layout_constraintStart_toStartOf="parent" |
| 122 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 148 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
| 123 | 149 | ||
| 124 | <TextView | 150 | <TextView |
| 125 | android:id="@+id/tvResultado" | 151 | android:id="@+id/tvResultado" |
| 126 | android:layout_width="wrap_content" | 152 | android:layout_width="wrap_content" |
| 127 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
| 128 | android:layout_margin="5dp" | 154 | android:layout_margin="5dp" |
| 129 | android:gravity="center" | 155 | android:gravity="center" |
| 130 | android:text="" | 156 | android:text="" |
| 131 | android:textSize="20sp" | 157 | android:textSize="20sp" |
| 132 | app:layout_constraintEnd_toEndOf="parent" | 158 | app:layout_constraintEnd_toEndOf="parent" |
| 133 | app:layout_constraintHorizontal_bias="0.0" | 159 | app:layout_constraintHorizontal_bias="0.0" |
| 134 | app:layout_constraintStart_toEndOf="@+id/tvgenerico3" | 160 | app:layout_constraintStart_toEndOf="@+id/tvgenerico3" |
| 135 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 161 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
| 136 | 162 | ||
| 137 | <LinearLayout | 163 | <LinearLayout |
| 138 | android:layout_width="match_parent" | 164 | android:layout_width="match_parent" |
| 139 | android:layout_height="wrap_content" | 165 | android:layout_height="wrap_content" |
| 166 | android:layout_margin="10dp" | ||
| 140 | android:gravity="center" | 167 | android:gravity="center" |
| 141 | android:orientation="horizontal" | 168 | android:orientation="horizontal" |
| 142 | app:layout_constraintEnd_toEndOf="parent" | 169 | app:layout_constraintEnd_toEndOf="parent" |
| 143 | app:layout_constraintStart_toStartOf="parent" | 170 | app:layout_constraintStart_toStartOf="parent" |
| 144 | app:layout_constraintTop_toBottomOf="@+id/tvResultado"> | 171 | app:layout_constraintTop_toBottomOf="@+id/tvResultado"> |
| 145 | 172 | ||
| 146 | <Button | 173 | <Button |
| 147 | android:id="@+id/btnAceptar" | 174 | android:id="@+id/btnAceptar" |
| 148 | style="@style/Base.Widget.AppCompat.Button.Colored" | 175 | style="@style/Base.Widget.AppCompat.Button.Colored" |
| 149 | android:layout_width="wrap_content" | 176 | android:layout_width="140dp" |
| 150 | android:layout_height="wrap_content" | 177 | android:layout_height="wrap_content" |
| 151 | android:layout_margin="5dp" | 178 | android:layout_margin="5dp" |
| 152 | android:background="@drawable/boton_borde_redondeado" | 179 | android:background="@drawable/boton_borde_redondeado" |
| 153 | android:padding="20dp" | 180 | android:padding="20dp" |
| 154 | android:text="@string/btnOk" | 181 | android:text="@string/btnOk" |
| 155 | android:textColor="@android:color/white" /> | 182 | android:textColor="@android:color/white" /> |
| 156 | 183 | ||
| 157 | <Button | 184 | <Button |
| 158 | android:id="@+id/dialogCancelBtn" | 185 | android:id="@+id/dialogCancelBtn" |
| 159 | style="@style/Base.Widget.AppCompat.Button.Colored" | 186 | style="@style/Base.Widget.AppCompat.Button.Colored" |
| 160 | android:layout_width="wrap_content" | 187 | android:layout_width="140dp" |
| 161 | android:layout_height="wrap_content" | 188 | android:layout_height="wrap_content" |
| 162 | android:layout_margin="5dp" | 189 | android:layout_margin="5dp" |
| 163 | android:background="@drawable/boton_borde_redondeado" | 190 | android:background="@drawable/boton_borde_redondeado" |
| 164 | android:padding="20dp" | 191 | android:padding="20dp" |
| 165 | android:text="@string/btnCancelar" | 192 | android:text="@string/btnCancelar" |
| 166 | android:textColor="@android:color/white" /> | 193 | android:textColor="@android:color/white" /> |
| 167 | </LinearLayout> | 194 | </LinearLayout> |
| 168 | 195 |
app/src/main/res/navigation/mobile_navigation.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | android:id="@+id/mobile_navigation" | 5 | android:id="@+id/mobile_navigation" |
| 6 | app:startDestination="@id/mainFragment2"> | 6 | app:startDestination="@id/mainFragment2"> |
| 7 | 7 | ||
| 8 | <activity | 8 | <activity |
| 9 | android:id="@+id/mainActivity" | 9 | android:id="@+id/mainActivity" |
| 10 | android:name="com.focasoftware.deboinventariov20.UI.MainActivity" | 10 | android:name="com.focasoftware.deboinventariov20.UI.MainActivity" |
| 11 | android:label="app_bar_main" | 11 | android:label="app_bar_main" |
| 12 | tools:layout="@layout/app_bar_main" /> | 12 | tools:layout="@layout/app_bar_main" /> |
| 13 | 13 | ||
| 14 | <fragment | 14 | <fragment |
| 15 | android:id="@+id/mainFragment2" | 15 | android:id="@+id/mainFragment2" |
| 16 | android:name="com.focasoftware.deboinventariov20.UI.main.MainFragment" | 16 | android:name="com.focasoftware.deboinventariov20.UI.main.MainFragment" |
| 17 | android:label="Principal" | 17 | android:label="Principal" |
| 18 | tools:layout="@layout/fragment_main" > | 18 | tools:layout="@layout/fragment_main" > |
| 19 | <action | 19 | <action |
| 20 | android:id="@+id/action_mainFragment2_to_configuracionFragment" | 20 | android:id="@+id/action_mainFragment2_to_configuracionFragment" |
| 21 | app:destination="@id/configuracionFragment" | 21 | app:destination="@id/configuracionFragment" |
| 22 | app:popEnterAnim="@anim/slide_in_left" | 22 | app:popEnterAnim="@anim/slide_in_left" |
| 23 | app:popExitAnim="@anim/slide_out_right" | 23 | app:popExitAnim="@anim/slide_out_right" |
| 24 | app:enterAnim="@anim/slide_in_right" | 24 | app:enterAnim="@anim/slide_in_right" |
| 25 | app:exitAnim="@anim/slide_out_left" /> | 25 | app:exitAnim="@anim/slide_out_left" /> |
| 26 | <action | 26 | <action |
| 27 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" | 27 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" |
| 28 | app:destination="@id/actuaMaestrosFragment" | 28 | app:destination="@id/actuaMaestrosFragment" |
| 29 | app:popEnterAnim="@anim/slide_in_left" | 29 | app:popEnterAnim="@anim/slide_in_left" |
| 30 | app:popExitAnim="@anim/slide_out_right" | 30 | app:popExitAnim="@anim/slide_out_right" |
| 31 | app:enterAnim="@anim/slide_in_right" | 31 | app:enterAnim="@anim/slide_in_right" |
| 32 | app:exitAnim="@anim/slide_out_left" /> | 32 | app:exitAnim="@anim/slide_out_left" /> |
| 33 | <action | 33 | <action |
| 34 | android:id="@+id/action_mainFragment2_to_inventarioFragment" | 34 | android:id="@+id/action_mainFragment2_to_inventarioFragment" |
| 35 | app:destination="@id/inventarioFragment" | 35 | app:destination="@id/inventarioFragment" |
| 36 | app:popEnterAnim="@anim/slide_in_left" | 36 | app:popEnterAnim="@anim/slide_in_left" |
| 37 | app:popExitAnim="@anim/slide_out_right" | 37 | app:popExitAnim="@anim/slide_out_right" |
| 38 | app:enterAnim="@anim/slide_in_right" | 38 | app:enterAnim="@anim/slide_in_right" |
| 39 | app:exitAnim="@anim/slide_out_left" /> | 39 | app:exitAnim="@anim/slide_out_left" /> |
| 40 | </fragment> | 40 | </fragment> |
| 41 | 41 | ||
| 42 | <fragment | 42 | <fragment |
| 43 | android:id="@+id/actuaMaestrosFragment" | 43 | android:id="@+id/actuaMaestrosFragment" |
| 44 | android:name="com.focasoftware.deboinventariov20.UI.actualizacionMaestros.ActuaMaestrosFragment" | 44 | android:name="com.focasoftware.deboinventariov20.UI.actualizacionMaestros.ActuaMaestrosFragment" |
| 45 | android:label="Importaciones Varias" | 45 | android:label="Importaciones Varias" |
| 46 | tools:layout="@layout/fragment_actua_maestros" /> | 46 | tools:layout="@layout/fragment_actua_maestros" /> |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | <fragment | 49 | <fragment |
| 50 | android:id="@+id/inventarioFragment" | 50 | android:id="@+id/inventarioFragment" |
| 51 | android:name="com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment" | 51 | android:name="com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment" |
| 52 | android:label="Inventario Dinamico" | 52 | android:label="Inventario Dinamico" |
| 53 | tools:layout="@layout/fragment_inventario" > | 53 | tools:layout="@layout/fragment_inventario" > |
| 54 | <action | 54 | <action |
| 55 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" | 55 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" |
| 56 | app:destination="@id/descripcionFragment" | 56 | app:destination="@id/descripcionFragment" |
| 57 | app:popEnterAnim="@anim/slide_in_left" | 57 | app:popEnterAnim="@anim/slide_in_left" |
| 58 | app:popExitAnim="@anim/slide_out_right" | 58 | app:popExitAnim="@anim/slide_out_right" |
| 59 | app:enterAnim="@anim/slide_in_right" | 59 | app:enterAnim="@anim/slide_in_right" |
| 60 | app:exitAnim="@anim/slide_out_left" | 60 | app:exitAnim="@anim/slide_out_left" |
| 61 | /> | 61 | /> |
| 62 | <action | 62 | <action |
| 63 | android:id="@+id/action_inventarioFragment_to_mainFragment2" | 63 | android:id="@+id/action_inventarioFragment_to_mainFragment2" |
| 64 | app:destination="@id/mainFragment2" | 64 | app:destination="@id/mainFragment2" |
| 65 | app:popEnterAnim="@anim/slide_in_left" | 65 | app:popEnterAnim="@anim/slide_in_left" |
| 66 | app:popExitAnim="@anim/slide_out_right" | 66 | app:popExitAnim="@anim/slide_out_right" |
| 67 | app:enterAnim="@anim/slide_in_right" | 67 | app:enterAnim="@anim/slide_in_right" |
| 68 | app:exitAnim="@anim/slide_out_left"/> | 68 | app:exitAnim="@anim/slide_out_left"/> |
| 69 | <action | 69 | <action |
| 70 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" | 70 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" |
| 71 | app:destination="@id/detalleArtFragment" /> | 71 | app:destination="@id/detalleArtFragment" /> |
| 72 | <action | 72 | <action |
| 73 | android:id="@+id/action_inventarioFragment_to_codigoOriFragment" | 73 | android:id="@+id/action_inventarioFragment_to_codigoOriFragment" |
| 74 | app:destination="@id/codigoOriFragment" /> | 74 | app:destination="@id/codigoOriFragment" /> |
| 75 | </fragment> | 75 | </fragment> |
| 76 | 76 | ||
| 77 | <fragment | 77 | <fragment |
| 78 | android:id="@+id/descripcionFragment" | 78 | android:id="@+id/descripcionFragment" |
| 79 | android:name="com.focasoftware.deboinventariov20.UI.descripcionFragment.DescripcionFragment" | 79 | android:name="com.focasoftware.deboinventariov20.UI.descripcionFragment.DescripcionFragment" |
| 80 | android:label="Productos Encontrados"> | 80 | android:label="Busqueda por Descripción"> |
| 81 | <action | 81 | <action |
| 82 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 82 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
| 83 | app:destination="@id/inventarioFragment" | 83 | app:destination="@id/inventarioFragment" |
| 84 | app:popEnterAnim="@anim/slide_in_left" | ||
| 85 | app:popExitAnim="@anim/slide_out_right" | ||
| 86 | app:enterAnim="@anim/slide_in_right" | 84 | app:enterAnim="@anim/slide_in_right" |
| 87 | app:exitAnim="@anim/slide_out_left" /> | 85 | app:exitAnim="@anim/slide_out_left" |
| 86 | app:popEnterAnim="@anim/slide_in_left" | ||
| 87 | app:popExitAnim="@anim/slide_out_right" /> | ||
| 88 | </fragment> | 88 | </fragment> |
| 89 | 89 | ||
| 90 | <fragment | 90 | <fragment |
| 91 | android:id="@+id/detalleArtFragment" | 91 | android:id="@+id/detalleArtFragment" |
| 92 | android:name="com.focasoftware.deboinventariov20.UI.detalleProducto.DetalleArtFragment" | 92 | android:name="com.focasoftware.deboinventariov20.UI.detalleProducto.DetalleArtFragment" |
| 93 | android:label="Detalle Articulo" | 93 | android:label="Detalle Articulo" |
| 94 | tools:layout="@layout/fragment_detalle_art"> | 94 | tools:layout="@layout/fragment_detalle_art"> |
| 95 | <action | 95 | <action |
| 96 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" | 96 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" |
| 97 | app:destination="@id/inventarioFragment" /> | 97 | app:destination="@id/inventarioFragment" /> |
| 98 | </fragment> | 98 | </fragment> |
| 99 | <fragment | 99 | <fragment |
| 100 | android:id="@+id/configuracionFragment" | 100 | android:id="@+id/configuracionFragment" |
| 101 | android:name="com.focasoftware.deboinventariov20.UI.configuracion.ConfiguracionFragment" | 101 | android:name="com.focasoftware.deboinventariov20.UI.configuracion.ConfiguracionFragment" |
| 102 | android:label="Configuraciones" | 102 | android:label="Configuraciones" |
| 103 | tools:layout="@layout/fragment_configuracion" > | 103 | tools:layout="@layout/fragment_configuracion" > |
| 104 | <action | 104 | <action |
| 105 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | 105 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" |
| 106 | app:destination="@id/servidoresFragment" | 106 | app:destination="@id/servidoresFragment" |
| 107 | app:popEnterAnim="@anim/slide_in_left" | 107 | app:popEnterAnim="@anim/slide_in_left" |
| 108 | app:popExitAnim="@anim/slide_out_right" | 108 | app:popExitAnim="@anim/slide_out_right" |
| 109 | app:enterAnim="@anim/slide_in_right" | 109 | app:enterAnim="@anim/slide_in_right" |
| 110 | app:exitAnim="@anim/slide_out_left" /> | 110 | app:exitAnim="@anim/slide_out_left" /> |
| 111 | <action | 111 | <action |
| 112 | android:id="@+id/action_configuracionFragment_to_mainFragment2" | 112 | android:id="@+id/action_configuracionFragment_to_mainFragment2" |
| 113 | app:destination="@id/mainFragment2" | 113 | app:destination="@id/mainFragment2" |
| 114 | app:popUpTo="@id/configuracionFragment" | 114 | app:popUpTo="@id/configuracionFragment" |
| 115 | app:popUpToInclusive="false" /> | 115 | app:popUpToInclusive="false" /> |
| 116 | </fragment> | 116 | </fragment> |
| 117 | 117 | ||
| 118 | <fragment | 118 | <fragment |
| 119 | android:id="@+id/servidoresFragment" | 119 | android:id="@+id/servidoresFragment" |
| 120 | android:name="com.focasoftware.deboinventariov20.UI.servidores.ServidoresFragment" | 120 | android:name="com.focasoftware.deboinventariov20.UI.servidores.ServidoresFragment" |
| 121 | android:label="Alta Servidores" | 121 | android:label="Alta Servidores" |
| 122 | tools:layout="@layout/fragment_servidores"> | 122 | tools:layout="@layout/fragment_servidores"> |
| 123 | <action | 123 | <action |
| 124 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | 124 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" |
| 125 | app:destination="@id/configuracionFragment" | 125 | app:destination="@id/configuracionFragment" |
| 126 | app:popUpTo="@id/servidoresFragment" | 126 | app:popUpTo="@id/servidoresFragment" |
| 127 | app:popUpToInclusive="false" /> | 127 | app:popUpToInclusive="false" /> |
| 128 | </fragment> | 128 | </fragment> |
| 129 | <fragment | 129 | <fragment |
| 130 | android:id="@+id/codigoOriFragment" | 130 | android:id="@+id/codigoOriFragment" |
| 131 | android:name="com.focasoftware.deboinventariov20.UI.descripCorigenFragment.CodigoOriFragment" | 131 | android:name="com.focasoftware.deboinventariov20.UI.descripCorigenFragment.CodigoOriFragment" |
| 132 | android:label="CodigoOriFragment" > | 132 | android:label="Busqueda por Código de Origen"> |
| 133 | <action | 133 | <action |
| 134 | android:id="@+id/action_codigoOriFragment_to_inventarioFragment" | 134 | android:id="@+id/action_codigoOriFragment_to_inventarioFragment" |
| 135 | app:destination="@id/inventarioFragment" /> | 135 | app:destination="@id/inventarioFragment" /> |
| 136 | </fragment> | 136 | </fragment> |