-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcertidaoinscr003.php
More file actions
executable file
·413 lines (373 loc) · 13.5 KB
/
certidaoinscr003.php
File metadata and controls
executable file
·413 lines (373 loc) · 13.5 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
405
406
407
408
409
410
411
412
413
<?
/*
* E-cidade Software Publico para Gestao Municipal
* Copyright (C) 2013 DBselller Servicos de Informatica
* www.dbseller.com.br
* e-cidade@dbseller.com.br
*
* Este programa e software livre; voce pode redistribui-lo e/ou
* modifica-lo sob os termos da Licenca Publica Geral GNU, conforme
* publicada pela Free Software Foundation; tanto a versao 2 da
* Licenca como (a seu criterio) qualquer versao mais nova.
*
* Este programa e distribuido na expectativa de ser util, mas SEM
* QUALQUER GARANTIA; sem mesmo a garantia implicita de
* COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM
* PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais
* detalhes.
*
* Voce deve ter recebido uma copia da Licenca Publica Geral GNU
* junto com este programa; se nao, escreva para a Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA.
*
* Copia da licenca no diretorio licenca/licenca_en.txt
* licenca/licenca_pt.txt
*/
session_start();
include("libs/db_conecta.php");
include("libs/db_stdlib.php");
include("libs/db_utils.php");
include("libs/db_sql.php");
include("classes/db_issbase_classe.php");
include("classes/db_escrito_classe.php");
parse_str(base64_decode($HTTP_SERVER_VARS["QUERY_STRING"]));
$oPost = db_utils::postMemory($_POST,0);
$oGet = db_utils::postMemory($_GET,0);
mens_help();
db_mensagem("alvara_cab","alvara_rod");
$db_verificaip = db_verifica_ip();
$clissbase = new cl_issbase;
$clescrito = new cl_escrito;
if ($db_verificaip == "0") {
$onsubmit = "onsubmit=\"return js_verificaCGCCPF((this.cgc.value==''?'':this.cgc),this.cpf);\"";
} else {
$onsubmit = "";
}
// busca dados para armazenar em cookies
if (@$_COOKIE["cookie_codigo_cgm"] == "") {
// issbase
if (@$inscricaow!="") {
$result = $clissbase->sql_record($clissbase->sql_query("",
"cgm.z01_numcgm,cgm.z01_nome",
"",
"issbase.q02_inscr = $inscricaow"));
$linhas1 = $clissbase->numrows;
}
// cgm
if (@$codigo_cgm!="") {
$result = $clcgm->sql_record($clcgm->sql_query("",
"cgm.z01_numcgm,cgm.z01_nome",
"",
"cgm.z01_numcgm = $codigo_cgm"));
$linhas2 = $clcgm->numrows;
}
// iptu
if (@$matricula1!=""){
$result = $cliptubase->sql_record($cliptubase->sql_query("",
"cgm.z01_numcgm,cgm.z01_nome",
"",
"iptubase.j01_matric = $matricula1"));
$linhas3 = $cliptubase->numrows;
}
db_fieldsmemory($result,0);
@setcookie("cookie_codigo_cgm",$z01_numcgm);
@setcookie("cookie_nome_cgm",$z01_nome);
@$cookie_codigo_cgm = $z01_numcgm;
} else {
@$cookie_codigo_cgm = $_COOKIE["cookie_codigo_cgm"];
}
?>
<html>
<head>
<title><?=$w01_titulo?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" src="scripts/db_script.js"></script>
<script>
</script>
<style type="text/css">
<?db_estilosite();?>
</style>
<link rel="stylesheet" type="text/css" href="include/estilodai.css" >
<link href="config/estilos.css" rel="stylesheet" type="text/css">
<script>
function js_valida(){
var inscr = document.getElementById('inscricao').value;
var cnpj = document.getElementById('cgc').value;
var cpf = document.getElementById('cpf').value;
var iTamCnpj = js_tamanho(cnpj);
var iTamCpf = js_tamanho(cpf);
if(inscr == ""){
alert('Preencha o campo INSCRIÇÃO ALVARÁ!');
return false;
} else if(cnpj == "" && cpf == ""){
alert('Preencha um dos campo CNPJ/CPF!');
return false;
} else {
if(cnpj != "" && iTamCnpj != 14){
alert('CNPJ Inconsistente!');
var retorno = false;
}
if(cpf != "" && iTamCpf != 11){
alert('CPF Inconsistente!');
var retorno = false;
}
if(retorno === false){
return false;
}
}
}
function js_tamanho(Campo){
var vr = Campo;
vr = vr.replace(".", "");
vr = vr.replace(".", "");
vr = vr.replace("-", "");
vr = vr.replace("/", "");
var iTamCampo = vr.length
return iTamCampo;
}
</script>
</head>
<div id='int_perc1' align="left" style="position:absolute;top:30%;left:35%; float:left; width:200; background-color:#ECEDF2;
padding:5px; margin:0px; border:1px #C2C7CB solid; margin-left:10px; font-size:80%; visibility:hidden">
<div style="border:1px #ffffff solid; margin:8px 3px 3px 3px;">
<div id='int_perc2' style="width:100%; background-color:#eaeaea;" align="center">
<img src="imagens/processando.gif" align="center"> Processando...</div>
</div>
</div>
</div>
<script>
document.getElementById('int_perc1').style.visibility='visible';
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="<?=$w01_corbody?>" onLoad="" <? mens_OnHelp() ?>>
<br><br>
<center>
<?
// verifica se está logado
if(( @$id_usuario!="" ) && !isset($outro)){
@$usuario = $id_usuario;
// é escritório?
$wherebx = " and q10_dtfim is null ";
if (@$mostrainscricao == 1) {
// todas
$wherebx = " and q10_dtfim is null ";
} else if (@$mostrainscricao == 2) {
// baixadas
$wherebx = " and q10_dtfim is null and q02_dtbaix is not null ";
} if (@$mostrainscricao == 3) {
// não baixadas
$wherebx = " and q10_dtfim is null and q02_dtbaix is null ";
}
// retorna todos os clientes do escritório
$result = $clescrito->sql_record($clescrito->sql_query("",
"q02_inscr, cgm.z01_nome as z01_nome,cgm.z01_cgccpf as z01_cgccpf","cgm.z01_nome",
"q10_numcgm = $usuario $wherebx"));
$escrito = $clescrito->numrows;
// é issbase
$result2 = $clissbase->sql_record($clissbase->sql_query("",
"issbase.q02_inscr,z01_nome,z01_cgccpf",
"",
"q02_numcgm = $usuario"));
//$result2 = $clissbase->sql_record($clissbase->sqlinscricoes_socios(0,$cookie_codigo_cgm,"*"));
$issbase = $clissbase->numrows;
}
if( isset($usuario) ) {
$sqlesc = "select * from cadescrito where q86_numcgm= $usuario";
$resultesc = @db_query($sqlesc);
$escritorio = @pg_num_rows($resultesc);
}
if((@$escrito==0 && @$issbase==0) || @$usuario==""){
?>
<form name="form1" method="post" <?=$onsubmit?> action="opcoescertidao.php?id_usuario=<?=$id_usuario?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="texto">
<tr>
<td colspan="2" align="center"> <?=$DB_mens1?> <br /> <br /> <br /> </td>
</tr>
<tr>
<td width="50%" height="30" align="right">
Inscrição Alvará:
</td>
<td width="50%" height="30">
<input id="inscricao" name="inscricaow" type="text" class="digitacgccpf" size="8" maxlength="6">
</td>
</tr>
<tr>
<td width="50%" height="30" align="right">
CNPJ:
</td>
<td width="50%" height="30">
<input name="cgc" type="text" class="digitacgccpf"
id="cgc" size="18" maxlength="18" onKeyPress="FormataCNPJ(this,event); return js_teclas(event);">
</td>
</tr>
<tr>
<td width="50%" height="30" align="right">
CPF:
</td>
<td width="50%" height="30">
<input name="cpf" type="text" class="digitacgccpf" id="cpf" size="14" maxlength="14"
onKeyPress="FormataCPF(this,event); return js_teclas(event);">
</td>
</tr>
<tr>
<td width="50%" height="30"> </td>
<td width="50%" height="30">
<input class="botao" type="submit" name="pesquisa" value="Pesquisa" class="botaoconfirma" onClick="return js_valida();">
<input type="hidden" name="opcao" value="i">
</td>
</tr>
</table>
</form>
<?
} else {
//Escritorio
if($escritorio!=0){
?>
<form name="form2" method="post" <?=$onsubmit?> action="opcoescertidao.php?id_usuario=<?=$id_usuario?>">
<table width="50%">
<tr>
<td width="50%" height="30" align="center" >
Inscrição Alvará:
<input id="inscricao" name="inscricao" type="text" class="digitacgccpf" size="8" maxlength="6">
</td>
</tr>
<tr>
<td align="center">
CNPJ:
<input name="cgc" type="text" class="digitacgccpf"
id="cgc" size="18" maxlength="18" onKeyPress="FormataCNPJ(this,event); return js_teclas(event);">
<input class="botao" type="submit" name="pesquisa" value="Pesquisa" class="botaoconfirma" onClick="return js_valida();">
<input type="hidden" name="opcao" value="i">
<input type="hidden" name="logadoescrito" value="1">
</td>
</tr>
</table>
</form>
<?
}
if($escrito > 0){
?>
<a href="certidaoinscr003.php?id_usuario=<?=$id_usuario?>&outro=''">:: Pesquisar Outro Alvará ::</a><br><br>
<?
}
?>
<form name="form3" method="post" >
<table width="350" border="0" cellspacing="0" cellpadding="3" class="texto">
<?
if($escrito > 0){
?>
<tr height="20" >
<td colspan="3">
<b>Mostrar inscriçoes</b>
<select name="mostrainscricao" onchange = "document.form3.submit();">
<?
echo "
<option value = '1'".($mostrainscricao == 1?"selected":"").">Todas</option>
<option value = '2'".($mostrainscricao == 2?"selected":"").">Somente baixadas</option>
<option value = '3'".($mostrainscricao == 3?"selected":"").">Somente não baixadas</option>
";
?>
</select>
<?
}
?>
</td>
</tr>
<tr height="20" >
<td colspan="3"> </td>
</tr>
<?
//busca clientes do escritório
for ($x = 0; $x < $escrito; $x++) {
if ($x == 0) {
?>
<tr height="20" bgcolor="#eaeaea">
<td colspan="3">
<b>Inscrições que tenho acesso</b>
</td>
</tr>
<?
}
db_fieldsmemory($result,$x);
$sUrlInscr = base64_encode("inscricao=$q02_inscr&cgc=$z01_cgccpf&opcao=i&id_usuario=$id_usuario");
$sUrlNome = base64_encode("inscricao=$q02_inscr&cgc=$z01_cgccpf&cpf=$z01_cgccpf&opcao=i&id_usuario=$id_usuario");
if ($escrito == 1 && $issbase == 0) {
$sUrl = base64_encode("inscricao=$q02_inscr&cgc=$z01_cgccpf&cpf=$z01_cgccpf&opcao=i&id_usuario=$id_usuario");
$redireciona = "opcoescertidao.php?".$sUrl;
db_redireciona($redireciona);
}
echo "
<tr height=\"20\">
<td>
<img src=\"imagens/seta.gif\" border=\"0\">
</td>
<td align=\"right\">
<a href=\"opcoescertidao.php?".$sUrlInscr."\">
<b>".$q02_inscr."</b>
</a>
</td>
<td>
<a href=\"opcoescertidao.php?".$sUrlNome."\">".$z01_nome."</a>
</td>
</tr>";
echo "
<tr height=\"1\" bgcolor=\"#cccccc\">
<td colspan=\"3\"></td>
</tr>";
}
//busca dados do issbase
for ($x = 0; $x < $issbase; $x++) {
if ($x == 0) {
?>
<tr height="20" bgcolor="<?=$w01_corfundomenu?>">
<td colspan="3">
<b>Minha Inscrição</b>
</td>
</tr>
<?
}
db_fieldsmemory($result2,$x);
if($escrito==0 && $issbase==1){
$sUrl = base64_encode("inscricao=$q02_inscr&cgc=$z01_cgccpf&opcao=i&id_usuario=".@$id_usuario);
$redireciona = "opcoescertidao.php?".$sUrl;
if(!isset($DB_LOGADO)){
@include($redireciona);
}else{
db_redireciona($redireciona);
}
}
$sUrlInscr = base64_encode("inscricao=$q02_inscr&cgc=$z01_cgccpf&opcao=i&id_usuario=".@$id_usuario);
$sUrlNome = base64_encode("inscricao=$q02_inscr&cgc=$z01_cgccpf&opcao=i&id_usuario=".@$id_usuario);
echo "<tr height=\"20\">
<td>
<img src=\"imagens/seta.gif\" border=\"0\"></td>
<td align=\"right\">
<a class='links' href=\"opcoescertidao.php?".$sUrlInscr."\">
<b>".$q02_inscr."</b>
</a>
</td>
<td>
<a class='links'href=\"opcoescertidao.php?".$sUrlNome."\">".$z01_nome."</a>
</td>
</tr>";
echo "<tr height=\"1\" bgcolor=\"$w01_corfundomenu\">
<td colspan=\"3\"></td>
</tr>";
}
?>
</table>
</form>
<?
}
db_logs("","",0,"Digita Codigo da Inscricao.");
if(isset($erroscripts)){
echo "<script>alert('".$erroscripts."');</script>";
}
?>
</center>
<br><br>
<script>
document.getElementById('int_perc1').style.visibility='hidden';
</script>
</body>
</html>