Duration normalWorkPeriodBalance = getWorkedOnNormalWorkPeriod().minus(getWorkSchedule().getWorkScheduleType().getNormalWorkPeriod().getWorkPeriodDuration()); Duration normalWorkPeriodAbsence = Duration.ZERO.minus(this.getWorkSchedule().getWorkScheduleType().getNormalWorkPeriod().getWorkPeriodDuration());
Period normalWorkedPeriod = getWorkedOnNormalWorkPeriod().toPeriod(); normalWorkedPeriod = normalWorkedPeriod.minusSeconds(normalWorkedPeriod.getSeconds()); Duration normalWorkPeriodBalance = new Duration(normalWorkedPeriod.toDurationFrom(new DateTime() .toDateMidnight())).minus(getWorkSchedule().getWorkScheduleType().getNormalWorkPeriod() .getWorkPeriodDuration()); Duration normalWorkPeriodAbsence = Duration.ZERO.minus(this.getWorkSchedule() .getWorkScheduleType().getNormalWorkPeriod().getWorkPeriodDuration());
    public Duration getNormalWorkPeriodBalance() {        Duration normalWorkPeriodBalance = getWorkedOnNormalWorkPeriod().minus(getWorkSchedule().getWorkScheduleType().getNormalWorkPeriod().getWorkPeriodDuration());        Duration normalWorkPeriodAbsence = Duration.ZERO.minus(this.getWorkSchedule().getWorkScheduleType().getNormalWorkPeriod().getWorkPeriodDuration());//        System.out.println("absence: " + normalWorkPeriodAbsence.toPeriod().toString());        if (normalWorkPeriodBalance.isShorterThan(normalWorkPeriodAbsence)) {            System.out.println(normalWorkPeriodBalance.toPeriod().toString() + " e menor que " + normalWorkPeriodAbsence.toPeriod().toString());            return normalWorkPeriodAbsence;        } else {//            System.out.println("wnwp" + getWorkedOnNormalWorkPeriod());            return getWorkedOnNormalWorkPeriod().minus(getWorkSchedule().getWorkScheduleType().getNormalWorkPeriod().getWorkPeriodDuration());        }    }