My boss told me that I no need to add field for shift, but I got a problem in my code for the shift 21:35-05:35 and also in 13:35-21:35 . here is the code:
[code] $result = mysql_query("UPDATE attendance SET Rendered = sec_to_time(time_to_sec('08:00:00') + case when time_to_sec(time(TimeIn)) < time_to_sec('21:35:00') then 0 else time_to_sec('21:35:00') - time_to_sec(time(TimeIn)) end + case when time_to_sec(time(TimeOut)) > time_to_sec('05:35:00') then 0 else time_to_sec(time(TimeOut)) - time_to_sec('05:35:00') end )") or die(mysql_error());
$result = mysql_query("UPDATE attendance SET Rendered = sec_to_time(time_to_sec('08:00:00') + case when time_to_sec(time(TimeIn)) < time_to_sec('13:35:00') then 0 else time_to_sec('13:35:00') - time_to_sec(time(TimeIn)) end + case when time_to_sec(time(TimeOut)) > time_to_sec('21:35:00') then 0 else time_to_sec(time(TimeOut)) - time_to_sec('21:35:00') end )") or die(mysql_error()); [/code]
i have time in : 2011-10-24 21:35:00 time out: 2011-10-25 08:35:00 and the ouput in rendered using this code is: -14:00:00 it should be 08:00:00
timein : 2011-10-24 13:35:00 timeout: 2011-10-24 21:35:00 rendered: 02:25:00 it should be 08:00:00
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum