123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- <?php
- require_once("../include/constantes.php");
- require_once("../include/bd_pdo.php");
- require_once("../classes/ValidaSesion.php");
- require_once("../classes/MainMenu.php");
- require_once("../include/util.php");
- $menu = 7;
- $submenu = 72;
- //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
- $objSesion = new ValidaSesion($pdo, $submenu, APSA);
- if(!$objSesion->tieneAcceso()){
- $objSesion->terminaSesion();
- }
- $objSesion->validaPeriodoUsuario();//si no tiene periodo manda a main
-
- if(!isset($_POST["clave"])){
- header("location: reporte_asistenciasprofesor.php");
- exit();
- }
- $filter_clave = filter_input(INPUT_POST, "clave", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- ?>
- <!DOCTYPE html>
- <html lang="es" prefix="og: http://ogp.me/ns#">
- <head>
- <title>APSA - Facultad de Ingeniería</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <link rel="icon" type="image/png" href="../img/favicon.png" />
- <link rel="stylesheet" href="../css/bootstrap-ulsa.min.css" type="text/css">
- <link rel="stylesheet" href="../css/indivisa.css" type="text/css">
- <link rel="stylesheet" href="../css/sgi.css?rand=<?php echo rand();?>" type="text/css">
- <link rel="stylesheet" href="../css/fa_all.css" type="text/css">
- <link rel="stylesheet" href="../css/jquery-ui.css" type="text/css">
- <link rel="stylesheet" href="../css/clockpicker.css" type="text/css">
- <link rel="stylesheet" href="../css/calendar.css" type="text/css">
- <script src="../js/util.js"></script>
- </head>
- <body>
- <div>
- <?php
- //--- Objeto que pinta menu
- $menuObj = new MainMenu($_SESSION["usuario_id"], $menu, $pdo, APSA, "Asistencias de profesores");//usr, menu, pdo, sist
- $menuObj->printMenu();
-
- /*if(isset($_POST["periodo"]))
- $filter_periodo = filter_input(INPUT_POST, "periodo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- else*/
- $filter_periodo = $_SESSION["periodo_id"];
-
- //Area
- $stmt = $pdo->prepare('Select * from fs_areaacademica(NULL, :nivel)');
- $stmt->bindParam(":nivel", $_SESSION["nivel_id"]);
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar las áreas académicas";
- }else{
- $area_rs = $stmt->fetchAll();
- }
- $stmt->closeCursor();
-
- //Periodo
- $stmt = $pdo->prepare('Select * from fs_periodo(:id, NULL, NULL, true)');
- $stmt->bindParam(":id", $filter_periodo);
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar el periodo";
- }else{
- $periodo_rs = $stmt->fetch();
- }
- $stmt->closeCursor();
-
-
-
- if(isset($_POST["area"]) && $_POST["area"]!=""){
- $filter_area = trim(filter_input(INPUT_POST, "area", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- }
- $filter_fini = trim(filter_input(INPUT_POST, "fecha_inicial", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $filter_ffin = trim(filter_input(INPUT_POST, "fecha_final", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $filter_hini = trim(filter_input(INPUT_POST, "hora_inicial", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $filter_hfin = trim(filter_input(INPUT_POST, "hora_final", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
-
- $hoy_fecha = date("Y-m-d");
-
- if(isset($filter_fini)) $fecha_ini = fechaGuion($filter_fini); else $fecha_ini = $periodo_rs["Periodo_fecha_inicial"];
- if(isset($filter_ffin)){
- $fecha_fin = fechaGuion($filter_ffin);
- }else{
- if($periodo_rs["Periodo_fecha_final"] < $hoy_fecha){
- $fecha_fin = $periodo_rs["Periodo_fecha_final"];
- }else{
- $fecha_fin = $hoy_fecha;
- }
-
- }
- //echo $filter_periodo." ".$fecha_ini." ".$fecha_fin." ".$filter_hini." ".$filter_hfin." ".$filter_clave."<br>";exit();
- if(isset($filter_area)){
- $stmt = $pdo->prepare('Select * from fs_asistenciaprofesores(:per, :fini, :ffin, :hini, :hfin, NULL, :clave, :area, 0, NULL)');//sólo activos
- $stmt->bindParam(":area", $filter_area);
- }else{
- $stmt = $pdo->prepare('Select * from fs_asistenciaprofesores(:per, :fini, :ffin, :hini, :hfin, NULL, :clave, NULL, 0, NULL)');//sólo activos
- }
- $stmt->bindParam(":per", $filter_periodo);
- $stmt->bindParam(":fini", $fecha_ini);
- $stmt->bindParam(":ffin", $fecha_fin);
- $stmt->bindParam(":hini", $filter_hini);
- $stmt->bindParam(":hfin", $filter_hfin);
- $stmt->bindParam(":clave", $filter_clave);
-
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar los profesores";
- print_r($stmt->errorInfo());
- }else{
- $profesores_rs = $stmt->fetchAll();
- }
- $stmt->closeCursor();
-
-
- ?>
- <main class="container-fluid content marco">
-
- <?php include_once("../include/errorMessage.php"); ?>
-
- <p><button class="btn btn-outline-secondary btn-regresar"><span class="ing-flecha ing-rotate-180"></span> Regresar</button></p>
- <?php
- if(isset($periodo_rs)){
- ?>
-
- <!-- Filtro -->
- <div class="row">
- <div class="col-12">
- <form action="reporte_asistenciasprofesordetalle.php" method="post" id="form_filter">
- <input type="hidden" name="clave" value="<?php echo $filter_clave;?>">
- <input type="hidden" name="area" value="<?php echo $filter_area;?>">
- <div class="form-box">
-
- <div class="form-group row">
- <label for="fecha_inicial" class="col-4 col-form-label">Fecha inicial *</label>
- <div class="col-8 col-sm-4">
- <input id="fecha_inicial" name="fecha_inicial" type="text" class="form-control date-picker" placeholder="dd/mm/aaaa" maxlength="10" required="required" readonly="readonly" value="<?php echo fechaSlash($fecha_ini);?>">
- </div>
- </div>
- <div class="form-group row">
- <label for="fecha_final" class="col-4 col-form-label">Fecha final *</label>
- <div class="col-8 col-sm-4">
- <input id="fecha_final" name="fecha_final" type="text" class="form-control date-picker" placeholder="dd/mm/aaaa" maxlength="10" required="required" readonly="readonly" value="<?php echo fechaSlash($fecha_fin); ?>">
- </div>
- </div>
- <div class="form-group row">
- <label for="hora_inicial" class="col-4 col-form-label">Hora inicial *</label>
- <div class="col-8 col-sm-4">
- <input id="hora_inicial" name="hora_inicial" type="text" class="form-control clock" data-autoclose="true" placeholder="hh:mm" maxlength="5" required="required" readonly="readonly" value="<?php echo $filter_hini;?>">
- </div>
- </div>
- <div class="form-group row">
- <label for="hora_final" class="col-4 col-form-label">Hora final *</label>
- <div class="col-8 col-sm-4">
- <input id="hora_final" name="hora_final" type="text" class="form-control clock" data-autoclose="true" placeholder="hh:mm" maxlength="10" required="required" readonly="readonly" value="<?php echo $filter_hfin ?>">
- </div>
- </div>
- </div>
- <div class="form-group row">
- <div class="col-12 text-center">
- <button type="submit" class="btn btn-outline-primary"><?php echo $ICO["buscar"]; ?> Filtrar</button>
- </div>
- </div>
- </form>
- </div>
- </div>
-
- <?php //if($filter_periodo != ""){ //hay periodo seleccionado?>
-
- <form action="./export/xls_asistenciasprofesor.php" target="_blank" method="post" id="formEnviar">
- <input type="hidden" name="clave" value="<?php if(isset($filter_clave)){ echo $filter_clave; }?>">
- <input type="hidden" name="fecha_inicial" value="<?php echo $fecha_ini;?>">
- <input type="hidden" name="fecha_final" value="<?php echo $fecha_fin;?>">
- <input type="hidden" name="hora_inicial" value="<?php echo $filter_hini;?>">
- <input type="hidden" name="hora_final" value="<?php echo $filter_hfin;?>">
- <input type="hidden" name="area" value="<?php if(isset($filter_area)){ echo $filter_area; }?>">
- <p class="text-right"><button type="submit" class="btn btn-outline-secondary"><?php echo $ICO["descargar"];?> Generar xls</button></p>
- </form>
- <div class="row justify-content-md-center">
- <div class="col-12 table-responsive">
- <table class="table table-sm table-striped table-white">
- <thead class="thead-dark">
- <tr >
- <th>Clave</th>
- <th>Profesor</th>
- <th>Grupo</th>
- <th>Materia</th>
- <th>Fecha</th>
- <th>Hora de clase</th>
- <th>Checador</th>
- <th>Estatus</th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($profesores_rs as $profesor){
- ?>
- <tr data-id="<?php echo $profesor["Usuario_id"]; ?>">
- <td class="text-center font-weight-bold"><?php echo $profesor["Usuario_claveULSA"]; ?></td>
- <td><?php echo $profesor["Usuario_apellidos"]." ".$profesor["Usuario_nombre"]; ?></td>
- <td><?php
- //if($_SESSION["nivel_id"] == 1)
- echo $profesor["Grupo_desc"]." ".$profesor["Carrera_prefijo"];
- //else
- //echo $profesor["Grupo_desc"];?></td>
- <td><?php echo $profesor["Materia_desc"];?><br>
- <small><span style="color:<?php echo $profesor["Area_color"];?>"><?php echo $ICO["circulo"];?></span> <?php echo $profesor["Area_desc"];?></small>
- </td>
- <td class="text-center text-nowrap"><?php echo fechaSlash($profesor["Fecha"]);?></td>
- <td class="text-center"><?php echo date('H:i', strtotime($profesor["Horario_hora"]));?></td>
- <td class="text-center"><?php
- if(isset($profesor["Asistencia_checador_inicial"]) && $profesor["Asistencia_checador_inicial"] != "")
- echo date('H:i', strtotime($profesor["Asistencia_checador_inicial"]));
- ?>
- </td>
- <?php
- $colorStatus = '';
- $status = '';
- if(isset($profesor["Asistencia_isRetardo"]) && $profesor["Asistencia_isRetardo"] !== ""){
- if($profesor["Asistencia_isRetardo"]){
- $status = "Retardo";
- $colorStatus = 'text-warning';
- }else{
- if($profesor["Asistencia_isJustificada"]){
- $status = "Justificada";
- $colorStatus = 'text-primary';
- }else{
- $status = "Asistencia";
- $colorStatus = 'text-success';
- }
- }
- }else{
- $status = "Sin registro";
- $colorStatus = 'text-danger';
- }
- if($profesor["Asistencia_isReposicion"]) $status.="<br><small>Reposición<small>";
- ?>
- <td class="text-center <?php echo $colorStatus;?>">
- <?php echo $status;?>
- </td>
- </tr>
- <?php
- }//foreach prof
- ?>
- </tbody>
- </table>
- </div>
- </div>
-
- <p><button class="btn btn-outline-secondary btn-regresar mt-3"><span class="ing-flecha ing-rotate-180"></span> Regresar</button></p>
- <?php } //fin hay periodo seleccionado?>
- <?php //} ?>
- </main>
- <!--- FOOTER--->
- <?php require_once("../include/footer.php"); ?>
-
- </div>
-
- <script src="../js/jquery.min.js"></script>
- <script src="../js/jquery-ui.js"></script>
- <script src="../js/datepicker-es.js"></script>
- <script src="../js/clockpicker.js"></script>
- <script src="../js/bootstrap/popper.min.js"></script>
- <script src="../js/bootstrap/bootstrap.min.js"></script>
- <script src="../js/sidebarmenu.js"></script>
- <script src="../js/datalist.js"></script>
-
- <script>
- var _periodo_fecha_inicial = "<?php echo fechaSlash($periodo_rs["Periodo_fecha_inicial"]); ?>";
- var _periodo_fecha_final = "<?php if($periodo_rs["Periodo_fecha_final"] > $hoy_fecha ) echo fechaSlash($hoy_fecha); else echo fechaSlash($periodo_rs["Periodo_fecha_final"]); ?>";
- var datepickerOptions = { dateFormat: "dd/mm/yy", minDate:_periodo_fecha_inicial, maxDate:_periodo_fecha_final };
-
-
- $(document).on( "click", ".btn-reset", function(event){
- var forma = $(this).parents("form");
- forma.find("input[type=text]").val("");
- forma.find("select").prop("selectedIndex",0);
- $("#fecha_inicial").val(_periodo_fecha_inicial);
- $("#fecha_final").val(_periodo_fecha_final);
- forma.submit();
- });
-
- $(document).on( "click", ".btn-regresar", function(event){
- $("#formEnviar").attr("action", "reporte_asistenciasprofesor.php");
- $("#formEnviar").attr("target", "_self");
- $("#formEnviar").submit();
- });
-
- $(document).ready(function(){
- setDatalist("#periodo", <?php echo $_SESSION["periodo_id"]; ?>);
- $(document).on('click', '#dlPeriodo ul li' ,function(){
- $("#formaPeriodo").submit();
- });
-
- $(".date-picker" ).datepicker(datepickerOptions);
- $(".date-picker" ).datepicker( $.datepicker.regional[ "es" ] );
-
- $('.clock').clockpicker();
- });
- </script>
- </body>
- </html>
|