use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class LoanBO method getTotalPrincipalAmountInArrearsAndOutsideLateness.
public Money getTotalPrincipalAmountInArrearsAndOutsideLateness() throws PersistenceException {
Money amount = new Money(getCurrency());
loanPrdPersistence = new LoanPrdPersistence();
Date currentDate = DateUtils.getCurrentDateWithoutTimeStamp();
List<AccountActionDateEntity> actionDateList = getDetailsOfInstallmentsInArrears();
for (AccountActionDateEntity accountActionDateEntity : actionDateList) {
if (accountActionDateEntity.isNotPaid() && currentDate.getTime() - accountActionDateEntity.getActionDate().getTime() > loanPrdPersistence.retrieveLatenessForPrd().intValue() * 24 * 60 * 60 * 1000) {
amount = amount.add(((LoanScheduleEntity) accountActionDateEntity).getPrincipalDue());
}
}
return amount;
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class LoanBO method applyChargeMifos5722.
public void applyChargeMifos5722(final Short feeId, final Double charge) throws AccountException {
List<AccountActionDateEntity> dueInstallments = getAllInstallments();
FeeBO fee = getFeeDao().findById(feeId);
if (fee.getFeeFrequency().getFeePayment() != null) {
applyOneTimeFee(fee, charge, dueInstallments.get(0));
} else {
applyPeriodicFee(fee, charge, dueInstallments);
}
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class LoanBO method payInterestAtDisbursement.
private AccountPaymentEntity payInterestAtDisbursement(final String receiptNum, final Date transactionDate, final Short paymentTypeId, final PersonnelBO loggedInUser, final Date receiptDate) throws AccountException {
AccountActionDateEntity firstInstallment = null;
for (AccountActionDateEntity accountActionDate : this.getAccountActionDates()) {
if (accountActionDate.getInstallmentId().shortValue() == 1) {
firstInstallment = accountActionDate;
break;
}
}
PaymentData paymentData = PaymentData.createPaymentData(((LoanScheduleEntity) firstInstallment).getTotalDueWithFees(), loggedInUser, paymentTypeId, transactionDate);
paymentData.setReceiptDate(receiptDate);
paymentData.setReceiptNum(receiptNum);
// Pay 1st installment and return accountPayableEntity to disbursal process
return makePayment(paymentData);
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class LoanBO method updateAccountActionDateEntity.
/**
* Remove unpaid or partially paid fee from each installment whose id is in installmentIdList, and return the total
* of all unpaid fees that were removed.
*/
@Override
public Money updateAccountActionDateEntity(final List<Short> intallmentIdList, final Short feeId) {
Money totalFeeAmount = new Money(getCurrency());
Set<AccountActionDateEntity> accountActionDateEntitySet = this.getAccountActionDates();
for (AccountActionDateEntity accountActionDateEntity : accountActionDateEntitySet) {
if (intallmentIdList.contains(accountActionDateEntity.getInstallmentId())) {
totalFeeAmount = totalFeeAmount.add(((LoanScheduleEntity) accountActionDateEntity).removeFees(feeId));
}
}
return totalFeeAmount;
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class LoanBO method getOverDueAmntsUptoInstallment.
/**
* It calculates over due amounts till installment 1 less than the one passed,because whatever amount is associated
* with the current installment it is the due amount and not the over due amount. It calculates that by iterating
* over the accountActionDates associated and summing up all the principal and principalPaid till installment-1 and
* then returning the difference of the two.It also takes into consideration any miscellaneous fee or miscellaneous
* penalty.
*
* @param installmentId
* - Installment id till which we want over due amounts.
*
*/
public OverDueAmounts getOverDueAmntsUptoInstallment(final Short installmentId) {
Set<AccountActionDateEntity> accountActionDateEntities = getAccountActionDates();
OverDueAmounts totalOverDueAmounts = new OverDueAmounts();
if (null != accountActionDateEntities && accountActionDateEntities.size() > 0) {
for (AccountActionDateEntity accountActionDateEntity : accountActionDateEntities) {
LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity;
if (loanScheduleEntity.getInstallmentId() < installmentId) {
totalOverDueAmounts.add(loanScheduleEntity.getDueAmnts());
}
}
}
return totalOverDueAmounts;
}
Aggregations