Commit 7778faf6a52f29345d844318a494c37e549cf3f8
1 parent
08caedf9d2
Exists in
master
26022020 2220
Showing
26 changed files
with
624 additions
and
273 deletions
Show diff stats
Solicitudes API Articulos y Time.docx
No preview for this file type
Solicitudes API Articulos y Time.pdf
No preview for this file type
Solicitudes API Articulos.docx
No preview for this file type
Solicitudes API Articulos.pdf
No preview for this file type
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.* | 3 | import androidx.room.* |
4 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART | 4 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART |
5 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B | 5 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B |
6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H | 6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H |
7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV | 7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV |
8 | import com.focasoftware.deboinventariov20.Model.* | 8 | import com.focasoftware.deboinventariov20.Model.* |
9 | 9 | ||
10 | @Dao | 10 | @Dao |
11 | interface ArticulosDAO { | 11 | interface ArticulosDAO { |
12 | 12 | ||
13 | // TABLA ARTICULOS | 13 | // TABLA ARTICULOS |
14 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 14 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
15 | suspend fun insertArticulos(articulos: Articles?) | 15 | suspend fun insertArticulos(articulos: Articles?) |
16 | 16 | ||
17 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") | 17 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") |
18 | suspend fun findAllArticulos(): List<Articles> | 18 | suspend fun findAllArticulos(): List<Articles> |
19 | 19 | ||
20 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") | 20 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") |
21 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> | 21 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> |
22 | 22 | ||
23 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") | 23 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") |
24 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? | 24 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? |
25 | 25 | ||
26 | @Query("DELETE FROM $TABLA_ART") | 26 | @Query("DELETE FROM $TABLA_ART") |
27 | suspend fun deleteAllArticulos() | 27 | suspend fun deleteAllArticulos() |
28 | |||
29 | @Query("SELECT * FROM $TABLA_ART WHERE SEC=:sector AND COD=:codigo") | ||
30 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? | ||
28 | } | 31 | } |
29 | 32 | ||
30 | @Dao | 33 | @Dao |
31 | interface InvHeadDAO { | 34 | interface InvHeadDAO { |
32 | @Insert() | 35 | @Insert() |
33 | suspend fun insertInvHead(invHead: InvHead?) | 36 | suspend fun insertInvHead(invHead: InvHead?) |
34 | 37 | ||
35 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") | 38 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") |
36 | suspend fun findLastInv(): Int | 39 | suspend fun findLastInv(): Int |
37 | 40 | ||
38 | @Query("DELETE FROM $TABLA_INV_H") | 41 | @Query("DELETE FROM $TABLA_INV_H") |
39 | suspend fun deleteAllArticulos() | 42 | suspend fun deleteAllArticulos() |
40 | 43 | ||
41 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 44 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
42 | suspend fun deleteinvHead(inven: Int) | 45 | suspend fun deleteinvHead(inven: Int) |
43 | 46 | ||
44 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") | 47 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") |
45 | suspend fun fetchAllInvHead(): List<InvHead> | 48 | suspend fun fetchAllInvHead(): List<InvHead> |
46 | } | 49 | } |
47 | 50 | ||
48 | @Dao | 51 | @Dao |
49 | interface InvBodyDAO { | 52 | interface InvBodyDAO { |
50 | @Insert() | 53 | @Insert() |
51 | suspend fun insertInvBody(invBody: InvBody?) | 54 | suspend fun insertInvBody(invBody: InvBody?) |
52 | 55 | ||
53 | @Query("DELETE FROM $TABLA_INV_B") | 56 | @Query("DELETE FROM $TABLA_INV_B") |
54 | suspend fun deleteAllInvBody() | 57 | suspend fun deleteAllInvBody() |
55 | 58 | ||
56 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") | 59 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") |
57 | suspend fun deleteInvBody(inven: Int) | 60 | suspend fun deleteInvBody(inven: Int) |
58 | 61 | ||
59 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") | 62 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") |
60 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) | 63 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) |
61 | 64 | ||
62 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") | 65 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") |
63 | suspend fun fetchAllInvBody(inven:Int): List<InvBody> | 66 | suspend fun fetchAllInvBody(inven:Int): List<InvBody> |
64 | 67 | ||
65 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 68 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
66 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody | 69 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody |
70 | |||
71 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | ||
72 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int | ||
67 | } | 73 | } |
68 | @Dao | 74 | @Dao |
69 | interface ServeInvDao { | 75 | interface ServeInvDao { |
70 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 76 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
71 | fun insertServer(servidor: ServeInv) | 77 | fun insertServer(servidor: ServeInv) |
72 | 78 | ||
73 | @Query("SELECT * FROM ServeInv") | 79 | @Query("SELECT * FROM ServeInv") |
74 | suspend fun fetchAllServers(): List<ServeInv> | 80 | suspend fun fetchAllServers(): List<ServeInv> |
75 | 81 | ||
76 | @Query("DELETE FROM ServeInv WHERE SER_NUM = :number") | 82 | @Query("DELETE FROM ServeInv WHERE SER_NUM = :number") |
77 | suspend fun deleteServer(number: Long) | 83 | suspend fun deleteServer(number: Long) |
78 | 84 | ||
79 | @Query("SELECT SER_NUM FROM ServeInv ORDER BY SER_NUM DESC") | 85 | @Query("SELECT SER_NUM FROM ServeInv ORDER BY SER_NUM DESC") |
80 | suspend fun findLastSer(): Long | 86 | suspend fun findLastSer(): Long |
81 | } | 87 | } |
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.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART | 6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART |
7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B | 7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B |
8 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H | 8 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H |
9 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV | 9 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.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("BAL") var balanza: Int?, | 20 | @SerializedName( "EV") var exiVenta: String?, |
21 | @SerializedName( "ED") var exiDeposito: String?, | ||
22 | @SerializedName( "DE") var de: String?, | ||
23 | @SerializedName( "BAL") var balanza: Int?, | ||
21 | @SerializedName("DEPSN") var depSn: Int?, | 24 | @SerializedName("DEPSN") var depSn: Int?, |
22 | @SerializedName("FOTO") var imagen: String?) | 25 | @SerializedName("FOTO") var imagen: String?) |
23 | 26 | ||
24 | @Entity(tableName = TABLA_ART) | 27 | @Entity(tableName = TABLA_ART) |
25 | data class Articles(@ColumnInfo(name = "SEC") var sector: String?, | 28 | data class Articles(@ColumnInfo(name = "SEC") var sector: String?, |
26 | @ColumnInfo(name = "COD") var codigo: String?, | 29 | @ColumnInfo(name = "COD") var codigo: String?, |
27 | @ColumnInfo(name = "DES") var descripcion: String?, | 30 | @ColumnInfo(name = "DES") var descripcion: String?, |
28 | @ColumnInfo(name = "CB") var codBar: String?, | 31 | @ColumnInfo(name = "CB") var codBar: String?, |
29 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 32 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
30 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 33 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
31 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 34 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
35 | @ColumnInfo(name = "EV") var exiVenta: String?, | ||
36 | @ColumnInfo(name = "ED") var exiDeposito: String?, | ||
37 | @ColumnInfo(name = "DE") var de: String?, | ||
32 | @ColumnInfo(name = "BAL") var balanza: Int?, | 38 | @ColumnInfo(name = "BAL") var balanza: Int?, |
33 | @ColumnInfo(name = "DEPSN") var depSn: Int?, | 39 | @ColumnInfo(name = "DEPSN") var depSn: Int?, |
34 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { | 40 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { |
35 | @PrimaryKey(autoGenerate = true) | 41 | @PrimaryKey(autoGenerate = true) |
36 | @ColumnInfo(name = "id") | 42 | @ColumnInfo(name = "id") |
37 | var id: Long = 0 | 43 | var id: Long = 0 |
38 | } | 44 | } |
39 | 45 | ||
40 | 46 | ||
41 | @Entity(tableName = TABLA_INV_H) | 47 | @Entity(tableName = TABLA_INV_H) |
42 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, | 48 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, |
43 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, | 49 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, |
44 | @ColumnInfo(name = "ESTADO") var estado: Int?, | 50 | @ColumnInfo(name = "ESTADO") var estado: Int?, |
45 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 51 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
46 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, | 52 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, |
47 | // productos contados en el inventario | 53 | // productos contados en el inventario |
48 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, | 54 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, |
49 | @ColumnInfo(name = "INV_LUG") var lugar: Int?, | 55 | @ColumnInfo(name = "INV_LUG") var lugar: Int?, |
50 | // Solo se ajustan los productos incluidos en el conteo=0 | 56 | // Solo se ajustan los productos incluidos en el conteo=0 |
51 | // Ajusta productos no incluidos en el conteo con stock en cero=1 | 57 | // Ajusta productos no incluidos en el conteo con stock en cero=1 |
52 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, | 58 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, |
53 | // Mostror stock en el sistema al momento de la descarga del maestro. | 59 | // Mostror stock en el sistema al momento de la descarga del maestro. |
54 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) | 60 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) |
55 | 61 | ||
56 | 62 | ||
57 | @Entity(tableName = TABLA_INV_B) | 63 | @Entity(tableName = TABLA_INV_B) |
58 | data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, | 64 | data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, |
59 | @ColumnInfo(name = "SEC") var sector: String?, | 65 | @ColumnInfo(name = "SEC") var sector: String?, |
60 | @ColumnInfo(name = "COD") var codigo: String?, | 66 | @ColumnInfo(name = "COD") var codigo: String?, |
61 | @ColumnInfo(name = "DES") var descripcion: String?, | 67 | @ColumnInfo(name = "DES") var descripcion: String?, |
62 | @ColumnInfo(name = "CANT") var cantTomada: String?, | 68 | @ColumnInfo(name = "CANT") var cantTomada: String?, |
63 | @ColumnInfo(name = "CB") var codBar: String?, | 69 | @ColumnInfo(name = "CB") var codBar: String?, |
64 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 70 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
65 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 71 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
66 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 72 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
67 | @ColumnInfo(name = "BAL") var balanza: Int?, | 73 | @ColumnInfo(name = "BAL") var balanza: Int?, |
68 | @ColumnInfo(name = "DSN") var depSn: Int?, | 74 | @ColumnInfo(name = "DSN") var depSn: Int?, |
69 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 75 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
70 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { | 76 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { |
71 | @PrimaryKey(autoGenerate = true) | 77 | @PrimaryKey(autoGenerate = true) |
72 | @ColumnInfo(name = "id") | 78 | @ColumnInfo(name = "id") |
73 | var id: Long = 0 | 79 | var id: Long = 0 |
74 | } | 80 | } |
75 | 81 | ||
76 | @Entity(tableName = TABLA_SERV_INV) | 82 | @Entity(tableName = TABLA_SERV_INV) |
77 | data class ServeInv( | 83 | data class ServeInv( |
78 | 84 | ||
79 | @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "SER_NUM") var SER_NUM: Long, | 85 | @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "SER_NUM") var SER_NUM: Long, |
80 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, | 86 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, |
81 | @ColumnInfo(name = "SER_DIR") var direccion: String?, | 87 | @ColumnInfo(name = "SER_DIR") var direccion: String?, |
82 | @ColumnInfo(name = "SER_PRE") var predeterminado: String?) | 88 | @ColumnInfo(name = "SER_PRE") var predeterminado: String?) |
83 | 89 | ||
84 | 90 | ||
85 | 91 |
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.Productos | 11 | import com.focasoftware.deboinventariov20.Model.Productos |
12 | import com.focasoftware.deboinventariov20.Model.ProductosService | 12 | import com.focasoftware.deboinventariov20.Model.ProductosService |
13 | import com.focasoftware.deboinventariov20.R | 13 | import com.focasoftware.deboinventariov20.R |
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 | 16 | ||
17 | class ActuaMaestrosFragment : Fragment() { | 17 | class ActuaMaestrosFragment : Fragment() { |
18 | 18 | ||
19 | var job: Job? = null | 19 | var job: Job? = null |
20 | 20 | ||
21 | 21 | ||
22 | override fun onCreate(savedInstanceState: Bundle?) { | 22 | override fun onCreate(savedInstanceState: Bundle?) { |
23 | super.onCreate(savedInstanceState) | 23 | super.onCreate(savedInstanceState) |
24 | 24 | ||
25 | 25 | ||
26 | //mostrarArticulos() | 26 | //mostrarArticulos() |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | override fun onCreateView( | 30 | override fun onCreateView( |
31 | inflater: LayoutInflater, container: ViewGroup?, | 31 | inflater: LayoutInflater, container: ViewGroup?, |
32 | savedInstanceState: Bundle? | 32 | savedInstanceState: Bundle? |
33 | ): View? { | 33 | ): View? { |
34 | // Inflate the layout for this fragment | 34 | // Inflate the layout for this fragment |
35 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) | 35 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) |
36 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) | 36 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) |
37 | bConfirmarAct.setOnClickListener { | 37 | bConfirmarAct.setOnClickListener { |
38 | loading_view.visibility = View.VISIBLE | 38 | loading_view.visibility = View.VISIBLE |
39 | countriesList.text = "Obteniendo Maestros Aguarde,por favor." | 39 | countriesList.text = "Obteniendo Maestros Aguarde,por favor." |
40 | obtenerArticulos() | 40 | obtenerArticulos() |
41 | } | 41 | } |
42 | return v | 42 | return v |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | private fun obtenerArticulos() { | 46 | private fun obtenerArticulos() { |
47 | 47 | ||
48 | val productosService = ProductosService.getProductosService() | 48 | val productosService = ProductosService.getProductosService() |
49 | var index: Long = 1 | 49 | var index: Long = 1 |
50 | job = CoroutineScope(Dispatchers.IO).launch { | 50 | job = CoroutineScope(Dispatchers.IO).launch { |
51 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 51 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
52 | .deleteAllArticulos() | 52 | .deleteAllArticulos() |
53 | val response = productosService.getProductos() | 53 | val response = productosService.getProductos() |
54 | if (response.isSuccessful) { | 54 | if (response.isSuccessful) { |
55 | for (pro in response.body()!!) { | 55 | for (pro in response.body()!!) { |
56 | val artiAcargar = Articles( | 56 | val artiAcargar = Articles( |
57 | pro.sector, | 57 | pro.sector, |
58 | pro.codigo, | 58 | pro.codigo, |
59 | pro.descripcion, | 59 | pro.descripcion, |
60 | pro.codBar, | 60 | pro.codBar, |
61 | pro.codOrigen, | 61 | pro.codOrigen, |
62 | pro.precio, | 62 | pro.precio, |
63 | pro.costo, | 63 | pro.costo, |
64 | pro.exiVenta, | ||
65 | pro.exiDeposito, | ||
66 | pro.de, | ||
64 | pro.balanza, | 67 | pro.balanza, |
65 | pro.depSn, | 68 | pro.depSn, |
66 | pro.imagen | 69 | pro.imagen |
67 | ) | 70 | ) |
68 | index += index | 71 | index += index |
69 | 72 | ||
70 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 73 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
71 | .insertArticulos(artiAcargar) | 74 | .insertArticulos(artiAcargar) |
72 | } | 75 | } |
73 | withContext(Dispatchers.Main) { | 76 | withContext(Dispatchers.Main) { |
74 | countriesList.visibility = View.VISIBLE | 77 | countriesList.visibility = View.VISIBLE |
75 | countriesList.text = "¡Datos Importados Correctamente!" | 78 | countriesList.text = "¡Datos Importados Correctamente!" |
76 | loading_view.visibility = View.GONE | 79 | loading_view.visibility = View.GONE |
77 | } | 80 | } |
78 | // | 81 | // |
79 | } else { | 82 | } else { |
80 | countriesList.text = "Error: ${response.message()}" | 83 | countriesList.text = "Error: ${response.message()}" |
81 | } | 84 | } |
82 | } | 85 | } |
83 | 86 | ||
84 | // withContext(Dispatchers.Main) { | 87 | // withContext(Dispatchers.Main) { |
85 | // if (response.isSuccessful) { | 88 | // if (response.isSuccessful) { |
86 | // val call = WebService | 89 | // val call = WebService |
87 | // .instance | 90 | // .instance |
88 | // ?.createService(WebServiceApi::class.java) | 91 | // ?.createService(WebServiceApi::class.java) |
89 | // ?.articulos | 92 | // ?.articulos |
90 | // call?.enqueue(object : Callback<List<productos?>?> { | 93 | // call?.enqueue(object : Callback<List<productos?>?> { |
91 | // override fun onResponse( | 94 | // override fun onResponse( |
92 | // call: Call<List<productos?>?>, | 95 | // call: Call<List<productos?>?>, |
93 | // response: Response<List<productos?>?> | 96 | // response: Response<List<productos?>?> |
94 | // ) { | 97 | // ) { |
95 | // if (response.code() == 200) { | 98 | // if (response.code() == 200) { |
96 | // for (i in response.body()!!.indices) { | 99 | // for (i in response.body()!!.indices) { |
97 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) | 100 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) |
98 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") | 101 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") |
99 | //// Log.d( | 102 | //// Log.d( |
100 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector | 103 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector |
101 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion | 104 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion |
102 | //// ) | 105 | //// ) |
103 | // mostrarArticulos() | 106 | // mostrarArticulos() |
104 | // } | 107 | // } |
105 | // } else if (response.code() == 404) { | 108 | // } else if (response.code() == 404) { |
106 | // Log.d("TAG1", "No hay cursos") | 109 | // Log.d("TAG1", "No hay cursos") |
107 | // } | 110 | // } |
108 | // | 111 | // |
109 | // } | 112 | // } |
110 | // | 113 | // |
111 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} | 114 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} |
112 | // }) | 115 | // }) |
113 | } | 116 | } |
114 | 117 | ||
115 | fun mostrarArticulos() { | 118 | fun mostrarArticulos() { |
116 | val Job = GlobalScope.launch { | 119 | val Job = GlobalScope.launch { |
117 | var listArticulos: List<Articles>? = null | 120 | var listArticulos: List<Articles>? = null |
118 | var temp: String = "" | 121 | var temp: String = "" |
119 | listArticulos = | 122 | listArticulos = |
120 | AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() | 123 | AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() |
121 | if (listArticulos != null) { | 124 | if (listArticulos != null) { |
122 | 125 | ||
123 | for (i in listArticulos.indices) | 126 | for (i in listArticulos.indices) |
124 | temp += listArticulos[i].codigo.toString() | 127 | temp += listArticulos[i].codigo.toString() |
125 | } | 128 | } |
126 | withContext(Dispatchers.Main) { | 129 | withContext(Dispatchers.Main) { |
127 | countriesList.visibility = View.VISIBLE | 130 | countriesList.visibility = View.VISIBLE |
128 | loading_view.visibility = View.GONE | 131 | loading_view.visibility = View.GONE |
129 | countriesList?.text = temp | 132 | countriesList?.text = temp |
130 | } | 133 | } |
131 | } | 134 | } |
132 | // for (professor in listArticulos!!) { | 135 | // for (professor in listArticulos!!) { |
133 | // editT.text= professor.id.toString() | 136 | // editT.text= professor.id.toString() |
134 | // } | 137 | // } |
135 | } | 138 | } |
136 | 139 | ||
137 | 140 | ||
138 | // fun observeViewModel() { | 141 | // fun observeViewModel() { |
139 | // | 142 | // |
140 | // val productosService = ProductosService.getProductosService() | 143 | // val productosService = ProductosService.getProductosService() |
141 | // var job: Job? = null | 144 | // var job: Job? = null |
142 | // | 145 | // |
143 | // | 146 | // |
144 | // //countriesList.text="Procesando..." | 147 | // //countriesList.text="Procesando..." |
145 | // //countriesList.visibility = View.VISIBLE | 148 | // //countriesList.visibility = View.VISIBLE |
146 | // // GlobalScope1.launch(Dispatchers.IO) { | 149 | // // GlobalScope1.launch(Dispatchers.IO) { |
147 | // val response = productosService.getProductos() | 150 | // val response = productosService.getProductos() |
148 | // if (response.isSuccessful) { | 151 | // if (response.isSuccessful) { |
149 | //// countriesList.layoutManager = LinearLayoutManager(context) | 152 | //// countriesList.layoutManager = LinearLayoutManager(context) |
150 | //// countriesList.itemAnimator = DefaultItemAnimator() | 153 | //// countriesList.itemAnimator = DefaultItemAnimator() |
151 | // | 154 | // |
152 | //// ProductAdapter.updateCountries(it) | 155 | //// ProductAdapter.updateCountries(it) |
153 | // // cargarArticulos(response.body()) | 156 | // // cargarArticulos(response.body()) |
154 | // | 157 | // |
155 | // | 158 | // |
156 | // val artiAcargar: Articulos? = null | 159 | // val artiAcargar: Articulos? = null |
157 | // var index: Long = 1 | 160 | // var index: Long = 1 |
158 | // | 161 | // |
159 | // for (pro in response.body()!!) { | 162 | // for (pro in response.body()!!) { |
160 | // //artiAcargar.id =index+1 | 163 | // //artiAcargar.id =index+1 |
161 | // artiAcargar!!.sector = pro.sector | 164 | // artiAcargar!!.sector = pro.sector |
162 | // artiAcargar.codigo = pro.codigo | 165 | // artiAcargar.codigo = pro.codigo |
163 | // artiAcargar.descripcion = pro.descripcion | 166 | // artiAcargar.descripcion = pro.descripcion |
164 | // artiAcargar.codBar = pro.codBar | 167 | // artiAcargar.codBar = pro.codBar |
165 | // artiAcargar.precio = pro.precio | 168 | // artiAcargar.precio = pro.precio |
166 | // artiAcargar.costo = pro.costo | 169 | // artiAcargar.costo = pro.costo |
167 | // artiAcargar.balanza = pro.balanza | 170 | // artiAcargar.balanza = pro.balanza |
168 | // artiAcargar.depSn = pro.depSn | 171 | // artiAcargar.depSn = pro.depSn |
169 | // artiAcargar.imagen = pro.imagen | 172 | // artiAcargar.imagen = pro.imagen |
170 | // index += index | 173 | // index += index |
171 | // | 174 | // |
172 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 175 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
173 | // .insertArticulos(artiAcargar) | 176 | // .insertArticulos(artiAcargar) |
174 | // } | 177 | // } |
175 | // } | 178 | // } |
176 | // // } | 179 | // // } |
177 | // | 180 | // |
178 | // //job.cancel() | 181 | // //job.cancel() |
179 | // | 182 | // |
180 | // | 183 | // |
181 | // } | 184 | // } |
182 | 185 | ||
183 | // fun cargarArticulos(Productos: List<Productos>?) { | 186 | // fun cargarArticulos(Productos: List<Productos>?) { |
184 | // val artiAcargar: Articulos? = null | 187 | // val artiAcargar: Articulos? = null |
185 | // var index: Long = 1 | 188 | // var index: Long = 1 |
186 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { | 189 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { |
187 | // for (pro in Productos!!) { | 190 | // for (pro in Productos!!) { |
188 | // //artiAcargar.id =index+1 | 191 | // //artiAcargar.id =index+1 |
189 | // artiAcargar!!.sector = pro.sector | 192 | // artiAcargar!!.sector = pro.sector |
190 | // artiAcargar.codigo = pro.codigo | 193 | // artiAcargar.codigo = pro.codigo |
191 | // artiAcargar.descripcion = pro.descripcion | 194 | // artiAcargar.descripcion = pro.descripcion |
192 | // artiAcargar.codBar = pro.codBar | 195 | // artiAcargar.codBar = pro.codBar |
193 | // artiAcargar.precio = pro.precio | 196 | // artiAcargar.precio = pro.precio |
194 | // artiAcargar.costo = pro.costo | 197 | // artiAcargar.costo = pro.costo |
195 | // artiAcargar.balanza = pro.balanza | 198 | // artiAcargar.balanza = pro.balanza |
196 | // artiAcargar.depSn = pro.depSn | 199 | // artiAcargar.depSn = pro.depSn |
197 | // artiAcargar.imagen = pro.imagen | 200 | // artiAcargar.imagen = pro.imagen |
198 | // index += index | 201 | // index += index |
199 | // | 202 | // |
200 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 203 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
201 | // .insertArticulos(artiAcargar) | 204 | // .insertArticulos(artiAcargar) |
202 | // } | 205 | // } |
203 | // } | 206 | // } |
204 | } | 207 | } |
205 | 208 | ||
206 | 209 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment | 1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment |
2 | 2 | ||
3 | import android.app.AlertDialog | 3 | import android.app.AlertDialog |
4 | import android.content.Context | 4 | import android.content.Context |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import android.graphics.Canvas | 6 | import android.graphics.Canvas |
7 | import android.graphics.Color | 7 | import android.graphics.Color |
8 | import android.graphics.drawable.ColorDrawable | 8 | import android.graphics.drawable.ColorDrawable |
9 | import android.os.Bundle | 9 | import android.os.Bundle |
10 | import android.text.InputType | 10 | import android.text.InputType |
11 | import android.view.LayoutInflater | 11 | import android.view.LayoutInflater |
12 | import android.view.View | 12 | import android.view.View |
13 | import android.view.ViewGroup | 13 | import android.view.ViewGroup |
14 | import android.widget.Button | 14 | import android.widget.Button |
15 | import androidx.fragment.app.Fragment | 15 | import androidx.fragment.app.Fragment |
16 | import androidx.fragment.app.FragmentActivity | ||
16 | import androidx.lifecycle.lifecycleScope | 17 | import androidx.lifecycle.lifecycleScope |
17 | import androidx.navigation.NavController | 18 | import androidx.navigation.NavController |
18 | import androidx.navigation.Navigation | 19 | import androidx.navigation.Navigation |
19 | import androidx.recyclerview.widget.ItemTouchHelper | 20 | import androidx.recyclerview.widget.ItemTouchHelper |
20 | import androidx.recyclerview.widget.LinearLayoutManager | 21 | import androidx.recyclerview.widget.LinearLayoutManager |
21 | import androidx.recyclerview.widget.RecyclerView | 22 | import androidx.recyclerview.widget.RecyclerView |
22 | import com.afollestad.materialdialogs.MaterialDialog | 23 | import com.afollestad.materialdialogs.MaterialDialog |
23 | import com.afollestad.materialdialogs.input.input | 24 | import com.afollestad.materialdialogs.input.input |
24 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 25 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
25 | import com.focasoftware.deboinventariov20.Model.Articles | 26 | import com.focasoftware.deboinventariov20.Model.Articles |
26 | import com.focasoftware.deboinventariov20.Model.InvBody | 27 | import com.focasoftware.deboinventariov20.Model.InvBody |
27 | import com.focasoftware.deboinventariov20.R | 28 | import com.focasoftware.deboinventariov20.R |
28 | import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment | 29 | import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment |
29 | import kotlinx.android.synthetic.main.login_dialog.view.* | 30 | import kotlinx.android.synthetic.main.login_dialog.view.* |
30 | import kotlinx.coroutines.* | 31 | import kotlinx.coroutines.* |
31 | 32 | ||
32 | class DescripcionFragment : Fragment() { | 33 | class DescripcionFragment : Fragment() { |
33 | private var artAcargar2: List<Articles>? = null | 34 | private var artAcargar2: List<Articles>? = null |
34 | private var listArticulos2: List<Articles>? = null | 35 | private var listArticulos2: List<Articles>? = null |
35 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | 36 | lateinit var viewAdapter2: RecyclerView.Adapter<*> |
36 | private lateinit var viewManager2: RecyclerView.LayoutManager | 37 | private lateinit var viewManager2: RecyclerView.LayoutManager |
37 | private lateinit var rcDescripcion: RecyclerView | 38 | private lateinit var rcDescripcion: RecyclerView |
38 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | 39 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) |
39 | private var cantidad = 0F | 40 | private var cantidad = 0F |
40 | private var numeroInventario = 0 | 41 | private var numeroInventario = 0 |
41 | lateinit var navController: NavController | 42 | lateinit var navController: NavController |
42 | lateinit var sharedPreferences: SharedPreferences | 43 | lateinit var sharedPreferences: SharedPreferences |
43 | private var indice = 0 | 44 | private var indice = 0 |
44 | private var artCargadoEnBD: InvBody? = null | 45 | private var artCargadoEnBD: InvBody? = null |
46 | |||
45 | override fun onCreate(savedInstanceState: Bundle?) { | 47 | override fun onCreate(savedInstanceState: Bundle?) { |
46 | super.onCreate(savedInstanceState) | 48 | super.onCreate(savedInstanceState) |
47 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 49 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
48 | arguments.apply { | 50 | arguments.apply { |
49 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | 51 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> |
50 | numeroInventario = requireArguments().getInt("numeroInv") | 52 | numeroInventario = requireArguments().getInt("numeroInv") |
51 | } | 53 | } |
52 | } | 54 | } |
53 | 55 | ||
54 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 56 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
55 | super.onViewCreated(view, savedInstanceState) | 57 | super.onViewCreated(view, savedInstanceState) |
56 | navController = Navigation.findNavController(view) | 58 | navController = Navigation.findNavController(view) |
57 | } | 59 | } |
58 | 60 | ||
59 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 61 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
60 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) | 62 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) |
61 | rcDescripcion = v.findViewById(R.id.rcDescripcion) | 63 | rcDescripcion = v.findViewById(R.id.rcDescripcion) |
62 | val btnSalir = v.findViewById<Button>(R.id.btnSalir) | 64 | val btnSalir = v.findViewById<Button>(R.id.btnSalir) |
63 | 65 | ||
64 | IngresarRecicler(artAcargar2) | 66 | IngresarRecicler(artAcargar2) |
65 | 67 | ||
66 | btnSalir.setOnClickListener { | 68 | btnSalir.setOnClickListener { |
67 | VolverAinventario() | 69 | VolverAinventario() |
68 | } | 70 | } |
69 | return v | 71 | return v |
70 | } | 72 | } |
71 | 73 | ||
72 | fun IngresarRecicler(articulos: List<Articles>?) { | 74 | fun IngresarRecicler(articulos: List<Articles>?) { |
73 | 75 | ||
74 | viewAdapter2 = DescripcionListAdapter(articulos) | 76 | viewAdapter2 = DescripcionListAdapter(articulos) |
75 | viewManager2 = LinearLayoutManager(requireContext()) | 77 | viewManager2 = LinearLayoutManager(requireContext()) |
76 | 78 | ||
77 | rcDescripcion.apply { | 79 | rcDescripcion.apply { |
78 | adapter = viewAdapter2 | 80 | adapter = viewAdapter2 |
79 | layoutManager = viewManager2 | 81 | layoutManager = viewManager2 |
80 | } | 82 | } |
81 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | 83 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { |
82 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 84 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
83 | return false | 85 | return false |
84 | } | 86 | } |
85 | 87 | ||
86 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 88 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
87 | 89 | ||
88 | var indice = 0 | 90 | var indice = 0 |
89 | indice = viewHolder.layoutPosition | 91 | indice = viewHolder.layoutPosition |
90 | GlobalScope.launch(Dispatchers.Main) { | 92 | GlobalScope.launch(Dispatchers.Main) { |
91 | //TODO BUSCO EN BASE DE DATOS | 93 | //TODO BUSCO EN BASE DE DATOS |
92 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.sector.toString(), | 94 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.sector.toString(), |
93 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.codigo.toString(), | 95 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.codigo.toString(), |
94 | numeroInventario.toString()) | 96 | numeroInventario.toString()) |
95 | if (artCargadoEnBD == null) { | 97 | if (artCargadoEnBD == null) { |
96 | val type = InputType.TYPE_CLASS_NUMBER | 98 | val type = InputType.TYPE_CLASS_NUMBER |
99 | |||
97 | MaterialDialog(requireContext()).show { | 100 | MaterialDialog(requireContext()).show { |
98 | title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") | 101 | title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") |
99 | message(R.string.sMensajeEncontrado) | 102 | message(R.string.sMensajeEncontrado) |
100 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 103 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
101 | cantidad = 0F | 104 | cantidad = 0F |
102 | cantidad = charSequence.toString().toFloat() | 105 | cantidad = charSequence.toString().toFloat() |
103 | } | 106 | } |
104 | positiveButton(R.string.btnOk) { | 107 | positiveButton(R.string.btnOk) { |
108 | val body = InvBody(numeroInventario, | ||
109 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | ||
110 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | ||
111 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | ||
112 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | ||
113 | cantidad.toString(), | ||
114 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | ||
115 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | ||
116 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | ||
117 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | ||
118 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | ||
119 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | ||
120 | InventarioFragment().ObtenerFechaActual(), | ||
121 | InventarioFragment().ObtenerFechaActual()) | ||
122 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | ||
123 | VolverAinventario() | ||
105 | dismiss() | 124 | dismiss() |
106 | } | 125 | } |
107 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 126 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
108 | 127 | ||
109 | val body = InvBody(numeroInventario, | ||
110 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | ||
111 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | ||
112 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | ||
113 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | ||
114 | cantidad.toString(), | ||
115 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | ||
116 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | ||
117 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | ||
118 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | ||
119 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | ||
120 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | ||
121 | InventarioFragment().ObtenerFechaActual(), | ||
122 | InventarioFragment().ObtenerFechaActual()) | ||
123 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | ||
124 | VolverAinventario() | ||
125 | } else if (artCargadoEnBD != null) { | 128 | } else if (artCargadoEnBD != null) { |
126 | 129 | ||
127 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 130 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
128 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) | 131 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) |
129 | mDialogView.tvCantInicial.text = artCargadoEnBD!!.cantTomada | 132 | mDialogView.tvCantInicial.text = artCargadoEnBD!!.cantTomada |
130 | 133 | ||
131 | val mAlertDialog = mBuilder.show() | 134 | val mAlertDialog = mBuilder.show() |
132 | mDialogView.rbSumar.setOnClickListener { | 135 | mDialogView.rbSumar.setOnClickListener { |
133 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | 136 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") |
134 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 137 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
135 | } | 138 | } |
136 | mDialogView.rbRestar.setOnClickListener { | 139 | mDialogView.rbRestar.setOnClickListener { |
137 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | 140 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") |
138 | if (mDialogView.tvCantInicial.text.toString().toFloat() <= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 141 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
139 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 142 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
140 | } | 143 | } |
141 | } | 144 | } |
142 | mDialogView.rbMdodificar.setOnClickListener { | 145 | mDialogView.rbMdodificar.setOnClickListener { |
143 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 146 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
144 | } | 147 | } |
145 | mDialogView.btnAceptar.setOnClickListener { | 148 | mDialogView.btnAceptar.setOnClickListener { |
146 | mAlertDialog.dismiss() | ||
147 | val name = mDialogView.tvgenerico4.text.toString().toFloat() | 149 | val name = mDialogView.tvgenerico4.text.toString().toFloat() |
148 | //updateCantidad(artCargadoEnBD.sector.toString(),artCargadoEnBD.codigo.toString(), name) | 150 | updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(), (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo |
151 | .toString(), name) | ||
152 | VolverAinventario() | ||
153 | mAlertDialog.dismiss() | ||
149 | } | 154 | } |
150 | mDialogView.dialogCancelBtn.setOnClickListener { | 155 | mDialogView.dialogCancelBtn.setOnClickListener { |
151 | mAlertDialog.dismiss() | 156 | mAlertDialog.dismiss() |
152 | } | 157 | } |
153 | |||
154 | VolverAinventario() | ||
155 | } | 158 | } |
156 | } | 159 | } |
157 | |||
158 | } | 160 | } |
159 | 161 | ||
160 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 162 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
161 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 163 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
162 | val itemView = viewHolder.itemView | 164 | val itemView = viewHolder.itemView |
163 | 165 | ||
164 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 166 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
165 | 167 | ||
166 | if (dX > 0) { | 168 | if (dX > 0) { |
167 | 169 | ||
168 | c.drawColor(Color.RED) | 170 | c.drawColor(Color.RED) |
169 | } else if (dX < 0) { | 171 | } else if (dX < 0) { |
170 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | 172 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) |
171 | c.drawColor(Color.YELLOW) | 173 | c.drawColor(Color.YELLOW) |
172 | } | 174 | } |
173 | swipeBackground.draw(c) | 175 | swipeBackground.draw(c) |
174 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 176 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
175 | } | 177 | } |
176 | } | 178 | } |
177 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | 179 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) |
178 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) | 180 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) |
179 | 181 | ||
180 | } | 182 | } |
181 | 183 | ||
182 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 184 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
183 | lifecycleScope.launch { | 185 | lifecycleScope.launch { |
184 | withContext(Dispatchers.IO) { | 186 | withContext(Dispatchers.IO) { |
185 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 187 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
186 | } | 188 | } |
187 | } | 189 | } |
188 | } | 190 | } |
189 | 191 | ||
190 | fun VolverAinventario() { | 192 | fun VolverAinventario() { |
191 | 193 | ||
192 | val editor = sharedPreferences.edit() | 194 | val editor = sharedPreferences.edit() |
193 | editor?.putString("Inventario", numeroInventario.toString()) | 195 | editor?.putString("Inventario", numeroInventario.toString()) |
194 | editor?.apply() | 196 | editor?.apply() |
195 | editor.commit() | 197 | editor.commit() |
196 | navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | 198 | navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) |
197 | } | 199 | } |
198 | 200 | ||
199 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { | 201 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { |
200 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 202 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
201 | var busqueda: InvBody? = null | 203 | var busqueda: InvBody? = null |
app/src/main/java/com/focasoftware/deboinventariov20/ui/detalleProducto/DetalleArtFragment.kt
File was created | 1 | package com.focasoftware.deboinventariov20.ui.detalleProducto | |
2 | |||
3 | import android.content.Context | ||
4 | import android.content.SharedPreferences | ||
5 | import android.os.Bundle | ||
6 | import android.view.LayoutInflater | ||
7 | import android.view.View | ||
8 | import android.view.ViewGroup | ||
9 | import androidx.fragment.app.Fragment | ||
10 | import androidx.navigation.NavController | ||
11 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
12 | import com.focasoftware.deboinventariov20.Model.Articles | ||
13 | import com.focasoftware.deboinventariov20.R | ||
14 | import kotlinx.android.synthetic.main.fragment_detalle_art.* | ||
15 | import kotlinx.coroutines.Dispatchers | ||
16 | import kotlinx.coroutines.GlobalScope | ||
17 | import kotlinx.coroutines.async | ||
18 | import kotlinx.coroutines.launch | ||
19 | |||
20 | |||
21 | class DetalleArtFragment : Fragment() { | ||
22 | |||
23 | private lateinit var navController: NavController | ||
24 | private var Inventario: Int = 0 | ||
25 | private var sector: String? = null | ||
26 | private var codigo: String? = null | ||
27 | private var artSerch: Articles? = null | ||
28 | lateinit var sharedPreferences: SharedPreferences | ||
29 | |||
30 | override fun onCreate(savedInstanceState: Bundle?) { | ||
31 | super.onCreate(savedInstanceState) | ||
32 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | ||
33 | arguments?.let { | ||
34 | sector = it.getString("sector") | ||
35 | codigo = it.getString("codigo") | ||
36 | Inventario= it.getInt("numeroInv") | ||
37 | } | ||
38 | marcarInventario() | ||
39 | GlobalScope.launch(Dispatchers.Main) { | ||
40 | |||
41 | artSerch = buscarCodigoDeboEnBD(sector, codigo) | ||
42 | if (artSerch == null) { | ||
43 | |||
44 | // val type = InputType.TYPE_CLASS_NUMBER | ||
45 | // MaterialDialog(requireContext()).show { | ||
46 | // | ||
47 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | ||
48 | // message(R.string.sCantidadNueva) | ||
49 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | ||
50 | // fCant = 0F | ||
51 | // fCant = charSequence.toString().toFloat() | ||
52 | // } | ||
53 | // positiveButton(R.string.btnOk) { | ||
54 | // //TODO ACTUALIZO CANTIADAD EN BD | ||
55 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
56 | // //TODO ACTUALIZO CANTIDAD EN RV | ||
57 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
58 | // viewAdapter.notifyDataSetChanged() | ||
59 | // dismiss() | ||
60 | // } | ||
61 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
62 | } else if (artSerch != null) { | ||
63 | tvSector.text=sector | ||
64 | tvCodigo.text=codigo | ||
65 | tvDeposito.text=if(artSerch!!.depSn!!.toInt() ==0)"No" else "Si" | ||
66 | tvDescripcion.text=artSerch!!.descripcion.toString() | ||
67 | tvCodigoBarras.text=artSerch!!.codBar.toString() | ||
68 | tvCodigoOrigen.text=artSerch!!.codOrigen.toString() | ||
69 | tvExiVenta.text=artSerch!!.exiVenta.toString() | ||
70 | tvExiDeposito.text=artSerch!!.exiDeposito.toString() | ||
71 | tvBal.text=artSerch!!.balanza.toString() | ||
72 | tvDE.text=artSerch!!.de.toString() | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | |||
77 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
78 | |||
79 | return inflater.inflate(R.layout.fragment_detalle_art, container, false) | ||
80 | } | ||
81 | |||
82 | suspend fun buscarCodigoDeboEnBD(sector: String?, codigo: String?): Articles? { | ||
83 | //TODO BUSQUEDA POR CODIGO DE BARRAS | ||
84 | var busqueda: Articles? = null | ||
85 | return GlobalScope.async(Dispatchers.IO) { | ||
86 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.fetchArticuloByCodSec(sector, codigo) | ||
87 | return@async busqueda | ||
88 | }.await() | ||
89 | } | ||
90 | fun marcarInventario() { | ||
91 | |||
92 | val editor = sharedPreferences.edit() | ||
93 | editor?.putString("Inventario", Inventario.toString()) | ||
94 | editor?.apply() | ||
95 | editor.commit() | ||
96 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | ||
97 | } | ||
98 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/DialogPersoComplexCantidadModificacion.kt
1 | package com.focasoftware.deboinventariov20.ui.inventario | File was deleted | |
2 | |||
3 | import android.app.AlertDialog | ||
4 | import android.app.Dialog | ||
5 | import android.content.Context | ||
6 | import android.text.Editable | ||
7 | import android.text.TextWatcher | ||
8 | import android.view.View | ||
9 | import android.view.View.OnFocusChangeListener | ||
10 | import android.widget.Button | ||
11 | import android.widget.EditText | ||
12 | import android.widget.ImageView | ||
13 | import android.widget.TextView | ||
14 | import com.focasoftware.deboinventariov20.R | ||
15 | |||
16 | /** | ||
17 | * Dialogo que permite mostrar una UI para modificar la cantidad de un articulo | ||
18 | * en las BD | ||
19 | * @author GuillermoR | ||
20 | */ | ||
21 | class DialogPersoComplexCantidadModificacion(context: Context?, | ||
22 | tipo_operacion: Int, | ||
23 | valor_inicial: Float, | ||
24 | listenerValidar: View.OnClickListener?, | ||
25 | listenerCancelar: View.OnClickListener?, | ||
26 | listenerReset: View.OnClickListener?) : Dialog(context!!), GestionarioTecladoVirtual { | ||
27 | /** | ||
28 | * TextView para mostrar el valor incical | ||
29 | */ | ||
30 | private val textV_valor_inicial: TextView | ||
31 | |||
32 | /** | ||
33 | * Text view para mostrar el valor previsional luego de modificar su cantidad | ||
34 | */ | ||
35 | private val textV_valor_previsional: TextView | ||
36 | |||
37 | /** | ||
38 | * EditText para almacenar el nuevo valor a ingresar | ||
39 | */ | ||
40 | private val editT_nuevo_valor: EditText | ||
41 | |||
42 | /** | ||
43 | * Boton para resetear la cantidad | ||
44 | */ | ||
45 | private val boton_reset: Button? = null | ||
46 | |||
47 | /** | ||
48 | * Variables accesorias | ||
49 | */ | ||
50 | private var VALOR_INICIO = 0f | ||
51 | private var TIPO_OPERACION = -1 | ||
52 | |||
53 | /** | ||
54 | * Devuleve el nuevo valor | ||
55 | * | ||
56 | * 1 Test para ver si el valor tiene formato a nombre, sino 0 | ||
57 | * | ||
58 | * 2 Para provocar la excepcion si s no es del tipo Integer | ||
59 | * | ||
60 | * 3 En caso de error, devolvemos 0 si se trata de "sumar" o "restar". | ||
61 | * En el caso del "modificar", devolvemos "" para poder | ||
62 | * restablecer un "No Tomado", o valor inicial sino | ||
63 | * | ||
64 | * @return | ||
65 | */ | ||
66 | fun get_nuevo_valor(): String { | ||
67 | //1 Test para ver si el valor tiene formato a nombre, sino 0: | ||
68 | val s = editT_nuevo_valor.text.toString() | ||
69 | return try { | ||
70 | //2 Para provocar la excepcion si s no es del tipo Integer | ||
71 | s.toFloat() | ||
72 | s | ||
73 | } catch (ex: Exception) { | ||
74 | VALOR_INICIO.toString() | ||
75 | } | ||
76 | } | ||
77 | |||
78 | fun valor_incorrecto(context: Context?) { | ||
79 | val show = AlertDialog.Builder(context).setTitle("Debo Inventario").setMessage("Valor ingresado incorrecto").show() | ||
80 | } | ||
81 | |||
82 | override fun showKeyboard(edit_text: EditText?) { | ||
83 | // TODO Auto-generated method stub | ||
84 | } | ||
85 | |||
86 | override fun hideKeyboard(edit_text: EditText?) { | ||
87 | // TODO Auto-generated method stub | ||
88 | } | ||
89 | |||
90 | /** | ||
91 | * Constructor completo, setea las UI y carga los handlers | ||
92 | * | ||
93 | * 1 Construccin del ttulo | ||
94 | * | ||
95 | * 2 Cargamos el layout y main layout | ||
96 | * | ||
97 | * 3 Actualizacin de los textos | ||
98 | * | ||
99 | * 4 Si estamos en el modo "MODIFICAR", | ||
100 | * se habilita la posibilidad de reestablecer el valor a No Tomado | ||
101 | * | ||
102 | * 5 EditTexts y handlers de los mismos | ||
103 | * | ||
104 | * 6 Botones y sus handlers | ||
105 | * | ||
106 | * @param context | ||
107 | * @param tipo_operacion | ||
108 | * @param valor_inicial | ||
109 | * @param listenerValidar | ||
110 | * @param listenerCancelar | ||
111 | * @param listenerReset | ||
112 | */ | ||
113 | init { | ||
114 | super.setTitle("Nuevo valor") | ||
115 | |||
116 | |||
117 | // System.out.println("::: DialogComple modificacion antes del switch"); | ||
118 | super.setContentView(R.layout.z_dialogpersocomplexcantidad_modificacion) | ||
119 | |||
120 | //3 Actualizacin de los textos: | ||
121 | textV_valor_inicial = super.findViewById<View>(R.id.Z_DIALOG_cantidad_actual) as TextView | ||
122 | textV_valor_inicial.text = valor_inicial.toString() | ||
123 | VALOR_INICIO = valor_inicial | ||
124 | TIPO_OPERACION = tipo_operacion | ||
125 | textV_valor_previsional = super.findViewById<View>(R.id.Z_DIALOG_cantidad_final) as TextView | ||
126 | textV_valor_previsional.text = valor_inicial.toString() | ||
127 | |||
128 | |||
129 | //5 EditTexts y handlers de los mismos | ||
130 | editT_nuevo_valor = super.findViewById<View>(R.id.Z_DIALOG_cantidad_nueva) as EditText | ||
131 | editT_nuevo_valor.onFocusChangeListener = OnFocusChangeListener { v, hasFocus -> showKeyboard(editT_nuevo_valor) } | ||
132 | editT_nuevo_valor.addTextChangedListener(object : TextWatcher { | ||
133 | override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {} | ||
134 | override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} | ||
135 | override fun afterTextChanged(s: Editable) { | ||
136 | val new_val = 0f | ||
137 | var val_temp = 0f | ||
138 | val_temp = s.toString().toFloat() | ||
139 | textV_valor_previsional.text = val_temp.toString() | ||
140 | } | ||
141 | }) | ||
142 | val textV_operacion = super.findViewById<View>(R.id.Z_DIALOG_tipo_operacion) as TextView | ||
143 | var miTexto = "" | ||
144 | miTexto = "NUEVO VALOR: " | ||
145 | textV_operacion.text = miTexto | ||
146 | |||
147 | //6 Botones y sus handlers: | ||
148 | val boton_validar = super.findViewById<View>(R.id.Z_DIALOG_validar) as ImageView | ||
149 | val boton_cancelar = super.findViewById<View>(R.id.Z_DIALOG_cancelar) as ImageView | ||
150 | boton_validar.setOnClickListener(listenerValidar) | ||
151 | boton_cancelar.setOnClickListener(listenerCancelar) | ||
152 | } | ||
153 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/GestionarioTecladoVirtual.kt
1 | package com.focasoftware.deboinventariov20.ui.inventario | File was deleted | |
2 | |||
3 | import android.widget.EditText | ||
4 | |||
5 | /** | ||
6 | * Interface que representa metodos para administrar (Mostrar u ocultar) el teclado | ||
7 | * virtual | ||
8 | * @author GuillermoR | ||
9 | */ | ||
10 | interface GestionarioTecladoVirtual { | ||
11 | /** | ||
12 | * Funcion a implementar para mostrar el teclado virtual sobre el editText parametro | ||
13 | * @param edit_text | ||
14 | */ | ||
15 | fun showKeyboard(edit_text: EditText?) | ||
16 | |||
17 | /** | ||
18 | * Funcion a implementar para ocultar el teclado virtual sobre el editText parametro | ||
19 | * @param edit_text | ||
20 | */ | ||
21 | fun hideKeyboard(edit_text: EditText?) | ||
22 | } |
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.app.AlertDialog | 3 | import android.app.AlertDialog |
4 | import android.content.Context | 4 | import android.content.Context |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import android.graphics.Canvas | 6 | import android.graphics.Canvas |
7 | import android.graphics.Color | 7 | import android.graphics.Color |
8 | import android.graphics.drawable.Drawable | 8 | import android.graphics.drawable.Drawable |
9 | import android.os.Bundle | 9 | import android.os.Bundle |
10 | import android.text.InputType | 10 | import android.text.InputType |
11 | import android.view.KeyEvent | 11 | import android.view.KeyEvent |
12 | import android.view.LayoutInflater | 12 | import android.view.LayoutInflater |
13 | import android.view.View | 13 | import android.view.View |
14 | import android.view.ViewGroup | 14 | import android.view.ViewGroup |
15 | import android.widget.EditText | 15 | import android.widget.EditText |
16 | import android.widget.TextView | 16 | import android.widget.TextView |
17 | import android.widget.Toast | 17 | import android.widget.Toast |
18 | import androidx.core.content.ContextCompat | 18 | import androidx.core.content.ContextCompat |
19 | import androidx.core.os.bundleOf | 19 | import androidx.core.os.bundleOf |
20 | import androidx.fragment.app.Fragment | 20 | import androidx.fragment.app.Fragment |
21 | import androidx.lifecycle.lifecycleScope | 21 | import androidx.lifecycle.lifecycleScope |
22 | import androidx.navigation.NavController | 22 | import androidx.navigation.NavController |
23 | import androidx.navigation.Navigation | 23 | import androidx.navigation.Navigation |
24 | import androidx.recyclerview.widget.ItemTouchHelper | 24 | import androidx.recyclerview.widget.ItemTouchHelper |
25 | import androidx.recyclerview.widget.LinearLayoutManager | 25 | import androidx.recyclerview.widget.LinearLayoutManager |
26 | import androidx.recyclerview.widget.RecyclerView | 26 | import androidx.recyclerview.widget.RecyclerView |
27 | import com.afollestad.materialdialogs.MaterialDialog | 27 | import com.afollestad.materialdialogs.MaterialDialog |
28 | import com.afollestad.materialdialogs.input.input | 28 | import com.afollestad.materialdialogs.input.input |
29 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 29 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
30 | import com.focasoftware.deboinventariov20.Model.Articles | 30 | import com.focasoftware.deboinventariov20.Model.Articles |
31 | import com.focasoftware.deboinventariov20.Model.InvBody | 31 | import com.focasoftware.deboinventariov20.Model.InvBody |
32 | import com.focasoftware.deboinventariov20.Model.InvHead | 32 | import com.focasoftware.deboinventariov20.Model.InvHead |
33 | import com.focasoftware.deboinventariov20.R | 33 | import com.focasoftware.deboinventariov20.R |
34 | import kotlinx.android.synthetic.main.fragment_inventario.* | 34 | import kotlinx.android.synthetic.main.fragment_inventario.* |
35 | import kotlinx.android.synthetic.main.login_dialog.view.* | 35 | import kotlinx.android.synthetic.main.login_dialog.view.* |
36 | import kotlinx.coroutines.* | 36 | import kotlinx.coroutines.* |
37 | import java.time.LocalDateTime | 37 | import java.time.LocalDateTime |
38 | import java.time.format.DateTimeFormatter | 38 | import java.time.format.DateTimeFormatter |
39 | import java.util.* | 39 | import java.util.* |
40 | 40 | ||
41 | 41 | ||
42 | class InventarioFragment : Fragment() { | 42 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { |
43 | 43 | ||
44 | private lateinit var sharedPreferences: SharedPreferences | 44 | private lateinit var sharedPreferences: SharedPreferences |
45 | private var iArea: Int = 0 | 45 | private var iArea: Int = 0 |
46 | private lateinit var invHead: InvHead | 46 | private lateinit var invHead: InvHead |
47 | private lateinit var rcInventarios: RecyclerView | 47 | private lateinit var rcInventarios: RecyclerView |
48 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 48 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
49 | private lateinit var viewManager: RecyclerView.LayoutManager | 49 | private lateinit var viewManager: RecyclerView.LayoutManager |
50 | private lateinit var sChangeUpper: String | 50 | private lateinit var sChangeUpper: String |
51 | private var listArticulos = ArrayList<ItemsRecycler>() | 51 | private var listArticulos = ArrayList<ItemsRecycler>() |
52 | private lateinit var navController: NavController | 52 | private lateinit var navController: NavController |
53 | private var InventarioNuevo: Int = 0 | 53 | private var InventarioNuevo: Int = 0 |
54 | private var iEstado = 0 | 54 | private var iEstado = 0 |
55 | private var iBusquedaPor = 0 | 55 | private var iBusquedaPor = 0 |
56 | private var fCant = 0F | 56 | private var fCant = 0F |
57 | private var bFirst = false | 57 | private var bFirst = false |
58 | private lateinit var deleteIcon: Drawable | 58 | private lateinit var deleteIcon: Drawable |
59 | // private var editTT: EditText? = null | ||
60 | // private var dialogoModificacion: DialogPersoComplexCantidadModificacion? = null | ||
61 | 59 | ||
62 | override fun onCreate(savedInstanceState: Bundle?) { | 60 | override fun onCreate(savedInstanceState: Bundle?) { |
63 | super.onCreate(savedInstanceState) | 61 | super.onCreate(savedInstanceState) |
64 | 62 | ||
65 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 63 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
66 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { | 64 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { |
67 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() | 65 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() |
68 | val editor = sharedPreferences.edit() | 66 | val editor = sharedPreferences.edit() |
69 | editor?.putString("Inventario", "-1") | 67 | editor?.putString("Inventario", "-1") |
70 | editor?.apply() | 68 | editor?.apply() |
71 | editor.commit() | 69 | editor.commit() |
72 | } | 70 | } |
71 | |||
73 | } | 72 | } |
74 | 73 | ||
74 | |||
75 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 75 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
76 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) | 76 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) |
77 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 77 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
78 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) | 78 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) |
79 | rcInventarios = v.findViewById(R.id.rcInventarios) | 79 | rcInventarios = v.findViewById(R.id.rcInventarios) |
80 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) | 80 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) |
81 | 81 | ||
82 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO | 82 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO |
83 | GlobalScope.launch(Dispatchers.Main) { | 83 | GlobalScope.launch(Dispatchers.Main) { |
84 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO | 84 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO |
85 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 | 85 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 |
86 | SerchArea() | 86 | SerchArea() |
87 | val descripInv: String = if (iArea == 0) "Ventas" else "Deposito" | 87 | val descripInv: String = if (iArea == 0) "Ventas" else "Deposito" |
88 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO | 88 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO |
89 | invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont()) | 89 | invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont()) |
90 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) | 90 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) |
91 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 91 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
92 | } | 92 | } |
93 | } else {// TODO: SI VENGO DE FRAGMENT DESCRIPCION | 93 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) |
94 | listArticulos.clear() | ||
94 | CargarDeBdInventario(InventarioNuevo) | 95 | CargarDeBdInventario(InventarioNuevo) |
95 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 96 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
96 | } | 97 | } |
97 | 98 | ||
98 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> | 99 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> |
99 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { | 100 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { |
100 | sChangeUpper = tCodigoBarras.text.toString() | 101 | sChangeUpper = tCodigoBarras.text.toString() |
101 | 102 | ||
102 | var indiceDelArtEncontrado = 0 | 103 | var indiceDelArtEncontrado = 0 |
103 | 104 | ||
104 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | 105 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS |
105 | when (iBusquedaPor) { | 106 | when (iBusquedaPor) { |
106 | 0 -> { | 107 | 0 -> { |
107 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | 108 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice |
108 | //TODO Si no lo encuentra devuelve -1 | 109 | //TODO Si no lo encuentra devuelve -1 |
109 | if (indiceDelArtEncontrado != -1) { | 110 | if (indiceDelArtEncontrado != -1) { |
110 | if (swSumaUno!!.isChecked) { | 111 | if (swSumaUno!!.isChecked) { |
111 | fCant = 0F | 112 | fCant = 0F |
112 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 113 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
113 | fCant += 1F | 114 | fCant += 1F |
114 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 115 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
115 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 116 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
116 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 117 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
117 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 118 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
118 | viewAdapter.notifyDataSetChanged() | 119 | viewAdapter.notifyDataSetChanged() |
119 | } else { | 120 | } else { |
120 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 121 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
121 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | 122 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") |
122 | .setCancelable(false) | 123 | .setCancelable(false) |
123 | mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | 124 | mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() |
124 | val mAlertDialog = mBuilder.show() | 125 | val mAlertDialog = mBuilder.show() |
125 | mDialogView.rbSumar.setOnClickListener { | 126 | mDialogView.rbSumar.setOnClickListener { |
126 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | 127 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") |
127 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 128 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
128 | } | 129 | } |
129 | mDialogView.rbRestar.setOnClickListener { | 130 | mDialogView.rbRestar.setOnClickListener { |
130 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | 131 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") |
131 | if (mDialogView.tvCantInicial.text.toString().toFloat() <= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 132 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
132 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 133 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
133 | } | 134 | } |
134 | } | 135 | } |
135 | mDialogView.rbMdodificar.setOnClickListener { | 136 | mDialogView.rbMdodificar.setOnClickListener { |
136 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 137 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
137 | } | 138 | } |
138 | mDialogView.btnAceptar.setOnClickListener { | 139 | mDialogView.btnAceptar.setOnClickListener { |
139 | mAlertDialog.dismiss() | 140 | mAlertDialog.dismiss() |
140 | val name = mDialogView.tvgenerico4.text.toString().toFloat() | 141 | val name = mDialogView.tvgenerico4.text.toString().toFloat() |
141 | fCant = 0F | 142 | fCant = 0F |
142 | fCant = name | 143 | fCant = name |
143 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 144 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
144 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 145 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
145 | viewAdapter.notifyDataSetChanged() | 146 | viewAdapter.notifyDataSetChanged() |
146 | } | 147 | } |
147 | mDialogView.dialogCancelBtn.setOnClickListener { | 148 | mDialogView.dialogCancelBtn.setOnClickListener { |
148 | mAlertDialog.dismiss() | 149 | mAlertDialog.dismiss() |
149 | } | 150 | } |
150 | } | 151 | } |
151 | 152 | ||
152 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | 153 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD |
153 | 154 | ||
154 | GlobalScope.launch(Dispatchers.Main) { | 155 | GlobalScope.launch(Dispatchers.Main) { |
155 | //TODO BUSCO EN BASE DE DATOS | 156 | //TODO BUSCO EN BASE DE DATOS |
156 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 157 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
157 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | 158 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE |
158 | } | 159 | } |
159 | } | 160 | } |
160 | 161 | ||
161 | tCodigoBarras.focusable = View.FOCUSABLE | 162 | tCodigoBarras.focusable = View.FOCUSABLE |
162 | tCodigoBarras.setText("") | 163 | tCodigoBarras.setText("") |
163 | tCodigoBarras.selectAll() | 164 | tCodigoBarras.selectAll() |
164 | return@setOnKeyListener true | 165 | return@setOnKeyListener true |
165 | 166 | ||
166 | 167 | ||
167 | } | 168 | } |
168 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | 169 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** |
169 | // | 170 | // |
170 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | 171 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice |
171 | // //TODO Si no lo encuentra devuelve -1 | 172 | // //TODO Si no lo encuentra devuelve -1 |
172 | // if (indiceDelArtEncontrado != -1) { | 173 | // if (indiceDelArtEncontrado != -1) { |
173 | //// if (swSumaUno!!.isChecked) { | 174 | //// if (swSumaUno!!.isChecked) { |
174 | //// fCant = 0F | 175 | //// fCant = 0F |
175 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 176 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
176 | //// fCant += 1F | 177 | //// fCant += 1F |
177 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 178 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
178 | //// viewAdapter.notifyDataSetChanged() | 179 | //// viewAdapter.notifyDataSetChanged() |
179 | //// } else { | 180 | //// } else { |
180 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 181 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
181 | // MaterialDialog(requireContext()).show { | 182 | // MaterialDialog(requireContext()).show { |
182 | // title(R.string.sTituloNueva) | 183 | // title(R.string.sTituloNueva) |
183 | // message(R.string.sCantidadNueva) | 184 | // message(R.string.sCantidadNueva) |
184 | // input { materialDialog, charSequence -> | 185 | // input { materialDialog, charSequence -> |
185 | // fCant = 0F | 186 | // fCant = 0F |
186 | // fCant = charSequence.toString().toFloat() | 187 | // fCant = charSequence.toString().toFloat() |
187 | // } | 188 | // } |
188 | // positiveButton(R.string.btnOk) { | 189 | // positiveButton(R.string.btnOk) { |
189 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 190 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
190 | // viewAdapter.notifyDataSetChanged() | 191 | // viewAdapter.notifyDataSetChanged() |
191 | // dismiss() | 192 | // dismiss() |
192 | // } | 193 | // } |
193 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 194 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
194 | //// } | 195 | //// } |
195 | // | 196 | // |
196 | // } else if | 197 | // } else if |
197 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | 198 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD |
198 | GlobalScope.launch(Dispatchers.Main) { | 199 | GlobalScope.launch(Dispatchers.Main) { |
199 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 200 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
200 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | 201 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) |
201 | } | 202 | } |
202 | // } | 203 | // } |
203 | tCodigoBarras.focusable = View.FOCUSABLE | 204 | tCodigoBarras.focusable = View.FOCUSABLE |
204 | tCodigoBarras.setText("") | 205 | tCodigoBarras.setText("") |
205 | tCodigoBarras.selectAll() | 206 | tCodigoBarras.selectAll() |
206 | return@setOnKeyListener true | 207 | return@setOnKeyListener true |
207 | } | 208 | } |
208 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | 209 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** |
209 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice | 210 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice |
210 | //TODO Si no lo encuentra devuelve -1 | 211 | //TODO Si no lo encuentra devuelve -1 |
211 | if (indiceDelArtEncontrado != -1) { | 212 | if (indiceDelArtEncontrado != -1) { |
212 | if (swSumaUno!!.isChecked) { | 213 | if (swSumaUno!!.isChecked) { |
213 | fCant = 0F | 214 | fCant = 0F |
214 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 215 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
215 | fCant += 1F | 216 | fCant += 1F |
216 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 217 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
217 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 218 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
218 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 219 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
219 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 220 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
220 | viewAdapter.notifyDataSetChanged() | 221 | viewAdapter.notifyDataSetChanged() |
221 | } else { | 222 | } else { |
222 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 223 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
223 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | 224 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") |
224 | .setCancelable(false) | 225 | .setCancelable(false) |
225 | mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | 226 | mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() |
226 | val mAlertDialog = mBuilder.show() | 227 | val mAlertDialog = mBuilder.show() |
227 | mDialogView.rbSumar.setOnClickListener { | 228 | mDialogView.rbSumar.setOnClickListener { |
228 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | 229 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") |
229 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 230 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
230 | } | 231 | } |
231 | mDialogView.rbRestar.setOnClickListener { | 232 | mDialogView.rbRestar.setOnClickListener { |
232 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | 233 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") |
233 | if (mDialogView.tvCantInicial.text.toString().toFloat() <= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 234 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
234 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 235 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
235 | } | 236 | } |
236 | } | 237 | } |
237 | mDialogView.rbMdodificar.setOnClickListener { | 238 | mDialogView.rbMdodificar.setOnClickListener { |
238 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 239 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
239 | } | 240 | } |
240 | mDialogView.btnAceptar.setOnClickListener { | 241 | mDialogView.btnAceptar.setOnClickListener { |
241 | mAlertDialog.dismiss() | 242 | mAlertDialog.dismiss() |
242 | val name = mDialogView.tvgenerico4.text.toString().toFloat() | 243 | val name = mDialogView.tvgenerico4.text.toString().toFloat() |
243 | fCant = 0F | 244 | fCant = 0F |
244 | fCant = name | 245 | fCant = name |
245 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 246 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
246 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 247 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
247 | viewAdapter.notifyDataSetChanged() | 248 | viewAdapter.notifyDataSetChanged() |
248 | } | 249 | } |
249 | mDialogView.dialogCancelBtn.setOnClickListener { | 250 | mDialogView.dialogCancelBtn.setOnClickListener { |
250 | mAlertDialog.dismiss() | 251 | mAlertDialog.dismiss() |
251 | } | 252 | } |
252 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 253 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
253 | // val type = InputType.TYPE_CLASS_NUMBER | 254 | // val type = InputType.TYPE_CLASS_NUMBER |
254 | // MaterialDialog(requireContext()).show { | 255 | // MaterialDialog(requireContext()).show { |
255 | // | 256 | // |
256 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | 257 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
257 | // message(R.string.sCantidadNueva) | 258 | // message(R.string.sCantidadNueva) |
258 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 259 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
259 | // fCant = 0F | 260 | // fCant = 0F |
260 | // fCant = charSequence.toString().toFloat() | 261 | // fCant = charSequence.toString().toFloat() |
261 | // } | 262 | // } |
262 | // positiveButton(R.string.btnOk) { | 263 | // positiveButton(R.string.btnOk) { |
263 | // //TODO ACTUALIZO CANTIADAD EN BD | 264 | // //TODO ACTUALIZO CANTIADAD EN BD |
264 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 265 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
265 | // //TODO ACTUALIZO CANTIDAD EN RV | 266 | // //TODO ACTUALIZO CANTIDAD EN RV |
266 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 267 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
267 | // viewAdapter.notifyDataSetChanged() | 268 | // viewAdapter.notifyDataSetChanged() |
268 | // dismiss() | 269 | // dismiss() |
269 | // } | 270 | // } |
270 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 271 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
271 | } | 272 | } |
272 | 273 | ||
273 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | 274 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD |
274 | 275 | ||
275 | GlobalScope.launch(Dispatchers.Main) { | 276 | GlobalScope.launch(Dispatchers.Main) { |
276 | //TODO BUSCO EN BASE DE DATOS | 277 | //TODO BUSCO EN BASE DE DATOS |
277 | listArticulos[indiceDelArtEncontrado].cantTomada | 278 | listArticulos[indiceDelArtEncontrado].cantTomada |
278 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 279 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
279 | ContinuarCargaCB(artEncontrado) | 280 | ContinuarCargaCB(artEncontrado) |
280 | } | 281 | } |
281 | } | 282 | } |
282 | 283 | ||
283 | tCodigoBarras.focusable = View.FOCUSABLE | 284 | tCodigoBarras.focusable = View.FOCUSABLE |
284 | tCodigoBarras.setText("") | 285 | tCodigoBarras.setText("") |
285 | tCodigoBarras.selectAll() | 286 | tCodigoBarras.selectAll() |
286 | return@setOnKeyListener true | 287 | return@setOnKeyListener true |
287 | 288 | ||
288 | 289 | ||
289 | } | 290 | } |
290 | } | 291 | } |
291 | } | 292 | } |
292 | return@setOnKeyListener false | 293 | return@setOnKeyListener false |
293 | } | 294 | } |
294 | return v | 295 | return v |
295 | } | 296 | } |
296 | 297 | ||
297 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 298 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
298 | super.onViewCreated(view, savedInstanceState) | 299 | super.onViewCreated(view, savedInstanceState) |
299 | navController = Navigation.findNavController(view) | 300 | navController = Navigation.findNavController(view) |
300 | etCodigoBarras.requestFocus() | 301 | etCodigoBarras.requestFocus() |
301 | 302 | ||
302 | btnBorrarInv.setOnClickListener { | 303 | btnBorrarInv.setOnClickListener { |
303 | MaterialDialog(requireContext()).show { | 304 | MaterialDialog(requireContext()).show { |
304 | title(R.string.sTituloBorrarInv) | 305 | title(R.string.sTituloBorrarInv) |
305 | message(R.string.sMensajeBorrarInv) | 306 | message(R.string.sMensajeBorrarInv) |
306 | positiveButton(R.string.btnOk) { | 307 | positiveButton(R.string.btnOk) { |
307 | BorrarInvActual() | 308 | BorrarInvActual() |
308 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | 309 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() |
309 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 310 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
310 | InventarioNuevo = 0 | 311 | InventarioNuevo = 0 |
311 | dismiss() | 312 | dismiss() |
312 | } | 313 | } |
313 | negativeButton { | 314 | negativeButton { |
314 | dismiss() | 315 | dismiss() |
315 | } | 316 | } |
316 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 317 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
317 | } | 318 | } |
318 | 319 | ||
319 | btnExportarInv.setOnClickListener { | 320 | btnExportarInv.setOnClickListener { |
320 | MaterialDialog(requireContext()).show { | 321 | MaterialDialog(requireContext()).show { |
321 | title(R.string.sTituloExportar) | 322 | title(R.string.sTituloExportar) |
322 | message(R.string.sMensajeExportar) | 323 | message(R.string.sMensajeExportar) |
323 | positiveButton(R.string.btnOk) { | 324 | positiveButton(R.string.btnOk) { |
324 | BorrarInvActual() | 325 | BorrarInvActual() |
325 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | 326 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() |
326 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 327 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
327 | InventarioNuevo = 0 | 328 | InventarioNuevo = 0 |
328 | dismiss() | 329 | dismiss() |
329 | } | 330 | } |
330 | negativeButton { | 331 | negativeButton { |
331 | dismiss() | 332 | dismiss() |
332 | } | 333 | } |
333 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 334 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
334 | } | 335 | } |
335 | ivCamara.setOnClickListener { | 336 | ivCamara.setOnClickListener { |
336 | if (!bFirst) { | 337 | if (!bFirst) { |
337 | iEstado = 1 | 338 | iEstado = 1 |
338 | bFirst = true | 339 | bFirst = true |
339 | } | 340 | } |
340 | 341 | ||
341 | when (iEstado) { | 342 | when (iEstado) { |
342 | 0 -> { | 343 | 0 -> { |
343 | ivCamara.setImageResource(R.drawable.codbar) | 344 | ivCamara.setImageResource(R.drawable.codbar) |
344 | etCodigoBarras.hint = "Busqueda por C. Barras" | 345 | etCodigoBarras.hint = "Busqueda por C. Barras" |
345 | swSumaUno.visibility = View.VISIBLE | 346 | swSumaUno.visibility = View.VISIBLE |
346 | iBusquedaPor = 0 | 347 | iBusquedaPor = 0 |
347 | iEstado = 1 | 348 | iEstado = 1 |
348 | } | 349 | } |
349 | 1 -> { | 350 | 1 -> { |
350 | ivCamara.setImageResource(R.drawable.desc) | 351 | ivCamara.setImageResource(R.drawable.desc) |
351 | etCodigoBarras.hint = "Busqueda por Descripción" | 352 | etCodigoBarras.hint = "Busqueda por Descripción" |
352 | swSumaUno.visibility = View.GONE | 353 | swSumaUno.visibility = View.GONE |
353 | iBusquedaPor = 1 | 354 | iBusquedaPor = 1 |
354 | iEstado = 2 | 355 | iEstado = 2 |
355 | } | 356 | } |
356 | 2 -> { | 357 | 2 -> { |
357 | ivCamara.setImageResource(R.drawable.cod_origen) | 358 | ivCamara.setImageResource(R.drawable.cod_origen) |
358 | etCodigoBarras.hint = "Busqueda por C. Origen" | 359 | etCodigoBarras.hint = "Busqueda por C. Origen" |
359 | swSumaUno.visibility = View.GONE | 360 | swSumaUno.visibility = View.GONE |
360 | iBusquedaPor = 2 | 361 | iBusquedaPor = 2 |
361 | iEstado = 0 | 362 | iEstado = 0 |
362 | } | 363 | } |
363 | } | 364 | } |
364 | } | 365 | } |
365 | } | 366 | } |
366 | 367 | ||
367 | private fun BorrarInvActual() { | 368 | private fun BorrarInvActual() { |
368 | lifecycleScope.launch { | 369 | lifecycleScope.launch { |
369 | withContext(Dispatchers.IO) { | 370 | withContext(Dispatchers.IO) { |
370 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) | 371 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) |
371 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) | 372 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) |
372 | } | 373 | } |
373 | } | 374 | } |
374 | } | 375 | } |
375 | 376 | ||
376 | private fun CargarDeBdInventario(ultimoInv: Int) { | 377 | private fun CargarDeBdInventario(ultimoInv: Int) { |
377 | GlobalScope.launch(Dispatchers.Main) { | 378 | GlobalScope.launch(Dispatchers.Main) { |
378 | val invbody = cargarInventario(ultimoInv) | 379 | val invbody = cargarInventario(ultimoInv) |
379 | for ((i, item) in invbody!!.withIndex()) { | 380 | for ((i, item) in invbody!!.withIndex()) { |
380 | val art = Articles(invbody[i].sector, | 381 | val art = Articles(invbody[i].sector, |
381 | invbody[i].codigo, | 382 | invbody[i].codigo, |
382 | invbody[i].descripcion, | 383 | invbody[i].descripcion, |
383 | invbody[i].codBar, | 384 | invbody[i].codBar, |
384 | invbody[i].codOrigen, | 385 | invbody[i].codOrigen, |
385 | invbody[i].precio, | 386 | invbody[i].precio, |
386 | invbody[i].costo, | 387 | invbody[i].costo, |
388 | "","","", | ||
387 | invbody[i].balanza, | 389 | invbody[i].balanza, |
388 | invbody[i].depSn, | 390 | invbody[i].depSn, |
389 | invbody[i].costo) | 391 | invbody[i].costo) |
390 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) | 392 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) |
391 | } | 393 | } |
392 | } | 394 | } |
393 | 395 | ||
394 | } | 396 | } |
395 | 397 | ||
396 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { | 398 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { |
397 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS | 399 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS |
398 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV | 400 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV |
399 | 401 | ||
400 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | 402 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD |
401 | // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1 | 403 | // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1 |
402 | if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 404 | if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
403 | fCant = 0F | 405 | fCant = 0F |
404 | fCant += 1F | 406 | fCant += 1F |
405 | // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 407 | // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
406 | val acargarPorDesc = Articles(artAcargar[0].sector, | 408 | val acargarPorDesc = Articles(artAcargar[0].sector, |
407 | artAcargar[0].codigo, | 409 | artAcargar[0].codigo, |
408 | artAcargar[0].descripcion, | 410 | artAcargar[0].descripcion, |
409 | artAcargar[0].codBar, | 411 | artAcargar[0].codBar, |
410 | artAcargar[0].codOrigen, | 412 | artAcargar[0].codOrigen, |
411 | artAcargar[0].precio, | 413 | artAcargar[0].precio, |
412 | artAcargar[0].costo, | 414 | artAcargar[0].costo,"","","", |
413 | artAcargar[0].balanza, | 415 | artAcargar[0].balanza, |
414 | artAcargar[0].depSn, | 416 | artAcargar[0].depSn, |
415 | "") | 417 | "") |
416 | // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 418 | // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
417 | cargarArtEnBd(acargarPorDesc, fCant) | 419 | cargarArtEnBd(acargarPorDesc, fCant) |
418 | cargarRecicler(acargarPorDesc, fCant) | 420 | cargarRecicler(acargarPorDesc, fCant) |
419 | } else { | 421 | } else { |
420 | var bundle = Bundle() | 422 | var bundle = Bundle() |
421 | bundle = bundleOf("ArrayDesc" to artAcargar) | 423 | bundle = bundleOf("ArrayDesc" to artAcargar) |
422 | bundle.putInt("numeroInv", InventarioNuevo) | 424 | bundle.putInt("numeroInv", InventarioNuevo) |
423 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 425 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
424 | } | 426 | } |
425 | // } else {//SI NO ESTA +1 | 427 | // } else {//SI NO ESTA +1 |
426 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 428 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
427 | // fCant = listArticulos[0].cantTomada | 429 | // fCant = listArticulos[0].cantTomada |
428 | // MaterialDialog(requireContext()).show { | 430 | // MaterialDialog(requireContext()).show { |
429 | // title(R.string.sTituloNueva) | 431 | // title(R.string.sTituloNueva) |
430 | // message(R.string.sCantidadNueva) | 432 | // message(R.string.sCantidadNueva) |
431 | // input { materialDialog, charSequence -> | 433 | // input { materialDialog, charSequence -> |
432 | // fCant = 0F | 434 | // fCant = 0F |
433 | // fCant = charSequence.toString().toFloat() | 435 | // fCant = charSequence.toString().toFloat() |
434 | // } | 436 | // } |
435 | // positiveButton(R.string.btnOk) { | 437 | // positiveButton(R.string.btnOk) { |
436 | // listArticulos[0].cantTomada = fCant | 438 | // listArticulos[0].cantTomada = fCant |
437 | // viewAdapter.notifyDataSetChanged() | 439 | // viewAdapter.notifyDataSetChanged() |
438 | // dismiss() | 440 | // dismiss() |
439 | // } | 441 | // } |
440 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 442 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
441 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 443 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
442 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 444 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
443 | // artAcargar[0].codigo, | 445 | // artAcargar[0].codigo, |
444 | // artAcargar[0].descripcion, | 446 | // artAcargar[0].descripcion, |
445 | // artAcargar[0].codBar, | 447 | // artAcargar[0].codBar, |
446 | // artAcargar[0].cod_origen, | 448 | // artAcargar[0].cod_origen, |
447 | // artAcargar[0].precio, | 449 | // artAcargar[0].precio, |
448 | // artAcargar[0].costo, | 450 | // artAcargar[0].costo, |
449 | // artAcargar[0].balanza, | 451 | // artAcargar[0].balanza, |
450 | // artAcargar[0].depSn, | 452 | // artAcargar[0].depSn, |
451 | // "") | 453 | // "") |
452 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 454 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
453 | // cargarArtEnBd(acargarPorDesc, fCant) | 455 | // cargarArtEnBd(acargarPorDesc, fCant) |
454 | // cargarRecicler(acargarPorDesc, fCant) | 456 | // cargarRecicler(acargarPorDesc, fCant) |
455 | // } else { | 457 | // } else { |
456 | // var bundle = Bundle() | 458 | // var bundle = Bundle() |
457 | // bundle = bundleOf("ArrayDesc" to artAcargar) | 459 | // bundle = bundleOf("ArrayDesc" to artAcargar) |
458 | // bundle.putInt("numeroInv", InventarioNuevo) | 460 | // bundle.putInt("numeroInv", InventarioNuevo) |
459 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 461 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
460 | // } | 462 | // } |
461 | // } | 463 | // } |
462 | } else {//TODO si no lo encuentra en la BD | 464 | } else {//TODO si no lo encuentra en la BD |
463 | MaterialDialog(requireContext()).show { | 465 | MaterialDialog(requireContext()).show { |
464 | title(text = "El articulo ${etCodigoBarras.text}") | 466 | title(text = "El articulo ${etCodigoBarras.text}") |
465 | message(R.string.sMensaje) | 467 | message(R.string.sMensaje) |
466 | positiveButton(R.string.btnOk) { | 468 | positiveButton(R.string.btnOk) { |
467 | dismiss() | 469 | dismiss() |
468 | } | 470 | } |
469 | }.cornerRadius(10F) | 471 | }.cornerRadius(10F) |
470 | } | 472 | } |
471 | } | 473 | } |
472 | 474 | ||
473 | private fun ContinuarCargaCB(artAcargar: Articles?) { | 475 | private fun ContinuarCargaCB(artAcargar: Articles?) { |
474 | 476 | ||
475 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD | 477 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD |
476 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 | 478 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 |
477 | fCant = 0F | 479 | fCant = 0F |
478 | fCant += 1F | 480 | fCant += 1F |
479 | cargarArtEnBd(artAcargar, fCant) | 481 | cargarArtEnBd(artAcargar, fCant) |
480 | cargarRecicler(artAcargar, fCant) | 482 | cargarRecicler(artAcargar, fCant) |
481 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD | 483 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD |
482 | 484 | ||
483 | val type = InputType.TYPE_CLASS_PHONE | 485 | val type = InputType.TYPE_CLASS_PHONE |
484 | MaterialDialog(requireContext()).show { | 486 | MaterialDialog(requireContext()).show { |
485 | 487 | ||
486 | title(text = "Producto: $sChangeUpper") | 488 | title(text = "Producto: ${artAcargar.descripcion.toString()}") |
487 | message(text = "Ingrese la cantidad") | 489 | message(text = "Ingrese la cantidad") |
488 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 490 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
489 | // val inputField = materialDialog.getInputField() | 491 | // val inputField = materialDialog.getInputField() |
490 | // val isValid = charSequence.isEmpty() | 492 | // val isValid = charSequence.isEmpty() |
491 | // | 493 | // |
492 | // inputField.error = if (isValid) null else "El campo no puede quedar vacio" | 494 | // inputField.error = if (isValid) null else "El campo no puede quedar vacio" |
493 | // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid) | 495 | // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid) |
494 | fCant = 0F | 496 | fCant = 0F |
495 | fCant = charSequence.toString().toFloat() | 497 | fCant = charSequence.toString().toFloat() |
496 | } | 498 | } |
497 | positiveButton(R.string.btnOk) { | 499 | positiveButton(R.string.btnOk) { |
498 | dismiss() | 500 | dismiss() |
499 | cargarArtEnBd(artAcargar, fCant) | 501 | cargarArtEnBd(artAcargar, fCant) |
500 | cargarRecicler(artAcargar, fCant) | 502 | cargarRecicler(artAcargar, fCant) |
501 | 503 | ||
502 | } | 504 | } |
503 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 505 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
504 | } | 506 | } |
505 | } else {// TODO si no lo encuentra en la BD | 507 | } else {// TODO si no lo encuentra en la BD |
506 | 508 | ||
507 | MaterialDialog(requireContext()).show { | 509 | MaterialDialog(requireContext()).show { |
508 | title(text = "El producto: $sChangeUpper") | 510 | title(text = "El producto: $sChangeUpper") |
509 | message(text = "¡No fue encontrado!") | 511 | message(text = "¡No fue encontrado!") |
510 | positiveButton(R.string.btnOk) {} | 512 | positiveButton(R.string.btnOk) {} |
511 | dismiss() | 513 | dismiss() |
512 | } | 514 | } |
513 | } | 515 | } |
514 | } | 516 | } |
515 | 517 | ||
516 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { | 518 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { |
517 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 519 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
518 | var busqueda: Articles? = null | 520 | var busqueda: Articles? = null |
519 | return GlobalScope.async(Dispatchers.IO) { | 521 | return GlobalScope.async(Dispatchers.IO) { |
520 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea) | 522 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea) |
521 | return@async busqueda | 523 | return@async busqueda |
522 | }.await() | 524 | }.await() |
523 | } | 525 | } |
524 | 526 | ||
525 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { | 527 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { |
526 | //TODO BUSQUEDA POR DESCRIPCION | 528 | //TODO BUSQUEDA POR DESCRIPCION |
527 | var busqueda: List<Articles>? = null | 529 | var busqueda: List<Articles>? = null |
528 | return GlobalScope.async(Dispatchers.IO) { | 530 | return GlobalScope.async(Dispatchers.IO) { |
529 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea) | 531 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea) |
530 | return@async busqueda | 532 | return@async busqueda |
531 | }.await() | 533 | }.await() |
532 | } | 534 | } |
533 | 535 | ||
536 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { | ||
537 | //TODO BUSQUEDA POR DESCRIPCION | ||
538 | var result:Int | ||
539 | return GlobalScope.async(Dispatchers.IO) { | ||
540 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo,inventario) | ||
541 | return@async result | ||
542 | }.await() | ||
543 | } | ||
534 | private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | 544 | private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { |
535 | var indice = 0 | 545 | var indice = 0 |
536 | var bEncontrado = false | 546 | var bEncontrado = false |
537 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | 547 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS |
538 | for (item in listArticulos) { | 548 | for (item in listArticulos) { |
539 | if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 549 | if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
540 | bEncontrado = true | 550 | bEncontrado = true |
541 | break | 551 | break |
542 | } | 552 | } |
543 | indice += 1 | 553 | indice += 1 |
544 | } | 554 | } |
545 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | 555 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION |
546 | for (item in listArticulos) { | 556 | for (item in listArticulos) { |
547 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 557 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
548 | bEncontrado = true | 558 | bEncontrado = true |
549 | break | 559 | break |
550 | } | 560 | } |
551 | indice += 1 | 561 | indice += 1 |
552 | } | 562 | } |
553 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | 563 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN |
554 | for (item in listArticulos) { | 564 | for (item in listArticulos) { |
555 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 565 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
556 | bEncontrado = true | 566 | bEncontrado = true |
557 | break | 567 | break |
558 | } | 568 | } |
559 | indice += 1 | 569 | indice += 1 |
560 | } | 570 | } |
561 | } | 571 | } |
562 | return if (bEncontrado) indice | 572 | return if (bEncontrado) indice |
563 | else -1 | 573 | else -1 |
564 | } | 574 | } |
565 | 575 | ||
566 | private fun cargarArtEnBd(articulos: Articles, cant: Float) { | 576 | private fun cargarArtEnBd(articulos: Articles, cant: Float) { |
567 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD | 577 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD |
568 | articulos.sector, | 578 | articulos.sector, |
569 | articulos.codigo, | 579 | articulos.codigo, |
570 | articulos.descripcion, | 580 | articulos.descripcion, |
571 | cant.toString(), | 581 | cant.toString(), |
572 | articulos.codBar, | 582 | articulos.codBar, |
573 | articulos.codOrigen, | 583 | articulos.codOrigen, |
574 | articulos.precio, | 584 | articulos.precio, |
575 | articulos.precio, | 585 | articulos.precio, |
576 | articulos.balanza, | 586 | articulos.balanza, |
577 | articulos.depSn, | 587 | articulos.depSn, |
578 | ObtenerFechaActual(), | 588 | ObtenerFechaActual(), |
579 | ObtenerFechaActual()) | 589 | ObtenerFechaActual()) |
580 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS | 590 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS |
581 | } | 591 | } |
582 | 592 | ||
583 | fun cargarRecicler(articulos: Articles, cant: Float) { | 593 | fun cargarRecicler(articulos: Articles, cant: Float) { |
584 | |||
585 | //TODO CARGO EN LE RV | 594 | //TODO CARGO EN LE RV |
586 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen) | 595 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen) |
587 | listArticulos.add(item) | 596 | listArticulos.add(item) |
588 | 597 | ||
589 | viewAdapter = ProductosListAdapter(listArticulos) | 598 | viewAdapter = ProductosListAdapter(requireContext(),listArticulos, this) |
590 | viewManager = LinearLayoutManager(requireContext()) | 599 | viewManager = LinearLayoutManager(requireContext()) |
591 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 600 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
592 | rcInventarios.apply { | 601 | rcInventarios.apply { |
593 | adapter = viewAdapter | 602 | adapter = viewAdapter |
594 | layoutManager = viewManager | 603 | layoutManager = viewManager |
595 | } | 604 | } |
596 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 605 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
597 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 606 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
598 | return false | 607 | return false |
599 | } | 608 | } |
600 | 609 | ||
601 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | 610 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
602 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | 611 | |
603 | viewAdapter.notifyDataSetChanged() | 612 | GlobalScope.launch(Dispatchers.Main) { |
613 | borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) | ||
614 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | ||
615 | viewAdapter.notifyDataSetChanged() | ||
616 | } | ||
604 | } | 617 | } |
605 | 618 | ||
606 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 619 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
607 | val itemView = viewHolder.itemView | 620 | val itemView = viewHolder.itemView |
608 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 621 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
609 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 622 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
610 | 623 | ||
611 | if (dX > 0) { | 624 | if (dX > 0) { |
612 | 625 | ||
613 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 626 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
614 | else c.drawColor(Color.RED) | 627 | else c.drawColor(Color.RED) |
615 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 628 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
616 | } else { | 629 | } else { |
617 | |||
618 | } | 630 | } |
619 | 631 | ||
620 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 632 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
621 | deleteIcon.draw(c) | 633 | deleteIcon.draw(c) |
622 | } | 634 | } |
623 | } | 635 | } |
624 | 636 | ||
625 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 637 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
626 | itemTouchHelper.attachToRecyclerView(rcInventarios) | 638 | itemTouchHelper.attachToRecyclerView(rcInventarios) |
627 | } | 639 | } |
628 | 640 | ||
629 | private fun ProdNoCont(): Int? { | 641 | private fun ProdNoCont(): Int? { |
630 | var mostrarStock = 0 | 642 | var mostrarStock = 0 |
631 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 | 643 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 |
632 | return mostrarStock | 644 | return mostrarStock |
633 | } | 645 | } |
634 | 646 | ||
635 | private fun AjusteProductos(): Int? { | 647 | private fun AjusteProductos(): Int? { |
636 | var prodInclu = 0 | 648 | var prodInclu = 0 |
637 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 | 649 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 |
638 | 650 | ||
639 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 | 651 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 |
640 | return prodInclu | 652 | return prodInclu |
641 | } | 653 | } |
642 | 654 | ||
643 | private fun SerchArea() { | 655 | private fun SerchArea() { |
644 | 656 | ||
645 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 | 657 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 |
646 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 | 658 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 |
647 | } | 659 | } |
648 | 660 | ||
649 | fun ObtenerFechaActual(): String? { | 661 | fun ObtenerFechaActual(): String? { |
650 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD | 662 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD |
651 | val current = LocalDateTime.now() | 663 | val current = LocalDateTime.now() |
652 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") | 664 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") |
653 | val dFechaHora = current.format(formatter) | 665 | val dFechaHora = current.format(formatter) |
654 | return dFechaHora.toString() | 666 | return dFechaHora.toString() |
655 | } | 667 | } |
656 | 668 | ||
657 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 669 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
658 | lifecycleScope.launch { | 670 | lifecycleScope.launch { |
659 | withContext(Dispatchers.IO) { | 671 | withContext(Dispatchers.IO) { |
660 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 672 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
661 | } | 673 | } |
662 | } | 674 | } |
663 | } | 675 | } |
664 | 676 | ||
665 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 677 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
666 | lifecycleScope.launch { | 678 | lifecycleScope.launch { |
667 | withContext(Dispatchers.IO) { | 679 | withContext(Dispatchers.IO) { |
668 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | 680 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) |
669 | } | 681 | } |
670 | } | 682 | } |
671 | } | 683 | } |
672 | 684 | ||
673 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { | 685 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { |
674 | // var inventarios: List<InvBody>? = null | ||
675 | return GlobalScope.async(Dispatchers.IO) { | 686 | return GlobalScope.async(Dispatchers.IO) { |
676 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) | 687 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) |
677 | }.await() | 688 | }.await() |
678 | } | 689 | } |
690 | |||
691 | override fun onImageDotsClick(sector: String?, codigo: String?) { | ||
692 | val bundle = Bundle() | ||
693 | bundle.putString("sector", sector) | ||
694 | bundle.putString("codigo", codigo) | ||
695 | bundle.putInt("numeroInv", InventarioNuevo) | ||
696 | navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) | ||
697 | } | ||
698 | |||
699 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { | ||
700 | |||
701 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
702 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[position.toInt()].descripcion}', se encuentra cargado.") | ||
703 | .setCancelable(false) | ||
704 | mDialogView.tvCantInicial.text = cantidad | ||
705 | val mAlertDialog = mBuilder.show() | ||
706 | mDialogView.rbSumar.setOnClickListener { | ||
707 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | ||
708 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
709 | } | ||
710 | mDialogView.rbRestar.setOnClickListener { | ||
711 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | ||
712 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
713 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
714 | } | ||
715 | } | ||
716 | mDialogView.rbMdodificar.setOnClickListener { | ||
717 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
718 | } | ||
719 | mDialogView.btnAceptar.setOnClickListener { | ||
720 | mAlertDialog.dismiss() | ||
721 | val name = mDialogView.tvgenerico4.text.toString().toFloat() | ||
722 | fCant = 0F | ||
723 | fCant = name | ||
724 | listArticulos[position.toInt()].cantTomada = fCant | ||
725 | updateCantidad(listArticulos[position.toInt()].sector.toString(), listArticulos[position.toInt()].codigo.toString(), fCant) | ||
726 | viewAdapter.notifyDataSetChanged() | ||
727 | } | ||
728 | mDialogView.dialogCancelBtn.setOnClickListener { | ||
729 | mAlertDialog.dismiss() | ||
730 | } | ||
731 | } | ||
732 | |||
679 | } | 733 | } |
680 | 734 | ||
681 | 735 | ||
682 | 736 | ||
683 | 737 | ||
684 | 738 | ||
685 | 739 | ||
686 | 740 | ||
687 | 741 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/ItemsRecycler.kt
1 | package com.focasoftware.deboinventariov20.ui.inventario | 1 | package com.focasoftware.deboinventariov20.ui.inventario |
2 | 2 | ||
3 | data class ItemsRecycler(val sector: String?,val codigo: String?, val descripcion: String?, var cantTomada: Float, val codigoBarras: String?, val codigoOrigen: String?) | ||
3 | import android.widget.ImageView | ||
4 | |||
5 | data class ItemsRecycler(val sector: String?,val codigo: String?, val descripcion: String?, var cantTomada: Float, val codigoBarras: String?, val codigoOrigen: String?) { | ||
6 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/ProductosListAdapter.kt
1 | package com.focasoftware.deboinventariov20.ui.inventario | 1 | package com.focasoftware.deboinventariov20.ui.inventario |
2 | 2 | ||
3 | import android.content.Context | ||
3 | import android.view.LayoutInflater | 4 | import android.view.LayoutInflater |
4 | import android.view.View | 5 | import android.view.View |
5 | import android.view.ViewGroup | 6 | import android.view.ViewGroup |
6 | import androidx.recyclerview.widget.RecyclerView | 7 | import androidx.recyclerview.widget.RecyclerView |
7 | import com.focasoftware.deboinventariov20.R | 8 | import com.focasoftware.deboinventariov20.R |
9 | import com.focasoftware.deboinventariov20.ui.main.ItemInventario | ||
10 | import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder | ||
8 | import com.google.android.material.snackbar.Snackbar | 11 | import com.google.android.material.snackbar.Snackbar |
9 | import kotlinx.android.synthetic.main.item.view.* | 12 | import kotlinx.android.synthetic.main.item.view.* |
10 | 13 | ||
11 | 14 | ||
12 | class ProductosListAdapter(private val productos: ArrayList<ItemsRecycler>) : RecyclerView.Adapter<ProductosListAdapter.ItemsViewHolder>() { | 15 | class ProductosListAdapter(private val context: Context,private val productos: ArrayList<ItemsRecycler>, private val itemImageClickListener: OnImageDotsClickListener) : |
16 | RecyclerView.Adapter<BaseViewHolder<*>>() { | ||
17 | |||
13 | private var removePosition: Int = 0 | 18 | private var removePosition: Int = 0 |
14 | private var removedItem: ItemsRecycler? = null | 19 | private var removedItem: ItemsRecycler? = null |
15 | internal var items2: ArrayList<ItemsRecycler>? = null | 20 | // private var items2: ArrayList<ItemsRecycler>? = null |
16 | 21 | ||
17 | init { | 22 | interface OnImageDotsClickListener { |
18 | this.items2 = productos | 23 | fun onImageDotsClick(sector: String?,codigo: String?) |
24 | fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) | ||
19 | } | 25 | } |
20 | 26 | ||
21 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item, parent, false)) | 27 | // init { |
28 | // this.items2 = productos | ||
29 | // } | ||
30 | |||
31 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item, parent, false)) | ||
22 | 32 | ||
23 | override fun getItemCount() = productos.size | 33 | override fun getItemCount() = productos.size |
24 | 34 | ||
25 | override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { | 35 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { |
26 | when (holder) { | 36 | when (holder) { |
27 | is ItemsViewHolder -> { | 37 | is ItemsViewHolder -> { holder.bind(productos[position], position) } |
28 | holder.bind(items2!![position]) | 38 | |
29 | } | ||
30 | } | 39 | } |
31 | } | 40 | } |
41 | inner class ItemsViewHolder (itemView: View) : BaseViewHolder<ItemsRecycler>(itemView) { | ||
42 | override fun bind(item: ItemsRecycler, position: Int) { | ||
43 | itemView.ivDots.setOnClickListener {itemImageClickListener.onImageDotsClick(item.sector,item.codigo) } | ||
44 | itemView.ivPen.setOnClickListener {itemImageClickListener.onImagePenClick(item.sector,item.codigo,item.cantTomada.toString(),adapterPosition.toString()) } | ||
32 | 45 | ||
46 | itemView.tvSector.text=item.sector | ||
47 | itemView.tvCodigo.text=item.codigo | ||
48 | itemView.tvDescripcion.text=item.descripcion | ||
49 | itemView.tvCantidad.text=item.cantTomada.toString() | ||
50 | itemView.tvCodigoBarras.text=item.sector | ||
51 | itemView.tvCodigoOrigen.text=item.sector | ||
52 | itemView.ivPen.setImageResource(R.drawable.pen) | ||
53 | itemView.ivDots.setImageResource(R.drawable.more) | ||
33 | 54 | ||
34 | class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view) { | 55 | } |
56 | // val sector = itemView.tvSector | ||
57 | // val codigo = itemView.tvCodigo | ||
58 | // val descripcion = itemView.tvDescripcion | ||
59 | // val cantCont = itemView.tvCantidad | ||
60 | // val codigoBarras = itemView.tvCodigoBarras | ||
61 | // val codigoOrigen = itemView.tvCodigoOrigen | ||
62 | // val imageDots = itemView.ivDots | ||
63 | // val imagePen = itemView.ivPen | ||
64 | // | ||
65 | // fun bind(pro: ItemsRecycler) { | ||
66 | // | ||
67 | // } | ||
35 | 68 | ||
36 | val sector = view.tvSector | ||
37 | val codigo = view.tvCodigo | ||
38 | val descripcion = view.tvDescripcion | ||
39 | val cantCont = view.tvCantidad | ||
40 | val codigoBarras = view.tvCodigoBarras | ||
41 | val codigoOrigen = view.tvCodigoOrigen | ||
42 | 69 | ||
43 | fun bind(pro: ItemsRecycler) { | ||
44 | sector.text = pro.sector | ||
45 | codigo.text = pro.codigo | ||
46 | descripcion.text = pro.descripcion | ||
47 | cantCont.text = pro.cantTomada.toString() | ||
48 | codigoBarras.text = pro.codigoBarras | ||
49 | codigoOrigen.text = pro.codigoOrigen | ||
50 | } | ||
51 | } | 70 | } |
52 | 71 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/Base/BaseViewHolder.kt
1 | package com.focasoftware.deboinventariov20.ui.main.Base | File was deleted | |
2 | |||
3 | import android.view.View | ||
4 | import androidx.recyclerview.widget.RecyclerView | ||
5 | |||
6 | abstract class BaseViewHolder<T>(itemView:View):RecyclerView.ViewHolder(itemView) { | ||
7 | abstract fun bind(item:T, position:Int) | ||
8 | } |
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.AdapterView | ||
8 | import androidx.recyclerview.widget.RecyclerView | 7 | import androidx.recyclerview.widget.RecyclerView |
9 | import com.focasoftware.deboinventariov20.R | 8 | import com.focasoftware.deboinventariov20.R |
10 | import com.focasoftware.deboinventariov20.ui.main.Base.BaseViewHolder | 9 | import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder |
11 | import kotlinx.android.synthetic.main.item_principal.view.* | 10 | import kotlinx.android.synthetic.main.item_principal.view.* |
12 | 11 | ||
13 | class InventarioListAdapter(private val context: Context, private val inv: ArrayList<ItemInventario>, private val itemClickListener: OnInventarioClickListener) : | 12 | class InventarioListAdapter(private val context: Context, private val inv: ArrayList<ItemInventario>, private val itemClickListener: OnInventarioClickListener) : |
14 | RecyclerView.Adapter<BaseViewHolder<*>>() { | 13 | RecyclerView.Adapter<BaseViewHolder<*>>() { |
15 | 14 | ||
16 | interface OnInventarioClickListener { | 15 | interface OnInventarioClickListener { |
17 | fun onItemClick(inventario: String?) | 16 | fun onItemClick(inventario: String?) |
18 | } | 17 | } |
19 | 18 | ||
20 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) | 19 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) |
21 | 20 | ||
22 | override fun getItemCount() = inv.size | 21 | override fun getItemCount() = inv.size |
23 | 22 | ||
24 | 23 | ||
25 | inner class ItemsViewHolder(itemview: View) : BaseViewHolder<ItemInventario>(itemview) { | 24 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<ItemInventario>(itemView) { |
26 | override fun bind(item: ItemInventario, position: Int) { | 25 | override fun bind(item: ItemInventario, position: Int) { |
27 | itemView.setOnClickListener {itemClickListener.onItemClick(item.inventario)} | 26 | itemView.setOnClickListener {itemClickListener.onItemClick(item.inventario)} |
28 | itemView.tvPrincipalinventario.text = item.inventario | 27 | itemView.tvPrincipalinventario.text = item.inventario |
29 | } | 28 | } |
30 | |||
31 | } | 29 | } |
32 | 30 | ||
33 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | 31 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { |
34 | when (holder) { | 32 | when (holder) { |
35 | is ItemsViewHolder -> holder.bind(inv[position], position) | 33 | is ItemsViewHolder -> holder.bind(inv[position], position) |
36 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") | 34 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") |
37 | } | 35 | } |
38 | } | 36 | } |
39 | 37 | ||
40 | 38 | ||
41 | } | 39 | } |
42 | 40 | ||
43 | 41 | ||
44 | 42 | ||
45 | 43 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/BaseViewHolder.kt
File was created | 1 | package com.focasoftware.deboinventariov20.ui.util.Base | |
2 | |||
3 | import android.view.View | ||
4 | import androidx.recyclerview.widget.RecyclerView | ||
5 | |||
6 | abstract class BaseViewHolder<T>(itemView:View):RecyclerView.ViewHolder(itemView) { | ||
7 | abstract fun bind(item:T, position:Int) | ||
8 | } |
app/src/main/res/drawable/no_imagen.png
10.7 KB
app/src/main/res/drawable/pen.xml
File was created | 1 | <vector android:height="30dp" android:tint="?attr/colorControlNormal" | |
2 | android:viewportHeight="24" android:viewportWidth="24" | ||
3 | android:width="30dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
4 | <path android:fillColor="@android:color/white" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/> | ||
5 | </vector> | ||
6 |
app/src/main/res/layout-land/fragment_inventario.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:id="@+id/frameLayout" | 5 | android:id="@+id/frameLayout" |
6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent" |
8 | tools:context=".ui.inventario.InventarioFragment"> | 8 | tools:context=".ui.inventario.InventarioFragment"> |
9 | 9 | ||
10 | |||
11 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
12 | android:id="@+id/tvTitulo" | 11 | android:id="@+id/tvTitulo" |
13 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
14 | android:layout_height="60dp" | 13 | android:layout_height="60dp" |
15 | android:layout_marginStart="8dp" | ||
16 | android:layout_marginTop="15dp" | ||
17 | android:layout_marginEnd="8dp" | ||
18 | android:autoSizeMaxTextSize="100sp" | 14 | android:autoSizeMaxTextSize="100sp" |
19 | android:autoSizeMinTextSize="20sp" | 15 | android:autoSizeMinTextSize="20sp" |
20 | android:autoSizeStepGranularity="5sp" | 16 | android:autoSizeStepGranularity="5sp" |
21 | android:autoSizeTextType="uniform" | 17 | android:autoSizeTextType="uniform" |
22 | android:gravity="center" | 18 | android:gravity="center" |
23 | android:lines="1" | 19 | android:lines="1" |
24 | android:text="@string/invTitulo" | 20 | android:text="@string/invTitulo" |
25 | android:textColor="@color/colorAccent" | 21 | android:textColor="@color/colorAccent" |
26 | app:fontFamily="sans-serif-condensed" | 22 | app:fontFamily="sans-serif-condensed" |
27 | app:layout_constraintBottom_toTopOf="@id/guideline2" | 23 | app:layout_constraintBottom_toTopOf="@id/guideline2" |
28 | app:layout_constraintEnd_toEndOf="parent" | 24 | app:layout_constraintEnd_toEndOf="parent" |
29 | app:layout_constraintStart_toStartOf="parent" | 25 | app:layout_constraintStart_toStartOf="parent" |
30 | app:layout_constraintTop_toTopOf="@id/guideline" /> | 26 | app:layout_constraintTop_toTopOf="@id/guideline" /> |
31 | 27 | ||
32 | 28 | ||
33 | <ImageButton | 29 | <ImageButton |
34 | android:id="@+id/ivCamara" | 30 | android:id="@+id/ivCamara" |
35 | android:layout_width="60dp" | 31 | android:layout_width="60dp" |
36 | android:layout_height="60dp" | 32 | android:layout_height="60dp" |
37 | android:layout_marginTop="15dp" | 33 | android:layout_marginTop="15dp" |
38 | android:clickable="true" | 34 | android:clickable="true" |
39 | android:contentDescription="@string/ibBusCB" | 35 | android:contentDescription="@string/ibBusCB" |
40 | android:elevation="5dp" | 36 | android:elevation="5dp" |
41 | android:background="@drawable/boton_redondo" | 37 | android:background="@drawable/boton_redondo" |
42 | android:layout_margin="10dp" | 38 | android:layout_margin="10dp" |
43 | android:focusable="false" | 39 | android:focusable="false" |
44 | android:scaleType="fitEnd" | 40 | android:scaleType="fitEnd" |
45 | app:layout_constraintCircleRadius="40dp" | 41 | app:layout_constraintCircleRadius="40dp" |
46 | android:src="@drawable/codbar" | 42 | android:src="@drawable/codbar" |
47 | app:layout_constraintBottom_toTopOf="@id/guideline3" | 43 | app:layout_constraintBottom_toTopOf="@id/guideline3" |
48 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" | 44 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" |
49 | app:layout_constraintHorizontal_bias="0.0" | 45 | app:layout_constraintHorizontal_bias="0.0" |
50 | app:layout_constraintStart_toStartOf="parent" | 46 | app:layout_constraintStart_toStartOf="parent" |
51 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 47 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
52 | 48 | ||
53 | <EditText | 49 | <EditText |
54 | android:id="@+id/etCodigoBarras" | 50 | android:id="@+id/etCodigoBarras" |
55 | android:layout_width="0dp" | 51 | android:layout_width="0dp" |
56 | android:layout_height="wrap_content" | 52 | android:layout_height="wrap_content" |
57 | android:autofillHints="" | 53 | android:autofillHints="" |
58 | android:clickable="true" | 54 | android:clickable="true" |
59 | android:ems="10" | 55 | android:ems="10" |
60 | android:focusable="true" | 56 | android:focusable="true" |
61 | android:hint="@string/ibBusCB" | 57 | android:hint="@string/ibBusCB" |
62 | android:inputType="textPersonName" | 58 | android:inputType="textPersonName" |
63 | android:lines="1" | 59 | android:lines="1" |
64 | android:textAllCaps="true" | 60 | android:textAllCaps="true" |
65 | android:textSize="20sp" | 61 | android:textSize="20sp" |
66 | app:layout_constraintBottom_toTopOf="@+id/guideline3" | 62 | app:layout_constraintBottom_toTopOf="@+id/guideline3" |
67 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" | 63 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" |
68 | app:layout_constraintHorizontal_bias="0.49" | 64 | app:layout_constraintHorizontal_bias="0.49" |
69 | app:layout_constraintHorizontal_chainStyle="packed" | 65 | app:layout_constraintHorizontal_chainStyle="packed" |
70 | app:layout_constraintStart_toEndOf="@+id/ivCamara" | 66 | app:layout_constraintStart_toEndOf="@+id/ivCamara" |
71 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 67 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
72 | 68 | ||
73 | 69 | ||
74 | <Switch | 70 | <Switch |
75 | android:id="@+id/swSumaUno" | 71 | android:id="@+id/swSumaUno" |
76 | android:layout_width="wrap_content" | 72 | android:layout_width="wrap_content" |
77 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
78 | android:text="@string/switch_1" | 74 | android:text="@string/switch_1" |
79 | app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" | 75 | app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" |
80 | app:layout_constraintEnd_toEndOf="parent" | 76 | app:layout_constraintEnd_toEndOf="parent" |
81 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" | 77 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" |
82 | tools:ignore="UseSwitchCompatOrMaterialXml" /> | 78 | tools:ignore="UseSwitchCompatOrMaterialXml" /> |
83 | 79 | ||
84 | <androidx.recyclerview.widget.RecyclerView | 80 | <androidx.recyclerview.widget.RecyclerView |
85 | android:id="@+id/rcInventarios" | 81 | android:id="@+id/rcInventarios" |
86 | android:layout_width="match_parent" | 82 | android:layout_width="match_parent" |
87 | android:layout_height="0dp" | 83 | android:layout_height="0dp" |
88 | android:background="@android:color/darker_gray" | 84 | android:background="@android:color/darker_gray" |
89 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" | 85 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" |
90 | app:layout_constraintEnd_toEndOf="parent" | 86 | app:layout_constraintEnd_toEndOf="parent" |
91 | app:layout_constraintStart_toStartOf="parent" | 87 | app:layout_constraintStart_toStartOf="parent" |
92 | app:layout_constraintTop_toBottomOf="@+id/guideline4" | 88 | app:layout_constraintTop_toBottomOf="@+id/guideline4" |
93 | tools:listitem="@layout/item" /> | 89 | tools:listitem="@layout/item" /> |
94 | 90 | ||
95 | 91 | ||
96 | <Button | 92 | <Button |
97 | android:id="@+id/btnExportarInv" | 93 | android:id="@+id/btnExportarInv" |
98 | android:layout_width="wrap_content" | 94 | android:layout_width="wrap_content" |
99 | android:layout_height="wrap_content" | 95 | android:layout_height="wrap_content" |
100 | android:text="@string/btnExportarInv" | 96 | android:text="@string/btnExportarInv" |
101 | android:textColor="@android:color/white" | 97 | android:textColor="@android:color/white" |
102 | android:padding="10dp" | 98 | android:padding="10dp" |
103 | android:background="@drawable/boton_borde_redondeado" | 99 | android:background="@drawable/boton_borde_redondeado" |
104 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 100 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
105 | app:layout_constraintEnd_toEndOf="parent" | 101 | app:layout_constraintEnd_toEndOf="parent" |
106 | app:layout_constraintHorizontal_chainStyle="spread" | 102 | app:layout_constraintHorizontal_chainStyle="spread" |
107 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" | 103 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" |
108 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 104 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
109 | 105 | ||
110 | <Button | 106 | <Button |
111 | android:id="@+id/btnBorrarInv" | 107 | android:id="@+id/btnBorrarInv" |
112 | android:layout_width="wrap_content" | 108 | android:layout_width="wrap_content" |
113 | android:layout_height="wrap_content" | 109 | android:layout_height="wrap_content" |
114 | android:text="@string/btnBorrarInv" | 110 | android:text="@string/btnBorrarInv" |
115 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 111 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
116 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" | 112 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" |
117 | app:layout_constraintHorizontal_chainStyle="spread" | 113 | app:layout_constraintHorizontal_chainStyle="spread" |
118 | app:layout_constraintStart_toStartOf="parent" | 114 | app:layout_constraintStart_toStartOf="parent" |
119 | android:textColor="@android:color/white" | 115 | android:textColor="@android:color/white" |
120 | android:padding="10dp" | 116 | android:padding="10dp" |
121 | android:background="@drawable/boton_borde_redondeado" | 117 | android:background="@drawable/boton_borde_redondeado" |
122 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 118 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
123 | 119 | ||
124 | <androidx.constraintlayout.widget.Guideline | 120 | <androidx.constraintlayout.widget.Guideline |
125 | android:id="@+id/guideline" | 121 | android:id="@+id/guideline" |
126 | android:layout_width="wrap_content" | 122 | android:layout_width="wrap_content" |
127 | android:layout_height="wrap_content" | 123 | android:layout_height="wrap_content" |
128 | android:orientation="horizontal" | 124 | android:orientation="horizontal" |
129 | app:layout_constraintGuide_percent="0.02" /> | 125 | app:layout_constraintGuide_percent="0.02" /> |
130 | 126 | ||
131 | <androidx.constraintlayout.widget.Guideline | 127 | <androidx.constraintlayout.widget.Guideline |
132 | android:id="@+id/guideline2" | 128 | android:id="@+id/guideline2" |
133 | android:layout_width="wrap_content" | 129 | android:layout_width="wrap_content" |
134 | android:layout_height="wrap_content" | 130 | android:layout_height="wrap_content" |
135 | android:orientation="horizontal" | 131 | android:orientation="horizontal" |
136 | app:layout_constraintGuide_percent="0.2" /> | 132 | app:layout_constraintGuide_percent="0.2" /> |
137 | 133 | ||
138 | <androidx.constraintlayout.widget.Guideline | 134 | <androidx.constraintlayout.widget.Guideline |
139 | android:id="@+id/guideline3" | 135 | android:id="@+id/guideline3" |
140 | android:layout_width="wrap_content" | 136 | android:layout_width="wrap_content" |
141 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
142 | android:orientation="horizontal" | 138 | android:orientation="horizontal" |
143 | app:layout_constraintGuide_percent="0.29" /> | 139 | app:layout_constraintGuide_percent="0.29" /> |
144 | 140 | ||
145 | <androidx.constraintlayout.widget.Guideline | 141 | <androidx.constraintlayout.widget.Guideline |
146 | android:id="@+id/guideline4" | 142 | android:id="@+id/guideline4" |
147 | android:layout_width="wrap_content" | 143 | android:layout_width="wrap_content" |
148 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
149 | android:orientation="horizontal" | 145 | android:orientation="horizontal" |
150 | app:layout_constraintGuide_percent="0.35" /> | 146 | app:layout_constraintGuide_percent="0.35" /> |
151 | 147 | ||
152 | <androidx.constraintlayout.widget.Guideline | 148 | <androidx.constraintlayout.widget.Guideline |
153 | android:id="@+id/guideline5" | 149 | android:id="@+id/guideline5" |
154 | android:layout_width="wrap_content" | 150 | android:layout_width="wrap_content" |
155 | android:layout_height="wrap_content" | 151 | android:layout_height="wrap_content" |
156 | android:orientation="horizontal" | 152 | android:orientation="horizontal" |
157 | app:layout_constraintGuide_percent="0.83" /> | 153 | app:layout_constraintGuide_percent="0.83" /> |
158 | 154 | ||
159 | <androidx.constraintlayout.widget.Guideline | 155 | <androidx.constraintlayout.widget.Guideline |
160 | android:id="@+id/guideline6" | 156 | android:id="@+id/guideline6" |
161 | android:layout_width="wrap_content" | 157 | android:layout_width="wrap_content" |
162 | android:layout_height="wrap_content" | 158 | android:layout_height="wrap_content" |
163 | android:orientation="horizontal" | 159 | android:orientation="horizontal" |
164 | app:layout_constraintGuide_percent="0.97" /> | 160 | app:layout_constraintGuide_percent="0.97" /> |
165 | 161 | ||
166 | 162 | ||
167 | </androidx.constraintlayout.widget.ConstraintLayout> | 163 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/activity_mensaje.xml
1 | <?xml version="1.0" encoding="utf-8"?> | File was deleted | |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | xmlns:tools="http://schemas.android.com/tools" | ||
5 | android:layout_width="match_parent" | ||
6 | android:layout_height="match_parent" | ||
7 | tools:context=".ui.MensajeActivity"> | ||
8 | |||
9 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/fragment_detalle_art.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | android:id="@+id/nsPedidosDatos" | ||
5 | android:layout_width="match_parent" | ||
6 | android:layout_height="match_parent"> | ||
7 | |||
8 | <androidx.cardview.widget.CardView | ||
9 | android:id="@+id/cvItem1" | ||
10 | android:layout_width="match_parent" | ||
11 | android:layout_height="wrap_content" | ||
12 | android:layout_marginStart="5dp" | ||
13 | android:layout_marginTop="5dp" | ||
14 | android:layout_marginEnd="5dp" | ||
15 | app:cardBackgroundColor="@android:color/darker_gray" | ||
16 | app:cardCornerRadius="4dp" | ||
17 | app:cardElevation="4dp" | ||
18 | app:layout_constraintEnd_toEndOf="parent" | ||
19 | app:layout_constraintStart_toStartOf="parent" | ||
20 | app:layout_constraintTop_toTopOf="parent"> | ||
21 | |||
22 | <androidx.constraintlayout.widget.ConstraintLayout | ||
23 | android:id="@+id/clayout" | ||
24 | android:layout_width="match_parent" | ||
25 | android:layout_height="match_parent"> | ||
26 | |||
27 | <TextView | ||
28 | android:id="@+id/tvTime" | ||
29 | android:layout_width="0dp" | ||
30 | android:layout_height="wrap_content" | ||
31 | android:layout_marginTop="15dp" | ||
32 | android:gravity="center" | ||
33 | android:text="Detalle del artículo" | ||
34 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
35 | android:textSize="@dimen/Titulos" | ||
36 | android:textStyle="bold" | ||
37 | app:layout_constraintEnd_toEndOf="parent" | ||
38 | app:layout_constraintStart_toStartOf="parent" | ||
39 | app:layout_constraintTop_toTopOf="parent" /> | ||
40 | |||
41 | <TextView | ||
42 | android:id="@+id/textView19" | ||
43 | android:layout_width="wrap_content" | ||
44 | android:layout_height="wrap_content" | ||
45 | android:layout_marginStart="5dp" | ||
46 | android:layout_marginTop="10dp" | ||
47 | android:text="Sector:" | ||
48 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
49 | android:textSize="14sp" | ||
50 | app:layout_constraintEnd_toStartOf="@id/tvSector" | ||
51 | app:layout_constraintStart_toStartOf="parent" | ||
52 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
53 | |||
54 | <TextView | ||
55 | android:id="@+id/tvSector" | ||
56 | android:layout_width="0dp" | ||
57 | android:layout_height="wrap_content" | ||
58 | android:layout_marginTop="10dp" | ||
59 | android:text="" | ||
60 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
61 | android:textSize="14sp" | ||
62 | app:layout_constraintEnd_toStartOf="@id/textView18" | ||
63 | app:layout_constraintStart_toEndOf="@id/textView19" | ||
64 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
65 | |||
66 | <TextView | ||
67 | android:id="@+id/textView18" | ||
68 | android:layout_width="wrap_content" | ||
69 | android:layout_height="wrap_content" | ||
70 | android:layout_marginTop="10dp" | ||
71 | android:text="Código:" | ||
72 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
73 | android:textSize="14sp" | ||
74 | app:layout_constraintEnd_toStartOf="@id/tvCodigo" | ||
75 | app:layout_constraintStart_toEndOf="@id/tvSector" | ||
76 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
77 | |||
78 | <TextView | ||
79 | android:id="@+id/tvCodigo" | ||
80 | android:layout_width="0dp" | ||
81 | android:layout_height="wrap_content" | ||
82 | android:layout_marginTop="10dp" | ||
83 | android:text="" | ||
84 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
85 | android:textSize="14sp" | ||
86 | app:layout_constraintEnd_toStartOf="@+id/textView3" | ||
87 | app:layout_constraintStart_toEndOf="@id/textView18" | ||
88 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
89 | |||
90 | <TextView | ||
91 | android:id="@+id/textView3" | ||
92 | android:layout_width="wrap_content" | ||
93 | android:layout_height="wrap_content" | ||
94 | android:layout_marginTop="10dp" | ||
95 | android:text="Depósito:" | ||
96 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
97 | android:textSize="14sp" | ||
98 | app:layout_constraintEnd_toStartOf="@id/tvDeposito" | ||
99 | app:layout_constraintStart_toEndOf="@id/tvCodigo" | ||
100 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
101 | |||
102 | <TextView | ||
103 | android:id="@+id/tvDeposito" | ||
104 | android:layout_width="0dp" | ||
105 | android:layout_height="wrap_content" | ||
106 | android:layout_marginTop="10dp" | ||
107 | android:text="" | ||
108 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
109 | android:textSize="14sp" | ||
110 | app:layout_constraintEnd_toEndOf="parent" | ||
111 | app:layout_constraintStart_toEndOf="@id/textView3" | ||
112 | app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | ||
113 | |||
114 | <TextView | ||
115 | android:id="@+id/textView6" | ||
116 | android:layout_width="wrap_content" | ||
117 | android:layout_height="wrap_content" | ||
118 | android:layout_marginStart="5dp" | ||
119 | android:layout_marginTop="10dp" | ||
120 | android:text="Descripción:" | ||
121 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
122 | android:textSize="14sp" | ||
123 | app:layout_constraintEnd_toStartOf="@id/tvDescripcion" | ||
124 | app:layout_constraintStart_toStartOf="parent" | ||
125 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | ||
126 | |||
127 | <TextView | ||
128 | android:id="@+id/tvDescripcion" | ||
129 | android:layout_width="0dp" | ||
130 | android:layout_height="wrap_content" | ||
131 | android:layout_marginStart="5dp" | ||
132 | android:layout_marginTop="10dp" | ||
133 | android:lines="2" | ||
134 | android:text="" | ||
135 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
136 | android:textSize="14sp" | ||
137 | app:layout_constraintEnd_toEndOf="parent" | ||
138 | app:layout_constraintStart_toEndOf="@+id/textView6" | ||
139 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | ||
140 | |||
141 | <TextView | ||
142 | android:id="@+id/textView1" | ||
143 | android:layout_width="wrap_content" | ||
144 | android:layout_height="wrap_content" | ||
145 | android:layout_marginStart="5dp" | ||
146 | android:layout_marginTop="10dp" | ||
147 | android:text="C. de barras:" | ||
148 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
149 | android:textSize="14sp" | ||
150 | app:layout_constraintEnd_toStartOf="@id/tvCodigoBarras" | ||
151 | app:layout_constraintStart_toStartOf="parent" | ||
152 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | ||
153 | |||
154 | <TextView | ||
155 | android:id="@+id/tvCodigoBarras" | ||
156 | android:layout_width="0dp" | ||
157 | android:layout_height="wrap_content" | ||
158 | android:layout_marginTop="10dp" | ||
159 | android:text="" | ||
160 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
161 | android:textSize="14sp" | ||
162 | app:layout_constraintEnd_toStartOf="@id/textView2" | ||
163 | app:layout_constraintStart_toEndOf="@id/textView1" | ||
164 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | ||
165 | |||
166 | <TextView | ||
167 | android:id="@+id/textView2" | ||
168 | android:layout_width="wrap_content" | ||
169 | android:layout_height="wrap_content" | ||
170 | android:layout_marginTop="10dp" | ||
171 | android:text="C. origen:" | ||
172 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
173 | android:textSize="14sp" | ||
174 | app:layout_constraintEnd_toStartOf="@id/tvCodigoOrigen" | ||
175 | app:layout_constraintStart_toEndOf="@id/tvCodigoBarras" | ||
176 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | ||
177 | |||
178 | <TextView | ||
179 | android:id="@+id/tvCodigoOrigen" | ||
180 | android:layout_width="0dp" | ||
181 | android:layout_height="wrap_content" | ||
182 | android:layout_marginTop="10dp" | ||
183 | android:text="" | ||
184 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
185 | android:textSize="14sp" | ||
186 | app:layout_constraintEnd_toEndOf="parent" | ||
187 | app:layout_constraintStart_toEndOf="@id/textView2" | ||
188 | app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | ||
189 | |||
190 | |||
191 | <TextView | ||
192 | android:id="@+id/textView5" | ||
193 | android:layout_width="wrap_content" | ||
194 | android:layout_height="wrap_content" | ||
195 | android:layout_marginStart="5dp" | ||
196 | android:layout_marginTop="10dp" | ||
197 | android:text="Exi.venta:" | ||
198 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
199 | android:textSize="14sp" | ||
200 | app:layout_constraintEnd_toStartOf="@id/tvExiVenta" | ||
201 | app:layout_constraintStart_toStartOf="parent" | ||
202 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | ||
203 | |||
204 | <TextView | ||
205 | android:id="@+id/tvExiVenta" | ||
206 | android:layout_width="0dp" | ||
207 | android:layout_height="wrap_content" | ||
208 | android:layout_marginTop="10dp" | ||
209 | android:text="" | ||
210 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
211 | android:textSize="14sp" | ||
212 | app:layout_constraintEnd_toStartOf="@id/textView7" | ||
213 | app:layout_constraintStart_toEndOf="@id/textView5" | ||
214 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | ||
215 | |||
216 | <TextView | ||
217 | android:id="@+id/textView7" | ||
218 | android:layout_width="wrap_content" | ||
219 | android:layout_height="wrap_content" | ||
220 | android:layout_marginTop="10dp" | ||
221 | android:text="Exi.dep:" | ||
222 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
223 | android:textSize="14sp" | ||
224 | app:layout_constraintEnd_toStartOf="@id/tvExiDeposito" | ||
225 | app:layout_constraintStart_toEndOf="@id/tvExiVenta" | ||
226 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | ||
227 | |||
228 | <TextView | ||
229 | android:id="@+id/tvExiDeposito" | ||
230 | android:layout_width="0dp" | ||
231 | android:layout_height="wrap_content" | ||
232 | android:layout_marginTop="10dp" | ||
233 | android:text="" | ||
234 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
235 | android:textSize="14sp" | ||
236 | app:layout_constraintEnd_toStartOf="@+id/textView8" | ||
237 | app:layout_constraintStart_toEndOf="@id/textView7" | ||
238 | app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | ||
239 | |||
240 | <TextView | ||
241 | android:id="@+id/textView8" | ||
242 | android:layout_width="wrap_content" | ||
243 | android:layout_height="wrap_content" | ||
244 | android:layout_marginTop="10dp" | ||
245 | android:text="Bal:" | ||
246 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
247 | android:textSize="14sp" | ||
248 | app:layout_constraintEnd_toStartOf="@id/tvBal" | ||
249 | app:layout_constraintStart_toEndOf="@id/tvExiDeposito" | ||
250 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | ||
251 | |||
252 | <TextView | ||
253 | android:id="@+id/tvBal" | ||
254 | android:layout_width="0dp" | ||
255 | android:layout_height="wrap_content" | ||
256 | android:layout_marginTop="10dp" | ||
257 | android:text="" | ||
258 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
259 | android:textSize="14sp" | ||
260 | app:layout_constraintEnd_toStartOf="@+id/textView9" | ||
261 | app:layout_constraintStart_toEndOf="@id/textView8" | ||
262 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | ||
263 | |||
264 | <TextView | ||
265 | android:id="@+id/textView9" | ||
266 | android:layout_width="wrap_content" | ||
267 | android:layout_height="wrap_content" | ||
268 | android:layout_marginTop="10dp" | ||
269 | android:text="De:" | ||
270 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
271 | android:textSize="14sp" | ||
272 | app:layout_constraintEnd_toStartOf="@id/tvDE" | ||
273 | app:layout_constraintStart_toEndOf="@id/tvBal" | ||
274 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | ||
275 | |||
276 | <TextView | ||
277 | android:id="@+id/tvDE" | ||
278 | android:layout_width="0dp" | ||
279 | android:layout_height="wrap_content" | ||
280 | android:layout_marginTop="10dp" | ||
281 | android:text="" | ||
282 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
283 | android:textSize="14sp" | ||
284 | app:layout_constraintEnd_toEndOf="parent" | ||
285 | app:layout_constraintStart_toEndOf="@id/textView9" | ||
286 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | ||
287 | |||
288 | |||
289 | <TextView | ||
290 | android:id="@+id/textView10" | ||
291 | android:layout_width="wrap_content" | ||
292 | android:layout_height="wrap_content" | ||
293 | android:layout_marginTop="10dp" | ||
294 | android:text="Imagen:" | ||
295 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
296 | android:textSize="14sp" | ||
297 | app:layout_constraintEnd_toStartOf="@id/tvDE" | ||
298 | app:layout_constraintHorizontal_bias="0.0" | ||
299 | app:layout_constraintStart_toStartOf="parent" | ||
300 | app:layout_constraintTop_toBottomOf="@+id/tvDE" /> | ||
301 | |||
302 | <ImageView | ||
303 | android:id="@+id/ivImagen" | ||
304 | android:layout_width="100dp" | ||
305 | android:layout_height="100dp" | ||
306 | android:layout_marginTop="10dp" | ||
307 | android:src="@drawable/no_imagen" | ||
308 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
309 | android:textSize="14sp" | ||
310 | app:layout_constraintEnd_toEndOf="parent" | ||
311 | app:layout_constraintHorizontal_bias="0.04" | ||
312 | app:layout_constraintStart_toEndOf="@id/textView10" | ||
313 | app:layout_constraintTop_toBottomOf="@+id/tvDE" /> | ||
314 | |||
315 | </androidx.constraintlayout.widget.ConstraintLayout> | ||
316 | </androidx.cardview.widget.CardView> | ||
317 | |||
318 | </ScrollView> | ||
319 |
app/src/main/res/layout/fragment_inventario.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:id="@+id/frameLayout" | 5 | android:id="@+id/frameLayout" |
6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent" |
8 | tools:context=".ui.inventario.InventarioFragment"> | 8 | tools:context=".ui.inventario.InventarioFragment"> |
9 | 9 | ||
10 | 10 | ||
11 | <androidx.appcompat.widget.AppCompatTextView | 11 | <androidx.appcompat.widget.AppCompatTextView |
12 | android:id="@+id/tvTitulo" | 12 | android:id="@+id/tvTitulo" |
13 | android:layout_width="match_parent" | 13 | android:layout_width="match_parent" |
14 | android:layout_height="90dp" | 14 | android:layout_height="90dp" |
15 | android:layout_marginStart="8dp" | 15 | android:layout_marginStart="8dp" |
16 | android:layout_marginTop="15dp" | ||
17 | android:layout_marginEnd="8dp" | 16 | android:layout_marginEnd="8dp" |
18 | android:autoSizeMaxTextSize="100sp" | 17 | android:autoSizeMaxTextSize="100sp" |
19 | android:autoSizeMinTextSize="20sp" | 18 | android:autoSizeMinTextSize="20sp" |
20 | android:autoSizeStepGranularity="5sp" | 19 | android:autoSizeStepGranularity="5sp" |
21 | android:autoSizeTextType="uniform" | 20 | android:autoSizeTextType="uniform" |
22 | android:gravity="center" | 21 | android:gravity="center" |
23 | android:lines="1" | 22 | android:lines="1" |
24 | android:text="@string/invTitulo" | 23 | android:text="@string/invTitulo" |
25 | android:textColor="@color/colorAccent" | 24 | android:textColor="@color/colorAccent" |
26 | app:fontFamily="sans-serif-condensed" | 25 | app:fontFamily="sans-serif-condensed" |
27 | app:layout_constraintBottom_toTopOf="@id/guideline2" | 26 | app:layout_constraintBottom_toTopOf="@id/guideline2" |
28 | app:layout_constraintEnd_toEndOf="parent" | 27 | app:layout_constraintEnd_toEndOf="parent" |
29 | app:layout_constraintStart_toStartOf="parent" | 28 | app:layout_constraintStart_toStartOf="parent" |
30 | app:layout_constraintTop_toTopOf="@id/guideline" /> | 29 | app:layout_constraintTop_toTopOf="@id/guideline" /> |
31 | 30 | ||
32 | 31 | ||
33 | <ImageButton | 32 | <ImageButton |
34 | android:id="@+id/ivCamara" | 33 | android:id="@+id/ivCamara" |
35 | android:layout_width="80dp" | 34 | android:layout_width="80dp" |
36 | android:layout_height="80dp" | 35 | android:layout_height="80dp" |
37 | android:layout_marginTop="15dp" | 36 | android:layout_marginTop="15dp" |
38 | android:clickable="true" | 37 | android:clickable="true" |
39 | android:contentDescription="@string/ibBusCB" | 38 | android:contentDescription="@string/ibBusCB" |
40 | android:elevation="5dp" | 39 | android:elevation="5dp" |
41 | android:background="@drawable/boton_redondo" | 40 | android:background="@drawable/boton_redondo" |
42 | android:layout_margin="10dp" | 41 | android:layout_margin="10dp" |
43 | android:focusable="false" | 42 | android:focusable="false" |
44 | android:scaleType="fitEnd" | 43 | android:scaleType="fitEnd" |
45 | app:layout_constraintCircleRadius="40dp" | 44 | app:layout_constraintCircleRadius="40dp" |
46 | android:src="@drawable/codbar" | 45 | android:src="@drawable/codbar" |
47 | app:layout_constraintBottom_toTopOf="@id/guideline3" | 46 | app:layout_constraintBottom_toTopOf="@id/guideline3" |
48 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" | 47 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" |
49 | app:layout_constraintHorizontal_bias="0.0" | 48 | app:layout_constraintHorizontal_bias="0.0" |
50 | app:layout_constraintStart_toStartOf="parent" | 49 | app:layout_constraintStart_toStartOf="parent" |
51 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 50 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
52 | 51 | ||
53 | <EditText | 52 | <EditText |
54 | android:id="@+id/etCodigoBarras" | 53 | android:id="@+id/etCodigoBarras" |
55 | android:layout_width="0dp" | 54 | android:layout_width="0dp" |
56 | android:layout_height="wrap_content" | 55 | android:layout_height="wrap_content" |
57 | android:autofillHints="" | 56 | android:autofillHints="" |
58 | android:clickable="true" | 57 | android:clickable="true" |
59 | android:ems="10" | 58 | android:ems="10" |
60 | android:focusable="true" | 59 | android:focusable="true" |
61 | android:hint="@string/ibBusCB" | 60 | android:hint="@string/ibBusCB" |
62 | android:inputType="textPersonName" | 61 | android:inputType="textPersonName" |
63 | android:lines="1" | 62 | android:lines="1" |
64 | android:textAllCaps="true" | 63 | android:textAllCaps="true" |
65 | android:textSize="20sp" | 64 | android:textSize="20sp" |
66 | app:layout_constraintBottom_toTopOf="@+id/guideline3" | 65 | app:layout_constraintBottom_toTopOf="@+id/guideline3" |
67 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" | 66 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" |
68 | app:layout_constraintHorizontal_bias="0.49" | 67 | app:layout_constraintHorizontal_bias="0.49" |
69 | app:layout_constraintHorizontal_chainStyle="packed" | 68 | app:layout_constraintHorizontal_chainStyle="packed" |
70 | app:layout_constraintStart_toEndOf="@+id/ivCamara" | 69 | app:layout_constraintStart_toEndOf="@+id/ivCamara" |
71 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 70 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
72 | 71 | ||
73 | 72 | ||
74 | <Switch | 73 | <Switch |
75 | android:id="@+id/swSumaUno" | 74 | android:id="@+id/swSumaUno" |
76 | android:layout_width="wrap_content" | 75 | android:layout_width="wrap_content" |
77 | android:layout_height="wrap_content" | 76 | android:layout_height="wrap_content" |
78 | android:text="@string/switch_1" | 77 | android:text="@string/switch_1" |
79 | app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" | 78 | app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" |
80 | app:layout_constraintEnd_toEndOf="parent" | 79 | app:layout_constraintEnd_toEndOf="parent" |
81 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" | 80 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" |
82 | tools:ignore="UseSwitchCompatOrMaterialXml" /> | 81 | tools:ignore="UseSwitchCompatOrMaterialXml" /> |
83 | 82 | ||
84 | <androidx.recyclerview.widget.RecyclerView | 83 | <androidx.recyclerview.widget.RecyclerView |
85 | android:id="@+id/rcInventarios" | 84 | android:id="@+id/rcInventarios" |
86 | android:layout_width="match_parent" | 85 | android:layout_width="match_parent" |
87 | android:layout_height="0dp" | 86 | android:layout_height="0dp" |
88 | android:background="@android:color/darker_gray" | 87 | android:background="@android:color/darker_gray" |
89 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" | 88 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" |
90 | app:layout_constraintEnd_toEndOf="parent" | 89 | app:layout_constraintEnd_toEndOf="parent" |
91 | app:layout_constraintStart_toStartOf="parent" | 90 | app:layout_constraintStart_toStartOf="parent" |
92 | app:layout_constraintTop_toBottomOf="@+id/guideline4" | 91 | app:layout_constraintTop_toBottomOf="@+id/guideline4" |
93 | tools:listitem="@layout/item" /> | 92 | tools:listitem="@layout/item" /> |
94 | 93 | ||
95 | 94 | ||
96 | <Button | 95 | <Button |
97 | android:id="@+id/btnExportarInv" | 96 | android:id="@+id/btnExportarInv" |
98 | android:layout_width="wrap_content" | 97 | android:layout_width="wrap_content" |
99 | android:layout_height="wrap_content" | 98 | android:layout_height="wrap_content" |
100 | android:text="@string/btnExportarInv" | 99 | android:text="@string/btnExportarInv" |
101 | android:textColor="@android:color/white" | 100 | android:textColor="@android:color/white" |
102 | android:padding="10dp" | 101 | android:padding="10dp" |
103 | android:background="@drawable/boton_borde_redondeado" | 102 | android:background="@drawable/boton_borde_redondeado" |
104 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 103 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
105 | app:layout_constraintEnd_toEndOf="parent" | 104 | app:layout_constraintEnd_toEndOf="parent" |
106 | app:layout_constraintHorizontal_chainStyle="spread" | 105 | app:layout_constraintHorizontal_chainStyle="spread" |
107 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" | 106 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" |
108 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 107 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
109 | 108 | ||
110 | <Button | 109 | <Button |
111 | android:id="@+id/btnBorrarInv" | 110 | android:id="@+id/btnBorrarInv" |
112 | android:layout_width="wrap_content" | 111 | android:layout_width="wrap_content" |
113 | android:layout_height="wrap_content" | 112 | android:layout_height="wrap_content" |
114 | android:text="@string/btnBorrarInv" | 113 | android:text="@string/btnBorrarInv" |
115 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 114 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
116 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" | 115 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" |
117 | app:layout_constraintHorizontal_chainStyle="spread" | 116 | app:layout_constraintHorizontal_chainStyle="spread" |
118 | app:layout_constraintStart_toStartOf="parent" | 117 | app:layout_constraintStart_toStartOf="parent" |
119 | android:textColor="@android:color/white" | 118 | android:textColor="@android:color/white" |
120 | android:padding="10dp" | 119 | android:padding="10dp" |
121 | android:background="@drawable/boton_borde_redondeado" | 120 | android:background="@drawable/boton_borde_redondeado" |
122 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 121 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
123 | 122 | ||
124 | <androidx.constraintlayout.widget.Guideline | 123 | <androidx.constraintlayout.widget.Guideline |
125 | android:id="@+id/guideline" | 124 | android:id="@+id/guideline" |
126 | android:layout_width="wrap_content" | 125 | android:layout_width="wrap_content" |
127 | android:layout_height="wrap_content" | 126 | android:layout_height="wrap_content" |
128 | android:orientation="horizontal" | 127 | android:orientation="horizontal" |
129 | app:layout_constraintGuide_percent="0.02" /> | 128 | app:layout_constraintGuide_percent="0.02" /> |
130 | 129 | ||
131 | <androidx.constraintlayout.widget.Guideline | 130 | <androidx.constraintlayout.widget.Guideline |
132 | android:id="@+id/guideline2" | 131 | android:id="@+id/guideline2" |
133 | android:layout_width="wrap_content" | 132 | android:layout_width="wrap_content" |
134 | android:layout_height="wrap_content" | 133 | android:layout_height="wrap_content" |
135 | android:orientation="horizontal" | 134 | android:orientation="horizontal" |
136 | app:layout_constraintGuide_percent="0.12" /> | 135 | app:layout_constraintGuide_percent="0.12" /> |
137 | 136 | ||
138 | <androidx.constraintlayout.widget.Guideline | 137 | <androidx.constraintlayout.widget.Guideline |
139 | android:id="@+id/guideline3" | 138 | android:id="@+id/guideline3" |
140 | android:layout_width="wrap_content" | 139 | android:layout_width="wrap_content" |
141 | android:layout_height="wrap_content" | 140 | android:layout_height="wrap_content" |
142 | android:orientation="horizontal" | 141 | android:orientation="horizontal" |
143 | app:layout_constraintGuide_percent="0.29" /> | 142 | app:layout_constraintGuide_percent="0.29" /> |
144 | 143 | ||
145 | <androidx.constraintlayout.widget.Guideline | 144 | <androidx.constraintlayout.widget.Guideline |
146 | android:id="@+id/guideline4" | 145 | android:id="@+id/guideline4" |
147 | android:layout_width="wrap_content" | 146 | android:layout_width="wrap_content" |
148 | android:layout_height="wrap_content" | 147 | android:layout_height="wrap_content" |
149 | android:orientation="horizontal" | 148 | android:orientation="horizontal" |
150 | app:layout_constraintGuide_percent="0.35" /> | 149 | app:layout_constraintGuide_percent="0.35" /> |
151 | 150 | ||
152 | <androidx.constraintlayout.widget.Guideline | 151 | <androidx.constraintlayout.widget.Guideline |
153 | android:id="@+id/guideline5" | 152 | android:id="@+id/guideline5" |
154 | android:layout_width="wrap_content" | 153 | android:layout_width="wrap_content" |
155 | android:layout_height="wrap_content" | 154 | android:layout_height="wrap_content" |
156 | android:orientation="horizontal" | 155 | android:orientation="horizontal" |
157 | app:layout_constraintGuide_percent="0.88" /> | 156 | app:layout_constraintGuide_percent="0.88" /> |
158 | 157 | ||
159 | <androidx.constraintlayout.widget.Guideline | 158 | <androidx.constraintlayout.widget.Guideline |
160 | android:id="@+id/guideline6" | 159 | android:id="@+id/guideline6" |
161 | android:layout_width="wrap_content" | 160 | android:layout_width="wrap_content" |
162 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
163 | android:orientation="horizontal" | 162 | android:orientation="horizontal" |
164 | app:layout_constraintGuide_percent="0.97" /> | 163 | app:layout_constraintGuide_percent="0.97" /> |
165 | 164 | ||
166 | 165 | ||
167 | </androidx.constraintlayout.widget.ConstraintLayout> | 166 | </androidx.constraintlayout.widget.ConstraintLayout> |
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="14sp" |
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 | <TextView | 46 | <TextView |
47 | android:id="@+id/tvCodigo" | 47 | android:id="@+id/tvCodigo" |
48 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
49 | android:layout_height="match_parent" | 49 | android:layout_height="match_parent" |
50 | android:layout_marginStart="8dp" | 50 | android:layout_marginStart="8dp" |
51 | android:text="99999999" | 51 | android:text="99999999" |
52 | app:layout_constraintHorizontal_chainStyle="packed" | 52 | app:layout_constraintHorizontal_chainStyle="packed" |
53 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 53 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
54 | android:textColorHint="@android:color/black" | 54 | android:textColorHint="@android:color/black" |
55 | android:textSize="14sp" | 55 | android:textSize="14sp" |
56 | android:textStyle="bold" | 56 | android:textStyle="bold" |
57 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" | 57 | app:layout_constraintBaseline_toBaselineOf="@+id/tvSector" |
58 | app:layout_constraintEnd_toStartOf="@+id/textView5" | 58 | app:layout_constraintEnd_toStartOf="@+id/textView5" |
59 | app:layout_constraintStart_toEndOf="@+id/tvSector" /> | 59 | app:layout_constraintStart_toEndOf="@+id/tvSector" /> |
60 | 60 | ||
61 | <TextView | 61 | <TextView |
62 | android:id="@+id/textView5" | 62 | android:id="@+id/textView5" |
63 | android:layout_width="wrap_content" | 63 | android:layout_width="wrap_content" |
64 | android:layout_height="wrap_content" | 64 | android:layout_height="wrap_content" |
65 | android:layout_marginStart="8dp" | 65 | android:layout_marginStart="8dp" |
66 | android:text="Cantidad:" | 66 | android:text="Cantidad:" |
67 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 67 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
68 | android:textSize="14sp" | 68 | android:textSize="14sp" |
69 | app:layout_constraintTop_toTopOf="parent" | 69 | app:layout_constraintTop_toTopOf="parent" |
70 | app:layout_constraintEnd_toStartOf="@+id/tvCodigoBarras" | 70 | app:layout_constraintEnd_toStartOf="@+id/tvCodigoBarras" |
71 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" /> | 71 | app:layout_constraintStart_toEndOf="@+id/tvCodigo" /> |
72 | 72 | ||
73 | <TextView | 73 | <TextView |
74 | android:id="@+id/tvCantidad" | 74 | android:id="@+id/tvCantidad" |
75 | android:layout_width="wrap_content" | 75 | android:layout_width="wrap_content" |
76 | android:layout_height="match_parent" | 76 | android:layout_height="match_parent" |
77 | android:layout_margin="5dp" | 77 | android:layout_margin="5dp" |
78 | android:text="12345.12" | 78 | android:text="12345.12" |
79 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 79 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
80 | android:textSize="14sp" | 80 | android:textSize="14sp" |
81 | android:textStyle="bold" | 81 | android:textStyle="bold" |
82 | app:layout_constraintBaseline_toBaselineOf="@+id/textView5" | 82 | app:layout_constraintBaseline_toBaselineOf="@+id/textView5" |
83 | app:layout_constraintEnd_toEndOf="parent" | 83 | app:layout_constraintEnd_toEndOf="parent" |
84 | app:layout_constraintHorizontal_bias="0.0" | 84 | app:layout_constraintHorizontal_bias="0.0" |
85 | app:layout_constraintStart_toEndOf="@id/textView5" | 85 | app:layout_constraintStart_toEndOf="@id/textView5" |
86 | app:layout_constraintTop_toTopOf="parent" /> | 86 | app:layout_constraintTop_toTopOf="parent" /> |
87 | 87 | ||
88 | <ImageView | 88 | <ImageView |
89 | android:id="@+id/ivHolder" | 89 | android:id="@+id/ivPen" |
90 | android:layout_width="30dp" | 90 | android:layout_width="30dp" |
91 | android:layout_height="30dp" | 91 | android:layout_height="30dp" |
92 | android:src="@drawable/pen" | ||
92 | android:visibility="visible" | 93 | android:visibility="visible" |
94 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" | ||
95 | app:layout_constraintStart_toEndOf="@+id/tvCantidad" | ||
96 | app:layout_constraintTop_toTopOf="parent" | ||
97 | app:layout_constraintVertical_bias="0.0" /> | ||
98 | |||
99 | <ImageView | ||
100 | android:id="@+id/ivDots" | ||
101 | android:layout_width="30dp" | ||
102 | android:layout_height="30dp" | ||
93 | android:src="@drawable/more" | 103 | android:src="@drawable/more" |
104 | android:visibility="visible" | ||
94 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" | 105 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" |
95 | app:layout_constraintEnd_toEndOf="parent" | 106 | app:layout_constraintEnd_toEndOf="parent" |
96 | app:layout_constraintHorizontal_bias="0.968" | ||
97 | app:layout_constraintStart_toEndOf="@+id/tvCodigoBarras" | ||
98 | app:layout_constraintTop_toTopOf="parent" | 107 | app:layout_constraintTop_toTopOf="parent" |
99 | app:layout_constraintVertical_bias="0.0" /> | 108 | app:layout_constraintVertical_bias="0.0" /> |
100 | 109 | ||
101 | <TextView | 110 | <TextView |
102 | android:id="@+id/textView85" | 111 | android:id="@+id/textView85" |
103 | android:layout_width="wrap_content" | 112 | android:layout_width="wrap_content" |
104 | android:layout_height="wrap_content" | 113 | android:layout_height="wrap_content" |
105 | android:layout_marginStart="5dp" | 114 | android:layout_marginStart="5dp" |
106 | android:layout_marginTop="8dp" | 115 | android:layout_marginTop="8dp" |
107 | android:text="Desc:" | 116 | android:text="Desc:" |
108 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | 117 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
109 | android:textSize="14sp" | 118 | android:textSize="14sp" |
110 | app:layout_constraintEnd_toStartOf="@+id/tvDescripcion" | 119 | app:layout_constraintEnd_toStartOf="@+id/tvDescripcion" |
111 | app:layout_constraintHorizontal_bias="0.0" | 120 | app:layout_constraintHorizontal_bias="0.0" |
112 | app:layout_constraintHorizontal_chainStyle="packed" | 121 | app:layout_constraintHorizontal_chainStyle="packed" |
113 | app:layout_constraintStart_toStartOf="parent" | 122 | app:layout_constraintStart_toStartOf="parent" |
114 | app:layout_constraintTop_toBottomOf="@id/tvCodigo" /> | 123 | app:layout_constraintTop_toBottomOf="@id/tvCodigo" /> |
115 | 124 | ||
116 | <TextView | 125 | <TextView |
117 | android:id="@+id/tvDescripcion" | 126 | android:id="@+id/tvDescripcion" |
118 | android:layout_width="0dp" | 127 | android:layout_width="0dp" |
119 | android:layout_height="wrap_content" | 128 | android:layout_height="wrap_content" |
120 | android:layout_marginStart="3dp" | 129 | android:layout_marginStart="3dp" |
121 | android:layout_marginTop="8dp" | 130 | android:layout_marginTop="8dp" |
122 | android:maxLines="2" | 131 | android:maxLines="2" |
123 | android:text="abcdefghijklmnñopqrstuvwxyz0123456789abcdefghijklmnñopqrstuvwxyz" | 132 | android:text="abcdefghijklmnñopqrstuvwxyz0123456789abcdefghijklmnñopqrstuvwxyz" |
124 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 133 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
125 | android:textSize="14sp" | 134 | android:textSize="14sp" |
126 | android:textStyle="bold" | 135 | android:textStyle="bold" |
127 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" | 136 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" |
128 | app:layout_constraintEnd_toEndOf="parent" | 137 | app:layout_constraintEnd_toEndOf="parent" |
129 | app:layout_constraintStart_toEndOf="@+id/textView85" | 138 | app:layout_constraintStart_toEndOf="@+id/textView85" |
130 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 139 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
131 | 140 | ||
132 | <TextView | 141 | <TextView |
133 | android:id="@+id/tvCodigoBarras" | 142 | android:id="@+id/tvCodigoBarras" |
134 | android:layout_width="match_parent" | 143 | android:layout_width="match_parent" |
135 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
136 | android:layout_marginStart="3dp" | 145 | android:layout_marginStart="3dp" |
137 | android:layout_marginTop="8dp" | 146 | android:layout_marginTop="8dp" |
138 | android:maxLines="2" | 147 | android:maxLines="2" |
139 | android:text="" | 148 | android:text="" |
140 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 149 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
141 | android:textSize="14sp" | 150 | android:textSize="14sp" |
142 | android:visibility="gone" | 151 | android:visibility="gone" |
143 | android:textStyle="bold" | 152 | android:textStyle="bold" |
144 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" | 153 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" |
145 | app:layout_constraintEnd_toEndOf="parent" | 154 | app:layout_constraintEnd_toEndOf="parent" |
146 | app:layout_constraintStart_toEndOf="@+id/textView85" | 155 | app:layout_constraintStart_toEndOf="@+id/textView85" |
147 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 156 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
148 | <TextView | 157 | <TextView |
149 | android:id="@+id/tvCodigoOrigen" | 158 | android:id="@+id/tvCodigoOrigen" |
150 | android:layout_width="match_parent" | 159 | android:layout_width="match_parent" |
151 | android:layout_height="wrap_content" | 160 | android:layout_height="wrap_content" |
152 | android:layout_marginStart="3dp" | 161 | android:layout_marginStart="3dp" |
153 | android:layout_marginTop="8dp" | 162 | android:layout_marginTop="8dp" |
154 | android:maxLines="2" | 163 | android:maxLines="2" |
155 | android:text="" | 164 | android:text="" |
156 | android:textAppearance="@style/TextAppearance.AppCompat.Large" | 165 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
157 | android:textSize="14sp" | 166 | android:textSize="14sp" |
158 | android:visibility="gone" | 167 | android:visibility="gone" |
159 | android:textStyle="bold" | 168 | android:textStyle="bold" |
160 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" | 169 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" |
161 | app:layout_constraintEnd_toEndOf="parent" | 170 | app:layout_constraintEnd_toEndOf="parent" |
162 | app:layout_constraintStart_toEndOf="@+id/textView85" | 171 | app:layout_constraintStart_toEndOf="@+id/textView85" |
163 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | 172 | app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> |
164 | </androidx.constraintlayout.widget.ConstraintLayout> | 173 | </androidx.constraintlayout.widget.ConstraintLayout> |
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 | <fragment | 13 | <fragment |
14 | android:id="@+id/mainFragment2" | 14 | android:id="@+id/mainFragment2" |
15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" | 15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" |
16 | android:label="Principal" | 16 | android:label="Principal" |
17 | tools:layout="@layout/fragment_main" > | 17 | tools:layout="@layout/fragment_main" > |
18 | <action | 18 | <action |
19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" | 19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" |
20 | app:destination="@id/configuracionFragment" | 20 | app:destination="@id/configuracionFragment" |
21 | app:popEnterAnim="@anim/slide_in_left" | 21 | app:popEnterAnim="@anim/slide_in_left" |
22 | app:popExitAnim="@anim/slide_out_right" | 22 | app:popExitAnim="@anim/slide_out_right" |
23 | app:enterAnim="@anim/slide_in_right" | 23 | app:enterAnim="@anim/slide_in_right" |
24 | app:exitAnim="@anim/slide_out_left" /> | 24 | app:exitAnim="@anim/slide_out_left" /> |
25 | <action | 25 | <action |
26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" | 26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" |
27 | app:destination="@id/actuaMaestrosFragment" | 27 | app:destination="@id/actuaMaestrosFragment" |
28 | app:popEnterAnim="@anim/slide_in_left" | 28 | app:popEnterAnim="@anim/slide_in_left" |
29 | app:popExitAnim="@anim/slide_out_right" | 29 | app:popExitAnim="@anim/slide_out_right" |
30 | app:enterAnim="@anim/slide_in_right" | 30 | app:enterAnim="@anim/slide_in_right" |
31 | app:exitAnim="@anim/slide_out_left" /> | 31 | app:exitAnim="@anim/slide_out_left" /> |
32 | <action | 32 | <action |
33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" | 33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" |
34 | app:destination="@id/inventarioFragment" | 34 | app:destination="@id/inventarioFragment" |
35 | app:popEnterAnim="@anim/slide_in_left" | 35 | app:popEnterAnim="@anim/slide_in_left" |
36 | app:popExitAnim="@anim/slide_out_right" | 36 | app:popExitAnim="@anim/slide_out_right" |
37 | app:enterAnim="@anim/slide_in_right" | 37 | app:enterAnim="@anim/slide_in_right" |
38 | app:exitAnim="@anim/slide_out_left" /> | 38 | app:exitAnim="@anim/slide_out_left" /> |
39 | </fragment> | 39 | </fragment> |
40 | <fragment | 40 | <fragment |
41 | android:id="@+id/actuaMaestrosFragment" | 41 | android:id="@+id/actuaMaestrosFragment" |
42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" | 42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" |
43 | android:label="Actualización de Maestros" | 43 | android:label="Actualización de Maestros" |
44 | tools:layout="@layout/fragment_actua_maestros" /> | 44 | tools:layout="@layout/fragment_actua_maestros" /> |
45 | <fragment | 45 | <fragment |
46 | android:id="@+id/servidoresFragment" | 46 | android:id="@+id/servidoresFragment" |
47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" | 47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" |
48 | android:label="Alta Servidores" | 48 | android:label="Alta Servidores" |
49 | tools:layout="@layout/fragment_servidores"> | 49 | tools:layout="@layout/fragment_servidores"> |
50 | <action | 50 | <action |
51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | 51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" |
52 | app:destination="@id/configuracionFragment" | 52 | app:destination="@id/configuracionFragment" |
53 | app:enterAnim="@anim/slide_in_right" | 53 | app:enterAnim="@anim/slide_in_right" |
54 | app:exitAnim="@anim/slide_out_left" | 54 | app:exitAnim="@anim/slide_out_left" |
55 | app:popEnterAnim="@anim/slide_in_left" | 55 | app:popEnterAnim="@anim/slide_in_left" |
56 | app:popExitAnim="@anim/slide_out_right" /> | 56 | app:popExitAnim="@anim/slide_out_right" /> |
57 | </fragment> | 57 | </fragment> |
58 | <fragment | 58 | <fragment |
59 | android:id="@+id/inventarioFragment" | 59 | android:id="@+id/inventarioFragment" |
60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" | 60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" |
61 | android:label="Inventario Dinamico" | 61 | android:label="Inventario Dinamico" |
62 | tools:layout="@layout/fragment_inventario" > | 62 | tools:layout="@layout/fragment_inventario" > |
63 | <action | 63 | <action |
64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" | 64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" |
65 | app:destination="@id/descripcionFragment" | 65 | app:destination="@id/descripcionFragment" |
66 | app:popEnterAnim="@anim/slide_in_left" | 66 | app:popEnterAnim="@anim/slide_in_left" |
67 | app:popExitAnim="@anim/slide_out_right" | 67 | app:popExitAnim="@anim/slide_out_right" |
68 | app:enterAnim="@anim/slide_in_right" | 68 | app:enterAnim="@anim/slide_in_right" |
69 | app:exitAnim="@anim/slide_out_left" /> | 69 | app:exitAnim="@anim/slide_out_left" /> |
70 | <action | 70 | <action |
71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" | 71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" |
72 | app:destination="@id/mainFragment2" | 72 | app:destination="@id/mainFragment2" |
73 | app:popEnterAnim="@anim/slide_in_left" | 73 | app:popEnterAnim="@anim/slide_in_left" |
74 | app:popExitAnim="@anim/slide_out_right" | 74 | app:popExitAnim="@anim/slide_out_right" |
75 | app:enterAnim="@anim/slide_in_right" | 75 | app:enterAnim="@anim/slide_in_right" |
76 | app:exitAnim="@anim/slide_out_left"/> | 76 | app:exitAnim="@anim/slide_out_left"/> |
77 | <action | ||
78 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" | ||
79 | app:destination="@id/detalleArtFragment" /> | ||
77 | 80 | ||
78 | </fragment> | 81 | </fragment> |
79 | <fragment | 82 | <fragment |
80 | android:id="@+id/configuracionFragment" | 83 | android:id="@+id/configuracionFragment" |
81 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" | 84 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" |
82 | android:label="Configuraciones" | 85 | android:label="Configuraciones" |
83 | tools:layout="@layout/fragment_configuracion" > | 86 | tools:layout="@layout/fragment_configuracion" > |
84 | <action | 87 | <action |
85 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | 88 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" |
86 | app:destination="@id/servidoresFragment" | 89 | app:destination="@id/servidoresFragment" |
87 | app:popEnterAnim="@anim/slide_in_left" | 90 | app:popEnterAnim="@anim/slide_in_left" |
88 | app:popExitAnim="@anim/slide_out_right" | 91 | app:popExitAnim="@anim/slide_out_right" |
89 | app:enterAnim="@anim/slide_in_right" | 92 | app:enterAnim="@anim/slide_in_right" |
90 | app:exitAnim="@anim/slide_out_left" /> | 93 | app:exitAnim="@anim/slide_out_left" /> |
91 | </fragment> | 94 | </fragment> |
92 | <fragment | 95 | <fragment |
93 | android:id="@+id/descripcionFragment" | 96 | android:id="@+id/descripcionFragment" |
94 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" | 97 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" |
95 | android:label="Productos Encontrados"> | 98 | android:label="Productos Encontrados"> |
96 | 99 | ||
97 | <action | 100 | <action |
98 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 101 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
99 | app:destination="@id/inventarioFragment" | 102 | app:destination="@id/inventarioFragment" |
100 | app:popEnterAnim="@anim/slide_in_left" | 103 | app:popEnterAnim="@anim/slide_in_left" |
101 | app:popExitAnim="@anim/slide_out_right" | 104 | app:popExitAnim="@anim/slide_out_right" |
102 | app:enterAnim="@anim/slide_in_right" | 105 | app:enterAnim="@anim/slide_in_right" |
103 | app:exitAnim="@anim/slide_out_left" | 106 | app:exitAnim="@anim/slide_out_left" |
104 | app:popUpTo="@+id/descripcionFragment" | 107 | app:popUpTo="@+id/descripcionFragment" |
105 | app:popUpToInclusive="true"/> | 108 | app:popUpToInclusive="true"/> |
106 | </fragment> | 109 | </fragment> |
107 | <dialog | 110 | <dialog |
108 | android:id="@+id/dialogNoEncontrado" | 111 | android:id="@+id/dialogNoEncontrado" |
109 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" | 112 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" |
110 | android:label="DialogNoEncontrado" /> | 113 | android:label="DialogNoEncontrado" /> |
111 | <fragment | 114 | <fragment |
112 | android:id="@+id/dialogoLogin" | 115 | android:id="@+id/dialogoLogin" |
113 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" | 116 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" |
114 | android:label="dialogoLogin" /> | 117 | android:label="dialogoLogin" /> |
115 | <fragment | 118 | <fragment |
116 | android:id="@+id/singleChoiceAlertDialog" | 119 | android:id="@+id/singleChoiceAlertDialog" |
117 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" | 120 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" |
118 | android:label="SingleChoiceAlertDialog" /> | 121 | android:label="SingleChoiceAlertDialog" /> |
122 | <fragment | ||
123 | android:id="@+id/detalleArtFragment" | ||
124 | android:name="com.focasoftware.deboinventariov20.ui.detalleProducto.DetalleArtFragment" | ||
125 | android:label="Detalle Articulo" | ||
126 | tools:layout="@layout/fragment_detalle_art"> | ||
127 | <action | ||
128 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" | ||
129 | app:destination="@id/inventarioFragment" /> | ||
130 | </fragment> | ||
119 | </navigation> | 131 | </navigation> |
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">Inicio</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">Actualizar Maestros</string> | 9 | <string name="menuActMae">Actualizar Maestros</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 Sectorizados</string> | 28 | <string name="invDinamicoCompra">Inventarios Sectorizados</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> | 33 | <string name="btnConfirmar">Confirmar</string> |
34 | <string name="btnCancela">Cancelar</string> | 34 | <string name="btnCancela">Cancelar</string> |
35 | 35 | ||
36 | 36 | ||
37 | <!-- Fragment Inventario--> | 37 | <!-- Fragment Inventario--> |
38 | <string name="invTitulo">Inventarios Dinámicos</string> | 38 | <string name="invTitulo">Inventarios Dinámicos</string> |
39 | <string name="invTituloV">Inventarios de Ventas</string> | 39 | <string name="invTituloV">Inventarios de Ventas</string> |
40 | <string name="invTituloD">Inventarios de Depositos</string> | 40 | <string name="invTituloD">Inventarios de Depositos</string> |
41 | <string name="invCodigoBarras">Código Barras:</string> | 41 | <string name="invCodigoBarras">Código Barras:</string> |
42 | <string name="btnExportarInv">Exportar Inventario</string> | 42 | <string name="btnExportarInv">Exportar Inventario</string> |
43 | <string name="btnBorrarInv">Borrar Inventario</string> | 43 | <string name="btnBorrarInv">Borrar Inventario</string> |
44 | <string name="ibBusDesc">Busqueda por Descripción</string> | 44 | <string name="ibBusDesc">Busqueda por Descripción</string> |
45 | <string name="ibBusCB">Busqueda por C. Barras</string> | 45 | <string name="ibBusCB">Busqueda por C. Barras</string> |
46 | <string name="ibBusCO">Busqueda por Código de Origen</string> | 46 | <string name="ibBusCO">Busqueda por Código de Origen</string> |
47 | <string name="switch_1">+ 1</string> | 47 | <string name="switch_1">+ 1</string> |
48 | 48 | ||
49 | <!-- Fragmento Configuraciones--> | 49 | <!-- Fragmento Configuraciones--> |
50 | <string name="tvTituloConf">Configuraciones</string> | 50 | <string name="tvTituloConf">Configuraciones</string> |
51 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> | 51 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> |
52 | <string name="btnValidarServidor">Validar</string> | 52 | <string name="btnValidarServidor">Validar</string> |
53 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> | 53 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> |
54 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> | 54 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> |
55 | <string name="tvTituloArea">Area de Invetnario</string> | 55 | <string name="tvTituloArea">Area de Invetnario</string> |
56 | <string name="rbVentas">Inventarios de Ventas</string> | 56 | <string name="rbVentas">Inventarios de Ventas</string> |
57 | <string name="rbDeposito">Inventarios de Depositos</string> | 57 | <string name="rbDeposito">Inventarios de Depositos</string> |
58 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> | 58 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> |
59 | <string name="tvColumnas">Columnas a Visualizar</string> | 59 | <string name="tvColumnas">Columnas a Visualizar</string> |
60 | 60 | ||
61 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> | 61 | <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> | 62 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> |
63 | 63 | ||
64 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> | 64 | <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> | 65 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> |
66 | 66 | ||
67 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> | 67 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> |
68 | 68 | ||
69 | <string name="rbCodigoDebo">Código DEBO</string> | 69 | <string name="rbCodigoDebo">Código DEBO</string> |
70 | <string name="rbCodigoOrigen">Código Origen</string> | 70 | <string name="rbCodigoOrigen">Código Origen</string> |
71 | <string name="rbCodigoBarras">Código de Barras</string> | 71 | <string name="rbCodigoBarras">Código de Barras</string> |
72 | 72 | ||
73 | 73 | ||
74 | <!-- Spinner servidor--> | 74 | <!-- Spinner servidor--> |
75 | <string-array name="spinnerServidor"> | 75 | <string-array name="spinnerServidor"> |
76 | <item>Servidor Laboratorio 1</item> | 76 | <item>Servidor Laboratorio 1</item> |
77 | <item>Servidor Laboratorio 2</item> | 77 | <item>Servidor Laboratorio 2</item> |
78 | <item>Servidor Laboratorio 3</item> | 78 | <item>Servidor Laboratorio 3</item> |
79 | </string-array> | 79 | </string-array> |
80 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> | 80 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> |
81 | 81 | ||
82 | <string name="cbMostrarExistencia">Existencia</string> | 82 | <string name="cbMostrarExistencia">Existencia</string> |
83 | <string name="cbMostrarPrecio">Precio</string> | 83 | <string name="cbMostrarPrecio">Precio</string> |
84 | 84 | ||
85 | <string name="btnGuardar">Guardar Cambios</string> | 85 | <string name="btnGuardar">Guardar Cambios</string> |
86 | 86 | ||
87 | <!-- fragment Actualizacion de Maestros--> | 87 | <!-- fragment Actualizacion de Maestros--> |
88 | <string name="tvActMaestros">Actualización de Maestros</string> | 88 | <string name="tvActMaestros">Actualización de Maestros</string> |
89 | <string name="tvMedio">Seleccione el medio por el cual desea realizar la importación de maestros</string> | 89 | <string name="tvMedio">Seleccione el medio por el cual desea realizar la importación de maestros</string> |
90 | <string name="obPorWifi">Via Wifi</string> | 90 | <string name="obPorWifi">Via Wifi</string> |
91 | <string name="obViaArchivo">Via Archivos MaeTable</string> | 91 | <string name="obViaArchivo">Via Archivos MaeTable</string> |
92 | 92 | ||
93 | <string name="btnConfirmarAct">Confirmar Actualización</string> | 93 | <string name="btnConfirmarAct">Confirmar Actualización</string> |
94 | 94 | ||
95 | <!-- Fragment Save--> | 95 | <!-- Fragment Save--> |
96 | <string name="tvConfServi">Configuración de Servidores</string> | 96 | <string name="tvConfServi">Configuración de Servidores</string> |
97 | <string name="server">Ingrese la direccion del servidor</string> | 97 | <string name="server">Ingrese la direccion del servidor</string> |
98 | <string name="etNomServer">Ingrese una descripción para la conexión</string> | 98 | <string name="etNomServer">Ingrese una descripción para la conexión</string> |
99 | <string name="btnGuardarConfServ">Guardar Conexión</string> | 99 | <string name="btnGuardarConfServ">Guardar Conexión</string> |
100 | 100 | ||
101 | <!-- Dialog--> | 101 | <!-- Dialog--> |
102 | <string name="sTitulo">Producto Buscado</string> | 102 | <string name="sTitulo">Producto Buscado</string> |
103 | <string name="btnOk">Aceptar</string> | 103 | <string name="btnOk">Aceptar</string> |
104 | <string name="btnCancelar">Cancelar</string> | 104 | <string name="btnCancelar">Cancelar</string> |
105 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> | 105 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> |
106 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> | 106 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> |
107 | <string name="sTituloNueva">Producto ingresado esta cargado</string> | 107 | <string name="sTituloNueva">Producto ingresado esta cargado</string> |
108 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> | 108 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> |
109 | <string name="sMensajeBorrarInv">¡Seguro que desea Borrar el inventario!</string> | 109 | <string name="sMensajeBorrarInv">¡Seguro que desea Borrar el inventario!</string> |
110 | <string name="sTituloBorrarInv">Borrar Inventario</string> | 110 | <string name="sTituloBorrarInv">Borrar Inventario</string> |
111 | 111 | ||
112 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> | 112 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> |
113 | <string name="sTituloExportar">Exportación de Inventarios</string> | 113 | <string name="sTituloExportar">Exportación de Inventarios</string> |
114 | 114 | ||
115 | <!-- FRAGMENT SERVIDOR--> | 115 | <!-- FRAGMENT SERVIDOR--> |
116 | <string name="tvTitutloServer">Alta de Servidores</string> | 116 | <string name="tvTitutloServer">Alta de Servidores</string> |
117 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> | 117 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> |
118 | <string name="tvDirServer">Ingrese la dirección del servidor</string> | 118 | <string name="tvDirServer">Ingrese la dirección del servidor</string> |
119 | <string name="btnGuardarServidores">Guardar Servidor</string> | 119 | <string name="btnGuardarServidores">Guardar Servidor</string> |
120 | 120 | ||
121 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> | 121 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> |
122 | <string name="rbSumar">Sumar</string> | 122 | <string name="rbSumar">Sumar</string> |
123 | <string name="rbRestar">Restar</string> | 123 | <string name="rbRestar">Restar</string> |
124 | <string name="rbModificar">Reemplazar</string> | 124 | <string name="rbModificar">Reemplazar</string> |
125 | <string name="tvTotal">Cantidad Final</string>tvTotal | 125 | <string name="tvTotal">Cantidad Final</string>tvTotal |
126 | <string name="tvResultado">Cantidad final:</string>tvTotal | 126 | <string name="tvResultado">Cantidad final:</string>tvTotal |
127 | 127 | ||
128 | <string name="large_text"> | 128 | <string name="large_text"> |
129 | "Material is the metaphor.\n\n" | 129 | "Material is the metaphor.\n\n" |
130 | 130 | ||
131 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." | 131 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." |
132 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " | 132 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " |
133 | "technologically advanced and open to imagination and magic.\n" | 133 | "technologically advanced and open to imagination and magic.\n" |
134 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " | 134 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " |
135 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " | 135 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " |
136 | "flexibility of the material creates new affordances that supercede those in the physical " | 136 | "flexibility of the material creates new affordances that supercede those in the physical " |
137 | "world, without breaking the rules of physics.\n" | 137 | "world, without breaking the rules of physics.\n" |
138 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " | 138 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " |
139 | "interact, and exist in space and in relation to each other. Realistic lighting shows " | 139 | "interact, and exist in space and in relation to each other. Realistic lighting shows " |
140 | "seams, divides space, and indicates moving parts.\n\n" | 140 | "seams, divides space, and indicates moving parts.\n\n" |
141 | 141 | ||
142 | "Bold, graphic, intentional.\n\n" | 142 | "Bold, graphic, intentional.\n\n" |
143 | 143 | ||
144 | "The foundational elements of print based design typography, grids, space, scale, color, " | 144 | "The foundational elements of print based design typography, grids, space, scale, color, " |
145 | "and use of imagery guide visual treatments. These elements do far more than please the " | 145 | "and use of imagery guide visual treatments. These elements do far more than please the " |
146 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " | 146 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " |
147 | "imagery, large scale typography, and intentional white space create a bold and graphic " | 147 | "imagery, large scale typography, and intentional white space create a bold and graphic " |
148 | "interface that immerse the user in the experience.\n" | 148 | "interface that immerse the user in the experience.\n" |
149 | "An emphasis on user actions makes core functionality immediately apparent and provides " | 149 | "An emphasis on user actions makes core functionality immediately apparent and provides " |
150 | "waypoints for the user.\n\n" | 150 | "waypoints for the user.\n\n" |
151 | 151 | ||
152 | "Motion provides meaning.\n\n" | 152 | "Motion provides meaning.\n\n" |
153 | 153 | ||
154 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " | 154 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " |
155 | "inflection points that initiate motion, transforming the whole design.\n" | 155 | "inflection points that initiate motion, transforming the whole design.\n" |
156 | "All action takes place in a single environment. Objects are presented to the user without " | 156 | "All action takes place in a single environment. Objects are presented to the user without " |
157 | "breaking the continuity of experience even as they transform and reorganize.\n" | 157 | "breaking the continuity of experience even as they transform and reorganize.\n" |
158 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " | 158 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " |
159 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" | 159 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" |
160 | 160 | ||
161 | "3D world.\n\n" | 161 | "3D world.\n\n" |
162 | 162 | ||
163 | "The material environment is a 3D space, which means all objects have x, y, and z " | 163 | "The material environment is a 3D space, which means all objects have x, y, and z " |
164 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " | 164 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " |
165 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " | 165 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " |
166 | "position along the z-axis and has a standard 1dp thickness.\n" | 166 | "position along the z-axis and has a standard 1dp thickness.\n" |
167 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " | 167 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " |
168 | "emulated by manipulating the y-axis.\n\n" | 168 | "emulated by manipulating the y-axis.\n\n" |
169 | 169 | ||
170 | "Light and shadow.\n\n" | 170 | "Light and shadow.\n\n" |
171 | 171 | ||
172 | "Within the material environment, virtual lights illuminate the scene. Key lights create " | 172 | "Within the material environment, virtual lights illuminate the scene. Key lights create " |
173 | "directional shadows, while ambient light creates soft shadows from all angles.\n" | 173 | "directional shadows, while ambient light creates soft shadows from all angles.\n" |
174 | "Shadows in the material environment are cast by these two light sources. In Android " | 174 | "Shadows in the material environment are cast by these two light sources. In Android " |
175 | "development, shadows occur when light sources are blocked by sheets of material at " | 175 | "development, shadows occur when light sources are blocked by sheets of material at " |
176 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " | 176 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " |
177 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" | 177 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" |
178 | 178 | ||
179 | "Resting elevation.\n\n" | 179 | "Resting elevation.\n\n" |
180 | 180 | ||
181 | "All material objects, regardless of size, have a resting elevation, or default elevation " | 181 | "All material objects, regardless of size, have a resting elevation, or default elevation " |
182 | "that does not change. If an object changes elevation, it should return to its resting " | 182 | "that does not change. If an object changes elevation, it should return to its resting " |
183 | "elevation as soon as possible.\n\n" | 183 | "elevation as soon as possible.\n\n" |
184 | 184 | ||
185 | "Component elevations.\n\n" | 185 | "Component elevations.\n\n" |
186 | 186 | ||
187 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " | 187 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " |
188 | "does not vary from 6dp in one app to 16dp in another app).\n" | 188 | "does not vary from 6dp in one app to 16dp in another app).\n" |
189 | "Components may have different resting elevations across platforms, depending on the depth " | 189 | "Components may have different resting elevations across platforms, depending on the depth " |
190 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" | 190 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" |
191 | 191 | ||
192 | "Responsive elevation and dynamic elevation offsets.\n\n" | 192 | "Responsive elevation and dynamic elevation offsets.\n\n" |
193 | 193 | ||
194 | "Some component types have responsive elevation, meaning they change elevation in response " | 194 | "Some component types have responsive elevation, meaning they change elevation in response " |
195 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " | 195 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " |
196 | "changes are consistently implemented using dynamic elevation offsets.\n" | 196 | "changes are consistently implemented using dynamic elevation offsets.\n" |
197 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " | 197 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " |
198 | "to the component’s resting state. They ensure that elevation changes are consistent " | 198 | "to the component’s resting state. They ensure that elevation changes are consistent " |
199 | "across actions and component types. For example, all components that lift on press have " | 199 | "across actions and component types. For example, all components that lift on press have " |
200 | "the same elevation change relative to their resting elevation.\n" | 200 | "the same elevation change relative to their resting elevation.\n" |
201 | "Once the input event is completed or cancelled, the component will return to its resting " | 201 | "Once the input event is completed or cancelled, the component will return to its resting " |
202 | "elevation.\n\n" | 202 | "elevation.\n\n" |
203 | 203 | ||
204 | "Avoiding elevation interference.\n\n" | 204 | "Avoiding elevation interference.\n\n" |
205 | 205 | ||
206 | "Components with responsive elevations may encounter other components as they move between " | 206 | "Components with responsive elevations may encounter other components as they move between " |
207 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " | 207 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " |
208 | "through other material, components avoid interfering with one another any number of ways, " | 208 | "through other material, components avoid interfering with one another any number of ways, " |
209 | "whether on a per component basis or using the entire app layout.\n" | 209 | "whether on a per component basis or using the entire app layout.\n" |
210 | "On a component level, components can move or be removed before they cause interference. " | 210 | "On a component level, components can move or be removed before they cause interference. " |
211 | "For example, a floating action button (FAB) can disappear or move off screen before a " | 211 | "For example, a floating action button (FAB) can disappear or move off screen before a " |
212 | "user picks up a card, or it can move if a snackbar appears.\n" | 212 | "user picks up a card, or it can move if a snackbar appears.\n" |
213 | "On the layout level, design your app layout to minimize opportunities for interference. " | 213 | "On the layout level, design your app layout to minimize opportunities for interference. " |
214 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " | 214 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " |
215 | "when a user tries to pick up one of cards.\n\n" | 215 | "when a user tries to pick up one of cards.\n\n" |
216 | </string> | 216 | </string> |
217 | </resources> | 217 | </resources> |