From 3fbe88652f9e05ec84fafeaad8b6c06e6c698570 Mon Sep 17 00:00:00 2001 From: AlexLara Date: Tue, 28 Jan 2025 12:05:45 -0600 Subject: [PATCH] Columnas agregadas --- export/solicitudes_excel.php | 73 +++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/export/solicitudes_excel.php b/export/solicitudes_excel.php index 43dc006..960e89c 100644 --- a/export/solicitudes_excel.php +++ b/export/solicitudes_excel.php @@ -92,16 +92,32 @@ foreach($repEdo_rs as $redo){ $drawing->setWorksheet($spreadsheet->getActiveSheet()); $spreadsheet->getActiveSheet() - ->setCellValue('A'.$row, 'Estado') + /*->setCellValue('A'.$row, 'Estado') ->setCellValue('B'.$row, 'Tipo') ->setCellValue('C'.$row, 'Profesor') ->setCellValue('D'.$row, 'Materia') ->setCellValue('E'.$row, 'Grupo') ->setCellValue('F'.$row, 'Fecha falta') ->setCellValue('G'.$row, 'Fecha reposición') - ->setCellValue('H'.$row, 'Salón'); + ->setCellValue('H'.$row, 'Salón');*/ + ->setCellValue('A'.$row, 'Tipo de solicitud') + ->setCellValue('B'.$row, 'Profesor') + ->setCellValue('C'.$row, 'Dependencia') + ->setCellValue('D'.$row, 'Carrera') + ->setCellValue('E'.$row, 'Materia') + ->setCellValue('F'.$row, 'Grupo') + ->setCellValue('G'.$row, 'Ciclo') + ->setCellValue('H'.$row, 'Bloque') + ->setCellValue('I'.$row, 'Fecha de falta') + ->setCellValue('J'.$row, 'Horario de falta inicio') + ->setCellValue('K'.$row, 'Horario de falta fin') + ->setCellValue('L'.$row, 'Fecha de reposición') + ->setCellValue('M'.$row, 'Horario de reposición inicio') + ->setCellValue('N'.$row, 'Horario de reposición fin') + ->setCellValue('O'.$row, 'Tipo de aula') + ->setCellValue('P'.$row, 'Salón'); - $spreadsheet->getActiveSheet()->getStyle('A'.$row.':H'.$row)->applyFromArray($headerStyle); + $spreadsheet->getActiveSheet()->getStyle('A'.$row.':P'.$row)->applyFromArray($headerStyle); $repoParams[":edo"]=$redo["estado_reposicion_id"]; if($user->rol["rol_id"] == 7){//es supervisor $repoParams[":sup"] = $user->user["id"]; @@ -115,28 +131,43 @@ foreach($repEdo_rs as $redo){ $sheet->setTitle($redo["estado_nombre"]); if(isset($solicitudes_rs) && count($solicitudes_rs)>0){ foreach($solicitudes_rs as $reposicion){ - - - $sheet->setCellValue('A'.$row, $reposicion["estado_nombre"]); - $sheet->setCellValue('B'.$row, $reposicion["solicitudtipo_nombre"]); - $sheet->setCellValue('C'.$row, $reposicion["profesor_clave"]." - ".$reposicion["profesor_nombre"]); - $sheet->setCellValue('D'.$row, $reposicion["materia_nombre"]); +/* RETURNS TABLE(solicitud_id integer, horario_id integer, fecha_nueva date, hora_nueva time without time zone, hora_nueva_fin time without time zone, +profesor_id integer, profesor_nombre character varying, profesor_clave character varying, descripcion text, estado_reposicion_id integer, +estado_nombre character varying, estado_color character varying, alumnos integer, fecha_clase date, tipoaula_id integer, tipoaula_nombre character varying, +tipoaula_supervisor boolean, solicitudtipo_id integer, solicitudtipo_nombre character varying, salon_id integer, salon_nombre character varying, +salon_array json, usuario_id integer, usuario_nombre character varying, bloque integer, ciclo integer, duracion_interval interval, supervisor_id integer, +supervisor_nombre character varying, facultad_id integer, facultad_nombre character varying, clave_dependencia character varying, carrera_nombre character varying, +materia_id integer, materia_nombre character varying, horario_grupo character varying, horario_hora time without time zone, horario_hora_fin time without time zone, +motivo_cancelacion text, horario_dia integer, horario_carrera character varying, carrera_comun boolean) + */ + $sheet->setCellValue('A'.$row, $reposicion["solicitudtipo_nombre"]); + $sheet->setCellValue('B'.$row, $reposicion["profesor_clave"]." - ".$reposicion["profesor_nombre"]); + $sheet->setCellValue('C'.$row, $reposicion["facultad_nombre"]); + $sheet->setCellValue('D'.$row, $reposicion["carrera_nombre"]); + $sheet->setCellValue('E'.$row, $reposicion["materia_nombre"]); if($reposicion["horario_grupo"]!="") - $sheet->setCellValue('E'.$row, $reposicion["horario_grupo"]); - - if($reposicion["fecha_clase"]!=""){ - $fechaI = DateTime::createFromFormat('Y-m-d', $reposicion["fecha_nueva"])->format('d/m/Y'); - $sheet->setCellValue('F'.$row, $fechaI." ".substr($reposicion["horario_hora"],0, 5)); + $sheet->setCellValue('F'.$row, $reposicion["horario_grupo"]); + else + $sheet->setCellValue('F'.$row, "Sin grupo"); + $sheet->setCellValue('G'.$row, $reposicion["ciclo"]); + $sheet->setCellValue('H'.$row, $reposicion["bloque"]); + if(!empty($reposicion["fecha_clase"])){ + $fechaI = DateTime::createFromFormat('Y-m-d', $reposicion["fecha_clase"])->format('d/m/Y'); + $sheet->setCellValue('I'.$row, $fechaI); + $sheet->setCellValue('J'.$row, "".substr($reposicion["horario_hora"],0, 5)); + $sheet->setCellValue('K'.$row, "".substr($reposicion["horario_hora_fin"],0, 5)); } - - $fechaF = date("d/m/Y", strtotime($reposicion["fecha_nueva"])); - $sheet->setCellValue('G'.$row, $fechaF." ".substr($reposicion["hora_nueva"],0, 5)." a ".substr($reposicion["hora_nueva_fin"],0, 5)); - + $fechaF = DateTime::createFromFormat('Y-m-d', $reposicion["fecha_nueva"])->format('d/m/Y'); + $sheet->setCellValue('L'.$row, $fechaF); + $sheet->setCellValue('M'.$row, "".substr($reposicion["hora_nueva"],0, 5)); + $sheet->setCellValue('N'.$row, "".substr($reposicion["hora_nueva_fin"],0, 5)); + $sheet->setCellValue('O'.$row, $reposicion["tipoaula_nombre"]); if($reposicion["salon_id"] != ""){ $salon_json = json_decode($reposicion["salon_array"], true); - $sheet->setCellValue('H'.$row, $salon_json[count($salon_json)-1]); + $sheet->setCellValue('P'.$row, $salon_json[count($salon_json)-1]); }else - $sheet->setCellValue('H'.$row, "Pendiente"); + $sheet->setCellValue('P'.$row, "Pendiente"); + $row++; }//foreach @@ -145,7 +176,7 @@ foreach($repEdo_rs as $redo){ foreach ($sheet->getColumnIterator() as $column) { $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true); } - $sheet->setAutoFilter('A'.$row_base.':H'.$row_base); + $sheet->setAutoFilter('A'.$row_base.':P'.$row_base); $i++; } $spreadsheet->setActiveSheetIndex(0);