Commit be3b7b8379eb7270ca91858b56670bab94d91506

Authored by Mauricio Sanchez
1 parent 89988103b2
Exists in master

21092020 0900

Showing 25 changed files with 646 additions and 564 deletions   Show diff stats
.idea/codeStyles/Project.xml
... ... @@ -133,6 +133,9 @@
133 133 </codeStyleSettings>
134 134 <codeStyleSettings language="kotlin">
135 135 <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
  136 + <option name="RIGHT_MARGIN" value="200" />
  137 + <option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
  138 + <option name="WRAP_ON_TYPING" value="0" />
136 139 </codeStyleSettings>
137 140 </code_scheme>
138 141 </component>
139 142 \ No newline at end of file
.idea/codeStyles/codeStyleConfig.xml
1 1 <component name="ProjectCodeStyleConfiguration">
2 2 <state>
3 3 <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4   - <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
5 4 </state>
6 5 </component>
7 6 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
... ... @@ -51,19 +51,19 @@ interface InvHeadDAO {
51 51 suspend fun deleteAllArticulos()
52 52  
53 53 @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven")
54   - suspend fun deleteinvHead(inven: Int)
  54 + suspend fun deleteinvHead(inven: Long)
55 55  
56 56 @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI")
57 57 suspend fun fetchAllInvHead(): List<InvHead>
58 58  
59 59 @Query("SELECT INV_LUG FROM $TABLA_INV_H WHERE INV_NUM=:inven")
60   - suspend fun fetchAreaInvH (inven: Int): Boolean
  60 + suspend fun fetchAreaInvH (inven: Long): Boolean
61 61  
62 62 @Query("SELECT INV_PRODCONT FROM $TABLA_INV_H WHERE INV_NUM=:inven")
63   - suspend fun consultaCantidadInvH (inven: Int): Int
  63 + suspend fun consultaCantidadInvH (inven: Long): Int
64 64  
65 65 @Query("UPDATE $TABLA_INV_H SET INV_PRODCONT=:cant WHERE INV_NUM=:inven")
66   - suspend fun updateInvBody(inven: Int,cant: Int)
  66 + suspend fun updateInvBody(inven: Long,cant: Int)
67 67 }
68 68  
69 69 @Dao
... ... @@ -75,19 +75,19 @@ interface InvBodyDAO {
75 75 suspend fun deleteAllInvBody()
76 76  
77 77 @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven")
78   - suspend fun deleteInvBody(inven: Int)
  78 + suspend fun deleteInvBody(inven: Long)
79 79  
80 80 @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod")
81   - suspend fun UpdateInvBody(cant: Float, sec: String, cod: String)
  81 + suspend fun UpdateInvBody(cant: Float, sec: Long, cod: Long)
82 82  
83 83 @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC")
84 84 suspend fun fetchAllInvBody(inven: Int): List<InvBody>
85 85  
86 86 @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo")
87   - suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody
  87 + suspend fun fetchArtInInvBody(sector: Long, codigo: Long, numInventario: Long): InvBody
88 88  
89 89 @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo")
90   - suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int
  90 + suspend fun deleteItemFromInvBody(sector: Long, codigo: Long, numInventario: Long): Int
91 91 }
92 92  
93 93 @Dao
... ... @@ -111,5 +111,8 @@ interface ServeInvDao {
111 111 suspend fun UpdateServerPre(numero: Int)
112 112  
113 113 @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE= 1")
114   - suspend fun fetchServerPreOne(): ServeInv
  114 + suspend fun fetchServerPreOne(): ServeInv
  115 +
  116 + @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_NUM = :numero")
  117 + suspend fun fetchServer(numero: Int): ServeInv
115 118 }
116 119 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/UI/SplashActivity.kt
... ... @@ -15,7 +15,7 @@ class SplashActivity : Activity() {
15 15 val bac = object : Thread(){
16 16 override fun run(){
17 17 try {
18   - Thread.sleep(5)
  18 + Thread.sleep(3000)
19 19 val intent = Intent(baseContext, MainActivity:: class.java)
20 20 startActivity(intent)
21 21 finish()
app/src/main/java/com/focasoftware/deboinventariov20/UI/Utils/Utils.kt
... ... @@ -12,14 +12,17 @@ import kotlinx.coroutines.async
12 12 import java.io.IOException
13 13 import java.net.UnknownHostException
14 14  
15   -fun modificarCantidadEnCabecera(inventarioActual: Int, b: Boolean,context: Context) {
  15 +fun modificarCantidadEnCabecera(inventarioActual: Int, b: Boolean, context: Context) {
16 16 GlobalScope.async(Dispatchers.IO) {
17 17 var cantProductos = 0
18   - cantProductos = AppDb.getAppDb(context)!!.InvHeadDAO()!!.consultaCantidadInvH(inventarioActual)
  18 + cantProductos =
  19 + AppDb.getAppDb(context)!!.InvHeadDAO()!!.consultaCantidadInvH(inventarioActual.toLong())
19 20 if (b) {
20   - AppDb.getAppDb(context)!!.InvHeadDAO()!!.updateInvBody(inventarioActual, cantProductos + 1)
  21 + AppDb.getAppDb(context)!!.InvHeadDAO()!!
  22 + .updateInvBody(inventarioActual.toLong(), cantProductos + 1)
21 23 } else {
22   - AppDb.getAppDb(context)!!.InvHeadDAO()!!.updateInvBody(inventarioActual, cantProductos - 1)
  24 + AppDb.getAppDb(context)!!.InvHeadDAO()!!
  25 + .updateInvBody(inventarioActual.toLong(), cantProductos - 1)
23 26 }
24 27 }
25 28 }
... ... @@ -48,38 +51,37 @@ open class AlertDialogBorrarInv : DialogFragment() {
48 51 return builder.create()
49 52 } ?: throw IllegalStateException("Activity cannot be null")
50 53 }
51   - public fun Int.twoDigits() =
52   - if (this <= 9) "0$this" else this.toString()}
  54 +}
53 55  
54   -public class NoEncontradoSimple : DialogFragment() {
  56 +class NoEncontradoSimple : DialogFragment() {
55 57 override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
56 58 return activity?.let {
57 59 val title = ""
58 60 val content = "¡El producto buscado NO fue encontrado!"
59 61 val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
60   - builder.setTitle(title).setMessage(content).setPositiveButton(android.R.string.ok) { _, _ ->
61   - //Todo OK click
  62 + builder.setTitle(title).setMessage(content)
  63 + .setPositiveButton(android.R.string.ok) { _, _ -> }
  64 + return builder.create()
  65 + } ?: throw IllegalStateException("Activity cannot be null")
  66 + }
  67 +}
  68 +
  69 +class noServerConf : DialogFragment() {
  70 + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
  71 + return activity?.let {
  72 + val title = ""
  73 + val content = "¡Antes de importar debe configurar un servidor!"
  74 + val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
  75 + builder.setTitle(title).setMessage(content)
  76 + .setPositiveButton(android.R.string.ok) { _, _ ->
  77 + activity?.onBackPressed()
62 78 }
63 79  
64 80 return builder.create()
65 81 } ?: throw IllegalStateException("Activity cannot be null")
66 82 }
67 83 }
68   - public class noServerConf : DialogFragment() {
69   - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
70   - return activity?.let {
71   - val title = ""
72   - val content = "¡Antes de importar debe configurar un servidor!"
73   - val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
74   - builder.setTitle(title).setMessage(content)
75   - .setPositiveButton(android.R.string.ok) { _, _ ->
76   - activity?.onBackPressed();
77   - }
78 84  
79   - return builder.create()
80   - } ?: throw IllegalStateException("Activity cannot be null")
81   - }
82   -}
83 85 fun isConnectedToThisServer(host: String): Boolean {
84 86  
85 87 val runtime = Runtime.getRuntime()
... ... @@ -98,3 +100,27 @@ fun isConnectedToThisServer(host: String): Boolean {
98 100  
99 101 return false
100 102 }
  103 +class serverValido : DialogFragment() {
  104 + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
  105 + return activity?.let {
  106 + val title = ""
  107 + val content = "¡La IP del servidor es correcta!"
  108 + val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
  109 + builder.setTitle(title).setMessage(content)
  110 + .setPositiveButton(android.R.string.ok) { _, _ -> }
  111 + return builder.create()
  112 + } ?: throw IllegalStateException("Activity cannot be null")
  113 + }
  114 +}
  115 +class serverNoValido : DialogFragment() {
  116 + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
  117 + return activity?.let {
  118 + val title = ""
  119 + val content = "¡La IP del servidor es Incorrecta! Verfique en la carga de Servidores."
  120 + val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
  121 + builder.setTitle(title).setMessage(content)
  122 + .setPositiveButton(android.R.string.ok) { _, _ -> }
  123 + return builder.create()
  124 + } ?: throw IllegalStateException("Activity cannot be null")
  125 + }
  126 +}
101 127 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/UI/actualizacionMaestros/ActuaMaestrosFragment.kt
... ... @@ -24,6 +24,7 @@ class ActuaMaestrosFragment : Fragment() {
24 24  
25 25 override fun onCreate(savedInstanceState: Bundle?) {
26 26 super.onCreate(savedInstanceState)
  27 +
27 28 GlobalScope.launch(Main) {
28 29 val serverPre = fetchServerPreOne()
29 30 if (serverPre!!.direccion.isNullOrEmpty()) {
... ... @@ -31,8 +32,10 @@ class ActuaMaestrosFragment : Fragment() {
31 32 modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog")
32 33 } else {
33 34 BASE_URL = serverPre.direccion.toString()+":"+serverPre.puerto.toString()+"/"
  35 + tvServerConectado.text="Conectado al servidor: ${serverPre.descripcion}"
34 36 }
35 37 }
  38 +
36 39 // mostrarArticulos()
37 40 }
38 41  
... ... @@ -46,9 +49,10 @@ class ActuaMaestrosFragment : Fragment() {
46 49 // Inflate the layout for this fragment
47 50 val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false)
48 51 val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct)
  52 +
49 53 bConfirmarAct.setOnClickListener {
50 54 loading_view.visibility = View.VISIBLE
51   - countriesList.text = "Obteniendo artículos del servidor $BASE_URL, aguarde por favor."
  55 + countriesList.text = "Obteniendo artículos del servidor, aguarde por favor."
52 56 GlobalScope.launch(Main) {
53 57 obtenerArticulos()
54 58 }
... ... @@ -158,73 +162,5 @@ class ActuaMaestrosFragment : Fragment() {
158 162 // editT.text= professor.id.toString()
159 163 // }
160 164 }
161   -
162   -
163   -// fun observeViewModel() {
164   -//
165   -// val productosService = ProductosService.getProductosService()
166   -// var job: Job? = null
167   -//
168   -//
169   -// //countriesList.text="Procesando..."
170   -// //countriesList.visibility = View.VISIBLE
171   -// // GlobalScope1.launch(Dispatchers.IO) {
172   -// val response = productosService.getProductos()
173   -// if (response.isSuccessful) {
174   -//// countriesList.layoutManager = LinearLayoutManager(context)
175   -//// countriesList.itemAnimator = DefaultItemAnimator()
176   -//
177   -//// ProductAdapter.updateCountries(it)
178   -// // cargarArticulos(response.body())
179   -//
180   -//
181   -// val artiAcargar: Articulos? = null
182   -// var index: Long = 1
183   -//
184   -// for (pro in response.body()!!) {
185   -// //artiAcargar.id =index+1
186   -// artiAcargar!!.sector = pro.sector
187   -// artiAcargar.codigo = pro.codigo
188   -// artiAcargar.descripcion = pro.descripcion
189   -// artiAcargar.codBar = pro.codBar
190   -// artiAcargar.precio = pro.precio
191   -// artiAcargar.costo = pro.costo
192   -// artiAcargar.balanza = pro.balanza
193   -// artiAcargar.depSn = pro.depSn
194   -// artiAcargar.imagen = pro.imagen
195   -// index += index
196   -//
197   -// AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!
198   -// .insertArticulos(artiAcargar)
199   -// }
200   -// }
201   -// // }
202   -//
203   -// //job.cancel()
204   -//
205   -//
206   -// }
207   -
208   -// fun cargarArticulos(Productos: List<Productos>?) {
209   -// val artiAcargar: Articulos? = null
210   -// var index: Long = 1
211   -// //val job4 = CoroutineScope(Dispatchers.Default).launch {
212   -// for (pro in Productos!!) {
213   -// //artiAcargar.id =index+1
214   -// artiAcargar!!.sector = pro.sector
215   -// artiAcargar.codigo = pro.codigo
216   -// artiAcargar.descripcion = pro.descripcion
217   -// artiAcargar.codBar = pro.codBar
218   -// artiAcargar.precio = pro.precio
219   -// artiAcargar.costo = pro.costo
220   -// artiAcargar.balanza = pro.balanza
221   -// artiAcargar.depSn = pro.depSn
222   -// artiAcargar.imagen = pro.imagen
223   -// index += index
224   -//
225   -// AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!
226   -// .insertArticulos(artiAcargar)
227   -// }
228   -// }
229 165 }
230 166  
app/src/main/java/com/focasoftware/deboinventariov20/UI/configuracion/ConfiguracionFragment.kt
... ... @@ -17,6 +17,8 @@ import com.focasoftware.deboinventariov20.DB.DataBase.AppDb
17 17 import com.focasoftware.deboinventariov20.Model.ServeInv
18 18 import com.focasoftware.deboinventariov20.R
19 19 import com.focasoftware.deboinventariov20.UI.Utils.isConnectedToThisServer
  20 +import com.focasoftware.deboinventariov20.UI.Utils.serverNoValido
  21 +import com.focasoftware.deboinventariov20.UI.Utils.serverValido
20 22 import kotlinx.android.synthetic.main.fragment_configuracion.*
21 23 import kotlinx.coroutines.*
22 24 import kotlinx.coroutines.Dispatchers.Main
... ... @@ -36,6 +38,7 @@ class ConfiguracionFragment : Fragment() {
36 38 override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
37 39 super.onViewCreated(view, savedInstanceState)
38 40 navController = Navigation.findNavController(view)
  41 +
39 42 GlobalScope.launch(Main) {
40 43 val listServer = mutableListOf<String>()
41 44 for (server in getDescServers()) {
... ... @@ -55,11 +58,7 @@ class ConfiguracionFragment : Fragment() {
55 58 }
56 59 }
57 60  
58   - override fun onCreateView(
59   - inflater: LayoutInflater,
60   - container: ViewGroup?,
61   - savedInstanceState: Bundle?
62   - ): View? {
  61 + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
63 62  
64 63 val v = inflater.inflate(R.layout.fragment_configuracion, container, false)
65 64 val etRuta = v.findViewById<EditText>(R.id.etRuta)
... ... @@ -187,33 +186,39 @@ class ConfiguracionFragment : Fragment() {
187 186 }
188 187 btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) }
189 188  
190   - btnValidarServidor.setOnClickListener {
191   - GlobalScope.launch(Main) {
192   - val serverPre = fetchServerPreOne()
193   - if (isConnectedToThisServer(serverPre!!.direccion.toString().substring(7,serverPre.direccion.toString().length))) {
194   - Toast.makeText(requireContext(), "¡Dirección Valida!", Toast.LENGTH_LONG).show()
195   - } else {
196   - Toast.makeText(requireContext(), "¡Verifique la Dirección!", Toast.LENGTH_LONG)
197   - .show()
198   - }
199   - }
200   - }
201   -
202 189 spServidor.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
203 190 override fun onNothingSelected(parent: AdapterView<*>?) {}
204   - override fun onItemSelected(
205   - parent: AdapterView<*>?,
206   - view: View?,
207   - position: Int,
208   - id: Long
209   - ) {
  191 + override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
210 192 itemSelect = parent!!.getItemAtPosition(position).toString().substring(0, 2).toInt()
211 193 indexSelect = position
212 194 }
213 195 }
  196 +
  197 + btnValidarServidor.setOnClickListener {
  198 + GlobalScope.launch(Main) {
  199 +
  200 + val serverPre = fetchServer()
  201 + if (serverPre != null) {
  202 + if (isConnectedToThisServer(serverPre.direccion.toString().substring(7, serverPre.direccion.toString().length))) {
  203 + val modalDialog = serverValido()
  204 + modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog")
  205 + } else {
  206 + val modalDialog = serverNoValido()
  207 + modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog")
  208 + }
  209 + }
  210 + }
  211 + }
  212 +
214 213 return v
215 214 }
216 215  
  216 + private suspend fun fetchServer(): ServeInv? {
  217 + return GlobalScope.async(Dispatchers.IO) {
  218 + return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServer(itemSelect)
  219 + }.await()
  220 + }
  221 +
217 222 suspend fun getDescServers(): List<ServeInv> {
218 223 return GlobalScope.async(Dispatchers.IO) {
219 224 return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers()
... ... @@ -221,67 +226,70 @@ class ConfiguracionFragment : Fragment() {
221 226 }
222 227  
223 228 fun guardarPreferencias() {
224   -// try {
225   - val editor = sharedPreferences.edit()
226   -
227   - if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString())
228   -
229   - if (rbProInclu.isChecked) editor?.putString(
230   - "rbProInclu",
231   - "1"
232   - ) else editor?.putString("rbProInclu", "0")
233   - if (rbProNoInclu.isChecked) editor?.putString(
234   - "rbProNoInclu",
235   - "1"
236   - ) else editor?.putString("rbProNoInclu", "0")
237   -
238   - if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString(
239   - "cbHabiLectura",
240   - "0"
241   - )
242   - if (cbMostrarStock.isChecked) editor?.putString(
243   - "cbMostrarStock",
244   - "1"
245   - ) else editor?.putString("cbMostrarStock", "0")
246   - if (rbVentas.isChecked) editor?.putString(
247   - "rbVentas",
248   - "1"
249   - ) else editor?.putString("rbVentas", "0")
250   - if (rbDeposito.isChecked) editor?.putString(
251   - "rbDeposito",
252   - "1"
253   - ) else editor?.putString("rbDeposito", "0")
254   - if (rbCodigoDebo.isChecked) editor?.putString(
255   - "rbCodigoDebo",
256   - "1"
257   - ) else editor?.putString("rbCodigoDebo", "0")
258   - if (rbCodigoOrigen.isChecked) editor?.putString(
259   - "rbCodigoOrigen",
260   - "1"
261   - ) else editor?.putString("rbCodigoOrigen", "0")
262   - if (rbCodigoBarras.isChecked) editor?.putString(
263   - "rbCodigoBarras",
264   - "1"
265   - ) else editor?.putString("rbCodigoBarras", "0")
266   - if (cbMostrarExistencia.isChecked) editor?.putString(
267   - "cbMostrarExistencia",
268   - "1"
269   - ) else editor?.putString("cbMostrarExistencia", "0")
270   - if (cbMostrarPrecio.isChecked) editor?.putString(
271   - "cbMostrarPrecio",
272   - "1"
273   - ) else editor?.putString("cbMostrarPrecio", "0")
274   - editor?.putString("ServerPredeterminado", indexSelect.toString())
275   - updateServerPreInZero()
276   - updateServerPre(itemSelect)
277   -
278   - editor?.apply()
279   - editor.commit()
280   -
281   -// } catch (e: Exception) {
282   -// Toast.makeText(requireContext(), "Error ", Toast.LENGTH_LONG).show()
283   -// e.printStackTrace()
284   -// }
  229 + try {
  230 + val editor = sharedPreferences.edit()
  231 +
  232 + if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString())
  233 +
  234 + if (rbProInclu.isChecked) editor?.putString(
  235 + "rbProInclu",
  236 + "1"
  237 + ) else editor?.putString("rbProInclu", "0")
  238 + if (rbProNoInclu.isChecked) editor?.putString(
  239 + "rbProNoInclu",
  240 + "1"
  241 + ) else editor?.putString("rbProNoInclu", "0")
  242 +
  243 + if (cbHabiLectura.isChecked) editor?.putString(
  244 + "cbHabiLectura",
  245 + "1"
  246 + ) else editor?.putString(
  247 + "cbHabiLectura",
  248 + "0"
  249 + )
  250 + if (cbMostrarStock.isChecked) editor?.putString(
  251 + "cbMostrarStock",
  252 + "1"
  253 + ) else editor?.putString("cbMostrarStock", "0")
  254 + if (rbVentas.isChecked) editor?.putString(
  255 + "rbVentas",
  256 + "1"
  257 + ) else editor?.putString("rbVentas", "0")
  258 + if (rbDeposito.isChecked) editor?.putString(
  259 + "rbDeposito",
  260 + "1"
  261 + ) else editor?.putString("rbDeposito", "0")
  262 + if (rbCodigoDebo.isChecked) editor?.putString(
  263 + "rbCodigoDebo",
  264 + "1"
  265 + ) else editor?.putString("rbCodigoDebo", "0")
  266 + if (rbCodigoOrigen.isChecked) editor?.putString(
  267 + "rbCodigoOrigen",
  268 + "1"
  269 + ) else editor?.putString("rbCodigoOrigen", "0")
  270 + if (rbCodigoBarras.isChecked) editor?.putString(
  271 + "rbCodigoBarras",
  272 + "1"
  273 + ) else editor?.putString("rbCodigoBarras", "0")
  274 + if (cbMostrarExistencia.isChecked) editor?.putString(
  275 + "cbMostrarExistencia",
  276 + "1"
  277 + ) else editor?.putString("cbMostrarExistencia", "0")
  278 + if (cbMostrarPrecio.isChecked) editor?.putString(
  279 + "cbMostrarPrecio",
  280 + "1"
  281 + ) else editor?.putString("cbMostrarPrecio", "0")
  282 + editor?.putString("ServerPredeterminado", indexSelect.toString())
  283 + updateServerPreInZero()
  284 + updateServerPre(itemSelect)
  285 +
  286 + editor?.apply()
  287 + editor.commit()
  288 +
  289 + } catch (e: Exception) {
  290 + Toast.makeText(requireContext(), "Error ", Toast.LENGTH_LONG).show()
  291 + e.printStackTrace()
  292 + }
285 293 }
286 294  
287 295 private fun updateServerPreInZero() {
... ... @@ -305,6 +313,7 @@ class ConfiguracionFragment : Fragment() {
305 313 }
306 314 }
307 315 }
  316 +
308 317 private suspend fun fetchServerPreOne(): ServeInv? {
309 318 return GlobalScope.async(Dispatchers.IO) {
310 319 return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne()
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripCorigenFragment/CodigoOriFragment.kt
... ... @@ -7,7 +7,9 @@ import android.graphics.Canvas
7 7 import android.graphics.Color
8 8 import android.graphics.drawable.ColorDrawable
9 9 import android.os.Bundle
  10 +import android.text.Editable
10 11 import android.text.InputType
  12 +import android.text.TextWatcher
11 13 import androidx.fragment.app.Fragment
12 14 import android.view.LayoutInflater
13 15 import android.view.View
... ... @@ -46,6 +48,7 @@ class CodigoOriFragment : Fragment() {
46 48 lateinit var navController: NavController
47 49 lateinit var sharedPreferences: SharedPreferences
48 50 private var artCargadoEnBD: InvBody? = null
  51 + lateinit var mDialogViewM: View
49 52  
50 53 override fun onCreate(savedInstanceState: Bundle?) {
51 54 super.onCreate(savedInstanceState)
... ... @@ -146,65 +149,66 @@ class CodigoOriFragment : Fragment() {
146 149 }
147 150 } else if (artCargadoEnBD != null) {
148 151  
149   - val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
150   - val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false)
151   - if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER
152   - mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat())
  152 + mDialogViewM = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
  153 + val mBuilder = AlertDialog.Builder(context).setView(mDialogViewM).setCancelable(false)
  154 + if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogViewM.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER
  155 + mDialogViewM.tvTitulo2.text="${artCargadoEnBD!!.descripcion}"
  156 + mDialogViewM.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat())
153 157  
154 158 val mAlertDialog = mBuilder.show()
155   - mDialogView.tvNuevaCantidad.requestFocus()
156   -
  159 + mDialogViewM.tvNuevaCantidad.requestFocus()
  160 + mDialogViewM.tvNuevaCantidad.addTextChangedListener(textWatcher)
157 161  
158 162 mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
159 163 mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
160 164  
161   - mDialogView.rbSumar.setOnClickListener {
162   - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
163   - mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()))
164   - mDialogView.tvNuevaCantidad.isEnabled=false
  165 + mDialogViewM.rbSumar.setOnClickListener {
  166 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  167 + mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvCantInicial.text.toString().toFloat() + mDialogViewM.tvNuevaCantidad.text.toString().toFloat()))
  168 +// mDialogView.tvNuevaCantidad.isEnabled=false
165 169 }
166 170 }
167   - mDialogView.rbRestar.setOnClickListener {
168   - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
169   - if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) {
170   - mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat())
171   - mDialogView.tvNuevaCantidad.isEnabled = false
  171 + mDialogViewM.rbRestar.setOnClickListener {
  172 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  173 + if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) {
  174 + mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat())
  175 +// mDialogView.tvNuevaCantidad.isEnabled = false
172 176 }else{
173   - mDialogView.tvResultado.text=""
174   - mDialogView.tvResultado.error = "Operación No Valida"
175   - mDialogView.tvResultado.requestFocus()
176   - mDialogView.tvResultado.hint = "Error"
  177 + mDialogViewM.tvResultado.text=""
  178 + mDialogViewM.tvResultado.error = "Operación No Valida"
  179 + mDialogViewM.tvResultado.requestFocus()
  180 + mDialogViewM.tvResultado.hint = "Error"
177 181 }
178 182 }
179 183 }
180   - mDialogView.rbMdodificar.setOnClickListener {
181   - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
182   - mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat()))
183   - mDialogView.tvNuevaCantidad.isEnabled = false
  184 + mDialogViewM.rbMdodificar.setOnClickListener {
  185 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  186 + mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvNuevaCantidad.text.toString().toFloat()))
  187 +// mDialogView.tvNuevaCantidad.isEnabled = false
184 188 }
185 189 }
186   - mDialogView.btnAceptar.setOnClickListener {
187   - if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) {
188   - if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) {
  190 + mDialogViewM.btnAceptar.setOnClickListener {
  191 + if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || !mDialogViewM.tvNuevaCantidad.text.isBlank()) {
  192 + if (mDialogViewM.tvResultado.text.isNotEmpty() || !mDialogViewM.tvResultado.text.isBlank()) {
189 193  
190 194 updateCantidad((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(),
191 195 (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(),
192   - mDialogView.tvResultado.text.toString().toFloat())
  196 + mDialogViewM.tvResultado.text.toString().toFloat())
193 197 // VolverAinventario()
194 198 activity?.onBackPressed();
195 199 mAlertDialog.dismiss()
196   - } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) {
197   - mDialogView.tvResultado.error = "Operación Requerida"
198   - mDialogView.tvResultado.requestFocus()
199   - mDialogView.tvResultado.hint = "Seleccione Operación"
  200 + } else if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) {
  201 + mDialogViewM.tvResultado.error = "Operación Requerida"
  202 + mDialogViewM.tvResultado.requestFocus()
  203 + mDialogViewM.tvResultado.hint = "Seleccione Operación"
200 204 }
201   - } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) {
202   - mDialogView.tvNuevaCantidad.error = "Completar"
203   - mDialogView.tvNuevaCantidad.requestFocus()
204   - mDialogView.tvNuevaCantidad.hint = "Ingrese un valor"
  205 + } else if (mDialogViewM.tvNuevaCantidad.text.isEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) {
  206 + mDialogViewM.tvNuevaCantidad.error = "Completar"
  207 + mDialogViewM.tvNuevaCantidad.requestFocus()
  208 + mDialogViewM.tvNuevaCantidad.hint = "Ingrese un valor"
205 209 }
206 210 }
207   - mDialogView.dialogCancelBtn.setOnClickListener {
  211 + mDialogViewM.dialogCancelBtn.setOnClickListener {
208 212 activity?.onBackPressed();
209 213 mAlertDialog.dismiss()
210 214 }
... ... @@ -242,20 +246,11 @@ class CodigoOriFragment : Fragment() {
242 246 }
243 247 }
244 248  
245   -// fun VolverAinventario() {
246   -//
247   -// val editor = sharedPreferences.edit()
248   -// editor?.putString("Inventario", numeroInventario.toString())
249   -// editor?.apply()
250   -// editor.commit()
251   -// navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment)
252   -// }
253   -
254 249 suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? {
255 250 //TODO BUSQUEDA POR CODIGO DE BARRAS
256 251 var busqueda: InvBody? = null
257 252 return GlobalScope.async(Dispatchers.IO) {
258   - busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario)
  253 + busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector.toLong(), codigo.toLong(), numInventario.toLong())
259 254 return@async busqueda
260 255 }.await()
261 256 }
... ... @@ -265,10 +260,42 @@ class CodigoOriFragment : Fragment() {
265 260 withContext(Dispatchers.IO) {
266 261 val activity: FragmentActivity? = activity
267 262 if (activity != null && isAdded) {
268   - AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo)
  263 + AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector.toLong(), codigo.toLong())
269 264 }
270 265 }
271 266 }
272 267 }
  268 + private val textWatcher = object : TextWatcher {
  269 + override fun afterTextChanged(s: Editable?) {
  270 + }
  271 +
  272 + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
  273 + }
273 274  
  275 + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
  276 + if (mDialogViewM.rbSumar.isChecked) {
  277 +// mDialogView.tvNuevaCantidad.isEnabled=false
  278 + mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat() + mDialogViewM.tvCantInicial.text.toString().toFloat())
  279 + }
  280 + if (mDialogViewM.rbRestar.isChecked) {
  281 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  282 + if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) {
  283 + mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat())
  284 +// mDialogView.tvNuevaCantidad.isEnabled = false
  285 + } else {
  286 + mDialogViewM.tvResultado.text = ""
  287 + mDialogViewM.tvResultado.error = "Operación No Valida"
  288 + mDialogViewM.tvResultado.requestFocus()
  289 + mDialogViewM.tvResultado.hint = "Error"
  290 + }
  291 + }
  292 + }
  293 + if (mDialogViewM.rbMdodificar.isChecked) {
  294 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  295 + mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat())
  296 +// mDialogView.tvNuevaCantidad.isEnabled = false
  297 + }
  298 + }
  299 + }
  300 + }
274 301 }
275 302 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripcionFragment/DescripcionFragment.kt
... ... @@ -7,7 +7,9 @@ import android.graphics.Canvas
7 7 import android.graphics.Color
8 8 import android.graphics.drawable.ColorDrawable
9 9 import android.os.Bundle
  10 +import android.text.Editable
10 11 import android.text.InputType
  12 +import android.text.TextWatcher
11 13 import android.view.LayoutInflater
12 14 import android.view.View
13 15 import android.view.ViewGroup
... ... @@ -45,6 +47,7 @@ class DescripcionFragment : Fragment() {
45 47 lateinit var navController: NavController
46 48 lateinit var sharedPreferences: SharedPreferences
47 49 private var artCargadoEnBD: InvBody? = null
  50 + lateinit var mDialogViewM: View
48 51  
49 52 override fun onCreate(savedInstanceState: Bundle?) {
50 53 super.onCreate(savedInstanceState)
... ... @@ -55,23 +58,19 @@ class DescripcionFragment : Fragment() {
55 58 }
56 59  
57 60 }
  61 +
58 62 override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
59 63 super.onViewCreated(view, savedInstanceState)
60 64 navController = Navigation.findNavController(view)
61 65 showSoftKeyboard(view)
62 66 }
  67 +
63 68 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
64 69 val v = inflater.inflate(R.layout.fragment_descripcion, container, false)
65 70 rcDescripcion = v.findViewById(R.id.rcDescripcion)
66   -// val btnSalir = v.findViewById<Button>(R.id.btnSalir)
67   -
68   -
69 71 IngresarRecicler(artAcargar2)
70 72 showSoftKeyboard(v)
71   -// btnSalir.setOnClickListener {
72   -// activity?.onBackPressed();
73   -//// VolverAinventario()
74   -// }
  73 +
75 74 return v
76 75 }
77 76  
... ... @@ -100,30 +99,33 @@ class DescripcionFragment : Fragment() {
100 99  
101 100 GlobalScope.launch(Dispatchers.Main) {
102 101 //TODO BUSCO EN BASE DE DATOS
103   - artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(),
104   - (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), numeroInventario.toString())
  102 + artCargadoEnBD = buscarCodigoDeboEnBD(
  103 + (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(),
  104 + (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), numeroInventario.toString()
  105 + )
105 106 if (artCargadoEnBD == null) {
106 107 val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null)
107 108 val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false)
108 109 //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO
109   - if ((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==1 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==3 || (viewAdapter2 as DescripcionListAdapter).items2?.get(
110   - viewHolder.layoutPosition)!!.balanza==7)
111   - mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER
112   -
  110 + if ((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 1 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 3 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 7)
  111 + mDialogView.etCantidad.inputType = InputType.TYPE_CLASS_NUMBER
113 112  
114 113 mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}"
115 114 val mAlertDialog = mBuilder.show()
  115 +
116 116 mDialogView.etCantidad.requestFocus()
117 117 mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
118 118 mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
  119 +
119 120 mDialogView.btnAceptar.setOnClickListener {
120 121 if (mDialogView.etCantidad.text.isNullOrEmpty()) {
121 122 mDialogView.etCantidad.error = "No vacio"
122 123 mDialogView.etCantidad.requestFocus()
123 124 mDialogView.etCantidad.hint = "Ingrese un valor"
124 125 } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) {
125   - cantidad =String.format("%.2f", mDialogView.etCantidad.text.toString().toFloat()).toFloat()
126   - val body = InvBody(numeroInventario,
  126 + cantidad = String.format("%.2f", mDialogView.etCantidad.text.toString().toFloat()).toFloat()
  127 + val body = InvBody(
  128 + numeroInventario,
127 129 (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector,
128 130 // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD
129 131 (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo,
... ... @@ -136,7 +138,8 @@ class DescripcionFragment : Fragment() {
136 138 (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza,
137 139 (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn,
138 140 InventarioFragment().ObtenerFechaActual(),
139   - InventarioFragment().ObtenerFechaActual())
  141 + InventarioFragment().ObtenerFechaActual()
  142 + )
140 143 InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS
141 144 modificarCantidadEnCabecera(numeroInventario, true, requireActivity())
142 145 // VolverAinventario()
... ... @@ -146,66 +149,71 @@ class DescripcionFragment : Fragment() {
146 149 }
147 150 } else if (artCargadoEnBD != null) {
148 151  
149   - val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
150   - val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false)
151   - if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER
152   - mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat())
  152 + mDialogViewM = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
  153 + val mBuilder = AlertDialog.Builder(context).setView(mDialogViewM).setCancelable(false)
  154 + if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")
  155 + ) mDialogViewM.tvNuevaCantidad.inputType = InputType.TYPE_CLASS_NUMBER
  156 + mDialogViewM.tvTitulo2.text="${artCargadoEnBD!!.descripcion}"
  157 + mDialogViewM.tvCantInicial.text = String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat())
153 158  
154 159 val mAlertDialog = mBuilder.show()
155   - mDialogView.tvNuevaCantidad.requestFocus()
  160 + mDialogViewM.tvNuevaCantidad.requestFocus()
156 161  
157 162  
158 163 mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
159 164 mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
160 165  
161   - mDialogView.rbSumar.setOnClickListener {
162   - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
163   - mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()))
164   - mDialogView.tvNuevaCantidad.isEnabled=false
  166 + mDialogViewM.tvNuevaCantidad.addTextChangedListener(textWatcher)
  167 +
  168 + mDialogViewM.rbSumar.setOnClickListener {
  169 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  170 + mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvCantInicial.text.toString().toFloat() + mDialogViewM.tvNuevaCantidad.text.toString().toFloat()))
  171 +// mDialogViewM.tvNuevaCantidad.isEnabled = false
165 172 }
166 173 }
167   - mDialogView.rbRestar.setOnClickListener {
168   - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
169   - if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) {
170   - mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat())
171   - mDialogView.tvNuevaCantidad.isEnabled = false
172   - }else{
173   - mDialogView.tvResultado.text=""
174   - mDialogView.tvResultado.error = "Operación No Valida"
175   - mDialogView.tvResultado.requestFocus()
176   - mDialogView.tvResultado.hint = "Error"
  174 + mDialogViewM.rbRestar.setOnClickListener {
  175 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  176 + if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) {
  177 + mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat())
  178 +// mDialogViewM.tvNuevaCantidad.isEnabled = false
  179 + } else {
  180 + mDialogViewM.tvResultado.text = ""
  181 + mDialogViewM.tvResultado.error = "Operación No Valida"
  182 + mDialogViewM.tvResultado.requestFocus()
  183 + mDialogViewM.tvResultado.hint = "Error"
177 184 }
178 185 }
179 186 }
180   - mDialogView.rbMdodificar.setOnClickListener {
181   - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
182   - mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat()))
183   - mDialogView.tvNuevaCantidad.isEnabled = false
  187 + mDialogViewM.rbMdodificar.setOnClickListener {
  188 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  189 + mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvNuevaCantidad.text.toString().toFloat()))
  190 +// mDialogViewM.tvNuevaCantidad.isEnabled = false
184 191 }
185 192 }
186   - mDialogView.btnAceptar.setOnClickListener {
187   - if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) {
188   - if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) {
189   -
190   - updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(),
191   - (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(),
192   - mDialogView.tvResultado.text.toString().toFloat())
193   -// VolverAinventario()
194   - activity?.onBackPressed();
195   - mAlertDialog.dismiss()
196   - } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) {
197   - mDialogView.tvResultado.error = "Operación Requerida"
198   - mDialogView.tvResultado.requestFocus()
199   - mDialogView.tvResultado.hint = "Seleccione Operación"
  193 + mDialogViewM.btnAceptar.setOnClickListener {
  194 + if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || !mDialogViewM.tvNuevaCantidad.text.isBlank()) {
  195 + if (mDialogViewM.tvResultado.text.isNotEmpty() || !mDialogViewM.tvResultado.text.isBlank()) {
  196 +
  197 + updateCantidad(
  198 + (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(),
  199 + (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(),
  200 + mDialogViewM.tvResultado.text.toString().toFloat()
  201 + )
  202 + activity?.onBackPressed()
  203 + mAlertDialog.dismiss()
  204 + } else if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) {
  205 + mDialogViewM.tvResultado.error = "Operación Requerida"
  206 + mDialogViewM.tvResultado.requestFocus()
  207 + mDialogViewM.tvResultado.hint = "Seleccione Operación"
  208 + }
  209 + } else if (mDialogViewM.tvNuevaCantidad.text.isEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) {
  210 + mDialogViewM.tvNuevaCantidad.error = "Completar"
  211 + mDialogViewM.tvNuevaCantidad.requestFocus()
  212 + mDialogViewM.tvNuevaCantidad.hint = "Ingrese un valor"
200 213 }
201   - } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) {
202   - mDialogView.tvNuevaCantidad.error = "Completar"
203   - mDialogView.tvNuevaCantidad.requestFocus()
204   - mDialogView.tvNuevaCantidad.hint = "Ingrese un valor"
205   - }
206 214 }
207   - mDialogView.dialogCancelBtn.setOnClickListener {
208   - activity?.onBackPressed();
  215 + mDialogViewM.dialogCancelBtn.setOnClickListener {
  216 + activity?.onBackPressed()
209 217 mAlertDialog.dismiss()
210 218 }
211 219 }
... ... @@ -231,7 +239,6 @@ class DescripcionFragment : Fragment() {
231 239 }
232 240 val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback)
233 241 itemTouchHelper2.attachToRecyclerView(rcDescripcion)
234   -
235 242 }
236 243  
237 244 fun InsertarArtEnDB(cuarpoInventario: InvBody) {
... ... @@ -242,20 +249,11 @@ class DescripcionFragment : Fragment() {
242 249 }
243 250 }
244 251  
245   -// fun VolverAinventario() {
246   -//
247   -// val editor = sharedPreferences.edit()
248   -// editor?.putString("Inventario", numeroInventario.toString())
249   -// editor?.apply()
250   -// editor.commit()
251   -// navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment)
252   -// }
253   -
254 252 suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? {
255 253 //TODO BUSQUEDA POR CODIGO DE BARRAS
256 254 var busqueda: InvBody? = null
257 255 return GlobalScope.async(Dispatchers.IO) {
258   - busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario)
  256 + busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector.toLong(), codigo.toLong(), numInventario.toLong())
259 257 return@async busqueda
260 258 }.await()
261 259 }
... ... @@ -265,7 +263,41 @@ class DescripcionFragment : Fragment() {
265 263 withContext(Dispatchers.IO) {
266 264 val activity: FragmentActivity? = activity
267 265 if (activity != null && isAdded) {
268   - AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo)
  266 + AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector.toLong(), codigo.toLong())
  267 + }
  268 + }
  269 + }
  270 + }
  271 +
  272 + private val textWatcher = object : TextWatcher {
  273 + override fun afterTextChanged(s: Editable?) {
  274 + }
  275 +
  276 + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
  277 + }
  278 +
  279 + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
  280 + if (mDialogViewM.rbSumar.isChecked) {
  281 +// mDialogView.tvNuevaCantidad.isEnabled=false
  282 + mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat() + mDialogViewM.tvCantInicial.text.toString().toFloat())
  283 + }
  284 + if (mDialogViewM.rbRestar.isChecked) {
  285 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  286 + if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) {
  287 + mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat())
  288 +// mDialogView.tvNuevaCantidad.isEnabled = false
  289 + } else {
  290 + mDialogViewM.tvResultado.text = ""
  291 + mDialogViewM.tvResultado.error = "Operación No Valida"
  292 + mDialogViewM.tvResultado.requestFocus()
  293 + mDialogViewM.tvResultado.hint = "Error"
  294 + }
  295 + }
  296 + }
  297 + if (mDialogViewM.rbMdodificar.isChecked) {
  298 + if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) {
  299 + mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat())
  300 +// mDialogView.tvNuevaCantidad.isEnabled = false
269 301 }
270 302 }
271 303 }
app/src/main/java/com/focasoftware/deboinventariov20/UI/inventario/InventarioFragment.kt
... ... @@ -2,6 +2,7 @@ package com.focasoftware.deboinventariov20.UI.inventario
2 2  
3 3 import android.annotation.SuppressLint
4 4 import android.app.AlertDialog
  5 +import android.app.Dialog
5 6 import android.content.Context
6 7 import android.content.Context.INPUT_METHOD_SERVICE
7 8 import android.content.DialogInterface
... ... @@ -10,7 +11,9 @@ import android.graphics.Canvas
10 11 import android.graphics.Color
11 12 import android.graphics.drawable.Drawable
12 13 import android.os.Bundle
  14 +import android.text.Editable
13 15 import android.text.InputType.TYPE_CLASS_NUMBER
  16 +import android.text.TextWatcher
14 17 import android.view.*
15 18 import android.view.inputmethod.InputMethodManager
16 19 import android.widget.EditText
... ... @@ -59,6 +62,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
59 62 private var fCant = 0F
60 63 private var bFirst = false
61 64 private lateinit var deleteIcon: Drawable
  65 + lateinit var mDialogView: View
62 66  
63 67 @SuppressLint("MissingPermission")
64 68 override fun onCreate(savedInstanceState: Bundle?) {
... ... @@ -365,8 +369,8 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
365 369 private fun BorrarInvActual() {
366 370 lifecycleScope.launch {
367 371 withContext(Dispatchers.IO) {
368   - AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo)
369   - AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo)
  372 + AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo.toLong())
  373 + AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo.toLong())
370 374 }
371 375 }
372 376 }
... ... @@ -524,11 +528,11 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
524 528 if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER
525 529 mDialogView.tvTitulo.text = artAcargar.descripcion.toString()
526 530 val mAlertDialog = mBuilder.show()
  531 +
527 532 mDialogView.etCantidad.requestFocus()
528 533 mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
529 534 mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
530 535  
531   -
532 536 mDialogView.btnAceptar.setOnClickListener {
533 537 if (mDialogView.etCantidad.text.isNullOrEmpty()) {
534 538 mDialogView.etCantidad.error = "No vacio"
... ... @@ -546,11 +550,12 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
546 550 }
547 551  
548 552 fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) {
549   - val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
550   - val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[indiceDelArtEncontrado].descripcion} se encuentra cargado.").setCancelable(cancelable)
  553 +
  554 + mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
  555 + val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(cancelable)
551 556 // TODO: SI PERMITE QUE INGRESE DECIMALES
552 557 if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER
553   -
  558 + mDialogView.tvTitulo2.text="${listArticulos[indiceDelArtEncontrado].descripcion}"
554 559 mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada)
555 560 val mAlertDialog = mBuilder.show()
556 561 mDialogView.tvNuevaCantidad.requestFocus()
... ... @@ -560,17 +565,19 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
560 565 mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
561 566 mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
562 567  
  568 + mDialogView.tvNuevaCantidad.addTextChangedListener(textWatcher)
  569 +
563 570 mDialogView.rbSumar.setOnClickListener {
564 571 if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
565 572 mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat())
566   - mDialogView.tvNuevaCantidad.isEnabled = false
  573 +// mDialogView.tvNuevaCantidad.isEnabled = false
567 574 }
568 575 }
569 576 mDialogView.rbRestar.setOnClickListener {
570 577 if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
571 578 if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) {
572 579 mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat())
573   - mDialogView.tvNuevaCantidad.isEnabled = false
  580 +// mDialogView.tvNuevaCantidad.isEnabled = false
574 581 } else {
575 582 mDialogView.tvResultado.text = ""
576 583 mDialogView.tvResultado.error = "Operación No Valida"
... ... @@ -582,7 +589,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
582 589 mDialogView.rbMdodificar.setOnClickListener {
583 590 if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
584 591 mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat())
585   - mDialogView.tvNuevaCantidad.isEnabled = false
  592 +// mDialogView.tvNuevaCantidad.isEnabled = false
586 593 }
587 594 }
588 595 mDialogView.btnAceptar.setOnClickListener {
... ... @@ -642,7 +649,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
642 649 //TODO BUSQUEDA POR DESCRIPCION
643 650 var result: Int
644 651 return GlobalScope.async(IO) {
645   - result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo, inventario)
  652 + result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector.toLong(), codigo.toLong(), inventario.toLong())
646 653 return@async result
647 654 }.await()
648 655 }
... ... @@ -689,7 +696,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
689 696 //TODO BUSQUEDA POR DESCRIPCION
690 697 var busqueda: Articles? = null
691 698 return GlobalScope.async(IO) {
692   - busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchArea())
  699 + busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchAreaInventario())
693 700 return@async busqueda
694 701 }.await()
695 702 }
... ... @@ -780,12 +787,14 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
780 787 if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = true
781 788 return iArea
782 789 }
  790 +
783 791 suspend fun SerchAreaInventario(): Boolean {
784 792 return GlobalScope.async(IO) {
785   - return@async AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.fetchAreaInvH(InventarioNuevo)
  793 + return@async AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.fetchAreaInvH(InventarioNuevo.toLong())
786 794 }.await()
787 795  
788 796 }
  797 +
789 798 fun ObtenerFechaActual(): String? {
790 799 //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD
791 800 val current = LocalDateTime.now()
... ... @@ -805,7 +814,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
805 814 fun updateCantidad(sector: String, codigo: String, cantidad: Float) {
806 815 lifecycleScope.launch {
807 816 withContext(Dispatchers.IO) {
808   - AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo)
  817 + AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector.toLong(), codigo.toLong())
809 818 }
810 819 }
811 820 }
... ... @@ -827,6 +836,41 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
827 836 override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) {
828 837 dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true)
829 838 }
  839 +
  840 + private val textWatcher = object : TextWatcher {
  841 + override fun afterTextChanged(s: Editable?) {
  842 + }
  843 +
  844 + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
  845 + }
  846 +
  847 + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
  848 + if(mDialogView.rbSumar.isChecked){
  849 +// mDialogView.tvNuevaCantidad.isEnabled=false
  850 + mDialogView.tvResultado.text=String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()+ mDialogView.tvCantInicial.text.toString().toFloat())
  851 + }
  852 + if(mDialogView.rbRestar.isChecked) {
  853 + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
  854 + if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) {
  855 + mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat())
  856 +// mDialogView.tvNuevaCantidad.isEnabled = false
  857 + } else {
  858 + mDialogView.tvResultado.text = ""
  859 + mDialogView.tvResultado.error = "Operación No Valida"
  860 + mDialogView.tvResultado.requestFocus()
  861 + mDialogView.tvResultado.hint = "Error"
  862 + }
  863 + }
  864 + }
  865 + if(mDialogView.rbMdodificar.isChecked) {
  866 + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
  867 + mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat())
  868 +// mDialogView.tvNuevaCantidad.isEnabled = false
  869 + }
  870 + }
  871 +
  872 + }
  873 + }
830 874 }
831 875  
832 876  
app/src/main/java/com/focasoftware/deboinventariov20/UI/main/InventarioListAdapter.kt
... ... @@ -15,11 +15,8 @@ import java.util.*
15 15 import kotlin.collections.ArrayList
16 16  
17 17 class InventarioListAdapter(private val context: Context, private val inv: List<InvHead>, private val itemClickListener: OnInventarioClickListener) :
18   - RecyclerView.Adapter<BaseViewHolder<*>>(), Filterable {
19   - var invFiltrados: List<InvHead>
20   - init {
21   - invFiltrados=inv
22   - }
  18 + RecyclerView.Adapter<BaseViewHolder<*>>() {
  19 +
23 20 interface OnInventarioClickListener {
24 21 fun onItemClick(inventario: String?)
25 22 }
... ... @@ -46,34 +43,4 @@ class InventarioListAdapter(private val context: Context, private val inv: List&lt;
46 43 else -> IllegalArgumentException("No se pudo pasar el ViewHolder")
47 44 }
48 45 }
49   -
50   - override fun getFilter(): Filter {
51   - return object : Filter() {
52   - override fun performFiltering(charSequence: CharSequence): FilterResults {
53   - val charString = charSequence.toString()
54   -
55   - invFiltrados = if (charString.isEmpty()) {
56   - inv
57   - } else {
58   - val filteredList = ArrayList<InvHead>()
59   -
60   - for (row in inv) {
61   - if (row.lugar.toString().contains(charString.toLowerCase(Locale.ROOT))) {
62   - filteredList.add(row)
63   - }
64   -
65   - }
66   - filteredList
67   - }
68   - val filterResults = FilterResults()
69   - filterResults.values=invFiltrados
70   - return filterResults
71   - }
72   -
73   - override fun publishResults(charSequence: CharSequence?, filterResults: FilterResults?) {
74   - invFiltrados = filterResults!!.values as ArrayList<InvHead>
75   - notifyDataSetChanged()
76   - }
77   - }
78   - }
79 46 }
80 47 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/UI/main/MainFragment.kt
... ... @@ -21,6 +21,7 @@ import kotlinx.coroutines.Dispatchers
21 21 import kotlinx.coroutines.GlobalScope
22 22 import kotlinx.coroutines.async
23 23 import kotlinx.coroutines.launch
  24 +import java.time.LocalDateTime
24 25 import java.util.*
25 26  
26 27 class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener {
... ... @@ -37,6 +38,7 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener
37 38 override fun onCreate(savedInstanceState: Bundle?) {
38 39 super.onCreate(savedInstanceState)
39 40 sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE)
  41 +
40 42 }
41 43  
42 44 override fun onCreateView(
... ... @@ -98,10 +100,15 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener
98 100 "Inventarios Dinamicos ($cantidadInventarios) +"
99 101 }
100 102 }
  103 + ordenado = inventarios.sortedBy {
  104 + it.invNum
  105 + }
101 106 ivSort19.setOnClickListener {
102 107 ordenado = inventarios.sortedByDescending {
103 108 it.invNum
104 109 }
  110 + cbDeposito.isChecked=true
  111 + cbVentas.isChecked=true
105 112 viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment)
106 113 viewManager = LinearLayoutManager(requireContext())
107 114  
... ... @@ -117,6 +124,8 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener
117 124 ordenado = inventarios.sortedBy {
118 125 it.invNum
119 126 }
  127 + cbDeposito.isChecked=true
  128 + cbVentas.isChecked=true
120 129 viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment)
121 130 viewManager = LinearLayoutManager(requireContext())
122 131  
... ... @@ -131,17 +140,42 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener
131 140 }
132 141  
133 142 cbVentas.setOnClickListener {
134   - if (cbVentas.isChecked) {
  143 + if (!cbVentas.isChecked) {
  144 + cbDeposito.isChecked=true
  145 + listIvn2.clear()
  146 + ordenado.forEach {
  147 + if (it.lugar==true) {
  148 + listIvn2.add(it)
  149 + }
  150 + }
  151 + } else {
  152 + listIvn2.clear()
  153 + listIvn2.addAll(ordenado)
  154 + }
  155 + viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this@MainFragment)
  156 + viewManager = LinearLayoutManager(requireContext())
  157 + rcInventario.apply {
  158 + adapter = viewAdapter
  159 + layoutManager = viewManager
  160 + }
  161 + viewAdapter.notifyDataSetChanged()
  162 + }
  163 +
  164 + cbDeposito.setOnClickListener {
  165 + if (!cbDeposito.isChecked) {
  166 + cbVentas.isChecked=true
135 167 listIvn2.clear()
136   - inventarios.forEach {
  168 + ordenado.forEach {
137 169 if (it.lugar==false) {
138 170 listIvn2.add(it)
139 171 }
140 172 }
141 173 } else {
142 174 listIvn2.clear()
143   - listIvn2.addAll(inventarios)
  175 + listIvn2.addAll(ordenado)
144 176 }
  177 + viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this@MainFragment)
  178 + viewManager = LinearLayoutManager(requireContext())
145 179 rcInventario.apply {
146 180 adapter = viewAdapter
147 181 layoutManager = viewManager
app/src/main/res/drawable/logo_splash.jpeg

14.3 KB

app/src/main/res/drawable/suitedebo.png

6.74 KB

app/src/main/res/layout-land/fragment_servidores.xml
... ... @@ -79,32 +79,16 @@
79 79 android:id="@+id/etDireccionServidor"
80 80 android:layout_width="130dp"
81 81 android:layout_height="wrap_content"
82   -
83 82 android:clickable="true"
84 83 android:ems="10"
85 84 android:focusable="true"
86 85 android:hint="192.168.100.100"
87   - android:inputType="text"
  86 + android:inputType="phone"
88 87 android:lines="1"
89 88 android:textSize="15sp"
90 89 app:layout_constraintBaseline_toBaselineOf="@+id/tvDirServer"
91 90 app:layout_constraintStart_toEndOf="@+id/tvDirServer" />
92 91  
93   - <TextView
94   - android:id="@+id/tvPuerto"
95   - android:layout_width="wrap_content"
96   - android:layout_height="wrap_content"
97   - android:layout_marginStart="10dp"
98   - android:layout_marginTop="10dp"
99   - android:gravity="start"
100   - android:lines="1"
101   - android:text="Puerto:"
102   - android:textColor="@android:color/black"
103   - android:textSize="@dimen/SubTitulos"
104   - android:textStyle="bold|italic"
105   - app:fontFamily="sans-serif-condensed"
106   - app:layout_constraintStart_toEndOf="@+id/etDireccionServidor"
107   - app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" />
108 92  
109 93 <EditText
110 94 android:id="@+id/etPuerto"
... ... @@ -113,12 +97,12 @@
113 97 android:clickable="true"
114 98 android:ems="10"
115 99 android:focusable="true"
116   - android:hint="9999"
117   - android:inputType="text"
  100 + android:hint="Puerto"
  101 + android:inputType="number"
118 102 android:lines="1"
119 103 android:textSize="15sp"
120   - app:layout_constraintBaseline_toBaselineOf="@+id/tvPuerto"
121   - app:layout_constraintStart_toEndOf="@+id/tvPuerto"
  104 + app:layout_constraintBaseline_toBaselineOf="@+id/etDireccionServidor"
  105 + app:layout_constraintStart_toEndOf="@+id/etDireccionServidor"
122 106 android:autofillHints="" />
123 107  
124 108  
app/src/main/res/layout/activity_splash.xml
... ... @@ -4,6 +4,8 @@
4 4 xmlns:tools="http://schemas.android.com/tools"
5 5 android:layout_width="match_parent"
6 6 android:layout_height="match_parent"
  7 + android:background="#E6E6E6"
  8 +
7 9 tools:context=".UI.SplashActivity">
8 10  
9 11  
... ... @@ -30,33 +32,18 @@
30 32 android:id="@+id/imageView"
31 33 android:layout_width="wrap_content"
32 34 android:layout_height="wrap_content"
  35 +
33 36 android:contentDescription="@string/todo"
34   - android:src="@drawable/ic_launcher_background"
35   - app:layout_constraintBottom_toTopOf="@id/textView3"
  37 + android:src="@drawable/logo_splash"
  38 + app:layout_constraintBottom_toTopOf="@id/textView4"
36 39 app:layout_constraintEnd_toEndOf="parent"
37 40 app:layout_constraintStart_toStartOf="parent"
38 41 app:layout_constraintTop_toBottomOf="@+id/textView2"
39   - app:srcCompat="@drawable/suitedebo" />
  42 + />
  43 +
  44 +
40 45  
41 46  
42   - <TextView
43   - android:id="@+id/textView3"
44   - android:layout_width="match_parent"
45   - android:layout_height="100dp"
46   - android:layout_margin="20dp"
47   - android:autoSizeMaxTextSize="1000sp"
48   - android:autoSizeMinTextSize="30sp"
49   - android:autoSizeStepGranularity="5sp"
50   - android:autoSizeTextType="uniform"
51   - android:gravity="center"
52   - android:lines="1"
53   - android:text="@string/debo"
54   - android:textColor="@color/colorAccent"
55   - app:fontFamily="sans-serif-condensed"
56   - app:layout_constraintBottom_toTopOf="@+id/textView4"
57   - app:layout_constraintEnd_toEndOf="parent"
58   - app:layout_constraintStart_toStartOf="parent"
59   - app:layout_constraintTop_toBottomOf="@+id/imageView" />
60 47  
61 48 <androidx.appcompat.widget.AppCompatTextView
62 49 android:id="@+id/textView4"
... ... @@ -75,5 +62,5 @@
75 62 app:layout_constraintBottom_toBottomOf="parent"
76 63 app:layout_constraintEnd_toEndOf="parent"
77 64 app:layout_constraintEnd_toStartOf="parent"
78   - app:layout_constraintTop_toBottomOf="@id/textView3" />
  65 + app:layout_constraintTop_toBottomOf="@id/imageView" />
79 66 </androidx.constraintlayout.widget.ConstraintLayout>
80 67 \ No newline at end of file
app/src/main/res/layout/fragment_actua_maestros.xml
... ... @@ -72,6 +72,19 @@
72 72  
73 73 </RadioGroup>
74 74  
  75 + <TextView
  76 + android:id="@+id/tvServerConectado"
  77 + android:layout_width="match_parent"
  78 + android:layout_height="wrap_content"
  79 + android:layout_margin="30dp"
  80 + android:gravity="center"
  81 + android:lines="2"
  82 + android:text=""
  83 + android:textColor="@android:color/black"
  84 + android:textSize="@dimen/SubTitulos"
  85 + app:fontFamily="sans-serif-condensed"
  86 + app:layout_constraintBottom_toTopOf="@+id/countriesList"
  87 + app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" />
75 88  
76 89 <TextView
77 90 android:id="@+id/countriesList"
... ... @@ -89,7 +102,7 @@
89 102 app:layout_constraintHorizontal_bias="0.0"
90 103 app:layout_constraintStart_toStartOf="parent"
91 104 app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion"
92   - app:layout_constraintVertical_bias="0.0" />
  105 + app:layout_constraintVertical_bias="0.106" />
93 106  
94 107 <Button
95 108 android:id="@+id/btnConfirmarAct"
app/src/main/res/layout/fragment_configuracion.xml
... ... @@ -94,7 +94,7 @@
94 94 android:id="@+id/tvUbicacionCarpetas"
95 95 android:layout_width="0dp"
96 96 android:layout_height="wrap_content"
97   -
  97 +android:visibility="gone"
98 98 android:layout_marginStart="@dimen/MarginBotAgreSer"
99 99 android:layout_marginTop="@dimen/MarginTopSubTitulos"
100 100 android:gravity="start"
... ... @@ -116,6 +116,7 @@
116 116 android:src="@drawable/search"
117 117 android:textColor="@android:color/white"
118 118 android:padding="10dp"
  119 + android:visibility="gone"
119 120 android:background="@drawable/boton_borde_redondeado"
120 121 app:layout_constraintEnd_toStartOf="@+id/etRuta"
121 122 app:layout_constraintStart_toStartOf="parent"
... ... @@ -130,6 +131,7 @@
130 131 android:clickable="true"
131 132 android:ems="10"
132 133 android:focusable="true"
  134 + android:visibility="gone"
133 135 android:inputType="textPersonName"
134 136 android:lines="1"
135 137 android:text=""
app/src/main/res/layout/fragment_detalle_art.xml
... ... @@ -13,8 +13,8 @@
13 13 android:layout_marginTop="5dp"
14 14 android:layout_marginEnd="5dp"
15 15 app:cardBackgroundColor="@android:color/darker_gray"
16   - app:cardCornerRadius="4dp"
17   - app:cardElevation="4dp"
  16 + app:cardCornerRadius="25dp"
  17 + app:cardElevation="10dp"
18 18 app:layout_constraintEnd_toEndOf="parent"
19 19 app:layout_constraintStart_toStartOf="parent"
20 20 app:layout_constraintTop_toTopOf="parent">
... ... @@ -29,7 +29,8 @@
29 29 android:layout_width="0dp"
30 30 android:layout_height="wrap_content"
31 31 android:layout_marginTop="15dp"
32   - android:gravity="center"
  32 + android:gravity="center_horizontal"
  33 + android:orientation="horizontal"
33 34 android:text="Detalle del artículo"
34 35 android:textAppearance="@style/TextAppearance.AppCompat.Large"
35 36 android:textSize="@dimen/Titulos"
... ... @@ -39,243 +40,250 @@
39 40 app:layout_constraintTop_toTopOf="parent" />
40 41  
41 42 <TextView
42   - android:id="@+id/textView19"
  43 + android:id="@+id/textView6"
43 44 android:layout_width="wrap_content"
44 45 android:layout_height="wrap_content"
45 46 android:layout_marginStart="5dp"
46 47 android:layout_marginTop="10dp"
47   - android:text="Sector:"
  48 + android:text="Descripción:"
48 49 android:textAppearance="@style/TextAppearance.AppCompat.Large"
49   - android:textSize="15sp"
50   - app:layout_constraintEnd_toStartOf="@id/tvSector"
  50 + android:textSize="14sp"
  51 + app:layout_constraintEnd_toStartOf="@id/tvDescripcion"
51 52 app:layout_constraintStart_toStartOf="parent"
52 53 app:layout_constraintTop_toBottomOf="@+id/tvTime" />
53 54  
54 55 <TextView
55   - android:id="@+id/tvSector"
  56 + android:id="@+id/tvDescripcion"
56 57 android:layout_width="0dp"
57 58 android:layout_height="wrap_content"
  59 + android:layout_marginStart="5dp"
  60 + android:layout_marginTop="10dp"
  61 + android:lines="2"
58 62 android:text=""
59 63 android:textAppearance="@style/TextAppearance.AppCompat.Large"
60 64 android:textSize="18sp"
61   - app:layout_constraintBaseline_toBaselineOf="@+id/textView19"
62   - app:layout_constraintEnd_toStartOf="@id/textView18"
63   - app:layout_constraintStart_toEndOf="@id/textView19" />
  65 + android:textStyle="bold"
  66 + app:layout_constraintBaseline_toBaselineOf="@+id/textView6"
  67 + app:layout_constraintEnd_toEndOf="parent"
  68 + app:layout_constraintStart_toEndOf="@+id/textView6" />
  69 +
64 70  
65 71 <TextView
66 72 android:id="@+id/textView18"
67 73 android:layout_width="wrap_content"
68 74 android:layout_height="wrap_content"
  75 + android:layout_marginStart="5dp"
69 76 android:layout_marginTop="10dp"
70 77 android:text="Código:"
71 78 android:textAppearance="@style/TextAppearance.AppCompat.Large"
72 79 android:textSize="15sp"
73   - app:layout_constraintEnd_toStartOf="@id/tvCodigo"
74   - app:layout_constraintStart_toEndOf="@id/tvSector"
75   - app:layout_constraintTop_toBottomOf="@+id/tvTime" />
  80 + app:layout_constraintStart_toStartOf="parent"
  81 + app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" />
76 82  
77 83 <TextView
78   - android:id="@+id/tvCodigo"
  84 + android:id="@+id/tvSector"
79 85 android:layout_width="0dp"
80 86 android:layout_height="wrap_content"
81   - android:text=""
  87 + android:layout_marginStart="5dp"
  88 + android:layout_marginTop="10dp"
  89 + android:text="99"
82 90 android:textAppearance="@style/TextAppearance.AppCompat.Large"
83 91 android:textSize="18sp"
  92 + android:textStyle="bold"
84 93 app:layout_constraintBaseline_toBaselineOf="@+id/textView18"
85   - app:layout_constraintEnd_toStartOf="@+id/textView3"
86   - app:layout_constraintStart_toEndOf="@id/textView18" />
  94 + app:layout_constraintStart_toEndOf="@+id/textView18" />
87 95  
88 96 <TextView
89   - android:id="@+id/textView3"
90   - android:layout_width="wrap_content"
91   - android:layout_height="wrap_content"
92   - android:layout_marginTop="10dp"
93   - android:text="Depósito:"
94   - android:textAppearance="@style/TextAppearance.AppCompat.Large"
95   - android:textSize="15sp"
96   - app:layout_constraintEnd_toStartOf="@id/tvDeposito"
97   - app:layout_constraintStart_toEndOf="@id/tvCodigo"
98   - app:layout_constraintTop_toBottomOf="@+id/tvTime" />
99   -
100   - <TextView
101   - android:id="@+id/tvDeposito"
  97 + android:id="@+id/tvCodigo"
102 98 android:layout_width="0dp"
103 99 android:layout_height="wrap_content"
104   - android:text=""
  100 + android:layout_marginStart="5dp"
  101 + android:layout_marginTop="10dp"
  102 + android:text="99999"
105 103 android:textAppearance="@style/TextAppearance.AppCompat.Large"
106 104 android:textSize="18sp"
107   - app:layout_constraintBaseline_toBaselineOf="@+id/textView3"
108   - app:layout_constraintEnd_toEndOf="parent"
109   - app:layout_constraintStart_toEndOf="@id/textView3" />
  105 + android:textStyle="bold"
  106 + app:layout_constraintBaseline_toBaselineOf="@+id/tvSector"
  107 + app:layout_constraintStart_toEndOf="@id/tvSector" />
  108 +
110 109  
111 110 <TextView
112   - android:id="@+id/textView6"
113   - android:layout_width="wrap_content"
  111 + android:id="@+id/textView1"
  112 + android:layout_width="0dp"
114 113 android:layout_height="wrap_content"
115 114 android:layout_marginStart="5dp"
116 115 android:layout_marginTop="10dp"
117   - android:text="Descripción:"
  116 + android:text="Código barras:"
118 117 android:textAppearance="@style/TextAppearance.AppCompat.Large"
119   - android:textSize="14sp"
120   - app:layout_constraintEnd_toStartOf="@id/tvDescripcion"
121   - app:layout_constraintStart_toStartOf="parent"
122   - app:layout_constraintTop_toBottomOf="@+id/tvCodigo" />
  118 + android:textSize="15sp"
  119 + app:layout_constraintBaseline_toBaselineOf="@+id/tvCodigo"
  120 + app:layout_constraintStart_toEndOf="@+id/tvCodigo" />
123 121  
124 122 <TextView
125   - android:id="@+id/tvDescripcion"
126   - android:layout_width="0dp"
  123 + android:id="@+id/tvCodigoBarras"
  124 + android:layout_width="wrap_content"
127 125 android:layout_height="wrap_content"
128 126 android:layout_marginStart="5dp"
129   - android:layout_marginTop="10dp"
130   - android:lines="2"
131   - android:text=""
  127 + android:text="1234567890123"
132 128 android:textAppearance="@style/TextAppearance.AppCompat.Large"
133 129 android:textSize="18sp"
134   - app:layout_constraintEnd_toEndOf="parent"
135   - app:layout_constraintStart_toEndOf="@+id/textView6"
136   - app:layout_constraintTop_toBottomOf="@+id/tvCodigo" />
  130 + android:textStyle="bold"
  131 + app:layout_constraintBaseline_toBaselineOf="@+id/textView1"
  132 + app:layout_constraintStart_toEndOf="@id/textView1" />
137 133  
138 134 <TextView
139   - android:id="@+id/textView1"
  135 + android:id="@+id/textView2"
140 136 android:layout_width="wrap_content"
141 137 android:layout_height="wrap_content"
142 138 android:layout_marginStart="5dp"
143 139 android:layout_marginTop="10dp"
144   - android:text="C. de barras:"
  140 + android:text="Código origen:"
145 141 android:textAppearance="@style/TextAppearance.AppCompat.Large"
146 142 android:textSize="15sp"
147   - app:layout_constraintEnd_toStartOf="@id/tvCodigoBarras"
148 143 app:layout_constraintStart_toStartOf="parent"
149   - app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" />
  144 + app:layout_constraintTop_toBottomOf="@+id/textView18" />
  145 +
150 146  
151 147 <TextView
152   - android:id="@+id/tvCodigoBarras"
153   - android:layout_width="0dp"
  148 + android:id="@+id/tvCodigoOrigen"
  149 + android:layout_width="wrap_content"
154 150 android:layout_height="wrap_content"
155   - android:text=""
  151 + android:layout_marginStart="5dp"
  152 + android:layout_marginTop="10dp"
  153 + android:text="9999999999"
156 154 android:textAppearance="@style/TextAppearance.AppCompat.Large"
157 155 android:textSize="18sp"
158   - app:layout_constraintBaseline_toBaselineOf="@+id/textView1"
159   - app:layout_constraintEnd_toStartOf="@id/textView2"
160   - app:layout_constraintStart_toEndOf="@id/textView1" />
  156 + android:textStyle="bold"
  157 + app:layout_constraintBaseline_toBaselineOf="@+id/textView2"
  158 + app:layout_constraintStart_toEndOf="@+id/textView2"
  159 + app:layout_constraintTop_toBottomOf="@+id/textView18" />
161 160  
162 161 <TextView
163   - android:id="@+id/textView2"
  162 + android:id="@+id/textView3"
164 163 android:layout_width="wrap_content"
165 164 android:layout_height="wrap_content"
  165 + android:layout_marginStart="5dp"
166 166 android:layout_marginTop="10dp"
167   - android:text="C. origen:"
  167 + android:text="Depósito:"
168 168 android:textAppearance="@style/TextAppearance.AppCompat.Large"
169 169 android:textSize="15sp"
170   - app:layout_constraintEnd_toStartOf="@id/tvCodigoOrigen"
171   - app:layout_constraintStart_toEndOf="@id/tvCodigoBarras"
172   - app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" />
  170 + app:layout_constraintStart_toEndOf="@+id/tvCodigoOrigen"
  171 + app:layout_constraintTop_toBottomOf="@+id/textView1" />
173 172  
174 173 <TextView
175   - android:id="@+id/tvCodigoOrigen"
176   - android:layout_width="0dp"
  174 + android:id="@+id/tvDeposito"
  175 + android:layout_width="wrap_content"
177 176 android:layout_height="wrap_content"
178   - android:text=""
  177 + android:layout_marginStart="5dp"
  178 + android:text="SI"
179 179 android:textAppearance="@style/TextAppearance.AppCompat.Large"
180 180 android:textSize="18sp"
181   - app:layout_constraintBaseline_toBaselineOf="@+id/textView2"
182   - app:layout_constraintEnd_toEndOf="parent"
183   - app:layout_constraintStart_toEndOf="@id/textView2" />
184   -
  181 + android:textStyle="bold"
  182 + app:layout_constraintBaseline_toBaselineOf="@+id/textView3"
  183 + app:layout_constraintStart_toEndOf="@+id/textView3" />
185 184  
186 185 <TextView
187   - android:id="@+id/textView5"
  186 + android:id="@+id/textView9"
188 187 android:layout_width="wrap_content"
189 188 android:layout_height="wrap_content"
190 189 android:layout_marginStart="5dp"
191 190 android:layout_marginTop="10dp"
192   - android:text="Exi.venta:"
  191 + android:text="Precio:"
193 192 android:textAppearance="@style/TextAppearance.AppCompat.Large"
194 193 android:textSize="15sp"
195   - app:layout_constraintEnd_toStartOf="@id/tvExiVenta"
196 194 app:layout_constraintStart_toStartOf="parent"
197   - app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" />
  195 + app:layout_constraintTop_toBottomOf="@+id/textView2" />
198 196  
199 197 <TextView
200   - android:id="@+id/tvExiVenta"
201   - android:layout_width="0dp"
  198 + android:id="@+id/tvPrecio"
  199 + android:layout_width="wrap_content"
202 200 android:layout_height="wrap_content"
203   - android:text=""
  201 + android:layout_marginStart="5dp"
  202 + android:layout_marginTop="10dp"
  203 + android:text="100.99"
204 204 android:textAppearance="@style/TextAppearance.AppCompat.Large"
205 205 android:textSize="18sp"
206   - app:layout_constraintBaseline_toBaselineOf="@+id/textView5"
207   - app:layout_constraintEnd_toStartOf="@id/textView7"
208   - app:layout_constraintStart_toEndOf="@id/textView5" />
  206 + android:textStyle="bold"
  207 + app:layout_constraintBaseline_toBaselineOf="@+id/textView9"
  208 + app:layout_constraintStart_toEndOf="@+id/textView9" />
209 209  
210 210 <TextView
211   - android:id="@+id/textView7"
  211 + android:id="@+id/textView8"
212 212 android:layout_width="wrap_content"
213 213 android:layout_height="wrap_content"
  214 + android:layout_marginStart="5dp"
214 215 android:layout_marginTop="10dp"
215   - android:text="Exi.dep:"
  216 + android:text="Costo:"
216 217 android:textAppearance="@style/TextAppearance.AppCompat.Large"
217 218 android:textSize="15sp"
218   - app:layout_constraintEnd_toStartOf="@id/tvExiDeposito"
219   - app:layout_constraintStart_toEndOf="@id/tvExiVenta"
220   - app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" />
  219 + app:layout_constraintStart_toEndOf="@+id/tvPrecio"
  220 + app:layout_constraintTop_toBottomOf="@+id/tvCodigoOrigen" />
221 221  
222 222 <TextView
223   - android:id="@+id/tvExiDeposito"
224   - android:layout_width="0dp"
  223 + android:id="@+id/tvCosto"
  224 + android:layout_width="wrap_content"
225 225 android:layout_height="wrap_content"
226   - android:text=""
  226 + android:layout_marginStart="5dp"
  227 + android:layout_marginTop="10dp"
  228 + android:text="22.99"
227 229 android:textAppearance="@style/TextAppearance.AppCompat.Large"
228 230 android:textSize="18sp"
229   - app:layout_constraintBaseline_toBaselineOf="@+id/textView7"
230   - app:layout_constraintEnd_toStartOf="@+id/textView9"
231   - app:layout_constraintStart_toEndOf="@id/textView7" />
  231 + android:textStyle="bold"
  232 + app:layout_constraintBaseline_toBaselineOf="@+id/textView8"
  233 + app:layout_constraintStart_toEndOf="@+id/textView8"
  234 + app:layout_constraintTop_toBottomOf="@+id/tvDeposito" />
232 235  
233 236 <TextView
234   - android:id="@+id/textView9"
  237 + android:id="@+id/textView5"
235 238 android:layout_width="wrap_content"
236 239 android:layout_height="wrap_content"
  240 + android:layout_marginStart="5dp"
237 241 android:layout_marginTop="10dp"
238   - android:text="Precio:"
  242 + android:text="Existencia en venta:"
239 243 android:textAppearance="@style/TextAppearance.AppCompat.Large"
240 244 android:textSize="15sp"
241   - app:layout_constraintEnd_toStartOf="@id/tvPrecio"
242   - app:layout_constraintStart_toEndOf="@id/tvExiDeposito"
243   - app:layout_constraintTop_toBottomOf="@+id/textView2" />
  245 + app:layout_constraintStart_toStartOf="parent"
  246 + app:layout_constraintTop_toBottomOf="@+id/textView9" />
244 247  
245 248 <TextView
246   - android:id="@+id/tvPrecio"
247   - android:layout_width="0dp"
  249 + android:id="@+id/tvExiVenta"
  250 + android:layout_width="wrap_content"
248 251 android:layout_height="wrap_content"
249   - android:text=""
  252 + android:layout_marginStart="5dp"
  253 + android:layout_marginTop="10dp"
  254 + android:text="100"
250 255 android:textAppearance="@style/TextAppearance.AppCompat.Large"
251 256 android:textSize="18sp"
252   - app:layout_constraintBaseline_toBaselineOf="@+id/textView9"
253   - app:layout_constraintEnd_toEndOf="parent"
254   - app:layout_constraintStart_toEndOf="@id/textView9" />
  257 + android:textStyle="bold"
  258 + app:layout_constraintBaseline_toBaselineOf="@+id/textView5"
  259 + app:layout_constraintStart_toEndOf="@+id/textView5" />
  260 +
255 261 <TextView
256   - android:id="@+id/textView8"
  262 + android:id="@+id/textView7"
257 263 android:layout_width="wrap_content"
258 264 android:layout_height="wrap_content"
259 265 android:layout_marginStart="5dp"
260 266 android:layout_marginTop="10dp"
261   - android:text="Costo:"
  267 + android:text="Existencia en deposito:"
262 268 android:textAppearance="@style/TextAppearance.AppCompat.Large"
263 269 android:textSize="15sp"
264   - app:layout_constraintEnd_toStartOf="@+id/tvCosto"
265   - app:layout_constraintStart_toStartOf="parent"
266   - app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" />
  270 + app:layout_constraintStart_toEndOf="@+id/tvExiVenta"
  271 + app:layout_constraintTop_toBottomOf="@+id/textView8" />
267 272  
268 273 <TextView
269   - android:id="@+id/tvCosto"
  274 + android:id="@+id/tvExiDeposito"
270 275 android:layout_width="wrap_content"
271 276 android:layout_height="wrap_content"
272   - android:text="22.99"
  277 + android:layout_marginStart="5dp"
  278 + android:layout_marginTop="10dp"
  279 + android:text="777"
273 280 android:textAppearance="@style/TextAppearance.AppCompat.Large"
274 281 android:textSize="18sp"
275   - app:layout_constraintBaseline_toBaselineOf="@+id/textView8"
276   - app:layout_constraintEnd_toStartOf="@+id/textView10"
277   - app:layout_constraintStart_toEndOf="@+id/textView8"
278   - app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" />
  282 + android:textStyle="bold"
  283 + app:layout_constraintBaseline_toBaselineOf="@+id/textView7"
  284 + app:layout_constraintStart_toEndOf="@+id/textView7"
  285 + app:layout_constraintTop_toBottomOf="@+id/tvCosto" />
  286 +
279 287  
280 288 <TextView
281 289 android:id="@+id/textView10"
... ... @@ -283,22 +291,21 @@
283 291 android:layout_height="wrap_content"
284 292 android:layout_marginStart="5dp"
285 293 android:layout_marginTop="10dp"
286   - android:text="Unidad de Venta:"
  294 + android:text="Unidad de venta:"
287 295 android:textAppearance="@style/TextAppearance.AppCompat.Large"
288 296 android:textSize="15sp"
289   - app:layout_constraintEnd_toStartOf="@id/tvBal"
290   - app:layout_constraintStart_toEndOf="@id/tvCosto"
291   - app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" />
  297 + app:layout_constraintStart_toStartOf="parent"
  298 + app:layout_constraintTop_toBottomOf="@+id/tvExiVenta" />
292 299  
293 300 <TextView
294 301 android:id="@+id/tvBal"
295   - android:layout_width="0dp"
  302 + android:layout_width="wrap_content"
296 303 android:layout_height="wrap_content"
  304 + android:layout_marginStart="3dp"
297 305 android:text="CENT. CUBICOS"
298 306 android:textAppearance="@style/TextAppearance.AppCompat.Large"
299 307 android:textSize="18sp"
300 308 app:layout_constraintBaseline_toBaselineOf="@+id/textView10"
301   - app:layout_constraintEnd_toEndOf="parent"
302 309 app:layout_constraintStart_toEndOf="@+id/textView10" />
303 310  
304 311  
... ... @@ -307,13 +314,12 @@
307 314 android:layout_width="wrap_content"
308 315 android:layout_height="wrap_content"
309 316 android:layout_marginStart="5dp"
310   - android:layout_marginTop="8dp"
  317 + android:layout_marginTop="10dp"
311 318 android:text="Imagen:"
312 319 android:textAppearance="@style/TextAppearance.AppCompat.Large"
313 320 android:textSize="14sp"
314   - app:layout_constraintHorizontal_bias="0.47"
315 321 app:layout_constraintStart_toStartOf="parent"
316   - app:layout_constraintTop_toBottomOf="@+id/textView8" />
  322 + app:layout_constraintTop_toBottomOf="@+id/textView10" />
317 323  
318 324 <ImageView
319 325 android:id="@+id/ivImagen"
... ... @@ -324,9 +330,7 @@
324 330 android:src="@drawable/no_imagen"
325 331 android:textAppearance="@style/TextAppearance.AppCompat.Large"
326 332 android:textSize="14sp"
327   - app:layout_constraintEnd_toEndOf="parent"
328   - app:layout_constraintHorizontal_bias="0.003"
329   - app:layout_constraintStart_toEndOf="@id/textView11"
  333 + app:layout_constraintStart_toEndOf="@+id/textView6"
330 334 app:layout_constraintTop_toBottomOf="@+id/tvBal" />
331 335  
332 336 </androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/fragment_servidores.xml
... ... @@ -79,32 +79,16 @@
79 79 android:id="@+id/etDireccionServidor"
80 80 android:layout_width="130dp"
81 81 android:layout_height="wrap_content"
82   -
83 82 android:clickable="true"
84 83 android:ems="10"
85 84 android:focusable="true"
86 85 android:hint="192.168.100.100"
87   - android:inputType="text"
  86 + android:inputType="phone"
88 87 android:lines="1"
89 88 android:textSize="15sp"
90 89 app:layout_constraintBaseline_toBaselineOf="@+id/tvDirServer"
91 90 app:layout_constraintStart_toEndOf="@+id/tvDirServer" />
92 91  
93   - <TextView
94   - android:id="@+id/tvPuerto"
95   - android:layout_width="wrap_content"
96   - android:layout_height="wrap_content"
97   - android:layout_marginStart="10dp"
98   - android:layout_marginTop="10dp"
99   - android:gravity="start"
100   - android:lines="1"
101   - android:text="Puerto:"
102   - android:textColor="@android:color/black"
103   - android:textSize="@dimen/SubTitulos"
104   - android:textStyle="bold|italic"
105   - app:fontFamily="sans-serif-condensed"
106   - app:layout_constraintStart_toEndOf="@+id/etDireccionServidor"
107   - app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" />
108 92  
109 93 <EditText
110 94 android:id="@+id/etPuerto"
... ... @@ -113,12 +97,12 @@
113 97 android:clickable="true"
114 98 android:ems="10"
115 99 android:focusable="true"
116   - android:hint="9999"
117   - android:inputType="text"
  100 + android:hint="Puerto"
  101 + android:inputType="number"
118 102 android:lines="1"
119 103 android:textSize="15sp"
120   - app:layout_constraintBaseline_toBaselineOf="@+id/tvPuerto"
121   - app:layout_constraintStart_toEndOf="@+id/tvPuerto"
  104 + app:layout_constraintBaseline_toBaselineOf="@+id/etDireccionServidor"
  105 + app:layout_constraintStart_toEndOf="@+id/etDireccionServidor"
122 106 android:autofillHints="" />
123 107  
124 108  
app/src/main/res/layout/ingresar_cantidad.xml
... ... @@ -63,6 +63,7 @@
63 63 android:inputType="numberDecimal"
64 64 android:maxLength="8"
65 65 android:text=""
  66 + android:hint="Ingrese Cantidad"
66 67 android:textSize="20sp" />
67 68  
68 69  
app/src/main/res/layout/item_codigo_origen.xml
... ... @@ -75,7 +75,7 @@
75 75 android:layout_width="wrap_content"
76 76 android:layout_height="match_parent"
77 77 android:layout_marginStart="8dp"
78   - android:text="Otros Códigos:"
  78 + android:text="Código Origen:"
79 79 android:textAppearance="@style/TextAppearance.AppCompat.Large"
80 80 android:textSize="14sp"
81 81 android:textStyle="bold"
app/src/main/res/layout/item_descripcion.xml
... ... @@ -75,7 +75,7 @@
75 75 android:layout_width="wrap_content"
76 76 android:layout_height="match_parent"
77 77 android:layout_marginStart="8dp"
78   - android:text="Otros Códigos:"
  78 + android:text="Código Barras:"
79 79 android:textAppearance="@style/TextAppearance.AppCompat.Large"
80 80 android:textSize="14sp"
81 81 android:textStyle="bold"
app/src/main/res/layout/login_dialog.xml
... ... @@ -6,18 +6,43 @@
6 6 android:orientation="vertical"
7 7 android:padding="10dp">
8 8  
  9 + <LinearLayout
  10 + android:id="@+id/barraSuperior"
  11 + android:layout_width="0dp"
  12 + android:layout_height="wrap_content"
  13 + android:background="@color/colorPrimaryDark"
  14 + android:orientation="horizontal"
  15 + app:layout_constraintEnd_toEndOf="parent"
  16 + app:layout_constraintStart_toStartOf="parent"
  17 + app:layout_constraintTop_toTopOf="parent">
  18 +
  19 + <androidx.appcompat.widget.AppCompatTextView
  20 + android:id="@+id/tvTitulo2"
  21 + android:layout_width="0dp"
  22 + android:layout_height="wrap_content"
  23 + android:layout_margin="10dp"
  24 + android:layout_marginStart="5dp"
  25 + android:layout_marginTop="10dp"
  26 + android:layout_weight="1"
  27 + android:text="@string/adv"
  28 + android:background="@drawable/boton_borde_redondeado"
  29 + android:textAlignment="center"
  30 + android:textColor="@android:color/white"
  31 + android:textSize="25sp" />
  32 + </LinearLayout>
  33 +
9 34 <TextView
10 35 android:id="@+id/dialogNameEt"
11 36 android:layout_width="wrap_content"
12 37 android:layout_height="wrap_content"
13 38 android:layout_margin="5dp"
14   - android:text="Cantidad actual:"
  39 + android:text="Conteo actual :"
15 40 android:textSize="20sp"
16 41 app:layout_constraintEnd_toStartOf="@id/tvCantInicial"
17 42 app:layout_constraintHorizontal_bias="0.0"
18 43 app:layout_constraintHorizontal_chainStyle="packed"
19 44 app:layout_constraintStart_toStartOf="parent"
20   - app:layout_constraintTop_toTopOf="parent" />
  45 + app:layout_constraintTop_toBottomOf="@id/barraSuperior"/>
21 46  
22 47 <TextView
23 48 android:id="@+id/tvCantInicial"
... ... @@ -37,6 +62,7 @@
37 62 android:layout_height="wrap_content"
38 63 android:layout_margin="5dp"
39 64 android:text="Nueva cantidad:"
  65 + android:textStyle="bold"
40 66 android:textSize="20sp"
41 67 app:layout_constraintStart_toStartOf="parent"
42 68 app:layout_constraintTop_toBottomOf="@+id/tvCantInicial" />
... ... @@ -82,8 +108,7 @@
82 108 android:layout_width="wrap_content"
83 109 android:layout_height="wrap_content"
84 110 android:layout_margin="5dp"
85   - android:checked="false"
86   -
  111 + android:checked="true"
87 112 android:text="@string/rbSumar"
88 113 android:textSize="@dimen/text_size2" />
89 114  
... ... @@ -114,7 +139,8 @@
114 139 android:layout_height="wrap_content"
115 140 android:layout_margin="5dp"
116 141 android:gravity="center"
117   - android:text="@string/tvResultado"
  142 + android:text="Resultado :"
  143 + android:textStyle="bold"
118 144 android:textSize="20sp"
119 145 app:layout_constraintEnd_toEndOf="parent"
120 146 app:layout_constraintHorizontal_bias="0.0"
... ... @@ -137,6 +163,7 @@
137 163 <LinearLayout
138 164 android:layout_width="match_parent"
139 165 android:layout_height="wrap_content"
  166 + android:layout_margin="10dp"
140 167 android:gravity="center"
141 168 android:orientation="horizontal"
142 169 app:layout_constraintEnd_toEndOf="parent"
... ... @@ -146,7 +173,7 @@
146 173 <Button
147 174 android:id="@+id/btnAceptar"
148 175 style="@style/Base.Widget.AppCompat.Button.Colored"
149   - android:layout_width="wrap_content"
  176 + android:layout_width="140dp"
150 177 android:layout_height="wrap_content"
151 178 android:layout_margin="5dp"
152 179 android:background="@drawable/boton_borde_redondeado"
... ... @@ -157,7 +184,7 @@
157 184 <Button
158 185 android:id="@+id/dialogCancelBtn"
159 186 style="@style/Base.Widget.AppCompat.Button.Colored"
160   - android:layout_width="wrap_content"
  187 + android:layout_width="140dp"
161 188 android:layout_height="wrap_content"
162 189 android:layout_margin="5dp"
163 190 android:background="@drawable/boton_borde_redondeado"
app/src/main/res/navigation/mobile_navigation.xml
... ... @@ -77,14 +77,14 @@
77 77 <fragment
78 78 android:id="@+id/descripcionFragment"
79 79 android:name="com.focasoftware.deboinventariov20.UI.descripcionFragment.DescripcionFragment"
80   - android:label="Productos Encontrados">
  80 + android:label="Busqueda por Descripción">
81 81 <action
82 82 android:id="@+id/action_descripcionFragment_to_inventarioFragment"
83 83 app:destination="@id/inventarioFragment"
84   - app:popEnterAnim="@anim/slide_in_left"
85   - app:popExitAnim="@anim/slide_out_right"
86 84 app:enterAnim="@anim/slide_in_right"
87   - app:exitAnim="@anim/slide_out_left" />
  85 + app:exitAnim="@anim/slide_out_left"
  86 + app:popEnterAnim="@anim/slide_in_left"
  87 + app:popExitAnim="@anim/slide_out_right" />
88 88 </fragment>
89 89  
90 90 <fragment
... ... @@ -129,7 +129,7 @@
129 129 <fragment
130 130 android:id="@+id/codigoOriFragment"
131 131 android:name="com.focasoftware.deboinventariov20.UI.descripCorigenFragment.CodigoOriFragment"
132   - android:label="CodigoOriFragment" >
  132 + android:label="Busqueda por Código de Origen">
133 133 <action
134 134 android:id="@+id/action_codigoOriFragment_to_inventarioFragment"
135 135 app:destination="@id/inventarioFragment" />