Control point staff card

0

I need to make a table that shows whether the employee is missing or not. if there is no need to show your point beats in front of the respective date.

Can anyone help me?

Example: In my bank I have several employees registered, assuming I have an employee with the following hits:

hit_id => 1 contributor_id = > 1 data = > 06/01/2016 hit = > 07:30 type = > entrance
hit_id => 2 collaborator_id = > 1 data = > 06/01/2016 hit = > 12:00 Type = > exit hit_id => 3 collaborator_id = > 1 data = > 06/01/2016 hit = > 13:30 type = > entrance
hit_id => 4 collaborator_id = > 1 data = > 06/01/2016 hit = > 17:00 type = > exit

From these beats I need to organize them by placing in front of the respective date:

It would look something like this:

01 - Wednesday - 07:30 a.m. 1:30 p.m. 02 - Thursday - foul
03 - Friday - missing
04 - Saturday - missing
(...)

Note: as it only has day hits 06/01/2016 I need to fill in the remaining days as missing :

<table class="table table-striped">
  <tr>
  <th>Data</th>
  <th>Dia Semana</th>
  <th>Ocorrências</th>
  </tr>  <br />
        
    <?php
            
              
    $diasSemana[1] = 'Segunda-feira';
    $diasSemana[2] = 'Terça-feira';
    $diasSemana[3] = 'Quarta-feira';
    $diasSemana[4] = 'Quinta-feira';
    $diasSemana[5] = 'Sexta-feira';
    $diasSemana[6] = 'Sábado';
    $diasSemana[7] = 'Domingo';

   
    for($dias = 1; $dias <= date('t',strtotime('2016-06')); $dias++)
    
    {
    echo "<tr>";
    echo "<th>".$dias."</th>" . "<th>".$diasSemana[date('N', strtotime("2016-06-$dias"))] ."</th>" . "<th>";
   
      
        }
        
     
   echo "</tr>";
      
?>    
             </table>
    
asked by anonymous 17.06.2016 / 16:26

1 answer

0

I think this is what you want, the $batidas array will store this information per day:

<table class="table table-striped">
    <tr>
        <th>Data</th>
        <th>Dia Semana</th>
        <th>Ocorrências</th>
    </tr>
    <?php

    $diasSemana[1] = 'Segunda-feira';
    $diasSemana[2] = 'Terça-feira';
    $diasSemana[3] = 'Quarta-feira';
    $diasSemana[4] = 'Quinta-feira';
    $diasSemana[5] = 'Sexta-feira';
    $diasSemana[6] = 'Sábado';
    $diasSemana[7] = 'Domingo';

    $horas = ['falta', '7:30 12:00 13:30 17:00'];
    $batidas = array();
    for($dias = 1; $dias <= date('t',strtotime('2016-06')); $dias++) {
        $falta = $horas[rand(0, 1)];
        $batidas[] = array(
            'dia_mes' => $dias,
            'dia_semana' => $diasSemana[date('N', strtotime("2016-06-$dias"))],
            'falta' => $falta
        );
        echo '<tr>
                <th> '.$dias. '</th>
                <th>' .$diasSemana[date('N', strtotime("2016-06-$dias"))]. '</th>
                <th>' .$falta. '</th>
            </tr>';
    }
    ?>    
</table>
<?php echo '<pre>', print_r($batidas), '</pre>'; ?>

The parameter is missing or not, I did it by chance, because I do not know what you are supporting for it

    
17.06.2016 / 16:43