Commit 6aec0e86d974d5b61f242fb9eb1280fc9ce3a16e
1 parent
10d0868ed8
Exists in
master
28022020 2304
Showing
18 changed files
with
618 additions
and
698 deletions
Show diff stats
app/build.gradle
| ... | ... | @@ -39,7 +39,7 @@ dependencies { |
| 39 | 39 | implementation 'androidx.appcompat:appcompat:1.2.0' |
| 40 | 40 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' |
| 41 | 41 | implementation 'com.google.android.material:material:1.2.0' |
| 42 | - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | |
| 42 | + implementation 'androidx.constraintlayout:constraintlayout:2.0.0' | |
| 43 | 43 | implementation 'androidx.navigation:navigation-fragment:2.3.0' |
| 44 | 44 | implementation 'androidx.navigation:navigation-ui:2.3.0' |
| 45 | 45 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' |
| ... | ... | @@ -66,7 +66,4 @@ dependencies { |
| 66 | 66 | implementation "com.google.code.gson:gson:2.8.6" |
| 67 | 67 | annotationProcessor 'androidx.room:room-compiler:2.2.5' |
| 68 | 68 | |
| 69 | - | |
| 70 | - implementation 'com.afollestad.material-dialogs:core:3.3.0' | |
| 71 | - implementation 'com.afollestad.material-dialogs:input:3.3.0' | |
| 72 | 69 | } |
| 73 | 70 | \ No newline at end of file |
app/src/main/AndroidManifest.xml
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | 3 | package="com.focasoftware.deboinventariov20"> |
| 4 | 4 | |
| 5 | + <uses-permission android:name="android.permission.WAKE_LOCK"/> | |
| 5 | 6 | <uses-permission android:name="android.permission.VIBRATE" /> |
| 6 | 7 | <uses-permission android:name="android.permission.INTERNET" /> |
| 7 | 8 |
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
| ... | ... | @@ -6,6 +6,7 @@ import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Compani |
| 6 | 6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H |
| 7 | 7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV |
| 8 | 8 | import com.focasoftware.deboinventariov20.Model.* |
| 9 | +import java.util.ArrayList | |
| 9 | 10 | |
| 10 | 11 | @Dao |
| 11 | 12 | interface ArticulosDAO { |
| ... | ... | @@ -45,7 +46,7 @@ interface InvHeadDAO { |
| 45 | 46 | suspend fun deleteinvHead(inven: Int) |
| 46 | 47 | |
| 47 | 48 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") |
| 48 | - suspend fun fetchAllInvHead(): List<InvHead> | |
| 49 | + suspend fun fetchAllInvHead(): ArrayList<InvHead> | |
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | @Dao |
app/src/main/java/com/focasoftware/deboinventariov20/Model/ProductosService.kt
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionFragment.kt
| ... | ... | @@ -7,7 +7,6 @@ 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.InputType | |
| 11 | 10 | import android.view.LayoutInflater |
| 12 | 11 | import android.view.View |
| 13 | 12 | import android.view.ViewGroup |
| ... | ... | @@ -20,8 +19,6 @@ import androidx.navigation.Navigation |
| 20 | 19 | import androidx.recyclerview.widget.ItemTouchHelper |
| 21 | 20 | import androidx.recyclerview.widget.LinearLayoutManager |
| 22 | 21 | import androidx.recyclerview.widget.RecyclerView |
| 23 | -import com.afollestad.materialdialogs.MaterialDialog | |
| 24 | -import com.afollestad.materialdialogs.input.input | |
| 25 | 22 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 26 | 23 | import com.focasoftware.deboinventariov20.Model.Articles |
| 27 | 24 | import com.focasoftware.deboinventariov20.Model.InvBody |
| ... | ... | @@ -97,22 +94,17 @@ class DescripcionFragment : Fragment() { |
| 97 | 94 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.codigo.toString(), |
| 98 | 95 | numeroInventario.toString()) |
| 99 | 96 | if (artCargadoEnBD == null) { |
| 100 | -// val type = InputType.TYPE_CLASS_NUMBER | |
| 101 | -// | |
| 102 | -// MaterialDialog(requireContext()).show { | |
| 103 | -// title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") | |
| 104 | -// message(R.string.sMensajeEncontrado) | |
| 105 | -// input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | |
| 106 | -// cantidad = 0F | |
| 107 | -// cantidad = charSequence.toString().toFloat() | |
| 108 | -// } | |
| 109 | -// positiveButton(R.string.btnOk) { | |
| 110 | 97 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) |
| 111 | 98 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) |
| 112 | - mDialogView.tvTitulo.text="Producto '${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}'." | |
| 99 | + mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}" | |
| 113 | 100 | val mAlertDialog = mBuilder.show() |
| 114 | 101 | mDialogView.btnAceptar.setOnClickListener { |
| 115 | - cantidad = mDialogView.etCantidad.text.toString().toFloat() | |
| 102 | + if (mDialogView.etCantidad.text.isNullOrEmpty()) { | |
| 103 | + mDialogView.etCantidad.error = "No vacio" | |
| 104 | + mDialogView.etCantidad.requestFocus() | |
| 105 | + mDialogView.etCantidad.hint = "Ingrese un valor" | |
| 106 | + } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | |
| 107 | + cantidad = mDialogView.etCantidad.text.toString().toFloat() | |
| 116 | 108 | val body = InvBody(numeroInventario, |
| 117 | 109 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, |
| 118 | 110 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD |
| ... | ... | @@ -129,11 +121,9 @@ class DescripcionFragment : Fragment() { |
| 129 | 121 | InventarioFragment().ObtenerFechaActual()) |
| 130 | 122 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
| 131 | 123 | VolverAinventario() |
| 132 | - mAlertDialog.dismiss() | |
| 133 | -// dismiss() | |
| 124 | + mAlertDialog.dismiss() | |
| 134 | 125 | } |
| 135 | -// }.cancelOnTouchOutside(false).cornerRadius(10F) | |
| 136 | - | |
| 126 | + } | |
| 137 | 127 | } else if (artCargadoEnBD != null) { |
| 138 | 128 | |
| 139 | 129 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| ... | ... | @@ -144,26 +134,36 @@ class DescripcionFragment : Fragment() { |
| 144 | 134 | mDialogView.rbSumar.setOnClickListener { |
| 145 | 135 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 146 | 136 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 137 | + mDialogView.tvNuevaCantidad.isEnabled=false | |
| 147 | 138 | } |
| 148 | 139 | } |
| 149 | 140 | mDialogView.rbRestar.setOnClickListener { |
| 150 | 141 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 151 | 142 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
| 152 | 143 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 144 | + mDialogView.tvNuevaCantidad.isEnabled=false | |
| 153 | 145 | } |
| 154 | 146 | } |
| 155 | 147 | } |
| 156 | 148 | mDialogView.rbMdodificar.setOnClickListener { |
| 157 | 149 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 158 | 150 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 151 | + mDialogView.tvNuevaCantidad.isEnabled=false | |
| 159 | 152 | } |
| 160 | 153 | } |
| 161 | 154 | mDialogView.btnAceptar.setOnClickListener { |
| 162 | - val name = mDialogView.tvgenerico4.text.toString().toFloat() | |
| 163 | - updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(), (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo | |
| 164 | - .toString(), name) | |
| 165 | - VolverAinventario() | |
| 166 | - mAlertDialog.dismiss() | |
| 155 | + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 156 | + val name = mDialogView.tvgenerico4.text.toString().toFloat() | |
| 157 | + updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(), | |
| 158 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo.toString(), | |
| 159 | + name) | |
| 160 | + VolverAinventario() | |
| 161 | + mAlertDialog.dismiss() | |
| 162 | + } else if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 163 | + mDialogView.tvNuevaCantidad.error = "No vacio" | |
| 164 | + mDialogView.tvNuevaCantidad.requestFocus() | |
| 165 | + mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | |
| 166 | + } | |
| 167 | 167 | } |
| 168 | 168 | mDialogView.dialogCancelBtn.setOnClickListener { |
| 169 | 169 | mAlertDialog.dismiss() |
| ... | ... | @@ -224,7 +224,7 @@ class DescripcionFragment : Fragment() { |
| 224 | 224 | lifecycleScope.launch { |
| 225 | 225 | withContext(Dispatchers.IO) { |
| 226 | 226 | val activity: FragmentActivity? = activity |
| 227 | - if(activity != null && isAdded){ | |
| 227 | + if (activity != null && isAdded) { | |
| 228 | 228 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) |
| 229 | 229 | } |
| 230 | 230 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InventarioFragment.kt
| 1 | 1 | package com.focasoftware.deboinventariov20.ui.inventario |
| 2 | 2 | |
| 3 | +import android.annotation.SuppressLint | |
| 3 | 4 | import android.app.AlertDialog |
| 4 | 5 | import android.content.Context |
| 6 | +import android.content.DialogInterface | |
| 5 | 7 | import android.content.SharedPreferences |
| 6 | 8 | import android.graphics.Canvas |
| 7 | 9 | import android.graphics.Color |
| ... | ... | @@ -23,13 +25,14 @@ import androidx.navigation.Navigation |
| 23 | 25 | import androidx.recyclerview.widget.ItemTouchHelper |
| 24 | 26 | import androidx.recyclerview.widget.LinearLayoutManager |
| 25 | 27 | import androidx.recyclerview.widget.RecyclerView |
| 26 | -import com.afollestad.materialdialogs.MaterialDialog | |
| 27 | 28 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 28 | 29 | import com.focasoftware.deboinventariov20.Model.Articles |
| 29 | 30 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 30 | 31 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 31 | 32 | import com.focasoftware.deboinventariov20.R |
| 32 | 33 | import com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado |
| 34 | +import com.focasoftware.deboinventariov20.ui.util.Base.AlertDialogBorrarInv | |
| 35 | +import com.focasoftware.deboinventariov20.ui.util.Base.NoEncontradoSimple | |
| 33 | 36 | import kotlinx.android.synthetic.main.fragment_inventario.* |
| 34 | 37 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| 35 | 38 | import kotlinx.android.synthetic.main.login_dialog.view.* |
| ... | ... | @@ -40,7 +43,7 @@ import java.time.format.DateTimeFormatter |
| 40 | 43 | import java.util.* |
| 41 | 44 | |
| 42 | 45 | |
| 43 | -class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { | |
| 46 | +class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener{ | |
| 44 | 47 | |
| 45 | 48 | private lateinit var sharedPreferences: SharedPreferences |
| 46 | 49 | private var iArea: Int = 0 |
| ... | ... | @@ -69,7 +72,6 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 69 | 72 | editor?.apply() |
| 70 | 73 | editor.commit() |
| 71 | 74 | } |
| 72 | - | |
| 73 | 75 | } |
| 74 | 76 | |
| 75 | 77 | |
| ... | ... | @@ -100,193 +102,212 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 100 | 102 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> |
| 101 | 103 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { |
| 102 | 104 | sChangeUpper = tCodigoBarras.text.toString() |
| 103 | - | |
| 104 | 105 | var indiceDelArtEncontrado = 0 |
| 105 | 106 | |
| 106 | - //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | |
| 107 | - when (iBusquedaPor) { | |
| 108 | - 0 -> { | |
| 109 | - indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | |
| 110 | - //TODO Si no lo encuentra devuelve -1 | |
| 111 | - if (indiceDelArtEncontrado != -1) { | |
| 112 | - if (swSumaUno!!.isChecked) { | |
| 113 | - fCant = 0F | |
| 114 | - fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 115 | - fCant += 1F | |
| 116 | - //TODO ACTUALIZO LA CANTIDAD EN LA BD | |
| 117 | - updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | |
| 118 | - //TODO ACTUALIZO LA CANTIDAD EN EL RV | |
| 119 | - listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 120 | - viewAdapter.notifyDataSetChanged() | |
| 121 | - } else { | |
| 122 | - val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | |
| 123 | - val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | |
| 124 | - .setCancelable(false) | |
| 125 | - mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | |
| 126 | - val mAlertDialog = mBuilder.show() | |
| 127 | - mDialogView.rbSumar.setOnClickListener { | |
| 128 | - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 129 | - mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 130 | - } | |
| 131 | - } | |
| 132 | - mDialogView.rbRestar.setOnClickListener { | |
| 133 | - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 134 | - if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
| 135 | - mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 107 | + if (tCodigoBarras.text.isNullOrBlank()) { | |
| 108 | + tCodigoBarras.error = "No puede estar vacio" | |
| 109 | + tCodigoBarras.requestFocus() | |
| 110 | + tCodigoBarras.hint = "No puede estar vacio" | |
| 111 | + } else { | |
| 112 | + | |
| 113 | + //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | |
| 114 | + when (iBusquedaPor) { | |
| 115 | + 0 -> { | |
| 116 | + GlobalScope.launch(Dispatchers.Main) { | |
| 117 | + indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | |
| 118 | + //TODO (Si no lo encuentra devuelve -1) | |
| 119 | + if (indiceDelArtEncontrado != -1) { | |
| 120 | + if (swSumaUno!!.isChecked) { | |
| 121 | +// fCant = 0F | |
| 122 | +// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 123 | +// fCant += 1F | |
| 124 | + //TODO ACTUALIZO LA CANTIDAD EN LA BD | |
| 125 | + updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), listArticulos[indiceDelArtEncontrado].cantTomada+1) | |
| 126 | + //TODO ACTUALIZO LA CANTIDAD EN EL RV | |
| 127 | + listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada+1 | |
| 128 | + viewAdapter.notifyDataSetChanged() | |
| 129 | + } else { | |
| 130 | + val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | |
| 131 | + val mBuilder = | |
| 132 | + AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | |
| 133 | +// .setCancelable(false) | |
| 134 | + mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | |
| 135 | + val mAlertDialog = mBuilder.show() | |
| 136 | + mDialogView.rbSumar.setOnClickListener { | |
| 137 | + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 138 | + mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 139 | + mDialogView.tvNuevaCantidad.isEnabled=false | |
| 140 | + } | |
| 141 | + } | |
| 142 | + mDialogView.rbRestar.setOnClickListener { | |
| 143 | + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 144 | + if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
| 145 | + mDialogView.tvgenerico4.text = | |
| 146 | + (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 147 | + mDialogView.tvNuevaCantidad.isEnabled=false | |
| 148 | + } | |
| 149 | + } | |
| 150 | + } | |
| 151 | + mDialogView.rbMdodificar.setOnClickListener { | |
| 152 | + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 153 | + mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 154 | + mDialogView.tvNuevaCantidad.isEnabled=false | |
| 155 | + } | |
| 156 | + } | |
| 157 | + mDialogView.btnAceptar.setOnClickListener { | |
| 158 | + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 159 | + mAlertDialog.dismiss() | |
| 160 | +// val name = mDialogView.tvgenerico4.text.toString().toFloat() | |
| 161 | +// fCant = 0F | |
| 162 | +// fCant = name | |
| 163 | + listArticulos[indiceDelArtEncontrado].cantTomada = mDialogView.tvgenerico4.text.toString().toFloat() | |
| 164 | + updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), mDialogView.tvgenerico4.text.toString().toFloat()) | |
| 165 | + viewAdapter.notifyDataSetChanged() | |
| 166 | + } else if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 167 | + mDialogView.tvNuevaCantidad.error = "No vacio" | |
| 168 | + mDialogView.tvNuevaCantidad.requestFocus() | |
| 169 | + mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | |
| 170 | + } | |
| 171 | + } | |
| 172 | + mDialogView.dialogCancelBtn.setOnClickListener { | |
| 173 | + mAlertDialog.dismiss() | |
| 136 | 174 | } |
| 137 | 175 | } |
| 176 | + | |
| 177 | + } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | |
| 178 | + | |
| 179 | + | |
| 180 | + //TODO BUSCO EN BASE DE DATOS | |
| 181 | + val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | |
| 182 | + ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | |
| 138 | 183 | } |
| 139 | - mDialogView.rbMdodificar.setOnClickListener { | |
| 140 | - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 141 | - mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 142 | - } | |
| 143 | - } | |
| 144 | - mDialogView.btnAceptar.setOnClickListener { | |
| 145 | - mAlertDialog.dismiss() | |
| 146 | - val name = mDialogView.tvgenerico4.text.toString().toFloat() | |
| 147 | - fCant = 0F | |
| 148 | - fCant = name | |
| 149 | - listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 150 | - updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | |
| 151 | - viewAdapter.notifyDataSetChanged() | |
| 152 | - } | |
| 153 | - mDialogView.dialogCancelBtn.setOnClickListener { | |
| 154 | - mAlertDialog.dismiss() | |
| 155 | - } | |
| 156 | - } | |
| 157 | 184 | |
| 158 | - } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | |
| 159 | 185 | |
| 160 | - GlobalScope.launch(Dispatchers.Main) { | |
| 161 | - //TODO BUSCO EN BASE DE DATOS | |
| 162 | - val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | |
| 163 | - ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | |
| 186 | + tCodigoBarras.focusable = View.FOCUSABLE | |
| 187 | + tCodigoBarras.setText("") | |
| 188 | + tCodigoBarras.selectAll() | |
| 164 | 189 | } |
| 165 | - } | |
| 166 | - | |
| 167 | - tCodigoBarras.focusable = View.FOCUSABLE | |
| 168 | - tCodigoBarras.setText("") | |
| 169 | - tCodigoBarras.selectAll() | |
| 170 | - return@setOnKeyListener true | |
| 190 | + return@setOnKeyListener true | |
| 171 | 191 | |
| 172 | 192 | |
| 173 | - } | |
| 174 | - 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | |
| 175 | - // | |
| 176 | - // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | |
| 177 | - // //TODO Si no lo encuentra devuelve -1 | |
| 178 | - // if (indiceDelArtEncontrado != -1) { | |
| 179 | - //// if (swSumaUno!!.isChecked) { | |
| 180 | - //// fCant = 0F | |
| 181 | - //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 182 | - //// fCant += 1F | |
| 183 | - //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 184 | - //// viewAdapter.notifyDataSetChanged() | |
| 185 | - //// } else { | |
| 186 | - // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 187 | - // MaterialDialog(requireContext()).show { | |
| 188 | - // title(R.string.sTituloNueva) | |
| 189 | - // message(R.string.sCantidadNueva) | |
| 190 | - // input { materialDialog, charSequence -> | |
| 191 | - // fCant = 0F | |
| 192 | - // fCant = charSequence.toString().toFloat() | |
| 193 | - // } | |
| 194 | - // positiveButton(R.string.btnOk) { | |
| 195 | - // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 196 | - // viewAdapter.notifyDataSetChanged() | |
| 197 | - // dismiss() | |
| 198 | - // } | |
| 199 | - // }.cancelOnTouchOutside(false).cornerRadius(10F) | |
| 200 | - //// } | |
| 201 | - // | |
| 202 | - // } else if | |
| 203 | - // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | |
| 204 | - GlobalScope.launch(Dispatchers.Main) { | |
| 205 | - val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | |
| 206 | - ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | |
| 207 | 193 | } |
| 208 | - // } | |
| 194 | + 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | |
| 195 | + // | |
| 196 | + // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | |
| 197 | + // //TODO Si no lo encuentra devuelve -1 | |
| 198 | + // if (indiceDelArtEncontrado != -1) { | |
| 199 | + //// if (swSumaUno!!.isChecked) { | |
| 200 | + //// fCant = 0F | |
| 201 | + //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 202 | + //// fCant += 1F | |
| 203 | + //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 204 | + //// viewAdapter.notifyDataSetChanged() | |
| 205 | + //// } else { | |
| 206 | + // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 207 | + // MaterialDialog(requireContext()).show { | |
| 208 | + // title(R.string.sTituloNueva) | |
| 209 | + // message(R.string.sCantidadNueva) | |
| 210 | + // input { materialDialog, charSequence -> | |
| 211 | + // fCant = 0F | |
| 212 | + // fCant = charSequence.toString().toFloat() | |
| 213 | + // } | |
| 214 | + // positiveButton(R.string.btnOk) { | |
| 215 | + // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 216 | + // viewAdapter.notifyDataSetChanged() | |
| 217 | + // dismiss() | |
| 218 | + // } | |
| 219 | + // }.cancelOnTouchOutside(false).cornerRadius(10F) | |
| 220 | + //// } | |
| 221 | + // | |
| 222 | + // } else if | |
| 223 | + // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | |
| 224 | + GlobalScope.launch(Dispatchers.Main) { | |
| 225 | + val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | |
| 226 | + ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | |
| 227 | + } | |
| 228 | + // } | |
| 209 | 229 | |
| 210 | - return@setOnKeyListener true | |
| 211 | - } | |
| 212 | - 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | |
| 213 | - indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice | |
| 214 | - //TODO Si no lo encuentra devuelve -1 | |
| 215 | - if (indiceDelArtEncontrado != -1) { | |
| 216 | - if (swSumaUno!!.isChecked) { | |
| 217 | - fCant = 0F | |
| 218 | - fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 219 | - fCant += 1F | |
| 220 | - //TODO ACTUALIZO LA CANTIDAD EN LA BD | |
| 221 | - updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | |
| 222 | - //TODO ACTUALIZO LA CANTIDAD EN EL RV | |
| 223 | - listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 224 | - viewAdapter.notifyDataSetChanged() | |
| 225 | - } else { | |
| 226 | - val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | |
| 227 | - val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | |
| 228 | - .setCancelable(false) | |
| 229 | - mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | |
| 230 | - val mAlertDialog = mBuilder.show() | |
| 231 | - mDialogView.rbSumar.setOnClickListener { | |
| 232 | - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 233 | - mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 234 | - } | |
| 235 | - } | |
| 236 | - mDialogView.rbRestar.setOnClickListener { | |
| 237 | - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 238 | - if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
| 239 | - mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 240 | - } | |
| 241 | - } | |
| 242 | - } | |
| 243 | - mDialogView.rbMdodificar.setOnClickListener { | |
| 244 | - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 245 | - mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 246 | - } | |
| 247 | - } | |
| 248 | - mDialogView.btnAceptar.setOnClickListener { | |
| 249 | - mAlertDialog.dismiss() | |
| 250 | - val name = mDialogView.tvgenerico4.text.toString().toFloat() | |
| 251 | - fCant = 0F | |
| 252 | - fCant = name | |
| 253 | - listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 254 | - updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | |
| 255 | - viewAdapter.notifyDataSetChanged() | |
| 256 | - } | |
| 257 | - mDialogView.dialogCancelBtn.setOnClickListener { | |
| 258 | - mAlertDialog.dismiss() | |
| 259 | - } | |
| 260 | -// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 261 | -// val type = InputType.TYPE_CLASS_NUMBER | |
| 262 | -// MaterialDialog(requireContext()).show { | |
| 263 | -// | |
| 264 | -// title(text = "Producto '$sChangeUpper', se encuentra cargado.") | |
| 265 | -// message(R.string.sCantidadNueva) | |
| 266 | -// input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | |
| 267 | -// fCant = 0F | |
| 268 | -// fCant = charSequence.toString().toFloat() | |
| 230 | + return@setOnKeyListener true | |
| 231 | + } | |
| 232 | +// 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | |
| 233 | +// indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice | |
| 234 | +// //TODO Si no lo encuentra devuelve -1 | |
| 235 | +// if (indiceDelArtEncontrado != -1) { | |
| 236 | +// if (swSumaUno!!.isChecked) { | |
| 237 | +// fCant = 0F | |
| 238 | +// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 239 | +// fCant += 1F | |
| 240 | +// //TODO ACTUALIZO LA CANTIDAD EN LA BD | |
| 241 | +// updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | |
| 242 | +// //TODO ACTUALIZO LA CANTIDAD EN EL RV | |
| 243 | +// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 244 | +// viewAdapter.notifyDataSetChanged() | |
| 245 | +// } else { | |
| 246 | +// val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | |
| 247 | +// val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | |
| 248 | +// .setCancelable(false) | |
| 249 | +// mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | |
| 250 | +// val mAlertDialog = mBuilder.show() | |
| 251 | +// mDialogView.rbSumar.setOnClickListener { | |
| 252 | +// if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 253 | +// mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 254 | +// } | |
| 269 | 255 | // } |
| 270 | -// positiveButton(R.string.btnOk) { | |
| 271 | -// //TODO ACTUALIZO CANTIADAD EN BD | |
| 272 | -// updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | |
| 273 | -// //TODO ACTUALIZO CANTIDAD EN RV | |
| 256 | +// mDialogView.rbRestar.setOnClickListener { | |
| 257 | +// if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 258 | +// if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
| 259 | +// mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 260 | +// } | |
| 261 | +// } | |
| 262 | +// } | |
| 263 | +// mDialogView.rbMdodificar.setOnClickListener { | |
| 264 | +// if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 265 | +// mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
| 266 | +// } | |
| 267 | +// } | |
| 268 | +// mDialogView.btnAceptar.setOnClickListener { | |
| 269 | +// mAlertDialog.dismiss() | |
| 270 | +// val name = mDialogView.tvgenerico4.text.toString().toFloat() | |
| 271 | +// fCant = 0F | |
| 272 | +// fCant = name | |
| 274 | 273 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 274 | +// updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | |
| 275 | 275 | // viewAdapter.notifyDataSetChanged() |
| 276 | -// dismiss() | |
| 277 | 276 | // } |
| 278 | -// }.cancelOnTouchOutside(false).cornerRadius(10F) | |
| 279 | - } | |
| 280 | - } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | |
| 281 | - | |
| 282 | - GlobalScope.launch(Dispatchers.Main) { | |
| 283 | - //TODO BUSCO EN BASE DE DATOS | |
| 284 | - listArticulos[indiceDelArtEncontrado].cantTomada | |
| 285 | - val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | |
| 286 | - ContinuarCargaCB(artEncontrado) | |
| 287 | - } | |
| 288 | - } | |
| 289 | - return@setOnKeyListener true | |
| 277 | +// mDialogView.dialogCancelBtn.setOnClickListener { | |
| 278 | +// mAlertDialog.dismiss() | |
| 279 | +// } | |
| 280 | +//// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
| 281 | +//// val type = InputType.TYPE_CLASS_NUMBER | |
| 282 | +//// MaterialDialog(requireContext()).show { | |
| 283 | +//// | |
| 284 | +//// title(text = "Producto '$sChangeUpper', se encuentra cargado.") | |
| 285 | +//// message(R.string.sCantidadNueva) | |
| 286 | +//// input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | |
| 287 | +//// fCant = 0F | |
| 288 | +//// fCant = charSequence.toString().toFloat() | |
| 289 | +//// } | |
| 290 | +//// positiveButton(R.string.btnOk) { | |
| 291 | +//// //TODO ACTUALIZO CANTIADAD EN BD | |
| 292 | +//// updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | |
| 293 | +//// //TODO ACTUALIZO CANTIDAD EN RV | |
| 294 | +//// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
| 295 | +//// viewAdapter.notifyDataSetChanged() | |
| 296 | +//// dismiss() | |
| 297 | +//// } | |
| 298 | +//// }.cancelOnTouchOutside(false).cornerRadius(10F) | |
| 299 | +// } | |
| 300 | +// } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | |
| 301 | +// | |
| 302 | +// GlobalScope.launch(Dispatchers.Main) { | |
| 303 | +// //TODO BUSCO EN BASE DE DATOS | |
| 304 | +// listArticulos[indiceDelArtEncontrado].cantTomada | |
| 305 | +// val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | |
| 306 | +// ContinuarCargaCB(artEncontrado) | |
| 307 | +// } | |
| 308 | +// } | |
| 309 | +// return@setOnKeyListener true | |
| 310 | +// } | |
| 290 | 311 | } |
| 291 | 312 | } |
| 292 | 313 | } |
| ... | ... | @@ -299,39 +320,76 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 299 | 320 | super.onViewCreated(view, savedInstanceState) |
| 300 | 321 | navController = Navigation.findNavController(view) |
| 301 | 322 | etCodigoBarras.requestFocus() |
| 323 | + val modalDialog = NoEncontradoSimple() | |
| 324 | + modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | |
| 302 | 325 | |
| 303 | 326 | btnBorrarInv.setOnClickListener { |
| 304 | - MaterialDialog(requireContext()).show { | |
| 305 | - title(R.string.sTituloBorrarInv) | |
| 306 | - message(R.string.sMensajeBorrarInv) | |
| 307 | - positiveButton(R.string.btnOk) { | |
| 327 | + AlertDialog.Builder(requireContext()) | |
| 328 | + .setTitle("Eliminación de Inventarios") | |
| 329 | + .setMessage("¿Confirma que desea eliminar el inventario?") | |
| 330 | + .setPositiveButton(R.string.btnOk, | |
| 331 | + DialogInterface.OnClickListener { dialog, which -> | |
| 308 | 332 | BorrarInvActual() |
| 309 | 333 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() |
| 310 | 334 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
| 311 | 335 | InventarioNuevo = 0 |
| 312 | - dismiss() | |
| 313 | - } | |
| 314 | - negativeButton { | |
| 315 | - dismiss() | |
| 316 | - } | |
| 317 | - }.cancelOnTouchOutside(false).cornerRadius(10F) | |
| 336 | + | |
| 337 | + }) | |
| 338 | + .setNegativeButton(R.string.btnCancelar, | |
| 339 | + DialogInterface.OnClickListener { dialog, which -> | |
| 340 | + //botón cancel pulsado | |
| 341 | + }) | |
| 342 | + .show() | |
| 343 | + | |
| 344 | + | |
| 345 | +// MaterialDialog(requireContext()).show { | |
| 346 | +// title(R.string.sTituloBorrarInv) | |
| 347 | +// message(R.string.sMensajeBorrarInv) | |
| 348 | +// positiveButton(R.string.btnOk) { | |
| 349 | +// BorrarInvActual() | |
| 350 | +// Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | |
| 351 | +// navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | |
| 352 | +// InventarioNuevo = 0 | |
| 353 | +// dismiss() | |
| 354 | +// } | |
| 355 | +// negativeButton { | |
| 356 | +// dismiss() | |
| 357 | +// } | |
| 358 | +// }.cancelOnTouchOutside(false).cornerRadius(10F) | |
| 318 | 359 | } |
| 319 | 360 | |
| 320 | 361 | btnExportarInv.setOnClickListener { |
| 321 | - MaterialDialog(requireContext()).show { | |
| 322 | - title(R.string.sTituloExportar) | |
| 323 | - message(R.string.sMensajeExportar) | |
| 324 | - positiveButton(R.string.btnOk) { | |
| 325 | - BorrarInvActual() | |
| 326 | - Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | |
| 327 | - navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | |
| 328 | - InventarioNuevo = 0 | |
| 329 | - dismiss() | |
| 330 | - } | |
| 331 | - negativeButton { | |
| 332 | - dismiss() | |
| 333 | - } | |
| 334 | - }.cancelOnTouchOutside(false).cornerRadius(10F) | |
| 362 | + AlertDialog.Builder(requireContext()) | |
| 363 | + .setTitle(R.string.sTituloExportar) | |
| 364 | + .setMessage(R.string.sMensajeExportar) | |
| 365 | + .setPositiveButton(R.string.btnOk, | |
| 366 | + DialogInterface.OnClickListener { dialog, which -> | |
| 367 | + BorrarInvActual() | |
| 368 | + Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | |
| 369 | + navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | |
| 370 | + InventarioNuevo = 0 | |
| 371 | + | |
| 372 | + }) | |
| 373 | + .setNegativeButton(R.string.btnCancelar, | |
| 374 | + DialogInterface.OnClickListener { dialog, which -> | |
| 375 | + //botón cancel pulsado | |
| 376 | + }) | |
| 377 | + .show() | |
| 378 | + | |
| 379 | +// MaterialDialog(requireContext()).show { | |
| 380 | +// title(R.string.sTituloExportar) | |
| 381 | +// message(R.string.sMensajeExportar) | |
| 382 | +// positiveButton(R.string.btnOk) { | |
| 383 | +// BorrarInvActual() | |
| 384 | +// Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | |
| 385 | +// navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | |
| 386 | +// InventarioNuevo = 0 | |
| 387 | +// dismiss() | |
| 388 | +// } | |
| 389 | +// negativeButton { | |
| 390 | +// dismiss() | |
| 391 | +// } | |
| 392 | +// }.cancelOnTouchOutside(false).cornerRadius(10F) | |
| 335 | 393 | } |
| 336 | 394 | ivCamara.setOnClickListener { |
| 337 | 395 | if (!bFirst) { |
| ... | ... | @@ -397,6 +455,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 397 | 455 | |
| 398 | 456 | } |
| 399 | 457 | |
| 458 | + @SuppressLint("RestrictedApi") | |
| 400 | 459 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { |
| 401 | 460 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS |
| 402 | 461 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV |
| ... | ... | @@ -428,6 +487,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 428 | 487 | bundle = bundleOf("ArrayDesc" to artAcargar) |
| 429 | 488 | bundle.putInt("numeroInv", InventarioNuevo) |
| 430 | 489 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
| 490 | + //navController.backStack.removeLast() | |
| 431 | 491 | } |
| 432 | 492 | // } else {//SI NO ESTA +1 |
| 433 | 493 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
| ... | ... | @@ -496,25 +556,34 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 496 | 556 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD |
| 497 | 557 | |
| 498 | 558 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) |
| 499 | - val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | |
| 500 | - mDialogView.tvTitulo.text="Producto '${artAcargar.descripcion.toString()}'." | |
| 559 | + val mBuilder = AlertDialog.Builder(context).setView(mDialogView) | |
| 560 | + .setCancelable(false) | |
| 561 | + mDialogView.tvTitulo.text = "${artAcargar.descripcion.toString()}" | |
| 501 | 562 | val mAlertDialog = mBuilder.show() |
| 502 | 563 | mDialogView.btnAceptar.setOnClickListener { |
| 503 | - mAlertDialog.dismiss() | |
| 504 | - fCant = 0F | |
| 505 | - fCant = mDialogView.etCantidad.text.toString().toFloat() | |
| 506 | - cargarArtEnBd(artAcargar, fCant) | |
| 507 | - cargarRecicler(artAcargar, fCant) | |
| 564 | + if (mDialogView.etCantidad.text.isNullOrEmpty()) { | |
| 565 | + mDialogView.etCantidad.error = "No vacio" | |
| 566 | + mDialogView.etCantidad.requestFocus() | |
| 567 | + mDialogView.etCantidad.hint = "Ingrese un valor" | |
| 568 | + } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | |
| 569 | + mAlertDialog.dismiss() | |
| 570 | +// fCant = 0F | |
| 571 | +// fCant = mDialogView.etCantidad.text.toString().toFloat() | |
| 572 | + cargarArtEnBd(artAcargar, mDialogView.etCantidad.text.toString().toFloat()) | |
| 573 | + cargarRecicler(artAcargar, mDialogView.etCantidad.text.toString().toFloat()) | |
| 574 | + } | |
| 508 | 575 | } |
| 509 | 576 | } |
| 510 | 577 | } else {// TODO si no lo encuentra en la BD |
| 511 | - | |
| 512 | - MaterialDialog(requireContext()).show { | |
| 513 | - title(text = "El producto: $sChangeUpper") | |
| 514 | - message(text = "¡No fue encontrado!") | |
| 515 | - positiveButton(R.string.btnOk) {} | |
| 516 | - dismiss() | |
| 517 | - } | |
| 578 | + val modalDialog = NoEncontradoSimple() | |
| 579 | + modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | |
| 580 | +// MaterialDialog(requireContext()).show { | |
| 581 | +// | |
| 582 | +// title(text = "El producto: $sChangeUpper") | |
| 583 | +// message(text = "¡No fue encontrado!") | |
| 584 | +// positiveButton(R.string.btnOk) {} | |
| 585 | +// dismiss() | |
| 586 | +// } | |
| 518 | 587 | } |
| 519 | 588 | etCodigoBarras.focusable = View.FOCUSABLE |
| 520 | 589 | etCodigoBarras.setText("") |
| ... | ... | @@ -548,36 +617,52 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 548 | 617 | }.await() |
| 549 | 618 | } |
| 550 | 619 | |
| 551 | - private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | |
| 552 | - var indice = 0 | |
| 553 | - var bEncontrado = false | |
| 554 | - if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | |
| 555 | - for (item in listArticulos) { | |
| 556 | - if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | |
| 557 | - bEncontrado = true | |
| 558 | - break | |
| 620 | + private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | |
| 621 | + | |
| 622 | + return GlobalScope.async(Dispatchers.IO) { | |
| 623 | + var indice = 0 | |
| 624 | + var bEncontrado = false | |
| 625 | + if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | |
| 626 | + // TODO CAMBIO DE CB A CODIGO DEBO | |
| 627 | + val any = cambioCBporCodigoDebo(codigoBarras) | |
| 628 | + if (any != null) { | |
| 629 | + for (item in listArticulos) { | |
| 630 | + if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { | |
| 631 | + bEncontrado = true | |
| 632 | + break | |
| 633 | + } | |
| 634 | + indice += 1 | |
| 635 | + } | |
| 559 | 636 | } |
| 560 | - indice += 1 | |
| 561 | - } | |
| 562 | - } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | |
| 563 | - for (item in listArticulos) { | |
| 564 | - if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | |
| 565 | - bEncontrado = true | |
| 566 | - break | |
| 637 | + | |
| 638 | + } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | |
| 639 | + for (item in listArticulos) { | |
| 640 | + if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | |
| 641 | + bEncontrado = true | |
| 642 | + break | |
| 643 | + } | |
| 644 | + indice += 1 | |
| 567 | 645 | } |
| 568 | - indice += 1 | |
| 569 | - } | |
| 570 | - } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | |
| 571 | - for (item in listArticulos) { | |
| 572 | - if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | |
| 573 | - bEncontrado = true | |
| 574 | - break | |
| 646 | + } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | |
| 647 | + for (item in listArticulos) { | |
| 648 | + if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | |
| 649 | + bEncontrado = true | |
| 650 | + break | |
| 651 | + } | |
| 652 | + indice += 1 | |
| 575 | 653 | } |
| 576 | - indice += 1 | |
| 577 | 654 | } |
| 578 | - } | |
| 579 | - return if (bEncontrado) indice | |
| 580 | - else -1 | |
| 655 | + return@async if (bEncontrado) indice else -1 | |
| 656 | + }.await() | |
| 657 | + } | |
| 658 | + | |
| 659 | + suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { | |
| 660 | + //TODO BUSQUEDA POR DESCRIPCION | |
| 661 | + var busqueda: Articles? = null | |
| 662 | + return GlobalScope.async(Dispatchers.IO) { | |
| 663 | + busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, iArea) | |
| 664 | + return@async busqueda | |
| 665 | + }.await() | |
| 581 | 666 | } |
| 582 | 667 | |
| 583 | 668 | private fun cargarArtEnBd(articulos: Articles, cant: Float) { |
| ... | ... | @@ -660,7 +745,6 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 660 | 745 | } |
| 661 | 746 | |
| 662 | 747 | private fun SerchArea() { |
| 663 | - | |
| 664 | 748 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 |
| 665 | 749 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 |
| 666 | 750 | } |
| ... | ... | @@ -706,40 +790,49 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 706 | 790 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { |
| 707 | 791 | |
| 708 | 792 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| 709 | - val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[position.toInt()].descripcion}'.").setCancelable(false) | |
| 793 | + val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("${listArticulos[position.toInt()].descripcion}") | |
| 794 | +// .setCancelable(false) | |
| 710 | 795 | mDialogView.tvCantInicial.text = cantidad |
| 711 | 796 | val mAlertDialog = mBuilder.show() |
| 712 | 797 | mDialogView.rbSumar.setOnClickListener { |
| 713 | 798 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 714 | 799 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 800 | + mDialogView.tvNuevaCantidad.isEnabled=false | |
| 715 | 801 | } |
| 716 | 802 | } |
| 717 | 803 | mDialogView.rbRestar.setOnClickListener { |
| 718 | 804 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 719 | 805 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
| 720 | 806 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 807 | + mDialogView.tvNuevaCantidad.isEnabled=false | |
| 721 | 808 | } |
| 722 | 809 | } |
| 723 | 810 | } |
| 724 | 811 | mDialogView.rbMdodificar.setOnClickListener { |
| 725 | 812 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 726 | 813 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 814 | + mDialogView.tvNuevaCantidad.isEnabled=false | |
| 727 | 815 | } |
| 728 | 816 | } |
| 729 | 817 | mDialogView.btnAceptar.setOnClickListener { |
| 730 | - mAlertDialog.dismiss() | |
| 731 | - val name = mDialogView.tvgenerico4.text.toString().toFloat() | |
| 732 | - fCant = 0F | |
| 733 | - fCant = name | |
| 734 | - listArticulos[position.toInt()].cantTomada = fCant | |
| 735 | - updateCantidad(listArticulos[position.toInt()].sector.toString(), listArticulos[position.toInt()].codigo.toString(), fCant) | |
| 736 | - viewAdapter.notifyDataSetChanged() | |
| 818 | + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 819 | + mAlertDialog.dismiss() | |
| 820 | + val name = mDialogView.tvgenerico4.text.toString().toFloat() | |
| 821 | + fCant = 0F | |
| 822 | + fCant = name | |
| 823 | + listArticulos[position.toInt()].cantTomada = fCant | |
| 824 | + updateCantidad(listArticulos[position.toInt()].sector.toString(), listArticulos[position.toInt()].codigo.toString(), fCant) | |
| 825 | + viewAdapter.notifyDataSetChanged() | |
| 826 | + } else if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 827 | + mDialogView.tvNuevaCantidad.error = "No vacio" | |
| 828 | + mDialogView.tvNuevaCantidad.requestFocus() | |
| 829 | + mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | |
| 830 | + } | |
| 737 | 831 | } |
| 738 | 832 | mDialogView.dialogCancelBtn.setOnClickListener { |
| 739 | 833 | mAlertDialog.dismiss() |
| 740 | 834 | } |
| 741 | 835 | } |
| 742 | - | |
| 743 | 836 | } |
| 744 | 837 | |
| 745 | 838 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/InventarioListAdapter.kt
| ... | ... | @@ -5,11 +5,12 @@ import android.view.LayoutInflater |
| 5 | 5 | import android.view.View |
| 6 | 6 | import android.view.ViewGroup |
| 7 | 7 | import androidx.recyclerview.widget.RecyclerView |
| 8 | +import com.focasoftware.deboinventariov20.Model.InvHead | |
| 8 | 9 | import com.focasoftware.deboinventariov20.R |
| 9 | 10 | import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder |
| 10 | 11 | import kotlinx.android.synthetic.main.item_principal.view.* |
| 11 | 12 | |
| 12 | -class InventarioListAdapter(private val context: Context, private val inv: ArrayList<ItemInventario>, private val itemClickListener: OnInventarioClickListener) : | |
| 13 | +class InventarioListAdapter(private val context: Context, private val inv: ArrayList<InvHead>, private val itemClickListener: OnInventarioClickListener) : | |
| 13 | 14 | RecyclerView.Adapter<BaseViewHolder<*>>() { |
| 14 | 15 | |
| 15 | 16 | interface OnInventarioClickListener { |
| ... | ... | @@ -21,10 +22,10 @@ class InventarioListAdapter(private val context: Context, private val inv: Array |
| 21 | 22 | override fun getItemCount() = inv.size |
| 22 | 23 | |
| 23 | 24 | |
| 24 | - inner class ItemsViewHolder(itemView: View) : BaseViewHolder<ItemInventario>(itemView) { | |
| 25 | - override fun bind(item: ItemInventario, position: Int) { | |
| 26 | - itemView.setOnClickListener {itemClickListener.onItemClick(item.inventario)} | |
| 27 | - itemView.tvPrincipalinventario.text = item.inventario | |
| 25 | + inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { | |
| 26 | + override fun bind(item: InvHead, position: Int) { | |
| 27 | + itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} | |
| 28 | + itemView.tvPrincipalinventario.text = item.invNum.toString() | |
| 28 | 29 | } |
| 29 | 30 | } |
| 30 | 31 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/MainFragment.kt
| ... | ... | @@ -6,6 +6,10 @@ import android.os.Bundle |
| 6 | 6 | import android.view.LayoutInflater |
| 7 | 7 | import android.view.View |
| 8 | 8 | import android.view.ViewGroup |
| 9 | +import android.widget.CheckBox | |
| 10 | +import android.widget.ImageView | |
| 11 | +import android.widget.LinearLayout | |
| 12 | +import android.widget.TextView | |
| 9 | 13 | import androidx.fragment.app.Fragment |
| 10 | 14 | import androidx.navigation.NavController |
| 11 | 15 | import androidx.navigation.Navigation |
| ... | ... | @@ -21,23 +25,33 @@ import kotlinx.coroutines.launch |
| 21 | 25 | import java.util.* |
| 22 | 26 | |
| 23 | 27 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { |
| 24 | - private lateinit var inventarios: List<InvHead> | |
| 28 | + private lateinit var inventarios: ArrayList<InvHead> | |
| 29 | + private lateinit var ordenado: ArrayList<InvHead> | |
| 25 | 30 | private lateinit var rcInventario: RecyclerView |
| 26 | 31 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
| 27 | 32 | private lateinit var viewManager: RecyclerView.LayoutManager |
| 28 | - private var listIvn = ArrayList<ItemInventario>() | |
| 33 | + private var listIvn = ArrayList<InvHead>() | |
| 29 | 34 | private lateinit var navController: NavController |
| 30 | 35 | private lateinit var sharedPreferences: SharedPreferences |
| 36 | + private var cantidadInventarios: Int = 0 | |
| 31 | 37 | |
| 32 | 38 | override fun onCreate(savedInstanceState: Bundle?) { |
| 33 | 39 | super.onCreate(savedInstanceState) |
| 34 | 40 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 35 | - | |
| 36 | - | |
| 37 | 41 | } |
| 38 | 42 | |
| 39 | 43 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 44 | + var bAbiertoCerrado = false | |
| 40 | 45 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
| 46 | + val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) | |
| 47 | + val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) | |
| 48 | + val tvFecha = v.findViewById<TextView>(R.id.tvFecha) | |
| 49 | + val ivSort19= v.findViewById<ImageView>(R.id.ivSort19) | |
| 50 | + val ivSort91= v.findViewById<ImageView>(R.id.ivSort91) | |
| 51 | + val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas) | |
| 52 | + val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito) | |
| 53 | + | |
| 54 | + rcInventario = v.findViewById(R.id.rcInventario) | |
| 41 | 55 | |
| 42 | 56 | GlobalScope.launch(Dispatchers.Main) { |
| 43 | 57 | inventarios = buscarEnBDInvHead() |
| ... | ... | @@ -52,15 +66,52 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener |
| 52 | 66 | inventarios[i].stDesc, |
| 53 | 67 | inventarios[i].proNoCont) |
| 54 | 68 | cargarRecicler(inv) |
| 69 | + cantidadInventarios = i + 1 | |
| 70 | + } | |
| 71 | + tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()})+" | |
| 72 | + tvInvDinamicos.setOnClickListener { | |
| 73 | + if (!bAbiertoCerrado) { | |
| 74 | + bAbiertoCerrado = true | |
| 75 | + txtDeposito.visibility = View.GONE | |
| 76 | + rcInventario.visibility = View.VISIBLE | |
| 77 | + ivSort91.visibility = View.VISIBLE | |
| 78 | + ivSort19.visibility = View.INVISIBLE | |
| 79 | + tvFecha.visibility = View.VISIBLE | |
| 80 | + cbVentas.visibility = View.VISIBLE | |
| 81 | + cbDeposito.visibility = View.VISIBLE | |
| 82 | + tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()})-" | |
| 83 | + } else { | |
| 84 | + bAbiertoCerrado = false | |
| 85 | + rcInventario.visibility = View.GONE | |
| 86 | + ivSort91.visibility = View.GONE | |
| 87 | + ivSort19.visibility = View.GONE | |
| 88 | + tvFecha.visibility = View.GONE | |
| 89 | + txtDeposito.visibility = View.VISIBLE | |
| 90 | + cbVentas.visibility = View.GONE | |
| 91 | + cbDeposito.visibility = View.GONE | |
| 92 | + tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()})+" | |
| 93 | + } | |
| 94 | + } | |
| 95 | + ivSort91.setOnClickListener { | |
| 96 | + ordenado= inventarios.sortedByDescending { | |
| 97 | + it.invNum | |
| 98 | + } as ArrayList<InvHead> | |
| 99 | + viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | |
| 100 | + viewManager = LinearLayoutManager(requireContext()) | |
| 101 | + | |
| 102 | + rcInventario.apply { | |
| 103 | + adapter = viewAdapter | |
| 104 | + layoutManager = viewManager | |
| 105 | + } | |
| 106 | + viewAdapter.notifyDataSetChanged() | |
| 55 | 107 | } |
| 56 | 108 | } |
| 57 | - rcInventario = v.findViewById(R.id.rcInventario) | |
| 58 | 109 | return v |
| 59 | 110 | } |
| 60 | 111 | |
| 61 | - suspend fun buscarEnBDInvHead(): List<InvHead> { | |
| 112 | + suspend fun buscarEnBDInvHead(): ArrayList<InvHead> { | |
| 62 | 113 | //TODO BUSQUEDA POR DESCRIPCION |
| 63 | - var busqueda: List<InvHead> | |
| 114 | + var busqueda: ArrayList<InvHead> | |
| 64 | 115 | return GlobalScope.async(Dispatchers.IO) { |
| 65 | 116 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() |
| 66 | 117 | return@async busqueda |
| ... | ... | @@ -70,12 +121,12 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener |
| 70 | 121 | fun cargarRecicler(inv: InvHead) { |
| 71 | 122 | //TODO CARGO EN LE RV |
| 72 | 123 | |
| 73 | - val number = if (inv.invNum.toLong()<10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | |
| 124 | + val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | |
| 74 | 125 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") |
| 75 | 126 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) |
| 76 | - listIvn.add(item) | |
| 77 | - | |
| 78 | - viewAdapter = InventarioListAdapter(requireContext(),listIvn,this) | |
| 127 | +// listIvn.add(item) | |
| 128 | + listIvn.add(inv) | |
| 129 | + viewAdapter = InventarioListAdapter(requireContext(), listIvn, this) | |
| 79 | 130 | viewManager = LinearLayoutManager(requireContext()) |
| 80 | 131 | |
| 81 | 132 | rcInventario.apply { |
| ... | ... | @@ -92,13 +143,13 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener |
| 92 | 143 | |
| 93 | 144 | override fun onItemClick(inventario: String?) { |
| 94 | 145 | |
| 95 | - val editor = sharedPreferences.edit() | |
| 96 | - var invSel:String =inventario.toString() | |
| 97 | - invSel=invSel.substring(3, 5) | |
| 98 | - editor?.putString("Inventario", invSel) | |
| 99 | - editor?.apply() | |
| 100 | - editor.commit() | |
| 101 | - navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | |
| 146 | + val editor = sharedPreferences.edit() | |
| 147 | +// var invSel: String = inventario.toString() | |
| 148 | +// invSel = invSel.substring(3, 5) | |
| 149 | + editor?.putString("Inventario", inventario) | |
| 150 | + editor?.apply() | |
| 151 | + editor.commit() | |
| 152 | + navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | |
| 102 | 153 | } |
| 103 | 154 | |
| 104 | 155 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/BaseViewHolder.kt
| 1 | 1 | package com.focasoftware.deboinventariov20.ui.util.Base |
| 2 | 2 | |
| 3 | +import android.app.AlertDialog | |
| 4 | +import android.app.Dialog | |
| 5 | +import android.os.Bundle | |
| 3 | 6 | import android.view.View |
| 7 | +import androidx.fragment.app.DialogFragment | |
| 4 | 8 | import androidx.recyclerview.widget.RecyclerView |
| 5 | 9 | |
| 6 | 10 | abstract class BaseViewHolder<T>(itemView:View):RecyclerView.ViewHolder(itemView) { |
| 7 | 11 | abstract fun bind(item:T, position:Int) |
| 12 | +} | |
| 13 | +class NoEncontradoSimple : DialogFragment() { | |
| 14 | + | |
| 15 | + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
| 16 | + return activity?.let { | |
| 17 | + val title = "" | |
| 18 | + val content = "¡El producto buscado NO fue encontrado!" | |
| 19 | + val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | |
| 20 | + builder.setTitle(title).setMessage(content) | |
| 21 | + .setPositiveButton(android.R.string.ok) { _, _ -> | |
| 22 | + //Todo OK click | |
| 23 | + } | |
| 24 | + | |
| 25 | + return builder.create() | |
| 26 | + } ?: throw IllegalStateException("Activity cannot be null") | |
| 27 | + } | |
| 28 | + | |
| 29 | +} | |
| 30 | + | |
| 31 | +class AlertDialogBorrarInv : DialogFragment() { | |
| 32 | + | |
| 33 | + interface OnBorrarInvClickListener { | |
| 34 | + fun onPositiveClick() | |
| 35 | + fun onCancelClick() | |
| 36 | + } | |
| 37 | + | |
| 38 | + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
| 39 | + return activity?.let { | |
| 40 | + val title = "Borrar Inventario" | |
| 41 | + val content = "¿Seguro que desea Borrar el inventario?" | |
| 42 | + val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | |
| 43 | + builder.setTitle(title).setMessage(content) | |
| 44 | + .setPositiveButton(android.R.string.ok) { _, _ -> | |
| 45 | + val listener = activity as OnBorrarInvClickListener? | |
| 46 | + listener!!.onPositiveClick() | |
| 47 | + } | |
| 48 | + .setNegativeButton(android.R.string.cancel) { _, _ -> | |
| 49 | + val listener = activity as OnBorrarInvClickListener? | |
| 50 | + listener!!.onCancelClick() | |
| 51 | + } | |
| 52 | + return builder.create() | |
| 53 | + } ?: throw IllegalStateException("Activity cannot be null") | |
| 54 | + } | |
| 55 | + | |
| 8 | 56 | } |
| 9 | 57 | \ No newline at end of file |
app/src/main/res/drawable/collapse.xml
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + android:width="24dp" | |
| 3 | + android:height="24dp" | |
| 4 | + android:viewportWidth="24" | |
| 5 | + android:viewportHeight="24" | |
| 6 | + android:tint="?attr/colorControlNormal"> | |
| 7 | + <path | |
| 8 | + android:fillColor="@android:color/white" | |
| 9 | + android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/> | |
| 10 | +</vector> |
app/src/main/res/drawable/expand.xml
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + android:width="24dp" | |
| 3 | + android:height="24dp" | |
| 4 | + android:viewportWidth="24" | |
| 5 | + android:viewportHeight="24" | |
| 6 | + android:tint="?attr/colorControlNormal"> | |
| 7 | + <path | |
| 8 | + android:fillColor="@android:color/white" | |
| 9 | + android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/> | |
| 10 | +</vector> |
app/src/main/res/drawable/ic_sort19.xml
| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | +<vector android:height="24dp" android:viewportHeight="97.589" | |
| 2 | + android:viewportWidth="97.589" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <path android:fillColor="#FF000000" android:pathData="M66.287,15.789c0.547,0.049 1.077,-0.121 1.489,-0.475l5.481,-4.705l-0.032,28.367c0,0.531 0.21,1.041 0.585,1.416s0.884,0.586 1.415,0.586h5.229c1.104,0 2,-0.895 2,-2V2.17c0,-1.104 -0.896,-2 -2,-2h-4.892c-0.453,0 -0.893,0.154 -1.246,0.436L63.079,9.553c-0.416,0.332 -0.683,0.814 -0.742,1.342c-0.059,0.529 0.096,1.059 0.428,1.475l2.146,2.68C65.251,15.471 65.747,15.738 66.287,15.789z"/> | |
| 4 | + <path android:fillColor="#FF000000" android:pathData="M90.684,64.143c-1.218,-2.703 -2.99,-4.797 -5.27,-6.223c-2.275,-1.424 -4.962,-2.145 -7.982,-2.145c-4.296,0 -7.746,1.301 -10.257,3.867c-2.506,2.562 -3.775,6.084 -3.775,10.465c0,4.063 1.051,7.297 3.123,9.604c2.086,2.322 4.968,3.5 8.566,3.5c2.141,0 3.956,-0.365 5.399,-1.086c1.161,-0.584 2.225,-1.515 3.161,-2.767c-0.219,2.402 -0.729,4.354 -1.51,5.795c-0.905,1.664 -2.229,2.9 -3.934,3.679c-1.746,0.793 -4.013,1.194 -6.738,1.194c-1.018,0 -2.023,-0.075 -2.989,-0.223c-0.578,-0.084 -1.162,0.08 -1.605,0.459c-0.441,0.381 -0.697,0.936 -0.697,1.518v3.638c0,1.021 0.769,1.877 1.782,1.987c1.101,0.121 2.475,0.183 4.082,0.183c6.82,0 11.996,-2.01 15.384,-5.974c3.367,-3.944 5.074,-9.963 5.074,-17.889C92.497,70.041 91.886,66.816 90.684,64.143zM81.473,74.219c-1.129,1.039 -2.45,1.543 -4.042,1.543c-1.671,0 -2.869,-0.49 -3.667,-1.502c-0.813,-1.025 -1.226,-2.459 -1.226,-4.262c0,-2.121 0.457,-3.756 1.358,-4.857c0.887,-1.084 2.096,-1.611 3.695,-1.611c1.609,0 2.9,0.664 3.943,2.031c1.063,1.396 1.601,3.137 1.601,5.174C83.139,72.053 82.594,73.193 81.473,74.219z"/> | |
| 5 | + <path android:fillColor="#FF000000" android:pathData="M43.243,65.596h-8.011V2c0,-1.105 -0.896,-2 -2,-2h-16.13c-1.104,0 -2,0.895 -2,2v63.596H7.091c-0.77,0 -1.472,0.443 -1.804,1.137c-0.333,0.695 -0.237,1.519 0.246,2.117l18.076,26.955c0.38,0.473 0.953,0.746 1.558,0.746s1.178,-0.273 1.558,-0.746L44.801,68.85c0.482,-0.6 0.578,-1.422 0.246,-2.117C44.715,66.039 44.013,65.596 43.243,65.596z"/> | |
| 6 | +</vector> |
app/src/main/res/drawable/ic_sort91.xml
| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | +<vector android:height="24dp" android:viewportHeight="97.086" | |
| 2 | + android:viewportWidth="97.086" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <path android:fillColor="#FF000000" android:pathData="M66.035,71.896c0.547,0.049 1.077,-0.121 1.489,-0.475l5.481,-4.705l-0.032,28.367c0,0.531 0.21,1.041 0.585,1.416s0.885,0.586 1.415,0.586h5.229c1.105,0 2,-0.895 2,-2V58.277c0,-1.104 -0.895,-2 -2,-2H75.31c-0.453,0 -0.893,0.154 -1.246,0.436L62.828,65.66c-0.416,0.332 -0.684,0.814 -0.742,1.342c-0.06,0.529 0.096,1.059 0.428,1.475l2.146,2.681C65,71.578 65.496,71.846 66.035,71.896z"/> | |
| 4 | + <path android:fillColor="#FF000000" android:pathData="M90.432,8.699c-1.218,-2.703 -2.99,-4.797 -5.271,-6.223C82.887,1.052 80.2,0.331 77.18,0.331c-4.297,0 -7.747,1.301 -10.258,3.867c-2.506,2.562 -3.775,6.084 -3.775,10.465c0,4.064 1.051,7.297 3.122,9.605c2.086,2.322 4.969,3.5 8.566,3.5c2.142,0 3.956,-0.365 5.399,-1.086c1.161,-0.584 2.225,-1.514 3.161,-2.766c-0.22,2.402 -0.729,4.354 -1.511,5.795c-0.904,1.664 -2.229,2.9 -3.934,3.678c-1.745,0.793 -4.013,1.195 -6.737,1.195c-1.018,0 -2.023,-0.076 -2.989,-0.223c-0.578,-0.084 -1.162,0.08 -1.605,0.459c-0.442,0.381 -0.696,0.936 -0.696,1.518v3.637c0,1.021 0.769,1.877 1.781,1.988c1.102,0.121 2.475,0.182 4.082,0.182c6.82,0 11.996,-2.01 15.385,-5.973c3.367,-3.945 5.074,-9.963 5.074,-17.889C92.246,14.598 91.634,11.373 90.432,8.699zM81.221,18.775c-1.129,1.039 -2.449,1.543 -4.041,1.543c-1.672,0 -2.869,-0.49 -3.668,-1.502c-0.813,-1.025 -1.226,-2.459 -1.226,-4.262c0,-2.121 0.457,-3.756 1.358,-4.857c0.887,-1.084 2.097,-1.611 3.695,-1.611c1.609,0 2.9,0.664 3.943,2.031c1.063,1.395 1.602,3.137 1.602,5.174C82.887,16.609 82.342,17.75 81.221,18.775z"/> | |
| 5 | + <path android:fillColor="#FF000000" android:pathData="M42.992,65.596h-8.011V2c0,-1.105 -0.896,-2 -2,-2h-16.13c-1.104,0 -2,0.895 -2,2v63.596H6.84c-0.77,0 -1.472,0.443 -1.804,1.137C4.704,67.428 4.8,68.251 5.282,68.85l18.076,26.955c0.38,0.473 0.952,0.746 1.558,0.746s1.179,-0.273 1.559,-0.746L44.55,68.85c0.482,-0.6 0.578,-1.422 0.246,-2.117C44.464,66.039 43.762,65.596 42.992,65.596z"/> | |
| 6 | +</vector> |
app/src/main/res/layout/fragment_main.xml
| ... | ... | @@ -3,11 +3,10 @@ |
| 3 | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | 5 | android:layout_width="match_parent" |
| 6 | - android:layout_height="match_parent" | |
| 7 | - tools:context=".ui.main.MainFragment"> | |
| 6 | + android:layout_height="match_parent"> | |
| 8 | 7 | |
| 9 | 8 | <androidx.appcompat.widget.AppCompatTextView |
| 10 | - android:id="@+id/txtVentas" | |
| 9 | + android:id="@+id/tvInvDinamicos" | |
| 11 | 10 | android:layout_width="match_parent" |
| 12 | 11 | android:layout_height="90dp" |
| 13 | 12 | android:autoSizeMaxTextSize="150sp" |
| ... | ... | @@ -18,286 +17,104 @@ |
| 18 | 17 | android:padding="10dp" |
| 19 | 18 | android:text="@string/invDinamicoVenta" |
| 20 | 19 | android:textColor="@color/colorAccent" |
| 20 | + android:visibility="visible" | |
| 21 | 21 | app:fontFamily="sans-serif" |
| 22 | - app:layout_constraintBottom_toTopOf="@+id/guideline" | |
| 23 | 22 | app:layout_constraintEnd_toEndOf="parent" |
| 24 | 23 | app:layout_constraintStart_toStartOf="parent" |
| 25 | - app:layout_constraintTop_toTopOf="@+id/guideline0" /> | |
| 24 | + app:layout_constraintTop_toTopOf="parent" /> | |
| 26 | 25 | |
| 27 | - <ScrollView | |
| 28 | - android:id="@+id/scrollView" | |
| 29 | - android:layout_width="match_parent" | |
| 30 | - android:layout_height="0dp" | |
| 26 | + <ImageView | |
| 27 | + android:id="@+id/ivSort19" | |
| 28 | + android:layout_width="wrap_content" | |
| 29 | + android:layout_height="wrap_content" | |
| 31 | 30 | android:layout_margin="10dp" |
| 32 | - android:layout_marginTop="4dp" | |
| 33 | - android:background="@android:color/darker_gray" | |
| 34 | - android:elevation="10dp" | |
| 35 | - android:scrollbarStyle="insideOverlay" | |
| 36 | - app:layout_constraintBottom_toTopOf="@+id/guideline2" | |
| 37 | - app:layout_constraintCircleRadius="10dp" | |
| 38 | - app:layout_constraintEnd_toEndOf="parent" | |
| 31 | + android:contentDescription=" " | |
| 32 | + android:visibility="gone" | |
| 33 | + android:src="@drawable/ic_sort19" | |
| 34 | + app:layout_constraintHorizontal_bias="0.0" | |
| 35 | + app:layout_constraintHorizontal_chainStyle="packed" | |
| 39 | 36 | app:layout_constraintStart_toStartOf="parent" |
| 40 | - app:layout_constraintTop_toTopOf="@+id/guideline" | |
| 41 | - app:layout_constraintVertical_bias="0.512"> | |
| 42 | - | |
| 43 | - <GridLayout | |
| 44 | - android:id="@+id/tableLayout" | |
| 45 | - android:layout_width="match_parent" | |
| 46 | - android:layout_height="wrap_content" | |
| 47 | - android:alignmentMode="alignMargins" | |
| 48 | - android:columnCount="2" | |
| 49 | - android:padding="15dp" | |
| 50 | - android:rowCount="2"> | |
| 37 | + app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | |
| 51 | 38 | |
| 52 | - <androidx.recyclerview.widget.RecyclerView | |
| 53 | - android:id="@+id/rcInventario" | |
| 54 | - android:layout_width="match_parent" | |
| 55 | - android:layout_height="wrap_content" | |
| 56 | - android:background="@android:color/darker_gray" | |
| 57 | - android:scrollbars="vertical" | |
| 58 | - app:layout_constraintTop_toBottomOf="@id/guideline4" | |
| 59 | - app:layout_constraintBottom_toTopOf="@+id/guideline5" | |
| 60 | - app:layout_constraintEnd_toEndOf="parent" | |
| 61 | - app:layout_constraintStart_toStartOf="parent" | |
| 62 | - tools:listitem="@layout/item_principal" /> | |
| 63 | - </GridLayout> | |
| 64 | - </ScrollView> | |
| 65 | - | |
| 66 | - <androidx.appcompat.widget.AppCompatTextView | |
| 67 | - android:id="@+id/txtDeposito" | |
| 68 | - android:layout_width="419dp" | |
| 69 | - android:layout_height="90dp" | |
| 70 | - android:autoSizeMaxTextSize="150sp" | |
| 71 | - android:autoSizeMinTextSize="25sp" | |
| 72 | - android:autoSizeStepGranularity="5sp" | |
| 73 | - android:autoSizeTextType="uniform" | |
| 74 | - android:gravity="center" | |
| 75 | - android:lines="1" | |
| 76 | - android:padding="10dp" | |
| 77 | - android:text="@string/invDinamicoCompra" | |
| 78 | - android:textColor="@color/colorAccent" | |
| 79 | - | |
| 80 | - app:fontFamily="sans-serif-condensed" | |
| 81 | - app:layout_constraintBottom_toTopOf="@id/guideline3" | |
| 82 | - app:layout_constraintEnd_toEndOf="parent" | |
| 39 | + <ImageView | |
| 40 | + android:id="@+id/ivSort91" | |
| 41 | + android:layout_width="wrap_content" | |
| 42 | + android:layout_height="wrap_content" | |
| 43 | + android:layout_margin="10dp" | |
| 44 | + android:layout_marginTop="12dp" | |
| 45 | + android:contentDescription=" " | |
| 46 | + android:visibility="gone" | |
| 47 | + android:src="@drawable/ic_sort91" | |
| 48 | + app:layout_constraintHorizontal_bias="1.0" | |
| 49 | + app:layout_constraintHorizontal_chainStyle="packed" | |
| 83 | 50 | app:layout_constraintStart_toStartOf="parent" |
| 84 | - app:layout_constraintTop_toTopOf="@+id/guideline2" /> | |
| 51 | + app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | |
| 85 | 52 | |
| 86 | - <ScrollView | |
| 87 | - android:id="@+id/scrollView2" | |
| 53 | + <TextView | |
| 54 | + android:id="@+id/tvFecha" | |
| 55 | + android:layout_width="wrap_content" | |
| 56 | + android:layout_height="wrap_content" | |
| 57 | + android:layout_marginTop="5dp" | |
| 58 | + android:text="Fecha" | |
| 59 | + android:textColor="@android:color/black" | |
| 60 | + android:textSize="25sp" | |
| 61 | + android:visibility="gone" | |
| 62 | + android:textStyle="bold" | |
| 63 | + app:layout_constraintBottom_toTopOf="@id/rcInventario" | |
| 64 | + app:layout_constraintHorizontal_chainStyle="packed" | |
| 65 | + app:layout_constraintStart_toEndOf="@+id/ivSort19" | |
| 66 | + app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | |
| 67 | + | |
| 68 | + <androidx.recyclerview.widget.RecyclerView | |
| 69 | + android:id="@+id/rcInventario" | |
| 88 | 70 | android:layout_width="match_parent" |
| 89 | 71 | android:layout_height="0dp" |
| 90 | - android:layout_margin="10dp" | |
| 91 | 72 | android:background="@android:color/darker_gray" |
| 92 | - android:elevation="10dp" | |
| 93 | - android:scrollbarStyle="insideOverlay" | |
| 94 | - app:layout_constraintBottom_toTopOf="@+id/guideline4" | |
| 95 | - app:layout_constraintCircleRadius="10dp" | |
| 73 | + android:scrollbars="vertical" | |
| 74 | + android:visibility="gone" | |
| 96 | 75 | app:layout_constraintEnd_toEndOf="parent" |
| 97 | 76 | app:layout_constraintStart_toStartOf="parent" |
| 98 | - app:layout_constraintTop_toBottomOf="@+id/txtDeposito"> | |
| 99 | - | |
| 100 | - <GridLayout | |
| 101 | - android:id="@+id/tableLayout2" | |
| 102 | - android:layout_width="match_parent" | |
| 103 | - android:layout_height="match_parent" | |
| 104 | - android:alignmentMode="alignMargins" | |
| 105 | - android:columnCount="2" | |
| 106 | - android:padding="15dp" | |
| 107 | - android:rowCount="2"> | |
| 108 | - | |
| 109 | - <!-- FILA 1--> | |
| 110 | - <!-- COLUMNA 1--> | |
| 111 | - <androidx.cardview.widget.CardView | |
| 112 | - android:layout_width="0dp" | |
| 113 | - android:layout_height="match_parent" | |
| 114 | - android:layout_rowWeight="1" | |
| 115 | - android:layout_columnWeight="1" | |
| 116 | - android:layout_margin="15dp" | |
| 117 | - app:cardCornerRadius="8dp" | |
| 118 | - app:cardElevation="8dp"> | |
| 77 | + app:layout_constraintTop_toBottomOf="@id/tvFecha" | |
| 78 | + tools:listitem="@layout/item_principal" /> | |
| 119 | 79 | |
| 120 | - <LinearLayout | |
| 121 | - android:layout_width="wrap_content" | |
| 122 | - android:layout_height="wrap_content" | |
| 123 | - android:layout_gravity="center_horizontal|center_vertical" | |
| 124 | - android:layout_margin="15dp" | |
| 125 | - android:orientation="vertical"> | |
| 126 | - | |
| 127 | - <androidx.appcompat.widget.AppCompatImageView | |
| 128 | - android:layout_width="wrap_content" | |
| 129 | - android:layout_height="wrap_content" | |
| 130 | - android:layout_gravity="center_horizontal" | |
| 131 | - android:src="@drawable/inventario" /> | |
| 132 | - | |
| 133 | - <androidx.appcompat.widget.AppCompatTextView | |
| 134 | - android:id="@+id/inventario5" | |
| 135 | - android:layout_width="wrap_content" | |
| 136 | - android:layout_height="100dp" | |
| 137 | - | |
| 138 | - android:autoSizeMaxTextSize="150sp" | |
| 139 | - android:autoSizeMinTextSize="15sp" | |
| 140 | - android:autoSizeStepGranularity="5sp" | |
| 141 | - android:autoSizeTextType="uniform" | |
| 142 | - android:gravity="center" | |
| 143 | - android:inputType="textMultiLine" | |
| 144 | - android:text="Inventeario 1 Articulos 100 12/12/2020 12:00" | |
| 145 | - android:textColor="@android:color/black" | |
| 146 | - android:textStyle="bold" /> | |
| 147 | - </LinearLayout> | |
| 148 | - </androidx.cardview.widget.CardView> | |
| 149 | - <!-- COLUMNA 2--> | |
| 150 | - <androidx.cardview.widget.CardView | |
| 151 | - android:layout_width="0dp" | |
| 152 | - android:layout_height="0dp" | |
| 153 | - android:layout_rowWeight="1" | |
| 154 | - android:layout_columnWeight="1" | |
| 155 | - android:layout_margin="15dp" | |
| 156 | - app:cardCornerRadius="8dp" | |
| 157 | - app:cardElevation="8dp"> | |
| 158 | - | |
| 159 | - <LinearLayout | |
| 160 | - android:layout_width="wrap_content" | |
| 161 | - android:layout_height="wrap_content" | |
| 162 | - android:layout_gravity="center_horizontal|center_vertical" | |
| 163 | - android:layout_margin="15dp" | |
| 164 | - android:orientation="vertical"> | |
| 165 | - | |
| 166 | - <androidx.appcompat.widget.AppCompatImageView | |
| 167 | - android:layout_width="wrap_content" | |
| 168 | - android:layout_height="wrap_content" | |
| 169 | - android:layout_gravity="center_horizontal" | |
| 170 | - android:src="@drawable/inventario" /> | |
| 171 | - | |
| 172 | - <androidx.appcompat.widget.AppCompatTextView | |
| 173 | - android:id="@+id/inventario6" | |
| 174 | - android:layout_width="wrap_content" | |
| 175 | - android:layout_height="100dp" | |
| 176 | - | |
| 177 | - android:autoSizeMaxTextSize="150sp" | |
| 178 | - android:autoSizeMinTextSize="15sp" | |
| 179 | - android:autoSizeStepGranularity="5sp" | |
| 180 | - android:autoSizeTextType="uniform" | |
| 181 | - android:gravity="center" | |
| 182 | - android:text="Inventeario 2 Articulos 100 12/12/2020 12:00" | |
| 183 | - android:textColor="@android:color/black" | |
| 184 | - android:textStyle="bold" /> | |
| 185 | - </LinearLayout> | |
| 186 | - </androidx.cardview.widget.CardView> | |
| 187 | - | |
| 188 | - <!-- FILA 2--> | |
| 189 | - <!-- COLUMNA 1--> | |
| 190 | - <androidx.cardview.widget.CardView | |
| 191 | - android:layout_width="0dp" | |
| 192 | - android:layout_height="match_parent" | |
| 193 | - android:layout_rowWeight="1" | |
| 194 | - android:layout_columnWeight="1" | |
| 195 | - android:layout_margin="15dp" | |
| 196 | - app:cardCornerRadius="8dp" | |
| 197 | - app:cardElevation="8dp"> | |
| 198 | - | |
| 199 | - <LinearLayout | |
| 200 | - android:layout_width="wrap_content" | |
| 201 | - android:layout_height="wrap_content" | |
| 202 | - android:layout_gravity="center_horizontal|center_vertical" | |
| 203 | - android:layout_margin="15dp" | |
| 204 | - android:orientation="vertical"> | |
| 205 | - | |
| 206 | - <androidx.appcompat.widget.AppCompatImageView | |
| 207 | - android:layout_width="wrap_content" | |
| 208 | - android:layout_height="wrap_content" | |
| 209 | - android:layout_gravity="center_horizontal" | |
| 210 | - android:src="@drawable/inventario" /> | |
| 211 | - | |
| 212 | - <androidx.appcompat.widget.AppCompatTextView | |
| 213 | - android:id="@+id/inventario7" | |
| 214 | - android:layout_width="wrap_content" | |
| 215 | - android:layout_height="100dp" | |
| 216 | - | |
| 217 | - android:autoSizeMaxTextSize="150sp" | |
| 218 | - android:autoSizeMinTextSize="15sp" | |
| 219 | - android:autoSizeStepGranularity="5sp" | |
| 220 | - android:autoSizeTextType="uniform" | |
| 221 | - android:gravity="center" | |
| 222 | - android:text="Inventeario 4 Cerrado. Articulos 100 12/12/2020 12:00" | |
| 223 | - android:textColor="@android:color/black" | |
| 224 | - android:textStyle="bold" /> | |
| 225 | - </LinearLayout> | |
| 226 | - </androidx.cardview.widget.CardView> | |
| 227 | - <!-- COLUMNA 2--> | |
| 228 | - <androidx.cardview.widget.CardView | |
| 229 | - android:layout_width="0dp" | |
| 230 | - android:layout_height="0dp" | |
| 231 | - android:layout_rowWeight="1" | |
| 232 | - android:layout_columnWeight="1" | |
| 233 | - android:layout_margin="15dp" | |
| 234 | - app:cardCornerRadius="8dp" | |
| 235 | - app:cardElevation="8dp"> | |
| 236 | - | |
| 237 | - <LinearLayout | |
| 238 | - android:layout_width="wrap_content" | |
| 239 | - android:layout_height="wrap_content" | |
| 240 | - android:layout_gravity="center_horizontal|center_vertical" | |
| 241 | - android:layout_margin="15dp" | |
| 242 | - android:orientation="vertical"> | |
| 243 | - | |
| 244 | - <androidx.appcompat.widget.AppCompatImageView | |
| 245 | - android:layout_width="wrap_content" | |
| 246 | - android:layout_height="wrap_content" | |
| 247 | - android:layout_gravity="center_horizontal" | |
| 248 | - android:src="@drawable/inventario" /> | |
| 249 | - | |
| 250 | - <androidx.appcompat.widget.AppCompatTextView | |
| 251 | - android:id="@+id/inventario8" | |
| 252 | - android:layout_width="wrap_content" | |
| 253 | - android:layout_height="100dp" | |
| 254 | - | |
| 255 | - android:autoSizeMaxTextSize="150sp" | |
| 256 | - android:autoSizeMinTextSize="15sp" | |
| 257 | - android:autoSizeStepGranularity="5sp" | |
| 258 | - android:autoSizeTextType="uniform" | |
| 259 | - android:gravity="center" | |
| 260 | - android:text="Inventeario 4 Cerrado. Articulos 100 12/12/2020 12:00" | |
| 261 | - android:textColor="@android:color/black" | |
| 262 | - android:textStyle="bold" /> | |
| 263 | - </LinearLayout> | |
| 264 | - </androidx.cardview.widget.CardView> | |
| 265 | - | |
| 266 | - </GridLayout> | |
| 267 | - </ScrollView> | |
| 268 | - | |
| 269 | - <androidx.constraintlayout.widget.Guideline | |
| 270 | - android:id="@+id/guideline0" | |
| 271 | - android:layout_width="wrap_content" | |
| 272 | - android:layout_height="wrap_content" | |
| 273 | - android:orientation="horizontal" | |
| 274 | - app:layout_constraintGuide_percent="0.03" /> | |
| 275 | - | |
| 276 | - <androidx.constraintlayout.widget.Guideline | |
| 277 | - android:id="@+id/guideline" | |
| 278 | - android:layout_width="wrap_content" | |
| 279 | - android:layout_height="wrap_content" | |
| 280 | - android:orientation="horizontal" | |
| 281 | - app:layout_constraintGuide_percent="0.15"/> | |
| 282 | - | |
| 283 | - <androidx.constraintlayout.widget.Guideline | |
| 284 | - android:id="@+id/guideline2" | |
| 80 | + <com.google.android.material.checkbox.MaterialCheckBox | |
| 81 | + android:id="@+id/cbVentas" | |
| 285 | 82 | android:layout_width="wrap_content" |
| 286 | 83 | android:layout_height="wrap_content" |
| 287 | - android:orientation="horizontal" | |
| 288 | - app:layout_constraintGuide_percent="0.55" /> | |
| 289 | - | |
| 290 | - <androidx.constraintlayout.widget.Guideline | |
| 291 | - android:id="@+id/guideline3" | |
| 84 | + android:layout_margin="5dp" | |
| 85 | + android:text="Ventas" | |
| 86 | + android:visibility="gone" | |
| 87 | + app:layout_constraintEnd_toStartOf="@+id/cbDeposito" | |
| 88 | + app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> | |
| 89 | + | |
| 90 | + <com.google.android.material.checkbox.MaterialCheckBox | |
| 91 | + android:id="@+id/cbDeposito" | |
| 292 | 92 | android:layout_width="wrap_content" |
| 293 | 93 | android:layout_height="wrap_content" |
| 294 | - android:orientation="horizontal" | |
| 295 | - app:layout_constraintGuide_percent="0.62" /> | |
| 94 | + android:layout_margin="5dp" | |
| 95 | + android:visibility="gone" | |
| 96 | + android:text="Deposito" | |
| 97 | + app:layout_constraintEnd_toEndOf="parent" | |
| 98 | + app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> | |
| 296 | 99 | |
| 297 | - <androidx.constraintlayout.widget.Guideline | |
| 298 | - android:id="@+id/guideline4" | |
| 299 | - android:layout_width="wrap_content" | |
| 300 | - android:layout_height="wrap_content" | |
| 301 | - android:orientation="horizontal" | |
| 302 | - app:layout_constraintGuide_percent="0.95" /> | |
| 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" /> | |
| 303 | 120 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 304 | 121 | \ No newline at end of file |
app/src/main/res/layout/ingresar_cantidad.xml
| ... | ... | @@ -7,9 +7,9 @@ |
| 7 | 7 | android:layout_height="wrap_content" |
| 8 | 8 | app:cardCornerRadius="10dp" |
| 9 | 9 | app:cardElevation="5dp" |
| 10 | - android:background="@drawable/md_transparent" | |
| 11 | - tools:ignore="PrivateResource"> | |
| 12 | 10 | |
| 11 | + tools:ignore="PrivateResource"> | |
| 12 | + <!-- android:background="@drawable/md_transparent"--> | |
| 13 | 13 | |
| 14 | 14 | <androidx.constraintlayout.widget.ConstraintLayout |
| 15 | 15 | android:layout_width="match_parent" |
app/src/main/res/layout/z_dialogpersocomplexcantidad_modificacion.xml
| ... | ... | @@ -1,119 +0,0 @@ |
| 1 | -<?xml version="1.0" encoding="utf-8"?> | |
| 2 | -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | - android:layout_width="match_parent" | |
| 4 | - android:layout_height="match_parent" | |
| 5 | - android:gravity="center_horizontal" | |
| 6 | - android:orientation="vertical"> | |
| 7 | - | |
| 8 | - <TableLayout | |
| 9 | - android:layout_width="wrap_content" | |
| 10 | - android:layout_height="wrap_content"> | |
| 11 | - | |
| 12 | - <TableRow | |
| 13 | - android:layout_width="wrap_content" | |
| 14 | - android:layout_height="wrap_content" | |
| 15 | - android:gravity="center_vertical"> | |
| 16 | - | |
| 17 | - <TextView | |
| 18 | - android:layout_width="200dp" | |
| 19 | - android:layout_height="wrap_content" | |
| 20 | - android:gravity="end" | |
| 21 | - android:text="Cantidad actual: " | |
| 22 | - android:textSize="20sp" /> | |
| 23 | - | |
| 24 | - <TextView | |
| 25 | - android:id="@+id/Z_DIALOG_cantidad_actual" | |
| 26 | - android:layout_width="50dp" | |
| 27 | - android:layout_height="wrap_content" | |
| 28 | - android:gravity="center" | |
| 29 | - android:text="13" | |
| 30 | - android:textSize="20sp" /> | |
| 31 | - </TableRow> | |
| 32 | - | |
| 33 | - <TableRow | |
| 34 | - android:layout_width="wrap_content" | |
| 35 | - android:layout_height="wrap_content" | |
| 36 | - android:gravity="center_vertical"> | |
| 37 | - | |
| 38 | - <TextView | |
| 39 | - android:layout_width="wrap_content" | |
| 40 | - android:layout_height="wrap_content" | |
| 41 | - android:gravity="end" | |
| 42 | - android:text="Cantidad previsional: " | |
| 43 | - android:textSize="20sp" /> | |
| 44 | - | |
| 45 | - <TextView | |
| 46 | - android:id="@+id/Z_DIALOG_cantidad_final" | |
| 47 | - android:layout_width="wrap_content" | |
| 48 | - android:layout_height="wrap_content" | |
| 49 | - android:gravity="center" | |
| 50 | - android:text="24" | |
| 51 | - android:textSize="20sp" /> | |
| 52 | - </TableRow> | |
| 53 | - </TableLayout> | |
| 54 | - | |
| 55 | - <LinearLayout | |
| 56 | - android:layout_width="wrap_content" | |
| 57 | - android:layout_height="wrap_content" | |
| 58 | - android:layout_marginTop="10dp" | |
| 59 | - android:gravity="center_vertical" | |
| 60 | - android:orientation="horizontal"> | |
| 61 | - | |
| 62 | - <TextView | |
| 63 | - android:id="@+id/Z_DIALOG_tipo_operacion" | |
| 64 | - android:layout_width="wrap_content" | |
| 65 | - android:layout_height="wrap_content" | |
| 66 | - android:gravity="end" | |
| 67 | - android:text="SUMAR: " | |
| 68 | - android:textSize="20sp" /> | |
| 69 | - | |
| 70 | - <EditText | |
| 71 | - android:id="@+id/Z_DIALOG_cantidad_nueva" | |
| 72 | - android:layout_width="120dp" | |
| 73 | - android:layout_height="50dp" | |
| 74 | - android:clickable="true" | |
| 75 | - android:focusable="true" | |
| 76 | - android:gravity="center" | |
| 77 | - android:hint="Cantidad" | |
| 78 | - android:inputType="numberDecimal" | |
| 79 | - android:maxLength="6" | |
| 80 | - android:textColor="@android:color/black" | |
| 81 | - android:textSize="20sp" /> | |
| 82 | - | |
| 83 | - <Button | |
| 84 | - android:id="@+id/Z_DIALOG_boton_reset" | |
| 85 | - android:layout_width="80dp" | |
| 86 | - android:layout_height="wrap_content" | |
| 87 | - android:gravity="center" | |
| 88 | - android:text="No tomado" | |
| 89 | - android:visibility="gone" /> | |
| 90 | - </LinearLayout> | |
| 91 | - | |
| 92 | - <LinearLayout | |
| 93 | - android:layout_width="wrap_content" | |
| 94 | - android:layout_height="wrap_content" | |
| 95 | - android:layout_gravity="center_horizontal" | |
| 96 | - android:layout_marginTop="10dp" | |
| 97 | - android:orientation="horizontal"> | |
| 98 | - | |
| 99 | - <ImageView | |
| 100 | - android:id="@+id/Z_DIALOG_validar" | |
| 101 | - android:layout_width="50dp" | |
| 102 | - android:layout_height="50dp" | |
| 103 | - android:layout_marginEnd="60dp" | |
| 104 | - android:contentDescription=" " | |
| 105 | - android:scaleType="fitXY" | |
| 106 | - android:src="@drawable/md_transparent" /> | |
| 107 | - | |
| 108 | - <ImageView | |
| 109 | - android:id="@+id/Z_DIALOG_cancelar" | |
| 110 | - android:layout_width="50dp" | |
| 111 | - android:layout_height="50dp" | |
| 112 | - android:contentDescription=" " | |
| 113 | - android:scaleType="fitXY" | |
| 114 | - android:src="@drawable/md_btn_selected_dark" /> | |
| 115 | - | |
| 116 | - | |
| 117 | - </LinearLayout> | |
| 118 | - | |
| 119 | -</LinearLayout> | |
| 120 | 0 | \ No newline at end of file |
app/src/main/res/navigation/mobile_navigation.xml
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | <fragment |
| 41 | 41 | android:id="@+id/actuaMaestrosFragment" |
| 42 | 42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" |
| 43 | - android:label="Actualización de Maestros" | |
| 43 | + android:label="Importaciones Varias" | |
| 44 | 44 | tools:layout="@layout/fragment_actua_maestros" /> |
| 45 | 45 | <fragment |
| 46 | 46 | android:id="@+id/servidoresFragment" |
app/src/main/res/values/strings.xml
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | <!-- menu--> |
| 7 | 7 | <string name="menuInicio">Principal</string> |
| 8 | 8 | <string name="menuNueInv">Nuevo Inventario</string> |
| 9 | - <string name="menuActMae">Actualizar Maestros</string> | |
| 9 | + <string name="menuActMae">Importaciones</string> | |
| 10 | 10 | <string name="menuConf">Configuraciones</string> |
| 11 | 11 | <string name="menuSal">Salir</string> |
| 12 | 12 | |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | |
| 26 | 26 | <!-- inventarios dinamicos--> |
| 27 | 27 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> |
| 28 | - <string name="invDinamicoCompra">Inventarios Sectorizados</string> | |
| 28 | + <string name="invDinamicoCompra">Inventarios Importados(0)+</string> | |
| 29 | 29 | |
| 30 | 30 | <!-- ventana emergente--> |
| 31 | 31 | <string name="adv">Ingrese la cantidad contada</string> |
| ... | ... | @@ -85,12 +85,12 @@ |
| 85 | 85 | <string name="btnGuardar">Guardar Cambios</string> |
| 86 | 86 | |
| 87 | 87 | <!-- fragment Actualizacion de Maestros--> |
| 88 | - <string name="tvActMaestros">Actualización de Maestros</string> | |
| 89 | - <string name="tvMedio">Seleccione el medio por el cual desea realizar la importación de maestros</string> | |
| 90 | - <string name="obPorWifi">Via Wifi</string> | |
| 91 | - <string name="obViaArchivo">Via Archivos MaeTable</string> | |
| 88 | + <string name="tvActMaestros">Importaciones</string> | |
| 89 | + <string name="tvMedio">Seleccione que tipo de importación desea realizar</string> | |
| 90 | + <string name="obPorWifi">Importación de artículos</string> | |
| 91 | + <string name="obViaArchivo">Importación de inventarios</string> | |
| 92 | 92 | |
| 93 | - <string name="btnConfirmarAct">Confirmar Actualización</string> | |
| 93 | + <string name="btnConfirmarAct">Confirmar Importación</string> | |
| 94 | 94 | |
| 95 | 95 | <!-- Fragment Save--> |
| 96 | 96 | <string name="tvConfServi">Configuración de Servidores</string> |
| ... | ... | @@ -106,8 +106,6 @@ |
| 106 | 106 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> |
| 107 | 107 | <string name="sTituloNueva">Producto ingresado esta cargado</string> |
| 108 | 108 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> |
| 109 | - <string name="sMensajeBorrarInv">¡Seguro que desea Borrar el inventario!</string> | |
| 110 | - <string name="sTituloBorrarInv">Borrar Inventario</string> | |
| 111 | 109 | |
| 112 | 110 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> |
| 113 | 111 | <string name="sTituloExportar">Exportación de Inventarios</string> |