set cadastro = oConn.execute("SELECT * FROM TB_DADOS_CLIENTES WHERE nome_empresa LIKE '%" & Request.QueryString("nome_empresa") & "%' ORDER BY nome_empresa ASC")
else
set cadastro = oConn.execute("SELECT * FROM TB_DADOS_CLIENTES ORDER BY nome_empresa ASC")
end if
while not(cadastro.eof)
id_cliente = cadastro("id_cliente")
'CONECTA A TABELA COBRANÇAS
temp_sql = "SELECT * FROM TB_INFO_PAGTO_2 WHERE (id_cliente = " & cadastro("id_cliente") & ") AND (data_venc_pagto > '01/01/1990') AND "
set TABELA1 = oConn.execute ("SELECT * FROM TB_GERAR_F_M_C WHERE id_cliente =" & id_cliente & " order by no_os ASC")
pagto = 0
while not(TABELA1.eof)
if (v_status_pagto <> "") then
set TABELA2 = oConn.execute ("SELECT * FROM TB_INFO_PAGTO_2 WHERE (no_os =" & TABELA1("no_os") & ") and (id_cliente =" & id_cliente & ") AND (status_pagto = '" & v_status_pagto & "') order by no_os ASC")
else
set TABELA2 = oConn.execute ("SELECT * FROM TB_INFO_PAGTO_2 WHERE (no_os =" & TABELA1("no_os") & ") AND (id_cliente =" & id_cliente & ") order by no_os ASC")
set TABELA1 = oConn.execute ("SELECT * FROM TB_GERAR_F_M_C WHERE id_cliente =" & id_cliente & " order by no_os ASC")
pago = 0
while not(TABELA1.eof)
if (v_status_pagto <> "") then
set TABELA2 = oConn.execute ("SELECT * FROM TB_INFO_PAGTO_2 WHERE (no_os =" & TABELA1("no_os") & ") and (id_cliente =" & id_cliente & ") AND (status_pagto = '" & v_status_pagto & "') order by no_os ASC")
else
set TABELA2 = oConn.execute ("SELECT * FROM TB_INFO_PAGTO_2 WHERE (no_os =" & TABELA1("no_os") & ") AND (id_cliente =" & id_cliente & ") order by no_os ASC")
Pergunta
PRWEBMaster
Tudo bem pessoal?
Estou quebrando a cabeça para desenvolver um relatório com paginação.
Gostaria de ver a possíbilidade de verificarem se meu código está certo.
Segue abaixo:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' technocurve arc 3 asp vb mv block1/3 start
Dim moColor1, moColor2, moColor
moColor1 = "#BCF7B9"
moColor2 = "#CCCCCC"
moColor3 = "#CCCCCC"
moColor = moColor1
' technocurve arc 3 asp vb mv block1/3 start
Response.Buffer = FALSE
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma","no-cache"
Session.TimeOut = 1440
Server.ScriptTimeOut = 999.999
Session.LCID = 4106 'BRASIL
id_cliente = request.QueryString("id_cliente")
no_cob = request.QueryString("no_cob")
no_os = request.QueryString("no_os")
descricao = request.QueryString("descricao")
data_fechado = request.QueryString("data_fechado")
fechado_por = request.QueryString("fechado_por")
status_pagto = Request.QueryString("status_pagto")
forma_pagto = Request.QueryString("forma_pagto")
nome_empresa = Request.QueryString("nome_empresa")
set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open("DRIVER={Firebird/Interbase® driver}; DBNAME=localhost:c:\Inetpub\wwwroot\sistema_interno_hcs_v.1.0\bd\BD_HCS.GDB; UID=SYSDBA;PWD=masterkey")
%>
<!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=iso-8859-1" />
<title>Relatório Cobrança Linear-HCS</title>
<script type="text/javascript" src="validations.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.mask.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//Ativando as mascaras
$('input:text').setMask();
});
</script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000000;
}
.style18 {color: #000000}
.style53 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style14 {font-family: Calibri}
.style70 { font-size: 12px
}
.style73 {font-size: 11px; font-family: Arial, Helvetica, sans-serif; }
.style196 {
color: #FF0000;
font-family: Arial, Helvetica, sans-serif;
}
.style161 {color: #333333}
.style197 { color: #FFFFFF;
font-family: Arial, Helvetica, sans-serif;
}
.style198 {
color: #000000;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
}
.style79 {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
}
.style80 {font-family: Arial, Helvetica, sans-serif}
.bodyline { -moz-border-radius: 5px;
-webkit-border-radius: 5px;
font-size: 10px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
border: 1px solid #333333;
}
.style43 {font-family: Calibri;
font-size: 10px;
color: #000000;
font-weight: bold;
}
.bodyline1 { -moz-border-radius: 5px;
-webkit-border-radius: 5px;
font-size: 10px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
border: 1px solid #333333;
}
-->
</style>
<link href="../css/campo_branco.css" rel="stylesheet" type="text/css">
<link type="text/css" media="screen" rel="stylesheet" href="colorbox/example5/colorbox.css" />
<script type="text/javascript" src="colorbox/colorbox/jquery.colorbox.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//Examples of how to assign the ColorBox event to elements
$("a[rel=example1]").colorbox();
$("a[rel=example2]").colorbox({transition:"fade"});
$("a[rel=example3]").colorbox({transition:"none", width:"80%", height:"80%"});
$("a[rel=example4]").colorbox({slideshow:true});
$(".example5").colorbox();
$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
$(".example7").colorbox({width:"100%", height:"100%", iframe:true});
$(".example7a").colorbox({width:"50%", height:"70%", iframe:true});
$(".example7b").colorbox({width:"40%", height:"50%", iframe:true});
$(".example8").colorbox({width:"100%", inline:true, href:"#inline_example1"});
$(".example9").colorbox({
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
});
//Example of preserving a JavaScript event for inline calls.
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
return false;
});
});
</script>
<style type="text/css">
<!--
.bodyline2 { -moz-border-radius: 5px;
-webkit-border-radius: 5px;
font-size: 10px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
border: 1px solid #333333;
}
.bodyline3 { -moz-border-radius: 5px;
-webkit-border-radius: 5px;
font-size: 10px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
border: 1px solid #333333;
}
.bodyline4 { -moz-border-radius: 5px;
-webkit-border-radius: 5px;
font-size: 10px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
border: 1px solid #333333;
}
.style154 {font-size: 14px;
font-weight: bold;
}
.style171 {color: #000000;
font-size: 18px;
font-weight: bold;
}
.bodyline5 { -moz-border-radius: 5px;
-webkit-border-radius: 5px;
font-size: 10px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
border: 1px solid #333333;
}
.bodyline6 { -moz-border-radius: 5px;
-webkit-border-radius: 5px;
font-size: 10px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
border: 1px solid #333333;
}
.campo_maior {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
color: #000000;
background-color: #FFFFFF;
border: 1px solid #FFFFFF;
font-weight: bold;
}
.style200 {font-size: 11px}
.style202 {
font-weight: bold;
font-size: 11px;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.style203 {font-size: 10px}
.style204 {font-weight: bold; font-size: 10px; }
.bodyline7 { -moz-border-radius: 5px;
-webkit-border-radius: 5px;
font-size: 10px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
border: 1px solid #333333;
}
.style205 {font-weight: bold}
.style206 {font-size: 12}
.style207 {
font-size: 12;
color: #000000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<%
'CONECTA A TABELA DE CLIENTES CADASTRADOS
'* Filtro NOME EMPRESA *
if (nome_empresa <> "") then
set cadastro = oConn.execute("SELECT * FROM TB_DADOS_CLIENTES WHERE nome_empresa LIKE '%" & Request.QueryString("nome_empresa") & "%' ORDER BY nome_empresa ASC")
else
set cadastro = oConn.execute("SELECT * FROM TB_DADOS_CLIENTES ORDER BY nome_empresa ASC")
end if
while not(cadastro.eof)
id_cliente = cadastro("id_cliente")
'CONECTA A TABELA COBRANÇAS
temp_sql = "SELECT * FROM TB_INFO_PAGTO_2 WHERE (id_cliente = " & cadastro("id_cliente") & ") AND (data_venc_pagto > '01/01/1990') AND "
'* Filtro STATUS PAGTO *
if (status_pagto <> "") then
temp_sql = temp_sql & "(status_pagto = '" & status_pagto & "') AND "
end if
'* Filtro FORMA PAGTO *
if (forma_pagto <> "") then
temp_sql = temp_sql & "(forma_pagto = '" & forma_pagto & "') AND "
end if
'* Finalizando filtro *
temp_sql = Left(temp_sql,Len(temp_sql)-4) & "ORDER BY no_cob ASC"
set tcobranca = oConn.execute(temp_sql)
if not(tcobranca.eof) then
' MOSTRA NOME DO CLIENTE
'Definimos o Numero de Paginas com a propriedade "PageSize" do objeto Recordset
cadastro.PageSize = 2
'Criamos as Validações
if cadastro.eof then
Mensagem = "Nenhum Registro Encontrado"
Response.End
else
'Definimos em qual pagina o visitante está
if Request.QueryString("pagina")="" then
intpagina = 1
else
if cint(Request.QueryString("pagina"))<1 then
intpagina = 1
else
if cint(Request.QueryString("pagina"))>cadastro.PageCount then
intpagina = cadastro.PageCount
else
intpagina = Request.QueryString("pagina")
end if
end if
end if
end if
%>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="12" class="style206 style207"><%=cadastro("nome_empresa")%></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><div align="center" class="style73 style202 style203 style205">
<div align="center">N. º COB.</div>
</div></td>
<td bgcolor="#CCCCCC"><div align="center" class="style204"><span class="style80">DATA COBRANÇA</span></div></td>
<td bgcolor="#CCCCCC"><div align="center" class="style204"><span class="style80">TIPO PAGAMENTO</span></div></td>
<td bgcolor="#CCCCCC"><div align="center" class="style204"><span class="style80">NUMERAÇÃO</span></div></td>
<td bgcolor="#CCCCCC"><div align="center" class="style204"><span class="style80">VENCIMENTO</span></div></td>
<td bgcolor="#CCCCCC"><div align="center" class="style204"><span class="style80">A PAGAR</span></div></td>
<td bgcolor="#CCCCCC"><div align="center" class="style204"><span class="style80">DATA
PAGTO</span></div></td>
<td bgcolor="#CCCCCC"><div align="center" class="style204"><span class="style80">VALOR
PAGO</span></div></td>
<td bgcolor="#CCCCCC"><div align="center" class="style204"><span class="style80">SITUAÇÃO</span></div></td>
<td width="161" bgcolor="#CCCCCC"><div align="center" class="style204">DÉBITO</div></td>
<td bgcolor="#CCCCCC"><div align="center" class="style204">CRÉDITO</div></td>
<td bgcolor="#CCCCCC"><div align="center"><strong>SALDO</strong></div></td>
</tr>
<%
end if
while not(tcobranca.eof)
' EXIBE COBRANÇAS
%> <tr <%
' technocurve arc 3 asp vb mv block2/3 start
Response.Write(" style='background-color:" & moColor & "' onMouseOver='this.style.backgroundColor=" & chr(34) & moColor3 & chr(34) & "' onMouseOut='this.style.backgroundColor=" & chr(34) & moColor & chr(34) & "'")
' technocurve arc 3 asp vb mv block2/3 start
%>>
<td width="65"><div align="center"><a class="example7" href="gerar_cobranca.asp?id_cliente=<%=tcobranca("id_cliente")%>&no_cob=<%=tcobranca("no_cob")%>&no_os=<%=tcobranca("no_os")%>"><span class="style70 style18 style14"><strong><span class="style73 style206"><%=tcobranca("no_cob")%></span></strong></span></a></div></td>
<td width="125"><div align="center"><span class="style190 style190"><span class="style18">
<%
set TABELA2 = oConn.execute ("SELECT * FROM TB_GERAR_COB_CAD WHERE no_os = '"&tcobranca("no_os")&"' ")
while not(TABELA2.eof)
data_cobranca = TABELA2("data_cobranca")
TABELA2.MoveNext()
wend
%>
</span></span><span class="style154">
</span></div></td>
<td width="125"><div align="center" class="style161 style14 style70 style197"><span class="style18 style190 style79 style80 style203">
<%
Select Case tcobranca("forma_pagto")
Case "0"
Response.write("A DEFINIR")
Case "1"
Response.write("BOLETO")
Case "2"
Response.write("BOLETO + NF")
Case "3"
Response.write("CARTÃO BNDES")
Case "4"
Response.write("CHEQUE À VISTA")
Case "11"
Response.write("CHEQUE PRÉ")
Case "5"
Response.write("COBRANÇA MENSAL")
Case "6"
Response.write("DEPÓSITO")
Case "7"
Response.write("DINHEIRO")
Case "10"
Response.write("DOC")
Case "12"
Response.write("LEASING")
Case "8"
Response.write("OUTROS")
Case "9"
Response.write("TRANSFERÊNCIA")
End Select
%>
</span></div></td>
<td width="125"><div align="center"><span class="style160 style161 style190 style190 style80"><%=tcobranca("numeracao")%> </span></div></td>
<td width="125"><div align="center"><span class="style196 style53 style160 style190 style190">
<%
if tcobranca("data_venc_pagto") = (Cdate("01/01/1990")) then
response.write ("")
else
response.write(tcobranca("data_venc_pagto"))
end if
%>
</span></div></td>
<td width="125"><div align="center"><span class="style198">
<input name="valor_pagto_<%=i%>" type="text" class="campo_branco" id="v_total_<%=i%>" value="<%=ROUND(tcobranca("valor_pagto"),2)%>" size="10" alt="decimal"/>
</span></div></td>
<td width="125"><div align="center"><span class="style160 style161 style190 style200"><%=tcobranca("data_pago")%></span></div></td>
<td width="125"><div align="center"><span class="style198">
<input name="valor_pago_<%=i%>" type="text" class="campo_branco" id="valor_pago_<%=i%>" value="<%=ROUND(tcobranca("valor_pago"),2)%>" size="10" alt="decimal"/>
</span></div></td>
<td width="125"><div align="center"><span class="style160 style161 style190 style190 style80">
<%
Select Case tcobranca("status_pagto")
Case "1"
Response.write("A VENCER")
Case "2"
Response.write("CHEQUES PENDENTES")
Case "3"
Response.write("PROTESTADO")
Case "4"
Response.write("PAGO")
Case "5"
Response.write("VENCIDO")
Case "6"
Response.write("SEM CUSTO")
End Select
%>
</span></div></td>
<td><div align="center"><span class="style154">
<%
soma2 = 0
set TABELA2 = oConn.execute ("SELECT * FROM TB_DEBITO WHERE no_cob = '"&tcobranca("no_cob")&"' ")
while not(TABELA2.eof)
soma2 = soma2 + Cdbl(TABELA2("valor_debito"))
TABELA2.MoveNext()
wend
%>
<span class="style171">
<input name="valor_debito" type="text" class="campo_branco" disabled="disabled" id="valor_debito" value="<%=ROUND(soma2,2)%>" size="10" alt="decimal"/>
</span></span></div></td>
<td><div align="center"><span class="style154">
<%
soma3 = 0
set TABELA2 = oConn.execute ("SELECT * FROM TB_CREDITO WHERE no_cob = '"&tcobranca("no_cob")&"' ")
while not(TABELA2.eof)
soma3 = soma3 + Cdbl(TABELA2("valor_credito"))
TABELA2.MoveNext()
wend
%>
</span><span class="style171">
<input name="valor_credito" type="text" class="campo_branco" disabled="disabled" id="valor_credito" value="<%=ROUND(soma3,2)%>" size="10" alt="decimal"/>
</span></div></td>
<td><div align="center"><span class="style154">
<%
pago = 0
set TABELA2 = oConn.execute ("SELECT * FROM TB_INFO_PAGTO_2 WHERE no_cob = '"&tcobranca("no_cob")&"' ")
while not(TABELA2.eof)
pago = pago + Cdbl(TABELA2("valor_pago"))
TABELA2.MoveNext()
wend
var_novo_total = soma1 + soma2 - soma3
var_novo_total = ROUND(var_novo_total,2)
%>
</span><span class="style171">
<input name="v_total_cred_deb" type="text" class="campo_branco" id="v_total_cred_deb" value="<%=var_novo_total%>" size="10" alt="signed-decimal" />
</span></div></td>
</tr>
<%
' technocurve arc 3 asp vb mv block3/3 start
if moColor = moColor1 then
moColor = moColor2
else
moColor = moColor1
end if
' technocurve arc 3 asp vb mv block3/3 start
%>
<tr>
<%
tcobranca.movenext
Wend
cadastro.MoveNext()
intrec = intrec + 1
if cadastro.eof then
response.write " "
end if
wend
%>
<td colspan="5"><div align="right" class="style79">TOTAL À PAGAR:</div></td>
<td><div align="center"><span class="style168 style14 style70">
<%
set TABELA1 = oConn.execute ("SELECT * FROM TB_GERAR_F_M_C WHERE id_cliente =" & id_cliente & " order by no_os ASC")
pagto = 0
while not(TABELA1.eof)
if (v_status_pagto <> "") then
set TABELA2 = oConn.execute ("SELECT * FROM TB_INFO_PAGTO_2 WHERE (no_os =" & TABELA1("no_os") & ") and (id_cliente =" & id_cliente & ") AND (status_pagto = '" & v_status_pagto & "') order by no_os ASC")
else
set TABELA2 = oConn.execute ("SELECT * FROM TB_INFO_PAGTO_2 WHERE (no_os =" & TABELA1("no_os") & ") AND (id_cliente =" & id_cliente & ") order by no_os ASC")
end if
while not(TABELA2.eof)
pagto = pagto + Cdbl(TABELA2("valor_pagto"))
TABELA2.MoveNext()
wend
TABELA1.MoveNext()
wend
%>
</span><span class="style43">
<input name="valor_pagto_<%=i%>" type="text" class="campo_branco" id="valor_pagto_<%=i%>" value="<%=ROUND(pagto,2)%>" size="10" alt="decimal"/>
</span></div></td>
<td><div align="right" class="style79">TOTAL PAGO:</div></td>
<td><div align="center"><span class="style168 style14 style70">
<%
set TABELA1 = oConn.execute ("SELECT * FROM TB_GERAR_F_M_C WHERE id_cliente =" & id_cliente & " order by no_os ASC")
pago = 0
while not(TABELA1.eof)
if (v_status_pagto <> "") then
set TABELA2 = oConn.execute ("SELECT * FROM TB_INFO_PAGTO_2 WHERE (no_os =" & TABELA1("no_os") & ") and (id_cliente =" & id_cliente & ") AND (status_pagto = '" & v_status_pagto & "') order by no_os ASC")
else
set TABELA2 = oConn.execute ("SELECT * FROM TB_INFO_PAGTO_2 WHERE (no_os =" & TABELA1("no_os") & ") AND (id_cliente =" & id_cliente & ") order by no_os ASC")
end if
while not(TABELA2.eof)
pago = pago + Cdbl(TABELA2("valor_pago"))
TABELA2.MoveNext()
wend
TABELA1.MoveNext()
wend
%>
</span><span class="style43">
<input name="valor_pago_<%=i%>" type="text" class="campo_branco" id="valor_pago_<%=i%>" value="<%=ROUND(pago,2)%>" size="10" alt="decimal"/>
</span></div></td>
<td> </td>
<td valign="middle"> </td>
<td width="173"><div align="left" class="style190">
<div align="right"><span class="style35"><strong> TOTAL COBRANÇAS: </strong></span></div>
</div></td>
<td width="173"><div align="center"><span class="style154">
<%
soma1 = 0
set TABELA2 = oConn.execute ("SELECT * FROM TB_GERAR_F_M_C WHERE id_cliente =" & id_cliente & " ")
while not(TABELA2.eof)
soma1 = soma1 + Cdbl(TABELA2("total_geral"))
TABELA2.MoveNext()
wend
%>
</span><span class="style171">
<input name="total_geral" type="text" class="campo_branco" disabled="disabled" id="total_geral" value="<%=ROUND(soma1,2)%>" size="10" alt="decimal"/>
</span></div></td>
</tr>
</table>
<div></div>
<div align="center">
<%
'Criamos as Validações para a navegação "Anterior" e "Próximo"
if intpagina > 1 then
%>
<a href="relatorio_cobranca.asp?pagina=<%=intpagina+1%>">Anterior</a>
<%
end if
if StrComp(intpagina,cadastro.PageCount)<>0 then
%>
<a href="relatorio_cobranca.asp?pagina=<%=intpagina + 1%>">Próximo</a>
</div>
<span class="style70"></span>
</body>
</html>
<%
end if
tcobranca.close
Set tcobranca = Nothing
%>
Muito obrigado
Link para o comentário
Compartilhar em outros sites
5 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.