List of usage examples for org.joda.time LocalDate toDateTimeAtStartOfDay
public DateTime toDateTimeAtStartOfDay()
From source file:org.libreplan.web.users.dashboard.PersonalTimesheetModel.java
License:Open Source License
private WorkReportLine createWorkReportLine(OrderElement orderElement, LocalDate date) { WorkReportLine workReportLine = WorkReportLine.create(workReport); workReportLine.setCodeAutogenerated(true); workReportLine.setOrderElement(orderElement); workReportLine.setDate(date.toDateTimeAtStartOfDay().toDate()); workReportLine.setTypeOfWorkHours(getTypeOfWorkHours()); workReportLine.setEffort(EffortDuration.zero()); return workReportLine; }
From source file:org.libreplan.web.works.WorkModel.java
License:Open Source License
private WorkReportLine createWorkReportLine(WorkReport workReport, OrderElement orderElement, LocalDate date) { WorkReportLine workReportLine = WorkReportLine.create(workReport); workReportLine.setCodeAutogenerated(true); workReportLine.setOrderElement(orderElement); workReportLine.setDate(date.toDateTimeAtStartOfDay().toDate()); workReportLine//from w w w. ja va 2 s .co m .setTypeOfWorkHours(configurationDAO.getConfiguration().getPersonalTimesheetsTypeOfWorkHours()); workReportLine.setEffort(EffortDuration.zero()); return workReportLine; }
From source file:org.mifos.accounts.loan.business.LoanBO.java
License:Open Source License
/** * regenerate installments starting from nextInstallmentId *//*from www. j ava 2s.c o m*/ @Override protected void regenerateFutureInstallments(final AccountActionDateEntity nextInstallment, final List<Days> workingDays, final List<Holiday> holidays) throws AccountException { int numberOfInstallmentsToGenerate = getLastInstallmentId(); MeetingBO meeting = buildLoanMeeting(customer.getCustomerMeeting().getMeeting(), getLoanMeeting(), getLoanMeeting().getMeetingStartDate()); ScheduledEvent scheduledEvent = ScheduledEventFactory.createScheduledEventFrom(meeting); LocalDate currentDate = new LocalDate(); LocalDate thisIntervalStartDate = meeting.startDateForMeetingInterval(currentDate); LocalDate nextMatchingDate = new LocalDate( scheduledEvent.nextEventDateAfter(thisIntervalStartDate.toDateTimeAtStartOfDay())); DateTime futureIntervalStartDate = meeting.startDateForMeetingInterval(nextMatchingDate) .toDateTimeAtStartOfDay(); ScheduledDateGeneration dateGeneration = new HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration( workingDays, holidays); List<DateTime> meetingDates = dateGeneration.generateScheduledDates(numberOfInstallmentsToGenerate, futureIntervalStartDate, scheduledEvent, false); updateSchedule(nextInstallment.getInstallmentId(), meetingDates); }
From source file:org.mifos.accounts.savings.business.SavingsBO.java
License:Open Source License
public static SavingsAccountActivationDetail determineAccountActivationDetails(CustomerBO customer, SavingsOfferingBO savingsProduct, Money recommendedOrMandatoryAmount, AccountState savingsAccountState, CalendarEvent calendarEvents, List<CustomerBO> activeAndOnHoldClients) { List<AccountActionDateEntity> scheduledPayments = new ArrayList<AccountActionDateEntity>(); LocalDate activationDate = new LocalDate(); LocalDate nextInterestPostingDate = new LocalDate(); if (savingsAccountState.isActiveSavingsAccountState()) { activationDate = new LocalDate(); ScheduledEvent scheduledEvent = ScheduledEventFactory .createScheduledEventFrom(customer.getCustomerMeetingValue()); ScheduledDateGeneration dateGeneration = new HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration( calendarEvents.getWorkingDays(), calendarEvents.getHolidays()); for (CustomerBO client : activeAndOnHoldClients) { List<DateTime> depositDates = dateGeneration.generateScheduledDates(10, activationDate.toDateTimeAtStartOfDay(), scheduledEvent, false); short installmentNumber = 1; for (DateTime date : depositDates) { java.sql.Date depositDueDate = new java.sql.Date(date.toDate().getTime()); AccountActionDateEntity scheduledSavingsDeposit = new SavingsScheduleEntity(client, installmentNumber, depositDueDate, PaymentStatus.UNPAID, recommendedOrMandatoryAmount, savingsProduct.getCurrency()); scheduledPayments.add(scheduledSavingsDeposit); }/*from w w w.j ava 2 s .c o m*/ } InterestScheduledEvent interestPostingEvent = new SavingsInterestScheduledEventFactory() .createScheduledEventFrom(savingsProduct.getFreqOfPostIntcalc().getMeeting()); nextInterestPostingDate = interestPostingEvent.nextMatchingDateAfter(new LocalDate(startOfFiscalYear()), activationDate); } return new SavingsAccountActivationDetail(activationDate, nextInterestPostingDate, scheduledPayments); }
From source file:org.mifos.accounts.savings.business.SavingsBO.java
License:Open Source License
public static SavingsAccountActivationDetail determineAccountActivationDetails(CustomerBO customer, SavingsOfferingBO savingsProduct, Money recommendedOrMandatoryAmount, AccountState savingsAccountState, CalendarEvent calendarEvents, LocalDate activationDate) { List<AccountActionDateEntity> scheduledPayments = new ArrayList<AccountActionDateEntity>(); LocalDate nextInterestPostingDate = new LocalDate(); if (savingsAccountState.isActiveSavingsAccountState()) { ScheduledEvent scheduledEvent = ScheduledEventFactory .createScheduledEventFrom(customer.getCustomerMeetingValue()); ScheduledDateGeneration dateGeneration = new HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration( calendarEvents.getWorkingDays(), calendarEvents.getHolidays()); List<DateTime> depositDates = dateGeneration.generateScheduledDates(10, activationDate.toDateTimeAtStartOfDay(), scheduledEvent, false); short installmentNumber = 1; for (DateTime date : depositDates) { java.sql.Date depositDueDate = new java.sql.Date(date.toDate().getTime()); AccountActionDateEntity scheduledSavingsDeposit = new SavingsScheduleEntity(customer, installmentNumber, depositDueDate, PaymentStatus.UNPAID, recommendedOrMandatoryAmount, savingsProduct.getCurrency()); scheduledPayments.add(scheduledSavingsDeposit); }/* w w w . j ava 2 s .co m*/ InterestScheduledEvent interestPostingEvent = new SavingsInterestScheduledEventFactory() .createScheduledEventFrom(savingsProduct.getFreqOfPostIntcalc().getMeeting()); nextInterestPostingDate = interestPostingEvent.nextMatchingDateAfter(new LocalDate(startOfFiscalYear()), activationDate); } return new SavingsAccountActivationDetail(activationDate, nextInterestPostingDate, scheduledPayments); }
From source file:org.mifos.accounts.savings.business.SavingsBO.java
License:Open Source License
public static SavingsAccountActivationDetail generateAccountActivationDetails(CustomerBO customer, SavingsOfferingBO savingsProduct, Money recommendedOrMandatoryAmount, AccountState savingsAccountState, CalendarEvent calendarEvents, LocalDate activationDate) { List<AccountActionDateEntity> scheduledPayments = new ArrayList<AccountActionDateEntity>(); LocalDate nextInterestPostingDate = new LocalDate(); if (savingsAccountState.isActiveSavingsAccountState()) { ScheduledEvent scheduledEvent = ScheduledEventFactory .createScheduledEventFrom(customer.getCustomerMeetingValue()); ScheduledDateGeneration dateGeneration = new HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration( calendarEvents.getWorkingDays(), calendarEvents.getHolidays()); List<DateTime> depositDates = dateGeneration.generateScheduledDates(10, activationDate.toDateTimeAtStartOfDay(), scheduledEvent, false); short installmentNumber = 0; for (DateTime date : depositDates) { java.sql.Date depositDueDate = new java.sql.Date(date.toDate().getTime()); AccountActionDateEntity scheduledSavingsDeposit = new SavingsScheduleEntity(customer, installmentNumber++, depositDueDate, PaymentStatus.UNPAID, recommendedOrMandatoryAmount, savingsProduct.getCurrency()); scheduledPayments.add(scheduledSavingsDeposit); }//from ww w . j a v a 2 s .c o m InterestScheduledEvent interestPostingEvent = new SavingsInterestScheduledEventFactory() .createScheduledEventFrom(savingsProduct.getFreqOfPostIntcalc().getMeeting()); nextInterestPostingDate = interestPostingEvent.nextMatchingDateAfter(new LocalDate(startOfFiscalYear()), activationDate); } return new SavingsAccountActivationDetail(activationDate, nextInterestPostingDate, scheduledPayments); }
From source file:org.mifos.accounts.savings.business.SavingsBO.java
License:Open Source License
@Override protected void regenerateFutureInstallments(final AccountActionDateEntity nextInstallment, final List<Days> workingDays, final List<Holiday> holidays) throws AccountException { MeetingBO customerMeeting = getCustomer().getCustomerMeetingValue(); ScheduledEvent scheduledEvent = ScheduledEventFactory.createScheduledEventFrom(customerMeeting); LocalDate currentDate = new LocalDate(); LocalDate thisIntervalStartDate = customerMeeting.startDateForMeetingInterval(currentDate); LocalDate nextMatchingDate = new LocalDate( scheduledEvent.nextEventDateAfter(thisIntervalStartDate.toDateTimeAtStartOfDay())); DateTime futureIntervalStartDate = customerMeeting.startDateForMeetingInterval(nextMatchingDate) .toDateTimeAtStartOfDay();/* www .j a va 2 s . co m*/ ScheduledDateGeneration dateGeneration = new HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration( workingDays, holidays); int numberOfInstallmentsToGenerate = getLastInstallmentId(); List<DateTime> meetingDates = dateGeneration.generateScheduledDates(numberOfInstallmentsToGenerate, futureIntervalStartDate, scheduledEvent, false); if (getCustomer().getCustomerLevel().getId().equals(CustomerLevel.CLIENT.getValue()) || getCustomer() .getCustomerLevel().getId().equals(CustomerLevel.GROUP.getValue()) && getRecommendedAmntUnit().getId().equals(RecommendedAmountUnit.COMPLETE_GROUP.getValue())) { updateSchedule(nextInstallment.getInstallmentId(), meetingDates); } else { List<CustomerBO> children; try { children = getCustomer().getChildren(CustomerLevel.CLIENT, ChildrenStateType.OTHER_THAN_CLOSED); } catch (CustomerException ce) { throw new AccountException(ce); } updateSavingsSchedule(nextInstallment.getInstallmentId(), meetingDates, children); } }
From source file:org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent.java
License:Open Source License
private LocalDate lastDayOfMonthFor(LocalDate date) { return new LocalDate(date.toDateTimeAtStartOfDay().dayOfMonth().withMaximumValue()); }
From source file:org.mifos.customers.business.CustomerAccountBO.java
License:Open Source License
@Override protected void regenerateFutureInstallments(final AccountActionDateEntity nextInstallment, final List<Days> workingDays, final List<Holiday> holidays) throws AccountException { int numberOfInstallmentsToGenerate = getLastInstallmentId(); MeetingBO meeting = getMeetingForAccount(); ScheduledEvent scheduledEvent = ScheduledEventFactory.createScheduledEventFrom(meeting); LocalDate currentDate = new LocalDate(); LocalDate thisIntervalStartDate = meeting.startDateForMeetingInterval(currentDate); LocalDate nextMatchingDate = new LocalDate( scheduledEvent.nextEventDateAfter(thisIntervalStartDate.toDateTimeAtStartOfDay())); DateTime futureIntervalStartDate = meeting.startDateForMeetingInterval(nextMatchingDate) .toDateTimeAtStartOfDay();// w ww. j a v a2 s .c o m ScheduledDateGeneration dateGeneration = new HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration( workingDays, holidays); List<DateTime> meetingDates = dateGeneration.generateScheduledDates(numberOfInstallmentsToGenerate, futureIntervalStartDate, scheduledEvent, true); updateSchedule(nextInstallment.getInstallmentId(), meetingDates); }
From source file:org.mifos.domain.builders.MeetingBuilder.java
License:Open Source License
public MeetingBO build() { LocalDate localStartDate = new LocalDate(startDate); final MeetingBO meeting = new MeetingBO(meetingType, localStartDate.toDateTimeAtStartOfDay().toDate(), meetingLocation);/*from ww w. ja v a 2s . c o m*/ final MeetingDetailsEntity meetingDetailsEntity = new MeetingDetailsEntity(meeting, recurrenceType, recurAfter); final MeetingRecurrenceEntity meetingRecurrenceEntity = new MeetingRecurrenceEntity(weekDay, meetingDetailsEntity); meetingRecurrenceEntity.setDayNumber(dayNumber); if (weekRank != null) { meetingRecurrenceEntity.setRankOfDays(weekRank); } meetingDetailsEntity.setMeetingRecurrence(meetingRecurrenceEntity); meeting.setMeetingDetails(meetingDetailsEntity); return meeting; }