$result = mysql_query($myQuery) or die(mysql_error()); //******************************************************************* //Lets set up the output //******************************************************************* $getHandler = new EBAGetHandler(); //First we define the columns we are sending in each record, and name each field. //We will do this by using the EBAGetHandler_DefineField function. We will name each //field of data after its column name in the database. $getHandler->DefineField("rut"); $getHandler->DefineField("nombreCompleto"); //$getHandler->DefineField("promedio"); # Controla el semestre //dpr($_GET); $offset = $_GET['periodo'] == '2S' ? 15 : 0; //dpr($_GET['periodo']); $class_colegio = new colegio(); $j = 1; for ($i = 1 + $offset; $i <= 15 + $offset; $i++) { $getHandler->DefineField("n" . $j++); } $class_notas = new notas(); $_SESSION['aux_ramo'] = $_GET['ramo']; $asignatura = $class_notas->promedioSemestreAsignatura($_GET['ramo'], $_GET['curso'], $_GET['periodo']); $label_prom = "promedio"; $getHandler->DefineField($label_prom); //foreach ($asignatura[$_GET['ramo']]['alumnos'] AS $rut_alum => $prom_alum): // ******************************************************************* // Lets loop through our data and send it to the grid // ******************************************************************* $nrows = mysql_num_rows($result); for ($counter = 0; $counter < $nrows; $counter++) {
function promedioAlumno($rut, $ramos, $redondeo = true) { $promedio = null; $class_colegio = new colegio(); $SQL = "\tSELECT * FROM notas AS n\r\n\t\t\t\tINNER JOIN ramos AS r\r\n\t\t\t\tON r.nombre = n.ramo \r\n\t\t\t\tWHERE n.rut IN {$rut} \r\n\t\t\t\tAND n.ramo IN {$ramos}\r\n\t\t\t\tORDER BY r.num"; $result = DBQuery($SQL, $this->dbh); while ($row = DBFetchArray($result)) { $notas = $this->array_notas($row); $promedio_aux[$row['rut']]['1S'][$row['ramo']] = $promedio[$row['rut']]['ramos'][$row['ramo']]['1S'] = $class_colegio->ponderaSemestre($this->promedio($notas['1S']), $row['examen1']); $promedio_aux[$row['rut']]['2S'][$row['ramo']] = $promedio[$row['rut']]['ramos'][$row['ramo']]['2S'] = $class_colegio->ponderaSemestre($this->promedio($notas['2S']), $row['examen2']); $promedio_aux[$row['rut']]['anual'][$row['ramo']] = $promedio[$row['rut']]['ramos'][$row['ramo']]['anual'] = $class_colegio->ponderaAnual($promedio_aux[$row['rut']]['1S'][$row['ramo']], $promedio_aux[$row['rut']]['2S'][$row['ramo']], $row['examen_anual'], $row['examen2']); } if (isset($promedio_aux)) { if (count($promedio_aux) > 0) { foreach ($promedio_aux as $rut => $notas) { $notasReligion = $this->obtenerNotasReligion($rut); $promedio[$rut]['ramos']['RELIGION']['notas']['1S'] = $this->promedio($notasReligion['1S']); $promedio[$rut]['ramos']['RELIGION']['notas']['2S'] = $this->promedio($notasReligion['2S']); $promedio[$rut]['ramos']['RELIGION']['1S'] = $this->concepto_religion($notasReligion['1S']); $promedio[$rut]['ramos']['RELIGION']['2S'] = $this->concepto_religion($notasReligion['2S']); //$promedio[$rut]['ramos']['RELIGION']['concepto1S'] = $this->concepto_religion($promedio[$rut]['ramos']['RELIGION']['1S']); $promedio[$rut]['ramos']['RELIGION']['notas']['anual'] = $this->promedio(array($promedio[$rut]['ramos']['RELIGION']['notas']['1S'], $promedio[$rut]['ramos']['RELIGION']['notas']['2S'])); $promedio[$rut]['ramos']['RELIGION']['anual'] = $this->concepto_religion(array($promedio[$rut]['ramos']['RELIGION']['notas']['1S'], $promedio[$rut]['ramos']['RELIGION']['notas']['2S'])); $promedio[$rut]['1S'] = $this->promedio($promedio_aux[$rut]['1S'], $redondeo); $promedio[$rut]['2S'] = $this->promedio($promedio_aux[$rut]['2S'], $redondeo); if ($promedio[$rut]['1S'] && $promedio[$rut]['2S']) { $promedio[$rut]['anual'] = $this->promedio($promedio_aux[$rut]['anual'], $redondeo); } else { $promedio[$rut]['anual'] = null; } } } } return $promedio; }
<?php session_start(); require "../main_Lib.php"; include_once "../class/class_notas.php"; include_once "../class/class_" . $_SESSION['path'] . ".php"; include_once '../fpdf153/fpdf.php'; if ($_SESSION['token'] != $token) { session_destroy(); moveLocation("../ingreso.php", 0, 2); } set_time_limit(600); $class_colegio = new colegio(); $class_notas = new notas(); $periodo = $_GET['periodo']; $x1 = $periodo == '1S' ? "Primer Semestre " : "Segundo Semestre "; $x1 .= $_SESSION['base_datos']->anio; $offset = $periodo == '1S' ? 0 : 15; $curso = $_GET['curso']; class PDF extends FPDF { function encabezado($x1) { $this->SetFillColor(255, 255, 255); $this->SetTextColor(1); $this->SetFont('Arial', 'I', 16); $this->Cell(0, 10, $_SESSION['colegio']->nombre, 0, 1, 'C'); $this->SetFont('Arial', 'I', 8); $this->Cell(0, 5, 'Avance de Notas - ' . $x1, 0, 1, 'C', 0); $this->Ln(10); }