use of org.mifos.accounts.util.helpers.FeeInstallment in project head by mifos.
the class CustomerAccountBO 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) {
CustomerScheduleEntity customerScheduleEntity = (CustomerScheduleEntity) accountActionDateEntity;
for (FeeInstallment feeInstallment : feeInstallmentList) {
if (feeInstallment.getInstallmentId().equals(customerScheduleEntity.getInstallmentId())) {
lastAppliedDate = customerScheduleEntity.getActionDate();
totalFeeAmountApplied = totalFeeAmountApplied.add(feeInstallment.getAccountFee());
AccountFeesActionDetailEntity accountFeesActionDetailEntity = new CustomerFeeScheduleEntity(customerScheduleEntity, feeInstallment.getAccountFeesEntity().getFees(), feeInstallment.getAccountFeesEntity(), feeInstallment.getAccountFee());
customerScheduleEntity.addAccountFeesAction(accountFeesActionDetailEntity);
accountFeesEntity = feeInstallment.getAccountFeesEntity();
}
}
}
if (accountFeesEntity != null) {
accountFeesEntity.setLastAppliedDate(lastAppliedDate);
addAccountFees(accountFeesEntity);
}
return totalFeeAmountApplied;
}
use of org.mifos.accounts.util.helpers.FeeInstallment in project head by mifos.
the class CustomerAccountBO method generateMeetingSchedule.
/**
* @deprecated - use static factory methods for creating {@link CustomerAccountBO} and inject in installment dates.
*/
@Deprecated
private void generateMeetingSchedule() throws AccountException {
// generate dates that adjust for holidays
List<InstallmentDate> installmentDates = getInstallmentDates(getCustomer().getCustomerMeeting().getMeeting(), (short) 10, (short) 0);
// generate dates without adjusting for holidays
List<InstallmentDate> nonAdjustedInstallmentDates = getInstallmentDates(getCustomer().getCustomerMeeting().getMeeting(), (short) 10, (short) 0, false, true);
logger.debug("RepamentSchedular:getRepaymentSchedule , installment dates obtained ");
List<FeeInstallment> feeInstallmentList = mergeFeeInstallments(getFeeInstallments(installmentDates, nonAdjustedInstallmentDates));
logger.debug("RepamentSchedular:getRepaymentSchedule , fee installment obtained ");
for (InstallmentDate installmentDate : installmentDates) {
CustomerScheduleEntity customerScheduleEntity = new CustomerScheduleEntity(this, getCustomer(), installmentDate.getInstallmentId(), new java.sql.Date(installmentDate.getInstallmentDueDate().getTime()), PaymentStatus.UNPAID);
addAccountActionDate(customerScheduleEntity);
for (FeeInstallment feeInstallment : feeInstallmentList) {
if (feeInstallment.getInstallmentId().equals(installmentDate.getInstallmentId())) {
CustomerFeeScheduleEntity customerFeeScheduleEntity = new CustomerFeeScheduleEntity(customerScheduleEntity, feeInstallment.getAccountFeesEntity().getFees(), feeInstallment.getAccountFeesEntity(), feeInstallment.getAccountFee());
customerScheduleEntity.addAccountFeesAction(customerFeeScheduleEntity);
}
}
}
logger.debug("RepamentSchedular:getRepaymentSchedule , repayment schedule generated ");
}
use of org.mifos.accounts.util.helpers.FeeInstallment in project head by mifos.
the class CustomerAccountBO method applyOneTimeFee.
private void applyOneTimeFee(final FeeBO fee, final Money charge, final AccountActionDateEntity accountActionDateEntity) throws AccountException {
CustomerScheduleEntity customerScheduleEntity = (CustomerScheduleEntity) accountActionDateEntity;
AccountFeesEntity accountFee = new AccountFeesEntity(this, fee, charge.getAmountDoubleValue(), FeeStatus.ACTIVE.getValue(), new DateTimeService().getCurrentJavaDateTime(), null);
List<AccountActionDateEntity> customerScheduleList = new ArrayList<AccountActionDateEntity>();
customerScheduleList.add(customerScheduleEntity);
List<InstallmentDate> installmentDates = new ArrayList<InstallmentDate>();
installmentDates.add(new InstallmentDate(accountActionDateEntity.getInstallmentId(), accountActionDateEntity.getActionDate()));
List<FeeInstallment> feeInstallmentList = new ArrayList<FeeInstallment>();
feeInstallmentList.add(handleOneTime(accountFee, installmentDates));
Money totalFeeAmountApplied = applyFeeToInstallments(feeInstallmentList, customerScheduleList);
updateCustomerActivity(fee.getFeeId(), totalFeeAmountApplied, fee.getFeeName() + AccountConstants.APPLIED);
accountFee.setFeeStatus(FeeStatus.ACTIVE);
}
use of org.mifos.accounts.util.helpers.FeeInstallment in project head by mifos.
the class CustomerAccountBO method applyFeesToInitialSetOfInstallments.
private void applyFeesToInitialSetOfInstallments(List<AccountFeesEntity> accountFees, final ScheduledEvent scheduledEvent) {
List<FeeInstallment> mergedFeeInstallments = FeeInstallment.createMergedFeeInstallments(scheduledEvent, accountFees, numberOfMeetingDatesToGenerate);
for (AccountActionDateEntity accountAction : this.getAccountActionDates()) {
this.applyFeesToScheduledEvent((CustomerScheduleEntity) accountAction, mergedFeeInstallments);
}
this.setLastAppliedDatesForFees(accountFees);
}
use of org.mifos.accounts.util.helpers.FeeInstallment in project head by mifos.
the class CustomerAccountBO method applyFeesToScheduledEvent.
private void applyFeesToScheduledEvent(CustomerScheduleEntity customerScheduleEntity, List<FeeInstallment> mergedFeeInstallments) {
for (FeeInstallment feeInstallment : mergedFeeInstallments) {
if (feeInstallment.getInstallmentId().equals(customerScheduleEntity.getInstallmentId())) {
CustomerFeeScheduleEntity customerFeeScheduleEntity = new CustomerFeeScheduleEntity(customerScheduleEntity, feeInstallment.getAccountFeesEntity().getFees(), feeInstallment.getAccountFeesEntity(), feeInstallment.getAccountFee());
customerScheduleEntity.addAccountFeesAction(customerFeeScheduleEntity);
}
}
}
Aggregations