use of org.mifos.config.FiscalCalendarRules in project head by mifos.
the class TestObjectFactory method getMeetingDates.
public static List<Date> getMeetingDates(short officeId, final MeetingBO meeting, final int occurrences) {
List<Days> workingDays = new FiscalCalendarRules().getWorkingDaysAsJodaTimeDays();
List<Holiday> upcomingHolidays = ApplicationContextProvider.getBean(HolidayDao.class).findAllHolidaysThisYearAndNext(officeId);
ScheduledEvent scheduledEvent = ScheduledEventFactory.createScheduledEventFrom(meeting);
DateTime meetingStartDate = new DateTime(meeting.getMeetingStartDate());
ScheduledDateGeneration dateGeneration = new HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration(workingDays, upcomingHolidays);
List<DateTime> allDates = dateGeneration.generateScheduledDates(occurrences, meetingStartDate, scheduledEvent, false);
List<Date> dates = new ArrayList<Date>();
for (DateTime dateTime : allDates) {
dates.add(dateTime.toDate());
}
return dates;
}
use of org.mifos.config.FiscalCalendarRules in project head by mifos.
the class ConfigurationInitializer method setFiscalStartOfWeek.
private void setFiscalStartOfWeek(Map<Key, Object> officeConfigMap) throws SystemException, ApplicationException {
Short id = new FiscalCalendarRules().getStartOfWeek();
officeConfigMap.put(new Key(getHeadOffice().getOfficeId(), ConfigConstants.FISCAL_START_OF_WEEK), id);
}
use of org.mifos.config.FiscalCalendarRules in project head by mifos.
the class AccountBO method getInstallmentDates.
/**
* @deprecated - used to create installment dates based on 'loan meeting' and working das, holidays, moratoria etc
*
* better to pull capability of creating 'installments' out of loan into something more reuseable and isolated
*/
@Deprecated
public final List<InstallmentDate> getInstallmentDates(final MeetingBO meeting, final Short noOfInstallments, final Short installmentToSkip, final boolean isRepaymentIndepOfMeetingEnabled, final boolean adjustForHolidays) {
logger.debug("Generating intallment dates");
List<InstallmentDate> dueInstallmentDates = new ArrayList<InstallmentDate>();
if (noOfInstallments > 0) {
List<Days> workingDays = new FiscalCalendarRules().getWorkingDaysAsJodaTimeDays();
List<Holiday> holidays = new ArrayList<Holiday>();
DateTime startFromMeetingDate = new DateTime(meeting.getMeetingStartDate());
if (adjustForHolidays) {
HolidayDao holidayDao = ApplicationContextProvider.getBean(HolidayDao.class);
holidays = holidayDao.findAllHolidaysFromDateAndNext(getOffice().getOfficeId(), startFromMeetingDate.toLocalDate().toString());
}
final int occurrences = noOfInstallments + installmentToSkip;
ScheduledEvent scheduledEvent = ScheduledEventFactory.createScheduledEventFrom(meeting);
ScheduledDateGeneration dateGeneration = new HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration(workingDays, holidays);
List<Date> dueDates = new ArrayList<Date>();
// FIXME - keithw - this whole area of installment creation should be pulled out of domain
DateTime startFromDayAfterAssignedMeetingDateRatherThanSkippingInstallments = startFromMeetingDate;
if (this.isLoanAccount()) {
// ensure loans that are created or disbursed on a meeting date start on next valid meeting date and not todays meeting
// ensure loans that are created or disbursed before a meeting date start on next valid meeting date
startFromDayAfterAssignedMeetingDateRatherThanSkippingInstallments = startFromMeetingDate.plusDays(1);
}
List<DateTime> installmentDates = dateGeneration.generateScheduledDates(occurrences, startFromDayAfterAssignedMeetingDateRatherThanSkippingInstallments, scheduledEvent, false);
for (DateTime installmentDate : installmentDates) {
dueDates.add(installmentDate.toDate());
}
dueInstallmentDates = createInstallmentDates(installmentToSkip, dueDates);
}
return dueInstallmentDates;
}
use of org.mifos.config.FiscalCalendarRules in project head by mifos.
the class MeetingAction method getLocalizedWorkingDays.
private List<WeekDay> getLocalizedWorkingDays() {
List<WeekDay> workingDays = new FiscalCalendarRules().getWorkingDays();
for (WeekDay workDay : workingDays) {
String weekdayName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(workDay.getPropertiesKey());
workDay.setWeekdayName(weekdayName);
}
return workingDays;
}
use of org.mifos.config.FiscalCalendarRules in project head by mifos.
the class ViewOrganizationSettingsServiceFacadeWebTier method getWorkingDays.
private String getWorkingDays() {
List<WeekDay> workDaysList = new FiscalCalendarRules().getWorkingDays();
List<String> workDayNames = new ArrayList<String>();
for (WeekDay workDay : workDaysList) {
String weekdayName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(workDay.getPropertiesKey());
workDay.setWeekdayName(weekdayName);
workDayNames.add(workDay.getName());
}
return StringUtils.join(workDayNames, DELIMITER);
}
Aggregations