eaiovnaovbqoebvqoeavibavo AddExtGState(array('ca' => $alpha, 'CA' => $alpha, 'BM' => '/' . $bm)); $this->SetExtGState($gs); } function AddExtGState($parms) { $n = count($this->extgstates) + 1; $this->extgstates[$n]['parms'] = $parms; return $n; } function SetExtGState($gs) { $this->_out(sprintf('/GS%d gs', $gs)); } function _enddoc() { if (!empty($this->extgstates) && $this->PDFVersion < '1.4') $this->PDFVersion = '1.4'; parent::_enddoc(); } function _putextgstates() { for ($i = 1; $i <= count($this->extgstates); $i++) { $this->_newobj(); $this->extgstates[$i]['n'] = $this->n; $this->_put('<extgstates[$i]['parms']; $this->_put(sprintf('/ca %.3F', $parms['ca'])); $this->_put(sprintf('/CA %.3F', $parms['CA'])); $this->_put('/BM ' . $parms['BM']); $this->_put('>>'); $this->_put('endobj'); } } function _putresourcedict() { parent::_putresourcedict(); $this->_put('/ExtGState <<'); foreach ($this->extgstates as $k => $extgstate) $this->_put('/GS' . $k . ' ' . $extgstate['n'] . ' 0 R'); $this->_put('>>'); } function _putresources() { $this->_putextgstates(); parent::_putresources(); } //girar texto function TextWithDirection($x, $y, $txt, $direction = 'R') { if ($direction == 'R') $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', 1, 0, 0, 1, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt)); elseif ($direction == 'L') $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', -1, 0, 0, -1, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt)); elseif ($direction == 'U') $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', 0, 1, -1, 0, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt)); elseif ($direction == 'D') $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', 0, -1, 1, 0, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt)); else $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt)); if ($this->ColorFlag) $s = 'q ' . $this->TextColor . ' ' . $s . ' Q'; $this->_out($s); } function TextWithRotation($x, $y, $txt, $txt_angle, $font_angle = 0) { $font_angle += 90 + $txt_angle; $txt_angle *= M_PI / 180; $font_angle *= M_PI / 180; $txt_dx = cos($txt_angle); $txt_dy = sin($txt_angle); $font_dx = cos($font_angle); $font_dy = sin($font_angle); $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', $txt_dx, $txt_dy, $font_dx, $font_dy, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt)); if ($this->ColorFlag) $s = 'q ' . $this->TextColor . ' ' . $s . ' Q'; $this->_out($s); } function obtener_sabana($nombreCursos, $id_grado, $bimestre) { //obtener datos del grado $consultas = new M_sabanas(); $datosGrado = $consultas->buscarGradoS($id_grado); $alumnos = $consultas->buscarAlumnos($id_grado); //encabezado $this->SetFont('Arial', 'B', 12); $this->SetTextColor(20); $this->setXY(15, 10); $this->Cell(40, 10, utf8_decode('Grado: ' . $datosGrado[0]['nombre_corto'])); $this->setXY(15, 15); $this->Cell(40, 10, utf8_decode('Bimestre: ' . $bimestre)); // Colores, ancho de línea y fuente en negrita $this->SetFont('Arial', '', 12); $this->SetFillColor(225, 228, 242); $this->SetTextColor(0, 0, 0); $this->SetDrawColor(191, 191, 201); $this->SetLineWidth(.1); $this->SetFont('', 'B'); $this->setXY(15, 25); //Encabezado de la tabla solo los espacios $this->Cell(10, 60, "No", 1, 0, 'C', true); $this->Cell(20, 60, "Carnet", 1, 0, 'C', true); $this->Cell(70, 60, "Apellidos y Nombres", 1, 0, 'C', true); $cantidadCursos = 0; $promedio = 0; foreach ($nombreCursos as $FNombre) { if (strpos($FNombre['nombre'], "Laboratorio") !== false || strpos($FNombre['nombre'], "Práctica") !== false) { } else { $this->Cell(10, 60, "", 1, 0, 'C', true); $cantidadCursos++; } } if ($id_grado >= 14) { $this->Cell(10, 60, "", 1, 0, 'C', true); $cantidadCursos++; } $this->Cell(10, 60, "", 1, 0, 'C', true); //validar que grado es por lo de danza, música y artes /*if($id_grado>=16 && $id_grado<=21 ){ $cantidadCursos-=2; }*/ if ($id_grado == 18 || $id_grado == 19) { $cantidadCursos--; } /*if($id_grado>=5 && $id_grado<=16){ $cantidadCursos--; }*/ if ($id_grado == 23 || $id_grado == 25 || $id_grado == 28 || $id_grado == 31) { $cantidadCursos--; } //texto del encabezado rotado $cont = 0; $this->SetFont('Arial', 'B', 10); foreach ($nombreCursos as $FNombre) { if (strpos($FNombre['nombre'], "Laboratorio") !== false || strpos($FNombre['nombre'], "Práctica") !== false) { } else { $nombreCurso = $this->TextWithDirection(121 + $cont, 83, utf8_decode($FNombre['nombre']), 'U'); $this->Cell(10, 60, $nombreCurso); $cont += 10; } } if ($id_grado >= 14) { $nombreCurso = $this->TextWithDirection(121 + $cont, 83, "Ingles varios niveles", 'U'); $this->Cell(10, 60, $nombreCurso); $cont += 10; } $nombreCurso = $this->TextWithDirection(121 + $cont, 83, "Promedio", 'U'); $this->Cell(10, 60, $nombreCurso); $cont += 10; //Impresión de las notas $fill = false; $contador = 1; $this->setXY(15, 85); foreach ($alumnos as $FAlumno) { $this->setX(15); $this->SetTextColor(59, 58, 58); $this->SetFontSize(9); $this->Cell(10, 9, $contador, 1, 0, 'C', $fill); $this->Cell(20, 9, $FAlumno['carnet'], 1, 0, 'C', $fill); $this->SetFontSize(8); $this->Cell(70, 9, utf8_decode(" " . $FAlumno['apellidos'] . ', ' . $FAlumno['nombres']), 1, 0, 'L', $fill); $this->SetFontSize(9); //IMPRESIÓN DE NOTAS DE CADA ALUMNO $datosNotas = $consultas->buscarNotasAlumno($FAlumno['carnet'], $bimestre); foreach ($datosNotas as $FNota) { if (strpos($FNota['nombreCurso'], "Laboratorio") !== false || strpos($FNota['nombreCurso'], "Práctica") !== false) { } else { if ($FNota['punteo'] < 60 && $FNota['punteo'] > 0) { $this->SetTextColor(204, 4, 41); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } elseif ($FNota['punteo'] >= 60 && $FNota['punteo'] < 70) { $this->SetTextColor(177, 4, 204); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } else { $this->SetTextColor(59, 58, 58); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } if ($FNota['nombreCurso'] != "Seminario") { $promedio += intval($FNota['punteo']); } } } $datosNotasI = $consultas->buscarNotasAlumnoIngles($FAlumno['carnet'], $bimestre); if ($datosNotasI) { foreach ($datosNotasI as $FNota) { if ($FNota['punteo'] < 60 && $FNota['punteo'] > 0) { $this->SetTextColor(204, 4, 41); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } elseif ($FNota['punteo'] >= 60 && $FNota['punteo'] < 70) { $this->SetTextColor(177, 4, 204); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } else { $this->SetTextColor(59, 58, 58); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } $promedio += intval($FNota['punteo']); } } //promedio $promedio = round($promedio / $cantidadCursos, 2); if ($promedio < 60 && $promedio > 0) { $this->SetTextColor(204, 4, 41); $this->Cell(10, 9, $promedio, 1, 0, 'C', $fill); } elseif ($promedio >= 60 && $promedio < 70) { $this->SetTextColor(177, 4, 204); $this->Cell(10, 9, $promedio, 1, 0, 'C', $fill); } else { $this->SetTextColor(59, 58, 58); $this->Cell(10, 9, $promedio, 1, 0, 'C', $fill); } $promedio = 0; $this->Ln(); $fill = !$fill; $contador++; } } function obtener_sabanaT($nombreCursos, $id_grado, $bimestre) { //obtener datos del grado $consultas = new M_sabanas(); $datosGrado = $consultas->buscarGradoS($id_grado); $alumnos = $consultas->buscarAlumnos($id_grado); $bimestre_activo = $consultas->buscarBimestreActivo(); $bimestreDividir = $bimestre_activo['bimestre']; //encabezado $this->SetFont('Arial', 'B', 12); $this->SetTextColor(20); $this->setXY(15, 10); $this->Cell(40, 10, utf8_decode('Grado: ' . $datosGrado[0]['nombre_corto'])); $this->setXY(15, 15); $this->Cell(40, 10, utf8_decode('Bimestre: Todos')); // Colores, ancho de línea y fuente en negrita $this->SetFont('Arial', '', 12); $this->SetFillColor(225, 228, 242); $this->SetTextColor(0, 0, 0); $this->SetDrawColor(191, 191, 201); $this->SetLineWidth(.1); $this->SetFont('', 'B'); $this->setXY(15, 25); //Encabezado de la tabla solo los espacios $this->Cell(10, 60, "No", 1, 0, 'C', true); $this->Cell(20, 60, "Carnet", 1, 0, 'C', true); $this->Cell(70, 60, "Apellidos y Nombres", 1, 0, 'C', true); $cantidadCursos = 0; $promedio = 0; foreach ($nombreCursos as $FNombre) { if (strpos($FNombre['nombre'], "Laboratorio") !== false || strpos($FNombre['nombre'], "LÓGICA MATEMÁTICA") !== false) { } else { $this->Cell(10, 60, "", 1, 0, 'C', true); $cantidadCursos++; } } if ($id_grado >= 14) { $this->Cell(10, 60, "", 1, 0, 'C', true); //$cantidadCursos++; } $this->Cell(10, 60, "", 1, 0, 'C', true); //validar que grado es por lo de danza, música y artes /*if($id_grado==16 || $id_grado==17 || $id_grado==20 || $id_grado==21 ){ $cantidadCursos-=2; }*/ /*if($id_grado==18 || $id_grado==19){ $cantidadCursos--; }*/ /*if($id_grado>=5 && $id_grado<=16){ $cantidadCursos--; }*/ /*if($id_grado==28 || $id_grado==31){ $cantidadCursos--; }*/ //texto del encabezado rotado $cont = 0; $this->SetFont('Arial', 'B', 10); foreach ($nombreCursos as $FNombre) { if (strpos($FNombre['nombre'], "Laboratorio") !== false || strpos($FNombre['nombre'], "LÓGICA MATEMÁTICA") !== false) { } else { $nombreCurso = $this->TextWithDirection(121 + $cont, 83, utf8_decode($FNombre['nombre']), 'U'); $this->Cell(10, 60, $nombreCurso); $cont += 10; } } if ($id_grado >= 14) { $nombreCurso = $this->TextWithDirection(121 + $cont, 83, "Ingles varios niveles", 'U'); $this->Cell(10, 60, $nombreCurso); $cont += 10; } $nombreCurso = $this->TextWithDirection(121 + $cont, 83, "Promedio", 'U'); $this->Cell(10, 60, $nombreCurso); $cont += 10; //Impresión de las notas $fill = false; $contador = 1; $this->setXY(15, 85); foreach ($alumnos as $FAlumno) { $this->setX(15); $this->SetTextColor(59, 58, 58); $this->SetFontSize(9); $this->Cell(10, 9, $contador, 1, 0, 'C', $fill); $this->Cell(20, 9, $FAlumno['carnet'], 1, 0, 'C', $fill); $this->SetFontSize(8); $this->Cell(70, 9, utf8_decode(" " . $FAlumno['apellidos'] . ', ' . $FAlumno['nombres']), 1, 0, 'L', $fill); $this->SetFontSize(9); //IMPRESIÓN DE NOTAS DE CADA ALUMNO $data[] = null; $datosNotas1 = $consultas->buscarNotasAlumno($FAlumno['carnet'], 1); $datosNotas2 = $consultas->buscarNotasAlumno($FAlumno['carnet'], 2); $datosNotas3 = $consultas->buscarNotasAlumno($FAlumno['carnet'], 3); $datosNotas4 = $consultas->buscarNotasAlumno($FAlumno['carnet'], 4); if ($datosNotas1 != null) { for ($i = 0; $i < sizeof($datosNotas1); $i++) { $data[$i] = [ "nombreCurso" => $datosNotas1[$i]['nombreCurso'], "punteo" => $datosNotas1[$i]['punteo'], "extracurricular" => $datosNotas1[$i]['extracurricular'] ]; } } if ($datosNotas2 != null) { for ($i = 0; $i < sizeof($datosNotas2); $i++) { $data[$i]['punteo'] += $datosNotas2[$i]['punteo']; } } if ($datosNotas3 != null) { for ($i = 0; $i < sizeof($datosNotas3); $i++) { $data[$i]['punteo'] += $datosNotas3[$i]['punteo']; } } if ($datosNotas4 != null) { for ($i = 0; $i < sizeof($datosNotas4); $i++) { $data[$i]['punteo'] += $datosNotas4[$i]['punteo']; if ($datosNotas4[$i]['nombreCurso'] != "Seminario") { $data[$i]['punteo'] = round($data[$i]['punteo'] / $bimestreDividir, 0); } } } $cont_perdidos = 0; /*----------------------INICIO DE AJUSTE POR ÁLGEBRA QUE SE UNO A MATERIAS DE MATEMÁTICAS------------------*/ //PRIMERO OBTENEMOS LA NOTA DE ÁLGEBRA $notaAlgebra = 0; foreach ($data as $FNota) { if ($FNota['nombreCurso'] == 'ÁLGEBRA') { $notaAlgebra = $FNota['punteo']; } } $notaAlgebra = round($notaAlgebra * 0.1, 0); //AHORA BUSCAMOS EL CURSO QUE DEBE INTEGRARSE; if($notaAlgebra!=0){ foreach ($data as &$Fnota) { if ($Fnota['nombreCurso'] == 'Matemáticas' || $Fnota['nombreCurso'] == 'Matemática 4' || $Fnota['nombreCurso'] == 'Matemática 5' || $Fnota['nombreCurso'] == 'Matemática IV' || $Fnota['nombreCurso'] == 'Matemática V' || $Fnota['nombreCurso'] == 'Matemática Comercial' || $Fnota['nombreCurso'] == 'Cálculo Mercantil y Financiero' || $Fnota['nombreCurso'] == 'Estadística' || $Fnota['nombreCurso'] == 'Matemática' || $Fnota['nombreCurso'] == 'MATEMÁTICA APLICADA') { $Fnota['punteo'] = $Fnota['punteo'] + round($notaAlgebra / $bimestreDividir); if ($Fnota['punteo'] > 100) { $Fnota['punteo'] = 100; } } } } /*----------------------FIN DE AJUSTE POR ÁLGEBRA QUE SE UNO A MATERIAS DE MATEMÁTICAS------------------*/ foreach ($data as $FNota) { if (strpos($FNota['nombreCurso'], "Laboratorio") !== false || strpos($FNota['nombreCurso'], "LÓGICA MATEMÁTICA") !== false) { } else { if (round($FNota['punteo'], 0) < 60 && round($FNota['punteo'], 0) > 0) { $this->SetTextColor(204, 4, 41); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } elseif (round($FNota['punteo'], 0) >= 60 && round($FNota['punteo'], 0) < 70) { $this->SetTextColor(177, 4, 204); $this->Cell(10, 9, round($FNota['punteo'], 2), 1, 0, 'C', $fill); } else { $this->SetTextColor(59, 58, 58); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } if ($FNota['nombreCurso'] != "Seminario") { $promedio += round($FNota['punteo'], 0); } if (round($FNota['punteo'], 0) < 60 && $FNota['extracurricular'] == 0) { $cont_perdidos++; } } } if ($id_grado >= 14) { $dataI[] = null; $datosNotasI1 = $consultas->buscarNotasAlumnoIngles($FAlumno['carnet'], 1); $datosNotasI2 = $consultas->buscarNotasAlumnoIngles($FAlumno['carnet'], 2); $datosNotasI3 = $consultas->buscarNotasAlumnoIngles($FAlumno['carnet'], 3); $datosNotasI4 = $consultas->buscarNotasAlumnoIngles($FAlumno['carnet'], 4); if ($datosNotasI1 != null) { for ($i = 0; $i < sizeof($datosNotasI1); $i++) { $dataI[$i] = [ "nombreCurso" => $datosNotasI1[$i]['nombreCurso'], "punteo" => $datosNotasI1[$i]['punteo'] ]; } } if ($datosNotasI2 != null) { for ($i = 0; $i < sizeof($datosNotasI2); $i++) { $dataI[$i]['punteo'] += $datosNotasI2[$i]['punteo']; } } if ($datosNotasI3 != null) { for ($i = 0; $i < sizeof($datosNotasI3); $i++) { $dataI[$i]['punteo'] += $datosNotasI3[$i]['punteo']; } } if ($datosNotasI4 != null) { for ($i = 0; $i < sizeof($datosNotasI4); $i++) { $dataI[$i]['punteo'] += $datosNotasI4[$i]['punteo']; $dataI[$i]['punteo'] = round($dataI[$i]['punteo'] / $bimestreDividir, 0); } } foreach ($dataI as $FNota) { if ($FNota['punteo'] < 60 && $FNota['punteo'] > 0) { $this->SetTextColor(204, 4, 41); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } elseif ($FNota['punteo'] >= 60 && $FNota['punteo'] < 70) { $this->SetTextColor(177, 4, 204); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } else { $this->SetTextColor(59, 58, 58); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } $promedio += round($FNota['punteo'], 0); } } //promedio if ($id_grado == 23 || $id_grado == 25 || $id_grado == 28 || $id_grado == 31) { $promedio = round($promedio / ($cantidadCursos), 2); } else if ($id_grado >= 16 && $id_grado <= 31) { $promedio = round($promedio / ($cantidadCursos + 1), 2); } else { $promedio = round($promedio / ($cantidadCursos), 2); } if ($promedio < 60 && $promedio > 0) { $this->SetTextColor(204, 4, 41); $this->Cell(10, 9, $promedio, 1, 0, 'C', $fill); } elseif ($promedio >= 60 && $promedio < 70) { $this->SetTextColor(177, 4, 204); $this->Cell(10, 9, $promedio, 1, 0, 'C', $fill); } else { $this->SetTextColor(59, 58, 58); $this->Cell(10, 9, $promedio, 1, 0, 'C', $fill); } //para imprimir cantidad cursos perdidos /*if($id_grado>=16 && $id_grado<=21){ $cont_perdidos-=2; }*/ $this->SetTextColor(59, 58, 58); $this->Cell(10, 9, round($cont_perdidos, 0), 1, 0, 'C', $fill); $promedio = 0; $this->Ln(); $fill = !$fill; $contador++; unset($data); unset($dataI); } } function obtener_sabanaLab($nombreCursos, $id_grado, $bimestre) { //obtener datos del grado $consultas = new M_sabanas(); $datosGrado = $consultas->buscarGradoS($id_grado); $alumnos = $consultas->buscarAlumnos($id_grado); //encabezado $this->SetFont('Arial', 'B', 12); $this->SetTextColor(20); $this->setXY(15, 10); $this->Cell(40, 10, utf8_decode('Grado: ' . $datosGrado[0]['nombre_corto'])); $this->setXY(15, 15); $this->Cell(40, 10, utf8_decode('Bimestre: ' . $bimestre)); // Colores, ancho de línea y fuente en negrita $this->SetFont('Arial', '', 12); $this->SetFillColor(225, 228, 242); $this->SetTextColor(0, 0, 0); $this->SetDrawColor(191, 191, 201); $this->SetLineWidth(.1); $this->SetFont('', 'B'); $this->setXY(15, 25); //Encabezado de la tabla solo los espacios $this->Cell(10, 60, "No", 1, 0, 'C', true); $this->Cell(20, 60, "Carnet", 1, 0, 'C', true); $this->Cell(70, 60, "Apellidos y Nombres", 1, 0, 'C', true); $cantidadCursos = 0; $promedio = 0; foreach ($nombreCursos as $FNombre) { $this->Cell(10, 60, "", 1, 0, 'C', true); $cantidadCursos++; } $this->Cell(10, 60, "", 1, 0, 'C', true); //texto del encabezado rotado $cont = 0; $this->SetFont('Arial', 'B', 10); foreach ($nombreCursos as $FNombre) { $nombreCurso = $this->TextWithDirection(121 + $cont, 83, utf8_decode($FNombre['nombre']), 'U'); $this->Cell(10, 60, $nombreCurso); $cont += 10; } $nombreCurso = $this->TextWithDirection(121 + $cont, 83, "Promedio", 'U'); $this->Cell(10, 60, $nombreCurso); $cont += 10; //Impresión de las notas $fill = false; $contador = 1; $this->setXY(15, 85); foreach ($alumnos as $FAlumno) { $this->setX(15); $this->SetTextColor(59, 58, 58); $this->SetFontSize(9); $this->Cell(10, 9, $contador, 1, 0, 'C', $fill); $this->Cell(20, 9, $FAlumno['carnet'], 1, 0, 'C', $fill); $this->SetFontSize(8); $this->Cell(70, 9, utf8_decode(" " . $FAlumno['apellidos'] . ', ' . $FAlumno['nombres']), 1, 0, 'L', $fill); $this->SetFontSize(9); //IMPRESIÓN DE NOTAS DE CADA ALUMNO $datosNotas = $consultas->buscarNotasAlumnoLab($FAlumno['carnet'], $bimestre); foreach ($datosNotas as $FNota) { if ($FNota['punteo'] < 60 && $FNota['punteo'] > 0) { $this->SetTextColor(204, 4, 41); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } elseif ($FNota['punteo'] >= 60 && $FNota['punteo'] < 70) { $this->SetTextColor(177, 4, 204); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } else { $this->SetTextColor(59, 58, 58); $this->Cell(10, 9, round($FNota['punteo'], 0), 1, 0, 'C', $fill); } if ($FNota['nombreCurso'] != "Seminario") { $promedio += intval($FNota['punteo']); } } //promedio $promedio = round($promedio / $cantidadCursos, 0); if ($promedio < 60 && $promedio > 0) { $this->SetTextColor(204, 4, 41); $this->Cell(10, 9, $promedio, 1, 0, 'C', $fill); } elseif ($promedio >= 60 && $promedio < 70) { $this->SetTextColor(177, 4, 204); $this->Cell(10, 9, $promedio, 1, 0, 'C', $fill); } else { $this->SetTextColor(59, 58, 58); $this->Cell(10, 9, $promedio, 1, 0, 'C', $fill); } $promedio = 0; $this->Ln(); $fill = !$fill; $contador++; } } }