public function consolidadoSantaTeresita($idSalon, $periodo) { $area = new Area(); $areas = $area->leerAreas(); $pensum = new Pensum(); $pens = $pensum->leerPensum($idSalon); $persona = new Persona(); $estudiantes = $persona->leerPorSalon($idSalon); $salon = new Salon(); $sal = $salon->leerSalonePorId($idSalon); $grado = new Grado(); $grad = $grado->leerGradoPorId($sal->getIdGrado()); $nots = new Nota(); if ($periodo == "PRIMERO") { $puestos = $nots->leerPromedios($idSalon, "primerP"); } elseif ($periodo == "SEGUNDO") { $puestos = $nots->leerPromedios($idSalon, "segundoP"); } elseif ($periodo == "TERCERO") { $puestos = $nots->leerPromedios($idSalon, "tercerP"); } elseif ($periodo == "CUARTO") { $puestos = $nots->leerPromedios($idSalon, "cuartoP"); } $pdf = new FPDF('L', 'cm', 'Legal'); $pdf->SetMargins(0, 0, 0); $pdf->AddPage(); $x = 0; $y = 0.25; $pdf->SetXY($x, $y); $pdf->SetFont("Arial", "B", 14); $pdf->cell(31, 1, 'COLEGIO "SANTA TERESITA"', 0, 0, "C"); $y += 0.5; $pdf->SetXY($x, $y); $pdf->cell(31, 1, 'CONSOLIDADO DEL GRADO: ' . $idSalon . '. PERIODO: ' . $periodo, 0, 0, "C"); $y += 1; $pdf->SetFont("Arial", "B", 10); $pdf->SetXY($x, $y); $pdf->cell(0.5, 1.5, 'No.', 1, 0, "C"); $pdf->cell(9, 0.75, 'Asignaturas', 0, 0, "R"); $y += 0.75; $x += 0.5; $pdf->SetXY($x, $y); $pdf->cell(9, 0.75, 'Apellidos y Nombres', 0, 0, "L"); $y -= 0.75; $pdf->SetXY($x, $y); $pdf->cell(9, 1.5, '', 1, 0, "L"); $pdf->Line($x, $y, $x + 9, $y + 1.5); $y += 0.75; $x += 9; $pdf->SetXY($x, $y); $c = 0; $pdf->SetFont("Arial", "B", 7); $m = array(); for ($i = 0; $i < count($areas); $i++) { $c++; $cont = 0; foreach ($areas as $a) { if ($a->getIdArea() == "FIL") { $g = intval($grad->getIdGrado()); if ($g > 5) { if ($a->getOrden() == $c) { $mate = new Materia(); foreach ($pens as $p) { $materias = $mate->leerMateriaPorId($p->getIdMateria()); foreach ($materias as $materia) { $idMateria = $materia->getIdMateria(); $nombreMateria = substr($materia->getNombreMateria(), 0, 5); $horas = $materia->getHoras(); $idArea = $materia->getIdArea(); if ($idArea == $a->getIdArea()) { $pdf->cell(1.1, 0.75, $nombreMateria, 1, 0, "C"); $cont++; $m[] = $idMateria; } } } $y -= 0.75; $pdf->SetXY($x, $y); $w = $cont * 1.1; if ($cont == 1) { $nombreArea = substr($a->getNombreArea(), 0, 5); } else { if ($cont == 2) { $nombreArea = substr($a->getNombreArea(), 0, 10); } else { if ($cont == 3) { $nombreArea = substr($a->getNombreArea(), 0, 13); } else { $nombreArea = $a->getNombreArea(); } } } $pdf->cell($w, 0.75, utf8_decode($nombreArea), 1, 0, "C"); $x += $w; $y += 0.75; $pdf->SetXY($x, $y); } } } else { if ($a->getIdArea() == "ET") { if ($grad->getIdGrado() != "P" && $grad->getIdGrado() != "J") { if ($a->getOrden() == $c) { $mate = new Materia(); foreach ($pens as $p) { $materias = $mate->leerMateriaPorId($p->getIdMateria()); foreach ($materias as $materia) { $idMateria = $materia->getIdMateria(); $nombreMateria = substr($materia->getNombreMateria(), 0, 5); $horas = $materia->getHoras(); $idArea = $materia->getIdArea(); if ($idArea == $a->getIdArea()) { $pdf->cell(1.1, 0.75, $nombreMateria, 1, 0, "C"); $cont++; $m[] = $idMateria; } } } $y -= 0.75; $pdf->SetXY($x, $y); $w = $cont * 1.1; if ($cont == 1) { $nombreArea = substr($a->getNombreArea(), 0, 5); } else { if ($cont == 2) { $nombreArea = substr($a->getNombreArea(), 0, 10); } else { if ($cont == 3) { $nombreArea = substr($a->getNombreArea(), 0, 13); } else { $nombreArea = $a->getNombreArea(); } } } $pdf->cell($w, 0.75, utf8_decode($nombreArea), 1, 0, "C"); $x += $w; $y += 0.75; $pdf->SetXY($x, $y); } } } else { if ($a->getOrden() == $c) { $mate = new Materia(); foreach ($pens as $p) { $materias = $mate->leerMateriaPorId($p->getIdMateria()); foreach ($materias as $materia) { $idMateria = $materia->getIdMateria(); $nombreMateria = substr($materia->getNombreMateria(), 0, 5); $horas = $materia->getHoras(); $idArea = $materia->getIdArea(); if ($idArea == $a->getIdArea()) { $pdf->cell(1.1, 0.75, $nombreMateria, 1, 0, "C"); $cont++; $m[] = $idMateria; } } } $y -= 0.75; $pdf->SetXY($x, $y); $w = $cont * 1.1; if ($cont == 1) { $nombreArea = substr($a->getNombreArea(), 0, 5); } else { if ($cont == 2) { $nombreArea = substr($a->getNombreArea(), 0, 10); } else { if ($cont == 3) { $nombreArea = substr($a->getNombreArea(), 0, 13); } else { $nombreArea = $a->getNombreArea(); } } } $pdf->cell($w, 0.75, utf8_decode($nombreArea), 1, 0, "C"); $x += $w; $y += 0.75; $pdf->SetXY($x, $y); } } } } } $y -= 0.75; $pdf->SetXY($x, $y); $pdf->cell($w, 0.75 * 2, utf8_decode("PROM"), 1, 0, "C"); $pdf->cell($w, 0.75 * 2, utf8_decode("POS"), 1, 0, "C"); $x = 0; $y += 0.75 * 2; $j = 0; $pdf->SetXY($x, $y); $pdf->SetFont("Arial", "", 8); foreach ($estudiantes as $estudiante) { $matricula = new Matricula(); $matr = $matricula->leerMatriculaPorId($estudiante->getIdPersona()); $j++; $pdf->cell(0.5, 0.4, $j, 1, 0, "C"); $pdf->cell(9, 0.4, utf8_decode(strtoupper($estudiante->getPApellido() . " " . $estudiante->getSApellido() . " " . $estudiante->getNombres())), 1, 0, "L"); $conts = 0; foreach ($puestos as $puesto) { $conts++; if ($puesto["idPersona"] == $estudiante->getIdPersona()) { $p = $conts; $promedio = $puesto["prom"]; } } foreach ($m as $idMateria) { $nota = new Nota(); $not = $nota->leerNotaEstudiante($estudiante->getIdPersona(), $idMateria); switch ($periodo) { case "PRIMERO": $n = $not->getPrimerP(); break; case "SEGUNDO": $n = $not->getSegundoP(); break; case "TERCERO": $n = $not->getTercerP(); break; case "CUARTO": $n = $not->getCuartoP(); break; } if ($n < 70) { $pdf->SetTextColor(190, 21, 34); } $pdf->cell(1.1, 0.4, $n, 1, 0, "C"); $pdf->SetTextColor(0, 0, 0); } if ($promedio < 70) { $pdf->SetTextColor(190, 21, 34); } $pdf->cell(1.1, 0.4, round($promedio, 2), 1, 0, "C"); $pdf->SetTextColor(0, 0, 0); $pdf->cell(1.1, 0.4, $p, 1, 0, "C"); $y += 0.4; $x = 0; $pdf->SetXY($x, $y); } $pdf->Output("Consolidado " . $grad->getIdGrado(), "I"); }