Merge pull request #1596 from pramodn02/variableInstallment
Added installment amount for period in schedule data
This commit is contained in:
+13
-8
@@ -58,6 +58,7 @@ public class LoanSchedulePeriodData {
|
|||||||
private final BigDecimal totalOutstandingForPeriod;
|
private final BigDecimal totalOutstandingForPeriod;
|
||||||
private final BigDecimal totalOverdue;
|
private final BigDecimal totalOverdue;
|
||||||
private final BigDecimal totalActualCostOfLoanForPeriod;
|
private final BigDecimal totalActualCostOfLoanForPeriod;
|
||||||
|
private final BigDecimal totalInstallmentAmountForPeriod;
|
||||||
|
|
||||||
public static LoanSchedulePeriodData disbursementOnlyPeriod(final LocalDate disbursementDate, final BigDecimal principalDisbursed,
|
public static LoanSchedulePeriodData disbursementOnlyPeriod(final LocalDate disbursementDate, final BigDecimal principalDisbursed,
|
||||||
final BigDecimal feeChargesDueAtTimeOfDisbursement, final boolean isDisbursed) {
|
final BigDecimal feeChargesDueAtTimeOfDisbursement, final boolean isDisbursed) {
|
||||||
@@ -69,10 +70,12 @@ public class LoanSchedulePeriodData {
|
|||||||
|
|
||||||
public static LoanSchedulePeriodData repaymentOnlyPeriod(final Integer periodNumber, final LocalDate fromDate, final LocalDate dueDate,
|
public static LoanSchedulePeriodData repaymentOnlyPeriod(final Integer periodNumber, final LocalDate fromDate, final LocalDate dueDate,
|
||||||
final BigDecimal principalDue, final BigDecimal principalOutstanding, final BigDecimal interestDueOnPrincipalOutstanding,
|
final BigDecimal principalDue, final BigDecimal principalOutstanding, final BigDecimal interestDueOnPrincipalOutstanding,
|
||||||
final BigDecimal feeChargesDueForPeriod, final BigDecimal penaltyChargesDueForPeriod, final BigDecimal totalDueForPeriod) {
|
final BigDecimal feeChargesDueForPeriod, final BigDecimal penaltyChargesDueForPeriod, final BigDecimal totalDueForPeriod,
|
||||||
|
final BigDecimal totalInstallmentAmountForPeriod) {
|
||||||
|
|
||||||
return new LoanSchedulePeriodData(periodNumber, fromDate, dueDate, principalDue, principalOutstanding,
|
return new LoanSchedulePeriodData(periodNumber, fromDate, dueDate, principalDue, principalOutstanding,
|
||||||
interestDueOnPrincipalOutstanding, feeChargesDueForPeriod, penaltyChargesDueForPeriod, totalDueForPeriod);
|
interestDueOnPrincipalOutstanding, feeChargesDueForPeriod, penaltyChargesDueForPeriod, totalDueForPeriod,
|
||||||
|
totalInstallmentAmountForPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanSchedulePeriodData repaymentPeriodWithPayments(@SuppressWarnings("unused") final Long loanId,
|
public static LoanSchedulePeriodData repaymentPeriodWithPayments(@SuppressWarnings("unused") final Long loanId,
|
||||||
@@ -87,7 +90,7 @@ public class LoanSchedulePeriodData {
|
|||||||
final BigDecimal penaltyChargesWrittenOff, final BigDecimal penaltyChargesOutstanding, final BigDecimal totalDueForPeriod,
|
final BigDecimal penaltyChargesWrittenOff, final BigDecimal penaltyChargesOutstanding, final BigDecimal totalDueForPeriod,
|
||||||
final BigDecimal totalPaid, final BigDecimal totalPaidInAdvanceForPeriod, final BigDecimal totalPaidLateForPeriod,
|
final BigDecimal totalPaid, final BigDecimal totalPaidInAdvanceForPeriod, final BigDecimal totalPaidLateForPeriod,
|
||||||
final BigDecimal totalWaived, final BigDecimal totalWrittenOff, final BigDecimal totalOutstanding,
|
final BigDecimal totalWaived, final BigDecimal totalWrittenOff, final BigDecimal totalOutstanding,
|
||||||
final BigDecimal totalActualCostOfLoanForPeriod) {
|
final BigDecimal totalActualCostOfLoanForPeriod, final BigDecimal totalInstallmentAmountForPeriod) {
|
||||||
|
|
||||||
return new LoanSchedulePeriodData(periodNumber, fromDate, dueDate, obligationsMetOnDate, complete, principalOriginalDue,
|
return new LoanSchedulePeriodData(periodNumber, fromDate, dueDate, obligationsMetOnDate, complete, principalOriginalDue,
|
||||||
principalPaid, principalWrittenOff, principalOutstanding, outstandingPrincipalBalanceOfLoan,
|
principalPaid, principalWrittenOff, principalOutstanding, outstandingPrincipalBalanceOfLoan,
|
||||||
@@ -95,7 +98,7 @@ public class LoanSchedulePeriodData {
|
|||||||
feeChargesPaid, feeChargesWaived, feeChargesWrittenOff, feeChargesOutstanding, penaltyChargesDue, penaltyChargesPaid,
|
feeChargesPaid, feeChargesWaived, feeChargesWrittenOff, feeChargesOutstanding, penaltyChargesDue, penaltyChargesPaid,
|
||||||
penaltyChargesWaived, penaltyChargesWrittenOff, penaltyChargesOutstanding, totalDueForPeriod, totalPaid,
|
penaltyChargesWaived, penaltyChargesWrittenOff, penaltyChargesOutstanding, totalDueForPeriod, totalPaid,
|
||||||
totalPaidInAdvanceForPeriod, totalPaidLateForPeriod, totalWaived, totalWrittenOff, totalOutstanding,
|
totalPaidInAdvanceForPeriod, totalPaidLateForPeriod, totalWaived, totalWrittenOff, totalOutstanding,
|
||||||
totalActualCostOfLoanForPeriod);
|
totalActualCostOfLoanForPeriod, totalInstallmentAmountForPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanSchedulePeriodData WithPaidDetail(final LoanSchedulePeriodData loanSchedulePeriodData, final boolean complete,
|
public static LoanSchedulePeriodData WithPaidDetail(final LoanSchedulePeriodData loanSchedulePeriodData, final boolean complete,
|
||||||
@@ -115,7 +118,7 @@ public class LoanSchedulePeriodData {
|
|||||||
loanSchedulePeriodData.totalPaidForPeriod, loanSchedulePeriodData.totalPaidInAdvanceForPeriod,
|
loanSchedulePeriodData.totalPaidForPeriod, loanSchedulePeriodData.totalPaidInAdvanceForPeriod,
|
||||||
loanSchedulePeriodData.totalPaidLateForPeriod, loanSchedulePeriodData.totalWaivedForPeriod,
|
loanSchedulePeriodData.totalPaidLateForPeriod, loanSchedulePeriodData.totalWaivedForPeriod,
|
||||||
loanSchedulePeriodData.totalWrittenOffForPeriod, loanSchedulePeriodData.totalOutstandingForPeriod,
|
loanSchedulePeriodData.totalWrittenOffForPeriod, loanSchedulePeriodData.totalOutstandingForPeriod,
|
||||||
loanSchedulePeriodData.totalActualCostOfLoanForPeriod);
|
loanSchedulePeriodData.totalActualCostOfLoanForPeriod, loanSchedulePeriodData.totalInstallmentAmountForPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -177,6 +180,7 @@ public class LoanSchedulePeriodData {
|
|||||||
this.totalWrittenOffForPeriod = null;
|
this.totalWrittenOffForPeriod = null;
|
||||||
this.totalOutstandingForPeriod = this.feeChargesOutstanding;
|
this.totalOutstandingForPeriod = this.feeChargesOutstanding;
|
||||||
this.totalActualCostOfLoanForPeriod = this.feeChargesDue;
|
this.totalActualCostOfLoanForPeriod = this.feeChargesDue;
|
||||||
|
this.totalInstallmentAmountForPeriod = null;
|
||||||
if (dueDate.isBefore(new LocalDate())) {
|
if (dueDate.isBefore(new LocalDate())) {
|
||||||
this.totalOverdue = this.totalOutstandingForPeriod;
|
this.totalOverdue = this.totalOutstandingForPeriod;
|
||||||
} else {
|
} else {
|
||||||
@@ -191,7 +195,7 @@ public class LoanSchedulePeriodData {
|
|||||||
private LoanSchedulePeriodData(final Integer periodNumber, final LocalDate fromDate, final LocalDate dueDate,
|
private LoanSchedulePeriodData(final Integer periodNumber, final LocalDate fromDate, final LocalDate dueDate,
|
||||||
final BigDecimal principalOriginalDue, final BigDecimal principalOutstanding,
|
final BigDecimal principalOriginalDue, final BigDecimal principalOutstanding,
|
||||||
final BigDecimal interestDueOnPrincipalOutstanding, final BigDecimal feeChargesDueForPeriod,
|
final BigDecimal interestDueOnPrincipalOutstanding, final BigDecimal feeChargesDueForPeriod,
|
||||||
final BigDecimal penaltyChargesDueForPeriod, final BigDecimal totalDueForPeriod) {
|
final BigDecimal penaltyChargesDueForPeriod, final BigDecimal totalDueForPeriod, BigDecimal totalInstallmentAmountForPeriod) {
|
||||||
this.period = periodNumber;
|
this.period = periodNumber;
|
||||||
this.fromDate = fromDate;
|
this.fromDate = fromDate;
|
||||||
this.dueDate = dueDate;
|
this.dueDate = dueDate;
|
||||||
@@ -238,6 +242,7 @@ public class LoanSchedulePeriodData {
|
|||||||
this.totalWrittenOffForPeriod = null;
|
this.totalWrittenOffForPeriod = null;
|
||||||
this.totalOutstandingForPeriod = totalDueForPeriod;
|
this.totalOutstandingForPeriod = totalDueForPeriod;
|
||||||
this.totalActualCostOfLoanForPeriod = interestDueOnPrincipalOutstanding.add(feeChargesDueForPeriod);
|
this.totalActualCostOfLoanForPeriod = interestDueOnPrincipalOutstanding.add(feeChargesDueForPeriod);
|
||||||
|
this.totalInstallmentAmountForPeriod = totalInstallmentAmountForPeriod;
|
||||||
|
|
||||||
if (dueDate.isBefore(new LocalDate())) {
|
if (dueDate.isBefore(new LocalDate())) {
|
||||||
this.totalOverdue = this.totalOutstandingForPeriod;
|
this.totalOverdue = this.totalOutstandingForPeriod;
|
||||||
@@ -261,7 +266,7 @@ public class LoanSchedulePeriodData {
|
|||||||
final BigDecimal penaltyChargesWrittenOff, final BigDecimal penaltyChargesOutstanding, final BigDecimal totalDueForPeriod,
|
final BigDecimal penaltyChargesWrittenOff, final BigDecimal penaltyChargesOutstanding, final BigDecimal totalDueForPeriod,
|
||||||
final BigDecimal totalPaid, final BigDecimal totalPaidInAdvanceForPeriod, final BigDecimal totalPaidLateForPeriod,
|
final BigDecimal totalPaid, final BigDecimal totalPaidInAdvanceForPeriod, final BigDecimal totalPaidLateForPeriod,
|
||||||
final BigDecimal totalWaived, final BigDecimal totalWrittenOff, final BigDecimal totalOutstanding,
|
final BigDecimal totalWaived, final BigDecimal totalWrittenOff, final BigDecimal totalOutstanding,
|
||||||
final BigDecimal totalActualCostOfLoanForPeriod) {
|
final BigDecimal totalActualCostOfLoanForPeriod, final BigDecimal totalInstallmentAmountForPeriod) {
|
||||||
this.period = periodNumber;
|
this.period = periodNumber;
|
||||||
this.fromDate = fromDate;
|
this.fromDate = fromDate;
|
||||||
this.dueDate = dueDate;
|
this.dueDate = dueDate;
|
||||||
@@ -308,6 +313,7 @@ public class LoanSchedulePeriodData {
|
|||||||
this.totalWrittenOffForPeriod = totalWrittenOff;
|
this.totalWrittenOffForPeriod = totalWrittenOff;
|
||||||
this.totalOutstandingForPeriod = totalOutstanding;
|
this.totalOutstandingForPeriod = totalOutstanding;
|
||||||
this.totalActualCostOfLoanForPeriod = totalActualCostOfLoanForPeriod;
|
this.totalActualCostOfLoanForPeriod = totalActualCostOfLoanForPeriod;
|
||||||
|
this.totalInstallmentAmountForPeriod = totalInstallmentAmountForPeriod;
|
||||||
|
|
||||||
if (dueDate.isBefore(new LocalDate())) {
|
if (dueDate.isBefore(new LocalDate())) {
|
||||||
this.totalOverdue = this.totalOutstandingForPeriod;
|
this.totalOverdue = this.totalOutstandingForPeriod;
|
||||||
@@ -428,7 +434,6 @@ public class LoanSchedulePeriodData {
|
|||||||
return this.principalLoanBalanceOutstanding;
|
return this.principalLoanBalanceOutstanding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Boolean getComplete() {
|
public Boolean getComplete() {
|
||||||
return this.complete;
|
return this.complete;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -55,7 +55,7 @@ public final class LoanScheduleModelRepaymentPeriod implements LoanScheduleModel
|
|||||||
public LoanSchedulePeriodData toData() {
|
public LoanSchedulePeriodData toData() {
|
||||||
return LoanSchedulePeriodData.repaymentOnlyPeriod(this.periodNumber, this.fromDate, this.dueDate, this.principalDue.getAmount(),
|
return LoanSchedulePeriodData.repaymentOnlyPeriod(this.periodNumber, this.fromDate, this.dueDate, this.principalDue.getAmount(),
|
||||||
this.outstandingLoanBalance.getAmount(), this.interestDue.getAmount(), this.feeChargesDue.getAmount(),
|
this.outstandingLoanBalance.getAmount(), this.interestDue.getAmount(), this.feeChargesDue.getAmount(),
|
||||||
this.penaltyChargesDue.getAmount(), this.totalDue.getAmount());
|
this.penaltyChargesDue.getAmount(), this.totalDue.getAmount(), this.principalDue.plus(this.interestDue).getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -126,9 +126,9 @@ public final class LoanScheduleModelRepaymentPeriod implements LoanScheduleModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPrincipalAmount(final Money principalDue){
|
public void addPrincipalAmount(final Money principalDue) {
|
||||||
this.principalDue = this.principalDue.plus(principalDue);
|
this.principalDue = this.principalDue.plus(principalDue);
|
||||||
this.totalDue = this.totalDue.plus(principalDue);
|
this.totalDue = this.totalDue.plus(principalDue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+3
-2
@@ -190,7 +190,8 @@ public class LoanScheduleCalculationPlatformServiceImpl implements LoanScheduleC
|
|||||||
periodData.periodFromDate(), periodData.periodDueDate(), totalPrincipal.getAmount(), periodData
|
periodData.periodFromDate(), periodData.periodDueDate(), totalPrincipal.getAmount(), periodData
|
||||||
.principalLoanBalanceOutstanding(), interestDue.getAmount(), loanRepaymentScheduleInstallment
|
.principalLoanBalanceOutstanding(), interestDue.getAmount(), loanRepaymentScheduleInstallment
|
||||||
.getFeeChargesCharged(currency).getAmount(),
|
.getFeeChargesCharged(currency).getAmount(),
|
||||||
loanRepaymentScheduleInstallment.getPenaltyChargesCharged(currency).getAmount(), totalAmount.getAmount());
|
loanRepaymentScheduleInstallment.getPenaltyChargesCharged(currency).getAmount(), totalAmount.getAmount(),
|
||||||
|
totalPrincipal.plus(interestDue).getAmount());
|
||||||
futureInstallments.add(loanSchedulePeriodData);
|
futureInstallments.add(loanSchedulePeriodData);
|
||||||
isNewPaymentRequired = false;
|
isNewPaymentRequired = false;
|
||||||
} else if (periodData.periodDueDate().isAfter(today)) {
|
} else if (periodData.periodDueDate().isAfter(today)) {
|
||||||
@@ -246,7 +247,7 @@ public class LoanScheduleCalculationPlatformServiceImpl implements LoanScheduleC
|
|||||||
installment.getFromDate(), installment.getDueDate(), installment.getPrincipal(currency).getAmount(),
|
installment.getFromDate(), installment.getDueDate(), installment.getPrincipal(currency).getAmount(),
|
||||||
outstanding.getAmount(), installment.getInterestCharged(currency).getAmount(),
|
outstanding.getAmount(), installment.getInterestCharged(currency).getAmount(),
|
||||||
installment.getFeeChargesCharged(currency).getAmount(), installment.getPenaltyChargesCharged(currency).getAmount(),
|
installment.getFeeChargesCharged(currency).getAmount(), installment.getPenaltyChargesCharged(currency).getAmount(),
|
||||||
installment.getDue(currency).getAmount());
|
installment.getDue(currency).getAmount(), installment.getTotalPrincipalAndInterest(currency).getAmount());
|
||||||
installmentData.add(loanSchedulePeriodData);
|
installmentData.add(loanSchedulePeriodData);
|
||||||
totalInterest = totalInterest.plus(installment.getInterestCharged(currency));
|
totalInterest = totalInterest.plus(installment.getInterestCharged(currency));
|
||||||
totalCharge = totalCharge.plus(installment.getFeeChargesCharged(currency));
|
totalCharge = totalCharge.plus(installment.getFeeChargesCharged(currency));
|
||||||
|
|||||||
+4
-1
@@ -163,6 +163,9 @@ public class LoanScheduleHistoryReadPlatformServiceImpl implements LoanScheduleH
|
|||||||
final BigDecimal interestExpectedDue = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestDue");
|
final BigDecimal interestExpectedDue = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestDue");
|
||||||
totalInterestCharged = totalInterestCharged.plus(interestExpectedDue);
|
totalInterestCharged = totalInterestCharged.plus(interestExpectedDue);
|
||||||
|
|
||||||
|
final BigDecimal totalInstallmentAmount = totalPrincipalExpected.zero().plus(principalDue).plus(interestExpectedDue)
|
||||||
|
.getAmount();
|
||||||
|
|
||||||
final BigDecimal feeChargesExpectedDue = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "feeChargesDue");
|
final BigDecimal feeChargesExpectedDue = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "feeChargesDue");
|
||||||
totalFeeChargesCharged = totalFeeChargesCharged.plus(feeChargesExpectedDue);
|
totalFeeChargesCharged = totalFeeChargesCharged.plus(feeChargesExpectedDue);
|
||||||
|
|
||||||
@@ -187,7 +190,7 @@ public class LoanScheduleHistoryReadPlatformServiceImpl implements LoanScheduleH
|
|||||||
|
|
||||||
final LoanSchedulePeriodData periodData = LoanSchedulePeriodData.repaymentOnlyPeriod(period, fromDate, dueDate,
|
final LoanSchedulePeriodData periodData = LoanSchedulePeriodData.repaymentOnlyPeriod(period, fromDate, dueDate,
|
||||||
principalDue, outstandingPrincipalBalanceOfLoan, interestExpectedDue, feeChargesExpectedDue,
|
principalDue, outstandingPrincipalBalanceOfLoan, interestExpectedDue, feeChargesExpectedDue,
|
||||||
penaltyChargesExpectedDue, totalDueForPeriod);
|
penaltyChargesExpectedDue, totalDueForPeriod, totalInstallmentAmount);
|
||||||
|
|
||||||
periods.add(periodData);
|
periods.add(periodData);
|
||||||
}
|
}
|
||||||
|
|||||||
+77
-77
@@ -13,8 +13,8 @@ import org.mifosplatform.portfolio.loanaccount.loanschedule.data.LoanSchedulePer
|
|||||||
|
|
||||||
public final class LoanRescheduleModelRepaymentPeriod implements LoanRescheduleModalPeriod {
|
public final class LoanRescheduleModelRepaymentPeriod implements LoanRescheduleModalPeriod {
|
||||||
|
|
||||||
private int periodNumber;
|
private int periodNumber;
|
||||||
private int oldPeriodNumber;
|
private int oldPeriodNumber;
|
||||||
private LocalDate fromDate;
|
private LocalDate fromDate;
|
||||||
private LocalDate dueDate;
|
private LocalDate dueDate;
|
||||||
private Money principalDue;
|
private Money principalDue;
|
||||||
@@ -26,146 +26,146 @@ public final class LoanRescheduleModelRepaymentPeriod implements LoanRescheduleM
|
|||||||
private boolean isNew;
|
private boolean isNew;
|
||||||
|
|
||||||
public LoanRescheduleModelRepaymentPeriod(final int periodNumber, final int oldPeriodNumber, LocalDate fromDate,
|
public LoanRescheduleModelRepaymentPeriod(final int periodNumber, final int oldPeriodNumber, LocalDate fromDate,
|
||||||
final LocalDate dueDate, final Money principalDue, final Money outstandingLoanBalance, final Money interestDue,
|
final LocalDate dueDate, final Money principalDue, final Money outstandingLoanBalance, final Money interestDue,
|
||||||
final Money feeChargesDue, final Money penaltyChargesDue, final Money totalDue, final boolean isNew) {
|
final Money feeChargesDue, final Money penaltyChargesDue, final Money totalDue, final boolean isNew) {
|
||||||
this.periodNumber = periodNumber;
|
this.periodNumber = periodNumber;
|
||||||
this.oldPeriodNumber = oldPeriodNumber;
|
this.oldPeriodNumber = oldPeriodNumber;
|
||||||
this.fromDate = fromDate;
|
this.fromDate = fromDate;
|
||||||
this.dueDate = dueDate;
|
this.dueDate = dueDate;
|
||||||
this.principalDue = principalDue;
|
this.principalDue = principalDue;
|
||||||
this.outstandingLoanBalance = outstandingLoanBalance;
|
this.outstandingLoanBalance = outstandingLoanBalance;
|
||||||
this.interestDue = interestDue;
|
this.interestDue = interestDue;
|
||||||
this.feeChargesDue = feeChargesDue;
|
this.feeChargesDue = feeChargesDue;
|
||||||
this.penaltyChargesDue = penaltyChargesDue;
|
this.penaltyChargesDue = penaltyChargesDue;
|
||||||
this.totalDue = totalDue;
|
this.totalDue = totalDue;
|
||||||
this.isNew = isNew;
|
this.isNew = isNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanRescheduleModelRepaymentPeriod instance(final int periodNumber, final int oldPeriodNumber, LocalDate fromDate,
|
public static LoanRescheduleModelRepaymentPeriod instance(final int periodNumber, final int oldPeriodNumber, LocalDate fromDate,
|
||||||
final LocalDate dueDate, final Money principalDue, final Money outstandingLoanBalance, final Money interestDue,
|
final LocalDate dueDate, final Money principalDue, final Money outstandingLoanBalance, final Money interestDue,
|
||||||
final Money feeChargesDue, final Money penaltyChargesDue, final Money totalDue, final boolean isNew) {
|
final Money feeChargesDue, final Money penaltyChargesDue, final Money totalDue, final boolean isNew) {
|
||||||
|
|
||||||
return new LoanRescheduleModelRepaymentPeriod(periodNumber, oldPeriodNumber, fromDate, dueDate, principalDue,
|
return new LoanRescheduleModelRepaymentPeriod(periodNumber, oldPeriodNumber, fromDate, dueDate, principalDue,
|
||||||
outstandingLoanBalance, interestDue, feeChargesDue, penaltyChargesDue, totalDue, isNew);
|
outstandingLoanBalance, interestDue, feeChargesDue, penaltyChargesDue, totalDue, isNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanSchedulePeriodData toData() {
|
public LoanSchedulePeriodData toData() {
|
||||||
return LoanSchedulePeriodData.repaymentOnlyPeriod(this.periodNumber, this.fromDate, this.dueDate, this.principalDue.getAmount(),
|
return LoanSchedulePeriodData.repaymentOnlyPeriod(this.periodNumber, this.fromDate, this.dueDate, this.principalDue.getAmount(),
|
||||||
this.outstandingLoanBalance.getAmount(), this.interestDue.getAmount(), this.feeChargesDue.getAmount(),
|
this.outstandingLoanBalance.getAmount(), this.interestDue.getAmount(), this.feeChargesDue.getAmount(),
|
||||||
this.penaltyChargesDue.getAmount(), this.totalDue.getAmount());
|
this.penaltyChargesDue.getAmount(), this.totalDue.getAmount(), this.principalDue.plus(this.interestDue).getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer periodNumber() {
|
public Integer periodNumber() {
|
||||||
return this.periodNumber;
|
return this.periodNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer oldPeriodNumber() {
|
public Integer oldPeriodNumber() {
|
||||||
return this.oldPeriodNumber;
|
return this.oldPeriodNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDate periodFromDate() {
|
public LocalDate periodFromDate() {
|
||||||
return this.fromDate;
|
return this.fromDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDate periodDueDate() {
|
public LocalDate periodDueDate() {
|
||||||
return this.dueDate;
|
return this.dueDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal principalDue() {
|
public BigDecimal principalDue() {
|
||||||
BigDecimal value = null;
|
BigDecimal value = null;
|
||||||
|
|
||||||
if (this.principalDue != null) {
|
if (this.principalDue != null) {
|
||||||
value = this.principalDue.getAmount();
|
value = this.principalDue.getAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal interestDue() {
|
public BigDecimal interestDue() {
|
||||||
BigDecimal value = null;
|
BigDecimal value = null;
|
||||||
|
|
||||||
if (this.interestDue != null) {
|
if (this.interestDue != null) {
|
||||||
value = this.interestDue.getAmount();
|
value = this.interestDue.getAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal feeChargesDue() {
|
public BigDecimal feeChargesDue() {
|
||||||
BigDecimal value = null;
|
BigDecimal value = null;
|
||||||
|
|
||||||
if (this.feeChargesDue != null) {
|
if (this.feeChargesDue != null) {
|
||||||
value = this.feeChargesDue.getAmount();
|
value = this.feeChargesDue.getAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal penaltyChargesDue() {
|
public BigDecimal penaltyChargesDue() {
|
||||||
BigDecimal value = null;
|
BigDecimal value = null;
|
||||||
|
|
||||||
if (this.penaltyChargesDue != null) {
|
if (this.penaltyChargesDue != null) {
|
||||||
value = this.penaltyChargesDue.getAmount();
|
value = this.penaltyChargesDue.getAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew() {
|
public boolean isNew() {
|
||||||
return isNew;
|
return isNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePeriodNumber(Integer periodNumber) {
|
public void updatePeriodNumber(Integer periodNumber) {
|
||||||
this.periodNumber = periodNumber;
|
this.periodNumber = periodNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateOldPeriodNumber(Integer oldPeriodNumber) {
|
public void updateOldPeriodNumber(Integer oldPeriodNumber) {
|
||||||
this.oldPeriodNumber = oldPeriodNumber;
|
this.oldPeriodNumber = oldPeriodNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePeriodFromDate(LocalDate periodFromDate) {
|
public void updatePeriodFromDate(LocalDate periodFromDate) {
|
||||||
this.fromDate = periodFromDate;
|
this.fromDate = periodFromDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePeriodDueDate(LocalDate periodDueDate) {
|
public void updatePeriodDueDate(LocalDate periodDueDate) {
|
||||||
this.dueDate = periodDueDate;
|
this.dueDate = periodDueDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePrincipalDue(Money principalDue) {
|
public void updatePrincipalDue(Money principalDue) {
|
||||||
this.principalDue = principalDue;
|
this.principalDue = principalDue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInterestDue(Money interestDue) {
|
public void updateInterestDue(Money interestDue) {
|
||||||
this.interestDue = interestDue;
|
this.interestDue = interestDue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFeeChargesDue(Money feeChargesDue) {
|
public void updateFeeChargesDue(Money feeChargesDue) {
|
||||||
this.feeChargesDue = feeChargesDue;
|
this.feeChargesDue = feeChargesDue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePenaltyChargesDue(Money penaltyChargesDue) {
|
public void updatePenaltyChargesDue(Money penaltyChargesDue) {
|
||||||
this.penaltyChargesDue = penaltyChargesDue;
|
this.penaltyChargesDue = penaltyChargesDue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateOutstandingLoanBalance(Money outstandingLoanBalance) {
|
public void updateOutstandingLoanBalance(Money outstandingLoanBalance) {
|
||||||
this.outstandingLoanBalance = outstandingLoanBalance;
|
this.outstandingLoanBalance = outstandingLoanBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTotalDue(Money totalDue) {
|
public void updateTotalDue(Money totalDue) {
|
||||||
this.totalDue = totalDue;
|
this.totalDue = totalDue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateIsNew(boolean isNew) {
|
public void updateIsNew(boolean isNew) {
|
||||||
this.isNew = isNew;
|
this.isNew = isNew;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -434,6 +434,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
|||||||
final LocalDate dueDate = JdbcSupport.getLocalDate(rs, "dueDate");
|
final LocalDate dueDate = JdbcSupport.getLocalDate(rs, "dueDate");
|
||||||
final BigDecimal principalDue = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "principalAmount");
|
final BigDecimal principalDue = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "principalAmount");
|
||||||
final BigDecimal interestDueOnPrincipalOutstanding = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestAmount");
|
final BigDecimal interestDueOnPrincipalOutstanding = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestAmount");
|
||||||
|
final BigDecimal totalInstallmentAmount = principalDue.add(interestDueOnPrincipalOutstanding);
|
||||||
final BigDecimal feeChargesDueForPeriod = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "feeAmount");
|
final BigDecimal feeChargesDueForPeriod = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "feeAmount");
|
||||||
final BigDecimal penaltyChargesDueForPeriod = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "penaltyAmount");
|
final BigDecimal penaltyChargesDueForPeriod = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "penaltyAmount");
|
||||||
final Integer periodNumber = null;
|
final Integer periodNumber = null;
|
||||||
@@ -441,7 +442,8 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
|||||||
final BigDecimal principalOutstanding = null;
|
final BigDecimal principalOutstanding = null;
|
||||||
final BigDecimal totalDueForPeriod = null;
|
final BigDecimal totalDueForPeriod = null;
|
||||||
return LoanSchedulePeriodData.repaymentOnlyPeriod(periodNumber, fromDate, dueDate, principalDue, principalOutstanding,
|
return LoanSchedulePeriodData.repaymentOnlyPeriod(periodNumber, fromDate, dueDate, principalDue, principalOutstanding,
|
||||||
interestDueOnPrincipalOutstanding, feeChargesDueForPeriod, penaltyChargesDueForPeriod, totalDueForPeriod);
|
interestDueOnPrincipalOutstanding, feeChargesDueForPeriod, penaltyChargesDueForPeriod, totalDueForPeriod,
|
||||||
|
totalInstallmentAmount);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -1079,6 +1079,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final BigDecimal interestPaid = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestPaid");
|
final BigDecimal interestPaid = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestPaid");
|
||||||
final BigDecimal interestWaived = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestWaived");
|
final BigDecimal interestWaived = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestWaived");
|
||||||
final BigDecimal interestWrittenOff = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestWrittenOff");
|
final BigDecimal interestWrittenOff = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "interestWrittenOff");
|
||||||
|
final BigDecimal totalInstallmentAmount = totalPrincipalPaid.zero().plus(principalDue).plus(interestExpectedDue)
|
||||||
|
.getAmount();
|
||||||
|
|
||||||
final BigDecimal interestActualDue = interestExpectedDue.subtract(interestWaived).subtract(interestWrittenOff);
|
final BigDecimal interestActualDue = interestExpectedDue.subtract(interestWaived).subtract(interestWrittenOff);
|
||||||
final BigDecimal interestOutstanding = interestActualDue.subtract(interestPaid);
|
final BigDecimal interestOutstanding = interestActualDue.subtract(interestPaid);
|
||||||
@@ -1143,7 +1145,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
feeChargesOutstanding, penaltyChargesExpectedDue, penaltyChargesPaid, penaltyChargesWaived,
|
feeChargesOutstanding, penaltyChargesExpectedDue, penaltyChargesPaid, penaltyChargesWaived,
|
||||||
penaltyChargesWrittenOff, penaltyChargesOutstanding, totalDueForPeriod, totalPaidForPeriod,
|
penaltyChargesWrittenOff, penaltyChargesOutstanding, totalDueForPeriod, totalPaidForPeriod,
|
||||||
totalPaidInAdvanceForPeriod, totalPaidLateForPeriod, totalWaivedForPeriod, totalWrittenOffForPeriod,
|
totalPaidInAdvanceForPeriod, totalPaidLateForPeriod, totalWaivedForPeriod, totalWrittenOffForPeriod,
|
||||||
totalOutstandingForPeriod, totalActualCostOfLoanForPeriod);
|
totalOutstandingForPeriod, totalActualCostOfLoanForPeriod, totalInstallmentAmount);
|
||||||
|
|
||||||
periods.add(periodData);
|
periods.add(periodData);
|
||||||
}
|
}
|
||||||
@@ -1889,6 +1891,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final BigDecimal totalWrittenOff = null;
|
final BigDecimal totalWrittenOff = null;
|
||||||
final BigDecimal totalOutstanding = null;
|
final BigDecimal totalOutstanding = null;
|
||||||
final BigDecimal totalPaid = null;
|
final BigDecimal totalPaid = null;
|
||||||
|
final BigDecimal totalInstallmentAmount = null;
|
||||||
|
|
||||||
return LoanSchedulePeriodData.repaymentPeriodWithPayments(loanId, period, fromDate, dueDate, obligationsMetOnDate, complete,
|
return LoanSchedulePeriodData.repaymentPeriodWithPayments(loanId, period, fromDate, dueDate, obligationsMetOnDate, complete,
|
||||||
principalOriginalDue, principalPaid, principalWrittenOff, principalOutstanding, outstandingPrincipalBalanceOfLoan,
|
principalOriginalDue, principalPaid, principalWrittenOff, principalOutstanding, outstandingPrincipalBalanceOfLoan,
|
||||||
@@ -1896,7 +1899,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
feeChargesDue, feeChargesPaid, feeChargesWaived, feeChargesWrittenOff, feeChargesOutstanding, penaltyChargesDue,
|
feeChargesDue, feeChargesPaid, feeChargesWaived, feeChargesWrittenOff, feeChargesOutstanding, penaltyChargesDue,
|
||||||
penaltyChargesPaid, penaltyChargesWaived, penaltyChargesWrittenOff, penaltyChargesOutstanding, totalDueForPeriod,
|
penaltyChargesPaid, penaltyChargesWaived, penaltyChargesWrittenOff, penaltyChargesOutstanding, totalDueForPeriod,
|
||||||
totalPaid, totalPaidInAdvanceForPeriod, totalPaidLateForPeriod, totalWaived, totalWrittenOff, totalOutstanding,
|
totalPaid, totalPaidInAdvanceForPeriod, totalPaidLateForPeriod, totalWaived, totalWrittenOff, totalOutstanding,
|
||||||
totalActualCostOfLoanForPeriod);
|
totalActualCostOfLoanForPeriod, totalInstallmentAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user