Commit d1857acb654eadef457edb61553648b2e9c1eb08
1 parent
2b4f7165e7
Exists in
master
25092020 1600
Showing
19 changed files
with
573 additions
and
226 deletions
Show diff stats
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
| ... | ... | @@ -65,7 +65,7 @@ interface InvHeadDAO { |
| 65 | 65 | @Query("UPDATE $TABLA_INV_H SET INV_PRODCONT=:cant WHERE INV_NUM=:inven") |
| 66 | 66 | suspend fun updateInvBody(inven: Int,cant: Int) |
| 67 | 67 | |
| 68 | - @Query("SELECT INV_PRODCONT FROM $TABLA_INV_H WHERE INV_NUM=:inven") | |
| 68 | + @Query("SELECT * FROM $TABLA_INV_H WHERE INV_NUM=:inven") | |
| 69 | 69 | suspend fun foundInvHead (inven: Int): InvHead |
| 70 | 70 | } |
| 71 | 71 |
app/src/main/java/com/focasoftware/deboinventariov20/DB/DataBase/AppDb.kt
| ... | ... | @@ -12,7 +12,7 @@ import com.focasoftware.deboinventariov20.Model.InvHead |
| 12 | 12 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 13 | 13 | |
| 14 | 14 | |
| 15 | -@Database(entities = [Articles::class, InvHead::class, InvBody::class, ServeInv::class], version = 1, exportSchema = true) | |
| 15 | +@Database(entities = [Articles::class, InvHead::class, InvBody::class, ServeInv::class], version = 1, exportSchema = false) | |
| 16 | 16 | abstract class AppDb : RoomDatabase() { |
| 17 | 17 | abstract fun ArticulosDAO(): ArticulosDAO? |
| 18 | 18 | abstract fun InvHeadDAO(): InvHeadDAO? |
app/src/main/java/com/focasoftware/deboinventariov20/Model/WebService.kt
| ... | ... | @@ -9,7 +9,7 @@ import java.util.concurrent.TimeUnit |
| 9 | 9 | |
| 10 | 10 | object WebService { |
| 11 | 11 | private var instance: WebService? = null |
| 12 | - private var retrofit:Retrofit? =null | |
| 12 | + private var retrofit: Retrofit? = null | |
| 13 | 13 | private val TIME_OUT: Long |
| 14 | 14 | get() { |
| 15 | 15 | return 15 |
| ... | ... | @@ -27,26 +27,21 @@ object WebService { |
| 27 | 27 | .readTimeout(TIME_OUT, TimeUnit.SECONDS) |
| 28 | 28 | .build() |
| 29 | 29 | |
| 30 | - private fun WebService() { | |
| 31 | - retrofit = Retrofit.Builder() | |
| 32 | - .client(okHttpClient) | |
| 33 | - .baseUrl(BASE_URL) | |
| 34 | - .addConverterFactory(GsonConverterFactory.create()) | |
| 35 | - .build() | |
| 36 | - } | |
| 37 | - | |
| 38 | - @Synchronized | |
| 39 | - fun getInstance(): WebService? { | |
| 40 | - if (instance == null) { | |
| 41 | - instance = WebService | |
| 42 | - } | |
| 43 | - return instance | |
| 44 | - } | |
| 45 | - | |
| 46 | - fun <S> createService(serviceClass: Class<S>): S { | |
| 47 | - return retrofit!!.create(serviceClass) | |
| 48 | - } | |
| 49 | - | |
| 30 | +// private fun WebService() { | |
| 31 | +// retrofit = Retrofit.Builder() | |
| 32 | +// .client(okHttpClient) | |
| 33 | +// .baseUrl(BASE_URL) | |
| 34 | +// .addConverterFactory(GsonConverterFactory.create()) | |
| 35 | +// .build() | |
| 36 | +// } | |
| 37 | +// | |
| 38 | +// @Synchronized | |
| 39 | +// fun getInstance(): WebService? { | |
| 40 | +// if (instance == null) { | |
| 41 | +// instance = WebService | |
| 42 | +// } | |
| 43 | +// return instance | |
| 44 | +// } | |
| 50 | 45 | // fun <S> createService(serviceClass: Class<S>): S { |
| 51 | 46 | // return retrofit!!.create(serviceClass) |
| 52 | 47 | // } |
| ... | ... | @@ -60,12 +55,13 @@ object WebService { |
| 60 | 55 | // .create(EndPoints::class.java) |
| 61 | 56 | // } |
| 62 | 57 | |
| 63 | -// fun getProductosService(): ProductosApi { | |
| 64 | -// return Retrofit.Builder() | |
| 65 | -// .client(okHttpClient) | |
| 66 | -// .baseUrl(BASE_URL) | |
| 67 | -// .addConverterFactory(GsonConverterFactory.create()) | |
| 68 | -// .build() | |
| 69 | -// .create(ProductosApi::class.java) | |
| 70 | -// } | |
| 58 | + | |
| 59 | + fun getProductosService(): WebServiceApi { | |
| 60 | + return Retrofit.Builder() | |
| 61 | + .client(okHttpClient) | |
| 62 | + .baseUrl(BASE_URL) | |
| 63 | + .addConverterFactory(GsonConverterFactory.create()) | |
| 64 | + .build() | |
| 65 | + .create(WebServiceApi::class.java) | |
| 66 | + } | |
| 71 | 67 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/Utils/Utils.kt
| ... | ... | @@ -18,13 +18,13 @@ fun modificarCantidadEnCabecera(inventarioActual: Int, b: Boolean, context: Cont |
| 18 | 18 | GlobalScope.async(Dispatchers.IO) { |
| 19 | 19 | var cantProductos = 0 |
| 20 | 20 | cantProductos = |
| 21 | - AppDb.getAppDb(context)!!.InvHeadDAO()!!.consultaCantidadInvH(inventarioActual.toLong()) | |
| 21 | + AppDb.getAppDb(context)!!.InvHeadDAO()!!.consultaCantidadInvH(inventarioActual) | |
| 22 | 22 | if (b) { |
| 23 | 23 | AppDb.getAppDb(context)!!.InvHeadDAO()!! |
| 24 | - .updateInvBody(inventarioActual.toLong(), cantProductos + 1) | |
| 24 | + .updateInvBody(inventarioActual, cantProductos + 1) | |
| 25 | 25 | } else { |
| 26 | 26 | AppDb.getAppDb(context)!!.InvHeadDAO()!! |
| 27 | - .updateInvBody(inventarioActual.toLong(), cantProductos - 1) | |
| 27 | + .updateInvBody(inventarioActual, cantProductos - 1) | |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | } |
| ... | ... | @@ -71,7 +71,7 @@ class NoEncontradoSimple : DialogFragment() { |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | -class noServerConf : DialogFragment() { | |
| 74 | +class NoServerConf : DialogFragment() { | |
| 75 | 75 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 76 | 76 | return activity?.let { |
| 77 | 77 | val title = "" |
| ... | ... | @@ -105,7 +105,7 @@ fun isConnectedToThisServer(host: String): Boolean { |
| 105 | 105 | |
| 106 | 106 | return false |
| 107 | 107 | } |
| 108 | -class serverValido : DialogFragment() { | |
| 108 | +class ServerValido : DialogFragment() { | |
| 109 | 109 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 110 | 110 | return activity?.let { |
| 111 | 111 | val title = "" |
| ... | ... | @@ -117,7 +117,7 @@ class serverValido : DialogFragment() { |
| 117 | 117 | } ?: throw IllegalStateException("Activity cannot be null") |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | -class serverNoValido : DialogFragment() { | |
| 120 | +class ServerNoValido : DialogFragment() { | |
| 121 | 121 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 122 | 122 | return activity?.let { |
| 123 | 123 | val title = "" |
| ... | ... | @@ -129,7 +129,7 @@ class serverNoValido : DialogFragment() { |
| 129 | 129 | } ?: throw IllegalStateException("Activity cannot be null") |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | -class serverNoConf : DialogFragment() { | |
| 132 | +class ServerNoConf : DialogFragment() { | |
| 133 | 133 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 134 | 134 | return activity?.let { |
| 135 | 135 | val title = "Servidor no Valido" |
| ... | ... | @@ -141,7 +141,19 @@ class serverNoConf : DialogFragment() { |
| 141 | 141 | } ?: throw IllegalStateException("Activity cannot be null") |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | -fun ObtenerFechaActual(): String { | |
| 144 | +class ExportacionExitosa : DialogFragment() { | |
| 145 | + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
| 146 | + return activity?.let { | |
| 147 | + val title = "Exportación de Inventarios" | |
| 148 | + val content = "!La exportacion del inventario se realizo exitosamente¡" | |
| 149 | + val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | |
| 150 | + builder.setTitle(title).setMessage(content) | |
| 151 | + .setPositiveButton(android.R.string.ok) { _, _ -> } | |
| 152 | + return builder.create() | |
| 153 | + } ?: throw IllegalStateException("Activity cannot be null") | |
| 154 | + } | |
| 155 | +} | |
| 156 | +fun obtenerFechaActual(): String { | |
| 145 | 157 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD |
| 146 | 158 | val current = LocalDateTime.now() |
| 147 | 159 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") |
app/src/main/java/com/focasoftware/deboinventariov20/UI/actualizacionMaestros/ActuaMaestrosFragment.kt
| ... | ... | @@ -5,25 +5,19 @@ import android.view.LayoutInflater |
| 5 | 5 | import android.view.View |
| 6 | 6 | import android.view.ViewGroup |
| 7 | 7 | import android.widget.Button |
| 8 | +import android.widget.RadioButton | |
| 8 | 9 | import androidx.fragment.app.Fragment |
| 9 | 10 | import androidx.lifecycle.lifecycleScope |
| 10 | 11 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 11 | 12 | import com.focasoftware.deboinventariov20.Model.Articles |
| 12 | -import com.focasoftware.deboinventariov20.Model.Productos | |
| 13 | 13 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 14 | -import com.focasoftware.deboinventariov20.Model.WebService.getInstance | |
| 15 | -import com.focasoftware.deboinventariov20.Model.WebServiceApi | |
| 16 | 14 | import com.focasoftware.deboinventariov20.R |
| 17 | -import com.focasoftware.deboinventariov20.UI.Utils.noServerConf | |
| 18 | -import com.focasoftware.deboinventariov20.UI.Utils.serverNoConf | |
| 15 | +import com.focasoftware.deboinventariov20.UI.Utils.NoServerConf | |
| 16 | +import com.focasoftware.deboinventariov20.UI.Utils.ServerNoConf | |
| 19 | 17 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* |
| 20 | 18 | import kotlinx.coroutines.* |
| 21 | 19 | import kotlinx.coroutines.Dispatchers.IO |
| 22 | 20 | import kotlinx.coroutines.Dispatchers.Main |
| 23 | -import retrofit2.Call | |
| 24 | -import retrofit2.Callback | |
| 25 | -import retrofit2.Response | |
| 26 | -import java.net.SocketTimeoutException | |
| 27 | 21 | |
| 28 | 22 | |
| 29 | 23 | var BASE_URL = "" |
| ... | ... | @@ -40,14 +34,14 @@ class ActuaMaestrosFragment : Fragment() { |
| 40 | 34 | if (serverPre != null) { |
| 41 | 35 | btnConfirmarAct.isEnabled = true |
| 42 | 36 | if (serverPre!!.direccion.isNullOrEmpty()) { |
| 43 | - val modalDialog = noServerConf() | |
| 37 | + val modalDialog = NoServerConf() | |
| 44 | 38 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 45 | 39 | } else { |
| 46 | 40 | BASE_URL = serverPre!!.direccion.toString() + ":" + serverPre!!.puerto.toString() + "/" |
| 47 | 41 | tvServerConectado.text = "Conectado al servidor: ${serverPre!!.descripcion}" |
| 48 | 42 | } |
| 49 | 43 | } else { |
| 50 | - val modalDialog = serverNoConf() | |
| 44 | + val modalDialog = ServerNoConf() | |
| 51 | 45 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 52 | 46 | |
| 53 | 47 | btnConfirmarAct.isEnabled = false |
| ... | ... | @@ -68,6 +62,8 @@ class ActuaMaestrosFragment : Fragment() { |
| 68 | 62 | // Inflate the layout for this fragment |
| 69 | 63 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) |
| 70 | 64 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) |
| 65 | + val obPorWifi = v.findViewById<RadioButton>(R.id.obPorWifi) | |
| 66 | + val obImpInventarios= v.findViewById<RadioButton>(R.id.obImpInventarios) | |
| 71 | 67 | |
| 72 | 68 | bConfirmarAct.setOnClickListener { |
| 73 | 69 | loading_view.visibility = View.VISIBLE |
| ... | ... | @@ -78,59 +74,62 @@ class ActuaMaestrosFragment : Fragment() { |
| 78 | 74 | } |
| 79 | 75 | |
| 80 | 76 | private fun obtenerArticulos() { |
| 81 | - val call = getInstance() | |
| 82 | - ?.createService(WebServiceApi::class.java) | |
| 83 | - ?.getProductos() | |
| 84 | - var index: Long = 1 | |
| 85 | - call!!.enqueue(object : Callback<List<Productos>> { | |
| 86 | - override fun onResponse(call: Call<List<Productos>>, response: Response<List<Productos>>) { | |
| 87 | - if (response.code() == 200) { | |
| 88 | - try { | |
| 89 | - for (pro in response.body()!!) { | |
| 90 | - val artiAcargar = Articles( | |
| 91 | - pro.sector, | |
| 92 | - pro.codigo, | |
| 93 | - pro.descripcion, | |
| 94 | - pro.codBar, | |
| 95 | - pro.codOrigen, | |
| 96 | - pro.precio, | |
| 97 | - pro.costo, | |
| 98 | - pro.exiVenta, | |
| 99 | - pro.exiDeposito, | |
| 100 | - pro.de, | |
| 101 | - pro.balanza, | |
| 102 | - pro.depSn, | |
| 103 | - pro.imagen | |
| 104 | - ) | |
| 105 | - index += index | |
| 106 | - insertarProducto(artiAcargar) | |
| 107 | - } | |
| 108 | - countriesList.visibility = View.VISIBLE | |
| 109 | - countriesList.text = "¡Datos Importados Correctamente!" | |
| 110 | - loading_view.visibility = View.GONE | |
| 111 | - } catch (e: SocketTimeoutException) { | |
| 112 | - countriesList.visibility = View.VISIBLE | |
| 113 | - countriesList.text = "¡Sin conexión al Servidor!" | |
| 114 | - loading_view.visibility = View.GONE | |
| 115 | - } | |
| 116 | - } | |
| 117 | - } | |
| 118 | - | |
| 119 | - override fun onFailure(call: Call<List<Productos>>, t: Throwable) { | |
| 120 | - countriesList.visibility = View.VISIBLE | |
| 121 | - countriesList.text = (t.message + "." + t.cause) | |
| 122 | - loading_view.visibility = View.GONE | |
| 123 | - } | |
| 124 | - }) | |
| 77 | +// val call = getInstance() | |
| 78 | +// ?.createService(WebServiceApi::class.java) | |
| 79 | +// ?.getProductos() | |
| 80 | +// val api: WebService? = getInstance()!!.createService() | |
| 81 | +// val call: Call<List<Productos>> = api!!.getProductos() | |
| 125 | 82 | |
| 83 | +// var index: Long = 1 | |
| 84 | +// call!!.enqueue(object : Callback<List<Productos>> { | |
| 85 | +// override fun onResponse(call: Call<List<Productos>>, response: Response<List<Productos>>) { | |
| 86 | +// if (response.code() == 200) { | |
| 87 | +// try { | |
| 88 | +// for (pro in response.body()!!) { | |
| 89 | +// val artiAcargar = Articles( | |
| 90 | +// pro.sector, | |
| 91 | +// pro.codigo, | |
| 92 | +// pro.descripcion, | |
| 93 | +// pro.codBar, | |
| 94 | +// pro.codOrigen, | |
| 95 | +// pro.precio, | |
| 96 | +// pro.costo, | |
| 97 | +// pro.exiVenta, | |
| 98 | +// pro.exiDeposito, | |
| 99 | +// pro.de, | |
| 100 | +// pro.balanza, | |
| 101 | +// pro.depSn, | |
| 102 | +// pro.imagen | |
| 103 | +// ) | |
| 104 | +// index += index | |
| 105 | +// insertarProducto(artiAcargar) | |
| 106 | +// } | |
| 107 | +// countriesList.visibility = View.VISIBLE | |
| 108 | +// countriesList.text = "¡Datos Importados Correctamente!" | |
| 109 | +// loading_view.visibility = View.GONE | |
| 110 | +// } catch (e: SocketTimeoutException) { | |
| 111 | +// countriesList.visibility = View.VISIBLE | |
| 112 | +// countriesList.text = "¡Sin conexión al Servidor!" | |
| 113 | +// loading_view.visibility = View.GONE | |
| 114 | +// } | |
| 115 | +// } | |
| 116 | +// } | |
| 117 | +// | |
| 118 | +// override fun onFailure(call: Call<List<Productos>>, t: Throwable) { | |
| 119 | +// countriesList.visibility = View.VISIBLE | |
| 120 | +// countriesList.text = (t.message + "." + t.cause) | |
| 121 | +// loading_view.visibility = View.GONE | |
| 122 | +// } | |
| 123 | +// }) | |
| 126 | 124 | |
| 125 | + //Este es el que andaba | |
| 127 | 126 | // var index: Long = 1 |
| 128 | 127 | // withContext(IO) { |
| 129 | 128 | // val job = CoroutineScope(IO).launch { |
| 130 | 129 | // // TODO: BORRO TODO LOS ARTICULOS DE LA BASE PARA CARGARLOS DE NUEVO |
| 131 | 130 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.deleteAllArticulos() |
| 132 | 131 | // try { |
| 133 | -// val response = productosService.getProductos() | |
| 132 | +// val response = WebServiceApi. | |
| 134 | 133 | // if (response.isSuccessful) { |
| 135 | 134 | // |
| 136 | 135 | // for (pro in response.body()!!) { |
app/src/main/java/com/focasoftware/deboinventariov20/UI/actualizacionMaestros/InvImportadosFragment.kt
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +package com.focasoftware.deboinventariov20.UI.actualizacionMaestros | |
| 2 | + | |
| 3 | +import android.os.Bundle | |
| 4 | +import androidx.fragment.app.Fragment | |
| 5 | +import android.view.LayoutInflater | |
| 6 | +import android.view.View | |
| 7 | +import android.view.ViewGroup | |
| 8 | +import com.focasoftware.deboinventariov20.R | |
| 9 | + | |
| 10 | +class InvImportadosFragment : Fragment() { | |
| 11 | + | |
| 12 | + override fun onCreate(savedInstanceState: Bundle?) { | |
| 13 | + super.onCreate(savedInstanceState) | |
| 14 | + | |
| 15 | + } | |
| 16 | + | |
| 17 | + override fun onCreateView( | |
| 18 | + inflater: LayoutInflater, container: ViewGroup?, | |
| 19 | + savedInstanceState: Bundle? | |
| 20 | + ): View? { | |
| 21 | + // Inflate the layout for this fragment | |
| 22 | + return inflater.inflate(R.layout.fragment_inv_importados, container, false) | |
| 23 | + } | |
| 24 | +} | |
| 0 | 25 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/UI/configuracion/ConfiguracionFragment.kt
| ... | ... | @@ -17,8 +17,8 @@ import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 17 | 17 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 18 | 18 | import com.focasoftware.deboinventariov20.R |
| 19 | 19 | import com.focasoftware.deboinventariov20.UI.Utils.isConnectedToThisServer |
| 20 | -import com.focasoftware.deboinventariov20.UI.Utils.serverNoValido | |
| 21 | -import com.focasoftware.deboinventariov20.UI.Utils.serverValido | |
| 20 | +import com.focasoftware.deboinventariov20.UI.Utils.ServerNoValido | |
| 21 | +import com.focasoftware.deboinventariov20.UI.Utils.ServerValido | |
| 22 | 22 | import kotlinx.android.synthetic.main.fragment_configuracion.* |
| 23 | 23 | import kotlinx.coroutines.* |
| 24 | 24 | import kotlinx.coroutines.Dispatchers.Main |
| ... | ... | @@ -200,10 +200,10 @@ class ConfiguracionFragment : Fragment() { |
| 200 | 200 | val serverPre = fetchServer() |
| 201 | 201 | if (serverPre != null) { |
| 202 | 202 | if (isConnectedToThisServer(serverPre.direccion.toString().substring(7, serverPre.direccion.toString().length))) { |
| 203 | - val modalDialog = serverValido() | |
| 203 | + val modalDialog = ServerValido() | |
| 204 | 204 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 205 | 205 | } else { |
| 206 | - val modalDialog = serverNoValido() | |
| 206 | + val modalDialog = ServerNoValido() | |
| 207 | 207 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 208 | 208 | } |
| 209 | 209 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripCorigenFragment/CodigoOriFragment.kt
| ... | ... | @@ -27,7 +27,7 @@ import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 27 | 27 | import com.focasoftware.deboinventariov20.Model.Articles |
| 28 | 28 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 29 | 29 | import com.focasoftware.deboinventariov20.R |
| 30 | -import com.focasoftware.deboinventariov20.UI.Utils.ObtenerFechaActual | |
| 30 | +import com.focasoftware.deboinventariov20.UI.Utils.obtenerFechaActual | |
| 31 | 31 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
| 32 | 32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| 33 | 33 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.btnAceptar |
| ... | ... | @@ -138,8 +138,8 @@ class CodigoOriFragment : Fragment() { |
| 138 | 138 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 139 | 139 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, |
| 140 | 140 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, |
| 141 | - ObtenerFechaActual(), | |
| 142 | - ObtenerFechaActual()) | |
| 141 | + obtenerFechaActual(), | |
| 142 | + obtenerFechaActual()) | |
| 143 | 143 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
| 144 | 144 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) |
| 145 | 145 | // VolverAinventario() |
| ... | ... | @@ -260,7 +260,7 @@ class CodigoOriFragment : Fragment() { |
| 260 | 260 | withContext(Dispatchers.IO) { |
| 261 | 261 | val activity: FragmentActivity? = activity |
| 262 | 262 | if (activity != null && isAdded) { |
| 263 | - AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.updateInvBody(cantidad, sector.toLong(), codigo.toLong(), ObtenerFechaActual()) | |
| 263 | + AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.updateInvBody(cantidad, sector.toLong(), codigo.toLong(), obtenerFechaActual()) | |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripcionFragment/DescripcionFragment.kt
| ... | ... | @@ -27,7 +27,7 @@ import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 27 | 27 | import com.focasoftware.deboinventariov20.Model.Articles |
| 28 | 28 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 29 | 29 | import com.focasoftware.deboinventariov20.R |
| 30 | -import com.focasoftware.deboinventariov20.UI.Utils.ObtenerFechaActual | |
| 30 | +import com.focasoftware.deboinventariov20.UI.Utils.obtenerFechaActual | |
| 31 | 31 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
| 32 | 32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| 33 | 33 | import kotlinx.android.synthetic.main.login_dialog.view.* |
| ... | ... | @@ -138,8 +138,8 @@ class DescripcionFragment : Fragment() { |
| 138 | 138 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 139 | 139 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, |
| 140 | 140 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, |
| 141 | - ObtenerFechaActual(), | |
| 142 | - ObtenerFechaActual() | |
| 141 | + obtenerFechaActual(), | |
| 142 | + obtenerFechaActual() | |
| 143 | 143 | ) |
| 144 | 144 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
| 145 | 145 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) |
| ... | ... | @@ -254,7 +254,7 @@ class DescripcionFragment : Fragment() { |
| 254 | 254 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 255 | 255 | var busqueda: InvBody? = null |
| 256 | 256 | return GlobalScope.async(Dispatchers.IO) { |
| 257 | - busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector.toLong(), codigo.toLong(), numInventario.toLong()) | |
| 257 | + busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector.toLong(), codigo.toLong(), numInventario.toInt()) | |
| 258 | 258 | return@async busqueda |
| 259 | 259 | }.await() |
| 260 | 260 | } |
| ... | ... | @@ -264,7 +264,7 @@ class DescripcionFragment : Fragment() { |
| 264 | 264 | withContext(Dispatchers.IO) { |
| 265 | 265 | val activity: FragmentActivity? = activity |
| 266 | 266 | if (activity != null && isAdded) { |
| 267 | - AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.updateInvBody(cantidad, sector.toLong(), codigo.toLong(),ObtenerFechaActual()) | |
| 267 | + AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.updateInvBody(cantidad, sector.toLong(), codigo.toLong(),obtenerFechaActual()) | |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/inventario/InventarioFragment.kt
| ... | ... | @@ -32,9 +32,10 @@ import androidx.recyclerview.widget.RecyclerView |
| 32 | 32 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 33 | 33 | import com.focasoftware.deboinventariov20.Model.* |
| 34 | 34 | import com.focasoftware.deboinventariov20.R |
| 35 | +import com.focasoftware.deboinventariov20.UI.Utils.ExportacionExitosa | |
| 35 | 36 | import com.focasoftware.deboinventariov20.UI.Utils.NoEncontradoSimple |
| 36 | -import com.focasoftware.deboinventariov20.UI.Utils.ObtenerFechaActual | |
| 37 | 37 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
| 38 | +import com.focasoftware.deboinventariov20.UI.Utils.obtenerFechaActual | |
| 38 | 39 | import com.focasoftware.deboinventariov20.UI.inventario.viewModel.InventarioViewModel |
| 39 | 40 | import kotlinx.android.synthetic.main.fragment_inventario.* |
| 40 | 41 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| ... | ... | @@ -42,10 +43,12 @@ import kotlinx.android.synthetic.main.login_dialog.view.* |
| 42 | 43 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar |
| 43 | 44 | import kotlinx.coroutines.* |
| 44 | 45 | import kotlinx.coroutines.Dispatchers.IO |
| 46 | +import kotlinx.coroutines.Dispatchers.Main | |
| 45 | 47 | import retrofit2.Call |
| 46 | 48 | import retrofit2.Callback |
| 47 | 49 | import retrofit2.Response |
| 48 | 50 | import java.util.* |
| 51 | +import kotlin.collections.ArrayList | |
| 49 | 52 | |
| 50 | 53 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { |
| 51 | 54 | |
| ... | ... | @@ -70,8 +73,8 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 70 | 73 | @SuppressLint("MissingPermission") |
| 71 | 74 | override fun onCreate(savedInstanceState: Bundle?) { |
| 72 | 75 | super.onCreate(savedInstanceState) |
| 73 | - inventarioViewModel= ViewModelProviders.of(this).get(InventarioViewModel::class.java) | |
| 74 | - | |
| 76 | + inventarioViewModel = ViewModelProviders.of(this).get(InventarioViewModel::class.java) | |
| 77 | + | |
| 75 | 78 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 76 | 79 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { |
| 77 | 80 | (inventarioViewModel as InventarioViewModel).InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() |
| ... | ... | @@ -108,8 +111,8 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 108 | 111 | (inventarioViewModel as InventarioViewModel).InventarioNuevo, |
| 109 | 112 | if (!SerchArea()) "Ventas" else "Deposito", |
| 110 | 113 | 1, |
| 111 | - ObtenerFechaActual(), | |
| 112 | - ObtenerFechaActual(), | |
| 114 | + obtenerFechaActual(), | |
| 115 | + obtenerFechaActual(), | |
| 113 | 116 | 0L, |
| 114 | 117 | SerchArea(), |
| 115 | 118 | AjusteProductos(), |
| ... | ... | @@ -117,12 +120,12 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 117 | 120 | ) |
| 118 | 121 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) |
| 119 | 122 | |
| 120 | - tvTitulo.text = "Inventario " + " # ${(inventarioViewModel as InventarioViewModel).InventarioNuevo} "+descArea | |
| 123 | + tvTitulo.text = "Inventario " + " # ${(inventarioViewModel as InventarioViewModel).InventarioNuevo} " + descArea | |
| 121 | 124 | } |
| 122 | 125 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) |
| 123 | 126 | listArticulos.clear() |
| 124 | 127 | cargarDeBdInventario((inventarioViewModel as InventarioViewModel).InventarioNuevo) |
| 125 | - tvTitulo.text = "Inventario " + " # ${(inventarioViewModel as InventarioViewModel).InventarioNuevo} "+ descArea | |
| 128 | + tvTitulo.text = "Inventario " + " # ${(inventarioViewModel as InventarioViewModel).InventarioNuevo} " + descArea | |
| 126 | 129 | } |
| 127 | 130 | |
| 128 | 131 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> |
| ... | ... | @@ -130,11 +133,11 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 130 | 133 | sChangeUpper = tCodigoBarras.text.toString() |
| 131 | 134 | var indiceDelArtEncontrado = 0 |
| 132 | 135 | |
| 133 | - if (tCodigoBarras.text.isNullOrBlank() ) { | |
| 136 | + if (tCodigoBarras.text.isNullOrBlank()) { | |
| 134 | 137 | tCodigoBarras.error = "No puede estar vacio" |
| 135 | 138 | tCodigoBarras.requestFocus() |
| 136 | 139 | tCodigoBarras.hint = "No puede estar vacio" |
| 137 | - }else if (tCodigoBarras.text.toString().length<4 && iEstado==2) { | |
| 140 | + } else if (tCodigoBarras.text.toString().length < 4 && iEstado == 2) { | |
| 138 | 141 | tCodigoBarras.error = "Minimo 4 caracteres" |
| 139 | 142 | tCodigoBarras.requestFocus() |
| 140 | 143 | tCodigoBarras.hint = "4 Minimo" |
| ... | ... | @@ -345,11 +348,15 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 345 | 348 | btnExportarInv.setOnClickListener { |
| 346 | 349 | AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar) |
| 347 | 350 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> |
| 348 | - exportarInventario(InventarioNuevo) | |
| 349 | - borrarInvActual() | |
| 350 | - Toast.makeText(requireContext(), "El inventario $(inventarioViewModel as InventarioViewModel).InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | |
| 351 | - navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | |
| 352 | - (inventarioViewModel as InventarioViewModel).InventarioNuevo = 0 | |
| 351 | + if (preparaInvParaExportar((inventarioViewModel as InventarioViewModel).InventarioNuevo )) { | |
| 352 | + borrarInvActual() | |
| 353 | + Toast.makeText(requireContext(), "El inventario $(inventarioViewModel as InventarioViewModel).InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | |
| 354 | + navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | |
| 355 | + (inventarioViewModel as InventarioViewModel).InventarioNuevo = 0 | |
| 356 | + } else { | |
| 357 | + Toast.makeText(requireContext(), "No se pudo realizar la exportación, Intente mas tarde.", Toast.LENGTH_LONG).show() | |
| 358 | + } | |
| 359 | + | |
| 353 | 360 | |
| 354 | 361 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> }).show() |
| 355 | 362 | } |
| ... | ... | @@ -385,50 +392,45 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 385 | 392 | } |
| 386 | 393 | } |
| 387 | 394 | |
| 388 | - private fun exportarInventario(inventario: Int) { | |
| 389 | - GlobalScope.launch(Dispatchers.Main) { | |
| 390 | - val aEnviar: MutableList<InvToSend>?=null | |
| 395 | + private fun preparaInvParaExportar(inventario: Int): Boolean { | |
| 396 | + var bExporto = false | |
| 397 | + GlobalScope.launch(Main) { | |
| 398 | + val aEnviar: ArrayList<InvToSend>? = arrayListOf<InvToSend>() | |
| 391 | 399 | val datosCabecera = foundInvHeadDB(inventario) |
| 392 | - val datosCuerpo=foundInvBodyBD(inventario) | |
| 393 | - | |
| 394 | - for (cuerpo in datosCuerpo){ | |
| 395 | - val temp=InvToSend( | |
| 396 | - datosCabecera.fechaInicio, | |
| 397 | - datosCabecera.fechaFinal, | |
| 398 | - if (datosCabecera.lugar!!) 1 else 0, | |
| 399 | - cuerpo.sector, | |
| 400 | - cuerpo.codigo, | |
| 401 | - cuerpo.descripcion, | |
| 402 | - cuerpo.cantTomada, | |
| 403 | - cuerpo.fechaInicio, | |
| 404 | - cuerpo.fechaFinal) | |
| 405 | - aEnviar!!.add (temp) | |
| 400 | + val datosCuerpo = foundInvBodyBD(inventario) | |
| 401 | + | |
| 402 | + for (cuerpo in datosCuerpo) { | |
| 403 | + val temp=InvToSend(datosCabecera.fechaInicio, datosCabecera.fechaFinal, if (datosCabecera.lugar!!) 1 else 0, cuerpo.sector, cuerpo.codigo, cuerpo.descripcion, cuerpo.cantTomada, cuerpo.fechaInicio, cuerpo.fechaFinal) | |
| 404 | + aEnviar!!.add(temp) | |
| 406 | 405 | } |
| 407 | - exportarInventario(aEnviar!!) | |
| 406 | +// exportarInventario(aEnviar!!) | |
| 407 | + bExporto = true | |
| 408 | 408 | } |
| 409 | - | |
| 410 | - | |
| 411 | - } | |
| 412 | - private fun exportarInventario(aEnviar:List<InvToSend> ){ | |
| 413 | - | |
| 414 | - val call: Call<Void?>? = WebService | |
| 415 | - .getInstance() | |
| 416 | - ?.createService(WebServiceApi::class.java) | |
| 417 | - ?.inventarioToSend(aEnviar) | |
| 418 | - | |
| 419 | - call!!.enqueue(object : Callback<Void?> { | |
| 420 | - override fun onResponse(call: Call<Void?>?, response: Response<Void?>) { | |
| 421 | - if (response.code() == 201) { | |
| 422 | - } | |
| 423 | - if (response.code() == 409) { | |
| 424 | - } | |
| 425 | - } | |
| 426 | - | |
| 427 | - override fun onFailure(call: Call<Void?>?, t: Throwable?) {} | |
| 428 | - }) | |
| 429 | - | |
| 409 | + return bExporto | |
| 430 | 410 | } |
| 431 | 411 | |
| 412 | +// private fun exportarInventario(aEnviar: List<InvToSend>) { | |
| 413 | +// | |
| 414 | +// val call: Call<Void?>? = WebService | |
| 415 | +// .getInstance() | |
| 416 | +// ?.createService(WebServiceApi::class.java) | |
| 417 | +// ?.inventarioToSend(aEnviar) | |
| 418 | +// | |
| 419 | +// call!!.enqueue(object : Callback<Void?> { | |
| 420 | +// override fun onResponse(call: Call<Void?>?, response: Response<Void?>) { | |
| 421 | +// if (response.code() == 201) { | |
| 422 | +// val modalDialog = ExportacionExitosa() | |
| 423 | +// modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | |
| 424 | +// } | |
| 425 | +// if (response.code() == 409) { | |
| 426 | +// } | |
| 427 | +// } | |
| 428 | +// | |
| 429 | +// override fun onFailure(call: Call<Void?>?, t: Throwable?) {} | |
| 430 | +// }) | |
| 431 | +// | |
| 432 | +// } | |
| 433 | + | |
| 432 | 434 | private suspend fun foundInvHeadDB(inv: Int): InvHead { |
| 433 | 435 | var busqueda: InvHead |
| 434 | 436 | return GlobalScope.async(IO) { |
| ... | ... | @@ -438,12 +440,12 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 438 | 440 | } |
| 439 | 441 | |
| 440 | 442 | private suspend fun foundInvBodyBD(inv: Int): List<InvBody> { |
| 441 | - var busqueda: List<InvBody> | |
| 442 | - return GlobalScope.async(IO) { | |
| 443 | - busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchAllInvBody(inv) | |
| 444 | - return@async busqueda | |
| 445 | - }.await() | |
| 446 | - } | |
| 443 | + var busqueda: List<InvBody> | |
| 444 | + return GlobalScope.async(IO) { | |
| 445 | + busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchAllInvBody(inv) | |
| 446 | + return@async busqueda | |
| 447 | + }.await() | |
| 448 | + } | |
| 447 | 449 | |
| 448 | 450 | private fun borrarInvActual() { |
| 449 | 451 | lifecycleScope.launch { |
| ... | ... | @@ -455,7 +457,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 455 | 457 | } |
| 456 | 458 | |
| 457 | 459 | private fun cargarDeBdInventario(ultimoInv: Int) { |
| 458 | - GlobalScope.launch(Dispatchers.Main) { | |
| 460 | + GlobalScope.launch(Main) { | |
| 459 | 461 | val invbody = cargarInventario(ultimoInv) |
| 460 | 462 | for ((i, _) in invbody!!.withIndex()) { |
| 461 | 463 | val art = Articles( |
| ... | ... | @@ -471,7 +473,8 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 471 | 473 | "", |
| 472 | 474 | invbody[i].balanza, |
| 473 | 475 | invbody[i].depSn, |
| 474 | - invbody[i].costo) | |
| 476 | + invbody[i].costo | |
| 477 | + ) | |
| 475 | 478 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) |
| 476 | 479 | } |
| 477 | 480 | } |
| ... | ... | @@ -631,11 +634,11 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 631 | 634 | |
| 632 | 635 | fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) { |
| 633 | 636 | |
| 634 | - mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | |
| 637 | + mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | |
| 635 | 638 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(cancelable) |
| 636 | 639 | // TODO: SI PERMITE QUE INGRESE DECIMALES |
| 637 | 640 | if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER |
| 638 | - mDialogView.tvTitulo2.text="${listArticulos[indiceDelArtEncontrado].descripcion}" | |
| 641 | + mDialogView.tvTitulo2.text = "${listArticulos[indiceDelArtEncontrado].descripcion}" | |
| 639 | 642 | mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada) |
| 640 | 643 | val mAlertDialog = mBuilder.show() |
| 641 | 644 | mDialogView.tvNuevaCantidad.requestFocus() |
| ... | ... | @@ -700,7 +703,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 700 | 703 | } |
| 701 | 704 | } |
| 702 | 705 | |
| 703 | - suspend fun buscarCodiogoOriEnBD(CodOri: String): List<Articles> { | |
| 706 | + suspend fun buscarCodiogoOriEnBD(CodOri: String): List<Articles> { | |
| 704 | 707 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 705 | 708 | var busqueda: List<Articles> |
| 706 | 709 | return GlobalScope.async(IO) { |
| ... | ... | @@ -796,8 +799,8 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 796 | 799 | articulos.precio, |
| 797 | 800 | articulos.balanza, |
| 798 | 801 | articulos.depSn, |
| 799 | - ObtenerFechaActual(), | |
| 800 | - ObtenerFechaActual() | |
| 802 | + obtenerFechaActual(), | |
| 803 | + obtenerFechaActual() | |
| 801 | 804 | ) |
| 802 | 805 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS |
| 803 | 806 | } |
| ... | ... | @@ -879,12 +882,12 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 879 | 882 | } |
| 880 | 883 | |
| 881 | 884 | private fun SerchArea(): Boolean { |
| 882 | - if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea =false | |
| 885 | + if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = false | |
| 883 | 886 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = true |
| 884 | 887 | return iArea |
| 885 | 888 | } |
| 886 | 889 | |
| 887 | - suspend fun SerchAreaInventario(): Boolean { | |
| 890 | + suspend fun SerchAreaInventario(): Boolean { | |
| 888 | 891 | return GlobalScope.async(IO) { |
| 889 | 892 | return@async AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.fetchAreaInvH((inventarioViewModel as InventarioViewModel).InventarioNuevo) |
| 890 | 893 | }.await() |
| ... | ... | @@ -902,7 +905,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 902 | 905 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
| 903 | 906 | lifecycleScope.launch { |
| 904 | 907 | withContext(IO) { |
| 905 | - AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.updateInvBody(cantidad, sector.toLong(), codigo.toLong(), ObtenerFechaActual()) | |
| 908 | + AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.updateInvBody(cantidad, sector.toLong(), codigo.toLong(), obtenerFechaActual()) | |
| 906 | 909 | } |
| 907 | 910 | } |
| 908 | 911 | } |
| ... | ... | @@ -930,29 +933,29 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
| 930 | 933 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} |
| 931 | 934 | |
| 932 | 935 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { |
| 933 | - if(mDialogView.rbSumar.isChecked){ | |
| 936 | + if (mDialogView.rbSumar.isChecked) { | |
| 934 | 937 | // mDialogView.tvNuevaCantidad.isEnabled=false |
| 935 | - mDialogView.tvResultado.text=String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat() + mDialogView.tvCantInicial.text.toString().toFloat()) | |
| 938 | + mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat() + mDialogView.tvCantInicial.text.toString().toFloat()) | |
| 936 | 939 | } |
| 937 | - if(mDialogView.rbRestar.isChecked) { | |
| 938 | - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 939 | - if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
| 940 | - mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | |
| 940 | + if (mDialogView.rbRestar.isChecked) { | |
| 941 | + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 942 | + if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | |
| 943 | + mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | |
| 941 | 944 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 942 | - } else { | |
| 943 | - mDialogView.tvResultado.text = "" | |
| 944 | - mDialogView.tvResultado.error = "Operación No Valida" | |
| 945 | - mDialogView.tvResultado.requestFocus() | |
| 946 | - mDialogView.tvResultado.hint = "Error" | |
| 947 | - } | |
| 948 | - } | |
| 949 | - } | |
| 950 | - if(mDialogView.rbMdodificar.isChecked) { | |
| 951 | - if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 952 | - mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) | |
| 945 | + } else { | |
| 946 | + mDialogView.tvResultado.text = "" | |
| 947 | + mDialogView.tvResultado.error = "Operación No Valida" | |
| 948 | + mDialogView.tvResultado.requestFocus() | |
| 949 | + mDialogView.tvResultado.hint = "Error" | |
| 950 | + } | |
| 951 | + } | |
| 952 | + } | |
| 953 | + if (mDialogView.rbMdodificar.isChecked) { | |
| 954 | + if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | |
| 955 | + mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) | |
| 953 | 956 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 954 | - } | |
| 955 | - } | |
| 957 | + } | |
| 958 | + } | |
| 956 | 959 | |
| 957 | 960 | } |
| 958 | 961 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/main/MainFragment.kt
| ... | ... | @@ -27,13 +27,17 @@ import java.util.* |
| 27 | 27 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { |
| 28 | 28 | private lateinit var inventarios: List<InvHead> |
| 29 | 29 | private lateinit var ordenado: List<InvHead> |
| 30 | + private lateinit var ordenadoII: List<InvHead> | |
| 30 | 31 | private lateinit var rcInventario: RecyclerView |
| 32 | + private lateinit var rcInventarioII: RecyclerView | |
| 31 | 33 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
| 32 | 34 | private lateinit var viewManager: RecyclerView.LayoutManager |
| 33 | 35 | private var listIvn2 = ArrayList<InvHead>() |
| 36 | + private var listIvn2II = ArrayList<InvHead>() | |
| 34 | 37 | private lateinit var navController: NavController |
| 35 | 38 | private lateinit var sharedPreferences: SharedPreferences |
| 36 | 39 | private var cantidadInventarios: Int = 0 |
| 40 | + private var cantidadInventariosII: Int = 0 | |
| 37 | 41 | |
| 38 | 42 | override fun onCreate(savedInstanceState: Bundle?) { |
| 39 | 43 | super.onCreate(savedInstanceState) |
| ... | ... | @@ -47,15 +51,22 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener |
| 47 | 51 | savedInstanceState: Bundle? |
| 48 | 52 | ): View? { |
| 49 | 53 | var bAbiertoCerrado = false |
| 54 | + var bAbiertoCerradoII = false | |
| 50 | 55 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
| 51 | 56 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) |
| 52 | - val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) | |
| 57 | + val tvInvImportados = v.findViewById<TextView>(R.id.tvInvImportados) | |
| 53 | 58 | val ivSort19 = v.findViewById<ImageButton>(R.id.ivSort19) |
| 54 | 59 | val ivSort91 = v.findViewById<ImageButton>(R.id.ivSort91) |
| 60 | + val ivSort19II = v.findViewById<ImageButton>(R.id.ivSort19II) | |
| 61 | + val ivSort91II = v.findViewById<ImageButton>(R.id.ivSort91II) | |
| 55 | 62 | val cbVentas = v.findViewById<CheckBox>(R.id.cbVentas) |
| 56 | 63 | val cbDeposito = v.findViewById<CheckBox>(R.id.cbDeposito) |
| 57 | 64 | val tvTipo = v.findViewById<TextView>(R.id.tvTipo) |
| 65 | + val cbVentasII = v.findViewById<CheckBox>(R.id.cbVentasII) | |
| 66 | + val cbDepositoII = v.findViewById<CheckBox>(R.id.cbDepositoII) | |
| 67 | + val tvTipoII = v.findViewById<TextView>(R.id.tvTipoII) | |
| 58 | 68 | rcInventario = v.findViewById(R.id.rcInventario) |
| 69 | + rcInventarioII = v.findViewById(R.id.rcInventarioII) | |
| 59 | 70 | |
| 60 | 71 | GlobalScope.launch(Dispatchers.Main) { |
| 61 | 72 | inventarios = buscarEnBDInvHead() |
| ... | ... | @@ -78,26 +89,30 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener |
| 78 | 89 | tvInvDinamicos.setOnClickListener { |
| 79 | 90 | if (!bAbiertoCerrado) { |
| 80 | 91 | bAbiertoCerrado = true |
| 81 | - txtDeposito.visibility = View.GONE | |
| 92 | + tvInvImportados.visibility = View.GONE | |
| 93 | + ivSort19II.visibility = View.GONE | |
| 94 | + ivSort91II.visibility = View.GONE | |
| 95 | + tvTipoII.visibility = View.GONE | |
| 96 | + cbVentasII.visibility = View.GONE | |
| 97 | + cbDepositoII.visibility = View.GONE | |
| 98 | + | |
| 82 | 99 | rcInventario.visibility = View.VISIBLE |
| 83 | 100 | ivSort91.visibility = View.INVISIBLE |
| 84 | 101 | ivSort19.visibility = View.VISIBLE |
| 85 | 102 | cbVentas.visibility = View.VISIBLE |
| 86 | 103 | cbDeposito.visibility = View.VISIBLE |
| 87 | 104 | tvTipo.visibility = View.VISIBLE |
| 88 | - tvInvDinamicos.text = | |
| 89 | - "Inventarios Dinamicos ($cantidadInventarios) -" | |
| 105 | + tvInvDinamicos.text = "Inventarios Dinamicos ($cantidadInventarios) -" | |
| 90 | 106 | } else { |
| 91 | 107 | bAbiertoCerrado = false |
| 92 | 108 | rcInventario.visibility = View.GONE |
| 93 | 109 | ivSort91.visibility = View.GONE |
| 94 | 110 | ivSort19.visibility = View.GONE |
| 95 | - txtDeposito.visibility = View.VISIBLE | |
| 111 | + tvInvImportados.visibility = View.VISIBLE | |
| 96 | 112 | cbVentas.visibility = View.GONE |
| 97 | 113 | cbDeposito.visibility = View.GONE |
| 98 | 114 | tvTipo.visibility = View.GONE |
| 99 | - tvInvDinamicos.text = | |
| 100 | - "Inventarios Dinamicos ($cantidadInventarios) +" | |
| 115 | + tvInvDinamicos.text = "Inventarios Dinamicos ($cantidadInventarios) +" | |
| 101 | 116 | } |
| 102 | 117 | } |
| 103 | 118 | ordenado = inventarios.sortedBy { |
| ... | ... | @@ -182,6 +197,121 @@ class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener |
| 182 | 197 | } |
| 183 | 198 | viewAdapter.notifyDataSetChanged() |
| 184 | 199 | } |
| 200 | + | |
| 201 | + GlobalScope.launch(Dispatchers.Main) { | |
| 202 | + tvInvImportados.text = "Inventarios Inportados ($cantidadInventariosII) +" | |
| 203 | + tvInvImportados.setOnClickListener { | |
| 204 | + if (!bAbiertoCerradoII) { | |
| 205 | + bAbiertoCerradoII = true | |
| 206 | + tvInvDinamicos.visibility = View.GONE | |
| 207 | + ivSort19.visibility = View.GONE | |
| 208 | + ivSort91.visibility = View.GONE | |
| 209 | + cbVentas.visibility = View.GONE | |
| 210 | + cbDeposito.visibility = View.GONE | |
| 211 | + | |
| 212 | + tvInvDinamicos.visibility = View.GONE | |
| 213 | + rcInventarioII.visibility = View.VISIBLE | |
| 214 | + ivSort91II.visibility = View.INVISIBLE | |
| 215 | + ivSort19II.visibility = View.VISIBLE | |
| 216 | + cbVentasII.visibility = View.VISIBLE | |
| 217 | + cbDepositoII.visibility = View.VISIBLE | |
| 218 | + tvTipoII.visibility = View.VISIBLE | |
| 219 | + tvInvImportados.text = "Inventarios Inportados ($cantidadInventariosII) -" | |
| 220 | + } else { | |
| 221 | + bAbiertoCerradoII = false | |
| 222 | + rcInventarioII.visibility = View.GONE | |
| 223 | + ivSort91II.visibility = View.GONE | |
| 224 | + ivSort19II.visibility = View.GONE | |
| 225 | + tvInvImportados.visibility = View.VISIBLE | |
| 226 | + cbVentasII.visibility = View.GONE | |
| 227 | + cbDepositoII.visibility = View.GONE | |
| 228 | + tvTipoII.visibility = View.GONE | |
| 229 | + tvInvDinamicos.visibility = View.VISIBLE | |
| 230 | + tvInvImportados.text = "Inventarios Inportados ($cantidadInventariosII) +" | |
| 231 | + } | |
| 232 | + } | |
| 233 | + ordenadoII = inventarios.sortedBy { | |
| 234 | + it.invNum | |
| 235 | + } | |
| 236 | + ivSort19II.setOnClickListener { | |
| 237 | + ordenadoII = inventarios.sortedByDescending { | |
| 238 | + it.invNum | |
| 239 | + } | |
| 240 | + cbDepositoII.isChecked=true | |
| 241 | + cbVentasII.isChecked=true | |
| 242 | + viewAdapter = InventarioListAdapter(requireContext(), ordenadoII, this@MainFragment) | |
| 243 | + viewManager = LinearLayoutManager(requireContext()) | |
| 244 | + | |
| 245 | + rcInventarioII.apply { | |
| 246 | + adapter = viewAdapter | |
| 247 | + layoutManager = viewManager | |
| 248 | + } | |
| 249 | + viewAdapter.notifyDataSetChanged() | |
| 250 | + ivSort19II.visibility = View.INVISIBLE | |
| 251 | + ivSort91II.visibility = View.VISIBLE | |
| 252 | + } | |
| 253 | + ivSort91II.setOnClickListener { | |
| 254 | + ordenadoII = inventarios.sortedBy { | |
| 255 | + it.invNum | |
| 256 | + } | |
| 257 | + cbDepositoII.isChecked=true | |
| 258 | + cbVentasII.isChecked=true | |
| 259 | + viewAdapter = InventarioListAdapter(requireContext(), ordenadoII, this@MainFragment) | |
| 260 | + viewManager = LinearLayoutManager(requireContext()) | |
| 261 | + | |
| 262 | + rcInventarioII.apply { | |
| 263 | + adapter = viewAdapter | |
| 264 | + layoutManager = viewManager | |
| 265 | + } | |
| 266 | + viewAdapter.notifyDataSetChanged() | |
| 267 | + ivSort91.visibility = View.INVISIBLE | |
| 268 | + ivSort19.visibility = View.VISIBLE | |
| 269 | + } | |
| 270 | + } | |
| 271 | + | |
| 272 | + cbVentasII.setOnClickListener { | |
| 273 | + if (!cbVentasII.isChecked) { | |
| 274 | + cbDepositoII.isChecked=true | |
| 275 | + listIvn2II.clear() | |
| 276 | + ordenadoII.forEach { | |
| 277 | + if (it.lugar==true) { | |
| 278 | + listIvn2II.add(it) | |
| 279 | + } | |
| 280 | + } | |
| 281 | + } else { | |
| 282 | + listIvn2II.clear() | |
| 283 | + listIvn2II.addAll(ordenadoII) | |
| 284 | + } | |
| 285 | + viewAdapter = InventarioListAdapter(requireContext(), listIvn2II, this@MainFragment) | |
| 286 | + viewManager = LinearLayoutManager(requireContext()) | |
| 287 | + rcInventarioII.apply { | |
| 288 | + adapter = viewAdapter | |
| 289 | + layoutManager = viewManager | |
| 290 | + } | |
| 291 | + viewAdapter.notifyDataSetChanged() | |
| 292 | + } | |
| 293 | + | |
| 294 | + cbDepositoII.setOnClickListener { | |
| 295 | + if (!cbDepositoII.isChecked) { | |
| 296 | + cbVentasII.isChecked=true | |
| 297 | + listIvn2II.clear() | |
| 298 | + ordenadoII.forEach { | |
| 299 | + if (it.lugar==false) { | |
| 300 | + listIvn2II.add(it) | |
| 301 | + } | |
| 302 | + } | |
| 303 | + } else { | |
| 304 | + listIvn2II.clear() | |
| 305 | + listIvn2II.addAll(ordenadoII) | |
| 306 | + } | |
| 307 | + viewAdapter = InventarioListAdapter(requireContext(), listIvn2II, this@MainFragment) | |
| 308 | + viewManager = LinearLayoutManager(requireContext()) | |
| 309 | + rcInventarioII.apply { | |
| 310 | + adapter = viewAdapter | |
| 311 | + layoutManager = viewManager | |
| 312 | + } | |
| 313 | + viewAdapter.notifyDataSetChanged() | |
| 314 | + } | |
| 185 | 315 | return v |
| 186 | 316 | } |
| 187 | 317 |
app/src/main/res/layout-land/fragment_configuracion.xml
| ... | ... | @@ -63,7 +63,6 @@ |
| 63 | 63 | app:layout_constraintHorizontal_chainStyle="packed" |
| 64 | 64 | app:layout_constraintStart_toStartOf="parent" |
| 65 | 65 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" |
| 66 | - android:entries="@array/spinnerServidor" | |
| 67 | 66 | android:prompt="@string/leyendaSpinner"/> |
| 68 | 67 | |
| 69 | 68 | <Button |
app/src/main/res/layout/activity_splash.xml
| ... | ... | @@ -28,7 +28,7 @@ |
| 28 | 28 | app:layout_constraintStart_toStartOf="parent" |
| 29 | 29 | app:layout_constraintTop_toTopOf="parent" /> |
| 30 | 30 | |
| 31 | - <ImageView | |
| 31 | + MarginTopTitulos <ImageView | |
| 32 | 32 | android:id="@+id/imageView" |
| 33 | 33 | android:layout_width="wrap_content" |
| 34 | 34 | android:layout_height="wrap_content" |
app/src/main/res/layout/fragment_actua_maestros.xml
app/src/main/res/layout/fragment_inv_importados.xml
| ... | ... | @@ -0,0 +1,88 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
| 4 | + xmlns:tools="http://schemas.android.com/tools" | |
| 5 | + android:layout_width="match_parent" | |
| 6 | + android:layout_height="match_parent" | |
| 7 | + tools:context=".UI.actualizacionMaestros.ActuaMaestrosFragment"> | |
| 8 | + | |
| 9 | + | |
| 10 | + <androidx.appcompat.widget.AppCompatTextView | |
| 11 | + android:id="@+id/tvActMaestros" | |
| 12 | + android:layout_width="match_parent" | |
| 13 | + android:layout_height="wrap_content" | |
| 14 | + android:layout_marginTop="@dimen/MarginTopTitulos" | |
| 15 | + android:gravity="center" | |
| 16 | + android:text="@string/tvActMaestros" | |
| 17 | + android:textColor="@color/colorAccent" | |
| 18 | + android:textSize="@dimen/Titulos" | |
| 19 | + app:fontFamily="sans-serif-condensed" | |
| 20 | + app:layout_constraintBottom_toTopOf="@+id/tvSeleccionInventario" | |
| 21 | + app:layout_constraintEnd_toEndOf="parent" | |
| 22 | + app:layout_constraintStart_toStartOf="parent" | |
| 23 | + app:layout_constraintTop_toTopOf="parent" /> | |
| 24 | + | |
| 25 | + <TextView | |
| 26 | + android:id="@+id/tvSeleccionInventario" | |
| 27 | + android:layout_width="0dp" | |
| 28 | + android:layout_height="wrap_content" | |
| 29 | + android:layout_margin="30dp" | |
| 30 | + android:layout_marginTop="28dp" | |
| 31 | + android:gravity="center" | |
| 32 | + android:text="@string/tvSeleccionInventario" | |
| 33 | + android:textColor="@android:color/black" | |
| 34 | + android:textSize="@dimen/MarginTopTitulos" | |
| 35 | + app:fontFamily="sans-serif-condensed" | |
| 36 | + app:layout_constraintEnd_toEndOf="parent" | |
| 37 | + app:layout_constraintStart_toStartOf="parent" | |
| 38 | + app:layout_constraintTop_toBottomOf="@+id/tvActMaestros" /> | |
| 39 | + | |
| 40 | + <androidx.recyclerview.widget.RecyclerView | |
| 41 | + android:id="@+id/rcDescripcion" | |
| 42 | + android:layout_width="match_parent" | |
| 43 | + android:layout_height="0dp" | |
| 44 | + android:background="@android:color/darker_gray" | |
| 45 | + android:scrollbars="vertical" | |
| 46 | + app:layout_constraintBottom_toTopOf="@+id/guideline" | |
| 47 | + app:layout_constraintEnd_toEndOf="parent" | |
| 48 | + app:layout_constraintStart_toStartOf="parent" | |
| 49 | + app:layout_constraintTop_toBottomOf="@id/tvSeleccionInventario" | |
| 50 | + tools:listitem="@layout/item_inv_importados" /> | |
| 51 | + | |
| 52 | + <Button | |
| 53 | + android:id="@+id/btnConfirmarAct" | |
| 54 | + android:layout_width="0dp" | |
| 55 | + android:layout_height="wrap_content" | |
| 56 | + android:layout_margin="20dp" | |
| 57 | + android:text="@string/btnConfirmarAct" | |
| 58 | + android:textSize="@dimen/MarginTopTitulos" | |
| 59 | + android:textColor="@android:color/white" | |
| 60 | + android:padding="10dp" | |
| 61 | + android:background="@drawable/boton_borde_redondeado" | |
| 62 | + app:layout_constraintBottom_toBottomOf="parent" | |
| 63 | + app:layout_constraintEnd_toEndOf="parent" | |
| 64 | + app:layout_constraintStart_toStartOf="parent" /> | |
| 65 | + | |
| 66 | + | |
| 67 | + <ProgressBar | |
| 68 | + android:id="@+id/loading_view" | |
| 69 | + android:layout_width="wrap_content" | |
| 70 | + android:layout_height="wrap_content" | |
| 71 | + android:layout_marginStart="8dp" | |
| 72 | + android:layout_marginLeft="8dp" | |
| 73 | + android:layout_marginTop="8dp" | |
| 74 | + android:layout_marginEnd="8dp" | |
| 75 | + android:layout_marginRight="8dp" | |
| 76 | + android:layout_marginBottom="8dp" | |
| 77 | + android:visibility="gone" | |
| 78 | + app:layout_constraintBottom_toBottomOf="parent" | |
| 79 | + app:layout_constraintEnd_toEndOf="parent" | |
| 80 | + app:layout_constraintStart_toStartOf="parent" | |
| 81 | + app:layout_constraintTop_toTopOf="parent" /> | |
| 82 | + <androidx.constraintlayout.widget.Guideline | |
| 83 | + android:id="@+id/guideline" | |
| 84 | + android:layout_width="wrap_content" | |
| 85 | + android:layout_height="wrap_content" | |
| 86 | + android:orientation="horizontal" | |
| 87 | + app:layout_constraintGuide_percent="0.88" /> | |
| 88 | +</androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/fragment_main.xml
| ... | ... | @@ -96,11 +96,11 @@ |
| 96 | 96 | app:layout_constraintStart_toStartOf="parent" |
| 97 | 97 | app:layout_constraintTop_toBottomOf="@id/ivSort19" |
| 98 | 98 | tools:listitem="@layout/item_principal" |
| 99 | - app:layout_constraintBottom_toTopOf="@+id/guideline6"/> | |
| 99 | + app:layout_constraintBottom_toTopOf="@+id/guideline1"/> | |
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | <androidx.appcompat.widget.AppCompatTextView |
| 103 | - android:id="@+id/txtDeposito" | |
| 103 | + android:id="@+id/tvInvImportados" | |
| 104 | 104 | android:layout_width="match_parent" |
| 105 | 105 | android:layout_height="90dp" |
| 106 | 106 | android:autoSizeMaxTextSize="150sp" |
| ... | ... | @@ -119,4 +119,86 @@ |
| 119 | 119 | app:layout_constraintStart_toStartOf="parent" |
| 120 | 120 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" |
| 121 | 121 | app:layout_constraintVertical_bias="0.0" /> |
| 122 | + | |
| 123 | + <androidx.appcompat.widget.AppCompatImageButton | |
| 124 | + android:id="@+id/ivSort19II" | |
| 125 | + android:layout_width="50dp" | |
| 126 | + android:layout_height="50dp" | |
| 127 | + android:layout_marginStart="10dp" | |
| 128 | + android:padding="5dp" | |
| 129 | + android:src="@drawable/ic_sort19" | |
| 130 | + android:visibility="gone" | |
| 131 | + app:layout_constraintHorizontal_bias="0.0" | |
| 132 | + app:layout_constraintHorizontal_chainStyle="packed" | |
| 133 | + app:layout_constraintStart_toStartOf="parent" | |
| 134 | + app:layout_constraintTop_toBottomOf="@id/tvInvImportados" /> | |
| 135 | + | |
| 136 | + <androidx.appcompat.widget.AppCompatImageButton | |
| 137 | + android:id="@+id/ivSort91II" | |
| 138 | + android:layout_width="50dp" | |
| 139 | + android:layout_height="50dp" | |
| 140 | + android:layout_marginStart="10dp" | |
| 141 | + android:padding="5dp" | |
| 142 | + android:src="@drawable/ic_sort91" | |
| 143 | + android:visibility="gone" | |
| 144 | + app:layout_constraintHorizontal_chainStyle="packed" | |
| 145 | + app:layout_constraintStart_toStartOf="parent" | |
| 146 | + app:layout_constraintTop_toBottomOf="@id/tvInvImportados" /> | |
| 147 | + | |
| 148 | + <TextView | |
| 149 | + android:id="@+id/tvTipoII" | |
| 150 | + android:layout_width="wrap_content" | |
| 151 | + android:layout_height="wrap_content" | |
| 152 | + android:layout_margin="5dp" | |
| 153 | + android:text="Tipo:" | |
| 154 | + android:layout_marginTop="12dp" | |
| 155 | + android:textSize="15sp" | |
| 156 | + android:visibility="gone" | |
| 157 | + app:layout_constraintBaseline_toBaselineOf="@+id/cbVentasII" | |
| 158 | + app:layout_constraintEnd_toStartOf="@+id/cbVentasII" /> | |
| 159 | + | |
| 160 | + <com.google.android.material.checkbox.MaterialCheckBox | |
| 161 | + android:id="@+id/cbVentasII" | |
| 162 | + android:layout_width="wrap_content" | |
| 163 | + android:layout_height="wrap_content" | |
| 164 | + android:layout_margin="5dp" | |
| 165 | + android:checked="true" | |
| 166 | + android:text="Ventas" | |
| 167 | + android:layout_marginTop="12dp" | |
| 168 | + android:visibility="gone" | |
| 169 | + app:layout_constraintEnd_toStartOf="@+id/cbDepositoII" | |
| 170 | + app:layout_constraintTop_toBottomOf="@+id/tvInvImportados" /> | |
| 171 | + | |
| 172 | + <com.google.android.material.checkbox.MaterialCheckBox | |
| 173 | + android:id="@+id/cbDepositoII" | |
| 174 | + android:layout_width="wrap_content" | |
| 175 | + android:layout_height="wrap_content" | |
| 176 | + android:layout_margin="5dp" | |
| 177 | + android:checked="true" | |
| 178 | + android:text="Deposito" | |
| 179 | + android:layout_marginTop="12dp" | |
| 180 | + android:visibility="gone" | |
| 181 | + app:layout_constraintEnd_toEndOf="parent" | |
| 182 | + app:layout_constraintTop_toBottomOf="@+id/tvInvImportados" /> | |
| 183 | + | |
| 184 | + | |
| 185 | + <androidx.recyclerview.widget.RecyclerView | |
| 186 | + android:id="@+id/rcInventarioII" | |
| 187 | + android:layout_width="match_parent" | |
| 188 | + android:layout_height="0dp" | |
| 189 | + android:background="@android:color/darker_gray" | |
| 190 | + android:scrollbars="vertical" | |
| 191 | + android:visibility="gone" | |
| 192 | + app:layout_constraintEnd_toEndOf="parent" | |
| 193 | + app:layout_constraintStart_toStartOf="parent" | |
| 194 | + app:layout_constraintTop_toBottomOf="@id/ivSort19II" | |
| 195 | + tools:listitem="@layout/item_principal" | |
| 196 | + app:layout_constraintBottom_toTopOf="@+id/guideline1"/> | |
| 197 | + | |
| 198 | + <androidx.constraintlayout.widget.Guideline | |
| 199 | + android:id="@+id/guideline1" | |
| 200 | + android:layout_width="wrap_content" | |
| 201 | + android:layout_height="wrap_content" | |
| 202 | + android:orientation="horizontal" | |
| 203 | + app:layout_constraintGuide_percent="0.97" /> | |
| 122 | 204 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 123 | 205 | \ No newline at end of file |
app/src/main/res/layout/item_inv_importados.xml
| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<androidx.constraintlayout.widget.ConstraintLayout | |
| 3 | + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" | |
| 4 | + android:layout_height="match_parent"> | |
| 5 | + | |
| 6 | +</androidx.constraintlayout.widget.ConstraintLayout> | |
| 0 | 7 | \ No newline at end of file |
app/src/main/res/navigation/mobile_navigation.xml
| ... | ... | @@ -43,7 +43,11 @@ |
| 43 | 43 | android:id="@+id/actuaMaestrosFragment" |
| 44 | 44 | android:name="com.focasoftware.deboinventariov20.UI.actualizacionMaestros.ActuaMaestrosFragment" |
| 45 | 45 | android:label="Importaciones Varias" |
| 46 | - tools:layout="@layout/fragment_actua_maestros" /> | |
| 46 | + tools:layout="@layout/fragment_actua_maestros" > | |
| 47 | + <action | |
| 48 | + android:id="@+id/action_actuaMaestrosFragment_to_invImportadosFragment" | |
| 49 | + app:destination="@id/invImportadosFragment" /> | |
| 50 | + </fragment> | |
| 47 | 51 | |
| 48 | 52 | |
| 49 | 53 | <fragment |
| ... | ... | @@ -134,4 +138,13 @@ |
| 134 | 138 | android:id="@+id/action_codigoOriFragment_to_inventarioFragment" |
| 135 | 139 | app:destination="@id/inventarioFragment" /> |
| 136 | 140 | </fragment> |
| 141 | + <fragment | |
| 142 | + android:id="@+id/invImportadosFragment" | |
| 143 | + android:name="com.focasoftware.deboinventariov20.UI.actualizacionMaestros.InvImportadosFragment" | |
| 144 | + android:label="Inventarios Importados" | |
| 145 | + tools:layout="@layout/fragment_inv_importados"> | |
| 146 | + <action | |
| 147 | + android:id="@+id/action_invImportadosFragment_to_mainFragment2" | |
| 148 | + app:destination="@id/mainFragment2" /> | |
| 149 | + </fragment> | |
| 137 | 150 | </navigation> |
app/src/main/res/values/strings.xml
| ... | ... | @@ -20,29 +20,27 @@ |
| 20 | 20 | <string name="bien">Bienvenido</string> |
| 21 | 21 | <string name="debo">DEBO®</string> |
| 22 | 22 | <string name="inventario">Inventario</string> |
| 23 | - <string name="todo">TODO</string> | |
| 24 | - <string name="hello_blank_fragment">Hello blank fragment</string> | |
| 25 | 23 | |
| 26 | 24 | <!-- inventarios dinamicos--> |
| 27 | - <string name="invDinamicoVenta">Inventarios Dinamicos</string> | |
| 25 | + <string name="invDinamicoVenta">Inventarios Dinámicos</string> | |
| 28 | 26 | <string name="invDinamicoCompra">Inventarios Importados(0) +</string> |
| 29 | 27 | |
| 30 | 28 | <!-- ventana emergente--> |
| 31 | 29 | <string name="adv">Ingrese la cantidad contada</string> |
| 32 | - <string name="invVentas">Inventarios Dinamicos de Ventas</string> | |
| 30 | + <string name="invVentas">Inventarios Dinámicos de Ventas</string> | |
| 33 | 31 | <string name="btnCancela">Cancelar</string> |
| 34 | 32 | |
| 35 | 33 | |
| 36 | 34 | <!-- Fragment Inventario--> |
| 37 | 35 | <string name="invTitulo">Inventarios Dinámicos</string> |
| 38 | 36 | <string name="invTituloV">Inventarios de Ventas</string> |
| 39 | - <string name="invTituloD">Inventarios de Depositos</string> | |
| 37 | + <string name="invTituloD">Inventarios de Depósitos</string> | |
| 40 | 38 | <string name="invCodigoBarras">Código Barras:</string> |
| 41 | 39 | <string name="btnExportarInv">Exportar Inventario</string> |
| 42 | 40 | <string name="btnBorrarInv">Borrar Inventario</string> |
| 43 | - <string name="ibBusDesc">Busqueda por Descripción</string> | |
| 44 | - <string name="ibBusCB">Busqueda por Código Barras</string> | |
| 45 | - <string name="ibBusCO">Busqueda por Código de Origen</string> | |
| 41 | + <string name="ibBusDesc">Búsqueda por Descripción</string> | |
| 42 | + <string name="ibBusCB">Búsqueda por Código Barras</string> | |
| 43 | + <string name="ibBusCO">Búsqueda por Código de Origen</string> | |
| 46 | 44 | <string name="switch_1">+ 1</string> |
| 47 | 45 | |
| 48 | 46 | <!-- Fragmento Configuraciones--> |
| ... | ... | @@ -69,31 +67,28 @@ |
| 69 | 67 | <string name="rbCodigoOrigen">Código Origen</string> |
| 70 | 68 | <string name="rbCodigoBarras">Código de Barras</string> |
| 71 | 69 | |
| 72 | - | |
| 73 | - <!-- Spinner servidor--> | |
| 74 | - <string-array name="spinnerServidor"> | |
| 75 | - <item>Servidor Laboratorio 1</item> | |
| 76 | - <item>Servidor Laboratorio 2</item> | |
| 77 | - <item>Servidor Laboratorio 3</item> | |
| 78 | - </string-array> | |
| 79 | 70 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> |
| 80 | 71 | |
| 81 | 72 | <string name="cbMostrarExistencia">Existencia</string> |
| 82 | 73 | <string name="cbMostrarPrecio">Precio</string> |
| 83 | 74 | |
| 84 | 75 | <string name="btnGuardar">Guardar Cambios</string> |
| 85 | - | |
| 76 | + <string name="todo"> </string> | |
| 77 | + todo | |
| 86 | 78 | <!-- fragment Actualizacion de Maestros--> |
| 87 | 79 | <string name="tvActMaestros">Importaciones</string> |
| 88 | 80 | <string name="tvMedio">Seleccione que tipo de importación desea realizar</string> |
| 81 | + <string name="tvSeleccionInventario"> Seleccione el inventario a importar</string> | |
| 82 | + | |
| 89 | 83 | <string name="obPorWifi">Importación de artículos</string> |
| 90 | 84 | <string name="obViaArchivo">Importación de inventarios</string> |
| 91 | 85 | |
| 92 | 86 | <string name="btnConfirmarAct">Confirmar Importación</string> |
| 87 | + <string name="btnConfirmarInv">Confirmar Inventarios</string> | |
| 93 | 88 | |
| 94 | 89 | <!-- Fragment Save--> |
| 95 | 90 | <string name="tvConfServi">Configuración de Servidores</string> |
| 96 | - <string name="server">Ingrese la direccion del servidor</string> | |
| 91 | + <string name="server">Ingrese la dirección del servidor</string> | |
| 97 | 92 | <string name="etNomServer">Ingrese una descripción para la conexión</string> |
| 98 | 93 | <string name="btnGuardarConfServ">Guardar Conexión</string> |
| 99 | 94 |