Search in sources :

Example 6 with Money

use of org.mifos.framework.util.helpers.Money in project head by mifos.

the class LoanSummaryEntity method updatePaymentDetails.

public void updatePaymentDetails(LoanTrxnDetailEntity loanReverseTrxn) {
    Money penaltyPaid = loanReverseTrxn.totalPenaltyPaid();
    Money totalAndMiscFeesPaid = loanReverseTrxn.totalAndMiscFeesPaid();
    updatePaymentDetails(loanReverseTrxn.getPrincipalAmount(), loanReverseTrxn.getInterestAmount(), penaltyPaid, totalAndMiscFeesPaid);
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Example 7 with Money

use of org.mifos.framework.util.helpers.Money in project head by mifos.

the class LoanSummaryEntity method getOutstandingBalance.

public Money getOutstandingBalance() {
    Money totalAmount = new Money(loan.getCurrency());
    totalAmount = totalAmount.add(getOriginalPrincipal()).subtract(getPrincipalPaid());
    totalAmount = totalAmount.add(getOriginalInterest()).subtract(getInterestPaid());
    totalAmount = totalAmount.add(getOriginalPenalty()).subtract(getPenaltyPaid());
    totalAmount = totalAmount.add(getOriginalFees()).subtract(getFeesPaid());
    return totalAmount;
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Example 8 with Money

use of org.mifos.framework.util.helpers.Money in project head by mifos.

the class OriginalLoanScheduleEntity method reset.

private void reset(MifosCurrency currency) {
    this.penaltyPaid = new Money(currency);
    this.extraInterest = new Money(currency);
    this.miscFeePaid = new Money(currency);
    this.miscPenaltyPaid = 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 9 with Money

use of org.mifos.framework.util.helpers.Money in project head by mifos.

the class LegacyLoanDao method findClientPerformanceHistoryLastLoanAmountWhenRepaidLoanAdjusted.

public Money findClientPerformanceHistoryLastLoanAmountWhenRepaidLoanAdjusted(Integer clientId, Integer excludeAccountId) {
    HashMap<String, Object> queryParameters = new HashMap<String, Object>();
    queryParameters.put("CLIENT_ID", clientId);
    queryParameters.put("EXCLUDE_ACCOUNT_ID", excludeAccountId);
    try {
        final Object[] obj = (Object[]) execUniqueResultNamedQuery("ClientPerformanceHistory.getLastLoanAmountWhenRepaidLoanAdjusted", queryParameters);
        if (obj == null || obj[1] == null) {
            return null;
        }
        Integer loanAccountId = (Integer) obj[0];
        BigDecimal lastLoanAmount = (BigDecimal) obj[1];
        LoanBO loan = (LoanBO) StaticHibernateUtil.getSessionTL().get(LoanBO.class, loanAccountId);
        return new Money(loan.getCurrency(), lastLoanAmount);
    } catch (PersistenceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) HashMap(java.util.HashMap) LoanBO(org.mifos.accounts.loan.business.LoanBO) PersistenceException(org.mifos.framework.exceptions.PersistenceException) BigDecimal(java.math.BigDecimal) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 10 with Money

use of org.mifos.framework.util.helpers.Money in project head by mifos.

the class LoanBO method repayInstallment.

void repayInstallment(LoanScheduleEntity loanSchedule, AccountPaymentEntity accountPaymentEntity, AccountActionTypes accountActionTypes, PersonnelBO currentUser, String comments, Money interestDue) {
    Money principal = loanSchedule.getPrincipalDue();
    Money fees = loanSchedule.getTotalFeeDueWithMiscFeeDue();
    Money penalty = loanSchedule.getPenaltyDue();
    Money interest = interestDue.add(loanSchedule.getExtraInterestDue());
    Money totalAmt = principal.add(interest).add(fees).add(penalty);
    LoanTrxnDetailEntity loanTrxnDetailEntity = new LoanTrxnDetailEntity(accountPaymentEntity, accountActionTypes, loanSchedule.getInstallmentId(), loanSchedule.getActionDate(), currentUser, accountPaymentEntity.getPaymentDate(), totalAmt, comments, null, principal, interest, loanSchedule.getPenalty().subtract(loanSchedule.getPenaltyPaid()), loanSchedule.getMiscFeeDue(), loanSchedule.getMiscPenaltyDue(), null, null);
    addFeeTransactions(loanTrxnDetailEntity, loanSchedule.getAccountFeesActionDetails());
    addPenaltyTransactions(loanTrxnDetailEntity, loanSchedule.getLoanPenaltyScheduleEntities());
    accountPaymentEntity.addAccountTrxn(loanTrxnDetailEntity);
    loanSchedule.makeEarlyRepaymentEntries(LoanConstants.PAY_FEES_PENALTY_INTEREST, interestDue, accountPaymentEntity.getPaymentDate());
    setCalculatedInterestIfApplicable(loanTrxnDetailEntity, loanSchedule, interestDue);
    updatePaymentDetails(accountActionTypes, principal, interest, penalty, fees);
}
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