From 3544f5cd5c06b37f8c42e8218d7d3f5a2b849b7f Mon Sep 17 00:00:00 2001 From: Keith Woodlock Date: Sat, 31 Aug 2013 21:41:39 +0100 Subject: [PATCH] MIFOSX-627: closing balance is calculated wrongly for same day transactions which can results in negative interest been calculated. --- .../savings/domain/SavingsAccountTransaction.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java index edae019c0..7916de80a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java @@ -302,9 +302,15 @@ public final class SavingsAccountTransaction extends AbstractPersistable { numberOfDaysOfBalance = spanOfBalance.daysInPeriodInclusiveOfEndDate(); } else { if (isDeposit()) { - endOfDayBalance = openingBalance.plus(getAmount(currency)); +// endOfDayBalance = openingBalance.plus(getAmount(currency)); +// if (endOfDayBalance.isLessThanZero()) { + endOfDayBalance = Money.of(currency, this.runningBalance); +// } } else if (isWithdrawal() || isWithdrawalFeeAndNotReversed()) { - endOfDayBalance = openingBalance.minus(getAmount(currency)); +// endOfDayBalance = openingBalance.minus(getAmount(currency)); +// if (endOfDayBalance.isLessThanZero()) { + endOfDayBalance = Money.of(currency, this.runningBalance); +// } } }