Control employee point card

Asked

Viewed 171 times

0

I need to make a chart that shows if the employee missed it or not. if you don’t have to show your point beats in front of the respective date.

Can someone help me??

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

batida_id =>1 collaborator_id=> 1 date => 01/06/2016 beat => 07:30 type => input
batida_id =>2 collaborator_id=> 1 date => 01/06/2016 beat => 12:00 type => output
batida_id =>3 collaborator_id=> 1 date => 01/06/2016 beat => 13:30 type => input
batida_id =>4 collaborator_id=> 1 date => 01/06/2016 beat => 17:00 type => output

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

would look something like this:

01 - Wednesday - 07:30 12:00 13:30 17:00
02 - Thursday - missing
03 - Friday - miss
04 - Saturday - foul
(...)

Note: as it only has beats of the day 01/06/2016 I need to fill in the rest of the days as foul:

<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>

  • How are you receiving the data whether it is missing or not? Each table concerns a certain person?

  • If the date field in the table is missing? Null or '' (emptiness)?

  • in my database I have the table "markers" with the columns: marcacao_id(int), collaborator_id(int),type(char)-> Obs* the type would be if it is input or output markup represented by E or S),date(date),record(time)(are the beats). If at the time of filling the dates with the array and that date is not hit it should print "missing".

1 answer

0

I think this is what you want, the array $batidas 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 at random, because I don’t know what you’re leaning on for this

Browser other questions tagged

You are not signed in. Login or sign up in order to post.