Merge pull request #1526 from pramodn02/MIFOSX-2320

MIFOSX-2320 : Moved stop processing check as first statement
This commit is contained in:
Adi Narayana Raju
2015-10-29 10:02:17 +05:30
@@ -1898,20 +1898,6 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
// This will create the recalculation details by applying the
// transactions
for (LoanRepaymentScheduleInstallment installment : repaymentScheduleInstallments) {
for (Map.Entry<LocalDate, Money> disburseDetail : disburseDetailMap.entrySet()) {
if (disburseDetail.getKey().isAfter(installment.getFromDate())
&& !disburseDetail.getKey().isAfter(installment.getDueDate())) {
// creates and add disbursement detail to the repayments
// period
final LoanScheduleModelDisbursementPeriod disbursementPeriod = LoanScheduleModelDisbursementPeriod.disbursement(
disburseDetail.getKey(), disburseDetail.getValue(), chargesDueAtTimeOfDisbursement);
periods.add(disbursementPeriod);
// updates actual outstanding balance with new
// disbursement detail
outstandingBalance = outstandingBalance.plus(disburseDetail.getValue());
}
}
// this will generate the next schedule due date and allows to
// process the installment only if recalculate from date is
// greater than due date
@@ -1928,6 +1914,20 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
}
periodNumber++;
}
for (Map.Entry<LocalDate, Money> disburseDetail : disburseDetailMap.entrySet()) {
if (disburseDetail.getKey().isAfter(installment.getFromDate())
&& !disburseDetail.getKey().isAfter(installment.getDueDate())) {
// creates and add disbursement detail to the repayments
// period
final LoanScheduleModelDisbursementPeriod disbursementPeriod = LoanScheduleModelDisbursementPeriod.disbursement(
disburseDetail.getKey(), disburseDetail.getValue(), chargesDueAtTimeOfDisbursement);
periods.add(disbursementPeriod);
// updates actual outstanding balance with new
// disbursement detail
outstandingBalance = outstandingBalance.plus(disburseDetail.getValue());
}
}
// calculation of basic fields to start the schedule generation
// from the middle