diff --git a/mifosng-data/src/main/java/org/mifosng/data/command/CalculateLoanScheduleCommand.java b/mifosng-data/src/main/java/org/mifosng/data/command/CalculateLoanScheduleCommand.java index 6d22c7a67..9b4c78f7e 100644 --- a/mifosng-data/src/main/java/org/mifosng/data/command/CalculateLoanScheduleCommand.java +++ b/mifosng-data/src/main/java/org/mifosng/data/command/CalculateLoanScheduleCommand.java @@ -10,23 +10,23 @@ import org.joda.time.LocalDate; public class CalculateLoanScheduleCommand { private String currencyCode; - private Integer digitsAfterDecimal; - private BigDecimal principal; - private BigDecimal inArrearsToleranceAmount; + private Integer digitsAfterDecimalValue; + private BigDecimal principalValue; + private BigDecimal inArrearsToleranceValue; - private Integer repaymentEvery; - private Integer repaymentFrequency; - private Integer numberOfRepayments; + private Integer repaymentEveryValue; + private Integer repaymentFrequencyType; + private Integer numberOfRepaymentsValue; - private BigDecimal interestRatePerPeriod; - private Integer interestRateFrequencyMethod; - private Integer amortizationMethod; - private Integer interestMethod; - private Integer interestCalculationPeriodMethod; + private BigDecimal interestRatePerPeriodValue; + private Integer interestRateFrequencyType; + private Integer amortizationType; + private Integer interestType; + private Integer interestCalculationPeriodType; - private LocalDate expectedDisbursementDate; - private LocalDate repaymentsStartingFromDate; - private LocalDate interestCalculatedFromDate; + private LocalDate expectedDisbursementLocalDate; + private LocalDate repaymentsStartingFromLocalDate; + private LocalDate interestChargedFromLocalDate; protected CalculateLoanScheduleCommand() { // @@ -40,20 +40,24 @@ public class CalculateLoanScheduleCommand { final LocalDate repaymentsStartingFromDate, final LocalDate interestCalculatedFromDate) { this.currencyCode = currencyCode; - this.digitsAfterDecimal = digitsAfterDecimal; - this.principal = BigDecimal.valueOf(principal.doubleValue()); - this.interestRatePerPeriod = BigDecimal.valueOf(interestRatePerPeriod.doubleValue()); - this.interestRateFrequencyMethod = interestRateFrequencyMethod; - this.interestMethod = interestMethod; - this.interestCalculationPeriodMethod = interestCalculationPeriodMethod; - this.repaymentEvery = repaymentEvery; - this.repaymentFrequency = repaymentFrequency; - this.numberOfRepayments = numberOfRepayments; - this.amortizationMethod = amortizationMethod; + this.digitsAfterDecimalValue = digitsAfterDecimal; + if (principal != null) { + this.principalValue = BigDecimal.valueOf(principal.doubleValue()); + } + if (interestRatePerPeriod != null) { + this.interestRatePerPeriodValue = BigDecimal.valueOf(interestRatePerPeriod.doubleValue()); + } + this.interestRateFrequencyType = interestRateFrequencyMethod; + this.interestType = interestMethod; + this.interestCalculationPeriodType = interestCalculationPeriodMethod; + this.repaymentEveryValue = repaymentEvery; + this.repaymentFrequencyType = repaymentFrequency; + this.numberOfRepaymentsValue = numberOfRepayments; + this.amortizationType = amortizationMethod; - this.expectedDisbursementDate = expectedDisbursementDate; - this.repaymentsStartingFromDate = repaymentsStartingFromDate; - this.interestCalculatedFromDate = interestCalculatedFromDate; + this.expectedDisbursementLocalDate = expectedDisbursementDate; + this.repaymentsStartingFromLocalDate = repaymentsStartingFromDate; + this.interestChargedFromLocalDate= interestCalculatedFromDate; } public String getCurrencyCode() { @@ -64,116 +68,119 @@ public class CalculateLoanScheduleCommand { this.currencyCode = currencyCode; } - public Integer getDigitsAfterDecimal() { - return digitsAfterDecimal; + public Integer getDigitsAfterDecimalValue() { + return digitsAfterDecimalValue; } - public void setDigitsAfterDecimal(Integer digitsAfterDecimal) { - this.digitsAfterDecimal = digitsAfterDecimal; + public void setDigitsAfterDecimalValue(Integer digitsAfterDecimalValue) { + this.digitsAfterDecimalValue = digitsAfterDecimalValue; } - public BigDecimal getPrincipal() { - return principal; + public BigDecimal getPrincipalValue() { + return principalValue; } - public void setPrincipal(BigDecimal principal) { - this.principal = principal; + public void setPrincipalValue(BigDecimal principalValue) { + this.principalValue = principalValue; } - public BigDecimal getInArrearsToleranceAmount() { - return inArrearsToleranceAmount; + public BigDecimal getInArrearsToleranceValue() { + return inArrearsToleranceValue; } - public void setInArrearsToleranceAmount(BigDecimal inArrearsToleranceAmount) { - this.inArrearsToleranceAmount = inArrearsToleranceAmount; + public void setInArrearsToleranceValue(BigDecimal inArrearsToleranceValue) { + this.inArrearsToleranceValue = inArrearsToleranceValue; } - public Integer getRepaymentEvery() { - return repaymentEvery; + public Integer getRepaymentEveryValue() { + return repaymentEveryValue; } - public void setRepaymentEvery(Integer repaymentEvery) { - this.repaymentEvery = repaymentEvery; + public void setRepaymentEveryValue(Integer repaymentEveryValue) { + this.repaymentEveryValue = repaymentEveryValue; } - public Integer getRepaymentFrequency() { - return repaymentFrequency; + public Integer getRepaymentFrequencyType() { + return repaymentFrequencyType; } - public void setRepaymentFrequency(Integer repaymentFrequency) { - this.repaymentFrequency = repaymentFrequency; + public void setRepaymentFrequencyType(Integer repaymentFrequencyType) { + this.repaymentFrequencyType = repaymentFrequencyType; } - public Integer getNumberOfRepayments() { - return numberOfRepayments; + public Integer getNumberOfRepaymentsValue() { + return numberOfRepaymentsValue; } - public void setNumberOfRepayments(Integer numberOfRepayments) { - this.numberOfRepayments = numberOfRepayments; + public void setNumberOfRepaymentsValue(Integer numberOfRepaymentsValue) { + this.numberOfRepaymentsValue = numberOfRepaymentsValue; } - public BigDecimal getInterestRatePerPeriod() { - return interestRatePerPeriod; + public BigDecimal getInterestRatePerPeriodValue() { + return interestRatePerPeriodValue; } - public void setInterestRatePerPeriod(BigDecimal interestRatePerPeriod) { - this.interestRatePerPeriod = interestRatePerPeriod; + public void setInterestRatePerPeriodValue(BigDecimal interestRatePerPeriodValue) { + this.interestRatePerPeriodValue = interestRatePerPeriodValue; } - public Integer getInterestRateFrequencyMethod() { - return interestRateFrequencyMethod; + public Integer getInterestRateFrequencyType() { + return interestRateFrequencyType; } - public void setInterestRateFrequencyMethod(Integer interestRateFrequencyMethod) { - this.interestRateFrequencyMethod = interestRateFrequencyMethod; + public void setInterestRateFrequencyType(Integer interestRateFrequencyType) { + this.interestRateFrequencyType = interestRateFrequencyType; } - public Integer getAmortizationMethod() { - return amortizationMethod; + public Integer getAmortizationType() { + return amortizationType; } - public void setAmortizationMethod(Integer amortizationMethod) { - this.amortizationMethod = amortizationMethod; + public void setAmortizationType(Integer amortizationType) { + this.amortizationType = amortizationType; } - public Integer getInterestMethod() { - return interestMethod; + public Integer getInterestType() { + return interestType; } - public void setInterestMethod(Integer interestMethod) { - this.interestMethod = interestMethod; + public void setInterestType(Integer interestType) { + this.interestType = interestType; } - public Integer getInterestCalculationPeriodMethod() { - return interestCalculationPeriodMethod; + public Integer getInterestCalculationPeriodType() { + return interestCalculationPeriodType; } - public void setInterestCalculationPeriodMethod( - Integer interestCalculationPeriodMethod) { - this.interestCalculationPeriodMethod = interestCalculationPeriodMethod; + public void setInterestCalculationPeriodType( + Integer interestCalculationPeriodType) { + this.interestCalculationPeriodType = interestCalculationPeriodType; } - public LocalDate getExpectedDisbursementDate() { - return expectedDisbursementDate; + public LocalDate getExpectedDisbursementLocalDate() { + return expectedDisbursementLocalDate; } - public void setExpectedDisbursementDate(LocalDate expectedDisbursementDate) { - this.expectedDisbursementDate = expectedDisbursementDate; + public void setExpectedDisbursementLocalDate( + LocalDate expectedDisbursementLocalDate) { + this.expectedDisbursementLocalDate = expectedDisbursementLocalDate; } - public LocalDate getRepaymentsStartingFromDate() { - return repaymentsStartingFromDate; + public LocalDate getRepaymentsStartingFromLocalDate() { + return repaymentsStartingFromLocalDate; } - public void setRepaymentsStartingFromDate(LocalDate repaymentsStartingFromDate) { - this.repaymentsStartingFromDate = repaymentsStartingFromDate; + public void setRepaymentsStartingFromLocalDate( + LocalDate repaymentsStartingFromLocalDate) { + this.repaymentsStartingFromLocalDate = repaymentsStartingFromLocalDate; } - public LocalDate getInterestCalculatedFromDate() { - return interestCalculatedFromDate; + public LocalDate getInterestChargedFromLocalDate() { + return interestChargedFromLocalDate; } - public void setInterestCalculatedFromDate(LocalDate interestCalculatedFromDate) { - this.interestCalculatedFromDate = interestCalculatedFromDate; + public void setInterestChargedFromLocalDate( + LocalDate interestChargedFromLocalDate) { + this.interestChargedFromLocalDate = interestChargedFromLocalDate; } } \ No newline at end of file diff --git a/mifosng-data/src/main/java/org/mifosng/data/command/SubmitLoanApplicationCommand.java b/mifosng-data/src/main/java/org/mifosng/data/command/SubmitLoanApplicationCommand.java index 42ac4ae2e..64205f24a 100644 --- a/mifosng-data/src/main/java/org/mifosng/data/command/SubmitLoanApplicationCommand.java +++ b/mifosng-data/src/main/java/org/mifosng/data/command/SubmitLoanApplicationCommand.java @@ -10,38 +10,44 @@ import org.mifosng.data.LoanSchedule; @XmlRootElement public class SubmitLoanApplicationCommand { - private Long applicantId; + private Long clientId; private Long productId; // product + private String locale; private String currencyCode; - private Integer digitsAfterDecimal; - private String principalFormatted; - private BigDecimal principal; - private String inArrearsToleranceAmountFormatted; - private BigDecimal inArrearsToleranceAmount; + private String digitsAfterDecimal; + private Integer digitsAfterDecimalValue; + private BigDecimal principalValue; + private String principal; + private BigDecimal inArrearsToleranceValue; + private String inArrearsTolerance; - private Integer repaymentEvery; - private Integer repaymentFrequency; - private Integer numberOfRepayments; + private String numberOfRepayments; + private Integer numberOfRepaymentsValue; + private String repaymentEvery; + private Integer repaymentEveryValue; - private String interestRatePerPeriodFormatted; - private BigDecimal interestRatePerPeriod; - private Integer interestRateFrequencyMethod; - private Integer amortizationMethod; - private Integer interestMethod; - private Integer interestCalculationPeriodMethod; + private String interestRatePerPeriod; + private BigDecimal interestRatePerPeriodValue; + + private Integer repaymentFrequencyType; + private Integer interestRateFrequencyType; + private Integer amortizationType; + private Integer interestType; + private Integer interestCalculationPeriodType; + // end of product related fields - private String expectedDisbursementDateFormatted; - private String repaymentsStartingFromDateFormatted; - private String interestCalculatedFromDateFormatted; - private LocalDate expectedDisbursementDate; - private LocalDate repaymentsStartingFromDate; - private LocalDate interestCalculatedFromDate; + private String expectedDisbursementDate; + private String repaymentsStartingFromDate; + private String interestChargedFromDate; + private LocalDate expectedDisbursementLocalDate; + private LocalDate repaymentsStartingFromLocalDate; + private LocalDate interestChargedFromLocalDate; private String dateFormat; - private String submittedOnDateFormatted; - private LocalDate submittedOnDate; + private String submittedOnDate; + private LocalDate submittedOnLocalDate; private String submittedOnNote; private String externalId; @@ -51,49 +57,42 @@ public class SubmitLoanApplicationCommand { // } - public SubmitLoanApplicationCommand(final Long applicantId, + public SubmitLoanApplicationCommand(final Long clientId, final Long productId, final LocalDate submittedOnDate, final String submittedOnNote, final LocalDate expectedDisbursementDate, final LocalDate repaymentsStartingFromDate, - final LocalDate interestCalculatedFromDate, + final LocalDate interestChargedFromLocalDate, final LoanSchedule loanSchedule, final String currencyCode, final Integer digitsAfterDecimal, final Number principal, final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod, final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Number toleranceAmount) { - this.applicantId = applicantId; + this.clientId = clientId; this.productId = productId; - this.submittedOnDate = submittedOnDate; + this.submittedOnLocalDate = submittedOnDate; this.submittedOnNote = submittedOnNote; - this.expectedDisbursementDate = expectedDisbursementDate; - this.repaymentsStartingFromDate = repaymentsStartingFromDate; - this.interestCalculatedFromDate = interestCalculatedFromDate; + this.expectedDisbursementLocalDate = expectedDisbursementDate; + this.repaymentsStartingFromLocalDate = repaymentsStartingFromDate; + this.interestChargedFromLocalDate = interestChargedFromLocalDate; this.loanSchedule = loanSchedule; - this.inArrearsToleranceAmount = BigDecimal.valueOf(toleranceAmount.doubleValue()); + this.inArrearsToleranceValue = BigDecimal.valueOf(toleranceAmount.doubleValue()); this.currencyCode = currencyCode; - this.digitsAfterDecimal = digitsAfterDecimal; - this.principal = BigDecimal.valueOf(principal.doubleValue()); - this.interestRatePerPeriod = BigDecimal.valueOf(interestRatePerPeriod.doubleValue()); - this.interestRateFrequencyMethod = interestRateFrequencyMethod; - this.interestMethod = interestMethod; - this.interestCalculationPeriodMethod = interestCalculationPeriodMethod; - this.repaymentEvery = repaymentEvery; - this.repaymentFrequency = repaymentFrequency; - this.numberOfRepayments = numberOfRepayments; - this.amortizationMethod = amortizationMethod; + this.digitsAfterDecimalValue = digitsAfterDecimal; + this.principalValue = BigDecimal.valueOf(principal.doubleValue()); + this.interestRatePerPeriodValue = BigDecimal.valueOf(interestRatePerPeriod.doubleValue()); + this.interestRateFrequencyType = interestRateFrequencyMethod; + this.interestType = interestMethod; + this.interestCalculationPeriodType = interestCalculationPeriodMethod; + this.repaymentEveryValue = repaymentEvery; + this.repaymentFrequencyType = repaymentFrequency; + this.numberOfRepaymentsValue = numberOfRepayments; + this.amortizationType = amortizationMethod; } public CalculateLoanScheduleCommand toCalculateLoanScheduleCommand() { - return new CalculateLoanScheduleCommand(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod, interestRateFrequencyMethod, interestMethod, interestCalculationPeriodMethod, repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod, expectedDisbursementDate, repaymentsStartingFromDate, interestCalculatedFromDate); - } - - public Long getApplicantId() { - return this.applicantId; - } - - public void setApplicantId(final Long applicantId) { - this.applicantId = applicantId; + return new CalculateLoanScheduleCommand(currencyCode, digitsAfterDecimalValue, principalValue, interestRatePerPeriodValue, interestRateFrequencyType, interestType, interestCalculationPeriodType, repaymentEveryValue, repaymentFrequencyType, numberOfRepaymentsValue, amortizationType, + expectedDisbursementLocalDate, repaymentsStartingFromLocalDate, interestChargedFromLocalDate); } public Long getProductId() { @@ -104,14 +103,6 @@ public class SubmitLoanApplicationCommand { this.productId = productId; } - public LocalDate getSubmittedOnDate() { - return this.submittedOnDate; - } - - public void setSubmittedOnDate(final LocalDate submittedOnDate) { - this.submittedOnDate = submittedOnDate; - } - public String getSubmittedOnNote() { return this.submittedOnNote; } @@ -120,24 +111,6 @@ public class SubmitLoanApplicationCommand { this.submittedOnNote = submittedOnNote; } - public LocalDate getExpectedDisbursementDate() { - return this.expectedDisbursementDate; - } - - public void setExpectedDisbursementDate( - final LocalDate expectedDisbursementDate) { - this.expectedDisbursementDate = expectedDisbursementDate; - } - - public LocalDate getRepaymentsStartingFromDate() { - return this.repaymentsStartingFromDate; - } - - public void setRepaymentsStartingFromDate( - final LocalDate repaymentsStartingFromDate) { - this.repaymentsStartingFromDate = repaymentsStartingFromDate; - } - public LoanSchedule getLoanSchedule() { return this.loanSchedule; } @@ -162,130 +135,6 @@ public class SubmitLoanApplicationCommand { this.currencyCode = currencyCode; } - public Integer getDigitsAfterDecimal() { - return digitsAfterDecimal; - } - - public void setDigitsAfterDecimal(Integer digitsAfterDecimal) { - this.digitsAfterDecimal = digitsAfterDecimal; - } - - public BigDecimal getPrincipal() { - return principal; - } - - public void setPrincipal(BigDecimal principal) { - this.principal = principal; - } - - public BigDecimal getInArrearsToleranceAmount() { - return inArrearsToleranceAmount; - } - - public void setInArrearsToleranceAmount(BigDecimal inArrearsToleranceAmount) { - this.inArrearsToleranceAmount = inArrearsToleranceAmount; - } - - public Integer getRepaymentEvery() { - return repaymentEvery; - } - - public void setRepaymentEvery(Integer repaymentEvery) { - this.repaymentEvery = repaymentEvery; - } - - public Integer getRepaymentFrequency() { - return repaymentFrequency; - } - - public void setRepaymentFrequency(Integer repaymentFrequency) { - this.repaymentFrequency = repaymentFrequency; - } - - public Integer getNumberOfRepayments() { - return numberOfRepayments; - } - - public void setNumberOfRepayments(Integer numberOfRepayments) { - this.numberOfRepayments = numberOfRepayments; - } - - public BigDecimal getInterestRatePerPeriod() { - return interestRatePerPeriod; - } - - public void setInterestRatePerPeriod(BigDecimal interestRatePerPeriod) { - this.interestRatePerPeriod = interestRatePerPeriod; - } - - public Integer getInterestRateFrequencyMethod() { - return interestRateFrequencyMethod; - } - - public void setInterestRateFrequencyMethod(Integer interestRateFrequencyMethod) { - this.interestRateFrequencyMethod = interestRateFrequencyMethod; - } - - public Integer getAmortizationMethod() { - return amortizationMethod; - } - - public void setAmortizationMethod(Integer amortizationMethod) { - this.amortizationMethod = amortizationMethod; - } - - public Integer getInterestMethod() { - return interestMethod; - } - - public void setInterestMethod(Integer interestMethod) { - this.interestMethod = interestMethod; - } - - public Integer getInterestCalculationPeriodMethod() { - return interestCalculationPeriodMethod; - } - - public void setInterestCalculationPeriodMethod( - Integer interestCalculationPeriodMethod) { - this.interestCalculationPeriodMethod = interestCalculationPeriodMethod; - } - - public LocalDate getInterestCalculatedFromDate() { - return interestCalculatedFromDate; - } - - public void setInterestCalculatedFromDate(LocalDate interestCalculatedFromDate) { - this.interestCalculatedFromDate = interestCalculatedFromDate; - } - - public String getExpectedDisbursementDateFormatted() { - return expectedDisbursementDateFormatted; - } - - public void setExpectedDisbursementDateFormatted( - String expectedDisbursementDateFormatted) { - this.expectedDisbursementDateFormatted = expectedDisbursementDateFormatted; - } - - public String getRepaymentsStartingFromDateFormatted() { - return repaymentsStartingFromDateFormatted; - } - - public void setRepaymentsStartingFromDateFormatted( - String repaymentsStartingFromDateFormatted) { - this.repaymentsStartingFromDateFormatted = repaymentsStartingFromDateFormatted; - } - - public String getInterestCalculatedFromDateFormatted() { - return interestCalculatedFromDateFormatted; - } - - public void setInterestCalculatedFromDateFormatted( - String interestCalculatedFromDateFormatted) { - this.interestCalculatedFromDateFormatted = interestCalculatedFromDateFormatted; - } - public String getDateFormat() { return dateFormat; } @@ -294,37 +143,223 @@ public class SubmitLoanApplicationCommand { this.dateFormat = dateFormat; } - public String getSubmittedOnDateFormatted() { - return submittedOnDateFormatted; + public Long getClientId() { + return clientId; } - public void setSubmittedOnDateFormatted(String submittedOnDateFormatted) { - this.submittedOnDateFormatted = submittedOnDateFormatted; + public void setClientId(Long clientId) { + this.clientId = clientId; } - public String getPrincipalFormatted() { - return principalFormatted; + public String getLocale() { + return locale; } - public void setPrincipalFormatted(String principalFormatted) { - this.principalFormatted = principalFormatted; + public void setLocale(String locale) { + this.locale = locale; } - public String getInArrearsToleranceAmountFormatted() { - return inArrearsToleranceAmountFormatted; + public String getDigitsAfterDecimal() { + return digitsAfterDecimal; } - public void setInArrearsToleranceAmountFormatted( - String inArrearsToleranceAmountFormatted) { - this.inArrearsToleranceAmountFormatted = inArrearsToleranceAmountFormatted; + public void setDigitsAfterDecimal(String digitsAfterDecimal) { + this.digitsAfterDecimal = digitsAfterDecimal; } - public String getInterestRatePerPeriodFormatted() { - return interestRatePerPeriodFormatted; + public Integer getDigitsAfterDecimalValue() { + return digitsAfterDecimalValue; } - public void setInterestRatePerPeriodFormatted( - String interestRatePerPeriodFormatted) { - this.interestRatePerPeriodFormatted = interestRatePerPeriodFormatted; + public void setDigitsAfterDecimalValue(Integer digitsAfterDecimalValue) { + this.digitsAfterDecimalValue = digitsAfterDecimalValue; + } + + public BigDecimal getPrincipalValue() { + return principalValue; + } + + public void setPrincipalValue(BigDecimal principalValue) { + this.principalValue = principalValue; + } + + public String getPrincipal() { + return principal; + } + + public void setPrincipal(String principal) { + this.principal = principal; + } + + public BigDecimal getInArrearsToleranceValue() { + return inArrearsToleranceValue; + } + + public void setInArrearsToleranceValue(BigDecimal inArrearsToleranceValue) { + this.inArrearsToleranceValue = inArrearsToleranceValue; + } + + public String getInArrearsTolerance() { + return inArrearsTolerance; + } + + public void setInArrearsTolerance(String inArrearsTolerance) { + this.inArrearsTolerance = inArrearsTolerance; + } + + public String getNumberOfRepayments() { + return numberOfRepayments; + } + + public void setNumberOfRepayments(String numberOfRepayments) { + this.numberOfRepayments = numberOfRepayments; + } + + public Integer getNumberOfRepaymentsValue() { + return numberOfRepaymentsValue; + } + + public void setNumberOfRepaymentsValue(Integer numberOfRepaymentsValue) { + this.numberOfRepaymentsValue = numberOfRepaymentsValue; + } + + public String getRepaymentEvery() { + return repaymentEvery; + } + + public void setRepaymentEvery(String repaymentEvery) { + this.repaymentEvery = repaymentEvery; + } + + public Integer getRepaymentEveryValue() { + return repaymentEveryValue; + } + + public void setRepaymentEveryValue(Integer repaymentEveryValue) { + this.repaymentEveryValue = repaymentEveryValue; + } + + public String getInterestRatePerPeriod() { + return interestRatePerPeriod; + } + + public void setInterestRatePerPeriod(String interestRatePerPeriod) { + this.interestRatePerPeriod = interestRatePerPeriod; + } + + public BigDecimal getInterestRatePerPeriodValue() { + return interestRatePerPeriodValue; + } + + public void setInterestRatePerPeriodValue(BigDecimal interestRatePerPeriodValue) { + this.interestRatePerPeriodValue = interestRatePerPeriodValue; + } + + public Integer getRepaymentFrequencyType() { + return repaymentFrequencyType; + } + + public void setRepaymentFrequencyType(Integer repaymentFrequencyType) { + this.repaymentFrequencyType = repaymentFrequencyType; + } + + public Integer getInterestRateFrequencyType() { + return interestRateFrequencyType; + } + + public void setInterestRateFrequencyType(Integer interestRateFrequencyType) { + this.interestRateFrequencyType = interestRateFrequencyType; + } + + public Integer getAmortizationType() { + return amortizationType; + } + + public void setAmortizationType(Integer amortizationType) { + this.amortizationType = amortizationType; + } + + public Integer getInterestType() { + return interestType; + } + + public void setInterestType(Integer interestType) { + this.interestType = interestType; + } + + public Integer getInterestCalculationPeriodType() { + return interestCalculationPeriodType; + } + + public void setInterestCalculationPeriodType( + Integer interestCalculationPeriodType) { + this.interestCalculationPeriodType = interestCalculationPeriodType; + } + + public String getExpectedDisbursementDate() { + return expectedDisbursementDate; + } + + public void setExpectedDisbursementDate(String expectedDisbursementDate) { + this.expectedDisbursementDate = expectedDisbursementDate; + } + + public String getRepaymentsStartingFromDate() { + return repaymentsStartingFromDate; + } + + public void setRepaymentsStartingFromDate(String repaymentsStartingFromDate) { + this.repaymentsStartingFromDate = repaymentsStartingFromDate; + } + + public LocalDate getExpectedDisbursementLocalDate() { + return expectedDisbursementLocalDate; + } + + public void setExpectedDisbursementLocalDate( + LocalDate expectedDisbursementLocalDate) { + this.expectedDisbursementLocalDate = expectedDisbursementLocalDate; + } + + public LocalDate getRepaymentsStartingFromLocalDate() { + return repaymentsStartingFromLocalDate; + } + + public void setRepaymentsStartingFromLocalDate( + LocalDate repaymentsStartingFromLocalDate) { + this.repaymentsStartingFromLocalDate = repaymentsStartingFromLocalDate; + } + + public LocalDate getInterestChargedFromLocalDate() { + return interestChargedFromLocalDate; + } + + public void setInterestChargedFromLocalDate( + LocalDate interestChargedFromLocalDate) { + this.interestChargedFromLocalDate = interestChargedFromLocalDate; + } + + public String getSubmittedOnDate() { + return submittedOnDate; + } + + public void setSubmittedOnDate(String submittedOnDate) { + this.submittedOnDate = submittedOnDate; + } + + public LocalDate getSubmittedOnLocalDate() { + return submittedOnLocalDate; + } + + public void setSubmittedOnLocalDate(LocalDate submittedOnLocalDate) { + this.submittedOnLocalDate = submittedOnLocalDate; + } + + public String getInterestChargedFromDate() { + return interestChargedFromDate; + } + + public void setInterestChargedFromDate(String interestChargedFromDate) { + this.interestChargedFromDate = interestChargedFromDate; } } \ No newline at end of file diff --git a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/global-translations/messages.properties b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/global-translations/messages.properties index 686ed5e96..36ebd25f0 100644 --- a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/global-translations/messages.properties +++ b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/global-translations/messages.properties @@ -109,10 +109,6 @@ validation.msg.loan.transaction.id.is.invalid=Loan transaction identifier is inv validation.msg.loan.state.transition.date.cannot.be.blank=A date must be provided when transitioning the loan into this state. validation.msg.note.exceeds.max.length=The content of the note exceeds max length of 1000 characters. -validation.msg.loan.repayment.date.cannot.be.blank=The repayment date cannot be blank. -validation.msg.loan.repayment.must.be.greater.than.zero=The repayment amount must be a number greater than zero. -validation.msg.loan.adjustment.must.be.zero.or.greater=The repayment amount must be a number greater than or equal to zero. - # loan event and transactions screens label.loan.on=On: label.loan.action.note=Note: @@ -128,7 +124,6 @@ dialog.title.waive.loan=Waive outstanding amount label.loan.transaction.on=Repayment on: label.loan.transaction.amount=Amount: - tab.client.account.loan.details=Details tab.client.account.loan.schedule=Schedule tab.client.account.loan.repayments=Repayments @@ -211,7 +206,23 @@ form.label.loan.interest.charged.from=Interest charged from: form.label.loan.expected.disbursement.date.on=Expected disbursement on: form.label.loan.first.repayment.on=First repayment on: -validation.msg.loan.expectedDisbursementDate.method.cannot.be.blank=Expected disbursement on field cannot be blank. +validation.msg.loan.digitsAfterDecimal.cannot.be.blank=You must enter a number to represent number of digits after decimal to be supported for product. +validation.msg.loan.digitsAfterDecimal.is.not.within.expected.range=Decimal places must be a number between {1} and {2} inclusive. +validation.msg.loan.repaymentEvery.cannot.be.blank=Repaid every cannot be blank. +validation.msg.loan.repaymentEvery.not.greater.than.zero=Repaid every must be greater than 0. +validation.msg.loan.numberOfRepayments.cannot.be.blank=# of repayments cannot be blank. +validation.msg.loan.numberOfRepayments.not.greater.than.zero=# of repayments must be greater than 0. +validation.msg.loan.principal.cannot.be.blank=Loan amount cannot be blank. +validation.msg.loan.inArrearsTolerance.cannot.be.blank=Arrears tolerance cannot be blank. +validation.msg.loan.interestRatePerPeriod.cannot.be.blank=Nominal interest rate % cannot be blank. +validation.msg.loan.principal.not.greater.than.zero=Loan amount must be greater than zero. +validation.msg.loan.inArrearsTolerance.not.zero.or.greater=Arrears tolerance must be greater than or equal to zero. +validation.msg.loan.interest.rate.per.period.amount.cannot.be.negative=Nominal interest rate % cannot be negative. +validation.msg.loan.repayment.date.cannot.be.blank=The repayment date cannot be blank. +validation.msg.loan.repayment.must.be.greater.than.zero=The repayment amount must be a number greater than zero. +validation.msg.loan.adjustment.must.be.zero.or.greater=The repayment amount must be a number greater than or equal to zero. + +validation.msg.loan.expectedDisbursementDate.cannot.be.blank=Expected disbursement on field cannot be blank. validation.msg.loan.expectedDisbursementDate.cannot.be.after.first.repayment.date=Expected disbursement date cannot be after the first repayment date. validation.msg.loan.interestCalculatedFromDate.must.be.entered.when.using.repayments.startfrom.field=The date interest is to be calculated from cannot be left blank when a date is provided for when repayments start from. validation.msg.loan.submitted.on.date.cannot.be.blank=Submitted on date cannot be blank. diff --git a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/newloanapplication.jsp b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/newloanapplication.jsp index 8ab0642f7..9d9eb75ff 100644 --- a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/newloanapplication.jsp +++ b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/newloanapplication.jsp @@ -55,9 +55,28 @@ $(document).ready(function() { return false; } }, - globalDate: function(localDateAsISOString) { + globalDate: function(dateParts) { try { - if (localDateAsISOString === null) return ""; + + if (dateParts === null || dateParts === '') return ""; + + var year = dateParts[0]; + var month = parseInt(dateParts[1]) - 1; // month is zero indexed + var day = dateParts[2]; + + var d = new Date(); + d.setFullYear(year,month,day); + + return Globalize.format(d,"dd MMMM yyyy"); + } catch(e) { + return "??"; + } + }, + globalDateAsISOString: function(localDateAsISOString) { + + try { + if (localDateAsISOString === null || localDateAsISOString === '') return ""; + var dateParts = localDateAsISOString.split("-") var year = dateParts[0]; var month = parseInt(dateParts[1]) - 1; // month is zero indexed @@ -177,13 +196,13 @@ $(document).ready(function() { }; function calculateAnnualPercentageRate() { - var periodInterestRate = parseFloat($('#interestRatePerPeriodFormatted').val()); + var periodInterestRate = parseFloat($('#interestRatePerPeriod').val()); if (isNaN(periodInterestRate)) { periodInterestRate = 0; } var periodsInYear = 12; - var periodType = $('#interestRateFrequencyMethod').val(); + var periodType = $('#interestRateFrequencyType').val(); if (periodType == 3) { periodsInYear = 1; } else if (periodType == 2) { @@ -207,7 +226,6 @@ $(document).ready(function() { dataType: 'json', cache: false, beforeSend: function(xhr) { - console.log("base64: " + base64); xhr.setRequestHeader("Authorization", "Basic " + base64); }, success: function(data, textStatus, jqXHR) { @@ -228,7 +246,7 @@ $(document).ready(function() { calculateLoanSchedule(); // change detection - $('#principalFormatted').change(function() { + $('#principal').change(function() { calculateLoanSchedule(); }); @@ -236,7 +254,7 @@ $(document).ready(function() { calculateLoanSchedule(); }); - $('#repaymentFrequency').change(function() { + $('#repaymentFrequencyType').change(function() { calculateLoanSchedule(); }); @@ -244,37 +262,37 @@ $(document).ready(function() { calculateLoanSchedule(); }); - $('#expectedDisbursementDateFormatted').change(function() { + $('#expectedDisbursementDate').change(function() { calculateLoanSchedule(); }); - $('#repaymentsStartingFromDateFormatted').change(function() { + $('#repaymentsStartingFromDate').change(function() { calculateLoanSchedule(); }); - $('#interestRatePerPeriodFormatted').change(function() { + $('#interestRatePerPeriod').change(function() { calculateAnnualPercentageRate(); calculateLoanSchedule(); }); - $('#interestRateFrequencyMethod').change(function() { + $('#interestRateFrequencyType').change(function() { calculateAnnualPercentageRate(); calculateLoanSchedule(); }); - $('#amortizationMethod').change(function() { + $('#amortizationType').change(function() { calculateLoanSchedule(); }); - $('#interestMethod').change(function() { + $('#interestType').change(function() { calculateLoanSchedule(); }); - $('#interestCalculationPeriodMethod').change(function() { + $('#interestCalculationPeriodType').change(function() { calculateLoanSchedule(); }); - $('#interestCalculatedFromDateFormatted').change(function() { + $('#interestChargedFromDate').change(function() { calculateLoanSchedule(); }); @@ -302,7 +320,6 @@ $(document).ready(function() { var calculateLoanScheduleurl = baseApiUrl + 'loans?command=calculateLoanSchedule'; var newFormData = JSON.stringify($('#entityform').serializeObject()); - console.log(newFormData); var jqxhr2 = $.ajax({ url: calculateLoanScheduleurl, @@ -312,7 +329,6 @@ $(document).ready(function() { data: newFormData, cache: false, beforeSend: function(xhr) { - console.log("base64: " + base64); xhr.setRequestHeader("Authorization", "Basic " + base64); }, success: function(data, textStatus, jqXHR) { @@ -332,7 +348,6 @@ $(document).ready(function() { var submitLoanApplicationUrl = baseApiUrl + 'loans'; var newFormData = JSON.stringify($('#entityform').serializeObject()); - console.log(newFormData); var jqxhr2 = $.ajax({ url: submitLoanApplicationUrl, @@ -342,11 +357,9 @@ $(document).ready(function() { data: newFormData, cache: false, beforeSend: function(xhr) { - console.log("base64: " + base64); xhr.setRequestHeader("Authorization", "Basic " + base64); }, beforeSend: function(xhr) { - console.log("base64: " + base64); xhr.setRequestHeader("Authorization", "Basic " + base64); }, success: function(data, textStatus, jqXHR) { @@ -368,7 +381,6 @@ $(document).ready(function() { dataType: 'json', cache: false, beforeSend: function(xhr) { - console.log("base64: " + base64); xhr.setRequestHeader("Authorization", "Basic " + base64); }, success: function(data, textStatus, jqXHR) { diff --git a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/view-templates.jsp b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/view-templates.jsp index de37ba7ea..0bbc92bb5 100644 --- a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/view-templates.jsp +++ b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/view-templates.jsp @@ -29,7 +29,7 @@ {{#each scheduledLoanInstallments}}