use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method zeroRemainingFields.
private void zeroRemainingFields(MifosCurrency currency) {
this.penalty = new Money(currency);
this.extraInterest = new Money(currency);
this.miscFee = new Money(currency);
this.miscPenalty = new Money(currency);
this.principalPaid = new Money(currency);
this.interestPaid = new Money(currency);
this.penaltyPaid = new Money(currency);
this.extraInterestPaid = new Money(currency);
this.miscFeePaid = new Money(currency);
this.miscPenaltyPaid = new Money(currency);
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method payFees.
private Money payFees(final Money amount) {
Money balance = amount;
for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : getAccountFeesActionDetails()) {
balance = accountFeesActionDetailEntity.payFee(balance);
Integer feeId = accountFeesActionDetailEntity.getAccountFeesActionDetailId();
if (feeId == null) {
// special workaround for MIFOS-4517
feeId = accountFeesActionDetailEntity.hashCode();
}
Money feeAllocated = accountFeesActionDetailEntity.getFeeAllocated();
paymentAllocation.allocateForFee(feeId, feeAllocated);
}
return balance;
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method getAmountToBePaidToGetExpectedProportion.
public Money getAmountToBePaidToGetExpectedProportion(BigDecimal expected) {
Money amount = getTotalAmountOfInstallment().multiply(expected);
amount = amount.subtract(getTotalPaidAmount());
return amount;
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method waivePenaltyCharges.
Money waivePenaltyCharges() {
Money chargeWaived = new Money(getCurrency());
chargeWaived = chargeWaived.add(getMiscPenaltyDue());
setMiscPenalty(getMiscPenaltyPaid());
setPenalty(getPenaltyPaid());
for (LoanPenaltyScheduleEntity loanPenaltyScheduleEntity : getLoanPenaltyScheduleEntities()) {
chargeWaived = chargeWaived.add(loanPenaltyScheduleEntity.waiveCharges());
}
return chargeWaived;
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method payComponentsNewMechanism.
public Money payComponentsNewMechanism(Money paymentAmount, Date paymentDate) {
initPaymentAllocation(paymentAmount.getCurrency());
Money balanceAmount = paymentAmount;
balanceAmount = payPrincipal(balanceAmount);
if (isPrincipalZero()) {
// the entire principal was paid in advance so no interest due on this installment.
}
balanceAmount = payMiscPenalty(balanceAmount);
balanceAmount = payPenalty(balanceAmount);
balanceAmount = payMiscFees(balanceAmount);
balanceAmount = payFees(balanceAmount);
balanceAmount = payInterest(balanceAmount);
recordPayment(paymentDate);
return balanceAmount;
}
Aggregations