educar_relatorio_registro_transferencias_proc.php
13.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* @author Prefeitura Municipal de Itajaí *
* @updated 29/03/2007 *
* Pacote: i-PLB Software Público Livre e Brasileiro *
* *
* Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
* ctima@itajai.sc.gov.br *
* *
* Este programa é software livre, você pode redistribuí-lo e/ou *
* modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
* publicada pela Free Software Foundation, tanto a versão 2 da *
* Licença como (a seu critério) qualquer versão mais nova. *
* *
* Este programa é distribuído na expectativa de ser útil, mas SEM *
* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
* sulte a Licença Pública Geral GNU para obter mais detalhes. *
* *
* Você deve ter recebido uma cópia da Licença Pública Geral GNU *
* junto com este programa. Se não, escreva para a Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
* 02111-1307, USA. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
require_once ("include/clsBase.inc.php");
require_once ("include/clsCadastro.inc.php");
require_once ("include/clsBanco.inc.php");
require_once( "include/pmieducar/geral.inc.php" );
require_once ("include/clsPDF.inc.php");
class clsIndexBase extends clsBase
{
function Formular()
{
$this->SetTitulo( "{$this->_instituicao} i-Educar - Registro de Matrículas" );
$this->processoAp = "693";
$this->renderMenu = false;
$this->renderMenuSuspenso = false;
}
}
class indice extends clsCadastro
{
/**
* Referencia pega da session para o idpes do usuario atual
*
* @var int
*/
var $pessoa_logada;
var $ref_cod_instituicao;
var $ref_cod_escola;
var $ref_cod_serie;
var $ref_cod_curso;
var $ano;
var $nm_escola;
var $nm_instituicao;
var $nm_curso;
var $pdf;
var $page_y = 139;
var $get_link;
var $campo_assinatura;
var $total = 0;
var $meses_do_ano = array(
"1" => "JANEIRO"
,"2" => "FEVEREIRO"
,"3" => "MARÇO"
,"4" => "ABRIL"
,"5" => "MAIO"
,"6" => "JUNHO"
,"7" => "JULHO"
,"8" => "AGOSTO"
,"9" => "SETEMBRO"
,"10" => "OUTUBRO"
,"11" => "NOVEMBRO"
,"12" => "DEZEMBRO"
);
function renderHTML()
{
$this->ref_cod_instituicao = $_POST["ref_cod_instituicao"];
$this->ref_cod_escola = $_POST["ref_cod_escola"];
$this->ano = $_POST['ano'];
$fonte = 'arial';
$corTexto = '#000000';
if (is_numeric($this->ref_cod_instituicao) && is_numeric($this->ref_cod_escola))
{
$obj_instituicao = new clsPmieducarInstituicao($this->ref_cod_instituicao);
$det_instituicao = $obj_instituicao->detalhe();
$this->nm_instituicao = $det_instituicao["nm_instituicao"];
$sql = " SELECT
fantasia as nome
FROM
pmieducar.escola
, cadastro.juridica
WHERE
ref_cod_instituicao = {$this->ref_cod_instituicao}
AND idpes = ref_idpes
AND cod_escola = {$this->ref_cod_escola}
AND ativo = 1
UNION
SELECT
nm_escola
FROM
pmieducar.escola
, pmieducar.escola_complemento
WHERE
ref_cod_instituicao = {$this->ref_cod_instituicao}
AND cod_escola = ref_cod_escola
AND cod_escola = {$this->ref_cod_escola}
AND escola.ativo = 1";
$db = new clsBanco();
$this->nm_escola = $db->CampoUnico($sql);
$sql = "SELECT
cod_matricula,
m.ref_cod_aluno,
(SELECT nome FROM cadastro.pessoa p, pmieducar.aluno a WHERE
a.cod_aluno = m.ref_cod_aluno AND a.ref_idpes = p.idpes) as nome_aluno,
to_char(data_transferencia,'DD/MM/YYYY') as dt_transferencia,
s.nm_serie,
t.nm_turma,
ts.ref_cod_matricula_entrada
FROM
pmieducar.matricula m,
pmieducar.matricula_turma mt,
pmieducar.turma t,
pmieducar.serie s,
pmieducar.transferencia_solicitacao ts
WHERE
m.ref_ref_cod_escola = {$this->ref_cod_escola}
AND ref_cod_matricula_saida = cod_matricula
AND ts.ativo = 1
AND mt.ref_cod_matricula = m.cod_matricula
AND mt.ref_cod_turma = t.cod_turma
AND t.ref_ref_cod_serie = s.cod_serie
AND m.ano = {$this->ano}
ORDER BY
nm_turma,
nm_serie,
dt_transferencia";
//AND data_transferencia IS NOT NULL
//AND EXTRACT (YEAR FROM data_transferencia) = {$this->ano}
$db->Consulta($sql);
if ($db->Num_Linhas())
{
$dados = array();
while ($db->ProximoRegistro())
{
$dados[] = $db->Tupla();
$this->total++;
}
$this->pdf = new clsPDF("Registro de Matrículas - {$this->ano}", "Registro de Matrículas", "A4", "", false, false);
$obj_instituicao = new clsPmieducarInstituicao();
$this->pdf->largura = 842.0;
$this->pdf->altura = 595.0;
$this->page_y = 125;
$this->pdf->OpenFile();
$this->addCabecalho();
$esquerda = 30;
$altura = 130 + 18*2;
$direita = 782;
$tam_texto = 8;
$altura = 130;
$altura_escrita = 3;
foreach ($dados as $dado_transferencia)
{
list($cod_matricula, $ref_cod_aluno, $nome_aluno, $dt_transferencia, $nm_serie, $nm_turma, $ref_cod_matricula_entrada) = $dado_transferencia;
$this->pdf->linha_relativa($esquerda, $altura+=18, 0, 18);
$this->pdf->linha_relativa($esquerda, $altura, $direita, 0);
$this->pdf->escreve_relativo($cod_matricula, $esquerda + 3, $altura + $altura_escrita, 55, 30, $fonte, $tam_texto, $corTexto, 'center');
$this->pdf->linha_relativa($esquerda + 55, $altura, 0, 18);
$this->pdf->escreve_relativo($nome_aluno, $esquerda + 58, $altura + $altura_escrita, 300, 30, $fonte, $tam_texto);
$this->pdf->linha_relativa($esquerda + 317 - 18, $altura, 0, 18);
$this->pdf->escreve_relativo($dt_transferencia, $esquerda + 320 - 18, $altura + $altura_escrita, 150, 30, $fonte, $tam_texto, $corTexto);
$this->pdf->linha_relativa($esquerda + 365-11, $altura, 0, 18);
$this->pdf->escreve_relativo($nm_serie, $esquerda + 365 - 9, $altura + $altura_escrita, 72, 30, $fonte, $tam_texto, $corTexto, 'center');
$this->pdf->linha_relativa($esquerda + 410+19, $altura, 0, 18);
$this->pdf->escreve_relativo($nm_turma, $esquerda + 408 + 10+13, $altura + $altura_escrita, 35, 30, $fonte, $tam_texto, $corTexto, 'center');
$this->pdf->linha_relativa($esquerda + 449 + 34, $altura, 0, 18);
$estabelecimento_destino = null;
if (is_numeric($ref_cod_matricula_entrada))
$estabelecimento_destino = $this->getNomeEscola($ref_cod_matricula_entrada);
else
$this->pdf->escreve_relativo("Escola Externa ao Sistema", $esquerda + 452 + 34, $altura + $altura_escrita, 300, 30, $fonte, $tam_texto);
if (!empty($estabelecimento_destino))
$this->pdf->escreve_relativo($estabelecimento_destino, $esquerda + 452 + 34, $altura + $altura_escrita, 300, 30, $fonte, $tam_texto);
$this->pdf->linha_relativa($esquerda + 757, $altura, 0, 18);
$this->pdf->escreve_relativo(empty($estabelecimento_destino) ? "" : "SC", $esquerda + 763, $altura + $altura_escrita, 50, 30, $fonte, $tam_texto);
$this->pdf->linha_relativa($esquerda + 782, $altura, 0, 18);
$this->pdf->linha_relativa($esquerda, $altura, $direita, 0);
$this->pdf->linha_relativa($esquerda, $altura + 18, $direita, 0);
if ($altura > $this->pdf->altura - 50)
{
$this->pdf->ClosePage();
$this->pdf->OpenPage();
$this->addCabecalho();
$esquerda = 30;
$altura = 130 + 18*2;
$direita = 782;
$tam_texto = 8;
$altura = 130;
$altura_escrita = 5;
}
}
if ($altura > $this->pdf->altura - 50)
{
$this->pdf->ClosePage();
$this->pdf->OpenPage();
$this->addCabecalho();
$esquerda = 30;
$altura = 130 + 18*2;
$direita = 782;
$tam_texto = 8;
$altura = 130;
$altura_escrita = 5;
}
$this->pdf->CloseFile();
$this->get_link = $this->pdf->GetLink();
echo "<script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=".$this->get_link."'}</script>";
echo "<html><center>Se o download não iniciar automaticamente <br /><a target='_blank' href='" . $this->get_link . "' style='font-size: 16px; color: #000000; text-decoration: underline;'>clique aqui!</a><br><br>
<span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
Clique na Imagem para Baixar o instalador<br><br>
<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>
</span>
</center>";
}
else
{
echo '<script>
alert("A escola nesse ano não possui nenhuma expedição de transferência");
window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
</script>';
return true;
}
}
else
{
echo '<script>
alert("A escola nesse ano não possui nenhuma expedição de transferência");
window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
</script>';
return true;
}
}
function addCabecalho()
{
// variavel que controla a altura atual das caixas
$altura = 30;
$fonte = 'arial';
$corTexto = '#000000';
// cabecalho
$this->pdf->quadrado_relativo( 30, $altura, 782, 85 );
$this->pdf->InsertJpng( "gif", "imagens/brasao.gif", 50, 95, 0.30 );
//titulo principal
$this->pdf->escreve_relativo( "PREFEITURA COBRA TECNOLOGIA", 30, 30, 782, 80, $fonte, 18, $corTexto, 'center' );
$this->pdf->escreve_relativo( date("d/m/Y"), 745, 30, 100, 80, $fonte, 12, $corTexto, 'left' );
//dados escola
$this->pdf->escreve_relativo( "Instituição: $this->nm_instituicao", 120, 52, 300, 80, $fonte, 9, $corTexto, 'left' );
$this->pdf->escreve_relativo( "Escola: {$this->nm_escola}",132, 64, 300, 80, $fonte, 9, $corTexto, 'left' );
$this->pdf->escreve_relativo( "Registro de Transferências Expedidas - {$this->ano}", 30, 78, 782, 80, $fonte, 12, $corTexto, 'center' );
$this->pdf->escreve_relativo( "Total de Transferências: {$this->total}", 30, 95, 782, 80, $fonte, 10, $corTexto, 'center' );
$this->pdf->linha_relativa(30, $altura += 100, 782, 0);
$esquerda = 30;
$altura = 30;
$direita = 782;
$tam_texto = 10;
$altura = 130;
$this->pdf->linha_relativa($esquerda, $altura, 0, 18);
$this->pdf->escreve_relativo("Matrícula", $esquerda + 1, $altura+3, 150, 30, $fonte, $tam_texto);
$this->pdf->linha_relativa($esquerda + 55, $altura, 0, 18);
$this->pdf->escreve_relativo("Nome Completo", $esquerda + 58, $altura+3, 150, 30, $fonte, $tam_texto);
$this->pdf->linha_relativa($esquerda + 317-18, $altura, 0, 18);
$this->pdf->escreve_relativo("Data", $esquerda + 320-18, $altura+3, 45, 30, $fonte, $tam_texto, $corTexto, 'center');
$this->pdf->linha_relativa($esquerda + 365 -11, $altura, 0, 18);
$this->pdf->escreve_relativo("Série", $esquerda + 355, $altura+3, 70, 30, $fonte, $tam_texto, $corTexto, 'center');
$this->pdf->linha_relativa($esquerda + 410+19, $altura, 0, 18);
$this->pdf->escreve_relativo("Turma", $esquerda + 408 + 10+16, $altura+3, 35, 30, $fonte, $tam_texto, $corTexto, 'center');
$this->pdf->linha_relativa($esquerda + 449 + 34, $altura, 0, 18);
$this->pdf->escreve_relativo("Estabelecimento Destino", $esquerda + 452 + 37, $altura + 3, 150, 30, $fonte, $tam_texto);
$this->pdf->linha_relativa($esquerda + 757, $altura, 0, 18);
$this->pdf->escreve_relativo("UF", $esquerda + 763, $altura + 3, 50, 30, $fonte, $tam_texto);
$this->pdf->linha_relativa($esquerda + 782, $altura, 0, 18);
$this->page_y +=19;
}
function getNomeEscola($ref_cod_matricula_entrada) {
$nome_escola = null;
if (is_numeric($ref_cod_matricula_entrada))
{
$sql = " SELECT
fantasia as nome
FROM
pmieducar.escola
, cadastro.juridica
WHERE
ref_cod_instituicao = {$this->ref_cod_instituicao}
AND idpes = ref_idpes
AND cod_escola = (SELECT ref_ref_cod_escola FROM pmieducar.matricula WHERE cod_matricula = {$ref_cod_matricula_entrada})
AND ativo = 1
UNION
SELECT
nm_escola
FROM
pmieducar.escola
, pmieducar.escola_complemento
WHERE
ref_cod_instituicao = {$this->ref_cod_instituicao}
AND cod_escola = ref_cod_escola
AND cod_escola = (SELECT ref_ref_cod_escola FROM pmieducar.matricula WHERE cod_matricula = {$ref_cod_matricula_entrada})
AND escola.ativo = 1;";
$db = new clsBanco();
$nome_escola = $db->CampoUnico($sql);
}
return $nome_escola;
}
function Editar()
{
return false;
}
function Excluir()
{
return false;
}
}
// cria uma extensao da classe base
$pagina = new clsIndexBase();
// cria o conteudo
$miolo = new indice();
// adiciona o conteudo na clsBase
$pagina->addForm( $miolo );
// gera o html
$pagina->MakeAll();
?>