<?php

header("Content-Type: text/html; charset=ISO-8859-1", true);
require "../includes/verifica_logado_safpostal.inc.php";
require "../includes/funcoes.php";
require "../includes/global.inc.php";
$permissao = verifica_permissao('EXPANSAO', $safpostal_departamento_saf);
if ($permissao == 'FALSE' or $safpostal_id_empresa != '1') {
    echo '<br><br><strong>Você não tem permissão para acessar essa página</strong>';
    exit;
}
pt_register('GET', 'uf');
pt_register('GET', 'id');
pt_register('GET', 'acao');
$dt = new ListaInteressadosDAO();
if ($uf == '') {
    echo '<select name="cidade_interesse" id="cidade_interesse" class="form_estilo" style="width:240px;">' . "\n";
    echo '<option value=""></option>' . "\n";
    echo '</select>' . "\n";
} else {
    echo '<select name="cidade_interesse" id="cidade_interesse" class="form_estilo" style="width:240px;">' . "\n";
    echo '<option value=""></option>' . "\n";
    $e = $dt->buscaCidadeInteresse($acao, $id, $uf);
    foreach ($e as $j => $cd) {
        echo '<option style="text-transform:uppercase">' . ucwords($cd->cidade_interesse) . '</option>' . "\n";
    }
    echo '</select>' . "\n";
}
?>

<?php

require "../includes/verifica_logado_safpostal.inc.php";
require '../includes/classQuery_sistecart.php';
require "../includes/funcoes.php";
require "../includes/global.inc.php";
$permissao = verifica_permissao('EXPANSAO', $safpostal_departamento_saf);
if ($permissao == 'FALSE' or $safpostal_id_empresa != '1') {
    echo '<br><br><strong>Você não tem permissão para acessar essa página</strong>';
    exit;
}
pt_register('GET', 'id');
$dt = new ListaInteressadosDAO();
$dt1 = new StatusDAO();
$c = new stdClass();
$e = $dt->buscaFichaCadastros($id);
if (count($e) > 0) {
    foreach ($e as $cp => $valor) {
        $c->{$cp} = $valor;
    }
}
$e = $dt->buscaCadastroAdicionais($id);
if (count($e) > 0) {
    foreach ($e as $cp => $valor) {
        $c->{$cp} = $valor;
    }
}
$e = $dt->buscaConjuge($id);
if (count($e) > 0) {
    foreach ($e as $cp => $valor) {
        $c->{$cp} = $valor;
<?php

session_start();
require "../includes/verifica_logado_safpostal.inc.php";
require "../includes/funcoes.php";
require "../includes/global.inc.php";
pt_register('GET', 'acao');
pt_register('GET', 'id_ficha');
pt_register('GET', 'id_anexo');
$dt = new ListaInteressadosDAO();
switch ($acao) {
    case 1:
        $e = $dt->listaAnexo($id_ficha);
        if (count($e) > 0) {
            ?>
			<div style="margin-left:14px; width:756px; font-weight:normal"><strong>Arquivos salvos:<a name="arquivos_salvos"></a></strong><br />
				<?php 
            foreach ($e as $j => $arr) {
                ?>
					<div style="width:656px; float:left"><a href="<?php 
                echo $arr->arquivo;
                ?>
" target="_blank">- <?php 
                echo $arr->nome;
                ?>
</a></div>
					<div style="width:100px; float:left"><a href="#arquivos_salvos" onclick="Anexos(<?php 
                echo $id_ficha;
                ?>
, 2, <?php 
                echo $arr->id_anexo;
function EmailFichaHTML($id, $safpostal_fantasia)
{
    $ficha = new ListaInteressadosDAO();
    $a = $ficha->buscaCadastroAdicionais($id);
    $e = $ficha->buscaEndereco2($id);
    $f = $ficha->buscaFichaCadastros($id);
    $fantasia = utf8_encode($safpostal_fantasia);
    $nome = $f->nome == '' ? ' ' : utf8_encode(strtoupper($f->nome));
    $rg = $f->rg == '' ? ' ' : utf8_encode(strtoupper($f->rg));
    $cpf = $f->cpf == '' ? ' ' : utf8_encode(strtoupper($f->cpf));
    $email = $f->email == '' ? ' ' : utf8_encode(strtolower($f->email));
    $nascimento = $f->nascimento == '' ? ' ' : $f->nascimento;
    $tel_res = $f->tel_res == '' ? ' ' : utf8_encode(strtoupper($f->tel_res));
    $tel_rec = $f->tel_rec == '' ? ' ' : utf8_encode(strtoupper($f->tel_rec));
    $tel_cel = $f->tel_cel == '' ? ' ' : utf8_encode(strtoupper($f->tel_cel));
    $nacionalidade = $a->nacionalidade == '' ? ' ' : utf8_encode(strtoupper($a->nacionalidade));
    $nascimento = $a->local_nascimento == '' ? '-' : utf8_encode(strtoupper($a->local_nascimento));
    $estado_civil = $f->estado_civil == '' ? ' ' : utf8_encode(strtoupper($f->estado_civil));
    $filhos = $f->filhos == '' ? ' ' : utf8_encode(strtoupper($f->filhos));
    $quant = $f->quant == '' ? ' ' : utf8_encode(strtoupper($f->quant));
    $regime = $a->regime == '' ? ' ' : utf8_encode(strtoupper($a->regime));
    $casamento = $a->data_casamento == '' ? ' ' : utf8_encode(strtoupper($a->data_casamento));
    $pai = $a->nome_pai == '' ? ' ' : utf8_encode(strtoupper($a->nome_pai));
    $mae = $a->nome_mae == '' ? ' ' : utf8_encode(strtoupper($a->nome_mae));
    $endereco = $f->endereco == '' ? '-' : utf8_encode(strtoupper($f->endereco));
    $numero = $f->numero == '' ? '-' : utf8_encode(strtoupper($f->numero));
    $complemento = $f->complemento == '' ? '-' : utf8_encode(strtoupper($f->complemento));
    $bairro = $teste = $e->bairro == '' ? '-' : utf8_encode(strtoupper($e->bairro));
    $estado = $f->estado == '' ? '-' : utf8_encode(strtoupper($f->estado));
    $cidade = $f->cidade == '' ? '-' : utf8_encode(strtoupper($f->cidade));
    $cep = $f->cep == '' ? '-' : utf8_encode(strtoupper($f->cep));
    switch ($a->tip_imovel) {
        case 0:
            $tip_imovel = ' ';
            break;
        case 1:
            $tip_imovel = 'Pr�prio';
            break;
        case 2:
            $tip_imovel = 'Alugada';
            break;
        case 3:
            $tip_imovel = 'Familiares';
            break;
    }
    $reside_praca = $a->reside_praca == '' ? '-' : utf8_encode(strtoupper($a->reside_praca));
    $endereco2 = $e->endereco == '' ? '-' : utf8_encode(strtoupper($e->endereco));
    $numero2 = $e->numero == '' ? '-' : utf8_encode(strtoupper($e->numero));
    $complemento2 = $e->complemento == '' ? '-' : utf8_encode(strtoupper($e->complemento));
    $estado2 = $e->estado == '' ? '-' : utf8_encode(strtoupper($e->estado));
    $cidade2 = $e->cidade == '' ? '-' : utf8_encode(strtoupper($e->cidade));
    $cep2 = $e->cep == '' ? '-' : utf8_encode(strtoupper($e->cep));
    $html = '
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>SAF Postal</title>
	<style type="text/css">
	<!--
	body,td,th {
		font-family: Verdana;
		font-size: 11px;
		color: #333333;
	}
	body {
		margin:15px;
	}
	hr {
		margin:0;
		padding:0;
		width:600px;
		background-color:#0071B6;
		height:3px;
		border:none;
		float:left;
	}
	.topo1 {
		float:left;
		width:25%;
		text-align:left;
	}
	.topo2 {
		float:right;
		width:75%;
		text-align:right;
	}
	.id {
		font-size:16px;
		font-weight:bold;
		float:left;
		color:#0071B6;
		width:600px;
	}
	.estrutura {
		border:solid 1px #0071B6;
		float:left;
		width:600px;
		margin-bottom:15px;
		padding-bottom:15px;
	}
	.titulo {
		background-color:#95D8FF;
		border-bottom:solid 2px #0071B6;
		float:left;
		width:600px;	
	}
	.titulo p {
		margin:3px;
		padding:3px;
		font-weight:bold;
	}
	.subtitulo {
		background-color:#FFE391;
		border-bottom:solid 1px #AE8300;
		float:left;
		width:600px;
	}
	.subtitulo2 {
		border-top:solid 1px #AE8300;
	}
	.subtitulo p {
		margin:3px;
		padding:3px;
	}
	.corpo {
		width:600px;
		margin-bottom:8px;
		padding-bottom:8px;
		float:left;
	}
	.corpo p {
		float:left;
		margin:0;
		padding:0;
		margin-left:10px;
		margin-top:5px;
		padding-left:10px;
		padding-top:5px;
	}
	-->
	</style>
	</head>
	<body>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td>&nbsp;</td>
		<td width="600">
			<p class="topo1">Novos Interessados</p>
			<p class="topo2">Franquia: ' . $fantasia . '</p>
			<hr />
			<p class="id">#ID Ficha: ' . $id . '</p>
			<p style="width:100%;"><span style="color:#FF0000;">Aten��o, voc� deve solicitar os seguintes documentos, junto ao cliente:</span><br />
			- C�pias de documentos (RG e CPF);<br /> 
			- Comprovante de endere�o (C.N ou C.C); e<br />
			- Bens (Matr�cula do im�vel)</p>
			<div class="estrutura">
				<div class="titulo"><p>Dados do Solicitante</p></div>
				<div class="subtitulo"><p>- Dados Pessoais</p></div>
				<div class="corpo">
					<p style="width:325px;"><strong>Nome:</strong><br />' . $nome . '&nbsp;</p>
					<p style="width:100px;"><strong>RG:</strong><br />' . $rg . '&nbsp;</p>
					<p style="width:100px;"><strong>CPF:</strong><br />' . $cpf . '&nbsp;</p>
					<p style="width:325px;"><strong>E-mail:</strong><br />' . $email . '&nbsp;</p>
					<p style="width:200px;"><strong>Data de Nascimento:</strong><br />' . $nascimento . '&nbsp;</p>                
					<p style="width:175px;"><strong>Residencial:</strong><br />' . $tel_res . '&nbsp;</p>
					<p style="width:175px;"><strong>Recado:</strong><br />' . $tel_rec . '&nbsp;</p>
					<p style="width:175px;"><strong>Celular:</strong><br />' . $tel_cel . '&nbsp;</p>
					<p style="width:100px;"><strong>Nacionalidade:</strong><br />' . $nacionalidade . '&nbsp;</p>
					<p style="width:145px;"><strong>Local de Nascimento:</strong><br />' . $nascimento . '&nbsp;</p>
					<p style="width:80px;"><strong>Estado Civil:</strong><br />' . $estado_civil . '&nbsp;</p>
					<p style="width:95px;"><strong>Possui Filhos?</strong><br />' . $filhos . '&nbsp;</p>
					<p style="width:80px;"><strong>Quantos?</strong><br />' . $quant . '&nbsp;</p>
					<p style="width:262px;"><strong>Regime de Casamento:</strong><br />' . $regime . '&nbsp;</p>
					<p style="width:262px;"><strong>Data do Casamento:</strong><br />' . $casamento . '&nbsp;</p>
					<p style="width:262px;"><strong>Nome do nome pai:</strong><br />' . $pai . '&nbsp;</p>
					<p style="width:262px;"><strong>Nome da M�e:</strong><br />' . $mae . '&nbsp;</p>           
				</div>
				<div class="subtitulo subtitulo2"><p>- Endere�o Atual do Solicitante</p></div>
				<div class="corpo">
					<p style="width:262px;"><strong>Endere�o:</strong><br />' . $endereco . '&nbsp;</p> 
					<p style="width:43px;"><strong>N�:</strong><br />' . $numero . '&nbsp;</p> 
					<p style="width:150px;"><strong>Complemento:</strong><br />' . $complemento . '&nbsp;</p> 
					<p style="width:180px;"><strong>Bairro:</strong><br />' . $bairro . '&nbsp;</p> 
					<p style="width:40px;"><strong>Estado:</strong><br />' . $estado . '&nbsp;</p> 
					<p style="width:200px;"><strong>Cidade:</strong><br />' . $cidade . '&nbsp;</p> 
					<p style="width:60px;"><strong>CEP:</strong><br />' . $cep . '&nbsp;</p> 
					<p style="width:262px;"><strong>Tipo do Im�vel:</strong><br />' . strtoupper($tip_imovel) . '&nbsp;</p> 
					<p style="width:262px;"><strong>Reside na Pra�a Desde:</strong><br />' . $reside_praca . '&nbsp;</p> 
				</div>
				<div class="subtitulo subtitulo2"><p>- Endere�o Anterior do Solicitante</p></div>
				<div class="corpo">
					<p style="width:262px;"><strong>Endere�o:</strong><br />' . $endereco2 . '&nbsp;</p> 
					<p style="width:43px;"><strong>N�:</strong><br />' . $numero2 . '&nbsp;</p> 
					<p style="width:150px;"><strong>Complemento:</strong><br />' . $complemento2 . '&nbsp;</p> 
					<p style="width:180px;"><strong>Bairro:</strong><br />' . $bairro . '&nbsp;</p> 
					<p style="width:40px;"><strong>Estado:</strong><br />' . $estado2 . '&nbsp;</p> 
					<p style="width:200px;"><strong>Cidade:</strong><br />' . $cidade2 . '&nbsp;</p> 
					<p style="width:60px;"><strong>CEP:</strong><br />' . $cep2 . '&nbsp;</p> 
				</div>
			</div>
	
		</td>
		<td>&nbsp;</td>
	  </tr>
	</table>
	</body>
	</html>';
    return $html;
}
<?php

header("Content-Type: text/html; charset=ISO-8859-1", true);
require "../includes/verifica_logado_safpostal.inc.php";
require "../includes/funcoes.php";
require "../includes/global.inc.php";
require '../includes/browser.php';
$permissao = verifica_permissao('EXPANSAO', $safpostal_departamento_saf);
if ($permissao == 'FALSE' or $safpostal_id_empresa != '1') {
    echo '<br><br><strong>Você não tem permissão para acessar essa página</strong>';
    exit;
}
$dt = new ListaInteressadosDAO();
$dt1 = new StatusDAO();
pt_register('GET', 'acao');
pt_register('GET', 'id_status');
pt_register('GET', 'pagina');
pt_register('GET', 'uf');
pt_register('GET', 'cidade');
pt_register('GET', 'id_status');
pt_register('GET', 'total_registro');
pt_register('GET', 'nome');
pt_register('GET', 'data1');
pt_register('GET', 'data2');
pt_register('GET', 'usuario');
$ini = 0;
if ($pagina > 1) {
    $ini = $pagina * $total_registro - $total_registro;
}
$e = $dt->listaInteressados2($acao, $id_status, $ini, $total_registro, $uf, $cidade, $id_status, $nome, $usuario);
$total = count($e);
<?php

header("Content-Type: text/html; charset=ISO-8859-1", true);
require "../includes/verifica_logado_safpostal.inc.php";
require "../includes/funcoes.php";
require "../includes/global.inc.php";
require '../includes/browser.php';
$permissao = verifica_permissao('EXPANSAO', $safpostal_departamento_saf);
if ($permissao == 'FALSE' or $safpostal_id_empresa != '1') {
    echo '<br><br><strong>Você não tem permissão para acessar essa página</strong>';
    exit;
}
$dt = new ListaInteressadosDAO();
$dt1 = new StatusDAO();
pt_register('GET', 'acao');
pt_register('GET', 'id_status');
pt_register('GET', 'pagina');
pt_register('GET', 'uf');
pt_register('GET', 'cidade');
pt_register('GET', 'id_status');
pt_register('GET', 'total_registro');
pt_register('GET', 'nome');
pt_register('GET', 'data1');
pt_register('GET', 'data2');
pt_register('GET', 'usuario');
$ini = 0;
if ($pagina > 1) {
    $ini = $pagina * $total_registro - $total_registro;
}
if ($data1) {
    $d = explode('/', $data1);
<?php

require "../includes/topo.php";
$permissao = verifica_permissao('EXPANSAO', $safpostal_departamento_saf);
if ($permissao == 'FALSE' or $safpostal_id_empresa != '1') {
    echo '<br><br><strong>Você não tem permissão para acessar essa página</strong>';
    exit;
}
$dt = new ListaInteressadosDAO();
$dt1 = new StatusDAO();
$total_pagina = 20;
$idst = 0;
?>
<div id="calendario"></div>
<table width="920" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
	<td colspan="3" height="2"></td>
  </tr>
  <tr>
	<td width="152" align="left" valign="top">
		<?php 
require "menu_lateral.php";
?>
	</td>
	<td width="2"></td>
	<td align="left" valign="top">
    	<div style="height:20px; width:766px; background-image:url(../images/paginas/index/barra_de_titulo1.png); background-position:left bottom; background-repeat:no-repeat;">
        	<p style="float:left; margin:0; margin-top:3px; width:322px; font-weight:bold;">Lista de Novos Interessados</p>
            <p style="float:left; margin:0; margin-top:3px; margin-left:28px; width:416px; font-weight:bold; font-weight:bold">Franquia: <?php 
echo $safpostal_fantasia;
?>
<?php

require "../includes/topo.php";
$permissao = verifica_permissao('EXPANSAO', $safpostal_departamento_saf);
if ($permissao == 'FALSE' or $safpostal_id_empresa != '1') {
    echo '<br><br><strong>Você não tem permissão para acessar essa página</strong>';
    exit;
}
$dt = new ListaInteressadosDAO();
?>
<table width="920" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
	<td colspan="3" height="2"></td>
  </tr>
  <tr>
	<td width="152" align="left" valign="top">
		<?php 
require "menu_lateral.php";
?>
	</td>
	<td width="2"></td>
	<td align="left" valign="top">
    	<div style="height:20px; width:766px; background-image:url(../images/paginas/index/barra_de_titulo1.png); background-position:left bottom; background-repeat:no-repeat;">
        	<p style="float:left; margin:0; margin-top:3px; width:322px; font-weight:bold;">Lista de Interessados</p>
            <p style="float:left; margin:0; margin-top:3px; margin-left:28px; width:416px; font-weight:bold; font-weight:bold">
            	Franquia: <?php 
echo $safpostal_fantasia;
?>
</p>
        </div>
        <div style="height:54px; width:766px; float:left;">
<?php

header("Content-Type: text/html; charset=ISO-8859-1", true);
require "../includes/verifica_logado_safpostal.inc.php";
require '../includes/classQuery_sistecart.php';
require "../includes/funcoes.php";
require "../includes/global.inc.php";
$permissao = verifica_permissao('EXPANSAO', $safpostal_departamento_saf);
if ($permissao == 'FALSE' or $safpostal_id_empresa != '1') {
    echo '<br><br><strong>Você não tem permissão para acessar essa página</strong>';
    exit;
}
pt_register('GET', 'id');
$cor = '#FFF';
$dt = new StatusDAO();
$dt1 = new ListaInteressadosDAO();
$e = $dt->buscaHistorico($id);
$f = $dt1->buscaDataInclude($id);
if (count($e) > 0) {
    ?>
<p align="right"><a href="#historico" onclick="VisualizarHistorico(0, 0);">X FECHAR HISTÓRICO</a></p>
<table width="756" border="0" cellspacing="2" cellpadding="0" style="border:solid 1px #0071B6; margin-top:5px;">
      <tr style="font-weight: bold; background:#95D8FF; font-size:10px;">
        <td width="180" height="20" style="border-bottom:solid 1px #0071B6;">&nbsp;&nbsp;STATUS ANTERIOR</td>
        <td width="131" style="border-bottom:solid 1px #0071B6;">&nbsp;&nbsp;ALTERADO POR:</td>
        <td width="229" style="border-bottom:solid 1px #0071B6;">&nbsp;&nbsp;OBSERVA&Ccedil;&Otilde;ES</td>
        <td width="85" align="center" style="border-bottom:solid 1px #0071B6;">REUNIÃO</td>
        <td width="117" align="center" style="border-bottom:solid 1px #0071B6;">INCLUS&Atilde;O</td>
      </tr>
	<?php 
    foreach ($e as $j => $hst) {
        case 26:
            $orgao_emissor = 'SSP-SP';
            break;
        case 27:
            $orgao_emissor = 'SSP-TO';
            break;
    }
    return $orgao_emissor;
}
pt_register('GET', 'aba');
if ($aba) {
    $aba = $aba;
} else {
    $aba = 1;
}
$dt = new ListaInteressadosDAO();
$dt1 = new StatusDAO();
$dt2 = new FichaDAO();
pt_register('GET', 'id');
pt_register('POST', 'submit1');
pt_register('POST', 'submit2');
pt_register('POST', 'submit3');
$c = new stdClass();
if ($submit1) {
    require "edita_submit1.php";
} elseif ($submit2) {
    require "edita_submit2.php";
} elseif ($submit3) {
    require "edita_submit3.php";
} else {
    $e = $dt->buscaFichaCadastros($id);
    $dt = $objQuery->SQLQuery($sql);
    $res = mysql_fetch_array($dt);
    echo '<select id="usuario" name="usuario" class="form_estilo" style="width:298px;">' . "\n";
    echo '<option value="0"></option>' . "\n";
    while ($res = mysql_fetch_array($dt)) {
        echo '<option value="' . $res['id_usuario'] . '">' . utf8_encode(ucwords(strtolower($res['nome']))) . '</option>' . "\n";
    }
    echo '</select>';
} else {
    require "../includes/verifica_logado_safpostal.inc.php";
    require "../includes/funcoes.php";
    require "../includes/global.inc.php";
    pt_register('GET', 'id_ficha');
    pt_register('GET', 'id_usuario');
    pt_register('GET', 'redirecionar');
    $dt = new ListaInteressadosDAO();
    $arr = explode(',', $id_ficha);
    for ($i = 0; $i < count($arr); $i++) {
        $dt->direcionaUsuario($id_usuario, $arr[$i]);
    }
    $pagina = 'direcionamento.php';
    if ($redirecionar) {
        $pagina .= '?redirecionar=1';
    }
    ?>
      <script language="javascript" type="text/javascript">
	  	alert('Direcionamento atualizado com sucesso!');
		setTimeout("location.href='<?php 
    echo $pagina;
    ?>
'", 500);
<?php

require "../includes/topo.php";
$permissao = verifica_permissao('EXPANSAO', $safpostal_departamento_saf);
if ($permissao == 'FALSE' or $safpostal_id_empresa != '1') {
    echo '<br><br><strong>Você não tem permissão para acessar essa página</strong>';
    exit;
}
$dt = new ListaInteressadosDAO();
$dt1 = new StatusDAO();
pt_register('GET', 'id');
pt_register('GET', 'ab');
pt_register('POST', 'submit1');
pt_register('POST', 'submit2');
$dsp1 = 'block';
$dsp2 = 'none';
$dsp3 = 'none';
if ($ab == '2') {
    $dsp1 = 'none';
    $dsp2 = 'block';
}
if ($submit2) {
    $dsp1 = 'none';
    $dsp2 = 'block';
    pt_register('POST', 'data_reuniao');
    pt_register('POST', 'id_status');
    pt_register('POST', 'observacao_expansao');
    $error2 = "Os campos com * são obrigatórios.<br />";
    $erro_sub2 = 0;
    if ($id_status == 0) {
        $erro_sub2 = 1;