Excel mejorado

This commit is contained in:
Your Name
2025-01-21 14:14:56 -06:00
parent 6bafc570f6
commit 5f3ae0350f
2 changed files with 13 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ $data = $db->query(
auditoria->>'facultad' as facultad,
auditoria->>'materia' as materia,
auditoria->>'carrera' as carrera,
auditoria->>'horario_grupo' as horario_grupo,
NULLIF(auditoria->>'horario_grupo', '') as horario_grupo,
auditoria->>'horario_hora_completa' as horario_hora_completa,
auditoria->>'salon' as salon,
(
@@ -48,6 +48,8 @@ $data = $db->query(
(auditoria->>'estado_supervisor_id')::integer as estado_id,
auditoria->>'registro_retardo' as registro_retardo
FROM last_auditoria
JOIN BLOQUE_HORARIO ON BLOQUE_HORARIO.ID = :bloque_horario_id
AND ((auditoria->>'horario_hora')::TIME, (auditoria->>'horario_fin')::TIME) OVERLAPS (HORA_INICIO, HORA_FIN)
WHERE USUARIO_ID = :usuario_id
AND auditoria->>'facultad_id' = COALESCE(:facultad_id, auditoria->>'facultad_id')
AND auditoria->>'profesor_clave' = COALESCE(:profesor_clave, auditoria->>'profesor_clave')",
@@ -55,6 +57,7 @@ $data = $db->query(
'usuario_id' => $user->user['id'],
'facultad_id' => $params['facultad_id'],
'profesor_clave' => $profesor_clave,
'bloque_horario_id' => $params['bloque_horario']
]
);
@@ -188,15 +191,20 @@ const DEFAULT_STYLE = [
function getFormattedValue($key, $registro)
{
return match ($key) {
'asistencia' => is_null($registro['registro_fecha']) ? "Sin registro" : ($registro['registro_retardo'] ? "Retardo " : "Asistencia "),
'asistencia' => $registro['registro_fecha'] === null
? "Sin registro"
: ($registro['registro_retardo'] ? "Retardo " : "Asistencia "),
'registro_fecha',
'registro_fecha_supervisor' => $registro[$key] === null ? 'Sin registro' : date('H:i', strtotime($registro[$key])),
'registro_fecha_supervisor' => $registro[$key] === null
? 'Sin registro'
: date('H:i', strtotime($registro[$key])),
'nombre' => $registro[$key] ?? "Sin registro",
'horario_hora_completa' => "{$registro['horario_hora']} - {$registro['horario_fin']}",
'usuario_nombre' => $registro[$key] ?? "Sin registro",
'salon_array' => $registro[$key],
'justificacion',
'comentario' => $registro[$key] ?? "Sin registro",
'horario_grupo' => $registro[$key] ?? "Sin registro",
'profesor_correo' => $registro[$key] ?? "Sin correo",
default => $registro[$key]
};
@@ -230,7 +238,7 @@ foreach ($data as $index => $registro) {
foreach ($sheet->getColumnIterator() as $column) {
$colIndex = $column->getColumnIndex();
if ($colIndex === 'Q') {
if (in_array($colIndex, ['Q', 'R'])) {
$sheet->getColumnDimension($colIndex)->setWidth(100); // Ajusta el valor según el tamaño deseado
} else {
$sheet->getColumnDimension($colIndex)->setAutoSize(true);