feat itemGetBalance refs #6769

This commit is contained in:
Sergio De la torre 2024-07-23 13:48:06 +02:00
parent 75c5d9ffd7
commit 3cc2717a90
3 changed files with 15 additions and 12 deletions

View File

@ -145,7 +145,7 @@ class HistoricoArticuloFragment(
listHistoric.removeAll(listHistoryAux.toSet()) listHistoric.removeAll(listHistoryAux.toSet())
listHistoryAux.forEach { listHistoryAux.forEach {
if (it.name?.contains( if (it.entityName?.contains(
binding.filterNameordateitem.text.toString(), true binding.filterNameordateitem.text.toString(), true
) == true ) == true
) { ) {
@ -180,21 +180,24 @@ class HistoricoArticuloFragment(
listHistoric.clear() listHistoric.clear()
listHistoryAux.clear() listHistoryAux.clear()
lista.forEach { lista.forEach {
if (filter == "all" || (filter == "falta" && it.name?.contains( if (filter == "all" || (filter == "falta" && it.entityName?.contains(
filter, filter,
true true
) == true) || (filter != "falta" && it.name?.contains( ) == true) || (filter != "falta" && it.entityName?.contains(
"merma", "merma",
true true
) == true && !it.name?.contains("falta", true)!!) ) == true && !it.entityName?.contains("falta", true)!!)
) { ) {
listHistoric.add(it) listHistoric.add(it)
} }
} }
listHistoric.sortWith { item1, item2 -> listHistoric.sortWith { item1, item2 ->
val compareShipped = item1.shipped.compareTo(item2.shipped) val compareShipped = item1.shipped.compareTo(item2.shipped)
//comentar con ivanm
if (compareShipped == 0) { if (compareShipped == 0) {
if (item1.order == null) { if (item1.order == null && item2.order == null) {
item2.balance!!.compareTo(item1.balance!!) // Comparar por balance cuando ambos órdenes son nulos
}else if (item1.order == null) {
-1 -1
} else if (item2.order == null) { } else if (item2.order == null) {
1 1
@ -215,10 +218,10 @@ class HistoricoArticuloFragment(
title = getString(R.string.titleWebViewer), title = getString(R.string.titleWebViewer),
), entryPoint = Gson().toJson( ), entryPoint = Gson().toJson(
mutableMapOf( mutableMapOf(
"entryPoint" to item.origin, "entryPoint" to item.entityId,
"web" to "${ "web" to "${
mobileApplication.dataStoreApp.getServerSalix() mobileApplication.dataStoreApp.getServerSalix()
}/#!/ticket/${item.origin}/summary" }/#!/ticket/${item.entityId}/summary"
) )
) )
) )
@ -226,7 +229,7 @@ class HistoricoArticuloFragment(
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialog customDialog
.setTitle(getString(R.string.entry)) .setTitle(getString(R.string.entry))
.setDescription(item.origin.toString()) .setDescription(item.entityId.toString())
.setOkButton( .setOkButton(
getString( getString(
R.string.accept R.string.accept

View File

@ -7,10 +7,10 @@ import es.verdnatura.domain.isoToString
class ItemHistoricoVO( class ItemHistoricoVO(
//var shipped: String? = null, //var shipped: String? = null,
var stateName: String? = null, var stateName: String? = null,
var origin: Int? = null, var originId: Int? = null,
var reference: String? = null, var reference: String? = null,
var clientFk: Int? = null, var entityId: Int? = null,
var name: String? = null, var entityName: String? = null,
var invalue: Int? = null, var invalue: Int? = null,
var out: Int? = null, var out: Int? = null,
var balance: Int? = null, var balance: Int? = null,

View File

@ -40,7 +40,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="start" android:gravity="start"
android:text="@{item.name}" android:text="@{item.entityName}"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" /> android:textSize="@dimen/body2" />