Commit ea89488e5416d3507b0a2c95931d92b05604f0b4
1 parent
df4a49f76c
Exists in
master
17092020 1500
Showing
23 changed files
with
980 additions
and
309 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 | <DBN-PSQL> | ||
4 | <case-options enabled="true"> | ||
5 | <option name="KEYWORD_CASE" value="lower" /> | ||
6 | <option name="FUNCTION_CASE" value="lower" /> | ||
7 | <option name="PARAMETER_CASE" value="lower" /> | ||
8 | <option name="DATATYPE_CASE" value="lower" /> | ||
9 | <option name="OBJECT_CASE" value="preserve" /> | ||
10 | </case-options> | ||
11 | <formatting-settings enabled="false" /> | ||
12 | </DBN-PSQL> | ||
13 | <DBN-SQL> | ||
14 | <case-options enabled="true"> | ||
15 | <option name="KEYWORD_CASE" value="lower" /> | ||
16 | <option name="FUNCTION_CASE" value="lower" /> | ||
17 | <option name="PARAMETER_CASE" value="lower" /> | ||
18 | <option name="DATATYPE_CASE" value="lower" /> | ||
19 | <option name="OBJECT_CASE" value="preserve" /> | ||
20 | </case-options> | ||
21 | <formatting-settings enabled="false"> | ||
22 | <option name="STATEMENT_SPACING" value="one_line" /> | ||
23 | <option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" /> | ||
24 | <option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" /> | ||
25 | </formatting-settings> | ||
26 | </DBN-SQL> | ||
27 | <JetCodeStyleSettings> | 3 | <JetCodeStyleSettings> |
28 | <option name="PACKAGES_TO_USE_STAR_IMPORTS"> | 4 | <option name="PACKAGES_TO_USE_STAR_IMPORTS"> |
29 | <value> | 5 | <value> |
30 | <package name="java.util" alias="false" withSubpackages="false" /> | 6 | <package name="java.util" alias="false" withSubpackages="false" /> |
31 | <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" /> | 7 | <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" /> |
32 | <package name="io.ktor" alias="false" withSubpackages="true" /> | 8 | <package name="io.ktor" alias="false" withSubpackages="true" /> |
33 | </value> | 9 | </value> |
34 | </option> | 10 | </option> |
35 | <option name="PACKAGES_IMPORT_LAYOUT"> | 11 | <option name="PACKAGES_IMPORT_LAYOUT"> |
36 | <value> | 12 | <value> |
37 | <package name="" alias="false" withSubpackages="true" /> | 13 | <package name="" alias="false" withSubpackages="true" /> |
38 | <package name="java" alias="false" withSubpackages="true" /> | 14 | <package name="java" alias="false" withSubpackages="true" /> |
39 | <package name="javax" alias="false" withSubpackages="true" /> | 15 | <package name="javax" alias="false" withSubpackages="true" /> |
40 | <package name="kotlin" alias="false" withSubpackages="true" /> | 16 | <package name="kotlin" alias="false" withSubpackages="true" /> |
41 | <package name="" alias="true" withSubpackages="true" /> | 17 | <package name="" alias="true" withSubpackages="true" /> |
42 | </value> | 18 | </value> |
43 | </option> | 19 | </option> |
44 | <option name="IF_RPAREN_ON_NEW_LINE" value="false" /> | ||
45 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> | 20 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> |
46 | </JetCodeStyleSettings> | 21 | </JetCodeStyleSettings> |
47 | <codeStyleSettings language="XML"> | 22 | <codeStyleSettings language="XML"> |
48 | <indentOptions> | 23 | <indentOptions> |
49 | <option name="CONTINUATION_INDENT_SIZE" value="4" /> | 24 | <option name="CONTINUATION_INDENT_SIZE" value="4" /> |
50 | </indentOptions> | 25 | </indentOptions> |
51 | <arrangement> | 26 | <arrangement> |
52 | <rules> | 27 | <rules> |
53 | <section> | 28 | <section> |
54 | <rule> | 29 | <rule> |
55 | <match> | 30 | <match> |
56 | <AND> | 31 | <AND> |
57 | <NAME>xmlns:android</NAME> | 32 | <NAME>xmlns:android</NAME> |
58 | <XML_ATTRIBUTE /> | 33 | <XML_ATTRIBUTE /> |
59 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 34 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
60 | </AND> | 35 | </AND> |
61 | </match> | 36 | </match> |
62 | </rule> | 37 | </rule> |
63 | </section> | 38 | </section> |
64 | <section> | 39 | <section> |
65 | <rule> | 40 | <rule> |
66 | <match> | 41 | <match> |
67 | <AND> | 42 | <AND> |
68 | <NAME>xmlns:.*</NAME> | 43 | <NAME>xmlns:.*</NAME> |
69 | <XML_ATTRIBUTE /> | 44 | <XML_ATTRIBUTE /> |
70 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 45 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
71 | </AND> | 46 | </AND> |
72 | </match> | 47 | </match> |
73 | <order>BY_NAME</order> | 48 | <order>BY_NAME</order> |
74 | </rule> | 49 | </rule> |
75 | </section> | 50 | </section> |
76 | <section> | 51 | <section> |
77 | <rule> | 52 | <rule> |
78 | <match> | 53 | <match> |
79 | <AND> | 54 | <AND> |
80 | <NAME>.*:id</NAME> | 55 | <NAME>.*:id</NAME> |
81 | <XML_ATTRIBUTE /> | 56 | <XML_ATTRIBUTE /> |
82 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | 57 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
83 | </AND> | 58 | </AND> |
84 | </match> | 59 | </match> |
85 | </rule> | 60 | </rule> |
86 | </section> | 61 | </section> |
87 | <section> | 62 | <section> |
88 | <rule> | 63 | <rule> |
89 | <match> | 64 | <match> |
90 | <AND> | 65 | <AND> |
91 | <NAME>.*:name</NAME> | 66 | <NAME>.*:name</NAME> |
92 | <XML_ATTRIBUTE /> | 67 | <XML_ATTRIBUTE /> |
93 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | 68 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
94 | </AND> | 69 | </AND> |
95 | </match> | 70 | </match> |
96 | </rule> | 71 | </rule> |
97 | </section> | 72 | </section> |
98 | <section> | 73 | <section> |
99 | <rule> | 74 | <rule> |
100 | <match> | 75 | <match> |
101 | <AND> | 76 | <AND> |
102 | <NAME>name</NAME> | 77 | <NAME>name</NAME> |
103 | <XML_ATTRIBUTE /> | 78 | <XML_ATTRIBUTE /> |
104 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 79 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
105 | </AND> | 80 | </AND> |
106 | </match> | 81 | </match> |
107 | </rule> | 82 | </rule> |
108 | </section> | 83 | </section> |
109 | <section> | 84 | <section> |
110 | <rule> | 85 | <rule> |
111 | <match> | 86 | <match> |
112 | <AND> | 87 | <AND> |
113 | <NAME>style</NAME> | 88 | <NAME>style</NAME> |
114 | <XML_ATTRIBUTE /> | 89 | <XML_ATTRIBUTE /> |
115 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 90 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
116 | </AND> | 91 | </AND> |
117 | </match> | 92 | </match> |
118 | </rule> | 93 | </rule> |
119 | </section> | 94 | </section> |
120 | <section> | 95 | <section> |
121 | <rule> | 96 | <rule> |
122 | <match> | 97 | <match> |
123 | <AND> | 98 | <AND> |
124 | <NAME>.*</NAME> | 99 | <NAME>.*</NAME> |
125 | <XML_ATTRIBUTE /> | 100 | <XML_ATTRIBUTE /> |
126 | <XML_NAMESPACE>^$</XML_NAMESPACE> | 101 | <XML_NAMESPACE>^$</XML_NAMESPACE> |
127 | </AND> | 102 | </AND> |
128 | </match> | 103 | </match> |
129 | <order>BY_NAME</order> | 104 | <order>BY_NAME</order> |
130 | </rule> | 105 | </rule> |
131 | </section> | 106 | </section> |
132 | <section> | 107 | <section> |
133 | <rule> | 108 | <rule> |
134 | <match> | 109 | <match> |
135 | <AND> | 110 | <AND> |
136 | <NAME>.*</NAME> | 111 | <NAME>.*</NAME> |
137 | <XML_ATTRIBUTE /> | 112 | <XML_ATTRIBUTE /> |
138 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | 113 | <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |
139 | </AND> | 114 | </AND> |
140 | </match> | 115 | </match> |
141 | <order>ANDROID_ATTRIBUTE_ORDER</order> | 116 | <order>ANDROID_ATTRIBUTE_ORDER</order> |
142 | </rule> | 117 | </rule> |
143 | </section> | 118 | </section> |
144 | <section> | 119 | <section> |
145 | <rule> | 120 | <rule> |
146 | <match> | 121 | <match> |
147 | <AND> | 122 | <AND> |
148 | <NAME>.*</NAME> | 123 | <NAME>.*</NAME> |
149 | <XML_ATTRIBUTE /> | 124 | <XML_ATTRIBUTE /> |
150 | <XML_NAMESPACE>.*</XML_NAMESPACE> | 125 | <XML_NAMESPACE>.*</XML_NAMESPACE> |
151 | </AND> | 126 | </AND> |
152 | </match> | 127 | </match> |
153 | <order>BY_NAME</order> | 128 | <order>BY_NAME</order> |
154 | </rule> | 129 | </rule> |
155 | </section> | 130 | </section> |
156 | </rules> | 131 | </rules> |
157 | </arrangement> | 132 | </arrangement> |
158 | </codeStyleSettings> | 133 | </codeStyleSettings> |
159 | <codeStyleSettings language="kotlin"> | 134 | <codeStyleSettings language="kotlin"> |
160 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> | 135 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> |
161 | <option name="RIGHT_MARGIN" value="200" /> | ||
162 | <option name="KEEP_LINE_BREAKS" value="false" /> | ||
163 | <option name="ALIGN_MULTILINE_PARAMETERS" value="false" /> | ||
164 | <option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="false" /> | ||
165 | <option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="false" /> | ||
166 | <option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="false" /> | ||
167 | <option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="false" /> | ||
168 | <option name="WRAP_ON_TYPING" value="1" /> | ||
169 | </codeStyleSettings> | 136 | </codeStyleSettings> |
170 | </code_scheme> | 137 | </code_scheme> |
171 | </component> | 138 | </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" /> | ||
4 | </state> | 5 | </state> |
5 | </component> | 6 | </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 DES 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 DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") | 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: Int): List<Articles> | 27 | suspend fun findArticuloByDesc(description: String?, dep: Boolean): List<Articles> |
28 | 28 | ||
29 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") | 29 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(CODBAR) = :codBarra") |
30 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? | 30 | suspend fun findArticuloByCodBar(codBarra: String, dep: Boolean): Articles |
31 | 31 | ||
32 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CBC LIKE :CodOrigen") | 32 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(COO) LIKE :CodOrigen") |
33 | suspend fun findArticuloByCodOri(CodOrigen: String?, dep: Int): 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 SEC=:sector AND COD=: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: Int) |
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") | ||
60 | suspend fun fetchAreaInvH (inven: Int): Boolean | ||
61 | |||
59 | @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") |
60 | suspend fun consultaCantidadInvH (inven: Int): Int | 63 | suspend fun consultaCantidadInvH (inven: Int): Int |
61 | 64 | ||
62 | @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") |
63 | suspend fun updateInvBody(inven: Int,cant: Int) | 66 | suspend fun updateInvBody(inven: Int,cant: Int) |
64 | } | 67 | } |
65 | 68 | ||
66 | @Dao | 69 | @Dao |
67 | interface InvBodyDAO { | 70 | interface InvBodyDAO { |
68 | @Insert() | 71 | @Insert() |
69 | suspend fun insertInvBody(invBody: InvBody?) | 72 | suspend fun insertInvBody(invBody: InvBody?) |
70 | 73 | ||
71 | @Query("DELETE FROM $TABLA_INV_B") | 74 | @Query("DELETE FROM $TABLA_INV_B") |
72 | suspend fun deleteAllInvBody() | 75 | suspend fun deleteAllInvBody() |
73 | 76 | ||
74 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") | 77 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") |
75 | suspend fun deleteInvBody(inven: Int) | 78 | suspend fun deleteInvBody(inven: Int) |
76 | 79 | ||
77 | @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") |
78 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) | 81 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) |
79 | 82 | ||
80 | @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") |
81 | suspend fun fetchAllInvBody(inven: Int): List<InvBody> | 84 | suspend fun fetchAllInvBody(inven: Int): List<InvBody> |
82 | 85 | ||
83 | @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") |
84 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody | 87 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody |
85 | 88 | ||
86 | @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") |
87 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int | 90 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int |
88 | } | 91 | } |
89 | 92 | ||
90 | @Dao | 93 | @Dao |
91 | interface ServeInvDao { | 94 | interface ServeInvDao { |
92 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 95 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
93 | fun insertServer(servidor: ServeInv) | 96 | fun insertServer(servidor: ServeInv) |
94 | 97 | ||
95 | @Query("SELECT * FROM $TABLA_SERV_INV ORDER BY SER_NUM") | 98 | @Query("SELECT * FROM $TABLA_SERV_INV ORDER BY SER_NUM") |
96 | suspend fun fetchAllServers(): List<ServeInv> | 99 | suspend fun fetchAllServers(): List<ServeInv> |
97 | 100 | ||
98 | @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") |
99 | suspend fun deleteServer(description: String, dir: String) | 102 | suspend fun deleteServer(description: String, dir: String) |
100 | 103 | ||
101 | @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") |
102 | suspend fun findLastServer(): Int | 105 | suspend fun findLastServer(): Int |
103 | 106 | ||
104 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") | 107 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") |
105 | suspend fun UpdateServerPreInZero() | 108 | suspend fun UpdateServerPreInZero() |
106 | 109 | ||
107 | @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") |
108 | suspend fun UpdateServerPre(numero: Int) | 111 | suspend fun UpdateServerPre(numero: Int) |
109 | 112 | ||
110 | @Query("SELECT SER_DIR FROM $TABLA_SERV_INV WHERE SER_PRE= 1") | 113 | @Query("SELECT SER_DIR FROM $TABLA_SERV_INV WHERE SER_PRE= 1") |
111 | suspend fun fetchServerPreOne(): String | 114 | suspend fun fetchServerPreOne(): String |
112 | } | 115 | } |
app/src/main/java/com/focasoftware/deboinventariov20/Model/ProductosApi.kt
1 | package com.focasoftware.deboinventariov20.Model | 1 | package com.focasoftware.deboinventariov20.Model |
2 | 2 | ||
3 | import retrofit2.Response | 3 | import retrofit2.Response |
4 | import retrofit2.http.GET | 4 | import retrofit2.http.GET |
5 | 5 | ||
6 | interface ProductosApi { | 6 | interface ProductosApi { |
7 | 7 | ||
8 | @GET("api/articulos") | 8 | @GET("articulos/articulosCodBarra") |
9 | suspend fun getProductos(): Response<List<Productos>> | 9 | suspend fun getProductos(): Response<List<Productos>> |
10 | 10 | ||
11 | } | 11 | } |
app/src/main/java/com/focasoftware/deboinventariov20/Model/Tablas.kt
1 | package com.focasoftware.deboinventariov20.Model | 1 | package com.focasoftware.deboinventariov20.Model |
2 | 2 | ||
3 | import androidx.room.ColumnInfo | 3 | import androidx.room.ColumnInfo |
4 | import androidx.room.Entity | 4 | import androidx.room.Entity |
5 | import androidx.room.PrimaryKey | 5 | import androidx.room.PrimaryKey |
6 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_ART | 6 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_ART |
7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_B | 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_B |
8 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_H | 8 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_H |
9 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_SERV_INV | 9 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_SERV_INV |
10 | import com.google.gson.annotations.SerializedName | 10 | import com.google.gson.annotations.SerializedName |
11 | import java.io.Serializable | 11 | import java.io.Serializable |
12 | 12 | ||
13 | data class Productos(@SerializedName("SEC") var sector: String?, | 13 | //data class Productos(@SerializedName("SEC") var sector: String?, |
14 | @SerializedName("COD") var codigo: String?, | 14 | // @SerializedName("COD") var codigo: String?, |
15 | @SerializedName("DESC") var descripcion: String?, | 15 | // @SerializedName("DESC") var descripcion: String?, |
16 | @SerializedName("CB") var codBar: String?, | 16 | // @SerializedName("CB") var codBar: String?, |
17 | @SerializedName("CBC") var codOrigen: String?, | 17 | // @SerializedName("CBC") var codOrigen: String?, |
18 | @SerializedName("PRE_VTA") var precio: String?, | 18 | // @SerializedName("PRE_VTA") var precio: String?, |
19 | @SerializedName("PRE_COS") var costo: String?, | 19 | // @SerializedName("PRE_COS") var costo: String?, |
20 | @SerializedName( "EV") var exiVenta: String?, | 20 | // @SerializedName( "EV") var exiVenta: String?, |
21 | @SerializedName( "ED") var exiDeposito: String?, | 21 | // @SerializedName( "ED") var exiDeposito: String?, |
22 | @SerializedName( "DE") var de: String?, | 22 | // @SerializedName( "DE") var de: String?, |
23 | @SerializedName( "BAL") var balanza: Int?, | 23 | // @SerializedName( "BAL") var balanza: Int?, |
24 | @SerializedName("DEPSN") var depSn: Int?, | 24 | // @SerializedName("DEPSN") var depSn: Int?, |
25 | @SerializedName("FOTO") var imagen: String?) | 25 | // @SerializedName("FOTO") var imagen: String?) |
26 | 26 | data class Productos(@SerializedName("CODSEC") var sector: String?, | |
27 | @SerializedName("CODART") var codigo: String?, | ||
28 | @SerializedName("DETART") var descripcion: String?, | ||
29 | @SerializedName("CODBAR") var codBar: String?, | ||
30 | @SerializedName("COO") var codOrigen: String?, | ||
31 | @SerializedName("PREVEN") var precio: String?, | ||
32 | @SerializedName("COSTO") var costo: String?, | ||
33 | @SerializedName( "EXIVTA") var exiVenta: String?, | ||
34 | @SerializedName( "EXIDEP") var exiDeposito: String?, | ||
35 | @SerializedName( "DVE") var de: String?, | ||
36 | @SerializedName( "UNIVEN") var balanza: Int?, | ||
37 | @SerializedName("DEPSN") var depSn: Boolean?, | ||
38 | @SerializedName("FOTO") var imagen: String?) | ||
39 | //@Entity(tableName = TABLA_ART) | ||
40 | //data class Articles(@ColumnInfo(name = "SEC") var sector: String?, | ||
41 | // @ColumnInfo(name = "COD") var codigo: String?, | ||
42 | // @ColumnInfo(name = "DES") var descripcion: String?, | ||
43 | // @ColumnInfo(name = "CB") var codBar: String?, | ||
44 | // @ColumnInfo(name = "CBC") var codOrigen: String?, | ||
45 | // @ColumnInfo(name = "PRE_VTA") var precio: String?, | ||
46 | // @ColumnInfo(name = "PRE_COS") var costo: String?, | ||
47 | // @ColumnInfo(name = "EV") var exiVenta: String?, | ||
48 | // @ColumnInfo(name = "ED") var exiDeposito: String?, | ||
49 | // @ColumnInfo(name = "DE") var de: String?, | ||
50 | // @ColumnInfo(name = "BAL") var balanza: Int?, | ||
51 | // @ColumnInfo(name = "DEPSN") var depSn: Int?, | ||
52 | // @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { | ||
53 | // @PrimaryKey(autoGenerate = true) | ||
54 | // @ColumnInfo(name = "id") | ||
55 | // var id: Long = 0 | ||
56 | //} | ||
27 | @Entity(tableName = TABLA_ART) | 57 | @Entity(tableName = TABLA_ART) |
28 | data class Articles(@ColumnInfo(name = "SEC") var sector: String?, | 58 | data class Articles(@ColumnInfo(name = "CODSEC") var sector: String?, |
29 | @ColumnInfo(name = "COD") var codigo: String?, | 59 | @ColumnInfo(name = "CODART") var codigo: String?, |
30 | @ColumnInfo(name = "DES") var descripcion: String?, | 60 | @ColumnInfo(name = "DETART") var descripcion: String?, |
31 | @ColumnInfo(name = "CB") var codBar: String?, | 61 | @ColumnInfo(name = "CODBAR") var codBar: String?, |
32 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 62 | @ColumnInfo(name = "COO") var codOrigen: String?, |
33 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 63 | @ColumnInfo(name = "PREVEN") var precio: String?, |
34 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 64 | @ColumnInfo(name = "COSTO") var costo: String?, |
35 | @ColumnInfo(name = "EV") var exiVenta: String?, | 65 | @ColumnInfo(name = "EXIVTA") var exiVenta: String?, |
36 | @ColumnInfo(name = "ED") var exiDeposito: String?, | 66 | @ColumnInfo(name = "EXIDEP") var exiDeposito: String?, |
37 | @ColumnInfo(name = "DE") var de: String?, | 67 | @ColumnInfo(name = "DVE") var de: String?, |
38 | @ColumnInfo(name = "BAL") var balanza: Int?, | 68 | @ColumnInfo(name = "UNIVEN") var balanza: Int?, |
39 | @ColumnInfo(name = "DEPSN") var depSn: Int?, | 69 | @ColumnInfo(name = "DEPSN") var depSn: Boolean?, |
40 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { | 70 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { |
41 | @PrimaryKey(autoGenerate = true) | 71 | @PrimaryKey(autoGenerate = true) |
42 | @ColumnInfo(name = "id") | 72 | @ColumnInfo(name = "id") |
43 | var id: Long = 0 | 73 | var id: Long = 0 |
44 | } | 74 | } |
45 | 75 | ||
46 | |||
47 | @Entity(tableName = TABLA_INV_H) | 76 | @Entity(tableName = TABLA_INV_H) |
48 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, | 77 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, |
49 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, | 78 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, |
50 | @ColumnInfo(name = "ESTADO") var estado: Int?, | 79 | @ColumnInfo(name = "ESTADO") var estado: Int?, |
51 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 80 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
52 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, | 81 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, |
53 | // productos contados en el inventario | 82 | // productos contados en el inventario |
54 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, | 83 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, |
55 | @ColumnInfo(name = "INV_LUG") var lugar: Int?, | 84 | @ColumnInfo(name = "INV_LUG") var lugar: Boolean?, |
56 | // Solo se ajustan los productos incluidos en el conteo=0 | 85 | // Solo se ajustan los productos incluidos en el conteo=0 |
57 | // Ajusta productos no incluidos en el conteo con stock en cero=1 | 86 | // Ajusta productos no incluidos en el conteo con stock en cero=1 |
58 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, | 87 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, |
59 | // Mostror stock en el sistema al momento de la descarga del maestro. | 88 | // Mostror stock en el sistema al momento de la descarga del maestro. |
60 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) | 89 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) |
61 | 90 | ||
62 | 91 | ||
63 | @Entity(tableName = TABLA_INV_B) | 92 | @Entity(tableName = TABLA_INV_B) |
64 | data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, | 93 | data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, |
65 | @ColumnInfo(name = "SEC") var sector: String?, | 94 | @ColumnInfo(name = "SEC") var sector: String?, |
66 | @ColumnInfo(name = "COD") var codigo: String?, | 95 | @ColumnInfo(name = "COD") var codigo: String?, |
67 | @ColumnInfo(name = "DES") var descripcion: String?, | 96 | @ColumnInfo(name = "DES") var descripcion: String?, |
68 | @ColumnInfo(name = "CANT") var cantTomada: String?, | 97 | @ColumnInfo(name = "CANT") var cantTomada: String?, |
69 | @ColumnInfo(name = "CB") var codBar: String?, | 98 | @ColumnInfo(name = "CB") var codBar: String?, |
70 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 99 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
71 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 100 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
72 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 101 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
73 | @ColumnInfo(name = "BAL") var balanza: Int?, | 102 | @ColumnInfo(name = "BAL") var balanza: Int?, |
74 | @ColumnInfo(name = "DSN") var depSn: Int?, | 103 | @ColumnInfo(name = "DSN") var depSn: Boolean?, |
75 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 104 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
76 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { | 105 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { |
77 | @PrimaryKey(autoGenerate = true) | 106 | @PrimaryKey(autoGenerate = true) |
78 | @ColumnInfo(name = "id") | 107 | @ColumnInfo(name = "id") |
79 | var id: Long = 0 | 108 | var id: Long = 0 |
80 | } | 109 | } |
81 | 110 | ||
82 | @Entity(tableName = TABLA_SERV_INV) | 111 | @Entity(tableName = TABLA_SERV_INV) |
83 | data class ServeInv( | 112 | data class ServeInv( |
84 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, | 113 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, |
85 | @ColumnInfo(name = "SER_DIR") var direccion: String?, | 114 | @ColumnInfo(name = "SER_DIR") var direccion: String?, |
86 | @ColumnInfo(name = "SER_PRE") var predeterminado: Int?): | 115 | @ColumnInfo(name = "SER_PRE") var predeterminado: Int?): |
87 | Serializable { @PrimaryKey(autoGenerate = true) | 116 | Serializable { @PrimaryKey(autoGenerate = true) |
88 | @ColumnInfo(name = "SER_NUM") | 117 | @ColumnInfo(name = "SER_NUM") |
89 | var servNum: Int=0 | 118 | var servNum: Int=0 |
90 | } | 119 | } |
91 | 120 | ||
92 | 121 |
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.R | 12 | import com.focasoftware.deboinventariov20.R |
13 | import com.focasoftware.deboinventariov20.UI.Utils.noServerConf | 13 | import com.focasoftware.deboinventariov20.UI.Utils.noServerConf |
14 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* | 14 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* |
15 | import kotlinx.coroutines.* | 15 | import kotlinx.coroutines.* |
16 | import kotlinx.coroutines.Dispatchers.IO | 16 | import kotlinx.coroutines.Dispatchers.IO |
17 | import kotlinx.coroutines.Dispatchers.Main | 17 | import kotlinx.coroutines.Dispatchers.Main |
18 | import java.util.ArrayList | ||
18 | 19 | ||
19 | var BASE_URL = "" | 20 | var BASE_URL = "" |
20 | 21 | ||
21 | class ActuaMaestrosFragment : Fragment() { | 22 | class ActuaMaestrosFragment : Fragment() { |
22 | 23 | ||
23 | override fun onCreate(savedInstanceState: Bundle?) { | 24 | override fun onCreate(savedInstanceState: Bundle?) { |
24 | super.onCreate(savedInstanceState) | 25 | super.onCreate(savedInstanceState) |
25 | GlobalScope.launch(Main) { | 26 | GlobalScope.launch(Main) { |
26 | val serverPre = fetchServerPreOne() | 27 | val serverPre = fetchServerPreOne() |
27 | if (serverPre.isNullOrEmpty()) { | 28 | if (serverPre.isNullOrEmpty()) { |
28 | val modalDialog = noServerConf() | 29 | val modalDialog = noServerConf() |
29 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 30 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
30 | } else { | 31 | } else { |
31 | BASE_URL = serverPre.toString() | 32 | BASE_URL = serverPre.toString() |
32 | } | 33 | } |
33 | } | 34 | } |
34 | // mostrarArticulos() | 35 | // mostrarArticulos() |
35 | } | 36 | } |
36 | 37 | ||
37 | private suspend fun fetchServerPreOne(): String? { | 38 | private suspend fun fetchServerPreOne(): String? { |
38 | return GlobalScope.async(IO) { | 39 | return GlobalScope.async(IO) { |
39 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() | 40 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() |
40 | }.await() | 41 | }.await() |
41 | } | 42 | } |
42 | 43 | ||
43 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 44 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
44 | // Inflate the layout for this fragment | 45 | // Inflate the layout for this fragment |
45 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) | 46 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) |
46 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) | 47 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) |
47 | bConfirmarAct.setOnClickListener { | 48 | bConfirmarAct.setOnClickListener { |
48 | loading_view.visibility = View.VISIBLE | 49 | loading_view.visibility = View.VISIBLE |
49 | countriesList.text = "Obteniendo artículos del servidor $BASE_URL, aguarde por favor." | 50 | countriesList.text = "Obteniendo artículos del servidor $BASE_URL, aguarde por favor." |
50 | GlobalScope.launch(Main) { | 51 | GlobalScope.launch(Main) { |
51 | obtenerArticulos() | 52 | obtenerArticulos() |
52 | } | 53 | } |
53 | } | 54 | } |
54 | return v | 55 | return v |
55 | } | 56 | } |
56 | 57 | ||
57 | |||
58 | private suspend fun obtenerArticulos() { | 58 | private suspend fun obtenerArticulos() { |
59 | 59 | ||
60 | val productosService = ProductosService.getProductosService() | 60 | val productosService = ProductosService.getProductosService() |
61 | var index: Long = 1 | 61 | var index: Long = 1 |
62 | withContext(IO) { | 62 | withContext(IO) { |
63 | val job = CoroutineScope(Dispatchers.IO).launch { | 63 | val job = CoroutineScope(IO).launch { |
64 | // TODO: BORRO TODO LOS ARTICULOS DE LA BASE PARA CARGARLOS DE NUEVO | 64 | // TODO: BORRO TODO LOS ARTICULOS DE LA BASE PARA CARGARLOS DE NUEVO |
65 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.deleteAllArticulos() | 65 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.deleteAllArticulos() |
66 | 66 | ||
67 | val response = productosService.getProductos() | 67 | val response = productosService.getProductos() |
68 | if (response.isSuccessful) { | 68 | if (response.isSuccessful) { |
69 | |||
69 | for (pro in response.body()!!) { | 70 | for (pro in response.body()!!) { |
70 | val artiAcargar = Articles(pro.sector, | 71 | val artiAcargar = Articles(pro.sector, |
71 | pro.codigo, | 72 | pro.codigo, |
72 | pro.descripcion, | 73 | pro.descripcion, |
73 | pro.codBar, | 74 | pro.codBar, |
74 | pro.codOrigen, | 75 | pro.codOrigen, |
75 | pro.precio, | 76 | pro.precio, |
76 | pro.costo, | 77 | pro.costo, |
77 | pro.exiVenta, | 78 | pro.exiVenta, |
78 | pro.exiDeposito, | 79 | pro.exiDeposito, |
79 | pro.de, | 80 | pro.de, |
80 | pro.balanza, | 81 | pro.balanza, |
81 | pro.depSn, | 82 | pro.depSn, |
82 | pro.imagen) | 83 | pro.imagen) |
83 | index += index | 84 | index += index |
84 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.insertArticulos(artiAcargar) | 85 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.insertArticulos(artiAcargar) |
85 | } | 86 | } |
86 | withContext(Main) { | 87 | withContext(Main) { |
87 | countriesList.visibility = View.VISIBLE | 88 | countriesList.visibility = View.VISIBLE |
88 | countriesList.text = "¡Datos Importados Correctamente!" | 89 | countriesList.text = "¡Datos Importados Correctamente!" |
89 | loading_view.visibility = View.GONE | 90 | loading_view.visibility = View.GONE |
90 | } | 91 | } |
92 | }else{ | ||
93 | withContext(Main) { | ||
94 | countriesList.visibility = View.VISIBLE | ||
95 | countriesList.text = "¡Error!" | ||
96 | loading_view.visibility = View.GONE | ||
97 | } | ||
91 | } | 98 | } |
92 | } | 99 | } |
93 | if (job == null) { | 100 | if (job == null) { |
94 | withContext(Main) { | 101 | withContext(Main) { |
95 | countriesList.visibility = View.VISIBLE | 102 | countriesList.visibility = View.VISIBLE |
96 | countriesList.text = "No se puedo realizar la conexión al Servidor" | 103 | countriesList.text = "No se puedo realizar la conexión al Servidor" |
97 | loading_view.visibility = View.GONE | 104 | loading_view.visibility = View.GONE |
98 | } | 105 | } |
99 | } | 106 | } |
100 | } | 107 | } |
101 | 108 | ||
109 | |||
102 | // withContext(Dispatchers.Main) { | 110 | // withContext(Dispatchers.Main) { |
103 | // if (response.isSuccessful) { | 111 | // if (response.isSuccessful) { |
104 | // val call = WebService | 112 | // val call = WebService |
105 | // .instance | 113 | // .instance |
106 | // ?.createService(WebServiceApi::class.java) | 114 | // ?.createService(WebServiceApi::class.java) |
107 | // ?.articulos | 115 | // ?.articulos |
108 | // call?.enqueue(object : Callback<List<productos?>?> { | 116 | // call?.enqueue(object : Callback<List<productos?>?> { |
109 | // override fun onResponse( | 117 | // override fun onResponse( |
110 | // call: Call<List<productos?>?>, | 118 | // call: Call<List<productos?>?>, |
111 | // response: Response<List<productos?>?> | 119 | // response: Response<List<productos?>?> |
112 | // ) { | 120 | // ) { |
113 | // if (response.code() == 200) { | 121 | // if (response.code() == 200) { |
114 | // for (i in response.body()!!.indices) { | 122 | // for (i in response.body()!!.indices) { |
115 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) | 123 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) |
116 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") | 124 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") |
117 | //// Log.d( | 125 | //// Log.d( |
118 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector | 126 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector |
119 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion | 127 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion |
120 | //// ) | 128 | //// ) |
121 | // mostrarArticulos() | 129 | // mostrarArticulos() |
122 | // } | 130 | // } |
123 | // } else if (response.code() == 404) { | 131 | // } else if (response.code() == 404) { |
124 | // Log.d("TAG1", "No hay cursos") | 132 | // Log.d("TAG1", "No hay cursos") |
125 | // } | 133 | // } |
126 | // | 134 | // |
127 | // } | 135 | // } |
128 | // | 136 | // |
129 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} | 137 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} |
130 | // }) | 138 | // }) |
131 | } | 139 | } |
132 | 140 | ||
133 | fun mostrarArticulos() { | 141 | fun mostrarArticulos() { |
134 | val Job = GlobalScope.launch { | 142 | val Job = GlobalScope.launch { |
135 | var listArticulos: List<Articles>? = null | 143 | var listArticulos: List<Articles>? = null |
136 | var temp: String = "" | 144 | var temp: String = "" |
137 | listArticulos = AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() | 145 | listArticulos = AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() |
138 | if (listArticulos != null) { | 146 | if (listArticulos != null) { |
139 | 147 | ||
140 | for (i in listArticulos.indices) temp += listArticulos[i].codigo.toString() | 148 | for (i in listArticulos.indices) temp += listArticulos[i].codigo.toString() |
141 | } | 149 | } |
142 | withContext(Dispatchers.Main) { | 150 | withContext(Dispatchers.Main) { |
143 | countriesList.visibility = View.VISIBLE | 151 | countriesList.visibility = View.VISIBLE |
144 | loading_view.visibility = View.GONE | 152 | loading_view.visibility = View.GONE |
145 | countriesList?.text = temp | 153 | countriesList?.text = temp |
146 | } | 154 | } |
147 | } | 155 | } |
148 | // for (professor in listArticulos!!) { | 156 | // for (professor in listArticulos!!) { |
149 | // editT.text= professor.id.toString() | 157 | // editT.text= professor.id.toString() |
150 | // } | 158 | // } |
151 | } | 159 | } |
152 | 160 | ||
153 | 161 | ||
154 | // fun observeViewModel() { | 162 | // fun observeViewModel() { |
155 | // | 163 | // |
156 | // val productosService = ProductosService.getProductosService() | 164 | // val productosService = ProductosService.getProductosService() |
157 | // var job: Job? = null | 165 | // var job: Job? = null |
158 | // | 166 | // |
159 | // | 167 | // |
160 | // //countriesList.text="Procesando..." | 168 | // //countriesList.text="Procesando..." |
161 | // //countriesList.visibility = View.VISIBLE | 169 | // //countriesList.visibility = View.VISIBLE |
162 | // // GlobalScope1.launch(Dispatchers.IO) { | 170 | // // GlobalScope1.launch(Dispatchers.IO) { |
163 | // val response = productosService.getProductos() | 171 | // val response = productosService.getProductos() |
164 | // if (response.isSuccessful) { | 172 | // if (response.isSuccessful) { |
165 | //// countriesList.layoutManager = LinearLayoutManager(context) | 173 | //// countriesList.layoutManager = LinearLayoutManager(context) |
166 | //// countriesList.itemAnimator = DefaultItemAnimator() | 174 | //// countriesList.itemAnimator = DefaultItemAnimator() |
167 | // | 175 | // |
168 | //// ProductAdapter.updateCountries(it) | 176 | //// ProductAdapter.updateCountries(it) |
169 | // // cargarArticulos(response.body()) | 177 | // // cargarArticulos(response.body()) |
170 | // | 178 | // |
171 | // | 179 | // |
172 | // val artiAcargar: Articulos? = null | 180 | // val artiAcargar: Articulos? = null |
173 | // var index: Long = 1 | 181 | // var index: Long = 1 |
174 | // | 182 | // |
175 | // for (pro in response.body()!!) { | 183 | // for (pro in response.body()!!) { |
176 | // //artiAcargar.id =index+1 | 184 | // //artiAcargar.id =index+1 |
177 | // artiAcargar!!.sector = pro.sector | 185 | // artiAcargar!!.sector = pro.sector |
178 | // artiAcargar.codigo = pro.codigo | 186 | // artiAcargar.codigo = pro.codigo |
179 | // artiAcargar.descripcion = pro.descripcion | 187 | // artiAcargar.descripcion = pro.descripcion |
180 | // artiAcargar.codBar = pro.codBar | 188 | // artiAcargar.codBar = pro.codBar |
181 | // artiAcargar.precio = pro.precio | 189 | // artiAcargar.precio = pro.precio |
182 | // artiAcargar.costo = pro.costo | 190 | // artiAcargar.costo = pro.costo |
183 | // artiAcargar.balanza = pro.balanza | 191 | // artiAcargar.balanza = pro.balanza |
184 | // artiAcargar.depSn = pro.depSn | 192 | // artiAcargar.depSn = pro.depSn |
185 | // artiAcargar.imagen = pro.imagen | 193 | // artiAcargar.imagen = pro.imagen |
186 | // index += index | 194 | // index += index |
187 | // | 195 | // |
188 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 196 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
189 | // .insertArticulos(artiAcargar) | 197 | // .insertArticulos(artiAcargar) |
190 | // } | 198 | // } |
191 | // } | 199 | // } |
192 | // // } | 200 | // // } |
193 | // | 201 | // |
194 | // //job.cancel() | 202 | // //job.cancel() |
195 | // | 203 | // |
196 | // | 204 | // |
197 | // } | 205 | // } |
198 | 206 | ||
199 | // fun cargarArticulos(Productos: List<Productos>?) { | 207 | // fun cargarArticulos(Productos: List<Productos>?) { |
200 | // val artiAcargar: Articulos? = null | 208 | // val artiAcargar: Articulos? = null |
201 | // var index: Long = 1 | 209 | // var index: Long = 1 |
202 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { | 210 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { |
203 | // for (pro in Productos!!) { | 211 | // for (pro in Productos!!) { |
204 | // //artiAcargar.id =index+1 | 212 | // //artiAcargar.id =index+1 |
205 | // artiAcargar!!.sector = pro.sector | 213 | // artiAcargar!!.sector = pro.sector |
206 | // artiAcargar.codigo = pro.codigo | 214 | // artiAcargar.codigo = pro.codigo |
207 | // artiAcargar.descripcion = pro.descripcion | 215 | // artiAcargar.descripcion = pro.descripcion |
208 | // artiAcargar.codBar = pro.codBar | 216 | // artiAcargar.codBar = pro.codBar |
209 | // artiAcargar.precio = pro.precio | 217 | // artiAcargar.precio = pro.precio |
210 | // artiAcargar.costo = pro.costo | 218 | // artiAcargar.costo = pro.costo |
211 | // artiAcargar.balanza = pro.balanza | 219 | // artiAcargar.balanza = pro.balanza |
212 | // artiAcargar.depSn = pro.depSn | 220 | // artiAcargar.depSn = pro.depSn |
213 | // artiAcargar.imagen = pro.imagen | 221 | // artiAcargar.imagen = pro.imagen |
214 | // index += index | 222 | // index += index |
215 | // | 223 | // |
216 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 224 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
217 | // .insertArticulos(artiAcargar) | 225 | // .insertArticulos(artiAcargar) |
218 | // } | 226 | // } |
219 | // } | 227 | // } |
220 | } | 228 | } |
221 | 229 |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripCorigenFragment/CodigoOriFragment.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.descripCorigenFragment | |
2 | |||
3 | import android.app.AlertDialog | ||
4 | import android.content.Context | ||
5 | import android.content.SharedPreferences | ||
6 | import android.graphics.Canvas | ||
7 | import android.graphics.Color | ||
8 | import android.graphics.drawable.ColorDrawable | ||
9 | import android.os.Bundle | ||
10 | import android.text.InputType | ||
11 | import androidx.fragment.app.Fragment | ||
12 | import android.view.LayoutInflater | ||
13 | import android.view.View | ||
14 | import android.view.ViewGroup | ||
15 | import android.view.WindowManager | ||
16 | import android.view.inputmethod.InputMethodManager | ||
17 | import androidx.fragment.app.FragmentActivity | ||
18 | import androidx.lifecycle.lifecycleScope | ||
19 | import androidx.navigation.NavController | ||
20 | import androidx.navigation.Navigation | ||
21 | import androidx.recyclerview.widget.ItemTouchHelper | ||
22 | import androidx.recyclerview.widget.LinearLayoutManager | ||
23 | import androidx.recyclerview.widget.RecyclerView | ||
24 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
25 | import com.focasoftware.deboinventariov20.Model.Articles | ||
26 | import com.focasoftware.deboinventariov20.Model.InvBody | ||
27 | import com.focasoftware.deboinventariov20.R | ||
28 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | ||
29 | import com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment | ||
30 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | ||
31 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.btnAceptar | ||
32 | import kotlinx.android.synthetic.main.login_dialog.view.* | ||
33 | import kotlinx.coroutines.* | ||
34 | |||
35 | // | ||
36 | class CodigoOriFragment : Fragment() { | ||
37 | |||
38 | private lateinit var artAcargar2: List<Articles> | ||
39 | private var listArticulos: List<Articles>? = null | ||
40 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | ||
41 | private lateinit var viewManager2: RecyclerView.LayoutManager | ||
42 | private lateinit var rcCodigoOri: RecyclerView | ||
43 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | ||
44 | private var cantidad = 0F | ||
45 | private var numeroInventario = 0 | ||
46 | lateinit var navController: NavController | ||
47 | lateinit var sharedPreferences: SharedPreferences | ||
48 | private var artCargadoEnBD: InvBody? = null | ||
49 | |||
50 | override fun onCreate(savedInstanceState: Bundle?) { | ||
51 | super.onCreate(savedInstanceState) | ||
52 | |||
53 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
54 | arguments.apply { | ||
55 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | ||
56 | numeroInventario = requireArguments().getInt("numeroInv") | ||
57 | } | ||
58 | |||
59 | } | ||
60 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
61 | super.onViewCreated(view, savedInstanceState) | ||
62 | navController = Navigation.findNavController(view) | ||
63 | showSoftKeyboard(view) | ||
64 | } | ||
65 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
66 | val v = inflater.inflate(R.layout.fragment_codigo_ori, container, false) | ||
67 | rcCodigoOri = v.findViewById(R.id.rcCodigoOri) | ||
68 | |||
69 | IngresarRecicler(artAcargar2) | ||
70 | showSoftKeyboard(v) | ||
71 | // btnSalir.setOnClickListener { | ||
72 | // activity?.onBackPressed(); | ||
73 | //// VolverAinventario() | ||
74 | // } | ||
75 | return v | ||
76 | } | ||
77 | |||
78 | private fun showSoftKeyboard(view: View) { | ||
79 | if (view.requestFocus()) { | ||
80 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
81 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) | ||
82 | } | ||
83 | } | ||
84 | |||
85 | fun IngresarRecicler(articulos: List<Articles>) { | ||
86 | |||
87 | viewAdapter2 = CodigoOrigenAdapter(requireContext(),articulos) | ||
88 | viewManager2 = LinearLayoutManager(requireContext()) | ||
89 | |||
90 | rcCodigoOri.apply { | ||
91 | adapter = viewAdapter2 | ||
92 | layoutManager = viewManager2 | ||
93 | } | ||
94 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | ||
95 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | ||
96 | return false | ||
97 | } | ||
98 | |||
99 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | ||
100 | |||
101 | GlobalScope.launch(Dispatchers.Main) { | ||
102 | //TODO BUSCO EN BASE DE DATOS | ||
103 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), | ||
104 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), | ||
105 | numeroInventario.toString()) | ||
106 | if (artCargadoEnBD == null) { | ||
107 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | ||
108 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | ||
109 | //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( | ||
111 | viewHolder.layoutPosition)!!.balanza==7) | ||
112 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER | ||
113 | |||
114 | mDialogView.tvTitulo.text = "${(viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" | ||
115 | val mAlertDialog = mBuilder.show() | ||
116 | mDialogView.etCantidad.requestFocus() | ||
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) | ||
119 | mDialogView.btnAceptar.setOnClickListener { | ||
120 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
121 | mDialogView.etCantidad.error = "No vacio" | ||
122 | mDialogView.etCantidad.requestFocus() | ||
123 | mDialogView.etCantidad.hint = "Ingrese un valor" | ||
124 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
125 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | ||
126 | val body = InvBody(numeroInventario, | ||
127 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, | ||
128 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | ||
129 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, | ||
130 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, | ||
131 | cantidad.toString(), | ||
132 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, | ||
133 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, | ||
134 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | ||
135 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | ||
136 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, | ||
137 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, | ||
138 | InventarioFragment().ObtenerFechaActual(), | ||
139 | InventarioFragment().ObtenerFechaActual()) | ||
140 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | ||
141 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) | ||
142 | // VolverAinventario() | ||
143 | activity?.onBackPressed() | ||
144 | mAlertDialog.dismiss() | ||
145 | } | ||
146 | } | ||
147 | } else if (artCargadoEnBD != null) { | ||
148 | |||
149 | val mDialogView = 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) | ||
151 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER | ||
152 | mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | ||
153 | |||
154 | val mAlertDialog = mBuilder.show() | ||
155 | mDialogView.tvNuevaCantidad.requestFocus() | ||
156 | |||
157 | |||
158 | 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) | ||
160 | |||
161 | mDialogView.rbSumar.setOnClickListener { | ||
162 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
163 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat())) | ||
164 | mDialogView.tvNuevaCantidad.isEnabled=false | ||
165 | } | ||
166 | } | ||
167 | mDialogView.rbRestar.setOnClickListener { | ||
168 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
169 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
170 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | ||
171 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
172 | }else{ | ||
173 | mDialogView.tvResultado.text="" | ||
174 | mDialogView.tvResultado.error = "Operación No Valida" | ||
175 | mDialogView.tvResultado.requestFocus() | ||
176 | mDialogView.tvResultado.hint = "Error" | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | mDialogView.rbMdodificar.setOnClickListener { | ||
181 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
182 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat())) | ||
183 | mDialogView.tvNuevaCantidad.isEnabled = false | ||
184 | } | ||
185 | } | ||
186 | mDialogView.btnAceptar.setOnClickListener { | ||
187 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
188 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | ||
189 | |||
190 | updateCantidad((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), | ||
191 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), | ||
192 | mDialogView.tvResultado.text.toString().toFloat()) | ||
193 | // VolverAinventario() | ||
194 | activity?.onBackPressed(); | ||
195 | mAlertDialog.dismiss() | ||
196 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | ||
197 | mDialogView.tvResultado.error = "Operación Requerida" | ||
198 | mDialogView.tvResultado.requestFocus() | ||
199 | mDialogView.tvResultado.hint = "Seleccione Operación" | ||
200 | } | ||
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 | } | ||
207 | mDialogView.dialogCancelBtn.setOnClickListener { | ||
208 | activity?.onBackPressed(); | ||
209 | mAlertDialog.dismiss() | ||
210 | } | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | |||
215 | 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) | ||
217 | val itemView = viewHolder.itemView | ||
218 | |||
219 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | ||
220 | |||
221 | if (dX > 0) { | ||
222 | |||
223 | c.drawColor(Color.RED) | ||
224 | } else if (dX < 0) { | ||
225 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | ||
226 | c.drawColor(Color.YELLOW) | ||
227 | } | ||
228 | swipeBackground.draw(c) | ||
229 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
230 | } | ||
231 | } | ||
232 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | ||
233 | itemTouchHelper2.attachToRecyclerView(rcCodigoOri) | ||
234 | |||
235 | } | ||
236 | |||
237 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | ||
238 | lifecycleScope.launch { | ||
239 | withContext(Dispatchers.IO) { | ||
240 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | ||
241 | } | ||
242 | } | ||
243 | } | ||
244 | |||
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? { | ||
255 | //TODO BUSQUEDA POR CODIGO DE BARRAS | ||
256 | var busqueda: InvBody? = null | ||
257 | return GlobalScope.async(Dispatchers.IO) { | ||
258 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario) | ||
259 | return@async busqueda | ||
260 | }.await() | ||
261 | } | ||
262 | |||
263 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | ||
264 | lifecycleScope.launch { | ||
265 | withContext(Dispatchers.IO) { | ||
266 | val activity: FragmentActivity? = activity | ||
267 | if (activity != null && isAdded) { | ||
268 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | |||
274 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripCorigenFragment/CodigoOrigenAdapter.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.descripCorigenFragment | |
2 | |||
3 | import android.content.Context | ||
4 | import android.view.LayoutInflater | ||
5 | import android.view.View | ||
6 | import android.view.ViewGroup | ||
7 | import androidx.recyclerview.widget.RecyclerView | ||
8 | import com.focasoftware.deboinventariov20.Model.Articles | ||
9 | import com.focasoftware.deboinventariov20.Model.InvHead | ||
10 | import com.focasoftware.deboinventariov20.R | ||
11 | import com.focasoftware.deboinventariov20.UI.Utils.BaseViewHolder | ||
12 | import com.focasoftware.deboinventariov20.UI.descripcionFragment.DescripcionListAdapter | ||
13 | import kotlinx.android.synthetic.main.item.view.* | ||
14 | import kotlinx.android.synthetic.main.item.view.tvCodigo | ||
15 | import kotlinx.android.synthetic.main.item.view.tvCodigoOrigen | ||
16 | import kotlinx.android.synthetic.main.item.view.tvDescripcion | ||
17 | import kotlinx.android.synthetic.main.item.view.tvSector | ||
18 | import kotlinx.android.synthetic.main.item_codigo_origen.view.* | ||
19 | |||
20 | class CodigoOrigenAdapter(private val cnxt: Context, private val corigen: List<Articles>) : | ||
21 | RecyclerView.Adapter<CodigoOrigenAdapter.ItemsViewHolder>() { | ||
22 | internal var items2: List<Articles>? = null | ||
23 | |||
24 | init { | ||
25 | this.items2 = corigen | ||
26 | } | ||
27 | |||
28 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder( | ||
29 | LayoutInflater.from(cnxt).inflate(R.layout.item_codigo_origen, parent, false)) | ||
30 | |||
31 | override fun getItemCount() = corigen.size | ||
32 | |||
33 | override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { | ||
34 | when (holder) { | ||
35 | is ItemsViewHolder -> { | ||
36 | holder.bind(items2!![position]) | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | |||
41 | class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view) { | ||
42 | |||
43 | val sector = view.tvSector | ||
44 | val codigo = view.tvCodigo | ||
45 | val descripcion = view.tvDescripcion | ||
46 | val CodigoOrigen = view.tvCodigoOrigen | ||
47 | |||
48 | fun bind(pro: Articles) { | ||
49 | sector.text = pro.sector | ||
50 | codigo.text = pro.codigo | ||
51 | descripcion.text = pro.descripcion | ||
52 | CodigoOrigen.text = pro.codOrigen | ||
53 | } | ||
54 | } | ||
55 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripCorigenFragment/ItemCodigoOrigen.kt
File was created | 1 | package com.focasoftware.deboinventariov20.UI.descripCorigenFragment | |
2 | |||
3 | data class ItemCodigoOrigen(val sector: String?,val codigo: String?, val descripcion: String?, val codigoOrigen: String?) |
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.Activity | ||
4 | import android.app.AlertDialog | 3 | import android.app.AlertDialog |
5 | import android.content.Context | 4 | import android.content.Context |
6 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
7 | import android.graphics.Canvas | 6 | import android.graphics.Canvas |
8 | import android.graphics.Color | 7 | import android.graphics.Color |
9 | import android.graphics.drawable.ColorDrawable | 8 | import android.graphics.drawable.ColorDrawable |
10 | import android.os.Bundle | 9 | import android.os.Bundle |
11 | import android.text.InputType | 10 | import android.text.InputType |
12 | import android.view.LayoutInflater | 11 | import android.view.LayoutInflater |
13 | import android.view.View | 12 | import android.view.View |
14 | import android.view.ViewGroup | 13 | import android.view.ViewGroup |
15 | import android.view.WindowManager | 14 | import android.view.WindowManager |
16 | import android.view.inputmethod.InputMethodManager | 15 | import android.view.inputmethod.InputMethodManager |
17 | import androidx.core.content.ContextCompat.getSystemService | ||
18 | import androidx.fragment.app.Fragment | 16 | import androidx.fragment.app.Fragment |
19 | import androidx.fragment.app.FragmentActivity | 17 | import androidx.fragment.app.FragmentActivity |
20 | import androidx.lifecycle.lifecycleScope | 18 | import androidx.lifecycle.lifecycleScope |
21 | import androidx.navigation.NavController | 19 | import androidx.navigation.NavController |
22 | import androidx.navigation.Navigation | 20 | import androidx.navigation.Navigation |
23 | import androidx.recyclerview.widget.ItemTouchHelper | 21 | import androidx.recyclerview.widget.ItemTouchHelper |
24 | import androidx.recyclerview.widget.LinearLayoutManager | 22 | import androidx.recyclerview.widget.LinearLayoutManager |
25 | import androidx.recyclerview.widget.RecyclerView | 23 | import androidx.recyclerview.widget.RecyclerView |
26 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 24 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
27 | import com.focasoftware.deboinventariov20.Model.Articles | 25 | import com.focasoftware.deboinventariov20.Model.Articles |
28 | import com.focasoftware.deboinventariov20.Model.InvBody | 26 | import com.focasoftware.deboinventariov20.Model.InvBody |
29 | import com.focasoftware.deboinventariov20.R | 27 | import com.focasoftware.deboinventariov20.R |
30 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | 28 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
31 | import com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment | 29 | import com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment |
32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 30 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
33 | import kotlinx.android.synthetic.main.login_dialog.view.* | 31 | import kotlinx.android.synthetic.main.login_dialog.view.* |
34 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | 32 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar |
35 | import kotlinx.coroutines.* | 33 | import kotlinx.coroutines.* |
36 | 34 | ||
37 | 35 | ||
38 | class DescripcionFragment : Fragment() { | 36 | class DescripcionFragment : Fragment() { |
39 | private var artAcargar2: List<Articles>? = null | 37 | private var artAcargar2: List<Articles>? = null |
40 | private var listArticulos2: List<Articles>? = null | 38 | private var listArticulos2: List<Articles>? = null |
41 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | 39 | lateinit var viewAdapter2: RecyclerView.Adapter<*> |
42 | private lateinit var viewManager2: RecyclerView.LayoutManager | 40 | private lateinit var viewManager2: RecyclerView.LayoutManager |
43 | private lateinit var rcDescripcion: RecyclerView | 41 | private lateinit var rcDescripcion: RecyclerView |
44 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | 42 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) |
45 | private var cantidad = 0F | 43 | private var cantidad = 0F |
46 | private var numeroInventario = 0 | 44 | private var numeroInventario = 0 |
47 | lateinit var navController: NavController | 45 | lateinit var navController: NavController |
48 | lateinit var sharedPreferences: SharedPreferences | 46 | lateinit var sharedPreferences: SharedPreferences |
49 | private var indice = 0 | ||
50 | private var artCargadoEnBD: InvBody? = null | 47 | private var artCargadoEnBD: InvBody? = null |
51 | 48 | ||
52 | override fun onCreate(savedInstanceState: Bundle?) { | 49 | override fun onCreate(savedInstanceState: Bundle?) { |
53 | super.onCreate(savedInstanceState) | 50 | super.onCreate(savedInstanceState) |
54 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 51 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
55 | arguments.apply { | 52 | arguments.apply { |
56 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | 53 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> |
57 | numeroInventario = requireArguments().getInt("numeroInv") | 54 | numeroInventario = requireArguments().getInt("numeroInv") |
58 | } | 55 | } |
59 | 56 | ||
60 | } | 57 | } |
61 | private fun showSoftKeyboard(view: View) { | ||
62 | if (view.requestFocus()) { | ||
63 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
64 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) | ||
65 | } | ||
66 | } | ||
67 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 58 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
68 | super.onViewCreated(view, savedInstanceState) | 59 | super.onViewCreated(view, savedInstanceState) |
69 | navController = Navigation.findNavController(view) | 60 | navController = Navigation.findNavController(view) |
70 | showSoftKeyboard(view) | 61 | showSoftKeyboard(view) |
71 | } | 62 | } |
72 | |||
73 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 63 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
74 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) | 64 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) |
75 | rcDescripcion = v.findViewById(R.id.rcDescripcion) | 65 | rcDescripcion = v.findViewById(R.id.rcDescripcion) |
76 | // val btnSalir = v.findViewById<Button>(R.id.btnSalir) | 66 | // val btnSalir = v.findViewById<Button>(R.id.btnSalir) |
77 | 67 | ||
78 | 68 | ||
79 | IngresarRecicler(artAcargar2) | 69 | IngresarRecicler(artAcargar2) |
80 | showSoftKeyboard(v) | 70 | showSoftKeyboard(v) |
81 | // btnSalir.setOnClickListener { | 71 | // btnSalir.setOnClickListener { |
82 | // activity?.onBackPressed(); | 72 | // activity?.onBackPressed(); |
83 | //// VolverAinventario() | 73 | //// VolverAinventario() |
84 | // } | 74 | // } |
85 | return v | 75 | return v |
86 | } | 76 | } |
87 | 77 | ||
78 | private fun showSoftKeyboard(view: View) { | ||
79 | if (view.requestFocus()) { | ||
80 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
81 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) | ||
82 | } | ||
83 | } | ||
84 | |||
88 | fun IngresarRecicler(articulos: List<Articles>?) { | 85 | fun IngresarRecicler(articulos: List<Articles>?) { |
89 | 86 | ||
90 | viewAdapter2 = DescripcionListAdapter(articulos) | 87 | viewAdapter2 = DescripcionListAdapter(articulos) |
91 | viewManager2 = LinearLayoutManager(requireContext()) | 88 | viewManager2 = LinearLayoutManager(requireContext()) |
92 | 89 | ||
93 | rcDescripcion.apply { | 90 | rcDescripcion.apply { |
94 | adapter = viewAdapter2 | 91 | adapter = viewAdapter2 |
95 | layoutManager = viewManager2 | 92 | layoutManager = viewManager2 |
96 | } | 93 | } |
97 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | 94 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { |
98 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 95 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
99 | return false | 96 | return false |
100 | } | 97 | } |
101 | 98 | ||
102 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 99 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
103 | 100 | ||
104 | var indice = 0 | ||
105 | indice = viewHolder.layoutPosition | ||
106 | GlobalScope.launch(Dispatchers.Main) { | 101 | GlobalScope.launch(Dispatchers.Main) { |
107 | //TODO BUSCO EN BASE DE DATOS | 102 | //TODO BUSCO EN BASE DE DATOS |
108 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.sector.toString(), | 103 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), |
109 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.codigo.toString(), | 104 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), numeroInventario.toString()) |
110 | numeroInventario.toString()) | ||
111 | if (artCargadoEnBD == null) { | 105 | if (artCargadoEnBD == null) { |
112 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | 106 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) |
113 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | 107 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) |
114 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO | 108 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO |
115 | if ((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza==1 || (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza==3 || (viewAdapter2 as DescripcionListAdapter).items2?.get( | 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( |
116 | indice)!!.balanza==7) | 110 | viewHolder.layoutPosition)!!.balanza==7) |
117 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER | 111 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER |
118 | 112 | ||
119 | 113 | ||
120 | mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}" | 114 | mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" |
121 | val mAlertDialog = mBuilder.show() | 115 | val mAlertDialog = mBuilder.show() |
122 | mDialogView.etCantidad.requestFocus() | 116 | mDialogView.etCantidad.requestFocus() |
123 | 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) |
124 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 118 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
125 | mDialogView.btnAceptar.setOnClickListener { | 119 | mDialogView.btnAceptar.setOnClickListener { |
126 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | 120 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
127 | mDialogView.etCantidad.error = "No vacio" | 121 | mDialogView.etCantidad.error = "No vacio" |
128 | mDialogView.etCantidad.requestFocus() | 122 | mDialogView.etCantidad.requestFocus() |
129 | mDialogView.etCantidad.hint = "Ingrese un valor" | 123 | mDialogView.etCantidad.hint = "Ingrese un valor" |
130 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | 124 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { |
131 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | 125 | cantidad =String.format("%.2f", mDialogView.etCantidad.text.toString().toFloat()).toFloat() |
132 | val body = InvBody(numeroInventario, | 126 | val body = InvBody(numeroInventario, |
133 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | 127 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, |
134 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | 128 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD |
135 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | 129 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, |
136 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | 130 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, |
137 | cantidad.toString(), | 131 | cantidad.toString(), |
138 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | 132 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, |
139 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | 133 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, |
140 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | 134 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
141 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | 135 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
142 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | 136 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, |
143 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | 137 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, |
144 | InventarioFragment().ObtenerFechaActual(), | 138 | InventarioFragment().ObtenerFechaActual(), |
145 | InventarioFragment().ObtenerFechaActual()) | 139 | InventarioFragment().ObtenerFechaActual()) |
146 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | 140 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
147 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) | 141 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) |
148 | // VolverAinventario() | 142 | // VolverAinventario() |
149 | activity?.onBackPressed() | 143 | activity?.onBackPressed() |
150 | mAlertDialog.dismiss() | 144 | mAlertDialog.dismiss() |
151 | } | 145 | } |
152 | } | 146 | } |
153 | } else if (artCargadoEnBD != null) { | 147 | } else if (artCargadoEnBD != null) { |
154 | 148 | ||
155 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 149 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
156 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) | 150 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) |
157 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER | 151 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER |
158 | mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | 152 | mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) |
159 | 153 | ||
160 | val mAlertDialog = mBuilder.show() | 154 | val mAlertDialog = mBuilder.show() |
161 | mDialogView.tvNuevaCantidad.requestFocus() | 155 | mDialogView.tvNuevaCantidad.requestFocus() |
162 | 156 | ||
163 | 157 | ||
164 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 158 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
165 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 159 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
166 | 160 | ||
167 | mDialogView.rbSumar.setOnClickListener { | 161 | mDialogView.rbSumar.setOnClickListener { |
168 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 162 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
169 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat())) | 163 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat())) |
170 | mDialogView.tvNuevaCantidad.isEnabled=false | 164 | mDialogView.tvNuevaCantidad.isEnabled=false |
171 | } | 165 | } |
172 | } | 166 | } |
173 | mDialogView.rbRestar.setOnClickListener { | 167 | mDialogView.rbRestar.setOnClickListener { |
174 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 168 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
175 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 169 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
176 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 170 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
177 | mDialogView.tvNuevaCantidad.isEnabled = false | 171 | mDialogView.tvNuevaCantidad.isEnabled = false |
178 | }else{ | 172 | }else{ |
179 | mDialogView.tvResultado.text="" | 173 | mDialogView.tvResultado.text="" |
180 | mDialogView.tvResultado.error = "Operación No Valida" | 174 | mDialogView.tvResultado.error = "Operación No Valida" |
181 | mDialogView.tvResultado.requestFocus() | 175 | mDialogView.tvResultado.requestFocus() |
182 | mDialogView.tvResultado.hint = "Error" | 176 | mDialogView.tvResultado.hint = "Error" |
183 | } | 177 | } |
184 | } | 178 | } |
185 | } | 179 | } |
186 | mDialogView.rbMdodificar.setOnClickListener { | 180 | mDialogView.rbMdodificar.setOnClickListener { |
187 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 181 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
188 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat())) | 182 | mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat())) |
189 | mDialogView.tvNuevaCantidad.isEnabled = false | 183 | mDialogView.tvNuevaCantidad.isEnabled = false |
190 | } | 184 | } |
191 | } | 185 | } |
192 | mDialogView.btnAceptar.setOnClickListener { | 186 | mDialogView.btnAceptar.setOnClickListener { |
193 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | 187 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { |
194 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | 188 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { |
195 | 189 | ||
196 | updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(), | 190 | updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), |
197 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo.toString(), | 191 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), |
198 | mDialogView.tvResultado.text.toString().toFloat()) | 192 | mDialogView.tvResultado.text.toString().toFloat()) |
199 | // VolverAinventario() | 193 | // VolverAinventario() |
200 | activity?.onBackPressed(); | 194 | activity?.onBackPressed(); |
201 | mAlertDialog.dismiss() | 195 | mAlertDialog.dismiss() |
202 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 196 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { |
203 | mDialogView.tvResultado.error = "Operación Requerida" | 197 | mDialogView.tvResultado.error = "Operación Requerida" |
204 | mDialogView.tvResultado.requestFocus() | 198 | mDialogView.tvResultado.requestFocus() |
205 | mDialogView.tvResultado.hint = "Seleccione Operación" | 199 | mDialogView.tvResultado.hint = "Seleccione Operación" |
206 | } | 200 | } |
207 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 201 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { |
208 | mDialogView.tvNuevaCantidad.error = "Completar" | 202 | mDialogView.tvNuevaCantidad.error = "Completar" |
209 | mDialogView.tvNuevaCantidad.requestFocus() | 203 | mDialogView.tvNuevaCantidad.requestFocus() |
210 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | 204 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" |
211 | } | 205 | } |
212 | } | 206 | } |
213 | mDialogView.dialogCancelBtn.setOnClickListener { | 207 | mDialogView.dialogCancelBtn.setOnClickListener { |
214 | activity?.onBackPressed(); | 208 | activity?.onBackPressed(); |
215 | mAlertDialog.dismiss() | 209 | mAlertDialog.dismiss() |
216 | } | 210 | } |
217 | } | 211 | } |
218 | } | 212 | } |
219 | } | 213 | } |
220 | 214 | ||
221 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 215 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
222 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 216 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
223 | val itemView = viewHolder.itemView | 217 | val itemView = viewHolder.itemView |
224 | 218 | ||
225 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 219 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
226 | 220 | ||
227 | if (dX > 0) { | 221 | if (dX > 0) { |
228 | 222 | ||
229 | c.drawColor(Color.RED) | 223 | c.drawColor(Color.RED) |
230 | } else if (dX < 0) { | 224 | } else if (dX < 0) { |
231 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | 225 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) |
232 | c.drawColor(Color.YELLOW) | 226 | c.drawColor(Color.YELLOW) |
233 | } | 227 | } |
234 | swipeBackground.draw(c) | 228 | swipeBackground.draw(c) |
235 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 229 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
236 | } | 230 | } |
237 | } | 231 | } |
238 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | 232 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) |
239 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) | 233 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) |
240 | 234 | ||
241 | } | 235 | } |
242 | 236 | ||
243 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 237 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
244 | lifecycleScope.launch { | 238 | lifecycleScope.launch { |
245 | withContext(Dispatchers.IO) { | 239 | withContext(Dispatchers.IO) { |
246 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 240 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
247 | } | 241 | } |
248 | } | 242 | } |
249 | } | 243 | } |
250 | 244 | ||
251 | // fun VolverAinventario() { | 245 | // fun VolverAinventario() { |
252 | // | 246 | // |
253 | // val editor = sharedPreferences.edit() | 247 | // val editor = sharedPreferences.edit() |
254 | // editor?.putString("Inventario", numeroInventario.toString()) | 248 | // editor?.putString("Inventario", numeroInventario.toString()) |
255 | // editor?.apply() | 249 | // editor?.apply() |
256 | // editor.commit() | 250 | // editor.commit() |
257 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | 251 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) |
258 | // } | 252 | // } |
259 | 253 | ||
260 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { | 254 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { |
261 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 255 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
262 | var busqueda: InvBody? = null | 256 | var busqueda: InvBody? = null |
263 | return GlobalScope.async(Dispatchers.IO) { | 257 | return GlobalScope.async(Dispatchers.IO) { |
264 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario) | 258 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario) |
265 | return@async busqueda | 259 | return@async busqueda |
266 | }.await() | 260 | }.await() |
267 | } | 261 | } |
268 | 262 | ||
269 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 263 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
270 | lifecycleScope.launch { | 264 | lifecycleScope.launch { |
271 | withContext(Dispatchers.IO) { | 265 | withContext(Dispatchers.IO) { |
272 | val activity: FragmentActivity? = activity | 266 | val activity: FragmentActivity? = activity |
273 | if (activity != null && isAdded) { | 267 | if (activity != null && isAdded) { |
274 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | 268 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) |
275 | } | 269 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripcionFragment/DescripcionListAdapter.kt
1 | package com.focasoftware.deboinventariov20.UI.descripcionFragment | 1 | package com.focasoftware.deboinventariov20.UI.descripcionFragment |
2 | 2 | ||
3 | import android.view.LayoutInflater | 3 | import android.view.LayoutInflater |
4 | import android.view.View | 4 | import android.view.View |
5 | import android.view.ViewGroup | 5 | import android.view.ViewGroup |
6 | import androidx.recyclerview.widget.RecyclerView | 6 | import androidx.recyclerview.widget.RecyclerView |
7 | import com.focasoftware.deboinventariov20.Model.Articles | 7 | import com.focasoftware.deboinventariov20.Model.Articles |
8 | import com.focasoftware.deboinventariov20.R | 8 | import com.focasoftware.deboinventariov20.R |
9 | import kotlinx.android.synthetic.main.item.view.* | 9 | import kotlinx.android.synthetic.main.item.view.* |
10 | 10 | ||
11 | class DescripcionListAdapter(private val productos: List<Articles>?) : | 11 | class DescripcionListAdapter(private val productos: List<Articles>?) : |
12 | RecyclerView.Adapter<DescripcionListAdapter.ItemsViewHolder>() { | 12 | RecyclerView.Adapter<DescripcionListAdapter.ItemsViewHolder>() { |
13 | internal var items2: List<Articles>? = null | 13 | internal var items2: List<Articles>? = null |
14 | 14 | ||
15 | init { | 15 | init { |
16 | this.items2 = productos | 16 | this.items2 = productos |
17 | } | 17 | } |
18 | 18 | ||
19 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder( | 19 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder( |
20 | LayoutInflater.from(parent.context).inflate(R.layout.item_descripcion, parent, false) | 20 | LayoutInflater.from(parent.context).inflate(R.layout.item_descripcion, parent, false)) |
21 | ) | ||
22 | 21 | ||
23 | override fun getItemCount() = productos!!.size | 22 | override fun getItemCount() = productos!!.size |
24 | 23 | ||
25 | override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { | 24 | override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { |
26 | when (holder) { | 25 | when (holder) { |
27 | is ItemsViewHolder -> { | 26 | is ItemsViewHolder -> { |
28 | holder.bind(items2!![position]) | 27 | holder.bind(items2!![position]) |
29 | } | 28 | } |
30 | } | 29 | } |
31 | } | 30 | } |
32 | 31 | ||
33 | |||
34 | class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view) { | 32 | class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view) { |
35 | 33 | ||
36 | val sector = view.tvSector | 34 | val sector = view.tvSector |
37 | val codigo = view.tvCodigo | 35 | val codigo = view.tvCodigo |
38 | val descripcion = view.tvDescripcion | 36 | val descripcion = view.tvDescripcion |
39 | val codigoBarras = view.tvCodigoBarras | 37 | val codigoBarras = view.tvCodigoBarras |
40 | 38 | ||
41 | fun bind(pro: Articles) { | 39 | fun bind(pro: Articles) { |
42 | sector.text = pro.sector | 40 | sector.text = pro.sector |
43 | codigo.text = pro.codigo | 41 | codigo.text = pro.codigo |
44 | descripcion.text = pro.descripcion | 42 | descripcion.text = pro.descripcion |
45 | codigoBarras.text = pro.codBar | 43 | codigoBarras.text = pro.codBar |
46 | } | 44 | } |
47 | } | 45 | } |
48 | } | 46 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/detalleProducto/DetalleArtFragment.kt
1 | package com.focasoftware.deboinventariov20.UI.detalleProducto | 1 | package com.focasoftware.deboinventariov20.UI.detalleProducto |
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.view.inputmethod.InputMethodManager | ||
9 | import androidx.fragment.app.Fragment | 10 | import androidx.fragment.app.Fragment |
10 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 11 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
11 | import com.focasoftware.deboinventariov20.Model.Articles | 12 | import com.focasoftware.deboinventariov20.Model.Articles |
12 | import com.focasoftware.deboinventariov20.R | 13 | import com.focasoftware.deboinventariov20.R |
13 | import kotlinx.android.synthetic.main.fragment_detalle_art.* | 14 | import kotlinx.android.synthetic.main.fragment_detalle_art.* |
14 | import kotlinx.coroutines.Dispatchers | 15 | import kotlinx.coroutines.Dispatchers |
15 | import kotlinx.coroutines.GlobalScope | 16 | import kotlinx.coroutines.GlobalScope |
16 | import kotlinx.coroutines.async | 17 | import kotlinx.coroutines.async |
17 | import kotlinx.coroutines.launch | 18 | import kotlinx.coroutines.launch |
18 | 19 | ||
19 | class DetalleArtFragment : Fragment() { | 20 | class DetalleArtFragment : Fragment() { |
20 | 21 | ||
21 | private var Inventario: Int = 0 | 22 | private var Inventario: Int = 0 |
22 | private var sector: String? = null | 23 | private var sector: String? = null |
23 | private var codigo: String? = null | 24 | private var codigo: String? = null |
24 | private var artSerch: Articles? = null | 25 | private var artSerch: Articles? = null |
25 | lateinit var sharedPreferences: SharedPreferences | 26 | lateinit var sharedPreferences: SharedPreferences |
26 | 27 | ||
27 | override fun onCreate(savedInstanceState: Bundle?) { | 28 | override fun onCreate(savedInstanceState: Bundle?) { |
28 | super.onCreate(savedInstanceState) | 29 | super.onCreate(savedInstanceState) |
29 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 30 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
30 | arguments?.let { | 31 | arguments?.let { |
31 | sector = it.getString("sector") | 32 | sector = it.getString("sector") |
32 | codigo = it.getString("codigo") | 33 | codigo = it.getString("codigo") |
33 | Inventario= it.getInt("numeroInv") | 34 | Inventario= it.getInt("numeroInv") |
34 | } | 35 | } |
36 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager? | ||
37 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | ||
38 | |||
35 | marcarInventario() | 39 | marcarInventario() |
36 | GlobalScope.launch(Dispatchers.Main) { | 40 | GlobalScope.launch(Dispatchers.Main) { |
37 | |||
38 | artSerch = buscarCodigoDeboEnBD(sector, codigo) | 41 | artSerch = buscarCodigoDeboEnBD(sector, codigo) |
39 | if (artSerch == null) { | 42 | if (artSerch == null) { |
40 | 43 | ||
41 | // val type = InputType.TYPE_CLASS_NUMBER | 44 | // val type = InputType.TYPE_CLASS_NUMBER |
42 | // MaterialDialog(requireContext()).show { | 45 | // MaterialDialog(requireContext()).show { |
43 | // | 46 | // |
44 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | 47 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
45 | // message(R.string.sCantidadNueva) | 48 | // message(R.string.sCantidadNueva) |
46 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 49 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
47 | // fCant = 0F | 50 | // fCant = 0F |
48 | // fCant = charSequence.toString().toFloat() | 51 | // fCant = charSequence.toString().toFloat() |
49 | // } | 52 | // } |
50 | // positiveButton(R.string.btnOk) { | 53 | // positiveButton(R.string.btnOk) { |
51 | // //TODO ACTUALIZO CANTIADAD EN BD | 54 | // //TODO ACTUALIZO CANTIADAD EN BD |
52 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 55 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
53 | // //TODO ACTUALIZO CANTIDAD EN RV | 56 | // //TODO ACTUALIZO CANTIDAD EN RV |
54 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 57 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
55 | // viewAdapter.notifyDataSetChanged() | 58 | // viewAdapter.notifyDataSetChanged() |
56 | // dismiss() | 59 | // dismiss() |
57 | // } | 60 | // } |
58 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 61 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
59 | } else if (artSerch != null) { | 62 | } else if (artSerch != null) { |
60 | tvSector.text=sector | 63 | tvSector.text=sector |
61 | tvCodigo.text=codigo | 64 | tvCodigo.text=codigo |
62 | tvDeposito.text=if(artSerch!!.depSn!!.toInt() ==0)"No" else "Si" | 65 | tvDeposito.text=if(!artSerch!!.depSn!!)"No" else "Si" |
63 | tvDescripcion.text=artSerch!!.descripcion.toString() | 66 | tvDescripcion.text=artSerch!!.descripcion.toString() |
64 | tvCodigoBarras.text=artSerch!!.codBar.toString() | 67 | tvCodigoBarras.text=if (artSerch!!.codBar.toString()=="null")"" else artSerch!!.codBar.toString() |
65 | tvCodigoOrigen.text=artSerch!!.codOrigen.toString() | 68 | tvCodigoOrigen.text=if (artSerch!!.codOrigen.toString()=="null")"" else artSerch!!.codOrigen.toString() |
66 | tvExiVenta.text=artSerch!!.exiVenta.toString() | 69 | tvExiVenta.text=artSerch!!.exiVenta.toString() |
67 | tvExiDeposito.text=artSerch!!.exiDeposito.toString() | 70 | tvExiDeposito.text=artSerch!!.exiDeposito.toString() |
68 | tvBal.text=artSerch!!.balanza.toString() | 71 | |
69 | tvDE.text=artSerch!!.de.toString() | 72 | when ( artSerch!!.balanza.toString().toInt()) { |
73 | 1 ->tvBal.text="Unidades" | ||
74 | 2 ->tvBal.text="Litros" | ||
75 | 3 ->tvBal.text="Cajas" | ||
76 | 4 ->tvBal.text="M3" | ||
77 | 5 ->tvBal.text="Metros" | ||
78 | 6 ->tvBal.text="Fracción" | ||
79 | 7 ->tvBal.text="Bultos" | ||
80 | 8 ->tvBal.text="Gramos" | ||
81 | 9 ->tvBal.text="Cent. cúbicos" | ||
82 | 10 ->tvBal.text="Kgs" | ||
83 | else -> { tvBal.text="Otros" | ||
84 | } | ||
85 | } | ||
86 | tvCosto.text=String.format("%.2f", artSerch!!.costo.toString().toFloat()) | ||
87 | tvPrecio.text=String.format("%.2f", artSerch!!.precio.toString().toFloat()) | ||
70 | } | 88 | } |
71 | } | 89 | } |
72 | } | 90 | } |
73 | 91 | ||
74 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 92 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
75 | 93 | ||
76 | return inflater.inflate(R.layout.fragment_detalle_art, container, false) | 94 | return inflater.inflate(R.layout.fragment_detalle_art, container, false) |
77 | } | 95 | } |
78 | 96 | ||
79 | suspend fun buscarCodigoDeboEnBD(sector: String?, codigo: String?): Articles? { | 97 | suspend fun buscarCodigoDeboEnBD(sector: String?, codigo: String?): Articles? { |
80 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 98 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
81 | var busqueda: Articles? = null | 99 | var busqueda: Articles? |
82 | return GlobalScope.async(Dispatchers.IO) { | 100 | return GlobalScope.async(Dispatchers.IO) { |
83 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.fetchArticuloByCodSec(sector, codigo) | 101 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.fetchArticuloByCodSec(sector, codigo) |
84 | return@async busqueda | 102 | return@async busqueda |
85 | }.await() | 103 | }.await() |
86 | } | 104 | } |
87 | fun marcarInventario() { | 105 | fun marcarInventario() { |
88 | 106 | ||
89 | val editor = sharedPreferences.edit() | 107 | val editor = sharedPreferences.edit() |
90 | editor?.putString("Inventario", Inventario.toString()) | 108 | editor?.putString("Inventario", Inventario.toString()) |
91 | editor?.apply() | 109 | editor?.apply() |
92 | editor.commit() | 110 | editor.commit() |
93 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | 111 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) |
94 | } | 112 | } |
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.content.Context | 5 | import android.content.Context |
6 | import android.content.Context.INPUT_METHOD_SERVICE | 6 | import android.content.Context.INPUT_METHOD_SERVICE |
7 | import android.content.DialogInterface | 7 | import android.content.DialogInterface |
8 | import android.content.SharedPreferences | 8 | import android.content.SharedPreferences |
9 | import android.graphics.Canvas | 9 | import android.graphics.Canvas |
10 | import android.graphics.Color | 10 | import android.graphics.Color |
11 | import android.graphics.drawable.Drawable | 11 | import android.graphics.drawable.Drawable |
12 | import android.os.Bundle | 12 | import android.os.Bundle |
13 | import android.text.InputType.TYPE_CLASS_NUMBER | 13 | import android.text.InputType.TYPE_CLASS_NUMBER |
14 | import android.view.* | 14 | import android.view.* |
15 | import android.view.inputmethod.InputMethodManager | 15 | import android.view.inputmethod.InputMethodManager |
16 | import android.widget.EditText | 16 | import android.widget.EditText |
17 | import android.widget.TextView | 17 | import android.widget.TextView |
18 | import android.widget.Toast | 18 | import android.widget.Toast |
19 | import androidx.core.content.ContextCompat | 19 | import androidx.core.content.ContextCompat |
20 | import androidx.core.os.bundleOf | 20 | import androidx.core.os.bundleOf |
21 | import androidx.fragment.app.Fragment | 21 | import androidx.fragment.app.Fragment |
22 | import androidx.lifecycle.lifecycleScope | 22 | import androidx.lifecycle.lifecycleScope |
23 | import androidx.navigation.NavController | 23 | import androidx.navigation.NavController |
24 | import androidx.navigation.Navigation | 24 | import androidx.navigation.Navigation |
25 | import androidx.recyclerview.widget.ItemTouchHelper | 25 | import androidx.recyclerview.widget.ItemTouchHelper |
26 | import androidx.recyclerview.widget.LinearLayoutManager | 26 | import androidx.recyclerview.widget.LinearLayoutManager |
27 | import androidx.recyclerview.widget.RecyclerView | 27 | import androidx.recyclerview.widget.RecyclerView |
28 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 28 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
29 | import com.focasoftware.deboinventariov20.Model.Articles | 29 | import com.focasoftware.deboinventariov20.Model.Articles |
30 | import com.focasoftware.deboinventariov20.Model.InvBody | 30 | import com.focasoftware.deboinventariov20.Model.InvBody |
31 | import com.focasoftware.deboinventariov20.Model.InvHead | 31 | import com.focasoftware.deboinventariov20.Model.InvHead |
32 | import com.focasoftware.deboinventariov20.R | 32 | import com.focasoftware.deboinventariov20.R |
33 | import com.focasoftware.deboinventariov20.UI.Utils.NoEncontradoSimple | 33 | import com.focasoftware.deboinventariov20.UI.Utils.NoEncontradoSimple |
34 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | 34 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
35 | import kotlinx.android.synthetic.main.fragment_inventario.* | 35 | import kotlinx.android.synthetic.main.fragment_inventario.* |
36 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 36 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
37 | import kotlinx.android.synthetic.main.login_dialog.view.* | 37 | import kotlinx.android.synthetic.main.login_dialog.view.* |
38 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | 38 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar |
39 | import kotlinx.coroutines.* | 39 | import kotlinx.coroutines.* |
40 | import kotlinx.coroutines.Dispatchers.IO | ||
40 | import java.time.LocalDateTime | 41 | import java.time.LocalDateTime |
41 | import java.time.format.DateTimeFormatter | 42 | import java.time.format.DateTimeFormatter |
42 | import java.util.* | 43 | import java.util.* |
43 | 44 | ||
44 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { | 45 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { |
45 | 46 | ||
46 | private lateinit var sharedPreferences: SharedPreferences | 47 | private lateinit var sharedPreferences: SharedPreferences |
47 | private var iArea: Int = 0 | 48 | private var iArea: Boolean = false |
48 | private lateinit var invHead: InvHead | 49 | private lateinit var invHead: InvHead |
49 | private lateinit var rcInventarios: RecyclerView | 50 | private lateinit var rcInventarios: RecyclerView |
50 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 51 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
51 | private lateinit var viewManager: RecyclerView.LayoutManager | 52 | private lateinit var viewManager: RecyclerView.LayoutManager |
52 | private lateinit var sChangeUpper: String | 53 | private lateinit var sChangeUpper: String |
53 | private var listArticulos = ArrayList<ItemsRecycler>() | 54 | private var listArticulos = ArrayList<ItemsRecycler>() |
54 | private lateinit var navController: NavController | 55 | private lateinit var navController: NavController |
55 | var InventarioNuevo: Int = 0 | 56 | var InventarioNuevo: Int = 0 |
56 | private var iEstado = 0 | 57 | private var iEstado = 0 |
57 | private var iBusquedaPor = 0 | 58 | private var iBusquedaPor = 0 |
58 | private var fCant = 0F | 59 | private var fCant = 0F |
59 | private var bFirst = false | 60 | private var bFirst = false |
60 | private lateinit var deleteIcon: Drawable | 61 | private lateinit var deleteIcon: Drawable |
61 | 62 | ||
62 | @SuppressLint("MissingPermission") | 63 | @SuppressLint("MissingPermission") |
63 | override fun onCreate(savedInstanceState: Bundle?) { | 64 | override fun onCreate(savedInstanceState: Bundle?) { |
64 | super.onCreate(savedInstanceState) | 65 | super.onCreate(savedInstanceState) |
65 | 66 | ||
66 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 67 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
67 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { | 68 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { |
68 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() | 69 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() |
69 | val editor = sharedPreferences.edit() | 70 | val editor = sharedPreferences.edit() |
70 | editor?.putString("Inventario", "-1") | 71 | editor?.putString("Inventario", "-1") |
71 | editor?.apply() | 72 | editor?.apply() |
72 | editor.commit() | 73 | editor.commit() |
73 | } | 74 | } |
74 | // val c = Calendar.getInstance() | 75 | // val c = Calendar.getInstance() |
75 | // c[2009, 9, 9, 12, 0] = 0 | 76 | // c[2009, 9, 9, 12, 0] = 0 |
76 | // val am: AlarmManager = requireActivity().getSystemService(Context.ALARM_SERVICE) as AlarmManager | 77 | // val am: AlarmManager = requireActivity().getSystemService(Context.ALARM_SERVICE) as AlarmManager |
77 | // am.setTime(c.timeInMillis) | 78 | // am.setTime(c.timeInMillis) |
78 | } | 79 | } |
79 | // private fun setupTimeZone(timeZoneName: String) { | 80 | // private fun setupTimeZone(timeZoneName: String) { |
80 | // val am = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager | 81 | // val am = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager |
81 | // am.setTimeZone("Europe/Madrid") | 82 | // am.setTimeZone("Europe/Madrid") |
82 | // } | 83 | // } |
83 | 84 | ||
84 | 85 | ||
85 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 86 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
86 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) | 87 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) |
87 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 88 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
88 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) | 89 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) |
89 | rcInventarios = v.findViewById(R.id.rcInventarios) | 90 | rcInventarios = v.findViewById(R.id.rcInventarios) |
90 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) | 91 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) |
91 | 92 | ||
92 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO | 93 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO |
93 | GlobalScope.launch(Dispatchers.Main) { | 94 | GlobalScope.launch(Dispatchers.Main) { |
94 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO | 95 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO |
95 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 | 96 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 |
96 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO | 97 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO |
97 | invHead = InvHead(InventarioNuevo, if (SerchArea() == 0) "Ventas" else "Deposito", 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, SerchArea(), AjusteProductos(), ProdNoCont()) | 98 | invHead = InvHead(InventarioNuevo, if (!SerchArea()) "Ventas" else "Deposito", 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, SerchArea(), AjusteProductos(), ProdNoCont()) |
98 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) | 99 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) |
99 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 100 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
100 | } | 101 | } |
101 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) | 102 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) |
102 | listArticulos.clear() | 103 | listArticulos.clear() |
103 | CargarDeBdInventario(InventarioNuevo) | 104 | CargarDeBdInventario(InventarioNuevo) |
104 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 105 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
105 | } | 106 | } |
106 | 107 | ||
107 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> | 108 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> |
108 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { | 109 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { |
109 | sChangeUpper = tCodigoBarras.text.toString() | 110 | sChangeUpper = tCodigoBarras.text.toString() |
110 | var indiceDelArtEncontrado = 0 | 111 | var indiceDelArtEncontrado = 0 |
111 | 112 | ||
112 | if (tCodigoBarras.text.isNullOrBlank()) { | 113 | if (tCodigoBarras.text.isNullOrBlank() ) { |
113 | tCodigoBarras.error = "No puede estar vacio" | 114 | tCodigoBarras.error = "No puede estar vacio" |
114 | tCodigoBarras.requestFocus() | 115 | tCodigoBarras.requestFocus() |
115 | tCodigoBarras.hint = "No puede estar vacio" | 116 | tCodigoBarras.hint = "No puede estar vacio" |
117 | }else if (tCodigoBarras.text.toString().length<4 && iEstado==2) { | ||
118 | tCodigoBarras.error = "Minimo 4 caracteres" | ||
119 | tCodigoBarras.requestFocus() | ||
120 | tCodigoBarras.hint = "4 Minimo" | ||
121 | |||
116 | } else { | 122 | } else { |
117 | 123 | ||
118 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | 124 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS |
119 | when (iBusquedaPor) { | 125 | when (iBusquedaPor) { |
120 | 0 -> { | 126 | 0 -> { |
121 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 127 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
122 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 128 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
123 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 129 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
124 | 130 | ||
125 | GlobalScope.launch(Dispatchers.Main) { | 131 | GlobalScope.launch(Dispatchers.Main) { |
126 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | 132 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice |
127 | //TODO (Si no lo encuentra devuelve -1) | 133 | //TODO (Si no lo encuentra devuelve -1) |
128 | if (indiceDelArtEncontrado != -1) { | 134 | if (indiceDelArtEncontrado != -1) { |
129 | if (swSumaUno!!.isChecked) { | 135 | if (swSumaUno!!.isChecked) { |
130 | // fCant = 0F | 136 | // fCant = 0F |
131 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 137 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
132 | // fCant += 1F | 138 | // fCant += 1F |
133 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 139 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
134 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), | 140 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), |
135 | listArticulos[indiceDelArtEncontrado].codigo.toString(), | 141 | listArticulos[indiceDelArtEncontrado].codigo.toString(), |
136 | listArticulos[indiceDelArtEncontrado].cantTomada + 1) | 142 | listArticulos[indiceDelArtEncontrado].cantTomada + 1) |
137 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 143 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
138 | listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada + 1 | 144 | listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada + 1 |
139 | viewAdapter.notifyDataSetChanged() | 145 | viewAdapter.notifyDataSetChanged() |
140 | } else { | 146 | } else { |
141 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) | 147 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) |
142 | } | 148 | } |
143 | 149 | ||
144 | } else if (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | 150 | } else if (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD |
145 | //TODO BUSCO EN BASE DE DATOS | 151 | //TODO BUSCO EN BASE DE DATOS |
146 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 152 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
147 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | 153 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE |
148 | } | 154 | } |
149 | tCodigoBarras.focusable = View.FOCUSABLE | 155 | tCodigoBarras.focusable = View.FOCUSABLE |
150 | tCodigoBarras.setText("") | 156 | tCodigoBarras.setText("") |
151 | tCodigoBarras.selectAll() | 157 | tCodigoBarras.selectAll() |
152 | } | 158 | } |
153 | return@setOnKeyListener true | 159 | return@setOnKeyListener true |
154 | 160 | ||
155 | 161 | ||
156 | } | 162 | } |
157 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | 163 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** |
158 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 164 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
159 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 165 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
160 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 166 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
161 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | 167 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice |
162 | // //TODO Si no lo encuentra devuelve -1 | 168 | // //TODO Si no lo encuentra devuelve -1 |
163 | // if (indiceDelArtEncontrado != -1) { | 169 | // if (indiceDelArtEncontrado != -1) { |
164 | //// if (swSumaUno!!.isChecked) { | 170 | //// if (swSumaUno!!.isChecked) { |
165 | //// fCant = 0F | 171 | //// fCant = 0F |
166 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 172 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
167 | //// fCant += 1F | 173 | //// fCant += 1F |
168 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 174 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
169 | //// viewAdapter.notifyDataSetChanged() | 175 | //// viewAdapter.notifyDataSetChanged() |
170 | //// } else { | 176 | //// } else { |
171 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 177 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
172 | // MaterialDialog(requireContext()).show { | 178 | // MaterialDialog(requireContext()).show { |
173 | // title(R.string.sTituloNueva) | 179 | // title(R.string.sTituloNueva) |
174 | // message(R.string.sCantidadNueva) | 180 | // message(R.string.sCantidadNueva) |
175 | // input { materialDialog, charSequence -> | 181 | // input { materialDialog, charSequence -> |
176 | // fCant = 0F | 182 | // fCant = 0F |
177 | // fCant = charSequence.toString().toFloat() | 183 | // fCant = charSequence.toString().toFloat() |
178 | // } | 184 | // } |
179 | // positiveButton(R.string.btnOk) { | 185 | // positiveButton(R.string.btnOk) { |
180 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 186 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
181 | // viewAdapter.notifyDataSetChanged() | 187 | // viewAdapter.notifyDataSetChanged() |
182 | // dismiss() | 188 | // dismiss() |
183 | // } | 189 | // } |
184 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 190 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
185 | //// } | 191 | //// } |
186 | // | 192 | // |
187 | // } else if | 193 | // } else if |
188 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | 194 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD |
189 | GlobalScope.launch(Dispatchers.Main) { | 195 | GlobalScope.launch(Dispatchers.Main) { |
190 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 196 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
191 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | 197 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) |
192 | } | 198 | } |
199 | |||
200 | iBusquedaPor = 0 | ||
193 | // } | 201 | // } |
194 | 202 | ||
195 | return@setOnKeyListener true | 203 | return@setOnKeyListener true |
196 | } | 204 | } |
197 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | 205 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** |
198 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 206 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
199 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 207 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
200 | 208 | ||
201 | GlobalScope.launch(Dispatchers.Main) { | 209 | // GlobalScope.launch(Dispatchers.Main) { |
202 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 2)//TODO Si encuentra el articulo en el RV devuelve el indice | 210 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 2)//TODO Si encuentra el articulo en el RV devuelve el indice |
203 | // //TODO Si no lo encuentra devuelve -1 | 211 | //// //TODO Si no lo encuentra devuelve -1 |
204 | if (indiceDelArtEncontrado != -1) { | 212 | // if (indiceDelArtEncontrado != -1) { |
205 | if (swSumaUno!!.isChecked) { | 213 | // if (swSumaUno!!.isChecked) { |
206 | fCant = 0F | 214 | // fCant = 0F |
207 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 215 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
208 | fCant += 1F | 216 | // fCant += 1F |
209 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 217 | // //TODO ACTUALIZO LA CANTIDAD EN LA BD |
210 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 218 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
211 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 219 | // //TODO ACTUALIZO LA CANTIDAD EN EL RV |
212 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 220 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
213 | viewAdapter.notifyDataSetChanged() | 221 | // viewAdapter.notifyDataSetChanged() |
214 | } else { | 222 | // } else { |
215 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) | 223 | // dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) |
216 | } | 224 | // } |
217 | // } else { | 225 | // } else { |
218 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 226 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
219 | // val mBuilder = | 227 | // val mBuilder = |
220 | // AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | 228 | // AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") |
221 | // .setCancelable(false) | 229 | // .setCancelable(false) |
222 | // mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | 230 | // mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() |
223 | // val mAlertDialog = mBuilder.show() | 231 | // val mAlertDialog = mBuilder.show() |
224 | // mDialogView.rbSumar.setOnClickListener { | 232 | // mDialogView.rbSumar.setOnClickListener { |
225 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 233 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
226 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 234 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
227 | // } | 235 | // } |
228 | // } | 236 | // } |
229 | // mDialogView.rbRestar.setOnClickListener { | 237 | // mDialogView.rbRestar.setOnClickListener { |
230 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 238 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
231 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 239 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
232 | // mDialogView.tvgenerico4.text = | 240 | // mDialogView.tvgenerico4.text = |
233 | // (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 241 | // (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
234 | // } | 242 | // } |
235 | // } | 243 | // } |
236 | // } | 244 | // } |
237 | // mDialogView.rbMdodificar.setOnClickListener { | 245 | // mDialogView.rbMdodificar.setOnClickListener { |
238 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 246 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
239 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 247 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
240 | // } | 248 | // } |
241 | // } | 249 | // } |
242 | // mDialogView.btnAceptar.setOnClickListener { | 250 | // mDialogView.btnAceptar.setOnClickListener { |
243 | // mAlertDialog.dismiss() | 251 | // mAlertDialog.dismiss() |
244 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() | 252 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() |
245 | // fCant = 0F | 253 | // fCant = 0F |
246 | // fCant = name | 254 | // fCant = name |
247 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 255 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
248 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 256 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
249 | // viewAdapter.notifyDataSetChanged() | 257 | // viewAdapter.notifyDataSetChanged() |
250 | // } | 258 | // } |
251 | // mDialogView.dialogCancelBtn.setOnClickListener { | 259 | // mDialogView.dialogCancelBtn.setOnClickListener { |
252 | // mAlertDialog.dismiss() | 260 | // mAlertDialog.dismiss() |
253 | // } | 261 | // } |
254 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 262 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
255 | // val type = InputType.TYPE_CLASS_NUMBER | 263 | // val type = InputType.TYPE_CLASS_NUMBER |
256 | // MaterialDialog(requireContext()).show { | 264 | // MaterialDialog(requireContext()).show { |
257 | // | 265 | // |
258 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | 266 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
259 | // message(R.string.sCantidadNueva) | 267 | // message(R.string.sCantidadNueva) |
260 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 268 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
261 | // fCant = 0F | 269 | // fCant = 0F |
262 | // fCant = charSequence.toString().toFloat() | 270 | // fCant = charSequence.toString().toFloat() |
263 | // } | 271 | // } |
264 | // positiveButton(R.string.btnOk) { | 272 | // positiveButton(R.string.btnOk) { |
265 | // //TODO ACTUALIZO CANTIADAD EN BD | 273 | // //TODO ACTUALIZO CANTIADAD EN BD |
266 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 274 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
267 | // //TODO ACTUALIZO CANTIDAD EN RV | 275 | // //TODO ACTUALIZO CANTIDAD EN RV |
268 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 276 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
269 | // viewAdapter.notifyDataSetChanged() | 277 | // viewAdapter.notifyDataSetChanged() |
270 | // dismiss() | 278 | // dismiss() |
271 | // } | 279 | // } |
272 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 280 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
273 | // } | 281 | // } |
274 | } else if (indiceDelArtEncontrado == -1) { | 282 | // } else if (indiceDelArtEncontrado == -1) { |
275 | // no lo encontro en el RV, lo va a buscar en al BD | 283 | // no lo encontro en el RV, lo va a buscar en al BD |
276 | 284 | ||
277 | GlobalScope.launch(Dispatchers.Main) { | 285 | GlobalScope.launch(Dispatchers.Main) { |
278 | //TODO BUSCO EN BASE DE DATOS | 286 | //TODO BUSCO EN BASE DE DATOS |
279 | listArticulos[indiceDelArtEncontrado].cantTomada | ||
280 | val artEncontrado = buscarCodiogoOriEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 287 | val artEncontrado = buscarCodiogoOriEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
281 | ContinuarCargaCB(artEncontrado) | 288 | ContinuarCargaCodigoOri(artEncontrado ) |
282 | } | 289 | } |
283 | } | 290 | iBusquedaPor = 0 |
284 | } | 291 | // } |
292 | // } | ||
285 | return@setOnKeyListener true | 293 | return@setOnKeyListener true |
286 | } | 294 | } |
287 | } | 295 | } |
288 | } | 296 | } |
289 | } | 297 | } |
290 | return@setOnKeyListener false | 298 | return@setOnKeyListener false |
291 | } | 299 | } |
292 | return v | 300 | return v |
293 | } | 301 | } |
294 | 302 | ||
295 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 303 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
296 | super.onViewCreated(view, savedInstanceState) | 304 | super.onViewCreated(view, savedInstanceState) |
297 | navController = Navigation.findNavController(view) | 305 | navController = Navigation.findNavController(view) |
298 | etCodigoBarras.requestFocus() | 306 | etCodigoBarras.requestFocus() |
299 | // val modalDialog = NoEncontradoSimple() | 307 | // val modalDialog = NoEncontradoSimple() |
300 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 308 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
301 | 309 | ||
302 | btnBorrarInv.setOnClickListener { | 310 | btnBorrarInv.setOnClickListener { |
303 | AlertDialog.Builder(requireContext()).setTitle("Eliminación de Inventarios").setMessage("¿Confirma que desea eliminar el inventario?") | 311 | AlertDialog.Builder(requireContext()).setTitle("Eliminación de Inventarios").setMessage("¿Confirma que desea eliminar el inventario?") |
304 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | 312 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> |
305 | BorrarInvActual() | 313 | BorrarInvActual() |
306 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | 314 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() |
307 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 315 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
308 | InventarioNuevo = 0 | 316 | InventarioNuevo = 0 |
309 | 317 | ||
310 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> | 318 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> |
311 | //botón cancel pulsado | 319 | //botón cancel pulsado |
312 | }).show() | 320 | }).show() |
313 | } | 321 | } |
314 | 322 | ||
315 | btnExportarInv.setOnClickListener { | 323 | btnExportarInv.setOnClickListener { |
316 | AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar) | 324 | AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar) |
317 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | 325 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> |
318 | BorrarInvActual() | 326 | BorrarInvActual() |
319 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | 327 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() |
320 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 328 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
321 | InventarioNuevo = 0 | 329 | InventarioNuevo = 0 |
322 | 330 | ||
323 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> }).show() | 331 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> }).show() |
324 | } | 332 | } |
325 | ivCamara.setOnClickListener { | 333 | ivCamara.setOnClickListener { |
326 | if (!bFirst) { | 334 | if (!bFirst) { |
327 | iEstado = 1 | 335 | iEstado = 1 |
328 | bFirst = true | 336 | bFirst = true |
329 | } | 337 | } |
330 | 338 | ||
331 | when (iEstado) { | 339 | when (iEstado) { |
332 | 0 -> { | 340 | 0 -> { |
333 | ivCamara.setImageResource(R.drawable.codbar) | 341 | ivCamara.setImageResource(R.drawable.codbar) |
334 | etCodigoBarras.hint = "Busqueda por C. Barras" | 342 | etCodigoBarras.hint = "Busqueda por C. Barras" |
335 | swSumaUno.visibility = View.VISIBLE | 343 | swSumaUno.visibility = View.VISIBLE |
336 | iBusquedaPor = 0 | 344 | iBusquedaPor = 0 |
337 | iEstado = 1 | 345 | iEstado = 1 |
338 | } | 346 | } |
339 | 1 -> { | 347 | 1 -> { |
340 | ivCamara.setImageResource(R.drawable.desc) | 348 | ivCamara.setImageResource(R.drawable.desc) |
341 | etCodigoBarras.hint = "Busqueda por Descripción" | 349 | etCodigoBarras.hint = "Busqueda por Descripción" |
342 | swSumaUno.visibility = View.GONE | 350 | swSumaUno.visibility = View.GONE |
343 | iBusquedaPor = 1 | 351 | iBusquedaPor = 1 |
344 | iEstado = 2 | 352 | iEstado = 2 |
345 | } | 353 | } |
346 | 2 -> { | 354 | 2 -> { |
347 | ivCamara.setImageResource(R.drawable.cod_origen) | 355 | ivCamara.setImageResource(R.drawable.cod_origen) |
348 | etCodigoBarras.hint = "Busqueda por C. Origen" | 356 | etCodigoBarras.hint = "Busqueda por C. Origen" |
349 | swSumaUno.visibility = View.GONE | 357 | swSumaUno.visibility = View.GONE |
350 | iBusquedaPor = 2 | 358 | iBusquedaPor = 2 |
351 | iEstado = 0 | 359 | iEstado = 0 |
352 | } | 360 | } |
353 | } | 361 | } |
354 | } | 362 | } |
355 | } | 363 | } |
356 | 364 | ||
357 | private fun BorrarInvActual() { | 365 | private fun BorrarInvActual() { |
358 | lifecycleScope.launch { | 366 | lifecycleScope.launch { |
359 | withContext(Dispatchers.IO) { | 367 | withContext(Dispatchers.IO) { |
360 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) | 368 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) |
361 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) | 369 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) |
362 | } | 370 | } |
363 | } | 371 | } |
364 | } | 372 | } |
365 | 373 | ||
366 | private fun CargarDeBdInventario(ultimoInv: Int) { | 374 | private fun CargarDeBdInventario(ultimoInv: Int) { |
367 | GlobalScope.launch(Dispatchers.Main) { | 375 | GlobalScope.launch(Dispatchers.Main) { |
368 | val invbody = cargarInventario(ultimoInv) | 376 | val invbody = cargarInventario(ultimoInv) |
369 | for ((i, _) in invbody!!.withIndex()) { | 377 | for ((i, _) in invbody!!.withIndex()) { |
370 | val art = Articles(invbody[i].sector, | 378 | val art = Articles(invbody[i].sector, |
371 | invbody[i].codigo, | 379 | invbody[i].codigo, |
372 | invbody[i].descripcion, | 380 | invbody[i].descripcion, |
373 | invbody[i].codBar, | 381 | invbody[i].codBar, |
374 | invbody[i].codOrigen, | 382 | invbody[i].codOrigen, |
375 | invbody[i].precio, | 383 | invbody[i].precio, |
376 | invbody[i].costo, | 384 | invbody[i].costo, |
377 | "", | 385 | "", |
378 | "", | 386 | "", |
379 | "", | 387 | "", |
380 | invbody[i].balanza, | 388 | invbody[i].balanza, |
381 | invbody[i].depSn, | 389 | invbody[i].depSn, |
382 | invbody[i].costo) | 390 | invbody[i].costo) |
383 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) | 391 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) |
384 | } | 392 | } |
385 | } | 393 | } |
386 | } | 394 | } |
387 | 395 | ||
388 | // @SuppressLint("RestrictedApi") | 396 | private fun ContinuarCargaCodigoOri(artAcargar:List<Articles>) { |
397 | |||
398 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | ||
399 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | ||
400 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | ||
401 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | ||
402 | |||
403 | var bundle = Bundle() | ||
404 | bundle = bundleOf("ArrayDesc" to artAcargar) | ||
405 | bundle.putInt("numeroInv", InventarioNuevo) | ||
406 | navController.navigate(R.id.action_inventarioFragment_to_codigoOriFragment, bundle) | ||
407 | |||
408 | } else {//TODO si no lo encuentra en la BD | ||
409 | val modalDialog = NoEncontradoSimple() | ||
410 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
411 | } | ||
412 | etCodigoBarras.focusable = View.FOCUSABLE | ||
413 | etCodigoBarras.setText("") | ||
414 | etCodigoBarras.selectAll() | ||
415 | } | ||
416 | |||
389 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { | 417 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { |
390 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS | 418 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS |
391 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV | 419 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV |
392 | 420 | ||
393 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | 421 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD |
394 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 422 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
395 | // fCant = 0F | 423 | // fCant = 0F |
396 | // fCant += 1F | 424 | // fCant += 1F |
397 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 425 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
398 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 426 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
399 | // artAcargar[0].codigo, | 427 | // artAcargar[0].codigo, |
400 | // artAcargar[0].descripcion, | 428 | // artAcargar[0].descripcion, |
401 | // artAcargar[0].codBar, | 429 | // artAcargar[0].codBar, |
402 | // artAcargar[0].codOrigen, | 430 | // artAcargar[0].codOrigen, |
403 | // artAcargar[0].precio, | 431 | // artAcargar[0].precio, |
404 | // artAcargar[0].costo, | 432 | // artAcargar[0].costo, |
405 | // "", | 433 | // "", |
406 | // "", | 434 | // "", |
407 | // "", | 435 | // "", |
408 | // artAcargar[0].balanza, | 436 | // artAcargar[0].balanza, |
409 | // artAcargar[0].depSn, | 437 | // artAcargar[0].depSn, |
410 | // "") | 438 | // "") |
411 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 439 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
412 | // cargarArtEnBd(acargarPorDesc, fCant) | 440 | // cargarArtEnBd(acargarPorDesc, fCant) |
413 | // cargarRecicler(acargarPorDesc, fCant) | 441 | // cargarRecicler(acargarPorDesc, fCant) |
414 | // } else { | 442 | // } else { |
415 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 443 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
416 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 444 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
417 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 445 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
418 | var bundle = Bundle() | 446 | var bundle = Bundle() |
419 | bundle = bundleOf("ArrayDesc" to artAcargar) | 447 | bundle = bundleOf("ArrayDesc" to artAcargar) |
420 | bundle.putInt("numeroInv", InventarioNuevo) | 448 | bundle.putInt("numeroInv", InventarioNuevo) |
421 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 449 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
422 | //navController.backStack.removeLast() | 450 | //navController.backStack.removeLast() |
423 | // } | 451 | // } |
424 | // } else {//SI NO ESTA +1 | 452 | // } else {//SI NO ESTA +1 |
425 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 453 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
426 | // fCant = listArticulos[0].cantTomada | 454 | // fCant = listArticulos[0].cantTomada |
427 | // MaterialDialog(requireContext()).show { | 455 | // MaterialDialog(requireContext()).show { |
428 | // title(R.string.sTituloNueva) | 456 | // title(R.string.sTituloNueva) |
429 | // message(R.string.sCantidadNueva) | 457 | // message(R.string.sCantidadNueva) |
430 | // input { materialDialog, charSequence -> | 458 | // input { materialDialog, charSequence -> |
431 | // fCant = 0F | 459 | // fCant = 0F |
432 | // fCant = charSequence.toString().toFloat() | 460 | // fCant = charSequence.toString().toFloat() |
433 | // } | 461 | // } |
434 | // positiveButton(R.string.btnOk) { | 462 | // positiveButton(R.string.btnOk) { |
435 | // listArticulos[0].cantTomada = fCant | 463 | // listArticulos[0].cantTomada = fCant |
436 | // viewAdapter.notifyDataSetChanged() | 464 | // viewAdapter.notifyDataSetChanged() |
437 | // dismiss() | 465 | // dismiss() |
438 | // } | 466 | // } |
439 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 467 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
440 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 468 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
441 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 469 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
442 | // artAcargar[0].codigo, | 470 | // artAcargar[0].codigo, |
443 | // artAcargar[0].descripcion, | 471 | // artAcargar[0].descripcion, |
444 | // artAcargar[0].codBar, | 472 | // artAcargar[0].codBar, |
445 | // artAcargar[0].cod_origen, | 473 | // artAcargar[0].cod_origen, |
446 | // artAcargar[0].precio, | 474 | // artAcargar[0].precio, |
447 | // artAcargar[0].costo, | 475 | // artAcargar[0].costo, |
448 | // artAcargar[0].balanza, | 476 | // artAcargar[0].balanza, |
449 | // artAcargar[0].depSn, | 477 | // artAcargar[0].depSn, |
450 | // "") | 478 | // "") |
451 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 479 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
452 | // cargarArtEnBd(acargarPorDesc, fCant) | 480 | // cargarArtEnBd(acargarPorDesc, fCant) |
453 | // cargarRecicler(acargarPorDesc, fCant) | 481 | // cargarRecicler(acargarPorDesc, fCant) |
454 | // } else { | 482 | // } else { |
455 | // var bundle = Bundle() | 483 | // var bundle = Bundle() |
456 | // bundle = bundleOf("ArrayDesc" to artAcargar) | 484 | // bundle = bundleOf("ArrayDesc" to artAcargar) |
457 | // bundle.putInt("numeroInv", InventarioNuevo) | 485 | // bundle.putInt("numeroInv", InventarioNuevo) |
458 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 486 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
459 | // } | 487 | // } |
460 | // } | 488 | // } |
461 | } else {//TODO si no lo encuentra en la BD | 489 | } else {//TODO si no lo encuentra en la BD |
462 | val modalDialog = NoEncontradoSimple() | 490 | val modalDialog = NoEncontradoSimple() |
463 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 491 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
464 | } | 492 | } |
465 | etCodigoBarras.focusable = View.FOCUSABLE | 493 | etCodigoBarras.focusable = View.FOCUSABLE |
466 | etCodigoBarras.setText("") | 494 | etCodigoBarras.setText("") |
467 | etCodigoBarras.selectAll() | 495 | etCodigoBarras.selectAll() |
468 | } | 496 | } |
469 | 497 | ||
470 | private fun ContinuarCargaCB(artAcargar: Articles?) { | 498 | private fun ContinuarCargaCB(artAcargar: Articles?) { |
471 | 499 | ||
472 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD | 500 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD |
473 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 | 501 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 |
474 | fCant = 0F | 502 | fCant = 0F |
475 | fCant += 1F | 503 | fCant += 1F |
476 | cargarArtEnBd(artAcargar, String.format("%.3f", fCant)) | 504 | cargarArtEnBd(artAcargar, String.format("%.3f", fCant)) |
477 | cargarRecicler(artAcargar, fCant) | 505 | cargarRecicler(artAcargar, fCant) |
478 | } else {//TODO: SI NO ESTA +1 PREGUNTA CANTIDAD | 506 | } else {//TODO: SI NO ESTA +1 PREGUNTA CANTIDAD |
479 | 507 | ||
480 | DialogingresarCantidad(requireContext(), artAcargar) | 508 | DialogingresarCantidad(requireContext(), artAcargar) |
481 | 509 | ||
482 | } | 510 | } |
483 | } else {// TODO si no lo encuentra en la BD | 511 | } else {// TODO si no lo encuentra en la BD |
484 | val modalDialog = NoEncontradoSimple() | 512 | val modalDialog = NoEncontradoSimple() |
485 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 513 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
486 | } | 514 | } |
487 | etCodigoBarras.focusable = View.FOCUSABLE | 515 | etCodigoBarras.focusable = View.FOCUSABLE |
488 | etCodigoBarras.setText("") | 516 | etCodigoBarras.setText("") |
489 | etCodigoBarras.selectAll() | 517 | etCodigoBarras.selectAll() |
490 | } | 518 | } |
491 | 519 | ||
492 | |||
493 | fun DialogingresarCantidad(cnxt: Context, artAcargar: Articles?): Float { | 520 | fun DialogingresarCantidad(cnxt: Context, artAcargar: Articles?): Float { |
494 | var cantidad = 0F | 521 | var cantidad = 0F |
495 | val mDialogView = LayoutInflater.from(cnxt).inflate(R.layout.ingresar_cantidad, null) | 522 | val mDialogView = LayoutInflater.from(cnxt).inflate(R.layout.ingresar_cantidad, null) |
496 | val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView).setCancelable(false) | 523 | val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView).setCancelable(false) |
497 | if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER | 524 | if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER |
498 | mDialogView.tvTitulo.text = artAcargar.descripcion.toString() | 525 | mDialogView.tvTitulo.text = artAcargar.descripcion.toString() |
499 | val mAlertDialog = mBuilder.show() | 526 | val mAlertDialog = mBuilder.show() |
500 | mDialogView.etCantidad.requestFocus() | 527 | mDialogView.etCantidad.requestFocus() |
501 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 528 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
502 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 529 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
503 | 530 | ||
504 | 531 | ||
505 | mDialogView.btnAceptar.setOnClickListener { | 532 | mDialogView.btnAceptar.setOnClickListener { |
506 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | 533 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
507 | mDialogView.etCantidad.error = "No vacio" | 534 | mDialogView.etCantidad.error = "No vacio" |
508 | mDialogView.etCantidad.requestFocus() | 535 | mDialogView.etCantidad.requestFocus() |
509 | mDialogView.etCantidad.hint = "Ingrese un valor" | 536 | mDialogView.etCantidad.hint = "Ingrese un valor" |
510 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | 537 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { |
511 | mAlertDialog.dismiss() | 538 | mAlertDialog.dismiss() |
512 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | 539 | cantidad = mDialogView.etCantidad.text.toString().toFloat() |
513 | cargarArtEnBd(artAcargar, String.format("%.2f", cantidad)) | 540 | cargarArtEnBd(artAcargar, String.format("%.2f", cantidad)) |
514 | cargarRecicler(artAcargar, cantidad) | 541 | cargarRecicler(artAcargar, cantidad) |
515 | modificarCantidadEnCabecera(InventarioNuevo, true, requireContext()) | 542 | modificarCantidadEnCabecera(InventarioNuevo, true, requireContext()) |
516 | } | 543 | } |
517 | } | 544 | } |
518 | return cantidad | 545 | return cantidad |
519 | } | 546 | } |
520 | 547 | ||
521 | fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) { | 548 | fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) { |
522 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 549 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
523 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[indiceDelArtEncontrado].descripcion} se encuentra cargado.").setCancelable(cancelable) | 550 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[indiceDelArtEncontrado].descripcion} se encuentra cargado.").setCancelable(cancelable) |
524 | // TODO: SI PERMITE QUE INGRESE DECIMALES | 551 | // TODO: SI PERMITE QUE INGRESE DECIMALES |
525 | if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER | 552 | if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER |
526 | 553 | ||
527 | mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada) | 554 | mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada) |
528 | val mAlertDialog = mBuilder.show() | 555 | val mAlertDialog = mBuilder.show() |
529 | mDialogView.tvNuevaCantidad.requestFocus() | 556 | mDialogView.tvNuevaCantidad.requestFocus() |
530 | 557 | ||
531 | 558 | ||
532 | 559 | ||
533 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 560 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
534 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 561 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
535 | 562 | ||
536 | mDialogView.rbSumar.setOnClickListener { | 563 | mDialogView.rbSumar.setOnClickListener { |
537 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 564 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
538 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 565 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
539 | mDialogView.tvNuevaCantidad.isEnabled = false | 566 | mDialogView.tvNuevaCantidad.isEnabled = false |
540 | } | 567 | } |
541 | } | 568 | } |
542 | mDialogView.rbRestar.setOnClickListener { | 569 | mDialogView.rbRestar.setOnClickListener { |
543 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 570 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
544 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 571 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
545 | 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()) |
546 | mDialogView.tvNuevaCantidad.isEnabled = false | 573 | mDialogView.tvNuevaCantidad.isEnabled = false |
547 | } else { | 574 | } else { |
548 | mDialogView.tvResultado.text = "" | 575 | mDialogView.tvResultado.text = "" |
549 | mDialogView.tvResultado.error = "Operación No Valida" | 576 | mDialogView.tvResultado.error = "Operación No Valida" |
550 | mDialogView.tvResultado.requestFocus() | 577 | mDialogView.tvResultado.requestFocus() |
551 | mDialogView.tvResultado.hint = "Error" | 578 | mDialogView.tvResultado.hint = "Error" |
552 | } | 579 | } |
553 | } | 580 | } |
554 | } | 581 | } |
555 | mDialogView.rbMdodificar.setOnClickListener { | 582 | mDialogView.rbMdodificar.setOnClickListener { |
556 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 583 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
557 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 584 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
558 | mDialogView.tvNuevaCantidad.isEnabled = false | 585 | mDialogView.tvNuevaCantidad.isEnabled = false |
559 | } | 586 | } |
560 | } | 587 | } |
561 | mDialogView.btnAceptar.setOnClickListener { | 588 | mDialogView.btnAceptar.setOnClickListener { |
562 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | 589 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { |
563 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | 590 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { |
564 | mAlertDialog.dismiss() | 591 | mAlertDialog.dismiss() |
565 | listArticulos[indiceDelArtEncontrado].cantTomada = String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() | 592 | listArticulos[indiceDelArtEncontrado].cantTomada = String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() |
566 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), | 593 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), |
567 | listArticulos[indiceDelArtEncontrado].codigo.toString(), | 594 | listArticulos[indiceDelArtEncontrado].codigo.toString(), |
568 | String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat()) | 595 | String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat()) |
569 | 596 | ||
570 | viewAdapter.notifyDataSetChanged() | 597 | viewAdapter.notifyDataSetChanged() |
571 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 598 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { |
572 | mDialogView.tvResultado.error = "Operación Requerida" | 599 | mDialogView.tvResultado.error = "Operación Requerida" |
573 | mDialogView.tvResultado.requestFocus() | 600 | mDialogView.tvResultado.requestFocus() |
574 | mDialogView.tvResultado.hint = "Seleccione Operación" | 601 | mDialogView.tvResultado.hint = "Seleccione Operación" |
575 | } | 602 | } |
576 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 603 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { |
577 | mDialogView.tvNuevaCantidad.error = "Completar" | 604 | mDialogView.tvNuevaCantidad.error = "Completar" |
578 | mDialogView.tvNuevaCantidad.requestFocus() | 605 | mDialogView.tvNuevaCantidad.requestFocus() |
579 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | 606 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" |
580 | } | 607 | } |
581 | } | 608 | } |
582 | mDialogView.dialogCancelBtn.setOnClickListener { | 609 | mDialogView.dialogCancelBtn.setOnClickListener { |
583 | mAlertDialog.dismiss() | 610 | mAlertDialog.dismiss() |
584 | } | 611 | } |
585 | } | 612 | } |
586 | suspend fun buscarCodiogoOriEnBD(CodOri: String): Articles? { | 613 | |
614 | suspend fun buscarCodiogoOriEnBD(CodOri: String): List<Articles> { | ||
587 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 615 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
588 | var busqueda: Articles? = null | 616 | var busqueda: List<Articles> |
589 | return GlobalScope.async(Dispatchers.IO) { | 617 | return GlobalScope.async(Dispatchers.IO) { |
590 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodOri(CodOri, SerchArea()) | 618 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodOri(CodOri, SerchAreaInventario()) |
591 | return@async busqueda | 619 | return@async busqueda |
592 | }.await() | 620 | }.await() |
593 | } | 621 | } |
594 | 622 | ||
595 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { | 623 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { |
596 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 624 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
597 | var busqueda: Articles? = null | 625 | var busqueda: Articles? = null |
598 | return GlobalScope.async(Dispatchers.IO) { | 626 | return GlobalScope.async(IO) { |
599 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, SerchArea()) | 627 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, SerchAreaInventario()) |
600 | return@async busqueda | 628 | return@async busqueda |
601 | }.await() | 629 | }.await() |
602 | } | 630 | } |
603 | 631 | ||
604 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { | 632 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { |
605 | //TODO BUSQUEDA POR DESCRIPCION | 633 | //TODO BUSQUEDA POR DESCRIPCION |
606 | var busqueda: List<Articles>? = null | 634 | var busqueda: List<Articles>? = null |
607 | return GlobalScope.async(Dispatchers.IO) { | 635 | return GlobalScope.async(Dispatchers.IO) { |
608 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, SerchArea()) | 636 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, SerchAreaInventario()) |
609 | return@async busqueda | 637 | return@async busqueda |
610 | }.await() | 638 | }.await() |
611 | } | 639 | } |
612 | 640 | ||
613 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { | 641 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { |
614 | //TODO BUSQUEDA POR DESCRIPCION | 642 | //TODO BUSQUEDA POR DESCRIPCION |
615 | var result: Int | 643 | var result: Int |
616 | return GlobalScope.async(Dispatchers.IO) { | 644 | return GlobalScope.async(IO) { |
617 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo, inventario) | 645 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo, inventario) |
618 | return@async result | 646 | return@async result |
619 | }.await() | 647 | }.await() |
620 | } | 648 | } |
621 | 649 | ||
622 | private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | 650 | private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { |
623 | return GlobalScope.async(Dispatchers.IO) { | 651 | return GlobalScope.async(IO) { |
624 | var indice = 0 | 652 | var indice = 0 |
625 | var bEncontrado = false | 653 | var bEncontrado = false |
626 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | 654 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS |
627 | // TODO CAMBIO DE CB A CODIGO DEBO | 655 | // TODO CAMBIO DE CB A CODIGO DEBO |
628 | val any = cambioCBporCodigoDebo(codigoBarras) | 656 | val any = cambioCBporCodigoDebo(codigoBarras) |
629 | if (any != null) { | 657 | if (any != null) { |
630 | for (item in listArticulos) { | 658 | for (item in listArticulos) { |
631 | if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { | 659 | if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { |
632 | bEncontrado = true | 660 | bEncontrado = true |
633 | break | 661 | break |
634 | } | 662 | } |
635 | indice += 1 | 663 | indice += 1 |
636 | } | 664 | } |
637 | } | 665 | } |
638 | 666 | ||
639 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | 667 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION |
640 | for (item in listArticulos) { | 668 | for (item in listArticulos) { |
641 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 669 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
642 | bEncontrado = true | 670 | bEncontrado = true |
643 | break | 671 | break |
644 | } | 672 | } |
645 | indice += 1 | 673 | indice += 1 |
646 | } | 674 | } |
647 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | 675 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN |
648 | for (item in listArticulos) { | 676 | for (item in listArticulos) { |
649 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 677 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
650 | bEncontrado = true | 678 | bEncontrado = true |
651 | break | 679 | break |
652 | } | 680 | } |
653 | indice += 1 | 681 | indice += 1 |
654 | } | 682 | } |
655 | } | 683 | } |
656 | return@async if (bEncontrado) indice else -1 | 684 | return@async if (bEncontrado) indice else -1 |
657 | }.await() | 685 | }.await() |
658 | } | 686 | } |
659 | 687 | ||
660 | suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { | 688 | suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { |
661 | //TODO BUSQUEDA POR DESCRIPCION | 689 | //TODO BUSQUEDA POR DESCRIPCION |
662 | var busqueda: Articles? = null | 690 | var busqueda: Articles? = null |
663 | return GlobalScope.async(Dispatchers.IO) { | 691 | return GlobalScope.async(IO) { |
664 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchArea()) | 692 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchArea()) |
665 | return@async busqueda | 693 | return@async busqueda |
666 | }.await() | 694 | }.await() |
667 | } | 695 | } |
668 | 696 | ||
669 | private fun cargarArtEnBd(articulos: Articles, cant: String) { | 697 | private fun cargarArtEnBd(articulos: Articles, cant: String) { |
670 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD | 698 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD |
671 | articulos.sector, | 699 | articulos.sector, |
672 | articulos.codigo, | 700 | articulos.codigo, |
673 | articulos.descripcion, | 701 | articulos.descripcion, |
674 | cant, | 702 | cant, |
675 | articulos.codBar, | 703 | articulos.codBar, |
676 | articulos.codOrigen, | 704 | articulos.codOrigen, |
677 | articulos.precio, | 705 | articulos.precio, |
678 | articulos.precio, | 706 | articulos.precio, |
679 | articulos.balanza, | 707 | articulos.balanza, |
680 | articulos.depSn, | 708 | articulos.depSn, |
681 | ObtenerFechaActual(), | 709 | ObtenerFechaActual(), |
682 | ObtenerFechaActual()) | 710 | ObtenerFechaActual()) |
683 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS | 711 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS |
684 | } | 712 | } |
685 | 713 | ||
686 | fun cargarRecicler(articulos: Articles, cant: Float) { | 714 | fun cargarRecicler(articulos: Articles, cant: Float) { |
687 | //TODO CARGO EN LE RV | 715 | //TODO CARGO EN LE RV |
688 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen, articulos.balanza.toString(), articulos.de.toString()) | 716 | 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()) | ||
689 | listArticulos.add(item) | 718 | listArticulos.add(item) |
690 | 719 | ||
691 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) | 720 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) |
692 | viewManager = LinearLayoutManager(requireContext()) | 721 | viewManager = LinearLayoutManager(requireContext()) |
693 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 722 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
694 | rcInventarios.apply { | 723 | rcInventarios.apply { |
695 | adapter = viewAdapter | 724 | adapter = viewAdapter |
696 | layoutManager = viewManager | 725 | layoutManager = viewManager |
697 | } | 726 | } |
698 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 727 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
699 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 728 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
700 | return false | 729 | return false |
701 | } | 730 | } |
702 | 731 | ||
703 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | 732 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
704 | 733 | ||
705 | GlobalScope.launch(Dispatchers.Main) { | 734 | GlobalScope.launch(Dispatchers.Main) { |
706 | borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) | 735 | borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) |
707 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | 736 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) |
708 | viewAdapter.notifyDataSetChanged() | 737 | viewAdapter.notifyDataSetChanged() |
709 | modificarCantidadEnCabecera(InventarioNuevo, false, requireContext()) | 738 | modificarCantidadEnCabecera(InventarioNuevo, false, requireContext()) |
710 | } | 739 | } |
711 | } | 740 | } |
712 | 741 | ||
713 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 742 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
714 | val itemView = viewHolder.itemView | 743 | val itemView = viewHolder.itemView |
715 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 744 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
716 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 745 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
717 | 746 | ||
718 | if (dX > 0) { | 747 | if (dX > 0) { |
719 | 748 | ||
720 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 749 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
721 | else c.drawColor(Color.RED) | 750 | else c.drawColor(Color.RED) |
722 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 751 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
723 | } else { | 752 | } else { |
724 | } | 753 | } |
725 | 754 | ||
726 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 755 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
727 | deleteIcon.draw(c) | 756 | deleteIcon.draw(c) |
728 | } | 757 | } |
729 | } | 758 | } |
730 | 759 | ||
731 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 760 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
732 | itemTouchHelper.attachToRecyclerView(rcInventarios) | 761 | itemTouchHelper.attachToRecyclerView(rcInventarios) |
733 | } | 762 | } |
734 | 763 | ||
735 | private fun ProdNoCont(): Int? { | 764 | private fun ProdNoCont(): Int? { |
736 | var mostrarStock = 0 | 765 | var mostrarStock = 0 |
737 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 | 766 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 |
738 | return mostrarStock | 767 | return mostrarStock |
739 | } | 768 | } |
740 | 769 | ||
741 | private fun AjusteProductos(): Int? { | 770 | private fun AjusteProductos(): Int? { |
742 | var prodInclu = 0 | 771 | var prodInclu = 0 |
743 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 | 772 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 |
744 | 773 | ||
745 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 | 774 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 |
746 | return prodInclu | 775 | return prodInclu |
747 | } | 776 | } |
748 | 777 | ||
749 | private fun SerchArea(): Int { | 778 | private fun SerchArea(): Boolean { |
750 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 | 779 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea =false |
751 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 | 780 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = true |
752 | return iArea | 781 | return iArea |
753 | } | 782 | } |
783 | suspend fun SerchAreaInventario(): Boolean { | ||
784 | return GlobalScope.async(IO) { | ||
785 | return@async AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.fetchAreaInvH(InventarioNuevo) | ||
786 | }.await() | ||
754 | 787 | ||
788 | } | ||
755 | fun ObtenerFechaActual(): String? { | 789 | fun ObtenerFechaActual(): String? { |
756 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD | 790 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD |
757 | val current = LocalDateTime.now() | 791 | val current = LocalDateTime.now() |
758 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") | 792 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") |
759 | val dFechaHora = current.format(formatter) | 793 | val dFechaHora = current.format(formatter) |
760 | return dFechaHora.toString() | 794 | return dFechaHora.toString() |
761 | } | 795 | } |
762 | 796 | ||
763 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 797 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
764 | lifecycleScope.launch { | 798 | lifecycleScope.launch { |
765 | withContext(Dispatchers.IO) { | 799 | withContext(Dispatchers.IO) { |
766 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 800 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
767 | } | 801 | } |
768 | } | 802 | } |
769 | } | 803 | } |
770 | 804 | ||
771 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 805 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
772 | lifecycleScope.launch { | 806 | lifecycleScope.launch { |
773 | withContext(Dispatchers.IO) { | 807 | withContext(Dispatchers.IO) { |
774 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | 808 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) |
775 | } | 809 | } |
776 | } | 810 | } |
777 | } | 811 | } |
778 | 812 | ||
779 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { | 813 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { |
780 | return GlobalScope.async(Dispatchers.IO) { | 814 | return GlobalScope.async(Dispatchers.IO) { |
781 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) | 815 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) |
782 | }.await() | 816 | }.await() |
783 | } | 817 | } |
784 | 818 | ||
785 | override fun onImageDotsClick(sector: String?, codigo: String?) { | 819 | override fun onImageDotsClick(sector: String?, codigo: String?) { |
786 | val bundle = Bundle() | 820 | val bundle = Bundle() |
787 | bundle.putString("sector", sector) | 821 | bundle.putString("sector", sector!!.toInt().toString()) |
788 | bundle.putString("codigo", codigo) | 822 | bundle.putString("codigo", codigo) |
789 | bundle.putInt("numeroInv", InventarioNuevo) | 823 | bundle.putInt("numeroInv", InventarioNuevo) |
790 | navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) | 824 | navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) |
791 | } | 825 | } |
792 | 826 | ||
793 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { | 827 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { |
794 | dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true) | 828 | dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true) |
795 | } | 829 | } |
796 | } | 830 | } |
797 | 831 | ||
798 | 832 | ||
799 | 833 | ||
800 | 834 | ||
801 | 835 | ||
802 | 836 | ||
803 | 837 | ||
804 | 838 | ||
805 | 839 | ||
806 | 840 | ||
807 | 841 | ||
808 | 842 | ||
809 | 843 |
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 | ||
8 | import android.widget.Filterable | ||
7 | import androidx.recyclerview.widget.RecyclerView | 9 | import androidx.recyclerview.widget.RecyclerView |
8 | import com.focasoftware.deboinventariov20.Model.InvHead | 10 | import com.focasoftware.deboinventariov20.Model.InvHead |
9 | import com.focasoftware.deboinventariov20.R | 11 | import com.focasoftware.deboinventariov20.R |
10 | import com.focasoftware.deboinventariov20.UI.Utils.BaseViewHolder | 12 | import com.focasoftware.deboinventariov20.UI.Utils.BaseViewHolder |
11 | import kotlinx.android.synthetic.main.item_principal.view.* | 13 | import kotlinx.android.synthetic.main.item_principal.view.* |
14 | import java.util.* | ||
15 | import kotlin.collections.ArrayList | ||
12 | 16 | ||
13 | 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) : |
14 | RecyclerView.Adapter<BaseViewHolder<*>>() { | 18 | RecyclerView.Adapter<BaseViewHolder<*>>(), Filterable { |
15 | 19 | var invFiltrados: List<InvHead> | |
20 | init { | ||
21 | invFiltrados=inv | ||
22 | } | ||
16 | interface OnInventarioClickListener { | 23 | interface OnInventarioClickListener { |
17 | fun onItemClick(inventario: String?) | 24 | fun onItemClick(inventario: String?) |
18 | } | 25 | } |
19 | 26 | ||
20 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) | 27 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) |
21 | 28 | ||
22 | override fun getItemCount() = inv.size | 29 | override fun getItemCount() = inv.size |
23 | 30 | ||
24 | 31 | ||
25 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { | 32 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { |
26 | override fun bind(item: InvHead, position: Int) { | 33 | override fun bind(item: InvHead, position: Int) { |
27 | itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} | 34 | itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} |
28 | itemView.tvPrincipalinventario.text = if ( item.invNum < 10) "0${ item.invNum.toString()}" else item.invNum.toString() | 35 | itemView.tvPrincipalinventario.text = if ( item.invNum < 10) "0${ item.invNum.toString()}" else item.invNum.toString() |
29 | 36 | ||
30 | itemView.tvDescription.text=item.descripcion.toString() | 37 | itemView.tvDescription.text=item.descripcion.toString() |
31 | itemView.tvFecha.text=item.fechaInicio.toString() | 38 | itemView.tvFecha.text=item.fechaInicio.toString() |
32 | itemView.tvCantContada.text=item.prodContados.toString() | 39 | itemView.tvCantContada.text=item.prodContados.toString() |
33 | } | 40 | } |
34 | } | 41 | } |
35 | 42 | ||
36 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | 43 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { |
37 | when (holder) { | 44 | when (holder) { |
38 | is ItemsViewHolder -> holder.bind(inv[position], position) | 45 | is ItemsViewHolder -> holder.bind(inv[position], position) |
39 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") | 46 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") |
40 | } | 47 | } |
41 | } | 48 | } |
42 | 49 | ||
50 | override fun getFilter(): Filter { | ||
51 | return object : Filter() { | ||
52 | override fun performFiltering(charSequence: CharSequence): FilterResults { | ||
53 | val charString = charSequence.toString() | ||
43 | 54 | ||
44 | } | 55 | invFiltrados = if (charString.isEmpty()) { |
56 | inv | ||
57 | } else { | ||
58 | val filteredList = ArrayList<InvHead>() | ||
45 | 59 | ||
60 | for (row in inv) { | ||
61 | if (row.lugar.toString().contains(charString.toLowerCase(Locale.ROOT))) { | ||
62 | filteredList.add(row) | ||
63 | } | ||
46 | 64 | ||
65 | } | ||
66 | filteredList | ||
67 | } | ||
68 | val filterResults = FilterResults() | ||
69 | filterResults.values=invFiltrados | ||
70 | return filterResults | ||
71 | } | ||
47 | 72 | ||
73 | override fun publishResults(charSequence: CharSequence?, filterResults: FilterResults?) { | ||
74 | invFiltrados = filterResults!!.values as ArrayList<InvHead> | ||
75 | notifyDataSetChanged() | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | } |
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.* | 9 | import android.widget.CheckBox |
10 | import android.widget.ImageButton | ||
11 | import android.widget.TextView | ||
10 | import androidx.fragment.app.Fragment | 12 | import androidx.fragment.app.Fragment |
11 | import androidx.navigation.NavController | 13 | import androidx.navigation.NavController |
12 | import androidx.navigation.Navigation | 14 | import androidx.navigation.Navigation |
13 | import androidx.recyclerview.widget.LinearLayoutManager | 15 | import androidx.recyclerview.widget.LinearLayoutManager |
14 | import androidx.recyclerview.widget.RecyclerView | 16 | import androidx.recyclerview.widget.RecyclerView |
15 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
16 | import com.focasoftware.deboinventariov20.Model.InvHead | 18 | import com.focasoftware.deboinventariov20.Model.InvHead |
17 | import com.focasoftware.deboinventariov20.R | 19 | import com.focasoftware.deboinventariov20.R |
18 | import kotlinx.coroutines.Dispatchers | 20 | import kotlinx.coroutines.Dispatchers |
19 | import kotlinx.coroutines.GlobalScope | 21 | import kotlinx.coroutines.GlobalScope |
20 | import kotlinx.coroutines.async | 22 | import kotlinx.coroutines.async |
21 | import kotlinx.coroutines.launch | 23 | import kotlinx.coroutines.launch |
22 | import java.util.* | 24 | import java.util.* |
25 | import java.util.Locale.filter | ||
23 | 26 | ||
24 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { | 27 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { |
25 | private lateinit var inventarios: List<InvHead> | 28 | private lateinit var inventarios: List<InvHead> |
26 | private lateinit var ordenado: List<InvHead> | 29 | private lateinit var ordenado: List<InvHead> |
27 | private lateinit var rcInventario: RecyclerView | 30 | private lateinit var rcInventario: RecyclerView |
28 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 31 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
29 | private lateinit var viewManager: RecyclerView.LayoutManager | 32 | private lateinit var viewManager: RecyclerView.LayoutManager |
30 | // private var listIvn2 = List<InvHead>() | 33 | private var listIvn2 = ArrayList<InvHead>() |
31 | private var listIvn2 = ArrayList<InvHead>() | ||
32 | private lateinit var navController: NavController | 34 | private lateinit var navController: NavController |
33 | private lateinit var sharedPreferences: SharedPreferences | 35 | private lateinit var sharedPreferences: SharedPreferences |
34 | private var cantidadInventarios: Int = 0 | 36 | private var cantidadInventarios: Int = 0 |
37 | private var adapterFilter: InventarioListAdapter? = null | ||
35 | 38 | ||
36 | override fun onCreate(savedInstanceState: Bundle?) { | 39 | override fun onCreate(savedInstanceState: Bundle?) { |
37 | super.onCreate(savedInstanceState) | 40 | super.onCreate(savedInstanceState) |
38 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 41 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
39 | } | 42 | } |
40 | 43 | ||
41 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 44 | override fun onCreateView( |
45 | inflater: LayoutInflater, | ||
46 | container: ViewGroup?, | ||
47 | savedInstanceState: Bundle? | ||
48 | ): View? { | ||
42 | var bAbiertoCerrado = false | 49 | var bAbiertoCerrado = false |
43 | val v = inflater.inflate(R.layout.fragment_main, container, false) | 50 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
44 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) | 51 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) |
45 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) | 52 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) |
46 | val ivSort19= v.findViewById<ImageButton>(R.id.ivSort19) | 53 | val ivSort19 = v.findViewById<ImageButton>(R.id.ivSort19) |
47 | val ivSort91= v.findViewById<ImageButton>(R.id.ivSort91) | 54 | val ivSort91 = v.findViewById<ImageButton>(R.id.ivSort91) |
48 | val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas) | 55 | val cbVentas = v.findViewById<CheckBox>(R.id.cbVentas) |
49 | val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito) | 56 | val cbDeposito = v.findViewById<CheckBox>(R.id.cbDeposito) |
50 | val tvTipo = v.findViewById<TextView>(R.id.tvTipo) | 57 | val tvTipo = v.findViewById<TextView>(R.id.tvTipo) |
51 | rcInventario = v.findViewById(R.id.rcInventario) | 58 | rcInventario = v.findViewById(R.id.rcInventario) |
52 | 59 | ||
53 | GlobalScope.launch(Dispatchers.Main) { | 60 | GlobalScope.launch(Dispatchers.Main) { |
54 | inventarios = buscarEnBDInvHead() | 61 | inventarios = buscarEnBDInvHead() |
55 | for ((i, item) in inventarios.withIndex()) { | 62 | for ((i, item) in inventarios.withIndex()) { |
56 | val inv = InvHead(inventarios[i].invNum, | 63 | val inv = InvHead( |
64 | inventarios[i].invNum, | ||
57 | inventarios[i].descripcion, | 65 | inventarios[i].descripcion, |
58 | inventarios[i].estado, | 66 | inventarios[i].estado, |
59 | inventarios[i].fechaInicio, | 67 | inventarios[i].fechaInicio, |
60 | inventarios[i].fechaFinal, | 68 | inventarios[i].fechaFinal, |
61 | inventarios[i].prodContados, | 69 | inventarios[i].prodContados, |
62 | inventarios[i].lugar, | 70 | inventarios[i].lugar, |
63 | inventarios[i].stDesc, | 71 | inventarios[i].stDesc, |
64 | inventarios[i].proNoCont) | 72 | inventarios[i].proNoCont |
73 | ) | ||
65 | cargarRecicler(inv) | 74 | cargarRecicler(inv) |
66 | cantidadInventarios = i + 1 | 75 | cantidadInventarios = i + 1 |
67 | } | 76 | } |
68 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | 77 | tvInvDinamicos.text = "Inventarios Dinamicos ($cantidadInventarios) +" |
69 | tvInvDinamicos.setOnClickListener { | 78 | tvInvDinamicos.setOnClickListener { |
70 | if (!bAbiertoCerrado) { | 79 | if (!bAbiertoCerrado) { |
71 | bAbiertoCerrado = true | 80 | bAbiertoCerrado = true |
72 | txtDeposito.visibility = View.GONE | 81 | txtDeposito.visibility = View.GONE |
73 | rcInventario.visibility = View.VISIBLE | 82 | rcInventario.visibility = View.VISIBLE |
74 | ivSort91.visibility = View.INVISIBLE | 83 | ivSort91.visibility = View.INVISIBLE |
75 | ivSort19.visibility = View.VISIBLE | 84 | ivSort19.visibility = View.VISIBLE |
76 | cbVentas.visibility = View.VISIBLE | 85 | cbVentas.visibility = View.VISIBLE |
77 | cbDeposito.visibility = View.VISIBLE | 86 | cbDeposito.visibility = View.VISIBLE |
78 | tvTipo.visibility = View.VISIBLE | 87 | tvTipo.visibility = View.VISIBLE |
79 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) -" | 88 | tvInvDinamicos.text = |
89 | "Inventarios Dinamicos ($cantidadInventarios) -" | ||
80 | } else { | 90 | } else { |
81 | bAbiertoCerrado = false | 91 | bAbiertoCerrado = false |
82 | rcInventario.visibility = View.GONE | 92 | rcInventario.visibility = View.GONE |
83 | ivSort91.visibility = View.GONE | 93 | ivSort91.visibility = View.GONE |
84 | ivSort19.visibility = View.GONE | 94 | ivSort19.visibility = View.GONE |
85 | txtDeposito.visibility = View.VISIBLE | 95 | txtDeposito.visibility = View.VISIBLE |
86 | cbVentas.visibility = View.GONE | 96 | cbVentas.visibility = View.GONE |
87 | cbDeposito.visibility = View.GONE | 97 | cbDeposito.visibility = View.GONE |
88 | tvTipo.visibility = View.GONE | 98 | tvTipo.visibility = View.GONE |
89 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | 99 | tvInvDinamicos.text = |
100 | "Inventarios Dinamicos ($cantidadInventarios) +" | ||
90 | } | 101 | } |
91 | } | 102 | } |
92 | ivSort19.setOnClickListener { | 103 | ivSort19.setOnClickListener { |
93 | ordenado= inventarios.sortedByDescending { | 104 | ordenado = inventarios.sortedByDescending { |
94 | it.invNum | 105 | it.invNum |
95 | } | 106 | } |
96 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 107 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
97 | viewManager = LinearLayoutManager(requireContext()) | 108 | viewManager = LinearLayoutManager(requireContext()) |
98 | 109 | ||
99 | rcInventario.apply { | 110 | rcInventario.apply { |
100 | adapter = viewAdapter | 111 | adapter = viewAdapter |
101 | layoutManager = viewManager | 112 | layoutManager = viewManager |
102 | } | 113 | } |
103 | viewAdapter.notifyDataSetChanged() | 114 | viewAdapter.notifyDataSetChanged() |
104 | ivSort19.visibility=View.INVISIBLE | 115 | ivSort19.visibility = View.INVISIBLE |
105 | ivSort91.visibility=View.VISIBLE | 116 | ivSort91.visibility = View.VISIBLE |
106 | } | 117 | } |
107 | ivSort91.setOnClickListener { | 118 | ivSort91.setOnClickListener { |
108 | ordenado= inventarios.sortedBy { | 119 | ordenado = inventarios.sortedBy { |
109 | it.invNum | 120 | it.invNum |
110 | } | 121 | } |
111 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 122 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
112 | viewManager = LinearLayoutManager(requireContext()) | 123 | viewManager = LinearLayoutManager(requireContext()) |
113 | 124 | ||
114 | rcInventario.apply { | 125 | rcInventario.apply { |
115 | adapter = viewAdapter | 126 | adapter = viewAdapter |
116 | layoutManager = viewManager | 127 | layoutManager = viewManager |
117 | } | 128 | } |
118 | viewAdapter.notifyDataSetChanged() | 129 | viewAdapter.notifyDataSetChanged() |
119 | ivSort91.visibility=View.INVISIBLE | 130 | ivSort91.visibility = View.INVISIBLE |
120 | ivSort19.visibility=View.VISIBLE | 131 | ivSort19.visibility = View.VISIBLE |
121 | } | 132 | } |
122 | } | 133 | } |
134 | |||
135 | // cbVentas.setOnClickListener { | ||
136 | // if (cbVentas.isChecked) { | ||
137 | // rcInventario.apply { | ||
138 | // adapter = viewAdapter | ||
139 | // layoutManager = viewManager | ||
140 | // } | ||
141 | // adapterFilter. | ||
142 | // adapterFilter?.filter?.filter("Deposito") | ||
143 | // adapterFilter?.notifyDataSetChanged() | ||
144 | // viewAdapter.notifyDataSetChanged() | ||
145 | // } | ||
146 | // } | ||
123 | return v | 147 | return v |
124 | } | 148 | } |
125 | 149 | ||
126 | suspend fun buscarEnBDInvHead(): List<InvHead> { | 150 | suspend fun buscarEnBDInvHead(): List<InvHead> { |
127 | //TODO BUSQUEDA POR DESCRIPCION | 151 | //TODO BUSQUEDA POR DESCRIPCION |
128 | var busqueda: List<InvHead> | 152 | var busqueda: List<InvHead> |
129 | return GlobalScope.async(Dispatchers.IO) { | 153 | return GlobalScope.async(Dispatchers.IO) { |
130 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | 154 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() |
131 | return@async busqueda | 155 | return@async busqueda |
132 | }.await() | 156 | }.await() |
133 | } | 157 | } |
134 | 158 | ||
135 | fun cargarRecicler(inv: InvHead) { | 159 | fun cargarRecicler(inv: InvHead) { |
136 | //TODO CARGO EN LE RV | 160 | //TODO CARGO EN LE RV |
137 | 161 | ||
138 | // val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | 162 | // val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() |
139 | // val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | 163 | // val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") |
140 | 164 | ||
141 | // listIvn.add(item) | 165 | // listIvn.add(item) |
142 | listIvn2.add(inv) | 166 | listIvn2.add(inv) |
143 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) | 167 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) |
144 | viewManager = LinearLayoutManager(requireContext()) | 168 | viewManager = LinearLayoutManager(requireContext()) |
145 | 169 | ||
146 | rcInventario.apply { | 170 | rcInventario.apply { |
147 | adapter = viewAdapter | 171 | adapter = viewAdapter |
148 | layoutManager = viewManager | 172 | layoutManager = viewManager |
149 | } | 173 | } |
150 | } | 174 | } |
151 | 175 | ||
152 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 176 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
153 | super.onViewCreated(view, savedInstanceState) | 177 | super.onViewCreated(view, savedInstanceState) |
154 | navController = Navigation.findNavController(view) | 178 | navController = Navigation.findNavController(view) |
155 | listIvn2.clear() | 179 | listIvn2.clear() |
156 | } | 180 | } |
157 | 181 | ||
158 | override fun onItemClick(inventario: String?) { | 182 | override fun onItemClick(inventario: String?) { |
159 | 183 | ||
160 | val editor = sharedPreferences.edit() | 184 | val editor = sharedPreferences.edit() |
161 | // var invSel: String = inventario.toString() | 185 | // var invSel: String = inventario.toString() |
162 | // invSel = invSel.substring(3, 5) | 186 | // invSel = invSel.substring(3, 5) |
163 | editor?.putString("Inventario", inventario) | 187 | editor?.putString("Inventario", inventario) |
164 | editor?.apply() | 188 | editor?.apply() |
165 | editor.commit() | 189 | editor.commit() |
166 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | 190 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) |
167 | } | 191 | } |
168 | 192 | ||
169 | 193 | ||
170 | } | 194 | } |
171 | 195 |
app/src/main/res/layout/fragment_codigo_ori.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | |||
3 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
4 | xmlns:app="http://schemas.android.com/apk/res-auto" | ||
5 | xmlns:tools="http://schemas.android.com/tools" | ||
6 | android:layout_width="match_parent" | ||
7 | android:layout_height="match_parent" | ||
8 | tools:context=".UI.descripcionFragment.DescripcionFragment"> | ||
9 | |||
10 | <androidx.recyclerview.widget.RecyclerView | ||
11 | android:id="@+id/rcCodigoOri" | ||
12 | android:layout_width="match_parent" | ||
13 | android:layout_height="0dp" | ||
14 | android:background="@android:color/darker_gray" | ||
15 | android:scrollbars="vertical" | ||
16 | app:layout_constraintBottom_toTopOf="@+id/guideline6" | ||
17 | app:layout_constraintEnd_toEndOf="parent" | ||
18 | app:layout_constraintStart_toStartOf="parent" | ||
19 | app:layout_constraintTop_toBottomOf="@id/guideline4" | ||
20 | tools:listitem="@layout/item_codigo_origen" /> | ||
21 | |||
22 | <!-- <Button--> | ||
23 | <!-- android:id="@+id/btnSalir"--> | ||
24 | <!-- android:layout_width="0dp"--> | ||
25 | <!-- android:layout_height="wrap_content"--> | ||
26 | <!-- android:text="@string/btnCancelar"--> | ||
27 | <!-- android:textColor="@android:color/white"--> | ||
28 | <!-- android:padding="10dp"--> | ||
29 | <!-- android:background="@drawable/boton_borde_redondeado"--> | ||
30 | <!-- app:layout_constraintBottom_toBottomOf="@+id/guideline6"--> | ||
31 | <!-- app:layout_constraintEnd_toEndOf="parent"--> | ||
32 | <!-- app:layout_constraintHorizontal_chainStyle="spread"--> | ||
33 | <!-- app:layout_constraintStart_toStartOf="parent"--> | ||
34 | <!-- app:layout_constraintTop_toBottomOf="@+id/rcInventarios" />--> | ||
35 | |||
36 | <androidx.constraintlayout.widget.Guideline | ||
37 | android:id="@+id/guideline4" | ||
38 | android:layout_width="wrap_content" | ||
39 | android:layout_height="wrap_content" | ||
40 | android:orientation="horizontal" | ||
41 | app:layout_constraintGuide_percent="0.06" /> | ||
42 | |||
43 | <androidx.constraintlayout.widget.Guideline | ||
44 | android:id="@+id/guideline5" | ||
45 | android:layout_width="wrap_content" | ||
46 | android:layout_height="wrap_content" | ||
47 | android:orientation="horizontal" | ||
48 | app:layout_constraintGuide_percent="0.88" /> | ||
49 | |||
50 | <androidx.constraintlayout.widget.Guideline | ||
51 | android:id="@+id/guideline6" | ||
52 | android:layout_width="wrap_content" | ||
53 | android:layout_height="wrap_content" | ||
54 | android:orientation="horizontal" | ||
55 | app:layout_constraintGuide_percent="0.97" /> | ||
56 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/fragment_descripcion.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | ||
3 | 3 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | <androidx.constraintlayout.widget.ConstraintLayout | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | xmlns:android="http://schemas.android.com/apk/res/android" | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | xmlns:app="http://schemas.android.com/apk/res-auto" | 6 | android:layout_width="match_parent" |
7 | xmlns:tools="http://schemas.android.com/tools" | 7 | android:layout_height="match_parent" |
8 | android:layout_width="match_parent" | 8 | tools:context=".UI.descripcionFragment.DescripcionFragment"> |
9 | android:layout_height="match_parent" | ||
10 | tools:context=".UI.descripcionFragment.DescripcionFragment"> | ||
11 | |||
12 | 9 | ||
13 | <androidx.recyclerview.widget.RecyclerView | 10 | <androidx.recyclerview.widget.RecyclerView |
14 | android:id="@+id/rcDescripcion" | 11 | android:id="@+id/rcDescripcion" |
15 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
16 | android:layout_height="0dp" | 13 | android:layout_height="0dp" |
17 | android:background="@android:color/darker_gray" | 14 | android:background="@android:color/darker_gray" |
18 | android:scrollbars="vertical" | 15 | android:scrollbars="vertical" |
19 | app:layout_constraintTop_toBottomOf="@id/guideline4" | ||
20 | app:layout_constraintBottom_toTopOf="@+id/guideline6" | 16 | app:layout_constraintBottom_toTopOf="@+id/guideline6" |
21 | app:layout_constraintEnd_toEndOf="parent" | 17 | app:layout_constraintEnd_toEndOf="parent" |
22 | app:layout_constraintStart_toStartOf="parent" | 18 | app:layout_constraintStart_toStartOf="parent" |
19 | app:layout_constraintTop_toBottomOf="@id/guideline4" | ||
23 | tools:listitem="@layout/item" /> | 20 | tools:listitem="@layout/item" /> |
24 | 21 | ||
25 | <!-- <Button--> | 22 | <!-- <Button--> |
26 | <!-- android:id="@+id/btnSalir"--> | 23 | <!-- android:id="@+id/btnSalir"--> |
27 | <!-- android:layout_width="0dp"--> | 24 | <!-- android:layout_width="0dp"--> |
28 | <!-- android:layout_height="wrap_content"--> | 25 | <!-- android:layout_height="wrap_content"--> |
29 | <!-- android:text="@string/btnCancelar"--> | 26 | <!-- android:text="@string/btnCancelar"--> |
30 | <!-- android:textColor="@android:color/white"--> | 27 | <!-- android:textColor="@android:color/white"--> |
31 | <!-- android:padding="10dp"--> | 28 | <!-- android:padding="10dp"--> |
32 | <!-- android:background="@drawable/boton_borde_redondeado"--> | 29 | <!-- android:background="@drawable/boton_borde_redondeado"--> |
33 | <!-- app:layout_constraintBottom_toBottomOf="@+id/guideline6"--> | 30 | <!-- app:layout_constraintBottom_toBottomOf="@+id/guideline6"--> |
34 | <!-- app:layout_constraintEnd_toEndOf="parent"--> | 31 | <!-- app:layout_constraintEnd_toEndOf="parent"--> |
35 | <!-- app:layout_constraintHorizontal_chainStyle="spread"--> | 32 | <!-- app:layout_constraintHorizontal_chainStyle="spread"--> |
36 | <!-- app:layout_constraintStart_toStartOf="parent"--> | 33 | <!-- app:layout_constraintStart_toStartOf="parent"--> |
37 | <!-- app:layout_constraintTop_toBottomOf="@+id/rcInventarios" />--> | 34 | <!-- app:layout_constraintTop_toBottomOf="@+id/rcInventarios" />--> |
38 | 35 | ||
39 | <androidx.constraintlayout.widget.Guideline | 36 | <androidx.constraintlayout.widget.Guideline |
40 | android:id="@+id/guideline4" | 37 | android:id="@+id/guideline4" |
41 | android:layout_width="wrap_content" | 38 | android:layout_width="wrap_content" |
42 | android:layout_height="wrap_content" | 39 | android:layout_height="wrap_content" |
43 | android:orientation="horizontal" | 40 | android:orientation="horizontal" |
44 | app:layout_constraintGuide_percent="0.06" /> | 41 | app:layout_constraintGuide_percent="0.06" /> |
45 | 42 | ||
46 | <androidx.constraintlayout.widget.Guideline | 43 | <androidx.constraintlayout.widget.Guideline |
47 | android:id="@+id/guideline5" | 44 | android:id="@+id/guideline5" |
48 | android:layout_width="wrap_content" | 45 | android:layout_width="wrap_content" |
49 | android:layout_height="wrap_content" | 46 | android:layout_height="wrap_content" |
50 | android:orientation="horizontal" | 47 | android:orientation="horizontal" |
51 | app:layout_constraintGuide_percent="0.88" /> | 48 | app:layout_constraintGuide_percent="0.88" /> |
52 | 49 | ||
53 | <androidx.constraintlayout.widget.Guideline | 50 | <androidx.constraintlayout.widget.Guideline |
54 | android:id="@+id/guideline6" | 51 | android:id="@+id/guideline6" |
55 | android:layout_width="wrap_content" | 52 | android:layout_width="wrap_content" |
56 | android:layout_height="wrap_content" | 53 | android:layout_height="wrap_content" |
57 | android:orientation="horizontal" | 54 | android:orientation="horizontal" |
58 | app:layout_constraintGuide_percent="0.97" /> | 55 | app:layout_constraintGuide_percent="0.97" /> |
59 | </androidx.constraintlayout.widget.ConstraintLayout> | 56 | </androidx.constraintlayout.widget.ConstraintLayout> |
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="4dp" |
17 | app:cardElevation="4dp" | 17 | app:cardElevation="4dp" |
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" |
33 | android:text="Detalle del artículo" | 33 | android:text="Detalle del artículo" |
34 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 34 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
35 | android:textSize="@dimen/Titulos" | 35 | android:textSize="@dimen/Titulos" |
36 | android:textStyle="bold" | 36 | android:textStyle="bold" |
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_toTopOf="parent" /> | 39 | app:layout_constraintTop_toTopOf="parent" /> |
40 | 40 | ||
41 | <TextView | 41 | <TextView |
42 | android:id="@+id/textView19" | 42 | android:id="@+id/textView19" |
43 | android:layout_width="wrap_content" | 43 | android:layout_width="wrap_content" |
44 | android:layout_height="wrap_content" | 44 | android:layout_height="wrap_content" |
45 | android:layout_marginStart="5dp" | 45 | android:layout_marginStart="5dp" |
46 | android:layout_marginTop="10dp" | 46 | android:layout_marginTop="10dp" |
47 | android:text="Sector:" | 47 | android:text="Sector:" |
48 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 48 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
49 | android:textSize="14sp" | 49 | android:textSize="15sp" |
50 | app:layout_constraintEnd_toStartOf="@id/tvSector" | 50 | app:layout_constraintEnd_toStartOf="@id/tvSector" |
51 | app:layout_constraintStart_toStartOf="parent" | 51 | app:layout_constraintStart_toStartOf="parent" |
52 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | 52 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> |
53 | 53 | ||
54 | <TextView | 54 | <TextView |
55 | android:id="@+id/tvSector" | 55 | android:id="@+id/tvSector" |
56 | android:layout_width="0dp" | 56 | android:layout_width="0dp" |
57 | android:layout_height="wrap_content" | 57 | android:layout_height="wrap_content" |
58 | android:layout_marginTop="10dp" | ||
59 | android:text="" | 58 | android:text="" |
60 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 59 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
61 | android:textSize="14sp" | 60 | android:textSize="18sp" |
61 | app:layout_constraintBaseline_toBaselineOf="@+id/textView19" | ||
62 | app:layout_constraintEnd_toStartOf="@id/textView18" | 62 | app:layout_constraintEnd_toStartOf="@id/textView18" |
63 | app:layout_constraintStart_toEndOf="@id/textView19" | 63 | app:layout_constraintStart_toEndOf="@id/textView19" /> |
64 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
65 | 64 | ||
66 | <TextView | 65 | <TextView |
67 | android:id="@+id/textView18" | 66 | android:id="@+id/textView18" |
68 | android:layout_width="wrap_content" | 67 | android:layout_width="wrap_content" |
69 | android:layout_height="wrap_content" | 68 | android:layout_height="wrap_content" |
70 | android:layout_marginTop="10dp" | 69 | android:layout_marginTop="10dp" |
71 | android:text="Código:" | 70 | android:text="Código:" |
72 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 71 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
73 | android:textSize="14sp" | 72 | android:textSize="15sp" |
74 | app:layout_constraintEnd_toStartOf="@id/tvCodigo" | 73 | app:layout_constraintEnd_toStartOf="@id/tvCodigo" |
75 | app:layout_constraintStart_toEndOf="@id/tvSector" | 74 | app:layout_constraintStart_toEndOf="@id/tvSector" |
76 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | 75 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> |
77 | 76 | ||
78 | <TextView | 77 | <TextView |
79 | android:id="@+id/tvCodigo" | 78 | android:id="@+id/tvCodigo" |
80 | android:layout_width="0dp" | 79 | android:layout_width="0dp" |
81 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" |
82 | android:layout_marginTop="10dp" | ||
83 | android:text="" | 81 | android:text="" |
84 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 82 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
85 | android:textSize="14sp" | 83 | android:textSize="18sp" |
84 | app:layout_constraintBaseline_toBaselineOf="@+id/textView18" | ||
86 | app:layout_constraintEnd_toStartOf="@+id/textView3" | 85 | app:layout_constraintEnd_toStartOf="@+id/textView3" |
87 | app:layout_constraintStart_toEndOf="@id/textView18" | 86 | app:layout_constraintStart_toEndOf="@id/textView18" /> |
88 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
89 | 87 | ||
90 | <TextView | 88 | <TextView |
91 | android:id="@+id/textView3" | 89 | android:id="@+id/textView3" |
92 | android:layout_width="wrap_content" | 90 | android:layout_width="wrap_content" |
93 | android:layout_height="wrap_content" | 91 | android:layout_height="wrap_content" |
94 | android:layout_marginTop="10dp" | 92 | android:layout_marginTop="10dp" |
95 | android:text="Depósito:" | 93 | android:text="Depósito:" |
96 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 94 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
97 | android:textSize="14sp" | 95 | android:textSize="15sp" |
98 | app:layout_constraintEnd_toStartOf="@id/tvDeposito" | 96 | app:layout_constraintEnd_toStartOf="@id/tvDeposito" |
99 | app:layout_constraintStart_toEndOf="@id/tvCodigo" | 97 | app:layout_constraintStart_toEndOf="@id/tvCodigo" |
100 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | 98 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> |
101 | 99 | ||
102 | <TextView | 100 | <TextView |
103 | android:id="@+id/tvDeposito" | 101 | android:id="@+id/tvDeposito" |
104 | android:layout_width="0dp" | 102 | android:layout_width="0dp" |
105 | android:layout_height="wrap_content" | 103 | android:layout_height="wrap_content" |
106 | android:layout_marginTop="10dp" | ||
107 | android:text="" | 104 | android:text="" |
108 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 105 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
109 | android:textSize="14sp" | 106 | android:textSize="18sp" |
107 | app:layout_constraintBaseline_toBaselineOf="@+id/textView3" | ||
110 | app:layout_constraintEnd_toEndOf="parent" | 108 | app:layout_constraintEnd_toEndOf="parent" |
111 | app:layout_constraintStart_toEndOf="@id/textView3" | 109 | app:layout_constraintStart_toEndOf="@id/textView3" /> |
112 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
113 | 110 | ||
114 | <TextView | 111 | <TextView |
115 | android:id="@+id/textView6" | 112 | android:id="@+id/textView6" |
116 | android:layout_width="wrap_content" | 113 | android:layout_width="wrap_content" |
117 | android:layout_height="wrap_content" | 114 | android:layout_height="wrap_content" |
118 | android:layout_marginStart="5dp" | 115 | android:layout_marginStart="5dp" |
119 | android:layout_marginTop="10dp" | 116 | android:layout_marginTop="10dp" |
120 | android:text="Descripción:" | 117 | android:text="Descripción:" |
121 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 118 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
122 | android:textSize="14sp" | 119 | android:textSize="14sp" |
123 | app:layout_constraintEnd_toStartOf="@id/tvDescripcion" | 120 | app:layout_constraintEnd_toStartOf="@id/tvDescripcion" |
124 | app:layout_constraintStart_toStartOf="parent" | 121 | app:layout_constraintStart_toStartOf="parent" |
125 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 122 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
126 | 123 | ||
127 | <TextView | 124 | <TextView |
128 | android:id="@+id/tvDescripcion" | 125 | android:id="@+id/tvDescripcion" |
129 | android:layout_width="0dp" | 126 | android:layout_width="0dp" |
130 | android:layout_height="wrap_content" | 127 | android:layout_height="wrap_content" |
131 | android:layout_marginStart="5dp" | 128 | android:layout_marginStart="5dp" |
132 | android:layout_marginTop="10dp" | 129 | android:layout_marginTop="10dp" |
133 | android:lines="2" | 130 | android:lines="2" |
134 | android:text="" | 131 | android:text="" |
135 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 132 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
136 | android:textSize="14sp" | 133 | android:textSize="18sp" |
137 | app:layout_constraintEnd_toEndOf="parent" | 134 | app:layout_constraintEnd_toEndOf="parent" |
138 | app:layout_constraintStart_toEndOf="@+id/textView6" | 135 | app:layout_constraintStart_toEndOf="@+id/textView6" |
139 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 136 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
140 | 137 | ||
141 | <TextView | 138 | <TextView |
142 | android:id="@+id/textView1" | 139 | android:id="@+id/textView1" |
143 | android:layout_width="wrap_content" | 140 | android:layout_width="wrap_content" |
144 | android:layout_height="wrap_content" | 141 | android:layout_height="wrap_content" |
145 | android:layout_marginStart="5dp" | 142 | android:layout_marginStart="5dp" |
146 | android:layout_marginTop="10dp" | 143 | android:layout_marginTop="10dp" |
147 | android:text="C. de barras:" | 144 | android:text="C. de barras:" |
148 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 145 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
149 | android:textSize="14sp" | 146 | android:textSize="15sp" |
150 | app:layout_constraintEnd_toStartOf="@id/tvCodigoBarras" | 147 | app:layout_constraintEnd_toStartOf="@id/tvCodigoBarras" |
151 | app:layout_constraintStart_toStartOf="parent" | 148 | app:layout_constraintStart_toStartOf="parent" |
152 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | 149 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> |
153 | 150 | ||
154 | <TextView | 151 | <TextView |
155 | android:id="@+id/tvCodigoBarras" | 152 | android:id="@+id/tvCodigoBarras" |
156 | android:layout_width="0dp" | 153 | android:layout_width="0dp" |
157 | android:layout_height="wrap_content" | 154 | android:layout_height="wrap_content" |
158 | android:layout_marginTop="10dp" | ||
159 | android:text="" | 155 | android:text="" |
160 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 156 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
161 | android:textSize="14sp" | 157 | android:textSize="18sp" |
158 | app:layout_constraintBaseline_toBaselineOf="@+id/textView1" | ||
162 | app:layout_constraintEnd_toStartOf="@id/textView2" | 159 | app:layout_constraintEnd_toStartOf="@id/textView2" |
163 | app:layout_constraintStart_toEndOf="@id/textView1" | 160 | app:layout_constraintStart_toEndOf="@id/textView1" /> |
164 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | ||
165 | 161 | ||
166 | <TextView | 162 | <TextView |
167 | android:id="@+id/textView2" | 163 | android:id="@+id/textView2" |
168 | android:layout_width="wrap_content" | 164 | android:layout_width="wrap_content" |
169 | android:layout_height="wrap_content" | 165 | android:layout_height="wrap_content" |
170 | android:layout_marginTop="10dp" | 166 | android:layout_marginTop="10dp" |
171 | android:text="C. origen:" | 167 | android:text="C. origen:" |
172 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 168 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
173 | android:textSize="14sp" | 169 | android:textSize="15sp" |
174 | app:layout_constraintEnd_toStartOf="@id/tvCodigoOrigen" | 170 | app:layout_constraintEnd_toStartOf="@id/tvCodigoOrigen" |
175 | app:layout_constraintStart_toEndOf="@id/tvCodigoBarras" | 171 | app:layout_constraintStart_toEndOf="@id/tvCodigoBarras" |
176 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | 172 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> |
177 | 173 | ||
178 | <TextView | 174 | <TextView |
179 | android:id="@+id/tvCodigoOrigen" | 175 | android:id="@+id/tvCodigoOrigen" |
180 | android:layout_width="0dp" | 176 | android:layout_width="0dp" |
181 | android:layout_height="wrap_content" | 177 | android:layout_height="wrap_content" |
182 | android:layout_marginTop="10dp" | ||
183 | android:text="" | 178 | android:text="" |
184 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 179 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
185 | android:textSize="14sp" | 180 | android:textSize="18sp" |
181 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" | ||
186 | app:layout_constraintEnd_toEndOf="parent" | 182 | app:layout_constraintEnd_toEndOf="parent" |
187 | app:layout_constraintStart_toEndOf="@id/textView2" | 183 | app:layout_constraintStart_toEndOf="@id/textView2" /> |
188 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | ||
189 | 184 | ||
190 | 185 | ||
191 | <TextView | 186 | <TextView |
192 | android:id="@+id/textView5" | 187 | android:id="@+id/textView5" |
193 | android:layout_width="wrap_content" | 188 | android:layout_width="wrap_content" |
194 | android:layout_height="wrap_content" | 189 | android:layout_height="wrap_content" |
195 | android:layout_marginStart="5dp" | 190 | android:layout_marginStart="5dp" |
196 | android:layout_marginTop="10dp" | 191 | android:layout_marginTop="10dp" |
197 | android:text="Exi.venta:" | 192 | android:text="Exi.venta:" |
198 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 193 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
199 | android:textSize="14sp" | 194 | android:textSize="15sp" |
200 | app:layout_constraintEnd_toStartOf="@id/tvExiVenta" | 195 | app:layout_constraintEnd_toStartOf="@id/tvExiVenta" |
201 | app:layout_constraintStart_toStartOf="parent" | 196 | app:layout_constraintStart_toStartOf="parent" |
202 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | 197 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> |
203 | 198 | ||
204 | <TextView | 199 | <TextView |
205 | android:id="@+id/tvExiVenta" | 200 | android:id="@+id/tvExiVenta" |
206 | android:layout_width="0dp" | 201 | android:layout_width="0dp" |
207 | android:layout_height="wrap_content" | 202 | android:layout_height="wrap_content" |
208 | android:layout_marginTop="10dp" | ||
209 | android:text="" | 203 | android:text="" |
210 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 204 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
211 | android:textSize="14sp" | 205 | android:textSize="18sp" |
206 | app:layout_constraintBaseline_toBaselineOf="@+id/textView5" | ||
212 | app:layout_constraintEnd_toStartOf="@id/textView7" | 207 | app:layout_constraintEnd_toStartOf="@id/textView7" |
213 | app:layout_constraintStart_toEndOf="@id/textView5" | 208 | app:layout_constraintStart_toEndOf="@id/textView5" /> |
214 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | ||
215 | 209 | ||
216 | <TextView | 210 | <TextView |
217 | android:id="@+id/textView7" | 211 | android:id="@+id/textView7" |
218 | android:layout_width="wrap_content" | 212 | android:layout_width="wrap_content" |
219 | android:layout_height="wrap_content" | 213 | android:layout_height="wrap_content" |
220 | android:layout_marginTop="10dp" | 214 | android:layout_marginTop="10dp" |
221 | android:text="Exi.dep:" | 215 | android:text="Exi.dep:" |
222 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 216 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
223 | android:textSize="14sp" | 217 | android:textSize="15sp" |
224 | app:layout_constraintEnd_toStartOf="@id/tvExiDeposito" | 218 | app:layout_constraintEnd_toStartOf="@id/tvExiDeposito" |
225 | app:layout_constraintStart_toEndOf="@id/tvExiVenta" | 219 | app:layout_constraintStart_toEndOf="@id/tvExiVenta" |
226 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | 220 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> |
227 | 221 | ||
228 | <TextView | 222 | <TextView |
229 | android:id="@+id/tvExiDeposito" | 223 | android:id="@+id/tvExiDeposito" |
230 | android:layout_width="0dp" | 224 | android:layout_width="0dp" |
231 | android:layout_height="wrap_content" | 225 | android:layout_height="wrap_content" |
232 | android:layout_marginTop="10dp" | ||
233 | android:text="" | 226 | android:text="" |
234 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 227 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
235 | android:textSize="14sp" | 228 | android:textSize="18sp" |
236 | app:layout_constraintEnd_toStartOf="@+id/textView8" | 229 | app:layout_constraintBaseline_toBaselineOf="@+id/textView7" |
237 | app:layout_constraintStart_toEndOf="@id/textView7" | 230 | app:layout_constraintEnd_toStartOf="@+id/textView9" |
238 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | 231 | app:layout_constraintStart_toEndOf="@id/textView7" /> |
239 | 232 | ||
240 | <TextView | 233 | <TextView |
241 | android:id="@+id/textView8" | 234 | android:id="@+id/textView9" |
242 | android:layout_width="wrap_content" | 235 | android:layout_width="wrap_content" |
243 | android:layout_height="wrap_content" | 236 | android:layout_height="wrap_content" |
244 | android:layout_marginTop="10dp" | 237 | android:layout_marginTop="10dp" |
245 | android:text="Bal:" | 238 | android:text="Precio:" |
246 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 239 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
247 | android:textSize="14sp" | 240 | android:textSize="15sp" |
248 | app:layout_constraintEnd_toStartOf="@id/tvBal" | 241 | app:layout_constraintEnd_toStartOf="@id/tvPrecio" |
249 | app:layout_constraintStart_toEndOf="@id/tvExiDeposito" | 242 | app:layout_constraintStart_toEndOf="@id/tvExiDeposito" |
250 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | 243 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
251 | 244 | ||
252 | <TextView | 245 | <TextView |
253 | android:id="@+id/tvBal" | 246 | android:id="@+id/tvPrecio" |
254 | android:layout_width="0dp" | 247 | android:layout_width="0dp" |
255 | android:layout_height="wrap_content" | 248 | android:layout_height="wrap_content" |
256 | android:layout_marginTop="10dp" | ||
257 | android:text="" | 249 | android:text="" |
258 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 250 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
259 | android:textSize="14sp" | 251 | android:textSize="18sp" |
260 | app:layout_constraintEnd_toStartOf="@+id/textView9" | 252 | app:layout_constraintBaseline_toBaselineOf="@+id/textView9" |
261 | app:layout_constraintStart_toEndOf="@id/textView8" | 253 | app:layout_constraintEnd_toEndOf="parent" |
262 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | 254 | app:layout_constraintStart_toEndOf="@id/textView9" /> |
255 | <TextView | ||
256 | android:id="@+id/textView8" | ||
257 | android:layout_width="wrap_content" | ||
258 | android:layout_height="wrap_content" | ||
259 | android:layout_marginStart="5dp" | ||
260 | android:layout_marginTop="10dp" | ||
261 | android:text="Costo:" | ||
262 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
263 | android:textSize="15sp" | ||
264 | app:layout_constraintEnd_toStartOf="@+id/tvCosto" | ||
265 | app:layout_constraintStart_toStartOf="parent" | ||
266 | app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" /> | ||
263 | 267 | ||
264 | <TextView | 268 | <TextView |
265 | android:id="@+id/textView9" | 269 | android:id="@+id/tvCosto" |
270 | android:layout_width="wrap_content" | ||
271 | android:layout_height="wrap_content" | ||
272 | android:text="22.99" | ||
273 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
274 | android:textSize="18sp" | ||
275 | app:layout_constraintBaseline_toBaselineOf="@+id/textView8" | ||
276 | app:layout_constraintEnd_toStartOf="@+id/textView10" | ||
277 | app:layout_constraintStart_toEndOf="@+id/textView8" | ||
278 | app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" /> | ||
279 | |||
280 | <TextView | ||
281 | android:id="@+id/textView10" | ||
266 | android:layout_width="wrap_content" | 282 | android:layout_width="wrap_content" |
267 | android:layout_height="wrap_content" | 283 | android:layout_height="wrap_content" |
284 | android:layout_marginStart="5dp" | ||
268 | android:layout_marginTop="10dp" | 285 | android:layout_marginTop="10dp" |
269 | android:text="De:" | 286 | android:text="Unidad de Venta:" |
270 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 287 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
271 | android:textSize="14sp" | 288 | android:textSize="15sp" |
272 | app:layout_constraintEnd_toStartOf="@id/tvDE" | 289 | app:layout_constraintEnd_toStartOf="@id/tvBal" |
273 | app:layout_constraintStart_toEndOf="@id/tvBal" | 290 | app:layout_constraintStart_toEndOf="@id/tvCosto" |
274 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | 291 | app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" /> |
275 | 292 | ||
276 | <TextView | 293 | <TextView |
277 | android:id="@+id/tvDE" | 294 | android:id="@+id/tvBal" |
278 | android:layout_width="0dp" | 295 | android:layout_width="0dp" |
279 | android:layout_height="wrap_content" | 296 | android:layout_height="wrap_content" |
280 | android:layout_marginTop="10dp" | 297 | android:text="CENT. CUBICOS" |
281 | android:text="" | ||
282 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 298 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
283 | android:textSize="14sp" | 299 | android:textSize="18sp" |
300 | app:layout_constraintBaseline_toBaselineOf="@+id/textView10" | ||
284 | app:layout_constraintEnd_toEndOf="parent" | 301 | app:layout_constraintEnd_toEndOf="parent" |
285 | app:layout_constraintStart_toEndOf="@id/textView9" | 302 | app:layout_constraintStart_toEndOf="@+id/textView10" /> |
286 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | ||
287 | 303 | ||
288 | 304 | ||
289 | <TextView | 305 | <TextView |
290 | android:id="@+id/textView10" | 306 | android:id="@+id/textView11" |
291 | android:layout_width="wrap_content" | 307 | android:layout_width="wrap_content" |
292 | android:layout_height="wrap_content" | 308 | android:layout_height="wrap_content" |
293 | android:layout_marginTop="10dp" | 309 | android:layout_marginStart="5dp" |
310 | android:layout_marginTop="8dp" | ||
294 | android:text="Imagen:" | 311 | android:text="Imagen:" |
295 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 312 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
296 | android:textSize="14sp" | 313 | android:textSize="14sp" |
297 | app:layout_constraintEnd_toStartOf="@id/tvDE" | 314 | app:layout_constraintHorizontal_bias="0.47" |
298 | app:layout_constraintHorizontal_bias="0.0" | ||
299 | app:layout_constraintStart_toStartOf="parent" | 315 | app:layout_constraintStart_toStartOf="parent" |
300 | app:layout_constraintTop_toBottomOf="@+id/tvDE" /> | 316 | app:layout_constraintTop_toBottomOf="@+id/textView8" /> |
301 | 317 | ||
302 | <ImageView | 318 | <ImageView |
303 | android:id="@+id/ivImagen" | 319 | android:id="@+id/ivImagen" |
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 | |||
56 | <EditText | 55 | <EditText |
57 | android:id="@+id/etCantidad" | 56 | android:id="@+id/etCantidad" |
58 | android:layout_width="match_parent" | 57 | android:layout_width="match_parent" |
59 | android:layout_height="wrap_content" | 58 | android:layout_height="wrap_content" |
59 | android:clickable="true" | ||
60 | android:ems="10" | 60 | android:ems="10" |
61 | android:gravity="center" | ||
62 | android:textSize="20sp" | ||
63 | android:focusable="true" | 61 | android:focusable="true" |
64 | android:clickable="true" | 62 | android:gravity="center" |
65 | android:inputType="numberDecimal" | 63 | android:inputType="numberDecimal" |
66 | android:text="" /> | 64 | android:maxLength="8" |
65 | android:text="" | ||
66 | android:textSize="20sp" /> | ||
67 | 67 | ||
68 | 68 | ||
69 | <androidx.appcompat.widget.AppCompatButton | 69 | <androidx.appcompat.widget.AppCompatButton |
70 | android:id="@+id/btnAceptar" | 70 | android:id="@+id/btnAceptar" |
71 | android:layout_width="match_parent" | 71 | android:layout_width="match_parent" |
72 | android:layout_height="wrap_content" | 72 | android:layout_height="wrap_content" |
73 | android:layout_margin="10dp" | 73 | android:layout_margin="10dp" |
74 | android:layout_marginBottom="20dp" | 74 | android:layout_marginBottom="20dp" |
75 | android:clickable="true" | 75 | android:clickable="true" |
76 | android:focusable="true" | 76 | android:focusable="true" |
77 | android:textColor="@android:color/white" | 77 | android:textColor="@android:color/white" |
78 | android:padding="10dp" | 78 | android:padding="10dp" |
79 | android:background="@drawable/boton_borde_redondeado" | 79 | android:background="@drawable/boton_borde_redondeado" |
80 | android:text="@string/btnConfirmar" | 80 | android:text="@string/btnOk" |
81 | android:textAlignment="center" | 81 | android:textAlignment="center" |
82 | android:textSize="20sp" | 82 | android:textSize="20sp" |
83 | android:textStyle="bold" | 83 | android:textStyle="bold" |
84 | app:cardBackgroundColor="@android:color/darker_gray" | 84 | app:cardBackgroundColor="@android:color/darker_gray" |
85 | app:cardUseCompatPadding="true" /> | 85 | app:cardUseCompatPadding="true" /> |
86 | 86 | ||
87 | 87 | ||
88 | </LinearLayout> | 88 | </LinearLayout> |
89 | 89 |
app/src/main/res/layout/item.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 | 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 | android:layout_margin="5dp" | 7 | android:layout_margin="5dp" |
8 | app:cardCornerRadius="2dp" | 8 | app:cardCornerRadius="2dp" |
9 | app:cardElevation="10dp" | 9 | app:cardElevation="10dp" |
10 | app:contentPadding="5dp" | 10 | app:contentPadding="5dp" |
11 | app:cardPreventCornerOverlap="false"> | 11 | app:cardPreventCornerOverlap="false"> |
12 | 12 | ||
13 | <androidx.constraintlayout.widget.ConstraintLayout | 13 | <androidx.constraintlayout.widget.ConstraintLayout |
14 | android:layout_width="match_parent" | 14 | android:layout_width="match_parent" |
15 | android:layout_height="wrap_content"> | 15 | android:layout_height="wrap_content"> |
16 | 16 | ||
17 | <TextView | 17 | <TextView |
18 | android:id="@+id/textView2" | 18 | android:id="@+id/textView2" |
19 | android:layout_width="wrap_content" | 19 | android:layout_width="wrap_content" |
20 | android:layout_height="wrap_content" | 20 | android:layout_height="wrap_content" |
21 | android:layout_marginStart="5dp" | 21 | android:layout_marginStart="5dp" |
22 | android:text="Código:" | 22 | android:text="Código:" |
23 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 23 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
24 | android:textSize="14sp" | 24 | android:textSize="14sp" |
25 | app:layout_constraintEnd_toStartOf="@+id/tvSector" | 25 | app:layout_constraintEnd_toStartOf="@+id/tvSector" |
26 | app:layout_constraintHorizontal_bias="0.01" | 26 | app:layout_constraintHorizontal_bias="0.01" |
27 | app:layout_constraintHorizontal_chainStyle="packed" | 27 | app:layout_constraintHorizontal_chainStyle="packed" |
28 | app:layout_constraintStart_toStartOf="parent" | 28 | app:layout_constraintStart_toStartOf="parent" |
29 | app:layout_constraintTop_toTopOf="parent" /> | 29 | app:layout_constraintTop_toTopOf="parent" /> |
30 | 30 | ||
31 | 31 | ||
32 | <TextView | 32 | <TextView |
33 | android:id="@+id/tvSector" | 33 | android:id="@+id/tvSector" |
34 | android:layout_width="wrap_content" | 34 | android:layout_width="wrap_content" |
35 | android:layout_height="match_parent" | 35 | android:layout_height="match_parent" |
36 | android:layout_marginStart="8dp" | 36 | android:layout_marginStart="8dp" |
37 | android:text="9999" | 37 | android:text="9999" |
38 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 38 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
39 | android:textColorHint="@android:color/black" | 39 | android:textColorHint="@android:color/black" |
40 | android:textSize="14sp" | 40 | android:textSize="18sp" |
41 | android:textStyle="bold" | 41 | android:textStyle="bold" |
42 | app:layout_constraintHorizontal_chainStyle="packed" | 42 | app:layout_constraintHorizontal_chainStyle="packed" |
43 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" | 43 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" |
44 | app:layout_constraintEnd_toStartOf="@+id/tvCodigo" | 44 | app:layout_constraintEnd_toStartOf="@+id/tvCodigo" |
45 | app:layout_constraintStart_toEndOf="@+id/textView2" /> | 45 | app:layout_constraintStart_toEndOf="@+id/textView2" /> |
46 | |||
47 | |||
46 | <TextView | 48 | <TextView |
47 | android:id="@+id/tvCodigo" | 49 | android:id="@+id/tvCodigo" |
48 | android:layout_width="wrap_content" | 50 | android:layout_width="wrap_content" |
49 | android:layout_height="match_parent" | 51 | android:layout_height="match_parent" |
50 | android:layout_marginStart="8dp" | ||
51 | android:text="99999999" | 52 | android:text="99999999" |
53 | android:layout_marginStart="8dp" | ||
52 | app:layout_constraintHorizontal_chainStyle="packed" | 54 | app:layout_constraintHorizontal_chainStyle="packed" |
53 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 55 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
54 | android:textColorHint="@android:color/black" | 56 | android:textColorHint="@android:color/black" |
55 | android:textSize="14sp" | 57 | android:textSize="18sp" |
56 | android:textStyle="bold" | 58 | android:textStyle="bold" |
57 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" | 59 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" |
58 | app:layout_constraintEnd_toStartOf="@+id/textView5" | 60 | app:layout_constraintEnd_toStartOf="@+id/textView5" |
59 | app:layout_constraintStart_toEndOf="@+id/tvSector" /> | 61 | app:layout_constraintStart_toEndOf="@+id/tvSector" /> |
60 | 62 | ||
61 | <TextView | 63 | <TextView |
62 | android:id="@+id/textView5" | 64 | android:id="@+id/textView5" |
63 | android:layout_width="wrap_content" | 65 | android:layout_width="wrap_content" |
64 | android:layout_height="wrap_content" | 66 | android:layout_height="wrap_content" |
65 | android:layout_marginStart="8dp" | 67 | android:layout_marginStart="12dp" |
66 | android:text="Cantidad:" | 68 | android:text="Cantidad:" |
67 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 69 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
68 | android:textSize="14sp" | 70 | android:textSize="18sp" |
69 | app:layout_constraintTop_toTopOf="parent" | ||
70 | app:layout_constraintEnd_toStartOf="@+id/tvCodigoBarras" | 71 | app:layout_constraintEnd_toStartOf="@+id/tvCodigoBarras" |
71 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" /> | 72 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" |
73 | app:layout_constraintTop_toTopOf="parent" /> | ||
72 | 74 | ||
73 | <TextView | 75 | <TextView |
74 | android:id="@+id/tvCantidad" | 76 | android:id="@+id/tvCantidad" |
75 | android:layout_width="wrap_content" | 77 | android:layout_width="wrap_content" |
76 | android:layout_height="match_parent" | 78 | android:layout_height="match_parent" |
77 | android:layout_margin="5dp" | 79 | android:layout_margin="5dp" |
78 | android:text="12345.12" | 80 | android:text="12345.12" |
79 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 81 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
80 | android:textSize="14sp" | 82 | android:textSize="18sp" |
81 | android:textStyle="bold" | 83 | android:textStyle="bold" |
82 | app:layout_constraintBaseline_toBaselineOf="@+id/textView5" | 84 | app:layout_constraintBaseline_toBaselineOf="@+id/textView5" |
83 | app:layout_constraintEnd_toEndOf="parent" | 85 | app:layout_constraintEnd_toEndOf="parent" |
84 | app:layout_constraintHorizontal_bias="0.0" | 86 | app:layout_constraintHorizontal_bias="0.0" |
85 | app:layout_constraintStart_toEndOf="@id/textView5" | 87 | app:layout_constraintStart_toEndOf="@id/textView5" |
86 | app:layout_constraintTop_toTopOf="parent" /> | 88 | app:layout_constraintTop_toTopOf="parent" /> |
87 | 89 | ||
88 | <ImageView | 90 | <ImageView |
89 | android:id="@+id/ivPen" | 91 | android:id="@+id/ivPen" |
90 | android:layout_width="30dp" | 92 | android:layout_width="30dp" |
91 | android:layout_height="30dp" | 93 | android:layout_height="30dp" |
92 | android:src="@drawable/pen" | 94 | android:src="@drawable/pen" |
93 | android:visibility="visible" | 95 | android:visibility="visible" |
94 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" | 96 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" |
95 | app:layout_constraintStart_toEndOf="@+id/tvCantidad" | 97 | app:layout_constraintStart_toEndOf="@+id/tvCantidad" |
96 | app:layout_constraintTop_toTopOf="parent" | 98 | app:layout_constraintTop_toTopOf="parent" |
97 | app:layout_constraintVertical_bias="0.0" /> | 99 | app:layout_constraintVertical_bias="0.0" /> |
98 | 100 | ||
99 | <ImageView | 101 | <ImageView |
100 | android:id="@+id/ivDots" | 102 | android:id="@+id/ivDots" |
101 | android:layout_width="30dp" | 103 | android:layout_width="30dp" |
102 | android:layout_height="30dp" | 104 | android:layout_height="30dp" |
103 | android:src="@drawable/more" | 105 | android:src="@drawable/more" |
104 | android:visibility="visible" | 106 | android:visibility="visible" |
105 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" | 107 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" |
106 | app:layout_constraintEnd_toEndOf="parent" | 108 | app:layout_constraintEnd_toEndOf="parent" |
107 | app:layout_constraintTop_toTopOf="parent" | 109 | app:layout_constraintTop_toTopOf="parent" |
108 | app:layout_constraintVertical_bias="0.0" /> | 110 | app:layout_constraintVertical_bias="0.0" /> |
109 | 111 | ||
110 | <TextView | 112 | <TextView |
111 | android:id="@+id/textView85" | 113 | android:id="@+id/textView85" |
112 | android:layout_width="wrap_content" | 114 | android:layout_width="wrap_content" |
113 | android:layout_height="wrap_content" | 115 | android:layout_height="wrap_content" |
114 | android:layout_marginStart="5dp" | 116 | android:layout_marginStart="5dp" |
115 | android:layout_marginTop="8dp" | 117 | android:layout_marginTop="8dp" |
116 | android:text="Desc:" | 118 | android:text="Desc:" |
117 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 119 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
118 | android:textSize="14sp" | 120 | android:textSize="14sp" |
119 | app:layout_constraintEnd_toStartOf="@+id/tvDescripcion" | 121 | app:layout_constraintEnd_toStartOf="@+id/tvDescripcion" |
120 | app:layout_constraintHorizontal_bias="0.0" | 122 | app:layout_constraintHorizontal_bias="0.0" |
121 | app:layout_constraintHorizontal_chainStyle="packed" | 123 | app:layout_constraintHorizontal_chainStyle="packed" |
122 | app:layout_constraintStart_toStartOf="parent" | 124 | app:layout_constraintStart_toStartOf="parent" |
123 | app:layout_constraintTop_toBottomOf="@id/tvCodigo" /> | 125 | app:layout_constraintTop_toBottomOf="@id/tvCodigo" /> |
124 | 126 | ||
125 | <TextView | 127 | <TextView |
126 | android:id="@+id/tvDescripcion" | 128 | android:id="@+id/tvDescripcion" |
127 | android:layout_width="0dp" | 129 | android:layout_width="0dp" |
128 | android:layout_height="wrap_content" | 130 | android:layout_height="wrap_content" |
129 | android:layout_marginStart="3dp" | 131 | android:layout_marginStart="3dp" |
130 | android:layout_marginTop="8dp" | 132 | android:layout_marginTop="8dp" |
131 | android:maxLines="2" | 133 | android:maxLines="2" |
132 | android:text="abcdefghijklmnñopqrstuvwxyz0123456789abcdefghijklmnñopqrstuvwxyz" | 134 | android:text="abcdefghijklmnñopqrstuvwxyz0123456789abcdefghijklmnñopqrstuvwxyz" |
133 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 135 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
134 | android:textSize="14sp" | 136 | android:textSize="18sp" |
135 | android:textStyle="bold" | 137 | android:textStyle="bold" |
136 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" | 138 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" |
137 | app:layout_constraintEnd_toEndOf="parent" | 139 | app:layout_constraintEnd_toEndOf="parent" |
138 | app:layout_constraintStart_toEndOf="@+id/textView85" | 140 | app:layout_constraintStart_toEndOf="@+id/textView85" |
139 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 141 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
140 | 142 | ||
141 | <TextView | 143 | <TextView |
142 | android:id="@+id/tvCodigoBarras" | 144 | android:id="@+id/tvCodigoBarras" |
143 | android:layout_width="match_parent" | 145 | android:layout_width="match_parent" |
144 | android:layout_height="wrap_content" | 146 | android:layout_height="wrap_content" |
145 | android:layout_marginStart="3dp" | 147 | android:layout_marginStart="3dp" |
146 | android:layout_marginTop="8dp" | 148 | android:layout_marginTop="8dp" |
147 | android:maxLines="2" | 149 | android:maxLines="2" |
148 | android:text="" | 150 | android:text="" |
149 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 151 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
150 | android:textSize="14sp" | 152 | android:textSize="14sp" |
151 | android:visibility="gone" | 153 | android:visibility="gone" |
152 | android:textStyle="bold" | 154 | android:textStyle="bold" |
153 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" | 155 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" |
154 | app:layout_constraintEnd_toEndOf="parent" | 156 | app:layout_constraintEnd_toEndOf="parent" |
155 | app:layout_constraintStart_toEndOf="@+id/textView85" | 157 | app:layout_constraintStart_toEndOf="@+id/textView85" |
156 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 158 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
157 | <TextView | 159 | <TextView |
158 | android:id="@+id/tvCodigoOrigen" | 160 | android:id="@+id/tvCodigoOrigen" |
159 | android:layout_width="match_parent" | 161 | android:layout_width="match_parent" |
160 | android:layout_height="wrap_content" | 162 | android:layout_height="wrap_content" |
161 | android:layout_marginStart="3dp" | 163 | android:layout_marginStart="3dp" |
162 | android:layout_marginTop="8dp" | 164 | android:layout_marginTop="8dp" |
163 | android:maxLines="2" | 165 | android:maxLines="2" |
164 | android:text="" | 166 | android:text="" |
165 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 167 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
166 | android:textSize="14sp" | 168 | android:textSize="14sp" |
167 | android:visibility="gone" | 169 | android:visibility="gone" |
168 | android:textStyle="bold" | 170 | android:textStyle="bold" |
169 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" | 171 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" |
170 | app:layout_constraintEnd_toEndOf="parent" | 172 | app:layout_constraintEnd_toEndOf="parent" |
171 | app:layout_constraintStart_toEndOf="@+id/textView85" | 173 | app:layout_constraintStart_toEndOf="@+id/textView85" |
172 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 174 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
173 | </androidx.constraintlayout.widget.ConstraintLayout> | 175 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/item_codigo_origen.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | android:layout_width="match_parent" | ||
5 | android:layout_height="wrap_content" | ||
6 | android:layout_margin="5dp" | ||
7 | app:cardCornerRadius="2dp" | ||
8 | app:cardElevation="10dp" | ||
9 | app:contentPadding="5dp" | ||
10 | app:cardPreventCornerOverlap="false"> | ||
11 | |||
12 | <androidx.constraintlayout.widget.ConstraintLayout | ||
13 | android:layout_width="match_parent" | ||
14 | android:layout_height="wrap_content"> | ||
15 | |||
16 | <TextView | ||
17 | android:id="@+id/textView2" | ||
18 | android:layout_width="wrap_content" | ||
19 | android:layout_height="wrap_content" | ||
20 | android:layout_marginStart="5dp" | ||
21 | android:text="Código:" | ||
22 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | ||
23 | android:textSize="14sp" | ||
24 | app:layout_constraintEnd_toStartOf="@+id/tvSector" | ||
25 | app:layout_constraintHorizontal_bias="0.01" | ||
26 | app:layout_constraintHorizontal_chainStyle="packed" | ||
27 | app:layout_constraintStart_toStartOf="parent" | ||
28 | app:layout_constraintTop_toTopOf="parent" /> | ||
29 | |||
30 | |||
31 | <TextView | ||
32 | android:id="@+id/tvSector" | ||
33 | android:layout_width="wrap_content" | ||
34 | android:layout_height="match_parent" | ||
35 | android:layout_marginStart="8dp" | ||
36 | android:text="9999" | ||
37 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
38 | android:textColorHint="@android:color/black" | ||
39 | android:textSize="14sp" | ||
40 | android:textStyle="bold" | ||
41 | app:layout_constraintHorizontal_chainStyle="packed" | ||
42 | app:layout_constraintBaseline_toBaselineOf="@+id/textView2" | ||
43 | app:layout_constraintEnd_toStartOf="@+id/tvCodigo" | ||
44 | app:layout_constraintStart_toEndOf="@+id/textView2" /> | ||
45 | <TextView | ||
46 | android:id="@+id/tvCodigo" | ||
47 | android:layout_width="wrap_content" | ||
48 | android:layout_height="match_parent" | ||
49 | android:layout_marginStart="8dp" | ||
50 | android:text="99999999" | ||
51 | app:layout_constraintHorizontal_chainStyle="packed" | ||
52 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
53 | android:textColorHint="@android:color/black" | ||
54 | android:textSize="14sp" | ||
55 | android:textStyle="bold" | ||
56 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" | ||
57 | app:layout_constraintEnd_toStartOf="@+id/textView5" | ||
58 | app:layout_constraintStart_toEndOf="@+id/tvSector" /> | ||
59 | |||
60 | <TextView | ||
61 | android:id="@+id/textView5" | ||
62 | android:layout_width="wrap_content" | ||
63 | android:layout_height="wrap_content" | ||
64 | android:layout_marginStart="8dp" | ||
65 | android:text="Cantidad:" | ||
66 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | ||
67 | android:textSize="14sp" | ||
68 | android:visibility="gone" | ||
69 | app:layout_constraintTop_toTopOf="parent" | ||
70 | app:layout_constraintEnd_toStartOf="@+id/tvCodigoBarras" | ||
71 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" /> | ||
72 | |||
73 | <TextView | ||
74 | android:id="@+id/tvCantidad" | ||
75 | android:layout_width="wrap_content" | ||
76 | android:layout_height="match_parent" | ||
77 | android:layout_marginStart="8dp" | ||
78 | android:text="Otros Códigos:" | ||
79 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
80 | android:textSize="14sp" | ||
81 | android:textStyle="bold" | ||
82 | android:visibility="visible" | ||
83 | app:layout_constraintEnd_toStartOf="@id/tvCodigoOrigen" | ||
84 | app:layout_constraintStart_toEndOf="@id/textView5" | ||
85 | app:layout_constraintTop_toTopOf="parent" /> | ||
86 | |||
87 | <TextView | ||
88 | android:id="@+id/tvCodigoOrigen" | ||
89 | android:layout_width="0dp" | ||
90 | android:layout_height="wrap_content" | ||
91 | android:layout_marginStart="3dp" | ||
92 | android:maxLines="2" | ||
93 | android:text="" | ||
94 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
95 | android:textSize="14sp" | ||
96 | android:visibility="visible" | ||
97 | android:textStyle="bold" | ||
98 | app:layout_constraintEnd_toEndOf="parent" | ||
99 | app:layout_constraintStart_toEndOf="@+id/tvCantidad" | ||
100 | app:layout_constraintTop_toTopOf="parent"/> | ||
101 | |||
102 | <ImageView | ||
103 | android:id="@+id/ivHolder" | ||
104 | android:layout_width="30dp" | ||
105 | android:layout_height="30dp" | ||
106 | android:visibility="gone" | ||
107 | android:src="@drawable/more" | ||
108 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" | ||
109 | app:layout_constraintEnd_toEndOf="parent" | ||
110 | app:layout_constraintHorizontal_bias="0.968" | ||
111 | app:layout_constraintStart_toEndOf="@+id/tvCodigoBarras" | ||
112 | app:layout_constraintTop_toTopOf="parent" | ||
113 | app:layout_constraintVertical_bias="0.0" /> | ||
114 | |||
115 | <TextView | ||
116 | android:id="@+id/textView85" | ||
117 | android:layout_width="wrap_content" | ||
118 | android:layout_height="wrap_content" | ||
119 | android:layout_marginStart="5dp" | ||
120 | android:layout_marginTop="8dp" | ||
121 | android:text="Desc:" | ||
122 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | ||
123 | android:textSize="14sp" | ||
124 | app:layout_constraintEnd_toStartOf="@+id/tvDescripcion" | ||
125 | app:layout_constraintHorizontal_bias="0.0" | ||
126 | app:layout_constraintHorizontal_chainStyle="packed" | ||
127 | app:layout_constraintStart_toStartOf="parent" | ||
128 | app:layout_constraintTop_toBottomOf="@id/tvCodigo" /> | ||
129 | |||
130 | <TextView | ||
131 | android:id="@+id/tvDescripcion" | ||
132 | android:layout_width="0dp" | ||
133 | android:layout_height="wrap_content" | ||
134 | android:layout_marginStart="3dp" | ||
135 | android:layout_marginTop="8dp" | ||
136 | android:maxLines="2" | ||
137 | android:text="abcdefghijklmnñopqrstuvwxyz0123456789abcdefghijklmnñopqrstuvwxyz" | ||
138 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
139 | android:textSize="14sp" | ||
140 | android:textStyle="bold" | ||
141 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" | ||
142 | app:layout_constraintEnd_toEndOf="parent" | ||
143 | app:layout_constraintStart_toEndOf="@+id/textView85" | ||
144 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | ||
145 | |||
146 | |||
147 | </androidx.constraintlayout.widget.ConstraintLayout> | ||
148 | |||
149 | </androidx.cardview.widget.CardView> |
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 | ||
73 | android:id="@+id/action_inventarioFragment_to_codigoOriFragment" | ||
74 | app:destination="@id/codigoOriFragment" /> | ||
72 | </fragment> | 75 | </fragment> |
73 | 76 | ||
74 | <fragment | 77 | <fragment |
75 | android:id="@+id/descripcionFragment" | 78 | android:id="@+id/descripcionFragment" |
76 | android:name="com.focasoftware.deboinventariov20.UI.descripcionFragment.DescripcionFragment" | 79 | android:name="com.focasoftware.deboinventariov20.UI.descripcionFragment.DescripcionFragment" |
77 | android:label="Productos Encontrados"> | 80 | android:label="Productos Encontrados"> |
78 | <action | 81 | <action |
79 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 82 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
80 | app:destination="@id/inventarioFragment" | 83 | app:destination="@id/inventarioFragment" |
81 | app:popEnterAnim="@anim/slide_in_left" | 84 | app:popEnterAnim="@anim/slide_in_left" |
82 | app:popExitAnim="@anim/slide_out_right" | 85 | app:popExitAnim="@anim/slide_out_right" |
83 | app:enterAnim="@anim/slide_in_right" | 86 | app:enterAnim="@anim/slide_in_right" |
84 | app:exitAnim="@anim/slide_out_left" /> | 87 | app:exitAnim="@anim/slide_out_left" /> |
85 | </fragment> | 88 | </fragment> |
86 | 89 | ||
87 | <fragment | 90 | <fragment |
88 | android:id="@+id/detalleArtFragment" | 91 | android:id="@+id/detalleArtFragment" |
89 | android:name="com.focasoftware.deboinventariov20.UI.detalleProducto.DetalleArtFragment" | 92 | android:name="com.focasoftware.deboinventariov20.UI.detalleProducto.DetalleArtFragment" |
90 | android:label="Detalle Articulo" | 93 | android:label="Detalle Articulo" |
91 | tools:layout="@layout/fragment_detalle_art"> | 94 | tools:layout="@layout/fragment_detalle_art"> |
92 | <action | 95 | <action |
93 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" | 96 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" |
94 | app:destination="@id/inventarioFragment" /> | 97 | app:destination="@id/inventarioFragment" /> |
95 | </fragment> | 98 | </fragment> |
96 | <fragment | 99 | <fragment |
97 | android:id="@+id/configuracionFragment" | 100 | android:id="@+id/configuracionFragment" |
98 | android:name="com.focasoftware.deboinventariov20.UI.configuracion.ConfiguracionFragment" | 101 | android:name="com.focasoftware.deboinventariov20.UI.configuracion.ConfiguracionFragment" |
99 | android:label="Configuraciones" | 102 | android:label="Configuraciones" |
100 | tools:layout="@layout/fragment_configuracion" > | 103 | tools:layout="@layout/fragment_configuracion" > |
101 | <action | 104 | <action |
102 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | 105 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" |
103 | app:destination="@id/servidoresFragment" | 106 | app:destination="@id/servidoresFragment" |
104 | app:popEnterAnim="@anim/slide_in_left" | 107 | app:popEnterAnim="@anim/slide_in_left" |
105 | app:popExitAnim="@anim/slide_out_right" | 108 | app:popExitAnim="@anim/slide_out_right" |
106 | app:enterAnim="@anim/slide_in_right" | 109 | app:enterAnim="@anim/slide_in_right" |
107 | app:exitAnim="@anim/slide_out_left" /> | 110 | app:exitAnim="@anim/slide_out_left" /> |
108 | <action | 111 | <action |
109 | android:id="@+id/action_configuracionFragment_to_mainFragment2" | 112 | android:id="@+id/action_configuracionFragment_to_mainFragment2" |
110 | app:destination="@id/mainFragment2" | 113 | app:destination="@id/mainFragment2" |
111 | app:popUpTo="@id/configuracionFragment" | 114 | app:popUpTo="@id/configuracionFragment" |
112 | app:popUpToInclusive="false" /> | 115 | app:popUpToInclusive="false" /> |
113 | </fragment> | 116 | </fragment> |
114 | 117 | ||
115 | <fragment | 118 | <fragment |
116 | android:id="@+id/servidoresFragment" | 119 | android:id="@+id/servidoresFragment" |
117 | android:name="com.focasoftware.deboinventariov20.UI.servidores.ServidoresFragment" | 120 | android:name="com.focasoftware.deboinventariov20.UI.servidores.ServidoresFragment" |
118 | android:label="Alta Servidores" | 121 | android:label="Alta Servidores" |
119 | tools:layout="@layout/fragment_servidores"> | 122 | tools:layout="@layout/fragment_servidores"> |
120 | <action | 123 | <action |
121 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | 124 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" |
122 | app:destination="@id/configuracionFragment" | 125 | app:destination="@id/configuracionFragment" |
123 | app:popUpTo="@id/servidoresFragment" | 126 | app:popUpTo="@id/servidoresFragment" |
124 | app:popUpToInclusive="false" /> | 127 | app:popUpToInclusive="false" /> |
125 | </fragment> | 128 | </fragment> |
129 | <fragment | ||
130 | android:id="@+id/codigoOriFragment" | ||
131 | android:name="com.focasoftware.deboinventariov20.UI.descripCorigenFragment.CodigoOriFragment" | ||
132 | android:label="CodigoOriFragment" > | ||
133 | <action | ||
134 | android:id="@+id/action_codigoOriFragment_to_inventarioFragment" | ||
135 | app:destination="@id/inventarioFragment" /> | ||
136 | </fragment> | ||
126 | </navigation> | 137 | </navigation> |
127 | 138 |
app/src/main/res/values/strings.xml
1 | <resources> | 1 | <resources> |
2 | 2 | ||
3 | <string name="action_settings">Ayuda</string> | 3 | <string name="action_settings">Ayuda</string> |
4 | <string name="app_name">DEBO Inventarios</string> | 4 | <string name="app_name">DEBO Inventarios</string> |
5 | 5 | ||
6 | <!-- menu--> | 6 | <!-- menu--> |
7 | <string name="menuInicio">Principal</string> | 7 | <string name="menuInicio">Principal</string> |
8 | <string name="menuNueInv">Nuevo Inventario</string> | 8 | <string name="menuNueInv">Nuevo Inventario</string> |
9 | <string name="menuActMae">Importaciones</string> | 9 | <string name="menuActMae">Importaciones</string> |
10 | <string name="menuConf">Configuraciones</string> | 10 | <string name="menuConf">Configuraciones</string> |
11 | <string name="menuSal">Salir</string> | 11 | <string name="menuSal">Salir</string> |
12 | 12 | ||
13 | <!-- Menu header--> | 13 | <!-- Menu header--> |
14 | <string name="menuLeyenda">Debo Inventario</string> | 14 | <string name="menuLeyenda">Debo Inventario</string> |
15 | 15 | ||
16 | <string name="navigation_drawer_open">Open navigation drawer</string> | 16 | <string name="navigation_drawer_open">Open navigation drawer</string> |
17 | <string name="navigation_drawer_close">Close navigation drawer</string> | 17 | <string name="navigation_drawer_close">Close navigation drawer</string> |
18 | 18 | ||
19 | <!-- Pantalla de inicio--> | 19 | <!-- Pantalla de inicio--> |
20 | <string name="bien">Bienvenido</string> | 20 | <string name="bien">Bienvenido</string> |
21 | <string name="debo">DEBO®</string> | 21 | <string name="debo">DEBO®</string> |
22 | <string name="inventario">Inventario</string> | 22 | <string name="inventario">Inventario</string> |
23 | <string name="todo">TODO</string> | 23 | <string name="todo">TODO</string> |
24 | <string name="hello_blank_fragment">Hello blank fragment</string> | 24 | <string name="hello_blank_fragment">Hello blank fragment</string> |
25 | 25 | ||
26 | <!-- inventarios dinamicos--> | 26 | <!-- inventarios dinamicos--> |
27 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> | 27 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> |
28 | <string name="invDinamicoCompra">Inventarios Importados(0) +</string> | 28 | <string name="invDinamicoCompra">Inventarios Importados(0) +</string> |
29 | 29 | ||
30 | <!-- ventana emergente--> | 30 | <!-- ventana emergente--> |
31 | <string name="adv">Ingrese la cantidad contada</string> | 31 | <string name="adv">Ingrese la cantidad contada</string> |
32 | <string name="invVentas">Inventarios Dinamicos de Ventas</string> | 32 | <string name="invVentas">Inventarios Dinamicos de Ventas</string> |
33 | <string name="btnConfirmar">Confirmar</string> | ||
34 | <string name="btnCancela">Cancelar</string> | 33 | <string name="btnCancela">Cancelar</string> |
35 | 34 | ||
36 | 35 | ||
37 | <!-- Fragment Inventario--> | 36 | <!-- Fragment Inventario--> |
38 | <string name="invTitulo">Inventarios Dinámicos</string> | 37 | <string name="invTitulo">Inventarios Dinámicos</string> |
39 | <string name="invTituloV">Inventarios de Ventas</string> | 38 | <string name="invTituloV">Inventarios de Ventas</string> |
40 | <string name="invTituloD">Inventarios de Depositos</string> | 39 | <string name="invTituloD">Inventarios de Depositos</string> |
41 | <string name="invCodigoBarras">Código Barras:</string> | 40 | <string name="invCodigoBarras">Código Barras:</string> |
42 | <string name="btnExportarInv">Exportar Inventario</string> | 41 | <string name="btnExportarInv">Exportar Inventario</string> |
43 | <string name="btnBorrarInv">Borrar Inventario</string> | 42 | <string name="btnBorrarInv">Borrar Inventario</string> |
44 | <string name="ibBusDesc">Busqueda por Descripción</string> | 43 | <string name="ibBusDesc">Busqueda por Descripción</string> |
45 | <string name="ibBusCB">Busqueda por C. Barras</string> | 44 | <string name="ibBusCB">Busqueda por C. Barras</string> |
46 | <string name="ibBusCO">Busqueda por Código de Origen</string> | 45 | <string name="ibBusCO">Busqueda por Código de Origen</string> |
47 | <string name="switch_1">+ 1</string> | 46 | <string name="switch_1">+ 1</string> |
48 | 47 | ||
49 | <!-- Fragmento Configuraciones--> | 48 | <!-- Fragmento Configuraciones--> |
50 | <string name="tvTituloConf">Configuraciones</string> | 49 | <string name="tvTituloConf">Configuraciones</string> |
51 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> | 50 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> |
52 | <string name="btnValidarServidor">Validar</string> | 51 | <string name="btnValidarServidor">Validar</string> |
53 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> | 52 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> |
54 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> | 53 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> |
55 | <string name="tvTituloArea">Area de Invetnario</string> | 54 | <string name="tvTituloArea">Area de Invetnario</string> |
56 | <string name="rbVentas">Inventarios de Ventas</string> | 55 | <string name="rbVentas">Inventarios de Ventas</string> |
57 | <string name="rbDeposito">Inventarios de Depositos</string> | 56 | <string name="rbDeposito">Inventarios de Depositos</string> |
58 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> | 57 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> |
59 | <string name="tvColumnas">Columnas a Visualizar</string> | 58 | <string name="tvColumnas">Columnas a Visualizar</string> |
60 | 59 | ||
61 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> | 60 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> |
62 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> | 61 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> |
63 | 62 | ||
64 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> | 63 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> |
65 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> | 64 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> |
66 | 65 | ||
67 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> | 66 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> |
68 | 67 | ||
69 | <string name="rbCodigoDebo">Código DEBO</string> | 68 | <string name="rbCodigoDebo">Código DEBO</string> |
70 | <string name="rbCodigoOrigen">Código Origen</string> | 69 | <string name="rbCodigoOrigen">Código Origen</string> |
71 | <string name="rbCodigoBarras">Código de Barras</string> | 70 | <string name="rbCodigoBarras">Código de Barras</string> |
72 | 71 | ||
73 | 72 | ||
74 | <!-- Spinner servidor--> | 73 | <!-- Spinner servidor--> |
75 | <string-array name="spinnerServidor"> | 74 | <string-array name="spinnerServidor"> |
76 | <item>Servidor Laboratorio 1</item> | 75 | <item>Servidor Laboratorio 1</item> |
77 | <item>Servidor Laboratorio 2</item> | 76 | <item>Servidor Laboratorio 2</item> |
78 | <item>Servidor Laboratorio 3</item> | 77 | <item>Servidor Laboratorio 3</item> |
79 | </string-array> | 78 | </string-array> |
80 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> | 79 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> |
81 | 80 | ||
82 | <string name="cbMostrarExistencia">Existencia</string> | 81 | <string name="cbMostrarExistencia">Existencia</string> |
83 | <string name="cbMostrarPrecio">Precio</string> | 82 | <string name="cbMostrarPrecio">Precio</string> |
84 | 83 | ||
85 | <string name="btnGuardar">Guardar Cambios</string> | 84 | <string name="btnGuardar">Guardar Cambios</string> |
86 | 85 | ||
87 | <!-- fragment Actualizacion de Maestros--> | 86 | <!-- fragment Actualizacion de Maestros--> |
88 | <string name="tvActMaestros">Importaciones</string> | 87 | <string name="tvActMaestros">Importaciones</string> |
89 | <string name="tvMedio">Seleccione que tipo de importación desea realizar</string> | 88 | <string name="tvMedio">Seleccione que tipo de importación desea realizar</string> |
90 | <string name="obPorWifi">Importación de artículos</string> | 89 | <string name="obPorWifi">Importación de artículos</string> |
91 | <string name="obViaArchivo">Importación de inventarios</string> | 90 | <string name="obViaArchivo">Importación de inventarios</string> |
92 | 91 | ||
93 | <string name="btnConfirmarAct">Confirmar Importación</string> | 92 | <string name="btnConfirmarAct">Confirmar Importación</string> |
94 | 93 | ||
95 | <!-- Fragment Save--> | 94 | <!-- Fragment Save--> |
96 | <string name="tvConfServi">Configuración de Servidores</string> | 95 | <string name="tvConfServi">Configuración de Servidores</string> |
97 | <string name="server">Ingrese la direccion del servidor</string> | 96 | <string name="server">Ingrese la direccion del servidor</string> |
98 | <string name="etNomServer">Ingrese una descripción para la conexión</string> | 97 | <string name="etNomServer">Ingrese una descripción para la conexión</string> |
99 | <string name="btnGuardarConfServ">Guardar Conexión</string> | 98 | <string name="btnGuardarConfServ">Guardar Conexión</string> |
100 | 99 | ||
101 | <!-- Dialog--> | 100 | <!-- Dialog--> |
102 | <string name="sTitulo">Producto Buscado</string> | 101 | <string name="sTitulo">Producto Buscado</string> |
103 | <string name="btnOk">Aceptar</string> | 102 | <string name="btnOk">Aceptar</string> |
104 | <string name="btnCancelar">Cancelar</string> | 103 | <string name="btnCancelar">Cancelar</string> |
105 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> | 104 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> |
106 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> | 105 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> |
107 | <string name="sTituloNueva">Producto ingresado esta cargado</string> | 106 | <string name="sTituloNueva">Producto ingresado esta cargado</string> |
108 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> | 107 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> |
109 | 108 | ||
110 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> | 109 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> |
111 | <string name="sTituloExportar">Exportación de Inventarios</string> | 110 | <string name="sTituloExportar">Exportación de Inventarios</string> |
112 | 111 | ||
113 | <!-- FRAGMENT SERVIDOR--> | 112 | <!-- FRAGMENT SERVIDOR--> |
114 | <string name="tvTitutloServer">Alta de Servidores</string> | 113 | <string name="tvTitutloServer">Alta de Servidores</string> |
115 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> | 114 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> |
116 | <string name="tvDirServer">Ingrese la dirección del servidor</string> | 115 | <string name="tvDirServer">Ingrese la dirección del servidor</string> |
117 | <string name="btnGuardarServidores">Guardar Servidor</string> | 116 | <string name="btnGuardarServidores">Guardar Servidor</string> |
118 | 117 | ||
119 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> | 118 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> |
120 | <string name="rbSumar">Sumar</string> | 119 | <string name="rbSumar">Sumar</string> |
121 | <string name="rbRestar">Restar</string> | 120 | <string name="rbRestar">Restar</string> |
122 | <string name="rbModificar">Reemplazar</string> | 121 | <string name="rbModificar">Reemplazar</string> |
123 | <string name="tvTotal">Cantidad Final</string>tvTotal | 122 | <string name="tvTotal">Cantidad Final</string>tvTotal |
124 | <string name="tvResultado">Resultado:</string>tvTotal | 123 | <string name="tvResultado">Resultado:</string>tvTotal |
125 | 124 | ||
126 | <string name="large_text"> | 125 | <string name="large_text"> |
127 | "Material is the metaphor.\n\n" | 126 | "Material is the metaphor.\n\n" |
128 | 127 | ||
129 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." | 128 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." |
130 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " | 129 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " |
131 | "technologically advanced and open to imagination and magic.\n" | 130 | "technologically advanced and open to imagination and magic.\n" |
132 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " | 131 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " |
133 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " | 132 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " |
134 | "flexibility of the material creates new affordances that supercede those in the physical " | 133 | "flexibility of the material creates new affordances that supercede those in the physical " |
135 | "world, without breaking the rules of physics.\n" | 134 | "world, without breaking the rules of physics.\n" |
136 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " | 135 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " |
137 | "interact, and exist in space and in relation to each other. Realistic lighting shows " | 136 | "interact, and exist in space and in relation to each other. Realistic lighting shows " |
138 | "seams, divides space, and indicates moving parts.\n\n" | 137 | "seams, divides space, and indicates moving parts.\n\n" |
139 | 138 | ||
140 | "Bold, graphic, intentional.\n\n" | 139 | "Bold, graphic, intentional.\n\n" |
141 | 140 | ||
142 | "The foundational elements of print based design typography, grids, space, scale, color, " | 141 | "The foundational elements of print based design typography, grids, space, scale, color, " |
143 | "and use of imagery guide visual treatments. These elements do far more than please the " | 142 | "and use of imagery guide visual treatments. These elements do far more than please the " |
144 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " | 143 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " |
145 | "imagery, large scale typography, and intentional white space create a bold and graphic " | 144 | "imagery, large scale typography, and intentional white space create a bold and graphic " |
146 | "interface that immerse the user in the experience.\n" | 145 | "interface that immerse the user in the experience.\n" |
147 | "An emphasis on user actions makes core functionality immediately apparent and provides " | 146 | "An emphasis on user actions makes core functionality immediately apparent and provides " |
148 | "waypoints for the user.\n\n" | 147 | "waypoints for the user.\n\n" |
149 | 148 | ||
150 | "Motion provides meaning.\n\n" | 149 | "Motion provides meaning.\n\n" |
151 | 150 | ||
152 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " | 151 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " |
153 | "inflection points that initiate motion, transforming the whole design.\n" | 152 | "inflection points that initiate motion, transforming the whole design.\n" |
154 | "All action takes place in a single environment. Objects are presented to the user without " | 153 | "All action takes place in a single environment. Objects are presented to the user without " |
155 | "breaking the continuity of experience even as they transform and reorganize.\n" | 154 | "breaking the continuity of experience even as they transform and reorganize.\n" |
156 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " | 155 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " |
157 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" | 156 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" |
158 | 157 | ||
159 | "3D world.\n\n" | 158 | "3D world.\n\n" |
160 | 159 | ||
161 | "The material environment is a 3D space, which means all objects have x, y, and z " | 160 | "The material environment is a 3D space, which means all objects have x, y, and z " |
162 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " | 161 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " |
163 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " | 162 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " |
164 | "position along the z-axis and has a standard 1dp thickness.\n" | 163 | "position along the z-axis and has a standard 1dp thickness.\n" |
165 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " | 164 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " |
166 | "emulated by manipulating the y-axis.\n\n" | 165 | "emulated by manipulating the y-axis.\n\n" |
167 | 166 | ||
168 | "Light and shadow.\n\n" | 167 | "Light and shadow.\n\n" |
169 | 168 | ||
170 | "Within the material environment, virtual lights illuminate the scene. Key lights create " | 169 | "Within the material environment, virtual lights illuminate the scene. Key lights create " |
171 | "directional shadows, while ambient light creates soft shadows from all angles.\n" | 170 | "directional shadows, while ambient light creates soft shadows from all angles.\n" |
172 | "Shadows in the material environment are cast by these two light sources. In Android " | 171 | "Shadows in the material environment are cast by these two light sources. In Android " |
173 | "development, shadows occur when light sources are blocked by sheets of material at " | 172 | "development, shadows occur when light sources are blocked by sheets of material at " |
174 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " | 173 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " |
175 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" | 174 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" |
176 | 175 | ||
177 | "Resting elevation.\n\n" | 176 | "Resting elevation.\n\n" |
178 | 177 | ||
179 | "All material objects, regardless of size, have a resting elevation, or default elevation " | 178 | "All material objects, regardless of size, have a resting elevation, or default elevation " |
180 | "that does not change. If an object changes elevation, it should return to its resting " | 179 | "that does not change. If an object changes elevation, it should return to its resting " |
181 | "elevation as soon as possible.\n\n" | 180 | "elevation as soon as possible.\n\n" |
182 | 181 | ||
183 | "Component elevations.\n\n" | 182 | "Component elevations.\n\n" |
184 | 183 | ||
185 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " | 184 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " |
186 | "does not vary from 6dp in one app to 16dp in another app).\n" | 185 | "does not vary from 6dp in one app to 16dp in another app).\n" |
187 | "Components may have different resting elevations across platforms, depending on the depth " | 186 | "Components may have different resting elevations across platforms, depending on the depth " |
188 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" | 187 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" |
189 | 188 | ||
190 | "Responsive elevation and dynamic elevation offsets.\n\n" | 189 | "Responsive elevation and dynamic elevation offsets.\n\n" |
191 | 190 | ||
192 | "Some component types have responsive elevation, meaning they change elevation in response " | 191 | "Some component types have responsive elevation, meaning they change elevation in response " |
193 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " | 192 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " |
194 | "changes are consistently implemented using dynamic elevation offsets.\n" | 193 | "changes are consistently implemented using dynamic elevation offsets.\n" |
195 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " | 194 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " |
196 | "to the component’s resting state. They ensure that elevation changes are consistent " | 195 | "to the component’s resting state. They ensure that elevation changes are consistent " |
197 | "across actions and component types. For example, all components that lift on press have " | 196 | "across actions and component types. For example, all components that lift on press have " |
198 | "the same elevation change relative to their resting elevation.\n" | 197 | "the same elevation change relative to their resting elevation.\n" |
199 | "Once the input event is completed or cancelled, the component will return to its resting " | 198 | "Once the input event is completed or cancelled, the component will return to its resting " |
200 | "elevation.\n\n" | 199 | "elevation.\n\n" |
201 | 200 | ||
202 | "Avoiding elevation interference.\n\n" | 201 | "Avoiding elevation interference.\n\n" |
203 | 202 | ||
204 | "Components with responsive elevations may encounter other components as they move between " | 203 | "Components with responsive elevations may encounter other components as they move between " |
205 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " | 204 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " |
206 | "through other material, components avoid interfering with one another any number of ways, " | 205 | "through other material, components avoid interfering with one another any number of ways, " |
207 | "whether on a per component basis or using the entire app layout.\n" | 206 | "whether on a per component basis or using the entire app layout.\n" |
208 | "On a component level, components can move or be removed before they cause interference. " | 207 | "On a component level, components can move or be removed before they cause interference. " |
209 | "For example, a floating action button (FAB) can disappear or move off screen before a " | 208 | "For example, a floating action button (FAB) can disappear or move off screen before a " |
210 | "user picks up a card, or it can move if a snackbar appears.\n" | 209 | "user picks up a card, or it can move if a snackbar appears.\n" |
211 | "On the layout level, design your app layout to minimize opportunities for interference. " | 210 | "On the layout level, design your app layout to minimize opportunities for interference. " |
212 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " | 211 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " |
213 | "when a user tries to pick up one of cards.\n\n" | 212 | "when a user tries to pick up one of cards.\n\n" |
214 | </string> | 213 | </string> |
215 | </resources> | 214 | </resources> |