Search in sources :

Example 21 with Money

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);
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Example 22 with Money

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;
}
Also used : Money(org.mifos.framework.util.helpers.Money) AccountFeesActionDetailEntity(org.mifos.accounts.business.AccountFeesActionDetailEntity)

Example 23 with Money

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;
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Example 24 with Money

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;
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Example 25 with Money

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;
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Aggregations

Money (org.mifos.framework.util.helpers.Money)688 Test (org.junit.Test)326 Date (java.util.Date)110 ArrayList (java.util.ArrayList)93 LocalDate (org.joda.time.LocalDate)90 Date (java.sql.Date)85 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)80 DateTime (org.joda.time.DateTime)67 LoanBO (org.mifos.accounts.loan.business.LoanBO)64 MeetingBO (org.mifos.application.meeting.business.MeetingBO)57 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)56 BigDecimal (java.math.BigDecimal)53 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)49 AccountException (org.mifos.accounts.exceptions.AccountException)48 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)46 UserContext (org.mifos.security.util.UserContext)46 CustomerBO (org.mifos.customers.business.CustomerBO)39 MifosUser (org.mifos.security.MifosUser)35 RepaymentScheduleInstallment (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)34 PaymentData (org.mifos.accounts.util.helpers.PaymentData)34