Initial Commit
This commit is contained in:
39
action/action_asistencias.php
Normal file
39
action/action_asistencias.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
// check if the session is started
|
||||
$user = Login::get_user();
|
||||
extract($_POST);
|
||||
|
||||
$initial_date = DateTime::createFromFormat('d/m/Y', $fecha_inicial);
|
||||
$final_date = DateTime::createFromFormat('d/m/Y', $fecha_final);
|
||||
|
||||
if ($initial_date > $final_date) {
|
||||
echo json_encode(['error' => 'La fecha inicial no puede ser mayor a la fecha final']);
|
||||
die;
|
||||
}
|
||||
// Nombre del profesor es opcional
|
||||
$params = [
|
||||
':carrera' => empty($carrera) ? null : $carrera,
|
||||
':periodo' => $periodo,
|
||||
':nombre' => empty($nombre) ? null : $nombre,
|
||||
':clave' => empty($clave) ? null : $clave,
|
||||
':initial_date' => $initial_date->format('Y-m-d'),
|
||||
':final_date' => $final_date->format('Y-m-d'),
|
||||
':facultad' => $facultad,
|
||||
];
|
||||
|
||||
$response = json_encode(
|
||||
[
|
||||
"retardo" => query("SELECT FS_HAS_RETARDO(:facultad) retardo", [
|
||||
'facultad' => $facultad
|
||||
]),
|
||||
"reporte" => queryAll(
|
||||
"SELECT * FROM fs_asistencia_reporte(:carrera, :periodo, :clave, :nombre, :facultad, :initial_date, :final_date) where total > 0",
|
||||
$params
|
||||
)
|
||||
]
|
||||
);
|
||||
$user->print_to_log("Genera reporte de asistencias", old: $params);
|
||||
echo $response;
|
||||
Reference in New Issue
Block a user