Check in/out in attendance system using codeigniter

眉间皱痕 提交于 2019-12-12 03:35:30

问题


I am trying to build an online attendance system where employees sign in and check in daily except for weekends and vacations.

so , my idea was to create a daily attendance record as a table in the database.

Attendance_date_daily         date
Employee_ID                   number(auto generated)
Check_in_time                 time
Check_out_time                time
Attendence_status             varchar

I am using codeigniter v 3.0.0

it's easy to create a model to get the current time and save it in the database when the user check in/out. but the problem is that, if the user was absent for a day or more , then the system will not create a record for those days.

moreover, i can't create the records beforehand. since i don't know when the user will have his/her vacation and working days may differ.

what is the best way to create and manage those daily records?


回答1:


One possible solution may be to allow the employees to do their check-in each day normally which would populate the database for those days.

In order to add the absence records for those who have not checked in you could use CRON or something similar to schedule a task at perhaps midnight each day. Use this task to target a url that would run a method in a controller that will check employees against the daily records. Obviously for those whom have checked in no action will be performed, although for those who have not and are not marked as on vacation or not working you update the database to add the absence records.

With a system like this you would typically invoke the url to perform the update using whatever system you use with wget or something similar to 'load' the url and force it to run. A security consideration also would be that you'll want to add in a secret key as a GET parameter or something similar so that the method can check that it's being invoked via the task and not e.g. someone visiting the url by comparing the GET parameter with a stored key that you've set.



来源:https://stackoverflow.com/questions/31254663/check-in-out-in-attendance-system-using-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!