<!-- #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_PAGAMENTO.registro_deposito, CF_PAGAMENTO.VALOR, CF_PAGAMENTO.PGTO_AGENDADO_PARA, CF_PAGAMENTO.data_realizou_deposito, CF_PAGAMENTO.ID_COD_PAGTO, cf_entrevistador.nome as nome, cf_entrevistador.nome as nome, cf_entrevistador.id_cf_entrevistador as id_cf_entrevistador, 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='REALIZADO' 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 = 1 :	RS.PageSize=num_registros : RS.AbsolutePage=Session("pagina") 
	num_registros = 12
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:780px; 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_pgto){
	div_iframe.style.top = event.clientY; div_iframe.style.display = 'block'; main_frame.location.href = 'geraregistropgto.asp?ID_COD_pgto='+ID_COD_pgto;
	//location.href='geraregistropgto.asp?ID_COD_pgto='+ID_COD_pgto;
	
}
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" >
<div id="div_iframe" class="div_iframe" style="display: none">
<table id="tb_iframe" width="100%" border="1" bgcolor="#F3F3F3" style="border-collapse: collapse; border-color: #f0f0f0; display: block">
	<tr> 
		<td height="20" background="app_img/faixa_top.jpg">
			<table width="100%" cellpadding="1" cellspacing="0">
				<tr><td><b><font size="1" face="verdana">Detalhes</font></b></td><td align="right">
					<input  onClick="show_div()" type="button" name="Submit2" value="" align="top" style=" font-family: comic sans; font-size: 8px; width: 18px; font-weight: bold; height: 17px; padding: 0px 0px 0px 0px; background: url(app_img/bg_close.gif); background-repeat: no-repeat">
				</td>
				</tr>
		  </table>
		</td>
    </tr>
	<tr>
		<td height="300">
		<iframe src="" name="main_frame" id="main_frame" width="100%" frameborder="0" height="100%" marginheight="0" marginwidth="0"></iframe>		</td>
	</tr>
	<tr>
	  <td>&nbsp;</td>
    </tr>
</table>
</div>
<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: 990px">Pagamentos Realizados			  </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. Registro</td>
								<td width="3%" bgcolor="#B9D4E5" class="td_title">Valor</td>
								<td width="3%" bgcolor="#B9D4E5" class="td_title">Dta Agendada</td>
								<td width="3%" bgcolor="#B9D4E5" class="td_title">Dta Depósito</td>
								<td width="9%" bgcolor="#B9D4E5" class="td_title">Pzo Agendament e deposito</td>
								<td width="9%" bgcolor="#B9D4E5" class="td_title">Cod. Entrev.</td>
								<td width="54%" bgcolor="#B9D4E5" class="td_title">Nome</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>
								<td width="9%" bgcolor="#B9D4E5" class="td_title"></td>
							</tr>

							
							<% 
							cont =0
							totalvalor=0
							While (Not RS.eof And registros_mostrados < num_registros) registros_mostrados = registros_mostrados +1
								cont = cont+1
								totalvalor = totalvalor + rs("VALOR")
								
								dia_total= DateDiff("d",rs("PGTO_AGENDADO_PARA"),rs("data_realizou_deposito")) %>
								<tr style="cursor: default" onMouseOver="do_over(this)" onMouseOut="do_out(this)"	>
									<td class="td_content"><% db_write(rs("registro_deposito")) %></td>
									<td class="td_content"><% db_write(FormatNumber(rs("VALOR"),2)) %></td>
									<td class="td_content"><% db_write(rs("PGTO_AGENDADO_PARA")) %></td>
									<td class="td_content"><% db_write(rs("data_realizou_deposito")) %></td>
									<td class="td_content"><% db_write(dia_total) %> Dias</td>
									<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 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>
									<td class="td_content">
									<!-- <input name="infor" type="button" onClick="go_page(<%'=rs("ID_COD_PAGTO")%>); do_click(this); " class="Botao" value="Registrar Pgto"> --></td>

								</tr>
							<%rs.moveNext 
							wend %>
							<tr style="cursor: default" onMouseOver="do_over(this)" onMouseOut="do_out(this)"	>
									<td class="td_content"><b>Valor</b></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content"></td>
									<td class="td_content">R$&nbsp;<b><%=FormatNumber(totalvalor,2)%></b></td>
									
									<!-- <input name="infor" type="button" onClick="go_page(<%'=rs("ID_COD_PAGTO")%>); do_click(this); " class="Botao" value="Registrar Pgto"> --></td>

							</tr>

							<tr>
								<td colspan="21" 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>
