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

<%
'if (request.form("nome") <> "") then filtro = " and cf_entrevistador.nome like '%"&request.form("nome")&"%' "

'sql_lista = "select  id_cf_entrevistador, cf_entrevistador.nome as nome, cf_status.nome as status, cidade, estado, email from cf_entrevistador, cf_status where cf_entrevistador.id_cf_status = cf_status.id_cf_status and cf_entrevistador.id_cf_status <> 3 and id_cf_tipo_usuario = 1 "&filtro&" and id_cf_entrevistador in (select id_cf_entrevistador from CF_PESQUISA_ENTREVISTADOR where CF_PESQUISA_ENTREVISTADOR.inativo <> 1 and CF_PESQUISA_ENTREVISTADOR.id_cf_entrevistador = cf_entrevistador.id_cf_entrevistador) order by nome asc"
'set rs = con.execute(sql_lista)

sql_lista = "Select cf_entrevistador.nome as nome, cf_entrevistador.nome as nome, cf_entrevistador.id_cf_entrevistador as id_cf_entrevistador, CF_PAGAMENTO.VALOR, cf_bancos.NOME_BANCO, CF_DADOS_BANCARIOS.BANCO_AGENCIA, CF_DADOS_BANCARIOS.BANCO_AGENCIA_DIG, CF_DADOS_BANCARIOS.BANCO_NUM_CONTA, CF_DADOS_BANCARIOS.TIPO_CONTA, CF_DADOS_BANCARIOS.NOME_TITULAR_CONTA, CF_DADOS_BANCARIOS.NOME_TITULAR_CONTA, CPF_TITULAR_CONTA from CF_DADOS_BANCARIOS, cf_entrevistador, cf_pesquisa, CF_PAGAMENTO, cf_bancos where cf_entrevistador.id_cf_entrevistador=CF_PAGAMENTO.id_cf_entrevistador and CF_PAGAMENTO.ID_COD_BANCO=cf_bancos.ID_COD_BANCO and CF_PAGAMENTO.ID_CF_PESQUISA=cf_pesquisa.ID_CF_PESQUISA and CF_DADOS_BANCARIOS.ID_COD_CONTA=CF_PAGAMENTO.ID_COD_CONTA and CF_PAGAMENTO.status='PROGRAMADO' order by CF_PAGAMENTO.PGTO_AGENDADO_PARA, cf_bancos.NOME_BANCO, CF_PAGAMENTO.VALOR ASC "

'sql_lista = "select  id_cf_entrevistador, cf_entrevistador.nome as nome, cf_status.nome as status, cidade, estado from cf_entrevistador, cf_status where cf_entrevistador.id_cf_status = cf_status.id_cf_status and cf_entrevistador.id_cf_status <> 3 and id_cf_tipo_usuario = 1" _
'		  & " "&filtro&"  and id_cf_entrevistador in (select id_cf_entrevistador from CF_PESQUISA_ENTREVISTADOR where CF_PESQUISA_ENTREVISTADOR.inativo <> 1 and CF_PESQUISA_ENTREVISTADOR.id_cf_entrevistador = cf_entrevistador.id_cf_entrevistador) order by nome asc"
'set rs = con.execute(sql_lista)



'response.write sql_lista
'response.end


Const adCmdText = &H0001 : Const adOpenStatic = 3 
Set Command = Server.CreateObject("ADODB.Command") 
Set RS =Server.CreateObject("ADODB.RecordSet") 
call db_open()
RS.Open sql_lista,Con,adopenstatic,adcmdtext 
if not (rs.eof) then
'resultados por pagina a escolher arbitrariamente 	'Dimensionamos as paginas e determinamos a pagina atual 
	num_registros = 15 :									RS.PageSize=num_registros : RS.AbsolutePage=Session("pagina") 
end If

'opcao="lista"


'End if


	
If Request.QueryString("pag")<>"" Then 
   Session("pagina")=Request.QueryString("pag") 
Else 
   Session("pagina")=1 
End If 

'response.write "listacidade  " & listacidade & "<br>"




'if (Request.Form() <> "") then
'	for each item in request.Form()
'		if (left(item,3) = "cmb") and (request.Form(item) <> "") then
'			id = split(item,"-")
'				if (id(1) <> "") then
'					str_sql = "update cf_entrevistador set id_cf_status = " & request.Form(item) & " where id_cf_entrevistador = " & id(1)
'					con.execute(str_sql)
'				end if	
'		end if	
'	next
'end if

' response.Write(str_sql)
' Lê as pesquisas do banco



%>
<html>
<head>
<title>IPESO</title>
<link href="css.css" rel="stylesheet" type="text/css">
<script src="form.js" type="text/javascript"></script>
<style type="text/css">
.div_iframe {position:absolute; left:200px; top:100px; width:480px; height:289px; z-index:1; padding: 3px; 

}

</style>
<script type="text/javascript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
function show_div() {if (div_iframe.style.display == 'none') {div_iframe.style.display = 'block'} else {div_iframe.style.display = 'none'}}
function go_page(ID_COD_CONTA){
	div_iframe.style.top = event.clientY; div_iframe.style.display = 'block'; main_frame.location.href = 'nova_conta.asp?linke=pgto&op=manutencao&ID_COD_CONTA='+ID_COD_CONTA;
	//location.href='nova_conta.asp?linke=pgto&op=manutencao&ID_COD_CONTA='+ID_COD_CONTA;
	
}
function go_pagevl(){
	div_iframe.style.top = event.clientY; div_iframe.style.display = 'block'; main_frame.location.href = 'agendanewpgtoprocentrevexi.asp?identre='+id_pessoa;
	//location.href='agendanewpgtoprocentrevexi.asp?identre='+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 type="text/css">

#popitmenu{
position: absolute;
background-color: white;
border:1px solid black;
font: normal 12px Verdana;
line-height: 18px;
z-index: 100;
visibility: hidden;
}

#popitmenu a{
text-decoration: none;
padding-left: 6px;
color: black;
display: block;
}

#popitmenu a:hover{ /*hover background color*/
background-color: #CCFF9D;
}

</style>

</head>
<body >
<form name="form" method="post" >
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td height="40" background="app_img/topo_background.jpg" bgcolor="#DFDFDF">
				
				</td>
            </tr>
			<tr>
			  <td height="15px"><!-- #include file="menu.asp" --></td>
			</tr>
            <tr>
              <td align="center" valign="top" style="padding-bottom: 30px; padding-top: 30px;">
			  <!-- Content here -->
			  <div class="div_topic" style="width: 750px">Listagem de entrevistadores			  </div>
                    <table width="750" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                      <tr>
                        <td align="left" bgcolor="f0f0f0">
						
						<table width="100%" border="0" cellspacing="0" cellpadding="0">

							<tr>
								<td width="3%" bgcolor="#B9D4E5" class="td_title">Cod.</td>
								<td width="54%" bgcolor="#B9D4E5" class="td_title">Nome</td>
								<td width="9%" bgcolor="#B9D4E5" class="td_title">Valor</td>
								<td width="9%" bgcolor="#B9D4E5" class="td_title">Banco</td>
								<td width="9%" bgcolor="#B9D4E5" class="td_title">Agência</td>
								<td width="9%" bgcolor="#B9D4E5" class="td_title">Dig</td>
								<td width="9%" bgcolor="#B9D4E5" class="td_title">Conta</td>
								<td width="9%" bgcolor="#B9D4E5" class="td_title">Tipo Conta</td>
								<td width="19%" bgcolor="#B9D4E5" class="td_title">Titular</td>
								<td width="9%" bgcolor="#B9D4E5" class="td_title">CPF</td>
							</tr>

							
							<% 
							cont =0
							While (Not RS.eof And registros_mostrados < num_registros) registros_mostrados = registros_mostrados +1
								cont = cont+1%>
								<tr style="cursor: default" onMouseOver="do_over(this)" onMouseOut="do_out(this)"	>
									
									<td class="td_content"><% db_write(rs("id_cf_entrevistador")) %></td>
									<td class="td_content"><% db_write rs("nome") %></td>
									<td class="td_content"><% db_write(FormatNumber(rs("VALOR"),2)) %></td>
									<td class="td_content"><% db_write rs("NOME_BANCO") %></td>
									<td class="td_content"><% db_write rs("BANCO_AGENCIA") %></td>
									<td class="td_content"><% db_write rs("BANCO_AGENCIA_DIG") %></td>
									<td class="td_content"><% db_write rs("BANCO_NUM_CONTA") %></td>
									<td class="td_content"><% If rs("TIPO_CONTA")="C" Then response.write "Corrente" Else response.write "Poupança"%></td>
									<td class="td_content"><% db_write rs("NOME_TITULAR_CONTA") %></td>
									<td class="td_content"><% db_write rs("CPF_TITULAR_CONTA") %></td>

								</tr>
							<%rs.moveNext 
							wend %>
							<tr>
								<td colspan="11" align="center" bgcolor="#B9D4E5" class="td_title_content">
								<div align="center">
								<% 
								i=0 
								While ( i < RS.PageCount )
								i=i+1 
								%> 
								<b>
								<a href="listapgtoprogramados.asp?pag=<%=i%>"><%=i%></a></b> 
								<% 
								Wend 
								%> 
								</div></td>
							</tr>
                        </table>
						
						</td>
                      </tr>
                    </table>
						<div align="left" class="texto" style="padding-left: 15%">
						Página atual: <b><%=Session("pagina")%></b> <br> 
						Total de páginas: <b><%=RS.PageCount%></b> <br> 
						Registros por página: <b><%=RS.PageSize%></b> <br> 
						Total de registros: <b><%=RS.RecordCount%></b> 
						</div> 

                    <br>
                    <iframe name="frmMain" width="750" scrolling="no" height="50" frameborder="0"></iframe>			  </td>
            </tr>
            <tr>
                <td height="26" background="app_img/bottom_background.jpg" bgcolor="#DFDFDF">&nbsp;              </td>
            </tr>
  </table>
</form>
</body>
</html>
