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
| 1 | package com.focasoftware.deboinventariov20.DB.DAO | 1 | package com.focasoftware.deboinventariov20.DB.DAO |
| 2 | 2 | ||
| 3 | import androidx.room.Dao | 3 | import androidx.room.Dao |
| 4 | import androidx.room.Insert | 4 | import androidx.room.Insert |
| 5 | import androidx.room.OnConflictStrategy | 5 | import androidx.room.OnConflictStrategy |
| 6 | import androidx.room.Query | 6 | import androidx.room.Query |
| 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_ART | 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_ART |
| 8 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_B | 8 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_B |
| 9 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_H | 9 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_INV_H |
| 10 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_SERV_INV | 10 | import com.focasoftware.deboinventariov20.DB.Constans.Constans.Companion.TABLA_SERV_INV |
| 11 | import com.focasoftware.deboinventariov20.Model.Articles | 11 | import com.focasoftware.deboinventariov20.Model.Articles |
| 12 | import com.focasoftware.deboinventariov20.Model.InvBody | 12 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 13 | import com.focasoftware.deboinventariov20.Model.InvHead | 13 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 14 | import com.focasoftware.deboinventariov20.Model.ServeInv | 14 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 15 | 15 | ||
| 16 | @Dao | 16 | @Dao |
| 17 | interface ArticulosDAO { | 17 | interface ArticulosDAO { |
| 18 | 18 | ||
| 19 | // TABLA ARTICULOS | 19 | // TABLA ARTICULOS |
| 20 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 20 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
| 21 | suspend fun insertArticulos(articulos: Articles?) | 21 | suspend fun insertArticulos(articulos: Articles?) |
| 22 | 22 | ||
| 23 | @Query("SELECT * FROM $TABLA_ART ORDER BY DETART DESC") | 23 | @Query("SELECT * FROM $TABLA_ART ORDER BY DETART DESC") |
| 24 | suspend fun findAllArticulos(): List<Articles> | 24 | suspend fun findAllArticulos(): List<Articles> |
| 25 | 25 | ||
| 26 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DETART LIKE '%' || :description || '%' GROUP BY DETART ORDER BY DETART") | 26 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DETART LIKE '%' || :description || '%' GROUP BY DETART ORDER BY DETART") |
| 27 | suspend fun findArticuloByDesc(description: String?, dep: Boolean): List<Articles> | 27 | suspend fun findArticuloByDesc(description: String?, dep: Boolean): List<Articles> |
| 28 | 28 | ||
| 29 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(CODBAR) = :codBarra") | 29 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(CODBAR) = :codBarra") |
| 30 | suspend fun findArticuloByCodBar(codBarra: String, dep: Boolean): Articles | 30 | suspend fun findArticuloByCodBar(codBarra: String, dep: Boolean): Articles |
| 31 | 31 | ||
| 32 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(COO) LIKE :CodOrigen") | 32 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND TRIM(COO) LIKE :CodOrigen") |
| 33 | suspend fun findArticuloByCodOri(CodOrigen: String?, dep: Boolean): List<Articles> | 33 | suspend fun findArticuloByCodOri(CodOrigen: String?, dep: Boolean): List<Articles> |
| 34 | 34 | ||
| 35 | @Query("DELETE FROM $TABLA_ART") | 35 | @Query("DELETE FROM $TABLA_ART") |
| 36 | suspend fun deleteAllArticulos() | 36 | suspend fun deleteAllArticulos() |
| 37 | 37 | ||
| 38 | @Query("SELECT * FROM $TABLA_ART WHERE CODSEC=:sector AND CODART=:codigo") | 38 | @Query("SELECT * FROM $TABLA_ART WHERE CODSEC=:sector AND CODART=:codigo") |
| 39 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? | 39 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | @Dao | 42 | @Dao |
| 43 | interface InvHeadDAO { | 43 | interface InvHeadDAO { |
| 44 | @Insert() | 44 | @Insert() |
| 45 | suspend fun insertInvHead(invHead: InvHead?) | 45 | suspend fun insertInvHead(invHead: InvHead?) |
| 46 | 46 | ||
| 47 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") | 47 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") |
| 48 | suspend fun findLastInv(): Int | 48 | suspend fun findLastInv(): Int |
| 49 | 49 | ||
| 50 | @Query("DELETE FROM $TABLA_INV_H") | 50 | @Query("DELETE FROM $TABLA_INV_H") |
| 51 | suspend fun deleteAllArticulos() | 51 | suspend fun deleteAllArticulos() |
| 52 | 52 | ||
| 53 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 53 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
| 54 | suspend fun deleteinvHead(inven: Int) | 54 | suspend fun deleteinvHead(inven: Int) |
| 55 | 55 | ||
| 56 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") | 56 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") |
| 57 | suspend fun fetchAllInvHead(): List<InvHead> | 57 | suspend fun fetchAllInvHead(): List<InvHead> |
| 58 | 58 | ||
| 59 | @Query("SELECT INV_LUG FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 59 | @Query("SELECT INV_LUG FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
| 60 | suspend fun fetchAreaInvH (inven: Int): Boolean | 60 | suspend fun fetchAreaInvH (inven: Int): Boolean |
| 61 | 61 | ||
| 62 | @Query("SELECT INV_PRODCONT FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 62 | @Query("SELECT INV_PRODCONT FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
| 63 | suspend fun consultaCantidadInvH (inven: Int): Int | 63 | suspend fun consultaCantidadInvH (inven: Int): Int |
| 64 | 64 | ||
| 65 | @Query("UPDATE $TABLA_INV_H SET INV_PRODCONT=:cant WHERE INV_NUM=:inven") | 65 | @Query("UPDATE $TABLA_INV_H SET INV_PRODCONT=:cant WHERE INV_NUM=:inven") |
| 66 | suspend fun updateInvBody(inven: Int,cant: Int) | 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 | suspend fun foundInvHead (inven: Int): InvHead | 69 | suspend fun foundInvHead (inven: Int): InvHead |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | @Dao | 72 | @Dao |
| 73 | interface InvBodyDAO { | 73 | interface InvBodyDAO { |
| 74 | @Insert() | 74 | @Insert() |
| 75 | suspend fun insertInvBody(invBody: InvBody?) | 75 | suspend fun insertInvBody(invBody: InvBody?) |
| 76 | 76 | ||
| 77 | @Query("DELETE FROM $TABLA_INV_B") | 77 | @Query("DELETE FROM $TABLA_INV_B") |
| 78 | suspend fun deleteAllInvBody() | 78 | suspend fun deleteAllInvBody() |
| 79 | 79 | ||
| 80 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") | 80 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") |
| 81 | suspend fun deleteInvBody(inven: Int) | 81 | suspend fun deleteInvBody(inven: Int) |
| 82 | 82 | ||
| 83 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant , INV_FEF=:actFechaHora WHERE SEC=:sec AND COD=:cod") | 83 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant , INV_FEF=:actFechaHora WHERE SEC=:sec AND COD=:cod") |
| 84 | suspend fun updateInvBody(cant: Float, sec: Long, cod: Long, actFechaHora:String) | 84 | suspend fun updateInvBody(cant: Float, sec: Long, cod: Long, actFechaHora:String) |
| 85 | 85 | ||
| 86 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") | 86 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") |
| 87 | suspend fun fetchAllInvBody(inven: Int): List<InvBody> | 87 | suspend fun fetchAllInvBody(inven: Int): List<InvBody> |
| 88 | 88 | ||
| 89 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 89 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
| 90 | suspend fun fetchArtInInvBody(sector: Long, codigo: Long, numInventario: Int): InvBody | 90 | suspend fun fetchArtInInvBody(sector: Long, codigo: Long, numInventario: Int): InvBody |
| 91 | 91 | ||
| 92 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 92 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
| 93 | suspend fun deleteItemFromInvBody(sector: Long, codigo: Long, numInventario: Int): Int | 93 | suspend fun deleteItemFromInvBody(sector: Long, codigo: Long, numInventario: Int): Int |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | @Dao | 96 | @Dao |
| 97 | interface ServeInvDao { | 97 | interface ServeInvDao { |
| 98 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 98 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
| 99 | fun insertServer(servidor: ServeInv) | 99 | fun insertServer(servidor: ServeInv) |
| 100 | 100 | ||
| 101 | @Query("SELECT * FROM $TABLA_SERV_INV ORDER BY SER_NUM") | 101 | @Query("SELECT * FROM $TABLA_SERV_INV ORDER BY SER_NUM") |
| 102 | suspend fun fetchAllServers(): List<ServeInv> | 102 | suspend fun fetchAllServers(): List<ServeInv> |
| 103 | 103 | ||
| 104 | @Query("DELETE FROM $TABLA_SERV_INV WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") | 104 | @Query("DELETE FROM $TABLA_SERV_INV WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") |
| 105 | suspend fun deleteServer(description: String, dir: String) | 105 | suspend fun deleteServer(description: String, dir: String) |
| 106 | 106 | ||
| 107 | @Query("SELECT SER_NUM FROM $TABLA_SERV_INV ORDER BY SER_NUM DESC") | 107 | @Query("SELECT SER_NUM FROM $TABLA_SERV_INV ORDER BY SER_NUM DESC") |
| 108 | suspend fun findLastServer(): Int | 108 | suspend fun findLastServer(): Int |
| 109 | 109 | ||
| 110 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") | 110 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") |
| 111 | suspend fun UpdateServerPreInZero() | 111 | suspend fun UpdateServerPreInZero() |
| 112 | 112 | ||
| 113 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_NUM = :numero") | 113 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_NUM = :numero") |
| 114 | suspend fun UpdateServerPre(numero: Int) | 114 | suspend fun UpdateServerPre(numero: Int) |
| 115 | 115 | ||
| 116 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE= 1") | 116 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE= 1") |
| 117 | suspend fun fetchServerPreOne(): ServeInv | 117 | suspend fun fetchServerPreOne(): ServeInv |
| 118 | 118 | ||
| 119 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_NUM = :numero") | 119 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_NUM = :numero") |
| 120 | suspend fun fetchServer(numero: Int): ServeInv | 120 | suspend fun fetchServer(numero: Int): ServeInv |
| 121 | } | 121 | } |
app/src/main/java/com/focasoftware/deboinventariov20/DB/DataBase/AppDb.kt
| 1 | package com.focasoftware.deboinventariov20.DB.DataBase | 1 | package com.focasoftware.deboinventariov20.DB.DataBase |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import androidx.room.Database | 4 | import androidx.room.Database |
| 5 | import androidx.room.Room | 5 | import androidx.room.Room |
| 6 | import androidx.room.RoomDatabase | 6 | import androidx.room.RoomDatabase |
| 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans | 7 | import com.focasoftware.deboinventariov20.DB.Constans.Constans |
| 8 | import com.focasoftware.deboinventariov20.DB.DAO.* | 8 | import com.focasoftware.deboinventariov20.DB.DAO.* |
| 9 | import com.focasoftware.deboinventariov20.Model.Articles | 9 | import com.focasoftware.deboinventariov20.Model.Articles |
| 10 | import com.focasoftware.deboinventariov20.Model.InvBody | 10 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 11 | import com.focasoftware.deboinventariov20.Model.InvHead | 11 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 12 | import com.focasoftware.deboinventariov20.Model.ServeInv | 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 | abstract class AppDb : RoomDatabase() { | 16 | abstract class AppDb : RoomDatabase() { |
| 17 | abstract fun ArticulosDAO(): ArticulosDAO? | 17 | abstract fun ArticulosDAO(): ArticulosDAO? |
| 18 | abstract fun InvHeadDAO(): InvHeadDAO? | 18 | abstract fun InvHeadDAO(): InvHeadDAO? |
| 19 | abstract fun InvBodyDAO(): InvBodyDAO? | 19 | abstract fun InvBodyDAO(): InvBodyDAO? |
| 20 | abstract fun ServeInvDao(): ServeInvDao? | 20 | abstract fun ServeInvDao(): ServeInvDao? |
| 21 | 21 | ||
| 22 | companion object { | 22 | companion object { |
| 23 | private var INSTANCE: AppDb? = null | 23 | private var INSTANCE: AppDb? = null |
| 24 | fun getAppDb(context: Context): AppDb? { | 24 | fun getAppDb(context: Context): AppDb? { |
| 25 | if (INSTANCE == null) { | 25 | if (INSTANCE == null) { |
| 26 | INSTANCE = Room.databaseBuilder(context.applicationContext, AppDb::class.java, Constans.DB_NAME) | 26 | INSTANCE = Room.databaseBuilder(context.applicationContext, AppDb::class.java, Constans.DB_NAME) |
| 27 | .allowMainThreadQueries() | 27 | .allowMainThreadQueries() |
| 28 | .build() | 28 | .build() |
| 29 | } | 29 | } |
| 30 | return INSTANCE | 30 | return INSTANCE |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | fun destroyInstance() { | 33 | fun destroyInstance() { |
| 34 | INSTANCE = null | 34 | INSTANCE = null |
| 35 | } | 35 | } |
| 36 | } | 36 | } |
| 37 | } | 37 | } |
app/src/main/java/com/focasoftware/deboinventariov20/Model/WebService.kt
| 1 | package com.focasoftware.deboinventariov20.Model | 1 | package com.focasoftware.deboinventariov20.Model |
| 2 | 2 | ||
| 3 | import com.focasoftware.deboinventariov20.UI.actualizacionMaestros.BASE_URL | 3 | import com.focasoftware.deboinventariov20.UI.actualizacionMaestros.BASE_URL |
| 4 | import okhttp3.OkHttpClient | 4 | import okhttp3.OkHttpClient |
| 5 | import okhttp3.logging.HttpLoggingInterceptor | 5 | import okhttp3.logging.HttpLoggingInterceptor |
| 6 | import retrofit2.Retrofit | 6 | import retrofit2.Retrofit |
| 7 | import retrofit2.converter.gson.GsonConverterFactory | 7 | import retrofit2.converter.gson.GsonConverterFactory |
| 8 | import java.util.concurrent.TimeUnit | 8 | import java.util.concurrent.TimeUnit |
| 9 | 9 | ||
| 10 | object WebService { | 10 | object WebService { |
| 11 | private var instance: WebService? = null | 11 | private var instance: WebService? = null |
| 12 | private var retrofit:Retrofit? =null | 12 | private var retrofit: Retrofit? = null |
| 13 | private val TIME_OUT: Long | 13 | private val TIME_OUT: Long |
| 14 | get() { | 14 | get() { |
| 15 | return 15 | 15 | return 15 |
| 16 | } | 16 | } |
| 17 | private val interceptor = run { | 17 | private val interceptor = run { |
| 18 | val httpLoggingInterceptor = HttpLoggingInterceptor() | 18 | val httpLoggingInterceptor = HttpLoggingInterceptor() |
| 19 | httpLoggingInterceptor.apply { | 19 | httpLoggingInterceptor.apply { |
| 20 | httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY | 20 | httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
| 23 | private val okHttpClient = OkHttpClient.Builder() | 23 | private val okHttpClient = OkHttpClient.Builder() |
| 24 | .addNetworkInterceptor(interceptor) | 24 | .addNetworkInterceptor(interceptor) |
| 25 | .connectTimeout(TIME_OUT, TimeUnit.SECONDS) | 25 | .connectTimeout(TIME_OUT, TimeUnit.SECONDS) |
| 26 | .writeTimeout(TIME_OUT, TimeUnit.SECONDS) | 26 | .writeTimeout(TIME_OUT, TimeUnit.SECONDS) |
| 27 | .readTimeout(TIME_OUT, TimeUnit.SECONDS) | 27 | .readTimeout(TIME_OUT, TimeUnit.SECONDS) |
| 28 | .build() | 28 | .build() |
| 29 | 29 | ||
| 30 | private fun WebService() { | 30 | // private fun WebService() { |
| 31 | retrofit = Retrofit.Builder() | 31 | // retrofit = Retrofit.Builder() |
| 32 | .client(okHttpClient) | 32 | // .client(okHttpClient) |
| 33 | .baseUrl(BASE_URL) | 33 | // .baseUrl(BASE_URL) |
| 34 | .addConverterFactory(GsonConverterFactory.create()) | 34 | // .addConverterFactory(GsonConverterFactory.create()) |
| 35 | .build() | 35 | // .build() |
| 36 | } | 36 | // } |
| 37 | 37 | // | |
| 38 | @Synchronized | 38 | // @Synchronized |
| 39 | fun getInstance(): WebService? { | 39 | // fun getInstance(): WebService? { |
| 40 | if (instance == null) { | 40 | // if (instance == null) { |
| 41 | instance = WebService | 41 | // instance = WebService |
| 42 | } | 42 | // } |
| 43 | return instance | 43 | // return instance |
| 44 | } | 44 | // } |
| 45 | |||
| 46 | fun <S> createService(serviceClass: Class<S>): S { | ||
| 47 | return retrofit!!.create(serviceClass) | ||
| 48 | } | ||
| 49 | |||
| 50 | // fun <S> createService(serviceClass: Class<S>): S { | 45 | // fun <S> createService(serviceClass: Class<S>): S { |
| 51 | // return retrofit!!.create(serviceClass) | 46 | // return retrofit!!.create(serviceClass) |
| 52 | // } | 47 | // } |
| 53 | 48 | ||
| 54 | // fun getProductosService(): EndPoints { | 49 | // fun getProductosService(): EndPoints { |
| 55 | // return Retrofit.Builder() | 50 | // return Retrofit.Builder() |
| 56 | // .client(okHttpClient) | 51 | // .client(okHttpClient) |
| 57 | // .baseUrl(BASE_URL) | 52 | // .baseUrl(BASE_URL) |
| 58 | // .addConverterFactory(GsonConverterFactory.create()) | 53 | // .addConverterFactory(GsonConverterFactory.create()) |
| 59 | // .build() | 54 | // .build() |
| 60 | // .create(EndPoints::class.java) | 55 | // .create(EndPoints::class.java) |
| 61 | // } | 56 | // } |
| 62 | 57 | ||
| 63 | // fun getProductosService(): ProductosApi { | 58 | |
| 64 | // return Retrofit.Builder() | 59 | fun getProductosService(): WebServiceApi { |
| 65 | // .client(okHttpClient) | 60 | return Retrofit.Builder() |
| 66 | // .baseUrl(BASE_URL) | 61 | .client(okHttpClient) |
| 67 | // .addConverterFactory(GsonConverterFactory.create()) | 62 | .baseUrl(BASE_URL) |
| 68 | // .build() | 63 | .addConverterFactory(GsonConverterFactory.create()) |
| 69 | // .create(ProductosApi::class.java) | 64 | .build() |
| 70 | // } | 65 | .create(WebServiceApi::class.java) |
| 66 | } | ||
| 71 | } | 67 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/Utils/Utils.kt
| 1 | package com.focasoftware.deboinventariov20.UI.Utils | 1 | package com.focasoftware.deboinventariov20.UI.Utils |
| 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.os.Bundle | 6 | import android.os.Bundle |
| 7 | import androidx.fragment.app.DialogFragment | 7 | import androidx.fragment.app.DialogFragment |
| 8 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 8 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 9 | import kotlinx.coroutines.Dispatchers | 9 | import kotlinx.coroutines.Dispatchers |
| 10 | import kotlinx.coroutines.GlobalScope | 10 | import kotlinx.coroutines.GlobalScope |
| 11 | import kotlinx.coroutines.async | 11 | import kotlinx.coroutines.async |
| 12 | import java.io.IOException | 12 | import java.io.IOException |
| 13 | import java.net.UnknownHostException | 13 | import java.net.UnknownHostException |
| 14 | import java.time.LocalDateTime | 14 | import java.time.LocalDateTime |
| 15 | import java.time.format.DateTimeFormatter | 15 | import java.time.format.DateTimeFormatter |
| 16 | 16 | ||
| 17 | fun modificarCantidadEnCabecera(inventarioActual: Int, b: Boolean, context: Context) { | 17 | fun modificarCantidadEnCabecera(inventarioActual: Int, b: Boolean, context: Context) { |
| 18 | GlobalScope.async(Dispatchers.IO) { | 18 | GlobalScope.async(Dispatchers.IO) { |
| 19 | var cantProductos = 0 | 19 | var cantProductos = 0 |
| 20 | cantProductos = | 20 | cantProductos = |
| 21 | AppDb.getAppDb(context)!!.InvHeadDAO()!!.consultaCantidadInvH(inventarioActual.toLong()) | 21 | AppDb.getAppDb(context)!!.InvHeadDAO()!!.consultaCantidadInvH(inventarioActual) |
| 22 | if (b) { | 22 | if (b) { |
| 23 | AppDb.getAppDb(context)!!.InvHeadDAO()!! | 23 | AppDb.getAppDb(context)!!.InvHeadDAO()!! |
| 24 | .updateInvBody(inventarioActual.toLong(), cantProductos + 1) | 24 | .updateInvBody(inventarioActual, cantProductos + 1) |
| 25 | } else { | 25 | } else { |
| 26 | AppDb.getAppDb(context)!!.InvHeadDAO()!! | 26 | AppDb.getAppDb(context)!!.InvHeadDAO()!! |
| 27 | .updateInvBody(inventarioActual.toLong(), cantProductos - 1) | 27 | .updateInvBody(inventarioActual, cantProductos - 1) |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | open class AlertDialogBorrarInv : DialogFragment() { | 32 | open class AlertDialogBorrarInv : DialogFragment() { |
| 33 | 33 | ||
| 34 | interface OnBorrarInvClickListener { | 34 | interface OnBorrarInvClickListener { |
| 35 | fun onPositiveClick() | 35 | fun onPositiveClick() |
| 36 | fun onCancelClick() | 36 | fun onCancelClick() |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 39 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 40 | return activity?.let { | 40 | return activity?.let { |
| 41 | val title = "Borrar Inventario" | 41 | val title = "Borrar Inventario" |
| 42 | val content = "¿Seguro que desea Borrar el inventario?" | 42 | val content = "¿Seguro que desea Borrar el inventario?" |
| 43 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | 43 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) |
| 44 | builder.setTitle(title).setMessage(content) | 44 | builder.setTitle(title).setMessage(content) |
| 45 | 45 | ||
| 46 | .setPositiveButton(android.R.string.ok) { _, _ -> | 46 | .setPositiveButton(android.R.string.ok) { _, _ -> |
| 47 | val listener = activity as OnBorrarInvClickListener? | 47 | val listener = activity as OnBorrarInvClickListener? |
| 48 | listener!!.onPositiveClick() | 48 | listener!!.onPositiveClick() |
| 49 | } | 49 | } |
| 50 | .setNegativeButton(android.R.string.cancel) { _, _ -> | 50 | .setNegativeButton(android.R.string.cancel) { _, _ -> |
| 51 | val listener = activity as OnBorrarInvClickListener? | 51 | val listener = activity as OnBorrarInvClickListener? |
| 52 | listener!!.onCancelClick() | 52 | listener!!.onCancelClick() |
| 53 | } | 53 | } |
| 54 | return builder.create() | 54 | return builder.create() |
| 55 | } ?: throw IllegalStateException("Activity cannot be null") | 55 | } ?: throw IllegalStateException("Activity cannot be null") |
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | class NoEncontradoSimple : DialogFragment() { | 59 | class NoEncontradoSimple : DialogFragment() { |
| 60 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 60 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 61 | return activity?.let { | 61 | return activity?.let { |
| 62 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | 62 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) |
| 63 | builder.show() | 63 | builder.show() |
| 64 | val title = "" | 64 | val title = "" |
| 65 | val content = "¡El producto buscado NO fue encontrado!" | 65 | val content = "¡El producto buscado NO fue encontrado!" |
| 66 | 66 | ||
| 67 | builder.setTitle(title).setMessage(content) | 67 | builder.setTitle(title).setMessage(content) |
| 68 | .setPositiveButton(android.R.string.ok) { _, _ -> } | 68 | .setPositiveButton(android.R.string.ok) { _, _ -> } |
| 69 | return builder.create() | 69 | return builder.create() |
| 70 | } ?: throw IllegalStateException("Activity cannot be null") | 70 | } ?: throw IllegalStateException("Activity cannot be null") |
| 71 | } | 71 | } |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | class noServerConf : DialogFragment() { | 74 | class NoServerConf : DialogFragment() { |
| 75 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 75 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 76 | return activity?.let { | 76 | return activity?.let { |
| 77 | val title = "" | 77 | val title = "" |
| 78 | val content = "¡Antes de importar debe configurar un servidor!" | 78 | val content = "¡Antes de importar debe configurar un servidor!" |
| 79 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | 79 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) |
| 80 | builder.setTitle(title).setMessage(content) | 80 | builder.setTitle(title).setMessage(content) |
| 81 | .setPositiveButton(android.R.string.ok) { _, _ -> | 81 | .setPositiveButton(android.R.string.ok) { _, _ -> |
| 82 | activity?.onBackPressed() | 82 | activity?.onBackPressed() |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | return builder.create() | 85 | return builder.create() |
| 86 | } ?: throw IllegalStateException("Activity cannot be null") | 86 | } ?: throw IllegalStateException("Activity cannot be null") |
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | fun isConnectedToThisServer(host: String): Boolean { | 90 | fun isConnectedToThisServer(host: String): Boolean { |
| 91 | 91 | ||
| 92 | val runtime = Runtime.getRuntime() | 92 | val runtime = Runtime.getRuntime() |
| 93 | try { | 93 | try { |
| 94 | val ipProcess = runtime.exec("/system/bin/ping -c 1 $host") | 94 | val ipProcess = runtime.exec("/system/bin/ping -c 1 $host") |
| 95 | val exitValue = ipProcess.waitFor() | 95 | val exitValue = ipProcess.waitFor() |
| 96 | ipProcess.destroy() | 96 | ipProcess.destroy() |
| 97 | return exitValue == 0 | 97 | return exitValue == 0 |
| 98 | } catch (e: UnknownHostException) { | 98 | } catch (e: UnknownHostException) { |
| 99 | e.printStackTrace() | 99 | e.printStackTrace() |
| 100 | } catch (e: IOException) { | 100 | } catch (e: IOException) { |
| 101 | e.printStackTrace() | 101 | e.printStackTrace() |
| 102 | } catch (e: InterruptedException) { | 102 | } catch (e: InterruptedException) { |
| 103 | e.printStackTrace() | 103 | e.printStackTrace() |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | return false | 106 | return false |
| 107 | } | 107 | } |
| 108 | class serverValido : DialogFragment() { | 108 | class ServerValido : DialogFragment() { |
| 109 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 109 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 110 | return activity?.let { | 110 | return activity?.let { |
| 111 | val title = "" | 111 | val title = "" |
| 112 | val content = "¡La IP del servidor es correcta!" | 112 | val content = "¡La IP del servidor es correcta!" |
| 113 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | 113 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) |
| 114 | builder.setTitle(title).setMessage(content) | 114 | builder.setTitle(title).setMessage(content) |
| 115 | .setPositiveButton(android.R.string.ok) { _, _ -> } | 115 | .setPositiveButton(android.R.string.ok) { _, _ -> } |
| 116 | return builder.create() | 116 | return builder.create() |
| 117 | } ?: throw IllegalStateException("Activity cannot be null") | 117 | } ?: throw IllegalStateException("Activity cannot be null") |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
| 120 | class serverNoValido : DialogFragment() { | 120 | class ServerNoValido : DialogFragment() { |
| 121 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 121 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 122 | return activity?.let { | 122 | return activity?.let { |
| 123 | val title = "" | 123 | val title = "" |
| 124 | val content = "¡La IP del servidor es Incorrecta! Verfique en la carga de Servidores." | 124 | val content = "¡La IP del servidor es Incorrecta! Verfique en la carga de Servidores." |
| 125 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | 125 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) |
| 126 | builder.setTitle(title).setMessage(content) | 126 | builder.setTitle(title).setMessage(content) |
| 127 | .setPositiveButton(android.R.string.ok) { _, _ -> } | 127 | .setPositiveButton(android.R.string.ok) { _, _ -> } |
| 128 | return builder.create() | 128 | return builder.create() |
| 129 | } ?: throw IllegalStateException("Activity cannot be null") | 129 | } ?: throw IllegalStateException("Activity cannot be null") |
| 130 | } | 130 | } |
| 131 | } | 131 | } |
| 132 | class serverNoConf : DialogFragment() { | 132 | class ServerNoConf : DialogFragment() { |
| 133 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 133 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 134 | return activity?.let { | 134 | return activity?.let { |
| 135 | val title = "Servidor no Valido" | 135 | val title = "Servidor no Valido" |
| 136 | val content = "!Debe configurar el Servidor en Configuraciones¡" | 136 | val content = "!Debe configurar el Servidor en Configuraciones¡" |
| 137 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | 137 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) |
| 138 | builder.setTitle(title).setMessage(content) | 138 | builder.setTitle(title).setMessage(content) |
| 139 | .setPositiveButton(android.R.string.ok) { _, _ -> } | 139 | .setPositiveButton(android.R.string.ok) { _, _ -> } |
| 140 | return builder.create() | 140 | return builder.create() |
| 141 | } ?: throw IllegalStateException("Activity cannot be null") | 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 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD | 157 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD |
| 146 | val current = LocalDateTime.now() | 158 | val current = LocalDateTime.now() |
| 147 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") | 159 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") |
| 148 | val dFechaHora = current.format(formatter) | 160 | val dFechaHora = current.format(formatter) |
| 149 | return dFechaHora.toString() | 161 | return dFechaHora.toString() |
| 150 | } | 162 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/actualizacionMaestros/ActuaMaestrosFragment.kt
| 1 | package com.focasoftware.deboinventariov20.UI.actualizacionMaestros | 1 | package com.focasoftware.deboinventariov20.UI.actualizacionMaestros |
| 2 | 2 | ||
| 3 | import android.os.Bundle | 3 | import android.os.Bundle |
| 4 | import android.view.LayoutInflater | 4 | import android.view.LayoutInflater |
| 5 | import android.view.View | 5 | import android.view.View |
| 6 | import android.view.ViewGroup | 6 | import android.view.ViewGroup |
| 7 | import android.widget.Button | 7 | import android.widget.Button |
| 8 | import android.widget.RadioButton | ||
| 8 | import androidx.fragment.app.Fragment | 9 | import androidx.fragment.app.Fragment |
| 9 | import androidx.lifecycle.lifecycleScope | 10 | import androidx.lifecycle.lifecycleScope |
| 10 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 11 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 11 | import com.focasoftware.deboinventariov20.Model.Articles | 12 | import com.focasoftware.deboinventariov20.Model.Articles |
| 12 | import com.focasoftware.deboinventariov20.Model.Productos | ||
| 13 | import com.focasoftware.deboinventariov20.Model.ServeInv | 13 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 14 | import com.focasoftware.deboinventariov20.Model.WebService.getInstance | ||
| 15 | import com.focasoftware.deboinventariov20.Model.WebServiceApi | ||
| 16 | import com.focasoftware.deboinventariov20.R | 14 | import com.focasoftware.deboinventariov20.R |
| 17 | import com.focasoftware.deboinventariov20.UI.Utils.noServerConf | 15 | import com.focasoftware.deboinventariov20.UI.Utils.NoServerConf |
| 18 | import com.focasoftware.deboinventariov20.UI.Utils.serverNoConf | 16 | import com.focasoftware.deboinventariov20.UI.Utils.ServerNoConf |
| 19 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* | 17 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* |
| 20 | import kotlinx.coroutines.* | 18 | import kotlinx.coroutines.* |
| 21 | import kotlinx.coroutines.Dispatchers.IO | 19 | import kotlinx.coroutines.Dispatchers.IO |
| 22 | import kotlinx.coroutines.Dispatchers.Main | 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 | var BASE_URL = "" | 23 | var BASE_URL = "" |
| 30 | var serverPre: ServeInv? = null | 24 | var serverPre: ServeInv? = null |
| 31 | 25 | ||
| 32 | class ActuaMaestrosFragment : Fragment() { | 26 | class ActuaMaestrosFragment : Fragment() { |
| 33 | 27 | ||
| 34 | override fun onCreate(savedInstanceState: Bundle?) { | 28 | override fun onCreate(savedInstanceState: Bundle?) { |
| 35 | super.onCreate(savedInstanceState) | 29 | super.onCreate(savedInstanceState) |
| 36 | 30 | ||
| 37 | GlobalScope.launch(Main) { | 31 | GlobalScope.launch(Main) { |
| 38 | 32 | ||
| 39 | serverPre = fetchServerPreOne() | 33 | serverPre = fetchServerPreOne() |
| 40 | if (serverPre != null) { | 34 | if (serverPre != null) { |
| 41 | btnConfirmarAct.isEnabled = true | 35 | btnConfirmarAct.isEnabled = true |
| 42 | if (serverPre!!.direccion.isNullOrEmpty()) { | 36 | if (serverPre!!.direccion.isNullOrEmpty()) { |
| 43 | val modalDialog = noServerConf() | 37 | val modalDialog = NoServerConf() |
| 44 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 38 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 45 | } else { | 39 | } else { |
| 46 | BASE_URL = serverPre!!.direccion.toString() + ":" + serverPre!!.puerto.toString() + "/" | 40 | BASE_URL = serverPre!!.direccion.toString() + ":" + serverPre!!.puerto.toString() + "/" |
| 47 | tvServerConectado.text = "Conectado al servidor: ${serverPre!!.descripcion}" | 41 | tvServerConectado.text = "Conectado al servidor: ${serverPre!!.descripcion}" |
| 48 | } | 42 | } |
| 49 | } else { | 43 | } else { |
| 50 | val modalDialog = serverNoConf() | 44 | val modalDialog = ServerNoConf() |
| 51 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 45 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 52 | 46 | ||
| 53 | btnConfirmarAct.isEnabled = false | 47 | btnConfirmarAct.isEnabled = false |
| 54 | 48 | ||
| 55 | } | 49 | } |
| 56 | } | 50 | } |
| 57 | 51 | ||
| 58 | // mostrarArticulos() | 52 | // mostrarArticulos() |
| 59 | } | 53 | } |
| 60 | 54 | ||
| 61 | private suspend fun fetchServerPreOne(): ServeInv? { | 55 | private suspend fun fetchServerPreOne(): ServeInv? { |
| 62 | return GlobalScope.async(IO) { | 56 | return GlobalScope.async(IO) { |
| 63 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() | 57 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() |
| 64 | }.await() | 58 | }.await() |
| 65 | } | 59 | } |
| 66 | 60 | ||
| 67 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 61 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 68 | // Inflate the layout for this fragment | 62 | // Inflate the layout for this fragment |
| 69 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) | 63 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) |
| 70 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) | 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 | bConfirmarAct.setOnClickListener { | 68 | bConfirmarAct.setOnClickListener { |
| 73 | loading_view.visibility = View.VISIBLE | 69 | loading_view.visibility = View.VISIBLE |
| 74 | countriesList.text = "Obteniendo artículos del servidor, aguarde por favor." | 70 | countriesList.text = "Obteniendo artículos del servidor, aguarde por favor." |
| 75 | obtenerArticulos() | 71 | obtenerArticulos() |
| 76 | } | 72 | } |
| 77 | return v | 73 | return v |
| 78 | } | 74 | } |
| 79 | 75 | ||
| 80 | private fun obtenerArticulos() { | 76 | private fun obtenerArticulos() { |
| 81 | val call = getInstance() | 77 | // val call = getInstance() |
| 82 | ?.createService(WebServiceApi::class.java) | 78 | // ?.createService(WebServiceApi::class.java) |
| 83 | ?.getProductos() | 79 | // ?.getProductos() |
| 84 | var index: Long = 1 | 80 | // val api: WebService? = getInstance()!!.createService() |
| 85 | call!!.enqueue(object : Callback<List<Productos>> { | 81 | // val call: Call<List<Productos>> = api!!.getProductos() |
| 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 | }) | ||
| 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 | // var index: Long = 1 | 126 | // var index: Long = 1 |
| 128 | // withContext(IO) { | 127 | // withContext(IO) { |
| 129 | // val job = CoroutineScope(IO).launch { | 128 | // val job = CoroutineScope(IO).launch { |
| 130 | // // TODO: BORRO TODO LOS ARTICULOS DE LA BASE PARA CARGARLOS DE NUEVO | 129 | // // TODO: BORRO TODO LOS ARTICULOS DE LA BASE PARA CARGARLOS DE NUEVO |
| 131 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.deleteAllArticulos() | 130 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.deleteAllArticulos() |
| 132 | // try { | 131 | // try { |
| 133 | // val response = productosService.getProductos() | 132 | // val response = WebServiceApi. |
| 134 | // if (response.isSuccessful) { | 133 | // if (response.isSuccessful) { |
| 135 | // | 134 | // |
| 136 | // for (pro in response.body()!!) { | 135 | // for (pro in response.body()!!) { |
| 137 | // val artiAcargar = Articles( | 136 | // val artiAcargar = Articles( |
| 138 | // pro.sector, | 137 | // pro.sector, |
| 139 | // pro.codigo, | 138 | // pro.codigo, |
| 140 | // pro.descripcion, | 139 | // pro.descripcion, |
| 141 | // pro.codBar, | 140 | // pro.codBar, |
| 142 | // pro.codOrigen, | 141 | // pro.codOrigen, |
| 143 | // pro.precio, | 142 | // pro.precio, |
| 144 | // pro.costo, | 143 | // pro.costo, |
| 145 | // pro.exiVenta, | 144 | // pro.exiVenta, |
| 146 | // pro.exiDeposito, | 145 | // pro.exiDeposito, |
| 147 | // pro.de, | 146 | // pro.de, |
| 148 | // pro.balanza, | 147 | // pro.balanza, |
| 149 | // pro.depSn, | 148 | // pro.depSn, |
| 150 | // pro.imagen | 149 | // pro.imagen |
| 151 | // ) | 150 | // ) |
| 152 | // index += index | 151 | // index += index |
| 153 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.insertArticulos(artiAcargar) | 152 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!!.insertArticulos(artiAcargar) |
| 154 | // } | 153 | // } |
| 155 | // withContext(Main) { | 154 | // withContext(Main) { |
| 156 | // countriesList.visibility = View.VISIBLE | 155 | // countriesList.visibility = View.VISIBLE |
| 157 | // countriesList.text = "¡Datos Importados Correctamente!" | 156 | // countriesList.text = "¡Datos Importados Correctamente!" |
| 158 | // loading_view.visibility = View.GONE | 157 | // loading_view.visibility = View.GONE |
| 159 | // } | 158 | // } |
| 160 | // } else if (!response.isSuccessful) { | 159 | // } else if (!response.isSuccessful) { |
| 161 | // withContext(Main) { | 160 | // withContext(Main) { |
| 162 | // countriesList.visibility = View.VISIBLE | 161 | // countriesList.visibility = View.VISIBLE |
| 163 | // countriesList.text = "¡Sin servicio. No se puede conectar a la api o al servidor configurado en el BackEnd!" | 162 | // countriesList.text = "¡Sin servicio. No se puede conectar a la api o al servidor configurado en el BackEnd!" |
| 164 | // loading_view.visibility = View.GONE | 163 | // loading_view.visibility = View.GONE |
| 165 | // } | 164 | // } |
| 166 | // } | 165 | // } |
| 167 | // } catch (e: SocketTimeoutException) { | 166 | // } catch (e: SocketTimeoutException) { |
| 168 | // withContext(Main) { | 167 | // withContext(Main) { |
| 169 | // countriesList.visibility = View.VISIBLE | 168 | // countriesList.visibility = View.VISIBLE |
| 170 | // countriesList.text = "¡Sin conexión al Servidor!" | 169 | // countriesList.text = "¡Sin conexión al Servidor!" |
| 171 | // loading_view.visibility = View.GONE | 170 | // loading_view.visibility = View.GONE |
| 172 | // } | 171 | // } |
| 173 | // } | 172 | // } |
| 174 | // } | 173 | // } |
| 175 | // } | 174 | // } |
| 176 | 175 | ||
| 177 | 176 | ||
| 178 | // withContext(Dispatchers.Main) { | 177 | // withContext(Dispatchers.Main) { |
| 179 | // if (response.isSuccessful) { | 178 | // if (response.isSuccessful) { |
| 180 | // val call = WebService | 179 | // val call = WebService |
| 181 | // .instance | 180 | // .instance |
| 182 | // ?.createService(WebServiceApi::class.java) | 181 | // ?.createService(WebServiceApi::class.java) |
| 183 | // ?.articulos | 182 | // ?.articulos |
| 184 | // call?.enqueue(object : Callback<List<productos?>?> { | 183 | // call?.enqueue(object : Callback<List<productos?>?> { |
| 185 | // override fun onResponse( | 184 | // override fun onResponse( |
| 186 | // call: Call<List<productos?>?>, | 185 | // call: Call<List<productos?>?>, |
| 187 | // response: Response<List<productos?>?> | 186 | // response: Response<List<productos?>?> |
| 188 | // ) { | 187 | // ) { |
| 189 | // if (response.code() == 200) { | 188 | // if (response.code() == 200) { |
| 190 | // for (i in response.body()!!.indices) { | 189 | // for (i in response.body()!!.indices) { |
| 191 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) | 190 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) |
| 192 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") | 191 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") |
app/src/main/java/com/focasoftware/deboinventariov20/UI/actualizacionMaestros/InvImportadosFragment.kt
| File was created | 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 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/configuracion/ConfiguracionFragment.kt
| 1 | package com.focasoftware.deboinventariov20.UI.configuracion | 1 | package com.focasoftware.deboinventariov20.UI.configuracion |
| 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 android.widget.* | 9 | import android.widget.* |
| 10 | import androidx.fragment.app.Fragment | 10 | import androidx.fragment.app.Fragment |
| 11 | import androidx.fragment.app.FragmentActivity | 11 | import androidx.fragment.app.FragmentActivity |
| 12 | import androidx.lifecycle.lifecycleScope | 12 | import androidx.lifecycle.lifecycleScope |
| 13 | import androidx.navigation.NavController | 13 | import androidx.navigation.NavController |
| 14 | import androidx.navigation.Navigation | 14 | import androidx.navigation.Navigation |
| 15 | import androidx.navigation.fragment.findNavController | 15 | import androidx.navigation.fragment.findNavController |
| 16 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 16 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 17 | import com.focasoftware.deboinventariov20.Model.ServeInv | 17 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 18 | import com.focasoftware.deboinventariov20.R | 18 | import com.focasoftware.deboinventariov20.R |
| 19 | import com.focasoftware.deboinventariov20.UI.Utils.isConnectedToThisServer | 19 | import com.focasoftware.deboinventariov20.UI.Utils.isConnectedToThisServer |
| 20 | import com.focasoftware.deboinventariov20.UI.Utils.serverNoValido | 20 | import com.focasoftware.deboinventariov20.UI.Utils.ServerNoValido |
| 21 | import com.focasoftware.deboinventariov20.UI.Utils.serverValido | 21 | import com.focasoftware.deboinventariov20.UI.Utils.ServerValido |
| 22 | import kotlinx.android.synthetic.main.fragment_configuracion.* | 22 | import kotlinx.android.synthetic.main.fragment_configuracion.* |
| 23 | import kotlinx.coroutines.* | 23 | import kotlinx.coroutines.* |
| 24 | import kotlinx.coroutines.Dispatchers.Main | 24 | import kotlinx.coroutines.Dispatchers.Main |
| 25 | 25 | ||
| 26 | class ConfiguracionFragment : Fragment() { | 26 | class ConfiguracionFragment : Fragment() { |
| 27 | 27 | ||
| 28 | lateinit var sharedPreferences: SharedPreferences | 28 | lateinit var sharedPreferences: SharedPreferences |
| 29 | private lateinit var navController: NavController | 29 | private lateinit var navController: NavController |
| 30 | var itemSelect: Int = 0 | 30 | var itemSelect: Int = 0 |
| 31 | var indexSelect: Int = 0 | 31 | var indexSelect: Int = 0 |
| 32 | 32 | ||
| 33 | override fun onCreate(savedInstanceState: Bundle?) { | 33 | override fun onCreate(savedInstanceState: Bundle?) { |
| 34 | super.onCreate(savedInstanceState) | 34 | super.onCreate(savedInstanceState) |
| 35 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 35 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 38 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 39 | super.onViewCreated(view, savedInstanceState) | 39 | super.onViewCreated(view, savedInstanceState) |
| 40 | navController = Navigation.findNavController(view) | 40 | navController = Navigation.findNavController(view) |
| 41 | 41 | ||
| 42 | GlobalScope.launch(Main) { | 42 | GlobalScope.launch(Main) { |
| 43 | val listServer = mutableListOf<String>() | 43 | val listServer = mutableListOf<String>() |
| 44 | for (server in getDescServers()) { | 44 | for (server in getDescServers()) { |
| 45 | listServer.add((if (server.servNum < 9) "0" + server.servNum.toString() else server.servNum.toString()) + " - " + server.descripcion.toString()) | 45 | listServer.add((if (server.servNum < 9) "0" + server.servNum.toString() else server.servNum.toString()) + " - " + server.descripcion.toString()) |
| 46 | } | 46 | } |
| 47 | val adapterSpServer = ArrayAdapter( | 47 | val adapterSpServer = ArrayAdapter( |
| 48 | requireContext(), | 48 | requireContext(), |
| 49 | R.layout.support_simple_spinner_dropdown_item, | 49 | R.layout.support_simple_spinner_dropdown_item, |
| 50 | listServer | 50 | listServer |
| 51 | ) | 51 | ) |
| 52 | spServidor.adapter = adapterSpServer | 52 | spServidor.adapter = adapterSpServer |
| 53 | if (sharedPreferences.contains("ServerPredeterminado")) { | 53 | if (sharedPreferences.contains("ServerPredeterminado")) { |
| 54 | spServidor.setSelection( | 54 | spServidor.setSelection( |
| 55 | sharedPreferences.getString("ServerPredeterminado", "").toString().toInt() | 55 | sharedPreferences.getString("ServerPredeterminado", "").toString().toInt() |
| 56 | ) | 56 | ) |
| 57 | } else (spServidor.setSelection(0)) | 57 | } else (spServidor.setSelection(0)) |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 61 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 62 | 62 | ||
| 63 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) | 63 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) |
| 64 | val etRuta = v.findViewById<EditText>(R.id.etRuta) | 64 | val etRuta = v.findViewById<EditText>(R.id.etRuta) |
| 65 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) | 65 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) |
| 66 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) | 66 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) |
| 67 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) | 67 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) |
| 68 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) | 68 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) |
| 69 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) | 69 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) |
| 70 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) | 70 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) |
| 71 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) | 71 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) |
| 72 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) | 72 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) |
| 73 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) | 73 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) |
| 74 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) | 74 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) |
| 75 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) | 75 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) |
| 76 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) | 76 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) |
| 77 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) | 77 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) |
| 78 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) | 78 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) |
| 79 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) | 79 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) |
| 80 | 80 | ||
| 81 | if (sharedPreferences.contains("etRuta")) if (sharedPreferences.contains("rbProInclu")) { | 81 | if (sharedPreferences.contains("etRuta")) if (sharedPreferences.contains("rbProInclu")) { |
| 82 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { | 82 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { |
| 83 | rbProInclu.isChecked = false | 83 | rbProInclu.isChecked = false |
| 84 | rbProNoInclu.isChecked = true | 84 | rbProNoInclu.isChecked = true |
| 85 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { | 85 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { |
| 86 | rbProInclu.isChecked = true | 86 | rbProInclu.isChecked = true |
| 87 | rbProNoInclu.isChecked = false | 87 | rbProNoInclu.isChecked = false |
| 88 | } | 88 | } |
| 89 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") | 89 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") |
| 90 | 90 | ||
| 91 | if (sharedPreferences.contains("rbProNoInclu")) { | 91 | if (sharedPreferences.contains("rbProNoInclu")) { |
| 92 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { | 92 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { |
| 93 | rbProNoInclu.isChecked = false | 93 | rbProNoInclu.isChecked = false |
| 94 | rbProInclu.isChecked = true | 94 | rbProInclu.isChecked = true |
| 95 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { | 95 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { |
| 96 | rbProNoInclu.isChecked = true | 96 | rbProNoInclu.isChecked = true |
| 97 | rbProInclu.isChecked = false | 97 | rbProInclu.isChecked = false |
| 98 | } | 98 | } |
| 99 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") | 99 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") |
| 100 | 100 | ||
| 101 | if (sharedPreferences.contains("cbHabiLectura")) { | 101 | if (sharedPreferences.contains("cbHabiLectura")) { |
| 102 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { | 102 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { |
| 103 | cbHabiLectura.isChecked = false | 103 | cbHabiLectura.isChecked = false |
| 104 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { | 104 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { |
| 105 | cbHabiLectura.isChecked = true | 105 | cbHabiLectura.isChecked = true |
| 106 | } | 106 | } |
| 107 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") | 107 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") |
| 108 | 108 | ||
| 109 | if (sharedPreferences.contains("cbMostrarStock")) { | 109 | if (sharedPreferences.contains("cbMostrarStock")) { |
| 110 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { | 110 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { |
| 111 | cbMostrarStock.isChecked = false | 111 | cbMostrarStock.isChecked = false |
| 112 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { | 112 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { |
| 113 | cbMostrarStock.isChecked = true | 113 | cbMostrarStock.isChecked = true |
| 114 | } | 114 | } |
| 115 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") | 115 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") |
| 116 | 116 | ||
| 117 | if (sharedPreferences.contains("rbVentas")) { | 117 | if (sharedPreferences.contains("rbVentas")) { |
| 118 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { | 118 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { |
| 119 | rbVentas.isChecked = false | 119 | rbVentas.isChecked = false |
| 120 | rbDeposito.isChecked = true | 120 | rbDeposito.isChecked = true |
| 121 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { | 121 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { |
| 122 | rbVentas.isChecked = true | 122 | rbVentas.isChecked = true |
| 123 | rbDeposito.isChecked = false | 123 | rbDeposito.isChecked = false |
| 124 | } | 124 | } |
| 125 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") | 125 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") |
| 126 | 126 | ||
| 127 | if (sharedPreferences.contains("rbDeposito")) { | 127 | if (sharedPreferences.contains("rbDeposito")) { |
| 128 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { | 128 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { |
| 129 | rbDeposito.isChecked = false | 129 | rbDeposito.isChecked = false |
| 130 | rbVentas.isChecked = true | 130 | rbVentas.isChecked = true |
| 131 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { | 131 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { |
| 132 | rbDeposito.isChecked = true | 132 | rbDeposito.isChecked = true |
| 133 | rbVentas.isChecked = false | 133 | rbVentas.isChecked = false |
| 134 | } | 134 | } |
| 135 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") | 135 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") |
| 136 | 136 | ||
| 137 | if (sharedPreferences.contains("rbCodigoDebo")) { | 137 | if (sharedPreferences.contains("rbCodigoDebo")) { |
| 138 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { | 138 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { |
| 139 | rbCodigoDebo.isChecked = false | 139 | rbCodigoDebo.isChecked = false |
| 140 | rbCodigoOrigen.isChecked = false | 140 | rbCodigoOrigen.isChecked = false |
| 141 | rbCodigoBarras.isChecked = false | 141 | rbCodigoBarras.isChecked = false |
| 142 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { | 142 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { |
| 143 | rbCodigoDebo.isChecked = true | 143 | rbCodigoDebo.isChecked = true |
| 144 | rbCodigoOrigen.isChecked = false | 144 | rbCodigoOrigen.isChecked = false |
| 145 | rbCodigoBarras.isChecked = false | 145 | rbCodigoBarras.isChecked = false |
| 146 | } | 146 | } |
| 147 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") | 147 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") |
| 148 | 148 | ||
| 149 | if (sharedPreferences.contains("rbCodigoOrigen")) { | 149 | if (sharedPreferences.contains("rbCodigoOrigen")) { |
| 150 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { | 150 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { |
| 151 | rbCodigoOrigen.isChecked = false | 151 | rbCodigoOrigen.isChecked = false |
| 152 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { | 152 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { |
| 153 | rbCodigoOrigen.isChecked = true | 153 | rbCodigoOrigen.isChecked = true |
| 154 | } | 154 | } |
| 155 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") | 155 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") |
| 156 | 156 | ||
| 157 | if (sharedPreferences.contains("rbCodigoBarras")) { | 157 | if (sharedPreferences.contains("rbCodigoBarras")) { |
| 158 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { | 158 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { |
| 159 | rbCodigoBarras.isChecked = false | 159 | rbCodigoBarras.isChecked = false |
| 160 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { | 160 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { |
| 161 | rbCodigoBarras.isChecked = true | 161 | rbCodigoBarras.isChecked = true |
| 162 | } | 162 | } |
| 163 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") | 163 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") |
| 164 | 164 | ||
| 165 | if (sharedPreferences.contains("cbMostrarExistencia")) { | 165 | if (sharedPreferences.contains("cbMostrarExistencia")) { |
| 166 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { | 166 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { |
| 167 | cbMostrarExistencia.isChecked = false | 167 | cbMostrarExistencia.isChecked = false |
| 168 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { | 168 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { |
| 169 | cbMostrarExistencia.isChecked = true | 169 | cbMostrarExistencia.isChecked = true |
| 170 | } | 170 | } |
| 171 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") | 171 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") |
| 172 | 172 | ||
| 173 | if (sharedPreferences.contains("cbMostrarPrecio")) { | 173 | if (sharedPreferences.contains("cbMostrarPrecio")) { |
| 174 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { | 174 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { |
| 175 | cbMostrarPrecio.isChecked = false | 175 | cbMostrarPrecio.isChecked = false |
| 176 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { | 176 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { |
| 177 | cbMostrarPrecio.isChecked = true | 177 | cbMostrarPrecio.isChecked = true |
| 178 | } | 178 | } |
| 179 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") | 179 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") |
| 180 | 180 | ||
| 181 | btnGuardar.setOnClickListener { | 181 | btnGuardar.setOnClickListener { |
| 182 | guardarPreferencias() | 182 | guardarPreferencias() |
| 183 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG) | 183 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG) |
| 184 | .show() | 184 | .show() |
| 185 | navController.navigate(R.id.action_configuracionFragment_to_mainFragment2) | 185 | navController.navigate(R.id.action_configuracionFragment_to_mainFragment2) |
| 186 | } | 186 | } |
| 187 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } | 187 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } |
| 188 | 188 | ||
| 189 | spServidor.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { | 189 | spServidor.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { |
| 190 | override fun onNothingSelected(parent: AdapterView<*>?) {} | 190 | override fun onNothingSelected(parent: AdapterView<*>?) {} |
| 191 | override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { | 191 | override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { |
| 192 | itemSelect = parent!!.getItemAtPosition(position).toString().substring(0, 2).toInt() | 192 | itemSelect = parent!!.getItemAtPosition(position).toString().substring(0, 2).toInt() |
| 193 | indexSelect = position | 193 | indexSelect = position |
| 194 | } | 194 | } |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | btnValidarServidor.setOnClickListener { | 197 | btnValidarServidor.setOnClickListener { |
| 198 | GlobalScope.launch(Main) { | 198 | GlobalScope.launch(Main) { |
| 199 | 199 | ||
| 200 | val serverPre = fetchServer() | 200 | val serverPre = fetchServer() |
| 201 | if (serverPre != null) { | 201 | if (serverPre != null) { |
| 202 | if (isConnectedToThisServer(serverPre.direccion.toString().substring(7, serverPre.direccion.toString().length))) { | 202 | if (isConnectedToThisServer(serverPre.direccion.toString().substring(7, serverPre.direccion.toString().length))) { |
| 203 | val modalDialog = serverValido() | 203 | val modalDialog = ServerValido() |
| 204 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 204 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 205 | } else { | 205 | } else { |
| 206 | val modalDialog = serverNoValido() | 206 | val modalDialog = ServerNoValido() |
| 207 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 207 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | return v | 213 | return v |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | private suspend fun fetchServer(): ServeInv? { | 216 | private suspend fun fetchServer(): ServeInv? { |
| 217 | return GlobalScope.async(Dispatchers.IO) { | 217 | return GlobalScope.async(Dispatchers.IO) { |
| 218 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServer(itemSelect) | 218 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServer(itemSelect) |
| 219 | }.await() | 219 | }.await() |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | suspend fun getDescServers(): List<ServeInv> { | 222 | suspend fun getDescServers(): List<ServeInv> { |
| 223 | return GlobalScope.async(Dispatchers.IO) { | 223 | return GlobalScope.async(Dispatchers.IO) { |
| 224 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() | 224 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() |
| 225 | }.await() | 225 | }.await() |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | fun guardarPreferencias() { | 228 | fun guardarPreferencias() { |
| 229 | try { | 229 | try { |
| 230 | val editor = sharedPreferences.edit() | 230 | val editor = sharedPreferences.edit() |
| 231 | 231 | ||
| 232 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) | 232 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) |
| 233 | 233 | ||
| 234 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") | 234 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") |
| 235 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") | 235 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") |
| 236 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") | 236 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") |
| 237 | if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") | 237 | if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") |
| 238 | if (rbVentas.isChecked) editor?.putString("rbVentas","1") else editor?.putString("rbVentas", "0") | 238 | if (rbVentas.isChecked) editor?.putString("rbVentas","1") else editor?.putString("rbVentas", "0") |
| 239 | if (rbDeposito.isChecked) editor?.putString("rbDeposito","1") else editor?.putString("rbDeposito", "0") | 239 | if (rbDeposito.isChecked) editor?.putString("rbDeposito","1") else editor?.putString("rbDeposito", "0") |
| 240 | // if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") | 240 | // if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") |
| 241 | // if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") | 241 | // if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") |
| 242 | // if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") | 242 | // if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") |
| 243 | // if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") | 243 | // if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") |
| 244 | // if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") | 244 | // if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") |
| 245 | editor?.putString("ServerPredeterminado", indexSelect.toString()) | 245 | editor?.putString("ServerPredeterminado", indexSelect.toString()) |
| 246 | updateServerPreInZero() | 246 | updateServerPreInZero() |
| 247 | updateServerPre(itemSelect) | 247 | updateServerPre(itemSelect) |
| 248 | 248 | ||
| 249 | editor?.apply() | 249 | editor?.apply() |
| 250 | editor.commit() | 250 | editor.commit() |
| 251 | 251 | ||
| 252 | } catch (e: Exception) { | 252 | } catch (e: Exception) { |
| 253 | Toast.makeText(requireContext(), "Error ", Toast.LENGTH_LONG).show() | 253 | Toast.makeText(requireContext(), "Error ", Toast.LENGTH_LONG).show() |
| 254 | e.printStackTrace() | 254 | e.printStackTrace() |
| 255 | } | 255 | } |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | private fun updateServerPreInZero() { | 258 | private fun updateServerPreInZero() { |
| 259 | lifecycleScope.launch { | 259 | lifecycleScope.launch { |
| 260 | withContext(Dispatchers.IO) { | 260 | withContext(Dispatchers.IO) { |
| 261 | val activity: FragmentActivity? = activity | 261 | val activity: FragmentActivity? = activity |
| 262 | if (activity != null && isAdded) { | 262 | if (activity != null && isAdded) { |
| 263 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPreInZero() | 263 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPreInZero() |
| 264 | } | 264 | } |
| 265 | } | 265 | } |
| 266 | } | 266 | } |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | private fun updateServerPre(server: Int) { | 269 | private fun updateServerPre(server: Int) { |
| 270 | lifecycleScope.launch { | 270 | lifecycleScope.launch { |
| 271 | withContext(Dispatchers.IO) { | 271 | withContext(Dispatchers.IO) { |
| 272 | val activity: FragmentActivity? = activity | 272 | val activity: FragmentActivity? = activity |
| 273 | if (activity != null) { | 273 | if (activity != null) { |
| 274 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPre(server) | 274 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.UpdateServerPre(server) |
| 275 | } | 275 | } |
| 276 | } | 276 | } |
| 277 | } | 277 | } |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | private suspend fun fetchServerPreOne(): ServeInv? { | 280 | private suspend fun fetchServerPreOne(): ServeInv? { |
| 281 | return GlobalScope.async(Dispatchers.IO) { | 281 | return GlobalScope.async(Dispatchers.IO) { |
| 282 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() | 282 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() |
| 283 | }.await() | 283 | }.await() |
| 284 | } | 284 | } |
| 285 | } | 285 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/descripCorigenFragment/CodigoOriFragment.kt
| 1 | package com.focasoftware.deboinventariov20.UI.descripCorigenFragment | 1 | package com.focasoftware.deboinventariov20.UI.descripCorigenFragment |
| 2 | 2 | ||
| 3 | import android.app.AlertDialog | 3 | import android.app.AlertDialog |
| 4 | import android.content.Context | 4 | import android.content.Context |
| 5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
| 6 | import android.graphics.Canvas | 6 | import android.graphics.Canvas |
| 7 | import android.graphics.Color | 7 | import android.graphics.Color |
| 8 | import android.graphics.drawable.ColorDrawable | 8 | import android.graphics.drawable.ColorDrawable |
| 9 | import android.os.Bundle | 9 | import android.os.Bundle |
| 10 | import android.text.Editable | 10 | import android.text.Editable |
| 11 | import android.text.InputType | 11 | import android.text.InputType |
| 12 | import android.text.TextWatcher | 12 | import android.text.TextWatcher |
| 13 | import androidx.fragment.app.Fragment | 13 | import androidx.fragment.app.Fragment |
| 14 | import android.view.LayoutInflater | 14 | import android.view.LayoutInflater |
| 15 | import android.view.View | 15 | import android.view.View |
| 16 | import android.view.ViewGroup | 16 | import android.view.ViewGroup |
| 17 | import android.view.WindowManager | 17 | import android.view.WindowManager |
| 18 | import android.view.inputmethod.InputMethodManager | 18 | import android.view.inputmethod.InputMethodManager |
| 19 | import androidx.fragment.app.FragmentActivity | 19 | import androidx.fragment.app.FragmentActivity |
| 20 | import androidx.lifecycle.lifecycleScope | 20 | import androidx.lifecycle.lifecycleScope |
| 21 | import androidx.navigation.NavController | 21 | import androidx.navigation.NavController |
| 22 | import androidx.navigation.Navigation | 22 | import androidx.navigation.Navigation |
| 23 | import androidx.recyclerview.widget.ItemTouchHelper | 23 | import androidx.recyclerview.widget.ItemTouchHelper |
| 24 | import androidx.recyclerview.widget.LinearLayoutManager | 24 | import androidx.recyclerview.widget.LinearLayoutManager |
| 25 | import androidx.recyclerview.widget.RecyclerView | 25 | import androidx.recyclerview.widget.RecyclerView |
| 26 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 26 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 27 | import com.focasoftware.deboinventariov20.Model.Articles | 27 | import com.focasoftware.deboinventariov20.Model.Articles |
| 28 | import com.focasoftware.deboinventariov20.Model.InvBody | 28 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 29 | import com.focasoftware.deboinventariov20.R | 29 | import com.focasoftware.deboinventariov20.R |
| 30 | import com.focasoftware.deboinventariov20.UI.Utils.ObtenerFechaActual | 30 | import com.focasoftware.deboinventariov20.UI.Utils.obtenerFechaActual |
| 31 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | 31 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
| 32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| 33 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.btnAceptar | 33 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.btnAceptar |
| 34 | import kotlinx.android.synthetic.main.login_dialog.view.* | 34 | import kotlinx.android.synthetic.main.login_dialog.view.* |
| 35 | import kotlinx.coroutines.* | 35 | import kotlinx.coroutines.* |
| 36 | 36 | ||
| 37 | // | 37 | // |
| 38 | class CodigoOriFragment : Fragment() { | 38 | class CodigoOriFragment : Fragment() { |
| 39 | 39 | ||
| 40 | private lateinit var artAcargar2: List<Articles> | 40 | private lateinit var artAcargar2: List<Articles> |
| 41 | private var listArticulos: List<Articles>? = null | 41 | private var listArticulos: List<Articles>? = null |
| 42 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | 42 | lateinit var viewAdapter2: RecyclerView.Adapter<*> |
| 43 | private lateinit var viewManager2: RecyclerView.LayoutManager | 43 | private lateinit var viewManager2: RecyclerView.LayoutManager |
| 44 | private lateinit var rcCodigoOri: RecyclerView | 44 | private lateinit var rcCodigoOri: RecyclerView |
| 45 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | 45 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) |
| 46 | private var cantidad = 0F | 46 | private var cantidad = 0F |
| 47 | private var numeroInventario = 0 | 47 | private var numeroInventario = 0 |
| 48 | lateinit var navController: NavController | 48 | lateinit var navController: NavController |
| 49 | lateinit var sharedPreferences: SharedPreferences | 49 | lateinit var sharedPreferences: SharedPreferences |
| 50 | private var artCargadoEnBD: InvBody? = null | 50 | private var artCargadoEnBD: InvBody? = null |
| 51 | lateinit var mDialogViewM: View | 51 | lateinit var mDialogViewM: View |
| 52 | 52 | ||
| 53 | override fun onCreate(savedInstanceState: Bundle?) { | 53 | override fun onCreate(savedInstanceState: Bundle?) { |
| 54 | super.onCreate(savedInstanceState) | 54 | super.onCreate(savedInstanceState) |
| 55 | 55 | ||
| 56 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 56 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 57 | arguments.apply { | 57 | arguments.apply { |
| 58 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | 58 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> |
| 59 | numeroInventario = requireArguments().getInt("numeroInv") | 59 | numeroInventario = requireArguments().getInt("numeroInv") |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | } | 62 | } |
| 63 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 63 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 64 | super.onViewCreated(view, savedInstanceState) | 64 | super.onViewCreated(view, savedInstanceState) |
| 65 | navController = Navigation.findNavController(view) | 65 | navController = Navigation.findNavController(view) |
| 66 | showSoftKeyboard(view) | 66 | showSoftKeyboard(view) |
| 67 | } | 67 | } |
| 68 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 68 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 69 | val v = inflater.inflate(R.layout.fragment_codigo_ori, container, false) | 69 | val v = inflater.inflate(R.layout.fragment_codigo_ori, container, false) |
| 70 | rcCodigoOri = v.findViewById(R.id.rcCodigoOri) | 70 | rcCodigoOri = v.findViewById(R.id.rcCodigoOri) |
| 71 | 71 | ||
| 72 | IngresarRecicler(artAcargar2) | 72 | IngresarRecicler(artAcargar2) |
| 73 | showSoftKeyboard(v) | 73 | showSoftKeyboard(v) |
| 74 | // btnSalir.setOnClickListener { | 74 | // btnSalir.setOnClickListener { |
| 75 | // activity?.onBackPressed(); | 75 | // activity?.onBackPressed(); |
| 76 | //// VolverAinventario() | 76 | //// VolverAinventario() |
| 77 | // } | 77 | // } |
| 78 | return v | 78 | return v |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | private fun showSoftKeyboard(view: View) { | 81 | private fun showSoftKeyboard(view: View) { |
| 82 | if (view.requestFocus()) { | 82 | if (view.requestFocus()) { |
| 83 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | 83 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager |
| 84 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) | 84 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) |
| 85 | } | 85 | } |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | fun IngresarRecicler(articulos: List<Articles>) { | 88 | fun IngresarRecicler(articulos: List<Articles>) { |
| 89 | 89 | ||
| 90 | viewAdapter2 = CodigoOrigenAdapter(requireContext(),articulos) | 90 | viewAdapter2 = CodigoOrigenAdapter(requireContext(),articulos) |
| 91 | viewManager2 = LinearLayoutManager(requireContext()) | 91 | viewManager2 = LinearLayoutManager(requireContext()) |
| 92 | 92 | ||
| 93 | rcCodigoOri.apply { | 93 | rcCodigoOri.apply { |
| 94 | adapter = viewAdapter2 | 94 | adapter = viewAdapter2 |
| 95 | layoutManager = viewManager2 | 95 | layoutManager = viewManager2 |
| 96 | } | 96 | } |
| 97 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | 97 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { |
| 98 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 98 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
| 99 | return false | 99 | return false |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 102 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
| 103 | 103 | ||
| 104 | GlobalScope.launch(Dispatchers.Main) { | 104 | GlobalScope.launch(Dispatchers.Main) { |
| 105 | //TODO BUSCO EN BASE DE DATOS | 105 | //TODO BUSCO EN BASE DE DATOS |
| 106 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), | 106 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), |
| 107 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), | 107 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), |
| 108 | numeroInventario.toString()) | 108 | numeroInventario.toString()) |
| 109 | if (artCargadoEnBD == null) { | 109 | if (artCargadoEnBD == null) { |
| 110 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | 110 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) |
| 111 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | 111 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) |
| 112 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO | 112 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO |
| 113 | if ((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==1 || (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==3 || (viewAdapter2 as CodigoOrigenAdapter).items2?.get( | 113 | if ((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==1 || (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza==3 || (viewAdapter2 as CodigoOrigenAdapter).items2?.get( |
| 114 | viewHolder.layoutPosition)!!.balanza==7) | 114 | viewHolder.layoutPosition)!!.balanza==7) |
| 115 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER | 115 | mDialogView.etCantidad.inputType= InputType.TYPE_CLASS_NUMBER |
| 116 | 116 | ||
| 117 | mDialogView.tvTitulo.text = "${(viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" | 117 | mDialogView.tvTitulo.text = "${(viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" |
| 118 | val mAlertDialog = mBuilder.show() | 118 | val mAlertDialog = mBuilder.show() |
| 119 | mDialogView.etCantidad.requestFocus() | 119 | mDialogView.etCantidad.requestFocus() |
| 120 | mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 120 | mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 121 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 121 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 122 | mDialogView.btnAceptar.setOnClickListener { | 122 | mDialogView.btnAceptar.setOnClickListener { |
| 123 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | 123 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 124 | mDialogView.etCantidad.error = "No vacio" | 124 | mDialogView.etCantidad.error = "No vacio" |
| 125 | mDialogView.etCantidad.requestFocus() | 125 | mDialogView.etCantidad.requestFocus() |
| 126 | mDialogView.etCantidad.hint = "Ingrese un valor" | 126 | mDialogView.etCantidad.hint = "Ingrese un valor" |
| 127 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | 127 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 128 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | 128 | cantidad = mDialogView.etCantidad.text.toString().toFloat() |
| 129 | val body = InvBody(numeroInventario, | 129 | val body = InvBody(numeroInventario, |
| 130 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, | 130 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, |
| 131 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | 131 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD |
| 132 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, | 132 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, |
| 133 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, | 133 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, |
| 134 | cantidad.toString(), | 134 | cantidad.toString(), |
| 135 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, | 135 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, |
| 136 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, | 136 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, |
| 137 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | 137 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 138 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | 138 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 139 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, | 139 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, |
| 140 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, | 140 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, |
| 141 | ObtenerFechaActual(), | 141 | obtenerFechaActual(), |
| 142 | ObtenerFechaActual()) | 142 | obtenerFechaActual()) |
| 143 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | 143 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
| 144 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) | 144 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) |
| 145 | // VolverAinventario() | 145 | // VolverAinventario() |
| 146 | activity?.onBackPressed() | 146 | activity?.onBackPressed() |
| 147 | mAlertDialog.dismiss() | 147 | mAlertDialog.dismiss() |
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | } else if (artCargadoEnBD != null) { | 150 | } else if (artCargadoEnBD != null) { |
| 151 | 151 | ||
| 152 | mDialogViewM = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 152 | mDialogViewM = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| 153 | val mBuilder = AlertDialog.Builder(context).setView(mDialogViewM).setCancelable(false) | 153 | val mBuilder = AlertDialog.Builder(context).setView(mDialogViewM).setCancelable(false) |
| 154 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogViewM.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER | 154 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7")) mDialogViewM.tvNuevaCantidad.inputType= InputType.TYPE_CLASS_NUMBER |
| 155 | mDialogViewM.tvTitulo2.text="${artCargadoEnBD!!.descripcion}" | 155 | mDialogViewM.tvTitulo2.text="${artCargadoEnBD!!.descripcion}" |
| 156 | mDialogViewM.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | 156 | mDialogViewM.tvCantInicial.text =String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) |
| 157 | 157 | ||
| 158 | val mAlertDialog = mBuilder.show() | 158 | val mAlertDialog = mBuilder.show() |
| 159 | mDialogViewM.tvNuevaCantidad.requestFocus() | 159 | mDialogViewM.tvNuevaCantidad.requestFocus() |
| 160 | mDialogViewM.tvNuevaCantidad.addTextChangedListener(textWatcher) | 160 | mDialogViewM.tvNuevaCantidad.addTextChangedListener(textWatcher) |
| 161 | 161 | ||
| 162 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 162 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 163 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 163 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 164 | 164 | ||
| 165 | mDialogViewM.rbSumar.setOnClickListener { | 165 | mDialogViewM.rbSumar.setOnClickListener { |
| 166 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 166 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 167 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvCantInicial.text.toString().toFloat() + mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) | 167 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvCantInicial.text.toString().toFloat() + mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) |
| 168 | // mDialogView.tvNuevaCantidad.isEnabled=false | 168 | // mDialogView.tvNuevaCantidad.isEnabled=false |
| 169 | } | 169 | } |
| 170 | } | 170 | } |
| 171 | mDialogViewM.rbRestar.setOnClickListener { | 171 | mDialogViewM.rbRestar.setOnClickListener { |
| 172 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 172 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 173 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { | 173 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { |
| 174 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) | 174 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) |
| 175 | // mDialogView.tvNuevaCantidad.isEnabled = false | 175 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 176 | }else{ | 176 | }else{ |
| 177 | mDialogViewM.tvResultado.text="" | 177 | mDialogViewM.tvResultado.text="" |
| 178 | mDialogViewM.tvResultado.error = "Operación No Valida" | 178 | mDialogViewM.tvResultado.error = "Operación No Valida" |
| 179 | mDialogViewM.tvResultado.requestFocus() | 179 | mDialogViewM.tvResultado.requestFocus() |
| 180 | mDialogViewM.tvResultado.hint = "Error" | 180 | mDialogViewM.tvResultado.hint = "Error" |
| 181 | } | 181 | } |
| 182 | } | 182 | } |
| 183 | } | 183 | } |
| 184 | mDialogViewM.rbMdodificar.setOnClickListener { | 184 | mDialogViewM.rbMdodificar.setOnClickListener { |
| 185 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 185 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 186 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) | 186 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) |
| 187 | // mDialogView.tvNuevaCantidad.isEnabled = false | 187 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 188 | } | 188 | } |
| 189 | } | 189 | } |
| 190 | mDialogViewM.btnAceptar.setOnClickListener { | 190 | mDialogViewM.btnAceptar.setOnClickListener { |
| 191 | if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || !mDialogViewM.tvNuevaCantidad.text.isBlank()) { | 191 | if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || !mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 192 | if (mDialogViewM.tvResultado.text.isNotEmpty() || !mDialogViewM.tvResultado.text.isBlank()) { | 192 | if (mDialogViewM.tvResultado.text.isNotEmpty() || !mDialogViewM.tvResultado.text.isBlank()) { |
| 193 | 193 | ||
| 194 | updateCantidad((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), | 194 | updateCantidad((viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), |
| 195 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), | 195 | (viewAdapter2 as CodigoOrigenAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), |
| 196 | mDialogViewM.tvResultado.text.toString().toFloat()) | 196 | mDialogViewM.tvResultado.text.toString().toFloat()) |
| 197 | // VolverAinventario() | 197 | // VolverAinventario() |
| 198 | activity?.onBackPressed(); | 198 | activity?.onBackPressed(); |
| 199 | mAlertDialog.dismiss() | 199 | mAlertDialog.dismiss() |
| 200 | } else if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { | 200 | } else if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 201 | mDialogViewM.tvResultado.error = "Operación Requerida" | 201 | mDialogViewM.tvResultado.error = "Operación Requerida" |
| 202 | mDialogViewM.tvResultado.requestFocus() | 202 | mDialogViewM.tvResultado.requestFocus() |
| 203 | mDialogViewM.tvResultado.hint = "Seleccione Operación" | 203 | mDialogViewM.tvResultado.hint = "Seleccione Operación" |
| 204 | } | 204 | } |
| 205 | } else if (mDialogViewM.tvNuevaCantidad.text.isEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { | 205 | } else if (mDialogViewM.tvNuevaCantidad.text.isEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 206 | mDialogViewM.tvNuevaCantidad.error = "Completar" | 206 | mDialogViewM.tvNuevaCantidad.error = "Completar" |
| 207 | mDialogViewM.tvNuevaCantidad.requestFocus() | 207 | mDialogViewM.tvNuevaCantidad.requestFocus() |
| 208 | mDialogViewM.tvNuevaCantidad.hint = "Ingrese un valor" | 208 | mDialogViewM.tvNuevaCantidad.hint = "Ingrese un valor" |
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | mDialogViewM.dialogCancelBtn.setOnClickListener { | 211 | mDialogViewM.dialogCancelBtn.setOnClickListener { |
| 212 | activity?.onBackPressed(); | 212 | activity?.onBackPressed(); |
| 213 | mAlertDialog.dismiss() | 213 | mAlertDialog.dismiss() |
| 214 | } | 214 | } |
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 219 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
| 220 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 220 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 221 | val itemView = viewHolder.itemView | 221 | val itemView = viewHolder.itemView |
| 222 | 222 | ||
| 223 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 223 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
| 224 | 224 | ||
| 225 | if (dX > 0) { | 225 | if (dX > 0) { |
| 226 | 226 | ||
| 227 | c.drawColor(Color.RED) | 227 | c.drawColor(Color.RED) |
| 228 | } else if (dX < 0) { | 228 | } else if (dX < 0) { |
| 229 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | 229 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) |
| 230 | c.drawColor(Color.YELLOW) | 230 | c.drawColor(Color.YELLOW) |
| 231 | } | 231 | } |
| 232 | swipeBackground.draw(c) | 232 | swipeBackground.draw(c) |
| 233 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 233 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 234 | } | 234 | } |
| 235 | } | 235 | } |
| 236 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | 236 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) |
| 237 | itemTouchHelper2.attachToRecyclerView(rcCodigoOri) | 237 | itemTouchHelper2.attachToRecyclerView(rcCodigoOri) |
| 238 | 238 | ||
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 241 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
| 242 | lifecycleScope.launch { | 242 | lifecycleScope.launch { |
| 243 | withContext(Dispatchers.IO) { | 243 | withContext(Dispatchers.IO) { |
| 244 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 244 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
| 245 | } | 245 | } |
| 246 | } | 246 | } |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { | 249 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { |
| 250 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 250 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 251 | var busqueda: InvBody? = null | 251 | var busqueda: InvBody? = null |
| 252 | return GlobalScope.async(Dispatchers.IO) { | 252 | return GlobalScope.async(Dispatchers.IO) { |
| 253 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector.toLong(), codigo.toLong(), numInventario.toInt()) | 253 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector.toLong(), codigo.toLong(), numInventario.toInt()) |
| 254 | return@async busqueda | 254 | return@async busqueda |
| 255 | }.await() | 255 | }.await() |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 258 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
| 259 | lifecycleScope.launch { | 259 | lifecycleScope.launch { |
| 260 | withContext(Dispatchers.IO) { | 260 | withContext(Dispatchers.IO) { |
| 261 | val activity: FragmentActivity? = activity | 261 | val activity: FragmentActivity? = activity |
| 262 | if (activity != null && isAdded) { | 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 | } |
| 267 | } | 267 | } |
| 268 | private val textWatcher = object : TextWatcher { | 268 | private val textWatcher = object : TextWatcher { |
| 269 | override fun afterTextChanged(s: Editable?) { | 269 | override fun afterTextChanged(s: Editable?) { |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { | 272 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { | 275 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { |
| 276 | if (mDialogViewM.rbSumar.isChecked) { | 276 | if (mDialogViewM.rbSumar.isChecked) { |
| 277 | // mDialogView.tvNuevaCantidad.isEnabled=false | 277 | // mDialogView.tvNuevaCantidad.isEnabled=false |
| 278 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat() + mDialogViewM.tvCantInicial.text.toString().toFloat()) | 278 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat() + mDialogViewM.tvCantInicial.text.toString().toFloat()) |
| 279 | } | 279 | } |
| 280 | if (mDialogViewM.rbRestar.isChecked) { | 280 | if (mDialogViewM.rbRestar.isChecked) { |
| 281 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 281 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 282 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { | 282 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { |
| 283 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) | 283 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) |
| 284 | // mDialogView.tvNuevaCantidad.isEnabled = false | 284 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 285 | } else { | 285 | } else { |
| 286 | mDialogViewM.tvResultado.text = "" | 286 | mDialogViewM.tvResultado.text = "" |
| 287 | mDialogViewM.tvResultado.error = "Operación No Valida" | 287 | mDialogViewM.tvResultado.error = "Operación No Valida" |
| 288 | mDialogViewM.tvResultado.requestFocus() | 288 | mDialogViewM.tvResultado.requestFocus() |
| 289 | mDialogViewM.tvResultado.hint = "Error" | 289 | mDialogViewM.tvResultado.hint = "Error" |
| 290 | } | 290 | } |
| 291 | } | 291 | } |
| 292 | } | 292 | } |
| 293 | if (mDialogViewM.rbMdodificar.isChecked) { | 293 | if (mDialogViewM.rbMdodificar.isChecked) { |
| 294 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 294 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 295 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) | 295 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) |
| 296 | // mDialogView.tvNuevaCantidad.isEnabled = false | 296 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 297 | } | 297 | } |
| 298 | } | 298 | } |
| 299 | } | 299 | } |
| 300 | } | 300 | } |
| 301 | } | 301 | } |
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.app.AlertDialog | 3 | import android.app.AlertDialog |
| 4 | import android.content.Context | 4 | import android.content.Context |
| 5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
| 6 | import android.graphics.Canvas | 6 | import android.graphics.Canvas |
| 7 | import android.graphics.Color | 7 | import android.graphics.Color |
| 8 | import android.graphics.drawable.ColorDrawable | 8 | import android.graphics.drawable.ColorDrawable |
| 9 | import android.os.Bundle | 9 | import android.os.Bundle |
| 10 | import android.text.Editable | 10 | import android.text.Editable |
| 11 | import android.text.InputType | 11 | import android.text.InputType |
| 12 | import android.text.TextWatcher | 12 | import android.text.TextWatcher |
| 13 | import android.view.LayoutInflater | 13 | import android.view.LayoutInflater |
| 14 | import android.view.View | 14 | import android.view.View |
| 15 | import android.view.ViewGroup | 15 | import android.view.ViewGroup |
| 16 | import android.view.WindowManager | 16 | import android.view.WindowManager |
| 17 | import android.view.inputmethod.InputMethodManager | 17 | import android.view.inputmethod.InputMethodManager |
| 18 | import androidx.fragment.app.Fragment | 18 | import androidx.fragment.app.Fragment |
| 19 | import androidx.fragment.app.FragmentActivity | 19 | import androidx.fragment.app.FragmentActivity |
| 20 | import androidx.lifecycle.lifecycleScope | 20 | import androidx.lifecycle.lifecycleScope |
| 21 | import androidx.navigation.NavController | 21 | import androidx.navigation.NavController |
| 22 | import androidx.navigation.Navigation | 22 | import androidx.navigation.Navigation |
| 23 | import androidx.recyclerview.widget.ItemTouchHelper | 23 | import androidx.recyclerview.widget.ItemTouchHelper |
| 24 | import androidx.recyclerview.widget.LinearLayoutManager | 24 | import androidx.recyclerview.widget.LinearLayoutManager |
| 25 | import androidx.recyclerview.widget.RecyclerView | 25 | import androidx.recyclerview.widget.RecyclerView |
| 26 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 26 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 27 | import com.focasoftware.deboinventariov20.Model.Articles | 27 | import com.focasoftware.deboinventariov20.Model.Articles |
| 28 | import com.focasoftware.deboinventariov20.Model.InvBody | 28 | import com.focasoftware.deboinventariov20.Model.InvBody |
| 29 | import com.focasoftware.deboinventariov20.R | 29 | import com.focasoftware.deboinventariov20.R |
| 30 | import com.focasoftware.deboinventariov20.UI.Utils.ObtenerFechaActual | 30 | import com.focasoftware.deboinventariov20.UI.Utils.obtenerFechaActual |
| 31 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | 31 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
| 32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 32 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| 33 | import kotlinx.android.synthetic.main.login_dialog.view.* | 33 | import kotlinx.android.synthetic.main.login_dialog.view.* |
| 34 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | 34 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar |
| 35 | import kotlinx.coroutines.* | 35 | import kotlinx.coroutines.* |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | class DescripcionFragment : Fragment() { | 38 | class DescripcionFragment : Fragment() { |
| 39 | private var artAcargar2: List<Articles>? = null | 39 | private var artAcargar2: List<Articles>? = null |
| 40 | private var listArticulos2: List<Articles>? = null | 40 | private var listArticulos2: List<Articles>? = null |
| 41 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | 41 | lateinit var viewAdapter2: RecyclerView.Adapter<*> |
| 42 | private lateinit var viewManager2: RecyclerView.LayoutManager | 42 | private lateinit var viewManager2: RecyclerView.LayoutManager |
| 43 | private lateinit var rcDescripcion: RecyclerView | 43 | private lateinit var rcDescripcion: RecyclerView |
| 44 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | 44 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) |
| 45 | private var cantidad = 0F | 45 | private var cantidad = 0F |
| 46 | private var numeroInventario = 0 | 46 | private var numeroInventario = 0 |
| 47 | lateinit var navController: NavController | 47 | lateinit var navController: NavController |
| 48 | lateinit var sharedPreferences: SharedPreferences | 48 | lateinit var sharedPreferences: SharedPreferences |
| 49 | private var artCargadoEnBD: InvBody? = null | 49 | private var artCargadoEnBD: InvBody? = null |
| 50 | lateinit var mDialogViewM: View | 50 | lateinit var mDialogViewM: View |
| 51 | 51 | ||
| 52 | override fun onCreate(savedInstanceState: Bundle?) { | 52 | override fun onCreate(savedInstanceState: Bundle?) { |
| 53 | super.onCreate(savedInstanceState) | 53 | super.onCreate(savedInstanceState) |
| 54 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 54 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 55 | arguments.apply { | 55 | arguments.apply { |
| 56 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | 56 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> |
| 57 | numeroInventario = requireArguments().getInt("numeroInv") | 57 | numeroInventario = requireArguments().getInt("numeroInv") |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 62 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 63 | super.onViewCreated(view, savedInstanceState) | 63 | super.onViewCreated(view, savedInstanceState) |
| 64 | navController = Navigation.findNavController(view) | 64 | navController = Navigation.findNavController(view) |
| 65 | showSoftKeyboard(view) | 65 | showSoftKeyboard(view) |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 68 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 69 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) | 69 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) |
| 70 | rcDescripcion = v.findViewById(R.id.rcDescripcion) | 70 | rcDescripcion = v.findViewById(R.id.rcDescripcion) |
| 71 | IngresarRecicler(artAcargar2) | 71 | IngresarRecicler(artAcargar2) |
| 72 | showSoftKeyboard(v) | 72 | showSoftKeyboard(v) |
| 73 | 73 | ||
| 74 | return v | 74 | return v |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | private fun showSoftKeyboard(view: View) { | 77 | private fun showSoftKeyboard(view: View) { |
| 78 | if (view.requestFocus()) { | 78 | if (view.requestFocus()) { |
| 79 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | 79 | val imm = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager |
| 80 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) | 80 | imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY) |
| 81 | } | 81 | } |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | fun IngresarRecicler(articulos: List<Articles>?) { | 84 | fun IngresarRecicler(articulos: List<Articles>?) { |
| 85 | 85 | ||
| 86 | viewAdapter2 = DescripcionListAdapter(articulos) | 86 | viewAdapter2 = DescripcionListAdapter(articulos) |
| 87 | viewManager2 = LinearLayoutManager(requireContext()) | 87 | viewManager2 = LinearLayoutManager(requireContext()) |
| 88 | 88 | ||
| 89 | rcDescripcion.apply { | 89 | rcDescripcion.apply { |
| 90 | adapter = viewAdapter2 | 90 | adapter = viewAdapter2 |
| 91 | layoutManager = viewManager2 | 91 | layoutManager = viewManager2 |
| 92 | } | 92 | } |
| 93 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | 93 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { |
| 94 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 94 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
| 95 | return false | 95 | return false |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 98 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
| 99 | 99 | ||
| 100 | GlobalScope.launch(Dispatchers.Main) { | 100 | GlobalScope.launch(Dispatchers.Main) { |
| 101 | //TODO BUSCO EN BASE DE DATOS | 101 | //TODO BUSCO EN BASE DE DATOS |
| 102 | artCargadoEnBD = buscarCodigoDeboEnBD( | 102 | artCargadoEnBD = buscarCodigoDeboEnBD( |
| 103 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), | 103 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.sector.toString(), |
| 104 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), numeroInventario.toString() | 104 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)?.codigo.toString(), numeroInventario.toString() |
| 105 | ) | 105 | ) |
| 106 | if (artCargadoEnBD == null) { | 106 | if (artCargadoEnBD == null) { |
| 107 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | 107 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) |
| 108 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | 108 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) |
| 109 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO | 109 | //TODO: DEPENDIENDO DEL TIPO DE ARTICULO PERMITER INGRESAR DECIMALES O NO |
| 110 | if ((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 1 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 3 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 7) | 110 | if ((viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 1 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 3 || (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza == 7) |
| 111 | mDialogView.etCantidad.inputType = InputType.TYPE_CLASS_NUMBER | 111 | mDialogView.etCantidad.inputType = InputType.TYPE_CLASS_NUMBER |
| 112 | 112 | ||
| 113 | mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" | 113 | mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion}" |
| 114 | val mAlertDialog = mBuilder.show() | 114 | val mAlertDialog = mBuilder.show() |
| 115 | 115 | ||
| 116 | mDialogView.etCantidad.requestFocus() | 116 | mDialogView.etCantidad.requestFocus() |
| 117 | mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 117 | mAlertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 118 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 118 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 119 | 119 | ||
| 120 | mDialogView.btnAceptar.setOnClickListener { | 120 | mDialogView.btnAceptar.setOnClickListener { |
| 121 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | 121 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 122 | mDialogView.etCantidad.error = "No vacio" | 122 | mDialogView.etCantidad.error = "No vacio" |
| 123 | mDialogView.etCantidad.requestFocus() | 123 | mDialogView.etCantidad.requestFocus() |
| 124 | mDialogView.etCantidad.hint = "Ingrese un valor" | 124 | mDialogView.etCantidad.hint = "Ingrese un valor" |
| 125 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | 125 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 126 | 126 | ||
| 127 | cantidad = String.format("%.2f",mDialogView.etCantidad.text.toString().toFloat()).toFloat() | 127 | cantidad = String.format("%.2f",mDialogView.etCantidad.text.toString().toFloat()).toFloat() |
| 128 | val body = InvBody( | 128 | val body = InvBody( |
| 129 | numeroInventario, | 129 | numeroInventario, |
| 130 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, | 130 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector, |
| 131 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | 131 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD |
| 132 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, | 132 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo, |
| 133 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, | 133 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.descripcion, |
| 134 | cantidad.toString(), | 134 | cantidad.toString(), |
| 135 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, | 135 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codBar, |
| 136 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, | 136 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codOrigen, |
| 137 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | 137 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 138 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, | 138 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.precio, |
| 139 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, | 139 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.balanza, |
| 140 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, | 140 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.depSn, |
| 141 | ObtenerFechaActual(), | 141 | obtenerFechaActual(), |
| 142 | ObtenerFechaActual() | 142 | obtenerFechaActual() |
| 143 | ) | 143 | ) |
| 144 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | 144 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
| 145 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) | 145 | modificarCantidadEnCabecera(numeroInventario, true, requireActivity()) |
| 146 | // VolverAinventario() | 146 | // VolverAinventario() |
| 147 | activity?.onBackPressed() | 147 | activity?.onBackPressed() |
| 148 | mAlertDialog.dismiss() | 148 | mAlertDialog.dismiss() |
| 149 | } | 149 | } |
| 150 | } | 150 | } |
| 151 | } else if (artCargadoEnBD != null) { | 151 | } else if (artCargadoEnBD != null) { |
| 152 | 152 | ||
| 153 | mDialogViewM = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 153 | mDialogViewM = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| 154 | val mBuilder = AlertDialog.Builder(context).setView(mDialogViewM).setCancelable(false) | 154 | val mBuilder = AlertDialog.Builder(context).setView(mDialogViewM).setCancelable(false) |
| 155 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7") | 155 | if (artCargadoEnBD!!.balanza.toString().contains("1") || artCargadoEnBD!!.balanza.toString().contains("3") || artCargadoEnBD!!.balanza.toString().contains("7") |
| 156 | ) mDialogViewM.tvNuevaCantidad.inputType = InputType.TYPE_CLASS_NUMBER | 156 | ) mDialogViewM.tvNuevaCantidad.inputType = InputType.TYPE_CLASS_NUMBER |
| 157 | mDialogViewM.tvTitulo2.text="${artCargadoEnBD!!.descripcion}" | 157 | mDialogViewM.tvTitulo2.text="${artCargadoEnBD!!.descripcion}" |
| 158 | mDialogViewM.tvCantInicial.text = String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) | 158 | mDialogViewM.tvCantInicial.text = String.format("%.2f", artCargadoEnBD!!.cantTomada.toString().toFloat()) |
| 159 | 159 | ||
| 160 | val mAlertDialog = mBuilder.show() | 160 | val mAlertDialog = mBuilder.show() |
| 161 | mDialogViewM.tvNuevaCantidad.requestFocus() | 161 | mDialogViewM.tvNuevaCantidad.requestFocus() |
| 162 | 162 | ||
| 163 | 163 | ||
| 164 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 164 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 165 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 165 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 166 | 166 | ||
| 167 | mDialogViewM.tvNuevaCantidad.addTextChangedListener(textWatcher) | 167 | mDialogViewM.tvNuevaCantidad.addTextChangedListener(textWatcher) |
| 168 | 168 | ||
| 169 | mDialogViewM.rbSumar.setOnClickListener { | 169 | mDialogViewM.rbSumar.setOnClickListener { |
| 170 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 170 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 171 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvCantInicial.text.toString().toFloat() + mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) | 171 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvCantInicial.text.toString().toFloat() + mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) |
| 172 | // mDialogViewM.tvNuevaCantidad.isEnabled = false | 172 | // mDialogViewM.tvNuevaCantidad.isEnabled = false |
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| 175 | mDialogViewM.rbRestar.setOnClickListener { | 175 | mDialogViewM.rbRestar.setOnClickListener { |
| 176 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 176 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 177 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { | 177 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { |
| 178 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) | 178 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) |
| 179 | // mDialogViewM.tvNuevaCantidad.isEnabled = false | 179 | // mDialogViewM.tvNuevaCantidad.isEnabled = false |
| 180 | } else { | 180 | } else { |
| 181 | mDialogViewM.tvResultado.text = "" | 181 | mDialogViewM.tvResultado.text = "" |
| 182 | mDialogViewM.tvResultado.error = "Operación No Valida" | 182 | mDialogViewM.tvResultado.error = "Operación No Valida" |
| 183 | mDialogViewM.tvResultado.requestFocus() | 183 | mDialogViewM.tvResultado.requestFocus() |
| 184 | mDialogViewM.tvResultado.hint = "Error" | 184 | mDialogViewM.tvResultado.hint = "Error" |
| 185 | } | 185 | } |
| 186 | } | 186 | } |
| 187 | } | 187 | } |
| 188 | mDialogViewM.rbMdodificar.setOnClickListener { | 188 | mDialogViewM.rbMdodificar.setOnClickListener { |
| 189 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 189 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 190 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) | 190 | mDialogViewM.tvResultado.text = String.format("%.2f", (mDialogViewM.tvNuevaCantidad.text.toString().toFloat())) |
| 191 | // mDialogViewM.tvNuevaCantidad.isEnabled = false | 191 | // mDialogViewM.tvNuevaCantidad.isEnabled = false |
| 192 | } | 192 | } |
| 193 | } | 193 | } |
| 194 | mDialogViewM.btnAceptar.setOnClickListener { | 194 | mDialogViewM.btnAceptar.setOnClickListener { |
| 195 | if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || !mDialogViewM.tvNuevaCantidad.text.isBlank()) { | 195 | if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || !mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 196 | if (mDialogViewM.tvResultado.text.isNotEmpty() || !mDialogViewM.tvResultado.text.isBlank()) { | 196 | if (mDialogViewM.tvResultado.text.isNotEmpty() || !mDialogViewM.tvResultado.text.isBlank()) { |
| 197 | 197 | ||
| 198 | updateCantidad( | 198 | updateCantidad( |
| 199 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), | 199 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.sector.toString(), |
| 200 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), | 200 | (viewAdapter2 as DescripcionListAdapter).items2?.get(viewHolder.layoutPosition)!!.codigo.toString(), |
| 201 | mDialogViewM.tvResultado.text.toString().toFloat() | 201 | mDialogViewM.tvResultado.text.toString().toFloat() |
| 202 | ) | 202 | ) |
| 203 | activity?.onBackPressed() | 203 | activity?.onBackPressed() |
| 204 | mAlertDialog.dismiss() | 204 | mAlertDialog.dismiss() |
| 205 | } else if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { | 205 | } else if (mDialogViewM.tvNuevaCantidad.text.isNotEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 206 | mDialogViewM.tvResultado.error = "Operación Requerida" | 206 | mDialogViewM.tvResultado.error = "Operación Requerida" |
| 207 | mDialogViewM.tvResultado.requestFocus() | 207 | mDialogViewM.tvResultado.requestFocus() |
| 208 | mDialogViewM.tvResultado.hint = "Seleccione Operación" | 208 | mDialogViewM.tvResultado.hint = "Seleccione Operación" |
| 209 | } | 209 | } |
| 210 | } else if (mDialogViewM.tvNuevaCantidad.text.isEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { | 210 | } else if (mDialogViewM.tvNuevaCantidad.text.isEmpty() || mDialogViewM.tvNuevaCantidad.text.isBlank()) { |
| 211 | mDialogViewM.tvNuevaCantidad.error = "Completar" | 211 | mDialogViewM.tvNuevaCantidad.error = "Completar" |
| 212 | mDialogViewM.tvNuevaCantidad.requestFocus() | 212 | mDialogViewM.tvNuevaCantidad.requestFocus() |
| 213 | mDialogViewM.tvNuevaCantidad.hint = "Ingrese un valor" | 213 | mDialogViewM.tvNuevaCantidad.hint = "Ingrese un valor" |
| 214 | } | 214 | } |
| 215 | } | 215 | } |
| 216 | mDialogViewM.dialogCancelBtn.setOnClickListener { | 216 | mDialogViewM.dialogCancelBtn.setOnClickListener { |
| 217 | activity?.onBackPressed() | 217 | activity?.onBackPressed() |
| 218 | mAlertDialog.dismiss() | 218 | mAlertDialog.dismiss() |
| 219 | } | 219 | } |
| 220 | } | 220 | } |
| 221 | } | 221 | } |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 224 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
| 225 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 225 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 226 | val itemView = viewHolder.itemView | 226 | val itemView = viewHolder.itemView |
| 227 | 227 | ||
| 228 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 228 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
| 229 | 229 | ||
| 230 | if (dX > 0) { | 230 | if (dX > 0) { |
| 231 | 231 | ||
| 232 | c.drawColor(Color.RED) | 232 | c.drawColor(Color.RED) |
| 233 | } else if (dX < 0) { | 233 | } else if (dX < 0) { |
| 234 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | 234 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) |
| 235 | c.drawColor(Color.YELLOW) | 235 | c.drawColor(Color.YELLOW) |
| 236 | } | 236 | } |
| 237 | swipeBackground.draw(c) | 237 | swipeBackground.draw(c) |
| 238 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 238 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 239 | } | 239 | } |
| 240 | } | 240 | } |
| 241 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | 241 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) |
| 242 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) | 242 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 245 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
| 246 | lifecycleScope.launch { | 246 | lifecycleScope.launch { |
| 247 | withContext(Dispatchers.IO) { | 247 | withContext(Dispatchers.IO) { |
| 248 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 248 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
| 249 | } | 249 | } |
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { | 253 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { |
| 254 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 254 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 255 | var busqueda: InvBody? = null | 255 | var busqueda: InvBody? = null |
| 256 | return GlobalScope.async(Dispatchers.IO) { | 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 | return@async busqueda | 258 | return@async busqueda |
| 259 | }.await() | 259 | }.await() |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 262 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
| 263 | lifecycleScope.launch { | 263 | lifecycleScope.launch { |
| 264 | withContext(Dispatchers.IO) { | 264 | withContext(Dispatchers.IO) { |
| 265 | val activity: FragmentActivity? = activity | 265 | val activity: FragmentActivity? = activity |
| 266 | if (activity != null && isAdded) { | 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 | } |
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | private val textWatcher = object : TextWatcher { | 273 | private val textWatcher = object : TextWatcher { |
| 274 | override fun afterTextChanged(s: Editable?) { | 274 | override fun afterTextChanged(s: Editable?) { |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { | 277 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { | 280 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { |
| 281 | if (mDialogViewM.rbSumar.isChecked) { | 281 | if (mDialogViewM.rbSumar.isChecked) { |
| 282 | // mDialogView.tvNuevaCantidad.isEnabled=false | 282 | // mDialogView.tvNuevaCantidad.isEnabled=false |
| 283 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat() + mDialogViewM.tvCantInicial.text.toString().toFloat()) | 283 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat() + mDialogViewM.tvCantInicial.text.toString().toFloat()) |
| 284 | } | 284 | } |
| 285 | if (mDialogViewM.rbRestar.isChecked) { | 285 | if (mDialogViewM.rbRestar.isChecked) { |
| 286 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 286 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 287 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { | 287 | if (mDialogViewM.tvCantInicial.text.toString().toFloat() >= mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) { |
| 288 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) | 288 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvCantInicial.text.toString().toFloat() - mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) |
| 289 | // mDialogView.tvNuevaCantidad.isEnabled = false | 289 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 290 | } else { | 290 | } else { |
| 291 | mDialogViewM.tvResultado.text = "" | 291 | mDialogViewM.tvResultado.text = "" |
| 292 | mDialogViewM.tvResultado.error = "Operación No Valida" | 292 | mDialogViewM.tvResultado.error = "Operación No Valida" |
| 293 | mDialogViewM.tvResultado.requestFocus() | 293 | mDialogViewM.tvResultado.requestFocus() |
| 294 | mDialogViewM.tvResultado.hint = "Error" | 294 | mDialogViewM.tvResultado.hint = "Error" |
| 295 | } | 295 | } |
| 296 | } | 296 | } |
| 297 | } | 297 | } |
| 298 | if (mDialogViewM.rbMdodificar.isChecked) { | 298 | if (mDialogViewM.rbMdodificar.isChecked) { |
| 299 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { | 299 | if (!mDialogViewM.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 300 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) | 300 | mDialogViewM.tvResultado.text = String.format("%.2f", mDialogViewM.tvNuevaCantidad.text.toString().toFloat()) |
| 301 | // mDialogView.tvNuevaCantidad.isEnabled = false | 301 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 302 | } | 302 | } |
| 303 | } | 303 | } |
| 304 | } | 304 | } |
| 305 | } | 305 | } |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | 308 | ||
| 309 | 309 |
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.annotation.SuppressLint | 3 | import android.annotation.SuppressLint |
| 4 | import android.app.AlertDialog | 4 | import android.app.AlertDialog |
| 5 | import android.content.Context | 5 | import android.content.Context |
| 6 | import android.content.Context.INPUT_METHOD_SERVICE | 6 | import android.content.Context.INPUT_METHOD_SERVICE |
| 7 | import android.content.DialogInterface | 7 | import android.content.DialogInterface |
| 8 | import android.content.SharedPreferences | 8 | import android.content.SharedPreferences |
| 9 | import android.graphics.Canvas | 9 | import android.graphics.Canvas |
| 10 | import android.graphics.Color | 10 | import android.graphics.Color |
| 11 | import android.graphics.drawable.Drawable | 11 | import android.graphics.drawable.Drawable |
| 12 | import android.os.Bundle | 12 | import android.os.Bundle |
| 13 | import android.text.Editable | 13 | import android.text.Editable |
| 14 | import android.text.InputType.TYPE_CLASS_NUMBER | 14 | import android.text.InputType.TYPE_CLASS_NUMBER |
| 15 | import android.text.TextWatcher | 15 | import android.text.TextWatcher |
| 16 | import android.view.* | 16 | import android.view.* |
| 17 | import android.view.inputmethod.InputMethodManager | 17 | import android.view.inputmethod.InputMethodManager |
| 18 | import android.widget.EditText | 18 | import android.widget.EditText |
| 19 | import android.widget.TextView | 19 | import android.widget.TextView |
| 20 | import android.widget.Toast | 20 | import android.widget.Toast |
| 21 | import androidx.core.content.ContextCompat | 21 | import androidx.core.content.ContextCompat |
| 22 | import androidx.core.os.bundleOf | 22 | import androidx.core.os.bundleOf |
| 23 | import androidx.fragment.app.Fragment | 23 | import androidx.fragment.app.Fragment |
| 24 | import androidx.lifecycle.ViewModel | 24 | import androidx.lifecycle.ViewModel |
| 25 | import androidx.lifecycle.ViewModelProviders | 25 | import androidx.lifecycle.ViewModelProviders |
| 26 | import androidx.lifecycle.lifecycleScope | 26 | import androidx.lifecycle.lifecycleScope |
| 27 | import androidx.navigation.NavController | 27 | import androidx.navigation.NavController |
| 28 | import androidx.navigation.Navigation | 28 | import androidx.navigation.Navigation |
| 29 | import androidx.recyclerview.widget.ItemTouchHelper | 29 | import androidx.recyclerview.widget.ItemTouchHelper |
| 30 | import androidx.recyclerview.widget.LinearLayoutManager | 30 | import androidx.recyclerview.widget.LinearLayoutManager |
| 31 | import androidx.recyclerview.widget.RecyclerView | 31 | import androidx.recyclerview.widget.RecyclerView |
| 32 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 32 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 33 | import com.focasoftware.deboinventariov20.Model.* | 33 | import com.focasoftware.deboinventariov20.Model.* |
| 34 | import com.focasoftware.deboinventariov20.R | 34 | import com.focasoftware.deboinventariov20.R |
| 35 | import com.focasoftware.deboinventariov20.UI.Utils.ExportacionExitosa | ||
| 35 | import com.focasoftware.deboinventariov20.UI.Utils.NoEncontradoSimple | 36 | import com.focasoftware.deboinventariov20.UI.Utils.NoEncontradoSimple |
| 36 | import com.focasoftware.deboinventariov20.UI.Utils.ObtenerFechaActual | ||
| 37 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera | 37 | import com.focasoftware.deboinventariov20.UI.Utils.modificarCantidadEnCabecera |
| 38 | import com.focasoftware.deboinventariov20.UI.Utils.obtenerFechaActual | ||
| 38 | import com.focasoftware.deboinventariov20.UI.inventario.viewModel.InventarioViewModel | 39 | import com.focasoftware.deboinventariov20.UI.inventario.viewModel.InventarioViewModel |
| 39 | import kotlinx.android.synthetic.main.fragment_inventario.* | 40 | import kotlinx.android.synthetic.main.fragment_inventario.* |
| 40 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 41 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
| 41 | import kotlinx.android.synthetic.main.login_dialog.view.* | 42 | import kotlinx.android.synthetic.main.login_dialog.view.* |
| 42 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | 43 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar |
| 43 | import kotlinx.coroutines.* | 44 | import kotlinx.coroutines.* |
| 44 | import kotlinx.coroutines.Dispatchers.IO | 45 | import kotlinx.coroutines.Dispatchers.IO |
| 46 | import kotlinx.coroutines.Dispatchers.Main | ||
| 45 | import retrofit2.Call | 47 | import retrofit2.Call |
| 46 | import retrofit2.Callback | 48 | import retrofit2.Callback |
| 47 | import retrofit2.Response | 49 | import retrofit2.Response |
| 48 | import java.util.* | 50 | import java.util.* |
| 51 | import kotlin.collections.ArrayList | ||
| 49 | 52 | ||
| 50 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { | 53 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { |
| 51 | 54 | ||
| 52 | private lateinit var sharedPreferences: SharedPreferences | 55 | private lateinit var sharedPreferences: SharedPreferences |
| 53 | private var iArea: Boolean = false | 56 | private var iArea: Boolean = false |
| 54 | private lateinit var invHead: InvHead | 57 | private lateinit var invHead: InvHead |
| 55 | private lateinit var rcInventarios: RecyclerView | 58 | private lateinit var rcInventarios: RecyclerView |
| 56 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 59 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
| 57 | private lateinit var viewManager: RecyclerView.LayoutManager | 60 | private lateinit var viewManager: RecyclerView.LayoutManager |
| 58 | private lateinit var sChangeUpper: String | 61 | private lateinit var sChangeUpper: String |
| 59 | private var listArticulos = ArrayList<ItemsRecycler>() | 62 | private var listArticulos = ArrayList<ItemsRecycler>() |
| 60 | private lateinit var navController: NavController | 63 | private lateinit var navController: NavController |
| 61 | var InventarioNuevo: Int = 0 | 64 | var InventarioNuevo: Int = 0 |
| 62 | private var iEstado = 0 | 65 | private var iEstado = 0 |
| 63 | private var iBusquedaPor = 0 | 66 | private var iBusquedaPor = 0 |
| 64 | private var fCant = 0F | 67 | private var fCant = 0F |
| 65 | private var bFirst = false | 68 | private var bFirst = false |
| 66 | private lateinit var deleteIcon: Drawable | 69 | private lateinit var deleteIcon: Drawable |
| 67 | lateinit var mDialogView: View | 70 | lateinit var mDialogView: View |
| 68 | lateinit var inventarioViewModel: ViewModel | 71 | lateinit var inventarioViewModel: ViewModel |
| 69 | 72 | ||
| 70 | @SuppressLint("MissingPermission") | 73 | @SuppressLint("MissingPermission") |
| 71 | override fun onCreate(savedInstanceState: Bundle?) { | 74 | override fun onCreate(savedInstanceState: Bundle?) { |
| 72 | super.onCreate(savedInstanceState) | 75 | super.onCreate(savedInstanceState) |
| 73 | inventarioViewModel= ViewModelProviders.of(this).get(InventarioViewModel::class.java) | 76 | inventarioViewModel = ViewModelProviders.of(this).get(InventarioViewModel::class.java) |
| 74 | 77 | ||
| 75 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 78 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 76 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { | 79 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { |
| 77 | (inventarioViewModel as InventarioViewModel).InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() | 80 | (inventarioViewModel as InventarioViewModel).InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() |
| 78 | val editor = sharedPreferences.edit() | 81 | val editor = sharedPreferences.edit() |
| 79 | editor?.putString("Inventario", "-1") | 82 | editor?.putString("Inventario", "-1") |
| 80 | editor?.apply() | 83 | editor?.apply() |
| 81 | editor.commit() | 84 | editor.commit() |
| 82 | } | 85 | } |
| 83 | // val c = Calendar.getInstance() | 86 | // val c = Calendar.getInstance() |
| 84 | // c[2009, 9, 9, 12, 0] = 0 | 87 | // c[2009, 9, 9, 12, 0] = 0 |
| 85 | // val am: AlarmManager = requireActivity().getSystemService(Context.ALARM_SERVICE) as AlarmManager | 88 | // val am: AlarmManager = requireActivity().getSystemService(Context.ALARM_SERVICE) as AlarmManager |
| 86 | // am.setTime(c.timeInMillis) | 89 | // am.setTime(c.timeInMillis) |
| 87 | } | 90 | } |
| 88 | // private fun setupTimeZone(timeZoneName: String) { | 91 | // private fun setupTimeZone(timeZoneName: String) { |
| 89 | // val am = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager | 92 | // val am = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager |
| 90 | // am.setTimeZone("Europe/Madrid") | 93 | // am.setTimeZone("Europe/Madrid") |
| 91 | // } | 94 | // } |
| 92 | 95 | ||
| 93 | 96 | ||
| 94 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 97 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 95 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) | 98 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) |
| 96 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 99 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 97 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) | 100 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) |
| 98 | rcInventarios = v.findViewById(R.id.rcInventarios) | 101 | rcInventarios = v.findViewById(R.id.rcInventarios) |
| 99 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) | 102 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) |
| 100 | val descArea: String = if (!SerchArea()) "Ventas" else "Deposito" | 103 | val descArea: String = if (!SerchArea()) "Ventas" else "Deposito" |
| 101 | 104 | ||
| 102 | if ((inventarioViewModel as InventarioViewModel).InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO | 105 | if ((inventarioViewModel as InventarioViewModel).InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO |
| 103 | GlobalScope.launch(Dispatchers.Main) { | 106 | GlobalScope.launch(Dispatchers.Main) { |
| 104 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO | 107 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO |
| 105 | (inventarioViewModel as InventarioViewModel).InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 | 108 | (inventarioViewModel as InventarioViewModel).InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 |
| 106 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO | 109 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO |
| 107 | invHead = InvHead( | 110 | invHead = InvHead( |
| 108 | (inventarioViewModel as InventarioViewModel).InventarioNuevo, | 111 | (inventarioViewModel as InventarioViewModel).InventarioNuevo, |
| 109 | if (!SerchArea()) "Ventas" else "Deposito", | 112 | if (!SerchArea()) "Ventas" else "Deposito", |
| 110 | 1, | 113 | 1, |
| 111 | ObtenerFechaActual(), | 114 | obtenerFechaActual(), |
| 112 | ObtenerFechaActual(), | 115 | obtenerFechaActual(), |
| 113 | 0L, | 116 | 0L, |
| 114 | SerchArea(), | 117 | SerchArea(), |
| 115 | AjusteProductos(), | 118 | AjusteProductos(), |
| 116 | ProdNoCont() | 119 | ProdNoCont() |
| 117 | ) | 120 | ) |
| 118 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) | 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 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) | 125 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) |
| 123 | listArticulos.clear() | 126 | listArticulos.clear() |
| 124 | cargarDeBdInventario((inventarioViewModel as InventarioViewModel).InventarioNuevo) | 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 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> | 131 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> |
| 129 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { | 132 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { |
| 130 | sChangeUpper = tCodigoBarras.text.toString() | 133 | sChangeUpper = tCodigoBarras.text.toString() |
| 131 | var indiceDelArtEncontrado = 0 | 134 | var indiceDelArtEncontrado = 0 |
| 132 | 135 | ||
| 133 | if (tCodigoBarras.text.isNullOrBlank() ) { | 136 | if (tCodigoBarras.text.isNullOrBlank()) { |
| 134 | tCodigoBarras.error = "No puede estar vacio" | 137 | tCodigoBarras.error = "No puede estar vacio" |
| 135 | tCodigoBarras.requestFocus() | 138 | tCodigoBarras.requestFocus() |
| 136 | tCodigoBarras.hint = "No puede estar vacio" | 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 | tCodigoBarras.error = "Minimo 4 caracteres" | 141 | tCodigoBarras.error = "Minimo 4 caracteres" |
| 139 | tCodigoBarras.requestFocus() | 142 | tCodigoBarras.requestFocus() |
| 140 | tCodigoBarras.hint = "4 Minimo" | 143 | tCodigoBarras.hint = "4 Minimo" |
| 141 | 144 | ||
| 142 | } else { | 145 | } else { |
| 143 | 146 | ||
| 144 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | 147 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS |
| 145 | when (iBusquedaPor) { | 148 | when (iBusquedaPor) { |
| 146 | 0 -> { | 149 | 0 -> { |
| 147 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 150 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
| 148 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 151 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 149 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 152 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 150 | 153 | ||
| 151 | GlobalScope.launch(Dispatchers.Main) { | 154 | GlobalScope.launch(Dispatchers.Main) { |
| 152 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | 155 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice |
| 153 | //TODO (Si no lo encuentra devuelve -1) | 156 | //TODO (Si no lo encuentra devuelve -1) |
| 154 | if (indiceDelArtEncontrado != -1) { | 157 | if (indiceDelArtEncontrado != -1) { |
| 155 | if (swSumaUno!!.isChecked) { | 158 | if (swSumaUno!!.isChecked) { |
| 156 | // fCant = 0F | 159 | // fCant = 0F |
| 157 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 160 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 158 | // fCant += 1F | 161 | // fCant += 1F |
| 159 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 162 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
| 160 | updateCantidad( | 163 | updateCantidad( |
| 161 | listArticulos[indiceDelArtEncontrado].sector.toString(), | 164 | listArticulos[indiceDelArtEncontrado].sector.toString(), |
| 162 | listArticulos[indiceDelArtEncontrado].codigo.toString(), | 165 | listArticulos[indiceDelArtEncontrado].codigo.toString(), |
| 163 | listArticulos[indiceDelArtEncontrado].cantTomada + 1 | 166 | listArticulos[indiceDelArtEncontrado].cantTomada + 1 |
| 164 | ) | 167 | ) |
| 165 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 168 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
| 166 | listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada + 1 | 169 | listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada + 1 |
| 167 | viewAdapter.notifyDataSetChanged() | 170 | viewAdapter.notifyDataSetChanged() |
| 168 | } else { | 171 | } else { |
| 169 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) | 172 | dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) |
| 170 | } | 173 | } |
| 171 | 174 | ||
| 172 | } else if (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | 175 | } else if (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD |
| 173 | //TODO BUSCO EN BASE DE DATOS | 176 | //TODO BUSCO EN BASE DE DATOS |
| 174 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 177 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
| 175 | continuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | 178 | continuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE |
| 176 | } | 179 | } |
| 177 | tCodigoBarras.focusable = View.FOCUSABLE | 180 | tCodigoBarras.focusable = View.FOCUSABLE |
| 178 | tCodigoBarras.setText("") | 181 | tCodigoBarras.setText("") |
| 179 | tCodigoBarras.selectAll() | 182 | tCodigoBarras.selectAll() |
| 180 | } | 183 | } |
| 181 | return@setOnKeyListener true | 184 | return@setOnKeyListener true |
| 182 | 185 | ||
| 183 | 186 | ||
| 184 | } | 187 | } |
| 185 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | 188 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** |
| 186 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 189 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
| 187 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 190 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 188 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 191 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 189 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | 192 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice |
| 190 | // //TODO Si no lo encuentra devuelve -1 | 193 | // //TODO Si no lo encuentra devuelve -1 |
| 191 | // if (indiceDelArtEncontrado != -1) { | 194 | // if (indiceDelArtEncontrado != -1) { |
| 192 | //// if (swSumaUno!!.isChecked) { | 195 | //// if (swSumaUno!!.isChecked) { |
| 193 | //// fCant = 0F | 196 | //// fCant = 0F |
| 194 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 197 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 195 | //// fCant += 1F | 198 | //// fCant += 1F |
| 196 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 199 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 197 | //// viewAdapter.notifyDataSetChanged() | 200 | //// viewAdapter.notifyDataSetChanged() |
| 198 | //// } else { | 201 | //// } else { |
| 199 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 202 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 200 | // MaterialDialog(requireContext()).show { | 203 | // MaterialDialog(requireContext()).show { |
| 201 | // title(R.string.sTituloNueva) | 204 | // title(R.string.sTituloNueva) |
| 202 | // message(R.string.sCantidadNueva) | 205 | // message(R.string.sCantidadNueva) |
| 203 | // input { materialDialog, charSequence -> | 206 | // input { materialDialog, charSequence -> |
| 204 | // fCant = 0F | 207 | // fCant = 0F |
| 205 | // fCant = charSequence.toString().toFloat() | 208 | // fCant = charSequence.toString().toFloat() |
| 206 | // } | 209 | // } |
| 207 | // positiveButton(R.string.btnOk) { | 210 | // positiveButton(R.string.btnOk) { |
| 208 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 211 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 209 | // viewAdapter.notifyDataSetChanged() | 212 | // viewAdapter.notifyDataSetChanged() |
| 210 | // dismiss() | 213 | // dismiss() |
| 211 | // } | 214 | // } |
| 212 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 215 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 213 | //// } | 216 | //// } |
| 214 | // | 217 | // |
| 215 | // } else if | 218 | // } else if |
| 216 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | 219 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD |
| 217 | GlobalScope.launch(Dispatchers.Main) { | 220 | GlobalScope.launch(Dispatchers.Main) { |
| 218 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 221 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
| 219 | continuarCargaDesc(artEncontrado as ArrayList<Articles>) | 222 | continuarCargaDesc(artEncontrado as ArrayList<Articles>) |
| 220 | } | 223 | } |
| 221 | 224 | ||
| 222 | iBusquedaPor = 0 | 225 | iBusquedaPor = 0 |
| 223 | // } | 226 | // } |
| 224 | 227 | ||
| 225 | return@setOnKeyListener true | 228 | return@setOnKeyListener true |
| 226 | } | 229 | } |
| 227 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | 230 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** |
| 228 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 231 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 229 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 232 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 230 | 233 | ||
| 231 | // GlobalScope.launch(Dispatchers.Main) { | 234 | // GlobalScope.launch(Dispatchers.Main) { |
| 232 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 2)//TODO Si encuentra el articulo en el RV devuelve el indice | 235 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 2)//TODO Si encuentra el articulo en el RV devuelve el indice |
| 233 | //// //TODO Si no lo encuentra devuelve -1 | 236 | //// //TODO Si no lo encuentra devuelve -1 |
| 234 | // if (indiceDelArtEncontrado != -1) { | 237 | // if (indiceDelArtEncontrado != -1) { |
| 235 | // if (swSumaUno!!.isChecked) { | 238 | // if (swSumaUno!!.isChecked) { |
| 236 | // fCant = 0F | 239 | // fCant = 0F |
| 237 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 240 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 238 | // fCant += 1F | 241 | // fCant += 1F |
| 239 | // //TODO ACTUALIZO LA CANTIDAD EN LA BD | 242 | // //TODO ACTUALIZO LA CANTIDAD EN LA BD |
| 240 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 243 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 241 | // //TODO ACTUALIZO LA CANTIDAD EN EL RV | 244 | // //TODO ACTUALIZO LA CANTIDAD EN EL RV |
| 242 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 245 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 243 | // viewAdapter.notifyDataSetChanged() | 246 | // viewAdapter.notifyDataSetChanged() |
| 244 | // } else { | 247 | // } else { |
| 245 | // dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) | 248 | // dialogoSumaResta(requireContext(), indiceDelArtEncontrado, listArticulos[indiceDelArtEncontrado].univta, false) |
| 246 | // } | 249 | // } |
| 247 | // } else { | 250 | // } else { |
| 248 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 251 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
| 249 | // val mBuilder = | 252 | // val mBuilder = |
| 250 | // AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | 253 | // AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") |
| 251 | // .setCancelable(false) | 254 | // .setCancelable(false) |
| 252 | // mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | 255 | // mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() |
| 253 | // val mAlertDialog = mBuilder.show() | 256 | // val mAlertDialog = mBuilder.show() |
| 254 | // mDialogView.rbSumar.setOnClickListener { | 257 | // mDialogView.rbSumar.setOnClickListener { |
| 255 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 258 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 256 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 259 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 257 | // } | 260 | // } |
| 258 | // } | 261 | // } |
| 259 | // mDialogView.rbRestar.setOnClickListener { | 262 | // mDialogView.rbRestar.setOnClickListener { |
| 260 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 263 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 261 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 264 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
| 262 | // mDialogView.tvgenerico4.text = | 265 | // mDialogView.tvgenerico4.text = |
| 263 | // (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 266 | // (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 264 | // } | 267 | // } |
| 265 | // } | 268 | // } |
| 266 | // } | 269 | // } |
| 267 | // mDialogView.rbMdodificar.setOnClickListener { | 270 | // mDialogView.rbMdodificar.setOnClickListener { |
| 268 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 271 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 269 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 272 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
| 270 | // } | 273 | // } |
| 271 | // } | 274 | // } |
| 272 | // mDialogView.btnAceptar.setOnClickListener { | 275 | // mDialogView.btnAceptar.setOnClickListener { |
| 273 | // mAlertDialog.dismiss() | 276 | // mAlertDialog.dismiss() |
| 274 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() | 277 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() |
| 275 | // fCant = 0F | 278 | // fCant = 0F |
| 276 | // fCant = name | 279 | // fCant = name |
| 277 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 280 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 278 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 281 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 279 | // viewAdapter.notifyDataSetChanged() | 282 | // viewAdapter.notifyDataSetChanged() |
| 280 | // } | 283 | // } |
| 281 | // mDialogView.dialogCancelBtn.setOnClickListener { | 284 | // mDialogView.dialogCancelBtn.setOnClickListener { |
| 282 | // mAlertDialog.dismiss() | 285 | // mAlertDialog.dismiss() |
| 283 | // } | 286 | // } |
| 284 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 287 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
| 285 | // val type = InputType.TYPE_CLASS_NUMBER | 288 | // val type = InputType.TYPE_CLASS_NUMBER |
| 286 | // MaterialDialog(requireContext()).show { | 289 | // MaterialDialog(requireContext()).show { |
| 287 | // | 290 | // |
| 288 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | 291 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
| 289 | // message(R.string.sCantidadNueva) | 292 | // message(R.string.sCantidadNueva) |
| 290 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 293 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
| 291 | // fCant = 0F | 294 | // fCant = 0F |
| 292 | // fCant = charSequence.toString().toFloat() | 295 | // fCant = charSequence.toString().toFloat() |
| 293 | // } | 296 | // } |
| 294 | // positiveButton(R.string.btnOk) { | 297 | // positiveButton(R.string.btnOk) { |
| 295 | // //TODO ACTUALIZO CANTIADAD EN BD | 298 | // //TODO ACTUALIZO CANTIADAD EN BD |
| 296 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 299 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
| 297 | // //TODO ACTUALIZO CANTIDAD EN RV | 300 | // //TODO ACTUALIZO CANTIDAD EN RV |
| 298 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 301 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
| 299 | // viewAdapter.notifyDataSetChanged() | 302 | // viewAdapter.notifyDataSetChanged() |
| 300 | // dismiss() | 303 | // dismiss() |
| 301 | // } | 304 | // } |
| 302 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 305 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 303 | // } | 306 | // } |
| 304 | // } else if (indiceDelArtEncontrado == -1) { | 307 | // } else if (indiceDelArtEncontrado == -1) { |
| 305 | // no lo encontro en el RV, lo va a buscar en al BD | 308 | // no lo encontro en el RV, lo va a buscar en al BD |
| 306 | 309 | ||
| 307 | GlobalScope.launch(Dispatchers.Main) { | 310 | GlobalScope.launch(Dispatchers.Main) { |
| 308 | //TODO BUSCO EN BASE DE DATOS | 311 | //TODO BUSCO EN BASE DE DATOS |
| 309 | val artEncontrado = buscarCodiogoOriEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 312 | val artEncontrado = buscarCodiogoOriEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
| 310 | continuarCargaCodigoOri(artEncontrado) | 313 | continuarCargaCodigoOri(artEncontrado) |
| 311 | } | 314 | } |
| 312 | iBusquedaPor = 0 | 315 | iBusquedaPor = 0 |
| 313 | // } | 316 | // } |
| 314 | // } | 317 | // } |
| 315 | return@setOnKeyListener true | 318 | return@setOnKeyListener true |
| 316 | } | 319 | } |
| 317 | } | 320 | } |
| 318 | } | 321 | } |
| 319 | } | 322 | } |
| 320 | return@setOnKeyListener false | 323 | return@setOnKeyListener false |
| 321 | } | 324 | } |
| 322 | return v | 325 | return v |
| 323 | } | 326 | } |
| 324 | 327 | ||
| 325 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 328 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 326 | super.onViewCreated(view, savedInstanceState) | 329 | super.onViewCreated(view, savedInstanceState) |
| 327 | navController = Navigation.findNavController(view) | 330 | navController = Navigation.findNavController(view) |
| 328 | etCodigoBarras.requestFocus() | 331 | etCodigoBarras.requestFocus() |
| 329 | // val modalDialog = NoEncontradoSimple() | 332 | // val modalDialog = NoEncontradoSimple() |
| 330 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 333 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 331 | 334 | ||
| 332 | btnBorrarInv.setOnClickListener { | 335 | btnBorrarInv.setOnClickListener { |
| 333 | AlertDialog.Builder(requireContext()).setTitle("Eliminación de Inventarios").setMessage("¿Confirma que desea eliminar el inventario?") | 336 | AlertDialog.Builder(requireContext()).setTitle("Eliminación de Inventarios").setMessage("¿Confirma que desea eliminar el inventario?") |
| 334 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | 337 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> |
| 335 | borrarInvActual() | 338 | borrarInvActual() |
| 336 | Toast.makeText(requireContext(), "El inventario $(inventarioViewModel as InventarioViewModel).InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | 339 | Toast.makeText(requireContext(), "El inventario $(inventarioViewModel as InventarioViewModel).InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() |
| 337 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 340 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
| 338 | (inventarioViewModel as InventarioViewModel).InventarioNuevo = 0 | 341 | (inventarioViewModel as InventarioViewModel).InventarioNuevo = 0 |
| 339 | 342 | ||
| 340 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> | 343 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> |
| 341 | //botón cancel pulsado | 344 | //botón cancel pulsado |
| 342 | }).show() | 345 | }).show() |
| 343 | } | 346 | } |
| 344 | 347 | ||
| 345 | btnExportarInv.setOnClickListener { | 348 | btnExportarInv.setOnClickListener { |
| 346 | AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar) | 349 | AlertDialog.Builder(requireContext()).setTitle(R.string.sTituloExportar).setMessage(R.string.sMensajeExportar) |
| 347 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> | 350 | .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, which -> |
| 348 | exportarInventario(InventarioNuevo) | 351 | if (preparaInvParaExportar((inventarioViewModel as InventarioViewModel).InventarioNuevo )) { |
| 349 | borrarInvActual() | 352 | borrarInvActual() |
| 350 | Toast.makeText(requireContext(), "El inventario $(inventarioViewModel as InventarioViewModel).InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | 353 | 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) | 354 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
| 352 | (inventarioViewModel as InventarioViewModel).InventarioNuevo = 0 | 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 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> }).show() | 361 | }).setNegativeButton(R.string.btnCancelar, DialogInterface.OnClickListener { dialog, which -> }).show() |
| 355 | } | 362 | } |
| 356 | ivCamara.setOnClickListener { | 363 | ivCamara.setOnClickListener { |
| 357 | if (!bFirst) { | 364 | if (!bFirst) { |
| 358 | iEstado = 1 | 365 | iEstado = 1 |
| 359 | bFirst = true | 366 | bFirst = true |
| 360 | } | 367 | } |
| 361 | 368 | ||
| 362 | when (iEstado) { | 369 | when (iEstado) { |
| 363 | 0 -> { | 370 | 0 -> { |
| 364 | ivCamara.setImageResource(R.drawable.codbar) | 371 | ivCamara.setImageResource(R.drawable.codbar) |
| 365 | etCodigoBarras.hint = "Busqueda por Código de Barras" | 372 | etCodigoBarras.hint = "Busqueda por Código de Barras" |
| 366 | swSumaUno.visibility = View.VISIBLE | 373 | swSumaUno.visibility = View.VISIBLE |
| 367 | iBusquedaPor = 0 | 374 | iBusquedaPor = 0 |
| 368 | iEstado = 1 | 375 | iEstado = 1 |
| 369 | } | 376 | } |
| 370 | 1 -> { | 377 | 1 -> { |
| 371 | ivCamara.setImageResource(R.drawable.desc) | 378 | ivCamara.setImageResource(R.drawable.desc) |
| 372 | etCodigoBarras.hint = "Busqueda por Descripción" | 379 | etCodigoBarras.hint = "Busqueda por Descripción" |
| 373 | swSumaUno.visibility = View.GONE | 380 | swSumaUno.visibility = View.GONE |
| 374 | iBusquedaPor = 1 | 381 | iBusquedaPor = 1 |
| 375 | iEstado = 2 | 382 | iEstado = 2 |
| 376 | } | 383 | } |
| 377 | 2 -> { | 384 | 2 -> { |
| 378 | ivCamara.setImageResource(R.drawable.cod_origen) | 385 | ivCamara.setImageResource(R.drawable.cod_origen) |
| 379 | etCodigoBarras.hint = "Busqueda por Código de Origen" | 386 | etCodigoBarras.hint = "Busqueda por Código de Origen" |
| 380 | swSumaUno.visibility = View.GONE | 387 | swSumaUno.visibility = View.GONE |
| 381 | iBusquedaPor = 2 | 388 | iBusquedaPor = 2 |
| 382 | iEstado = 0 | 389 | iEstado = 0 |
| 383 | } | 390 | } |
| 384 | } | 391 | } |
| 385 | } | 392 | } |
| 386 | } | 393 | } |
| 387 | 394 | ||
| 388 | private fun exportarInventario(inventario: Int) { | 395 | private fun preparaInvParaExportar(inventario: Int): Boolean { |
| 389 | GlobalScope.launch(Dispatchers.Main) { | 396 | var bExporto = false |
| 390 | val aEnviar: MutableList<InvToSend>?=null | 397 | GlobalScope.launch(Main) { |
| 398 | val aEnviar: ArrayList<InvToSend>? = arrayListOf<InvToSend>() | ||
| 391 | val datosCabecera = foundInvHeadDB(inventario) | 399 | val datosCabecera = foundInvHeadDB(inventario) |
| 392 | val datosCuerpo=foundInvBodyBD(inventario) | 400 | val datosCuerpo = foundInvBodyBD(inventario) |
| 393 | 401 | ||
| 394 | for (cuerpo in datosCuerpo){ | 402 | for (cuerpo in datosCuerpo) { |
| 395 | val temp=InvToSend( | 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) |
| 396 | datosCabecera.fechaInicio, | 404 | aEnviar!!.add(temp) |
| 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) | ||
| 406 | } | 405 | } |
| 407 | exportarInventario(aEnviar!!) | 406 | // exportarInventario(aEnviar!!) |
| 407 | bExporto = true | ||
| 408 | } | 408 | } |
| 409 | 409 | return bExporto | |
| 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 | |||
| 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 | private suspend fun foundInvHeadDB(inv: Int): InvHead { | 434 | private suspend fun foundInvHeadDB(inv: Int): InvHead { |
| 433 | var busqueda: InvHead | 435 | var busqueda: InvHead |
| 434 | return GlobalScope.async(IO) { | 436 | return GlobalScope.async(IO) { |
| 435 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.foundInvHead(inv) | 437 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.foundInvHead(inv) |
| 436 | return@async busqueda | 438 | return@async busqueda |
| 437 | }.await() | 439 | }.await() |
| 438 | } | 440 | } |
| 439 | 441 | ||
| 440 | private suspend fun foundInvBodyBD(inv: Int): List<InvBody> { | 442 | private suspend fun foundInvBodyBD(inv: Int): List<InvBody> { |
| 441 | var busqueda: List<InvBody> | 443 | var busqueda: List<InvBody> |
| 442 | return GlobalScope.async(IO) { | 444 | return GlobalScope.async(IO) { |
| 443 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchAllInvBody(inv) | 445 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchAllInvBody(inv) |
| 444 | return@async busqueda | 446 | return@async busqueda |
| 445 | }.await() | 447 | }.await() |
| 446 | } | 448 | } |
| 447 | 449 | ||
| 448 | private fun borrarInvActual() { | 450 | private fun borrarInvActual() { |
| 449 | lifecycleScope.launch { | 451 | lifecycleScope.launch { |
| 450 | withContext(Dispatchers.IO) { | 452 | withContext(Dispatchers.IO) { |
| 451 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead((inventarioViewModel as InventarioViewModel).InventarioNuevo) | 453 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead((inventarioViewModel as InventarioViewModel).InventarioNuevo) |
| 452 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody((inventarioViewModel as InventarioViewModel).InventarioNuevo) | 454 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody((inventarioViewModel as InventarioViewModel).InventarioNuevo) |
| 453 | } | 455 | } |
| 454 | } | 456 | } |
| 455 | } | 457 | } |
| 456 | 458 | ||
| 457 | private fun cargarDeBdInventario(ultimoInv: Int) { | 459 | private fun cargarDeBdInventario(ultimoInv: Int) { |
| 458 | GlobalScope.launch(Dispatchers.Main) { | 460 | GlobalScope.launch(Main) { |
| 459 | val invbody = cargarInventario(ultimoInv) | 461 | val invbody = cargarInventario(ultimoInv) |
| 460 | for ((i, _) in invbody!!.withIndex()) { | 462 | for ((i, _) in invbody!!.withIndex()) { |
| 461 | val art = Articles( | 463 | val art = Articles( |
| 462 | invbody[i].sector, | 464 | invbody[i].sector, |
| 463 | invbody[i].codigo, | 465 | invbody[i].codigo, |
| 464 | invbody[i].descripcion, | 466 | invbody[i].descripcion, |
| 465 | invbody[i].codBar, | 467 | invbody[i].codBar, |
| 466 | invbody[i].codOrigen, | 468 | invbody[i].codOrigen, |
| 467 | invbody[i].precio, | 469 | invbody[i].precio, |
| 468 | invbody[i].costo, | 470 | invbody[i].costo, |
| 469 | "", | 471 | "", |
| 470 | "", | 472 | "", |
| 471 | "", | 473 | "", |
| 472 | invbody[i].balanza, | 474 | invbody[i].balanza, |
| 473 | invbody[i].depSn, | 475 | invbody[i].depSn, |
| 474 | invbody[i].costo) | 476 | invbody[i].costo |
| 477 | ) | ||
| 475 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) | 478 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) |
| 476 | } | 479 | } |
| 477 | } | 480 | } |
| 478 | } | 481 | } |
| 479 | 482 | ||
| 480 | private fun continuarCargaCodigoOri(artAcargar: List<Articles>) { | 483 | private fun continuarCargaCodigoOri(artAcargar: List<Articles>) { |
| 481 | 484 | ||
| 482 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | 485 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD |
| 483 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 486 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
| 484 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 487 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 485 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 488 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 486 | 489 | ||
| 487 | var bundle = Bundle() | 490 | var bundle = Bundle() |
| 488 | bundle = bundleOf("ArrayDesc" to artAcargar) | 491 | bundle = bundleOf("ArrayDesc" to artAcargar) |
| 489 | bundle.putInt("numeroInv", (inventarioViewModel as InventarioViewModel).InventarioNuevo) | 492 | bundle.putInt("numeroInv", (inventarioViewModel as InventarioViewModel).InventarioNuevo) |
| 490 | navController.navigate(R.id.action_inventarioFragment_to_codigoOriFragment, bundle) | 493 | navController.navigate(R.id.action_inventarioFragment_to_codigoOriFragment, bundle) |
| 491 | 494 | ||
| 492 | } else {//TODO si no lo encuentra en la BD | 495 | } else {//TODO si no lo encuentra en la BD |
| 493 | val modalDialog = NoEncontradoSimple() | 496 | val modalDialog = NoEncontradoSimple() |
| 494 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 497 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 495 | } | 498 | } |
| 496 | etCodigoBarras.focusable = View.FOCUSABLE | 499 | etCodigoBarras.focusable = View.FOCUSABLE |
| 497 | etCodigoBarras.setText("") | 500 | etCodigoBarras.setText("") |
| 498 | etCodigoBarras.selectAll() | 501 | etCodigoBarras.selectAll() |
| 499 | } | 502 | } |
| 500 | 503 | ||
| 501 | private fun continuarCargaDesc(artAcargar: ArrayList<Articles>) { | 504 | private fun continuarCargaDesc(artAcargar: ArrayList<Articles>) { |
| 502 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS | 505 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS |
| 503 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV | 506 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV |
| 504 | 507 | ||
| 505 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | 508 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD |
| 506 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 509 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
| 507 | // fCant = 0F | 510 | // fCant = 0F |
| 508 | // fCant += 1F | 511 | // fCant += 1F |
| 509 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 512 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
| 510 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 513 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
| 511 | // artAcargar[0].codigo, | 514 | // artAcargar[0].codigo, |
| 512 | // artAcargar[0].descripcion, | 515 | // artAcargar[0].descripcion, |
| 513 | // artAcargar[0].codBar, | 516 | // artAcargar[0].codBar, |
| 514 | // artAcargar[0].codOrigen, | 517 | // artAcargar[0].codOrigen, |
| 515 | // artAcargar[0].precio, | 518 | // artAcargar[0].precio, |
| 516 | // artAcargar[0].costo, | 519 | // artAcargar[0].costo, |
| 517 | // "", | 520 | // "", |
| 518 | // "", | 521 | // "", |
| 519 | // "", | 522 | // "", |
| 520 | // artAcargar[0].balanza, | 523 | // artAcargar[0].balanza, |
| 521 | // artAcargar[0].depSn, | 524 | // artAcargar[0].depSn, |
| 522 | // "") | 525 | // "") |
| 523 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 526 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
| 524 | // cargarArtEnBd(acargarPorDesc, fCant) | 527 | // cargarArtEnBd(acargarPorDesc, fCant) |
| 525 | // cargarRecicler(acargarPorDesc, fCant) | 528 | // cargarRecicler(acargarPorDesc, fCant) |
| 526 | // } else { | 529 | // } else { |
| 527 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER | 530 | // TODO: ESCONDE EL TECLADO VIRTUAL AL PRESIONAR ENTER |
| 528 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? | 531 | val imm = requireActivity().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager? |
| 529 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) | 532 | imm!!.hideSoftInputFromWindow(requireActivity().currentFocus?.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) |
| 530 | var bundle = Bundle() | 533 | var bundle = Bundle() |
| 531 | bundle = bundleOf("ArrayDesc" to artAcargar) | 534 | bundle = bundleOf("ArrayDesc" to artAcargar) |
| 532 | bundle.putInt("numeroInv", (inventarioViewModel as InventarioViewModel).InventarioNuevo) | 535 | bundle.putInt("numeroInv", (inventarioViewModel as InventarioViewModel).InventarioNuevo) |
| 533 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 536 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
| 534 | //navController.backStack.removeLast() | 537 | //navController.backStack.removeLast() |
| 535 | // } | 538 | // } |
| 536 | // } else {//SI NO ESTA +1 | 539 | // } else {//SI NO ESTA +1 |
| 537 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 540 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
| 538 | // fCant = listArticulos[0].cantTomada | 541 | // fCant = listArticulos[0].cantTomada |
| 539 | // MaterialDialog(requireContext()).show { | 542 | // MaterialDialog(requireContext()).show { |
| 540 | // title(R.string.sTituloNueva) | 543 | // title(R.string.sTituloNueva) |
| 541 | // message(R.string.sCantidadNueva) | 544 | // message(R.string.sCantidadNueva) |
| 542 | // input { materialDialog, charSequence -> | 545 | // input { materialDialog, charSequence -> |
| 543 | // fCant = 0F | 546 | // fCant = 0F |
| 544 | // fCant = charSequence.toString().toFloat() | 547 | // fCant = charSequence.toString().toFloat() |
| 545 | // } | 548 | // } |
| 546 | // positiveButton(R.string.btnOk) { | 549 | // positiveButton(R.string.btnOk) { |
| 547 | // listArticulos[0].cantTomada = fCant | 550 | // listArticulos[0].cantTomada = fCant |
| 548 | // viewAdapter.notifyDataSetChanged() | 551 | // viewAdapter.notifyDataSetChanged() |
| 549 | // dismiss() | 552 | // dismiss() |
| 550 | // } | 553 | // } |
| 551 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 554 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
| 552 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 555 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
| 553 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 556 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
| 554 | // artAcargar[0].codigo, | 557 | // artAcargar[0].codigo, |
| 555 | // artAcargar[0].descripcion, | 558 | // artAcargar[0].descripcion, |
| 556 | // artAcargar[0].codBar, | 559 | // artAcargar[0].codBar, |
| 557 | // artAcargar[0].cod_origen, | 560 | // artAcargar[0].cod_origen, |
| 558 | // artAcargar[0].precio, | 561 | // artAcargar[0].precio, |
| 559 | // artAcargar[0].costo, | 562 | // artAcargar[0].costo, |
| 560 | // artAcargar[0].balanza, | 563 | // artAcargar[0].balanza, |
| 561 | // artAcargar[0].depSn, | 564 | // artAcargar[0].depSn, |
| 562 | // "") | 565 | // "") |
| 563 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 566 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
| 564 | // cargarArtEnBd(acargarPorDesc, fCant) | 567 | // cargarArtEnBd(acargarPorDesc, fCant) |
| 565 | // cargarRecicler(acargarPorDesc, fCant) | 568 | // cargarRecicler(acargarPorDesc, fCant) |
| 566 | // } else { | 569 | // } else { |
| 567 | // var bundle = Bundle() | 570 | // var bundle = Bundle() |
| 568 | // bundle = bundleOf("ArrayDesc" to artAcargar) | 571 | // bundle = bundleOf("ArrayDesc" to artAcargar) |
| 569 | // bundle.putInt("numeroInv", (inventarioViewModel as InventarioViewModel).InventarioNuevo) | 572 | // bundle.putInt("numeroInv", (inventarioViewModel as InventarioViewModel).InventarioNuevo) |
| 570 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 573 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
| 571 | // } | 574 | // } |
| 572 | // } | 575 | // } |
| 573 | } else {//TODO si no lo encuentra en la BD | 576 | } else {//TODO si no lo encuentra en la BD |
| 574 | val modalDialog = NoEncontradoSimple() | 577 | val modalDialog = NoEncontradoSimple() |
| 575 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 578 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 576 | } | 579 | } |
| 577 | etCodigoBarras.focusable = View.FOCUSABLE | 580 | etCodigoBarras.focusable = View.FOCUSABLE |
| 578 | etCodigoBarras.setText("") | 581 | etCodigoBarras.setText("") |
| 579 | etCodigoBarras.selectAll() | 582 | etCodigoBarras.selectAll() |
| 580 | } | 583 | } |
| 581 | 584 | ||
| 582 | private fun continuarCargaCB(artAcargar: Articles?) { | 585 | private fun continuarCargaCB(artAcargar: Articles?) { |
| 583 | 586 | ||
| 584 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD | 587 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD |
| 585 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 | 588 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 |
| 586 | fCant = 0F | 589 | fCant = 0F |
| 587 | fCant += 1F | 590 | fCant += 1F |
| 588 | cargarArtEnBd(artAcargar, String.format("%.3f", fCant)) | 591 | cargarArtEnBd(artAcargar, String.format("%.3f", fCant)) |
| 589 | cargarRecicler(artAcargar, fCant) | 592 | cargarRecicler(artAcargar, fCant) |
| 590 | } else {//TODO: SI NO ESTA +1 PREGUNTA CANTIDAD | 593 | } else {//TODO: SI NO ESTA +1 PREGUNTA CANTIDAD |
| 591 | 594 | ||
| 592 | dialogingresarCantidad(requireContext(), artAcargar) | 595 | dialogingresarCantidad(requireContext(), artAcargar) |
| 593 | 596 | ||
| 594 | } | 597 | } |
| 595 | } else {// TODO si no lo encuentra en la BD | 598 | } else {// TODO si no lo encuentra en la BD |
| 596 | val modalDialog = NoEncontradoSimple() | 599 | val modalDialog = NoEncontradoSimple() |
| 597 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 600 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 598 | } | 601 | } |
| 599 | etCodigoBarras.focusable = View.FOCUSABLE | 602 | etCodigoBarras.focusable = View.FOCUSABLE |
| 600 | etCodigoBarras.setText("") | 603 | etCodigoBarras.setText("") |
| 601 | etCodigoBarras.selectAll() | 604 | etCodigoBarras.selectAll() |
| 602 | } | 605 | } |
| 603 | 606 | ||
| 604 | fun dialogingresarCantidad(cnxt: Context, artAcargar: Articles?): Float { | 607 | fun dialogingresarCantidad(cnxt: Context, artAcargar: Articles?): Float { |
| 605 | var cantidad = 0F | 608 | var cantidad = 0F |
| 606 | val mDialogView = LayoutInflater.from(cnxt).inflate(R.layout.ingresar_cantidad, null) | 609 | val mDialogView = LayoutInflater.from(cnxt).inflate(R.layout.ingresar_cantidad, null) |
| 607 | val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView).setCancelable(false) | 610 | val mBuilder = AlertDialog.Builder(cnxt).setView(mDialogView).setCancelable(false) |
| 608 | if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER | 611 | if (artAcargar!!.balanza!!.toInt() == 1 || artAcargar.balanza!!.toInt() == 3 || artAcargar.balanza!!.toInt() == 7) mDialogView.etCantidad.inputType = TYPE_CLASS_NUMBER |
| 609 | mDialogView.tvTitulo.text = artAcargar.descripcion.toString() | 612 | mDialogView.tvTitulo.text = artAcargar.descripcion.toString() |
| 610 | val mAlertDialog = mBuilder.show() | 613 | val mAlertDialog = mBuilder.show() |
| 611 | 614 | ||
| 612 | mDialogView.etCantidad.requestFocus() | 615 | mDialogView.etCantidad.requestFocus() |
| 613 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 616 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 614 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 617 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 615 | 618 | ||
| 616 | mDialogView.btnAceptar.setOnClickListener { | 619 | mDialogView.btnAceptar.setOnClickListener { |
| 617 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { | 620 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 618 | mDialogView.etCantidad.error = "No vacio" | 621 | mDialogView.etCantidad.error = "No vacio" |
| 619 | mDialogView.etCantidad.requestFocus() | 622 | mDialogView.etCantidad.requestFocus() |
| 620 | mDialogView.etCantidad.hint = "Ingrese un valor" | 623 | mDialogView.etCantidad.hint = "Ingrese un valor" |
| 621 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | 624 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { |
| 622 | mAlertDialog.dismiss() | 625 | mAlertDialog.dismiss() |
| 623 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | 626 | cantidad = mDialogView.etCantidad.text.toString().toFloat() |
| 624 | cargarArtEnBd(artAcargar, String.format("%.2f", cantidad)) | 627 | cargarArtEnBd(artAcargar, String.format("%.2f", cantidad)) |
| 625 | cargarRecicler(artAcargar, cantidad) | 628 | cargarRecicler(artAcargar, cantidad) |
| 626 | modificarCantidadEnCabecera((inventarioViewModel as InventarioViewModel).InventarioNuevo, true, requireContext()) | 629 | modificarCantidadEnCabecera((inventarioViewModel as InventarioViewModel).InventarioNuevo, true, requireContext()) |
| 627 | } | 630 | } |
| 628 | } | 631 | } |
| 629 | return cantidad | 632 | return cantidad |
| 630 | } | 633 | } |
| 631 | 634 | ||
| 632 | fun dialogoSumaResta(context: Context, indiceDelArtEncontrado: Int, univta: String, cancelable: Boolean) { | 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 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(cancelable) | 638 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(cancelable) |
| 636 | // TODO: SI PERMITE QUE INGRESE DECIMALES | 639 | // TODO: SI PERMITE QUE INGRESE DECIMALES |
| 637 | if (univta.contains("1") || univta.contains("3") || univta.contains("7")) mDialogView.tvNuevaCantidad.inputType = TYPE_CLASS_NUMBER | 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 | mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada) | 642 | mDialogView.tvCantInicial.text = String.format("%.2f", listArticulos[indiceDelArtEncontrado].cantTomada) |
| 640 | val mAlertDialog = mBuilder.show() | 643 | val mAlertDialog = mBuilder.show() |
| 641 | mDialogView.tvNuevaCantidad.requestFocus() | 644 | mDialogView.tvNuevaCantidad.requestFocus() |
| 642 | 645 | ||
| 643 | 646 | ||
| 644 | 647 | ||
| 645 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) | 648 | mAlertDialog?.window!!.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) |
| 646 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | 649 | mAlertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
| 647 | 650 | ||
| 648 | mDialogView.tvNuevaCantidad.addTextChangedListener(textWatcher) | 651 | mDialogView.tvNuevaCantidad.addTextChangedListener(textWatcher) |
| 649 | 652 | ||
| 650 | mDialogView.rbSumar.setOnClickListener { | 653 | mDialogView.rbSumar.setOnClickListener { |
| 651 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 654 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 652 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 655 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
| 653 | // mDialogView.tvNuevaCantidad.isEnabled = false | 656 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 654 | } | 657 | } |
| 655 | } | 658 | } |
| 656 | mDialogView.rbRestar.setOnClickListener { | 659 | mDialogView.rbRestar.setOnClickListener { |
| 657 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 660 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 658 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 661 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
| 659 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 662 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
| 660 | // mDialogView.tvNuevaCantidad.isEnabled = false | 663 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 661 | } else { | 664 | } else { |
| 662 | mDialogView.tvResultado.text = "" | 665 | mDialogView.tvResultado.text = "" |
| 663 | mDialogView.tvResultado.error = "Operación No Valida" | 666 | mDialogView.tvResultado.error = "Operación No Valida" |
| 664 | mDialogView.tvResultado.requestFocus() | 667 | mDialogView.tvResultado.requestFocus() |
| 665 | mDialogView.tvResultado.hint = "Error" | 668 | mDialogView.tvResultado.hint = "Error" |
| 666 | } | 669 | } |
| 667 | } | 670 | } |
| 668 | } | 671 | } |
| 669 | mDialogView.rbMdodificar.setOnClickListener { | 672 | mDialogView.rbMdodificar.setOnClickListener { |
| 670 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 673 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 671 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) | 674 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
| 672 | // mDialogView.tvNuevaCantidad.isEnabled = false | 675 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 673 | } | 676 | } |
| 674 | } | 677 | } |
| 675 | mDialogView.btnAceptar.setOnClickListener { | 678 | mDialogView.btnAceptar.setOnClickListener { |
| 676 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { | 679 | if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || !mDialogView.tvNuevaCantidad.text.isBlank()) { |
| 677 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { | 680 | if (mDialogView.tvResultado.text.isNotEmpty() || !mDialogView.tvResultado.text.isBlank()) { |
| 678 | mAlertDialog.dismiss() | 681 | mAlertDialog.dismiss() |
| 679 | listArticulos[indiceDelArtEncontrado].cantTomada = String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() | 682 | listArticulos[indiceDelArtEncontrado].cantTomada = String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() |
| 680 | updateCantidad( | 683 | updateCantidad( |
| 681 | listArticulos[indiceDelArtEncontrado].sector.toString(), | 684 | listArticulos[indiceDelArtEncontrado].sector.toString(), |
| 682 | listArticulos[indiceDelArtEncontrado].codigo.toString(), | 685 | listArticulos[indiceDelArtEncontrado].codigo.toString(), |
| 683 | String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() | 686 | String.format("%.2f", mDialogView.tvResultado.text.toString().toFloat()).toFloat() |
| 684 | ) | 687 | ) |
| 685 | 688 | ||
| 686 | viewAdapter.notifyDataSetChanged() | 689 | viewAdapter.notifyDataSetChanged() |
| 687 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 690 | } else if (mDialogView.tvNuevaCantidad.text.isNotEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { |
| 688 | mDialogView.tvResultado.error = "Operación Requerida" | 691 | mDialogView.tvResultado.error = "Operación Requerida" |
| 689 | mDialogView.tvResultado.requestFocus() | 692 | mDialogView.tvResultado.requestFocus() |
| 690 | mDialogView.tvResultado.hint = "Seleccione Operación" | 693 | mDialogView.tvResultado.hint = "Seleccione Operación" |
| 691 | } | 694 | } |
| 692 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { | 695 | } else if (mDialogView.tvNuevaCantidad.text.isEmpty() || mDialogView.tvNuevaCantidad.text.isBlank()) { |
| 693 | mDialogView.tvNuevaCantidad.error = "Completar" | 696 | mDialogView.tvNuevaCantidad.error = "Completar" |
| 694 | mDialogView.tvNuevaCantidad.requestFocus() | 697 | mDialogView.tvNuevaCantidad.requestFocus() |
| 695 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | 698 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" |
| 696 | } | 699 | } |
| 697 | } | 700 | } |
| 698 | mDialogView.dialogCancelBtn.setOnClickListener { | 701 | mDialogView.dialogCancelBtn.setOnClickListener { |
| 699 | mAlertDialog.dismiss() | 702 | mAlertDialog.dismiss() |
| 700 | } | 703 | } |
| 701 | } | 704 | } |
| 702 | 705 | ||
| 703 | suspend fun buscarCodiogoOriEnBD(CodOri: String): List<Articles> { | 706 | suspend fun buscarCodiogoOriEnBD(CodOri: String): List<Articles> { |
| 704 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 707 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 705 | var busqueda: List<Articles> | 708 | var busqueda: List<Articles> |
| 706 | return GlobalScope.async(IO) { | 709 | return GlobalScope.async(IO) { |
| 707 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodOri(CodOri, SerchAreaInventario()) | 710 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodOri(CodOri, SerchAreaInventario()) |
| 708 | return@async busqueda | 711 | return@async busqueda |
| 709 | }.await() | 712 | }.await() |
| 710 | } | 713 | } |
| 711 | 714 | ||
| 712 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { | 715 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { |
| 713 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 716 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
| 714 | var busqueda: Articles? = null | 717 | var busqueda: Articles? = null |
| 715 | return GlobalScope.async(IO) { | 718 | return GlobalScope.async(IO) { |
| 716 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, SerchAreaInventario()) | 719 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, SerchAreaInventario()) |
| 717 | return@async busqueda | 720 | return@async busqueda |
| 718 | }.await() | 721 | }.await() |
| 719 | } | 722 | } |
| 720 | 723 | ||
| 721 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { | 724 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { |
| 722 | //TODO BUSQUEDA POR DESCRIPCION | 725 | //TODO BUSQUEDA POR DESCRIPCION |
| 723 | var busqueda: List<Articles>? = null | 726 | var busqueda: List<Articles>? = null |
| 724 | return GlobalScope.async(IO) { | 727 | return GlobalScope.async(IO) { |
| 725 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, SerchAreaInventario()) | 728 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, SerchAreaInventario()) |
| 726 | return@async busqueda | 729 | return@async busqueda |
| 727 | }.await() | 730 | }.await() |
| 728 | } | 731 | } |
| 729 | 732 | ||
| 730 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { | 733 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { |
| 731 | //TODO BUSQUEDA POR DESCRIPCION | 734 | //TODO BUSQUEDA POR DESCRIPCION |
| 732 | var result: Int | 735 | var result: Int |
| 733 | return GlobalScope.async(IO) { | 736 | return GlobalScope.async(IO) { |
| 734 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector.toLong(), codigo.toLong(), inventario.toInt()) | 737 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector.toLong(), codigo.toLong(), inventario.toInt()) |
| 735 | return@async result | 738 | return@async result |
| 736 | }.await() | 739 | }.await() |
| 737 | } | 740 | } |
| 738 | 741 | ||
| 739 | private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | 742 | private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { |
| 740 | return GlobalScope.async(IO) { | 743 | return GlobalScope.async(IO) { |
| 741 | var indice = 0 | 744 | var indice = 0 |
| 742 | var bEncontrado = false | 745 | var bEncontrado = false |
| 743 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | 746 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS |
| 744 | // TODO CAMBIO DE CB A CODIGO DEBO | 747 | // TODO CAMBIO DE CB A CODIGO DEBO |
| 745 | val any = cambioCBporCodigoDebo(codigoBarras) | 748 | val any = cambioCBporCodigoDebo(codigoBarras) |
| 746 | if (any != null) { | 749 | if (any != null) { |
| 747 | for (item in listArticulos) { | 750 | for (item in listArticulos) { |
| 748 | if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { | 751 | if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { |
| 749 | bEncontrado = true | 752 | bEncontrado = true |
| 750 | break | 753 | break |
| 751 | } | 754 | } |
| 752 | indice += 1 | 755 | indice += 1 |
| 753 | } | 756 | } |
| 754 | } | 757 | } |
| 755 | 758 | ||
| 756 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | 759 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION |
| 757 | for (item in listArticulos) { | 760 | for (item in listArticulos) { |
| 758 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 761 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
| 759 | bEncontrado = true | 762 | bEncontrado = true |
| 760 | break | 763 | break |
| 761 | } | 764 | } |
| 762 | indice += 1 | 765 | indice += 1 |
| 763 | } | 766 | } |
| 764 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | 767 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN |
| 765 | for (item in listArticulos) { | 768 | for (item in listArticulos) { |
| 766 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 769 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
| 767 | bEncontrado = true | 770 | bEncontrado = true |
| 768 | break | 771 | break |
| 769 | } | 772 | } |
| 770 | indice += 1 | 773 | indice += 1 |
| 771 | } | 774 | } |
| 772 | } | 775 | } |
| 773 | return@async if (bEncontrado) indice else -1 | 776 | return@async if (bEncontrado) indice else -1 |
| 774 | }.await() | 777 | }.await() |
| 775 | } | 778 | } |
| 776 | 779 | ||
| 777 | suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { | 780 | suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { |
| 778 | //TODO BUSQUEDA POR DESCRIPCION | 781 | //TODO BUSQUEDA POR DESCRIPCION |
| 779 | var busqueda: Articles? = null | 782 | var busqueda: Articles? = null |
| 780 | return GlobalScope.async(IO) { | 783 | return GlobalScope.async(IO) { |
| 781 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchAreaInventario()) | 784 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, SerchAreaInventario()) |
| 782 | return@async busqueda | 785 | return@async busqueda |
| 783 | }.await() | 786 | }.await() |
| 784 | } | 787 | } |
| 785 | 788 | ||
| 786 | private fun cargarArtEnBd(articulos: Articles, cant: String) { | 789 | private fun cargarArtEnBd(articulos: Articles, cant: String) { |
| 787 | val body = InvBody( | 790 | val body = InvBody( |
| 788 | (inventarioViewModel as InventarioViewModel).InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD | 791 | (inventarioViewModel as InventarioViewModel).InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD |
| 789 | articulos.sector, | 792 | articulos.sector, |
| 790 | articulos.codigo, | 793 | articulos.codigo, |
| 791 | articulos.descripcion, | 794 | articulos.descripcion, |
| 792 | cant, | 795 | cant, |
| 793 | articulos.codBar, | 796 | articulos.codBar, |
| 794 | articulos.codOrigen, | 797 | articulos.codOrigen, |
| 795 | articulos.precio, | 798 | articulos.precio, |
| 796 | articulos.precio, | 799 | articulos.precio, |
| 797 | articulos.balanza, | 800 | articulos.balanza, |
| 798 | articulos.depSn, | 801 | articulos.depSn, |
| 799 | ObtenerFechaActual(), | 802 | obtenerFechaActual(), |
| 800 | ObtenerFechaActual() | 803 | obtenerFechaActual() |
| 801 | ) | 804 | ) |
| 802 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS | 805 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS |
| 803 | } | 806 | } |
| 804 | 807 | ||
| 805 | fun cargarRecicler(articulos: Articles, cant: Float) { | 808 | fun cargarRecicler(articulos: Articles, cant: Float) { |
| 806 | //TODO CARGO EN LE RV | 809 | //TODO CARGO EN LE RV |
| 807 | val item = ItemsRecycler( | 810 | val item = ItemsRecycler( |
| 808 | if (articulos.sector.toString().toInt() < 9) "0${articulos.sector.toString()}" else articulos.sector.toString(), | 811 | if (articulos.sector.toString().toInt() < 9) "0${articulos.sector.toString()}" else articulos.sector.toString(), |
| 809 | articulos.codigo, | 812 | articulos.codigo, |
| 810 | articulos.descripcion, | 813 | articulos.descripcion, |
| 811 | cant, | 814 | cant, |
| 812 | articulos.codBar, | 815 | articulos.codBar, |
| 813 | articulos.codOrigen, | 816 | articulos.codOrigen, |
| 814 | articulos.balanza.toString(), | 817 | articulos.balanza.toString(), |
| 815 | articulos.de.toString() | 818 | articulos.de.toString() |
| 816 | ) | 819 | ) |
| 817 | listArticulos.add(item) | 820 | listArticulos.add(item) |
| 818 | 821 | ||
| 819 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) | 822 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) |
| 820 | viewManager = LinearLayoutManager(requireContext()) | 823 | viewManager = LinearLayoutManager(requireContext()) |
| 821 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 824 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
| 822 | rcInventarios.apply { | 825 | rcInventarios.apply { |
| 823 | adapter = viewAdapter | 826 | adapter = viewAdapter |
| 824 | layoutManager = viewManager | 827 | layoutManager = viewManager |
| 825 | } | 828 | } |
| 826 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 829 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
| 827 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 830 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
| 828 | return false | 831 | return false |
| 829 | } | 832 | } |
| 830 | 833 | ||
| 831 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | 834 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
| 832 | 835 | ||
| 833 | GlobalScope.launch(Dispatchers.Main) { | 836 | GlobalScope.launch(Dispatchers.Main) { |
| 834 | borrarArticulo( | 837 | borrarArticulo( |
| 835 | listArticulos[viewHolder.adapterPosition].sector.toString(), | 838 | listArticulos[viewHolder.adapterPosition].sector.toString(), |
| 836 | listArticulos[viewHolder.adapterPosition].codigo.toString(), | 839 | listArticulos[viewHolder.adapterPosition].codigo.toString(), |
| 837 | (inventarioViewModel as InventarioViewModel).InventarioNuevo.toString() | 840 | (inventarioViewModel as InventarioViewModel).InventarioNuevo.toString() |
| 838 | ) | 841 | ) |
| 839 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | 842 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) |
| 840 | viewAdapter.notifyDataSetChanged() | 843 | viewAdapter.notifyDataSetChanged() |
| 841 | modificarCantidadEnCabecera((inventarioViewModel as InventarioViewModel).InventarioNuevo, false, requireContext()) | 844 | modificarCantidadEnCabecera((inventarioViewModel as InventarioViewModel).InventarioNuevo, false, requireContext()) |
| 842 | } | 845 | } |
| 843 | } | 846 | } |
| 844 | 847 | ||
| 845 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 848 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
| 846 | val itemView = viewHolder.itemView | 849 | val itemView = viewHolder.itemView |
| 847 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 850 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
| 848 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 851 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
| 849 | 852 | ||
| 850 | if (dX > 0) { | 853 | if (dX > 0) { |
| 851 | 854 | ||
| 852 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 855 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
| 853 | else c.drawColor(Color.RED) | 856 | else c.drawColor(Color.RED) |
| 854 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 857 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
| 855 | } else { | 858 | } else { |
| 856 | } | 859 | } |
| 857 | 860 | ||
| 858 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 861 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
| 859 | deleteIcon.draw(c) | 862 | deleteIcon.draw(c) |
| 860 | } | 863 | } |
| 861 | } | 864 | } |
| 862 | 865 | ||
| 863 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 866 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
| 864 | itemTouchHelper.attachToRecyclerView(rcInventarios) | 867 | itemTouchHelper.attachToRecyclerView(rcInventarios) |
| 865 | } | 868 | } |
| 866 | 869 | ||
| 867 | private fun ProdNoCont(): Int? { | 870 | private fun ProdNoCont(): Int? { |
| 868 | var mostrarStock = 0 | 871 | var mostrarStock = 0 |
| 869 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 | 872 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 |
| 870 | return mostrarStock | 873 | return mostrarStock |
| 871 | } | 874 | } |
| 872 | 875 | ||
| 873 | private fun AjusteProductos(): Int? { | 876 | private fun AjusteProductos(): Int? { |
| 874 | var prodInclu = 0 | 877 | var prodInclu = 0 |
| 875 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 | 878 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 |
| 876 | 879 | ||
| 877 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 | 880 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 |
| 878 | return prodInclu | 881 | return prodInclu |
| 879 | } | 882 | } |
| 880 | 883 | ||
| 881 | private fun SerchArea(): Boolean { | 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 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = true | 886 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = true |
| 884 | return iArea | 887 | return iArea |
| 885 | } | 888 | } |
| 886 | 889 | ||
| 887 | suspend fun SerchAreaInventario(): Boolean { | 890 | suspend fun SerchAreaInventario(): Boolean { |
| 888 | return GlobalScope.async(IO) { | 891 | return GlobalScope.async(IO) { |
| 889 | return@async AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.fetchAreaInvH((inventarioViewModel as InventarioViewModel).InventarioNuevo) | 892 | return@async AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.fetchAreaInvH((inventarioViewModel as InventarioViewModel).InventarioNuevo) |
| 890 | }.await() | 893 | }.await() |
| 891 | 894 | ||
| 892 | } | 895 | } |
| 893 | 896 | ||
| 894 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 897 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
| 895 | lifecycleScope.launch { | 898 | lifecycleScope.launch { |
| 896 | withContext(Dispatchers.IO) { | 899 | withContext(Dispatchers.IO) { |
| 897 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 900 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
| 898 | } | 901 | } |
| 899 | } | 902 | } |
| 900 | } | 903 | } |
| 901 | 904 | ||
| 902 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 905 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
| 903 | lifecycleScope.launch { | 906 | lifecycleScope.launch { |
| 904 | withContext(IO) { | 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 | } |
| 909 | 912 | ||
| 910 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { | 913 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { |
| 911 | return GlobalScope.async(IO) { | 914 | return GlobalScope.async(IO) { |
| 912 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) | 915 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) |
| 913 | }.await() | 916 | }.await() |
| 914 | } | 917 | } |
| 915 | 918 | ||
| 916 | override fun onImageDotsClick(sector: String?, codigo: String?) { | 919 | override fun onImageDotsClick(sector: String?, codigo: String?) { |
| 917 | val bundle = Bundle() | 920 | val bundle = Bundle() |
| 918 | bundle.putString("sector", sector!!.toInt().toString()) | 921 | bundle.putString("sector", sector!!.toInt().toString()) |
| 919 | bundle.putString("codigo", codigo) | 922 | bundle.putString("codigo", codigo) |
| 920 | bundle.putInt("numeroInv", (inventarioViewModel as InventarioViewModel).InventarioNuevo) | 923 | bundle.putInt("numeroInv", (inventarioViewModel as InventarioViewModel).InventarioNuevo) |
| 921 | navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) | 924 | navController.navigate(R.id.action_inventarioFragment_to_detalleArtFragment, bundle) |
| 922 | } | 925 | } |
| 923 | 926 | ||
| 924 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { | 927 | override fun onImagePenClick(sector: String?, codigo: String?, cantidad: String?, position: String) { |
| 925 | dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true) | 928 | dialogoSumaResta(requireContext(), position.toInt(), listArticulos[position.toInt()].univta, true) |
| 926 | } | 929 | } |
| 927 | 930 | ||
| 928 | private val textWatcher = object : TextWatcher { | 931 | private val textWatcher = object : TextWatcher { |
| 929 | override fun afterTextChanged(s: Editable?) {} | 932 | override fun afterTextChanged(s: Editable?) {} |
| 930 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} | 933 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} |
| 931 | 934 | ||
| 932 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { | 935 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { |
| 933 | if(mDialogView.rbSumar.isChecked){ | 936 | if (mDialogView.rbSumar.isChecked) { |
| 934 | // mDialogView.tvNuevaCantidad.isEnabled=false | 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) { | 940 | if (mDialogView.rbRestar.isChecked) { |
| 938 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 941 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
| 939 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 942 | 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()) | 943 | mDialogView.tvResultado.text = String.format("%.2f", mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()) |
| 941 | // mDialogView.tvNuevaCantidad.isEnabled = false | 944 | // mDialogView.tvNuevaCantidad.isEnabled = false |
| 942 | } else { | 945 | } else { |
| 943 | mDialogView.tvResultado.text = "" | 946 | mDialogView.tvResultado.text = "" |
| 944 | mDialogView.tvResultado.error = "Operación No Valida" | 947 | mDialogView.tvResultado.error = "Operación No Valida" |
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 android.widget.CheckBox | 9 | import android.widget.CheckBox |
| 10 | import android.widget.ImageButton | 10 | import android.widget.ImageButton |
| 11 | import android.widget.TextView | 11 | import android.widget.TextView |
| 12 | import androidx.fragment.app.Fragment | 12 | import androidx.fragment.app.Fragment |
| 13 | import androidx.navigation.NavController | 13 | import androidx.navigation.NavController |
| 14 | import androidx.navigation.Navigation | 14 | import androidx.navigation.Navigation |
| 15 | import androidx.recyclerview.widget.LinearLayoutManager | 15 | import androidx.recyclerview.widget.LinearLayoutManager |
| 16 | import androidx.recyclerview.widget.RecyclerView | 16 | import androidx.recyclerview.widget.RecyclerView |
| 17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 18 | import com.focasoftware.deboinventariov20.Model.InvHead | 18 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 19 | import com.focasoftware.deboinventariov20.R | 19 | import com.focasoftware.deboinventariov20.R |
| 20 | import kotlinx.coroutines.Dispatchers | 20 | import kotlinx.coroutines.Dispatchers |
| 21 | import kotlinx.coroutines.GlobalScope | 21 | import kotlinx.coroutines.GlobalScope |
| 22 | import kotlinx.coroutines.async | 22 | import kotlinx.coroutines.async |
| 23 | import kotlinx.coroutines.launch | 23 | import kotlinx.coroutines.launch |
| 24 | import java.time.LocalDateTime | 24 | import java.time.LocalDateTime |
| 25 | import java.util.* | 25 | import java.util.* |
| 26 | 26 | ||
| 27 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { | 27 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { |
| 28 | private lateinit var inventarios: List<InvHead> | 28 | private lateinit var inventarios: List<InvHead> |
| 29 | private lateinit var ordenado: List<InvHead> | 29 | private lateinit var ordenado: List<InvHead> |
| 30 | private lateinit var ordenadoII: List<InvHead> | ||
| 30 | private lateinit var rcInventario: RecyclerView | 31 | private lateinit var rcInventario: RecyclerView |
| 32 | private lateinit var rcInventarioII: RecyclerView | ||
| 31 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 33 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
| 32 | private lateinit var viewManager: RecyclerView.LayoutManager | 34 | private lateinit var viewManager: RecyclerView.LayoutManager |
| 33 | private var listIvn2 = ArrayList<InvHead>() | 35 | private var listIvn2 = ArrayList<InvHead>() |
| 36 | private var listIvn2II = ArrayList<InvHead>() | ||
| 34 | private lateinit var navController: NavController | 37 | private lateinit var navController: NavController |
| 35 | private lateinit var sharedPreferences: SharedPreferences | 38 | private lateinit var sharedPreferences: SharedPreferences |
| 36 | private var cantidadInventarios: Int = 0 | 39 | private var cantidadInventarios: Int = 0 |
| 40 | private var cantidadInventariosII: Int = 0 | ||
| 37 | 41 | ||
| 38 | override fun onCreate(savedInstanceState: Bundle?) { | 42 | override fun onCreate(savedInstanceState: Bundle?) { |
| 39 | super.onCreate(savedInstanceState) | 43 | super.onCreate(savedInstanceState) |
| 40 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 44 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 41 | 45 | ||
| 42 | } | 46 | } |
| 43 | 47 | ||
| 44 | override fun onCreateView( | 48 | override fun onCreateView( |
| 45 | inflater: LayoutInflater, | 49 | inflater: LayoutInflater, |
| 46 | container: ViewGroup?, | 50 | container: ViewGroup?, |
| 47 | savedInstanceState: Bundle? | 51 | savedInstanceState: Bundle? |
| 48 | ): View? { | 52 | ): View? { |
| 49 | var bAbiertoCerrado = false | 53 | var bAbiertoCerrado = false |
| 54 | var bAbiertoCerradoII = false | ||
| 50 | val v = inflater.inflate(R.layout.fragment_main, container, false) | 55 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
| 51 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) | 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 | val ivSort19 = v.findViewById<ImageButton>(R.id.ivSort19) | 58 | val ivSort19 = v.findViewById<ImageButton>(R.id.ivSort19) |
| 54 | val ivSort91 = v.findViewById<ImageButton>(R.id.ivSort91) | 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 | val cbVentas = v.findViewById<CheckBox>(R.id.cbVentas) | 62 | val cbVentas = v.findViewById<CheckBox>(R.id.cbVentas) |
| 56 | val cbDeposito = v.findViewById<CheckBox>(R.id.cbDeposito) | 63 | val cbDeposito = v.findViewById<CheckBox>(R.id.cbDeposito) |
| 57 | val tvTipo = v.findViewById<TextView>(R.id.tvTipo) | 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 | rcInventario = v.findViewById(R.id.rcInventario) | 68 | rcInventario = v.findViewById(R.id.rcInventario) |
| 69 | rcInventarioII = v.findViewById(R.id.rcInventarioII) | ||
| 59 | 70 | ||
| 60 | GlobalScope.launch(Dispatchers.Main) { | 71 | GlobalScope.launch(Dispatchers.Main) { |
| 61 | inventarios = buscarEnBDInvHead() | 72 | inventarios = buscarEnBDInvHead() |
| 62 | for ((i, item) in inventarios.withIndex()) { | 73 | for ((i, item) in inventarios.withIndex()) { |
| 63 | val inv = InvHead( | 74 | val inv = InvHead( |
| 64 | inventarios[i].invNum, | 75 | inventarios[i].invNum, |
| 65 | inventarios[i].descripcion, | 76 | inventarios[i].descripcion, |
| 66 | inventarios[i].estado, | 77 | inventarios[i].estado, |
| 67 | inventarios[i].fechaInicio, | 78 | inventarios[i].fechaInicio, |
| 68 | inventarios[i].fechaFinal, | 79 | inventarios[i].fechaFinal, |
| 69 | inventarios[i].prodContados, | 80 | inventarios[i].prodContados, |
| 70 | inventarios[i].lugar, | 81 | inventarios[i].lugar, |
| 71 | inventarios[i].stDesc, | 82 | inventarios[i].stDesc, |
| 72 | inventarios[i].proNoCont | 83 | inventarios[i].proNoCont |
| 73 | ) | 84 | ) |
| 74 | cargarRecicler(inv) | 85 | cargarRecicler(inv) |
| 75 | cantidadInventarios = i + 1 | 86 | cantidadInventarios = i + 1 |
| 76 | } | 87 | } |
| 77 | tvInvDinamicos.text = "Inventarios Dinamicos ($cantidadInventarios) +" | 88 | tvInvDinamicos.text = "Inventarios Dinamicos ($cantidadInventarios) +" |
| 78 | tvInvDinamicos.setOnClickListener { | 89 | tvInvDinamicos.setOnClickListener { |
| 79 | if (!bAbiertoCerrado) { | 90 | if (!bAbiertoCerrado) { |
| 80 | bAbiertoCerrado = true | 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 | rcInventario.visibility = View.VISIBLE | 99 | rcInventario.visibility = View.VISIBLE |
| 83 | ivSort91.visibility = View.INVISIBLE | 100 | ivSort91.visibility = View.INVISIBLE |
| 84 | ivSort19.visibility = View.VISIBLE | 101 | ivSort19.visibility = View.VISIBLE |
| 85 | cbVentas.visibility = View.VISIBLE | 102 | cbVentas.visibility = View.VISIBLE |
| 86 | cbDeposito.visibility = View.VISIBLE | 103 | cbDeposito.visibility = View.VISIBLE |
| 87 | tvTipo.visibility = View.VISIBLE | 104 | tvTipo.visibility = View.VISIBLE |
| 88 | tvInvDinamicos.text = | 105 | tvInvDinamicos.text = "Inventarios Dinamicos ($cantidadInventarios) -" |
| 89 | "Inventarios Dinamicos ($cantidadInventarios) -" | ||
| 90 | } else { | 106 | } else { |
| 91 | bAbiertoCerrado = false | 107 | bAbiertoCerrado = false |
| 92 | rcInventario.visibility = View.GONE | 108 | rcInventario.visibility = View.GONE |
| 93 | ivSort91.visibility = View.GONE | 109 | ivSort91.visibility = View.GONE |
| 94 | ivSort19.visibility = View.GONE | 110 | ivSort19.visibility = View.GONE |
| 95 | txtDeposito.visibility = View.VISIBLE | 111 | tvInvImportados.visibility = View.VISIBLE |
| 96 | cbVentas.visibility = View.GONE | 112 | cbVentas.visibility = View.GONE |
| 97 | cbDeposito.visibility = View.GONE | 113 | cbDeposito.visibility = View.GONE |
| 98 | tvTipo.visibility = View.GONE | 114 | tvTipo.visibility = View.GONE |
| 99 | tvInvDinamicos.text = | 115 | tvInvDinamicos.text = "Inventarios Dinamicos ($cantidadInventarios) +" |
| 100 | "Inventarios Dinamicos ($cantidadInventarios) +" | ||
| 101 | } | 116 | } |
| 102 | } | 117 | } |
| 103 | ordenado = inventarios.sortedBy { | 118 | ordenado = inventarios.sortedBy { |
| 104 | it.invNum | 119 | it.invNum |
| 105 | } | 120 | } |
| 106 | ivSort19.setOnClickListener { | 121 | ivSort19.setOnClickListener { |
| 107 | ordenado = inventarios.sortedByDescending { | 122 | ordenado = inventarios.sortedByDescending { |
| 108 | it.invNum | 123 | it.invNum |
| 109 | } | 124 | } |
| 110 | cbDeposito.isChecked=true | 125 | cbDeposito.isChecked=true |
| 111 | cbVentas.isChecked=true | 126 | cbVentas.isChecked=true |
| 112 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 127 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
| 113 | viewManager = LinearLayoutManager(requireContext()) | 128 | viewManager = LinearLayoutManager(requireContext()) |
| 114 | 129 | ||
| 115 | rcInventario.apply { | 130 | rcInventario.apply { |
| 116 | adapter = viewAdapter | 131 | adapter = viewAdapter |
| 117 | layoutManager = viewManager | 132 | layoutManager = viewManager |
| 118 | } | 133 | } |
| 119 | viewAdapter.notifyDataSetChanged() | 134 | viewAdapter.notifyDataSetChanged() |
| 120 | ivSort19.visibility = View.INVISIBLE | 135 | ivSort19.visibility = View.INVISIBLE |
| 121 | ivSort91.visibility = View.VISIBLE | 136 | ivSort91.visibility = View.VISIBLE |
| 122 | } | 137 | } |
| 123 | ivSort91.setOnClickListener { | 138 | ivSort91.setOnClickListener { |
| 124 | ordenado = inventarios.sortedBy { | 139 | ordenado = inventarios.sortedBy { |
| 125 | it.invNum | 140 | it.invNum |
| 126 | } | 141 | } |
| 127 | cbDeposito.isChecked=true | 142 | cbDeposito.isChecked=true |
| 128 | cbVentas.isChecked=true | 143 | cbVentas.isChecked=true |
| 129 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 144 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
| 130 | viewManager = LinearLayoutManager(requireContext()) | 145 | viewManager = LinearLayoutManager(requireContext()) |
| 131 | 146 | ||
| 132 | rcInventario.apply { | 147 | rcInventario.apply { |
| 133 | adapter = viewAdapter | 148 | adapter = viewAdapter |
| 134 | layoutManager = viewManager | 149 | layoutManager = viewManager |
| 135 | } | 150 | } |
| 136 | viewAdapter.notifyDataSetChanged() | 151 | viewAdapter.notifyDataSetChanged() |
| 137 | ivSort91.visibility = View.INVISIBLE | 152 | ivSort91.visibility = View.INVISIBLE |
| 138 | ivSort19.visibility = View.VISIBLE | 153 | ivSort19.visibility = View.VISIBLE |
| 139 | } | 154 | } |
| 140 | } | 155 | } |
| 141 | 156 | ||
| 142 | cbVentas.setOnClickListener { | 157 | cbVentas.setOnClickListener { |
| 143 | if (!cbVentas.isChecked) { | 158 | if (!cbVentas.isChecked) { |
| 144 | cbDeposito.isChecked=true | 159 | cbDeposito.isChecked=true |
| 145 | listIvn2.clear() | 160 | listIvn2.clear() |
| 146 | ordenado.forEach { | 161 | ordenado.forEach { |
| 147 | if (it.lugar==true) { | 162 | if (it.lugar==true) { |
| 148 | listIvn2.add(it) | 163 | listIvn2.add(it) |
| 149 | } | 164 | } |
| 150 | } | 165 | } |
| 151 | } else { | 166 | } else { |
| 152 | listIvn2.clear() | 167 | listIvn2.clear() |
| 153 | listIvn2.addAll(ordenado) | 168 | listIvn2.addAll(ordenado) |
| 154 | } | 169 | } |
| 155 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this@MainFragment) | 170 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this@MainFragment) |
| 156 | viewManager = LinearLayoutManager(requireContext()) | 171 | viewManager = LinearLayoutManager(requireContext()) |
| 157 | rcInventario.apply { | 172 | rcInventario.apply { |
| 158 | adapter = viewAdapter | 173 | adapter = viewAdapter |
| 159 | layoutManager = viewManager | 174 | layoutManager = viewManager |
| 160 | } | 175 | } |
| 161 | viewAdapter.notifyDataSetChanged() | 176 | viewAdapter.notifyDataSetChanged() |
| 162 | } | 177 | } |
| 163 | 178 | ||
| 164 | cbDeposito.setOnClickListener { | 179 | cbDeposito.setOnClickListener { |
| 165 | if (!cbDeposito.isChecked) { | 180 | if (!cbDeposito.isChecked) { |
| 166 | cbVentas.isChecked=true | 181 | cbVentas.isChecked=true |
| 167 | listIvn2.clear() | 182 | listIvn2.clear() |
| 168 | ordenado.forEach { | 183 | ordenado.forEach { |
| 169 | if (it.lugar==false) { | 184 | if (it.lugar==false) { |
| 170 | listIvn2.add(it) | 185 | listIvn2.add(it) |
| 171 | } | 186 | } |
| 172 | } | 187 | } |
| 173 | } else { | 188 | } else { |
| 174 | listIvn2.clear() | 189 | listIvn2.clear() |
| 175 | listIvn2.addAll(ordenado) | 190 | listIvn2.addAll(ordenado) |
| 176 | } | 191 | } |
| 177 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this@MainFragment) | 192 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this@MainFragment) |
| 178 | viewManager = LinearLayoutManager(requireContext()) | 193 | viewManager = LinearLayoutManager(requireContext()) |
| 179 | rcInventario.apply { | 194 | rcInventario.apply { |
| 180 | adapter = viewAdapter | 195 | adapter = viewAdapter |
| 181 | layoutManager = viewManager | 196 | layoutManager = viewManager |
| 182 | } | 197 | } |
| 183 | viewAdapter.notifyDataSetChanged() | 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 | return v | 315 | return v |
| 186 | } | 316 | } |
| 187 | 317 | ||
| 188 | suspend fun buscarEnBDInvHead(): List<InvHead> { | 318 | suspend fun buscarEnBDInvHead(): List<InvHead> { |
| 189 | //TODO BUSQUEDA POR DESCRIPCION | 319 | //TODO BUSQUEDA POR DESCRIPCION |
| 190 | var busqueda: List<InvHead> | 320 | var busqueda: List<InvHead> |
| 191 | return GlobalScope.async(Dispatchers.IO) { | 321 | return GlobalScope.async(Dispatchers.IO) { |
| 192 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | 322 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() |
| 193 | return@async busqueda | 323 | return@async busqueda |
| 194 | }.await() | 324 | }.await() |
| 195 | } | 325 | } |
| 196 | 326 | ||
| 197 | fun cargarRecicler(inv: InvHead) { | 327 | fun cargarRecicler(inv: InvHead) { |
| 198 | //TODO CARGO EN LE RV | 328 | //TODO CARGO EN LE RV |
| 199 | 329 | ||
| 200 | // val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | 330 | // val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() |
| 201 | // val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | 331 | // val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") |
| 202 | 332 | ||
| 203 | // listIvn.add(item) | 333 | // listIvn.add(item) |
| 204 | listIvn2.add(inv) | 334 | listIvn2.add(inv) |
| 205 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) | 335 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) |
| 206 | viewManager = LinearLayoutManager(requireContext()) | 336 | viewManager = LinearLayoutManager(requireContext()) |
| 207 | 337 | ||
| 208 | rcInventario.apply { | 338 | rcInventario.apply { |
| 209 | adapter = viewAdapter | 339 | adapter = viewAdapter |
| 210 | layoutManager = viewManager | 340 | layoutManager = viewManager |
| 211 | } | 341 | } |
| 212 | } | 342 | } |
| 213 | 343 | ||
| 214 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 344 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 215 | super.onViewCreated(view, savedInstanceState) | 345 | super.onViewCreated(view, savedInstanceState) |
| 216 | navController = Navigation.findNavController(view) | 346 | navController = Navigation.findNavController(view) |
| 217 | listIvn2.clear() | 347 | listIvn2.clear() |
| 218 | } | 348 | } |
| 219 | 349 | ||
| 220 | override fun onItemClick(inventario: String?) { | 350 | override fun onItemClick(inventario: String?) { |
| 221 | 351 | ||
| 222 | val editor = sharedPreferences.edit() | 352 | val editor = sharedPreferences.edit() |
| 223 | // var invSel: String = inventario.toString() | 353 | // var invSel: String = inventario.toString() |
| 224 | // invSel = invSel.substring(3, 5) | 354 | // invSel = invSel.substring(3, 5) |
| 225 | editor?.putString("Inventario", inventario) | 355 | editor?.putString("Inventario", inventario) |
| 226 | editor?.apply() | 356 | editor?.apply() |
| 227 | editor.commit() | 357 | editor.commit() |
| 228 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | 358 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) |
| 229 | } | 359 | } |
| 230 | 360 | ||
| 231 | 361 | ||
| 232 | } | 362 | } |
app/src/main/res/layout-land/fragment_configuracion.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <ScrollView | 2 | <ScrollView |
| 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 | tools:context=".UI.configuracion.ConfiguracionFragment" | 5 | tools:context=".UI.configuracion.ConfiguracionFragment" |
| 6 | xmlns:android="http://schemas.android.com/apk/res/android" | 6 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 7 | android:layout_width="match_parent" | 7 | android:layout_width="match_parent" |
| 8 | android:layout_height="wrap_content"> | 8 | android:layout_height="wrap_content"> |
| 9 | 9 | ||
| 10 | <androidx.constraintlayout.widget.ConstraintLayout | 10 | <androidx.constraintlayout.widget.ConstraintLayout |
| 11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 12 | android:layout_height="wrap_content"> | 12 | android:layout_height="wrap_content"> |
| 13 | 13 | ||
| 14 | <androidx.appcompat.widget.AppCompatTextView | 14 | <androidx.appcompat.widget.AppCompatTextView |
| 15 | android:id="@+id/textView2" | 15 | android:id="@+id/textView2" |
| 16 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
| 17 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
| 18 | android:layout_marginTop="@dimen/MarginTopTitulos" | 18 | android:layout_marginTop="@dimen/MarginTopTitulos" |
| 19 | android:gravity="center" | 19 | android:gravity="center" |
| 20 | android:lines="1" | 20 | android:lines="1" |
| 21 | android:text="@string/tvTituloConf" | 21 | android:text="@string/tvTituloConf" |
| 22 | android:textColor="@color/colorAccent" | 22 | android:textColor="@color/colorAccent" |
| 23 | android:textSize="@dimen/Titulos" | 23 | android:textSize="@dimen/Titulos" |
| 24 | app:fontFamily="sans-serif-condensed" | 24 | app:fontFamily="sans-serif-condensed" |
| 25 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" | 25 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" |
| 26 | app:layout_constraintEnd_toEndOf="parent" | 26 | app:layout_constraintEnd_toEndOf="parent" |
| 27 | app:layout_constraintStart_toStartOf="parent" | 27 | app:layout_constraintStart_toStartOf="parent" |
| 28 | app:layout_constraintTop_toTopOf="parent" /> | 28 | app:layout_constraintTop_toTopOf="parent" /> |
| 29 | 29 | ||
| 30 | <TextView | 30 | <TextView |
| 31 | android:id="@+id/tvSeleccioneServidor" | 31 | android:id="@+id/tvSeleccioneServidor" |
| 32 | android:layout_width="0dp" | 32 | android:layout_width="0dp" |
| 33 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
| 34 | 34 | ||
| 35 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 35 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 36 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 36 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
| 37 | android:gravity="start" | 37 | android:gravity="start" |
| 38 | android:lines="1" | 38 | android:lines="1" |
| 39 | android:text="@string/tvSeleccioneServidor" | 39 | android:text="@string/tvSeleccioneServidor" |
| 40 | android:textColor="@android:color/black" | 40 | android:textColor="@android:color/black" |
| 41 | android:textSize="@dimen/SubTitulos" | 41 | android:textSize="@dimen/SubTitulos" |
| 42 | app:fontFamily="sans-serif-condensed" | 42 | app:fontFamily="sans-serif-condensed" |
| 43 | app:layout_constraintBottom_toTopOf="@+id/spServidor" | 43 | app:layout_constraintBottom_toTopOf="@+id/spServidor" |
| 44 | app:layout_constraintEnd_toEndOf="parent" | 44 | app:layout_constraintEnd_toEndOf="parent" |
| 45 | app:layout_constraintStart_toStartOf="parent" | 45 | app:layout_constraintStart_toStartOf="parent" |
| 46 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | 46 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
| 47 | 47 | ||
| 48 | <Spinner | 48 | <Spinner |
| 49 | android:id="@+id/spServidor" | 49 | android:id="@+id/spServidor" |
| 50 | android:layout_width="0dp" | 50 | android:layout_width="0dp" |
| 51 | android:layout_height="wrap_content" | 51 | android:layout_height="wrap_content" |
| 52 | android:backgroundTint="@color/LightGray" | 52 | android:backgroundTint="@color/LightGray" |
| 53 | android:elevation="5dp" | 53 | android:elevation="5dp" |
| 54 | android:fadeScrollbars="true" | 54 | android:fadeScrollbars="true" |
| 55 | android:foregroundTint="@android:color/holo_orange_dark" | 55 | android:foregroundTint="@android:color/holo_orange_dark" |
| 56 | android:soundEffectsEnabled="true" | 56 | android:soundEffectsEnabled="true" |
| 57 | android:spinnerMode="dialog" | 57 | android:spinnerMode="dialog" |
| 58 | android:splitMotionEvents="false" | 58 | android:splitMotionEvents="false" |
| 59 | android:textAlignment="center" | 59 | android:textAlignment="center" |
| 60 | android:textSize="@dimen/NormalText" | 60 | android:textSize="@dimen/NormalText" |
| 61 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 61 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
| 62 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" | 62 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" |
| 63 | app:layout_constraintHorizontal_chainStyle="packed" | 63 | app:layout_constraintHorizontal_chainStyle="packed" |
| 64 | app:layout_constraintStart_toStartOf="parent" | 64 | app:layout_constraintStart_toStartOf="parent" |
| 65 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" | 65 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" |
| 66 | android:entries="@array/spinnerServidor" | ||
| 67 | android:prompt="@string/leyendaSpinner"/> | 66 | android:prompt="@string/leyendaSpinner"/> |
| 68 | 67 | ||
| 69 | <Button | 68 | <Button |
| 70 | android:id="@+id/btnValidarServidor" | 69 | android:id="@+id/btnValidarServidor" |
| 71 | android:layout_width="wrap_content" | 70 | android:layout_width="wrap_content" |
| 72 | android:layout_height="wrap_content" | 71 | android:layout_height="wrap_content" |
| 73 | android:textColor="@android:color/white" | 72 | android:textColor="@android:color/white" |
| 74 | android:padding="10dp" | 73 | android:padding="10dp" |
| 75 | android:background="@drawable/boton_borde_redondeado" | 74 | android:background="@drawable/boton_borde_redondeado" |
| 76 | android:text="@string/btnValidarServidor" | 75 | android:text="@string/btnValidarServidor" |
| 77 | android:textSize="@dimen/NormalText" | 76 | android:textSize="@dimen/NormalText" |
| 78 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 77 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
| 79 | app:layout_constraintEnd_toEndOf="parent" | 78 | app:layout_constraintEnd_toEndOf="parent" |
| 80 | app:layout_constraintHorizontal_chainStyle="packed" | 79 | app:layout_constraintHorizontal_chainStyle="packed" |
| 81 | app:layout_constraintStart_toEndOf="@id/spServidor" | 80 | app:layout_constraintStart_toEndOf="@id/spServidor" |
| 82 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> | 81 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> |
| 83 | 82 | ||
| 84 | <Button | 83 | <Button |
| 85 | android:id="@+id/btnAgregarServidor" | 84 | android:id="@+id/btnAgregarServidor" |
| 86 | android:layout_width="0dp" | 85 | android:layout_width="0dp" |
| 87 | android:layout_height="wrap_content" | 86 | android:layout_height="wrap_content" |
| 88 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 87 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 89 | android:layout_marginEnd="@dimen/MarginBotAgreSer" | 88 | android:layout_marginEnd="@dimen/MarginBotAgreSer" |
| 90 | android:text="@string/btnAgregarServidor" | 89 | android:text="@string/btnAgregarServidor" |
| 91 | android:textSize="@dimen/NormalText" | 90 | android:textSize="@dimen/NormalText" |
| 92 | android:textColor="@android:color/white" | 91 | android:textColor="@android:color/white" |
| 93 | android:padding="10dp" | 92 | android:padding="10dp" |
| 94 | android:background="@drawable/boton_borde_redondeado" | 93 | android:background="@drawable/boton_borde_redondeado" |
| 95 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" | 94 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" |
| 96 | app:layout_constraintEnd_toEndOf="parent" | 95 | app:layout_constraintEnd_toEndOf="parent" |
| 97 | app:layout_constraintStart_toStartOf="parent" | 96 | app:layout_constraintStart_toStartOf="parent" |
| 98 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> | 97 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> |
| 99 | 98 | ||
| 100 | 99 | ||
| 101 | <TextView | 100 | <TextView |
| 102 | android:id="@+id/tvUbicacionCarpetas" | 101 | android:id="@+id/tvUbicacionCarpetas" |
| 103 | android:layout_width="0dp" | 102 | android:layout_width="0dp" |
| 104 | android:layout_height="wrap_content" | 103 | android:layout_height="wrap_content" |
| 105 | 104 | ||
| 106 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 105 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 107 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 106 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
| 108 | android:gravity="start" | 107 | android:gravity="start" |
| 109 | android:lines="1" | 108 | android:lines="1" |
| 110 | android:text="@string/tvUbicacionCarpetas" | 109 | android:text="@string/tvUbicacionCarpetas" |
| 111 | android:textColor="@android:color/black" | 110 | android:textColor="@android:color/black" |
| 112 | android:textSize="@dimen/SubTitulos" | 111 | android:textSize="@dimen/SubTitulos" |
| 113 | app:fontFamily="sans-serif-condensed" | 112 | app:fontFamily="sans-serif-condensed" |
| 114 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" | 113 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" |
| 115 | app:layout_constraintEnd_toEndOf="parent" | 114 | app:layout_constraintEnd_toEndOf="parent" |
| 116 | app:layout_constraintStart_toStartOf="parent" | 115 | app:layout_constraintStart_toStartOf="parent" |
| 117 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> | 116 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> |
| 118 | 117 | ||
| 119 | <ImageButton | 118 | <ImageButton |
| 120 | android:id="@+id/ibSearch" | 119 | android:id="@+id/ibSearch" |
| 121 | android:layout_width="36dp" | 120 | android:layout_width="36dp" |
| 122 | android:layout_height="37dp" | 121 | android:layout_height="37dp" |
| 123 | android:layout_margin="10dp" | 122 | android:layout_margin="10dp" |
| 124 | android:src="@drawable/search" | 123 | android:src="@drawable/search" |
| 125 | android:textColor="@android:color/white" | 124 | android:textColor="@android:color/white" |
| 126 | android:padding="10dp" | 125 | android:padding="10dp" |
| 127 | android:background="@drawable/boton_borde_redondeado" | 126 | android:background="@drawable/boton_borde_redondeado" |
| 128 | app:layout_constraintEnd_toStartOf="@+id/etRuta" | 127 | app:layout_constraintEnd_toStartOf="@+id/etRuta" |
| 129 | app:layout_constraintStart_toStartOf="parent" | 128 | app:layout_constraintStart_toStartOf="parent" |
| 130 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 129 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
| 131 | 130 | ||
| 132 | <EditText | 131 | <EditText |
| 133 | android:id="@+id/etRuta" | 132 | android:id="@+id/etRuta" |
| 134 | android:layout_width="0dp" | 133 | android:layout_width="0dp" |
| 135 | android:layout_height="wrap_content" | 134 | android:layout_height="wrap_content" |
| 136 | android:layout_marginTop="10dp" | 135 | android:layout_marginTop="10dp" |
| 137 | android:layout_marginEnd="10dp" | 136 | android:layout_marginEnd="10dp" |
| 138 | android:clickable="true" | 137 | android:clickable="true" |
| 139 | android:ems="10" | 138 | android:ems="10" |
| 140 | android:focusable="true" | 139 | android:focusable="true" |
| 141 | android:inputType="textPersonName" | 140 | android:inputType="textPersonName" |
| 142 | android:lines="1" | 141 | android:lines="1" |
| 143 | android:text="" | 142 | android:text="" |
| 144 | android:textSize="@dimen/NormalText" | 143 | android:textSize="@dimen/NormalText" |
| 145 | app:layout_constraintEnd_toEndOf="parent" | 144 | app:layout_constraintEnd_toEndOf="parent" |
| 146 | app:layout_constraintStart_toEndOf="@id/ibSearch" | 145 | app:layout_constraintStart_toEndOf="@id/ibSearch" |
| 147 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 146 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
| 148 | 147 | ||
| 149 | <TextView | 148 | <TextView |
| 150 | android:id="@+id/tvActuFecha" | 149 | android:id="@+id/tvActuFecha" |
| 151 | android:layout_width="0dp" | 150 | android:layout_width="0dp" |
| 152 | android:layout_height="wrap_content" | 151 | android:layout_height="wrap_content" |
| 153 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 152 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 154 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 153 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
| 155 | android:gravity="start" | 154 | android:gravity="start" |
| 156 | android:lines="1" | 155 | android:lines="1" |
| 157 | android:text="@string/tvTituloArea" | 156 | android:text="@string/tvTituloArea" |
| 158 | android:textColor="@android:color/black" | 157 | android:textColor="@android:color/black" |
| 159 | android:textSize="@dimen/SubTitulos" | 158 | android:textSize="@dimen/SubTitulos" |
| 160 | app:fontFamily="sans-serif-condensed" | 159 | app:fontFamily="sans-serif-condensed" |
| 161 | app:layout_constraintEnd_toEndOf="parent" | 160 | app:layout_constraintEnd_toEndOf="parent" |
| 162 | app:layout_constraintStart_toStartOf="parent" | 161 | app:layout_constraintStart_toStartOf="parent" |
| 163 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> | 162 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> |
| 164 | 163 | ||
| 165 | <RadioGroup | 164 | <RadioGroup |
| 166 | android:id="@+id/rgFechaHora" | 165 | android:id="@+id/rgFechaHora" |
| 167 | android:layout_width="0dp" | 166 | android:layout_width="0dp" |
| 168 | android:layout_height="wrap_content" | 167 | android:layout_height="wrap_content" |
| 169 | 168 | ||
| 170 | android:gravity="center" | 169 | android:gravity="center" |
| 171 | android:orientation="horizontal" | 170 | android:orientation="horizontal" |
| 172 | app:layout_constraintEnd_toEndOf="parent" | 171 | app:layout_constraintEnd_toEndOf="parent" |
| 173 | app:layout_constraintStart_toStartOf="parent" | 172 | app:layout_constraintStart_toStartOf="parent" |
| 174 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> | 173 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> |
| 175 | 174 | ||
| 176 | <RadioButton | 175 | <RadioButton |
| 177 | android:id="@+id/rbVentas" | 176 | android:id="@+id/rbVentas" |
| 178 | android:layout_width="wrap_content" | 177 | android:layout_width="wrap_content" |
| 179 | android:layout_height="wrap_content" | 178 | android:layout_height="wrap_content" |
| 180 | android:layout_margin="5dp" | 179 | android:layout_margin="5dp" |
| 181 | android:checked="true" | 180 | android:checked="true" |
| 182 | android:padding="5dp" | 181 | android:padding="5dp" |
| 183 | android:text="@string/rbVentas" | 182 | android:text="@string/rbVentas" |
| 184 | android:textSize="@dimen/NormalText" /> | 183 | android:textSize="@dimen/NormalText" /> |
| 185 | 184 | ||
| 186 | <RadioButton | 185 | <RadioButton |
| 187 | android:id="@+id/rbDeposito" | 186 | android:id="@+id/rbDeposito" |
| 188 | android:layout_width="wrap_content" | 187 | android:layout_width="wrap_content" |
| 189 | android:layout_height="wrap_content" | 188 | android:layout_height="wrap_content" |
| 190 | android:layout_margin="5dp" | 189 | android:layout_margin="5dp" |
| 191 | android:checked="false" | 190 | android:checked="false" |
| 192 | android:padding="5dp" | 191 | android:padding="5dp" |
| 193 | android:text="@string/rbDeposito" | 192 | android:text="@string/rbDeposito" |
| 194 | android:textSize="@dimen/NormalText" /> | 193 | android:textSize="@dimen/NormalText" /> |
| 195 | 194 | ||
| 196 | </RadioGroup> | 195 | </RadioGroup> |
| 197 | 196 | ||
| 198 | <TextView | 197 | <TextView |
| 199 | android:id="@+id/tvLosProductos" | 198 | android:id="@+id/tvLosProductos" |
| 200 | android:layout_width="0dp" | 199 | android:layout_width="0dp" |
| 201 | android:layout_height="wrap_content" | 200 | android:layout_height="wrap_content" |
| 202 | 201 | ||
| 203 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 202 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 204 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 203 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
| 205 | android:gravity="start" | 204 | android:gravity="start" |
| 206 | android:lines="1" | 205 | android:lines="1" |
| 207 | android:text="@string/tvLosProductos" | 206 | android:text="@string/tvLosProductos" |
| 208 | android:textColor="@android:color/black" | 207 | android:textColor="@android:color/black" |
| 209 | android:textSize="@dimen/SubTitulos" | 208 | android:textSize="@dimen/SubTitulos" |
| 210 | app:fontFamily="sans-serif-condensed" | 209 | app:fontFamily="sans-serif-condensed" |
| 211 | app:layout_constraintEnd_toEndOf="parent" | 210 | app:layout_constraintEnd_toEndOf="parent" |
| 212 | app:layout_constraintStart_toStartOf="parent" | 211 | app:layout_constraintStart_toStartOf="parent" |
| 213 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 212 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
| 214 | 213 | ||
| 215 | <RadioGroup | 214 | <RadioGroup |
| 216 | android:id="@+id/rgLosProductos" | 215 | android:id="@+id/rgLosProductos" |
| 217 | android:layout_width="0dp" | 216 | android:layout_width="0dp" |
| 218 | android:layout_height="wrap_content" | 217 | android:layout_height="wrap_content" |
| 219 | 218 | ||
| 220 | android:gravity="center" | 219 | android:gravity="center" |
| 221 | android:orientation="vertical" | 220 | android:orientation="vertical" |
| 222 | app:layout_constraintEnd_toEndOf="parent" | 221 | app:layout_constraintEnd_toEndOf="parent" |
| 223 | app:layout_constraintStart_toStartOf="parent" | 222 | app:layout_constraintStart_toStartOf="parent" |
| 224 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> | 223 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> |
| 225 | 224 | ||
| 226 | <RadioButton | 225 | <RadioButton |
| 227 | android:id="@+id/rbProInclu" | 226 | android:id="@+id/rbProInclu" |
| 228 | android:layout_width="match_parent" | 227 | android:layout_width="match_parent" |
| 229 | android:layout_height="wrap_content" | 228 | android:layout_height="wrap_content" |
| 230 | 229 | ||
| 231 | android:layout_margin="@dimen/PadingCbyRb" | 230 | android:layout_margin="@dimen/PadingCbyRb" |
| 232 | android:checked="true" | 231 | android:checked="true" |
| 233 | android:padding="@dimen/PadingCbyRb" | 232 | android:padding="@dimen/PadingCbyRb" |
| 234 | android:text="@string/rbProInclu" | 233 | android:text="@string/rbProInclu" |
| 235 | android:textSize="@dimen/NormalText" /> | 234 | android:textSize="@dimen/NormalText" /> |
| 236 | 235 | ||
| 237 | <RadioButton | 236 | <RadioButton |
| 238 | android:id="@+id/rbProNoInclu" | 237 | android:id="@+id/rbProNoInclu" |
| 239 | android:layout_width="match_parent" | 238 | android:layout_width="match_parent" |
| 240 | android:layout_height="wrap_content" | 239 | android:layout_height="wrap_content" |
| 241 | android:layout_margin="@dimen/PadingCbyRb" | 240 | android:layout_margin="@dimen/PadingCbyRb" |
| 242 | android:checked="false" | 241 | android:checked="false" |
| 243 | android:padding="@dimen/PadingCbyRb" | 242 | android:padding="@dimen/PadingCbyRb" |
| 244 | android:text="@string/rbProNoInclu" | 243 | android:text="@string/rbProNoInclu" |
| 245 | android:textSize="@dimen/NormalText" /> | 244 | android:textSize="@dimen/NormalText" /> |
| 246 | 245 | ||
| 247 | </RadioGroup> | 246 | </RadioGroup> |
| 248 | 247 | ||
| 249 | <CheckBox | 248 | <CheckBox |
| 250 | android:id="@+id/cbHabiLectura" | 249 | android:id="@+id/cbHabiLectura" |
| 251 | android:layout_width="0dp" | 250 | android:layout_width="0dp" |
| 252 | android:layout_height="wrap_content" | 251 | android:layout_height="wrap_content" |
| 253 | android:layout_margin="@dimen/PadingCbyRb" | 252 | android:layout_margin="@dimen/PadingCbyRb" |
| 254 | android:padding="@dimen/PadingCbyRb" | 253 | android:padding="@dimen/PadingCbyRb" |
| 255 | android:text="@string/cbHabiLectura" | 254 | android:text="@string/cbHabiLectura" |
| 256 | android:textSize="@dimen/NormalText" | 255 | android:textSize="@dimen/NormalText" |
| 257 | app:layout_constraintEnd_toEndOf="parent" | 256 | app:layout_constraintEnd_toEndOf="parent" |
| 258 | app:layout_constraintStart_toStartOf="parent" | 257 | app:layout_constraintStart_toStartOf="parent" |
| 259 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> | 258 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> |
| 260 | 259 | ||
| 261 | <CheckBox | 260 | <CheckBox |
| 262 | android:id="@+id/cbMostrarStock" | 261 | android:id="@+id/cbMostrarStock" |
| 263 | android:layout_width="0dp" | 262 | android:layout_width="0dp" |
| 264 | android:layout_height="wrap_content" | 263 | android:layout_height="wrap_content" |
| 265 | android:layout_margin="@dimen/PadingCbyRb" | 264 | android:layout_margin="@dimen/PadingCbyRb" |
| 266 | android:padding="@dimen/PadingCbyRb" | 265 | android:padding="@dimen/PadingCbyRb" |
| 267 | android:text="@string/cbMostrarStock" | 266 | android:text="@string/cbMostrarStock" |
| 268 | android:textSize="@dimen/NormalText" | 267 | android:textSize="@dimen/NormalText" |
| 269 | app:layout_constraintEnd_toEndOf="parent" | 268 | app:layout_constraintEnd_toEndOf="parent" |
| 270 | app:layout_constraintStart_toStartOf="parent" | 269 | app:layout_constraintStart_toStartOf="parent" |
| 271 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> | 270 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> |
| 272 | 271 | ||
| 273 | <TextView | 272 | <TextView |
| 274 | android:id="@+id/tvColumMostrar" | 273 | android:id="@+id/tvColumMostrar" |
| 275 | android:layout_width="0dp" | 274 | android:layout_width="0dp" |
| 276 | android:layout_height="wrap_content" | 275 | android:layout_height="wrap_content" |
| 277 | 276 | ||
| 278 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 277 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 279 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 278 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
| 280 | android:gravity="start" | 279 | android:gravity="start" |
| 281 | android:lines="1" | 280 | android:lines="1" |
| 282 | android:text="@string/tvColumMostrar" | 281 | android:text="@string/tvColumMostrar" |
| 283 | android:textColor="@android:color/black" | 282 | android:textColor="@android:color/black" |
| 284 | android:textSize="@dimen/SubTitulos" | 283 | android:textSize="@dimen/SubTitulos" |
| 285 | app:fontFamily="sans-serif-condensed" | 284 | app:fontFamily="sans-serif-condensed" |
| 286 | app:layout_constraintEnd_toEndOf="parent" | 285 | app:layout_constraintEnd_toEndOf="parent" |
| 287 | app:layout_constraintStart_toStartOf="parent" | 286 | app:layout_constraintStart_toStartOf="parent" |
| 288 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> | 287 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> |
| 289 | 288 | ||
| 290 | <RadioGroup | 289 | <RadioGroup |
| 291 | android:id="@+id/rgCodigosMostrar" | 290 | android:id="@+id/rgCodigosMostrar" |
| 292 | android:layout_width="0dp" | 291 | android:layout_width="0dp" |
| 293 | android:layout_height="wrap_content" | 292 | android:layout_height="wrap_content" |
| 294 | 293 | ||
| 295 | android:gravity="center" | 294 | android:gravity="center" |
| 296 | android:orientation="horizontal" | 295 | android:orientation="horizontal" |
| 297 | app:layout_constraintEnd_toEndOf="parent" | 296 | app:layout_constraintEnd_toEndOf="parent" |
| 298 | app:layout_constraintStart_toStartOf="parent" | 297 | app:layout_constraintStart_toStartOf="parent" |
| 299 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> | 298 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> |
| 300 | 299 | ||
| 301 | <RadioButton | 300 | <RadioButton |
| 302 | android:id="@+id/rbCodigoDebo" | 301 | android:id="@+id/rbCodigoDebo" |
| 303 | android:layout_width="wrap_content" | 302 | android:layout_width="wrap_content" |
| 304 | android:layout_height="wrap_content" | 303 | android:layout_height="wrap_content" |
| 305 | android:layout_margin="5dp" | 304 | android:layout_margin="5dp" |
| 306 | android:checked="true" | 305 | android:checked="true" |
| 307 | android:padding="5dp" | 306 | android:padding="5dp" |
| 308 | android:text="@string/rbCodigoDebo" | 307 | android:text="@string/rbCodigoDebo" |
| 309 | android:textSize="@dimen/NormalText" /> | 308 | android:textSize="@dimen/NormalText" /> |
| 310 | 309 | ||
| 311 | <RadioButton | 310 | <RadioButton |
| 312 | android:id="@+id/rbCodigoOrigen" | 311 | android:id="@+id/rbCodigoOrigen" |
| 313 | android:layout_width="wrap_content" | 312 | android:layout_width="wrap_content" |
| 314 | android:layout_height="wrap_content" | 313 | android:layout_height="wrap_content" |
| 315 | android:layout_margin="5dp" | 314 | android:layout_margin="5dp" |
| 316 | android:checked="false" | 315 | android:checked="false" |
| 317 | android:padding="5dp" | 316 | android:padding="5dp" |
| 318 | android:text="@string/rbCodigoOrigen" | 317 | android:text="@string/rbCodigoOrigen" |
| 319 | android:textSize="@dimen/NormalText" /> | 318 | android:textSize="@dimen/NormalText" /> |
| 320 | 319 | ||
| 321 | <RadioButton | 320 | <RadioButton |
| 322 | android:id="@+id/rbCodigoBarras" | 321 | android:id="@+id/rbCodigoBarras" |
| 323 | android:layout_width="wrap_content" | 322 | android:layout_width="wrap_content" |
| 324 | android:layout_height="wrap_content" | 323 | android:layout_height="wrap_content" |
| 325 | android:layout_margin="5dp" | 324 | android:layout_margin="5dp" |
| 326 | android:padding="5dp" | 325 | android:padding="5dp" |
| 327 | android:text="@string/rbCodigoBarras" | 326 | android:text="@string/rbCodigoBarras" |
| 328 | android:textSize="@dimen/NormalText" /> | 327 | android:textSize="@dimen/NormalText" /> |
| 329 | </RadioGroup> | 328 | </RadioGroup> |
| 330 | 329 | ||
| 331 | <CheckBox | 330 | <CheckBox |
| 332 | android:id="@+id/cbMostrarExistencia" | 331 | android:id="@+id/cbMostrarExistencia" |
| 333 | android:layout_width="wrap_content" | 332 | android:layout_width="wrap_content" |
| 334 | android:layout_height="wrap_content" | 333 | android:layout_height="wrap_content" |
| 335 | android:layout_margin="@dimen/PadingCbyRb" | 334 | android:layout_margin="@dimen/PadingCbyRb" |
| 336 | android:padding="@dimen/PadingCbyRb" | 335 | android:padding="@dimen/PadingCbyRb" |
| 337 | android:text="@string/cbMostrarExistencia" | 336 | android:text="@string/cbMostrarExistencia" |
| 338 | android:textSize="@dimen/NormalText" | 337 | android:textSize="@dimen/NormalText" |
| 339 | android:checked="false" | 338 | android:checked="false" |
| 340 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" | 339 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" |
| 341 | app:layout_constraintStart_toStartOf="parent" | 340 | app:layout_constraintStart_toStartOf="parent" |
| 342 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 341 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
| 343 | 342 | ||
| 344 | <CheckBox | 343 | <CheckBox |
| 345 | android:id="@+id/cbMostrarPrecio" | 344 | android:id="@+id/cbMostrarPrecio" |
| 346 | android:layout_width="wrap_content" | 345 | android:layout_width="wrap_content" |
| 347 | android:layout_height="wrap_content" | 346 | android:layout_height="wrap_content" |
| 348 | android:layout_margin="@dimen/PadingCbyRb" | 347 | android:layout_margin="@dimen/PadingCbyRb" |
| 349 | android:padding="@dimen/PadingCbyRb" | 348 | android:padding="@dimen/PadingCbyRb" |
| 350 | android:text="@string/cbMostrarPrecio" | 349 | android:text="@string/cbMostrarPrecio" |
| 351 | android:textSize="@dimen/NormalText" | 350 | android:textSize="@dimen/NormalText" |
| 352 | android:checked="false" | 351 | android:checked="false" |
| 353 | app:layout_constraintEnd_toEndOf="parent" | 352 | app:layout_constraintEnd_toEndOf="parent" |
| 354 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" | 353 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" |
| 355 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 354 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
| 356 | 355 | ||
| 357 | <Button | 356 | <Button |
| 358 | android:id="@+id/btnGuardar" | 357 | android:id="@+id/btnGuardar" |
| 359 | android:layout_width="wrap_content" | 358 | android:layout_width="wrap_content" |
| 360 | android:layout_height="wrap_content" | 359 | android:layout_height="wrap_content" |
| 361 | android:text="@string/btnGuardar" | 360 | android:text="@string/btnGuardar" |
| 362 | android:textSize="@dimen/NormalText" | 361 | android:textSize="@dimen/NormalText" |
| 363 | app:layout_constraintEnd_toEndOf="parent" | 362 | app:layout_constraintEnd_toEndOf="parent" |
| 364 | android:textColor="@android:color/white" | 363 | android:textColor="@android:color/white" |
| 365 | android:padding="10dp" | 364 | android:padding="10dp" |
| 366 | android:background="@drawable/boton_borde_redondeado" | 365 | android:background="@drawable/boton_borde_redondeado" |
| 367 | app:layout_constraintStart_toStartOf="parent" | 366 | app:layout_constraintStart_toStartOf="parent" |
| 368 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> | 367 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> |
| 369 | </androidx.constraintlayout.widget.ConstraintLayout> | 368 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 370 | 369 | ||
| 371 | </ScrollView> | 370 | </ScrollView> |
app/src/main/res/layout/activity_splash.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | android:background="#E6E6E6" | 7 | android:background="#E6E6E6" |
| 8 | 8 | ||
| 9 | tools:context=".UI.SplashActivity"> | 9 | tools:context=".UI.SplashActivity"> |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | <androidx.appcompat.widget.AppCompatTextView | 12 | <androidx.appcompat.widget.AppCompatTextView |
| 13 | android:id="@+id/textView2" | 13 | android:id="@+id/textView2" |
| 14 | android:layout_width="match_parent" | 14 | android:layout_width="match_parent" |
| 15 | android:layout_height="100dp" | 15 | android:layout_height="100dp" |
| 16 | android:layout_margin="20dp" | 16 | android:layout_margin="20dp" |
| 17 | android:autoSizeMaxTextSize="1000sp" | 17 | android:autoSizeMaxTextSize="1000sp" |
| 18 | android:autoSizeMinTextSize="30sp" | 18 | android:autoSizeMinTextSize="30sp" |
| 19 | android:autoSizeStepGranularity="5sp" | 19 | android:autoSizeStepGranularity="5sp" |
| 20 | android:autoSizeTextType="uniform" | 20 | android:autoSizeTextType="uniform" |
| 21 | android:gravity="center" | 21 | android:gravity="center" |
| 22 | android:lines="1" | 22 | android:lines="1" |
| 23 | android:text="@string/bien" | 23 | android:text="@string/bien" |
| 24 | android:textColor="@color/colorAccent" | 24 | android:textColor="@color/colorAccent" |
| 25 | app:fontFamily="sans-serif-condensed" | 25 | app:fontFamily="sans-serif-condensed" |
| 26 | app:layout_constraintBottom_toTopOf="@+id/imageView" | 26 | app:layout_constraintBottom_toTopOf="@+id/imageView" |
| 27 | app:layout_constraintEnd_toEndOf="parent" | 27 | app:layout_constraintEnd_toEndOf="parent" |
| 28 | app:layout_constraintStart_toStartOf="parent" | 28 | app:layout_constraintStart_toStartOf="parent" |
| 29 | app:layout_constraintTop_toTopOf="parent" /> | 29 | app:layout_constraintTop_toTopOf="parent" /> |
| 30 | 30 | ||
| 31 | <ImageView | 31 | MarginTopTitulos <ImageView |
| 32 | android:id="@+id/imageView" | 32 | android:id="@+id/imageView" |
| 33 | android:layout_width="wrap_content" | 33 | android:layout_width="wrap_content" |
| 34 | android:layout_height="wrap_content" | 34 | android:layout_height="wrap_content" |
| 35 | 35 | ||
| 36 | android:contentDescription="@string/todo" | 36 | android:contentDescription="@string/todo" |
| 37 | android:src="@drawable/logo_splash" | 37 | android:src="@drawable/logo_splash" |
| 38 | app:layout_constraintBottom_toTopOf="@id/textView4" | 38 | app:layout_constraintBottom_toTopOf="@id/textView4" |
| 39 | app:layout_constraintEnd_toEndOf="parent" | 39 | app:layout_constraintEnd_toEndOf="parent" |
| 40 | app:layout_constraintStart_toStartOf="parent" | 40 | app:layout_constraintStart_toStartOf="parent" |
| 41 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | 41 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
| 42 | 42 | ||
| 43 | <androidx.appcompat.widget.AppCompatTextView | 43 | <androidx.appcompat.widget.AppCompatTextView |
| 44 | android:id="@+id/textView4" | 44 | android:id="@+id/textView4" |
| 45 | android:layout_width="match_parent" | 45 | android:layout_width="match_parent" |
| 46 | android:layout_height="110dp" | 46 | android:layout_height="110dp" |
| 47 | android:layout_margin="20dp" | 47 | android:layout_margin="20dp" |
| 48 | android:autoSizeMaxTextSize="1000sp" | 48 | android:autoSizeMaxTextSize="1000sp" |
| 49 | android:autoSizeMinTextSize="30sp" | 49 | android:autoSizeMinTextSize="30sp" |
| 50 | android:autoSizeStepGranularity="5sp" | 50 | android:autoSizeStepGranularity="5sp" |
| 51 | android:autoSizeTextType="uniform" | 51 | android:autoSizeTextType="uniform" |
| 52 | android:gravity="center" | 52 | android:gravity="center" |
| 53 | android:lines="1" | 53 | android:lines="1" |
| 54 | android:text="@string/inventario" | 54 | android:text="@string/inventario" |
| 55 | android:textColor="@color/colorAccent" | 55 | android:textColor="@color/colorAccent" |
| 56 | app:fontFamily="sans-serif-condensed" | 56 | app:fontFamily="sans-serif-condensed" |
| 57 | app:layout_constraintBottom_toBottomOf="parent" | 57 | app:layout_constraintBottom_toBottomOf="parent" |
| 58 | app:layout_constraintEnd_toEndOf="parent" | 58 | app:layout_constraintEnd_toEndOf="parent" |
| 59 | app:layout_constraintEnd_toStartOf="parent" | 59 | app:layout_constraintEnd_toStartOf="parent" |
| 60 | app:layout_constraintTop_toBottomOf="@id/imageView" /> | 60 | app:layout_constraintTop_toBottomOf="@id/imageView" /> |
| 61 | </androidx.constraintlayout.widget.ConstraintLayout> | 61 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/fragment_actua_maestros.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | tools:context=".UI.actualizacionMaestros.ActuaMaestrosFragment"> | 7 | tools:context=".UI.actualizacionMaestros.ActuaMaestrosFragment"> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
| 11 | android:id="@+id/tvActMaestros" | 11 | android:id="@+id/tvActMaestros" |
| 12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
| 13 | android:layout_height="wrap_content" | 13 | android:layout_height="wrap_content" |
| 14 | android:layout_marginTop="@dimen/MarginTopTitulos" | 14 | android:layout_marginTop="@dimen/MarginTopTitulos" |
| 15 | android:gravity="center" | 15 | android:gravity="center" |
| 16 | 16 | ||
| 17 | android:text="@string/tvActMaestros" | 17 | android:text="@string/tvActMaestros" |
| 18 | android:textColor="@color/colorAccent" | 18 | android:textColor="@color/colorAccent" |
| 19 | android:textSize="@dimen/Titulos" | 19 | android:textSize="@dimen/Titulos" |
| 20 | app:fontFamily="sans-serif-condensed" | 20 | app:fontFamily="sans-serif-condensed" |
| 21 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" | 21 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" |
| 22 | app:layout_constraintEnd_toEndOf="parent" | 22 | app:layout_constraintEnd_toEndOf="parent" |
| 23 | app:layout_constraintStart_toStartOf="parent" | 23 | app:layout_constraintStart_toStartOf="parent" |
| 24 | app:layout_constraintTop_toTopOf="parent" /> | 24 | app:layout_constraintTop_toTopOf="parent" /> |
| 25 | 25 | ||
| 26 | <TextView | 26 | <TextView |
| 27 | android:id="@+id/tvSeleccioneServidor" | 27 | android:id="@+id/tvSeleccioneServidor" |
| 28 | android:layout_width="0dp" | 28 | android:layout_width="0dp" |
| 29 | android:layout_height="wrap_content" | 29 | android:layout_height="wrap_content" |
| 30 | android:layout_margin="30dp" | 30 | android:layout_margin="30dp" |
| 31 | android:gravity="center" | 31 | android:gravity="center" |
| 32 | android:lines="2" | 32 | android:lines="2" |
| 33 | android:text="@string/tvMedio" | 33 | android:text="@string/tvMedio" |
| 34 | android:textColor="@android:color/black" | 34 | android:textColor="@android:color/black" |
| 35 | android:textSize="@dimen/SubTitulos" | 35 | android:textSize="@dimen/SubTitulos" |
| 36 | app:fontFamily="sans-serif-condensed" | 36 | app:fontFamily="sans-serif-condensed" |
| 37 | app:layout_constraintEnd_toEndOf="parent" | 37 | app:layout_constraintEnd_toEndOf="parent" |
| 38 | app:layout_constraintStart_toStartOf="parent" | 38 | app:layout_constraintStart_toStartOf="parent" |
| 39 | app:layout_constraintTop_toBottomOf="@+id/tvActMaestros" /> | 39 | app:layout_constraintTop_toBottomOf="@+id/tvActMaestros" /> |
| 40 | 40 | ||
| 41 | <RadioGroup | 41 | <RadioGroup |
| 42 | android:id="@+id/rgTipoActualizacion" | 42 | android:id="@+id/rgTipoActualizacion" |
| 43 | android:layout_width="0dp" | 43 | android:layout_width="0dp" |
| 44 | android:layout_height="wrap_content" | 44 | android:layout_height="wrap_content" |
| 45 | android:layout_margin="25dp" | 45 | android:layout_margin="25dp" |
| 46 | android:gravity="center" | 46 | android:gravity="center" |
| 47 | android:orientation="horizontal" | 47 | android:orientation="horizontal" |
| 48 | app:layout_constraintEnd_toEndOf="parent" | 48 | app:layout_constraintEnd_toEndOf="parent" |
| 49 | app:layout_constraintStart_toStartOf="parent" | 49 | app:layout_constraintStart_toStartOf="parent" |
| 50 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor"> | 50 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor"> |
| 51 | 51 | ||
| 52 | <RadioButton | 52 | <RadioButton |
| 53 | android:id="@+id/obPorWifi" | 53 | android:id="@+id/obPorWifi" |
| 54 | android:layout_width="wrap_content" | 54 | android:layout_width="wrap_content" |
| 55 | android:layout_height="wrap_content" | 55 | android:layout_height="wrap_content" |
| 56 | android:layout_margin="5dp" | 56 | android:layout_margin="5dp" |
| 57 | android:checked="true" | 57 | android:checked="true" |
| 58 | android:padding="5dp" | 58 | android:padding="5dp" |
| 59 | android:text="@string/obPorWifi" | 59 | android:text="@string/obPorWifi" |
| 60 | android:textSize="@dimen/NormalText" /> | 60 | android:textSize="@dimen/NormalText" /> |
| 61 | 61 | ||
| 62 | <RadioButton | 62 | <RadioButton |
| 63 | android:id="@+id/obViaArchivo" | 63 | android:id="@+id/obImpInventarios" |
| 64 | android:layout_width="wrap_content" | 64 | android:layout_width="wrap_content" |
| 65 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
| 66 | android:layout_margin="5dp" | 66 | android:layout_margin="5dp" |
| 67 | android:checked="false" | 67 | android:checked="false" |
| 68 | android:padding="5dp" | 68 | android:padding="5dp" |
| 69 | android:text="@string/obViaArchivo" | 69 | android:text="@string/obViaArchivo" |
| 70 | android:textSize="@dimen/NormalText" /> | 70 | android:textSize="@dimen/NormalText" /> |
| 71 | 71 | ||
| 72 | 72 | ||
| 73 | </RadioGroup> | 73 | </RadioGroup> |
| 74 | 74 | ||
| 75 | <TextView | 75 | <TextView |
| 76 | android:id="@+id/tvServerConectado" | 76 | android:id="@+id/tvServerConectado" |
| 77 | android:layout_width="match_parent" | 77 | android:layout_width="match_parent" |
| 78 | android:layout_height="wrap_content" | 78 | android:layout_height="wrap_content" |
| 79 | android:layout_margin="30dp" | 79 | android:layout_margin="30dp" |
| 80 | android:gravity="center" | 80 | android:gravity="center" |
| 81 | android:lines="2" | 81 | android:lines="2" |
| 82 | android:text="" | 82 | android:text="" |
| 83 | android:textColor="@android:color/black" | 83 | android:textColor="@android:color/black" |
| 84 | android:textSize="@dimen/SubTitulos" | 84 | android:textSize="@dimen/SubTitulos" |
| 85 | app:fontFamily="sans-serif-condensed" | 85 | app:fontFamily="sans-serif-condensed" |
| 86 | app:layout_constraintBottom_toTopOf="@+id/countriesList" | 86 | app:layout_constraintBottom_toTopOf="@+id/countriesList" |
| 87 | app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" /> | 87 | app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" /> |
| 88 | 88 | ||
| 89 | <TextView | 89 | <TextView |
| 90 | android:id="@+id/countriesList" | 90 | android:id="@+id/countriesList" |
| 91 | android:layout_width="0dp" | 91 | android:layout_width="0dp" |
| 92 | android:layout_height="wrap_content" | 92 | android:layout_height="wrap_content" |
| 93 | android:layout_marginTop="@dimen/MarginTopTitulos" | 93 | android:layout_marginTop="@dimen/MarginTopTitulos" |
| 94 | android:gravity="center" | 94 | android:gravity="center" |
| 95 | android:text="" | 95 | android:text="" |
| 96 | android:textColor="@android:color/black" | 96 | android:textColor="@android:color/black" |
| 97 | android:textSize="@dimen/SubTitulos" | 97 | android:textSize="@dimen/SubTitulos" |
| 98 | android:visibility="visible" | 98 | android:visibility="visible" |
| 99 | app:fontFamily="sans-serif-condensed" | 99 | app:fontFamily="sans-serif-condensed" |
| 100 | app:layout_constraintBottom_toTopOf="@+id/btnConfirmarAct" | 100 | app:layout_constraintBottom_toTopOf="@+id/btnConfirmarAct" |
| 101 | app:layout_constraintEnd_toEndOf="parent" | 101 | app:layout_constraintEnd_toEndOf="parent" |
| 102 | app:layout_constraintHorizontal_bias="0.0" | 102 | app:layout_constraintHorizontal_bias="0.0" |
| 103 | app:layout_constraintStart_toStartOf="parent" | 103 | app:layout_constraintStart_toStartOf="parent" |
| 104 | app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" | 104 | app:layout_constraintTop_toBottomOf="@+id/rgTipoActualizacion" |
| 105 | app:layout_constraintVertical_bias="0.106" /> | 105 | app:layout_constraintVertical_bias="0.106" /> |
| 106 | 106 | ||
| 107 | <Button | 107 | <Button |
| 108 | android:id="@+id/btnConfirmarAct" | 108 | android:id="@+id/btnConfirmarAct" |
| 109 | android:layout_width="0dp" | 109 | android:layout_width="0dp" |
| 110 | android:layout_height="wrap_content" | 110 | android:layout_height="wrap_content" |
| 111 | android:layout_margin="20dp" | 111 | android:layout_margin="20dp" |
| 112 | android:text="@string/btnConfirmarAct" | 112 | android:text="@string/btnConfirmarAct" |
| 113 | android:textSize="@dimen/NormalText" | 113 | android:textSize="@dimen/NormalText" |
| 114 | android:textColor="@android:color/white" | 114 | android:textColor="@android:color/white" |
| 115 | android:padding="10dp" | 115 | android:padding="10dp" |
| 116 | android:background="@drawable/boton_borde_redondeado" | 116 | android:background="@drawable/boton_borde_redondeado" |
| 117 | app:layout_constraintBottom_toBottomOf="parent" | 117 | app:layout_constraintBottom_toBottomOf="parent" |
| 118 | app:layout_constraintEnd_toEndOf="parent" | 118 | app:layout_constraintEnd_toEndOf="parent" |
| 119 | app:layout_constraintStart_toStartOf="parent" /> | 119 | app:layout_constraintStart_toStartOf="parent" /> |
| 120 | 120 | ||
| 121 | 121 | ||
| 122 | <ProgressBar | 122 | <ProgressBar |
| 123 | android:id="@+id/loading_view" | 123 | android:id="@+id/loading_view" |
| 124 | android:layout_width="wrap_content" | 124 | android:layout_width="wrap_content" |
| 125 | android:layout_height="wrap_content" | 125 | android:layout_height="wrap_content" |
| 126 | android:layout_marginStart="8dp" | 126 | android:layout_marginStart="8dp" |
| 127 | android:layout_marginLeft="8dp" | 127 | android:layout_marginLeft="8dp" |
| 128 | android:layout_marginTop="8dp" | 128 | android:layout_marginTop="8dp" |
| 129 | android:layout_marginEnd="8dp" | 129 | android:layout_marginEnd="8dp" |
| 130 | android:layout_marginRight="8dp" | 130 | android:layout_marginRight="8dp" |
| 131 | android:layout_marginBottom="8dp" | 131 | android:layout_marginBottom="8dp" |
| 132 | android:visibility="gone" | 132 | android:visibility="gone" |
| 133 | app:layout_constraintBottom_toBottomOf="parent" | 133 | app:layout_constraintBottom_toBottomOf="parent" |
| 134 | app:layout_constraintEnd_toEndOf="parent" | 134 | app:layout_constraintEnd_toEndOf="parent" |
| 135 | app:layout_constraintStart_toStartOf="parent" | 135 | app:layout_constraintStart_toStartOf="parent" |
| 136 | app:layout_constraintTop_toTopOf="parent" /> | 136 | app:layout_constraintTop_toTopOf="parent" /> |
| 137 | 137 | ||
| 138 | </androidx.constraintlayout.widget.ConstraintLayout> | 138 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 139 | 139 |
app/src/main/res/layout/fragment_inv_importados.xml
| File was created | 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> | ||
| 89 |
app/src/main/res/layout/fragment_main.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent"> | 6 | android:layout_height="match_parent"> |
| 7 | 7 | ||
| 8 | <androidx.appcompat.widget.AppCompatTextView | 8 | <androidx.appcompat.widget.AppCompatTextView |
| 9 | android:id="@+id/tvInvDinamicos" | 9 | android:id="@+id/tvInvDinamicos" |
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | android:layout_height="90dp" | 11 | android:layout_height="90dp" |
| 12 | android:autoSizeMaxTextSize="150sp" | 12 | android:autoSizeMaxTextSize="150sp" |
| 13 | android:autoSizeMinTextSize="25sp" | 13 | android:autoSizeMinTextSize="25sp" |
| 14 | android:autoSizeStepGranularity="5sp" | 14 | android:autoSizeStepGranularity="5sp" |
| 15 | android:autoSizeTextType="uniform" | 15 | android:autoSizeTextType="uniform" |
| 16 | android:gravity="start" | 16 | android:gravity="start" |
| 17 | android:lines="1" | 17 | android:lines="1" |
| 18 | android:padding="10dp" | 18 | android:padding="10dp" |
| 19 | android:text="@string/invDinamicoVenta" | 19 | android:text="@string/invDinamicoVenta" |
| 20 | android:textColor="@color/colorAccent" | 20 | android:textColor="@color/colorAccent" |
| 21 | android:visibility="visible" | 21 | android:visibility="visible" |
| 22 | app:fontFamily="sans-serif-condensed" | 22 | app:fontFamily="sans-serif-condensed" |
| 23 | app:layout_constraintEnd_toEndOf="parent" | 23 | app:layout_constraintEnd_toEndOf="parent" |
| 24 | app:layout_constraintStart_toStartOf="parent" | 24 | app:layout_constraintStart_toStartOf="parent" |
| 25 | app:layout_constraintTop_toTopOf="parent" /> | 25 | app:layout_constraintTop_toTopOf="parent" /> |
| 26 | 26 | ||
| 27 | <androidx.appcompat.widget.AppCompatImageButton | 27 | <androidx.appcompat.widget.AppCompatImageButton |
| 28 | android:id="@+id/ivSort19" | 28 | android:id="@+id/ivSort19" |
| 29 | android:layout_width="50dp" | 29 | android:layout_width="50dp" |
| 30 | android:layout_height="50dp" | 30 | android:layout_height="50dp" |
| 31 | android:layout_marginStart="10dp" | 31 | android:layout_marginStart="10dp" |
| 32 | android:padding="5dp" | 32 | android:padding="5dp" |
| 33 | android:src="@drawable/ic_sort19" | 33 | android:src="@drawable/ic_sort19" |
| 34 | android:visibility="gone" | 34 | android:visibility="gone" |
| 35 | app:layout_constraintHorizontal_bias="0.0" | 35 | app:layout_constraintHorizontal_bias="0.0" |
| 36 | app:layout_constraintHorizontal_chainStyle="packed" | 36 | app:layout_constraintHorizontal_chainStyle="packed" |
| 37 | app:layout_constraintStart_toStartOf="parent" | 37 | app:layout_constraintStart_toStartOf="parent" |
| 38 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | 38 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> |
| 39 | 39 | ||
| 40 | <androidx.appcompat.widget.AppCompatImageButton | 40 | <androidx.appcompat.widget.AppCompatImageButton |
| 41 | android:id="@+id/ivSort91" | 41 | android:id="@+id/ivSort91" |
| 42 | android:layout_width="50dp" | 42 | android:layout_width="50dp" |
| 43 | android:layout_height="50dp" | 43 | android:layout_height="50dp" |
| 44 | android:layout_marginStart="10dp" | 44 | android:layout_marginStart="10dp" |
| 45 | android:padding="5dp" | 45 | android:padding="5dp" |
| 46 | android:src="@drawable/ic_sort91" | 46 | android:src="@drawable/ic_sort91" |
| 47 | android:visibility="gone" | 47 | android:visibility="gone" |
| 48 | app:layout_constraintHorizontal_chainStyle="packed" | 48 | app:layout_constraintHorizontal_chainStyle="packed" |
| 49 | app:layout_constraintStart_toStartOf="parent" | 49 | app:layout_constraintStart_toStartOf="parent" |
| 50 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | 50 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> |
| 51 | 51 | ||
| 52 | <TextView | 52 | <TextView |
| 53 | android:id="@+id/tvTipo" | 53 | android:id="@+id/tvTipo" |
| 54 | android:layout_width="wrap_content" | 54 | android:layout_width="wrap_content" |
| 55 | android:layout_height="wrap_content" | 55 | android:layout_height="wrap_content" |
| 56 | android:layout_margin="5dp" | 56 | android:layout_margin="5dp" |
| 57 | android:text="Tipo:" | 57 | android:text="Tipo:" |
| 58 | android:layout_marginTop="12dp" | 58 | android:layout_marginTop="12dp" |
| 59 | android:textSize="15sp" | 59 | android:textSize="15sp" |
| 60 | android:visibility="gone" | 60 | android:visibility="gone" |
| 61 | app:layout_constraintBaseline_toBaselineOf="@+id/cbVentas" | 61 | app:layout_constraintBaseline_toBaselineOf="@+id/cbVentas" |
| 62 | app:layout_constraintEnd_toStartOf="@+id/cbVentas" /> | 62 | app:layout_constraintEnd_toStartOf="@+id/cbVentas" /> |
| 63 | 63 | ||
| 64 | <com.google.android.material.checkbox.MaterialCheckBox | 64 | <com.google.android.material.checkbox.MaterialCheckBox |
| 65 | android:id="@+id/cbVentas" | 65 | android:id="@+id/cbVentas" |
| 66 | android:layout_width="wrap_content" | 66 | android:layout_width="wrap_content" |
| 67 | android:layout_height="wrap_content" | 67 | android:layout_height="wrap_content" |
| 68 | android:layout_margin="5dp" | 68 | android:layout_margin="5dp" |
| 69 | android:checked="true" | 69 | android:checked="true" |
| 70 | android:text="Ventas" | 70 | android:text="Ventas" |
| 71 | android:layout_marginTop="12dp" | 71 | android:layout_marginTop="12dp" |
| 72 | android:visibility="gone" | 72 | android:visibility="gone" |
| 73 | app:layout_constraintEnd_toStartOf="@+id/cbDeposito" | 73 | app:layout_constraintEnd_toStartOf="@+id/cbDeposito" |
| 74 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> | 74 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> |
| 75 | 75 | ||
| 76 | <com.google.android.material.checkbox.MaterialCheckBox | 76 | <com.google.android.material.checkbox.MaterialCheckBox |
| 77 | android:id="@+id/cbDeposito" | 77 | android:id="@+id/cbDeposito" |
| 78 | android:layout_width="wrap_content" | 78 | android:layout_width="wrap_content" |
| 79 | android:layout_height="wrap_content" | 79 | android:layout_height="wrap_content" |
| 80 | android:layout_margin="5dp" | 80 | android:layout_margin="5dp" |
| 81 | android:checked="true" | 81 | android:checked="true" |
| 82 | android:text="Deposito" | 82 | android:text="Deposito" |
| 83 | android:layout_marginTop="12dp" | 83 | android:layout_marginTop="12dp" |
| 84 | android:visibility="gone" | 84 | android:visibility="gone" |
| 85 | app:layout_constraintEnd_toEndOf="parent" | 85 | app:layout_constraintEnd_toEndOf="parent" |
| 86 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> | 86 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> |
| 87 | 87 | ||
| 88 | <androidx.recyclerview.widget.RecyclerView | 88 | <androidx.recyclerview.widget.RecyclerView |
| 89 | android:id="@+id/rcInventario" | 89 | android:id="@+id/rcInventario" |
| 90 | android:layout_width="match_parent" | 90 | android:layout_width="match_parent" |
| 91 | android:layout_height="0dp" | 91 | android:layout_height="0dp" |
| 92 | android:background="@android:color/darker_gray" | 92 | android:background="@android:color/darker_gray" |
| 93 | android:scrollbars="vertical" | 93 | android:scrollbars="vertical" |
| 94 | android:visibility="gone" | 94 | android:visibility="gone" |
| 95 | app:layout_constraintEnd_toEndOf="parent" | 95 | app:layout_constraintEnd_toEndOf="parent" |
| 96 | app:layout_constraintStart_toStartOf="parent" | 96 | app:layout_constraintStart_toStartOf="parent" |
| 97 | app:layout_constraintTop_toBottomOf="@id/ivSort19" | 97 | app:layout_constraintTop_toBottomOf="@id/ivSort19" |
| 98 | tools:listitem="@layout/item_principal" | 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 | <androidx.appcompat.widget.AppCompatTextView | 102 | <androidx.appcompat.widget.AppCompatTextView |
| 103 | android:id="@+id/txtDeposito" | 103 | android:id="@+id/tvInvImportados" |
| 104 | android:layout_width="match_parent" | 104 | android:layout_width="match_parent" |
| 105 | android:layout_height="90dp" | 105 | android:layout_height="90dp" |
| 106 | android:autoSizeMaxTextSize="150sp" | 106 | android:autoSizeMaxTextSize="150sp" |
| 107 | android:autoSizeMinTextSize="25sp" | 107 | android:autoSizeMinTextSize="25sp" |
| 108 | android:autoSizeStepGranularity="5sp" | 108 | android:autoSizeStepGranularity="5sp" |
| 109 | android:autoSizeTextType="uniform" | 109 | android:autoSizeTextType="uniform" |
| 110 | android:gravity="start" | 110 | android:gravity="start" |
| 111 | android:lines="1" | 111 | android:lines="1" |
| 112 | android:padding="10dp" | 112 | android:padding="10dp" |
| 113 | android:text="@string/invDinamicoCompra" | 113 | android:text="@string/invDinamicoCompra" |
| 114 | android:textColor="@color/colorAccent" | 114 | android:textColor="@color/colorAccent" |
| 115 | android:visibility="visible" | 115 | android:visibility="visible" |
| 116 | app:fontFamily="sans-serif-condensed" | 116 | app:fontFamily="sans-serif-condensed" |
| 117 | app:layout_constraintBottom_toBottomOf="parent" | 117 | app:layout_constraintBottom_toBottomOf="parent" |
| 118 | app:layout_constraintEnd_toEndOf="parent" | 118 | app:layout_constraintEnd_toEndOf="parent" |
| 119 | app:layout_constraintStart_toStartOf="parent" | 119 | app:layout_constraintStart_toStartOf="parent" |
| 120 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" | 120 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" |
| 121 | app:layout_constraintVertical_bias="0.0" /> | 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 | </androidx.constraintlayout.widget.ConstraintLayout> | 204 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/item_inv_importados.xml
| File was created | 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> |
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.UI.MainActivity" | 10 | android:name="com.focasoftware.deboinventariov20.UI.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 | 13 | ||
| 14 | <fragment | 14 | <fragment |
| 15 | android:id="@+id/mainFragment2" | 15 | android:id="@+id/mainFragment2" |
| 16 | android:name="com.focasoftware.deboinventariov20.UI.main.MainFragment" | 16 | android:name="com.focasoftware.deboinventariov20.UI.main.MainFragment" |
| 17 | android:label="Principal" | 17 | android:label="Principal" |
| 18 | tools:layout="@layout/fragment_main" > | 18 | tools:layout="@layout/fragment_main" > |
| 19 | <action | 19 | <action |
| 20 | android:id="@+id/action_mainFragment2_to_configuracionFragment" | 20 | android:id="@+id/action_mainFragment2_to_configuracionFragment" |
| 21 | app:destination="@id/configuracionFragment" | 21 | app:destination="@id/configuracionFragment" |
| 22 | app:popEnterAnim="@anim/slide_in_left" | 22 | app:popEnterAnim="@anim/slide_in_left" |
| 23 | app:popExitAnim="@anim/slide_out_right" | 23 | app:popExitAnim="@anim/slide_out_right" |
| 24 | app:enterAnim="@anim/slide_in_right" | 24 | app:enterAnim="@anim/slide_in_right" |
| 25 | app:exitAnim="@anim/slide_out_left" /> | 25 | app:exitAnim="@anim/slide_out_left" /> |
| 26 | <action | 26 | <action |
| 27 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" | 27 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" |
| 28 | app:destination="@id/actuaMaestrosFragment" | 28 | app:destination="@id/actuaMaestrosFragment" |
| 29 | app:popEnterAnim="@anim/slide_in_left" | 29 | app:popEnterAnim="@anim/slide_in_left" |
| 30 | app:popExitAnim="@anim/slide_out_right" | 30 | app:popExitAnim="@anim/slide_out_right" |
| 31 | app:enterAnim="@anim/slide_in_right" | 31 | app:enterAnim="@anim/slide_in_right" |
| 32 | app:exitAnim="@anim/slide_out_left" /> | 32 | app:exitAnim="@anim/slide_out_left" /> |
| 33 | <action | 33 | <action |
| 34 | android:id="@+id/action_mainFragment2_to_inventarioFragment" | 34 | android:id="@+id/action_mainFragment2_to_inventarioFragment" |
| 35 | app:destination="@id/inventarioFragment" | 35 | app:destination="@id/inventarioFragment" |
| 36 | app:popEnterAnim="@anim/slide_in_left" | 36 | app:popEnterAnim="@anim/slide_in_left" |
| 37 | app:popExitAnim="@anim/slide_out_right" | 37 | app:popExitAnim="@anim/slide_out_right" |
| 38 | app:enterAnim="@anim/slide_in_right" | 38 | app:enterAnim="@anim/slide_in_right" |
| 39 | app:exitAnim="@anim/slide_out_left" /> | 39 | app:exitAnim="@anim/slide_out_left" /> |
| 40 | </fragment> | 40 | </fragment> |
| 41 | 41 | ||
| 42 | <fragment | 42 | <fragment |
| 43 | android:id="@+id/actuaMaestrosFragment" | 43 | android:id="@+id/actuaMaestrosFragment" |
| 44 | android:name="com.focasoftware.deboinventariov20.UI.actualizacionMaestros.ActuaMaestrosFragment" | 44 | android:name="com.focasoftware.deboinventariov20.UI.actualizacionMaestros.ActuaMaestrosFragment" |
| 45 | android:label="Importaciones Varias" | 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 | <fragment | 53 | <fragment |
| 50 | android:id="@+id/inventarioFragment" | 54 | android:id="@+id/inventarioFragment" |
| 51 | android:name="com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment" | 55 | android:name="com.focasoftware.deboinventariov20.UI.inventario.InventarioFragment" |
| 52 | android:label="Inventario Dinamico" | 56 | android:label="Inventario Dinamico" |
| 53 | tools:layout="@layout/fragment_inventario" > | 57 | tools:layout="@layout/fragment_inventario" > |
| 54 | <action | 58 | <action |
| 55 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" | 59 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" |
| 56 | app:destination="@id/descripcionFragment" | 60 | app:destination="@id/descripcionFragment" |
| 57 | app:popEnterAnim="@anim/slide_in_left" | 61 | app:popEnterAnim="@anim/slide_in_left" |
| 58 | app:popExitAnim="@anim/slide_out_right" | 62 | app:popExitAnim="@anim/slide_out_right" |
| 59 | app:enterAnim="@anim/slide_in_right" | 63 | app:enterAnim="@anim/slide_in_right" |
| 60 | app:exitAnim="@anim/slide_out_left" | 64 | app:exitAnim="@anim/slide_out_left" |
| 61 | /> | 65 | /> |
| 62 | <action | 66 | <action |
| 63 | android:id="@+id/action_inventarioFragment_to_mainFragment2" | 67 | android:id="@+id/action_inventarioFragment_to_mainFragment2" |
| 64 | app:destination="@id/mainFragment2" | 68 | app:destination="@id/mainFragment2" |
| 65 | app:popEnterAnim="@anim/slide_in_left" | 69 | app:popEnterAnim="@anim/slide_in_left" |
| 66 | app:popExitAnim="@anim/slide_out_right" | 70 | app:popExitAnim="@anim/slide_out_right" |
| 67 | app:enterAnim="@anim/slide_in_right" | 71 | app:enterAnim="@anim/slide_in_right" |
| 68 | app:exitAnim="@anim/slide_out_left"/> | 72 | app:exitAnim="@anim/slide_out_left"/> |
| 69 | <action | 73 | <action |
| 70 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" | 74 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" |
| 71 | app:destination="@id/detalleArtFragment" /> | 75 | app:destination="@id/detalleArtFragment" /> |
| 72 | <action | 76 | <action |
| 73 | android:id="@+id/action_inventarioFragment_to_codigoOriFragment" | 77 | android:id="@+id/action_inventarioFragment_to_codigoOriFragment" |
| 74 | app:destination="@id/codigoOriFragment" /> | 78 | app:destination="@id/codigoOriFragment" /> |
| 75 | </fragment> | 79 | </fragment> |
| 76 | 80 | ||
| 77 | <fragment | 81 | <fragment |
| 78 | android:id="@+id/descripcionFragment" | 82 | android:id="@+id/descripcionFragment" |
| 79 | android:name="com.focasoftware.deboinventariov20.UI.descripcionFragment.DescripcionFragment" | 83 | android:name="com.focasoftware.deboinventariov20.UI.descripcionFragment.DescripcionFragment" |
| 80 | android:label="Busqueda por Descripción"> | 84 | android:label="Busqueda por Descripción"> |
| 81 | <action | 85 | <action |
| 82 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 86 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
| 83 | app:destination="@id/inventarioFragment" | 87 | app:destination="@id/inventarioFragment" |
| 84 | app:enterAnim="@anim/slide_in_right" | 88 | app:enterAnim="@anim/slide_in_right" |
| 85 | app:exitAnim="@anim/slide_out_left" | 89 | app:exitAnim="@anim/slide_out_left" |
| 86 | app:popEnterAnim="@anim/slide_in_left" | 90 | app:popEnterAnim="@anim/slide_in_left" |
| 87 | app:popExitAnim="@anim/slide_out_right" /> | 91 | app:popExitAnim="@anim/slide_out_right" /> |
| 88 | </fragment> | 92 | </fragment> |
| 89 | 93 | ||
| 90 | <fragment | 94 | <fragment |
| 91 | android:id="@+id/detalleArtFragment" | 95 | android:id="@+id/detalleArtFragment" |
| 92 | android:name="com.focasoftware.deboinventariov20.UI.detalleProducto.DetalleArtFragment" | 96 | android:name="com.focasoftware.deboinventariov20.UI.detalleProducto.DetalleArtFragment" |
| 93 | android:label="Información Artículo" | 97 | android:label="Información Artículo" |
| 94 | tools:layout="@layout/fragment_detalle_art"> | 98 | tools:layout="@layout/fragment_detalle_art"> |
| 95 | <action | 99 | <action |
| 96 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" | 100 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" |
| 97 | app:destination="@id/inventarioFragment" /> | 101 | app:destination="@id/inventarioFragment" /> |
| 98 | </fragment> | 102 | </fragment> |
| 99 | <fragment | 103 | <fragment |
| 100 | android:id="@+id/configuracionFragment" | 104 | android:id="@+id/configuracionFragment" |
| 101 | android:name="com.focasoftware.deboinventariov20.UI.configuracion.ConfiguracionFragment" | 105 | android:name="com.focasoftware.deboinventariov20.UI.configuracion.ConfiguracionFragment" |
| 102 | android:label="Configuraciones" | 106 | android:label="Configuraciones" |
| 103 | tools:layout="@layout/fragment_configuracion" > | 107 | tools:layout="@layout/fragment_configuracion" > |
| 104 | <action | 108 | <action |
| 105 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | 109 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" |
| 106 | app:destination="@id/servidoresFragment" | 110 | app:destination="@id/servidoresFragment" |
| 107 | app:popEnterAnim="@anim/slide_in_left" | 111 | app:popEnterAnim="@anim/slide_in_left" |
| 108 | app:popExitAnim="@anim/slide_out_right" | 112 | app:popExitAnim="@anim/slide_out_right" |
| 109 | app:enterAnim="@anim/slide_in_right" | 113 | app:enterAnim="@anim/slide_in_right" |
| 110 | app:exitAnim="@anim/slide_out_left" /> | 114 | app:exitAnim="@anim/slide_out_left" /> |
| 111 | <action | 115 | <action |
| 112 | android:id="@+id/action_configuracionFragment_to_mainFragment2" | 116 | android:id="@+id/action_configuracionFragment_to_mainFragment2" |
| 113 | app:destination="@id/mainFragment2" | 117 | app:destination="@id/mainFragment2" |
| 114 | app:popUpTo="@id/configuracionFragment" | 118 | app:popUpTo="@id/configuracionFragment" |
| 115 | app:popUpToInclusive="false" /> | 119 | app:popUpToInclusive="false" /> |
| 116 | </fragment> | 120 | </fragment> |
| 117 | 121 | ||
| 118 | <fragment | 122 | <fragment |
| 119 | android:id="@+id/servidoresFragment" | 123 | android:id="@+id/servidoresFragment" |
| 120 | android:name="com.focasoftware.deboinventariov20.UI.servidores.ServidoresFragment" | 124 | android:name="com.focasoftware.deboinventariov20.UI.servidores.ServidoresFragment" |
| 121 | android:label="Alta Servidores" | 125 | android:label="Alta Servidores" |
| 122 | tools:layout="@layout/fragment_servidores"> | 126 | tools:layout="@layout/fragment_servidores"> |
| 123 | <action | 127 | <action |
| 124 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | 128 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" |
| 125 | app:destination="@id/configuracionFragment" | 129 | app:destination="@id/configuracionFragment" |
| 126 | app:popUpTo="@id/servidoresFragment" | 130 | app:popUpTo="@id/servidoresFragment" |
| 127 | app:popUpToInclusive="false" /> | 131 | app:popUpToInclusive="false" /> |
| 128 | </fragment> | 132 | </fragment> |
| 129 | <fragment | 133 | <fragment |
| 130 | android:id="@+id/codigoOriFragment" | 134 | android:id="@+id/codigoOriFragment" |
| 131 | android:name="com.focasoftware.deboinventariov20.UI.descripCorigenFragment.CodigoOriFragment" | 135 | android:name="com.focasoftware.deboinventariov20.UI.descripCorigenFragment.CodigoOriFragment" |
| 132 | android:label="Busqueda por Código de Origen"> | 136 | android:label="Busqueda por Código de Origen"> |
| 133 | <action | 137 | <action |
| 134 | android:id="@+id/action_codigoOriFragment_to_inventarioFragment" | 138 | android:id="@+id/action_codigoOriFragment_to_inventarioFragment" |
| 135 | app:destination="@id/inventarioFragment" /> | 139 | app:destination="@id/inventarioFragment" /> |
| 136 | </fragment> | 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 | </navigation> | 150 | </navigation> |
| 138 | 151 |
app/src/main/res/values/strings.xml
| 1 | <resources> | 1 | <resources> |
| 2 | 2 | ||
| 3 | <string name="action_settings">Ayuda</string> | 3 | <string name="action_settings">Ayuda</string> |
| 4 | <string name="app_name">DEBO Inventarios</string> | 4 | <string name="app_name">DEBO Inventarios</string> |
| 5 | 5 | ||
| 6 | <!-- menu--> | 6 | <!-- menu--> |
| 7 | <string name="menuInicio">Principal</string> | 7 | <string name="menuInicio">Principal</string> |
| 8 | <string name="menuNueInv">Nuevo Inventario</string> | 8 | <string name="menuNueInv">Nuevo Inventario</string> |
| 9 | <string name="menuActMae">Importaciones</string> | 9 | <string name="menuActMae">Importaciones</string> |
| 10 | <string name="menuConf">Configuraciones</string> | 10 | <string name="menuConf">Configuraciones</string> |
| 11 | <string name="menuSal">Salir</string> | 11 | <string name="menuSal">Salir</string> |
| 12 | 12 | ||
| 13 | <!-- Menu header--> | 13 | <!-- Menu header--> |
| 14 | <string name="menuLeyenda">Debo Inventario</string> | 14 | <string name="menuLeyenda">Debo Inventario</string> |
| 15 | 15 | ||
| 16 | <string name="navigation_drawer_open">Open navigation drawer</string> | 16 | <string name="navigation_drawer_open">Open navigation drawer</string> |
| 17 | <string name="navigation_drawer_close">Close navigation drawer</string> | 17 | <string name="navigation_drawer_close">Close navigation drawer</string> |
| 18 | 18 | ||
| 19 | <!-- Pantalla de inicio--> | 19 | <!-- Pantalla de inicio--> |
| 20 | <string name="bien">Bienvenido</string> | 20 | <string name="bien">Bienvenido</string> |
| 21 | <string name="debo">DEBO®</string> | 21 | <string name="debo">DEBO®</string> |
| 22 | <string name="inventario">Inventario</string> | 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 | <!-- inventarios dinamicos--> | 24 | <!-- inventarios dinamicos--> |
| 27 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> | 25 | <string name="invDinamicoVenta">Inventarios Dinámicos</string> |
| 28 | <string name="invDinamicoCompra">Inventarios Importados(0) +</string> | 26 | <string name="invDinamicoCompra">Inventarios Importados(0) +</string> |
| 29 | 27 | ||
| 30 | <!-- ventana emergente--> | 28 | <!-- ventana emergente--> |
| 31 | <string name="adv">Ingrese la cantidad contada</string> | 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 | <string name="btnCancela">Cancelar</string> | 31 | <string name="btnCancela">Cancelar</string> |
| 34 | 32 | ||
| 35 | 33 | ||
| 36 | <!-- Fragment Inventario--> | 34 | <!-- Fragment Inventario--> |
| 37 | <string name="invTitulo">Inventarios Dinámicos</string> | 35 | <string name="invTitulo">Inventarios Dinámicos</string> |
| 38 | <string name="invTituloV">Inventarios de Ventas</string> | 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 | <string name="invCodigoBarras">Código Barras:</string> | 38 | <string name="invCodigoBarras">Código Barras:</string> |
| 41 | <string name="btnExportarInv">Exportar Inventario</string> | 39 | <string name="btnExportarInv">Exportar Inventario</string> |
| 42 | <string name="btnBorrarInv">Borrar Inventario</string> | 40 | <string name="btnBorrarInv">Borrar Inventario</string> |
| 43 | <string name="ibBusDesc">Busqueda por Descripción</string> | 41 | <string name="ibBusDesc">Búsqueda por Descripción</string> |
| 44 | <string name="ibBusCB">Busqueda por Código Barras</string> | 42 | <string name="ibBusCB">Búsqueda por Código Barras</string> |
| 45 | <string name="ibBusCO">Busqueda por Código de Origen</string> | 43 | <string name="ibBusCO">Búsqueda por Código de Origen</string> |
| 46 | <string name="switch_1">+ 1</string> | 44 | <string name="switch_1">+ 1</string> |
| 47 | 45 | ||
| 48 | <!-- Fragmento Configuraciones--> | 46 | <!-- Fragmento Configuraciones--> |
| 49 | <string name="tvTituloConf">Configuraciones</string> | 47 | <string name="tvTituloConf">Configuraciones</string> |
| 50 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> | 48 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> |
| 51 | <string name="btnValidarServidor">Validar</string> | 49 | <string name="btnValidarServidor">Validar</string> |
| 52 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> | 50 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> |
| 53 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> | 51 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> |
| 54 | <string name="tvTituloArea">Area de Invetnario</string> | 52 | <string name="tvTituloArea">Area de Invetnario</string> |
| 55 | <string name="rbVentas">Inventarios de Ventas</string> | 53 | <string name="rbVentas">Inventarios de Ventas</string> |
| 56 | <string name="rbDeposito">Inventarios de Depositos</string> | 54 | <string name="rbDeposito">Inventarios de Depositos</string> |
| 57 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> | 55 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> |
| 58 | <string name="tvColumnas">Columnas a Visualizar</string> | 56 | <string name="tvColumnas">Columnas a Visualizar</string> |
| 59 | 57 | ||
| 60 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> | 58 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> |
| 61 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> | 59 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> |
| 62 | 60 | ||
| 63 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> | 61 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> |
| 64 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> | 62 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> |
| 65 | 63 | ||
| 66 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> | 64 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> |
| 67 | 65 | ||
| 68 | <string name="rbCodigoDebo">Código DEBO</string> | 66 | <string name="rbCodigoDebo">Código DEBO</string> |
| 69 | <string name="rbCodigoOrigen">Código Origen</string> | 67 | <string name="rbCodigoOrigen">Código Origen</string> |
| 70 | <string name="rbCodigoBarras">Código de Barras</string> | 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 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> | 70 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> |
| 80 | 71 | ||
| 81 | <string name="cbMostrarExistencia">Existencia</string> | 72 | <string name="cbMostrarExistencia">Existencia</string> |
| 82 | <string name="cbMostrarPrecio">Precio</string> | 73 | <string name="cbMostrarPrecio">Precio</string> |
| 83 | 74 | ||
| 84 | <string name="btnGuardar">Guardar Cambios</string> | 75 | <string name="btnGuardar">Guardar Cambios</string> |
| 85 | 76 | <string name="todo"> </string> | |
| 77 | todo | ||
| 86 | <!-- fragment Actualizacion de Maestros--> | 78 | <!-- fragment Actualizacion de Maestros--> |
| 87 | <string name="tvActMaestros">Importaciones</string> | 79 | <string name="tvActMaestros">Importaciones</string> |
| 88 | <string name="tvMedio">Seleccione que tipo de importación desea realizar</string> | 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 | <string name="obPorWifi">Importación de artículos</string> | 83 | <string name="obPorWifi">Importación de artículos</string> |
| 90 | <string name="obViaArchivo">Importación de inventarios</string> | 84 | <string name="obViaArchivo">Importación de inventarios</string> |
| 91 | 85 | ||
| 92 | <string name="btnConfirmarAct">Confirmar Importación</string> | 86 | <string name="btnConfirmarAct">Confirmar Importación</string> |
| 87 | <string name="btnConfirmarInv">Confirmar Inventarios</string> | ||
| 93 | 88 | ||
| 94 | <!-- Fragment Save--> | 89 | <!-- Fragment Save--> |
| 95 | <string name="tvConfServi">Configuración de Servidores</string> | 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 | <string name="etNomServer">Ingrese una descripción para la conexión</string> | 92 | <string name="etNomServer">Ingrese una descripción para la conexión</string> |
| 98 | <string name="btnGuardarConfServ">Guardar Conexión</string> | 93 | <string name="btnGuardarConfServ">Guardar Conexión</string> |
| 99 | 94 | ||
| 100 | <!-- Dialog--> | 95 | <!-- Dialog--> |
| 101 | <string name="sTitulo">Producto Buscado</string> | 96 | <string name="sTitulo">Producto Buscado</string> |
| 102 | <string name="btnOk">Aceptar</string> | 97 | <string name="btnOk">Aceptar</string> |
| 103 | <string name="btnConfirmar">Confirmar</string> | 98 | <string name="btnConfirmar">Confirmar</string> |
| 104 | <string name="btnCancelar">Cancelar</string> | 99 | <string name="btnCancelar">Cancelar</string> |
| 105 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> | 100 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> |
| 106 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> | 101 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> |
| 107 | <string name="sTituloNueva">Producto ingresado esta cargado</string> | 102 | <string name="sTituloNueva">Producto ingresado esta cargado</string> |
| 108 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> | 103 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> |
| 109 | 104 | ||
| 110 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> | 105 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> |
| 111 | <string name="sTituloExportar">Exportación de Inventarios</string> | 106 | <string name="sTituloExportar">Exportación de Inventarios</string> |
| 112 | 107 | ||
| 113 | <!-- FRAGMENT SERVIDOR--> | 108 | <!-- FRAGMENT SERVIDOR--> |
| 114 | <string name="tvTitutloServer">Alta de Servidores</string> | 109 | <string name="tvTitutloServer">Alta de Servidores</string> |
| 115 | <string name="tvNomServer">Descripción para identificar al servidor</string> | 110 | <string name="tvNomServer">Descripción para identificar al servidor</string> |
| 116 | <string name="tvDirServer">Dirección del servidor</string> | 111 | <string name="tvDirServer">Dirección del servidor</string> |
| 117 | <string name="btnGuardarServidores">Guardar Servidor</string> | 112 | <string name="btnGuardarServidores">Guardar Servidor</string> |
| 118 | 113 | ||
| 119 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> | 114 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> |
| 120 | <string name="rbSumar">Sumar</string> | 115 | <string name="rbSumar">Sumar</string> |
| 121 | <string name="rbRestar">Restar</string> | 116 | <string name="rbRestar">Restar</string> |
| 122 | <string name="rbModificar">Reemplazar</string> | 117 | <string name="rbModificar">Reemplazar</string> |
| 123 | <string name="tvTotal">Cantidad Final</string>tvTotal | 118 | <string name="tvTotal">Cantidad Final</string>tvTotal |
| 124 | <string name="tvResultado">Resultado:</string>tvTotal | 119 | <string name="tvResultado">Resultado:</string>tvTotal |
| 125 | 120 | ||
| 126 | <string name="large_text"> | 121 | <string name="large_text"> |
| 127 | "Material is the metaphor.\n\n" | 122 | "Material is the metaphor.\n\n" |
| 128 | 123 | ||
| 129 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." | 124 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." |
| 130 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " | 125 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " |
| 131 | "technologically advanced and open to imagination and magic.\n" | 126 | "technologically advanced and open to imagination and magic.\n" |
| 132 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " | 127 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " |
| 133 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " | 128 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " |
| 134 | "flexibility of the material creates new affordances that supercede those in the physical " | 129 | "flexibility of the material creates new affordances that supercede those in the physical " |
| 135 | "world, without breaking the rules of physics.\n" | 130 | "world, without breaking the rules of physics.\n" |
| 136 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " | 131 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " |
| 137 | "interact, and exist in space and in relation to each other. Realistic lighting shows " | 132 | "interact, and exist in space and in relation to each other. Realistic lighting shows " |
| 138 | "seams, divides space, and indicates moving parts.\n\n" | 133 | "seams, divides space, and indicates moving parts.\n\n" |
| 139 | 134 | ||
| 140 | "Bold, graphic, intentional.\n\n" | 135 | "Bold, graphic, intentional.\n\n" |
| 141 | 136 | ||
| 142 | "The foundational elements of print based design typography, grids, space, scale, color, " | 137 | "The foundational elements of print based design typography, grids, space, scale, color, " |
| 143 | "and use of imagery guide visual treatments. These elements do far more than please the " | 138 | "and use of imagery guide visual treatments. These elements do far more than please the " |
| 144 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " | 139 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " |
| 145 | "imagery, large scale typography, and intentional white space create a bold and graphic " | 140 | "imagery, large scale typography, and intentional white space create a bold and graphic " |
| 146 | "interface that immerse the user in the experience.\n" | 141 | "interface that immerse the user in the experience.\n" |
| 147 | "An emphasis on user actions makes core functionality immediately apparent and provides " | 142 | "An emphasis on user actions makes core functionality immediately apparent and provides " |
| 148 | "waypoints for the user.\n\n" | 143 | "waypoints for the user.\n\n" |
| 149 | 144 | ||
| 150 | "Motion provides meaning.\n\n" | 145 | "Motion provides meaning.\n\n" |
| 151 | 146 | ||
| 152 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " | 147 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " |
| 153 | "inflection points that initiate motion, transforming the whole design.\n" | 148 | "inflection points that initiate motion, transforming the whole design.\n" |
| 154 | "All action takes place in a single environment. Objects are presented to the user without " | 149 | "All action takes place in a single environment. Objects are presented to the user without " |
| 155 | "breaking the continuity of experience even as they transform and reorganize.\n" | 150 | "breaking the continuity of experience even as they transform and reorganize.\n" |
| 156 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " | 151 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " |
| 157 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" | 152 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" |
| 158 | 153 | ||
| 159 | "3D world.\n\n" | 154 | "3D world.\n\n" |
| 160 | 155 | ||
| 161 | "The material environment is a 3D space, which means all objects have x, y, and z " | 156 | "The material environment is a 3D space, which means all objects have x, y, and z " |
| 162 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " | 157 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " |
| 163 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " | 158 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " |
| 164 | "position along the z-axis and has a standard 1dp thickness.\n" | 159 | "position along the z-axis and has a standard 1dp thickness.\n" |
| 165 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " | 160 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " |
| 166 | "emulated by manipulating the y-axis.\n\n" | 161 | "emulated by manipulating the y-axis.\n\n" |
| 167 | 162 | ||
| 168 | "Light and shadow.\n\n" | 163 | "Light and shadow.\n\n" |
| 169 | 164 | ||
| 170 | "Within the material environment, virtual lights illuminate the scene. Key lights create " | 165 | "Within the material environment, virtual lights illuminate the scene. Key lights create " |
| 171 | "directional shadows, while ambient light creates soft shadows from all angles.\n" | 166 | "directional shadows, while ambient light creates soft shadows from all angles.\n" |
| 172 | "Shadows in the material environment are cast by these two light sources. In Android " | 167 | "Shadows in the material environment are cast by these two light sources. In Android " |
| 173 | "development, shadows occur when light sources are blocked by sheets of material at " | 168 | "development, shadows occur when light sources are blocked by sheets of material at " |
| 174 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " | 169 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " |
| 175 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" | 170 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" |
| 176 | 171 | ||
| 177 | "Resting elevation.\n\n" | 172 | "Resting elevation.\n\n" |
| 178 | 173 | ||
| 179 | "All material objects, regardless of size, have a resting elevation, or default elevation " | 174 | "All material objects, regardless of size, have a resting elevation, or default elevation " |
| 180 | "that does not change. If an object changes elevation, it should return to its resting " | 175 | "that does not change. If an object changes elevation, it should return to its resting " |
| 181 | "elevation as soon as possible.\n\n" | 176 | "elevation as soon as possible.\n\n" |
| 182 | 177 | ||
| 183 | "Component elevations.\n\n" | 178 | "Component elevations.\n\n" |
| 184 | 179 | ||
| 185 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " | 180 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " |
| 186 | "does not vary from 6dp in one app to 16dp in another app).\n" | 181 | "does not vary from 6dp in one app to 16dp in another app).\n" |
| 187 | "Components may have different resting elevations across platforms, depending on the depth " | 182 | "Components may have different resting elevations across platforms, depending on the depth " |
| 188 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" | 183 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" |
| 189 | 184 | ||
| 190 | "Responsive elevation and dynamic elevation offsets.\n\n" | 185 | "Responsive elevation and dynamic elevation offsets.\n\n" |
| 191 | 186 | ||
| 192 | "Some component types have responsive elevation, meaning they change elevation in response " | 187 | "Some component types have responsive elevation, meaning they change elevation in response " |
| 193 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " | 188 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " |
| 194 | "changes are consistently implemented using dynamic elevation offsets.\n" | 189 | "changes are consistently implemented using dynamic elevation offsets.\n" |
| 195 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " | 190 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " |
| 196 | "to the component’s resting state. They ensure that elevation changes are consistent " | 191 | "to the component’s resting state. They ensure that elevation changes are consistent " |
| 197 | "across actions and component types. For example, all components that lift on press have " | 192 | "across actions and component types. For example, all components that lift on press have " |
| 198 | "the same elevation change relative to their resting elevation.\n" | 193 | "the same elevation change relative to their resting elevation.\n" |
| 199 | "Once the input event is completed or cancelled, the component will return to its resting " | 194 | "Once the input event is completed or cancelled, the component will return to its resting " |
| 200 | "elevation.\n\n" | 195 | "elevation.\n\n" |
| 201 | 196 | ||
| 202 | "Avoiding elevation interference.\n\n" | 197 | "Avoiding elevation interference.\n\n" |
| 203 | 198 | ||
| 204 | "Components with responsive elevations may encounter other components as they move between " | 199 | "Components with responsive elevations may encounter other components as they move between " |
| 205 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " | 200 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " |
| 206 | "through other material, components avoid interfering with one another any number of ways, " | 201 | "through other material, components avoid interfering with one another any number of ways, " |
| 207 | "whether on a per component basis or using the entire app layout.\n" | 202 | "whether on a per component basis or using the entire app layout.\n" |
| 208 | "On a component level, components can move or be removed before they cause interference. " | 203 | "On a component level, components can move or be removed before they cause interference. " |
| 209 | "For example, a floating action button (FAB) can disappear or move off screen before a " | 204 | "For example, a floating action button (FAB) can disappear or move off screen before a " |
| 210 | "user picks up a card, or it can move if a snackbar appears.\n" | 205 | "user picks up a card, or it can move if a snackbar appears.\n" |
| 211 | "On the layout level, design your app layout to minimize opportunities for interference. " | 206 | "On the layout level, design your app layout to minimize opportunities for interference. " |