For a new project a have to automate time sheets and the calculations behind it and I'm looking for the best technical approach.
- User fills out a time sheet with 3 columns 'Day', 'In' and 'Out'. Day contains 1-31 and both In and Out contain a hour format (24 hrs). So the first line would be '1', '09:00' '17:00'. The sheet gets filled on the last day of the current month.
- Depending on the labour contract, 4 different time blocks exist, e.g. 00:00-06:00, 06:00-19:00, 19:00-22:00 and 22:00-00:00.
- I need to figure out how many hours there are in every block and calculate the applicable overtime compensation, block 1 = 110%, block 2 = 100% etc.
- So I have 30 or 31 lines every month and need to break them up in applicable blocks.
- As an example: day 21, in 05:00, out 21:00. That would be 1 hr block 1, 13 hrs block 2 and 2 hrs block 3.
How to put the 4 rules in a method? Would a dictionary come in handy with 4 entries?