<?php
include("../sol/sessao.php");
//Conecta ao banco e abre query
$dados = new dados();
$dados->get_conexao();
$a_suporte = true;
$a_comecial = true;
if (!empty($_GET['id']))
{
$sql = "SELECT
v.*, i.nome
FROM
visitas AS v
INNER JOIN
instituicao AS i ON (i.id_inst = v.solicitante)
WHERE v.id = ".$_GET['id'];
$rs = mysql_query($sql);
$reg = mysql_fetch_array($rs);
}
//Verifica permissao
if ($_GET['tipo'] != 'ver')
{
$achou_dpto = false;
$sqlx = "SELECT * FROM deptos_x_preagendamento WHERE departamento = ".$_SESSION['departamento'];
if ($_GET['tipo'] == 'pre') $sqlx .= " AND eh_pre = 1";
if (($_GET['tipo'] == 'agendar') || ($_GET['tipo'] == 'atender')) $sqlx .= " AND eh_pre = 0";
$rsx = mysql_query($sqlx);
while ($regx = mysql_fetch_array($rsx))
{
$achou_dpto = true;
$a_suporte = $regx['abre_suporte'];
$a_comecial = $regx['abre_vendas'];
//Verifica departamentos depos de aberto o agendamento
if (($reg['eh_comercial'] == 1) && (!$a_comecial)) $achou_dpto = false;
if (($reg['eh_suporte'] == 1) && (!$a_suporte)) $achou_dpto = false;
}
if (!$achou_dpto) header('Location:/sol/agendamentos.php?msg=dpto');
}
//Variaveis da pagina
$MyTipo = $_GET['tipo'];
$MyData = date("d/m/Y");
$MyHora = date("H:i");
$MyID = $_GET['id'];
$casual = false;
if ($_GET['casual'] == '1') $casual = true;
?>
<!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>SolBT - <?=$sitenome?></title>
<link rel="StyleSheet" type="text/css" href="../sol/includes/estilos.css" id="estilo" />
<script language='JavaScript' src='../sol/includes/FuncoesTela.js' type="text/javascript"></script>
<script language='JavaScript' type="text/javascript">
//Pesquisa e valida o cliente
function ValidarCliente(pesquisa)
{
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
b = document.getElementById('cliente').value = b = document.getElementById('cliente').value.trim();
var er = /[0-9]{1,}/;
b = document.getElementById('cliente').value;
if (document.getElementById('cliente').value == '')
{
document.getElementById('clinome').value = '';
if (!pesquisa)
{
window.alert('Campo solicitante/cliente deve ser preenchido!');
document.getElementById('cliente').focus();
return false;
}
}
else
{
if(!er.test(b))
{
window.alert('Campo solicitante/cliente inválido!');
document.getElementById('cliente').value = '';
document.getElementById('cliente').focus();
return false;
}
else
{
ajax = InstanciaAJAX();
document.getElementById('clinome').value = '';
ajax.open('POST', 'clientes.xml.php?all=true', true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajax.onreadystatechange = function()
{
//Enquanto estiver processando emite a mensagem de aguarde
if(ajax.readyState == 1)
{
document.getElementById('clinome').style.color = '#666666';
document.getElementById('clinome').value = 'Localizando solicitante/cliente...';
}
//Após ser processado chama função processXML que vai varrer os dados
if(ajax.readyState == 4 )
{
if(ajax.responseXML)
{
return processaCliente(ajax.responseXML);
}
else
{
document.getElementById('clinome').value = '';
document.getElementById('cliente').value = '';
alert('Solicitante/cliente não encontrado!');
document.getElementById('clinome').style.color = '#000000';
document.getElementById('cliente').focus();
return false;
}
}
}
//Passa o código do estado escolhido como parâmetro pro POST e envia
var params = 'id=' + document.getElementById('cliente').value;
ajax.send(params);
return true;
}
}
}
function processaCliente(obj)
{
//Pega a TAG modulo
var dataArray = obj.getElementsByTagName('cliente');
//Verifica o total de elementos contidos na TAG
if(dataArray.length > 0)
{
//Percorre o arquivo XML para extrair os dados
for(var i = 0 ; i < dataArray.length ; i++)
{
var item = dataArray[i];
//Conteudo dos campos no arquivo XML
var cli = item.getElementsByTagName('nome')[0].firstChild.nodeValue;
var codreal = item.getElementsByTagName('codigo')[0].firstChild.nodeValue;
document.getElementById('cliente').value = codreal;
document.getElementById('clinome').value = cli;
document.getElementById('clinome').style.color = '#000000';
return true
}
}
else
{
//Caso o XML volte vazio
document.getElementById('clinome').value = '';
document.getElementById('cliente').value = '';
alert('Solicitante/cliente informado não encontrado!');
document.getElementById('clinome').style.color = '#000000';
document.getElementById('cliente').focus();
return false;
}
}
function BuscarCliente()
{
document.getElementById('clinome').value = '';
document.getElementById('cliente').value = '';
document.getElementById('pesqcli').style.display = '';
document.getElementById('actSair').style.display = 'none';
if (document.getElementById('rpVoltar') != null)
{
document.getElementById('rpVoltar').style.display = 'none';
}
document.getElementById('actCFG').style.display = 'none';
document.getElementById('edtPesqCli').value = '';
document.getElementById('carregando').style.display = '';
document.getElementById('aviso_so_efetivos').style.display = 'none';
document.getElementById('aviso_todos_cli').style.display = '';
document.getElementById('todos_cli').value = 'true';
document.getElementById('edtPesqCli').focus();
window.open('pesqcli.php', 'ipesqcli');
}
function VerificaFocoPesquisa()
{
if (document.getElementById('pesqcli').style.display == '') document.getElementById('edtPesqCli').focus();
}
function FocoInicial()
{
<? if ($MyTipo != 'ver') echo "if (document.getElementById('data').readOnly == false) document.getElementById('data').focus();"; ?>
}
function SelCliEfetivo()
{
document.getElementById('sel_cli').style.display = 'none';
document.getElementById('cliente').style.display = '';
document.getElementById('btnCliente').style.display = '';
document.getElementById('clinome').style.display = '';
document.getElementById('redefSel').style.display = '';
document.getElementById('cliente').focus();
}
function CadCliNovo()
{
document.getElementById('sel_cli').style.display = 'none';
document.getElementById('cli_novo_nome').style.display = '';
document.getElementById('cli_novo_dados').style.display = '';
document.getElementById('redefNovo').style.display = '';
document.getElementById('cli_novo_nome').focus();
}
function cadRamo()
{
if (document.getElementById('sramo').value == '[novo]')
{
document.getElementById('ramo').style.display = '';
document.getElementById('sramo').style.display = 'none';
document.getElementById('ramo').focus();
}
else
{
document.getElementById('ramo').value = document.getElementById('sramo').value;
}
}
function Dados(valor)
{
ajax = InstanciaAJAX();
//Se tiver suporte a AJAX
if(ajax)
{
//Deixa apenas o elemento 1 no option, os outros são excluÃdos
document.getElementById('cidade').options.length = 1;
idOpcao = document.getElementById('opcoes');
if (valor == -1)
{
//Desabilita a lista de cidades
document.getElementById('cidade').disabled = 'disabled';
idOpcao.innerHTML = 'Selecione um estado na lista.';
}
else
{
//Define a chamada via POST ao XML criado pelo PHP com as cidades
ajax.open('POST', 'cidades.xml.php', true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajax.onreadystatechange = function()
{
//Enquanto estiver processando emite a mensagem de aguarde
if(ajax.readyState == 1)
{
idOpcao.innerHTML = 'Aguarde...';
}
//Após ser processado chama função processXML que vai varrer os dados
if(ajax.readyState == 4 )
{
if(ajax.responseXML)
{
processXML(ajax.responseXML);
}
else
{
//Caso não consiga ler o arquivo XML emite a mensagem e desabilita a lista de cidades
idOpcao.innerHTML = 'Cidades não encontradas.';
document.getElementById('cidade').disabled = 'disabled';
}
}
}
}
//Passa o código do estado escolhido como parâmetro pro POST e envia
var params = 'id_uf=' + valor;
ajax.send(params);
}
function processXML(obj)
{
//Pega a TAG cidade
var dataArray = obj.getElementsByTagName('cidade');
//Verifica o total de elementos contidos na TAG cidade
if(dataArray.length > 0)
{
//Percorre o arquivo XML para extrair os dados
for(var i = 0 ; i < dataArray.length ; i++)
{
var item = dataArray[i];
//Contéudo dos campos no arquivo XML
var valorcid = item.getElementsByTagName('id_cidade')[0].firstChild.nodeValue;
var nome = item.getElementsByTagName('nome')[0].firstChild.nodeValue;
idOpcao.innerHTML = 'Selecione a cidade.';
//Cria um novo option dinamicamente
var novo = document.createElement('option');
//Atribui um ID a esse elemento
novo.setAttribute('id', 'opcoes');
//Atribui valor e texto
novo.value = valorcid;
novo.text = nome;
//Adiciona o novo elemento
document.getElementById('cidade').options.add(novo);
}
//Habilita a lista de cidades
document.getElementById('cidade').disabled = '';
var idUF = 0;
if (idUF > 0)
{
if (!jaLoaded)
{
if (document.getElementById('uf').value == idUF)
{
var idCity = 0;
document.getElementById('cidade').value = idCity;
}
}
}
jaLoaded = true;
}
else
{
//Caso o XML volte vazio, exibe a mensagem abaixo e desabilita a lista de cidades
idOpcao.innerHTML = 'Cidades não encontradas.';
document.getElementById('cidade').disabled = 'disabled';
}
}
}
//Redefine busca de cliente
function RedefinirCliente()
{
//Visiveis
document.getElementById('sel_cli').style.display = '';
document.getElementById('cliente').style.display = 'none';
document.getElementById('btnCliente').style.display = 'none';
document.getElementById('clinome').style.display = 'none';
document.getElementById('redefSel').style.display = 'none';
document.getElementById('cli_novo_nome').style.display = 'none';
document.getElementById('cli_novo_dados').style.display = 'none';
document.getElementById('redefNovo').style.display = 'none';
document.getElementById('ramo').style.display = 'none';
document.getElementById('sramo').style.display = '';
//Valores
document.getElementById('cliente').value = '';
document.getElementById('clinome').value = '';
document.getElementById('cli_novo_nome').value = '';
document.getElementById('cli_novo_telefone').value = '';
document.getElementById('uf').value = '11';
Dados(document.getElementById('uf').value);
document.getElementById('outra_cidade').value = '';
document.getElementById('ramo').value = '';
document.getElementById('sramo').value = '';
}
function strToInt(s)
{
return isNaN(v = parseInt(s)) ? 0 : v;
}
function Salvar()
{
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
//Limpa espaços
document.getElementById('data').value = document.getElementById('data').value.trim();
document.getElementById('hora').value = document.getElementById('hora').value.trim();
document.getElementById('cli_novo_nome').value = document.getElementById('cli_novo_nome').value.trim();
document.getElementById('cli_novo_telefone').value = document.getElementById('cli_novo_telefone').value.trim();
document.getElementById('ramo').value = document.getElementById('ramo').value.trim();
document.getElementById('outra_cidade').value = document.getElementById('outra_cidade').value.trim();
document.getElementById('pessoa').value = document.getElementById('pessoa').value.trim();
document.getElementById('historico').value = document.getElementById('historico').value.trim();
//Valida a Data
if (document.getElementById('data').value.length == 0)
{
window.alert('Informe uma data.');
document.getElementById('data').focus();
return;
}
else
{
var er = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[1-2][0-9]\d{2})$/;
b = document.getElementById('data').value;
if(!er.test(b))
{
window.alert('Data inválida.');
document.getElementById('data').value = '';
document.getElementById('data').focus();
return;
}
}
//Valida a hora
if (document.getElementById('hora').value.length == 0)
{
window.alert('Informe a hora.');
document.getElementById('hora').focus();
return;
}
else
{
var er = /[0-9]{2,}/;
//00:00
b = document.getElementById('hora').value.substring(0, 2);
c = document.getElementById('hora').value.substring(2, 3);
d = document.getElementById('hora').value.substring(3, 5);
var ErroHora = false;
if (!er.test(b)) ErroHora = true;
if (strToInt(b) > 23) ErroHora = true;
if (!er.test(d)) ErroHora = true;
if (strToInt(d) > 59) ErroHora = true;
if (c != ':') ErroHora = true;
if (ErroHora == true)
{
window.alert('Hora inválida.');
document.getElementById('hora').value = '';
document.getElementById('hora').focus();
return;
}
}
<?php
if (empty($MyID))
{
?>
//Valida direcionamento
if (document.getElementById('suporte_ou_comercial').value == '')
{
window.alert('Informe o direcionamento deste atendimento.');
document.getElementById('suporte_ou_comercial').focus();
return;
}
//Valida direcionamento e o cliente
if (document.getElementById('suporte_ou_comercial').value == 'S')
{
if (document.getElementById('cli_novo_dados').style.display == '')
{
window.alert('Você não pode agendar um atendimento de suporte para um cliente novo não efetivado.');
document.getElementById('suporte_ou_comercial').focus();
return;
}
}
if ((document.getElementById('cli_novo_dados').style.display == 'none') && (document.getElementById('cliente').style.display == 'none'))
{
window.alert('Informe o cliente.');
SelCliEfetivo();
return;
}
<?php
}
?>
//Verifica cliente
if (document.getElementById('cliente').style.display == '')
{
if (document.getElementById('cliente').value == '')
{
window.alert('Informe o cliente.');
document.getElementById('cliente').focus();
return;
}
else
{
if (document.getElementById('cliente').value == '0')
{
window.alert('Você não pode agendar atendimentos para o cliente novo.');
document.getElementById('cliente').focus();
document.getElementById('cliente').value = '';
return;
}
}
}
//Verifica cliente novo
if (document.getElementById('cli_novo_dados').style.display == '')
{
if (document.getElementById('cli_novo_nome').value == '')
{
window.alert('Informe o nome do cliente.');
document.getElementById('cli_novo_nome').focus();
return;
}
if (document.getElementById('cli_novo_telefone').value == '')
{
window.alert('Informe o telefone do cliente.');
document.getElementById('cli_novo_telefone').focus();
return;
}
document.getElementById('outra_cidade').value = document.getElementById('outra_cidade').value.trim();
if ((document.getElementById('cidade').value == 0) && (document.getElementById('outra_cidade').value.length == 0))
{
alert('Selecione uma cidade na lista ou informe uma nova.');
document.getElementById('outra_cidade').focus();
return;
}
}
//Valida tipo de contato
if (document.getElementById('tipo').value == '')
{
window.alert('Informe o tipo de contato.');
document.getElementById('tipo').focus();
return;
}
//Valida a pessoa
if (document.getElementById('pessoa').value == '')
{
window.alert('Informe a pessoa de contato.');
document.getElementById('pessoa').focus();
return;
}
//Valida o historico
if (document.getElementById('historico').value == '')
{
window.alert('Informe os detalhes do contato.');
document.getElementById('historico').focus();
return;
}
//Posta
document.forms.frmPre.submit();
}
</script>
</head>
<body onload="FocoInicial(); window.open('#', '_self');">
<?php
include("../sol/framepesqcli.php");
include("../sol/includes/menus.php");
?>
<table width="100%">
<?php
include("../sol/includes/top.php");
?>
<!-- CONTEUDO DA PAGINA -->
<tr>
<td id="Conteudo">
<br />
<span class="Titulo">
<?php
if ($MyTipo == "pre")
{
echo "Pré-agendamento";
}
else
{
if ($MyTipo == "agendar")
{
if ($casual) echo "Registro de visita/atendimento casual"; else echo "Agendar visita/atendimento";
}
else
{
echo "Registrar visita/atendimento efetuado";
}
}
?>
</span>
<!-- DADOS DO AGENDAMENTO -->
<?php
if (!empty($MyID))
{
//O sql tá la em cima, cuidado pra nao confundir
if ($reg['usuario_pre'] > 0)
{
?>
<!-- DADOS DO PRE-AGENDAMENTO-->
<br /> <br />
<u>Dados do pré-agendamento</u>
<br /> <br />
<strong>Data e hora:</strong>
<?php
$MyData = substr($reg["data_pre"], 8, 2)."/".substr($reg["data_pre"], 5, 2)."/".substr($reg["data_pre"], 0, 4);
$MyHora = substr($reg['hora_pre'], 0, 5);
echo $MyData;
echo ' às '.$MyHora;
?>
<strong>Direcionamento:</strong>
<?php
if ($reg['eh_suporte']) echo 'Suporte';
if ($reg['eh_suporte'] && $reg['eh_comercial']) echo ' e ';
if ($reg['eh_comercial']) echo 'Comercial';
?>
<strong>Tipo de contato:</strong> <?=utf8_encode($reg['tipo_pre'])?>
<br /> <br />
<span class="Titulo"><strong>Solicitante: </strong><?=utf8_encode($reg['nome'])?></span>
<br /> <br />
<strong>Pessoa de contato: </strong><?=utf8_encode($reg['pessoa_pre'])?>
<strong>Atendente: </strong>
<?php
$sqlx = "SELECT username FROM usuarios WHERE id_usuario = ".$reg['usuario_pre'];
$rsx = mysql_query($sqlx);
$regx = mysql_fetch_array($rsx);
echo utf8_encode($regx['username'])
?>
<br /> <br />
<strong>Detalhes:</strong>
<br /> <br />
<em><?=utf8_encode(nl2br($reg['historico_pre']))?></em>
<br /> <br />
<hr size="1" />
<!-- FIM DOS DADOS DO PRE-AGENDAMENTO-->
<?php
}
//DADOS DO AGENDAMENTO
if ($reg['data_agendada'] > 0)
{
?>
<br /> <br />
<u>Dados do agendamento</u>
<br /> <br />
<strong>Data e hora:</strong>
<?php
$MyData = substr($reg["data_agendada"], 8, 2)."/".substr($reg["data_agendada"], 5, 2)."/".substr($reg["data_agendada"], 0, 4);
$MyHora = substr($reg['hora_agendada'], 0, 5);
echo $MyData;
echo ' às '.$MyHora;
$MyData = date("d/m/Y");
$MyHora = date("H:i");
?>
<strong>Tipo de contato:</strong> <?=utf8_encode($reg['tipo_agendado'])?>
<? if ($reg['usuario_pre'] == 0) { ?>
<strong>Direcionamento:</strong>
<?php
if ($reg['eh_suporte']) echo 'Suporte';
if ($reg['eh_suporte'] && $reg['eh_comercial']) echo ' e ';
if ($reg['eh_comercial']) echo 'Comercial';
?>
<? } ?>
<br /> <br />
<? if ($reg['usuario_pre'] == 0) { ?>
<span class="Titulo"><strong>Solicitante: </strong><?=utf8_encode($reg['nome'])?></span>
<br /> <br />
<? } ?>
<strong>Pessoa de contato: </strong><?=utf8_encode($reg['pessoa_pre'])?>
<strong>Atendente: </strong>
<?php
$sqlx = "SELECT username FROM usuarios WHERE id_usuario = ".$reg['usuario_agendou'];
$rsx = mysql_query($sqlx);
$regx = mysql_fetch_array($rsx);
echo utf8_encode($regx['username'])
?>
<br /> <br />
<strong>Detalhes:</strong>
<br /> <br />
<em><?=utf8_encode(nl2br($reg['historico_agendamento']))?></em>
<br /> <br />
<hr size="1" />
<?php
}
//DADOS DO ATENDIMENTO
if ($reg['data_atendido'] > 0)
{
?>
<br /> <br />
<u>Dados do atendimento/visita realizado</u>
<br /> <br />
<strong>Data e hora:</strong>
<?php
$MyData = substr($reg["data_atendido"], 8, 2)."/".substr($reg["data_atendido"], 5, 2)."/".substr($reg["data_atendido"], 0, 4);
$MyHora = substr($reg['hora_atendido'], 0, 5);
echo $MyData;
echo ' às '.$MyHora;
?>
<strong>Tipo de contato:</strong> <?=utf8_encode($reg['tipo_atendido'])?>
<strong>Pessoa de contato: </strong><?=utf8_encode($reg['pessoa_atendida'])?>
<br /> <br />
<strong>Atendente: </strong>
<?php
$sqlx = "SELECT username FROM usuarios WHERE id_usuario = ".$reg['usuario_agendou'];
$rsx = mysql_query($sqlx);
$regx = mysql_fetch_array($rsx);
echo utf8_encode($regx['username'])
?>
<strong>Situação: </strong><?=utf8_encode($reg['situacao_contato'])?>
<br /> <br />
<strong>Detalhes:</strong>
<br /> <br />
<em><?=utf8_encode(nl2br($reg['historico_atendido']))?></em>
<?php
}
}
?>
<!-- FIM DE DADOS DO AGENDAMENTO -->
<br /> <br />
<u>
<?php
if ($MyTipo == "pre")
{
echo "Pré-agendar";
}
else
{
if ($MyTipo == "agendar")
{
if ($casual) echo "Registrar atendimento/visita casual" ; else echo "Agendar";
}
else
{
if ($MyTipo != "ver") echo "Registrar visita/atendimento";
}
}
?></u>
<br /> <br />
<form action="registra_agendamento.php?tipo=<?=$MyTipo?>&id=<? echo $MyID; if ($casual) echo "&casual=1"; ?>" method="post" id="frmPre">
<?php
if ((($MyTipo != 'ver') && (!$casual)) || (($MyTipo == 'agendar') && ($casual)))
{
if (($MyTipo == 'agendar') && (!$casual) && ($_SESSION['univel'] == 3))
{
echo 'Você não tem permissão para agendar atendimentos. <br /><br /> <input type="button" value="Voltar" onclick="window.open(\'agendamentos.php\', \'_self\');" />';
}
else
{
?>
<!-- PRE-AGENDAMENTO -->
Data: <input type="text" id="data" name="data" value="<?=$MyData?>" maxlength="10" size="10" onfocus="VerificaFocoPesquisa();" />
Hora: <input type="text" id="hora" name="hora" value="<?=$MyHora?>" maxlength="5" size="5" /> <font size="1" color="Gray"><em>(formato 24 hs.)</em></font>
<?php
if (($MyTipo == 'atender') || ($casual))
{
?>
Situação:
<select id="situacao" name="situacao">
<option value="Atendido/visitado">Atendido/visitado</option>
<?php
if ($a_comecial)
{
?>
<option value="Demonstração de sistema">Demonstração de sistema</option>
<option value="Contrato fechado">Contrato fechado</option>
<option value="Negociando (agendar nova visita)">Negociando (agendar nova visita)</option>
<?php
}
?>
<option value="Instalação de sistema">Instalação de sistema</option>
<option value="Outros">Outros (especificar nos detalhes)</option>
</select>
<?php
}
?>
<?php
if (empty($MyID))
{
?>
Direcionamento:
<select id="suporte_ou_comercial" name="suporte_ou_comercial">
<option value="">Selecione...</option>
<?php
if ($a_suporte) echo '<option value="S">Suporte</option>';
if ($a_comecial) echo '<option value="C">Comercial</option>';
?>
</select>
<br /> <br />
Solicitante/Cliente: <span id="sel_cli"> [ <a href="#" onclick="SelCliEfetivo();">selecionar cliente</a> ] [ <a href="#" onclick="CadCliNovo();">cadastrar cliente novo</a> <font size="1">(verifique se já está cadastrado antes)</font> ]</span>
<?php
}
?>
<!-- SELECIONAR CLIENTE CADASTRADO -->
<input type="text" id="cliente" name="cliente" value="" maxlength="7" size="5" onblur="ValidarCliente(true);" style="display:none;" />
<input type="button" name="btnCliente" id="btnCliente" value="..." onclick="BuscarCliente();" title="Localizar cliente..." style="display:none;" />
<input type="text" id="clinome" name="clinome" value="" size="50" readonly="true" style="display:none;" /> <span style="display:none;" id="redefSel">[ <a href="#" onclick="RedefinirCliente()">redefinir cliente</a> ]</span>
<!-- CADASTRAR NOVO CLIENTE -->
<input type="text" name="cli_novo_nome" id="cli_novo_nome" value="" maxlength="50" size="50" style="display:none;" /> <span style="display:none;" id="redefNovo">[ <a href="#" onclick="RedefinirCliente()">redefinir cliente</a> ]</span>
<br /> <br />
<div id="cli_novo_dados" style="display:none;">
Telefone:
<input type="text" name="cli_novo_telefone" id="cli_novo_telefone" value="" maxlength="16" size="16" />
Ramo de atividade:
<select name="sramo" id="sramo" onchange="cadRamo()">
<option value="" selected>Selecione...</option>
<option value="[novo]">- Cadastrar novo -</option>
<?php
$sqlx = "SELECT ramo FROM instituicao GROUP BY ramo ORDER BY ramo ASC";
$rsx = mysql_query($sqlx);
while ($regx = mysql_fetch_array($rsx))
{
if (!empty($regx['ramo']))
{
echo '<option value="'.utf8_encode($regx["ramo"]).'"';
echo '>'.utf8_encode($regx["ramo"]).'</option>';
}
}
?>
</select>
<input type="text" name="ramo" id="ramo" value="" maxlength="50" size="30" style="display:none;" />
<br /> <br />
UF:
<select name="uf" id="uf" onChange="Dados(this.value);">
<option value="1">AC</option>
<option value="2">AL</option>
<option value="3">AP</option>
<option value="4">AM</option>
<option value="5">BA</option>
<option value="6">CE</option>
<option value="7">DF</option>
<option value="8">ES</option>
<option value="9">GO</option>
<option value="10">MA</option>
<option value="11" selected>MT</option>
<option value="12">MS</option>
<option value="13">MG</option>
<option value="14">PA</option>
<option value="15">PB</option>
<option value="16">PR</option>
<option value="17">PE</option>
<option value="18">PI</option>
<option value="19">RJ</option>
<option value="20">RN</option>
<option value="21">RS</option>
<option value="22">RO</option>
<option value="23">RR</option>
<option value="24">SC</option>
<option value="25">SP</option>
<option value="26">SE</option>
<option value="27">TO</option>
</select>
Cidade:
<select name="cidade" id="cidade" onchange="document.getElementById('outra_cidade').value = '';">
<option id="opcoes" value="0">Selecione...</option>
</select>
<script language='JavaScript' type="text/javascript">
Dados(document.getElementById('uf').value);
</script>
Outra: <input type="text" name="outra_cidade" id="outra_cidade" value="" maxlength="35" size="35" onchange="document.getElementById('cidade').value = 0;" />
<br /> <br />
<font size="1"><em>ATENÇÃO! Este novo cliente cadastrado não será incluso na lista de efetivos, ele ficará cadastrado como um cliente potencial em negociação com o comercial.</em></font>
<br /> <br />
</div>
<!-- FIM DOS DADOS DO CLIENTE -->
Tipo de contato:
<select name="tipo" id="tipo">
<option value="">Selecione...</option>
<option value="Visita">Visita</option>
<option value="Contato telefônico">Contato telefônico</option>
<option value="E-mail">E-mail</option>
<option value="MSN/Skype/GTalk">MSN/Skype/GTalk</option>
<option value="Torpedo SMS">Torpedo SMS</option>
<option value="Outros">Outros (especifique nos detalhes)</option>
</select>
Pessoa de contato: <input type="text" name="pessoa" id="pessoa" value="" maxlength="15" size="15" />
<?php
if (($MyTipo == "agendar") && ($_SESSION["univel"] <= 2) && (!$casual))
{
?>
<br /> <br />
Agendar para o atendente:
<select name="usuario" id="usuario">
<?php
//Lista todos os andamentos acima mais os de abertura
$sqlx = "SELECT
u.id_usuario, u.username
FROM
usuarios AS u
INNER JOIN
deptos_x_preagendamento AS d
ON (d.departamento = u.id_departamento)
WHERE";
if ($_SESSION["univel"] == 2)
{
$sqlx .= " u.id_departamento = ".$_SESSION['departamento'];
}
else $sqlx .= " u.id_departamento > -1";
$sqlx .= " AND u.ativo = 1 AND d.eh_pre = 0 ORDER BY u.username ASC";
$rsx = mysql_query($sqlx);
while ($regx = mysql_fetch_array($rsx))
{
echo '<option value="'.$regx["id_usuario"].'"';
if ($_SESSION["usuario"] == $regx["id_usuario"]) echo ' selected';
echo '>'.utf8_encode($regx["username"]).'</option>';
}
?>
</select>
<?php
}
?>
<br /> <br />
Detalhes:<br />
<textarea cols="100" rows="7" id="historico" name="historico"></textarea>
<!-- BOTOES DE ACAO -->
<br /> <br />
<input type="button" name="btnSalvar" id="btnSalvar" value="Salvar" onclick="Salvar();" onfocus="if (document.getElementById('pesqcli').style.display == '') document.getElementById('edtPesqCli').focus();" style="font-weight:bold;" />
<input type="button" value="Cancelar" onclick="window.open('agendamentos.php', '_self');" />
<?php
//Fim de apenas ver
}
}
else echo '<input type="button" value="Voltar" onclick="window.open(\'agendamentos.php\', \'_self\');" />';
?>
<br /> <br />
</form>
</td>
</tr>
<!-- FIM DE CONTEUDO DA PAGINA -->
<?php
include("../sol/includes/rp.php");
?>
</table>
</body>
</html>
<?php
@mysql_close();
?>