I need to set up a staff absence tracking application. There is a requirement to show each day of absence for the current week and the next four weeks in a calendar grid. Also, to show each day of absence for user-defined dates.
There is also a requirement to show each absence ‘event’ (an ‘event’ will have a start and end date) in a list, one per ‘event’ e.g. an absence of 5 days would show as a single ‘absence event’.
There is also a requirement to have the ability to add notes to any of the ‘absence events’ or individual dates.
I’m thinking of implementing the database on the lines of ‘Order Header’ and ‘Order Details’.
I’m pretty sure this isn’t the best way though - as it seems a bit like a ‘programming solution’ to a data problem but I’m no database expert - here are my original thoughts, I’m sure it’s hacky and very sub-optimal:
ABSENCE HEADER TABLE - used to show each ‘absence event’
StaffID |EventID | From | To | Days | Type --------+--------+--------------+------------+-------+----------------- 1 | 1 | 2015-05-01 | 2015-05-06 | 6 | S 1 | 2 | 2015-07-14 | 2015-07-14 | 1 | H 1 | 3 | 2015-08-05 | 2015-08-05 | 1 | H ABSENCE DETAIL TABLE - used to show the details in the Calendar grid StaffID |EventID | Seq | Date --------+--------+-----+------------ 1 | 1 | 1 | 2015-05-01 1 | 1 | 2 | 2015-05-02 1 | 1 | 3 | 2015-05-01 1 | 1 | 4 | 2015-05-02 1 | 1 | 5 | 2015-05-01 1 | 1 | 6 | 2015-05-02 1 | 2 | 1 | 2015-07-14 1 | 3 | 1 | 2015-08-05 etc. ABSENCE NOTES TABLE StaffID |EventID | Seq | Notes --------+--------+-----+------------ 1 | 1 | 1 | Some descriptive text in here