List<DailyBalance> dailyBalanceList = new ArrayList<DailyBalance>(); List<Schedule> scheduleList = getSchedulesWithInterval(interval);  for (YearMonthDay date = interval.getStartDate(); isDateInInterval(date, interval) ; date = date.plusDays(1)) {  for (Schedule schedule: scheduleList) { WorkSchedule workSchedule = schedule.workScheduleWithDate(date); DailyBalance dailyBalance = new DailyBalance(date, workSchedule); if (workSchedule != null) { System.out.println("horario:" + workSchedule.getWorkScheduleType().getAcronym()); dailyBalance.setWorkSchedule(workSchedule); List<AssiduousnessRecord> clockingList = clockingsWithDate(date); List<Leave> leaveList = leavesWithDate(date);       dailyBalance = calculateDailyBalance(date, workSchedule, clockingList, leaveList); dailyBalanceList.add(dailyBalance); } else {   } } } return dailyBalanceList;
List<DailyBalance> dailyBalanceList = new ArrayList<DailyBalance>(); List<Schedule> scheduleList = getSchedulesWithInterval(interval);   for (YearMonthDay date = interval.getStartDate(); isDateInInterval(date, interval); date = date .plusDays(1)) {   for (Schedule schedule : scheduleList) { WorkSchedule workSchedule = schedule.workScheduleWithDate(date);   DailyBalance dailyBalance = new DailyBalance(date, workSchedule); if (workSchedule != null) { System.out.println("horario:" + workSchedule.getWorkScheduleType().getAcronym()); dailyBalance.setWorkSchedule(workSchedule);               dailyBalance = calculateDailyBalance(date); dailyBalanceList.add(dailyBalance); } else {   } } } return dailyBalanceList;
    public List calculateIntervalBalance(DateInterval interval) {        System.out.println("Calculate interval balance");    		List<DailyBalance> dailyBalanceList = new ArrayList<DailyBalance>();    		List<Schedule> scheduleList = getSchedulesWithInterval(interval); // todos os Schedules dentro do intervalo validInterval    		// para cada dia do intervalo ver q horario esta definido nesse dia    		for (YearMonthDay date = interval.getStartDate(); isDateInInterval(date, interval) ; date = date.plusDays(1)) {    			// percorrer os schedules (tipicamente ha' 1 mas pode haver varios...)    			for (Schedule schedule: scheduleList) { // para cada schedule...    				WorkSchedule workSchedule = schedule.workScheduleWithDate(date); // ...ve que Work Schedule esta' definido nesse dia    				DailyBalance dailyBalance = new DailyBalance(date, workSchedule);    				if (workSchedule != null) { // ha horario neste dia    					System.out.println("horario:" + workSchedule.getWorkScheduleType().getAcronym());    					dailyBalance.setWorkSchedule(workSchedule);    					List<AssiduousnessRecord> clockingList = clockingsWithDate(date); // passar-lhe a assiduidade e ir buscar os missing clockings    					List<Leave> leaveList = leavesWithDate(date);//    					if (clockingList.size() > 0) {//    						dailyBalance.setClockingList(clockingList);//    					}//    					if (leaveList.size() > 0) {//    					    dailyBalance.setLeaveList(leaveList);//    					}    					dailyBalance = calculateDailyBalance(date, workSchedule, clockingList, leaveList);    					dailyBalanceList.add(dailyBalance);    				} else { // nao ha horario neste dia => sabado ou domingo     					// neste caso devia ter info de DSC e DS?    					// TODO ver esta situacao    				}    			}    		}    		return dailyBalanceList;    }