Commit b5325948ae96a5ebefaccc8101e7d5b2645b3124
1 parent
23f89b25e1
Exists in
master
24022020 1214
Showing
11 changed files
with
235 additions
and
183 deletions
Show diff stats
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionFragment.kt
| 1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment | 1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import android.content.SharedPreferences | 4 | import android.content.SharedPreferences |
| 5 | import android.graphics.Canvas | 5 | import android.graphics.Canvas |
| 6 | import android.graphics.Color | 6 | import android.graphics.Color |
| 7 | import android.graphics.drawable.ColorDrawable | 7 | import android.graphics.drawable.ColorDrawable |
| 8 | import android.os.Bundle | 8 | import android.os.Bundle |
| 9 | import android.text.InputType | ||
| 9 | import android.view.LayoutInflater | 10 | import android.view.LayoutInflater |
| 10 | import android.view.View | 11 | import android.view.View |
| 11 | import android.view.ViewGroup | 12 | import android.view.ViewGroup |
| 12 | import android.widget.Button | 13 | import android.widget.Button |
| 13 | import androidx.fragment.app.Fragment | 14 | import androidx.fragment.app.Fragment |
| 14 | import androidx.lifecycle.lifecycleScope | 15 | import androidx.lifecycle.lifecycleScope |
| 15 | import androidx.navigation.NavController | 16 | import androidx.navigation.NavController |
| 16 | import androidx.navigation.Navigation | 17 | import androidx.navigation.Navigation |
| 17 | import androidx.recyclerview.widget.ItemTouchHelper | 18 | import androidx.recyclerview.widget.ItemTouchHelper |
| 18 | import androidx.recyclerview.widget.LinearLayoutManager | 19 | import androidx.recyclerview.widget.LinearLayoutManager |
| 19 | import androidx.recyclerview.widget.RecyclerView | 20 | import androidx.recyclerview.widget.RecyclerView |
| 20 | import com.afollestad.materialdialogs.MaterialDialog | 21 | import com.afollestad.materialdialogs.MaterialDialog |
| 21 | import com.afollestad.materialdialogs.input.input | 22 | import com.afollestad.materialdialogs.input.input |
| 22 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 23 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 23 | import com.focasoftware.deboinventariov20.Model.Articles | 24 | import com.focasoftware.deboinventariov20.Model.Articles |
| 24 | import com.focasoftware.deboinventariov20.Model.InvBody | 25 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 25 | import com.focasoftware.deboinventariov20.R | 26 | import com.focasoftware.deboinventariov20.R |
| 26 | import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment | 27 | import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment |
| 27 | import kotlinx.coroutines.Dispatchers | 28 | import kotlinx.coroutines.Dispatchers |
| 28 | import kotlinx.coroutines.launch | 29 | import kotlinx.coroutines.launch |
| 29 | import kotlinx.coroutines.withContext | 30 | import kotlinx.coroutines.withContext |
| 30 | 31 | ||
| 31 | class DescripcionFragment : Fragment() { | 32 | class DescripcionFragment : Fragment() { |
| 32 | private var artAcargar2: List<Articles>? = null | 33 | private var artAcargar2: List<Articles>? = null |
| 33 | private var listArticulos2: List<Articles>? = null | 34 | private var listArticulos2: List<Articles>? = null |
| 34 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | 35 | lateinit var viewAdapter2: RecyclerView.Adapter<*> |
| 35 | private lateinit var viewManager2: RecyclerView.LayoutManager | 36 | private lateinit var viewManager2: RecyclerView.LayoutManager |
| 36 | private lateinit var rcDescripcion: RecyclerView | 37 | private lateinit var rcDescripcion: RecyclerView |
| 37 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | 38 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) |
| 38 | private var cantidad = 0F | 39 | private var cantidad = 0F |
| 39 | private var numeroInventario = 0 | 40 | private var numeroInventario = 0 |
| 40 | lateinit var navController: NavController | 41 | lateinit var navController: NavController |
| 41 | lateinit var sharedPreferences: SharedPreferences | 42 | lateinit var sharedPreferences: SharedPreferences |
| 43 | private var indice=0 | ||
| 42 | 44 | ||
| 43 | override fun onCreate(savedInstanceState: Bundle?) { | 45 | override fun onCreate(savedInstanceState: Bundle?) { |
| 44 | super.onCreate(savedInstanceState) | 46 | super.onCreate(savedInstanceState) |
| 45 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 47 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 46 | arguments.apply { | 48 | arguments.apply { |
| 47 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | 49 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> |
| 48 | numeroInventario = requireArguments().getInt("numeroInv") | 50 | numeroInventario = requireArguments().getInt("numeroInv") |
| 49 | } | 51 | } |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 52 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 54 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 53 | super.onViewCreated(view, savedInstanceState) | 55 | super.onViewCreated(view, savedInstanceState) |
| 54 | navController = Navigation.findNavController(view) | 56 | navController = Navigation.findNavController(view) |
| 55 | } | 57 | } |
| 56 | 58 | ||
| 57 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 59 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 58 | // Inflate the layout for this fragment | ||
| 59 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) | 60 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) |
| 60 | rcDescripcion = v.findViewById(R.id.rcDescripcion) | 61 | rcDescripcion = v.findViewById(R.id.rcDescripcion) |
| 61 | val btnSalir = v.findViewById<Button>(R.id.btnSalir) | 62 | val btnSalir = v.findViewById<Button>(R.id.btnSalir) |
| 62 | 63 | ||
| 63 | IngresarRecicler(artAcargar2) | 64 | IngresarRecicler(artAcargar2) |
| 64 | 65 | ||
| 65 | btnSalir.setOnClickListener { | 66 | btnSalir.setOnClickListener { |
| 66 | VolverAinventario() | 67 | VolverAinventario() |
| 67 | } | 68 | } |
| 68 | return v | 69 | return v |
| 69 | } | 70 | } |
| 70 | 71 | ||
| 71 | fun IngresarRecicler(articulos: List<Articles>?) { | 72 | fun IngresarRecicler(articulos: List<Articles>?) { |
| 72 | 73 | ||
| 73 | viewAdapter2 = DescripcionListAdapter(articulos) | 74 | viewAdapter2 = DescripcionListAdapter(articulos) |
| 74 | viewManager2 = LinearLayoutManager(requireContext()) | 75 | viewManager2 = LinearLayoutManager(requireContext()) |
| 75 | 76 | ||
| 76 | rcDescripcion.apply { | 77 | rcDescripcion.apply { |
| 77 | adapter = viewAdapter2 | 78 | adapter = viewAdapter2 |
| 78 | layoutManager = viewManager2 | 79 | layoutManager = viewManager2 |
| 79 | } | 80 | } |
| 80 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) { | 81 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) { |
| 81 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 82 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
| 82 | return false | 83 | return false |
| 83 | } | 84 | } |
| 84 | 85 | ||
| 85 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 86 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
| 87 | val type = InputType.TYPE_CLASS_PHONE | ||
| 86 | MaterialDialog(requireContext()).show { | 88 | MaterialDialog(requireContext()).show { |
| 87 | title(R.string.sTitulo) | 89 | title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") |
| 88 | message(R.string.sMensajeEncontrado) | 90 | message(R.string.sMensajeEncontrado) |
| 89 | input { materialDialog, charSequence -> | 91 | input (waitForPositiveButton = false ,hint = "99.99", inputType = type){ materialDialog, charSequence -> |
| 90 | cantidad = 0F | 92 | cantidad = 0F |
| 91 | cantidad = charSequence.toString().toFloat() | 93 | cantidad = charSequence.toString().toFloat() |
| 92 | } | 94 | } |
| 93 | // .input("Cantidad",1,,1,0,InputType.TYPE_CLASS_NUMBER,0,waitForPositiveButton = true,false,positiveButton ()) | 95 | // .input("Cantidad",1,,1,0,InputType.TYPE_CLASS_NUMBER,0,waitForPositiveButton = true,false,positiveButton ()) |
| 94 | positiveButton(R.string.btnOk) { | 96 | positiveButton(R.string.btnOk) { |
| 95 | dismiss() | 97 | dismiss() |
| 96 | var indice = 0 | 98 | var indice = 0 |
| 97 | indice=viewHolder.layoutPosition | 99 | indice=viewHolder.layoutPosition |
| 98 | 100 | ||
| 99 | val body = InvBody(numeroInventario, | 101 | val body = InvBody(numeroInventario, |
| 100 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | 102 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, |
| 101 | // TODO PREPARO PARA MANDAR A CARGAR EN LA BD | 103 | // TODO PREPARO PARA MANDAR A CARGAR EN LA BD |
| 102 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | 104 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, |
| 103 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | 105 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, |
| 104 | cantidad.toString(), | 106 | cantidad.toString(), |
| 105 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | 107 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, |
| 106 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | 108 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, |
| 107 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | 109 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, |
| 108 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | 110 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, |
| 109 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | 111 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, |
| 110 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | 112 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, |
| 111 | InventarioFragment().ObtenerFechaActual(), | 113 | InventarioFragment().ObtenerFechaActual(), |
| 112 | InventarioFragment().ObtenerFechaActual()) | 114 | InventarioFragment().ObtenerFechaActual()) |
| 113 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | 115 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
| 114 | VolverAinventario() | 116 | VolverAinventario() |
| 115 | } | 117 | } |
| 116 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 118 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 117 | } | 119 | } |
| 118 | 120 | ||
| 119 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 121 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
| 120 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 122 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 121 | val itemView = viewHolder.itemView | 123 | val itemView = viewHolder.itemView |
| 122 | 124 | ||
| 123 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 125 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
| 124 | 126 | ||
| 125 | if (dX > 0) { | 127 | if (dX > 0) { |
| 126 | 128 | ||
| 127 | c.drawColor(Color.RED) | 129 | c.drawColor(Color.RED) |
| 128 | } else if (dX < 0) { | 130 | } else if (dX < 0) { |
| 129 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | 131 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) |
| 130 | c.drawColor(Color.YELLOW) | 132 | c.drawColor(Color.YELLOW) |
| 131 | } | 133 | } |
| 132 | swipeBackground.draw(c) | 134 | swipeBackground.draw(c) |
| 133 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 135 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 134 | } | 136 | } |
| 135 | } | 137 | } |
| 136 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | 138 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) |
| 137 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) | 139 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) |
| 138 | 140 | ||
| 139 | } | 141 | } |
| 140 | 142 | ||
| 141 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 143 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
| 142 | lifecycleScope.launch { | 144 | lifecycleScope.launch { |
| 143 | withContext(Dispatchers.IO) { | 145 | withContext(Dispatchers.IO) { |
| 144 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 146 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
| 145 | } | 147 | } |
| 146 | } | 148 | } |
| 147 | } | 149 | } |
| 148 | fun VolverAinventario(){ | 150 | fun VolverAinventario(){ |
| 149 | 151 | ||
| 150 | val editor = sharedPreferences.edit() | 152 | val editor = sharedPreferences.edit() |
| 151 | editor?.putString("Inventario", numeroInventario.toString()) | 153 | editor?.putString("Inventario", numeroInventario.toString()) |
| 152 | editor?.apply() | 154 | editor?.apply() |
| 153 | editor.commit() | 155 | editor.commit() |
| 154 | navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | 156 | navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) |
| 155 | } | 157 | } |
| 156 | } | 158 | } |
| 157 | 159 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/dialogos/DialogNoEncontrado.kt
| File was created | 1 | package com.focasoftware.deboinventariov20.ui.dialogos | |
| 2 | |||
| 3 | import android.app.AlertDialog | ||
| 4 | import android.app.Dialog | ||
| 5 | import android.content.DialogInterface | ||
| 6 | import android.os.Bundle | ||
| 7 | import android.view.LayoutInflater | ||
| 8 | import androidx.fragment.app.DialogFragment | ||
| 9 | import com.focasoftware.deboinventariov20.R | ||
| 10 | import kotlinx.android.synthetic.main.ingresar_cantidad.* | ||
| 11 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | ||
| 12 | |||
| 13 | class DialogNoEncontrado : DialogFragment() { | ||
| 14 | |||
| 15 | fun newInstance(title: String, s: String): DialogNoEncontrado? { | ||
| 16 | val dialog = DialogNoEncontrado() | ||
| 17 | |||
| 18 | val args = Bundle() | ||
| 19 | args.putString("title", title) | ||
| 20 | args.putString("s", s) | ||
| 21 | dialog.arguments = args | ||
| 22 | return dialog | ||
| 23 | } | ||
| 24 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
| 25 | return activity?.let { | ||
| 26 | val args = requireArguments() | ||
| 27 | val title = args.getString("title") | ||
| 28 | val s = args.getString("s") | ||
| 29 | |||
| 30 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
| 31 | val inflater = requireActivity().layoutInflater; | ||
| 32 | |||
| 33 | builder.setView(inflater.inflate(R.layout.ingresar_cantidad, null)) | ||
| 34 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, id ->}) | ||
| 35 | |||
| 36 | |||
| 37 | builder.create() | ||
| 38 | } ?: throw IllegalStateException("Activity cannot be null") | ||
| 39 | } | ||
| 40 | |||
| 41 | } | ||
| 42 | |||
| 43 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/dialogos/dialogoLogin.kt
| 1 | package com.focasoftware.deboinventariov20.ui.dialogos | 1 | package com.focasoftware.deboinventariov20.ui.dialogos |
| 2 | 2 | ||
| 3 | import android.app.AlertDialog | 3 | import android.app.AlertDialog |
| 4 | import android.app.Dialog | 4 | import android.app.Dialog |
| 5 | import android.content.Context | 5 | import android.content.Context |
| 6 | import android.content.DialogInterface | 6 | import android.content.DialogInterface |
| 7 | import android.content.SharedPreferences | 7 | import android.content.SharedPreferences |
| 8 | import android.os.Bundle | 8 | import android.os.Bundle |
| 9 | import androidx.fragment.app.DialogFragment | 9 | import androidx.fragment.app.DialogFragment |
| 10 | import com.focasoftware.deboinventariov20.R | 10 | import com.focasoftware.deboinventariov20.R |
| 11 | 11 | ||
| 12 | class dialogoLogin() : DialogFragment() { | 12 | class dialogoLogin() : DialogFragment() { |
| 13 | private lateinit var sharedPreferences: SharedPreferences | 13 | private lateinit var sharedPreferences: SharedPreferences |
| 14 | interface OnContinueCancelClickListener { | 14 | interface OnContinueCancelClickListener { |
| 15 | fun onPositiveClick() | 15 | fun onPositiveClick() |
| 16 | fun onCancelClick() | 16 | fun onCancelClick() |
| 17 | } | 17 | } |
| 18 | // interface onDialogPositiveClick { | 18 | // interface onDialogPositiveClick { |
| 19 | // abstract fun onDialogPositiveClick() | 19 | // abstract fun onDialogPositiveClick() |
| 20 | // | 20 | // |
| 21 | //// fun onDialogNegativeClick(dialog: DialogFragment) | 21 | //// fun onDialogNegativeClick(dialog: DialogFragment) |
| 22 | // } | 22 | // } |
| 23 | // var mDialogSelectorCallback: dialogoLogin.onDialogPositiveClick? = null | 23 | // var mDialogSelectorCallback: dialogoLogin.onDialogPositiveClick? = null |
| 24 | fun newInstance(s: String): dialogoLogin? { | 24 | fun newInstance(s: String): dialogoLogin? { |
| 25 | val dialog = dialogoLogin() | 25 | val dialog = dialogoLogin() |
| 26 | 26 | ||
| 27 | val args = Bundle() | 27 | val args = Bundle() |
| 28 | args.putString("title", s) | 28 | args.putString("title", s) |
| 29 | dialog.arguments = args | 29 | dialog.arguments = args |
| 30 | 30 | ||
| 31 | return dialog | 31 | return dialog |
| 32 | } | 32 | } |
| 33 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 33 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 34 | return activity?.let { | 34 | return activity?.let { |
| 35 | val builder = AlertDialog.Builder(it) | 35 | val builder = AlertDialog.Builder(it) |
| 36 | // val args = requireArguments() | 36 | // val args = requireArguments() |
| 37 | // val title = args.getString("title") | 37 | // val title = args.getString("title") |
| 38 | val inflater = requireActivity().layoutInflater; | 38 | val inflater = requireActivity().layoutInflater; |
| 39 | 39 | ||
| 40 | builder.setView(inflater.inflate(R.layout.dialog_signin, null)) | 40 | builder.setView(inflater.inflate(R.layout.login_dialog, null)) |
| 41 | .setTitle("El producto ya fue escaneado") | 41 | .setTitle("El producto ya fue escaneado") |
| 42 | // .setMessage("La cantidad cargada es $title") | 42 | // .setMessage("La cantidad cargada es $title") |
| 43 | .setPositiveButton(android.R.string.ok) { _, _ -> | 43 | .setPositiveButton(android.R.string.ok) { _, _ -> |
| 44 | val listener = activity as OnContinueCancelClickListener? | 44 | val listener = activity as OnContinueCancelClickListener? |
| 45 | listener!!.onPositiveClick() | 45 | listener!!.onPositiveClick() |
| 46 | } | 46 | } |
| 47 | .setNegativeButton(android.R.string.cancel) { _, _ -> | 47 | .setNegativeButton(android.R.string.cancel) { _, _ -> |
| 48 | val listener = activity as OnContinueCancelClickListener? | 48 | val listener = activity as OnContinueCancelClickListener? |
| 49 | listener!!.onCancelClick() | 49 | listener!!.onCancelClick() |
| 50 | } | 50 | } |
| 51 | // builder.setPositiveButton(android.R.string.ok) { _, _ -> | 51 | // builder.setPositiveButton(android.R.string.ok) { _, _ -> |
| 52 | // mDialogSelectorCallback!!.onDialogPositiveClick() | 52 | // mDialogSelectorCallback!!.onDialogPositiveClick() |
| 53 | // } | 53 | // } |
| 54 | // .setPositiveButton(R.string.btnOk, | 54 | // .setPositiveButton(R.string.btnOk, |
| 55 | // DialogInterface.OnClickListener { dialog, id -> | 55 | // DialogInterface.OnClickListener { dialog, id -> |
| 56 | // mDialogSelectorCallback!!.onDialogPositiveClick() | 56 | // mDialogSelectorCallback!!.onDialogPositiveClick() |
| 57 | // sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 57 | // sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 58 | // val editor = sharedPreferences.edit() | 58 | // val editor = sharedPreferences.edit() |
| 59 | // editor?.putString("cantArtIng", R.id.username.toString()) | 59 | // editor?.putString("cantArtIng", R.id.username.toString()) |
| 60 | //// editor?.putString("TitArtIng", "") | 60 | //// editor?.putString("TitArtIng", "") |
| 61 | // editor?.apply() | 61 | // editor?.apply() |
| 62 | // editor.commit() | 62 | // editor.commit() |
| 63 | // }) | 63 | // }) |
| 64 | // .setNegativeButton(R.string.btnCancela, | 64 | // .setNegativeButton(R.string.btnCancela, |
| 65 | // DialogInterface.OnClickListener { dialog, id -> | 65 | // DialogInterface.OnClickListener { dialog, id -> |
| 66 | // getDialog()!!.cancel() | 66 | // getDialog()!!.cancel() |
| 67 | // }) | 67 | // }) |
| 68 | builder.create() | 68 | builder.create() |
| 69 | } ?: throw IllegalStateException("Activity cannot be null") | 69 | } ?: throw IllegalStateException("Activity cannot be null") |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InventarioFragment.kt
| 1 | package com.focasoftware.deboinventariov20.ui.inventario | 1 | package com.focasoftware.deboinventariov20.ui.inventario |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import android.content.SharedPreferences | 4 | import android.content.SharedPreferences |
| 5 | import android.graphics.Canvas | 5 | import android.graphics.Canvas |
| 6 | import android.graphics.Color | 6 | import android.graphics.Color |
| 7 | import android.graphics.drawable.Drawable | 7 | import android.graphics.drawable.Drawable |
| 8 | import android.os.Bundle | 8 | import android.os.Bundle |
| 9 | import android.text.InputType | ||
| 9 | import android.view.KeyEvent | 10 | import android.view.KeyEvent |
| 10 | import android.view.LayoutInflater | 11 | import android.view.LayoutInflater |
| 11 | import android.view.View | 12 | import android.view.View |
| 12 | import android.view.ViewGroup | 13 | import android.view.ViewGroup |
| 13 | import android.widget.EditText | 14 | import android.widget.EditText |
| 14 | import android.widget.TextView | 15 | import android.widget.TextView |
| 15 | import android.widget.Toast | 16 | import android.widget.Toast |
| 16 | import androidx.core.content.ContextCompat | 17 | import androidx.core.content.ContextCompat |
| 17 | import androidx.core.os.bundleOf | 18 | import androidx.core.os.bundleOf |
| 18 | import androidx.fragment.app.Fragment | 19 | import androidx.fragment.app.Fragment |
| 19 | import androidx.lifecycle.lifecycleScope | 20 | import androidx.lifecycle.lifecycleScope |
| 20 | import androidx.navigation.NavController | 21 | import androidx.navigation.NavController |
| 21 | import androidx.navigation.Navigation | 22 | import androidx.navigation.Navigation |
| 22 | import androidx.recyclerview.widget.ItemTouchHelper | 23 | import androidx.recyclerview.widget.ItemTouchHelper |
| 23 | import androidx.recyclerview.widget.LinearLayoutManager | 24 | import androidx.recyclerview.widget.LinearLayoutManager |
| 24 | import androidx.recyclerview.widget.RecyclerView | 25 | import androidx.recyclerview.widget.RecyclerView |
| 25 | import com.afollestad.materialdialogs.MaterialDialog | 26 | import com.afollestad.materialdialogs.MaterialDialog |
| 26 | import com.afollestad.materialdialogs.input.input | 27 | import com.afollestad.materialdialogs.input.input |
| 27 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 28 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 28 | import com.focasoftware.deboinventariov20.Model.Articles | 29 | import com.focasoftware.deboinventariov20.Model.Articles |
| 29 | import com.focasoftware.deboinventariov20.Model.InvBody | 30 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 30 | import com.focasoftware.deboinventariov20.Model.InvHead | 31 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 31 | import com.focasoftware.deboinventariov20.R | 32 | import com.focasoftware.deboinventariov20.R |
| 32 | import kotlinx.android.synthetic.main.fragment_inventario.* | 33 | import kotlinx.android.synthetic.main.fragment_inventario.* |
| 33 | import kotlinx.coroutines.* | 34 | import kotlinx.coroutines.* |
| 34 | import java.time.LocalDateTime | 35 | import java.time.LocalDateTime |
| 35 | import java.time.format.DateTimeFormatter | 36 | import java.time.format.DateTimeFormatter |
| 36 | import java.util.* | 37 | import java.util.* |
| 37 | 38 | ||
| 38 | 39 | ||
| 39 | class InventarioFragment : Fragment() { | 40 | class InventarioFragment : Fragment() { |
| 40 | 41 | ||
| 41 | private lateinit var sharedPreferences: SharedPreferences | 42 | private lateinit var sharedPreferences: SharedPreferences |
| 42 | private var iArea: Int = 0 | 43 | private var iArea: Int = 0 |
| 43 | private lateinit var invHead: InvHead | 44 | private lateinit var invHead: InvHead |
| 44 | private lateinit var rcInventarios: RecyclerView | 45 | private lateinit var rcInventarios: RecyclerView |
| 45 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 46 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
| 46 | private lateinit var viewManager: RecyclerView.LayoutManager | 47 | private lateinit var viewManager: RecyclerView.LayoutManager |
| 47 | private lateinit var sChangeUpper: String | 48 | private lateinit var sChangeUpper: String |
| 48 | private var listArticulos = ArrayList<ItemsRecycler>() | 49 | private var listArticulos = ArrayList<ItemsRecycler>() |
| 49 | private lateinit var navController: NavController | 50 | private lateinit var navController: NavController |
| 50 | private var InventarioNuevo: Int = 0 | 51 | private var InventarioNuevo: Int = 0 |
| 51 | private var iEstado = 0 | 52 | private var iEstado = 0 |
| 52 | private var fCant = 0F | 53 | private var fCant = 0F |
| 53 | private var bFirst = false | 54 | private var bFirst = false |
| 54 | private lateinit var deleteIcon: Drawable | 55 | private lateinit var deleteIcon: Drawable |
| 55 | // private var editTT: EditText? = null | 56 | // private var editTT: EditText? = null |
| 56 | // private var dialogoModificacion: DialogPersoComplexCantidadModificacion? = null | 57 | // private var dialogoModificacion: DialogPersoComplexCantidadModificacion? = null |
| 57 | 58 | ||
| 58 | override fun onCreate(savedInstanceState: Bundle?) { | 59 | override fun onCreate(savedInstanceState: Bundle?) { |
| 59 | super.onCreate(savedInstanceState) | 60 | super.onCreate(savedInstanceState) |
| 60 | 61 | ||
| 61 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 62 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 62 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { | 63 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { |
| 63 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() | 64 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() |
| 64 | val editor = sharedPreferences.edit() | 65 | val editor = sharedPreferences.edit() |
| 65 | editor?.putString("Inventario", "-1") | 66 | editor?.putString("Inventario", "-1") |
| 66 | editor?.apply() | 67 | editor?.apply() |
| 67 | editor.commit() | 68 | editor.commit() |
| 68 | } | 69 | } |
| 69 | } | 70 | } |
| 70 | 71 | ||
| 71 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 72 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 72 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) | 73 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) |
| 73 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 74 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 74 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) | 75 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) |
| 75 | rcInventarios = v.findViewById(R.id.rcInventarios) | 76 | rcInventarios = v.findViewById(R.id.rcInventarios) |
| 76 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) | 77 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) |
| 77 | 78 | ||
| 78 | 79 | ||
| 79 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO | 80 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO |
| 80 | GlobalScope.launch(Dispatchers.Main) { | 81 | GlobalScope.launch(Dispatchers.Main) { |
| 81 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO | 82 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO |
| 82 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 | 83 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 |
| 83 | SerchArea() | 84 | SerchArea() |
| 84 | val descripInv: String = if (iArea == 0) "Ventas" else "Deposito" | 85 | val descripInv: String = if (iArea == 0) "Ventas" else "Deposito" |
| 85 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO | 86 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO |
| 86 | invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont()) | 87 | invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont()) |
| 87 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) | 88 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) |
| 88 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 89 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
| 89 | } | 90 | } |
| 90 | } else {// TODO: SI VENGO DE FRAGMENT DESCRIPCION | 91 | } else {// TODO: SI VENGO DE FRAGMENT DESCRIPCION |
| 91 | CargarDeBdInventario(InventarioNuevo) | 92 | CargarDeBdInventario(InventarioNuevo) |
| 92 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 93 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
| 93 | } | 94 | } |
| 94 | 95 | ||
| 95 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> | 96 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> |
| 96 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { | 97 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { |
| 97 | sChangeUpper = tCodigoBarras.text.toString() | 98 | sChangeUpper = tCodigoBarras.text.toString() |
| 98 | 99 | ||
| 99 | var indiceDelArtEncontrado = 0 | 100 | var indiceDelArtEncontrado = 0 |
| 100 | 101 | ||
| 101 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | 102 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS |
| 102 | when (iEstado) { | 103 | when (iEstado) { |
| 103 | 0 -> { | 104 | 0 -> { |
| 104 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | 105 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice |
| 105 | //TODO Si no lo encuentra devuelve -1 | 106 | //TODO Si no lo encuentra devuelve -1 |
| 106 | if (indiceDelArtEncontrado != -1) { | 107 | if (indiceDelArtEncontrado != -1) { |
| 107 | if (swSumaUno!!.isChecked) { | 108 | if (swSumaUno!!.isChecked) { |
| 108 | fCant = 0F | 109 | fCant = 0F |
| 109 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 110 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 110 | fCant += 1F | 111 | fCant += 1F |
| 111 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 112 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
| 112 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 113 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 113 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 114 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
| 114 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 115 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 115 | viewAdapter.notifyDataSetChanged() | 116 | viewAdapter.notifyDataSetChanged() |
| 116 | } else { | 117 | } else { |
| 117 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 118 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| 118 | // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Login Form").setCancelable(false) | 119 | // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Login Form").setCancelable(false) |
| 119 | // val mAlertDialog = mBuilder.show() | 120 | // val mAlertDialog = mBuilder.show() |
| 120 | // mDialogView.dialogLoginBtn.setOnClickListener { | 121 | // mDialogView.dialogLoginBtn.setOnClickListener { |
| 121 | // mAlertDialog.dismiss() | 122 | // mAlertDialog.dismiss() |
| 122 | // //get text from EditTexts of custom layout | 123 | // //get text from EditTexts of custom layout |
| 123 | // val name = mDialogView.dialogNameEt.text.toString() | 124 | // val name = mDialogView.dialogNameEt.text.toString() |
| 124 | // val email = mDialogView.dialogEmailEt.text.toString() | 125 | // val email = mDialogView.dialogEmailEt.text.toString() |
| 125 | // val password = mDialogView.dialogPasswEt.text.toString() | 126 | // val password = mDialogView.dialogPasswEt.text.toString() |
| 126 | // fCant = 0F | 127 | // fCant = 0F |
| 127 | // fCant = name.toFloat() | 128 | // fCant = name.toFloat() |
| 128 | // } | 129 | // } |
| 129 | // mDialogView.dialogCancelBtn.setOnClickListener { | 130 | // mDialogView.dialogCancelBtn.setOnClickListener { |
| 130 | // mAlertDialog.dismiss() | 131 | // mAlertDialog.dismiss() |
| 131 | // } | 132 | // } |
| 132 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 133 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 134 | |||
| 135 | val type = InputType.TYPE_CLASS_PHONE | ||
| 133 | MaterialDialog(requireContext()).show { | 136 | MaterialDialog(requireContext()).show { |
| 134 | title(R.string.sTituloNueva) | 137 | |
| 135 | message(R.string.sCantidadNueva) | 138 | title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
| 136 | input { materialDialog, charSequence -> | 139 | message(R.string.sMensajeEncontrado) |
| 140 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | ||
| 141 | // val inputField = materialDialog.getInputField() | ||
| 142 | // val isValid = charSequence.isEmpty() | ||
| 143 | // | ||
| 144 | // inputField.error = if (isValid) null else "El campo no puede quedar vacio" | ||
| 145 | // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid) | ||
| 137 | fCant = 0F | 146 | fCant = 0F |
| 138 | fCant = charSequence.toString().toFloat() | 147 | fCant = charSequence.toString().toFloat() |
| 139 | } | 148 | } |
| 140 | positiveButton(R.string.btnOk) { | 149 | positiveButton(R.string.btnOk) { |
| 141 | //TODO ACTUALIZO CANTIADAD EN BD | 150 | //TODO ACTUALIZO CANTIADAD EN BD |
| 142 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 151 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 143 | //TODO ACTUALIZO CANTIDAD EN RV | 152 | //TODO ACTUALIZO CANTIDAD EN RV |
| 144 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 153 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 145 | viewAdapter.notifyDataSetChanged() | 154 | viewAdapter.notifyDataSetChanged() |
| 146 | dismiss() | 155 | dismiss() |
| 147 | } | 156 | } |
| 148 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 157 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 149 | } | 158 | } |
| 150 | 159 | ||
| 151 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | 160 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD |
| 152 | 161 | ||
| 153 | GlobalScope.launch(Dispatchers.Main) { | 162 | GlobalScope.launch(Dispatchers.Main) { |
| 154 | //TODO BUSCO EN BASE DE DATOS | 163 | //TODO BUSCO EN BASE DE DATOS |
| 155 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 164 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
| 156 | ContinuarCargaCB(artEncontrado) | 165 | ContinuarCargaCB(artEncontrado) |
| 157 | } | 166 | } |
| 158 | } | 167 | } |
| 159 | 168 | ||
| 160 | tCodigoBarras.focusable = View.FOCUSABLE | 169 | tCodigoBarras.focusable = View.FOCUSABLE |
| 161 | tCodigoBarras.setText("") | 170 | tCodigoBarras.setText("") |
| 162 | tCodigoBarras.selectAll() | 171 | tCodigoBarras.selectAll() |
| 163 | return@setOnKeyListener true | 172 | return@setOnKeyListener true |
| 164 | 173 | ||
| 165 | 174 | ||
| 166 | } | 175 | } |
| 167 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | 176 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** |
| 168 | // | 177 | // |
| 169 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | 178 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice |
| 170 | // //TODO Si no lo encuentra devuelve -1 | 179 | // //TODO Si no lo encuentra devuelve -1 |
| 171 | // if (indiceDelArtEncontrado != -1) { | 180 | // if (indiceDelArtEncontrado != -1) { |
| 172 | //// if (swSumaUno!!.isChecked) { | 181 | //// if (swSumaUno!!.isChecked) { |
| 173 | //// fCant = 0F | 182 | //// fCant = 0F |
| 174 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 183 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 175 | //// fCant += 1F | 184 | //// fCant += 1F |
| 176 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 185 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 177 | //// viewAdapter.notifyDataSetChanged() | 186 | //// viewAdapter.notifyDataSetChanged() |
| 178 | //// } else { | 187 | //// } else { |
| 179 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 188 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 180 | // MaterialDialog(requireContext()).show { | 189 | // MaterialDialog(requireContext()).show { |
| 181 | // title(R.string.sTituloNueva) | 190 | // title(R.string.sTituloNueva) |
| 182 | // message(R.string.sCantidadNueva) | 191 | // message(R.string.sCantidadNueva) |
| 183 | // input { materialDialog, charSequence -> | 192 | // input { materialDialog, charSequence -> |
| 184 | // fCant = 0F | 193 | // fCant = 0F |
| 185 | // fCant = charSequence.toString().toFloat() | 194 | // fCant = charSequence.toString().toFloat() |
| 186 | // } | 195 | // } |
| 187 | // positiveButton(R.string.btnOk) { | 196 | // positiveButton(R.string.btnOk) { |
| 188 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 197 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 189 | // viewAdapter.notifyDataSetChanged() | 198 | // viewAdapter.notifyDataSetChanged() |
| 190 | // dismiss() | 199 | // dismiss() |
| 191 | // } | 200 | // } |
| 192 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 201 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 193 | //// } | 202 | //// } |
| 194 | // | 203 | // |
| 195 | // } else if | 204 | // } else if |
| 196 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | 205 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD |
| 197 | GlobalScope.launch(Dispatchers.Main) { | 206 | GlobalScope.launch(Dispatchers.Main) { |
| 198 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 207 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
| 199 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | 208 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) |
| 200 | } | 209 | } |
| 201 | // } | 210 | // } |
| 202 | tCodigoBarras.focusable = View.FOCUSABLE | 211 | tCodigoBarras.focusable = View.FOCUSABLE |
| 203 | tCodigoBarras.setText("") | 212 | tCodigoBarras.setText("") |
| 204 | tCodigoBarras.selectAll() | 213 | tCodigoBarras.selectAll() |
| 205 | return@setOnKeyListener true | 214 | return@setOnKeyListener true |
| 206 | } | 215 | } |
| 207 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | 216 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** |
| 208 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice | 217 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice |
| 209 | //TODO Si no lo encuentra devuelve -1 | 218 | //TODO Si no lo encuentra devuelve -1 |
| 210 | if (indiceDelArtEncontrado != -1) { | 219 | if (indiceDelArtEncontrado != -1) { |
| 211 | if (swSumaUno!!.isChecked) { | 220 | if (swSumaUno!!.isChecked) { |
| 212 | fCant = 0F | 221 | fCant = 0F |
| 213 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 222 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 214 | fCant += 1F | 223 | fCant += 1F |
| 215 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 224 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
| 216 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 225 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 217 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 226 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
| 218 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 227 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 219 | viewAdapter.notifyDataSetChanged() | 228 | viewAdapter.notifyDataSetChanged() |
| 220 | } else { | 229 | } else { |
| 221 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
| 222 | // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Login Form").setCancelable(false) | ||
| 223 | // val mAlertDialog = mBuilder.show() | ||
| 224 | // mDialogView.dialogLoginBtn.setOnClickListener { | ||
| 225 | // mAlertDialog.dismiss() | ||
| 226 | // //get text from EditTexts of custom layout | ||
| 227 | // val name = mDialogView.dialogNameEt.text.toString() | ||
| 228 | // val email = mDialogView.dialogEmailEt.text.toString() | ||
| 229 | // val password = mDialogView.dialogPasswEt.text.toString() | ||
| 230 | // fCant = 0F | ||
| 231 | // fCant = name.toFloat() | ||
| 232 | // } | ||
| 233 | // mDialogView.dialogCancelBtn.setOnClickListener { | ||
| 234 | // mAlertDialog.dismiss() | ||
| 235 | // } | ||
| 236 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 230 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 231 | val type = InputType.TYPE_CLASS_PHONE | ||
| 237 | MaterialDialog(requireContext()).show { | 232 | MaterialDialog(requireContext()).show { |
| 238 | title(R.string.sTituloNueva) | 233 | |
| 234 | title(text = "Producto '$sChangeUpper', se encuentra cargado.") | ||
| 239 | message(R.string.sCantidadNueva) | 235 | message(R.string.sCantidadNueva) |
| 240 | input { materialDialog, charSequence -> | 236 | input (waitForPositiveButton = false ,hint = "99.99", inputType = type){ materialDialog, charSequence -> |
| 241 | fCant = 0F | 237 | fCant = 0F |
| 242 | fCant = charSequence.toString().toFloat() | 238 | fCant = charSequence.toString().toFloat() |
| 243 | } | 239 | } |
| 244 | positiveButton(R.string.btnOk) { | 240 | positiveButton(R.string.btnOk) { |
| 245 | //TODO ACTUALIZO CANTIADAD EN BD | 241 | //TODO ACTUALIZO CANTIADAD EN BD |
| 246 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 242 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 247 | //TODO ACTUALIZO CANTIDAD EN RV | 243 | //TODO ACTUALIZO CANTIDAD EN RV |
| 248 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 244 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 249 | viewAdapter.notifyDataSetChanged() | 245 | viewAdapter.notifyDataSetChanged() |
| 250 | dismiss() | 246 | dismiss() |
| 251 | } | 247 | } |
| 252 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 248 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 253 | } | 249 | } |
| 254 | 250 | ||
| 255 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | 251 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD |
| 256 | 252 | ||
| 257 | GlobalScope.launch(Dispatchers.Main) { | 253 | GlobalScope.launch(Dispatchers.Main) { |
| 258 | //TODO BUSCO EN BASE DE DATOS | 254 | //TODO BUSCO EN BASE DE DATOS |
| 259 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 255 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
| 260 | ContinuarCargaCB(artEncontrado) | 256 | ContinuarCargaCB(artEncontrado) |
| 261 | } | 257 | } |
| 262 | } | 258 | } |
| 263 | 259 | ||
| 264 | tCodigoBarras.focusable = View.FOCUSABLE | 260 | tCodigoBarras.focusable = View.FOCUSABLE |
| 265 | tCodigoBarras.setText("") | 261 | tCodigoBarras.setText("") |
| 266 | tCodigoBarras.selectAll() | 262 | tCodigoBarras.selectAll() |
| 267 | return@setOnKeyListener true | 263 | return@setOnKeyListener true |
| 268 | 264 | ||
| 269 | 265 | ||
| 270 | } | 266 | } |
| 271 | } | 267 | } |
| 272 | } | 268 | } |
| 273 | return@setOnKeyListener false | 269 | return@setOnKeyListener false |
| 274 | } | 270 | } |
| 275 | return v | 271 | return v |
| 276 | } | 272 | } |
| 277 | 273 | ||
| 278 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 274 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 279 | super.onViewCreated(view, savedInstanceState) | 275 | super.onViewCreated(view, savedInstanceState) |
| 280 | navController = Navigation.findNavController(view) | 276 | navController = Navigation.findNavController(view) |
| 281 | etCodigoBarras.requestFocus() | 277 | etCodigoBarras.requestFocus() |
| 282 | 278 | ||
| 283 | btnBorrarInv.setOnClickListener { | 279 | btnBorrarInv.setOnClickListener { |
| 284 | MaterialDialog(requireContext()).show { | 280 | MaterialDialog(requireContext()).show { |
| 285 | title(R.string.sTituloBorrarInv) | 281 | title(R.string.sTituloBorrarInv) |
| 286 | message(R.string.sMensajeBorrarInv) | 282 | message(R.string.sMensajeBorrarInv) |
| 287 | positiveButton(R.string.btnOk) { | 283 | positiveButton(R.string.btnOk) { |
| 288 | BorrarInvActual() | 284 | BorrarInvActual() |
| 289 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | 285 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() |
| 290 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 286 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
| 291 | InventarioNuevo = 0 | 287 | InventarioNuevo = 0 |
| 292 | dismiss() | 288 | dismiss() |
| 293 | } | 289 | } |
| 294 | negativeButton { | 290 | negativeButton { |
| 295 | dismiss() | 291 | dismiss() |
| 296 | } | 292 | } |
| 297 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 293 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 298 | } | 294 | } |
| 299 | 295 | ||
| 300 | btnExportarInv.setOnClickListener { | 296 | btnExportarInv.setOnClickListener { |
| 301 | MaterialDialog(requireContext()).show { | 297 | MaterialDialog(requireContext()).show { |
| 302 | title(R.string.sTituloExportar) | 298 | title(R.string.sTituloExportar) |
| 303 | message(R.string.sMensajeExportar) | 299 | message(R.string.sMensajeExportar) |
| 304 | positiveButton(R.string.btnOk) { | 300 | positiveButton(R.string.btnOk) { |
| 305 | BorrarInvActual() | 301 | BorrarInvActual() |
| 306 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | 302 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() |
| 307 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 303 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
| 308 | InventarioNuevo = 0 | 304 | InventarioNuevo = 0 |
| 309 | dismiss() | 305 | dismiss() |
| 310 | } | 306 | } |
| 311 | negativeButton { | 307 | negativeButton { |
| 312 | dismiss() | 308 | dismiss() |
| 313 | } | 309 | } |
| 314 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 310 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 315 | } | 311 | } |
| 316 | ivCamara.setOnClickListener { | 312 | ivCamara.setOnClickListener { |
| 317 | if (!bFirst) { | 313 | if (!bFirst) { |
| 318 | iEstado = 1 | 314 | iEstado = 1 |
| 319 | bFirst = true | 315 | bFirst = true |
| 320 | } | 316 | } |
| 321 | 317 | ||
| 322 | when (iEstado) { | 318 | when (iEstado) { |
| 323 | 0 -> { | 319 | 0 -> { |
| 324 | ivCamara.setImageResource(R.drawable.codbar) | 320 | ivCamara.setImageResource(R.drawable.codbar) |
| 325 | etCodigoBarras.hint = "Busqueda por C. Barras" | 321 | etCodigoBarras.hint = "Busqueda por C. Barras" |
| 326 | swSumaUno.visibility = View.VISIBLE | 322 | swSumaUno.visibility = View.VISIBLE |
| 327 | iEstado = 1 | 323 | iEstado = 0 |
| 328 | } | 324 | } |
| 329 | 1 -> { | 325 | 1 -> { |
| 330 | ivCamara.setImageResource(R.drawable.desc) | 326 | ivCamara.setImageResource(R.drawable.desc) |
| 331 | etCodigoBarras.hint = "Busqueda por Descripción" | 327 | etCodigoBarras.hint = "Busqueda por Descripción" |
| 332 | swSumaUno.visibility = View.GONE | 328 | swSumaUno.visibility = View.GONE |
| 333 | iEstado = 2 | 329 | iEstado = 1 |
| 334 | } | 330 | } |
| 335 | 2 -> { | 331 | 2 -> { |
| 336 | ivCamara.setImageResource(R.drawable.cod_origen) | 332 | ivCamara.setImageResource(R.drawable.cod_origen) |
| 337 | etCodigoBarras.hint = "Busqueda por C. Origen" | 333 | etCodigoBarras.hint = "Busqueda por C. Origen" |
| 338 | swSumaUno.visibility = View.GONE | 334 | swSumaUno.visibility = View.GONE |
| 339 | iEstado = 0 | 335 | iEstado = 2 |
| 340 | } | 336 | } |
| 341 | } | 337 | } |
| 342 | } | 338 | } |
| 343 | } | 339 | } |
| 344 | 340 | ||
| 345 | private fun BorrarInvActual() { | 341 | private fun BorrarInvActual() { |
| 346 | lifecycleScope.launch { | 342 | lifecycleScope.launch { |
| 347 | withContext(Dispatchers.IO) { | 343 | withContext(Dispatchers.IO) { |
| 348 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) | 344 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) |
| 349 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) | 345 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) |
| 350 | } | 346 | } |
| 351 | } | 347 | } |
| 352 | } | 348 | } |
| 353 | 349 | ||
| 354 | private fun CargarDeBdInventario(ultimoInv: Int) { | 350 | private fun CargarDeBdInventario(ultimoInv: Int) { |
| 355 | GlobalScope.launch(Dispatchers.Main) { | 351 | GlobalScope.launch(Dispatchers.Main) { |
| 356 | val invbody = cargarInventario(ultimoInv) | 352 | val invbody = cargarInventario(ultimoInv) |
| 357 | for ((i, item) in invbody!!.withIndex()) { | 353 | for ((i, item) in invbody!!.withIndex()) { |
| 358 | val art = Articles(invbody[i].sector, | 354 | val art = Articles(invbody[i].sector, |
| 359 | invbody[i].codigo, | 355 | invbody[i].codigo, |
| 360 | invbody[i].descripcion, | 356 | invbody[i].descripcion, |
| 361 | invbody[i].codBar, | 357 | invbody[i].codBar, |
| 362 | invbody[i].codOrigen, | 358 | invbody[i].codOrigen, |
| 363 | invbody[i].precio, | 359 | invbody[i].precio, |
| 364 | invbody[i].costo, | 360 | invbody[i].costo, |
| 365 | invbody[i].balanza, | 361 | invbody[i].balanza, |
| 366 | invbody[i].depSn, | 362 | invbody[i].depSn, |
| 367 | invbody[i].costo) | 363 | invbody[i].costo) |
| 368 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) | 364 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) |
| 369 | } | 365 | } |
| 370 | } | 366 | } |
| 371 | 367 | ||
| 372 | } | 368 | } |
| 373 | 369 | ||
| 374 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { | 370 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { |
| 375 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS | 371 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS |
| 376 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV | 372 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV |
| 377 | 373 | ||
| 378 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | 374 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD |
| 379 | // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1 | 375 | // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1 |
| 380 | if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 376 | if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
| 381 | fCant = 0F | 377 | fCant = 0F |
| 382 | fCant += 1F | 378 | fCant += 1F |
| 383 | // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 379 | // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
| 384 | val acargarPorDesc = Articles(artAcargar[0].sector, | 380 | val acargarPorDesc = Articles(artAcargar[0].sector, |
| 385 | artAcargar[0].codigo, | 381 | artAcargar[0].codigo, |
| 386 | artAcargar[0].descripcion, | 382 | artAcargar[0].descripcion, |
| 387 | artAcargar[0].codBar, | 383 | artAcargar[0].codBar, |
| 388 | artAcargar[0].codOrigen, | 384 | artAcargar[0].codOrigen, |
| 389 | artAcargar[0].precio, | 385 | artAcargar[0].precio, |
| 390 | artAcargar[0].costo, | 386 | artAcargar[0].costo, |
| 391 | artAcargar[0].balanza, | 387 | artAcargar[0].balanza, |
| 392 | artAcargar[0].depSn, | 388 | artAcargar[0].depSn, |
| 393 | "") | 389 | "") |
| 394 | // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 390 | // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
| 395 | cargarArtEnBd(acargarPorDesc, fCant) | 391 | cargarArtEnBd(acargarPorDesc, fCant) |
| 396 | cargarRecicler(acargarPorDesc, fCant) | 392 | cargarRecicler(acargarPorDesc, fCant) |
| 397 | } else { | 393 | } else { |
| 398 | var bundle = Bundle() | 394 | var bundle = Bundle() |
| 399 | bundle = bundleOf("ArrayDesc" to artAcargar) | 395 | bundle = bundleOf("ArrayDesc" to artAcargar) |
| 400 | bundle.putInt("numeroInv", InventarioNuevo) | 396 | bundle.putInt("numeroInv", InventarioNuevo) |
| 401 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 397 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
| 402 | } | 398 | } |
| 403 | // } else {//SI NO ESTA +1 | 399 | // } else {//SI NO ESTA +1 |
| 404 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 400 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
| 405 | // fCant = listArticulos[0].cantTomada | 401 | // fCant = listArticulos[0].cantTomada |
| 406 | // MaterialDialog(requireContext()).show { | 402 | // MaterialDialog(requireContext()).show { |
| 407 | // title(R.string.sTituloNueva) | 403 | // title(R.string.sTituloNueva) |
| 408 | // message(R.string.sCantidadNueva) | 404 | // message(R.string.sCantidadNueva) |
| 409 | // input { materialDialog, charSequence -> | 405 | // input { materialDialog, charSequence -> |
| 410 | // fCant = 0F | 406 | // fCant = 0F |
| 411 | // fCant = charSequence.toString().toFloat() | 407 | // fCant = charSequence.toString().toFloat() |
| 412 | // } | 408 | // } |
| 413 | // positiveButton(R.string.btnOk) { | 409 | // positiveButton(R.string.btnOk) { |
| 414 | // listArticulos[0].cantTomada = fCant | 410 | // listArticulos[0].cantTomada = fCant |
| 415 | // viewAdapter.notifyDataSetChanged() | 411 | // viewAdapter.notifyDataSetChanged() |
| 416 | // dismiss() | 412 | // dismiss() |
| 417 | // } | 413 | // } |
| 418 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 414 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 419 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 415 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
| 420 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 416 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
| 421 | // artAcargar[0].codigo, | 417 | // artAcargar[0].codigo, |
| 422 | // artAcargar[0].descripcion, | 418 | // artAcargar[0].descripcion, |
| 423 | // artAcargar[0].codBar, | 419 | // artAcargar[0].codBar, |
| 424 | // artAcargar[0].cod_origen, | 420 | // artAcargar[0].cod_origen, |
| 425 | // artAcargar[0].precio, | 421 | // artAcargar[0].precio, |
| 426 | // artAcargar[0].costo, | 422 | // artAcargar[0].costo, |
| 427 | // artAcargar[0].balanza, | 423 | // artAcargar[0].balanza, |
| 428 | // artAcargar[0].depSn, | 424 | // artAcargar[0].depSn, |
| 429 | // "") | 425 | // "") |
| 430 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 426 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
| 431 | // cargarArtEnBd(acargarPorDesc, fCant) | 427 | // cargarArtEnBd(acargarPorDesc, fCant) |
| 432 | // cargarRecicler(acargarPorDesc, fCant) | 428 | // cargarRecicler(acargarPorDesc, fCant) |
| 433 | // } else { | 429 | // } else { |
| 434 | // var bundle = Bundle() | 430 | // var bundle = Bundle() |
| 435 | // bundle = bundleOf("ArrayDesc" to artAcargar) | 431 | // bundle = bundleOf("ArrayDesc" to artAcargar) |
| 436 | // bundle.putInt("numeroInv", InventarioNuevo) | 432 | // bundle.putInt("numeroInv", InventarioNuevo) |
| 437 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 433 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
| 438 | // } | 434 | // } |
| 439 | // } | 435 | // } |
| 440 | } else {//TODO si no lo encuentra en la BD | 436 | } else {//TODO si no lo encuentra en la BD |
| 441 | MaterialDialog(requireContext()).show { | 437 | // MaterialDialog(requireContext()).show { |
| 442 | title(R.string.sTitulo) | 438 | // title(R.string.sTitulo) |
| 443 | message(R.string.sMensaje) | 439 | // message(R.string.sMensaje) |
| 444 | positiveButton(R.string.btnOk) { | 440 | // positiveButton(R.string.btnOk) { |
| 445 | dismiss() | 441 | // dismiss() |
| 446 | } | 442 | // } |
| 447 | }.cornerRadius(10F) | 443 | // }.cornerRadius(10F) |
| 444 | |||
| 445 | // val modalDialog = DialogNoEncontrado() | ||
| 446 | // modalDialog.isCancelable=false | ||
| 447 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
| 448 | // | ||
| 449 | // | ||
| 450 | // val modalDialog = DialogNoEncontrado().newInstance( | ||
| 451 | // "El producto $etCodigoBarras.text.toString()", | ||
| 452 | // "No se encotro en la Base de Datos." | ||
| 453 | // ) | ||
| 454 | // modalDialog?.show(requireActivity().supportFragmentManager, "DialogFragment") | ||
| 455 | |||
| 456 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
| 457 | // val mBuilder = AlertDialog.Builder(requireContext()).setView(mDialogView).setTitle("Login Form").setCancelable(false) | ||
| 458 | // val mAlertDialog = mBuilder.show() | ||
| 459 | // mDialogView.dialogLoginBtn.setOnClickListener { | ||
| 460 | // mAlertDialog.dismiss() | ||
| 461 | // //get text from EditTexts of custom layout | ||
| 462 | // val name = mDialogView.tvgenerico4.text.toString() | ||
| 463 | // | ||
| 464 | //// fCant = 0F | ||
| 465 | //// fCant = name.toFloat() | ||
| 466 | // } | ||
| 467 | // mDialogView.dialogCancelBtn.setOnClickListener { | ||
| 468 | // mAlertDialog.dismiss() | ||
| 469 | // } | ||
| 448 | } | 470 | } |
| 449 | 471 | ||
| 450 | } | 472 | } |
| 451 | 473 | ||
| 452 | private fun ContinuarCargaCB(artAcargar: Articles?) { | 474 | private fun ContinuarCargaCB(artAcargar: Articles?) { |
| 453 | 475 | ||
| 454 | if (artAcargar != null) {//Si lo encuentra en la BD | 476 | if (artAcargar != null) {//Si lo encuentra en la BD |
| 455 | 477 | ||
| 456 | if (swSumaUno!!.isChecked) {// SI ESTA +1, PONE CANTIDAD 1 | 478 | if (swSumaUno!!.isChecked) {// SI ESTA +1, PONE CANTIDAD 1 |
| 457 | fCant = 0F | 479 | fCant = 0F |
| 458 | fCant += 1F | 480 | fCant += 1F |
| 459 | cargarArtEnBd(artAcargar, fCant) | 481 | cargarArtEnBd(artAcargar, fCant) |
| 460 | cargarRecicler(artAcargar, fCant) | 482 | cargarRecicler(artAcargar, fCant) |
| 461 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD | 483 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD |
| 484 | val type = InputType.TYPE_CLASS_PHONE | ||
| 462 | MaterialDialog(requireContext()).show { | 485 | MaterialDialog(requireContext()).show { |
| 463 | title(R.string.sTitulo) | 486 | |
| 487 | title(text = "Producto: $sChangeUpper") | ||
| 464 | message(R.string.sMensajeEncontrado) | 488 | message(R.string.sMensajeEncontrado) |
| 465 | input { materialDialog, charSequence -> | 489 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
| 490 | // val inputField = materialDialog.getInputField() | ||
| 491 | // val isValid = charSequence.isEmpty() | ||
| 492 | // | ||
| 493 | // inputField.error = if (isValid) null else "El campo no puede quedar vacio" | ||
| 494 | // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid) | ||
| 466 | fCant = 0F | 495 | fCant = 0F |
| 467 | fCant = charSequence.toString().toFloat() | 496 | fCant = charSequence.toString().toFloat() |
| 468 | } | 497 | } |
| 469 | // .input("Cantidad",1,,1,0,InputType.TYPE_CLASS_NUMBER,0,waitForPositiveButton = true,false,positiveButton ()) | ||
| 470 | positiveButton(R.string.btnOk) { | 498 | positiveButton(R.string.btnOk) { |
| 471 | dismiss() | 499 | dismiss() |
| 472 | cargarArtEnBd(artAcargar, fCant) | 500 | cargarArtEnBd(artAcargar, fCant) |
| 473 | cargarRecicler(artAcargar, fCant) | 501 | cargarRecicler(artAcargar, fCant) |
| 474 | 502 | ||
| 475 | } | 503 | } |
| 476 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 504 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 477 | } | 505 | } |
| 478 | } else {// TODO si no lo encuentra en la BD | 506 | } else {// TODO si no lo encuentra en la BD |
| 507 | |||
| 479 | MaterialDialog(requireContext()).show { | 508 | MaterialDialog(requireContext()).show { |
| 480 | title(R.string.sTitulo) | 509 | title(text = "El producto: $sChangeUpper") |
| 481 | message(R.string.sMensaje) | 510 | message(text = "¡No fue encontrado!") |
| 482 | positiveButton(R.string.btnOk) { | 511 | positiveButton(R.string.btnOk) {} |
| 483 | // if (this.swSumaUno.isChecked) { | 512 | dismiss() |
| 484 | // swSumaUno.isChecked=false | 513 | } |
| 485 | // } | ||
| 486 | dismiss() | ||
| 487 | } | ||
| 488 | }.cornerRadius(10F) | ||
| 489 | } | 514 | } |
| 490 | } | 515 | } |
| 491 | 516 | ||
| 492 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { | 517 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { |
| 493 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 518 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 494 | var busqueda: Articles? = null | 519 | var busqueda: Articles? = null |
| 495 | return GlobalScope.async(Dispatchers.IO) { | 520 | return GlobalScope.async(Dispatchers.IO) { |
| 496 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea) | 521 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea) |
| 497 | return@async busqueda | 522 | return@async busqueda |
| 498 | }.await() | 523 | }.await() |
| 499 | } | 524 | } |
| 500 | 525 | ||
| 501 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { | 526 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { |
| 502 | //TODO BUSQUEDA POR DESCRIPCION | 527 | //TODO BUSQUEDA POR DESCRIPCION |
| 503 | var busqueda: List<Articles>? = null | 528 | var busqueda: List<Articles>? = null |
| 504 | return GlobalScope.async(Dispatchers.IO) { | 529 | return GlobalScope.async(Dispatchers.IO) { |
| 505 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea) | 530 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea) |
| 506 | return@async busqueda | 531 | return@async busqueda |
| 507 | }.await() | 532 | }.await() |
| 508 | } | 533 | } |
| 509 | 534 | ||
| 510 | private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | 535 | private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { |
| 511 | var indice = 0 | 536 | var indice = 0 |
| 512 | var bEncontrado = false | 537 | var bEncontrado = false |
| 513 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | 538 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS |
| 514 | for (item in listArticulos) { | 539 | for (item in listArticulos) { |
| 515 | if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 540 | if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
| 516 | bEncontrado = true | 541 | bEncontrado = true |
| 517 | break | 542 | break |
| 518 | } | 543 | } |
| 519 | indice += 1 | 544 | indice += 1 |
| 520 | } | 545 | } |
| 521 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | 546 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION |
| 522 | for (item in listArticulos) { | 547 | for (item in listArticulos) { |
| 523 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 548 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
| 524 | bEncontrado = true | 549 | bEncontrado = true |
| 525 | break | 550 | break |
| 526 | } | 551 | } |
| 527 | indice += 1 | 552 | indice += 1 |
| 528 | } | 553 | } |
| 529 | }else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | 554 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN |
| 530 | for (item in listArticulos) { | 555 | for (item in listArticulos) { |
| 531 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 556 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
| 532 | bEncontrado = true | 557 | bEncontrado = true |
| 533 | break | 558 | break |
| 534 | } | 559 | } |
| 535 | indice += 1 | 560 | indice += 1 |
| 536 | } | 561 | } |
| 537 | } | 562 | } |
| 538 | return if (bEncontrado) indice | 563 | return if (bEncontrado) indice |
| 539 | else -1 | 564 | else -1 |
| 540 | } | 565 | } |
| 541 | 566 | ||
| 542 | private fun cargarArtEnBd(articulos: Articles, cant: Float) { | 567 | private fun cargarArtEnBd(articulos: Articles, cant: Float) { |
| 543 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD | 568 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD |
| 544 | articulos.sector, | 569 | articulos.sector, |
| 545 | articulos.codigo, | 570 | articulos.codigo, |
| 546 | articulos.descripcion, | 571 | articulos.descripcion, |
| 547 | cant.toString(), | 572 | cant.toString(), |
| 548 | articulos.codBar, | 573 | articulos.codBar, |
| 549 | articulos.codOrigen, | 574 | articulos.codOrigen, |
| 550 | articulos.precio, | 575 | articulos.precio, |
| 551 | articulos.precio, | 576 | articulos.precio, |
| 552 | articulos.balanza, | 577 | articulos.balanza, |
| 553 | articulos.depSn, | 578 | articulos.depSn, |
| 554 | ObtenerFechaActual(), | 579 | ObtenerFechaActual(), |
| 555 | ObtenerFechaActual()) | 580 | ObtenerFechaActual()) |
| 556 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS | 581 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS |
| 557 | } | 582 | } |
| 558 | 583 | ||
| 559 | fun cargarRecicler(articulos: Articles, cant: Float) { | 584 | fun cargarRecicler(articulos: Articles, cant: Float) { |
| 560 | 585 | ||
| 561 | //TODO CARGO EN LE RV | 586 | //TODO CARGO EN LE RV |
| 562 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar,articulos.codOrigen) | 587 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen) |
| 563 | listArticulos.add(item) | 588 | listArticulos.add(item) |
| 564 | 589 | ||
| 565 | viewAdapter = ProductosListAdapter(listArticulos) | 590 | viewAdapter = ProductosListAdapter(listArticulos) |
| 566 | viewManager = LinearLayoutManager(requireContext()) | 591 | viewManager = LinearLayoutManager(requireContext()) |
| 567 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 592 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
| 568 | rcInventarios.apply { | 593 | rcInventarios.apply { |
| 569 | adapter = viewAdapter | 594 | adapter = viewAdapter |
| 570 | layoutManager = viewManager | 595 | layoutManager = viewManager |
| 571 | } | 596 | } |
| 572 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 597 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
| 573 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 598 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
| 574 | return false | 599 | return false |
| 575 | } | 600 | } |
| 576 | 601 | ||
| 577 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | 602 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
| 578 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | 603 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) |
| 579 | viewAdapter.notifyDataSetChanged() | 604 | viewAdapter.notifyDataSetChanged() |
| 580 | } | 605 | } |
| 581 | 606 | ||
| 582 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 607 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
| 583 | val itemView = viewHolder.itemView | 608 | val itemView = viewHolder.itemView |
| 584 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 609 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
| 585 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 610 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
| 586 | 611 | ||
| 587 | if (dX > 0) { | 612 | if (dX > 0) { |
| 588 | 613 | ||
| 589 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 614 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
| 590 | else c.drawColor(Color.RED) | 615 | else c.drawColor(Color.RED) |
| 591 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 616 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
| 592 | } else { | 617 | } else { |
| 593 | 618 | ||
| 594 | } | ||
| 595 | |||
| 596 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
| 597 | deleteIcon.draw(c) | ||
| 598 | } | 619 | } |
| 620 | |||
| 621 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | ||
| 622 | deleteIcon.draw(c) | ||
| 623 | } | ||
| 599 | } | 624 | } |
| 600 | 625 | ||
| 601 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 626 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
| 602 | itemTouchHelper.attachToRecyclerView(rcInventarios) | 627 | itemTouchHelper.attachToRecyclerView(rcInventarios) |
| 603 | } | 628 | } |
| 604 | 629 | ||
| 605 | private fun ProdNoCont(): Int? { | 630 | private fun ProdNoCont(): Int? { |
| 606 | var mostrarStock = 0 | 631 | var mostrarStock = 0 |
| 607 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 | 632 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 |
| 608 | return mostrarStock | 633 | return mostrarStock |
| 609 | } | 634 | } |
| 610 | 635 | ||
| 611 | private fun AjusteProductos(): Int? { | 636 | private fun AjusteProductos(): Int? { |
| 612 | var prodInclu = 0 | 637 | var prodInclu = 0 |
| 613 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 | 638 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 |
| 614 | 639 | ||
| 615 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 | 640 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 |
| 616 | return prodInclu | 641 | return prodInclu |
| 617 | } | 642 | } |
| 618 | 643 | ||
| 619 | private fun SerchArea() { | 644 | private fun SerchArea() { |
| 620 | 645 | ||
| 621 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 | 646 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 |
| 622 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 | 647 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 |
| 623 | } | 648 | } |
| 624 | 649 | ||
| 625 | fun ObtenerFechaActual(): String? { | 650 | fun ObtenerFechaActual(): String? { |
| 626 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD | 651 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD |
| 627 | val current = LocalDateTime.now() | 652 | val current = LocalDateTime.now() |
| 628 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") | 653 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") |
| 629 | val dFechaHora = current.format(formatter) | 654 | val dFechaHora = current.format(formatter) |
| 630 | return dFechaHora.toString() | 655 | return dFechaHora.toString() |
| 631 | } | 656 | } |
| 632 | 657 | ||
| 633 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 658 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
| 634 | lifecycleScope.launch { | 659 | lifecycleScope.launch { |
| 635 | withContext(Dispatchers.IO) { | 660 | withContext(Dispatchers.IO) { |
| 636 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 661 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
| 637 | } | 662 | } |
| 638 | } | 663 | } |
| 639 | } | 664 | } |
| 640 | 665 | ||
| 641 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 666 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
| 642 | lifecycleScope.launch { | 667 | lifecycleScope.launch { |
| 643 | withContext(Dispatchers.IO) { | 668 | withContext(Dispatchers.IO) { |
| 644 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | 669 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/InventarioListAdapter.kt
| 1 | package com.focasoftware.deboinventariov20.ui.main | 1 | package com.focasoftware.deboinventariov20.ui.main |
| 2 | 2 | ||
| 3 | import android.view.LayoutInflater | 3 | import android.view.LayoutInflater |
| 4 | import android.view.View | 4 | import android.view.View |
| 5 | import android.view.ViewGroup | 5 | import android.view.ViewGroup |
| 6 | import androidx.recyclerview.widget.RecyclerView | 6 | import androidx.recyclerview.widget.RecyclerView |
| 7 | import com.focasoftware.deboinventariov20.R | 7 | import com.focasoftware.deboinventariov20.R |
| 8 | import com.google.android.material.snackbar.Snackbar | 8 | import com.google.android.material.snackbar.Snackbar |
| 9 | import kotlinx.android.synthetic.main.item.view.* | 9 | import kotlinx.android.synthetic.main.item.view.* |
| 10 | import kotlinx.android.synthetic.main.item_principal.view.* | 10 | import kotlinx.android.synthetic.main.item_principal.view.* |
| 11 | import javax.sql.ConnectionEventListener | 11 | import javax.sql.ConnectionEventListener |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | class InventarioListAdapter(private val productos: ArrayList<ItemInventario>, private val listener: OnItemClickListener) : RecyclerView.Adapter<InventarioListAdapter.ItemsViewHolder>() { | 14 | class InventarioListAdapter(private val productos: ArrayList<ItemInventario>, private val listener: OnItemClickListener) : RecyclerView.Adapter<InventarioListAdapter.ItemsViewHolder>() { |
| 15 | 15 | ||
| 16 | internal var items2: ArrayList<ItemInventario>? = null | 16 | internal var items2: ArrayList<ItemInventario>? = null |
| 17 | 17 | ||
| 18 | init { | 18 | init { |
| 19 | this.items2 = productos | 19 | this.items2 = productos |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_principal, parent, false)) | 22 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_principal, parent, false)) |
| 23 | 23 | ||
| 24 | override fun getItemCount() = productos.size | 24 | override fun getItemCount() = productos.size |
| 25 | 25 | ||
| 26 | override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { | 26 | override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { |
| 27 | val currentItem=productos[position] | 27 | val currentItem=productos[position] |
| 28 | holder.inventario.text=currentItem.inventario | 28 | holder.inventario.text=currentItem.inventario |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | inner class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view),View.OnClickListener { | 31 | inner class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view),View.OnClickListener { |
| 32 | 32 | ||
| 33 | |||
| 34 | val inventario = view.inventario | 33 | val inventario = view.inventario |
| 35 | init { | 34 | init { |
| 36 | itemView.setOnClickListener(this) | 35 | itemView.setOnClickListener(this) |
| 37 | } | 36 | } |
| 38 | override fun onClick(p0: View?) { | 37 | override fun onClick(p0: View?) { |
| 39 | val position=adapterPosition | 38 | val position=adapterPosition |
| 40 | if (position!=RecyclerView.NO_POSITION) { | 39 | if (position!=RecyclerView.NO_POSITION) { |
| 41 | listener.OnItemClick(position) | 40 | listener.OnItemClick(position) |
| 42 | } | 41 | } |
| 43 | } | 42 | } |
| 44 | } | 43 | } |
| 45 | 44 | ||
| 46 | interface OnItemClickListener{ | 45 | interface OnItemClickListener{ |
| 47 | fun OnItemClick(position: Int) | 46 | fun OnItemClick(position: Int) |
| 48 | } | 47 | } |
| 49 | } | 48 | } |
| 50 | 49 | ||
| 51 | 50 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/MainFragment.kt
| 1 | package com.focasoftware.deboinventariov20.ui.main | 1 | package com.focasoftware.deboinventariov20.ui.main |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import android.content.SharedPreferences | 4 | import android.content.SharedPreferences |
| 5 | import android.os.Bundle | 5 | import android.os.Bundle |
| 6 | import android.view.LayoutInflater | 6 | import android.view.LayoutInflater |
| 7 | import android.view.View | 7 | import android.view.View |
| 8 | import android.view.ViewGroup | 8 | import android.view.ViewGroup |
| 9 | import androidx.fragment.app.Fragment | 9 | import androidx.fragment.app.Fragment |
| 10 | import androidx.navigation.NavController | 10 | import androidx.navigation.NavController |
| 11 | import androidx.navigation.Navigation | 11 | import androidx.navigation.Navigation |
| 12 | import androidx.recyclerview.widget.LinearLayoutManager | 12 | import androidx.recyclerview.widget.LinearLayoutManager |
| 13 | import androidx.recyclerview.widget.RecyclerView | 13 | import androidx.recyclerview.widget.RecyclerView |
| 14 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 14 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 15 | import com.focasoftware.deboinventariov20.Model.InvHead | 15 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 16 | import com.focasoftware.deboinventariov20.R | 16 | import com.focasoftware.deboinventariov20.R |
| 17 | import kotlinx.coroutines.Dispatchers | 17 | import kotlinx.coroutines.Dispatchers |
| 18 | import kotlinx.coroutines.GlobalScope | 18 | import kotlinx.coroutines.GlobalScope |
| 19 | import kotlinx.coroutines.async | 19 | import kotlinx.coroutines.async |
| 20 | import kotlinx.coroutines.launch | 20 | import kotlinx.coroutines.launch |
| 21 | import java.util.* | 21 | import java.util.* |
| 22 | 22 | ||
| 23 | class MainFragment : Fragment(), InventarioListAdapter.OnItemClickListener { | 23 | class MainFragment : Fragment(), InventarioListAdapter.OnItemClickListener { |
| 24 | private lateinit var inventarios: List<InvHead> | 24 | private lateinit var inventarios: List<InvHead> |
| 25 | private lateinit var rcInventario: RecyclerView | 25 | private lateinit var rcInventario: RecyclerView |
| 26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
| 27 | private lateinit var viewManager: RecyclerView.LayoutManager | 27 | private lateinit var viewManager: RecyclerView.LayoutManager |
| 28 | private var listIvn = ArrayList<ItemInventario>() | 28 | private var listIvn = ArrayList<ItemInventario>() |
| 29 | private lateinit var navController: NavController | 29 | private lateinit var navController: NavController |
| 30 | private lateinit var sharedPreferences: SharedPreferences | 30 | private lateinit var sharedPreferences: SharedPreferences |
| 31 | 31 | ||
| 32 | override fun onCreate(savedInstanceState: Bundle?) { | 32 | override fun onCreate(savedInstanceState: Bundle?) { |
| 33 | super.onCreate(savedInstanceState) | 33 | super.onCreate(savedInstanceState) |
| 34 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 34 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 39 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 40 | val v = inflater.inflate(R.layout.fragment_main, container, false) | 40 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
| 41 | |||
| 41 | GlobalScope.launch(Dispatchers.Main) { | 42 | GlobalScope.launch(Dispatchers.Main) { |
| 42 | inventarios = buscarEnBDInvHead() | 43 | inventarios = buscarEnBDInvHead() |
| 43 | for ((i, item) in inventarios.withIndex()) { | 44 | for ((i, item) in inventarios.withIndex()) { |
| 44 | val inv = InvHead(inventarios[i].invNum, | 45 | val inv = InvHead(inventarios[i].invNum, |
| 45 | inventarios[i].descripcion, | 46 | inventarios[i].descripcion, |
| 46 | inventarios[i].estado, | 47 | inventarios[i].estado, |
| 47 | inventarios[i].fechaInicio, | 48 | inventarios[i].fechaInicio, |
| 48 | inventarios[i].fechaFinal, | 49 | inventarios[i].fechaFinal, |
| 49 | inventarios[i].prodContados, | 50 | inventarios[i].prodContados, |
| 50 | inventarios[i].lugar, | 51 | inventarios[i].lugar, |
| 51 | inventarios[i].stDesc, | 52 | inventarios[i].stDesc, |
| 52 | inventarios[i].proNoCont) | 53 | inventarios[i].proNoCont) |
| 53 | cargarRecicler(inv) | 54 | cargarRecicler(inv) |
| 54 | } | 55 | } |
| 55 | } | 56 | } |
| 56 | rcInventario = v.findViewById(R.id.rcInventario) | 57 | rcInventario = v.findViewById(R.id.rcInventario) |
| 57 | return v | 58 | return v |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | suspend fun buscarEnBDInvHead(): List<InvHead> { | 61 | suspend fun buscarEnBDInvHead(): List<InvHead> { |
| 61 | //TODO BUSQUEDA POR DESCRIPCION | 62 | //TODO BUSQUEDA POR DESCRIPCION |
| 62 | var busqueda: List<InvHead> | 63 | var busqueda: List<InvHead> |
| 63 | return GlobalScope.async(Dispatchers.IO) { | 64 | return GlobalScope.async(Dispatchers.IO) { |
| 64 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | 65 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() |
| 65 | return@async busqueda | 66 | return@async busqueda |
| 66 | }.await() | 67 | }.await() |
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | fun cargarRecicler(inv: InvHead) { | 70 | fun cargarRecicler(inv: InvHead) { |
| 70 | //TODO CARGO EN LE RV | 71 | //TODO CARGO EN LE RV |
| 71 | 72 | ||
| 72 | val number = if (inv.invNum.toLong()<10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | 73 | val number = if (inv.invNum.toLong()<10) "0${inv.invNum.toLong()}" else inv.invNum.toString() |
| 73 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | 74 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") |
| 74 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) | 75 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) |
| 75 | listIvn.add(item) | 76 | listIvn.add(item) |
| 76 | 77 | ||
| 77 | viewAdapter = InventarioListAdapter(listIvn, this) | 78 | viewAdapter = InventarioListAdapter(listIvn, this) |
| 78 | viewManager = LinearLayoutManager(requireContext()) | 79 | viewManager = LinearLayoutManager(requireContext()) |
| 79 | 80 | ||
| 80 | rcInventario.apply { | 81 | rcInventario.apply { |
| 81 | adapter = viewAdapter | 82 | adapter = viewAdapter |
| 82 | layoutManager = viewManager | 83 | layoutManager = viewManager |
| 83 | } | 84 | } |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 87 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 87 | super.onViewCreated(view, savedInstanceState) | 88 | super.onViewCreated(view, savedInstanceState) |
| 88 | navController = Navigation.findNavController(view) | 89 | navController = Navigation.findNavController(view) |
| 90 | listIvn.clear() | ||
| 89 | } | 91 | } |
| 90 | 92 | ||
| 91 | override fun OnItemClick(position: Int) { | 93 | override fun OnItemClick(position: Int) { |
| 92 | val editor = sharedPreferences.edit() | 94 | val editor = sharedPreferences.edit() |
| 93 | var invSel:String = listIvn[position].inventario.toString() | 95 | var invSel:String = listIvn[position].inventario.toString() |
| 94 | invSel=invSel.substring(3, 5) | 96 | invSel=invSel.substring(3, 5) |
| 95 | editor?.putString("Inventario", invSel) | 97 | editor?.putString("Inventario", invSel) |
| 96 | editor?.apply() | 98 | editor?.apply() |
| 97 | editor.commit() | 99 | editor.commit() |
| 98 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | 100 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) |
| 99 | 101 | ||
| 100 | } | 102 | } |
| 101 | } | 103 | } |
| 102 | 104 | ||
| 103 | 105 |
app/src/main/res/layout/dialog_signin.xml
| 1 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | File was deleted | |
| 2 | android:orientation="vertical" | ||
| 3 | android:layout_width="wrap_content" | ||
| 4 | android:layout_height="wrap_content"> | ||
| 5 | |||
| 6 | <EditText | ||
| 7 | android:id="@+id/username" | ||
| 8 | android:inputType="textEmailAddress" | ||
| 9 | android:layout_width="match_parent" | ||
| 10 | android:layout_height="wrap_content" | ||
| 11 | android:layout_marginTop="16dp" | ||
| 12 | android:layout_marginLeft="4dp" | ||
| 13 | android:layout_marginRight="4dp" | ||
| 14 | android:layout_marginBottom="4dp" | ||
| 15 | android:hint="" /> | ||
| 16 | <EditText | ||
| 17 | android:id="@+id/password" | ||
| 18 | android:inputType="textPassword" | ||
| 19 | android:layout_width="match_parent" | ||
| 20 | android:layout_height="wrap_content" | ||
| 21 | android:layout_marginTop="4dp" | ||
| 22 | android:layout_marginLeft="4dp" | ||
| 23 | android:layout_marginRight="4dp" | ||
| 24 | android:layout_marginBottom="16dp" | ||
| 25 | android:fontFamily="sans-serif" | ||
| 26 | android:hint=""/> | ||
| 27 | </LinearLayout> |
app/src/main/res/layout/ingresar_cantidad.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.cardview.widget.CardView | 2 | <androidx.cardview.widget.CardView |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
| 6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
| 7 | android:layout_height="wrap_content" | 7 | android:layout_height="wrap_content" |
| 8 | app:cardCornerRadius="10dp" | 8 | app:cardCornerRadius="10dp" |
| 9 | app:cardElevation="5dp" | 9 | app:cardElevation="5dp" |
| 10 | android:background="@drawable/md_transparent" | 10 | android:background="@drawable/md_transparent" |
| 11 | tools:context=".ui.inventario.InsertCant" | ||
| 12 | tools:ignore="PrivateResource"> | 11 | tools:ignore="PrivateResource"> |
| 13 | 12 | ||
| 14 | 13 | ||
| 15 | <androidx.constraintlayout.widget.ConstraintLayout | 14 | <androidx.constraintlayout.widget.ConstraintLayout |
| 16 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
| 17 | android:layout_height="match_parent"> | 16 | android:layout_height="match_parent"> |
| 18 | 17 | ||
| 19 | <LinearLayout | 18 | <LinearLayout |
| 20 | android:id="@+id/barraSuperior" | 19 | android:id="@+id/barraSuperior" |
| 21 | android:layout_width="0dp" | 20 | android:layout_width="0dp" |
| 22 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
| 23 | android:background="@color/colorPrimaryDark" | 22 | android:background="@color/colorPrimaryDark" |
| 24 | android:orientation="horizontal" | 23 | android:orientation="horizontal" |
| 25 | app:layout_constraintLeft_toLeftOf="parent" | 24 | app:layout_constraintLeft_toLeftOf="parent" |
| 26 | app:layout_constraintRight_toRightOf="parent" | 25 | app:layout_constraintRight_toRightOf="parent" |
| 27 | app:layout_constraintTop_toTopOf="parent" | 26 | app:layout_constraintTop_toTopOf="parent" |
| 28 | app:layout_constraintTop_toBottomOf="@+id/lySegundo"> | 27 | app:layout_constraintTop_toBottomOf="@+id/lySegundo"> |
| 29 | 28 | ||
| 30 | <androidx.appcompat.widget.AppCompatTextView | 29 | <androidx.appcompat.widget.AppCompatTextView |
| 30 | android:id="@+id/tvTitulo" | ||
| 31 | android:layout_width="0dp" | 31 | android:layout_width="0dp" |
| 32 | android:layout_height="wrap_content" | 32 | android:layout_height="wrap_content" |
| 33 | android:layout_margin="10dp" | 33 | android:layout_margin="10dp" |
| 34 | android:layout_marginStart="5dp" | 34 | android:layout_marginStart="5dp" |
| 35 | android:layout_marginTop="10dp" | 35 | android:layout_marginTop="10dp" |
| 36 | android:layout_weight="1" | 36 | android:layout_weight="1" |
| 37 | android:text="@string/adv" | 37 | android:text="@string/adv" |
| 38 | android:textAlignment="center" | 38 | android:textAlignment="center" |
| 39 | android:textColor="@android:color/white" | 39 | android:textColor="@android:color/white" |
| 40 | android:textSize="25sp" | 40 | android:textSize="25sp" |
| 41 | android:textStyle="bold" /> | 41 | android:textStyle="bold" /> |
| 42 | </LinearLayout> | 42 | </LinearLayout> |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | <LinearLayout | 45 | <LinearLayout |
| 46 | android:id="@+id/lySegundo" | 46 | android:id="@+id/lySegundo" |
| 47 | android:layout_width="match_parent" | 47 | android:layout_width="match_parent" |
| 48 | android:layout_height="wrap_content" | 48 | android:layout_height="wrap_content" |
| 49 | android:orientation="vertical" | 49 | android:orientation="vertical" |
| 50 | android:padding="12dp" | 50 | android:padding="12dp" |
| 51 | app:layout_constraintLeft_toLeftOf="parent" | 51 | app:layout_constraintLeft_toLeftOf="parent" |
| 52 | app:layout_constraintRight_toRightOf="parent" | 52 | app:layout_constraintRight_toRightOf="parent" |
| 53 | app:layout_constraintTop_toBottomOf="@id/barraSuperior"> | 53 | app:layout_constraintTop_toBottomOf="@id/barraSuperior"> |
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | 56 | ||
| 57 | <EditText | 57 | <EditText |
| 58 | android:id="@+id/etCantidad" | 58 | android:id="@+id/etCantidad" |
| 59 | android:layout_width="match_parent" | 59 | android:layout_width="match_parent" |
| 60 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
| 61 | android:ems="10" | 61 | android:ems="10" |
| 62 | android:gravity="center" | 62 | android:gravity="center" |
| 63 | android:textSize="20sp" | 63 | android:textSize="20sp" |
| 64 | android:focusable="true" | 64 | android:focusable="true" |
| 65 | android:clickable="true" | 65 | android:clickable="true" |
| 66 | android:inputType="numberDecimal" | 66 | android:inputType="numberDecimal" |
| 67 | android:text="" /> | 67 | android:text="" /> |
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | <androidx.appcompat.widget.AppCompatButton | 70 | <androidx.appcompat.widget.AppCompatButton |
| 71 | android:id="@+id/btnAceptar" | 71 | android:id="@+id/btnAceptar" |
| 72 | android:layout_width="match_parent" | 72 | android:layout_width="match_parent" |
| 73 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
| 74 | android:layout_margin="10dp" | 74 | android:layout_margin="10dp" |
| 75 | android:layout_marginBottom="20dp" | 75 | android:layout_marginBottom="20dp" |
| 76 | android:clickable="true" | 76 | android:clickable="true" |
| 77 | android:focusable="true" | 77 | android:focusable="true" |
| 78 | android:textColor="@android:color/white" | 78 | android:textColor="@android:color/white" |
| 79 | android:padding="10dp" | 79 | android:padding="10dp" |
| 80 | android:background="@drawable/boton_borde_redondeado" | 80 | android:background="@drawable/boton_borde_redondeado" |
| 81 | android:text="@string/btnConfirmar" | 81 | android:text="@string/btnConfirmar" |
| 82 | android:textAlignment="center" | 82 | android:textAlignment="center" |
| 83 | android:textSize="20sp" | 83 | android:textSize="20sp" |
| 84 | android:textStyle="bold" | 84 | android:textStyle="bold" |
| 85 | app:cardBackgroundColor="@android:color/darker_gray" | 85 | app:cardBackgroundColor="@android:color/darker_gray" |
| 86 | app:cardUseCompatPadding="true" /> | 86 | app:cardUseCompatPadding="true" /> |
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | </LinearLayout> | 89 | </LinearLayout> |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | </androidx.constraintlayout.widget.ConstraintLayout> | 92 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/item_principal.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.cardview.widget.CardView | 2 | <androidx.cardview.widget.CardView |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 5 | android:id="@+id/cvInventario" | 5 | xmlns:tools="http://schemas.android.com/tools" |
| 6 | android:layout_width="match_parent" | 6 | android:id="@+id/cvInventario" |
| 7 | android:layout_width="match_parent" | ||
| 8 | android:layout_height="wrap_content" | ||
| 9 | android:layout_rowWeight="1" | ||
| 10 | android:layout_columnWeight="1" | ||
| 11 | android:layout_margin="15dp" | ||
| 12 | android:clickable="true" | ||
| 13 | app:cardCornerRadius="8dp" | ||
| 14 | app:cardElevation="8dp" | ||
| 15 | app:layout_constraintBottom_toBottomOf="parent" | ||
| 16 | app:layout_constraintEnd_toEndOf="parent" | ||
| 17 | app:layout_constraintStart_toStartOf="parent" | ||
| 18 | app:layout_constraintTop_toTopOf="parent"> | ||
| 19 | |||
| 20 | <LinearLayout | ||
| 21 | android:layout_width="wrap_content" | ||
| 7 | android:layout_height="wrap_content" | 22 | android:layout_height="wrap_content" |
| 8 | android:layout_rowWeight="1" | 23 | android:layout_gravity="center_horizontal|center_vertical" |
| 9 | android:layout_columnWeight="1" | 24 | android:orientation="vertical"> |
| 10 | android:layout_margin="15dp" | ||
| 11 | app:cardCornerRadius="8dp" | ||
| 12 | app:cardElevation="8dp" | ||
| 13 | app:layout_constraintBottom_toBottomOf="parent" | ||
| 14 | app:layout_constraintEnd_toEndOf="parent" | ||
| 15 | app:layout_constraintStart_toStartOf="parent" | ||
| 16 | app:layout_constraintTop_toTopOf="parent"> | ||
| 17 | 25 | ||
| 18 | <LinearLayout | 26 | <androidx.appcompat.widget.AppCompatImageView |
| 19 | android:layout_width="wrap_content" | 27 | android:layout_width="wrap_content" |
| 20 | android:layout_height="wrap_content" | 28 | android:layout_height="wrap_content" |
| 21 | android:layout_gravity="center_horizontal|center_vertical" | 29 | android:layout_gravity="center_horizontal" |
| 22 | android:layout_margin="15dp" | 30 | android:src="@drawable/inventario" /> |
| 23 | android:orientation="vertical"> | ||
| 24 | |||
| 25 | <androidx.appcompat.widget.AppCompatImageView | ||
| 26 | android:layout_width="wrap_content" | ||
| 27 | android:layout_height="wrap_content" | ||
| 28 | android:layout_gravity="center_horizontal" | ||
| 29 | android:src="@drawable/inventario" /> | ||
| 30 | 31 | ||
| 31 | <androidx.appcompat.widget.AppCompatTextView | 32 | <TextView |
| 32 | android:id="@+id/inventario" | 33 | android:id="@+id/inventario" |
app/src/main/res/navigation/mobile_navigation.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | android:id="@+id/mobile_navigation" | 5 | android:id="@+id/mobile_navigation" |
| 6 | app:startDestination="@id/mainFragment2"> | 6 | app:startDestination="@id/mainFragment2"> |
| 7 | 7 | ||
| 8 | <activity | 8 | <activity |
| 9 | android:id="@+id/mainActivity" | 9 | android:id="@+id/mainActivity" |
| 10 | android:name="com.focasoftware.deboinventariov20.MainActivity" | 10 | android:name="com.focasoftware.deboinventariov20.MainActivity" |
| 11 | android:label="app_bar_main" | 11 | android:label="app_bar_main" |
| 12 | tools:layout="@layout/app_bar_main" /> | 12 | tools:layout="@layout/app_bar_main" /> |
| 13 | <fragment | 13 | <fragment |
| 14 | android:id="@+id/mainFragment2" | 14 | android:id="@+id/mainFragment2" |
| 15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" | 15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" |
| 16 | android:label="Principal" | 16 | android:label="Principal" |
| 17 | tools:layout="@layout/fragment_main" > | 17 | tools:layout="@layout/fragment_main" > |
| 18 | <action | 18 | <action |
| 19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" | 19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" |
| 20 | app:destination="@id/configuracionFragment" | 20 | app:destination="@id/configuracionFragment" |
| 21 | app:popEnterAnim="@anim/slide_in_left" | 21 | app:popEnterAnim="@anim/slide_in_left" |
| 22 | app:popExitAnim="@anim/slide_out_right" | 22 | app:popExitAnim="@anim/slide_out_right" |
| 23 | app:enterAnim="@anim/slide_in_right" | 23 | app:enterAnim="@anim/slide_in_right" |
| 24 | app:exitAnim="@anim/slide_out_left" /> | 24 | app:exitAnim="@anim/slide_out_left" /> |
| 25 | <action | 25 | <action |
| 26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" | 26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" |
| 27 | app:destination="@id/actuaMaestrosFragment" | 27 | app:destination="@id/actuaMaestrosFragment" |
| 28 | app:popEnterAnim="@anim/slide_in_left" | 28 | app:popEnterAnim="@anim/slide_in_left" |
| 29 | app:popExitAnim="@anim/slide_out_right" | 29 | app:popExitAnim="@anim/slide_out_right" |
| 30 | app:enterAnim="@anim/slide_in_right" | 30 | app:enterAnim="@anim/slide_in_right" |
| 31 | app:exitAnim="@anim/slide_out_left" /> | 31 | app:exitAnim="@anim/slide_out_left" /> |
| 32 | <action | 32 | <action |
| 33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" | 33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" |
| 34 | app:destination="@id/inventarioFragment" | 34 | app:destination="@id/inventarioFragment" |
| 35 | app:popEnterAnim="@anim/slide_in_left" | 35 | app:popEnterAnim="@anim/slide_in_left" |
| 36 | app:popExitAnim="@anim/slide_out_right" | 36 | app:popExitAnim="@anim/slide_out_right" |
| 37 | app:enterAnim="@anim/slide_in_right" | 37 | app:enterAnim="@anim/slide_in_right" |
| 38 | app:exitAnim="@anim/slide_out_left" /> | 38 | app:exitAnim="@anim/slide_out_left" /> |
| 39 | </fragment> | 39 | </fragment> |
| 40 | <fragment | 40 | <fragment |
| 41 | android:id="@+id/actuaMaestrosFragment" | 41 | android:id="@+id/actuaMaestrosFragment" |
| 42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" | 42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" |
| 43 | android:label="Actualización de Maestros" | 43 | android:label="Actualización de Maestros" |
| 44 | tools:layout="@layout/fragment_actua_maestros" /> | 44 | tools:layout="@layout/fragment_actua_maestros" /> |
| 45 | <fragment | 45 | <fragment |
| 46 | android:id="@+id/servidoresFragment" | 46 | android:id="@+id/servidoresFragment" |
| 47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" | 47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" |
| 48 | android:label="Alta Servidores" | 48 | android:label="Alta Servidores" |
| 49 | tools:layout="@layout/fragment_servidores"> | 49 | tools:layout="@layout/fragment_servidores"> |
| 50 | <action | 50 | <action |
| 51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | 51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" |
| 52 | app:destination="@id/configuracionFragment" | 52 | app:destination="@id/configuracionFragment" |
| 53 | app:enterAnim="@anim/slide_in_right" | 53 | app:enterAnim="@anim/slide_in_right" |
| 54 | app:exitAnim="@anim/slide_out_left" | 54 | app:exitAnim="@anim/slide_out_left" |
| 55 | app:popEnterAnim="@anim/slide_in_left" | 55 | app:popEnterAnim="@anim/slide_in_left" |
| 56 | app:popExitAnim="@anim/slide_out_right" /> | 56 | app:popExitAnim="@anim/slide_out_right" /> |
| 57 | </fragment> | 57 | </fragment> |
| 58 | <fragment | 58 | <fragment |
| 59 | android:id="@+id/inventarioFragment" | 59 | android:id="@+id/inventarioFragment" |
| 60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" | 60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" |
| 61 | android:label="Inventario Dinamico" | 61 | android:label="Inventario Dinamico" |
| 62 | tools:layout="@layout/fragment_inventario" > | 62 | tools:layout="@layout/fragment_inventario" > |
| 63 | <action | 63 | <action |
| 64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" | 64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" |
| 65 | app:destination="@id/descripcionFragment" | 65 | app:destination="@id/descripcionFragment" |
| 66 | app:popEnterAnim="@anim/slide_in_left" | 66 | app:popEnterAnim="@anim/slide_in_left" |
| 67 | app:popExitAnim="@anim/slide_out_right" | 67 | app:popExitAnim="@anim/slide_out_right" |
| 68 | app:enterAnim="@anim/slide_in_right" | 68 | app:enterAnim="@anim/slide_in_right" |
| 69 | app:exitAnim="@anim/slide_out_left" /> | 69 | app:exitAnim="@anim/slide_out_left" /> |
| 70 | <action | 70 | <action |
| 71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" | 71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" |
| 72 | app:destination="@id/mainFragment2" | 72 | app:destination="@id/mainFragment2" |
| 73 | app:popEnterAnim="@anim/slide_in_left" | 73 | app:popEnterAnim="@anim/slide_in_left" |
| 74 | app:popExitAnim="@anim/slide_out_right" | 74 | app:popExitAnim="@anim/slide_out_right" |
| 75 | app:enterAnim="@anim/slide_in_right" | 75 | app:enterAnim="@anim/slide_in_right" |
| 76 | app:exitAnim="@anim/slide_out_left"/> | 76 | app:exitAnim="@anim/slide_out_left"/> |
| 77 | 77 | ||
| 78 | </fragment> | 78 | </fragment> |
| 79 | <fragment | 79 | <fragment |
| 80 | android:id="@+id/configuracionFragment" | 80 | android:id="@+id/configuracionFragment" |
| 81 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" | 81 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" |
| 82 | android:label="Configuraciones" | 82 | android:label="Configuraciones" |
| 83 | tools:layout="@layout/fragment_configuracion" > | 83 | tools:layout="@layout/fragment_configuracion" > |
| 84 | <action | 84 | <action |
| 85 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | 85 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" |
| 86 | app:destination="@id/servidoresFragment" | 86 | app:destination="@id/servidoresFragment" |
| 87 | app:popEnterAnim="@anim/slide_in_left" | 87 | app:popEnterAnim="@anim/slide_in_left" |
| 88 | app:popExitAnim="@anim/slide_out_right" | 88 | app:popExitAnim="@anim/slide_out_right" |
| 89 | app:enterAnim="@anim/slide_in_right" | 89 | app:enterAnim="@anim/slide_in_right" |
| 90 | app:exitAnim="@anim/slide_out_left" /> | 90 | app:exitAnim="@anim/slide_out_left" /> |
| 91 | </fragment> | 91 | </fragment> |
| 92 | <fragment | 92 | <fragment |
| 93 | android:id="@+id/descripcionFragment" | 93 | android:id="@+id/descripcionFragment" |
| 94 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" | 94 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" |
| 95 | android:label="Productos Encontrados"> | 95 | android:label="Productos Encontrados"> |
| 96 | 96 | ||
| 97 | <action | 97 | <action |
| 98 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 98 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
| 99 | app:destination="@id/inventarioFragment" | 99 | app:destination="@id/inventarioFragment" |
| 100 | app:popEnterAnim="@anim/slide_in_left" | 100 | app:popEnterAnim="@anim/slide_in_left" |
| 101 | app:popExitAnim="@anim/slide_out_right" | 101 | app:popExitAnim="@anim/slide_out_right" |
| 102 | app:enterAnim="@anim/slide_in_right" | 102 | app:enterAnim="@anim/slide_in_right" |
| 103 | app:exitAnim="@anim/slide_out_left" | 103 | app:exitAnim="@anim/slide_out_left" |
| 104 | app:popUpTo="@+id/descripcionFragment" | 104 | app:popUpTo="@+id/descripcionFragment" |
| 105 | app:popUpToInclusive="true"/> | 105 | app:popUpToInclusive="true"/> |
| 106 | </fragment> | 106 | </fragment> |
| 107 | <dialog | ||
| 108 | android:id="@+id/dialogNoEncontrado" | ||
| 109 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" | ||
| 110 | android:label="DialogNoEncontrado" /> | ||
| 111 | <fragment | ||
| 112 | android:id="@+id/dialogoLogin" | ||
| 113 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" | ||
| 114 | android:label="dialogoLogin" /> | ||
| 115 | <fragment | ||
| 116 | android:id="@+id/singleChoiceAlertDialog" | ||
| 117 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" | ||
| 118 | android:label="SingleChoiceAlertDialog" /> | ||
| 107 | </navigation> | 119 | </navigation> |
app/src/main/res/values/strings.xml
| 1 | <resources> | 1 | <resources> |
| 2 | 2 | ||
| 3 | <string name="nav_header_title">Android Studio</string> | 3 | <string name="nav_header_title">Android Studio</string> |
| 4 | <string name="nav_header_subtitle">android.studio@android.com</string> | 4 | <string name="nav_header_subtitle">android.studio@android.com</string> |
| 5 | <string name="nav_header_desc">Navigation header</string> | 5 | <string name="nav_header_desc">Navigation header</string> |
| 6 | <string name="action_settings">Settings</string> | 6 | <string name="action_settings">Settings</string> |
| 7 | 7 | ||
| 8 | <string name="menu_home">Home</string> | 8 | <string name="menu_home">Home</string> |
| 9 | <string name="menu_gallery">Gallery</string> | 9 | <string name="menu_gallery">Gallery</string> |
| 10 | <string name="menu_slideshow">Slideshow</string> | 10 | <string name="menu_slideshow">Slideshow</string> |
| 11 | 11 | ||
| 12 | <string name="app_name">Inventario Dinamicos</string> | 12 | <string name="app_name">Inventario Dinamicos</string> |
| 13 | 13 | ||
| 14 | <!-- menu--> | 14 | <!-- menu--> |
| 15 | <string name="menuInicio">Inicio</string> | 15 | <string name="menuInicio">Inicio</string> |
| 16 | <string name="menuNueInv">Nuevo Inventario</string> | 16 | <string name="menuNueInv">Nuevo Inventario</string> |
| 17 | <string name="menuActMae">Actualizar Maestros</string> | 17 | <string name="menuActMae">Actualizar Maestros</string> |
| 18 | <string name="menuConf">Configuraciones</string> | 18 | <string name="menuConf">Configuraciones</string> |
| 19 | <string name="menuSal">Salir</string> | 19 | <string name="menuSal">Salir</string> |
| 20 | 20 | ||
| 21 | <!-- Menu header--> | 21 | <!-- Menu header--> |
| 22 | <string name="menuLeyenda">Debo Inventario</string> | 22 | <string name="menuLeyenda">Debo Inventario</string> |
| 23 | 23 | ||
| 24 | <string name="navigation_drawer_open">Open navigation drawer</string> | 24 | <string name="navigation_drawer_open">Open navigation drawer</string> |
| 25 | <string name="navigation_drawer_close">Close navigation drawer</string> | 25 | <string name="navigation_drawer_close">Close navigation drawer</string> |
| 26 | 26 | ||
| 27 | <!-- Pantalla de inicio--> | 27 | <!-- Pantalla de inicio--> |
| 28 | <string name="bien">Bienvenido</string> | 28 | <string name="bien">Bienvenido</string> |
| 29 | <string name="debo">DEBO®</string> | 29 | <string name="debo">DEBO®</string> |
| 30 | <string name="inventario">Inventario</string> | 30 | <string name="inventario">Inventario</string> |
| 31 | <string name="todo">TODO</string> | 31 | <string name="todo">TODO</string> |
| 32 | <string name="hello_blank_fragment">Hello blank fragment</string> | 32 | <string name="hello_blank_fragment">Hello blank fragment</string> |
| 33 | 33 | ||
| 34 | <!-- inventarios dinamicos--> | 34 | <!-- inventarios dinamicos--> |
| 35 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> | 35 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> |
| 36 | <string name="invDinamicoCompra">Inventarios Sectorizados</string> | 36 | <string name="invDinamicoCompra">Inventarios Sectorizados</string> |
| 37 | 37 | ||
| 38 | <!-- ventana emergente--> | 38 | <!-- ventana emergente--> |
| 39 | <string name="adv">Ingrese la cantidad contada</string> | 39 | <string name="adv">Ingrese la cantidad contada</string> |
| 40 | <string name="invVentas">Inventarios Dinamicos de Ventas</string> | 40 | <string name="invVentas">Inventarios Dinamicos de Ventas</string> |
| 41 | <string name="btnConfirmar">Confirmar</string> | 41 | <string name="btnConfirmar">Confirmar</string> |
| 42 | <string name="btnCancela">Cancelar</string> | 42 | <string name="btnCancela">Cancelar</string> |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | <!-- Fragment Inventario--> | 45 | <!-- Fragment Inventario--> |
| 46 | <string name="invTitulo">Inventarios Dinámicos</string> | 46 | <string name="invTitulo">Inventarios Dinámicos</string> |
| 47 | <string name="invTituloV">Inventarios de Ventas</string> | 47 | <string name="invTituloV">Inventarios de Ventas</string> |
| 48 | <string name="invTituloD">Inventarios de Depositos</string> | 48 | <string name="invTituloD">Inventarios de Depositos</string> |
| 49 | <string name="invCodigoBarras">Código Barras:</string> | 49 | <string name="invCodigoBarras">Código Barras:</string> |
| 50 | <string name="btnExportarInv">Exportar Inventario</string> | 50 | <string name="btnExportarInv">Exportar Inventario</string> |
| 51 | <string name="btnBorrarInv">Borrar Inventario</string> | 51 | <string name="btnBorrarInv">Borrar Inventario</string> |
| 52 | <string name="ibBusDesc">Busqueda por Descripción</string> | 52 | <string name="ibBusDesc">Busqueda por Descripción</string> |
| 53 | <string name="ibBusCB">Busqueda por C. Barras</string> | 53 | <string name="ibBusCB">Busqueda por C. Barras</string> |
| 54 | <string name="ibBusCO">Busqueda por Código de Origen</string> | 54 | <string name="ibBusCO">Busqueda por Código de Origen</string> |
| 55 | <string name="switch_1">+ 1</string> | 55 | <string name="switch_1">+ 1</string> |
| 56 | 56 | ||
| 57 | <!-- Fragmento Configuraciones--> | 57 | <!-- Fragmento Configuraciones--> |
| 58 | <string name="tvTituloConf">Configuraciones</string> | 58 | <string name="tvTituloConf">Configuraciones</string> |
| 59 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> | 59 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> |
| 60 | <string name="btnValidarServidor">Validar</string> | 60 | <string name="btnValidarServidor">Validar</string> |
| 61 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> | 61 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> |
| 62 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> | 62 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> |
| 63 | <string name="tvTituloArea">Area de Invetnario</string> | 63 | <string name="tvTituloArea">Area de Invetnario</string> |
| 64 | <string name="rbVentas">Inventarios de Ventas</string> | 64 | <string name="rbVentas">Inventarios de Ventas</string> |
| 65 | <string name="rbDeposito">Inventarios de Depositos</string> | 65 | <string name="rbDeposito">Inventarios de Depositos</string> |
| 66 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> | 66 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> |
| 67 | <string name="tvColumnas">Columnas a Visualizar</string> | 67 | <string name="tvColumnas">Columnas a Visualizar</string> |
| 68 | 68 | ||
| 69 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> | 69 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> |
| 70 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> | 70 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> |
| 71 | 71 | ||
| 72 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> | 72 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> |
| 73 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> | 73 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> |
| 74 | 74 | ||
| 75 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> | 75 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> |
| 76 | 76 | ||
| 77 | <string name="rbCodigoDebo">Código DEBO</string> | 77 | <string name="rbCodigoDebo">Código DEBO</string> |
| 78 | <string name="rbCodigoOrigen">Código Origen</string> | 78 | <string name="rbCodigoOrigen">Código Origen</string> |
| 79 | <string name="rbCodigoBarras">Código de Barras</string> | 79 | <string name="rbCodigoBarras">Código de Barras</string> |
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | <!-- Spinner servidor--> | 82 | <!-- Spinner servidor--> |
| 83 | <string-array name="spinnerServidor"> | 83 | <string-array name="spinnerServidor"> |
| 84 | <item>Servidor Laboratorio 1</item> | 84 | <item>Servidor Laboratorio 1</item> |
| 85 | <item>Servidor Laboratorio 2</item> | 85 | <item>Servidor Laboratorio 2</item> |
| 86 | <item>Servidor Laboratorio 3</item> | 86 | <item>Servidor Laboratorio 3</item> |
| 87 | </string-array> | 87 | </string-array> |
| 88 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> | 88 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> |
| 89 | 89 | ||
| 90 | <string name="cbMostrarExistencia">Existencia</string> | 90 | <string name="cbMostrarExistencia">Existencia</string> |
| 91 | <string name="cbMostrarPrecio">Precio</string> | 91 | <string name="cbMostrarPrecio">Precio</string> |
| 92 | 92 | ||
| 93 | <string name="btnGuardar">Guardar Cambios</string> | 93 | <string name="btnGuardar">Guardar Cambios</string> |
| 94 | 94 | ||
| 95 | <!-- fragment Actualizacion de Maestros--> | 95 | <!-- fragment Actualizacion de Maestros--> |
| 96 | <string name="tvActMaestros">Actualización de Maestros</string> | 96 | <string name="tvActMaestros">Actualización de Maestros</string> |
| 97 | <string name="tvMedio">Seleccione el medio por el cual desea realizar la importación de maestros</string> | 97 | <string name="tvMedio">Seleccione el medio por el cual desea realizar la importación de maestros</string> |
| 98 | <string name="obPorWifi">Via Wifi</string> | 98 | <string name="obPorWifi">Via Wifi</string> |
| 99 | <string name="obViaArchivo">Via Archivos MaeTable</string> | 99 | <string name="obViaArchivo">Via Archivos MaeTable</string> |
| 100 | 100 | ||
| 101 | <string name="btnConfirmarAct">Confirmar Actualización</string> | 101 | <string name="btnConfirmarAct">Confirmar Actualización</string> |
| 102 | 102 | ||
| 103 | <!-- Fragment Save--> | 103 | <!-- Fragment Save--> |
| 104 | <string name="tvConfServi">Configuración de Servidores</string> | 104 | <string name="tvConfServi">Configuración de Servidores</string> |
| 105 | <string name="server">Ingrese la direccion del servidor</string> | 105 | <string name="server">Ingrese la direccion del servidor</string> |
| 106 | <string name="etNomServer">Ingrese una descripción para la conexión</string> | 106 | <string name="etNomServer">Ingrese una descripción para la conexión</string> |
| 107 | <string name="btnGuardarConfServ">Guardar Conexión</string> | 107 | <string name="btnGuardarConfServ">Guardar Conexión</string> |
| 108 | 108 | ||
| 109 | <!-- Dialog--> | 109 | <!-- Dialog--> |
| 110 | <string name="sTitulo">Producto Buscado</string> | 110 | <string name="sTitulo">Producto Buscado</string> |
| 111 | <string name="btnOk">Aceptar</string> | 111 | <string name="btnOk">Aceptar</string> |
| 112 | <string name="btnCancelar">Cancelar</string> | 112 | <string name="btnCancelar">Cancelar</string> |
| 113 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> | 113 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> |
| 114 | <string name="sMensajeEncontrado">¡Ingrese la cantidad contada!</string> | 114 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> |
| 115 | <string name="sTituloNueva">Producto ingresado esta cargado</string> | 115 | <string name="sTituloNueva">Producto ingresado esta cargado</string> |
| 116 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> | 116 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> |
| 117 | <string name="sMensajeBorrarInv">¡Seguro que desea Borrar el inventario!</string> | 117 | <string name="sMensajeBorrarInv">¡Seguro que desea Borrar el inventario!</string> |
| 118 | <string name="sTituloBorrarInv">Borrar Inventario</string> | 118 | <string name="sTituloBorrarInv">Borrar Inventario</string> |
| 119 | 119 | ||
| 120 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> | 120 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> |
| 121 | <string name="sTituloExportar">Exportación de Inventarios</string> | 121 | <string name="sTituloExportar">Exportación de Inventarios</string> |
| 122 | 122 | ||
| 123 | <!-- FRAGMENT SERVIDOR--> | 123 | <!-- FRAGMENT SERVIDOR--> |
| 124 | <string name="tvTitutloServer">Alta de Servidores</string> | 124 | <string name="tvTitutloServer">Alta de Servidores</string> |
| 125 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> | 125 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> |
| 126 | <string name="tvDirServer">Ingrese la dirección del servidor</string> | 126 | <string name="tvDirServer">Ingrese la dirección del servidor</string> |
| 127 | <string name="btnGuardarServidores">Guardar Servidor</string> | 127 | <string name="btnGuardarServidores">Guardar Servidor</string> |
| 128 | 128 | ||
| 129 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> | 129 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> |
| 130 | <string name="rbSumar">Sumar</string> | 130 | <string name="rbSumar">Sumar</string> |
| 131 | <string name="rbRestar">Restar</string> | 131 | <string name="rbRestar">Restar</string> |
| 132 | <string name="rbModificar">Reemplazar</string> | 132 | <string name="rbModificar">Reemplazar</string> |
| 133 | <string name="tvTotal">Cantidad Final</string>tvTotal | 133 | <string name="tvTotal">Cantidad Final</string>tvTotal |
| 134 | <string name="tvResultado">La cantidad final es:</string>tvTotal | 134 | <string name="tvResultado">La cantidad final es:</string>tvTotal |
| 135 | 135 | ||
| 136 | <string name="large_text"> | 136 | <string name="large_text"> |
| 137 | "Material is the metaphor.\n\n" | 137 | "Material is the metaphor.\n\n" |
| 138 | 138 | ||
| 139 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." | 139 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." |
| 140 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " | 140 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " |
| 141 | "technologically advanced and open to imagination and magic.\n" | 141 | "technologically advanced and open to imagination and magic.\n" |
| 142 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " | 142 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " |
| 143 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " | 143 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " |
| 144 | "flexibility of the material creates new affordances that supercede those in the physical " | 144 | "flexibility of the material creates new affordances that supercede those in the physical " |
| 145 | "world, without breaking the rules of physics.\n" | 145 | "world, without breaking the rules of physics.\n" |
| 146 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " | 146 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " |
| 147 | "interact, and exist in space and in relation to each other. Realistic lighting shows " | 147 | "interact, and exist in space and in relation to each other. Realistic lighting shows " |
| 148 | "seams, divides space, and indicates moving parts.\n\n" | 148 | "seams, divides space, and indicates moving parts.\n\n" |
| 149 | 149 | ||
| 150 | "Bold, graphic, intentional.\n\n" | 150 | "Bold, graphic, intentional.\n\n" |
| 151 | 151 | ||
| 152 | "The foundational elements of print based design typography, grids, space, scale, color, " | 152 | "The foundational elements of print based design typography, grids, space, scale, color, " |
| 153 | "and use of imagery guide visual treatments. These elements do far more than please the " | 153 | "and use of imagery guide visual treatments. These elements do far more than please the " |
| 154 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " | 154 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " |
| 155 | "imagery, large scale typography, and intentional white space create a bold and graphic " | 155 | "imagery, large scale typography, and intentional white space create a bold and graphic " |
| 156 | "interface that immerse the user in the experience.\n" | 156 | "interface that immerse the user in the experience.\n" |
| 157 | "An emphasis on user actions makes core functionality immediately apparent and provides " | 157 | "An emphasis on user actions makes core functionality immediately apparent and provides " |
| 158 | "waypoints for the user.\n\n" | 158 | "waypoints for the user.\n\n" |
| 159 | 159 | ||
| 160 | "Motion provides meaning.\n\n" | 160 | "Motion provides meaning.\n\n" |
| 161 | 161 | ||
| 162 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " | 162 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " |
| 163 | "inflection points that initiate motion, transforming the whole design.\n" | 163 | "inflection points that initiate motion, transforming the whole design.\n" |
| 164 | "All action takes place in a single environment. Objects are presented to the user without " | 164 | "All action takes place in a single environment. Objects are presented to the user without " |
| 165 | "breaking the continuity of experience even as they transform and reorganize.\n" | 165 | "breaking the continuity of experience even as they transform and reorganize.\n" |
| 166 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " | 166 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " |
| 167 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" | 167 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" |
| 168 | 168 | ||
| 169 | "3D world.\n\n" | 169 | "3D world.\n\n" |
| 170 | 170 | ||
| 171 | "The material environment is a 3D space, which means all objects have x, y, and z " | 171 | "The material environment is a 3D space, which means all objects have x, y, and z " |
| 172 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " | 172 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " |
| 173 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " | 173 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " |
| 174 | "position along the z-axis and has a standard 1dp thickness.\n" | 174 | "position along the z-axis and has a standard 1dp thickness.\n" |
| 175 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " | 175 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " |
| 176 | "emulated by manipulating the y-axis.\n\n" | 176 | "emulated by manipulating the y-axis.\n\n" |
| 177 | 177 | ||
| 178 | "Light and shadow.\n\n" | 178 | "Light and shadow.\n\n" |
| 179 | 179 | ||
| 180 | "Within the material environment, virtual lights illuminate the scene. Key lights create " | 180 | "Within the material environment, virtual lights illuminate the scene. Key lights create " |
| 181 | "directional shadows, while ambient light creates soft shadows from all angles.\n" | 181 | "directional shadows, while ambient light creates soft shadows from all angles.\n" |
| 182 | "Shadows in the material environment are cast by these two light sources. In Android " | 182 | "Shadows in the material environment are cast by these two light sources. In Android " |
| 183 | "development, shadows occur when light sources are blocked by sheets of material at " | 183 | "development, shadows occur when light sources are blocked by sheets of material at " |
| 184 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " | 184 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " |
| 185 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" | 185 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" |
| 186 | 186 | ||
| 187 | "Resting elevation.\n\n" | 187 | "Resting elevation.\n\n" |
| 188 | 188 | ||
| 189 | "All material objects, regardless of size, have a resting elevation, or default elevation " | 189 | "All material objects, regardless of size, have a resting elevation, or default elevation " |
| 190 | "that does not change. If an object changes elevation, it should return to its resting " | 190 | "that does not change. If an object changes elevation, it should return to its resting " |
| 191 | "elevation as soon as possible.\n\n" | 191 | "elevation as soon as possible.\n\n" |
| 192 | 192 | ||
| 193 | "Component elevations.\n\n" | 193 | "Component elevations.\n\n" |
| 194 | 194 | ||
| 195 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " | 195 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " |
| 196 | "does not vary from 6dp in one app to 16dp in another app).\n" | 196 | "does not vary from 6dp in one app to 16dp in another app).\n" |
| 197 | "Components may have different resting elevations across platforms, depending on the depth " | 197 | "Components may have different resting elevations across platforms, depending on the depth " |
| 198 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" | 198 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" |
| 199 | 199 | ||
| 200 | "Responsive elevation and dynamic elevation offsets.\n\n" | 200 | "Responsive elevation and dynamic elevation offsets.\n\n" |
| 201 | 201 | ||
| 202 | "Some component types have responsive elevation, meaning they change elevation in response " | 202 | "Some component types have responsive elevation, meaning they change elevation in response " |
| 203 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " | 203 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " |
| 204 | "changes are consistently implemented using dynamic elevation offsets.\n" | 204 | "changes are consistently implemented using dynamic elevation offsets.\n" |
| 205 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " | 205 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " |
| 206 | "to the component’s resting state. They ensure that elevation changes are consistent " | 206 | "to the component’s resting state. They ensure that elevation changes are consistent " |
| 207 | "across actions and component types. For example, all components that lift on press have " | 207 | "across actions and component types. For example, all components that lift on press have " |
| 208 | "the same elevation change relative to their resting elevation.\n" | 208 | "the same elevation change relative to their resting elevation.\n" |
| 209 | "Once the input event is completed or cancelled, the component will return to its resting " | 209 | "Once the input event is completed or cancelled, the component will return to its resting " |
| 210 | "elevation.\n\n" | 210 | "elevation.\n\n" |
| 211 | 211 | ||
| 212 | "Avoiding elevation interference.\n\n" | 212 | "Avoiding elevation interference.\n\n" |
| 213 | 213 | ||
| 214 | "Components with responsive elevations may encounter other components as they move between " | 214 | "Components with responsive elevations may encounter other components as they move between " |
| 215 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " | 215 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " |
| 216 | "through other material, components avoid interfering with one another any number of ways, " | 216 | "through other material, components avoid interfering with one another any number of ways, " |
| 217 | "whether on a per component basis or using the entire app layout.\n" | 217 | "whether on a per component basis or using the entire app layout.\n" |
| 218 | "On a component level, components can move or be removed before they cause interference. " | 218 | "On a component level, components can move or be removed before they cause interference. " |
| 219 | "For example, a floating action button (FAB) can disappear or move off screen before a " | 219 | "For example, a floating action button (FAB) can disappear or move off screen before a " |
| 220 | "user picks up a card, or it can move if a snackbar appears.\n" | 220 | "user picks up a card, or it can move if a snackbar appears.\n" |
| 221 | "On the layout level, design your app layout to minimize opportunities for interference. " | 221 | "On the layout level, design your app layout to minimize opportunities for interference. " |
| 222 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " | 222 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " |
| 223 | "when a user tries to pick up one of cards.\n\n" | 223 | "when a user tries to pick up one of cards.\n\n" |
| 224 | </string> | 224 | </string> |
| 225 | </resources> | 225 | </resources> |