Ver Mensaje Individual
  #15 (permalink)  
Antiguo 13/11/2007, 20:42
darkmcloud
 
Fecha de Ingreso: octubre-2007
Mensajes: 191
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Problema Con Formato De Tabla

Primero que nada....agradezco la paciencia y la atencion de todos los que me han respondido....y bueno.....a decir verdad ya encontre la solucion pero a medias.......este es el codigo nuevo:

Cita:
<HTML>
<HEAD>
<%xx=request.form("direccion")
if xx = "Registros Previos" then
session("pagina")=session("pagina")-1

if session("pagina")< 1 then

session("pagina")=1 'evitamos el error por reload
end if

else
if xx="Registros Siguientes" then
session("pagina")=session("pagina")+1
else
session("pagina")=1 'primera pasada
end if
end if%>

</HEAD>
<body bgcolor="#FFCC66" background="2.jpg" text="BLACK" link="BLACK" vlink="BLACK" alink="BLACK">
<p align="center">
<%
if Session("id_usuario") = "" then
Response.Write "<SCRIPT LANGUAGE='JAVASCRIPT'>"
Response.Write "top.opener.close()"
Response.Write "</SCRIPT>"
Response.Redirect("Login.Asp")
end if

dim dbConn

'aca recibo los campos que voy a realizar la busqueda
fecha_1 = Request.Form("fecha_1")
if IsDate(dfecha_1) then
dFecha_1=CDate(dFecha_1)
else
dFecha=""
end if

fecha_2 = Request.form("fecha_2")
csr = Request.form("csr")
distribuidor = Request.form("distribuidor")
estado = Request.form("estado")
tecnico = Request.form("tecnico")
On Error Resume next

'declaro las variables a utilizar incluyendo la se_encuentra
Dim Rs, Cnn, SQL
set Cnn=Server.CreateObject("ADODB.Connection")
set rs=Server.CreateObject("ADODB.Recordset")
set rs.CursorType = adOpenstatic
Cnn.Open Session("cnx")


'ejecuto la consulta
strSQL="SELECT *, DateDiff (day, fecha_in ,fecha_ret) as difes,
DATEDIFF (DAY, fecha_in, getdate()) as difftot
FROM tblcliente"

se_encuentra = False

if se_encuentra then
strSQL=strSQL & " AND tipo_cliente LIKE '%distribuidor'"
else
strSQL=strSQL & " WHERE tipo_cliente LIKE '%distribuidor'"
se_encuentra=True
end if


if IsDate(fecha_1) then

if se_encuentra then
strSQL=strSQL & " AND fecha_ret between '"&fecha_1&"' and '"&fecha_2&"'"
else
strSQL=strSQL & " WHERE fecha_ret between '"&fecha_1&"' and '"&fecha_2&"'"
se_encuentra=True
end if
end if


if csr <> "" then
if se_encuentra then
strSQL=strSQL & " AND csr LIKE '%"&csr&"'"
else
strSQL=strSQL & " WHERE csr LIKE '%"&csr&"'"
se_encuentra=True
end if
end if

'la variable se_encuentra se inicializa en falso y se cambia a verdadero si el campo trae un valor ingresado

if distribuidor <> "" then
if se_encuentra then
strSQL=strSQL & " AND distribuidor LIKE '%"&distribuidor&"'"
else
strSQL=strSQL & " WHERE distribuidor LIKE '%"&distribuidor&"'"
se_encuentra=True
end if
end if

if estado <> "" then
if se_encuentra then
strSQL=strSQL & " AND estado LIKE '%"&estado&"'"
else
strSQL=strSQL & " WHERE estado LIKE '%"&estado&"'"
se_encuentra=True
end if
end if

if tecnico <> "" then
if se_encuentra then
strSQL=strSQL & " AND tecnico LIKE '%"&tecnico&"'"
else
strSQL=strSQL & " WHERE tecnico LIKE '%"&tecnico&"'"
se_encuentra=True
end if
end if
if se_encuentra then
strSQL = strSQL & " ORDER BY 'difftot' desc "
se_encuentra=True
end if



rs.Open strSQL, Cnn,adopenstatic,adcmdtext, rs.pagesize=10
'abrimos la tabla para llamar los registros

if session("pagina")>rs.pagecount then
session("pagina")=rs.pagecount 'evitamos el error de reload
end if%>

<!-- situamos el cursor en el inicio de la pagina a mostrar y
calculamos los valores de inicio y fin para mostrarlos en
las cabeceras -->

<%rs.absolutepage=session("pagina")
inicio=1+(session("pagina")-1)*rs.pagesize
fin=inicio+9
if fin > rs.recordcount then
fin =rs.recordcount
end if
%>
<center>
<h3>Resultados de la Busqueda </h3>
</center>
<table border="0" width="100%" bgcolor="#00FF00">
<tr>
<td width="50%" align="center">Registros <font color="#FF0000"><%=inicio%> </font>
al <font color="#FF0000"><%=fin%></font> de un total de
<font color="#FF0000"><%=rs.recordcount%></font></td>
<td width="50%" align="center">Página <font color="#FF0000"><%=session("pagina")%>
</font> de <font color="#FF0000"><%=rs.pagecount%></font></td>
</tr>
</table>
<br>

<table width="123%" height="99" BORDER="1" CELLPADDING="2" CELLSPACING="0" BORDERCOLOR="#000000">
<tr>
<td width="3%" BGCOLOR="#FFFFFF"><b>CSR</b></td>
<td width="4%" BGCOLOR="#FFFFFF"><b>Local</b></td>
<td width="6%" align="center" BGCOLOR="#FFFFFF"><b>Guia Despacho</b></td>
<td width="8%" align="center" BGCOLOR="#FFFFFF"><b>Distribuidor</b></td>
<td width="6%" align="center" BGCOLOR="#FFFFFF"><b>Artefacto</b></td>
<td width="4%" align="center" BGCOLOR="#FFFFFF"><b>Serie</b></td>
<td width="5%" align="center" BGCOLOR="#FFFFFF"><b>Estado</b></td>
<td width="4%" align="center" BGCOLOR="#FFFFFF"><b>Tipo Gtia</b></td>
<td width="13%" align="center" BGCOLOR="#FFFFFF"><b>Fecha Ingreso</b></td>
<td width="11%" align="center" BGCOLOR="#FFFFFF"><b>Fecha Status</b></td>
<td width="4%" align="center" BGCOLOR="#FFFFFF"><b>Fecha Aviso</b></td>
<td width="5%" align="center" BGCOLOR="#FFFFFF"><b>Guia de Entrega</b></td>
<td width="8%" align="center" BGCOLOR="#FFFFFF"><b>Codigo Autorizacion</b></td>
<td width="5%" align="center" BGCOLOR="#FFFFFF"><b>Tecnico</b></td>
<td width="7%" align="center" BGCOLOR="#FFFFFF"><b>Diferencia Status</b></td>
<td width="7%" align="center" BGCOLOR="#FFFFFF"><b>Diferencia Total</b></td>

</tr>


<!-- montamos el bucle para mostrar los registros -->

<%
contador=0
Do While contador < rs.pagesize and NOT rs.EOF%>


<tr>
<td><%= rs("csr")%></td>
<td><%= rs("loc")%></td>
<td> <%= rs("guia_d")%></td>
<td> <%= rs("distribuidor")%></td>
<td> <%= rs("artefacto")%></td>
<td> <%= rs("serie")%></td>
<td> <%= rs("estado")%></td>
<td> <%= rs("gtia")%></td>
<td> <%= rs("fecha_in")%></td>
<td> <%= rs("fecha_ret")%></td>
<td> <%= rs("fecha_avi")%></td>
<td> <%= rs("guia_sta")%></td>
<td> <%= rs("cod_auto")%></td>
<td> <%= rs("tecnico")%></td>
<td> <%= rs("difes")%></td>
<td> <%= rs("difftot")%></td>
</tr>


<% rs.MoveNext
contador=contador+1
Loop

%>
</table>

<div align="center">
<center>

<!-- mostramos los botones de adelante y atras segun proceda -->
<table border="0" width="38%" height="5">
<tr><%if session("pagina")<> 1 then %>
<td width="50%" height="1" align="center">
<form method="POST" action="val_buscar.asp">
<p><input type="submit" value="Registros Anteriores" name="direccion"></p>
</form>
</td><%end if%>
<%if session("pagina")< rs.pagecount then%>
<td width="50%" height="1" align="center">
<form method="POST" name="val_buscar.asp">
<p><input type="submit" value="Registros Siguientes" name="direccion"></p>
</form>
</td><%end if%>
</tr>
</table>
</center>
</div>

<!-- cerramos el recordset -->

<%rs.Close%>
</body>
</html>
el problema que tengo es que cuando me muestra los 10 primeros registros no tengo problema alguno...pero cuando presiono para ver los registros siguientes....se salta el filtro de la busqueda y me trae todos los resultados de la base de datos, que podra ser mi error ??

De antemano muchas gracias

Última edición por darkmcloud; 13/11/2007 a las 21:50