Search in sources :

Example 26 with AccountFeesActionDetailEntity

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;
}
Also used : LoanScheduleEntity(org.mifos.accounts.loan.business.LoanScheduleEntity) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) AccountFeesActionDetailEntity(org.mifos.accounts.business.AccountFeesActionDetailEntity) CustomerScheduleEntity(org.mifos.customers.business.CustomerScheduleEntity) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence)

Example 27 with AccountFeesActionDetailEntity

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;
}
Also used : Money(org.mifos.framework.util.helpers.Money) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) AccountFeesActionDetailEntity(org.mifos.accounts.business.AccountFeesActionDetailEntity) FeeInstallment(org.mifos.accounts.util.helpers.FeeInstallment) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) Date(java.util.Date) InstallmentDate(org.mifos.accounts.util.helpers.InstallmentDate) LocalDate(org.joda.time.LocalDate)

Example 28 with AccountFeesActionDetailEntity

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

Example 29 with AccountFeesActionDetailEntity

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

Example 30 with AccountFeesActionDetailEntity

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

Aggregations

AccountFeesActionDetailEntity (org.mifos.accounts.business.AccountFeesActionDetailEntity)39 Money (org.mifos.framework.util.helpers.Money)21 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)9 ArrayList (java.util.ArrayList)8 LoanScheduleEntity (org.mifos.accounts.loan.business.LoanScheduleEntity)8 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)7 BigDecimal (java.math.BigDecimal)6 FeesTrxnDetailEntity (org.mifos.accounts.business.FeesTrxnDetailEntity)6 Date (java.sql.Date)5 CustomerScheduleEntity (org.mifos.customers.business.CustomerScheduleEntity)5 Date (java.util.Date)4 LocalDate (org.joda.time.LocalDate)4 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)4 AccountException (org.mifos.accounts.exceptions.AccountException)4 FeeBO (org.mifos.accounts.fees.business.FeeBO)4 MeetingBO (org.mifos.application.meeting.business.MeetingBO)4 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)4 Test (org.junit.Test)3 AccountTrxnEntity (org.mifos.accounts.business.AccountTrxnEntity)3 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)3