educar_exemplar_devolucao_det.php
5.96 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
<?php
use Illuminate\Support\Facades\Session;
require_once ("include/clsBase.inc.php");
require_once ("include/clsDetalhe.inc.php");
require_once ("include/clsBanco.inc.php");
require_once( "include/pmieducar/geral.inc.php" );
class clsIndexBase extends clsBase
{
function Formular()
{
$this->SetTitulo( "{$this->_instituicao} i-Educar - Exemplar Devolução" );
$this->processoAp = "628";
}
}
class indice extends clsDetalhe
{
/**
* Titulo no topo da pagina
*
* @var int
*/
var $titulo;
var $cod_emprestimo;
var $ref_usuario_devolucao;
var $ref_usuario_cad;
var $ref_cod_cliente;
var $ref_cod_exemplar;
var $data_retirada;
var $data_devolucao;
var $valor_multa;
function Gerar()
{
Session::forget('reload');
Session::save();
Session::start();
$this->titulo = "Exemplar Devolução - Detalhe";
$this->cod_emprestimo=$_GET["cod_emprestimo"];
if(!$this->cod_emprestimo){
$this->simpleRedirect('educar_exemplar_devolucao_lst.php');
}
$obj_exemplar_emprestimo = new clsPmieducarExemplarEmprestimo();
$lista = $obj_exemplar_emprestimo->lista($this->cod_emprestimo);
if( is_array( $lista ) && count( $lista ) )
{
$registro = array_shift($lista);
if( ! $registro )
{
$this->simpleRedirect('educar_exemplar_devolucao_lst.php');
}
$obj_ref_cod_biblioteca = new clsPmieducarBiblioteca( $registro["ref_cod_biblioteca"] );
$det_ref_cod_biblioteca = $obj_ref_cod_biblioteca->detalhe();
$registro["ref_cod_biblioteca"] = $det_ref_cod_biblioteca["nm_biblioteca"];
$obj_ref_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] );
$det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
$registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"];
$obj_ref_cod_escola = new clsPmieducarEscola( $registro["ref_cod_escola"] );
$det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
$idpes = $det_ref_cod_escola["ref_idpes"];
if ($idpes)
{
$obj_escola = new clsPessoaJuridica( $idpes );
$obj_escola_det = $obj_escola->detalhe();
$registro["ref_cod_escola"] = $obj_escola_det["fantasia"];
}
else
{
$obj_escola = new clsPmieducarEscolaComplemento( $registro["ref_cod_escola"] );
$obj_escola_det = $obj_escola->detalhe();
$registro["ref_cod_escola"] = $obj_escola_det["nm_escola"];
}
$obj_ref_cod_exemplar = new clsPmieducarExemplar( $registro["ref_cod_exemplar"] );
$det_ref_cod_exemplar = $obj_ref_cod_exemplar->detalhe();
$acervo = $det_ref_cod_exemplar["ref_cod_acervo"];
$obj_acervo = new clsPmieducarAcervo($acervo);
$det_acervo = $obj_acervo->detalhe();
$titulo_exemplar = $det_acervo["titulo"];
$obj_cliente = new clsPmieducarCliente( $registro["ref_cod_cliente"] );
$det_cliente = $obj_cliente->detalhe();
$ref_idpes = $det_cliente["ref_idpes"];
$obj_pessoa = new clsPessoa_($ref_idpes);
$det_pessoa = $obj_pessoa->detalhe();
$registro["ref_cod_cliente"] = $det_pessoa["nome"];
}
$obj_permissoes = new clsPermissoes();
$nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
if ($nivel_usuario == 1)
{
if( $registro["ref_cod_instituicao"] )
{
$this->addDetalhe( array( "Instituição", "{$registro["ref_cod_instituicao"]}") );
}
}
if ($nivel_usuario == 1 || $nivel_usuario == 2)
{
if( $registro["ref_cod_escola"] )
{
$this->addDetalhe( array( "Escola", "{$registro["ref_cod_escola"]}") );
}
}
if( $registro["ref_cod_biblioteca"] )
{
$this->addDetalhe( array( "Biblioteca", "{$registro["ref_cod_biblioteca"]}") );
}
if( $registro["ref_cod_cliente"] )
{
$this->addDetalhe( array( "Cliente", "{$registro["ref_cod_cliente"]}") );
}
if( $titulo_exemplar )
{
$this->addDetalhe( array( "Obra", "{$titulo_exemplar}") );
}
$this->addDetalhe( array( "Código exemplar", "{$registro["ref_cod_exemplar"]}") );
$this->addDetalhe( array( "Tombo", "{$det_ref_cod_exemplar["tombo"]}") );
if( $registro["data_retirada"] )
{
$this->addDetalhe( array( "Data Retirada", dataFromPgToBr( $registro["data_retirada"], "d/m/Y" ) ) );
}
if( $registro["valor_multa"] )
{
$this->addDetalhe( array( "Valor Multa", "{$registro["valor_multa"]}") );
}
if( $obj_permissoes->permissao_cadastra( 628, $this->pessoa_logada, 11 ) )
{
$this->array_botao = array();
$this->array_botao_url_script = array();
$this->array_botao[] = 'Devolução';
$this->array_botao_url_script[] = "go(\"educar_exemplar_devolucao_cad.php?cod_emprestimo={$registro[cod_emprestimo]}\");";
$this->array_botao[] = 'Renovação';
$this->array_botao_url_script[] = "go(\"educar_exemplar_renovacao_cad.php?cod_emprestimo={$registro[cod_emprestimo]}\");";
}
$this->url_cancelar = "educar_exemplar_devolucao_lst.php";
$this->largura = "100%";
$this->breadcrumb('Detalhe do exemplar para devolução', [
url('intranet/educar_biblioteca_index.php') => 'Biblioteca',
]);
}
}
// 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();
?>