use of org.mifos.config.persistence.ConfigurationPersistence in project head by mifos.
the class LoanBO method updateLoan.
public void updateLoan(final Date disbursementDate, final Short noOfInstallments, final Money loanAmount, final Integer businessActivityId) throws AccountException {
setLoanAmount(loanAmount);
setNoOfInstallments(noOfInstallments);
setDisbursementDate(disbursementDate);
setBusinessActivityId(businessActivityId);
MeetingBO meetingBO = (isIndividualLoan() ? this.getParentAccount().getLoanMeeting() : this.getLoanMeeting());
boolean isRepaymentIndepOfMeetingEnabled = new ConfigurationPersistence().isRepaymentIndepOfMeetingEnabled();
regeneratePaymentSchedule(isRepaymentIndepOfMeetingEnabled, meetingBO);
update();
}
use of org.mifos.config.persistence.ConfigurationPersistence in project head by mifos.
the class DecliningBalanceEqualPrincipalWithInterestGenerator method generateEqualInstallments.
@Override
public List<InstallmentPrincipalAndInterest> generateEqualInstallments(LoanInterestCalculationDetails loanInterestCalculationDetails) {
Money loanAmount = loanInterestCalculationDetails.getLoanAmount();
Integer numberOfInstallments = loanInterestCalculationDetails.getNumberOfInstallments();
Double interestFractionalRatePerInstallment = loanInterestCalculationDetails.getInterestFractionalRatePerInstallment();
GraceType graceType = loanInterestCalculationDetails.getGraceType();
Integer gracePeriodDuration = loanInterestCalculationDetails.getGracePeriodDuration();
//For M5193
int prorateValue = 0;
List<InstallmentPrincipalAndInterest> lstInstallmntPricplIntrst = null;
LocalDate disbursalDateInLocalDate = loanInterestCalculationDetails.getDisbursementDate();
DateTime disbursalDate = disbursalDateInLocalDate.toDateTimeAtStartOfDay();
List<DateTime> scheduledDates = loanInterestCalculationDetails.getLoanScheduleDates();
if (scheduledDates.size() > 2) {
//chek whether loanscheduledDates are there
DateTime firstRepaymentDay = scheduledDates.get(0);
long differenceOfTwoDatesinMilliseconds = (firstRepaymentDay.toDate().getTime() - disbursalDate.toDate().getTime());
long noOfDays = differenceOfTwoDatesinMilliseconds / (1000 * 60 * 60 * 24);
int noOfDaysBetweenFirstRepaymentDayAndDisbursalDate = (int) noOfDays;
DateTime secondRepaymentDay = scheduledDates.get(1);
long duration = (secondRepaymentDay.toDate().getTime() - firstRepaymentDay.toDate().getTime()) / (1000 * 60 * 60 * 24);
int noOfDaysInOneSchedule = (int) duration;
prorateValue = new ConfigurationPersistence().getConfigurationValueInteger(PRORATE_RULE);
if (prorateValue == 1)
lstInstallmntPricplIntrst = allDecliningEPIInstallments_v2(loanAmount, numberOfInstallments, interestFractionalRatePerInstallment, graceType, gracePeriodDuration, noOfDaysBetweenFirstRepaymentDayAndDisbursalDate, noOfDaysInOneSchedule);
}
if (prorateValue != 1) {
lstInstallmntPricplIntrst = allDecliningEPIInstallments_v2(loanAmount, numberOfInstallments, interestFractionalRatePerInstallment, graceType, gracePeriodDuration);
}
return lstInstallmntPricplIntrst;
}
use of org.mifos.config.persistence.ConfigurationPersistence in project head by mifos.
the class AccountingRules method getCurrencies.
/**
*
* Gets the List of currencies configured to use in Mifos,
* the first element will be the default currency.
*
* @return List of currencies
*/
public static LinkedList<MifosCurrency> getCurrencies() {
if (currencies.size() == 0) {
currencies.add(AccountingRules.getMifosCurrency(new ConfigurationPersistence()));
ConfigurationPersistence configurationPersistence = new ConfigurationPersistence();
for (String currencyCode : AccountingRules.getAdditionalCurrencyCodes()) {
currencies.add(getMifosCurrency(currencyCode, configurationPersistence));
}
}
return currencies;
}
Aggregations