Forums
This topic is locked
Incompatibility in retrieving data
Posted 01 Jun 2003 01:16:05
1
has voted
01 Jun 2003 01:16:05 Dalton Gilson posted:
Hi GurusSomething quite strange is happening with one of my scripts -- I'm building a site with ASP pages managing a SQL Server 2000 database, from dealing with "Contracts" of all kinds (in Portuguese).
- The goal of this actual set of pages is to allow Users to calculate the evolution of the price of (for instance) a periodic payment of a Contract in accordance with the escalation of economic costs -- please be acknowledged that in Brasil the recalculation of prices in Contracts only can be made after a period of at least 12 months (that's to say: everyone recalculates its costs each 12 months...).
- In a first page ("calcatualizacao", the User will pick, from the database table "indecontb" (that stands for "INDices ECONomicos TaBle, a page that shows the monthly evolution of 04 different types of economic indexes), the index (as his Contract settles) that must be considered for calculating the price he wants to recalculate -- its code is here:
<pre id=code><font face=courier size=2 id=code><%@enablesessionstate=false%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Contratos on Line : Atualize o valor do seu Contrato conforme o Índice econômico</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="../../../inc/estiloCoL.css" type=text/css rel=stylesheet></HEAD>
<BODY>.....
<FORM name="calcatualizacao" method="POST" action="../../../biblioteca/indseconomicos/calcatualizacao2.asp">
Qual o índice utilizado pelo seu Contrato — ou que Você queira atualizar?<br>
<input type="radio" name="indatualiz" value="igpm"> "IGP-<i>M</i>" - Índice Geral de Preços do <i>Mercado financeiro</i><BR>
<input type="radio" name="indatualiz" value="igpdi"> "IGP-<i>DI</i>" - Índice Geral de Preços - <i>Disponibilidade Interna</i><BR>
<input type="radio" name="indatualiz" value="ipca"> "IPCA" - Índice de Preços ao Consumidor - <i>Ampliado</i><BR>
<input type="radio" name="indatualiz" value="poup01"> Índice de Rendimentos da <i>Caderneta de Poupança</i> do dia 1º do mês</DIV>
.....(there comes the "reset" and the "submit" buttons</FORM></BODY></HTML></font id=code></pre id=code>;
- In the second page ("calcatualizacao2", a "form" is opened for the User:
(1st) inform the actual value of the Contract he wants to recalculate -- this information will be collected directly through an "input"; and, after,
(2st) indicate the month-and-year he wants to bring that value to -- choosing the respective row directly from a list of the data of that "indecontb" table (each row informs the month/year and the amount of the choosen index, its last number and, more, the cumulative escalation of the "last 12 months"
- both part run inside the same form, but there is no "Submit" button in this page, because the link to the next page comes automatically when clicking one of these rows in the database table -- its code is also here:
<pre id=code><font face=courier size=2 id=code><%@ LANGUAGE = "VBScript"
ENABLESESSIONSTATE = False %>
<%
Option Explicit
On Error Resume Next
Response.Expires = 0
%>
<!-- #include virtual="../../../inc/inc-conexao.asp" -->
<!-- #include virtual="../../../inc/clsDatefunctions.asp" -->
<%
Dim objConn, objRS, strQ, x, varcodigoind
Dim strConnection
dim date_functions
Call abre_objConn
Set date_functions = new classDateFunctions
Set objRS = Server.CreateObject("ADODB.Recordset"
x = request.form("indatualiz"
varcodigoind = request.querystring("tit"
Set objRS.ActiveConnection = objConn
strQ = "SELECT TOP 24 indecontb.codigoind, indecontb.mesind, indecontb.anoind, indecontb.numeroind, indecontb.varmesind, indecontb.vardozemesind FROM indecontb WHERE tipoind LIKE '%" & x & "%' ORDER BY anoind DESC, mesind DESC"
objRS.Open strQ
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Contratos on Line : Atualize o valor do seu Contrato conforme o Índice econômico</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="../../../inc/estiloCoL.css" type=text/css rel=stylesheet>
<!-- #include virtual = "../inc/scrollbarbranco.css" --></head>
<BODY background="../../../imagens/back1.gif" onload="document.calcatualizacao2.valatualiz.focus()">.....
<FORM name="calcatualizacao2" method="POST" action="../../../biblioteca/indseconomicos/calcatualizacao3.asp">
<DIV style="position:absolute; align:center; top:120px; width:526px; font-family:verdana,arial; color:#000066; size:8pt;"><B> Valor do Contrato ou parcela que Você queira atualizar: R$ </B><INPUT name="valatualiz" size=11 maxLength=15></DIV><BR>
<ilayer width=526 height=178><DIV style="position:absolute; align:left; left:10px; top:150px; width:526px; font-family:verdana,arial; color:#000066; size:8pt;"><B> Clique sobre o mês/ano para o qual Você quer trazer o valor contratual:</B>
<layer width=526 height=2000>
<div style="left:5px; top:140; width:526px; height:150px; overflow:scroll;">
<TABLE class="letras" style="BEHAVIOR: url(../../../inc/sort.htc); BACKGROUND-COLOR: #E6E8FA" borderColor=#FFFFFF cellSpacing=0 cellPadding=2 border=1>
<THEAD><TR align=left>
<TD align="center" background="../../../imagens/blankEFEBEF.gif" width="70" style="font-family:verdana,tahoma,arial; font-size:7.5pt; color:#880000;"><B>Mês/Ano</B></FONT></TD>
<%
if x = "igpm" then
x = "IGP-M"
elseif x = "igpdi" then
x = "IGP-DI"
elseif x = "ipca" then
x = "IPCA"
elseif x = "poup01" then
x = "Poupança : dia 1º"
end if
%>
<TD align="left" background="../../../imagens/blankEFEBEF.gif" width="165" style="font-family:verdana,tahoma,arial; font-size:7.5pt; color:#880000;"><B> <% = x %> do mês</B></FONT></TD>
<TD align="left" background="../../../imagens/blankEFEBEF.gif" width="150" style="font-family:verdana,tahoma,arial; font-size:7.5pt; color:#880000;"><B> % <i>X</i> último mês</B></FONT></TD>
<TD align="left" background="../../../imagens/blankD8D9B0.gif" width="150" style="font-family:verdana,tahoma,arial; font-size:7.5pt; color:#880000;"><B> % <i>X</i> últimos 12 meses</B></FONT></TD></TR></THEAD>
<TBODY>
<%
While Not objRS.EOF
Response.Write "<TR><TD align='center' valign='top' width='70'><FONT color=#000066 size=1><a href='../../../biblioteca/indseconomicos/calcatualizacao3.asp?tit=" & objRs("codigoind" & "'>" & objRS("mesind" & "/" & objRS("anoind" & "</a></FONT></TD>"
Response.Write "<TD align='right' valign='top' width='165'><FONT color=#000066 size=1><a href='../../../biblioteca/indseconomicos/calcatualizacao3.asp?tit=" & objRs("codigoind" & "'>" & FormatNumber(objRS("numeroind", 4, -1) & "</a> </FONT></TD>"
Response.Write "<TD align='right' valign='top' width='150'><FONT color=#000066 size=1><a href='../../../biblioteca/indseconomicos/calcatualizacao3.asp?tit=" & objRs("codigoind" & "'>" & FormatNumber(objRS("varmesind", 4, -1) & " %</a> </FONT></TD>"
Response.Write "<TD align='right' valign='top' background='../../../imagens/blankFFF7E7.gif' width='150'><FONT color=#880000 size=1><a href='../../../biblioteca/indseconomicos/calcatualizacao3.asp?tit=" & objRs("codigoind" & "'>" & FormatNumber(objRS("vardozemesind", 4, -1) & " %</a> </FONT></TD>"
objRS.MoveNext
Wend
objRS.close
Call fecha_objConn
Set objRS = Nothing
%>
</TR></TBODY></TABLE></DIV></layer></DIV></ilayer></FORM>..... (and, finally, just the "back" button)</font id=code></pre id=code>
- ...but the problem appears when We reach the "page3" ("calcatualizacao3" intended to show this data (and where the program will make a simple calculation of the actual value X the desired escalation index, and show the new value):
- almost all data are shown - unless the "actual contractual value" (that one that is picked directly from an "input" at "calcatualizacao2" page)
- I cannot reach why! I even tried transfering that "input" command to page3, but it become worse: those other data ...disapeared!!! Please take a look at the code:
<pre id=code><font face=courier size=2 id=code><%@ LANGUAGE = "VBScript"
ENABLESESSIONSTATE = False %>
<%
Option Explicit
On Error Resume Next
Response.Expires = 0
%>
<!-- #include virtual="../../../inc/inc-conexao.asp" -->
<!-- #include virtual="../../../inc/clsDatefunctions.asp" -->
<%
Dim objConn, objRS, strQ, y, i, m, a, n, k, varcodigoind
Dim strConnection
dim date_functions
Call abre_objConn
Set date_functions = new classDateFunctions
Set objRS = Server.CreateObject("ADODB.Recordset"
y = Request.form("valatualiz"
varcodigoind = request.querystring("tit"
Set objRS.ActiveConnection = objConn
strQ = "SELECT TOP 24 indecontb.codigoind, indecontb.mesind, indecontb.anoind, indecontb.numeroind, indecontb.varmesind, indecontb.vardozemesind, indecontb.tipoind FROM indecontb WHERE codigoind LIKE '%" & varcodigoind & "%'"
objRS.Open strQ
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Contratos on Line : Atualize o valor do seu Contrato conforme o Índice econômico</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="../../../inc/estiloCoL.css" type=text/css rel=stylesheet>
<!-- #include virtual = "../inc/scrollbarbranco.css" --></head>
<BODY background="../../../imagens/back1.gif" onload="document.calcatualizacao2.valatualiz.focus()">.....
<FORM><DIV style="position:absolute; width:526px; top:57px;">
<%
i = objRS("tipoind"
m = objRS("mesind"
a = objRS("anoind"
n = objRS("numeroind"
k = FormatNumber(objRS("vardozemesind", 4, -1)
%>
Nome do índice: <% = i %><BR>
Mês/ano a que se refere: <% = m %>/<% = a %><BR>
Índice respectivo: <% = n %><BR>
Variação nos últimos 12 meses: <% = k %><BR><BR>
Valor contratual atual-k: R$ <% = y %><BR>
Valor contratual atual-valatualiz: R$ <% = valatualiz %><BR>
</FORM></font id=code></pre id=code>
May You-Gurus be kind in helping me to find this mysterious patch? Thanks, many thanks since now!
Sincelery Dalton
Replies
Replied 02 Jun 2003 00:35:20
02 Jun 2003 00:35:20 Dalton Gilson replied:
By the way: in order to make easier to read them, here You have those 03 scripts, in .txt:
- www.contratosonline.com.br/biblioteca/indseconomicos/calcatualizacao1.txt
- www.contratosonline.com.br/biblioteca/indseconomicos/calcatualizacao2.txt
- www.contratosonline.com.br/biblioteca/indseconomicos/calcatualizacao3.txt
Thanks
Dalton
- www.contratosonline.com.br/biblioteca/indseconomicos/calcatualizacao1.txt
- www.contratosonline.com.br/biblioteca/indseconomicos/calcatualizacao2.txt
- www.contratosonline.com.br/biblioteca/indseconomicos/calcatualizacao3.txt
Thanks
Dalton