Commit b4b07401021e1fe91c4bd62849870ae1ba45aff2
1 parent
de09d7a3
Exists in
master
#48 by Eriksen Costa: Corrigido problemas com relatórios de servidores:
* Os scripts não estavam gerando mensagens de erro para casos onde não a busca não retornava registros * Relatório de professores por disciplina não verificavam o curso do professor, gerando listas incorretas e com redundância * Título configurado em {{{ieducar.ini}}} ({{{app.template.pdf.titulo}}}) agora é usado nos relatórios ao invés do valor hardcoded "Prefeitura COBRA Tecnologia"
Showing
4 changed files
with
143 additions
and
97 deletions
Show diff stats
ieducar/intranet/educar_relatorio_professor_disciplina_proc.php
... | ... | @@ -76,8 +76,14 @@ class indice extends clsCadastro |
76 | 76 | |
77 | 77 | var $get_link; |
78 | 78 | |
79 | + /** | |
80 | + * @global $coreExt | |
81 | + */ | |
79 | 82 | function renderHTML() |
80 | 83 | { |
84 | + global $coreExt; | |
85 | + $config = $coreExt['Config']->app->template->pdf; | |
86 | + | |
81 | 87 | if ($_POST) { |
82 | 88 | foreach ($_POST as $key => $value) { |
83 | 89 | $this->$key = $value; |
... | ... | @@ -95,7 +101,7 @@ class indice extends clsCadastro |
95 | 101 | $det_instituicao = $obj_instituicao->detalhe(); |
96 | 102 | $this->nm_instituicao = $det_instituicao['nm_instituicao']; |
97 | 103 | |
98 | - if($this->ref_cod_escola) { | |
104 | + if ($this->ref_cod_escola) { | |
99 | 105 | $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); |
100 | 106 | $det_escola = $obj_escola->detalhe(); |
101 | 107 | $this->nm_escola = $det_escola['nome']; |
... | ... | @@ -106,50 +112,52 @@ class indice extends clsCadastro |
106 | 112 | $this->nm_curso = $det_curso['nm_curso']; |
107 | 113 | |
108 | 114 | if ($this->ref_cod_disciplina) { |
109 | - $where = ' AND cod_disciplina = ' . $this->ref_cod_disciplina; | |
115 | + $where = ' AND mcc.id = ' . $this->ref_cod_disciplina; | |
110 | 116 | } |
111 | 117 | |
112 | 118 | if ($this->ref_cod_escola) { |
113 | 119 | $sql = sprintf(' |
114 | 120 | SELECT |
121 | + DISTINCT(cod_servidor_alocacao), | |
115 | 122 | cod_servidor, |
116 | - nome, | |
123 | + cp.nome, | |
117 | 124 | sa.carga_horaria, |
118 | 125 | CASE periodo |
119 | 126 | WHEN 1 THEN \'Matutino\' |
120 | 127 | WHEN 2 THEN \'Vespertino\' |
121 | 128 | ELSE \'Noturno\' |
122 | 129 | END AS turno, |
123 | - nm_disciplina | |
130 | + mcc.nome as nm_disciplina | |
124 | 131 | FROM |
125 | 132 | pmieducar.servidor s, |
126 | 133 | pmieducar.servidor_disciplina sd, |
127 | 134 | pmieducar.servidor_alocacao sa, |
128 | - pmieducar.disciplina, | |
129 | - cadastro.pessoa | |
135 | + modules.componente_curricular mcc, | |
136 | + cadastro.pessoa cp | |
130 | 137 | WHERE |
131 | 138 | cod_servidor = sd.ref_cod_servidor |
132 | 139 | AND cod_servidor = sa.ref_cod_servidor |
133 | 140 | AND ref_cod_instituicao = sd.ref_ref_cod_instituicao |
134 | 141 | AND ref_cod_instituicao = sa.ref_ref_cod_instituicao |
135 | - AND cod_disciplina = ref_cod_disciplina | |
136 | - AND cod_servidor = idpes | |
142 | + AND mcc.id = ref_cod_disciplina | |
143 | + AND cod_servidor = idpes | |
137 | 144 | AND ref_cod_instituicao = \'%d\' |
138 | - AND ref_cod_escola = %d | |
145 | + AND ref_cod_escola = %d | |
139 | 146 | %s |
147 | + AND sd.ref_cod_curso = \'%d\' | |
140 | 148 | AND sa.ativo = 1 |
141 | 149 | AND s.ativo = 1 |
142 | 150 | ORDER BY |
143 | - nome, nm_disciplina', $this->ref_cod_instituicao, $this->ref_cod_escola, $where); | |
151 | + nome, nm_disciplina', $this->ref_cod_instituicao, $this->ref_cod_escola, $where, $this->ref_cod_curso); | |
144 | 152 | } |
145 | 153 | else { |
146 | 154 | $sql = sprintf(' |
147 | 155 | SELECT |
156 | + DISTINCT(cod_servidor_alocacao), | |
148 | 157 | cod_servidor, |
149 | - nome, | |
158 | + cp.nome, | |
150 | 159 | CAST(s.carga_horaria || \' hour\' AS interval) AS carga_horaria, |
151 | - nm_disciplina, | |
152 | - cod_disciplina, | |
160 | + mcc.nome as nm_disciplina, | |
153 | 161 | CASE periodo |
154 | 162 | WHEN 1 THEN \'Matutino\' |
155 | 163 | WHEN 2 THEN \'Vespertino\' |
... | ... | @@ -158,24 +166,24 @@ class indice extends clsCadastro |
158 | 166 | FROM |
159 | 167 | pmieducar.servidor s, |
160 | 168 | pmieducar.servidor_disciplina sd, |
161 | - pmieducar.disciplina, | |
162 | - cadastro.pessoa, | |
169 | + modules.componente_curricular mcc, | |
170 | + cadastro.pessoa cp, | |
163 | 171 | pmieducar.servidor_alocacao sa |
164 | 172 | WHERE |
165 | 173 | cod_servidor = sd.ref_cod_servidor |
166 | 174 | AND cod_servidor = idpes |
167 | 175 | AND ref_cod_instituicao = sd.ref_ref_cod_instituicao |
168 | - AND cod_disciplina = ref_cod_disciplina | |
176 | + AND mcc.id = ref_cod_disciplina | |
169 | 177 | AND ref_cod_instituicao = \'%d\' |
170 | 178 | %s |
179 | + AND sd.ref_cod_curso = \'%d\' | |
171 | 180 | AND s.ativo = 1 |
172 | 181 | AND cod_servidor = sa.ref_cod_servidor |
173 | 182 | ORDER BY |
174 | - nome, nm_disciplina', $this->ref_cod_instituicao, $where); | |
183 | + nome, nm_disciplina', $this->ref_cod_instituicao, $where, $this->ref_cod_curso); | |
175 | 184 | } |
176 | 185 | |
177 | 186 | $db = new clsBanco(); |
178 | - | |
179 | 187 | $db->Consulta($sql); |
180 | 188 | |
181 | 189 | $nm_disciplina = NULL; |
... | ... | @@ -183,7 +191,7 @@ class indice extends clsCadastro |
183 | 191 | if ($db->Num_Linhas()) { |
184 | 192 | $relatorio = new relatorios('Professores por Disciplina', 210, FALSE, |
185 | 193 | 'Professores por Disciplina', 'A4', |
186 | - "{$this->nm_instituicao}\n{$this->nm_escola}\n{$this->nm_curso}"); | |
194 | + $config->get($config->titulo, 'i-Educar') . "\n{$this->nm_escola}\n{$this->nm_curso}"); | |
187 | 195 | |
188 | 196 | $relatorio->setMargem(20, 20, 50, 50); |
189 | 197 | $relatorio->exibe_produzido_por = FALSE; |
... | ... | @@ -214,27 +222,42 @@ class indice extends clsCadastro |
214 | 222 | } |
215 | 223 | |
216 | 224 | $this->get_link = $relatorio->fechaPdf(); |
217 | - } | |
218 | - | |
219 | 225 | |
220 | - echo sprintf(' | |
221 | - <script> | |
222 | - window.onload=function() | |
223 | - { | |
224 | - parent.EscondeDiv("LoadImprimir"); | |
225 | - window.location="download.php?filename=%s" | |
226 | - } | |
227 | - </script>', $this->get_link); | |
228 | - | |
229 | - echo sprintf(' | |
230 | - <html> | |
231 | - <center>Se o download não iniciar automaticamente <br /> | |
232 | - <a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br /><br /> | |
233 | - <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br /> | |
234 | - Clique na Imagem para Baixar o instalador<br /><br /> | |
235 | - <a href="http://www.adobe.com.br/products/acrobat/readstep2.html" target="new"><br><img src="imagens/acrobat.gif" width="88" height="31" border="0"></a> | |
236 | - </span> | |
237 | - </center>', $this->get_link); | |
226 | + echo sprintf(' | |
227 | + <script> | |
228 | + window.onload=function() | |
229 | + { | |
230 | + parent.EscondeDiv("LoadImprimir"); | |
231 | + window.location="download.php?filename=%s" | |
232 | + } | |
233 | + </script>', $this->get_link); | |
234 | + | |
235 | + echo sprintf(' | |
236 | + <html> | |
237 | + <center>Se o download não iniciar automaticamente <br /> | |
238 | + <a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br /><br /> | |
239 | + <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br /> | |
240 | + Clique na Imagem para Baixar o instalador<br /><br /> | |
241 | + <a href="http://www.adobe.com.br/products/acrobat/readstep2.html" target="new"><br><img src="imagens/acrobat.gif" width="88" height="31" border="0"></a> | |
242 | + </span> | |
243 | + </center>', $this->get_link); | |
244 | + } | |
245 | + else { | |
246 | + if ($this->ref_cod_escola) { | |
247 | + $msg = 'Nenhum professor ministra a disciplina ou está alocado na escola selecionada.'; | |
248 | + } | |
249 | + else { | |
250 | + $msg = 'Nenhum professor ministra a disciplina selecionada.'; | |
251 | + } | |
252 | + echo | |
253 | + '<script> | |
254 | + window.onload=function() | |
255 | + { | |
256 | + parent.EscondeDiv("LoadImprimir"); | |
257 | + } | |
258 | + </script>' . | |
259 | + '<center>' . $msg . '</center>'; | |
260 | + } | |
238 | 261 | } |
239 | 262 | |
240 | 263 | function Editar() | ... | ... |
ieducar/intranet/educar_relatorio_quadro_horario_proc.php
... | ... | @@ -49,10 +49,10 @@ class clsIndexBase extends clsBase |
49 | 49 | { |
50 | 50 | function Formular() |
51 | 51 | { |
52 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Quadro Horários" ); | |
53 | - $this->processoAp = "835"; | |
54 | - $this->renderMenu = false; | |
55 | - $this->renderMenuSuspenso = false; | |
52 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Quadro Horários'); | |
53 | + $this->processoAp = 835; | |
54 | + $this->renderMenu = FALSE; | |
55 | + $this->renderMenuSuspenso = FALSE; | |
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
... | ... | @@ -68,8 +68,6 @@ class clsIndexBase extends clsBase |
68 | 68 | */ |
69 | 69 | class indice extends clsCadastro |
70 | 70 | { |
71 | - var $pessoa_logada; | |
72 | - | |
73 | 71 | var $ref_cod_instituicao; |
74 | 72 | var $ref_cod_escola; |
75 | 73 | var $ref_cod_serie; |
... | ... | @@ -77,29 +75,14 @@ class indice extends clsCadastro |
77 | 75 | var $ref_cod_curso; |
78 | 76 | |
79 | 77 | var $ano; |
80 | - var $mes; | |
81 | 78 | |
82 | 79 | var $nm_escola; |
83 | 80 | var $nm_instituicao; |
84 | - var $nm_professor; | |
85 | - var $nm_turma; | |
86 | - var $nm_serie; | |
87 | - var $nm_disciplina; | |
88 | 81 | |
89 | 82 | var $get_link = FALSE; |
90 | 83 | var $pdf = FALSE; |
91 | 84 | var $page_y = 15; |
92 | 85 | |
93 | - var $array_dias_semana = array( | |
94 | - 1 => 'Domingo', | |
95 | - 2 => 'Segunda', | |
96 | - 3 => 'Terça', | |
97 | - 4 => 'Quarta', | |
98 | - 5 => 'Quinta', | |
99 | - 6 => 'Sexta', | |
100 | - 7 => 'Sábado' | |
101 | - ); | |
102 | - | |
103 | 86 | function renderHTML() |
104 | 87 | { |
105 | 88 | if ($_POST){ | ... | ... |
ieducar/intranet/educar_relatorio_quadro_professores_proc.php
... | ... | @@ -51,15 +51,17 @@ |
51 | 51 | </head> |
52 | 52 | <body onload="parent.EscondeDiv('LoadImprimir');"> |
53 | 53 | <?php |
54 | - require_once ("include/clsBase.inc.php"); | |
55 | - require_once ("include/clsCadastro.inc.php"); | |
56 | - require_once ("include/relatorio.inc.php"); | |
57 | - require_once ("include/pmieducar/geral.inc.php"); | |
54 | +require_once 'include/clsBase.inc.php'; | |
55 | +require_once 'include/clsCadastro.inc.php'; | |
56 | +require_once 'include/relatorio.inc.php'; | |
57 | +require_once 'include/pmieducar/geral.inc.php'; | |
58 | 58 | |
59 | 59 | $ref_cod_instituicao = $_GET['ref_cod_instituicao']; |
60 | 60 | $ref_cod_escola = $_GET['ref_cod_escola']; |
61 | 61 | $professor = $_GET['professor'] ? TRUE : NULL; |
62 | 62 | |
63 | +$config = $coreExt['Config']->app->template->pdf; | |
64 | + | |
63 | 65 | if ($ref_cod_escola) { |
64 | 66 | $obj_servidor = new clsPmieducarServidorAlocacao (); |
65 | 67 | $obj_servidor->setCamposLista('ref_ref_cod_instituicao, ref_cod_escola, sa.ref_cod_servidor, SUM(carga_horaria) AS carga_horaria'); |
... | ... | @@ -71,8 +73,8 @@ if ($ref_cod_escola) { |
71 | 73 | if (is_array($lst_servidor)) { |
72 | 74 | $total_servidor = count($lst_servidor); |
73 | 75 | |
74 | - $relatorio = new relatorios('RELAÇÃO DO QUADRO DE PROFESSORES - Total de Funcionário/Professores = ' . $total_servidor, | |
75 | - 120, FALSE, 'i-Educar', 'A4', "Prefeitura COBRA Tecnologia\n\nSecretaria da Educação", | |
76 | + $relatorio = new relatorios('RELAÇÃO DO QUADRO DE PROFESSORES 1 - Total de Funcionário/Professores = ' . $total_servidor, | |
77 | + 120, FALSE, 'i-Educar', 'A4', $config->get($config->titulo, 'i-Educar'), | |
76 | 78 | '#515151'); |
77 | 79 | |
78 | 80 | $relatorio->exibe_produzido_por = FALSE; |
... | ... | @@ -116,7 +118,15 @@ if ($ref_cod_escola) { |
116 | 118 | } |
117 | 119 | } |
118 | 120 | |
119 | - $sql = 'SELECT nm_funcao FROM pmieducar.servidor_funcao, pmieducar.funcao WHERE ref_cod_funcao = cod_funcao AND ref_cod_servidor = ' . $servidor['ref_cod_servidor']; | |
121 | + $sql = ' | |
122 | + SELECT | |
123 | + nm_funcao | |
124 | + FROM | |
125 | + pmieducar.servidor_funcao, | |
126 | + pmieducar.funcao | |
127 | + WHERE | |
128 | + ref_cod_funcao = cod_funcao AND | |
129 | + ref_cod_servidor = ' . $servidor['ref_cod_servidor']; | |
120 | 130 | $db = new clsBanco(); |
121 | 131 | |
122 | 132 | $nm_funcao = $db->CampoUnico($sql); |
... | ... | @@ -156,7 +166,7 @@ if ($ref_cod_escola) { |
156 | 166 | </html>', $link); |
157 | 167 | } |
158 | 168 | else { |
159 | - echo '<center>Não existem servidores a serem listados!</center>'; | |
169 | + echo '<center>Não existem servidores alocados na escola selecionada!</center>'; | |
160 | 170 | } |
161 | 171 | } |
162 | 172 | else { |
... | ... | @@ -167,7 +177,7 @@ else { |
167 | 177 | |
168 | 178 | if (is_array($lst_escolas)) { |
169 | 179 | $relatorio = new relatorios('RELAÇÃO DO QUADRO DE PROFESSORES', 120, FALSE, |
170 | - 'i-Educar', 'A4', "Prefeitura COBRA Tecnologia\n\nSecretaria da Educação", | |
180 | + 'i-Educar', 'A4', $config->get($config->titulo, 'i-Educar'), | |
171 | 181 | '#515151'); |
172 | 182 | |
173 | 183 | $relatorio->exibe_produzido_por = FALSE; |
... | ... | @@ -238,16 +248,28 @@ else { |
238 | 248 | $link = $relatorio->fechaPdf(); |
239 | 249 | |
240 | 250 | if ($entrou) { |
241 | - echo "<center><a target='blank' href='" . $link . "' style='font-size: 16px; color: #000000; text-decoration: underline;'>Clique aqui para visualizar o arquivo!</a><br><br> | |
242 | - <span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br> | |
251 | + echo sprintf(' | |
252 | + <script> | |
253 | + window.onload = function() | |
254 | + { | |
255 | + parent.EscondeDiv("LoadImprimir"); | |
256 | + window.location="download.php?filename=%s" | |
257 | + } | |
258 | + </script>', $link); | |
243 | 259 | |
244 | - Clique na Imagem para Baixar o instalador<br><br> | |
245 | - <a href=\"http://www.adobe.com.br/products/acrobat/readstep2.html\" target=\"new\"><br><img src=\"imagens/acrobat.gif\" width=\"88\" height=\"31\" border=\"0\"></a> | |
246 | - </span> | |
247 | - </center><script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=" . $link . "'}</script>"; | |
260 | + echo sprintf(' | |
261 | + <html> | |
262 | + <center> | |
263 | + Se o download não iniciar automaticamente <br /><a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br> | |
264 | + <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br> | |
265 | + Clique na Imagem para Baixar o instalador<br><br> | |
266 | + <a href="http://www.adobe.com.br/products/acrobat/readstep2.html" target="new"><br><img src="imagens/acrobat.gif" width="88" height="31" border="0"></a> | |
267 | + </span> | |
268 | + </center> | |
269 | + </html>', $link); | |
248 | 270 | } |
249 | 271 | else { |
250 | - echo '<center>Não existem alunos enturmados!</center>'; | |
272 | + echo '<center>Não existem servidores cadastrados.</center>'; | |
251 | 273 | } |
252 | 274 | } |
253 | 275 | ?> | ... | ... |
ieducar/intranet/educar_relatorio_servidor_nivel_proc.php
... | ... | @@ -74,8 +74,14 @@ class indice extends clsCadastro |
74 | 74 | |
75 | 75 | var $get_link; |
76 | 76 | |
77 | + /** | |
78 | + * @global $coreExt | |
79 | + */ | |
77 | 80 | function renderHTML() |
78 | 81 | { |
82 | + global $coreExt; | |
83 | + $config = $coreExt['Config']->app->template->pdf; | |
84 | + | |
79 | 85 | if ($_POST) { |
80 | 86 | foreach ($_POST as $key => $value) { |
81 | 87 | $this->$key = $value; |
... | ... | @@ -161,7 +167,9 @@ class indice extends clsCadastro |
161 | 167 | |
162 | 168 | if ($db->Num_Linhas()) { |
163 | 169 | $relatorio = new relatorios('Servidores por Nível', 210, FALSE, |
164 | - 'Servidores por Nível', 'A4', $this->nm_instituicao . "\n" . $this->nm_escola); | |
170 | + 'Servidores por Nível', 'A4', $config->get($config->titulo, 'i-Educar') . | |
171 | + "\n" . $this->nm_escola); | |
172 | + | |
165 | 173 | $relatorio->setMargem(20, 20, 50, 50); |
166 | 174 | $relatorio->exibe_produzido_por = FALSE; |
167 | 175 | |
... | ... | @@ -176,27 +184,37 @@ class indice extends clsCadastro |
176 | 184 | } |
177 | 185 | |
178 | 186 | $this->get_link = $relatorio->fechaPdf(); |
179 | - } | |
180 | 187 | |
181 | - echo sprintf(' | |
182 | - <script> | |
183 | - window.onload = function() | |
184 | - { | |
185 | - parent.EscondeDiv("LoadImprimir"); | |
186 | - window.location="download.php?filename=%s" | |
187 | - } | |
188 | - </script>', $this->get_link); | |
189 | - | |
190 | - echo sprintf(' | |
191 | - <html> | |
192 | - <center> | |
193 | - Se o download não iniciar automaticamente <br /><a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br> | |
194 | - <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br> | |
195 | - Clique na Imagem para Baixar o instalador<br><br> | |
196 | - <a href="http://www.adobe.com.br/products/acrobat/readstep2.html" target="new"><br><img src="imagens/acrobat.gif" width="88" height="31" border="0"></a> | |
197 | - </span> | |
198 | - </center> | |
199 | - </html>', $this->get_link); | |
188 | + echo sprintf(' | |
189 | + <script> | |
190 | + window.onload = function() | |
191 | + { | |
192 | + parent.EscondeDiv("LoadImprimir"); | |
193 | + window.location="download.php?filename=%s" | |
194 | + } | |
195 | + </script>', $this->get_link); | |
196 | + | |
197 | + echo sprintf(' | |
198 | + <html> | |
199 | + <center> | |
200 | + Se o download não iniciar automaticamente <br /><a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br> | |
201 | + <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br> | |
202 | + Clique na Imagem para Baixar o instalador<br><br> | |
203 | + <a href="http://www.adobe.com.br/products/acrobat/readstep2.html" target="new"><br><img src="imagens/acrobat.gif" width="88" height="31" border="0"></a> | |
204 | + </span> | |
205 | + </center> | |
206 | + </html>', $this->get_link); | |
207 | + } | |
208 | + else { | |
209 | + echo ' | |
210 | + <script> | |
211 | + window.onload = function() | |
212 | + { | |
213 | + parent.EscondeDiv("LoadImprimir"); | |
214 | + } | |
215 | + </script> | |
216 | + <center>Nenhum servidor cadastrado ou categorizado em níveis.</center>'; | |
217 | + } | |
200 | 218 | } |
201 | 219 | |
202 | 220 | function Editar() | ... | ... |