if (workDaySheet.getWorkSchedule() != null && !isDayHoliday) {
if (workDaySheet.getWorkSchedule() != null && !isDayHoliday && workDaySheet.getWorkSchedule().getWorkScheduleType().getMandatoryClocking()) {
    public WorkDaySheet calculateDailyBalance(WorkDaySheet workDaySheet, boolean isDayHoliday) {        if (workDaySheet.getWorkSchedule() != null && !isDayHoliday) {            List<Leave> dayOccurrences = getLeavesByType(workDaySheet.getLeaves(),                    JustificationType.OCCURRENCE);            if (dayOccurrences.isEmpty()) {                List<Leave> timeLeaves = getLeavesByType(workDaySheet.getLeaves(),                        JustificationType.TIME);                List<Leave> balanceLeaves = getLeavesByType(workDaySheet.getLeaves(),                        JustificationType.BALANCE);                if (!workDaySheet.getAssiduousnessRecords().isEmpty() || !timeLeaves.isEmpty()) {                    Timeline timeline = getTimeline(workDaySheet, timeLeaves);                    workDaySheet = workDaySheet.getWorkSchedule().calculateWorkingPeriods(workDaySheet,                            timeline, timeLeaves);                } else {                    workDaySheet.setBalanceTime(Duration.ZERO.minus(                            workDaySheet.getWorkSchedule().getWorkScheduleType().getNormalWorkPeriod()                                    .getWorkPeriodDuration()).toPeriod());                    if (workDaySheet.getWorkSchedule().getWorkScheduleType().getFixedWorkPeriod() != null) {                        workDaySheet.setUnjustifiedTime(workDaySheet.getWorkSchedule()                                .getWorkScheduleType().getFixedWorkPeriod().getWorkPeriodDuration());                    }                    if (balanceLeaves.isEmpty()) {                        workDaySheet.setNotes(workDaySheet.getNotes().concat("FALTA"));                    }                }                workDaySheet.discountBalanceLeaveInFixedPeriod(balanceLeaves);            }        }        // TODO remove comment in 2007        // else {        // if (!workDaySheet.getAssiduousnessRecords().isEmpty()) {        // final Timeline timeline = new Timeline(day);        // Iterator<AttributeType> attributesIt = DomainConstants.WORKED_ATTRIBUTES.getAttributes()        // .iterator();        // timeline.plotListInTimeline(workDaySheet.getAssiduousnessRecords(), workDaySheet        // .getLeaves(), attributesIt, day);        // Duration worked = timeline.calculateWorkPeriodDuration(null, timeline.getTimePoints()        // .iterator().next(), new TimePoint(defaultStartWorkDay, AttributeType.NULL),        // new TimePoint(defaultEndWorkDay, AttributeType.NULL), null);        // Duration weeklyRestDuration = worked;        // if (worked.isLongerThan(normalWorkDayDuration)) {        // weeklyRestDuration = normalWorkDayDuration;        // }        // final WeekDay dayOfWeek = WeekDay.fromJodaTimeToWeekDay(day.toDateTimeAtMidnight());        // if (dayOfWeek.equals(WeekDay.SATURDAY) || isDayHoliday) {        // workDaySheet.setComplementaryWeeklyRest(weeklyRestDuration);        // } else if (dayOfWeek.equals(WeekDay.SUNDAY)) {        // workDaySheet.setWeeklyRest(weeklyRestDuration);        // }        // workDaySheet.setBalanceTime(worked.toPeriod());        // }        // }        return workDaySheet;    }