Production in PHP hours

0

  • Shift time (08:00:00) (h: m: s) (value varies by shift)
  • Pairs per hour (15 pairs per hour) (value varies by machine)
  • Production, which comes from an input

I want to do this account, pairs per hour * shift time, which gives me the total production of 100%, then I only make a rule of 3 to know the efficiency of the shift;

Does anyone suggest something to me?

    
asked by anonymous 07.06.2018 / 20:26

1 answer

0

I managed with the following trick:

    $horario: '08:20:00';
    $pares_p_hora : !valor vindo do BD;
    $producao = !valor vindo do BD;



    $segundos = strtotime('1970-01-01 '.$horario.'UTC');
    $tempo_producao = ($pares_p_hora / 3600);
    $tempo_producao = number_format(($tempo_producao * $segundos), 0, ',', '.');
    $eficiencia = number_format((($producao * 100) / $tempo_producao), 0, ',', '.');
    echo "eficiencia: ".$eficiencia."%<br>";
    
07.06.2018 / 21:07