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);
}
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;
}
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);
}
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);
}
}
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);
}
Aggregations