If you just want to count the number of days, just create a field.
When generating reports, avoid adding another table to your query.
Within this field save the data as follows:
12,15,13,5,0,0,0,0,0,0,0,0
Each position represents one month, January, February, etc...
To add +1 day to the respective month, before recording, you need to convert the data into array using the function explode:
$aDias = explode(",",string_com_os_dias);
In the string we use as an example, we have until April.
An example to add another day to the month of April.
$aDias[3] += 1; //passa a 6
Before saving the data, re-convert the array to string. To do this use the function implode:
$sDias = implode(",",$aDias);
This is an example if you only need to record the number of days.
If you want to record the date the work was done, you need to create a table by part.
Create a new table, for example "TB_HORAS" with the fields:
- ID - int //autocomplete
- ID_FUNCIONARIO - int //id of the respective employee corresponding to the employee table
- DATA - date //date on which the work was performed
- HOURS - int //number of hours
To search by month and count every day, for example, month of May for employee with ID=5:
SELECT SUM(HORAS) FROM TB_HORAS WHERE ID_FUNCIONARIO = 5 AND DATA between '2014-05-01' AND '2014-05-31'
How will these data be imputed ? The best model would be in my opinion one that registers : Employee start date and time, end date and time and hours worked would be calculated.
– Motta
By means of a form. If you want to take a look at the whole problem: http://answall.com/questions/15837/calcular-total-ofworked days-em-certain/ is another account of mine, at work you can not log in with facebook.
– João Neto
It is necessary to record the hours of the day, as if it were a time clock or only the number of days in the month?
– Filipe Moraes
Will be by means of a form where I inform name, entry date, exit date. The way will be manipulated the data already know. I just need to define the insertion of the days in the bank.
– João Neto
Only the number of days.
– João Neto
And you need to know what those days were?
– Filipe Moraes
Yes Ilipe, to then compare with the days that are holidays.
– João Neto