Borrowing from Eric Petroel and mdma:
Employee
- EmployeeID (PK)
- EmployeeName
- Other_fields
Project
- ProjectID (PK)
- ProjectName
- Other_fields
WorkSegment
- WorkSegmentID (PK)
- ProjectID (IX1)
- EmployeeID (IX2)
- Date (IX1, IX2)
- StartTime
- EndTime
- PayrollCycleID (FK)
The first index of the WorkSegment is ProjectID, Date. The second WorkSegment index is EmployeeID, Date. These indexes are not unique. This means that a person can work on a project more than once in one day. Indexes allow you to report hours of work from a project or person.
Each WorkSegment line is intended for one time segment, one day, one project. Each employee has as many WorkSegment lines as needed to describe their payroll cycle.
TimeSheetSegment
- TimeSheetSegmentID (PK)
- ProjectId (FK)
- EmployeeId (FK)
- PayrollCycleID (FK)
There is a unique index for ProjectID, EmployeeID and PayrollCycleID. For each project, there is one TimeSheetSegment line that the employee works on during the payroll cycle.
TimeSheet
- TimeSheetID (PK)
- EmployeeID (IX)
- PayrollCycleID (IX)
TimeSheet TimeSheetSegment WorkSegment. EmployeeID, PayrollCycleID .
Approval
- TimeSheetID (PK)
- PayrollCycleID (FK)
- SubmittedTimestamp
- ApproverID (FK)
- ApprovedTimestamp
"" , . TimeSheet. , , , , TimeSheet.
PayrollCycle
- PayrollCycleID (PK)
- PayrollCycleYear
- PayrollCycleNumber
- StartDate
- EndDate
- DirectDepositDate
- CheckDate
- Other_fields
PayrollCycle , WorkSegment TimeSheetSegment .