pen_map_tipo_documento_recebimento_listar.php
12.4 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
<?php
require_once dirname(__FILE__) . '/../../SEI.php';
/**
* Consulta os logs do estado do procedimento ao ser expedido
*
* @author Join Tecnologia
*/
session_start();
InfraDebug::getInstance()->setBolLigado(false);
InfraDebug::getInstance()->setBolDebugInfra(true);
InfraDebug::getInstance()->limpar();
$objPaginaSEI = PaginaSEI::getInstance();
$objSessaoSEI = SessaoSEI::getInstance();
$strProprioLink = 'controlador.php?acao='.$_GET['acao'].'&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao_retorno'];
try {
$objSessaoSEI->validarLink();
//$objSessaoSEI->validarPermissao('pen_map_tipo_documento_recebimento_listar');
$objBancoSEI = BancoSEI::getInstance();
$objBancoSEI->abrirConexao();
//--------------------------------------------------------------------------
// Ações
if(array_key_exists('acao', $_GET)) {
$arrParam = array_merge($_GET, $_POST);
switch($_GET['acao']) {
case 'pen_map_tipo_documento_recebimento_excluir':
if(array_key_exists('hdnInfraItensSelecionados', $arrParam) && !empty($arrParam['hdnInfraItensSelecionados'])) {
$objBancoSEI = BancoSEI::getInstance();
$objGenericoBD = new GenericoBD($objBancoSEI);
$arrDblIdMap = explode(',', $arrParam['hdnInfraItensSelecionados']);
foreach($arrDblIdMap as $dblIdMap) {
$objPenRelTipoDocMapRecebidoDTO = new PenRelTipoDocMapRecebidoDTO();
$objPenRelTipoDocMapRecebidoDTO->setDblIdMap($dblIdMap);
$objGenericoBD->excluir($objPenRelTipoDocMapRecebidoDTO);
}
$objPaginaSEI->adicionarMensagem('Excluido com sucesso.', InfraPagina::$TIPO_MSG_INFORMACAO);
header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_retorno'].'&acao_origem='.$_GET['acao_origem']));
exit(0);
}
else {
throw new InfraException('Nenhum Registro foi selecionado para executar esta ação');
}
break;
case 'pen_map_tipo_documento_recebimento_listar':
// Ação padrão desta tela
break;
default:
throw new InfraException('Ação não permitida nesta tela');
}
}
//--------------------------------------------------------------------------
$strTitulo = 'Lista dos Mapeamentos de Tipos de Documento para Recebimento';
$arrComandos = array();
$arrComandos[] = '<button type="button" accesskey="P" onclick="onClickBtnPesquisar();" id="btnPesquisar" value="Pesquisar" class="infraButton"><span class="infraTeclaAtalho">P</span>esquisar</button>';
$arrComandos[] = '<button type="button" value="Novo" onclick="onClickBtnNovo()" class="infraButton"><span class="infraTeclaAtalho">N</span>ovo</button>';
$arrComandos[] = '<button type="button" value="Excluir" onclick="onClickBtnExcluir()" class="infraButton"><span class="infraTeclaAtalho">E</span>xcluir</button>';
$arrComandos[] = '<button type="button" accesskey="I" id="btnImprimir" value="Imprimir" onclick="infraImprimirTabela();" class="infraButton"><span class="infraTeclaAtalho">I</span>mprimir</button>';
//--------------------------------------------------------------------------
// DTO de paginação
$objPenRelTipoDocMapRecebidoDTO = new PenRelTipoDocMapRecebidoDTO();
$objPenRelTipoDocMapRecebidoDTO->retTodos(true);
//--------------------------------------------------------------------------
// Filtragem
if(array_key_exists('nome_serie', $_POST) && !empty($_POST['nome_serie'])) {
$objPenRelTipoDocMapRecebidoDTO->setStrNomeSerie('%'.$_POST['nome_serie'].'%', InfraDTO::$OPER_LIKE);
}
if(array_key_exists('nome_especie', $_POST) && !empty($_POST['nome_especie'])) {
$objPenRelTipoDocMapRecebidoDTO->setStrNomeEspecie('%'.$_POST['nome_especie'].'%', InfraDTO::$OPER_LIKE);
}
//--------------------------------------------------------------------------
$objPaginaSEI->prepararOrdenacao($objPenRelTipoDocMapRecebidoDTO, 'CodigoEspecie', InfraDTO::$TIPO_ORDENACAO_ASC);
$objPaginaSEI->prepararPaginacao($objPenRelTipoDocMapRecebidoDTO);
$objGenericoBD = new GenericoBD($objBancoSEI);
$arrObjPenRelTipoDocMapRecebidoDTO = $objGenericoBD->listar($objPenRelTipoDocMapRecebidoDTO);
$objPaginaSEI->processarPaginacao($objPenRelTipoDocMapRecebidoDTO);
$numRegistros = count($arrObjPenRelTipoDocMapRecebidoDTO);
if(!empty($arrObjPenRelTipoDocMapRecebidoDTO)){
$strResultado = '';
$strResultado .= '<table width="99%" class="infraTable">'."\n";
$strResultado .= '<caption class="infraCaption">'.$objPaginaSEI->gerarCaptionTabela('estados do processo', $numRegistros).'</caption>';
$strResultado .= '<tr>';
$strResultado .= '<th class="infraTh" width="1%">'.$objPaginaSEI->getThCheck().'</th>'."\n";
$strResultado .= '<th class="infraTh" width="35%">Espécie Documental PEN</th>'."\n";
$strResultado .= '<th class="infraTh" width="35%">Tipo de Documento SEI</th>'."\n";
$strResultado .= '<th class="infraTh" width="14%">Ações</th>'."\n";
$strResultado .= '</tr>'."\n";
$strCssTr = '';
$index = 0;
foreach($arrObjPenRelTipoDocMapRecebidoDTO as $objPenRelTipoDocMapRecebidoDTO) {
$strCssTr = ($strCssTr == 'infraTrClara') ? 'infraTrEscura' : 'infraTrClara';
$strResultado .= '<tr class="'.$strCssTr.'">';
$strResultado .= '<td>'.$objPaginaSEI->getTrCheck($index, $objPenRelTipoDocMapRecebidoDTO->getDblIdMap(), '').'</td>';
$strResultado .= '<td>'.$objPenRelTipoDocMapRecebidoDTO->getStrNomeEspecie().'</td>';
$strResultado .= '<td>'.$objPenRelTipoDocMapRecebidoDTO->getStrNomeSerie().'</td>';
$strResultado .= '<td align="center">';
if($objSessaoSEI->verificarPermissao('pen_map_tipo_documento_recebimento_visualizar')) {
$strResultado .= '<a href="'.$objSessaoSEI->assinarLink('controlador.php?acao=pen_map_tipo_documento_recebimento_visualizar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao'].'&id_mapeamento='.$objPenRelTipoDocMapRecebidoDTO->getDblIdMap()).'"><img src="imagens/consultar.gif" title="Consultar Mapeamento" alt="Consultar Mapeamento" class="infraImg"></a>';
}
if($objSessaoSEI->verificarPermissao('pen_map_tipo_documento_recebimento_alterar')) {
$strResultado .= '<a href="'.$objSessaoSEI->assinarLink('controlador.php?acao=pen_map_tipo_documento_recebimento_cadastrar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao'].'&id_mapeamento='.$objPenRelTipoDocMapRecebidoDTO->getDblIdMap()).'"><img src="imagens/alterar.gif" title="Alterar Mapeamento" alt="Alterar Mapeamento" class="infraImg"></a>';
}
if($objSessaoSEI->verificarPermissao('pen_map_tipo_documento_recebimento_excluir')) {
$strResultado .= '<a href="#" onclick="onCLickLinkDelete(\''.$objSessaoSEI->assinarLink('controlador.php?acao=pen_map_tipo_documento_recebimento_excluir&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao'].'&hdnInfraItensSelecionados='.$objPenRelTipoDocMapRecebidoDTO->getDblIdMap()).'\', this)"><img src="imagens/excluir.gif" title="Excluir Mapeamento" alt="Excluir Mapeamento" class="infraImg"></a>';
}
$strResultado .= '</td>';
$strResultado .= '</tr>'."\n";
$index++;
}
$strResultado .= '</table>';
}
}
catch(InfraException $e){
$objPaginaSEI->processarExcecao($e);
}
$objPaginaSEI->montarDocType();
$objPaginaSEI->abrirHtml();
$objPaginaSEI->abrirHead();
$objPaginaSEI->montarMeta();
$objPaginaSEI->montarTitle(':: '.$objPaginaSEI->getStrNomeSistema().' - '.$strTitulo.' ::');
$objPaginaSEI->montarStyle();
?>
<style type="text/css">
.input-label-first{position:absolute;left:0%;top:0%;width:25%; color: #666!important}
.input-field-first{position:absolute;left:0%;top:50%;width:25%}
.input-label-second{position:absolute;left:30%;top:0%;width:25%; color: #666!important}
.input-field-second{position:absolute;left:30%;top:50%;width:25%;}
.input-label-third {position:absolute;left:0%;top:40%;width:25%; color:#666!important}
.input-field-third {position:absolute;left:0%;top:55%;width:25%;}
</style>
<?php $objPaginaSEI->montarJavaScript(); ?>
<script type="text/javascript">
function inicializar(){
infraEfeitoTabelas();
var strMensagens = '<?php print str_replace("\n", '\n', $objPaginaSEI->getStrMensagens()); ?>';
if(strMensagens) {
alert(strMensagens);
}
}
function onClickBtnPesquisar(){
document.getElementById('frmAcompanharEstadoProcesso').action='<?php print $objSessaoSEI->assinarLink($strProprioLink); ?>';
document.getElementById('frmAcompanharEstadoProcesso').submit();
}
function tratarEnter(ev){
var key = infraGetCodigoTecla(ev);
if (key == 13){
onClickBtnPesquisar();
}
return true;
}
function onCLickLinkDelete(url, link) {
var row = jQuery(link).parents('tr:first');
var strEspecieDocumental = row.find('td:eq(1)').text();
var strTipoDocumento = row.find('td:eq(2)').text();
if(confirm('Confirma a exclusão do mapeamento "' + strEspecieDocumental + ' x ' + strTipoDocumento +'"?')){
window.location = url;
}
}
function onClickBtnNovo(){
window.location = '<?php print $objSessaoSEI->assinarLink('controlador.php?acao=pen_map_tipo_documento_recebimento_cadastrar&acao_origem='.$_GET['acao_origem'].'&acao_retorno='.$_GET['acao_origem']); ?>';
}
function onClickBtnExcluir(){
try {
var len = jQuery('input[name*=chkInfraItem]:checked').length;
if(len > 0){
if(confirm('Confirma a exclusão de ' + len + ' mapeamento(s) ?')) {
var form = jQuery('#frmAcompanharEstadoProcesso');
form.attr('action', '<?php print $objSessaoSEI->assinarLink('controlador.php?acao=pen_map_tipo_documento_recebimento_excluir&acao_origem='.$_GET['acao_origem'].'&acao_retorno=pen_map_tipo_documento_recebimento_listar'); ?>');
form.submit();
}
}
else {
alert('Selecione pelo menos um mapeamento para Excluir');
}
}
catch(e){
alert('Erro : ' + e.message);
}
}
</script>
<?php
$objPaginaSEI->fecharHead();
$objPaginaSEI->abrirBody($strTitulo,'onload="inicializar();"');
?>
<form id="frmAcompanharEstadoProcesso" method="post" action="<?php// print $objSessaoSEI->assinarLink($strProprioLink); ?>">
<?php $objPaginaSEI->montarBarraComandosSuperior($arrComandos); ?>
<?php //$objPaginaSEI->montarAreaValidacao(); ?>
<?php $objPaginaSEI->abrirAreaDados('40px'); ?>
<label for="nome_especie" class="infraLabelObrigatorio input-label-first">Espécie Documental PEN:</label>
<input type="text" name="nome_especie" class="infraText input-field-first" onkeyup="return tratarEnter(event)" value="<?php print $_POST['nome_especie']; ?>"/>
<label for="nome_serie" class="infraLabelObrigatorio input-label-second">Tipo de Documento SEI:</label>
<input type="text" name="nome_serie" class="infraText input-field-second" onkeyup="return tratarEnter(event)" value="<?php print $_POST['nome_serie']; ?>"/>
<?php $objPaginaSEI->fecharAreaDados(); ?>
<?php if($numRegistros > 0): ?>
<?php $objPaginaSEI->montarAreaTabela($strResultado, $numRegistros); ?>
<?php //$objPaginaSEI->montarAreaDebug(); ?>
<?php else: ?>
<div style="clear:both"></div>
<p>Nenhum estado foi encontrado para este procedimento</p>
<?php endif; ?>
</form>
<?php $objPaginaSEI->fecharBody(); ?>
<?php $objPaginaSEI->fecharHtml(); ?>