Ejemplo n.º 1
0
function get_esquecidos($data, $tipo)
{
    // echo 'Aguarde...';
    $horario = new Horarios();
    $array = $horario->get_registros_esquecidos($data, $tipo);
    $config = new Config();
    $TEMP_LIMIT_ATRASO = $config->get_config("temp_limit_atraso");
    // tempo limite de atraso ou adiantamento aceito
    // echo "<script>alert('".count($array)."');</script>";
    if (count($array) > 0) {
        // verifica se existe registro
        echo '<div class="content-right" id="content-right">
                    <div class="box-atrasos" style="width:96%">';
        echo '<table class="table-atrasos" border="0" style="box-shadow:0px 0px 5px #ccc;">';
        // echo '<tr><td colspan="4"><img src="../images/rel.png"></td></tr>';
        if ($tipo == 0) {
            echo '<tr><td colspan="4">' . date("d/m/Y") . '<br />' . '<a href="logado.php?desc=mes" style="font-size:12px">Ver mês inteiro</a>' . '</td></tr>';
        } else {
            echo '<tr><td colspan="4">' . date("m/Y") . '<br />' . '<a href="logado.php" style="font-size:12px">Ver hoje</a>' . '</td></tr>';
        }
        echo '<tr><td colspan="4"><b>Atenção</b></td></tr>';
        echo '<tr><td colspan="4"><span>Os funcionários abaixo esqueceram ou não bateram o ponto</span></td></tr>';
        $title = 'Clique para justificar o atraso';
        $funcionario = new Funcionario();
        $turno = new Turno();
        $table_color = 0;
        // para fazer a tabela zebrada
        $total_registros = 0;
        echo '<tr>
                         <td colspan="4">';
        echo '<div style="overflow-y: scroll; height: 190px;">';
        echo '<table style="text-align:center; width:100%" border="0">';
        echo '<tr><td><b>Funcionário</b></td><td><b>Tipo</b></td>';
        if ($tipo == 1) {
            echo '<td><b>Data</b></td>';
        }
        echo '</tr>';
        for ($aux = 0; $aux < count($array); $aux++) {
            /*
              $array[$aux][0] -> 'id'
              $array[$aux][1] -> 'data'
              $array[$aux][2] -> 'id_funcionario'
              $array[$aux][3] -> 'tipo_1'
              $array[$aux][4] -> 'tipo_2'
              $array[$aux][5] -> 'tipo_3'
              $array[$aux][6] -> 'tipo_0'
            */
            $nome_turno_funcionario = $funcionario->get_nome_by_id($array[$aux][2]);
            $turno = $turno->getTurnoById($nome_turno_funcionario[1]);
            // date_default_timezone_set('America/Sao_Paulo');
            $hora = strtotime(date('H:i:s'));
            $hora_turno['ini_exp'] = strtotime($turno->ini_exp) + $TEMP_LIMIT_ATRASO * 60;
            $hora_turno['ini_alm'] = strtotime($turno->ini_alm) + $TEMP_LIMIT_ATRASO * 60;
            $hora_turno['fim_alm'] = strtotime($turno->fim_alm) + $TEMP_LIMIT_ATRASO * 60;
            $hora_turno['fim_exp'] = strtotime($turno->fim_exp) + $TEMP_LIMIT_ATRASO * 60;
            // echo $hora;
            if ($array[$aux][3] == 0 && ($hora > $hora_turno['ini_exp'] || strtotime($data) < strtotime($array[$aux][1]))) {
                //tipo_1
                if (date('D', strtotime($array[$aux][1])) != 'Sun' && date('D', strtotime($array[$aux][1])) != 'Sat') {
                    if ($table_color % 2 == 0) {
                        echo '<tr style="background-color:#eee">';
                        $table_color++;
                    } else {
                        echo '<tr style="background-color:#dedede">';
                        $table_color++;
                    }
                } else {
                    echo '<tr style="background-color:rgba(250,10,10,0.3)">';
                }
                echo '<td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=1&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . $nome_turno_funcionario[0] . '</b></a></td><td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=1&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>Inicio expediente</b></a></td>';
                if ($tipo == 1) {
                    echo '<td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=1&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . date('d/m/Y', strtotime($array[$aux][1])) . '</b></a></td>';
                }
                echo '</tr>';
                $total_registros++;
            }
            if ($array[$aux][4] == 0 && ($hora > $hora_turno['ini_alm'] || strtotime($data) < strtotime($array[$aux][1])) && $turno->sem_hor_almoco != '1') {
                //tipo_2
                if (date('D', strtotime($array[$aux][1])) != 'Sun' && date('D', strtotime($array[$aux][1])) != 'Sat') {
                    if ($table_color % 2 == 0) {
                        echo '<tr style="background-color:#eee">';
                        $table_color++;
                    } else {
                        echo '<tr style="background-color:#dedede">';
                        $table_color++;
                    }
                } else {
                    echo '<tr style="background-color:rgba(250,10,10,0.3)">';
                }
                echo '<td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=2&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . $nome_turno_funcionario[0] . '</b></a></td><td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=2&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>Inicio Almoço</b></a></td>';
                if ($tipo == 1) {
                    echo '<td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=2&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . date('d/m/Y', strtotime($array[$aux][1])) . '</b></a></td>';
                }
                echo '</tr>';
                $total_registros++;
            }
            if ($array[$aux][5] == 0 && ($hora > $hora_turno['fim_alm'] || strtotime($data) < strtotime($array[$aux][1])) && $turno->sem_hor_almoco != '1') {
                //tipo_3
                if (date('D', strtotime($array[$aux][1])) != 'Sun' && date('D', strtotime($array[$aux][1])) != 'Sat') {
                    if ($table_color % 2 == 0) {
                        echo '<tr style="background-color:#eee">';
                        $table_color++;
                    } else {
                        echo '<tr style="background-color:#dedede">';
                        $table_color++;
                    }
                } else {
                    echo '<tr style="background-color:rgba(250,10,10,0.3)">';
                }
                echo '<td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=3&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . $nome_turno_funcionario[0] . '</b></a></td><td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=3&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>Fim Almoço</b></a></td>';
                if ($tipo == 1) {
                    echo '<td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=3&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . date('d/m/Y', strtotime($array[$aux][1])) . '</b></a></td>';
                }
                echo '</tr>';
                $total_registros++;
            }
            if ($array[$aux][6] == 0 && ($hora > $hora_turno['fim_exp'] || strtotime($data) < strtotime($array[$aux][1]))) {
                //tipo_0
                if (date('D', strtotime($array[$aux][1])) != 'Sun' && date('D', strtotime($array[$aux][1])) != 'Sat') {
                    if ($table_color % 2 == 0) {
                        echo '<tr style="background-color:#eee">';
                        $table_color++;
                    } else {
                        echo '<tr style="background-color:#dedede">';
                        $table_color++;
                    }
                } else {
                    echo '<tr style="background-color:rgba(250,10,10,0.3)">';
                }
                echo '<td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=0&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . $nome_turno_funcionario[0] . '</b></a></td><td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=0&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>Fim expediente</b></a></td>';
                if ($tipo == 1) {
                    echo '<td class="rows-content"><a href="logado.php?desc=sem_registros&tipo=0&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . date('d/m/Y', strtotime($array[$aux][1])) . '</b></a></td>';
                }
                echo '</tr>';
                $total_registros++;
            }
        }
        echo '</table>';
        echo '</div>';
        echo '</td></tr>';
        if ($total_registros > 0) {
            echo '<tr><td colspan="4" style="text-align: right; padding-top: 5px; color:#555; font-size: 12px;">';
            if ($tipo == 1) {
                echo '<div style="border-radius: 50%; border: 1px solid#555; float:left; height: 11px; width:11px; background-color:rgba(250,10,10,0.3)"></div><div style="float:left; margin-left: 5px;"> Sábados e domingos</div>';
            }
            echo 'Clique para corrigir </td></tr>';
            echo "<script>document.getElementById('content-right').style.display='block'</script>";
        } else {
            echo '<tr><td colspan="4" style="padding-top: 15px; color:#555; font-size: 12px;">Nenhum horário registrado!</td></tr>';
        }
        echo '<div class="cont" style="color:#f33;font-size:15px;  text-align:center"><b>' . $total_registros . '</b></div>';
        echo '</table>';
    }
    //fim if count($array) > 0
    echo '</div>
            </div>';
}
Ejemplo n.º 2
0
function get_esquecidos($data, $tipo, $data2)
{
    // echo 'Aguarde...';
    $horario = new Horarios();
    $array = $horario->get_registros_esquecidos($data, $tipo, $data2);
    $config = new Config();
    $TEMP_LIMIT_ATRASO = $config->get_config("temp_limit_atraso", $_SESSION['id_empresa']);
    // tempo limite de atraso ou adiantamento aceito
    // echo "<script>alert('".count($array)."');</script>";
    if (count($array) > 0) {
        // verifica se existe registro
        echo '<div class="content-right" id="content-right">
                    <div class="box-atrasos" style="">';
        echo '<div class="cont" style="margin-left:480px;"><a name="exibe_box_sem_registros" onclick="oculta(this.name)"><img width="20px" src="../images/icon-fechar.png" onmouseover="info(\'pop1\')" onmouseout="fecharInfo(\'pop1\')"></a>
                              <div id="pop1" class="pop" style="display:none">
                                  <div id="titulo1" class="title-info-config"><span>Informações</span></div>
                                  <div id="content1" class="content-info">Clique para ocultar esse bloco, você pode exibi-lo novamente a qualquer momento em:<br /><b>Configurações > Layout</b></div>   
                              </div>
                         </div>';
        echo '<table class="table-atrasos" border="0" style="box-shadow:0px 0px 5px #ccc;">';
        // echo '<tr><td colspan="4"><img src="../images/rel.png"></td></tr>';
        // if($tipo == 0){
        echo '<tr><td colspan="4">';
        echo '<a href="principal" style="font-size:12px">Ver hoje</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="principal?desc=mes" style="font-size:12px">Ver mês inteiro</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="exibe_oculta(\'intervalo_datas\')" style="cursor: pointer; font-size:12px">Ver por período</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="exibe_oculta(\'funcionario\')" style="cursor: pointer;font-size:12px">Ver por funcionário</a>';
        echo '<br />';
        if ($tipo == 0) {
            echo '<span style="color:#aaa">Exibindo registros de hoje ' . date("d/m/Y") . '</span><br />';
        } else {
            if ($tipo == 1) {
                echo '<span style="color:#aaa">Exibindo registros para o mês ' . date("m/Y") . '</span><br />';
            } else {
                echo '<span style="color:#aaa">Exibindo registros de ' . date("d/m/Y", strtotime($data)) . ' até ' . date("d/m/Y", strtotime($data2)) . '</span><br />';
            }
        }
        echo '</td></tr>';
        // }else{
        //      echo '<tr><td colspan="4">'.date("m/Y").'<br />'. '<a href="principal" style="font-size:12px">Ver hoje</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="exibe_oculta(\'intervalo_datas\')" style="font-size:12px">Ver por período</a>'.'</td></tr>';
        // }
        echo '<tr id="intervalo_datas" style="display:none; ">
                                <td colspan="4">
                                    <form name="dataini_datafim" action="principal" method="POST">
                                      <span>Inicio: </span> <input  onclick="carregaMascaras()" type="date" name="ini" id="ini" style="border: 1px solid#cdcdcd; border-radius: 5px">&nbsp;&nbsp;<span>Fim: </span><input  onclick="carregaMascaras()" id="fim" name="fim" style="border: 1px solid#cdcdcd; border-radius: 5px" type="date"> <input type="submit" value="Buscar">
                                    <form>
                                </td>
                              </tr>';
        echo '<tr id="funcionario" style="display:none; ">
                                <td colspan="4">
                                    <form name="nome_func" action="principal" method="POST">
                                      <span>Nome: </span> <input type="text" name="funcionario" style="padding-left:5px;border: 1px solid#cdcdcd; border-radius: 5px"> <input type="submit" value="Buscar">
                                    <form>
                                </td>
                              </tr>';
        echo '<tr><td colspan="4"><b>Atenção</b></td></tr>';
        echo '<tr><td colspan="4"><span>Os funcionários abaixo esqueceram ou não bateram o ponto</span></td></tr>';
        $title = 'Clique para justificar o atraso';
        $funcionario = new Funcionario();
        $turno = new Turno();
        $table_color = 0;
        // para fazer a tabela zebrada
        $total_registros = 0;
        echo '<tr>
                         <td colspan="4">';
        echo '<div style="overflow-y: scroll; height: 190px;">';
        echo '<table style="text-align:center; width:100%" border="0">';
        echo '<tr><td><b>Funcionário</b></td><td><b>Tipo</b></td>';
        if ($tipo == 1) {
            echo '<td><b>Data</b></td>';
        }
        echo '</tr>';
        for ($aux = 0; $aux < count($array); $aux++) {
            /*
              $array[$aux][0] -> 'id'
              $array[$aux][1] -> 'data'
              $array[$aux][2] -> 'id_funcionario'
              $array[$aux][3] -> 'tipo_1'
              $array[$aux][4] -> 'tipo_2'
              $array[$aux][5] -> 'tipo_3'
              $array[$aux][6] -> 'tipo_0'
            */
            $nome_turno_funcionario = $funcionario->get_nome_by_id($array[$aux][2]);
            $turno = $turno->getTurnoById($nome_turno_funcionario[1]);
            $hora = strtotime(date('H:i:s'));
            $hora_turno['ini_exp'] = strtotime($turno->ini_exp) + $TEMP_LIMIT_ATRASO * 60;
            $hora_turno['ini_alm'] = strtotime($turno->ini_alm) + $TEMP_LIMIT_ATRASO * 60;
            $hora_turno['fim_alm'] = strtotime($turno->fim_alm) + $TEMP_LIMIT_ATRASO * 60;
            $hora_turno['fim_exp'] = strtotime($turno->fim_exp) + $TEMP_LIMIT_ATRASO * 60;
            // echo $hora;
            if ($array[$aux][3] == 0 && ($hora > $hora_turno['ini_exp'] || strtotime($data) < strtotime($array[$aux][1]))) {
                //tipo_1
                if (date('D', strtotime($array[$aux][1])) != 'Sun' && date('D', strtotime($array[$aux][1])) != 'Sat') {
                    if ($table_color % 2 == 0) {
                        echo '<tr style="background-color:#eee">';
                        $table_color++;
                    } else {
                        echo '<tr style="background-color:#dedede">';
                        $table_color++;
                    }
                } else {
                    echo '<tr style="background-color:rgba(250,10,10,0.3)">';
                }
                echo '<td class="rows-content"><a href="principal?desc=sem_registros&tipo=1&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . $nome_turno_funcionario[0] . '</b></a></td><td class="rows-content"><a href="principal?desc=sem_registros&tipo=1&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>Inicio expediente</b></a></td>';
                if ($tipo == 1 || $tipo == 3) {
                    echo '<td class="rows-content"><a href="principal?desc=sem_registros&tipo=1&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . date('d/m/Y', strtotime($array[$aux][1])) . '</b></a></td>';
                }
                echo '</tr>';
                $total_registros++;
            }
            if ($array[$aux][4] == 0 && ($hora > $hora_turno['ini_alm'] || strtotime($data) < strtotime($array[$aux][1])) && $turno->sem_hor_almoco != '1') {
                //tipo_2
                if (date('D', strtotime($array[$aux][1])) != 'Sun' && date('D', strtotime($array[$aux][1])) != 'Sat') {
                    if ($table_color % 2 == 0) {
                        echo '<tr style="background-color:#eee">';
                        $table_color++;
                    } else {
                        echo '<tr style="background-color:#dedede">';
                        $table_color++;
                    }
                } else {
                    echo '<tr style="background-color:rgba(250,10,10,0.3)">';
                }
                echo '<td class="rows-content"><a href="principal?desc=sem_registros&tipo=2&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . $nome_turno_funcionario[0] . '</b></a></td><td class="rows-content"><a href="principal?desc=sem_registros&tipo=2&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>Inicio Almoço</b></a></td>';
                if ($tipo == 1 || $tipo == 3) {
                    echo '<td class="rows-content"><a href="principal?desc=sem_registros&tipo=2&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . date('d/m/Y', strtotime($array[$aux][1])) . '</b></a></td>';
                }
                echo '</tr>';
                $total_registros++;
            }
            if ($array[$aux][5] == 0 && ($hora > $hora_turno['fim_alm'] || strtotime($data) < strtotime($array[$aux][1])) && $turno->sem_hor_almoco != '1') {
                //tipo_3
                if (date('D', strtotime($array[$aux][1])) != 'Sun' && date('D', strtotime($array[$aux][1])) != 'Sat') {
                    if ($table_color % 2 == 0) {
                        echo '<tr style="background-color:#eee">';
                        $table_color++;
                    } else {
                        echo '<tr style="background-color:#dedede">';
                        $table_color++;
                    }
                } else {
                    echo '<tr style="background-color:rgba(250,10,10,0.3)">';
                }
                echo '<td class="rows-content"><a href="principal?desc=sem_registros&tipo=3&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . $nome_turno_funcionario[0] . '</b></a></td><td class="rows-content"><a href="principal?desc=sem_registros&tipo=3&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>Fim Almoço</b></a></td>';
                if ($tipo == 1 || $tipo == 3) {
                    echo '<td class="rows-content"><a href="principal?desc=sem_registros&tipo=3&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . date('d/m/Y', strtotime($array[$aux][1])) . '</b></a></td>';
                }
                echo '</tr>';
                $total_registros++;
            }
            if ($array[$aux][6] == 0 && ($hora > $hora_turno['fim_exp'] || strtotime($data) < strtotime($array[$aux][1]))) {
                //tipo_0
                if (date('D', strtotime($array[$aux][1])) != 'Sun' && date('D', strtotime($array[$aux][1])) != 'Sat') {
                    if ($table_color % 2 == 0) {
                        echo '<tr style="background-color:#eee">';
                        $table_color++;
                    } else {
                        echo '<tr style="background-color:#dedede">';
                        $table_color++;
                    }
                } else {
                    echo '<tr style="background-color:rgba(250,10,10,0.3)">';
                }
                echo '<td class="rows-content"><a href="principal?desc=sem_registros&tipo=0&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . $nome_turno_funcionario[0] . '</b></a></td><td class="rows-content"><a href="principal?desc=sem_registros&tipo=0&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>Fim expediente</b></a></td>';
                if ($tipo == 1 || $tipo == 3) {
                    echo '<td class="rows-content"><a href="principal?desc=sem_registros&tipo=0&id_func=' . $array[$aux][2] . '&data=' . $array[$aux][1] . '"><b>' . date('d/m/Y', strtotime($array[$aux][1])) . '</b></a></td>';
                }
                echo '</tr>';
                $total_registros++;
            }
        }
        echo '</table>';
        echo '</div>';
        echo '</td></tr>';
        if ($total_registros > 0) {
            echo '<tr><td colspan="4" style="text-align: right; padding-top: 5px; color:#555; font-size: 12px;">';
            if ($tipo == 1) {
                echo '<div style="border-radius: 50%; border: 1px solid#555; float:left; height: 11px; width:11px; background-color:rgba(250,10,10,0.3)"></div><div style="float:left; margin-left: 5px;"> Sábados e domingos</div>';
            }
            echo 'Clique para corrigir </td></tr>';
            echo "<script>document.getElementById('content-right').style.display='block'</script>";
        } else {
            echo '<tr><td colspan="4" style="padding-top: 15px; color:#555; font-size: 12px;">Nenhum horário registrado!</td></tr>';
        }
        echo '<div class="cont" style="color:#f33;font-size:15px;  text-align:left"><b>' . $total_registros . '</b></div>';
        echo '</table>';
    } else {
        //fim if count($array) > 0
        echo '<div class="content-right" id="content-right">
                    <div class="box-atrasos" style="">';
        echo '<table class="table-atrasos" border="0" style="box-shadow:0px 0px 5px #ccc;">';
        // echo '<tr><td colspan="4"><img src="../images/rel.png"></td></tr>';
        // if($tipo == 0){
        echo '<tr><td colspan="4">';
        echo '<a href="principal" style="font-size:12px">Ver hoje</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="principal?desc=mes" style="font-size:12px">Ver mês inteiro</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="exibe_oculta(\'intervalo_datas\')" style="cursor: pointer;font-size:12px">Ver por período</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="exibe_oculta(\'intervalo_datas\')" style="cursor: pointer;font-size:12px">Ver por funcionário</a>';
        echo '<br />';
        if ($tipo == 0) {
            echo '<span style="color:#aaa">Exibindo registros de hoje ' . date("d/m/Y") . '</span><br />';
        } else {
            if ($tipo == 1) {
                echo '<span style="color:#aaa">Exibindo registros para o mês ' . date("m/Y") . '</span><br />';
            } else {
                echo '<span style="color:#aaa">Exibindo registros de ' . date("d/m/Y", strtotime($data)) . ' até ' . date("d/m/Y", strtotime($data2)) . '</span><br />';
            }
        }
        echo '</td></tr>';
        $total_registros = 0;
        echo '<tr>
                         <td colspan="4">';
        echo 'NENHUM REGISTRO FOI ENCONTRADO NESSE PERÍODO';
        echo '</td></tr>';
        echo '<div class="cont" style="color:#f33;font-size:15px;  text-align:left"><b>' . $total_registros . '</b></div>';
        echo '</table>';
        echo '</div></div>';
    }
    echo '</div>
            </div>';
}