use of org.mifos.accounts.business.AccountFeesActionDetailEntity in project head by mifos.
the class CustomerAccountBO method updateInstallmentAfterAdjustment.
@Override
protected void updateInstallmentAfterAdjustment(final List<AccountTrxnEntity> reversedTrxns, PersonnelBO loggedInUser) throws AccountException {
if (null != reversedTrxns && reversedTrxns.size() > 0) {
Money totalAmountAdj = new Money(getCurrency());
for (AccountTrxnEntity accntTrxn : reversedTrxns) {
CustomerTrxnDetailEntity custTrxn = (CustomerTrxnDetailEntity) accntTrxn;
CustomerScheduleEntity accntActionDate = (CustomerScheduleEntity) getAccountActionDate(custTrxn.getInstallmentId());
accntActionDate.setPaymentStatus(PaymentStatus.UNPAID);
accntActionDate.setPaymentDate(null);
accntActionDate.setMiscFeePaid(accntActionDate.getMiscFeePaid().add(custTrxn.getMiscFeeAmount()));
totalAmountAdj = totalAmountAdj.add(removeSign(custTrxn.getMiscFeeAmount()));
accntActionDate.setMiscPenaltyPaid(accntActionDate.getMiscPenaltyPaid().add(custTrxn.getMiscPenaltyAmount()));
totalAmountAdj = totalAmountAdj.add(removeSign(custTrxn.getMiscPenaltyAmount()));
if (null != accntActionDate.getAccountFeesActionDetails() && accntActionDate.getAccountFeesActionDetails().size() > 0) {
for (AccountFeesActionDetailEntity accntFeesAction : accntActionDate.getAccountFeesActionDetails()) {
Money feeAmntAdjusted = custTrxn.getFeesTrxn(accntFeesAction.getAccountFee().getAccountFeeId()).getFeeAmount();
((CustomerFeeScheduleEntity) accntFeesAction).setFeeAmountPaid(accntFeesAction.getFeeAmountPaid().add(feeAmntAdjusted));
totalAmountAdj = totalAmountAdj.add(removeSign(feeAmntAdjusted));
}
}
}
addCustomerActivity(buildCustomerActivity(totalAmountAdj, AccountConstants.AMNT_ADJUSTED, userContext.getId()));
}
}
use of org.mifos.accounts.business.AccountFeesActionDetailEntity in project head by mifos.
the class CustomerAccountBO method dueAmountForCustomerSchedule.
private BigDecimal dueAmountForCustomerSchedule(CustomerScheduleEntity customerSchedule) {
BigDecimal totalAllUnpaidInstallments = customerSchedule.getMiscFeeDue().getAmount();
totalAllUnpaidInstallments = totalAllUnpaidInstallments.add(customerSchedule.getMiscPenaltyDue().getAmount());
for (AccountFeesActionDetailEntity accountFeesActionDetail : customerSchedule.getAccountFeesActionDetails()) {
CustomerFeeScheduleEntity customerFeeSchedule = (CustomerFeeScheduleEntity) accountFeesActionDetail;
totalAllUnpaidInstallments = totalAllUnpaidInstallments.add(customerFeeSchedule.getFeeDue().getAmount());
}
return totalAllUnpaidInstallments;
}
use of org.mifos.accounts.business.AccountFeesActionDetailEntity in project head by mifos.
the class CustomerAccountBO method updateUpcomingAndFutureInstallments.
private void updateUpcomingAndFutureInstallments(final AccountFeesEntity fee) {
CustomerScheduleEntity nextInstallment = (CustomerScheduleEntity) getDetailsOfNextInstallment();
AccountFeesActionDetailEntity nextAccountFeesActionDetail = null;
if (nextInstallment != null) {
nextAccountFeesActionDetail = nextInstallment.getAccountFeesAction(fee.getAccountFeeId());
}
if (nextAccountFeesActionDetail != null) {
((CustomerFeeScheduleEntity) nextAccountFeesActionDetail).setFeeAmount(fee.getAccountFeeAmount());
}
List<AccountActionDateEntity> futureInstallments = getFutureInstallments();
for (AccountActionDateEntity accountActionDateEntity : futureInstallments) {
CustomerScheduleEntity installment = (CustomerScheduleEntity) accountActionDateEntity;
AccountFeesActionDetailEntity accountFeesActionDetail = installment.getAccountFeesAction(fee.getAccountFeeId());
if (accountFeesActionDetail != null) {
((CustomerFeeScheduleEntity) accountFeesActionDetail).setFeeAmount(fee.getAccountFeeAmount());
}
}
}
use of org.mifos.accounts.business.AccountFeesActionDetailEntity in project head by mifos.
the class DefaultLoanScheduleRounderHelper method adjustLastInstallmentFees_v2.
/**
* adjust the first fee in the installment's set of fees
*/
private void adjustLastInstallmentFees_v2(final LoanScheduleEntity lastInstallment, final RepaymentTotals totals, MifosCurrency mifosCurrency) {
Set<AccountFeesActionDetailEntity> feeDetails = lastInstallment.getAccountFeesActionDetails();
if (!(feeDetails == null) && !feeDetails.isEmpty()) {
Money lastInstallmentFeeSum = new Money(mifosCurrency);
for (AccountFeesActionDetailEntity e : feeDetails) {
lastInstallmentFeeSum = lastInstallmentFeeSum.add(e.getFeeAmount());
}
for (Object element : feeDetails) {
AccountFeesActionDetailEntity e = (AccountFeesActionDetailEntity) element;
e.adjustFeeAmount(totals.getRoundedAccountFeesDue().subtract(totals.getRunningAccountFees()).subtract(lastInstallmentFeeSum));
// just adjust the first fee
return;
}
}
}
Aggregations