Sorting now by value date instead of booking date

This commit is contained in:
dankito 2020-05-25 20:02:42 +02:00
parent 2ef8a03e95
commit 92231a72a1
10 changed files with 13 additions and 13 deletions

View File

@ -336,7 +336,7 @@ open class FinTsClient @JvmOverloads constructor(
} }
return GetTransactionsResponse(response, return GetTransactionsResponse(response,
bookedTransactions.sortedByDescending { it.bookingDate }, bookedTransactions,
listOf(), // TODO: implement parsing MT942 listOf(), // TODO: implement parsing MT942
balance) balance)
} }

View File

@ -17,7 +17,7 @@ class LuceneConfig {
const val OtherPartyAccountIdFieldName = "other_party_account_id" const val OtherPartyAccountIdFieldName = "other_party_account_id"
const val BookingDateFieldName = "booking_date" const val BookingDateFieldName = "booking_date"
const val BookingDateSortFieldName = "booking_date_sort" const val DateSortFieldName = "value_date_sort"
const val UsageFieldName = "usage" const val UsageFieldName = "usage"

View File

@ -5,7 +5,7 @@ import net.dankito.banking.LuceneConfig.Companion.AmountFieldName
import net.dankito.banking.LuceneConfig.Companion.BalanceFieldName import net.dankito.banking.LuceneConfig.Companion.BalanceFieldName
import net.dankito.banking.LuceneConfig.Companion.BankAccountIdFieldName import net.dankito.banking.LuceneConfig.Companion.BankAccountIdFieldName
import net.dankito.banking.LuceneConfig.Companion.BookingDateFieldName import net.dankito.banking.LuceneConfig.Companion.BookingDateFieldName
import net.dankito.banking.LuceneConfig.Companion.BookingDateSortFieldName import net.dankito.banking.LuceneConfig.Companion.DateSortFieldName
import net.dankito.banking.LuceneConfig.Companion.BookingTextFieldName import net.dankito.banking.LuceneConfig.Companion.BookingTextFieldName
import net.dankito.banking.LuceneConfig.Companion.CurrencyFieldName import net.dankito.banking.LuceneConfig.Companion.CurrencyFieldName
import net.dankito.banking.LuceneConfig.Companion.IdFieldName import net.dankito.banking.LuceneConfig.Companion.IdFieldName
@ -74,7 +74,7 @@ open class LuceneBankingPersistence(
fields.storedField(CurrencyFieldName, transaction.currency), fields.storedField(CurrencyFieldName, transaction.currency),
fields.nullableStoredField(BalanceFieldName, transaction.closingBalance), // TODO: remove fields.nullableStoredField(BalanceFieldName, transaction.closingBalance), // TODO: remove
fields.sortField(BookingDateSortFieldName, transaction.bookingDate) // TODO: sort by valueDate fields.sortField(DateSortFieldName, transaction.valueDate)
) )
} }

View File

@ -17,7 +17,7 @@ open class AccountTransactionAdapter(protected val presenter: BankingPresenter)
: ListRecyclerAdapter<AccountTransaction, AccountTransactionViewHolder>() { : ListRecyclerAdapter<AccountTransaction, AccountTransactionViewHolder>() {
companion object { companion object {
val BookingDateFormat = DateFormat.getDateInstance(DateFormat.SHORT) val ValueDateFormat = DateFormat.getDateInstance(DateFormat.SHORT)
} }
@ -35,7 +35,7 @@ open class AccountTransactionAdapter(protected val presenter: BankingPresenter)
} }
override fun bindItemToView(viewHolder: AccountTransactionViewHolder, item: AccountTransaction) { override fun bindItemToView(viewHolder: AccountTransactionViewHolder, item: AccountTransaction) {
viewHolder.txtvwBookingDate.text = BookingDateFormat.format(item.bookingDate) viewHolder.txtvwDate.text = ValueDateFormat.format(item.valueDate)
viewHolder.txtvwBookingText.text = item.bookingText ?: "" viewHolder.txtvwBookingText.text = item.bookingText ?: ""

View File

@ -8,7 +8,7 @@ import kotlinx.android.synthetic.main.list_item_account_transaction.view.*
open class AccountTransactionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { open class AccountTransactionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val txtvwBookingDate: TextView = itemView.txtvwBookingDate val txtvwDate: TextView = itemView.txtvwDate
val txtvwBookingText: TextView = itemView.txtvwBookingText val txtvwBookingText: TextView = itemView.txtvwBookingText

View File

@ -75,7 +75,7 @@
/> />
<TextView <TextView
android:id="@+id/txtvwBookingDate" android:id="@+id/txtvwDate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"

View File

@ -38,7 +38,7 @@ open class AccountTransactionsTable @JvmOverloads constructor(
protected open fun initUi() { protected open fun initUi() {
column(messages["account.transactions.table.column.header.value.date"], AccountTransaction::bookingDate) { column(messages["account.transactions.table.column.header.value.date"], AccountTransaction::valueDate) {
prefWidth = 115.0 prefWidth = 115.0
cellFormat { cellFormat {

View File

@ -106,7 +106,7 @@ open class AccountTransaction(
override fun toString(): String { override fun toString(): String {
return "${DateFormat.getDateInstance(DateFormat.MEDIUM).format(bookingDate)} $amount $otherPartyName: $usage" return "${DateFormat.getDateInstance(DateFormat.MEDIUM).format(valueDate)} $amount $otherPartyName: $usage"
} }
} }

View File

@ -559,7 +559,7 @@ open class BankingPresenter(
protected open fun getAccountTransactionsForBankAccounts(bankAccounts: Collection<BankAccount>): List<AccountTransaction> { protected open fun getAccountTransactionsForBankAccounts(bankAccounts: Collection<BankAccount>): List<AccountTransaction> {
return bankAccounts.flatMap { it.bookedTransactions }.sortedByDescending { it.bookingDate } // TODO: someday add unbooked transactions return bankAccounts.flatMap { it.bookedTransactions }.sortedByDescending { it.valueDate } // TODO: someday add unbooked transactions
} }
protected open fun getBalanceForAccounts(accounts: Collection<Account>): BigDecimal { protected open fun getBalanceForAccounts(accounts: Collection<Account>): BigDecimal {

View File

@ -25,7 +25,7 @@ open class AccountTransactionMapper {
open fun mapAccountTransactions(bankAccount: BankAccount, result: GVRKUms): List<AccountTransaction> { open fun mapAccountTransactions(bankAccount: BankAccount, result: GVRKUms): List<AccountTransaction> {
val entries = ArrayList<AccountTransaction>() val entries = mutableListOf<AccountTransaction>()
result.dataPerDay.forEach { btag -> result.dataPerDay.forEach { btag ->
btag.lines.forEach { transaction -> btag.lines.forEach { transaction ->
@ -35,7 +35,7 @@ open class AccountTransactionMapper {
log.debug("Retrieved ${result.flatData.size} accounting entries") log.debug("Retrieved ${result.flatData.size} accounting entries")
return entries.sortedByDescending { it.bookingDate } return entries
} }
protected open fun mapAccountingEntry(bankAccount: BankAccount, btag: GVRKUms.BTag, transaction: GVRKUms.UmsLine): AccountTransaction { protected open fun mapAccountingEntry(bankAccount: BankAccount, btag: GVRKUms.BTag, transaction: GVRKUms.UmsLine): AccountTransaction {