Answer the question
In order to leave comments, you need to log in
Staff work schedule, how to write to the database (mysql)? what structure to create?
I have a staff schedule according to which wages will be calculated, the number of working days and days off for each employee, it doesn’t occur to me how to write to the database, that is, what columns to create? whether it will be days (1-31)? the schedule will also change depending on which month.
The question is how can I build a structure in the database so that I can write to the database from the inputs!?
An example of a chart that needs to be implemented in the admin panel. that is, everything is as in the example, only how should the structure in the database look like?
So I made a table for 31 calendar days, each cell has an input
Answer the question
In order to leave comments, you need to log in
Table Employees:
Id, Full Name, Department, Position, ...
Table TypeDay:
Id, TypeDay (working, day off, sick leave, vacation, study, ...)
Table Timesheet:
Id_employee, Date, Id_DayType
Connection of the first two with the third through keys
kisaa 's
answer gives a first approximation of what a database structure might look like.
However, most likely it is also necessary to take into account the fact that the day "in fact" will probably differ from the day "according to the plan". For example, someone took a day off at their own expense or suddenly fell ill. Therefore, most likely, there should be two schedules - planned and real, while the data from the "planned" will have to be copied every day to the "real" with subsequent adjustments.
Also, if all this is also taken into account when calculating wages, you need to take into account a number of other parameters:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question