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 // This will create the recalculation details by applying the
// transactions // transactions
for (LoanRepaymentScheduleInstallment installment : repaymentScheduleInstallments) { 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 // this will generate the next schedule due date and allows to
// process the installment only if recalculate from date is // process the installment only if recalculate from date is
// greater than due date // greater than due date
@@ -1929,6 +1915,20 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
periodNumber++; 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 // calculation of basic fields to start the schedule generation
// from the middle // from the middle
periodStartDate = installment.getDueDate(); periodStartDate = installment.getDueDate();