0
I am creating a table for the calculation of working hours of employees, but I am not able to do the calculation to know if the correct amount of hours was worked in the day.
In the database is that way:
On the site will be displayed this way:
In the last column, in "Worked Hours" I need to put the result of the calculation of Input 1 (Beginning of the day), Output 1 (Lunch), Input 2 (Return of Lunch) and Output 2 (end of day)
I used this select to get all data from the table:
SELECT p.id_ponto, p.tb_user_id_user, p.tb_ponto_mes_id_ponto_mes, p.dia_ponto, p.dt_entrada1, p.dt_saida1, p.dt_entrada2, p.dt_saida2, u.id_user, u.nm_user
FROM tb_ponto p
INNER JOIN tb_user u on u.id_user = p.tb_user_id_user
I’m displaying values like this:
echo '<tr><td>' . $item["nm_user"] . '</td>' .
'<td>' . $item["dia_ponto"] . '/' . $item["tb_ponto_mes_id_ponto_mes"] . '/2017' . '</td>' .
'<td>' . $item["dt_entrada1"] . '</td>' .
'<td>' . $item["dt_saida1"] . '</td>' .
'<td>' . $item["dt_entrada2"] . '</td>' .
'<td>' . $item["dt_saida2"] . '</td>' .
'<td>8 Horas</td></tr>';
How can I calculate this?
It worked perfectly, thank you! Now, I only have one other question, the display is like this: 8:0, it is possible to do it like this: 8:00 or 8:00?
– João Carvalho
There is, I made a change to the code. Look there.
– David Alves
Everything perfect, thank you very much!
– João Carvalho
For nothing hehe. :)
– David Alves