use of org.mifos.accounts.business.AccountFeesActionDetailEntity in project head by mifos.
the class TestObjectFactory method getDueActionDatesForAccount.
public static List<AccountActionDateEntity> getDueActionDatesForAccount(final Integer accountId, final java.sql.Date transactionDate) throws Exception {
List<AccountActionDateEntity> dueActionDates = new CustomerPersistence().retrieveCustomerAccountActionDetails(accountId, transactionDate);
for (AccountActionDateEntity accountActionDate : dueActionDates) {
Hibernate.initialize(accountActionDate);
if (accountActionDate instanceof LoanScheduleEntity) {
LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDate;
for (AccountFeesActionDetailEntity accountFeesActionDetail : loanScheduleEntity.getAccountFeesActionDetails()) {
Hibernate.initialize(accountFeesActionDetail);
}
}
if (accountActionDate instanceof CustomerScheduleEntity) {
CustomerScheduleEntity customerScheduleEntity = (CustomerScheduleEntity) accountActionDate;
for (AccountFeesActionDetailEntity accountFeesActionDetail : customerScheduleEntity.getAccountFeesActionDetails()) {
Hibernate.initialize(accountFeesActionDetail);
}
}
}
StaticHibernateUtil.flushSession();
return dueActionDates;
}
use of org.mifos.accounts.business.AccountFeesActionDetailEntity in project head by mifos.
the class LoanBO method applyFeeToInstallments.
private Money applyFeeToInstallments(final List<FeeInstallment> feeInstallmentList, final List<AccountActionDateEntity> accountActionDateList) {
Date lastAppliedDate = null;
Money totalFeeAmountApplied = new Money(getCurrency());
AccountFeesEntity accountFeesEntity = null;
for (AccountActionDateEntity accountActionDateEntity : accountActionDateList) {
LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity;
for (FeeInstallment feeInstallment : feeInstallmentList) {
if (feeInstallment.getInstallmentId().equals(loanScheduleEntity.getInstallmentId())) {
lastAppliedDate = loanScheduleEntity.getActionDate();
totalFeeAmountApplied = totalFeeAmountApplied.add(feeInstallment.getAccountFee());
/*
* AccountFeesActionDetailEntity accountFeesActionDetailEntity = new LoanFeeScheduleEntity(
* loanScheduleEntity, feeInstallment .getAccountFeesEntity().getFees(),
* feeInstallment.getAccountFeesEntity(), feeInstallment.getAccountFee()); loanScheduleEntity
* .addAccountFeesAction(accountFeesActionDetailEntity);
*/
if (feeInstallment.getAccountFeesEntity().getFees().isPeriodic() && loanScheduleEntity.isFeeAlreadyAttatched(feeInstallment.getAccountFeesEntity().getFees().getFeeId())) {
LoanFeeScheduleEntity loanFeeScheduleEntity = (LoanFeeScheduleEntity) loanScheduleEntity.getAccountFeesAction(feeInstallment.getAccountFeesEntity().getFees().getFeeId());
loanFeeScheduleEntity.setFeeAmount(loanFeeScheduleEntity.getFeeAmount().add(feeInstallment.getAccountFee()));
} else {
AccountFeesActionDetailEntity accountFeesActionDetailEntity = new LoanFeeScheduleEntity(loanScheduleEntity, feeInstallment.getAccountFeesEntity().getFees(), feeInstallment.getAccountFeesEntity(), feeInstallment.getAccountFee());
loanScheduleEntity.addAccountFeesAction(accountFeesActionDetailEntity);
}
accountFeesEntity = feeInstallment.getAccountFeesEntity();
}
}
}
accountFeesEntity.setLastAppliedDate(lastAppliedDate);
addAccountFees(accountFeesEntity);
return totalFeeAmountApplied;
}
use of org.mifos.accounts.business.AccountFeesActionDetailEntity in project head by mifos.
the class LoanScheduleEntity method makeRepaymentEntries.
private void makeRepaymentEntries(String payFullOrPartial, Date paymentDate) {
setPaymentStatus(PaymentStatus.PAID);
setPaymentDate(new java.sql.Date(paymentDate.getTime()));
Set<AccountFeesActionDetailEntity> accountFeesActionDetailSet = this.getAccountFeesActionDetails();
for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : accountFeesActionDetailSet) {
((LoanFeeScheduleEntity) accountFeesActionDetailEntity).makeRepaymentEnteries(payFullOrPartial);
}
Set<LoanPenaltyScheduleEntity> loanPenaltyScheduleSet = this.getLoanPenaltyScheduleEntities();
for (LoanPenaltyScheduleEntity loanPenaltyScheduleEntity : loanPenaltyScheduleSet) {
loanPenaltyScheduleEntity.makeRepaymentEnteries(payFullOrPartial);
}
}
use of org.mifos.accounts.business.AccountFeesActionDetailEntity in project head by mifos.
the class LoanScheduleEntity method waiveFeeCharges.
Money waiveFeeCharges() {
Money chargeWaived = new Money(getCurrency());
chargeWaived = chargeWaived.add(getMiscFeeDue());
setMiscFee(getMiscFeePaid());
for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : getAccountFeesActionDetails()) {
chargeWaived = chargeWaived.add(((LoanFeeScheduleEntity) accountFeesActionDetailEntity).waiveCharges());
}
getAccountFeesActionDetails().clear();
return chargeWaived;
}
use of org.mifos.accounts.business.AccountFeesActionDetailEntity in project head by mifos.
the class LoanScheduleEntity method getTotalScheduledFeeAmountWithMiscFee.
public Money getTotalScheduledFeeAmountWithMiscFee() {
Money totalFees = new Money(getCurrency());
for (AccountFeesActionDetailEntity obj : accountFeesActionDetails) {
totalFees = totalFees.add(obj.getFeeAmount());
}
totalFees = totalFees.add(getMiscFee());
return totalFees;
}
Aggregations