Commit 7778faf6a52f29345d844318a494c37e549cf3f8
1 parent
08caedf9d2
Exists in
master
26022020 2220
Showing
26 changed files
with
624 additions
and
273 deletions
Show diff stats
Solicitudes API Articulos y Time.docx
No preview for this file type
Solicitudes API Articulos y Time.pdf
No preview for this file type
Solicitudes API Articulos.docx
No preview for this file type
Solicitudes API Articulos.pdf
No preview for this file type
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
... | ... | @@ -25,6 +25,9 @@ interface ArticulosDAO { |
25 | 25 | |
26 | 26 | @Query("DELETE FROM $TABLA_ART") |
27 | 27 | suspend fun deleteAllArticulos() |
28 | + | |
29 | + @Query("SELECT * FROM $TABLA_ART WHERE SEC=:sector AND COD=:codigo") | |
30 | + suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? | |
28 | 31 | } |
29 | 32 | |
30 | 33 | @Dao |
... | ... | @@ -64,6 +67,9 @@ interface InvBodyDAO { |
64 | 67 | |
65 | 68 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
66 | 69 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody |
70 | + | |
71 | + @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | |
72 | + suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int | |
67 | 73 | } |
68 | 74 | @Dao |
69 | 75 | interface ServeInvDao { |
app/src/main/java/com/focasoftware/deboinventariov20/Model/Tablas.kt
... | ... | @@ -17,7 +17,10 @@ data class Productos(@SerializedName("SEC") var sector: String?, |
17 | 17 | @SerializedName("CBC") var codOrigen: String?, |
18 | 18 | @SerializedName("PRE_VTA") var precio: String?, |
19 | 19 | @SerializedName("PRE_COS") var costo: String?, |
20 | - @SerializedName("BAL") var balanza: Int?, | |
20 | + @SerializedName( "EV") var exiVenta: String?, | |
21 | + @SerializedName( "ED") var exiDeposito: String?, | |
22 | + @SerializedName( "DE") var de: String?, | |
23 | + @SerializedName( "BAL") var balanza: Int?, | |
21 | 24 | @SerializedName("DEPSN") var depSn: Int?, |
22 | 25 | @SerializedName("FOTO") var imagen: String?) |
23 | 26 | |
... | ... | @@ -29,6 +32,9 @@ data class Articles(@ColumnInfo(name = "SEC") var sector: String?, |
29 | 32 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
30 | 33 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
31 | 34 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
35 | + @ColumnInfo(name = "EV") var exiVenta: String?, | |
36 | + @ColumnInfo(name = "ED") var exiDeposito: String?, | |
37 | + @ColumnInfo(name = "DE") var de: String?, | |
32 | 38 | @ColumnInfo(name = "BAL") var balanza: Int?, |
33 | 39 | @ColumnInfo(name = "DEPSN") var depSn: Int?, |
34 | 40 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { |
app/src/main/java/com/focasoftware/deboinventariov20/ui/actualizacionMaestros/ActuaMaestrosFragment.kt
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionFragment.kt
... | ... | @@ -13,6 +13,7 @@ import android.view.View |
13 | 13 | import android.view.ViewGroup |
14 | 14 | import android.widget.Button |
15 | 15 | import androidx.fragment.app.Fragment |
16 | +import androidx.fragment.app.FragmentActivity | |
16 | 17 | import androidx.lifecycle.lifecycleScope |
17 | 18 | import androidx.navigation.NavController |
18 | 19 | import androidx.navigation.Navigation |
... | ... | @@ -42,6 +43,7 @@ class DescripcionFragment : Fragment() { |
42 | 43 | lateinit var sharedPreferences: SharedPreferences |
43 | 44 | private var indice = 0 |
44 | 45 | private var artCargadoEnBD: InvBody? = null |
46 | + | |
45 | 47 | override fun onCreate(savedInstanceState: Bundle?) { |
46 | 48 | super.onCreate(savedInstanceState) |
47 | 49 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
... | ... | @@ -94,6 +96,7 @@ class DescripcionFragment : Fragment() { |
94 | 96 | numeroInventario.toString()) |
95 | 97 | if (artCargadoEnBD == null) { |
96 | 98 | val type = InputType.TYPE_CLASS_NUMBER |
99 | + | |
97 | 100 | MaterialDialog(requireContext()).show { |
98 | 101 | title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") |
99 | 102 | message(R.string.sMensajeEncontrado) |
... | ... | @@ -102,26 +105,26 @@ class DescripcionFragment : Fragment() { |
102 | 105 | cantidad = charSequence.toString().toFloat() |
103 | 106 | } |
104 | 107 | positiveButton(R.string.btnOk) { |
108 | + val body = InvBody(numeroInventario, | |
109 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | |
110 | + // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | |
111 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | |
112 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | |
113 | + cantidad.toString(), | |
114 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | |
115 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | |
116 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | |
117 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | |
118 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | |
119 | + (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | |
120 | + InventarioFragment().ObtenerFechaActual(), | |
121 | + InventarioFragment().ObtenerFechaActual()) | |
122 | + InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | |
123 | + VolverAinventario() | |
105 | 124 | dismiss() |
106 | 125 | } |
107 | 126 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
108 | 127 | |
109 | - val body = InvBody(numeroInventario, | |
110 | - (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | |
111 | - // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | |
112 | - (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | |
113 | - (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | |
114 | - cantidad.toString(), | |
115 | - (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | |
116 | - (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | |
117 | - (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | |
118 | - (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | |
119 | - (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | |
120 | - (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | |
121 | - InventarioFragment().ObtenerFechaActual(), | |
122 | - InventarioFragment().ObtenerFechaActual()) | |
123 | - InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | |
124 | - VolverAinventario() | |
125 | 128 | } else if (artCargadoEnBD != null) { |
126 | 129 | |
127 | 130 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
... | ... | @@ -135,7 +138,7 @@ class DescripcionFragment : Fragment() { |
135 | 138 | } |
136 | 139 | mDialogView.rbRestar.setOnClickListener { |
137 | 140 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") |
138 | - if (mDialogView.tvCantInicial.text.toString().toFloat() <= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
141 | + if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
139 | 142 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
140 | 143 | } |
141 | 144 | } |
... | ... | @@ -143,18 +146,17 @@ class DescripcionFragment : Fragment() { |
143 | 146 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
144 | 147 | } |
145 | 148 | mDialogView.btnAceptar.setOnClickListener { |
146 | - mAlertDialog.dismiss() | |
147 | 149 | val name = mDialogView.tvgenerico4.text.toString().toFloat() |
148 | - //updateCantidad(artCargadoEnBD.sector.toString(),artCargadoEnBD.codigo.toString(), name) | |
150 | + updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(), (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo | |
151 | + .toString(), name) | |
152 | + VolverAinventario() | |
153 | + mAlertDialog.dismiss() | |
149 | 154 | } |
150 | 155 | mDialogView.dialogCancelBtn.setOnClickListener { |
151 | 156 | mAlertDialog.dismiss() |
152 | 157 | } |
153 | - | |
154 | - VolverAinventario() | |
155 | 158 | } |
156 | 159 | } |
157 | - | |
158 | 160 | } |
159 | 161 | |
160 | 162 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
... | ... | @@ -208,7 +210,11 @@ class DescripcionFragment : Fragment() { |
208 | 210 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
209 | 211 | lifecycleScope.launch { |
210 | 212 | withContext(Dispatchers.IO) { |
211 | - AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | |
213 | + val activity: FragmentActivity? = activity | |
214 | + if(activity != null && isAdded){ | |
215 | + AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | |
216 | + } | |
217 | + | |
212 | 218 | } |
213 | 219 | } |
214 | 220 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/detalleProducto/DetalleArtFragment.kt
... | ... | @@ -0,0 +1,98 @@ |
1 | +package com.focasoftware.deboinventariov20.ui.detalleProducto | |
2 | + | |
3 | +import android.content.Context | |
4 | +import android.content.SharedPreferences | |
5 | +import android.os.Bundle | |
6 | +import android.view.LayoutInflater | |
7 | +import android.view.View | |
8 | +import android.view.ViewGroup | |
9 | +import androidx.fragment.app.Fragment | |
10 | +import androidx.navigation.NavController | |
11 | +import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | |
12 | +import com.focasoftware.deboinventariov20.Model.Articles | |
13 | +import com.focasoftware.deboinventariov20.R | |
14 | +import kotlinx.android.synthetic.main.fragment_detalle_art.* | |
15 | +import kotlinx.coroutines.Dispatchers | |
16 | +import kotlinx.coroutines.GlobalScope | |
17 | +import kotlinx.coroutines.async | |
18 | +import kotlinx.coroutines.launch | |
19 | + | |
20 | + | |
21 | +class DetalleArtFragment : Fragment() { | |
22 | + | |
23 | + private lateinit var navController: NavController | |
24 | + private var Inventario: Int = 0 | |
25 | + private var sector: String? = null | |
26 | + private var codigo: String? = null | |
27 | + private var artSerch: Articles? = null | |
28 | + lateinit var sharedPreferences: SharedPreferences | |
29 | + | |
30 | + override fun onCreate(savedInstanceState: Bundle?) { | |
31 | + super.onCreate(savedInstanceState) | |
32 | + sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | |
33 | + arguments?.let { | |
34 | + sector = it.getString("sector") | |
35 | + codigo = it.getString("codigo") | |
36 | + Inventario= it.getInt("numeroInv") | |
37 | + } | |
38 | + marcarInventario() | |
39 | + GlobalScope.launch(Dispatchers.Main) { | |
40 | + | |
41 | + artSerch = buscarCodigoDeboEnBD(sector, codigo) | |
42 | + if (artSerch == null) { | |
43 | + | |
44 | +// val type = InputType.TYPE_CLASS_NUMBER | |
45 | +// MaterialDialog(requireContext()).show { | |
46 | +// | |
47 | +// title(text = "Producto '$sChangeUpper', se encuentra cargado.") | |
48 | +// message(R.string.sCantidadNueva) | |
49 | +// input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | |
50 | +// fCant = 0F | |
51 | +// fCant = charSequence.toString().toFloat() | |
52 | +// } | |
53 | +// positiveButton(R.string.btnOk) { | |
54 | +// //TODO ACTUALIZO CANTIADAD EN BD | |
55 | +// updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | |
56 | +// //TODO ACTUALIZO CANTIDAD EN RV | |
57 | +// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | |
58 | +// viewAdapter.notifyDataSetChanged() | |
59 | +// dismiss() | |
60 | +// } | |
61 | +// }.cancelOnTouchOutside(false).cornerRadius(10F) | |
62 | + } else if (artSerch != null) { | |
63 | + tvSector.text=sector | |
64 | + tvCodigo.text=codigo | |
65 | + tvDeposito.text=if(artSerch!!.depSn!!.toInt() ==0)"No" else "Si" | |
66 | + tvDescripcion.text=artSerch!!.descripcion.toString() | |
67 | + tvCodigoBarras.text=artSerch!!.codBar.toString() | |
68 | + tvCodigoOrigen.text=artSerch!!.codOrigen.toString() | |
69 | + tvExiVenta.text=artSerch!!.exiVenta.toString() | |
70 | + tvExiDeposito.text=artSerch!!.exiDeposito.toString() | |
71 | + tvBal.text=artSerch!!.balanza.toString() | |
72 | + tvDE.text=artSerch!!.de.toString() | |
73 | + } | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | |
78 | + | |
79 | + return inflater.inflate(R.layout.fragment_detalle_art, container, false) | |
80 | + } | |
81 | + | |
82 | + suspend fun buscarCodigoDeboEnBD(sector: String?, codigo: String?): Articles? { | |
83 | + //TODO BUSQUEDA POR CODIGO DE BARRAS | |
84 | + var busqueda: Articles? = null | |
85 | + return GlobalScope.async(Dispatchers.IO) { | |
86 | + busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.fetchArticuloByCodSec(sector, codigo) | |
87 | + return@async busqueda | |
88 | + }.await() | |
89 | + } | |
90 | + fun marcarInventario() { | |
91 | + | |
92 | + val editor = sharedPreferences.edit() | |
93 | + editor?.putString("Inventario", Inventario.toString()) | |
94 | + editor?.apply() | |
95 | + editor.commit() | |
96 | +// navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | |
97 | + } | |
98 | +} | |
0 | 99 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/DialogPersoComplexCantidadModificacion.kt
... | ... | @@ -1,153 +0,0 @@ |
1 | -package com.focasoftware.deboinventariov20.ui.inventario | |
2 | - | |
3 | -import android.app.AlertDialog | |
4 | -import android.app.Dialog | |
5 | -import android.content.Context | |
6 | -import android.text.Editable | |
7 | -import android.text.TextWatcher | |
8 | -import android.view.View | |
9 | -import android.view.View.OnFocusChangeListener | |
10 | -import android.widget.Button | |
11 | -import android.widget.EditText | |
12 | -import android.widget.ImageView | |
13 | -import android.widget.TextView | |
14 | -import com.focasoftware.deboinventariov20.R | |
15 | - | |
16 | -/** | |
17 | - * Dialogo que permite mostrar una UI para modificar la cantidad de un articulo | |
18 | - * en las BD | |
19 | - * @author GuillermoR | |
20 | - */ | |
21 | -class DialogPersoComplexCantidadModificacion(context: Context?, | |
22 | - tipo_operacion: Int, | |
23 | - valor_inicial: Float, | |
24 | - listenerValidar: View.OnClickListener?, | |
25 | - listenerCancelar: View.OnClickListener?, | |
26 | - listenerReset: View.OnClickListener?) : Dialog(context!!), GestionarioTecladoVirtual { | |
27 | - /** | |
28 | - * TextView para mostrar el valor incical | |
29 | - */ | |
30 | - private val textV_valor_inicial: TextView | |
31 | - | |
32 | - /** | |
33 | - * Text view para mostrar el valor previsional luego de modificar su cantidad | |
34 | - */ | |
35 | - private val textV_valor_previsional: TextView | |
36 | - | |
37 | - /** | |
38 | - * EditText para almacenar el nuevo valor a ingresar | |
39 | - */ | |
40 | - private val editT_nuevo_valor: EditText | |
41 | - | |
42 | - /** | |
43 | - * Boton para resetear la cantidad | |
44 | - */ | |
45 | - private val boton_reset: Button? = null | |
46 | - | |
47 | - /** | |
48 | - * Variables accesorias | |
49 | - */ | |
50 | - private var VALOR_INICIO = 0f | |
51 | - private var TIPO_OPERACION = -1 | |
52 | - | |
53 | - /** | |
54 | - * Devuleve el nuevo valor | |
55 | - * | |
56 | - * 1 Test para ver si el valor tiene formato a nombre, sino 0 | |
57 | - * | |
58 | - * 2 Para provocar la excepcion si s no es del tipo Integer | |
59 | - * | |
60 | - * 3 En caso de error, devolvemos 0 si se trata de "sumar" o "restar". | |
61 | - * En el caso del "modificar", devolvemos "" para poder | |
62 | - * restablecer un "No Tomado", o valor inicial sino | |
63 | - * | |
64 | - * @return | |
65 | - */ | |
66 | - fun get_nuevo_valor(): String { | |
67 | - //1 Test para ver si el valor tiene formato a nombre, sino 0: | |
68 | - val s = editT_nuevo_valor.text.toString() | |
69 | - return try { | |
70 | - //2 Para provocar la excepcion si s no es del tipo Integer | |
71 | - s.toFloat() | |
72 | - s | |
73 | - } catch (ex: Exception) { | |
74 | - VALOR_INICIO.toString() | |
75 | - } | |
76 | - } | |
77 | - | |
78 | - fun valor_incorrecto(context: Context?) { | |
79 | - val show = AlertDialog.Builder(context).setTitle("Debo Inventario").setMessage("Valor ingresado incorrecto").show() | |
80 | - } | |
81 | - | |
82 | - override fun showKeyboard(edit_text: EditText?) { | |
83 | - // TODO Auto-generated method stub | |
84 | - } | |
85 | - | |
86 | - override fun hideKeyboard(edit_text: EditText?) { | |
87 | - // TODO Auto-generated method stub | |
88 | - } | |
89 | - | |
90 | - /** | |
91 | - * Constructor completo, setea las UI y carga los handlers | |
92 | - * | |
93 | - * 1 Construccin del ttulo | |
94 | - * | |
95 | - * 2 Cargamos el layout y main layout | |
96 | - * | |
97 | - * 3 Actualizacin de los textos | |
98 | - * | |
99 | - * 4 Si estamos en el modo "MODIFICAR", | |
100 | - * se habilita la posibilidad de reestablecer el valor a No Tomado | |
101 | - * | |
102 | - * 5 EditTexts y handlers de los mismos | |
103 | - * | |
104 | - * 6 Botones y sus handlers | |
105 | - * | |
106 | - * @param context | |
107 | - * @param tipo_operacion | |
108 | - * @param valor_inicial | |
109 | - * @param listenerValidar | |
110 | - * @param listenerCancelar | |
111 | - * @param listenerReset | |
112 | - */ | |
113 | - init { | |
114 | - super.setTitle("Nuevo valor") | |
115 | - | |
116 | - | |
117 | - // System.out.println("::: DialogComple modificacion antes del switch"); | |
118 | - super.setContentView(R.layout.z_dialogpersocomplexcantidad_modificacion) | |
119 | - | |
120 | - //3 Actualizacin de los textos: | |
121 | - textV_valor_inicial = super.findViewById<View>(R.id.Z_DIALOG_cantidad_actual) as TextView | |
122 | - textV_valor_inicial.text = valor_inicial.toString() | |
123 | - VALOR_INICIO = valor_inicial | |
124 | - TIPO_OPERACION = tipo_operacion | |
125 | - textV_valor_previsional = super.findViewById<View>(R.id.Z_DIALOG_cantidad_final) as TextView | |
126 | - textV_valor_previsional.text = valor_inicial.toString() | |
127 | - | |
128 | - | |
129 | - //5 EditTexts y handlers de los mismos | |
130 | - editT_nuevo_valor = super.findViewById<View>(R.id.Z_DIALOG_cantidad_nueva) as EditText | |
131 | - editT_nuevo_valor.onFocusChangeListener = OnFocusChangeListener { v, hasFocus -> showKeyboard(editT_nuevo_valor) } | |
132 | - editT_nuevo_valor.addTextChangedListener(object : TextWatcher { | |
133 | - override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {} | |
134 | - override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} | |
135 | - override fun afterTextChanged(s: Editable) { | |
136 | - val new_val = 0f | |
137 | - var val_temp = 0f | |
138 | - val_temp = s.toString().toFloat() | |
139 | - textV_valor_previsional.text = val_temp.toString() | |
140 | - } | |
141 | - }) | |
142 | - val textV_operacion = super.findViewById<View>(R.id.Z_DIALOG_tipo_operacion) as TextView | |
143 | - var miTexto = "" | |
144 | - miTexto = "NUEVO VALOR: " | |
145 | - textV_operacion.text = miTexto | |
146 | - | |
147 | - //6 Botones y sus handlers: | |
148 | - val boton_validar = super.findViewById<View>(R.id.Z_DIALOG_validar) as ImageView | |
149 | - val boton_cancelar = super.findViewById<View>(R.id.Z_DIALOG_cancelar) as ImageView | |
150 | - boton_validar.setOnClickListener(listenerValidar) | |
151 | - boton_cancelar.setOnClickListener(listenerCancelar) | |
152 | - } | |
153 | -} | |
154 | 0 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/GestionarioTecladoVirtual.kt
... | ... | @@ -1,22 +0,0 @@ |
1 | -package com.focasoftware.deboinventariov20.ui.inventario | |
2 | - | |
3 | -import android.widget.EditText | |
4 | - | |
5 | -/** | |
6 | - * Interface que representa metodos para administrar (Mostrar u ocultar) el teclado | |
7 | - * virtual | |
8 | - * @author GuillermoR | |
9 | - */ | |
10 | -interface GestionarioTecladoVirtual { | |
11 | - /** | |
12 | - * Funcion a implementar para mostrar el teclado virtual sobre el editText parametro | |
13 | - * @param edit_text | |
14 | - */ | |
15 | - fun showKeyboard(edit_text: EditText?) | |
16 | - | |
17 | - /** | |
18 | - * Funcion a implementar para ocultar el teclado virtual sobre el editText parametro | |
19 | - * @param edit_text | |
20 | - */ | |
21 | - fun hideKeyboard(edit_text: EditText?) | |
22 | -} | |
23 | 0 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InventarioFragment.kt
... | ... | @@ -39,7 +39,7 @@ import java.time.format.DateTimeFormatter |
39 | 39 | import java.util.* |
40 | 40 | |
41 | 41 | |
42 | -class InventarioFragment : Fragment() { | |
42 | +class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { | |
43 | 43 | |
44 | 44 | private lateinit var sharedPreferences: SharedPreferences |
45 | 45 | private var iArea: Int = 0 |
... | ... | @@ -56,8 +56,6 @@ class InventarioFragment : Fragment() { |
56 | 56 | private var fCant = 0F |
57 | 57 | private var bFirst = false |
58 | 58 | private lateinit var deleteIcon: Drawable |
59 | -// private var editTT: EditText? = null | |
60 | -// private var dialogoModificacion: DialogPersoComplexCantidadModificacion? = null | |
61 | 59 | |
62 | 60 | override fun onCreate(savedInstanceState: Bundle?) { |
63 | 61 | super.onCreate(savedInstanceState) |
... | ... | @@ -70,8 +68,10 @@ class InventarioFragment : Fragment() { |
70 | 68 | editor?.apply() |
71 | 69 | editor.commit() |
72 | 70 | } |
71 | + | |
73 | 72 | } |
74 | 73 | |
74 | + | |
75 | 75 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
76 | 76 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) |
77 | 77 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
... | ... | @@ -90,7 +90,8 @@ class InventarioFragment : Fragment() { |
90 | 90 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) |
91 | 91 | tvTitulo.text = "Inventario Dinamico" + " Nยฐ $InventarioNuevo" |
92 | 92 | } |
93 | - } else {// TODO: SI VENGO DE FRAGMENT DESCRIPCION | |
93 | + } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) | |
94 | + listArticulos.clear() | |
94 | 95 | CargarDeBdInventario(InventarioNuevo) |
95 | 96 | tvTitulo.text = "Inventario Dinamico" + " Nยฐ $InventarioNuevo" |
96 | 97 | } |
... | ... | @@ -128,7 +129,7 @@ class InventarioFragment : Fragment() { |
128 | 129 | } |
129 | 130 | mDialogView.rbRestar.setOnClickListener { |
130 | 131 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") |
131 | - if (mDialogView.tvCantInicial.text.toString().toFloat() <= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
132 | + if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
132 | 133 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
133 | 134 | } |
134 | 135 | } |
... | ... | @@ -230,7 +231,7 @@ class InventarioFragment : Fragment() { |
230 | 231 | } |
231 | 232 | mDialogView.rbRestar.setOnClickListener { |
232 | 233 | if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") |
233 | - if (mDialogView.tvCantInicial.text.toString().toFloat() <= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
234 | + if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
234 | 235 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
235 | 236 | } |
236 | 237 | } |
... | ... | @@ -384,6 +385,7 @@ class InventarioFragment : Fragment() { |
384 | 385 | invbody[i].codOrigen, |
385 | 386 | invbody[i].precio, |
386 | 387 | invbody[i].costo, |
388 | + "","","", | |
387 | 389 | invbody[i].balanza, |
388 | 390 | invbody[i].depSn, |
389 | 391 | invbody[i].costo) |
... | ... | @@ -409,7 +411,7 @@ class InventarioFragment : Fragment() { |
409 | 411 | artAcargar[0].codBar, |
410 | 412 | artAcargar[0].codOrigen, |
411 | 413 | artAcargar[0].precio, |
412 | - artAcargar[0].costo, | |
414 | + artAcargar[0].costo,"","","", | |
413 | 415 | artAcargar[0].balanza, |
414 | 416 | artAcargar[0].depSn, |
415 | 417 | "") |
... | ... | @@ -483,7 +485,7 @@ class InventarioFragment : Fragment() { |
483 | 485 | val type = InputType.TYPE_CLASS_PHONE |
484 | 486 | MaterialDialog(requireContext()).show { |
485 | 487 | |
486 | - title(text = "Producto: $sChangeUpper") | |
488 | + title(text = "Producto: ${artAcargar.descripcion.toString()}") | |
487 | 489 | message(text = "Ingrese la cantidad") |
488 | 490 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
489 | 491 | // val inputField = materialDialog.getInputField() |
... | ... | @@ -531,6 +533,14 @@ class InventarioFragment : Fragment() { |
531 | 533 | }.await() |
532 | 534 | } |
533 | 535 | |
536 | + suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { | |
537 | + //TODO BUSQUEDA POR DESCRIPCION | |
538 | + var result:Int | |
539 | + return GlobalScope.async(Dispatchers.IO) { | |
540 | + result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo,inventario) | |
541 | + return@async result | |
542 | + }.await() | |
543 | + } | |
534 | 544 | private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { |
535 | 545 | var indice = 0 |
536 | 546 | var bEncontrado = false |
... | ... | @@ -581,12 +591,11 @@ class InventarioFragment : Fragment() { |
581 | 591 | } |
582 | 592 | |
583 | 593 | fun cargarRecicler(articulos: Articles, cant: Float) { |
584 | - | |
585 | 594 | //TODO CARGO EN LE RV |
586 | 595 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen) |
587 | 596 | listArticulos.add(item) |
588 | 597 | |
589 | - viewAdapter = ProductosListAdapter(listArticulos) | |
598 | + viewAdapter = ProductosListAdapter(requireContext(),listArticulos, this) | |
590 | 599 | viewManager = LinearLayoutManager(requireContext()) |
591 | 600 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
592 | 601 | rcInventarios.apply { |
... | ... | @@ -599,8 +608,12 @@ class InventarioFragment : Fragment() { |
599 | 608 | } |
600 | 609 | |
601 | 610 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
602 | - (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | |
603 | - viewAdapter.notifyDataSetChanged() | |
611 | + | |
612 | + GlobalScope.launch(Dispatchers.Main) { | |
613 | + borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) | |
614 | + (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | |
615 | + viewAdapter.notifyDataSetChanged() | |
616 | + } | |
604 | 617 | } |
605 | 618 | |
606 | 619 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
... | ... | @@ -614,7 +627,6 @@ class InventarioFragment : Fragment() { |
614 | 627 | else c.drawColor(Color.RED) |
615 | 628 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
616 | 629 | } else { |
617 | - | |
618 | 630 | } |
619 | 631 | |
620 | 632 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
... | ... | @@ -671,11 +683,53 @@ class InventarioFragment : Fragment() { |
671 | 683 | } |
672 | 684 | |
673 | 685 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { |
674 | -// var inventarios: List<InvBody>? = null | |
675 | 686 | return GlobalScope.async(Dispatchers.IO) { |
676 | 687 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) |
677 | 688 | }.await() |
678 | 689 | } |
690 | + | |
691 | + override fun onImageDotsClick(sector: String?, codigo: String?) { | |
692 | + val bundle = Bundle() | |
693 | + bundle.putString("sector", sector) | |
694 | + bundle.putString("codigo", codigo) | |
695 | + bundle.putInt("numeroInv", InventarioNuevo) | |
696 | + navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) | |
697 | + } | |
698 | + | |
699 | + override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { | |
700 | + | |
701 | + val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | |
702 | + val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[position.toInt()].descripcion}', se encuentra cargado.") | |
703 | + .setCancelable(false) | |
704 | + mDialogView.tvCantInicial.text = cantidad | |
705 | + val mAlertDialog = mBuilder.show() | |
706 | + mDialogView.rbSumar.setOnClickListener { | |
707 | + if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | |
708 | + mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
709 | + } | |
710 | + mDialogView.rbRestar.setOnClickListener { | |
711 | + if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0") | |
712 | + if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
713 | + mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
714 | + } | |
715 | + } | |
716 | + mDialogView.rbMdodificar.setOnClickListener { | |
717 | + mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | |
718 | + } | |
719 | + mDialogView.btnAceptar.setOnClickListener { | |
720 | + mAlertDialog.dismiss() | |
721 | + val name = mDialogView.tvgenerico4.text.toString().toFloat() | |
722 | + fCant = 0F | |
723 | + fCant = name | |
724 | + listArticulos[position.toInt()].cantTomada = fCant | |
725 | + updateCantidad(listArticulos[position.toInt()].sector.toString(), listArticulos[position.toInt()].codigo.toString(), fCant) | |
726 | + viewAdapter.notifyDataSetChanged() | |
727 | + } | |
728 | + mDialogView.dialogCancelBtn.setOnClickListener { | |
729 | + mAlertDialog.dismiss() | |
730 | + } | |
731 | + } | |
732 | + | |
679 | 733 | } |
680 | 734 | |
681 | 735 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/ItemsRecycler.kt
1 | 1 | package com.focasoftware.deboinventariov20.ui.inventario |
2 | 2 | |
3 | -data class ItemsRecycler(val sector: String?,val codigo: String?, val descripcion: String?, var cantTomada: Float, val codigoBarras: String?, val codigoOrigen: String?) | |
4 | 3 | \ No newline at end of file |
4 | +import android.widget.ImageView | |
5 | + | |
6 | +data class ItemsRecycler(val sector: String?,val codigo: String?, val descripcion: String?, var cantTomada: Float, val codigoBarras: String?, val codigoOrigen: String?) { | |
7 | + | |
8 | +} | |
5 | 9 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/ProductosListAdapter.kt
1 | 1 | package com.focasoftware.deboinventariov20.ui.inventario |
2 | 2 | |
3 | +import android.content.Context | |
3 | 4 | import android.view.LayoutInflater |
4 | 5 | import android.view.View |
5 | 6 | import android.view.ViewGroup |
6 | 7 | import androidx.recyclerview.widget.RecyclerView |
7 | 8 | import com.focasoftware.deboinventariov20.R |
9 | +import com.focasoftware.deboinventariov20.ui.main.ItemInventario | |
10 | +import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder | |
8 | 11 | import com.google.android.material.snackbar.Snackbar |
9 | 12 | import kotlinx.android.synthetic.main.item.view.* |
10 | 13 | |
11 | 14 | |
12 | -class ProductosListAdapter(private val productos: ArrayList<ItemsRecycler>) : RecyclerView.Adapter<ProductosListAdapter.ItemsViewHolder>() { | |
15 | +class ProductosListAdapter(private val context: Context,private val productos: ArrayList<ItemsRecycler>, private val itemImageClickListener: OnImageDotsClickListener) : | |
16 | + RecyclerView.Adapter<BaseViewHolder<*>>() { | |
17 | + | |
13 | 18 | private var removePosition: Int = 0 |
14 | 19 | private var removedItem: ItemsRecycler? = null |
15 | - internal var items2: ArrayList<ItemsRecycler>? = null | |
20 | +// private var items2: ArrayList<ItemsRecycler>? = null | |
16 | 21 | |
17 | - init { | |
18 | - this.items2 = productos | |
22 | + interface OnImageDotsClickListener { | |
23 | + fun onImageDotsClick(sector: String?,codigo: String?) | |
24 | + fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) | |
19 | 25 | } |
20 | 26 | |
21 | - override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item, parent, false)) | |
27 | +// init { | |
28 | +// this.items2 = productos | |
29 | +// } | |
30 | + | |
31 | + override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item, parent, false)) | |
22 | 32 | |
23 | 33 | override fun getItemCount() = productos.size |
24 | 34 | |
25 | - override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { | |
35 | + override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | |
26 | 36 | when (holder) { |
27 | - is ItemsViewHolder -> { | |
28 | - holder.bind(items2!![position]) | |
29 | - } | |
37 | + is ItemsViewHolder -> { holder.bind(productos[position], position) } | |
38 | + | |
30 | 39 | } |
31 | 40 | } |
41 | + inner class ItemsViewHolder (itemView: View) : BaseViewHolder<ItemsRecycler>(itemView) { | |
42 | + override fun bind(item: ItemsRecycler, position: Int) { | |
43 | + itemView.ivDots.setOnClickListener {itemImageClickListener.onImageDotsClick(item.sector,item.codigo) } | |
44 | + itemView.ivPen.setOnClickListener {itemImageClickListener.onImagePenClick(item.sector,item.codigo,item.cantTomada.toString(),adapterPosition.toString()) } | |
32 | 45 | |
46 | + itemView.tvSector.text=item.sector | |
47 | + itemView.tvCodigo.text=item.codigo | |
48 | + itemView.tvDescripcion.text=item.descripcion | |
49 | + itemView.tvCantidad.text=item.cantTomada.toString() | |
50 | + itemView.tvCodigoBarras.text=item.sector | |
51 | + itemView.tvCodigoOrigen.text=item.sector | |
52 | + itemView.ivPen.setImageResource(R.drawable.pen) | |
53 | + itemView.ivDots.setImageResource(R.drawable.more) | |
33 | 54 | |
34 | - class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view) { | |
55 | + } | |
56 | +// val sector = itemView.tvSector | |
57 | +// val codigo = itemView.tvCodigo | |
58 | +// val descripcion = itemView.tvDescripcion | |
59 | +// val cantCont = itemView.tvCantidad | |
60 | +// val codigoBarras = itemView.tvCodigoBarras | |
61 | +// val codigoOrigen = itemView.tvCodigoOrigen | |
62 | +// val imageDots = itemView.ivDots | |
63 | +// val imagePen = itemView.ivPen | |
64 | +// | |
65 | +// fun bind(pro: ItemsRecycler) { | |
66 | +// | |
67 | +// } | |
35 | 68 | |
36 | - val sector = view.tvSector | |
37 | - val codigo = view.tvCodigo | |
38 | - val descripcion = view.tvDescripcion | |
39 | - val cantCont = view.tvCantidad | |
40 | - val codigoBarras = view.tvCodigoBarras | |
41 | - val codigoOrigen = view.tvCodigoOrigen | |
42 | 69 | |
43 | - fun bind(pro: ItemsRecycler) { | |
44 | - sector.text = pro.sector | |
45 | - codigo.text = pro.codigo | |
46 | - descripcion.text = pro.descripcion | |
47 | - cantCont.text = pro.cantTomada.toString() | |
48 | - codigoBarras.text = pro.codigoBarras | |
49 | - codigoOrigen.text = pro.codigoOrigen | |
50 | - } | |
51 | 70 | } |
52 | 71 | |
53 | 72 | fun removeItem(viewHolder: RecyclerView.ViewHolder) { |
... | ... | @@ -56,10 +75,12 @@ class ProductosListAdapter(private val productos: ArrayList<ItemsRecycler>) : Re |
56 | 75 | |
57 | 76 | productos.removeAt(viewHolder.adapterPosition) |
58 | 77 | notifyItemRemoved(viewHolder.adapterPosition) |
59 | - | |
60 | - Snackbar.make(viewHolder.itemView, "El articulo fue ${removedItem!!.descripcion} eliminado", Snackbar.LENGTH_LONG).setAction("Rehacer") { | |
61 | - productos.add(removePosition, removedItem!!) | |
62 | - notifyItemInserted(removePosition) | |
63 | - }.show() | |
78 | +// | |
79 | +// Snackbar.make(viewHolder.itemView, "El articulo fue ${removedItem!!.descripcion} eliminado", Snackbar.LENGTH_LONG).setAction("Rehacer") { | |
80 | +// productos.add(removePosition, removedItem!!) | |
81 | +// notifyItemInserted(removePosition) | |
82 | +// }.show() | |
64 | 83 | } |
84 | + | |
85 | + | |
65 | 86 | } |
66 | 87 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/Base/BaseViewHolder.kt
... | ... | @@ -1,8 +0,0 @@ |
1 | -package com.focasoftware.deboinventariov20.ui.main.Base | |
2 | - | |
3 | -import android.view.View | |
4 | -import androidx.recyclerview.widget.RecyclerView | |
5 | - | |
6 | -abstract class BaseViewHolder<T>(itemView:View):RecyclerView.ViewHolder(itemView) { | |
7 | - abstract fun bind(item:T, position:Int) | |
8 | -} | |
9 | 0 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/InventarioListAdapter.kt
... | ... | @@ -4,10 +4,9 @@ import android.content.Context |
4 | 4 | import android.view.LayoutInflater |
5 | 5 | import android.view.View |
6 | 6 | import android.view.ViewGroup |
7 | -import android.widget.AdapterView | |
8 | 7 | import androidx.recyclerview.widget.RecyclerView |
9 | 8 | import com.focasoftware.deboinventariov20.R |
10 | -import com.focasoftware.deboinventariov20.ui.main.Base.BaseViewHolder | |
9 | +import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder | |
11 | 10 | import kotlinx.android.synthetic.main.item_principal.view.* |
12 | 11 | |
13 | 12 | class InventarioListAdapter(private val context: Context, private val inv: ArrayList<ItemInventario>, private val itemClickListener: OnInventarioClickListener) : |
... | ... | @@ -22,12 +21,11 @@ class InventarioListAdapter(private val context: Context, private val inv: Array |
22 | 21 | override fun getItemCount() = inv.size |
23 | 22 | |
24 | 23 | |
25 | - inner class ItemsViewHolder(itemview: View) : BaseViewHolder<ItemInventario>(itemview) { | |
24 | + inner class ItemsViewHolder(itemView: View) : BaseViewHolder<ItemInventario>(itemView) { | |
26 | 25 | override fun bind(item: ItemInventario, position: Int) { |
27 | 26 | itemView.setOnClickListener {itemClickListener.onItemClick(item.inventario)} |
28 | 27 | itemView.tvPrincipalinventario.text = item.inventario |
29 | 28 | } |
30 | - | |
31 | 29 | } |
32 | 30 | |
33 | 31 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { |
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/BaseViewHolder.kt
... | ... | @@ -0,0 +1,8 @@ |
1 | +package com.focasoftware.deboinventariov20.ui.util.Base | |
2 | + | |
3 | +import android.view.View | |
4 | +import androidx.recyclerview.widget.RecyclerView | |
5 | + | |
6 | +abstract class BaseViewHolder<T>(itemView:View):RecyclerView.ViewHolder(itemView) { | |
7 | + abstract fun bind(item:T, position:Int) | |
8 | +} | |
0 | 9 | \ No newline at end of file |
app/src/main/res/drawable/no_imagen.png
10.7 KB
app/src/main/res/drawable/pen.xml
... | ... | @@ -0,0 +1,5 @@ |
1 | +<vector android:height="30dp" android:tint="?attr/colorControlNormal" | |
2 | + android:viewportHeight="24" android:viewportWidth="24" | |
3 | + android:width="30dp" xmlns:android="http://schemas.android.com/apk/res/android"> | |
4 | + <path android:fillColor="@android:color/white" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/> | |
5 | +</vector> |
app/src/main/res/layout-land/fragment_inventario.xml
... | ... | @@ -7,14 +7,10 @@ |
7 | 7 | android:layout_height="match_parent" |
8 | 8 | tools:context=".ui.inventario.InventarioFragment"> |
9 | 9 | |
10 | - | |
11 | 10 | <androidx.appcompat.widget.AppCompatTextView |
12 | 11 | android:id="@+id/tvTitulo" |
13 | 12 | android:layout_width="match_parent" |
14 | 13 | android:layout_height="60dp" |
15 | - android:layout_marginStart="8dp" | |
16 | - android:layout_marginTop="15dp" | |
17 | - android:layout_marginEnd="8dp" | |
18 | 14 | android:autoSizeMaxTextSize="100sp" |
19 | 15 | android:autoSizeMinTextSize="20sp" |
20 | 16 | android:autoSizeStepGranularity="5sp" |
app/src/main/res/layout/activity_mensaje.xml
... | ... | @@ -1,9 +0,0 @@ |
1 | -<?xml version="1.0" encoding="utf-8"?> | |
2 | -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | - xmlns:app="http://schemas.android.com/apk/res-auto" | |
4 | - xmlns:tools="http://schemas.android.com/tools" | |
5 | - android:layout_width="match_parent" | |
6 | - android:layout_height="match_parent" | |
7 | - tools:context=".ui.MensajeActivity"> | |
8 | - | |
9 | -</androidx.constraintlayout.widget.ConstraintLayout> | |
10 | 0 | \ No newline at end of file |
app/src/main/res/layout/fragment_detalle_art.xml
... | ... | @@ -0,0 +1,318 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
4 | + android:id="@+id/nsPedidosDatos" | |
5 | + android:layout_width="match_parent" | |
6 | + android:layout_height="match_parent"> | |
7 | + | |
8 | + <androidx.cardview.widget.CardView | |
9 | + android:id="@+id/cvItem1" | |
10 | + android:layout_width="match_parent" | |
11 | + android:layout_height="wrap_content" | |
12 | + android:layout_marginStart="5dp" | |
13 | + android:layout_marginTop="5dp" | |
14 | + android:layout_marginEnd="5dp" | |
15 | + app:cardBackgroundColor="@android:color/darker_gray" | |
16 | + app:cardCornerRadius="4dp" | |
17 | + app:cardElevation="4dp" | |
18 | + app:layout_constraintEnd_toEndOf="parent" | |
19 | + app:layout_constraintStart_toStartOf="parent" | |
20 | + app:layout_constraintTop_toTopOf="parent"> | |
21 | + | |
22 | + <androidx.constraintlayout.widget.ConstraintLayout | |
23 | + android:id="@+id/clayout" | |
24 | + android:layout_width="match_parent" | |
25 | + android:layout_height="match_parent"> | |
26 | + | |
27 | + <TextView | |
28 | + android:id="@+id/tvTime" | |
29 | + android:layout_width="0dp" | |
30 | + android:layout_height="wrap_content" | |
31 | + android:layout_marginTop="15dp" | |
32 | + android:gravity="center" | |
33 | + android:text="Detalle del artรญculo" | |
34 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
35 | + android:textSize="@dimen/Titulos" | |
36 | + android:textStyle="bold" | |
37 | + app:layout_constraintEnd_toEndOf="parent" | |
38 | + app:layout_constraintStart_toStartOf="parent" | |
39 | + app:layout_constraintTop_toTopOf="parent" /> | |
40 | + | |
41 | + <TextView | |
42 | + android:id="@+id/textView19" | |
43 | + android:layout_width="wrap_content" | |
44 | + android:layout_height="wrap_content" | |
45 | + android:layout_marginStart="5dp" | |
46 | + android:layout_marginTop="10dp" | |
47 | + android:text="Sector:" | |
48 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
49 | + android:textSize="14sp" | |
50 | + app:layout_constraintEnd_toStartOf="@id/tvSector" | |
51 | + app:layout_constraintStart_toStartOf="parent" | |
52 | + app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | |
53 | + | |
54 | + <TextView | |
55 | + android:id="@+id/tvSector" | |
56 | + android:layout_width="0dp" | |
57 | + android:layout_height="wrap_content" | |
58 | + android:layout_marginTop="10dp" | |
59 | + android:text="" | |
60 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
61 | + android:textSize="14sp" | |
62 | + app:layout_constraintEnd_toStartOf="@id/textView18" | |
63 | + app:layout_constraintStart_toEndOf="@id/textView19" | |
64 | + app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | |
65 | + | |
66 | + <TextView | |
67 | + android:id="@+id/textView18" | |
68 | + android:layout_width="wrap_content" | |
69 | + android:layout_height="wrap_content" | |
70 | + android:layout_marginTop="10dp" | |
71 | + android:text="Cรณdigo:" | |
72 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
73 | + android:textSize="14sp" | |
74 | + app:layout_constraintEnd_toStartOf="@id/tvCodigo" | |
75 | + app:layout_constraintStart_toEndOf="@id/tvSector" | |
76 | + app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | |
77 | + | |
78 | + <TextView | |
79 | + android:id="@+id/tvCodigo" | |
80 | + android:layout_width="0dp" | |
81 | + android:layout_height="wrap_content" | |
82 | + android:layout_marginTop="10dp" | |
83 | + android:text="" | |
84 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
85 | + android:textSize="14sp" | |
86 | + app:layout_constraintEnd_toStartOf="@+id/textView3" | |
87 | + app:layout_constraintStart_toEndOf="@id/textView18" | |
88 | + app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | |
89 | + | |
90 | + <TextView | |
91 | + android:id="@+id/textView3" | |
92 | + android:layout_width="wrap_content" | |
93 | + android:layout_height="wrap_content" | |
94 | + android:layout_marginTop="10dp" | |
95 | + android:text="Depรณsito:" | |
96 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
97 | + android:textSize="14sp" | |
98 | + app:layout_constraintEnd_toStartOf="@id/tvDeposito" | |
99 | + app:layout_constraintStart_toEndOf="@id/tvCodigo" | |
100 | + app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | |
101 | + | |
102 | + <TextView | |
103 | + android:id="@+id/tvDeposito" | |
104 | + android:layout_width="0dp" | |
105 | + android:layout_height="wrap_content" | |
106 | + android:layout_marginTop="10dp" | |
107 | + android:text="" | |
108 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
109 | + android:textSize="14sp" | |
110 | + app:layout_constraintEnd_toEndOf="parent" | |
111 | + app:layout_constraintStart_toEndOf="@id/textView3" | |
112 | + app:layout_constraintTop_toBottomOf="@+id/tvTime" /> | |
113 | + | |
114 | + <TextView | |
115 | + android:id="@+id/textView6" | |
116 | + android:layout_width="wrap_content" | |
117 | + android:layout_height="wrap_content" | |
118 | + android:layout_marginStart="5dp" | |
119 | + android:layout_marginTop="10dp" | |
120 | + android:text="Descripciรณn:" | |
121 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
122 | + android:textSize="14sp" | |
123 | + app:layout_constraintEnd_toStartOf="@id/tvDescripcion" | |
124 | + app:layout_constraintStart_toStartOf="parent" | |
125 | + app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | |
126 | + | |
127 | + <TextView | |
128 | + android:id="@+id/tvDescripcion" | |
129 | + android:layout_width="0dp" | |
130 | + android:layout_height="wrap_content" | |
131 | + android:layout_marginStart="5dp" | |
132 | + android:layout_marginTop="10dp" | |
133 | + android:lines="2" | |
134 | + android:text="" | |
135 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
136 | + android:textSize="14sp" | |
137 | + app:layout_constraintEnd_toEndOf="parent" | |
138 | + app:layout_constraintStart_toEndOf="@+id/textView6" | |
139 | + app:layout_constraintTop_toBottomOf="@+id/tvCodigo" /> | |
140 | + | |
141 | + <TextView | |
142 | + android:id="@+id/textView1" | |
143 | + android:layout_width="wrap_content" | |
144 | + android:layout_height="wrap_content" | |
145 | + android:layout_marginStart="5dp" | |
146 | + android:layout_marginTop="10dp" | |
147 | + android:text="C. de barras:" | |
148 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
149 | + android:textSize="14sp" | |
150 | + app:layout_constraintEnd_toStartOf="@id/tvCodigoBarras" | |
151 | + app:layout_constraintStart_toStartOf="parent" | |
152 | + app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | |
153 | + | |
154 | + <TextView | |
155 | + android:id="@+id/tvCodigoBarras" | |
156 | + android:layout_width="0dp" | |
157 | + android:layout_height="wrap_content" | |
158 | + android:layout_marginTop="10dp" | |
159 | + android:text="" | |
160 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
161 | + android:textSize="14sp" | |
162 | + app:layout_constraintEnd_toStartOf="@id/textView2" | |
163 | + app:layout_constraintStart_toEndOf="@id/textView1" | |
164 | + app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | |
165 | + | |
166 | + <TextView | |
167 | + android:id="@+id/textView2" | |
168 | + android:layout_width="wrap_content" | |
169 | + android:layout_height="wrap_content" | |
170 | + android:layout_marginTop="10dp" | |
171 | + android:text="C. origen:" | |
172 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
173 | + android:textSize="14sp" | |
174 | + app:layout_constraintEnd_toStartOf="@id/tvCodigoOrigen" | |
175 | + app:layout_constraintStart_toEndOf="@id/tvCodigoBarras" | |
176 | + app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | |
177 | + | |
178 | + <TextView | |
179 | + android:id="@+id/tvCodigoOrigen" | |
180 | + android:layout_width="0dp" | |
181 | + android:layout_height="wrap_content" | |
182 | + android:layout_marginTop="10dp" | |
183 | + android:text="" | |
184 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
185 | + android:textSize="14sp" | |
186 | + app:layout_constraintEnd_toEndOf="parent" | |
187 | + app:layout_constraintStart_toEndOf="@id/textView2" | |
188 | + app:layout_constraintTop_toBottomOf="@+id/tvDescripcion" /> | |
189 | + | |
190 | + | |
191 | + <TextView | |
192 | + android:id="@+id/textView5" | |
193 | + android:layout_width="wrap_content" | |
194 | + android:layout_height="wrap_content" | |
195 | + android:layout_marginStart="5dp" | |
196 | + android:layout_marginTop="10dp" | |
197 | + android:text="Exi.venta:" | |
198 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
199 | + android:textSize="14sp" | |
200 | + app:layout_constraintEnd_toStartOf="@id/tvExiVenta" | |
201 | + app:layout_constraintStart_toStartOf="parent" | |
202 | + app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | |
203 | + | |
204 | + <TextView | |
205 | + android:id="@+id/tvExiVenta" | |
206 | + android:layout_width="0dp" | |
207 | + android:layout_height="wrap_content" | |
208 | + android:layout_marginTop="10dp" | |
209 | + android:text="" | |
210 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
211 | + android:textSize="14sp" | |
212 | + app:layout_constraintEnd_toStartOf="@id/textView7" | |
213 | + app:layout_constraintStart_toEndOf="@id/textView5" | |
214 | + app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | |
215 | + | |
216 | + <TextView | |
217 | + android:id="@+id/textView7" | |
218 | + android:layout_width="wrap_content" | |
219 | + android:layout_height="wrap_content" | |
220 | + android:layout_marginTop="10dp" | |
221 | + android:text="Exi.dep:" | |
222 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
223 | + android:textSize="14sp" | |
224 | + app:layout_constraintEnd_toStartOf="@id/tvExiDeposito" | |
225 | + app:layout_constraintStart_toEndOf="@id/tvExiVenta" | |
226 | + app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | |
227 | + | |
228 | + <TextView | |
229 | + android:id="@+id/tvExiDeposito" | |
230 | + android:layout_width="0dp" | |
231 | + android:layout_height="wrap_content" | |
232 | + android:layout_marginTop="10dp" | |
233 | + android:text="" | |
234 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
235 | + android:textSize="14sp" | |
236 | + app:layout_constraintEnd_toStartOf="@+id/textView8" | |
237 | + app:layout_constraintStart_toEndOf="@id/textView7" | |
238 | + app:layout_constraintTop_toBottomOf="@+id/tvCodigoBarras" /> | |
239 | + | |
240 | + <TextView | |
241 | + android:id="@+id/textView8" | |
242 | + android:layout_width="wrap_content" | |
243 | + android:layout_height="wrap_content" | |
244 | + android:layout_marginTop="10dp" | |
245 | + android:text="Bal:" | |
246 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
247 | + android:textSize="14sp" | |
248 | + app:layout_constraintEnd_toStartOf="@id/tvBal" | |
249 | + app:layout_constraintStart_toEndOf="@id/tvExiDeposito" | |
250 | + app:layout_constraintTop_toBottomOf="@+id/textView2" /> | |
251 | + | |
252 | + <TextView | |
253 | + android:id="@+id/tvBal" | |
254 | + android:layout_width="0dp" | |
255 | + android:layout_height="wrap_content" | |
256 | + android:layout_marginTop="10dp" | |
257 | + android:text="" | |
258 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
259 | + android:textSize="14sp" | |
260 | + app:layout_constraintEnd_toStartOf="@+id/textView9" | |
261 | + app:layout_constraintStart_toEndOf="@id/textView8" | |
262 | + app:layout_constraintTop_toBottomOf="@+id/textView2" /> | |
263 | + | |
264 | + <TextView | |
265 | + android:id="@+id/textView9" | |
266 | + android:layout_width="wrap_content" | |
267 | + android:layout_height="wrap_content" | |
268 | + android:layout_marginTop="10dp" | |
269 | + android:text="De:" | |
270 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
271 | + android:textSize="14sp" | |
272 | + app:layout_constraintEnd_toStartOf="@id/tvDE" | |
273 | + app:layout_constraintStart_toEndOf="@id/tvBal" | |
274 | + app:layout_constraintTop_toBottomOf="@+id/textView2" /> | |
275 | + | |
276 | + <TextView | |
277 | + android:id="@+id/tvDE" | |
278 | + android:layout_width="0dp" | |
279 | + android:layout_height="wrap_content" | |
280 | + android:layout_marginTop="10dp" | |
281 | + android:text="" | |
282 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
283 | + android:textSize="14sp" | |
284 | + app:layout_constraintEnd_toEndOf="parent" | |
285 | + app:layout_constraintStart_toEndOf="@id/textView9" | |
286 | + app:layout_constraintTop_toBottomOf="@+id/textView2" /> | |
287 | + | |
288 | + | |
289 | + <TextView | |
290 | + android:id="@+id/textView10" | |
291 | + android:layout_width="wrap_content" | |
292 | + android:layout_height="wrap_content" | |
293 | + android:layout_marginTop="10dp" | |
294 | + android:text="Imagen:" | |
295 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
296 | + android:textSize="14sp" | |
297 | + app:layout_constraintEnd_toStartOf="@id/tvDE" | |
298 | + app:layout_constraintHorizontal_bias="0.0" | |
299 | + app:layout_constraintStart_toStartOf="parent" | |
300 | + app:layout_constraintTop_toBottomOf="@+id/tvDE" /> | |
301 | + | |
302 | + <ImageView | |
303 | + android:id="@+id/ivImagen" | |
304 | + android:layout_width="100dp" | |
305 | + android:layout_height="100dp" | |
306 | + android:layout_marginTop="10dp" | |
307 | + android:src="@drawable/no_imagen" | |
308 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
309 | + android:textSize="14sp" | |
310 | + app:layout_constraintEnd_toEndOf="parent" | |
311 | + app:layout_constraintHorizontal_bias="0.04" | |
312 | + app:layout_constraintStart_toEndOf="@id/textView10" | |
313 | + app:layout_constraintTop_toBottomOf="@+id/tvDE" /> | |
314 | + | |
315 | + </androidx.constraintlayout.widget.ConstraintLayout> | |
316 | + </androidx.cardview.widget.CardView> | |
317 | + | |
318 | +</ScrollView> |
app/src/main/res/layout/fragment_inventario.xml
app/src/main/res/layout/item.xml
... | ... | @@ -86,15 +86,24 @@ |
86 | 86 | app:layout_constraintTop_toTopOf="parent" /> |
87 | 87 | |
88 | 88 | <ImageView |
89 | - android:id="@+id/ivHolder" | |
89 | + android:id="@+id/ivPen" | |
90 | 90 | android:layout_width="30dp" |
91 | 91 | android:layout_height="30dp" |
92 | + android:src="@drawable/pen" | |
92 | 93 | android:visibility="visible" |
94 | + app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" | |
95 | + app:layout_constraintStart_toEndOf="@+id/tvCantidad" | |
96 | + app:layout_constraintTop_toTopOf="parent" | |
97 | + app:layout_constraintVertical_bias="0.0" /> | |
98 | + | |
99 | + <ImageView | |
100 | + android:id="@+id/ivDots" | |
101 | + android:layout_width="30dp" | |
102 | + android:layout_height="30dp" | |
93 | 103 | android:src="@drawable/more" |
104 | + android:visibility="visible" | |
94 | 105 | app:layout_constraintBottom_toTopOf="@+id/tvDescripcion" |
95 | 106 | app:layout_constraintEnd_toEndOf="parent" |
96 | - app:layout_constraintHorizontal_bias="0.968" | |
97 | - app:layout_constraintStart_toEndOf="@+id/tvCodigoBarras" | |
98 | 107 | app:layout_constraintTop_toTopOf="parent" |
99 | 108 | app:layout_constraintVertical_bias="0.0" /> |
100 | 109 |
app/src/main/res/navigation/mobile_navigation.xml
... | ... | @@ -74,6 +74,9 @@ |
74 | 74 | app:popExitAnim="@anim/slide_out_right" |
75 | 75 | app:enterAnim="@anim/slide_in_right" |
76 | 76 | app:exitAnim="@anim/slide_out_left"/> |
77 | + <action | |
78 | + android:id="@+id/action_inventarioFragment_to_detalleArtFragment" | |
79 | + app:destination="@id/detalleArtFragment" /> | |
77 | 80 | |
78 | 81 | </fragment> |
79 | 82 | <fragment |
... | ... | @@ -116,4 +119,13 @@ |
116 | 119 | android:id="@+id/singleChoiceAlertDialog" |
117 | 120 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" |
118 | 121 | android:label="SingleChoiceAlertDialog" /> |
122 | + <fragment | |
123 | + android:id="@+id/detalleArtFragment" | |
124 | + android:name="com.focasoftware.deboinventariov20.ui.detalleProducto.DetalleArtFragment" | |
125 | + android:label="Detalle Articulo" | |
126 | + tools:layout="@layout/fragment_detalle_art"> | |
127 | + <action | |
128 | + android:id="@+id/action_detalleArtFragment_to_inventarioFragment" | |
129 | + app:destination="@id/inventarioFragment" /> | |
130 | + </fragment> | |
119 | 131 | </navigation> |
120 | 132 | \ No newline at end of file |
app/src/main/res/values/strings.xml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <string name="app_name">DEBO Inventarios</string> |
5 | 5 | |
6 | 6 | <!-- menu--> |
7 | - <string name="menuInicio">Inicio</string> | |
7 | + <string name="menuInicio">Principal</string> | |
8 | 8 | <string name="menuNueInv">Nuevo Inventario</string> |
9 | 9 | <string name="menuActMae">Actualizar Maestros</string> |
10 | 10 | <string name="menuConf">Configuraciones</string> |