Search in sources :

Example 1 with EventsPlanningLine

use of com.axelor.apps.base.db.EventsPlanningLine in project axelor-open-suite by axelor.

the class PublicHolidayHrService method getImposedDayNumber.

public int getImposedDayNumber(Employee employee, LocalDate startDate, LocalDate endDate) {
    EventsPlanning imposedDays = employee.getImposedDayEventsPlanning();
    if (imposedDays == null || imposedDays.getEventsPlanningLineList() == null || imposedDays.getEventsPlanningLineList().isEmpty()) {
        return 0;
    }
    List<EventsPlanningLine> imposedDayList = eventsPlanningLineRepo.all().filter("self.eventsPlanning = ?1 AND self.date BETWEEN ?2 AND ?3", imposedDays, startDate, endDate).fetch();
    return imposedDayList.size();
}
Also used : EventsPlanning(com.axelor.apps.base.db.EventsPlanning) EventsPlanningLine(com.axelor.apps.base.db.EventsPlanningLine)

Example 2 with EventsPlanningLine

use of com.axelor.apps.base.db.EventsPlanningLine in project axelor-open-suite by axelor.

the class PublicHolidayService method computePublicHolidayDays.

public BigDecimal computePublicHolidayDays(LocalDate fromDate, LocalDate toDate, WeeklyPlanning weeklyPlanning, EventsPlanning publicHolidayPlanning) {
    BigDecimal publicHolidayDays = BigDecimal.ZERO;
    List<EventsPlanningLine> publicHolidayDayList = eventsPlanningLineRepo.all().filter("self.eventsPlanning = ?1 AND self.date BETWEEN ?2 AND ?3", publicHolidayPlanning, fromDate, toDate).fetch();
    for (EventsPlanningLine publicHolidayDay : publicHolidayDayList) {
        publicHolidayDays = publicHolidayDays.add(BigDecimal.valueOf(weeklyPlanningService.getWorkingDayValueInDays(weeklyPlanning, publicHolidayDay.getDate())));
    }
    return publicHolidayDays;
}
Also used : EventsPlanningLine(com.axelor.apps.base.db.EventsPlanningLine) BigDecimal(java.math.BigDecimal)

Aggregations

EventsPlanningLine (com.axelor.apps.base.db.EventsPlanningLine)2 EventsPlanning (com.axelor.apps.base.db.EventsPlanning)1 BigDecimal (java.math.BigDecimal)1