Commit 6aec0e86d974d5b61f242fb9eb1280fc9ce3a16e
1 parent
10d0868ed8
Exists in
master
28022020 2304
Showing
18 changed files
with
618 additions
and
698 deletions
Show diff stats
app/build.gradle
1 | apply plugin: 'com.android.application' | 1 | apply plugin: 'com.android.application' |
2 | apply plugin: 'kotlin-android' | 2 | apply plugin: 'kotlin-android' |
3 | apply plugin: 'kotlin-android-extensions' | 3 | apply plugin: 'kotlin-android-extensions' |
4 | apply plugin: 'kotlin-kapt' | 4 | apply plugin: 'kotlin-kapt' |
5 | 5 | ||
6 | android { | 6 | android { |
7 | compileSdkVersion 30 | 7 | compileSdkVersion 30 |
8 | buildToolsVersion "29.0.3" | 8 | buildToolsVersion "29.0.3" |
9 | 9 | ||
10 | defaultConfig { | 10 | defaultConfig { |
11 | applicationId "com.focasoftware.deboinventariov20" | 11 | applicationId "com.focasoftware.deboinventariov20" |
12 | minSdkVersion 26 | 12 | minSdkVersion 26 |
13 | targetSdkVersion 30 | 13 | targetSdkVersion 30 |
14 | versionCode 1 | 14 | versionCode 1 |
15 | versionName "1.0" | 15 | versionName "1.0" |
16 | 16 | ||
17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
18 | } | 18 | } |
19 | 19 | ||
20 | buildTypes { | 20 | buildTypes { |
21 | release { | 21 | release { |
22 | minifyEnabled false | 22 | minifyEnabled false |
23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
24 | } | 24 | } |
25 | } | 25 | } |
26 | compileOptions { | 26 | compileOptions { |
27 | sourceCompatibility JavaVersion.VERSION_1_8 | 27 | sourceCompatibility JavaVersion.VERSION_1_8 |
28 | targetCompatibility JavaVersion.VERSION_1_8 | 28 | targetCompatibility JavaVersion.VERSION_1_8 |
29 | } | 29 | } |
30 | kotlinOptions { | 30 | kotlinOptions { |
31 | jvmTarget = '1.8' | 31 | jvmTarget = '1.8' |
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | dependencies { | 35 | dependencies { |
36 | implementation fileTree(dir: "libs", include: ["*.jar"]) | 36 | implementation fileTree(dir: "libs", include: ["*.jar"]) |
37 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | 37 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" |
38 | implementation 'androidx.core:core-ktx:1.3.1' | 38 | implementation 'androidx.core:core-ktx:1.3.1' |
39 | implementation 'androidx.appcompat:appcompat:1.2.0' | 39 | implementation 'androidx.appcompat:appcompat:1.2.0' |
40 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' | 40 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' |
41 | implementation 'com.google.android.material:material:1.2.0' | 41 | implementation 'com.google.android.material:material:1.2.0' |
42 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | 42 | implementation 'androidx.constraintlayout:constraintlayout:2.0.0' |
43 | implementation 'androidx.navigation:navigation-fragment:2.3.0' | 43 | implementation 'androidx.navigation:navigation-fragment:2.3.0' |
44 | implementation 'androidx.navigation:navigation-ui:2.3.0' | 44 | implementation 'androidx.navigation:navigation-ui:2.3.0' |
45 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' | 45 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' |
46 | implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0' | 46 | implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0' |
47 | implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' | 47 | implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' |
48 | implementation 'androidx.recyclerview:recyclerview:1.1.0' | 48 | implementation 'androidx.recyclerview:recyclerview:1.1.0' |
49 | testImplementation 'junit:junit:4.13' | 49 | testImplementation 'junit:junit:4.13' |
50 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' | 50 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
51 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | 51 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
52 | 52 | ||
53 | 53 | ||
54 | //Room | 54 | //Room |
55 | implementation 'androidx.room:room-ktx:2.2.5' | 55 | implementation 'androidx.room:room-ktx:2.2.5' |
56 | implementation "androidx.room:room-runtime:2.2.5" | 56 | implementation "androidx.room:room-runtime:2.2.5" |
57 | kapt "androidx.room:room-compiler:2.2.5" | 57 | kapt "androidx.room:room-compiler:2.2.5" |
58 | 58 | ||
59 | //Retrofit | 59 | //Retrofit |
60 | implementation 'com.squareup.retrofit2:retrofit:2.9.0' | 60 | implementation 'com.squareup.retrofit2:retrofit:2.9.0' |
61 | implementation 'com.google.code.gson:gson:2.8.6' | 61 | implementation 'com.google.code.gson:gson:2.8.6' |
62 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0' | 62 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0' |
63 | implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1' | 63 | implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1' |
64 | 64 | ||
65 | //Gson library | 65 | //Gson library |
66 | implementation "com.google.code.gson:gson:2.8.6" | 66 | implementation "com.google.code.gson:gson:2.8.6" |
67 | annotationProcessor 'androidx.room:room-compiler:2.2.5' | 67 | annotationProcessor 'androidx.room:room-compiler:2.2.5' |
68 | 68 | ||
69 | |||
70 | implementation 'com.afollestad.material-dialogs:core:3.3.0' | ||
71 | implementation 'com.afollestad.material-dialogs:input:3.3.0' | ||
72 | } | 69 | } |
app/src/main/AndroidManifest.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | package="com.focasoftware.deboinventariov20"> | 3 | package="com.focasoftware.deboinventariov20"> |
4 | 4 | ||
5 | <uses-permission android:name="android.permission.WAKE_LOCK"/> | ||
5 | <uses-permission android:name="android.permission.VIBRATE" /> | 6 | <uses-permission android:name="android.permission.VIBRATE" /> |
6 | <uses-permission android:name="android.permission.INTERNET" /> | 7 | <uses-permission android:name="android.permission.INTERNET" /> |
7 | 8 | ||
8 | <application | 9 | <application |
9 | android:allowBackup="true" | 10 | android:allowBackup="true" |
10 | android:icon="@drawable/icono_inventario_big" | 11 | android:icon="@drawable/icono_inventario_big" |
11 | android:label="@string/app_name" | 12 | android:label="@string/app_name" |
12 | android:roundIcon="@drawable/icono_inventario_big" | 13 | android:roundIcon="@drawable/icono_inventario_big" |
13 | android:supportsRtl="true" | 14 | android:supportsRtl="true" |
14 | android:theme="@style/AppTheme" | 15 | android:theme="@style/AppTheme" |
15 | android:usesCleartextTraffic="true"> | 16 | android:usesCleartextTraffic="true"> |
16 | <activity | 17 | <activity |
17 | android:name=".ui.SplashActivity" | 18 | android:name=".ui.SplashActivity" |
18 | android:label="@string/app_name" | 19 | android:label="@string/app_name" |
19 | android:theme="@style/AppTheme.NoActionBar"> | 20 | android:theme="@style/AppTheme.NoActionBar"> |
20 | <intent-filter> | 21 | <intent-filter> |
21 | <action android:name="android.intent.action.MAIN" /> | 22 | <action android:name="android.intent.action.MAIN" /> |
22 | 23 | ||
23 | <category android:name="android.intent.category.LAUNCHER" /> | 24 | <category android:name="android.intent.category.LAUNCHER" /> |
24 | </intent-filter> | 25 | </intent-filter> |
25 | </activity> | 26 | </activity> |
26 | <activity | 27 | <activity |
27 | android:name=".ui.MainActivity" | 28 | android:name=".ui.MainActivity" |
28 | android:label="@string/app_name" | 29 | android:label="@string/app_name" |
29 | android:theme="@style/AppTheme.NoActionBar"> | 30 | android:theme="@style/AppTheme.NoActionBar"> |
30 | 31 | ||
31 | </activity> | 32 | </activity> |
32 | </application> | 33 | </application> |
33 | 34 | ||
34 | </manifest> | 35 | </manifest> |
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.* | 3 | import androidx.room.* |
4 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART | 4 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART |
5 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B | 5 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B |
6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H | 6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H |
7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV | 7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV |
8 | import com.focasoftware.deboinventariov20.Model.* | 8 | import com.focasoftware.deboinventariov20.Model.* |
9 | import java.util.ArrayList | ||
9 | 10 | ||
10 | @Dao | 11 | @Dao |
11 | interface ArticulosDAO { | 12 | interface ArticulosDAO { |
12 | 13 | ||
13 | // TABLA ARTICULOS | 14 | // TABLA ARTICULOS |
14 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 15 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
15 | suspend fun insertArticulos(articulos: Articles?) | 16 | suspend fun insertArticulos(articulos: Articles?) |
16 | 17 | ||
17 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") | 18 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") |
18 | suspend fun findAllArticulos(): List<Articles> | 19 | suspend fun findAllArticulos(): List<Articles> |
19 | 20 | ||
20 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") | 21 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") |
21 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> | 22 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> |
22 | 23 | ||
23 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") | 24 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") |
24 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? | 25 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? |
25 | 26 | ||
26 | @Query("DELETE FROM $TABLA_ART") | 27 | @Query("DELETE FROM $TABLA_ART") |
27 | suspend fun deleteAllArticulos() | 28 | suspend fun deleteAllArticulos() |
28 | 29 | ||
29 | @Query("SELECT * FROM $TABLA_ART WHERE SEC=:sector AND COD=:codigo") | 30 | @Query("SELECT * FROM $TABLA_ART WHERE SEC=:sector AND COD=:codigo") |
30 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? | 31 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? |
31 | } | 32 | } |
32 | 33 | ||
33 | @Dao | 34 | @Dao |
34 | interface InvHeadDAO { | 35 | interface InvHeadDAO { |
35 | @Insert() | 36 | @Insert() |
36 | suspend fun insertInvHead(invHead: InvHead?) | 37 | suspend fun insertInvHead(invHead: InvHead?) |
37 | 38 | ||
38 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") | 39 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") |
39 | suspend fun findLastInv(): Int | 40 | suspend fun findLastInv(): Int |
40 | 41 | ||
41 | @Query("DELETE FROM $TABLA_INV_H") | 42 | @Query("DELETE FROM $TABLA_INV_H") |
42 | suspend fun deleteAllArticulos() | 43 | suspend fun deleteAllArticulos() |
43 | 44 | ||
44 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 45 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
45 | suspend fun deleteinvHead(inven: Int) | 46 | suspend fun deleteinvHead(inven: Int) |
46 | 47 | ||
47 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") | 48 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") |
48 | suspend fun fetchAllInvHead(): List<InvHead> | 49 | suspend fun fetchAllInvHead(): ArrayList<InvHead> |
49 | } | 50 | } |
50 | 51 | ||
51 | @Dao | 52 | @Dao |
52 | interface InvBodyDAO { | 53 | interface InvBodyDAO { |
53 | @Insert() | 54 | @Insert() |
54 | suspend fun insertInvBody(invBody: InvBody?) | 55 | suspend fun insertInvBody(invBody: InvBody?) |
55 | 56 | ||
56 | @Query("DELETE FROM $TABLA_INV_B") | 57 | @Query("DELETE FROM $TABLA_INV_B") |
57 | suspend fun deleteAllInvBody() | 58 | suspend fun deleteAllInvBody() |
58 | 59 | ||
59 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") | 60 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") |
60 | suspend fun deleteInvBody(inven: Int) | 61 | suspend fun deleteInvBody(inven: Int) |
61 | 62 | ||
62 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") | 63 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") |
63 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) | 64 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) |
64 | 65 | ||
65 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") | 66 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") |
66 | suspend fun fetchAllInvBody(inven:Int): List<InvBody> | 67 | suspend fun fetchAllInvBody(inven:Int): List<InvBody> |
67 | 68 | ||
68 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 69 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
69 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody | 70 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody |
70 | 71 | ||
71 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 72 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
72 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int | 73 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int |
73 | } | 74 | } |
74 | @Dao | 75 | @Dao |
75 | interface ServeInvDao { | 76 | interface ServeInvDao { |
76 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 77 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
77 | fun insertServer(servidor: ServeInv) | 78 | fun insertServer(servidor: ServeInv) |
78 | 79 | ||
79 | @Query("SELECT * FROM ServeInv") | 80 | @Query("SELECT * FROM ServeInv") |
80 | suspend fun fetchAllServers(): List<ServeInv> | 81 | suspend fun fetchAllServers(): List<ServeInv> |
81 | 82 | ||
82 | @Query("DELETE FROM ServeInv WHERE SER_NUM = :number") | 83 | @Query("DELETE FROM ServeInv WHERE SER_NUM = :number") |
83 | suspend fun deleteServer(number: Long) | 84 | suspend fun deleteServer(number: Long) |
84 | 85 | ||
85 | @Query("SELECT SER_NUM FROM ServeInv ORDER BY SER_NUM DESC") | 86 | @Query("SELECT SER_NUM FROM ServeInv ORDER BY SER_NUM DESC") |
86 | suspend fun findLastSer(): Long | 87 | suspend fun findLastSer(): Long |
87 | } | 88 | } |
app/src/main/java/com/focasoftware/deboinventariov20/Model/ProductosService.kt
1 | package com.focasoftware.deboinventariov20.Model | 1 | package com.focasoftware.deboinventariov20.Model |
2 | 2 | ||
3 | import retrofit2.Retrofit | 3 | import retrofit2.Retrofit |
4 | import retrofit2.converter.gson.GsonConverterFactory | 4 | import retrofit2.converter.gson.GsonConverterFactory |
5 | 5 | ||
6 | object ProductosService { | 6 | object ProductosService { |
7 | private val BASE_URL ="http://192.168.0.8:3000/" | 7 | private val BASE_URL ="http://192.168.0.2:3000/" |
8 | //"http://10.0.2.2:3000/" | 8 | //"http://10.0.2.2:3000/" |
9 | 9 | ||
10 | 10 | ||
11 | fun getProductosService(): ProductosApi { | 11 | fun getProductosService(): ProductosApi { |
12 | return Retrofit.Builder() | 12 | return Retrofit.Builder() |
13 | .baseUrl(BASE_URL) | 13 | .baseUrl(BASE_URL) |
14 | .addConverterFactory(GsonConverterFactory.create()) | 14 | .addConverterFactory(GsonConverterFactory.create()) |
15 | .build() | 15 | .build() |
16 | .create(ProductosApi::class.java) | 16 | .create(ProductosApi::class.java) |
17 | } | 17 | } |
18 | } | 18 | } |
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.InputType | ||
11 | import android.view.LayoutInflater | 10 | import android.view.LayoutInflater |
12 | import android.view.View | 11 | import android.view.View |
13 | import android.view.ViewGroup | 12 | import android.view.ViewGroup |
14 | import android.widget.Button | 13 | import android.widget.Button |
15 | import androidx.fragment.app.Fragment | 14 | import androidx.fragment.app.Fragment |
16 | import androidx.fragment.app.FragmentActivity | 15 | import androidx.fragment.app.FragmentActivity |
17 | import androidx.lifecycle.lifecycleScope | 16 | import androidx.lifecycle.lifecycleScope |
18 | import androidx.navigation.NavController | 17 | import androidx.navigation.NavController |
19 | import androidx.navigation.Navigation | 18 | import androidx.navigation.Navigation |
20 | import androidx.recyclerview.widget.ItemTouchHelper | 19 | import androidx.recyclerview.widget.ItemTouchHelper |
21 | import androidx.recyclerview.widget.LinearLayoutManager | 20 | import androidx.recyclerview.widget.LinearLayoutManager |
22 | import androidx.recyclerview.widget.RecyclerView | 21 | import androidx.recyclerview.widget.RecyclerView |
23 | import com.afollestad.materialdialogs.MaterialDialog | ||
24 | import com.afollestad.materialdialogs.input.input | ||
25 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 22 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
26 | import com.focasoftware.deboinventariov20.Model.Articles | 23 | import com.focasoftware.deboinventariov20.Model.Articles |
27 | import com.focasoftware.deboinventariov20.Model.InvBody | 24 | import com.focasoftware.deboinventariov20.Model.InvBody |
28 | import com.focasoftware.deboinventariov20.R | 25 | import com.focasoftware.deboinventariov20.R |
29 | import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment | 26 | import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment |
30 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 27 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
31 | import kotlinx.android.synthetic.main.login_dialog.view.* | 28 | import kotlinx.android.synthetic.main.login_dialog.view.* |
32 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | 29 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar |
33 | import kotlinx.coroutines.* | 30 | import kotlinx.coroutines.* |
34 | 31 | ||
35 | class DescripcionFragment : Fragment() { | 32 | class DescripcionFragment : Fragment() { |
36 | private var artAcargar2: List<Articles>? = null | 33 | private var artAcargar2: List<Articles>? = null |
37 | private var listArticulos2: List<Articles>? = null | 34 | private var listArticulos2: List<Articles>? = null |
38 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | 35 | lateinit var viewAdapter2: RecyclerView.Adapter<*> |
39 | private lateinit var viewManager2: RecyclerView.LayoutManager | 36 | private lateinit var viewManager2: RecyclerView.LayoutManager |
40 | private lateinit var rcDescripcion: RecyclerView | 37 | private lateinit var rcDescripcion: RecyclerView |
41 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | 38 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) |
42 | private var cantidad = 0F | 39 | private var cantidad = 0F |
43 | private var numeroInventario = 0 | 40 | private var numeroInventario = 0 |
44 | lateinit var navController: NavController | 41 | lateinit var navController: NavController |
45 | lateinit var sharedPreferences: SharedPreferences | 42 | lateinit var sharedPreferences: SharedPreferences |
46 | private var indice = 0 | 43 | private var indice = 0 |
47 | private var artCargadoEnBD: InvBody? = null | 44 | private var artCargadoEnBD: InvBody? = null |
48 | 45 | ||
49 | override fun onCreate(savedInstanceState: Bundle?) { | 46 | override fun onCreate(savedInstanceState: Bundle?) { |
50 | super.onCreate(savedInstanceState) | 47 | super.onCreate(savedInstanceState) |
51 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 48 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
52 | arguments.apply { | 49 | arguments.apply { |
53 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | 50 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> |
54 | numeroInventario = requireArguments().getInt("numeroInv") | 51 | numeroInventario = requireArguments().getInt("numeroInv") |
55 | } | 52 | } |
56 | } | 53 | } |
57 | 54 | ||
58 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 55 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
59 | super.onViewCreated(view, savedInstanceState) | 56 | super.onViewCreated(view, savedInstanceState) |
60 | navController = Navigation.findNavController(view) | 57 | navController = Navigation.findNavController(view) |
61 | } | 58 | } |
62 | 59 | ||
63 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 60 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
64 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) | 61 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) |
65 | rcDescripcion = v.findViewById(R.id.rcDescripcion) | 62 | rcDescripcion = v.findViewById(R.id.rcDescripcion) |
66 | val btnSalir = v.findViewById<Button>(R.id.btnSalir) | 63 | val btnSalir = v.findViewById<Button>(R.id.btnSalir) |
67 | 64 | ||
68 | IngresarRecicler(artAcargar2) | 65 | IngresarRecicler(artAcargar2) |
69 | 66 | ||
70 | btnSalir.setOnClickListener { | 67 | btnSalir.setOnClickListener { |
71 | VolverAinventario() | 68 | VolverAinventario() |
72 | } | 69 | } |
73 | return v | 70 | return v |
74 | } | 71 | } |
75 | 72 | ||
76 | fun IngresarRecicler(articulos: List<Articles>?) { | 73 | fun IngresarRecicler(articulos: List<Articles>?) { |
77 | 74 | ||
78 | viewAdapter2 = DescripcionListAdapter(articulos) | 75 | viewAdapter2 = DescripcionListAdapter(articulos) |
79 | viewManager2 = LinearLayoutManager(requireContext()) | 76 | viewManager2 = LinearLayoutManager(requireContext()) |
80 | 77 | ||
81 | rcDescripcion.apply { | 78 | rcDescripcion.apply { |
82 | adapter = viewAdapter2 | 79 | adapter = viewAdapter2 |
83 | layoutManager = viewManager2 | 80 | layoutManager = viewManager2 |
84 | } | 81 | } |
85 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { | 82 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) { |
86 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 83 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
87 | return false | 84 | return false |
88 | } | 85 | } |
89 | 86 | ||
90 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 87 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
91 | 88 | ||
92 | var indice = 0 | 89 | var indice = 0 |
93 | indice = viewHolder.layoutPosition | 90 | indice = viewHolder.layoutPosition |
94 | GlobalScope.launch(Dispatchers.Main) { | 91 | GlobalScope.launch(Dispatchers.Main) { |
95 | //TODO BUSCO EN BASE DE DATOS | 92 | //TODO BUSCO EN BASE DE DATOS |
96 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.sector.toString(), | 93 | artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.sector.toString(), |
97 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.codigo.toString(), | 94 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.codigo.toString(), |
98 | numeroInventario.toString()) | 95 | numeroInventario.toString()) |
99 | if (artCargadoEnBD == null) { | 96 | if (artCargadoEnBD == null) { |
100 | // val type = InputType.TYPE_CLASS_NUMBER | ||
101 | // | ||
102 | // MaterialDialog(requireContext()).show { | ||
103 | // title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") | ||
104 | // message(R.string.sMensajeEncontrado) | ||
105 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | ||
106 | // cantidad = 0F | ||
107 | // cantidad = charSequence.toString().toFloat() | ||
108 | // } | ||
109 | // positiveButton(R.string.btnOk) { | ||
110 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | 97 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) |
111 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | 98 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) |
112 | mDialogView.tvTitulo.text="Producto '${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}'." | 99 | mDialogView.tvTitulo.text = "${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}" |
113 | val mAlertDialog = mBuilder.show() | 100 | val mAlertDialog = mBuilder.show() |
114 | mDialogView.btnAceptar.setOnClickListener { | 101 | mDialogView.btnAceptar.setOnClickListener { |
115 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | 102 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
103 | mDialogView.etCantidad.error = "No vacio" | ||
104 | mDialogView.etCantidad.requestFocus() | ||
105 | mDialogView.etCantidad.hint = "Ingrese un valor" | ||
106 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { | ||
107 | cantidad = mDialogView.etCantidad.text.toString().toFloat() | ||
116 | val body = InvBody(numeroInventario, | 108 | val body = InvBody(numeroInventario, |
117 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | 109 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, |
118 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD | 110 | // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD |
119 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | 111 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, |
120 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | 112 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, |
121 | cantidad.toString(), | 113 | cantidad.toString(), |
122 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | 114 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, |
123 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | 115 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, |
124 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | 116 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, |
125 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | 117 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, |
126 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | 118 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, |
127 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | 119 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, |
128 | InventarioFragment().ObtenerFechaActual(), | 120 | InventarioFragment().ObtenerFechaActual(), |
129 | InventarioFragment().ObtenerFechaActual()) | 121 | InventarioFragment().ObtenerFechaActual()) |
130 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | 122 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
131 | VolverAinventario() | 123 | VolverAinventario() |
132 | mAlertDialog.dismiss() | 124 | mAlertDialog.dismiss() |
133 | // dismiss() | ||
134 | } | 125 | } |
135 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 126 | } |
136 | |||
137 | } else if (artCargadoEnBD != null) { | 127 | } else if (artCargadoEnBD != null) { |
138 | 128 | ||
139 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 129 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
140 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) | 130 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false) |
141 | mDialogView.tvCantInicial.text = artCargadoEnBD!!.cantTomada | 131 | mDialogView.tvCantInicial.text = artCargadoEnBD!!.cantTomada |
142 | 132 | ||
143 | val mAlertDialog = mBuilder.show() | 133 | val mAlertDialog = mBuilder.show() |
144 | mDialogView.rbSumar.setOnClickListener { | 134 | mDialogView.rbSumar.setOnClickListener { |
145 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 135 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
146 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 136 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
137 | mDialogView.tvNuevaCantidad.isEnabled=false | ||
147 | } | 138 | } |
148 | } | 139 | } |
149 | mDialogView.rbRestar.setOnClickListener { | 140 | mDialogView.rbRestar.setOnClickListener { |
150 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 141 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
151 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 142 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
152 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 143 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
144 | mDialogView.tvNuevaCantidad.isEnabled=false | ||
153 | } | 145 | } |
154 | } | 146 | } |
155 | } | 147 | } |
156 | mDialogView.rbMdodificar.setOnClickListener { | 148 | mDialogView.rbMdodificar.setOnClickListener { |
157 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 149 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
158 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 150 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
151 | mDialogView.tvNuevaCantidad.isEnabled=false | ||
159 | } | 152 | } |
160 | } | 153 | } |
161 | mDialogView.btnAceptar.setOnClickListener { | 154 | mDialogView.btnAceptar.setOnClickListener { |
162 | val name = mDialogView.tvgenerico4.text.toString().toFloat() | 155 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
163 | updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(), (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo | 156 | val name = mDialogView.tvgenerico4.text.toString().toFloat() |
164 | .toString(), name) | 157 | updateCantidad((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector.toString(), |
165 | VolverAinventario() | 158 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo.toString(), |
166 | mAlertDialog.dismiss() | 159 | name) |
160 | VolverAinventario() | ||
161 | mAlertDialog.dismiss() | ||
162 | } else if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
163 | mDialogView.tvNuevaCantidad.error = "No vacio" | ||
164 | mDialogView.tvNuevaCantidad.requestFocus() | ||
165 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | ||
166 | } | ||
167 | } | 167 | } |
168 | mDialogView.dialogCancelBtn.setOnClickListener { | 168 | mDialogView.dialogCancelBtn.setOnClickListener { |
169 | mAlertDialog.dismiss() | 169 | mAlertDialog.dismiss() |
170 | } | 170 | } |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 175 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
176 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 176 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
177 | val itemView = viewHolder.itemView | 177 | val itemView = viewHolder.itemView |
178 | 178 | ||
179 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 179 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
180 | 180 | ||
181 | if (dX > 0) { | 181 | if (dX > 0) { |
182 | 182 | ||
183 | c.drawColor(Color.RED) | 183 | c.drawColor(Color.RED) |
184 | } else if (dX < 0) { | 184 | } else if (dX < 0) { |
185 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | 185 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) |
186 | c.drawColor(Color.YELLOW) | 186 | c.drawColor(Color.YELLOW) |
187 | } | 187 | } |
188 | swipeBackground.draw(c) | 188 | swipeBackground.draw(c) |
189 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 189 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
190 | } | 190 | } |
191 | } | 191 | } |
192 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | 192 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) |
193 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) | 193 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) |
194 | 194 | ||
195 | } | 195 | } |
196 | 196 | ||
197 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 197 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
198 | lifecycleScope.launch { | 198 | lifecycleScope.launch { |
199 | withContext(Dispatchers.IO) { | 199 | withContext(Dispatchers.IO) { |
200 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 200 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
201 | } | 201 | } |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | fun VolverAinventario() { | 205 | fun VolverAinventario() { |
206 | 206 | ||
207 | val editor = sharedPreferences.edit() | 207 | val editor = sharedPreferences.edit() |
208 | editor?.putString("Inventario", numeroInventario.toString()) | 208 | editor?.putString("Inventario", numeroInventario.toString()) |
209 | editor?.apply() | 209 | editor?.apply() |
210 | editor.commit() | 210 | editor.commit() |
211 | navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | 211 | navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) |
212 | } | 212 | } |
213 | 213 | ||
214 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { | 214 | suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? { |
215 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 215 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
216 | var busqueda: InvBody? = null | 216 | var busqueda: InvBody? = null |
217 | return GlobalScope.async(Dispatchers.IO) { | 217 | return GlobalScope.async(Dispatchers.IO) { |
218 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario) | 218 | busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario) |
219 | return@async busqueda | 219 | return@async busqueda |
220 | }.await() | 220 | }.await() |
221 | } | 221 | } |
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.app.AlertDialog | 4 | import android.app.AlertDialog |
4 | import android.content.Context | 5 | import android.content.Context |
6 | import android.content.DialogInterface | ||
5 | import android.content.SharedPreferences | 7 | import android.content.SharedPreferences |
6 | import android.graphics.Canvas | 8 | import android.graphics.Canvas |
7 | import android.graphics.Color | 9 | import android.graphics.Color |
8 | import android.graphics.drawable.Drawable | 10 | import android.graphics.drawable.Drawable |
9 | import android.os.Bundle | 11 | import android.os.Bundle |
10 | import android.view.KeyEvent | 12 | import android.view.KeyEvent |
11 | import android.view.LayoutInflater | 13 | import android.view.LayoutInflater |
12 | import android.view.View | 14 | import android.view.View |
13 | import android.view.ViewGroup | 15 | import android.view.ViewGroup |
14 | import android.widget.EditText | 16 | import android.widget.EditText |
15 | import android.widget.TextView | 17 | import android.widget.TextView |
16 | import android.widget.Toast | 18 | import android.widget.Toast |
17 | import androidx.core.content.ContextCompat | 19 | import androidx.core.content.ContextCompat |
18 | import androidx.core.os.bundleOf | 20 | import androidx.core.os.bundleOf |
19 | import androidx.fragment.app.Fragment | 21 | import androidx.fragment.app.Fragment |
20 | import androidx.lifecycle.lifecycleScope | 22 | import androidx.lifecycle.lifecycleScope |
21 | import androidx.navigation.NavController | 23 | import androidx.navigation.NavController |
22 | import androidx.navigation.Navigation | 24 | import androidx.navigation.Navigation |
23 | import androidx.recyclerview.widget.ItemTouchHelper | 25 | import androidx.recyclerview.widget.ItemTouchHelper |
24 | import androidx.recyclerview.widget.LinearLayoutManager | 26 | import androidx.recyclerview.widget.LinearLayoutManager |
25 | import androidx.recyclerview.widget.RecyclerView | 27 | import androidx.recyclerview.widget.RecyclerView |
26 | import com.afollestad.materialdialogs.MaterialDialog | ||
27 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 28 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
28 | import com.focasoftware.deboinventariov20.Model.Articles | 29 | import com.focasoftware.deboinventariov20.Model.Articles |
29 | import com.focasoftware.deboinventariov20.Model.InvBody | 30 | import com.focasoftware.deboinventariov20.Model.InvBody |
30 | import com.focasoftware.deboinventariov20.Model.InvHead | 31 | import com.focasoftware.deboinventariov20.Model.InvHead |
31 | import com.focasoftware.deboinventariov20.R | 32 | import com.focasoftware.deboinventariov20.R |
32 | import com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado | 33 | import com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado |
34 | import com.focasoftware.deboinventariov20.ui.util.Base.AlertDialogBorrarInv | ||
35 | import com.focasoftware.deboinventariov20.ui.util.Base.NoEncontradoSimple | ||
33 | import kotlinx.android.synthetic.main.fragment_inventario.* | 36 | import kotlinx.android.synthetic.main.fragment_inventario.* |
34 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | 37 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
35 | import kotlinx.android.synthetic.main.login_dialog.view.* | 38 | import kotlinx.android.synthetic.main.login_dialog.view.* |
36 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar | 39 | import kotlinx.android.synthetic.main.login_dialog.view.btnAceptar |
37 | import kotlinx.coroutines.* | 40 | import kotlinx.coroutines.* |
38 | import java.time.LocalDateTime | 41 | import java.time.LocalDateTime |
39 | import java.time.format.DateTimeFormatter | 42 | import java.time.format.DateTimeFormatter |
40 | import java.util.* | 43 | import java.util.* |
41 | 44 | ||
42 | 45 | ||
43 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener { | 46 | class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickListener{ |
44 | 47 | ||
45 | private lateinit var sharedPreferences: SharedPreferences | 48 | private lateinit var sharedPreferences: SharedPreferences |
46 | private var iArea: Int = 0 | 49 | private var iArea: Int = 0 |
47 | private lateinit var invHead: InvHead | 50 | private lateinit var invHead: InvHead |
48 | private lateinit var rcInventarios: RecyclerView | 51 | private lateinit var rcInventarios: RecyclerView |
49 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 52 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
50 | private lateinit var viewManager: RecyclerView.LayoutManager | 53 | private lateinit var viewManager: RecyclerView.LayoutManager |
51 | private lateinit var sChangeUpper: String | 54 | private lateinit var sChangeUpper: String |
52 | private var listArticulos = ArrayList<ItemsRecycler>() | 55 | private var listArticulos = ArrayList<ItemsRecycler>() |
53 | private lateinit var navController: NavController | 56 | private lateinit var navController: NavController |
54 | private var InventarioNuevo: Int = 0 | 57 | private var InventarioNuevo: Int = 0 |
55 | private var iEstado = 0 | 58 | private var iEstado = 0 |
56 | private var iBusquedaPor = 0 | 59 | private var iBusquedaPor = 0 |
57 | private var fCant = 0F | 60 | private var fCant = 0F |
58 | private var bFirst = false | 61 | private var bFirst = false |
59 | private lateinit var deleteIcon: Drawable | 62 | private lateinit var deleteIcon: Drawable |
60 | 63 | ||
61 | override fun onCreate(savedInstanceState: Bundle?) { | 64 | override fun onCreate(savedInstanceState: Bundle?) { |
62 | super.onCreate(savedInstanceState) | 65 | super.onCreate(savedInstanceState) |
63 | 66 | ||
64 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 67 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
65 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { | 68 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { |
66 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() | 69 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() |
67 | val editor = sharedPreferences.edit() | 70 | val editor = sharedPreferences.edit() |
68 | editor?.putString("Inventario", "-1") | 71 | editor?.putString("Inventario", "-1") |
69 | editor?.apply() | 72 | editor?.apply() |
70 | editor.commit() | 73 | editor.commit() |
71 | } | 74 | } |
72 | |||
73 | } | 75 | } |
74 | 76 | ||
75 | 77 | ||
76 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 78 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
77 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) | 79 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) |
78 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 80 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
79 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) | 81 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) |
80 | rcInventarios = v.findViewById(R.id.rcInventarios) | 82 | rcInventarios = v.findViewById(R.id.rcInventarios) |
81 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) | 83 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) |
82 | 84 | ||
83 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO | 85 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO |
84 | GlobalScope.launch(Dispatchers.Main) { | 86 | GlobalScope.launch(Dispatchers.Main) { |
85 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO | 87 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO |
86 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 | 88 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 |
87 | SerchArea() | 89 | SerchArea() |
88 | val descripInv: String = if (iArea == 0) "Ventas" else "Deposito" | 90 | val descripInv: String = if (iArea == 0) "Ventas" else "Deposito" |
89 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO | 91 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO |
90 | invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont()) | 92 | invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont()) |
91 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) | 93 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) |
92 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 94 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
93 | } | 95 | } |
94 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) | 96 | } else {// TODO (SI VENGO DE FRAGMENT DESCRIPCION) |
95 | listArticulos.clear() | 97 | listArticulos.clear() |
96 | CargarDeBdInventario(InventarioNuevo) | 98 | CargarDeBdInventario(InventarioNuevo) |
97 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 99 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
98 | } | 100 | } |
99 | 101 | ||
100 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> | 102 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> |
101 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { | 103 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { |
102 | sChangeUpper = tCodigoBarras.text.toString() | 104 | sChangeUpper = tCodigoBarras.text.toString() |
103 | |||
104 | var indiceDelArtEncontrado = 0 | 105 | var indiceDelArtEncontrado = 0 |
105 | 106 | ||
106 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | 107 | if (tCodigoBarras.text.isNullOrBlank()) { |
107 | when (iBusquedaPor) { | 108 | tCodigoBarras.error = "No puede estar vacio" |
108 | 0 -> { | 109 | tCodigoBarras.requestFocus() |
109 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | 110 | tCodigoBarras.hint = "No puede estar vacio" |
110 | //TODO Si no lo encuentra devuelve -1 | 111 | } else { |
111 | if (indiceDelArtEncontrado != -1) { | 112 | |
112 | if (swSumaUno!!.isChecked) { | 113 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS |
113 | fCant = 0F | 114 | when (iBusquedaPor) { |
114 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 115 | 0 -> { |
115 | fCant += 1F | 116 | GlobalScope.launch(Dispatchers.Main) { |
116 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 117 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice |
117 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 118 | //TODO (Si no lo encuentra devuelve -1) |
118 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 119 | if (indiceDelArtEncontrado != -1) { |
119 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 120 | if (swSumaUno!!.isChecked) { |
120 | viewAdapter.notifyDataSetChanged() | 121 | // fCant = 0F |
121 | } else { | 122 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
122 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 123 | // fCant += 1F |
123 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | 124 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
124 | .setCancelable(false) | 125 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), listArticulos[indiceDelArtEncontrado].cantTomada+1) |
125 | mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | 126 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
126 | val mAlertDialog = mBuilder.show() | 127 | listArticulos[indiceDelArtEncontrado].cantTomada = listArticulos[indiceDelArtEncontrado].cantTomada+1 |
127 | mDialogView.rbSumar.setOnClickListener { | 128 | viewAdapter.notifyDataSetChanged() |
128 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 129 | } else { |
129 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 130 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
130 | } | 131 | val mBuilder = |
131 | } | 132 | AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") |
132 | mDialogView.rbRestar.setOnClickListener { | 133 | // .setCancelable(false) |
133 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 134 | mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() |
134 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | 135 | val mAlertDialog = mBuilder.show() |
135 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 136 | mDialogView.rbSumar.setOnClickListener { |
137 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
138 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
139 | mDialogView.tvNuevaCantidad.isEnabled=false | ||
140 | } | ||
141 | } | ||
142 | mDialogView.rbRestar.setOnClickListener { | ||
143 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
144 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
145 | mDialogView.tvgenerico4.text = | ||
146 | (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
147 | mDialogView.tvNuevaCantidad.isEnabled=false | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | mDialogView.rbMdodificar.setOnClickListener { | ||
152 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
153 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
154 | mDialogView.tvNuevaCantidad.isEnabled=false | ||
155 | } | ||
156 | } | ||
157 | mDialogView.btnAceptar.setOnClickListener { | ||
158 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
159 | mAlertDialog.dismiss() | ||
160 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() | ||
161 | // fCant = 0F | ||
162 | // fCant = name | ||
163 | listArticulos[indiceDelArtEncontrado].cantTomada = mDialogView.tvgenerico4.text.toString().toFloat() | ||
164 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), mDialogView.tvgenerico4.text.toString().toFloat()) | ||
165 | viewAdapter.notifyDataSetChanged() | ||
166 | } else if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
167 | mDialogView.tvNuevaCantidad.error = "No vacio" | ||
168 | mDialogView.tvNuevaCantidad.requestFocus() | ||
169 | mDialogView.tvNuevaCantidad.hint = "Ingrese un valor" | ||
170 | } | ||
171 | } | ||
172 | mDialogView.dialogCancelBtn.setOnClickListener { | ||
173 | mAlertDialog.dismiss() | ||
136 | } | 174 | } |
137 | } | 175 | } |
176 | |||
177 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | ||
178 | |||
179 | |||
180 | //TODO BUSCO EN BASE DE DATOS | ||
181 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
182 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | ||
138 | } | 183 | } |
139 | mDialogView.rbMdodificar.setOnClickListener { | ||
140 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
141 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
142 | } | ||
143 | } | ||
144 | mDialogView.btnAceptar.setOnClickListener { | ||
145 | mAlertDialog.dismiss() | ||
146 | val name = mDialogView.tvgenerico4.text.toString().toFloat() | ||
147 | fCant = 0F | ||
148 | fCant = name | ||
149 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
150 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
151 | viewAdapter.notifyDataSetChanged() | ||
152 | } | ||
153 | mDialogView.dialogCancelBtn.setOnClickListener { | ||
154 | mAlertDialog.dismiss() | ||
155 | } | ||
156 | } | ||
157 | 184 | ||
158 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | ||
159 | 185 | ||
160 | GlobalScope.launch(Dispatchers.Main) { | 186 | tCodigoBarras.focusable = View.FOCUSABLE |
161 | //TODO BUSCO EN BASE DE DATOS | 187 | tCodigoBarras.setText("") |
162 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 188 | tCodigoBarras.selectAll() |
163 | ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE | ||
164 | } | 189 | } |
165 | } | 190 | return@setOnKeyListener true |
166 | |||
167 | tCodigoBarras.focusable = View.FOCUSABLE | ||
168 | tCodigoBarras.setText("") | ||
169 | tCodigoBarras.selectAll() | ||
170 | return@setOnKeyListener true | ||
171 | 191 | ||
172 | 192 | ||
173 | } | ||
174 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | ||
175 | // | ||
176 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | ||
177 | // //TODO Si no lo encuentra devuelve -1 | ||
178 | // if (indiceDelArtEncontrado != -1) { | ||
179 | //// if (swSumaUno!!.isChecked) { | ||
180 | //// fCant = 0F | ||
181 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
182 | //// fCant += 1F | ||
183 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
184 | //// viewAdapter.notifyDataSetChanged() | ||
185 | //// } else { | ||
186 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
187 | // MaterialDialog(requireContext()).show { | ||
188 | // title(R.string.sTituloNueva) | ||
189 | // message(R.string.sCantidadNueva) | ||
190 | // input { materialDialog, charSequence -> | ||
191 | // fCant = 0F | ||
192 | // fCant = charSequence.toString().toFloat() | ||
193 | // } | ||
194 | // positiveButton(R.string.btnOk) { | ||
195 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
196 | // viewAdapter.notifyDataSetChanged() | ||
197 | // dismiss() | ||
198 | // } | ||
199 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
200 | //// } | ||
201 | // | ||
202 | // } else if | ||
203 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | ||
204 | GlobalScope.launch(Dispatchers.Main) { | ||
205 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
206 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | ||
207 | } | 193 | } |
208 | // } | 194 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** |
195 | // | ||
196 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | ||
197 | // //TODO Si no lo encuentra devuelve -1 | ||
198 | // if (indiceDelArtEncontrado != -1) { | ||
199 | //// if (swSumaUno!!.isChecked) { | ||
200 | //// fCant = 0F | ||
201 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
202 | //// fCant += 1F | ||
203 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
204 | //// viewAdapter.notifyDataSetChanged() | ||
205 | //// } else { | ||
206 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
207 | // MaterialDialog(requireContext()).show { | ||
208 | // title(R.string.sTituloNueva) | ||
209 | // message(R.string.sCantidadNueva) | ||
210 | // input { materialDialog, charSequence -> | ||
211 | // fCant = 0F | ||
212 | // fCant = charSequence.toString().toFloat() | ||
213 | // } | ||
214 | // positiveButton(R.string.btnOk) { | ||
215 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
216 | // viewAdapter.notifyDataSetChanged() | ||
217 | // dismiss() | ||
218 | // } | ||
219 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
220 | //// } | ||
221 | // | ||
222 | // } else if | ||
223 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | ||
224 | GlobalScope.launch(Dispatchers.Main) { | ||
225 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
226 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | ||
227 | } | ||
228 | // } | ||
209 | 229 | ||
210 | return@setOnKeyListener true | 230 | return@setOnKeyListener true |
211 | } | 231 | } |
212 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | 232 | // 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** |
213 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice | 233 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice |
214 | //TODO Si no lo encuentra devuelve -1 | 234 | // //TODO Si no lo encuentra devuelve -1 |
215 | if (indiceDelArtEncontrado != -1) { | 235 | // if (indiceDelArtEncontrado != -1) { |
216 | if (swSumaUno!!.isChecked) { | 236 | // if (swSumaUno!!.isChecked) { |
217 | fCant = 0F | 237 | // fCant = 0F |
218 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 238 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
219 | fCant += 1F | 239 | // fCant += 1F |
220 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 240 | // //TODO ACTUALIZO LA CANTIDAD EN LA BD |
221 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 241 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
222 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 242 | // //TODO ACTUALIZO LA CANTIDAD EN EL RV |
223 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 243 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
224 | viewAdapter.notifyDataSetChanged() | 244 | // viewAdapter.notifyDataSetChanged() |
225 | } else { | 245 | // } else { |
226 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 246 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
227 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") | 247 | // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.") |
228 | .setCancelable(false) | 248 | // .setCancelable(false) |
229 | mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() | 249 | // mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString() |
230 | val mAlertDialog = mBuilder.show() | 250 | // val mAlertDialog = mBuilder.show() |
231 | mDialogView.rbSumar.setOnClickListener { | 251 | // mDialogView.rbSumar.setOnClickListener { |
232 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | 252 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
233 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | 253 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
234 | } | 254 | // } |
235 | } | ||
236 | mDialogView.rbRestar.setOnClickListener { | ||
237 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
238 | if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { | ||
239 | mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
240 | } | ||
241 | } | ||
242 | } | ||
243 | mDialogView.rbMdodificar.setOnClickListener { | ||
244 | if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
245 | mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
246 | } | ||
247 | } | ||
248 | mDialogView.btnAceptar.setOnClickListener { | ||
249 | mAlertDialog.dismiss() | ||
250 | val name = mDialogView.tvgenerico4.text.toString().toFloat() | ||
251 | fCant = 0F | ||
252 | fCant = name | ||
253 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
254 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
255 | viewAdapter.notifyDataSetChanged() | ||
256 | } | ||
257 | mDialogView.dialogCancelBtn.setOnClickListener { | ||
258 | mAlertDialog.dismiss() | ||
259 | } | ||
260 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | ||
261 | // val type = InputType.TYPE_CLASS_NUMBER | ||
262 | // MaterialDialog(requireContext()).show { | ||
263 | // | ||
264 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | ||
265 | // message(R.string.sCantidadNueva) | ||
266 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | ||
267 | // fCant = 0F | ||
268 | // fCant = charSequence.toString().toFloat() | ||
269 | // } | 255 | // } |
270 | // positiveButton(R.string.btnOk) { | 256 | // mDialogView.rbRestar.setOnClickListener { |
271 | // //TODO ACTUALIZO CANTIADAD EN BD | 257 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { |
272 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 258 | // if (mDialogView.tvCantInicial.text.toString().toFloat() >= mDialogView.tvNuevaCantidad.text.toString().toFloat()) { |
273 | // //TODO ACTUALIZO CANTIDAD EN RV | 259 | // mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() |
260 | // } | ||
261 | // } | ||
262 | // } | ||
263 | // mDialogView.rbMdodificar.setOnClickListener { | ||
264 | // if (!mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) { | ||
265 | // mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString() | ||
266 | // } | ||
267 | // } | ||
268 | // mDialogView.btnAceptar.setOnClickListener { | ||
269 | // mAlertDialog.dismiss() | ||
270 | // val name = mDialogView.tvgenerico4.text.toString().toFloat() | ||
271 | // fCant = 0F | ||
272 | // fCant = name | ||
274 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 273 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
274 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
275 | // viewAdapter.notifyDataSetChanged() | 275 | // viewAdapter.notifyDataSetChanged() |
276 | // dismiss() | ||
277 | // } | 276 | // } |
278 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 277 | // mDialogView.dialogCancelBtn.setOnClickListener { |
279 | } | 278 | // mAlertDialog.dismiss() |
280 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | 279 | // } |
281 | 280 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | |
282 | GlobalScope.launch(Dispatchers.Main) { | 281 | //// val type = InputType.TYPE_CLASS_NUMBER |
283 | //TODO BUSCO EN BASE DE DATOS | 282 | //// MaterialDialog(requireContext()).show { |
284 | listArticulos[indiceDelArtEncontrado].cantTomada | 283 | //// |
285 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 284 | //// title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
286 | ContinuarCargaCB(artEncontrado) | 285 | //// message(R.string.sCantidadNueva) |
287 | } | 286 | //// input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
288 | } | 287 | //// fCant = 0F |
289 | return@setOnKeyListener true | 288 | //// fCant = charSequence.toString().toFloat() |
289 | //// } | ||
290 | //// positiveButton(R.string.btnOk) { | ||
291 | //// //TODO ACTUALIZO CANTIADAD EN BD | ||
292 | //// updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | ||
293 | //// //TODO ACTUALIZO CANTIDAD EN RV | ||
294 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | ||
295 | //// viewAdapter.notifyDataSetChanged() | ||
296 | //// dismiss() | ||
297 | //// } | ||
298 | //// }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
299 | // } | ||
300 | // } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | ||
301 | // | ||
302 | // GlobalScope.launch(Dispatchers.Main) { | ||
303 | // //TODO BUSCO EN BASE DE DATOS | ||
304 | // listArticulos[indiceDelArtEncontrado].cantTomada | ||
305 | // val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | ||
306 | // ContinuarCargaCB(artEncontrado) | ||
307 | // } | ||
308 | // } | ||
309 | // return@setOnKeyListener true | ||
310 | // } | ||
290 | } | 311 | } |
291 | } | 312 | } |
292 | } | 313 | } |
293 | return@setOnKeyListener false | 314 | return@setOnKeyListener false |
294 | } | 315 | } |
295 | return v | 316 | return v |
296 | } | 317 | } |
297 | 318 | ||
298 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 319 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
299 | super.onViewCreated(view, savedInstanceState) | 320 | super.onViewCreated(view, savedInstanceState) |
300 | navController = Navigation.findNavController(view) | 321 | navController = Navigation.findNavController(view) |
301 | etCodigoBarras.requestFocus() | 322 | etCodigoBarras.requestFocus() |
323 | val modalDialog = NoEncontradoSimple() | ||
324 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
302 | 325 | ||
303 | btnBorrarInv.setOnClickListener { | 326 | btnBorrarInv.setOnClickListener { |
304 | MaterialDialog(requireContext()).show { | 327 | AlertDialog.Builder(requireContext()) |
305 | title(R.string.sTituloBorrarInv) | 328 | .setTitle("Eliminación de Inventarios") |
306 | message(R.string.sMensajeBorrarInv) | 329 | .setMessage("¿Confirma que desea eliminar el inventario?") |
307 | positiveButton(R.string.btnOk) { | 330 | .setPositiveButton(R.string.btnOk, |
331 | DialogInterface.OnClickListener { dialog, which -> | ||
308 | BorrarInvActual() | 332 | BorrarInvActual() |
309 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | 333 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() |
310 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 334 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
311 | InventarioNuevo = 0 | 335 | InventarioNuevo = 0 |
312 | dismiss() | 336 | |
313 | } | 337 | }) |
314 | negativeButton { | 338 | .setNegativeButton(R.string.btnCancelar, |
315 | dismiss() | 339 | DialogInterface.OnClickListener { dialog, which -> |
316 | } | 340 | //botón cancel pulsado |
317 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 341 | }) |
342 | .show() | ||
343 | |||
344 | |||
345 | // MaterialDialog(requireContext()).show { | ||
346 | // title(R.string.sTituloBorrarInv) | ||
347 | // message(R.string.sMensajeBorrarInv) | ||
348 | // positiveButton(R.string.btnOk) { | ||
349 | // BorrarInvActual() | ||
350 | // Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | ||
351 | // navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | ||
352 | // InventarioNuevo = 0 | ||
353 | // dismiss() | ||
354 | // } | ||
355 | // negativeButton { | ||
356 | // dismiss() | ||
357 | // } | ||
358 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
318 | } | 359 | } |
319 | 360 | ||
320 | btnExportarInv.setOnClickListener { | 361 | btnExportarInv.setOnClickListener { |
321 | MaterialDialog(requireContext()).show { | 362 | AlertDialog.Builder(requireContext()) |
322 | title(R.string.sTituloExportar) | 363 | .setTitle(R.string.sTituloExportar) |
323 | message(R.string.sMensajeExportar) | 364 | .setMessage(R.string.sMensajeExportar) |
324 | positiveButton(R.string.btnOk) { | 365 | .setPositiveButton(R.string.btnOk, |
325 | BorrarInvActual() | 366 | DialogInterface.OnClickListener { dialog, which -> |
326 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | 367 | BorrarInvActual() |
327 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 368 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() |
328 | InventarioNuevo = 0 | 369 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
329 | dismiss() | 370 | InventarioNuevo = 0 |
330 | } | 371 | |
331 | negativeButton { | 372 | }) |
332 | dismiss() | 373 | .setNegativeButton(R.string.btnCancelar, |
333 | } | 374 | DialogInterface.OnClickListener { dialog, which -> |
334 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 375 | //botón cancel pulsado |
376 | }) | ||
377 | .show() | ||
378 | |||
379 | // MaterialDialog(requireContext()).show { | ||
380 | // title(R.string.sTituloExportar) | ||
381 | // message(R.string.sMensajeExportar) | ||
382 | // positiveButton(R.string.btnOk) { | ||
383 | // BorrarInvActual() | ||
384 | // Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | ||
385 | // navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | ||
386 | // InventarioNuevo = 0 | ||
387 | // dismiss() | ||
388 | // } | ||
389 | // negativeButton { | ||
390 | // dismiss() | ||
391 | // } | ||
392 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | ||
335 | } | 393 | } |
336 | ivCamara.setOnClickListener { | 394 | ivCamara.setOnClickListener { |
337 | if (!bFirst) { | 395 | if (!bFirst) { |
338 | iEstado = 1 | 396 | iEstado = 1 |
339 | bFirst = true | 397 | bFirst = true |
340 | } | 398 | } |
341 | 399 | ||
342 | when (iEstado) { | 400 | when (iEstado) { |
343 | 0 -> { | 401 | 0 -> { |
344 | ivCamara.setImageResource(R.drawable.codbar) | 402 | ivCamara.setImageResource(R.drawable.codbar) |
345 | etCodigoBarras.hint = "Busqueda por C. Barras" | 403 | etCodigoBarras.hint = "Busqueda por C. Barras" |
346 | swSumaUno.visibility = View.VISIBLE | 404 | swSumaUno.visibility = View.VISIBLE |
347 | iBusquedaPor = 0 | 405 | iBusquedaPor = 0 |
348 | iEstado = 1 | 406 | iEstado = 1 |
349 | } | 407 | } |
350 | 1 -> { | 408 | 1 -> { |
351 | ivCamara.setImageResource(R.drawable.desc) | 409 | ivCamara.setImageResource(R.drawable.desc) |
352 | etCodigoBarras.hint = "Busqueda por Descripción" | 410 | etCodigoBarras.hint = "Busqueda por Descripción" |
353 | swSumaUno.visibility = View.GONE | 411 | swSumaUno.visibility = View.GONE |
354 | iBusquedaPor = 1 | 412 | iBusquedaPor = 1 |
355 | iEstado = 2 | 413 | iEstado = 2 |
356 | } | 414 | } |
357 | 2 -> { | 415 | 2 -> { |
358 | ivCamara.setImageResource(R.drawable.cod_origen) | 416 | ivCamara.setImageResource(R.drawable.cod_origen) |
359 | etCodigoBarras.hint = "Busqueda por C. Origen" | 417 | etCodigoBarras.hint = "Busqueda por C. Origen" |
360 | swSumaUno.visibility = View.GONE | 418 | swSumaUno.visibility = View.GONE |
361 | iBusquedaPor = 2 | 419 | iBusquedaPor = 2 |
362 | iEstado = 0 | 420 | iEstado = 0 |
363 | } | 421 | } |
364 | } | 422 | } |
365 | } | 423 | } |
366 | } | 424 | } |
367 | 425 | ||
368 | private fun BorrarInvActual() { | 426 | private fun BorrarInvActual() { |
369 | lifecycleScope.launch { | 427 | lifecycleScope.launch { |
370 | withContext(Dispatchers.IO) { | 428 | withContext(Dispatchers.IO) { |
371 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) | 429 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) |
372 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) | 430 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) |
373 | } | 431 | } |
374 | } | 432 | } |
375 | } | 433 | } |
376 | 434 | ||
377 | private fun CargarDeBdInventario(ultimoInv: Int) { | 435 | private fun CargarDeBdInventario(ultimoInv: Int) { |
378 | GlobalScope.launch(Dispatchers.Main) { | 436 | GlobalScope.launch(Dispatchers.Main) { |
379 | val invbody = cargarInventario(ultimoInv) | 437 | val invbody = cargarInventario(ultimoInv) |
380 | for ((i, item) in invbody!!.withIndex()) { | 438 | for ((i, item) in invbody!!.withIndex()) { |
381 | val art = Articles(invbody[i].sector, | 439 | val art = Articles(invbody[i].sector, |
382 | invbody[i].codigo, | 440 | invbody[i].codigo, |
383 | invbody[i].descripcion, | 441 | invbody[i].descripcion, |
384 | invbody[i].codBar, | 442 | invbody[i].codBar, |
385 | invbody[i].codOrigen, | 443 | invbody[i].codOrigen, |
386 | invbody[i].precio, | 444 | invbody[i].precio, |
387 | invbody[i].costo, | 445 | invbody[i].costo, |
388 | "", | 446 | "", |
389 | "", | 447 | "", |
390 | "", | 448 | "", |
391 | invbody[i].balanza, | 449 | invbody[i].balanza, |
392 | invbody[i].depSn, | 450 | invbody[i].depSn, |
393 | invbody[i].costo) | 451 | invbody[i].costo) |
394 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) | 452 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) |
395 | } | 453 | } |
396 | } | 454 | } |
397 | 455 | ||
398 | } | 456 | } |
399 | 457 | ||
458 | @SuppressLint("RestrictedApi") | ||
400 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { | 459 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { |
401 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS | 460 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS |
402 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV | 461 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV |
403 | 462 | ||
404 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | 463 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD |
405 | // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1 | 464 | // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1 |
406 | if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 465 | if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
407 | fCant = 0F | 466 | fCant = 0F |
408 | fCant += 1F | 467 | fCant += 1F |
409 | // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 468 | // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
410 | val acargarPorDesc = Articles(artAcargar[0].sector, | 469 | val acargarPorDesc = Articles(artAcargar[0].sector, |
411 | artAcargar[0].codigo, | 470 | artAcargar[0].codigo, |
412 | artAcargar[0].descripcion, | 471 | artAcargar[0].descripcion, |
413 | artAcargar[0].codBar, | 472 | artAcargar[0].codBar, |
414 | artAcargar[0].codOrigen, | 473 | artAcargar[0].codOrigen, |
415 | artAcargar[0].precio, | 474 | artAcargar[0].precio, |
416 | artAcargar[0].costo, | 475 | artAcargar[0].costo, |
417 | "", | 476 | "", |
418 | "", | 477 | "", |
419 | "", | 478 | "", |
420 | artAcargar[0].balanza, | 479 | artAcargar[0].balanza, |
421 | artAcargar[0].depSn, | 480 | artAcargar[0].depSn, |
422 | "") | 481 | "") |
423 | // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 482 | // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
424 | cargarArtEnBd(acargarPorDesc, fCant) | 483 | cargarArtEnBd(acargarPorDesc, fCant) |
425 | cargarRecicler(acargarPorDesc, fCant) | 484 | cargarRecicler(acargarPorDesc, fCant) |
426 | } else { | 485 | } else { |
427 | var bundle = Bundle() | 486 | var bundle = Bundle() |
428 | bundle = bundleOf("ArrayDesc" to artAcargar) | 487 | bundle = bundleOf("ArrayDesc" to artAcargar) |
429 | bundle.putInt("numeroInv", InventarioNuevo) | 488 | bundle.putInt("numeroInv", InventarioNuevo) |
430 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 489 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
490 | //navController.backStack.removeLast() | ||
431 | } | 491 | } |
432 | // } else {//SI NO ESTA +1 | 492 | // } else {//SI NO ESTA +1 |
433 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 493 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
434 | // fCant = listArticulos[0].cantTomada | 494 | // fCant = listArticulos[0].cantTomada |
435 | // MaterialDialog(requireContext()).show { | 495 | // MaterialDialog(requireContext()).show { |
436 | // title(R.string.sTituloNueva) | 496 | // title(R.string.sTituloNueva) |
437 | // message(R.string.sCantidadNueva) | 497 | // message(R.string.sCantidadNueva) |
438 | // input { materialDialog, charSequence -> | 498 | // input { materialDialog, charSequence -> |
439 | // fCant = 0F | 499 | // fCant = 0F |
440 | // fCant = charSequence.toString().toFloat() | 500 | // fCant = charSequence.toString().toFloat() |
441 | // } | 501 | // } |
442 | // positiveButton(R.string.btnOk) { | 502 | // positiveButton(R.string.btnOk) { |
443 | // listArticulos[0].cantTomada = fCant | 503 | // listArticulos[0].cantTomada = fCant |
444 | // viewAdapter.notifyDataSetChanged() | 504 | // viewAdapter.notifyDataSetChanged() |
445 | // dismiss() | 505 | // dismiss() |
446 | // } | 506 | // } |
447 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 507 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
448 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 508 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
449 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 509 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
450 | // artAcargar[0].codigo, | 510 | // artAcargar[0].codigo, |
451 | // artAcargar[0].descripcion, | 511 | // artAcargar[0].descripcion, |
452 | // artAcargar[0].codBar, | 512 | // artAcargar[0].codBar, |
453 | // artAcargar[0].cod_origen, | 513 | // artAcargar[0].cod_origen, |
454 | // artAcargar[0].precio, | 514 | // artAcargar[0].precio, |
455 | // artAcargar[0].costo, | 515 | // artAcargar[0].costo, |
456 | // artAcargar[0].balanza, | 516 | // artAcargar[0].balanza, |
457 | // artAcargar[0].depSn, | 517 | // artAcargar[0].depSn, |
458 | // "") | 518 | // "") |
459 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 519 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
460 | // cargarArtEnBd(acargarPorDesc, fCant) | 520 | // cargarArtEnBd(acargarPorDesc, fCant) |
461 | // cargarRecicler(acargarPorDesc, fCant) | 521 | // cargarRecicler(acargarPorDesc, fCant) |
462 | // } else { | 522 | // } else { |
463 | // var bundle = Bundle() | 523 | // var bundle = Bundle() |
464 | // bundle = bundleOf("ArrayDesc" to artAcargar) | 524 | // bundle = bundleOf("ArrayDesc" to artAcargar) |
465 | // bundle.putInt("numeroInv", InventarioNuevo) | 525 | // bundle.putInt("numeroInv", InventarioNuevo) |
466 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 526 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
467 | // } | 527 | // } |
468 | // } | 528 | // } |
469 | } else {//TODO si no lo encuentra en la BD | 529 | } else {//TODO si no lo encuentra en la BD |
470 | val modalDialog = DialogNoEncontrado() | 530 | val modalDialog = DialogNoEncontrado() |
471 | 531 | ||
472 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | 532 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
473 | 533 | ||
474 | // MaterialDialog(requireContext()).show { | 534 | // MaterialDialog(requireContext()).show { |
475 | // val t=etCodigoBarras.text | 535 | // val t=etCodigoBarras.text |
476 | // title(text = "El articulo ${etCodigoBarras.text.toString()}") | 536 | // title(text = "El articulo ${etCodigoBarras.text.toString()}") |
477 | // message(R.string.sMensaje) | 537 | // message(R.string.sMensaje) |
478 | // positiveButton(R.string.btnOk) { | 538 | // positiveButton(R.string.btnOk) { |
479 | // dismiss() | 539 | // dismiss() |
480 | // } | 540 | // } |
481 | // }.cornerRadius(10F) | 541 | // }.cornerRadius(10F) |
482 | } | 542 | } |
483 | etCodigoBarras.focusable = View.FOCUSABLE | 543 | etCodigoBarras.focusable = View.FOCUSABLE |
484 | etCodigoBarras.setText("") | 544 | etCodigoBarras.setText("") |
485 | etCodigoBarras.selectAll() | 545 | etCodigoBarras.selectAll() |
486 | } | 546 | } |
487 | 547 | ||
488 | private fun ContinuarCargaCB(artAcargar: Articles?) { | 548 | private fun ContinuarCargaCB(artAcargar: Articles?) { |
489 | 549 | ||
490 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD | 550 | if (artAcargar != null) {// TODO: Si lo encuentra en la BD |
491 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 | 551 | if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1 |
492 | fCant = 0F | 552 | fCant = 0F |
493 | fCant += 1F | 553 | fCant += 1F |
494 | cargarArtEnBd(artAcargar, fCant) | 554 | cargarArtEnBd(artAcargar, fCant) |
495 | cargarRecicler(artAcargar, fCant) | 555 | cargarRecicler(artAcargar, fCant) |
496 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD | 556 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD |
497 | 557 | ||
498 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) | 558 | val mDialogView = LayoutInflater.from(context).inflate(R.layout.ingresar_cantidad, null) |
499 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setCancelable(false) | 559 | val mBuilder = AlertDialog.Builder(context).setView(mDialogView) |
500 | mDialogView.tvTitulo.text="Producto '${artAcargar.descripcion.toString()}'." | 560 | .setCancelable(false) |
561 | mDialogView.tvTitulo.text = "${artAcargar.descripcion.toString()}" | ||
501 | val mAlertDialog = mBuilder.show() | 562 | val mAlertDialog = mBuilder.show() |
502 | mDialogView.btnAceptar.setOnClickListener { | 563 | mDialogView.btnAceptar.setOnClickListener { |
503 | mAlertDialog.dismiss() | 564 | if (mDialogView.etCantidad.text.isNullOrEmpty()) { |
504 | fCant = 0F | 565 | mDialogView.etCantidad.error = "No vacio" |
505 | fCant = mDialogView.etCantidad.text.toString().toFloat() | 566 | mDialogView.etCantidad.requestFocus() |
506 | cargarArtEnBd(artAcargar, fCant) | 567 | mDialogView.etCantidad.hint = "Ingrese un valor" |
507 | cargarRecicler(artAcargar, fCant) | 568 | } else if (!mDialogView.etCantidad.text.isNullOrEmpty()) { |
569 | mAlertDialog.dismiss() | ||
570 | // fCant = 0F | ||
571 | // fCant = mDialogView.etCantidad.text.toString().toFloat() | ||
572 | cargarArtEnBd(artAcargar, mDialogView.etCantidad.text.toString().toFloat()) | ||
573 | cargarRecicler(artAcargar, mDialogView.etCantidad.text.toString().toFloat()) | ||
574 | } | ||
508 | } | 575 | } |
509 | } | 576 | } |
510 | } else {// TODO si no lo encuentra en la BD | 577 | } else {// TODO si no lo encuentra en la BD |
511 | 578 | val modalDialog = NoEncontradoSimple() | |
512 | MaterialDialog(requireContext()).show { | 579 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
513 | title(text = "El producto: $sChangeUpper") | 580 | // MaterialDialog(requireContext()).show { |
514 | message(text = "¡No fue encontrado!") | 581 | // |
515 | positiveButton(R.string.btnOk) {} | 582 | // title(text = "El producto: $sChangeUpper") |
516 | dismiss() | 583 | // message(text = "¡No fue encontrado!") |
517 | } | 584 | // positiveButton(R.string.btnOk) {} |
585 | // dismiss() | ||
586 | // } | ||
518 | } | 587 | } |
519 | etCodigoBarras.focusable = View.FOCUSABLE | 588 | etCodigoBarras.focusable = View.FOCUSABLE |
520 | etCodigoBarras.setText("") | 589 | etCodigoBarras.setText("") |
521 | etCodigoBarras.selectAll() | 590 | etCodigoBarras.selectAll() |
522 | } | 591 | } |
523 | 592 | ||
524 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { | 593 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { |
525 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 594 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
526 | var busqueda: Articles? = null | 595 | var busqueda: Articles? = null |
527 | return GlobalScope.async(Dispatchers.IO) { | 596 | return GlobalScope.async(Dispatchers.IO) { |
528 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea) | 597 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea) |
529 | return@async busqueda | 598 | return@async busqueda |
530 | }.await() | 599 | }.await() |
531 | } | 600 | } |
532 | 601 | ||
533 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { | 602 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { |
534 | //TODO BUSQUEDA POR DESCRIPCION | 603 | //TODO BUSQUEDA POR DESCRIPCION |
535 | var busqueda: List<Articles>? = null | 604 | var busqueda: List<Articles>? = null |
536 | return GlobalScope.async(Dispatchers.IO) { | 605 | return GlobalScope.async(Dispatchers.IO) { |
537 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea) | 606 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea) |
538 | return@async busqueda | 607 | return@async busqueda |
539 | }.await() | 608 | }.await() |
540 | } | 609 | } |
541 | 610 | ||
542 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { | 611 | suspend fun borrarArticulo(sector: String, codigo: String, inventario: String): Int? { |
543 | //TODO BUSQUEDA POR DESCRIPCION | 612 | //TODO BUSQUEDA POR DESCRIPCION |
544 | var result: Int | 613 | var result: Int |
545 | return GlobalScope.async(Dispatchers.IO) { | 614 | return GlobalScope.async(Dispatchers.IO) { |
546 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo, inventario) | 615 | result = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.deleteItemFromInvBody(sector, codigo, inventario) |
547 | return@async result | 616 | return@async result |
548 | }.await() | 617 | }.await() |
549 | } | 618 | } |
550 | 619 | ||
551 | private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | 620 | private suspend fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { |
552 | var indice = 0 | 621 | |
553 | var bEncontrado = false | 622 | return GlobalScope.async(Dispatchers.IO) { |
554 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | 623 | var indice = 0 |
555 | for (item in listArticulos) { | 624 | var bEncontrado = false |
556 | if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 625 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS |
557 | bEncontrado = true | 626 | // TODO CAMBIO DE CB A CODIGO DEBO |
558 | break | 627 | val any = cambioCBporCodigoDebo(codigoBarras) |
628 | if (any != null) { | ||
629 | for (item in listArticulos) { | ||
630 | if (item.sector!!.toInt() == any.sector!!.toInt() && item.codigo!!.toInt() == any.codigo!!.toInt()) { | ||
631 | bEncontrado = true | ||
632 | break | ||
633 | } | ||
634 | indice += 1 | ||
635 | } | ||
559 | } | 636 | } |
560 | indice += 1 | 637 | |
561 | } | 638 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION |
562 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | 639 | for (item in listArticulos) { |
563 | for (item in listArticulos) { | 640 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
564 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 641 | bEncontrado = true |
565 | bEncontrado = true | 642 | break |
566 | break | 643 | } |
644 | indice += 1 | ||
567 | } | 645 | } |
568 | indice += 1 | 646 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN |
569 | } | 647 | for (item in listArticulos) { |
570 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | 648 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
571 | for (item in listArticulos) { | 649 | bEncontrado = true |
572 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 650 | break |
573 | bEncontrado = true | 651 | } |
574 | break | 652 | indice += 1 |
575 | } | 653 | } |
576 | indice += 1 | ||
577 | } | 654 | } |
578 | } | 655 | return@async if (bEncontrado) indice else -1 |
579 | return if (bEncontrado) indice | 656 | }.await() |
580 | else -1 | 657 | } |
658 | |||
659 | suspend fun cambioCBporCodigoDebo(codigoBarras: String): Articles? { | ||
660 | //TODO BUSQUEDA POR DESCRIPCION | ||
661 | var busqueda: Articles? = null | ||
662 | return GlobalScope.async(Dispatchers.IO) { | ||
663 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(codigoBarras, iArea) | ||
664 | return@async busqueda | ||
665 | }.await() | ||
581 | } | 666 | } |
582 | 667 | ||
583 | private fun cargarArtEnBd(articulos: Articles, cant: Float) { | 668 | private fun cargarArtEnBd(articulos: Articles, cant: Float) { |
584 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD | 669 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD |
585 | articulos.sector, | 670 | articulos.sector, |
586 | articulos.codigo, | 671 | articulos.codigo, |
587 | articulos.descripcion, | 672 | articulos.descripcion, |
588 | cant.toString(), | 673 | cant.toString(), |
589 | articulos.codBar, | 674 | articulos.codBar, |
590 | articulos.codOrigen, | 675 | articulos.codOrigen, |
591 | articulos.precio, | 676 | articulos.precio, |
592 | articulos.precio, | 677 | articulos.precio, |
593 | articulos.balanza, | 678 | articulos.balanza, |
594 | articulos.depSn, | 679 | articulos.depSn, |
595 | ObtenerFechaActual(), | 680 | ObtenerFechaActual(), |
596 | ObtenerFechaActual()) | 681 | ObtenerFechaActual()) |
597 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS | 682 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS |
598 | } | 683 | } |
599 | 684 | ||
600 | fun cargarRecicler(articulos: Articles, cant: Float) { | 685 | fun cargarRecicler(articulos: Articles, cant: Float) { |
601 | //TODO CARGO EN LE RV | 686 | //TODO CARGO EN LE RV |
602 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen) | 687 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen) |
603 | listArticulos.add(item) | 688 | listArticulos.add(item) |
604 | 689 | ||
605 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) | 690 | viewAdapter = ProductosListAdapter(requireContext(), listArticulos, this) |
606 | viewManager = LinearLayoutManager(requireContext()) | 691 | viewManager = LinearLayoutManager(requireContext()) |
607 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 692 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
608 | rcInventarios.apply { | 693 | rcInventarios.apply { |
609 | adapter = viewAdapter | 694 | adapter = viewAdapter |
610 | layoutManager = viewManager | 695 | layoutManager = viewManager |
611 | } | 696 | } |
612 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 697 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
613 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 698 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
614 | return false | 699 | return false |
615 | } | 700 | } |
616 | 701 | ||
617 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | 702 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
618 | 703 | ||
619 | GlobalScope.launch(Dispatchers.Main) { | 704 | GlobalScope.launch(Dispatchers.Main) { |
620 | borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) | 705 | borrarArticulo(listArticulos[viewHolder.adapterPosition].sector.toString(), listArticulos[viewHolder.adapterPosition].codigo.toString(), InventarioNuevo.toString()) |
621 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | 706 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) |
622 | viewAdapter.notifyDataSetChanged() | 707 | viewAdapter.notifyDataSetChanged() |
623 | } | 708 | } |
624 | } | 709 | } |
625 | 710 | ||
626 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 711 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
627 | val itemView = viewHolder.itemView | 712 | val itemView = viewHolder.itemView |
628 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 713 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
629 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 714 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
630 | 715 | ||
631 | if (dX > 0) { | 716 | if (dX > 0) { |
632 | 717 | ||
633 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 718 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
634 | else c.drawColor(Color.RED) | 719 | else c.drawColor(Color.RED) |
635 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 720 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
636 | } else { | 721 | } else { |
637 | } | 722 | } |
638 | 723 | ||
639 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 724 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
640 | deleteIcon.draw(c) | 725 | deleteIcon.draw(c) |
641 | } | 726 | } |
642 | } | 727 | } |
643 | 728 | ||
644 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 729 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
645 | itemTouchHelper.attachToRecyclerView(rcInventarios) | 730 | itemTouchHelper.attachToRecyclerView(rcInventarios) |
646 | } | 731 | } |
647 | 732 | ||
648 | private fun ProdNoCont(): Int? { | 733 | private fun ProdNoCont(): Int? { |
649 | var mostrarStock = 0 | 734 | var mostrarStock = 0 |
650 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 | 735 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 |
651 | return mostrarStock | 736 | return mostrarStock |
652 | } | 737 | } |
653 | 738 | ||
654 | private fun AjusteProductos(): Int? { | 739 | private fun AjusteProductos(): Int? { |
655 | var prodInclu = 0 | 740 | var prodInclu = 0 |
656 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 | 741 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 |
657 | 742 | ||
658 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 | 743 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 |
659 | return prodInclu | 744 | return prodInclu |
660 | } | 745 | } |
661 | 746 | ||
662 | private fun SerchArea() { | 747 | private fun SerchArea() { |
663 | |||
664 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 | 748 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 |
665 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 | 749 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 |
666 | } | 750 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/InventarioListAdapter.kt
1 | package com.focasoftware.deboinventariov20.ui.main | 1 | package com.focasoftware.deboinventariov20.ui.main |
2 | 2 | ||
3 | import android.content.Context | 3 | import android.content.Context |
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 androidx.recyclerview.widget.RecyclerView | 7 | import androidx.recyclerview.widget.RecyclerView |
8 | import com.focasoftware.deboinventariov20.Model.InvHead | ||
8 | import com.focasoftware.deboinventariov20.R | 9 | import com.focasoftware.deboinventariov20.R |
9 | import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder | 10 | import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder |
10 | import kotlinx.android.synthetic.main.item_principal.view.* | 11 | import kotlinx.android.synthetic.main.item_principal.view.* |
11 | 12 | ||
12 | class InventarioListAdapter(private val context: Context, private val inv: ArrayList<ItemInventario>, private val itemClickListener: OnInventarioClickListener) : | 13 | class InventarioListAdapter(private val context: Context, private val inv: ArrayList<InvHead>, private val itemClickListener: OnInventarioClickListener) : |
13 | RecyclerView.Adapter<BaseViewHolder<*>>() { | 14 | RecyclerView.Adapter<BaseViewHolder<*>>() { |
14 | 15 | ||
15 | interface OnInventarioClickListener { | 16 | interface OnInventarioClickListener { |
16 | fun onItemClick(inventario: String?) | 17 | fun onItemClick(inventario: String?) |
17 | } | 18 | } |
18 | 19 | ||
19 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) | 20 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) |
20 | 21 | ||
21 | override fun getItemCount() = inv.size | 22 | override fun getItemCount() = inv.size |
22 | 23 | ||
23 | 24 | ||
24 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<ItemInventario>(itemView) { | 25 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { |
25 | override fun bind(item: ItemInventario, position: Int) { | 26 | override fun bind(item: InvHead, position: Int) { |
26 | itemView.setOnClickListener {itemClickListener.onItemClick(item.inventario)} | 27 | itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} |
27 | itemView.tvPrincipalinventario.text = item.inventario | 28 | itemView.tvPrincipalinventario.text = item.invNum.toString() |
28 | } | 29 | } |
29 | } | 30 | } |
30 | 31 | ||
31 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | 32 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { |
32 | when (holder) { | 33 | when (holder) { |
33 | is ItemsViewHolder -> holder.bind(inv[position], position) | 34 | is ItemsViewHolder -> holder.bind(inv[position], position) |
34 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") | 35 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") |
35 | } | 36 | } |
36 | } | 37 | } |
37 | 38 | ||
38 | 39 | ||
39 | } | 40 | } |
40 | 41 | ||
41 | 42 | ||
42 | 43 | ||
43 | 44 |
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 | ||
10 | import android.widget.ImageView | ||
11 | import android.widget.LinearLayout | ||
12 | import android.widget.TextView | ||
9 | import androidx.fragment.app.Fragment | 13 | import androidx.fragment.app.Fragment |
10 | import androidx.navigation.NavController | 14 | import androidx.navigation.NavController |
11 | import androidx.navigation.Navigation | 15 | import androidx.navigation.Navigation |
12 | import androidx.recyclerview.widget.LinearLayoutManager | 16 | import androidx.recyclerview.widget.LinearLayoutManager |
13 | import androidx.recyclerview.widget.RecyclerView | 17 | import androidx.recyclerview.widget.RecyclerView |
14 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 18 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
15 | import com.focasoftware.deboinventariov20.Model.InvHead | 19 | import com.focasoftware.deboinventariov20.Model.InvHead |
16 | import com.focasoftware.deboinventariov20.R | 20 | import com.focasoftware.deboinventariov20.R |
17 | import kotlinx.coroutines.Dispatchers | 21 | import kotlinx.coroutines.Dispatchers |
18 | import kotlinx.coroutines.GlobalScope | 22 | import kotlinx.coroutines.GlobalScope |
19 | import kotlinx.coroutines.async | 23 | import kotlinx.coroutines.async |
20 | import kotlinx.coroutines.launch | 24 | import kotlinx.coroutines.launch |
21 | import java.util.* | 25 | import java.util.* |
22 | 26 | ||
23 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { | 27 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { |
24 | private lateinit var inventarios: List<InvHead> | 28 | private lateinit var inventarios: ArrayList<InvHead> |
29 | private lateinit var ordenado: ArrayList<InvHead> | ||
25 | private lateinit var rcInventario: RecyclerView | 30 | private lateinit var rcInventario: RecyclerView |
26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 31 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
27 | private lateinit var viewManager: RecyclerView.LayoutManager | 32 | private lateinit var viewManager: RecyclerView.LayoutManager |
28 | private var listIvn = ArrayList<ItemInventario>() | 33 | private var listIvn = ArrayList<InvHead>() |
29 | private lateinit var navController: NavController | 34 | private lateinit var navController: NavController |
30 | private lateinit var sharedPreferences: SharedPreferences | 35 | private lateinit var sharedPreferences: SharedPreferences |
36 | private var cantidadInventarios: Int = 0 | ||
31 | 37 | ||
32 | override fun onCreate(savedInstanceState: Bundle?) { | 38 | override fun onCreate(savedInstanceState: Bundle?) { |
33 | super.onCreate(savedInstanceState) | 39 | super.onCreate(savedInstanceState) |
34 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 40 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
35 | |||
36 | |||
37 | } | 41 | } |
38 | 42 | ||
39 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 43 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
44 | var bAbiertoCerrado = false | ||
40 | val v = inflater.inflate(R.layout.fragment_main, container, false) | 45 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
46 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) | ||
47 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) | ||
48 | val tvFecha = v.findViewById<TextView>(R.id.tvFecha) | ||
49 | val ivSort19= v.findViewById<ImageView>(R.id.ivSort19) | ||
50 | val ivSort91= v.findViewById<ImageView>(R.id.ivSort91) | ||
51 | val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas) | ||
52 | val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito) | ||
53 | |||
54 | rcInventario = v.findViewById(R.id.rcInventario) | ||
41 | 55 | ||
42 | GlobalScope.launch(Dispatchers.Main) { | 56 | GlobalScope.launch(Dispatchers.Main) { |
43 | inventarios = buscarEnBDInvHead() | 57 | inventarios = buscarEnBDInvHead() |
44 | for ((i, item) in inventarios.withIndex()) { | 58 | for ((i, item) in inventarios.withIndex()) { |
45 | val inv = InvHead(inventarios[i].invNum, | 59 | val inv = InvHead(inventarios[i].invNum, |
46 | inventarios[i].descripcion, | 60 | inventarios[i].descripcion, |
47 | inventarios[i].estado, | 61 | inventarios[i].estado, |
48 | inventarios[i].fechaInicio, | 62 | inventarios[i].fechaInicio, |
49 | inventarios[i].fechaFinal, | 63 | inventarios[i].fechaFinal, |
50 | inventarios[i].prodContados, | 64 | inventarios[i].prodContados, |
51 | inventarios[i].lugar, | 65 | inventarios[i].lugar, |
52 | inventarios[i].stDesc, | 66 | inventarios[i].stDesc, |
53 | inventarios[i].proNoCont) | 67 | inventarios[i].proNoCont) |
54 | cargarRecicler(inv) | 68 | cargarRecicler(inv) |
69 | cantidadInventarios = i + 1 | ||
70 | } | ||
71 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()})+" | ||
72 | tvInvDinamicos.setOnClickListener { | ||
73 | if (!bAbiertoCerrado) { | ||
74 | bAbiertoCerrado = true | ||
75 | txtDeposito.visibility = View.GONE | ||
76 | rcInventario.visibility = View.VISIBLE | ||
77 | ivSort91.visibility = View.VISIBLE | ||
78 | ivSort19.visibility = View.INVISIBLE | ||
79 | tvFecha.visibility = View.VISIBLE | ||
80 | cbVentas.visibility = View.VISIBLE | ||
81 | cbDeposito.visibility = View.VISIBLE | ||
82 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()})-" | ||
83 | } else { | ||
84 | bAbiertoCerrado = false | ||
85 | rcInventario.visibility = View.GONE | ||
86 | ivSort91.visibility = View.GONE | ||
87 | ivSort19.visibility = View.GONE | ||
88 | tvFecha.visibility = View.GONE | ||
89 | txtDeposito.visibility = View.VISIBLE | ||
90 | cbVentas.visibility = View.GONE | ||
91 | cbDeposito.visibility = View.GONE | ||
92 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()})+" | ||
93 | } | ||
94 | } | ||
95 | ivSort91.setOnClickListener { | ||
96 | ordenado= inventarios.sortedByDescending { | ||
97 | it.invNum | ||
98 | } as ArrayList<InvHead> | ||
99 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | ||
100 | viewManager = LinearLayoutManager(requireContext()) | ||
101 | |||
102 | rcInventario.apply { | ||
103 | adapter = viewAdapter | ||
104 | layoutManager = viewManager | ||
105 | } | ||
106 | viewAdapter.notifyDataSetChanged() | ||
55 | } | 107 | } |
56 | } | 108 | } |
57 | rcInventario = v.findViewById(R.id.rcInventario) | ||
58 | return v | 109 | return v |
59 | } | 110 | } |
60 | 111 | ||
61 | suspend fun buscarEnBDInvHead(): List<InvHead> { | 112 | suspend fun buscarEnBDInvHead(): ArrayList<InvHead> { |
62 | //TODO BUSQUEDA POR DESCRIPCION | 113 | //TODO BUSQUEDA POR DESCRIPCION |
63 | var busqueda: List<InvHead> | 114 | var busqueda: ArrayList<InvHead> |
64 | return GlobalScope.async(Dispatchers.IO) { | 115 | return GlobalScope.async(Dispatchers.IO) { |
65 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | 116 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() |
66 | return@async busqueda | 117 | return@async busqueda |
67 | }.await() | 118 | }.await() |
68 | } | 119 | } |
69 | 120 | ||
70 | fun cargarRecicler(inv: InvHead) { | 121 | fun cargarRecicler(inv: InvHead) { |
71 | //TODO CARGO EN LE RV | 122 | //TODO CARGO EN LE RV |
72 | 123 | ||
73 | val number = if (inv.invNum.toLong()<10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | 124 | val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() |
74 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | 125 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") |
75 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) | 126 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) |
76 | listIvn.add(item) | 127 | // listIvn.add(item) |
77 | 128 | listIvn.add(inv) | |
78 | viewAdapter = InventarioListAdapter(requireContext(),listIvn,this) | 129 | viewAdapter = InventarioListAdapter(requireContext(), listIvn, this) |
79 | viewManager = LinearLayoutManager(requireContext()) | 130 | viewManager = LinearLayoutManager(requireContext()) |
80 | 131 | ||
81 | rcInventario.apply { | 132 | rcInventario.apply { |
82 | adapter = viewAdapter | 133 | adapter = viewAdapter |
83 | layoutManager = viewManager | 134 | layoutManager = viewManager |
84 | } | 135 | } |
85 | } | 136 | } |
86 | 137 | ||
87 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 138 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
88 | super.onViewCreated(view, savedInstanceState) | 139 | super.onViewCreated(view, savedInstanceState) |
89 | navController = Navigation.findNavController(view) | 140 | navController = Navigation.findNavController(view) |
90 | listIvn.clear() | 141 | listIvn.clear() |
91 | } | 142 | } |
92 | 143 | ||
93 | override fun onItemClick(inventario: String?) { | 144 | override fun onItemClick(inventario: String?) { |
94 | 145 | ||
95 | val editor = sharedPreferences.edit() | 146 | val editor = sharedPreferences.edit() |
96 | var invSel:String =inventario.toString() | 147 | // var invSel: String = inventario.toString() |
97 | invSel=invSel.substring(3, 5) | 148 | // invSel = invSel.substring(3, 5) |
98 | editor?.putString("Inventario", invSel) | 149 | editor?.putString("Inventario", inventario) |
99 | editor?.apply() | 150 | editor?.apply() |
100 | editor.commit() | 151 | editor.commit() |
101 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | 152 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) |
102 | } | 153 | } |
103 | 154 | ||
104 | 155 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/util/Base/BaseViewHolder.kt
1 | package com.focasoftware.deboinventariov20.ui.util.Base | 1 | package com.focasoftware.deboinventariov20.ui.util.Base |
2 | 2 | ||
3 | import android.app.AlertDialog | ||
4 | import android.app.Dialog | ||
5 | import android.os.Bundle | ||
3 | import android.view.View | 6 | import android.view.View |
7 | import androidx.fragment.app.DialogFragment | ||
4 | import androidx.recyclerview.widget.RecyclerView | 8 | import androidx.recyclerview.widget.RecyclerView |
5 | 9 | ||
6 | abstract class BaseViewHolder<T>(itemView:View):RecyclerView.ViewHolder(itemView) { | 10 | abstract class BaseViewHolder<T>(itemView:View):RecyclerView.ViewHolder(itemView) { |
7 | abstract fun bind(item:T, position:Int) | 11 | abstract fun bind(item:T, position:Int) |
12 | } | ||
13 | class NoEncontradoSimple : DialogFragment() { | ||
14 | |||
15 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
16 | return activity?.let { | ||
17 | val title = "" | ||
18 | val content = "¡El producto buscado NO fue encontrado!" | ||
19 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
20 | builder.setTitle(title).setMessage(content) | ||
21 | .setPositiveButton(android.R.string.ok) { _, _ -> | ||
22 | //Todo OK click | ||
23 | } | ||
24 | |||
25 | return builder.create() | ||
26 | } ?: throw IllegalStateException("Activity cannot be null") | ||
27 | } | ||
28 | |||
29 | } | ||
30 | |||
31 | class AlertDialogBorrarInv : DialogFragment() { | ||
32 | |||
33 | interface OnBorrarInvClickListener { | ||
34 | fun onPositiveClick() | ||
35 | fun onCancelClick() | ||
36 | } | ||
37 | |||
38 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
39 | return activity?.let { | ||
40 | val title = "Borrar Inventario" | ||
41 | val content = "¿Seguro que desea Borrar el inventario?" | ||
42 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) | ||
43 | builder.setTitle(title).setMessage(content) | ||
44 | .setPositiveButton(android.R.string.ok) { _, _ -> | ||
45 | val listener = activity as OnBorrarInvClickListener? | ||
46 | listener!!.onPositiveClick() | ||
47 | } | ||
48 | .setNegativeButton(android.R.string.cancel) { _, _ -> | ||
49 | val listener = activity as OnBorrarInvClickListener? | ||
50 | listener!!.onCancelClick() | ||
51 | } | ||
52 | return builder.create() | ||
53 | } ?: throw IllegalStateException("Activity cannot be null") | ||
54 | } | ||
55 | |||
8 | } | 56 | } |
app/src/main/res/drawable/collapse.xml
File was created | 1 | <vector xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | android:width="24dp" | ||
3 | android:height="24dp" | ||
4 | android:viewportWidth="24" | ||
5 | android:viewportHeight="24" | ||
6 | android:tint="?attr/colorControlNormal"> | ||
7 | <path | ||
8 | android:fillColor="@android:color/white" | ||
9 | android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/> | ||
10 | </vector> | ||
11 |
app/src/main/res/drawable/expand.xml
File was created | 1 | <vector xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | android:width="24dp" | ||
3 | android:height="24dp" | ||
4 | android:viewportWidth="24" | ||
5 | android:viewportHeight="24" | ||
6 | android:tint="?attr/colorControlNormal"> | ||
7 | <path | ||
8 | android:fillColor="@android:color/white" | ||
9 | android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/> | ||
10 | </vector> | ||
11 |
app/src/main/res/drawable/ic_sort19.xml
File was created | 1 | <vector android:height="24dp" android:viewportHeight="97.589" | |
2 | android:viewportWidth="97.589" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
3 | <path android:fillColor="#FF000000" android:pathData="M66.287,15.789c0.547,0.049 1.077,-0.121 1.489,-0.475l5.481,-4.705l-0.032,28.367c0,0.531 0.21,1.041 0.585,1.416s0.884,0.586 1.415,0.586h5.229c1.104,0 2,-0.895 2,-2V2.17c0,-1.104 -0.896,-2 -2,-2h-4.892c-0.453,0 -0.893,0.154 -1.246,0.436L63.079,9.553c-0.416,0.332 -0.683,0.814 -0.742,1.342c-0.059,0.529 0.096,1.059 0.428,1.475l2.146,2.68C65.251,15.471 65.747,15.738 66.287,15.789z"/> | ||
4 | <path android:fillColor="#FF000000" android:pathData="M90.684,64.143c-1.218,-2.703 -2.99,-4.797 -5.27,-6.223c-2.275,-1.424 -4.962,-2.145 -7.982,-2.145c-4.296,0 -7.746,1.301 -10.257,3.867c-2.506,2.562 -3.775,6.084 -3.775,10.465c0,4.063 1.051,7.297 3.123,9.604c2.086,2.322 4.968,3.5 8.566,3.5c2.141,0 3.956,-0.365 5.399,-1.086c1.161,-0.584 2.225,-1.515 3.161,-2.767c-0.219,2.402 -0.729,4.354 -1.51,5.795c-0.905,1.664 -2.229,2.9 -3.934,3.679c-1.746,0.793 -4.013,1.194 -6.738,1.194c-1.018,0 -2.023,-0.075 -2.989,-0.223c-0.578,-0.084 -1.162,0.08 -1.605,0.459c-0.441,0.381 -0.697,0.936 -0.697,1.518v3.638c0,1.021 0.769,1.877 1.782,1.987c1.101,0.121 2.475,0.183 4.082,0.183c6.82,0 11.996,-2.01 15.384,-5.974c3.367,-3.944 5.074,-9.963 5.074,-17.889C92.497,70.041 91.886,66.816 90.684,64.143zM81.473,74.219c-1.129,1.039 -2.45,1.543 -4.042,1.543c-1.671,0 -2.869,-0.49 -3.667,-1.502c-0.813,-1.025 -1.226,-2.459 -1.226,-4.262c0,-2.121 0.457,-3.756 1.358,-4.857c0.887,-1.084 2.096,-1.611 3.695,-1.611c1.609,0 2.9,0.664 3.943,2.031c1.063,1.396 1.601,3.137 1.601,5.174C83.139,72.053 82.594,73.193 81.473,74.219z"/> | ||
5 | <path android:fillColor="#FF000000" android:pathData="M43.243,65.596h-8.011V2c0,-1.105 -0.896,-2 -2,-2h-16.13c-1.104,0 -2,0.895 -2,2v63.596H7.091c-0.77,0 -1.472,0.443 -1.804,1.137c-0.333,0.695 -0.237,1.519 0.246,2.117l18.076,26.955c0.38,0.473 0.953,0.746 1.558,0.746s1.178,-0.273 1.558,-0.746L44.801,68.85c0.482,-0.6 0.578,-1.422 0.246,-2.117C44.715,66.039 44.013,65.596 43.243,65.596z"/> | ||
6 | </vector> | ||
7 |
app/src/main/res/drawable/ic_sort91.xml
File was created | 1 | <vector android:height="24dp" android:viewportHeight="97.086" | |
2 | android:viewportWidth="97.086" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
3 | <path android:fillColor="#FF000000" android:pathData="M66.035,71.896c0.547,0.049 1.077,-0.121 1.489,-0.475l5.481,-4.705l-0.032,28.367c0,0.531 0.21,1.041 0.585,1.416s0.885,0.586 1.415,0.586h5.229c1.105,0 2,-0.895 2,-2V58.277c0,-1.104 -0.895,-2 -2,-2H75.31c-0.453,0 -0.893,0.154 -1.246,0.436L62.828,65.66c-0.416,0.332 -0.684,0.814 -0.742,1.342c-0.06,0.529 0.096,1.059 0.428,1.475l2.146,2.681C65,71.578 65.496,71.846 66.035,71.896z"/> | ||
4 | <path android:fillColor="#FF000000" android:pathData="M90.432,8.699c-1.218,-2.703 -2.99,-4.797 -5.271,-6.223C82.887,1.052 80.2,0.331 77.18,0.331c-4.297,0 -7.747,1.301 -10.258,3.867c-2.506,2.562 -3.775,6.084 -3.775,10.465c0,4.064 1.051,7.297 3.122,9.605c2.086,2.322 4.969,3.5 8.566,3.5c2.142,0 3.956,-0.365 5.399,-1.086c1.161,-0.584 2.225,-1.514 3.161,-2.766c-0.22,2.402 -0.729,4.354 -1.511,5.795c-0.904,1.664 -2.229,2.9 -3.934,3.678c-1.745,0.793 -4.013,1.195 -6.737,1.195c-1.018,0 -2.023,-0.076 -2.989,-0.223c-0.578,-0.084 -1.162,0.08 -1.605,0.459c-0.442,0.381 -0.696,0.936 -0.696,1.518v3.637c0,1.021 0.769,1.877 1.781,1.988c1.102,0.121 2.475,0.182 4.082,0.182c6.82,0 11.996,-2.01 15.385,-5.973c3.367,-3.945 5.074,-9.963 5.074,-17.889C92.246,14.598 91.634,11.373 90.432,8.699zM81.221,18.775c-1.129,1.039 -2.449,1.543 -4.041,1.543c-1.672,0 -2.869,-0.49 -3.668,-1.502c-0.813,-1.025 -1.226,-2.459 -1.226,-4.262c0,-2.121 0.457,-3.756 1.358,-4.857c0.887,-1.084 2.097,-1.611 3.695,-1.611c1.609,0 2.9,0.664 3.943,2.031c1.063,1.395 1.602,3.137 1.602,5.174C82.887,16.609 82.342,17.75 81.221,18.775z"/> | ||
5 | <path android:fillColor="#FF000000" android:pathData="M42.992,65.596h-8.011V2c0,-1.105 -0.896,-2 -2,-2h-16.13c-1.104,0 -2,0.895 -2,2v63.596H6.84c-0.77,0 -1.472,0.443 -1.804,1.137C4.704,67.428 4.8,68.251 5.282,68.85l18.076,26.955c0.38,0.473 0.952,0.746 1.558,0.746s1.179,-0.273 1.559,-0.746L44.55,68.85c0.482,-0.6 0.578,-1.422 0.246,-2.117C44.464,66.039 43.762,65.596 42.992,65.596z"/> | ||
6 | </vector> | ||
7 |
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 | tools:context=".ui.main.MainFragment"> | ||
8 | 7 | ||
9 | <androidx.appcompat.widget.AppCompatTextView | 8 | <androidx.appcompat.widget.AppCompatTextView |
10 | android:id="@+id/txtVentas" | 9 | android:id="@+id/tvInvDinamicos" |
11 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
12 | android:layout_height="90dp" | 11 | android:layout_height="90dp" |
13 | android:autoSizeMaxTextSize="150sp" | 12 | android:autoSizeMaxTextSize="150sp" |
14 | android:autoSizeMinTextSize="25sp" | 13 | android:autoSizeMinTextSize="25sp" |
15 | android:autoSizeStepGranularity="5sp" | 14 | android:autoSizeStepGranularity="5sp" |
16 | android:autoSizeTextType="uniform" | 15 | android:autoSizeTextType="uniform" |
17 | android:gravity="center" | 16 | android:gravity="center" |
18 | android:padding="10dp" | 17 | android:padding="10dp" |
19 | android:text="@string/invDinamicoVenta" | 18 | android:text="@string/invDinamicoVenta" |
20 | android:textColor="@color/colorAccent" | 19 | android:textColor="@color/colorAccent" |
20 | android:visibility="visible" | ||
21 | app:fontFamily="sans-serif" | 21 | app:fontFamily="sans-serif" |
22 | app:layout_constraintBottom_toTopOf="@+id/guideline" | ||
23 | app:layout_constraintEnd_toEndOf="parent" | 22 | app:layout_constraintEnd_toEndOf="parent" |
24 | app:layout_constraintStart_toStartOf="parent" | 23 | app:layout_constraintStart_toStartOf="parent" |
25 | app:layout_constraintTop_toTopOf="@+id/guideline0" /> | 24 | app:layout_constraintTop_toTopOf="parent" /> |
26 | 25 | ||
27 | <ScrollView | 26 | <ImageView |
28 | android:id="@+id/scrollView" | 27 | android:id="@+id/ivSort19" |
29 | android:layout_width="match_parent" | 28 | android:layout_width="wrap_content" |
30 | android:layout_height="0dp" | 29 | android:layout_height="wrap_content" |
31 | android:layout_margin="10dp" | 30 | android:layout_margin="10dp" |
32 | android:layout_marginTop="4dp" | 31 | android:contentDescription=" " |
33 | android:background="@android:color/darker_gray" | 32 | android:visibility="gone" |
34 | android:elevation="10dp" | 33 | android:src="@drawable/ic_sort19" |
35 | android:scrollbarStyle="insideOverlay" | 34 | app:layout_constraintHorizontal_bias="0.0" |
36 | app:layout_constraintBottom_toTopOf="@+id/guideline2" | 35 | app:layout_constraintHorizontal_chainStyle="packed" |
37 | app:layout_constraintCircleRadius="10dp" | ||
38 | app:layout_constraintEnd_toEndOf="parent" | ||
39 | app:layout_constraintStart_toStartOf="parent" | 36 | app:layout_constraintStart_toStartOf="parent" |
40 | app:layout_constraintTop_toTopOf="@+id/guideline" | 37 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> |
41 | app:layout_constraintVertical_bias="0.512"> | ||
42 | |||
43 | <GridLayout | ||
44 | android:id="@+id/tableLayout" | ||
45 | android:layout_width="match_parent" | ||
46 | android:layout_height="wrap_content" | ||
47 | android:alignmentMode="alignMargins" | ||
48 | android:columnCount="2" | ||
49 | android:padding="15dp" | ||
50 | android:rowCount="2"> | ||
51 | 38 | ||
52 | <androidx.recyclerview.widget.RecyclerView | 39 | <ImageView |
53 | android:id="@+id/rcInventario" | 40 | android:id="@+id/ivSort91" |
54 | android:layout_width="match_parent" | 41 | android:layout_width="wrap_content" |
55 | android:layout_height="wrap_content" | 42 | android:layout_height="wrap_content" |
56 | android:background="@android:color/darker_gray" | 43 | android:layout_margin="10dp" |
57 | android:scrollbars="vertical" | 44 | android:layout_marginTop="12dp" |
58 | app:layout_constraintTop_toBottomOf="@id/guideline4" | 45 | android:contentDescription=" " |
59 | app:layout_constraintBottom_toTopOf="@+id/guideline5" | 46 | android:visibility="gone" |
60 | app:layout_constraintEnd_toEndOf="parent" | 47 | android:src="@drawable/ic_sort91" |
61 | app:layout_constraintStart_toStartOf="parent" | 48 | app:layout_constraintHorizontal_bias="1.0" |
62 | tools:listitem="@layout/item_principal" /> | 49 | app:layout_constraintHorizontal_chainStyle="packed" |
63 | </GridLayout> | ||
64 | </ScrollView> | ||
65 | |||
66 | <androidx.appcompat.widget.AppCompatTextView | ||
67 | android:id="@+id/txtDeposito" | ||
68 | android:layout_width="419dp" | ||
69 | android:layout_height="90dp" | ||
70 | android:autoSizeMaxTextSize="150sp" | ||
71 | android:autoSizeMinTextSize="25sp" | ||
72 | android:autoSizeStepGranularity="5sp" | ||
73 | android:autoSizeTextType="uniform" | ||
74 | android:gravity="center" | ||
75 | android:lines="1" | ||
76 | android:padding="10dp" | ||
77 | android:text="@string/invDinamicoCompra" | ||
78 | android:textColor="@color/colorAccent" | ||
79 | |||
80 | app:fontFamily="sans-serif-condensed" | ||
81 | app:layout_constraintBottom_toTopOf="@id/guideline3" | ||
82 | app:layout_constraintEnd_toEndOf="parent" | ||
83 | app:layout_constraintStart_toStartOf="parent" | 50 | app:layout_constraintStart_toStartOf="parent" |
84 | app:layout_constraintTop_toTopOf="@+id/guideline2" /> | 51 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> |
85 | 52 | ||
86 | <ScrollView | 53 | <TextView |
87 | android:id="@+id/scrollView2" | 54 | android:id="@+id/tvFecha" |
55 | android:layout_width="wrap_content" | ||
56 | android:layout_height="wrap_content" | ||
57 | android:layout_marginTop="5dp" | ||
58 | android:text="Fecha" | ||
59 | android:textColor="@android:color/black" | ||
60 | android:textSize="25sp" | ||
61 | android:visibility="gone" | ||
62 | android:textStyle="bold" | ||
63 | app:layout_constraintBottom_toTopOf="@id/rcInventario" | ||
64 | app:layout_constraintHorizontal_chainStyle="packed" | ||
65 | app:layout_constraintStart_toEndOf="@+id/ivSort19" | ||
66 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | ||
67 | |||
68 | <androidx.recyclerview.widget.RecyclerView | ||
69 | android:id="@+id/rcInventario" | ||
88 | android:layout_width="match_parent" | 70 | android:layout_width="match_parent" |
89 | android:layout_height="0dp" | 71 | android:layout_height="0dp" |
90 | android:layout_margin="10dp" | ||
91 | android:background="@android:color/darker_gray" | 72 | android:background="@android:color/darker_gray" |
92 | android:elevation="10dp" | 73 | android:scrollbars="vertical" |
93 | android:scrollbarStyle="insideOverlay" | 74 | android:visibility="gone" |
94 | app:layout_constraintBottom_toTopOf="@+id/guideline4" | ||
95 | app:layout_constraintCircleRadius="10dp" | ||
96 | app:layout_constraintEnd_toEndOf="parent" | 75 | app:layout_constraintEnd_toEndOf="parent" |
97 | app:layout_constraintStart_toStartOf="parent" | 76 | app:layout_constraintStart_toStartOf="parent" |
98 | app:layout_constraintTop_toBottomOf="@+id/txtDeposito"> | 77 | app:layout_constraintTop_toBottomOf="@id/tvFecha" |
99 | 78 | tools:listitem="@layout/item_principal" /> | |
100 | <GridLayout | ||
101 | android:id="@+id/tableLayout2" | ||
102 | android:layout_width="match_parent" | ||
103 | android:layout_height="match_parent" | ||
104 | android:alignmentMode="alignMargins" | ||
105 | android:columnCount="2" | ||
106 | android:padding="15dp" | ||
107 | android:rowCount="2"> | ||
108 | |||
109 | <!-- FILA 1--> | ||
110 | <!-- COLUMNA 1--> | ||
111 | <androidx.cardview.widget.CardView | ||
112 | android:layout_width="0dp" | ||
113 | android:layout_height="match_parent" | ||
114 | android:layout_rowWeight="1" | ||
115 | android:layout_columnWeight="1" | ||
116 | android:layout_margin="15dp" | ||
117 | app:cardCornerRadius="8dp" | ||
118 | app:cardElevation="8dp"> | ||
119 | 79 | ||
120 | <LinearLayout | 80 | <com.google.android.material.checkbox.MaterialCheckBox |
121 | android:layout_width="wrap_content" | 81 | android:id="@+id/cbVentas" |
122 | android:layout_height="wrap_content" | ||
123 | android:layout_gravity="center_horizontal|center_vertical" | ||
124 | android:layout_margin="15dp" | ||
125 | android:orientation="vertical"> | ||
126 | |||
127 | <androidx.appcompat.widget.AppCompatImageView | ||
128 | android:layout_width="wrap_content" | ||
129 | android:layout_height="wrap_content" | ||
130 | android:layout_gravity="center_horizontal" | ||
131 | android:src="@drawable/inventario" /> | ||
132 | |||
133 | <androidx.appcompat.widget.AppCompatTextView | ||
134 | android:id="@+id/inventario5" | ||
135 | android:layout_width="wrap_content" | ||
136 | android:layout_height="100dp" | ||
137 | |||
138 | android:autoSizeMaxTextSize="150sp" | ||
139 | android:autoSizeMinTextSize="15sp" | ||
140 | android:autoSizeStepGranularity="5sp" | ||
141 | android:autoSizeTextType="uniform" | ||
142 | android:gravity="center" | ||
143 | android:inputType="textMultiLine" | ||
144 | android:text="Inventeario 1 Articulos 100 12/12/2020 12:00" | ||
145 | android:textColor="@android:color/black" | ||
146 | android:textStyle="bold" /> | ||
147 | </LinearLayout> | ||
148 | </androidx.cardview.widget.CardView> | ||
149 | <!-- COLUMNA 2--> | ||
150 | <androidx.cardview.widget.CardView | ||
151 | android:layout_width="0dp" | ||
152 | android:layout_height="0dp" | ||
153 | android:layout_rowWeight="1" | ||
154 | android:layout_columnWeight="1" | ||
155 | android:layout_margin="15dp" | ||
156 | app:cardCornerRadius="8dp" | ||
157 | app:cardElevation="8dp"> | ||
158 | |||
159 | <LinearLayout | ||
160 | android:layout_width="wrap_content" | ||
161 | android:layout_height="wrap_content" | ||
162 | android:layout_gravity="center_horizontal|center_vertical" | ||
163 | android:layout_margin="15dp" | ||
164 | android:orientation="vertical"> | ||
165 | |||
166 | <androidx.appcompat.widget.AppCompatImageView | ||
167 | android:layout_width="wrap_content" | ||
168 | android:layout_height="wrap_content" | ||
169 | android:layout_gravity="center_horizontal" | ||
170 | android:src="@drawable/inventario" /> | ||
171 | |||
172 | <androidx.appcompat.widget.AppCompatTextView | ||
173 | android:id="@+id/inventario6" | ||
174 | android:layout_width="wrap_content" | ||
175 | android:layout_height="100dp" | ||
176 | |||
177 | android:autoSizeMaxTextSize="150sp" | ||
178 | android:autoSizeMinTextSize="15sp" | ||
179 | android:autoSizeStepGranularity="5sp" | ||
180 | android:autoSizeTextType="uniform" | ||
181 | android:gravity="center" | ||
182 | android:text="Inventeario 2 Articulos 100 12/12/2020 12:00" | ||
183 | android:textColor="@android:color/black" | ||
184 | android:textStyle="bold" /> | ||
185 | </LinearLayout> | ||
186 | </androidx.cardview.widget.CardView> | ||
187 | |||
188 | <!-- FILA 2--> | ||
189 | <!-- COLUMNA 1--> | ||
190 | <androidx.cardview.widget.CardView | ||
191 | android:layout_width="0dp" | ||
192 | android:layout_height="match_parent" | ||
193 | android:layout_rowWeight="1" | ||
194 | android:layout_columnWeight="1" | ||
195 | android:layout_margin="15dp" | ||
196 | app:cardCornerRadius="8dp" | ||
197 | app:cardElevation="8dp"> | ||
198 | |||
199 | <LinearLayout | ||
200 | android:layout_width="wrap_content" | ||
201 | android:layout_height="wrap_content" | ||
202 | android:layout_gravity="center_horizontal|center_vertical" | ||
203 | android:layout_margin="15dp" | ||
204 | android:orientation="vertical"> | ||
205 | |||
206 | <androidx.appcompat.widget.AppCompatImageView | ||
207 | android:layout_width="wrap_content" | ||
208 | android:layout_height="wrap_content" | ||
209 | android:layout_gravity="center_horizontal" | ||
210 | android:src="@drawable/inventario" /> | ||
211 | |||
212 | <androidx.appcompat.widget.AppCompatTextView | ||
213 | android:id="@+id/inventario7" | ||
214 | android:layout_width="wrap_content" | ||
215 | android:layout_height="100dp" | ||
216 | |||
217 | android:autoSizeMaxTextSize="150sp" | ||
218 | android:autoSizeMinTextSize="15sp" | ||
219 | android:autoSizeStepGranularity="5sp" | ||
220 | android:autoSizeTextType="uniform" | ||
221 | android:gravity="center" | ||
222 | android:text="Inventeario 4 Cerrado. Articulos 100 12/12/2020 12:00" | ||
223 | android:textColor="@android:color/black" | ||
224 | android:textStyle="bold" /> | ||
225 | </LinearLayout> | ||
226 | </androidx.cardview.widget.CardView> | ||
227 | <!-- COLUMNA 2--> | ||
228 | <androidx.cardview.widget.CardView | ||
229 | android:layout_width="0dp" | ||
230 | android:layout_height="0dp" | ||
231 | android:layout_rowWeight="1" | ||
232 | android:layout_columnWeight="1" | ||
233 | android:layout_margin="15dp" | ||
234 | app:cardCornerRadius="8dp" | ||
235 | app:cardElevation="8dp"> | ||
236 | |||
237 | <LinearLayout | ||
238 | android:layout_width="wrap_content" | ||
239 | android:layout_height="wrap_content" | ||
240 | android:layout_gravity="center_horizontal|center_vertical" | ||
241 | android:layout_margin="15dp" | ||
242 | android:orientation="vertical"> | ||
243 | |||
244 | <androidx.appcompat.widget.AppCompatImageView | ||
245 | android:layout_width="wrap_content" | ||
246 | android:layout_height="wrap_content" | ||
247 | android:layout_gravity="center_horizontal" | ||
248 | android:src="@drawable/inventario" /> | ||
249 | |||
250 | <androidx.appcompat.widget.AppCompatTextView | ||
251 | android:id="@+id/inventario8" | ||
252 | android:layout_width="wrap_content" | ||
253 | android:layout_height="100dp" | ||
254 | |||
255 | android:autoSizeMaxTextSize="150sp" | ||
256 | android:autoSizeMinTextSize="15sp" | ||
257 | android:autoSizeStepGranularity="5sp" | ||
258 | android:autoSizeTextType="uniform" | ||
259 | android:gravity="center" | ||
260 | android:text="Inventeario 4 Cerrado. Articulos 100 12/12/2020 12:00" | ||
261 | android:textColor="@android:color/black" | ||
262 | android:textStyle="bold" /> | ||
263 | </LinearLayout> | ||
264 | </androidx.cardview.widget.CardView> | ||
265 | |||
266 | </GridLayout> | ||
267 | </ScrollView> | ||
268 | |||
269 | <androidx.constraintlayout.widget.Guideline | ||
270 | android:id="@+id/guideline0" | ||
271 | android:layout_width="wrap_content" | ||
272 | android:layout_height="wrap_content" | ||
273 | android:orientation="horizontal" | ||
274 | app:layout_constraintGuide_percent="0.03" /> | ||
275 | |||
276 | <androidx.constraintlayout.widget.Guideline | ||
277 | android:id="@+id/guideline" | ||
278 | android:layout_width="wrap_content" | ||
279 | android:layout_height="wrap_content" | ||
280 | android:orientation="horizontal" | ||
281 | app:layout_constraintGuide_percent="0.15"/> | ||
282 | |||
283 | <androidx.constraintlayout.widget.Guideline | ||
284 | android:id="@+id/guideline2" | ||
285 | android:layout_width="wrap_content" | 82 | android:layout_width="wrap_content" |
286 | android:layout_height="wrap_content" | 83 | android:layout_height="wrap_content" |
287 | android:orientation="horizontal" | 84 | android:layout_margin="5dp" |
app/src/main/res/layout/ingresar_cantidad.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.cardview.widget.CardView | 2 | <androidx.cardview.widget.CardView |
3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="wrap_content" | 7 | android:layout_height="wrap_content" |
8 | app:cardCornerRadius="10dp" | 8 | app:cardCornerRadius="10dp" |
9 | app:cardElevation="5dp" | 9 | app:cardElevation="5dp" |
10 | android:background="@drawable/md_transparent" | ||
11 | tools:ignore="PrivateResource"> | ||
12 | 10 | ||
11 | tools:ignore="PrivateResource"> | ||
12 | <!-- android:background="@drawable/md_transparent"--> | ||
13 | 13 | ||
14 | <androidx.constraintlayout.widget.ConstraintLayout | 14 | <androidx.constraintlayout.widget.ConstraintLayout |
15 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
16 | android:layout_height="match_parent"> | 16 | android:layout_height="match_parent"> |
17 | 17 | ||
18 | <LinearLayout | 18 | <LinearLayout |
19 | android:id="@+id/barraSuperior" | 19 | android:id="@+id/barraSuperior" |
20 | android:layout_width="0dp" | 20 | android:layout_width="0dp" |
21 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
22 | android:background="@color/colorPrimaryDark" | 22 | android:background="@color/colorPrimaryDark" |
23 | android:orientation="horizontal" | 23 | android:orientation="horizontal" |
24 | app:layout_constraintLeft_toLeftOf="parent" | 24 | app:layout_constraintLeft_toLeftOf="parent" |
25 | app:layout_constraintRight_toRightOf="parent" | 25 | app:layout_constraintRight_toRightOf="parent" |
26 | app:layout_constraintTop_toTopOf="parent" | 26 | app:layout_constraintTop_toTopOf="parent" |
27 | app:layout_constraintTop_toBottomOf="@+id/lySegundo"> | 27 | app:layout_constraintTop_toBottomOf="@+id/lySegundo"> |
28 | 28 | ||
29 | <androidx.appcompat.widget.AppCompatTextView | 29 | <androidx.appcompat.widget.AppCompatTextView |
30 | android:id="@+id/tvTitulo" | 30 | android:id="@+id/tvTitulo" |
31 | android:layout_width="0dp" | 31 | android:layout_width="0dp" |
32 | android:layout_height="wrap_content" | 32 | android:layout_height="wrap_content" |
33 | android:layout_margin="10dp" | 33 | android:layout_margin="10dp" |
34 | android:layout_marginStart="5dp" | 34 | android:layout_marginStart="5dp" |
35 | android:layout_marginTop="10dp" | 35 | android:layout_marginTop="10dp" |
36 | android:layout_weight="1" | 36 | android:layout_weight="1" |
37 | android:text="@string/adv" | 37 | android:text="@string/adv" |
38 | android:textAlignment="center" | 38 | android:textAlignment="center" |
39 | android:textColor="@android:color/white" | 39 | android:textColor="@android:color/white" |
40 | android:textSize="25sp" | 40 | android:textSize="25sp" |
41 | android:textStyle="bold" /> | 41 | android:textStyle="bold" /> |
42 | </LinearLayout> | 42 | </LinearLayout> |
43 | 43 | ||
44 | 44 | ||
45 | <LinearLayout | 45 | <LinearLayout |
46 | android:id="@+id/lySegundo" | 46 | android:id="@+id/lySegundo" |
47 | android:layout_width="match_parent" | 47 | android:layout_width="match_parent" |
48 | android:layout_height="wrap_content" | 48 | android:layout_height="wrap_content" |
49 | android:orientation="vertical" | 49 | android:orientation="vertical" |
50 | android:padding="12dp" | 50 | android:padding="12dp" |
51 | app:layout_constraintLeft_toLeftOf="parent" | 51 | app:layout_constraintLeft_toLeftOf="parent" |
52 | app:layout_constraintRight_toRightOf="parent" | 52 | app:layout_constraintRight_toRightOf="parent" |
53 | app:layout_constraintTop_toBottomOf="@id/barraSuperior"> | 53 | app:layout_constraintTop_toBottomOf="@id/barraSuperior"> |
54 | 54 | ||
55 | 55 | ||
56 | 56 | ||
57 | <EditText | 57 | <EditText |
58 | android:id="@+id/etCantidad" | 58 | android:id="@+id/etCantidad" |
59 | android:layout_width="match_parent" | 59 | android:layout_width="match_parent" |
60 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
61 | android:ems="10" | 61 | android:ems="10" |
62 | android:gravity="center" | 62 | android:gravity="center" |
63 | android:textSize="20sp" | 63 | android:textSize="20sp" |
64 | android:focusable="true" | 64 | android:focusable="true" |
65 | android:clickable="true" | 65 | android:clickable="true" |
66 | android:inputType="numberDecimal" | 66 | android:inputType="numberDecimal" |
67 | android:text="" /> | 67 | android:text="" /> |
68 | 68 | ||
69 | 69 | ||
70 | <androidx.appcompat.widget.AppCompatButton | 70 | <androidx.appcompat.widget.AppCompatButton |
71 | android:id="@+id/btnAceptar" | 71 | android:id="@+id/btnAceptar" |
72 | android:layout_width="match_parent" | 72 | android:layout_width="match_parent" |
73 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
74 | android:layout_margin="10dp" | 74 | android:layout_margin="10dp" |
75 | android:layout_marginBottom="20dp" | 75 | android:layout_marginBottom="20dp" |
76 | android:clickable="true" | 76 | android:clickable="true" |
77 | android:focusable="true" | 77 | android:focusable="true" |
78 | android:textColor="@android:color/white" | 78 | android:textColor="@android:color/white" |
79 | android:padding="10dp" | 79 | android:padding="10dp" |
80 | android:background="@drawable/boton_borde_redondeado" | 80 | android:background="@drawable/boton_borde_redondeado" |
81 | android:text="@string/btnConfirmar" | 81 | android:text="@string/btnConfirmar" |
82 | android:textAlignment="center" | 82 | android:textAlignment="center" |
83 | android:textSize="20sp" | 83 | android:textSize="20sp" |
84 | android:textStyle="bold" | 84 | android:textStyle="bold" |
85 | app:cardBackgroundColor="@android:color/darker_gray" | 85 | app:cardBackgroundColor="@android:color/darker_gray" |
86 | app:cardUseCompatPadding="true" /> | 86 | app:cardUseCompatPadding="true" /> |
87 | 87 | ||
88 | 88 | ||
89 | </LinearLayout> | 89 | </LinearLayout> |
90 | 90 | ||
91 | 91 |
app/src/main/res/layout/z_dialogpersocomplexcantidad_modificacion.xml
1 | <?xml version="1.0" encoding="utf-8"?> | File was deleted | |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | android:layout_width="match_parent" | ||
4 | android:layout_height="match_parent" | ||
5 | android:gravity="center_horizontal" | ||
6 | android:orientation="vertical"> | ||
7 | |||
8 | <TableLayout | ||
9 | android:layout_width="wrap_content" | ||
10 | android:layout_height="wrap_content"> | ||
11 | |||
12 | <TableRow | ||
13 | android:layout_width="wrap_content" | ||
14 | android:layout_height="wrap_content" | ||
15 | android:gravity="center_vertical"> | ||
16 | |||
17 | <TextView | ||
18 | android:layout_width="200dp" | ||
19 | android:layout_height="wrap_content" | ||
20 | android:gravity="end" | ||
21 | android:text="Cantidad actual: " | ||
22 | android:textSize="20sp" /> | ||
23 | |||
24 | <TextView | ||
25 | android:id="@+id/Z_DIALOG_cantidad_actual" | ||
26 | android:layout_width="50dp" | ||
27 | android:layout_height="wrap_content" | ||
28 | android:gravity="center" | ||
29 | android:text="13" | ||
30 | android:textSize="20sp" /> | ||
31 | </TableRow> | ||
32 | |||
33 | <TableRow | ||
34 | android:layout_width="wrap_content" | ||
35 | android:layout_height="wrap_content" | ||
36 | android:gravity="center_vertical"> | ||
37 | |||
38 | <TextView | ||
39 | android:layout_width="wrap_content" | ||
40 | android:layout_height="wrap_content" | ||
41 | android:gravity="end" | ||
42 | android:text="Cantidad previsional: " | ||
43 | android:textSize="20sp" /> | ||
44 | |||
45 | <TextView | ||
46 | android:id="@+id/Z_DIALOG_cantidad_final" | ||
47 | android:layout_width="wrap_content" | ||
48 | android:layout_height="wrap_content" | ||
49 | android:gravity="center" | ||
50 | android:text="24" | ||
51 | android:textSize="20sp" /> | ||
52 | </TableRow> | ||
53 | </TableLayout> | ||
54 | |||
55 | <LinearLayout | ||
56 | android:layout_width="wrap_content" | ||
57 | android:layout_height="wrap_content" | ||
58 | android:layout_marginTop="10dp" | ||
59 | android:gravity="center_vertical" | ||
60 | android:orientation="horizontal"> | ||
61 | |||
62 | <TextView | ||
63 | android:id="@+id/Z_DIALOG_tipo_operacion" | ||
64 | android:layout_width="wrap_content" | ||
65 | android:layout_height="wrap_content" | ||
66 | android:gravity="end" | ||
67 | android:text="SUMAR: " | ||
68 | android:textSize="20sp" /> | ||
69 | |||
70 | <EditText | ||
71 | android:id="@+id/Z_DIALOG_cantidad_nueva" | ||
72 | android:layout_width="120dp" | ||
73 | android:layout_height="50dp" | ||
74 | android:clickable="true" | ||
75 | android:focusable="true" | ||
76 | android:gravity="center" | ||
77 | android:hint="Cantidad" | ||
78 | android:inputType="numberDecimal" | ||
79 | android:maxLength="6" | ||
80 | android:textColor="@android:color/black" | ||
81 | android:textSize="20sp" /> | ||
82 | |||
83 | <Button | ||
84 | android:id="@+id/Z_DIALOG_boton_reset" | ||
85 | android:layout_width="80dp" | ||
86 | android:layout_height="wrap_content" | ||
87 | android:gravity="center" | ||
88 | android:text="No tomado" | ||
89 | android:visibility="gone" /> | ||
90 | </LinearLayout> | ||
91 | |||
92 | <LinearLayout | ||
93 | android:layout_width="wrap_content" | ||
94 | android:layout_height="wrap_content" | ||
95 | android:layout_gravity="center_horizontal" | ||
96 | android:layout_marginTop="10dp" | ||
97 | android:orientation="horizontal"> | ||
98 | |||
99 | <ImageView | ||
100 | android:id="@+id/Z_DIALOG_validar" | ||
101 | android:layout_width="50dp" | ||
102 | android:layout_height="50dp" | ||
103 | android:layout_marginEnd="60dp" | ||
104 | android:contentDescription=" " | ||
105 | android:scaleType="fitXY" | ||
106 | android:src="@drawable/md_transparent" /> | ||
107 | |||
108 | <ImageView | ||
109 | android:id="@+id/Z_DIALOG_cancelar" | ||
110 | android:layout_width="50dp" | ||
111 | android:layout_height="50dp" | ||
112 | android:contentDescription=" " | ||
113 | android:scaleType="fitXY" | ||
114 | android:src="@drawable/md_btn_selected_dark" /> | ||
115 | |||
116 | |||
117 | </LinearLayout> | ||
118 | |||
119 | </LinearLayout> |
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 | <fragment | 13 | <fragment |
14 | android:id="@+id/mainFragment2" | 14 | android:id="@+id/mainFragment2" |
15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" | 15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" |
16 | android:label="Principal" | 16 | android:label="Principal" |
17 | tools:layout="@layout/fragment_main" > | 17 | tools:layout="@layout/fragment_main" > |
18 | <action | 18 | <action |
19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" | 19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" |
20 | app:destination="@id/configuracionFragment" | 20 | app:destination="@id/configuracionFragment" |
21 | app:popEnterAnim="@anim/slide_in_left" | 21 | app:popEnterAnim="@anim/slide_in_left" |
22 | app:popExitAnim="@anim/slide_out_right" | 22 | app:popExitAnim="@anim/slide_out_right" |
23 | app:enterAnim="@anim/slide_in_right" | 23 | app:enterAnim="@anim/slide_in_right" |
24 | app:exitAnim="@anim/slide_out_left" /> | 24 | app:exitAnim="@anim/slide_out_left" /> |
25 | <action | 25 | <action |
26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" | 26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" |
27 | app:destination="@id/actuaMaestrosFragment" | 27 | app:destination="@id/actuaMaestrosFragment" |
28 | app:popEnterAnim="@anim/slide_in_left" | 28 | app:popEnterAnim="@anim/slide_in_left" |
29 | app:popExitAnim="@anim/slide_out_right" | 29 | app:popExitAnim="@anim/slide_out_right" |
30 | app:enterAnim="@anim/slide_in_right" | 30 | app:enterAnim="@anim/slide_in_right" |
31 | app:exitAnim="@anim/slide_out_left" /> | 31 | app:exitAnim="@anim/slide_out_left" /> |
32 | <action | 32 | <action |
33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" | 33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" |
34 | app:destination="@id/inventarioFragment" | 34 | app:destination="@id/inventarioFragment" |
35 | app:popEnterAnim="@anim/slide_in_left" | 35 | app:popEnterAnim="@anim/slide_in_left" |
36 | app:popExitAnim="@anim/slide_out_right" | 36 | app:popExitAnim="@anim/slide_out_right" |
37 | app:enterAnim="@anim/slide_in_right" | 37 | app:enterAnim="@anim/slide_in_right" |
38 | app:exitAnim="@anim/slide_out_left" /> | 38 | app:exitAnim="@anim/slide_out_left" /> |
39 | </fragment> | 39 | </fragment> |
40 | <fragment | 40 | <fragment |
41 | android:id="@+id/actuaMaestrosFragment" | 41 | android:id="@+id/actuaMaestrosFragment" |
42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" | 42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" |
43 | android:label="Actualización de Maestros" | 43 | android:label="Importaciones Varias" |
44 | tools:layout="@layout/fragment_actua_maestros" /> | 44 | tools:layout="@layout/fragment_actua_maestros" /> |
45 | <fragment | 45 | <fragment |
46 | android:id="@+id/servidoresFragment" | 46 | android:id="@+id/servidoresFragment" |
47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" | 47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" |
48 | android:label="Alta Servidores" | 48 | android:label="Alta Servidores" |
49 | tools:layout="@layout/fragment_servidores"> | 49 | tools:layout="@layout/fragment_servidores"> |
50 | <action | 50 | <action |
51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | 51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" |
52 | app:destination="@id/configuracionFragment" | 52 | app:destination="@id/configuracionFragment" |
53 | app:enterAnim="@anim/slide_in_right" | 53 | app:enterAnim="@anim/slide_in_right" |
54 | app:exitAnim="@anim/slide_out_left" | 54 | app:exitAnim="@anim/slide_out_left" |
55 | app:popEnterAnim="@anim/slide_in_left" | 55 | app:popEnterAnim="@anim/slide_in_left" |
56 | app:popExitAnim="@anim/slide_out_right" /> | 56 | app:popExitAnim="@anim/slide_out_right" /> |
57 | </fragment> | 57 | </fragment> |
58 | <fragment | 58 | <fragment |
59 | android:id="@+id/inventarioFragment" | 59 | android:id="@+id/inventarioFragment" |
60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" | 60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" |
61 | android:label="Inventario Dinamico" | 61 | android:label="Inventario Dinamico" |
62 | tools:layout="@layout/fragment_inventario" > | 62 | tools:layout="@layout/fragment_inventario" > |
63 | <action | 63 | <action |
64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" | 64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" |
65 | app:destination="@id/descripcionFragment" | 65 | app:destination="@id/descripcionFragment" |
66 | app:popEnterAnim="@anim/slide_in_left" | 66 | app:popEnterAnim="@anim/slide_in_left" |
67 | app:popExitAnim="@anim/slide_out_right" | 67 | app:popExitAnim="@anim/slide_out_right" |
68 | app:enterAnim="@anim/slide_in_right" | 68 | app:enterAnim="@anim/slide_in_right" |
69 | app:exitAnim="@anim/slide_out_left" /> | 69 | app:exitAnim="@anim/slide_out_left" /> |
70 | <action | 70 | <action |
71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" | 71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" |
72 | app:destination="@id/mainFragment2" | 72 | app:destination="@id/mainFragment2" |
73 | app:popEnterAnim="@anim/slide_in_left" | 73 | app:popEnterAnim="@anim/slide_in_left" |
74 | app:popExitAnim="@anim/slide_out_right" | 74 | app:popExitAnim="@anim/slide_out_right" |
75 | app:enterAnim="@anim/slide_in_right" | 75 | app:enterAnim="@anim/slide_in_right" |
76 | app:exitAnim="@anim/slide_out_left"/> | 76 | app:exitAnim="@anim/slide_out_left"/> |
77 | <action | 77 | <action |
78 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" | 78 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" |
79 | app:destination="@id/detalleArtFragment" /> | 79 | app:destination="@id/detalleArtFragment" /> |
80 | 80 | ||
81 | </fragment> | 81 | </fragment> |
82 | <fragment | 82 | <fragment |
83 | android:id="@+id/configuracionFragment" | 83 | android:id="@+id/configuracionFragment" |
84 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" | 84 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" |
85 | android:label="Configuraciones" | 85 | android:label="Configuraciones" |
86 | tools:layout="@layout/fragment_configuracion" > | 86 | tools:layout="@layout/fragment_configuracion" > |
87 | <action | 87 | <action |
88 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | 88 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" |
89 | app:destination="@id/servidoresFragment" | 89 | app:destination="@id/servidoresFragment" |
90 | app:popEnterAnim="@anim/slide_in_left" | 90 | app:popEnterAnim="@anim/slide_in_left" |
91 | app:popExitAnim="@anim/slide_out_right" | 91 | app:popExitAnim="@anim/slide_out_right" |
92 | app:enterAnim="@anim/slide_in_right" | 92 | app:enterAnim="@anim/slide_in_right" |
93 | app:exitAnim="@anim/slide_out_left" /> | 93 | app:exitAnim="@anim/slide_out_left" /> |
94 | </fragment> | 94 | </fragment> |
95 | <fragment | 95 | <fragment |
96 | android:id="@+id/descripcionFragment" | 96 | android:id="@+id/descripcionFragment" |
97 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" | 97 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" |
98 | android:label="Productos Encontrados"> | 98 | android:label="Productos Encontrados"> |
99 | 99 | ||
100 | <action | 100 | <action |
101 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 101 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
102 | app:destination="@id/inventarioFragment" | 102 | app:destination="@id/inventarioFragment" |
103 | app:popEnterAnim="@anim/slide_in_left" | 103 | app:popEnterAnim="@anim/slide_in_left" |
104 | app:popExitAnim="@anim/slide_out_right" | 104 | app:popExitAnim="@anim/slide_out_right" |
105 | app:enterAnim="@anim/slide_in_right" | 105 | app:enterAnim="@anim/slide_in_right" |
106 | app:exitAnim="@anim/slide_out_left" | 106 | app:exitAnim="@anim/slide_out_left" |
107 | app:popUpTo="@+id/descripcionFragment" | 107 | app:popUpTo="@+id/descripcionFragment" |
108 | app:popUpToInclusive="true"/> | 108 | app:popUpToInclusive="true"/> |
109 | </fragment> | 109 | </fragment> |
110 | <dialog | 110 | <dialog |
111 | android:id="@+id/dialogNoEncontrado" | 111 | android:id="@+id/dialogNoEncontrado" |
112 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" | 112 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" |
113 | android:label="DialogNoEncontrado" /> | 113 | android:label="DialogNoEncontrado" /> |
114 | <fragment | 114 | <fragment |
115 | android:id="@+id/dialogoLogin" | 115 | android:id="@+id/dialogoLogin" |
116 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" | 116 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" |
117 | android:label="dialogoLogin" /> | 117 | android:label="dialogoLogin" /> |
118 | <fragment | 118 | <fragment |
119 | android:id="@+id/singleChoiceAlertDialog" | 119 | android:id="@+id/singleChoiceAlertDialog" |
120 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" | 120 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" |
121 | android:label="SingleChoiceAlertDialog" /> | 121 | android:label="SingleChoiceAlertDialog" /> |
122 | <fragment | 122 | <fragment |
123 | android:id="@+id/detalleArtFragment" | 123 | android:id="@+id/detalleArtFragment" |
124 | android:name="com.focasoftware.deboinventariov20.ui.detalleProducto.DetalleArtFragment" | 124 | android:name="com.focasoftware.deboinventariov20.ui.detalleProducto.DetalleArtFragment" |
125 | android:label="Detalle Articulo" | 125 | android:label="Detalle Articulo" |
126 | tools:layout="@layout/fragment_detalle_art"> | 126 | tools:layout="@layout/fragment_detalle_art"> |
127 | <action | 127 | <action |
128 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" | 128 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" |
129 | app:destination="@id/inventarioFragment" /> | 129 | app:destination="@id/inventarioFragment" /> |
130 | </fragment> | 130 | </fragment> |
131 | </navigation> | 131 | </navigation> |
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">Actualizar Maestros</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> | 23 | <string name="todo">TODO</string> |
24 | <string name="hello_blank_fragment">Hello blank fragment</string> | 24 | <string name="hello_blank_fragment">Hello blank fragment</string> |
25 | 25 | ||
26 | <!-- inventarios dinamicos--> | 26 | <!-- inventarios dinamicos--> |
27 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> | 27 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> |
28 | <string name="invDinamicoCompra">Inventarios Sectorizados</string> | 28 | <string name="invDinamicoCompra">Inventarios Importados(0)+</string> |
29 | 29 | ||
30 | <!-- ventana emergente--> | 30 | <!-- ventana emergente--> |
31 | <string name="adv">Ingrese la cantidad contada</string> | 31 | <string name="adv">Ingrese la cantidad contada</string> |
32 | <string name="invVentas">Inventarios Dinamicos de Ventas</string> | 32 | <string name="invVentas">Inventarios Dinamicos de Ventas</string> |
33 | <string name="btnConfirmar">Confirmar</string> | 33 | <string name="btnConfirmar">Confirmar</string> |
34 | <string name="btnCancela">Cancelar</string> | 34 | <string name="btnCancela">Cancelar</string> |
35 | 35 | ||
36 | 36 | ||
37 | <!-- Fragment Inventario--> | 37 | <!-- Fragment Inventario--> |
38 | <string name="invTitulo">Inventarios Dinámicos</string> | 38 | <string name="invTitulo">Inventarios Dinámicos</string> |
39 | <string name="invTituloV">Inventarios de Ventas</string> | 39 | <string name="invTituloV">Inventarios de Ventas</string> |
40 | <string name="invTituloD">Inventarios de Depositos</string> | 40 | <string name="invTituloD">Inventarios de Depositos</string> |
41 | <string name="invCodigoBarras">Código Barras:</string> | 41 | <string name="invCodigoBarras">Código Barras:</string> |
42 | <string name="btnExportarInv">Exportar Inventario</string> | 42 | <string name="btnExportarInv">Exportar Inventario</string> |
43 | <string name="btnBorrarInv">Borrar Inventario</string> | 43 | <string name="btnBorrarInv">Borrar Inventario</string> |
44 | <string name="ibBusDesc">Busqueda por Descripción</string> | 44 | <string name="ibBusDesc">Busqueda por Descripción</string> |
45 | <string name="ibBusCB">Busqueda por C. Barras</string> | 45 | <string name="ibBusCB">Busqueda por C. Barras</string> |
46 | <string name="ibBusCO">Busqueda por Código de Origen</string> | 46 | <string name="ibBusCO">Busqueda por Código de Origen</string> |
47 | <string name="switch_1">+ 1</string> | 47 | <string name="switch_1">+ 1</string> |
48 | 48 | ||
49 | <!-- Fragmento Configuraciones--> | 49 | <!-- Fragmento Configuraciones--> |
50 | <string name="tvTituloConf">Configuraciones</string> | 50 | <string name="tvTituloConf">Configuraciones</string> |
51 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> | 51 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> |
52 | <string name="btnValidarServidor">Validar</string> | 52 | <string name="btnValidarServidor">Validar</string> |
53 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> | 53 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> |
54 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> | 54 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> |
55 | <string name="tvTituloArea">Area de Invetnario</string> | 55 | <string name="tvTituloArea">Area de Invetnario</string> |
56 | <string name="rbVentas">Inventarios de Ventas</string> | 56 | <string name="rbVentas">Inventarios de Ventas</string> |
57 | <string name="rbDeposito">Inventarios de Depositos</string> | 57 | <string name="rbDeposito">Inventarios de Depositos</string> |
58 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> | 58 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> |
59 | <string name="tvColumnas">Columnas a Visualizar</string> | 59 | <string name="tvColumnas">Columnas a Visualizar</string> |
60 | 60 | ||
61 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> | 61 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> |
62 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> | 62 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> |
63 | 63 | ||
64 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> | 64 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> |
65 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> | 65 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> |
66 | 66 | ||
67 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> | 67 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> |
68 | 68 | ||
69 | <string name="rbCodigoDebo">Código DEBO</string> | 69 | <string name="rbCodigoDebo">Código DEBO</string> |
70 | <string name="rbCodigoOrigen">Código Origen</string> | 70 | <string name="rbCodigoOrigen">Código Origen</string> |
71 | <string name="rbCodigoBarras">Código de Barras</string> | 71 | <string name="rbCodigoBarras">Código de Barras</string> |
72 | 72 | ||
73 | 73 | ||
74 | <!-- Spinner servidor--> | 74 | <!-- Spinner servidor--> |
75 | <string-array name="spinnerServidor"> | 75 | <string-array name="spinnerServidor"> |
76 | <item>Servidor Laboratorio 1</item> | 76 | <item>Servidor Laboratorio 1</item> |
77 | <item>Servidor Laboratorio 2</item> | 77 | <item>Servidor Laboratorio 2</item> |
78 | <item>Servidor Laboratorio 3</item> | 78 | <item>Servidor Laboratorio 3</item> |
79 | </string-array> | 79 | </string-array> |
80 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> | 80 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> |
81 | 81 | ||
82 | <string name="cbMostrarExistencia">Existencia</string> | 82 | <string name="cbMostrarExistencia">Existencia</string> |
83 | <string name="cbMostrarPrecio">Precio</string> | 83 | <string name="cbMostrarPrecio">Precio</string> |
84 | 84 | ||
85 | <string name="btnGuardar">Guardar Cambios</string> | 85 | <string name="btnGuardar">Guardar Cambios</string> |
86 | 86 | ||
87 | <!-- fragment Actualizacion de Maestros--> | 87 | <!-- fragment Actualizacion de Maestros--> |
88 | <string name="tvActMaestros">Actualización de Maestros</string> | 88 | <string name="tvActMaestros">Importaciones</string> |
89 | <string name="tvMedio">Seleccione el medio por el cual desea realizar la importación de maestros</string> | 89 | <string name="tvMedio">Seleccione que tipo de importación desea realizar</string> |
90 | <string name="obPorWifi">Via Wifi</string> | 90 | <string name="obPorWifi">Importación de artículos</string> |
91 | <string name="obViaArchivo">Via Archivos MaeTable</string> | 91 | <string name="obViaArchivo">Importación de inventarios</string> |
92 | 92 | ||
93 | <string name="btnConfirmarAct">Confirmar Actualización</string> | 93 | <string name="btnConfirmarAct">Confirmar Importación</string> |
94 | 94 | ||
95 | <!-- Fragment Save--> | 95 | <!-- Fragment Save--> |
96 | <string name="tvConfServi">Configuración de Servidores</string> | 96 | <string name="tvConfServi">Configuración de Servidores</string> |
97 | <string name="server">Ingrese la direccion del servidor</string> | 97 | <string name="server">Ingrese la direccion del servidor</string> |
98 | <string name="etNomServer">Ingrese una descripción para la conexión</string> | 98 | <string name="etNomServer">Ingrese una descripción para la conexión</string> |
99 | <string name="btnGuardarConfServ">Guardar Conexión</string> | 99 | <string name="btnGuardarConfServ">Guardar Conexión</string> |
100 | 100 | ||
101 | <!-- Dialog--> | 101 | <!-- Dialog--> |
102 | <string name="sTitulo">Producto Buscado</string> | 102 | <string name="sTitulo">Producto Buscado</string> |
103 | <string name="btnOk">Aceptar</string> | 103 | <string name="btnOk">Aceptar</string> |
104 | <string name="btnCancelar">Cancelar</string> | 104 | <string name="btnCancelar">Cancelar</string> |
105 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> | 105 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> |
106 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> | 106 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> |
107 | <string name="sTituloNueva">Producto ingresado esta cargado</string> | 107 | <string name="sTituloNueva">Producto ingresado esta cargado</string> |
108 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> | 108 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> |
109 | <string name="sMensajeBorrarInv">¡Seguro que desea Borrar el inventario!</string> | ||
110 | <string name="sTituloBorrarInv">Borrar Inventario</string> | ||
111 | 109 | ||
112 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> | 110 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> |
113 | <string name="sTituloExportar">Exportación de Inventarios</string> | 111 | <string name="sTituloExportar">Exportación de Inventarios</string> |
114 | 112 | ||
115 | <!-- FRAGMENT SERVIDOR--> | 113 | <!-- FRAGMENT SERVIDOR--> |
116 | <string name="tvTitutloServer">Alta de Servidores</string> | 114 | <string name="tvTitutloServer">Alta de Servidores</string> |
117 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> | 115 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> |
118 | <string name="tvDirServer">Ingrese la dirección del servidor</string> | 116 | <string name="tvDirServer">Ingrese la dirección del servidor</string> |
119 | <string name="btnGuardarServidores">Guardar Servidor</string> | 117 | <string name="btnGuardarServidores">Guardar Servidor</string> |
120 | 118 | ||
121 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> | 119 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> |
122 | <string name="rbSumar">Sumar</string> | 120 | <string name="rbSumar">Sumar</string> |
123 | <string name="rbRestar">Restar</string> | 121 | <string name="rbRestar">Restar</string> |
124 | <string name="rbModificar">Reemplazar</string> | 122 | <string name="rbModificar">Reemplazar</string> |
125 | <string name="tvTotal">Cantidad Final</string>tvTotal | 123 | <string name="tvTotal">Cantidad Final</string>tvTotal |
126 | <string name="tvResultado">Cantidad final:</string>tvTotal | 124 | <string name="tvResultado">Cantidad final:</string>tvTotal |
127 | 125 | ||
128 | <string name="large_text"> | 126 | <string name="large_text"> |
129 | "Material is the metaphor.\n\n" | 127 | "Material is the metaphor.\n\n" |
130 | 128 | ||
131 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." | 129 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." |
132 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " | 130 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " |
133 | "technologically advanced and open to imagination and magic.\n" | 131 | "technologically advanced and open to imagination and magic.\n" |
134 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " | 132 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " |
135 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " | 133 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " |
136 | "flexibility of the material creates new affordances that supercede those in the physical " | 134 | "flexibility of the material creates new affordances that supercede those in the physical " |
137 | "world, without breaking the rules of physics.\n" | 135 | "world, without breaking the rules of physics.\n" |
138 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " | 136 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " |
139 | "interact, and exist in space and in relation to each other. Realistic lighting shows " | 137 | "interact, and exist in space and in relation to each other. Realistic lighting shows " |
140 | "seams, divides space, and indicates moving parts.\n\n" | 138 | "seams, divides space, and indicates moving parts.\n\n" |
141 | 139 | ||
142 | "Bold, graphic, intentional.\n\n" | 140 | "Bold, graphic, intentional.\n\n" |
143 | 141 | ||
144 | "The foundational elements of print based design typography, grids, space, scale, color, " | 142 | "The foundational elements of print based design typography, grids, space, scale, color, " |
145 | "and use of imagery guide visual treatments. These elements do far more than please the " | 143 | "and use of imagery guide visual treatments. These elements do far more than please the " |
146 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " | 144 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " |
147 | "imagery, large scale typography, and intentional white space create a bold and graphic " | 145 | "imagery, large scale typography, and intentional white space create a bold and graphic " |
148 | "interface that immerse the user in the experience.\n" | 146 | "interface that immerse the user in the experience.\n" |
149 | "An emphasis on user actions makes core functionality immediately apparent and provides " | 147 | "An emphasis on user actions makes core functionality immediately apparent and provides " |
150 | "waypoints for the user.\n\n" | 148 | "waypoints for the user.\n\n" |
151 | 149 | ||
152 | "Motion provides meaning.\n\n" | 150 | "Motion provides meaning.\n\n" |
153 | 151 | ||
154 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " | 152 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " |
155 | "inflection points that initiate motion, transforming the whole design.\n" | 153 | "inflection points that initiate motion, transforming the whole design.\n" |
156 | "All action takes place in a single environment. Objects are presented to the user without " | 154 | "All action takes place in a single environment. Objects are presented to the user without " |
157 | "breaking the continuity of experience even as they transform and reorganize.\n" | 155 | "breaking the continuity of experience even as they transform and reorganize.\n" |
158 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " | 156 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " |
159 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" | 157 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" |
160 | 158 | ||
161 | "3D world.\n\n" | 159 | "3D world.\n\n" |
162 | 160 | ||
163 | "The material environment is a 3D space, which means all objects have x, y, and z " | 161 | "The material environment is a 3D space, which means all objects have x, y, and z " |
164 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " | 162 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " |
165 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " | 163 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " |
166 | "position along the z-axis and has a standard 1dp thickness.\n" | 164 | "position along the z-axis and has a standard 1dp thickness.\n" |
167 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " | 165 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " |
168 | "emulated by manipulating the y-axis.\n\n" | 166 | "emulated by manipulating the y-axis.\n\n" |
169 | 167 | ||
170 | "Light and shadow.\n\n" | 168 | "Light and shadow.\n\n" |
171 | 169 | ||
172 | "Within the material environment, virtual lights illuminate the scene. Key lights create " | 170 | "Within the material environment, virtual lights illuminate the scene. Key lights create " |
173 | "directional shadows, while ambient light creates soft shadows from all angles.\n" | 171 | "directional shadows, while ambient light creates soft shadows from all angles.\n" |
174 | "Shadows in the material environment are cast by these two light sources. In Android " | 172 | "Shadows in the material environment are cast by these two light sources. In Android " |
175 | "development, shadows occur when light sources are blocked by sheets of material at " | 173 | "development, shadows occur when light sources are blocked by sheets of material at " |
176 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " | 174 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " |
177 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" | 175 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" |
178 | 176 | ||
179 | "Resting elevation.\n\n" | 177 | "Resting elevation.\n\n" |
180 | 178 | ||
181 | "All material objects, regardless of size, have a resting elevation, or default elevation " | 179 | "All material objects, regardless of size, have a resting elevation, or default elevation " |
182 | "that does not change. If an object changes elevation, it should return to its resting " | 180 | "that does not change. If an object changes elevation, it should return to its resting " |
183 | "elevation as soon as possible.\n\n" | 181 | "elevation as soon as possible.\n\n" |
184 | 182 | ||
185 | "Component elevations.\n\n" | 183 | "Component elevations.\n\n" |
186 | 184 | ||
187 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " | 185 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " |
188 | "does not vary from 6dp in one app to 16dp in another app).\n" | 186 | "does not vary from 6dp in one app to 16dp in another app).\n" |
189 | "Components may have different resting elevations across platforms, depending on the depth " | 187 | "Components may have different resting elevations across platforms, depending on the depth " |
190 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" | 188 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" |
191 | 189 | ||
192 | "Responsive elevation and dynamic elevation offsets.\n\n" | 190 | "Responsive elevation and dynamic elevation offsets.\n\n" |
193 | 191 | ||
194 | "Some component types have responsive elevation, meaning they change elevation in response " | 192 | "Some component types have responsive elevation, meaning they change elevation in response " |
195 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " | 193 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " |
196 | "changes are consistently implemented using dynamic elevation offsets.\n" | 194 | "changes are consistently implemented using dynamic elevation offsets.\n" |
197 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " | 195 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " |
198 | "to the component’s resting state. They ensure that elevation changes are consistent " | 196 | "to the component’s resting state. They ensure that elevation changes are consistent " |
199 | "across actions and component types. For example, all components that lift on press have " | 197 | "across actions and component types. For example, all components that lift on press have " |
200 | "the same elevation change relative to their resting elevation.\n" | 198 | "the same elevation change relative to their resting elevation.\n" |
201 | "Once the input event is completed or cancelled, the component will return to its resting " | 199 | "Once the input event is completed or cancelled, the component will return to its resting " |
202 | "elevation.\n\n" | 200 | "elevation.\n\n" |
203 | 201 | ||
204 | "Avoiding elevation interference.\n\n" | 202 | "Avoiding elevation interference.\n\n" |
205 | 203 | ||
206 | "Components with responsive elevations may encounter other components as they move between " | 204 | "Components with responsive elevations may encounter other components as they move between " |
207 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " | 205 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " |
208 | "through other material, components avoid interfering with one another any number of ways, " | 206 | "through other material, components avoid interfering with one another any number of ways, " |
209 | "whether on a per component basis or using the entire app layout.\n" | 207 | "whether on a per component basis or using the entire app layout.\n" |
210 | "On a component level, components can move or be removed before they cause interference. " | 208 | "On a component level, components can move or be removed before they cause interference. " |
211 | "For example, a floating action button (FAB) can disappear or move off screen before a " | 209 | "For example, a floating action button (FAB) can disappear or move off screen before a " |
212 | "user picks up a card, or it can move if a snackbar appears.\n" | 210 | "user picks up a card, or it can move if a snackbar appears.\n" |
213 | "On the layout level, design your app layout to minimize opportunities for interference. " | 211 | "On the layout level, design your app layout to minimize opportunities for interference. " |
214 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " | 212 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " |
215 | "when a user tries to pick up one of cards.\n\n" | 213 | "when a user tries to pick up one of cards.\n\n" |
216 | </string> | 214 | </string> |
217 | </resources> | 215 | </resources> |