Commit c1c9b23894b1638b33e222f229a8e2d5f8366689

Authored by Mauricio Sanchez
1 parent ea6d4ed726
Exists in master

06092020 2207

Showing 24 changed files with 534 additions and 457 deletions   Show diff stats
1 1 apply plugin: 'com.android.application'
2 2 apply plugin: 'kotlin-android'
3 3 apply plugin: 'kotlin-android-extensions'
4   -apply plugin: 'kotlin-kapt'
  4 +
5 5  
6 6 android {
7 7 compileSdkVersion 30
... ... @@ -44,7 +44,7 @@ dependencies {
44 44 implementation 'androidx.appcompat:appcompat:1.2.0'
45 45 implementation 'androidx.legacy:legacy-support-v4:1.0.0'
46 46 implementation 'com.google.android.material:material:1.2.0'
47   - implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
  47 + implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
48 48 implementation 'androidx.navigation:navigation-fragment:2.3.0'
49 49 implementation 'androidx.navigation:navigation-ui:2.3.0'
50 50 implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
... ... @@ -52,14 +52,14 @@ dependencies {
52 52 implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
53 53 implementation 'androidx.recyclerview:recyclerview:1.1.0'
54 54 testImplementation 'junit:junit:4.13'
55   - androidTestImplementation 'androidx.test.ext:junit:1.1.1'
56   - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
  55 + androidTestImplementation 'androidx.test.ext:junit:1.1.2'
  56 + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
57 57  
58 58  
59 59 //Room
60 60 implementation 'androidx.room:room-ktx:2.2.5'
61 61 implementation "androidx.room:room-runtime:2.2.5"
62   - kapt "androidx.room:room-compiler:2.2.5"
  62 + annotationProcessor 'androidx.room:room-compiler:2.2.5'
63 63  
64 64 //Retrofit
65 65 implementation 'com.squareup.retrofit2:retrofit:2.9.0'
... ... @@ -69,6 +69,8 @@ dependencies {
69 69  
70 70 //Gson library
71 71 implementation "com.google.code.gson:gson:2.8.6"
72   - annotationProcessor 'androidx.room:room-compiler:2.2.5'
73 72  
  73 + // ViewModel and LiveData
  74 + implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
  75 + annotationProcessor 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
74 76 }
75 77 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
... ... @@ -47,6 +47,9 @@ interface InvHeadDAO {
47 47  
48 48 @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI")
49 49 suspend fun fetchAllInvHead(): List<InvHead>
  50 +
  51 + @Query("UPDATE $TABLA_INV_H SET INV_PRODCONT=:cant WHERE INV_NUM=:inven")
  52 + suspend fun UpdateInvBody(cant: Float, inven: Int)
50 53 }
51 54  
52 55 @Dao
... ... @@ -89,9 +92,9 @@ interface ServeInvDao {
89 92 @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0")
90 93 suspend fun UpdateServerPreInZero()
91 94  
92   - @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir")
93   - suspend fun UpdateServerPre(description: String, dir: String)
  95 + @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_NUM = :numero")
  96 + suspend fun UpdateServerPre(numero: Int)
94 97  
95   - @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE =:sOne")
96   - suspend fun fetchServerPreOne(sOne: String): ServeInv
  98 + @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE= 1")
  99 + suspend fun fetchServerPreOne(): ServeInv
97 100 }
98 101 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/Model/Tablas.kt
... ... @@ -83,7 +83,7 @@ data class InvBody(@ColumnInfo(name = &quot;INV_NUM&quot;) var invNum: Int,
83 83 data class ServeInv(
84 84 @ColumnInfo(name = "SER_DESC") var descripcion: String?,
85 85 @ColumnInfo(name = "SER_DIR") var direccion: String?,
86   - @ColumnInfo(name = "SER_PRE") var predeterminado: String?):
  86 + @ColumnInfo(name = "SER_PRE") var predeterminado: Int?):
87 87 Serializable { @PrimaryKey(autoGenerate = true)
88 88 @ColumnInfo(name = "SER_NUM")
89 89 var servNum: Int=0
app/src/main/java/com/focasoftware/deboinventariov20/ui/actualizacionMaestros/ActuaMaestrosFragment.kt
... ... @@ -6,17 +6,16 @@ import android.view.View
6 6 import android.view.ViewGroup
7 7 import android.widget.Button
8 8 import androidx.fragment.app.Fragment
  9 +import androidx.fragment.app.FragmentActivity
  10 +import androidx.lifecycle.lifecycleScope
9 11 import com.focasoftware.deboinventariov20.DB.DataBase.AppDb
10   -import com.focasoftware.deboinventariov20.Model.Articles
11   -import com.focasoftware.deboinventariov20.Model.Productos
12   -import com.focasoftware.deboinventariov20.Model.ProductosService
13   -import com.focasoftware.deboinventariov20.Model.ServeInv
  12 +import com.focasoftware.deboinventariov20.Model.*
14 13 import com.focasoftware.deboinventariov20.R
15 14 import com.google.android.material.bottomappbar.BottomAppBarTopEdgeTreatment
16 15 import kotlinx.android.synthetic.main.fragment_actua_maestros.*
17 16 import kotlinx.coroutines.*
18 17  
19   -var BASE_URL =""
  18 +public var BASE_URL =""
20 19 class ActuaMaestrosFragment : Fragment() {
21 20  
22 21 var job: Job? = null
... ... @@ -25,18 +24,16 @@ class ActuaMaestrosFragment : Fragment() {
25 24 override fun onCreate(savedInstanceState: Bundle?) {
26 25 super.onCreate(savedInstanceState)
27 26 // GlobalScope.launch(Dispatchers.Main) {
28   -//
29   -// BASE_URL = fetchServerPre().direccion.toString()
30   -// }
31   - BASE_URL="http://10.0.2.2:3000/"
  27 +// val invbody = fetchServerPreOne()
  28 + //BASE_URL= invbody!!.direccion.toString()
  29 + BASE_URL="http://10.0.2.2:3000/"
  30 +// }
32 31 // mostrarArticulos()
33 32 }
34 33  
35   - suspend fun fetchServerPre(): ServeInv {
36   - var busqueda: ServeInv
  34 + private suspend fun fetchServerPreOne(): ServeInv? {
37 35 return GlobalScope.async(Dispatchers.IO) {
38   - busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchServerPreOne("1")
39   - return@async busqueda
  36 + return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne()
40 37 }.await()
41 38 }
42 39  
app/src/main/java/com/focasoftware/deboinventariov20/ui/configuracion/ConfiguracionFragment.kt
... ... @@ -8,6 +8,8 @@ import android.view.View
8 8 import android.view.ViewGroup
9 9 import android.widget.*
10 10 import androidx.fragment.app.Fragment
  11 +import androidx.fragment.app.FragmentActivity
  12 +import androidx.lifecycle.lifecycleScope
11 13 import androidx.navigation.NavController
12 14 import androidx.navigation.Navigation
13 15 import androidx.navigation.fragment.findNavController
... ... @@ -16,10 +18,7 @@ import com.focasoftware.deboinventariov20.Model.ServeInv
16 18 import com.focasoftware.deboinventariov20.R
17 19 import com.focasoftware.deboinventariov20.ui.servidores.SpinnerAdapterServidor
18 20 import kotlinx.android.synthetic.main.fragment_configuracion.*
19   -import kotlinx.coroutines.Dispatchers
20   -import kotlinx.coroutines.GlobalScope
21   -import kotlinx.coroutines.async
22   -import kotlinx.coroutines.launch
  21 +import kotlinx.coroutines.*
23 22  
24 23 class ConfiguracionFragment : Fragment() {
25 24  
... ... @@ -166,19 +165,19 @@ class ConfiguracionFragment : Fragment() {
166 165 }
167 166 btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) }
168 167 btnValidarServidor.setOnClickListener { Toast.makeText(requireContext(), "Direcciรณn correcta", Toast.LENGTH_LONG).show() }
169   - spServidor?.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
170   - override fun onNothingSelected(parent: AdapterView<*>?) {}
171   - override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { itemSelect = position }
172   - }
173 168 GlobalScope.launch(Dispatchers.Main) {
174 169 adapterSpinnerServidor = SpinnerAdapterServidor(requireContext(), getDescServers())
175 170 spServidor.adapter = adapterSpinnerServidor
176   -
177 171 if (sharedPreferences.contains("ServerPredeterminado")) {
178 172 spServidor.setSelection(sharedPreferences.getString("ServerPredeterminado", "").toString().toInt())
179 173 } else (spServidor.setSelection(0))
180 174 }
181   -
  175 + spServidor?.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
  176 + override fun onNothingSelected(parent: AdapterView<*>?) {}
  177 + override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
  178 + itemSelect = position
  179 + }
  180 + }
182 181 return v
183 182 }
184 183  
... ... @@ -189,31 +188,54 @@ class ConfiguracionFragment : Fragment() {
189 188 }
190 189  
191 190 fun guardarPreferencias() {
192   - try {
193   - val editor = sharedPreferences.edit()
194   -
195   - if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString())
196   -
197   - if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0")
198   - if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0")
199   -
200   - if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0")
201   - if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0")
202   - if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0")
203   - if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0")
204   - if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0")
205   - if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0")
206   - if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0")
207   - if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0")
208   - if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0")
209   - editor?.putString("ServerPredeterminado", itemSelect.toString())
210   -
211   - editor?.apply()
212   - editor.commit()
213   -
214   - } catch (e: Exception) {
215   - e.printStackTrace()
216   - }
  191 +// try {
  192 + val editor = sharedPreferences.edit()
  193 +
  194 + if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString())
  195 +
  196 + if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0")
  197 + if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0")
  198 +
  199 + if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0")
  200 + if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0")
  201 + if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0")
  202 + if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0")
  203 + if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0")
  204 + if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0")
  205 + if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0")
  206 + if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0")
  207 + if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0")
  208 + editor?.putString("ServerPredeterminado", itemSelect.toString())
  209 + updateServerPreInZero()
  210 + updateServerPre(itemSelect+1)
  211 +
  212 + editor?.apply()
  213 + editor.commit()
  214 +
  215 +// } catch (e: Exception) {
  216 +// Toast.makeText(requireContext(), "Error ", Toast.LENGTH_LONG).show()
  217 +// e.printStackTrace()
  218 +// }
217 219 }
218 220  
  221 + private fun updateServerPreInZero() {
  222 + lifecycleScope.launch {
  223 + withContext(Dispatchers.IO) {
  224 + val activity: FragmentActivity? = activity
  225 + if (activity != null && isAdded) {
  226 + AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPreInZero()
  227 + }
  228 + }
  229 + }
  230 + }
  231 + private fun updateServerPre(server:Int) {
  232 + lifecycleScope.launch {
  233 + withContext(Dispatchers.IO) {
  234 + val activity: FragmentActivity? = activity
  235 + if (activity != null && isAdded) {
  236 + AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPre(server)
  237 + }
  238 + }
  239 + }
  240 + }
219 241 }
220 242 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionFragment.kt
... ... @@ -61,13 +61,14 @@ class DescripcionFragment : Fragment() {
61 61 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
62 62 val v = inflater.inflate(R.layout.fragment_descripcion, container, false)
63 63 rcDescripcion = v.findViewById(R.id.rcDescripcion)
64   - val btnSalir = v.findViewById<Button>(R.id.btnSalir)
  64 +// val btnSalir = v.findViewById<Button>(R.id.btnSalir)
65 65  
66 66 IngresarRecicler(artAcargar2)
67 67  
68   - btnSalir.setOnClickListener {
69   - VolverAinventario()
70   - }
  68 +// btnSalir.setOnClickListener {
  69 +// activity?.onBackPressed();
  70 +//// VolverAinventario()
  71 +// }
71 72 return v
72 73 }
73 74  
... ... @@ -124,7 +125,8 @@ class DescripcionFragment : Fragment() {
124 125 InventarioFragment().ObtenerFechaActual(),
125 126 InventarioFragment().ObtenerFechaActual())
126 127 InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS
127   - VolverAinventario()
  128 +// VolverAinventario()
  129 + activity?.onBackPressed()
128 130 mAlertDialog.dismiss()
129 131 }
130 132 }
... ... @@ -133,44 +135,57 @@ class DescripcionFragment : Fragment() {
133 135 val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
134 136 val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false)
135 137 if (artCargadoEnBD!!.balanza.toString().contains("1" ) || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogView.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER
136   - mDialogView.tvCantInicial.text = artCargadoEnBD!!.cantTomada
  138 + mDialogView.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat())
137 139  
138 140 val mAlertDialog = mBuilder.show()
139 141 mDialogView.rbSumar.setOnClickListener {
140 142 if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
141   - mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
  143 + mDialogView.tvResultado.text = String.format("%.2f",(mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()))
142 144 mDialogView.tvNuevaCantidad.isEnabled=false
143 145 }
144 146 }
145 147 mDialogView.rbRestar.setOnClickListener {
146 148 if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
147 149 if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) {
148   - mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
149   - mDialogView.tvNuevaCantidad.isEnabled=false
  150 + mDialogView.tvResultado.text = String.format("%.2f",mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat())
  151 + mDialogView.tvNuevaCantidad.isEnabled = false
  152 + }else{
  153 + mDialogView.tvResultado.text=""
  154 + mDialogView.tvResultado.error = "Operaciรณn No Valida"
  155 + mDialogView.tvResultado.requestFocus()
  156 + mDialogView.tvResultado.hint = "Error"
150 157 }
151 158 }
152 159 }
153 160 mDialogView.rbMdodificar.setOnClickListener {
154 161 if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
155   - mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
156   - mDialogView.tvNuevaCantidad.isEnabled=false
  162 + mDialogView.tvResultado.text = String.format("%.2f", (mDialogView.tvNuevaCantidad.text.toString().toFloat()))
  163 + mDialogView.tvNuevaCantidad.isEnabled = false
157 164 }
158 165 }
159 166 mDialogView.btnAceptar.setOnClickListener {
160   - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
161   - val name = mDialogView.tvgenerico4.text.toString().toFloat()
  167 + if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) {
  168 + if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) {
  169 +
162 170 updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(),
163 171 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo.toString(),
164   - name)
165   - VolverAinventario()
  172 + mDialogView.tvResultado.text.toString().toFloat())
  173 +// VolverAinventario()
  174 + activity?.onBackPressed();
166 175 mAlertDialog.dismiss()
167   - } else if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
168   - mDialogView.tvNuevaCantidad.error = "No vacio"
169   - mDialogView.tvNuevaCantidad.requestFocus()
170   - mDialogView.tvNuevaCantidad.hint = "Ingrese un valor"
  176 + } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) {
  177 + mDialogView.tvResultado.error = "Operaciรณn Requerida"
  178 + mDialogView.tvResultado.requestFocus()
  179 + mDialogView.tvResultado.hint = "Seleccione Operaciรณn"
171 180 }
  181 + } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) {
  182 + mDialogView.tvNuevaCantidad.error = "Completar"
  183 + mDialogView.tvNuevaCantidad.requestFocus()
  184 + mDialogView.tvNuevaCantidad.hint = "Ingrese un valor"
  185 + }
172 186 }
173 187 mDialogView.dialogCancelBtn.setOnClickListener {
  188 + activity?.onBackPressed();
174 189 mAlertDialog.dismiss()
175 190 }
176 191 }
... ... @@ -207,14 +222,14 @@ class DescripcionFragment : Fragment() {
207 222 }
208 223 }
209 224  
210   - fun VolverAinventario() {
211   -
212   - val editor = sharedPreferences.edit()
213   - editor?.putString("Inventario", numeroInventario.toString())
214   - editor?.apply()
215   - editor.commit()
216   - navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment)
217   - }
  225 +// fun VolverAinventario() {
  226 +//
  227 +// val editor = sharedPreferences.edit()
  228 +// editor?.putString("Inventario", numeroInventario.toString())
  229 +// editor?.apply()
  230 +// editor.commit()
  231 +// navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment)
  232 +// }
218 233  
219 234 suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? {
220 235 //TODO BUSQUEDA POR CODIGO DE BARRAS
... ... @@ -232,7 +247,6 @@ class DescripcionFragment : Fragment() {
232 247 if (activity != null && isAdded) {
233 248 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo)
234 249 }
235   -
236 250 }
237 251 }
238 252 }
app/src/main/java/com/focasoftware/deboinventariov20/ui/dialogos/DialogNoEncontrado.kt
... ... @@ -1,20 +0,0 @@
1   -package com.focasoftware.deboinventariov20.ui.dialogos
2   -
3   -import android.app.AlertDialog
4   -import android.app.Dialog
5   -import android.os.Bundle
6   -import androidx.fragment.app.DialogFragment
7   -
8   -class DialogNoEncontrado : DialogFragment() {
9   - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
10   - return activity?.let {
11   - val title = "Busqueda de Productos"
12   - val content = "Producto no encotrado."
13   - val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
14   - builder.setTitle(title).setMessage(content).setPositiveButton(android.R.string.ok) { _, _ ->
15   - //Todo OK click
16   - }
17   - return builder.create()
18   - } ?: throw IllegalStateException("Activity cannot be null")
19   - }
20   -}
app/src/main/java/com/focasoftware/deboinventariov20/ui/dialogos/DialogoLogin.kt
... ... @@ -1,44 +0,0 @@
1   -package com.focasoftware.deboinventariov20.ui.dialogos
2   -
3   -import android.app.AlertDialog
4   -import android.app.Dialog
5   -import android.content.SharedPreferences
6   -import android.os.Bundle
7   -import androidx.fragment.app.DialogFragment
8   -import com.focasoftware.deboinventariov20.R
9   -
10   -class DialogoLogin() : DialogFragment() {
11   - private lateinit var sharedPreferences: SharedPreferences
12   -
13   - interface OnContinueCancelClickListener {
14   - fun onPositiveClick()
15   - fun onCancelClick()
16   - }
17   -
18   - fun newInstance(s: String): DialogoLogin? {
19   - val dialog = DialogoLogin()
20   -
21   - val args = Bundle()
22   - args.putString("title", s)
23   - dialog.arguments = args
24   -
25   - return dialog
26   - }
27   -
28   - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
29   - return activity?.let {
30   - val builder = AlertDialog.Builder(it)
31   -
32   - val inflater = requireActivity().layoutInflater;
33   -
34   - builder.setView(inflater.inflate(R.layout.login_dialog, null)).setTitle("El producto ya fue escaneado").setPositiveButton(android.R.string.ok) { _, _ ->
35   - val listener = activity as OnContinueCancelClickListener?
36   - listener!!.onPositiveClick()
37   - }.setNegativeButton(android.R.string.cancel) { _, _ ->
38   - val listener = activity as OnContinueCancelClickListener?
39   - listener!!.onCancelClick()
40   - }
41   - builder.create()
42   - } ?: throw IllegalStateException("Activity cannot be null")
43   - }
44   -}
45 0 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/ui/dialogos/InsertCant.kt
... ... @@ -1,48 +0,0 @@
1   -package com.focasoftware.deboinventariov20.ui.dialogos
2   -
3   -import android.app.AlertDialog
4   -import android.app.Dialog
5   -import android.content.Context
6   -import android.content.SharedPreferences
7   -import android.os.Bundle
8   -import android.view.View
9   -import android.widget.EditText
10   -import androidx.fragment.app.DialogFragment
11   -import com.focasoftware.deboinventariov20.R
12   -
13   -class InsertCant() : DialogFragment() {
14   -
15   - private lateinit var sharedPreferences: SharedPreferences
16   -
17   - interface OnContinueCancelClickListener {
18   - fun onPositiveClick()
19   - fun onCancelClick()
20   - }
21   -
22   - fun newInstance(s: String): InsertCant? {
23   - val dialog = InsertCant()
24   -
25   - val args = Bundle()
26   - args.putString("title", s)
27   - dialog.arguments = args
28   -
29   - return dialog
30   - }
31   -
32   - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
33   - return activity?.let {
34   - val builder = AlertDialog.Builder(it)
35   -
36   - val inflater = requireActivity().layoutInflater;
37   -
38   - builder.setView(inflater.inflate(R.layout.ingresar_cantidad, null)).setTitle("").setPositiveButton(android.R.string.ok) { _, _ ->
39   - val listener = activity as OnContinueCancelClickListener?
40   - listener!!.onPositiveClick()
41   - }.setNegativeButton(android.R.string.cancel) { _, _ ->
42   - val listener = activity as OnContinueCancelClickListener?
43   - listener!!.onCancelClick()
44   - }
45   - builder.create()
46   - } ?: throw IllegalStateException("Activity cannot be null")
47   - }
48   - }
49 0 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/ui/dialogos/SingleChoiceAlertDialog.kt
... ... @@ -1,53 +0,0 @@
1   -package com.focasoftware.deboinventariov20.ui.dialogos
2   -
3   -import android.app.AlertDialog
4   -import android.app.Dialog
5   -import android.os.Bundle
6   -import androidx.fragment.app.DialogFragment
7   -
8   -class SingleChoiceAlertDialog : DialogFragment() {
9   -
10   - interface OnDialogSelectorListener {
11   - fun onSelectedOption(dialogId: Int)
12   - }
13   -
14   -
15   - var mDialogSelectorCallback: OnDialogSelectorListener? = null
16   -
17   - fun newInstance(title: String, values: Array<String>, selected: Int = -1): SingleChoiceAlertDialog? {
18   - val dialog = SingleChoiceAlertDialog()
19   -
20   - val args = Bundle()
21   - args.putString("title", title)
22   - args.putStringArray("values", values)
23   - args.putInt("selected", selected)
24   - dialog.arguments = args
25   -
26   - return dialog
27   -
28   - }
29   -
30   - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
31   -
32   - return activity?.let {
33   -
34   - val args = requireArguments()
35   - val title = args.getString("title")
36   - val values = args.getStringArray("values")
37   - val selectedIndex = args.getInt("selected")
38   -
39   - val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
40   -
41   - builder.setSingleChoiceItems(values, selectedIndex) { _, which ->
42   - //val item = values?.get(which)
43   - mDialogSelectorCallback?.onSelectedOption(which)
44   - dialog?.dismiss()
45   - }
46   - builder.setTitle(title)
47   -
48   - return builder.create()
49   - } ?: throw IllegalStateException("Activity cannot be null")
50   - }
51   -
52   -
53   -}
54 0 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InventarioFragment.kt
... ... @@ -9,9 +9,7 @@ import android.graphics.Canvas
9 9 import android.graphics.Color
10 10 import android.graphics.drawable.Drawable
11 11 import android.os.Bundle
12   -import android.text.InputType
13 12 import android.text.InputType.TYPE_CLASS_NUMBER
14   -import android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL
15 13 import android.view.KeyEvent
16 14 import android.view.LayoutInflater
17 15 import android.view.View
... ... @@ -33,19 +31,18 @@ import com.focasoftware.deboinventariov20.Model.Articles
33 31 import com.focasoftware.deboinventariov20.Model.InvBody
34 32 import com.focasoftware.deboinventariov20.Model.InvHead
35 33 import com.focasoftware.deboinventariov20.R
36   -import com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado
  34 +import com.focasoftware.deboinventariov20.ui.util.Base.dialogos.DialogNoEncontrado
37 35 import kotlinx.android.synthetic.main.fragment_inventario.*
38 36 import kotlinx.android.synthetic.main.ingresar_cantidad.view.*
39 37 import kotlinx.android.synthetic.main.login_dialog.view.*
40 38 import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar
41 39 import kotlinx.coroutines.*
42   -import java.lang.Integer.TYPE
43 40 import java.time.LocalDateTime
44 41 import java.time.format.DateTimeFormatter
45 42 import java.util.*
46 43  
47 44  
48   -class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener{
  45 +class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener {
49 46  
50 47 private lateinit var sharedPreferences: SharedPreferences
51 48 private var iArea: Int = 0
... ... @@ -89,7 +86,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
89 86 //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO
90 87 InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1
91 88 //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO
92   - invHead = InvHead(InventarioNuevo, if (SerchArea() == 0) "Ventas" else "Deposito", 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, SerchArea(), AjusteProductos(), ProdNoCont())
  89 + invHead = InvHead(InventarioNuevo, if (SerchArea() == 0) "Ventas" else "Deposito", 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, SerchArea(), AjusteProductos(), ProdNoCont())
93 90 AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead)
94 91 tvTitulo.text = "Inventario Dinamico" + " Nยฐ $InventarioNuevo"
95 92 }
... ... @@ -122,12 +119,14 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
122 119 // fCant = listArticulos[indiceDelArtEncontrado].cantTomada
123 120 // fCant += 1F
124 121 //TODO ACTUALIZO LA CANTIDAD EN LA BD
125   - updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), listArticulos[indiceDelArtEncontrado].cantTomada+1)
  122 + updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(),
  123 + listArticulos[indiceDelArtEncontrado].codigo.toString(),
  124 + listArticulos[indiceDelArtEncontrado].cantTomada + 1)
126 125 //TODO ACTUALIZO LA CANTIDAD EN EL RV
127   - listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada+1
  126 + listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada + 1
128 127 viewAdapter.notifyDataSetChanged()
129 128 } else {
130   - dialogoSumaResta(requireContext(),indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta)
  129 + dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false)
131 130 }
132 131  
133 132 } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD
... ... @@ -280,41 +279,29 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
280 279 // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog")
281 280  
282 281 btnBorrarInv.setOnClickListener {
283   - AlertDialog.Builder(requireContext())
284   - .setTitle("Eliminaciรณn de Inventarios")
285   - .setMessage("ยฟConfirma que desea eliminar el inventario?")
286   - .setPositiveButton(R.string.btnOk,
287   - DialogInterface.OnClickListener { dialog, which ->
  282 + AlertDialog.Builder(requireContext()).setTitle("Eliminaciรณn de Inventarios").setMessage("ยฟConfirma que desea eliminar el inventario?")
  283 + .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which ->
288 284 BorrarInvActual()
289 285 Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show()
290 286 navController.navigate(R.id.action_inventarioFragment_to_mainFragment2)
291 287 InventarioNuevo = 0
292 288  
293   - })
294   - .setNegativeButton(R.string.btnCancelar,
295   - DialogInterface.OnClickListener { dialog, which ->
296   - //botรณn cancel pulsado
297   - })
298   - .show()
  289 + }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which ->
  290 + //botรณn cancel pulsado
  291 + }).show()
299 292 }
300 293  
301 294 btnExportarInv.setOnClickListener {
302   - AlertDialog.Builder(requireContext())
303   - .setTitle(R.string.sTituloExportar)
304   - .setMessage(R.string.sMensajeExportar)
305   - .setPositiveButton(R.string.btnOk,
306   - DialogInterface.OnClickListener { dialog, which ->
307   - BorrarInvActual()
308   - Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show()
309   - navController.navigate(R.id.action_inventarioFragment_to_mainFragment2)
310   - InventarioNuevo = 0
311   -
312   - })
313   - .setNegativeButton(R.string.btnCancelar,
314   - DialogInterface.OnClickListener { dialog, which ->
315   - //botรณn cancel pulsado
316   - })
317   - .show()
  295 + AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar)
  296 + .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which ->
  297 + BorrarInvActual()
  298 + Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show()
  299 + navController.navigate(R.id.action_inventarioFragment_to_mainFragment2)
  300 + InventarioNuevo = 0
  301 +
  302 + }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which ->
  303 + //botรณn cancel pulsado
  304 + }).show()
318 305  
319 306 // MaterialDialog(requireContext()).show {
320 307 // title(R.string.sTituloExportar)
... ... @@ -422,11 +409,11 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
422 409 // cargarArtEnBd(acargarPorDesc, fCant)
423 410 // cargarRecicler(acargarPorDesc, fCant)
424 411 // } else {
425   - var bundle = Bundle()
426   - bundle = bundleOf("ArrayDesc" to artAcargar)
427   - bundle.putInt("numeroInv", InventarioNuevo)
428   - navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle)
429   - //navController.backStack.removeLast()
  412 + var bundle = Bundle()
  413 + bundle = bundleOf("ArrayDesc" to artAcargar)
  414 + bundle.putInt("numeroInv", InventarioNuevo)
  415 + navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle)
  416 + //navController.backStack.removeLast()
430 417 // }
431 418 // } else {//SI NO ESTA +1
432 419 // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV
... ... @@ -480,11 +467,11 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
480 467 if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1
481 468 fCant = 0F
482 469 fCant += 1F
483   - cargarArtEnBd(artAcargar, fCant)
  470 + cargarArtEnBd(artAcargar, String.format("%.3f", fCant))
484 471 cargarRecicler(artAcargar, fCant)
485 472 } else {//SI NO ESTA +1 PREGUNTA CANTIDAD
486 473  
487   - DialogingresarCantidad(requireContext(),artAcargar)
  474 + DialogingresarCantidad(requireContext(), artAcargar)
488 475 }
489 476 } else {// TODO si no lo encuentra en la BD
490 477 val modalDialog = DialogNoEncontrado()
... ... @@ -497,9 +484,8 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
497 484  
498 485 fun DialogingresarCantidad(cnxt: Context, artAcargar: Articles?) {
499 486 val mDialogView = LayoutInflater.from(cnxt).inflate(R.layout.ingresar_cantidad, null)
500   - val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView)
501   - .setCancelable(false)
502   - if (artAcargar!!.balanza!!.toInt()==1 || artAcargar.balanza!!.toInt()==3 || artAcargar.balanza!!.toInt()==7) mDialogView.etCantidad.inputType=TYPE_CLASS_NUMBER
  487 + val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView).setCancelable(false)
  488 + if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER
503 489 mDialogView.tvTitulo.text = artAcargar.descripcion.toString()
504 490 val mAlertDialog = mBuilder.show()
505 491 mDialogView.btnAceptar.setOnClickListener {
... ... @@ -509,53 +495,61 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
509 495 mDialogView.etCantidad.hint = "Ingrese un valor"
510 496 } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) {
511 497 mAlertDialog.dismiss()
512   - cargarArtEnBd(artAcargar, mDialogView.etCantidad.text.toString().toFloat())
513   - cargarRecicler(artAcargar, mDialogView.etCantidad.text.toString().toFloat())
  498 + cargarArtEnBd(artAcargar, String.format("%.2f", mDialogView.etCantidad.text.toString().toFloat()))
  499 + cargarRecicler(artAcargar, mDialogView.etCantidad.text.toString().toFloat())
514 500 }
515 501 }
516 502 }
517 503  
518   - fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String) {
  504 + fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) {
519 505 val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
520   - val mBuilder =
521   - AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[indiceDelArtEncontrado].descripcion} se encuentra cargado.")
522   -// .setCancelable(false)
523   - if (univta.contains("1" ) || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType=TYPE_CLASS_NUMBER
  506 + val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[indiceDelArtEncontrado].descripcion} se encuentra cargado.").setCancelable(cancelable)
  507 + // TODO: SI PERMITE QUE INGRESE DECIMALES
  508 + if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER
524 509  
525   - mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString()
  510 + mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada)
526 511 val mAlertDialog = mBuilder.show()
527 512 mDialogView.rbSumar.setOnClickListener {
528 513 if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
529   - mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
530   - mDialogView.tvNuevaCantidad.isEnabled=false
  514 + mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat())
  515 + mDialogView.tvNuevaCantidad.isEnabled = false
531 516 }
532 517 }
533 518 mDialogView.rbRestar.setOnClickListener {
534 519 if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
535 520 if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) {
536   - mDialogView.tvgenerico4.text =
537   - (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
538   - mDialogView.tvNuevaCantidad.isEnabled=false
  521 + mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat())
  522 + mDialogView.tvNuevaCantidad.isEnabled = false
  523 + } else {
  524 + mDialogView.tvResultado.text = ""
  525 + mDialogView.tvResultado.error = "Operaciรณn No Valida"
  526 + mDialogView.tvResultado.requestFocus()
  527 + mDialogView.tvResultado.hint = "Error"
539 528 }
540 529 }
541 530 }
542 531 mDialogView.rbMdodificar.setOnClickListener {
543 532 if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
544   - mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
545   - mDialogView.tvNuevaCantidad.isEnabled=false
  533 + mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat())
  534 + mDialogView.tvNuevaCantidad.isEnabled = false
546 535 }
547 536 }
548 537 mDialogView.btnAceptar.setOnClickListener {
549   - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
550   - mAlertDialog.dismiss()
551   -// val name = mDialogView.tvgenerico4.text.toString().toFloat()
552   -// fCant = 0F
553   -// fCant = name
554   - listArticulos[indiceDelArtEncontrado].cantTomada = mDialogView.tvgenerico4.text.toString().toFloat()
555   - updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), mDialogView.tvgenerico4.text.toString().toFloat())
556   - viewAdapter.notifyDataSetChanged()
557   - } else if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) {
558   - mDialogView.tvNuevaCantidad.error = "No vacio"
  538 + if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) {
  539 + if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) {
  540 + mAlertDialog.dismiss()
  541 + listArticulos[indiceDelArtEncontrado].cantTomada = String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat()
  542 + updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(),
  543 + String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat())
  544 +
  545 + viewAdapter.notifyDataSetChanged()
  546 + } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) {
  547 + mDialogView.tvResultado.error = "Operaciรณn Requerida"
  548 + mDialogView.tvResultado.requestFocus()
  549 + mDialogView.tvResultado.hint = "Seleccione Operaciรณn"
  550 + }
  551 + } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) {
  552 + mDialogView.tvNuevaCantidad.error = "Completar"
559 553 mDialogView.tvNuevaCantidad.requestFocus()
560 554 mDialogView.tvNuevaCantidad.hint = "Ingrese un valor"
561 555 }
... ... @@ -640,12 +634,12 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
640 634 }.await()
641 635 }
642 636  
643   - private fun cargarArtEnBd(articulos: Articles, cant: Float) {
  637 + private fun cargarArtEnBd(articulos: Articles, cant: String) {
644 638 val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD
645 639 articulos.sector,
646 640 articulos.codigo,
647 641 articulos.descripcion,
648   - cant.toString(),
  642 + cant,
649 643 articulos.codBar,
650 644 articulos.codOrigen,
651 645 articulos.precio,
... ... @@ -659,7 +653,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
659 653  
660 654 fun cargarRecicler(articulos: Articles, cant: Float) {
661 655 //TODO CARGO EN LE RV
662   - val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen, articulos.balanza.toString(),articulos.de.toString())
  656 + val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen, articulos.balanza.toString(), articulos.de.toString())
663 657 listArticulos.add(item)
664 658  
665 659 viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this)
... ... @@ -764,7 +758,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList
764 758 }
765 759  
766 760 override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) {
767   - dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta)
  761 + dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true)
768 762  
769 763 // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
770 764 // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[position.toInt()].descripcion}")
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/InventarioListAdapter.kt
... ... @@ -25,8 +25,11 @@ class InventarioListAdapter(private val context: Context, private val inv: List&lt;
25 25 inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) {
26 26 override fun bind(item: InvHead, position: Int) {
27 27 itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())}
28   - itemView.tvPrincipalinventario.text = item.invNum.toString()
  28 + itemView.tvPrincipalinventario.text = if ( item.invNum < 10) "0${ item.invNum.toString()}" else item.invNum.toString()
  29 +
29 30 itemView.tvDescription.text=item.descripcion.toString()
  31 + itemView.tvFecha.text=item.fechaInicio.toString()
  32 + itemView.tvCantContada.text=item.prodContados.toString()
30 33 }
31 34 }
32 35  
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/MainFragment.kt
... ... @@ -48,7 +48,7 @@ private var listIvn2 = ArrayList&lt;InvHead&gt;()
48 48 val ivSort91= v.findViewById<ImageButton>(R.id.ivSort91)
49 49 val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas)
50 50 val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito)
51   -
  51 + val tvTipo = v.findViewById<TextView>(R.id.tvTipo)
52 52 rcInventario = v.findViewById(R.id.rcInventario)
53 53  
54 54 GlobalScope.launch(Dispatchers.Main) {
... ... @@ -76,6 +76,7 @@ private var listIvn2 = ArrayList&lt;InvHead&gt;()
76 76 ivSort19.visibility = View.VISIBLE
77 77 cbVentas.visibility = View.VISIBLE
78 78 cbDeposito.visibility = View.VISIBLE
  79 + tvTipo.visibility = View.VISIBLE
79 80 tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) -"
80 81 } else {
81 82 bAbiertoCerrado = false
... ... @@ -85,6 +86,7 @@ private var listIvn2 = ArrayList&lt;InvHead&gt;()
85 86 txtDeposito.visibility = View.VISIBLE
86 87 cbVentas.visibility = View.GONE
87 88 cbDeposito.visibility = View.GONE
  89 + tvTipo.visibility = View.GONE
88 90 tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +"
89 91 }
90 92 }
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/ServidoresFragment.kt
... ... @@ -51,7 +51,7 @@ class ServidoresFragment : Fragment() {
51 51 if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) {
52 52 // GlobalScope.launch(Dispatchers.Main) {
53 53 // ServerNew =AppDb.getAppDb(requireContext())?.ServeInvDao()?.findLastServer()?.plus(1) ?: 1
54   - val servidor = ServeInv(etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", "0")
  54 + val servidor = ServeInv(etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", 0)
55 55 ingresarDatos(servidor)
56 56 cargarRecicler(servidor)
57 57 Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show()
... ... @@ -95,7 +95,7 @@ class ServidoresFragment : Fragment() {
95 95 fun cargarRecicler(ser: ServeInv) {
96 96 //TODO CARGO EN LE RV
97 97 deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!!
98   - val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado)
  98 + val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado.toString())
99 99  
100 100 listServ.add(item)
101 101  
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/dialogos/DialogNoEncontrado.kt
... ... @@ -0,0 +1,20 @@
  1 +package com.focasoftware.deboinventariov20.ui.util.Base.dialogos
  2 +
  3 +import android.app.AlertDialog
  4 +import android.app.Dialog
  5 +import android.os.Bundle
  6 +import androidx.fragment.app.DialogFragment
  7 +
  8 +class DialogNoEncontrado : DialogFragment() {
  9 + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
  10 + return activity?.let {
  11 + val title = "Busqueda de Productos"
  12 + val content = "Producto no encotrado."
  13 + val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
  14 + builder.setTitle(title).setMessage(content).setPositiveButton(android.R.string.ok) { _, _ ->
  15 + //Todo OK click
  16 + }
  17 + return builder.create()
  18 + } ?: throw IllegalStateException("Activity cannot be null")
  19 + }
  20 +}
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/dialogos/DialogoLogin.kt
... ... @@ -0,0 +1,44 @@
  1 +package com.focasoftware.deboinventariov20.ui.util.Base.dialogos
  2 +
  3 +import android.app.AlertDialog
  4 +import android.app.Dialog
  5 +import android.content.SharedPreferences
  6 +import android.os.Bundle
  7 +import androidx.fragment.app.DialogFragment
  8 +import com.focasoftware.deboinventariov20.R
  9 +
  10 +class DialogoLogin() : DialogFragment() {
  11 + private lateinit var sharedPreferences: SharedPreferences
  12 +
  13 + interface OnContinueCancelClickListener {
  14 + fun onPositiveClick()
  15 + fun onCancelClick()
  16 + }
  17 +
  18 + fun newInstance(s: String): DialogoLogin? {
  19 + val dialog = DialogoLogin()
  20 +
  21 + val args = Bundle()
  22 + args.putString("title", s)
  23 + dialog.arguments = args
  24 +
  25 + return dialog
  26 + }
  27 +
  28 + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
  29 + return activity?.let {
  30 + val builder = AlertDialog.Builder(it)
  31 +
  32 + val inflater = requireActivity().layoutInflater;
  33 +
  34 + builder.setView(inflater.inflate(R.layout.login_dialog, null)).setTitle("El producto ya fue escaneado").setPositiveButton(android.R.string.ok) { _, _ ->
  35 + val listener = activity as OnContinueCancelClickListener?
  36 + listener!!.onPositiveClick()
  37 + }.setNegativeButton(android.R.string.cancel) { _, _ ->
  38 + val listener = activity as OnContinueCancelClickListener?
  39 + listener!!.onCancelClick()
  40 + }
  41 + builder.create()
  42 + } ?: throw IllegalStateException("Activity cannot be null")
  43 + }
  44 +}
0 45 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/dialogos/InsertCant.kt
... ... @@ -0,0 +1,45 @@
  1 +package com.focasoftware.deboinventariov20.ui.util.Base.dialogos
  2 +
  3 +import android.app.AlertDialog
  4 +import android.app.Dialog
  5 +import android.content.SharedPreferences
  6 +import android.os.Bundle
  7 +import androidx.fragment.app.DialogFragment
  8 +import com.focasoftware.deboinventariov20.R
  9 +
  10 +class InsertCant() : DialogFragment() {
  11 +
  12 + private lateinit var sharedPreferences: SharedPreferences
  13 +
  14 + interface OnContinueCancelClickListener {
  15 + fun onPositiveClick()
  16 + fun onCancelClick()
  17 + }
  18 +
  19 + fun newInstance(s: String): InsertCant? {
  20 + val dialog = InsertCant()
  21 +
  22 + val args = Bundle()
  23 + args.putString("title", s)
  24 + dialog.arguments = args
  25 +
  26 + return dialog
  27 + }
  28 +
  29 + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
  30 + return activity?.let {
  31 + val builder = AlertDialog.Builder(it)
  32 +
  33 + val inflater = requireActivity().layoutInflater;
  34 +
  35 + builder.setView(inflater.inflate(R.layout.ingresar_cantidad, null)).setTitle("").setPositiveButton(android.R.string.ok) { _, _ ->
  36 + val listener = activity as OnContinueCancelClickListener?
  37 + listener!!.onPositiveClick()
  38 + }.setNegativeButton(android.R.string.cancel) { _, _ ->
  39 + val listener = activity as OnContinueCancelClickListener?
  40 + listener!!.onCancelClick()
  41 + }
  42 + builder.create()
  43 + } ?: throw IllegalStateException("Activity cannot be null")
  44 + }
  45 + }
0 46 \ No newline at end of file
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/dialogos/SingleChoiceAlertDialog.kt
... ... @@ -0,0 +1,53 @@
  1 +package com.focasoftware.deboinventariov20.ui.util.Base.dialogos
  2 +
  3 +import android.app.AlertDialog
  4 +import android.app.Dialog
  5 +import android.os.Bundle
  6 +import androidx.fragment.app.DialogFragment
  7 +
  8 +class SingleChoiceAlertDialog : DialogFragment() {
  9 +
  10 + interface OnDialogSelectorListener {
  11 + fun onSelectedOption(dialogId: Int)
  12 + }
  13 +
  14 +
  15 + var mDialogSelectorCallback: OnDialogSelectorListener? = null
  16 +
  17 + fun newInstance(title: String, values: Array<String>, selected: Int = -1): SingleChoiceAlertDialog? {
  18 + val dialog = SingleChoiceAlertDialog()
  19 +
  20 + val args = Bundle()
  21 + args.putString("title", title)
  22 + args.putStringArray("values", values)
  23 + args.putInt("selected", selected)
  24 + dialog.arguments = args
  25 +
  26 + return dialog
  27 +
  28 + }
  29 +
  30 + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
  31 +
  32 + return activity?.let {
  33 +
  34 + val args = requireArguments()
  35 + val title = args.getString("title")
  36 + val values = args.getStringArray("values")
  37 + val selectedIndex = args.getInt("selected")
  38 +
  39 + val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
  40 +
  41 + builder.setSingleChoiceItems(values, selectedIndex) { _, which ->
  42 + //val item = values?.get(which)
  43 + mDialogSelectorCallback?.onSelectedOption(which)
  44 + dialog?.dismiss()
  45 + }
  46 + builder.setTitle(title)
  47 +
  48 + return builder.create()
  49 + } ?: throw IllegalStateException("Activity cannot be null")
  50 + }
  51 +
  52 +
  53 +}
0 54 \ No newline at end of file
app/src/main/res/layout/fragment_descripcion.xml
... ... @@ -17,24 +17,24 @@
17 17 android:background="@android:color/darker_gray"
18 18 android:scrollbars="vertical"
19 19 app:layout_constraintTop_toBottomOf="@id/guideline4"
20   - app:layout_constraintBottom_toTopOf="@+id/guideline5"
  20 + app:layout_constraintBottom_toTopOf="@+id/guideline6"
21 21 app:layout_constraintEnd_toEndOf="parent"
22 22 app:layout_constraintStart_toStartOf="parent"
23 23 tools:listitem="@layout/item" />
24 24  
25   - <Button
26   - android:id="@+id/btnSalir"
27   - android:layout_width="0dp"
28   - android:layout_height="wrap_content"
29   - android:text="@string/btnCancelar"
30   - android:textColor="@android:color/white"
31   - android:padding="10dp"
32   - android:background="@drawable/boton_borde_redondeado"
33   - app:layout_constraintBottom_toBottomOf="@+id/guideline6"
34   - app:layout_constraintEnd_toEndOf="parent"
35   - app:layout_constraintHorizontal_chainStyle="spread"
36   - app:layout_constraintStart_toStartOf="parent"
37   - app:layout_constraintTop_toBottomOf="@+id/rcInventarios" />
  25 +<!-- <Button-->
  26 +<!-- android:id="@+id/btnSalir"-->
  27 +<!-- android:layout_width="0dp"-->
  28 +<!-- android:layout_height="wrap_content"-->
  29 +<!-- android:text="@string/btnCancelar"-->
  30 +<!-- android:textColor="@android:color/white"-->
  31 +<!-- android:padding="10dp"-->
  32 +<!-- android:background="@drawable/boton_borde_redondeado"-->
  33 +<!-- app:layout_constraintBottom_toBottomOf="@+id/guideline6"-->
  34 +<!-- app:layout_constraintEnd_toEndOf="parent"-->
  35 +<!-- app:layout_constraintHorizontal_chainStyle="spread"-->
  36 +<!-- app:layout_constraintStart_toStartOf="parent"-->
  37 +<!-- app:layout_constraintTop_toBottomOf="@+id/rcInventarios" />-->
38 38  
39 39 <androidx.constraintlayout.widget.Guideline
40 40 android:id="@+id/guideline4"
app/src/main/res/layout/fragment_main.xml
... ... @@ -27,10 +27,10 @@
27 27 android:id="@+id/ivSort19"
28 28 android:layout_width="50dp"
29 29 android:layout_height="50dp"
30   - android:layout_margin="10dp"
  30 + android:layout_marginStart="10dp"
31 31 android:padding="5dp"
32   - android:visibility="gone"
33 32 android:src="@drawable/ic_sort19"
  33 + android:visibility="gone"
34 34 app:layout_constraintHorizontal_bias="0.0"
35 35 app:layout_constraintHorizontal_chainStyle="packed"
36 36 app:layout_constraintStart_toStartOf="parent"
... ... @@ -40,36 +40,34 @@
40 40 android:id="@+id/ivSort91"
41 41 android:layout_width="50dp"
42 42 android:layout_height="50dp"
43   - android:layout_margin="10dp"
  43 + android:layout_marginStart="10dp"
44 44 android:padding="5dp"
45   - android:layout_marginTop="12dp"
46   - android:visibility="gone"
47 45 android:src="@drawable/ic_sort91"
48   - app:layout_constraintHorizontal_bias="1.0"
  46 + android:visibility="gone"
49 47 app:layout_constraintHorizontal_chainStyle="packed"
50 48 app:layout_constraintStart_toStartOf="parent"
51 49 app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" />
52 50  
53   -
54   - <androidx.recyclerview.widget.RecyclerView
55   - android:id="@+id/rcInventario"
56   - android:layout_width="match_parent"
57   - android:layout_height="0dp"
58   - android:background="@android:color/darker_gray"
59   - android:scrollbars="vertical"
  51 + <TextView
  52 + android:id="@+id/tvTipo"
  53 + android:layout_width="wrap_content"
  54 + android:layout_height="wrap_content"
  55 + android:layout_margin="5dp"
  56 + android:text="Tipo:"
  57 + android:layout_marginTop="12dp"
  58 + android:textSize="15sp"
60 59 android:visibility="gone"
61   - app:layout_constraintEnd_toEndOf="parent"
62   - app:layout_constraintStart_toStartOf="parent"
63   - app:layout_constraintTop_toBottomOf="@id/ivSort19"
64   - tools:listitem="@layout/item_principal" />
  60 + app:layout_constraintBaseline_toBaselineOf="@+id/cbVentas"
  61 + app:layout_constraintEnd_toStartOf="@+id/cbVentas" />
65 62  
66 63 <com.google.android.material.checkbox.MaterialCheckBox
67 64 android:id="@+id/cbVentas"
68 65 android:layout_width="wrap_content"
69 66 android:layout_height="wrap_content"
70 67 android:layout_margin="5dp"
71   - android:text="Ventas"
72 68 android:checked="true"
  69 + android:text="Ventas"
  70 + android:layout_marginTop="12dp"
73 71 android:visibility="gone"
74 72 app:layout_constraintEnd_toStartOf="@+id/cbDeposito"
75 73 app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" />
... ... @@ -79,30 +77,44 @@
79 77 android:layout_width="wrap_content"
80 78 android:layout_height="wrap_content"
81 79 android:layout_margin="5dp"
82   - android:visibility="gone"
83   - android:text="Deposito"
84 80 android:checked="true"
  81 + android:text="Deposito"
  82 + android:layout_marginTop="12dp"
  83 + android:visibility="gone"
85 84 app:layout_constraintEnd_toEndOf="parent"
86 85 app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" />
87 86  
88   - <androidx.appcompat.widget.AppCompatTextView
89   - android:id="@+id/txtDeposito"
90   - android:layout_width="match_parent"
91   - android:layout_height="90dp"
92   - android:autoSizeMaxTextSize="150sp"
93   - android:autoSizeMinTextSize="25sp"
94   - android:autoSizeStepGranularity="5sp"
95   - android:autoSizeTextType="uniform"
96   - android:gravity="start"
97   - android:lines="1"
98   - android:padding="10dp"
99   - android:text="@string/invDinamicoCompra"
100   - android:textColor="@color/colorAccent"
101   - android:visibility="visible"
102   - app:fontFamily="sans-serif-condensed"
103   - app:layout_constraintBottom_toBottomOf="parent"
104   - app:layout_constraintEnd_toEndOf="parent"
105   - app:layout_constraintStart_toStartOf="parent"
106   - app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos"
107   - app:layout_constraintVertical_bias="0.0" />
  87 + <androidx.recyclerview.widget.RecyclerView
  88 + android:id="@+id/rcInventario"
  89 + android:layout_width="match_parent"
  90 + android:layout_height="0dp"
  91 + android:background="@android:color/darker_gray"
  92 + android:scrollbars="vertical"
  93 + android:visibility="gone"
  94 + app:layout_constraintEnd_toEndOf="parent"
  95 + app:layout_constraintStart_toStartOf="parent"
  96 + app:layout_constraintTop_toBottomOf="@id/ivSort19"
  97 + tools:listitem="@layout/item_principal" />
  98 +
  99 +
  100 + <androidx.appcompat.widget.AppCompatTextView
  101 + android:id="@+id/txtDeposito"
  102 + android:layout_width="match_parent"
  103 + android:layout_height="90dp"
  104 + android:autoSizeMaxTextSize="150sp"
  105 + android:autoSizeMinTextSize="25sp"
  106 + android:autoSizeStepGranularity="5sp"
  107 + android:autoSizeTextType="uniform"
  108 + android:gravity="start"
  109 + android:lines="1"
  110 + android:padding="10dp"
  111 + android:text="@string/invDinamicoCompra"
  112 + android:textColor="@color/colorAccent"
  113 + android:visibility="visible"
  114 + app:fontFamily="sans-serif-condensed"
  115 + app:layout_constraintBottom_toBottomOf="parent"
  116 + app:layout_constraintEnd_toEndOf="parent"
  117 + app:layout_constraintStart_toStartOf="parent"
  118 + app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos"
  119 + app:layout_constraintVertical_bias="0.0" />
108 120 </androidx.constraintlayout.widget.ConstraintLayout>
109 121 \ No newline at end of file
app/src/main/res/layout/item_principal.xml
... ... @@ -15,33 +15,14 @@
15 15 android:layout_gravity="center_horizontal|center_vertical"
16 16 android:orientation="vertical">
17 17  
18   -<!-- <androidx.appcompat.widget.AppCompatImageView-->
19   -<!-- android:id="@+id/ivCamara"-->
20   -<!-- android:layout_width="80dp"-->
21   -<!-- android:layout_height="80dp"-->
22   -<!-- android:layout_margin="10dp"-->
23   -<!-- android:layout_marginTop="15dp"-->
24   -<!-- android:background="@drawable/boton_redondo2"-->
25   -<!-- android:clickable="true"-->
26   -<!-- android:contentDescription="@string/ibBusCB"-->
27   -<!-- android:elevation="5dp"-->
28   -<!-- android:focusable="false"-->
29   -<!-- android:scaleType="fitEnd"-->
30   -<!-- -->
31   -<!-- app:layout_constraintBottom_toTopOf="@+id/ivFondo"-->
32   -<!-- app:layout_constraintCircleRadius="40dp"-->
33   -<!-- app:layout_constraintStart_toStartOf="parent"-->
34   -<!-- app:layout_constraintTop_toTopOf="parent"-->
35   -<!-- />-->
36   -
37 18 <TextView
38 19 android:id="@+id/tvPrincipalinventario"
39 20 android:layout_width="50dp"
40 21 android:layout_height="50dp"
41 22 android:layout_margin="10dp"
  23 + android:background="@drawable/boton_redondo2"
42 24 android:gravity="center"
43 25 android:lines="2"
44   - android:background="@drawable/boton_redondo2"
45 26 android:textColor="@android:color/black"
46 27 android:textSize="@dimen/TitulosMedios"
47 28 android:textStyle="bold"
... ... @@ -51,16 +32,69 @@
51 32 tools:text="99" />
52 33  
53 34 <TextView
  35 + android:id="@+id/textView6"
  36 + android:layout_width="wrap_content"
  37 + android:layout_height="wrap_content"
  38 + android:layout_marginTop="5dp"
  39 + android:text="Fecha Inicio"
  40 + android:textSize="15sp"
  41 + android:textStyle="bold"
  42 + app:layout_constraintEnd_toEndOf="parent"
  43 + app:layout_constraintHorizontal_bias="0.217"
  44 + app:layout_constraintStart_toEndOf="@id/tvPrincipalinventario"
  45 + app:layout_constraintTop_toTopOf="parent" />
  46 +
  47 + <TextView
  48 + android:id="@+id/tvFecha"
  49 + android:layout_width="wrap_content"
  50 + android:layout_height="wrap_content"
  51 + android:layout_marginStart="5dp"
  52 + android:text="01/01/2020 12:20:20"
  53 + android:textSize="15sp"
  54 + android:textStyle="bold"
  55 + app:layout_constraintBaseline_toBaselineOf="@+id/textView6"
  56 + app:layout_constraintEnd_toEndOf="parent"
  57 + app:layout_constraintHorizontal_bias="0.0"
  58 + app:layout_constraintStart_toEndOf="@id/textView6" />
  59 +
  60 + <TextView
  61 + android:id="@+id/textView7"
  62 + android:layout_width="wrap_content"
  63 + android:layout_height="wrap_content"
  64 + android:layout_marginTop="4dp"
  65 + android:text="Art. Contados"
  66 + android:textSize="15sp"
  67 + android:textStyle="bold"
  68 + app:layout_constraintEnd_toEndOf="parent"
  69 + app:layout_constraintHorizontal_bias="0.23"
  70 + app:layout_constraintStart_toEndOf="@+id/tvPrincipalinventario"
  71 + app:layout_constraintTop_toBottomOf="@id/textView6" />
  72 +
  73 + <TextView
  74 + android:id="@+id/tvCantContada"
  75 + android:layout_width="wrap_content"
  76 + android:layout_height="wrap_content"
  77 + android:layout_marginTop="4dp"
  78 + android:layout_marginStart="5dp"
  79 + android:text="002"
  80 + android:textSize="15sp"
  81 + android:textStyle="bold"
  82 + app:layout_constraintBaseline_toBaselineOf="@+id/textView7"
  83 + app:layout_constraintStart_toEndOf="@+id/textView7"
  84 + app:layout_constraintTop_toBottomOf="@+id/tvFecha" />
  85 +
  86 + <TextView
54 87 android:id="@+id/tvDescription"
55 88 android:layout_width="wrap_content"
56 89 android:layout_height="wrap_content"
57 90 android:text="prueba"
58 91 app:layout_constraintBottom_toTopOf="@id/ivFondo"
59 92 app:layout_constraintEnd_toEndOf="parent"
60   - app:layout_constraintHorizontal_bias="0.046"
  93 + app:layout_constraintHorizontal_bias="0.489"
61 94 app:layout_constraintStart_toEndOf="@id/tvPrincipalinventario"
62   - app:layout_constraintTop_toTopOf="parent"
63   - app:layout_constraintVertical_bias="0.607" />
  95 + app:layout_constraintTop_toBottomOf="@+id/tvFecha"
  96 + app:layout_constraintVertical_bias="1.0" />
  97 +
64 98  
65 99 <androidx.appcompat.widget.AppCompatImageView
66 100 android:id="@+id/ivFondo"
app/src/main/res/layout/login_dialog.xml
... ... @@ -45,22 +45,22 @@
45 45 android:id="@+id/tvNuevaCantidad"
46 46 android:layout_width="0dp"
47 47 android:layout_height="wrap_content"
  48 + android:autofillHints=""
48 49 android:hint=""
49 50 android:inputType="numberDecimal"
50 51 app:layout_constraintBaseline_toBaselineOf="@+id/tvgenerico"
51 52 app:layout_constraintEnd_toEndOf="parent"
52   - app:layout_constraintStart_toEndOf="@id/tvgenerico"
53   - android:autofillHints="" />
  53 + app:layout_constraintStart_toEndOf="@id/tvgenerico" />
54 54  
55 55 <TextView
56 56 android:id="@+id/tvgenerico2"
57 57 android:layout_width="wrap_content"
58 58 android:layout_height="wrap_content"
59 59 android:layout_margin="5dp"
60   - android:visibility="gone"
61 60 android:gravity="center"
62 61 android:text="@string/tvSeleccion"
63 62 android:textSize="20sp"
  63 + android:visibility="gone"
64 64 app:layout_constraintStart_toStartOf="parent"
65 65 app:layout_constraintTop_toBottomOf="@+id/tvgenerico" />
66 66  
... ... @@ -68,7 +68,6 @@
68 68 android:id="@+id/rgFechaHora"
69 69 android:layout_width="wrap_content"
70 70 android:layout_height="wrap_content"
71   - android:layout_margin="5dp"
72 71 android:gravity="start"
73 72 android:orientation="horizontal"
74 73 app:layout_constraintEnd_toEndOf="parent"
... ... @@ -82,29 +81,29 @@
82 81 android:layout_height="wrap_content"
83 82 android:layout_margin="5dp"
84 83 android:checked="false"
85   - android:padding="5dp"
  84 +
86 85 android:text="@string/rbSumar"
87 86 android:textSize="@dimen/text_size2" />
88 87  
89 88 <RadioButton
90   - android:id="@+id/rbRestar"
  89 + android:id="@+id/rbMdodificar"
91 90 android:layout_width="wrap_content"
92 91 android:layout_height="wrap_content"
93 92 android:layout_margin="5dp"
94 93 android:checked="false"
95   - android:padding="5dp"
96   - android:text="@string/rbRestar"
  94 + android:text="@string/rbModificar"
97 95 android:textSize="@dimen/text_size2" />
98 96  
99 97 <RadioButton
100   - android:id="@+id/rbMdodificar"
  98 + android:id="@+id/rbRestar"
101 99 android:layout_width="wrap_content"
102 100 android:layout_height="wrap_content"
103 101 android:layout_margin="5dp"
104 102 android:checked="false"
105 103 android:padding="5dp"
106   - android:text="@string/rbModificar"
  104 + android:text="@string/rbRestar"
107 105 android:textSize="@dimen/text_size2" />
  106 +
108 107 </RadioGroup>
109 108  
110 109 <TextView
... ... @@ -121,7 +120,7 @@
121 120 app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" />
122 121  
123 122 <TextView
124   - android:id="@+id/tvgenerico4"
  123 + android:id="@+id/tvResultado"
125 124 android:layout_width="wrap_content"
126 125 android:layout_height="wrap_content"
127 126 android:layout_margin="5dp"
... ... @@ -133,36 +132,36 @@
133 132 app:layout_constraintStart_toEndOf="@+id/tvgenerico3"
134 133 app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" />
135 134  
136   - <LinearLayout
137   - android:layout_width="match_parent"
  135 + <LinearLayout
  136 + android:layout_width="match_parent"
  137 + android:layout_height="wrap_content"
  138 + android:gravity="center"
  139 + android:orientation="horizontal"
  140 + app:layout_constraintEnd_toEndOf="parent"
  141 + app:layout_constraintStart_toStartOf="parent"
  142 + app:layout_constraintTop_toBottomOf="@+id/tvResultado">
  143 +
  144 + <Button
  145 + android:id="@+id/btnAceptar"
  146 + style="@style/Base.Widget.AppCompat.Button.Colored"
  147 + android:layout_width="wrap_content"
  148 + android:layout_height="wrap_content"
  149 + android:layout_margin="5dp"
  150 + android:background="@drawable/boton_borde_redondeado"
  151 + android:padding="20dp"
  152 + android:text="@string/btnOk"
  153 + android:textColor="@android:color/white" />
  154 +
  155 + <Button
  156 + android:id="@+id/dialogCancelBtn"
  157 + style="@style/Base.Widget.AppCompat.Button.Colored"
  158 + android:layout_width="wrap_content"
138 159 android:layout_height="wrap_content"
139   - android:orientation="horizontal"
140   - android:gravity="center"
141   - app:layout_constraintStart_toStartOf="parent"
142   - app:layout_constraintEnd_toEndOf="parent"
143   - app:layout_constraintTop_toBottomOf="@+id/tvgenerico4">
144   -
145   - <Button
146   - android:id="@+id/btnAceptar"
147   - style="@style/Base.Widget.AppCompat.Button.Colored"
148   - android:layout_width="wrap_content"
149   - android:textColor="@android:color/white"
150   - android:padding="20dp"
151   - android:background="@drawable/boton_borde_redondeado"
152   - android:layout_margin="5dp"
153   - android:layout_height="wrap_content"
154   - android:text="@string/btnOk" />
155   -
156   - <Button
157   - android:id="@+id/dialogCancelBtn"
158   - style="@style/Base.Widget.AppCompat.Button.Colored"
159   - android:textColor="@android:color/white"
160   - android:padding="20dp"
161   - android:background="@drawable/boton_borde_redondeado"
162   - android:layout_margin="5dp"
163   - android:layout_width="wrap_content"
164   - android:layout_height="wrap_content"
165   - android:text="@string/btnCancelar" />
166   - </LinearLayout>
  160 + android:layout_margin="5dp"
  161 + android:background="@drawable/boton_borde_redondeado"
  162 + android:padding="20dp"
  163 + android:text="@string/btnCancelar"
  164 + android:textColor="@android:color/white" />
  165 + </LinearLayout>
167 166  
168 167 </androidx.constraintlayout.widget.ConstraintLayout>
169 168 \ No newline at end of file
app/src/main/res/navigation/mobile_navigation.xml
... ... @@ -67,8 +67,7 @@
67 67 app:popExitAnim="@anim/slide_out_right"
68 68 app:enterAnim="@anim/slide_in_right"
69 69 app:exitAnim="@anim/slide_out_left"
70   - app:popUpTo="@+id/inventarioFragment"
71   - app:popUpToInclusive="true"/>
  70 + />
72 71 <action
73 72 android:id="@+id/action_inventarioFragment_to_mainFragment2"
74 73 app:destination="@id/mainFragment2"
... ... @@ -111,20 +110,19 @@
111 110 app:popExitAnim="@anim/slide_out_right"
112 111 app:enterAnim="@anim/slide_in_right"
113 112 app:exitAnim="@anim/slide_out_left"
114   - app:popUpTo="@+id/descripcionFragment"
115   - app:popUpToInclusive="true"/>
  113 + />
116 114 </fragment>
117 115 <dialog
118 116 android:id="@+id/dialogNoEncontrado"
119   - android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado"
  117 + android:name="com.focasoftware.deboinventariov20.ui.util.Base.dialogos.DialogNoEncontrado"
120 118 android:label="DialogNoEncontrado" />
121 119 <fragment
122 120 android:id="@+id/dialogoLogin"
123   - android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogoLogin"
  121 + android:name="com.focasoftware.deboinventariov20.ui.util.Base.dialogos.DialogoLogin"
124 122 android:label="dialogoLogin" />
125 123 <fragment
126 124 android:id="@+id/singleChoiceAlertDialog"
127   - android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog"
  125 + android:name="com.focasoftware.deboinventariov20.ui.util.Base.dialogos.SingleChoiceAlertDialog"
128 126 android:label="SingleChoiceAlertDialog" />
129 127  
130 128 <fragment
app/src/main/res/values/strings.xml
... ... @@ -121,7 +121,7 @@
121 121 <string name="rbRestar">Restar</string>
122 122 <string name="rbModificar">Reemplazar</string>
123 123 <string name="tvTotal">Cantidad Final</string>tvTotal
124   - <string name="tvResultado">Cantidad final:</string>tvTotal
  124 + <string name="tvResultado">Resultado:</string>tvTotal
125 125  
126 126 <string name="large_text">
127 127 "Material is the metaphor.\n\n"