Ejemplo n.º 1
0
 public function relatorio_geral()
 {
     $data = $this->getParametroVisao();
     $data['page'] = 'home';
     $data['tema'] != '' ? $this->load->setTheme($data['tema']) : '';
     $data['msg'] = $this->getMsg();
     $data['abaAtiva'] = 9;
     $data['abaPage'] = 'relatorio_geral';
     $sqlAfa = new SqlAfa();
     $result = $sqlAfa->relatorio_geral($data['ano_letivo'], 8);
     $tabela = '<h4>Por unidades</h4><table>';
     $tabela .= '<tr><td></td><th>Deficiente</th><th>Insuficiente</th><th>Regular</th><th>Bom</th><th>Louvor</th><th>GERAL</th></tr>';
     foreach ($result as $row) {
         $conceito_def = View::bgConceito($row['score_deficiente']);
         $conceito_ins = View::bgConceito($row['score_insuficiente']);
         $conceito_reg = View::bgConceito($row['score_regular']);
         $conceito_bom = View::bgConceito($row['score_bom']);
         $conceito_lou = View::bgConceito($row['score_louvor']);
         $conceito = View::bgConceito($row['afa_conceito_unidade']);
         $tabela .= '<tr><th class="w200">' . $row['unidade_nome'] . '</th>
                         <td class="' . $conceito_def['class'] . ' tcenter w80">' . number_format($row['score_deficiente'], 1) . '<br />' . $row['n_deficiente'] . ' alunos<br />' . number_format($row['n_deficiente'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito_ins['class'] . ' tcenter w80">' . number_format($row['score_insuficiente'], 1) . '<br />' . $row['n_insuficiente'] . ' alunos<br />' . number_format($row['n_insuficiente'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito_reg['class'] . ' tcenter w80">' . number_format($row['score_regular'], 1) . '<br />' . $row['n_regular'] . ' alunos<br />' . number_format($row['n_regular'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito_bom['class'] . ' tcenter w80">' . number_format($row['score_bom'], 1) . '<br />' . $row['n_bom'] . ' alunos<br />' . number_format($row['n_bom'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito_lou['class'] . ' tcenter w80">' . number_format($row['score_louvor'], 1) . '<br />' . $row['n_louvor'] . ' alunos<br />' . number_format($row['n_louvor'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito['class'] . ' tcenter w80">' . number_format($row['afa_conceito_unidade'], 1) . '<br />' . $row['total'] . ' alunos</td>
                     </tr>';
     }
     $tabela .= '</table>';
     $data['tabela'] = $tabela;
     // Séries
     $sqlAfa = new SqlAfa();
     $result = $sqlAfa->relatorio_series($data['ano_letivo'], 8);
     $tabela .= '<br /><br /><h4>Por séries</h4><table>';
     $tabela .= '<tr><td></td><th>Deficiente</th><th>Insuficiente</th><th>Regular</th><th>Bom</th><th>Louvor</th><th>GERAL</th></tr>';
     foreach ($result as $row) {
         $conceito_def = View::bgConceito($row['score_deficiente']);
         $conceito_ins = View::bgConceito($row['score_insuficiente']);
         $conceito_reg = View::bgConceito($row['score_regular']);
         $conceito_bom = View::bgConceito($row['score_bom']);
         $conceito_lou = View::bgConceito($row['score_louvor']);
         $conceito = View::bgConceito($row['afa_conceito_serie']);
         $tabela .= '<tr><th class="w200">' . $row['serie_nome'] . '</th>
                         <td class="' . $conceito_def['class'] . ' tcenter w80">' . number_format($row['score_deficiente'], 1) . '<br />' . $row['n_deficiente'] . ' alunos<br />' . number_format($row['n_deficiente'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito_ins['class'] . ' tcenter w80">' . number_format($row['score_insuficiente'], 1) . '<br />' . $row['n_insuficiente'] . ' alunos<br />' . number_format($row['n_insuficiente'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito_reg['class'] . ' tcenter w80">' . number_format($row['score_regular'], 1) . '<br />' . $row['n_regular'] . ' alunos<br />' . number_format($row['n_regular'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito_bom['class'] . ' tcenter w80">' . number_format($row['score_bom'], 1) . '<br />' . $row['n_bom'] . ' alunos<br />' . number_format($row['n_bom'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito_lou['class'] . ' tcenter w80">' . number_format($row['score_louvor'], 1) . '<br />' . $row['n_louvor'] . ' alunos<br />' . number_format($row['n_louvor'] / $row['total'] * 100, 1) . '%</td>
                         <td class="' . $conceito['class'] . ' tcenter w80">' . number_format($row['afa_conceito_serie'], 1) . '<br />' . $row['total'] . ' alunos</td>
                     </tr>';
     }
     $tabela .= '</table>';
     $data['tabela'] = $tabela;
     if ($this->input->is_ajax_request()) {
         echo json_encode(array('content' => $this->load->view($this->uri->segment(3), $data, true)));
     } else {
         $this->load->view($this->load->getUrlTema(), $data);
     }
     //        $tabela = '<table>';
     //        $tabela .= '<tr><td></td><th>Deficiente</th><th>Insuficiente</th><th>Regular</th><th>Bom</th><th>Louvor</th></tr>';
     //
     //        $series = array(6,7,8,9,11,12,13);
     //
     //        foreach ($series as $serie)
     //        {
     //            $sqlAfa = new SqlAfa();
     //            $result_def = $sqlAfa->listar_conceitos_series($data['ano_letivo'], $serie, 'AND score < 5');
     //            $tota_alunos_def = count($result_def);
     //
     //            $sqlAfa = new SqlAfa();
     //            $result_ins = $sqlAfa->listar_conceitos_series($data['ano_letivo'], $serie, 'AND score >= 5 AND score < 7');
     //            $tota_alunos_ins = count($result_ins);
     //
     //            $sqlAfa = new SqlAfa();
     //            $result_reg = $sqlAfa->listar_conceitos_series($data['ano_letivo'], $serie, 'AND score >= 7 AND score < 8');
     //            $tota_alunos_reg = count($result_reg);
     //
     //            $sqlAfa = new SqlAfa();
     //            $result_bom = $sqlAfa->listar_conceitos_series($data['ano_letivo'], $serie, 'AND score >= 8 AND score < 9');
     //            $tota_alunos_bom = count($result_bom);
     //
     //            $sqlAfa = new SqlAfa();
     //            $result_lou = $sqlAfa->listar_conceitos_series($data['ano_letivo'], $serie, 'AND score >= 9');
     //            $tota_alunos_lou = count($result_lou);
     //
     //            $total_alunos = $tota_alunos_def + $tota_alunos_ins + $tota_alunos_reg + $tota_alunos_bom + $tota_alunos_lou;
     //
     //            $i_def = 0;
     //            $tot_def = 0;
     //            foreach ($result_def as $row)
     //            {
     //                $i_def++;
     //                $tot_def = $tot_def + $row['score'];
     //            }
     //            $media_def = $tot_def / $i_def;
     //            $conceito_def = View::bgConceito($media_def);
     //            $percent_def = ($i_def / $total_alunos) * 100;
     //
     //
     //            $i_ins = 0;
     //            $tot_ins = 0;
     //            foreach ($result_ins as $row)
     //            {
     //                $i_ins++;
     //                $tot_ins = $tot_ins + $row['score'];
     //            }
     //            $media_ins = $tot_ins / $i_ins;
     //            $conceito_ins = View::bgConceito($media_ins);
     //            $percent_ins = ($i_ins / $total_alunos) * 100;
     //
     //
     //            $i_reg = 0;
     //            $tot_reg = 0;
     //            foreach ($result_reg as $row)
     //            {
     //                $i_reg++;
     //                $tot_reg = $tot_reg + $row['score'];
     //            }
     //            $media_reg = $tot_reg / $i_reg;
     //            $conceito_reg = View::bgConceito($media_reg);
     //            $percent_reg = ($i_reg / $total_alunos) * 100;
     //
     //
     //            $i_bom = 0;
     //            $tot_bom = 0;
     //            foreach ($result_bom as $row)
     //            {
     //                $i_bom++;
     //                $tot_bom = $tot_bom + $row['score'];
     //            }
     //            $media_bom = $tot_bom / $i_bom;
     //            $conceito_bom = View::bgConceito($media_bom);
     //            $percent_bom = ($i_bom / $total_alunos) * 100;
     //
     //
     //            $i_lou = 0;
     //            $tot_lou = 0;
     //            foreach ($result_lou as $row)
     //            {
     //                $i_lou++;
     //                $tot_lou = $tot_lou + $row['score'];
     //            }
     //            $media_lou = $tot_lou / $i_lou;
     //            $conceito_lou = View::bgConceito($media_lou);
     //            $percent_lou = ($i_lou / $total_alunos) * 100;
     //
     //            if ($serie == 6)
     //            {
     //                $serie_nome = '6º ano';
     //            }
     //            else if ($serie == 7)
     //            {
     //                $serie_nome = '7º ano';
     //            }
     //            else if ($serie == 8)
     //            {
     //                $serie_nome = '8º ano';
     //            }
     //            else if ($serie == 9)
     //            {
     //                $serie_nome = '9º ano';
     //            }
     //            else if ($serie == 11)
     //            {
     //                $serie_nome = '1º ano';
     //            }
     //            else if ($serie == 12)
     //            {
     //                $serie_nome = '2º ano';
     //            }
     //            else if ($serie == 13)
     //            {
     //                $serie_nome = '3º ano';
     //            }
     //
     //            $tabela .= '<tr><th>'.$serie_nome.'</th>
     //                            <td class="'.$conceito_def['class'].' tcenter w80">'.number_format($media_def,1).'<br />'.$i_def.' alunos ('.number_format($percent_def,1).'%)</td>
     //                            <td class="'.$conceito_ins['class'].' tcenter w80">'.number_format($media_ins,1).'<br />'.$i_ins.' alunos ('.number_format($percent_ins,1).'%)</td>
     //                            <td class="'.$conceito_reg['class'].' tcenter w80">'.number_format($media_reg,1).'<br />'.$i_reg.' alunos ('.number_format($percent_reg,1).'%)</td>
     //                            <td class="'.$conceito_bom['class'].' tcenter w80">'.number_format($media_bom,1).'<br />'.$i_bom.' alunos ('.number_format($percent_bom,1).'%)</td>
     //                            <td class="'.$conceito_lou['class'].' tcenter w80">'.number_format($media_lou,1).'<br />'.$i_lou.' alunos ('.number_format($percent_lou,1).'%)</td>
     //                        </tr>';
     //        }
     //
     //
     //        $tabela .= '</table>';
     //
     //        $data['tabela'] = $tabela;
     //
     //
     //        if($this->input->is_ajax_request())
     //        {
     //            echo json_encode(array('content' => $this->load->view($this->uri->segment(3),$data,true)));
     //        }
     //        else
     //        {
     //            $this->load->view($this->load->getUrlTema(),$data);
     //        }
 }