Our employees have an interface to enter their vacation days. The vacation dates are stored in the database as one row per day, minus the weekend days. I'm trying to create a report that will show the starting and ending dates for each employee. Note: Each employee can have muliple vacation periods and the data in the database only records Monday - Friday.
Database sample data:
VacationDays table (contains EmployeeID and their DayOff)
[U]EID DayOff .[/U]
1 05/03/2010
1 05/04/2010
1 05/05/2010
1 05/06/2010
1 05/07/2010
1 05/10/2010
1 05/24/2010
1 05/25/2010
1 05/26/2010
2 05/21/2010
2 05/24/2010
2 05/25/2010
2 05/26/2010
3 05/12/2010
3 05/13/2010
4 05/27/2010
4 05/28/2010
4 05/31/2010
4 06/01/2010
4 06/02/2010
Desired output:
[U]Employee VacationPeriod .[/U]
John 05/03/2010 - 05/10/2010
John 05/24/2010 - 05/26/2010
Jane 05/21/2010 - 05/26/2010
Matt 05/12/2010 - 05/13/2010
Carl 05/27/2010 - 06/02/2010
I'm sure I'm going to have to loop through the records for each employee and find the start date and the end date by looking for a break in days that are not Saturday or Sunday.