<!-- #include file="config.asp" -->
<!-- #include file="app_inc/db.asp" -->
<!-- #include file="app_inc/form.asp" -->

<%
if (Request.Form() <> "") then

end if

' Lê as pesquisas do banco
call db_open()
sql_lista = "select * from cf_pesquisa where id_cf_pesquisa = "&Request("id_pesquisa")&""
set rs = con.execute(sql_lista)

%>
<html>
<head>
<title>IPESO</title>
<link href="css.css" rel="stylesheet" type="text/css">
<script src="form.js" type="text/javascript"></script>
<script>

function show_div() {if (div_iframe.style.display == 'none') {div_iframe.style.display = 'block'} else {div_iframe.style.display = 'none'}}
function go_page(id_pessoa){div_iframe.style.display = 'block'; main_frame.location.href = 'Pesquisa_Detalhe_Min.asp?id_pessoa='+id_pessoa;}


function do_over(obj)
{
obj.style.background = 'white';
}
function do_out(obj)
{
obj.style.background = '#f3f3f3';
}
function do_click(obj)
{
//obj.style.background = 'gray';
}
	
</script>
<style>
	.div_iframe {position:absolute; left:200px; top:100px; width:480px; height:289px; z-index:1; padding: 3px;}
</style>
</head>
<body scroll=yes>
<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <% while not rs.eof %>
  <tr>
    <td width="31%" bgcolor="f3f3f3" class="td_content"><b>T&iacute;tulo da pesquisa </b></td>
    <td width="69%" bgcolor="#FFFFFF" class="td_content">
      <b>
      <% db_write(rs("titulo")) %>    
      </b></td>
  </tr>
  <tr>
    <td bgcolor="f3f3f3" class="td_content"><b>Cidade</b></td>
    <td bgcolor="#FFFFFF" class="td_content"><b>
      <% db_write rs("cidade") %>
    </b></td>
  </tr>
  <tr>
    <td bgcolor="f3f3f3" class="td_content"><b>Estado</b></td>
    <td bgcolor="#FFFFFF" class="td_content"><b>
      <% db_write rs("estado") %>
    </b></td>
  </tr>
  <tr>
    <td bgcolor="f3f3f3" class="td_content"><b>In&iacute;cio</b></td>
    <td bgcolor="#FFFFFF" class="td_content"><b>
      <% db_write rs("data_inicio") %>
    </b></td>
  </tr>
  <tr>
    <td bgcolor="f3f3f3" class="td_content"><b>T&eacute;rmino</b></td>
    <td bgcolor="#FFFFFF" class="td_content"><b>
      <% db_write rs("data_encerramento") %>
    </b></td>
  </tr>
  <tr>
    <td colspan="2" valign="top" class="td_content" style="padding: 10px">


		<div class="td_title">Entrevistadores cadastrados nesta pesquisa</div>
		<div class="td">
		
			<% set rs_ent = con.execute("select cf_entrevistador.id_cf_entrevistador, id_CF_PESQUISA_ENTREVISTADOR, cf_entrevistador.nome from CF_PESQUISA_ENTREVISTADOR, cf_entrevistador where CF_PESQUISA_ENTREVISTADOR.id_cf_entrevistador = cf_entrevistador.id_cf_entrevistador  and ID_CF_PESQUISA = "&request("id_pesquisa")&" and (inativo = 0 or inativo is null) order by nome") %>
			<table>
			<% while not rs_ent.eof %>
			<tr>
				<td class="td"><% = rs_ent("nome") %></td>
				<td class="td"><a class="a_geral" href="Entrevistador_Cota_Alteracao.asp?id_pessoa=<% = rs_ent("id_cf_entrevistador") %>&id_pesquisa=<% = request("id_pesquisa") %>&nome=<% = rs_ent("nome")%>">Quantificar Cota</a></td>
				<td> <a href="Pesquisa_Entrevistador_Exclui.asp?id_pesquisa_entrevistador=<% = rs_ent(0) %>&id_pesquisa=<% = request("id_pesquisa") %>" title="clique para excluir" onClick="return confirm('Deseja realmente excluir o entrevistador da pesquisa?')"><img src="app_img/delete.gif" border="0"></a></td>
			</tr>
			<% rs_ent.movenext : wend %>
			</table>
		</div><br>
		<input type="button" value="Cadastrar mais um entrevistador" class="btn" onClick="window.location.href = 'Pesquisa_Entrevistador.asp?id_pesquisa=<% = request("id_pesquisa") %>'"></td>
  </tr>
  <tr>
    <td colspan="2" valign="top" class="td_content" style="padding: 10px">
	
		<div class="td_title">Cotas cadastradas nesta pesquisa</div>
		<div class="td">
		
			<% set rs_ent = con.execute("select * from vw_cf_pesquisa_cota where id_cf_PESQUISA = "&request("id_pesquisa")&" and inativo <> 1 order by estrato") %>
			<table border="0" cellpadding="0" cellspacing="1" bgcolor="f3f3f3">
			
			<tr>
			  <td class="td_title">Regi&atilde;o</td>
			  <td class="td_title">Estado</td>
			  <td class="td_title">Cidade</td>
			  <td class="td_title">Estrato</td>
			  <td class="td_title">Quantidade</td>
			  <td class="td_title">Pre&ccedil;o quest. </td>
			  <td class="td_title">Pre&ccedil;o dig. </td>
			  <td>&nbsp;</td>
			  </tr>
			  <% while not rs_ent.eof %>
			<tr>
				<td bgcolor="#FFFFFF" class="td"><% = rs_ent("regiao") %></td>
				<td bgcolor="#FFFFFF" class="td"><% = rs_ent("estado") %></td>
				<td bgcolor="#FFFFFF" class="td"><% = rs_ent("cidade") %></td>
				<td bgcolor="#FFFFFF" class="td"><% = rs_ent("estrato") %></td>
				<td bgcolor="#FFFFFF" class="td"><% = rs_ent("quantidade") %></td>
				<td bgcolor="#FFFFFF" class="td">R$ <% = rs_ent("preco_questionario") %></td>
				<td bgcolor="#FFFFFF" class="td">R$ <% = rs_ent("preco_digitacao") %></td>
				<td bgcolor="#FFFFFF"> 
				<a href="Entrevistador_Cota_Exclusao.asp?id_cota=<% = rs_ent("id_cf_Pesquisa_cota") %>&tipo=pesquisa" title="clique para excluir" onClick="return confirm('Deseja realmente excluir essa cota do entrevistador?')"><img src="app_img/delete.gif" border="0"></a>
				</td>
			</tr>
			<% rs_ent.movenext : wend %>
			</table>
		</div>		
		
	      <p><span class="td" style="padding: 10px">
	        <input name="button" type="button" class="btn" onClick="window.location.href = 'Pesquisa_Cota_Cadastro.asp?id_pesquisa=<% = request("id_pesquisa") %>'" value="Cadastrar mais cotas">
          </span> </p>	</td>
  </tr>

  <% rs.moveNext : wend %>
</table>
</body>
</html>