/
rel_pendentes.php
105 lines (70 loc) · 2.62 KB
/
rel_pendentes.php
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
<?php
require "src/scripts/conecta.php";
require "src/scripts/restrito.php";
include "src/scripts/functions.php";
require "src/classes/Template.class.php";
include_once "src/classes/Users.class.php";
include_once "src/classes/Notas.class.php";
include_once "src/classes/Contratos.class.php";
include_once "src/classes/Relatorio.class.php";
redirectByPermission(1); // SETAR PERMISSÃO DA PÁGINA
$inicio = execucao();
$tpl = new Template('html_libs/template.html');
$tpl->addFile('SECONDMENU','html_libs/udd_secondMenu.html');
$tpl->addFile('CONTEUDO','html_libs/rel_pendentes.html');
//$tpl->addFile("JSCRIPT", 'cssjs_libs/js_parts/js_rel_notas.html');
/**********************
MOSTRAR ANO_REF DE FORM
**********************/
$ano_atual = Date('Y');
for($i= $ano_atual; $i >= 2012; $i--){
$tpl->ANO_REF = $i;
$tpl->block('EACH_ANOREF');
}
/********************************************
MOSTRAR TABELA COM NOTAS VINDAS DE $_POST
********************************************/
if (getenv("REQUEST_METHOD") == "POST") {
if(isset($_POST['mes_ref'],$_POST['ano_ref'])){
$mes = ($_POST['mes_ref'] == "") ? "nulo" : $_POST['mes_ref'] ;
$ano = ($_POST['ano_ref'] <= Date('Y') || $_POST['ano_ref'] >=2012) ? $_POST['ano_ref'] : Date('Y');
$tpl->MESNOME = strtoupper(getMesNome($mes, false));
$tpl->ANO = $ano;
$sql_cont = "SELECT id FROM daee_contratos";
$query_cont = mysql_query($sql_cont);
$qtd = 0;
$i = 0;
$rel = new Relatorio();
$rel->setUdds();
$udds = $rel->udds;
$cores = $rel->cores;
$tipos = $rel->ucTipos;
if(mysql_num_rows($query_cont) > 0){
while($res = mysql_fetch_array($query_cont)){
$contrato = new Contrato($res['id']);
$notas = $contrato->getFaltaNotas($mes, $ano);
if($notas[0]['ucid'] != null){
$qtd += count($notas);
foreach($notas as $nota){
$consTipo = $nota['tipo'];
$tpl->UO = $udds[$nota['uo']];
$tpl->AUTOS = $contrato->geraNome();
$tpl->UC = "<b>" . $nota['rgi'] . "</b> - [ <small>" . $nota['endereco'] . "</small> ]";
$tpl->UC .= "<br /><small><font color='". $cores[$consTipo] ."'>". $tipos[$consTipo] ."</font></small>";
$tpl->VENCTO = setDateDiaMesAno($nota['vencto']);
$i++;
$tpl->INDEX = $i;
$tpl->block('EACH_NOTAS');
}
}
}
}
$tpl->NOTAQTD = $qtd;
$tpl->block("RESULT_BLOCK");
}
}
$fim = execucao();
$tempo = number_format(($fim-$inicio),6);
$tpl->EXECTIME = "Tempo de Execução: <b>".$tempo."</b> segundos ";
$tpl->show();
?>