access('reporte_de_asistencias');
if ($user->acceso == null)
die(header('Location: main.php?error=1'));
$user->print_to_log('Consultar: Reporte de asistencias de profesor');
#$required_post = ['id', 'fecha_inicial', 'fecha_final', 'periodo'];
#if (array_diff($required_post, array_keys($_POST)))
#header('Location: s.php');
extract($_POST);
$post_keys = array_keys($_POST);
if (
!in_array('fecha_inicial', $post_keys) ||
!in_array('fecha_final', $post_keys)
) {
header('Location: reporte_de_asistencias.php');
exit;
}
# date validation
$fecha_inicial = date_create_from_format("d/m/Y", $fecha_inicial);
$fecha_final = date_create_from_format("d/m/Y", $fecha_final);
// Nombre del profesor es opcional
$reporte = queryAll("SELECT * FROM fs_asistencia_profesorreporte(:carrera, :periodo, :id, :initial_date, :final_date)
WHERE materia_id = COALESCE(:materia, materia_id)",
array(
":carrera" => empty($carrera) ? null : $carrera,
":periodo" => $user->periodo_id,
":id" => $id,
":initial_date" => $fecha_inicial->format("Y-m-d"),
":final_date" => $fecha_final->format("Y-m-d"),
":materia" => empty($materia) ? null : $materia
)
);
$profesor = query(
"SELECT * FROM FS_PROFESOR WHERE id = :id",
array(":id" => $id)
);
$asistencias = query(
"SELECT total, asistencias, retardos, justificaciones FROM fs_asistencia_reporte(:carrera, :periodo, :clave, :nombre, :facultad, :initial_date, :final_date)",
array(
":carrera" => empty($carrera) ? null : $carrera,
":periodo" => $user->periodo_id,
":clave" => $profesor['clave'],
":nombre" => $profesor['profesor'],
":facultad" => $user->facultad['facultad_id'],
":initial_date" => $fecha_inicial->format("Y-m-d"),
":final_date" => $fecha_final->format("Y-m-d"),
),
);
// die(var_dump($asistencias));
$retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":facultad" => $user->facultad['facultad_id']))['retardo']; ?>
Reporte asistencias
= $profesor['profesor'] ?>
Clave:
= $profesor['clave'] ?>
Asistencia |
Retardo |
Sin registro | Justificada
Grupo |
Salón |
Materia |
Fecha |
Hora de clase |
Checado |
|
";
$check_icon = "";
$retardo_icon = "";
$justificado_icon = "";
# print_r($reporte);
foreach ($reporte as $row) {
# print_r($row);
$justificable = false;
if ($row["checado"] == 1)
if ($row["justificada"] == 1)
$checado = $justificado_icon;
else if ($row["retardo"] == 1)
$checado = $retardo_icon;
else
$checado = $check_icon;
else {
$checado = $cross_icon;
$justificable = true;
}
$fecha = date("d/m/Y", strtotime($row["fecha"]));
$hora = date("H:i", strtotime($row['hora']));
$hora_checado = is_null($row["hora_checado"]) ? '-' : date("H:i:s", strtotime($row["hora_checado"]));
$horario = $db->getOne("fget_horario({$row['id']})");
?>
">
= $row["grupo"] ?>
|
= $horario["salon"] ?>
|
">= $row["materia"] ?> |
= $fecha ?> |
= $días[date("w", strtotime($row["fecha"]))] ?>
|
= $hora ?> -
= join(":", array_slice(explode(":", $horario["hora_final"]), 0, 2)) ?>
|
= $checado ?>
|
= !$row["justificada"] ? $hora_checado : "Justificada" ?>
|
No hay registros para mostrar
{{message}}
¿Estás seguro de justificar esta falta?