diff --git a/app/src/main/java/org/gnucash/android/db/adapter/SplitsDbAdapter.java b/app/src/main/java/org/gnucash/android/db/adapter/SplitsDbAdapter.java index 3bfb32aca..c74a32c51 100644 --- a/app/src/main/java/org/gnucash/android/db/adapter/SplitsDbAdapter.java +++ b/app/src/main/java/org/gnucash/android/db/adapter/SplitsDbAdapter.java @@ -220,13 +220,18 @@ private Money calculateSplitBalance(List accountUIDList, + " = 0"; if (startTimestamp != -1 && endTimestamp != -1) { + selection += " AND " + TransactionEntry.TABLE_NAME + "_" + TransactionEntry.COLUMN_TIMESTAMP + " BETWEEN ? AND ? "; selectionArgs = new String[]{String.valueOf(startTimestamp), String.valueOf(endTimestamp)}; + } else if (startTimestamp == -1 && endTimestamp != -1) { + selection += " AND " + TransactionEntry.TABLE_NAME + "_" + TransactionEntry.COLUMN_TIMESTAMP + " <= ?"; selectionArgs = new String[]{String.valueOf(endTimestamp)}; + } else if (startTimestamp != -1/* && endTimestamp == -1*/) { + selection += " AND " + TransactionEntry.TABLE_NAME + "_" + TransactionEntry.COLUMN_TIMESTAMP + " >= ?"; selectionArgs = new String[]{String.valueOf(startTimestamp)}; } diff --git a/app/src/main/java/org/gnucash/android/model/Money.java b/app/src/main/java/org/gnucash/android/model/Money.java index eedc67ac1..0c3ddd145 100644 --- a/app/src/main/java/org/gnucash/android/model/Money.java +++ b/app/src/main/java/org/gnucash/android/model/Money.java @@ -257,7 +257,8 @@ public double asDouble(){ public String asString(){ return toPlainString(); } - + + // TODO TW C 2020-03-06 : A factoriser avec Split.getFormattedAmount /** * Returns a string representation of the Money object formatted according to * the locale and includes the currency symbol.