$nrows = mysql_num_rows($result); for ($counter = 0; $counter < $nrows; $counter++) { $row = mysql_fetch_array($result); $record = new EBARecord($row["rut"]); $record->add("nombreCompleto", $row['apellidop'] . " " . $row['apellidom'] . " " . $row['nombres']); $record->add($label_prom, $asignatura[$_GET['ramo']]['alumnos'][$row["rut"]]); //$record->add("matricula", $row['matricula']); //$record->add("rut", $row["rut"]); $exam_aux = $_GET['periodo'] == '2S' ? 'examen2' : 'examen1'; $examen = $row[$exam_aux] > 0 ? number_format($row[$exam_aux], 1, ".", ",") : null; //$record->add("examen", $examen); $record->add("examen", $examen); if ($_GET['periodo'] == '2S' && $_SESSION['colegio']->colegio_ID == "dor") { $record->add("examen_anual", $row['examen_anual'] > 1 ? number_format($row['examen_anual'], 1, ".", ",") : null); } $j = 1; for ($i = 1 + $offset; $i <= 15 + $offset; $i++) { $notas[] = $row['n' . $i]; $record->add("nota" . $j++, $row['n' . $i] > 0 ? number_format($row['n' . $i], 1, ".", ",") : null); } //$prom_alumno = $class_notas->promedioAlumno("('$row[rut]')", "('')") $promedio = $class_colegio->promedio($notas); $promedio_ponderado = $class_colegio->ponderaSemestre($promedio, $examen); //$record->add("promedio", $promedio_ponderado); $getHandler->add($record); unset($notas); } $getHandler->CompleteGet(); ?>
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; }
$pdf->SetFont('Arial', 'I', 6); $pdf->Cell(50, 5, str_cortar($row["ramo"], 35), 1); $pdf->Cell(1, 5, "", 0, 0, 'C', 0); for ($i = 1 + $offset; $i <= 15 + $offset; $i++) { $pdf->SetFont('Arial', 'I', 8); $n[$i] = $row["n{$i}"] ? number_format($row["n{$i}"], 1, ".", ",") : null; $n[$i] < 4 ? $pdf->SetTextColor(255, 0, 0) : $pdf->SetTextColor(0, 0, 255); $pdf->Cell(8, 5, $n[$i], 1, 0); } $exam_aux = $examen = $periodo == '1S' ? $row['examen1'] : $row['examen2']; $examen = $examen ? number_format($examen, 1, ".", ",") : null; $examen < 4 ? $pdf->SetTextColor(255, 0, 0) : $pdf->SetTextColor(0, 0, 255); $pdf->Cell(1, 5, "", 0, 0, 'C', 0); $pdf->Cell(8, 5, $examen, 1, 0, 'C', 0); $promedio = $class_colegio->promedio($n); $promedio_asignatura = $class_colegio->ponderaSemestre($promedio, $exam_aux); $promedio_asignatura = $promedio_asignatura ? number_format($promedio_asignatura, 1, ".", ",") : null; $promedio_asignatura < 4 ? $pdf->SetTextColor(255, 0, 0) : $pdf->SetTextColor(0, 0, 255); $pdf->Cell(1, 5, "", 0, 0, 'C', 1); $pdf->Cell(8, 5, $promedio_asignatura, 1, 1, 'C', 0); $ponderados[$row['ramo']] = $promedio_asignatura; $data[$l]['nombre_ramo'] = str_cortar($row['ramo'], 15); $data[$l]['promedio_ramo'] = $promedio_asignatura; $data[$l]['promedio_ramo_curso'] = $promedio_ramo[$row['ramo']]['promedio']; $l++; unset($n); } } $notas_religion = $class_notas->obtenerNotasReligion($rut); //dpr($_SESSION[colegio]->colegio_ID); if ($_SESSION[colegio]->colegio_ID == "edupac") {