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

amigos de foros del web....mi consulta es la siguiente :
tengo un problema en el formato de una tabla que visualiza los resultados de un buscador.....el problema es que cuando en uno de los registros viene un campo vacio.....se corre las lineas de la tabla y me pierde el orden.....aqui una imagen de como se ve :




y este es el codigo del buscador :

Cita:
<HTML>
<HEAD>
</HEAD>
<body bgcolor="#FFCC66" background="2.jpg" text="BLACK" link="BLACK" vlink="BLACK" alink="BLACK">
<p align="center">
<%

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

Const adCmdText = &H0001
Const adOpenStatic = 3


'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")
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_in between '"&fecha_1&"' and '"&fecha_2&"'"
else
strSQL=strSQL & " WHERE fecha_in 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

'abrimos la tabla para llamar los registros



if rs.EOF then
Response.Write("No existe el campo ingresado, verifique los datos")
else %>


<br>
<font face="Bookman Old Style"><em>N&uacute;mero de registros seleccionados:</em></font> <b><%=RS.RecordCount%></b>
<p align="center">
<CENTER>
<TABLE WIDTH=1404 height="61" BORDER=1 align="center" CELLSPACING="2">
<tr> <td width=74 bordercolor="#F0F0F0" bgcolor="ORANGE"><center><b>Csr</b></center>
<td width=60 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Local</b></center>
<td width=66 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Guia De Despacho</b></center>
<td width=125 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Distribuidor</b></center>
<td width=73 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Fecha Ingreso</b></center>
<td width=122 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Artefacto</b></center>
<td width=83 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Serie</b></center>
<td width=95 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Estado</b></center>
<td width=92 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Fecha Aviso</b></center>
<td width=72 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><p><b>Fecha </b><b>Status</b></p></center>
<td width=92 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Guia de Entrega</b></center>
<td width=59 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Tipo de Garantia</b></center>
<td width=76 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Tecnico Asignado</b></center>
<td width=101 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Código de Autorización</b></center>
<td width=74 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Diferencia Dias Status</b></center>
<td width=74 bordercolor="#FFFFFF" bgcolor="ORANGE"><center><b>Diferencia Dias Total</b></center>
</tr> </table> </CENTER>

<%do while not rs.EOF%>

<center>
<TABLE BORDER=1 CELLSPACING="2" WIDTH=1416>
<tr>
<%Response.Write "<td WIDTH=80 align='left' >"&rs("csr")&"<td WIDTH=100 align='left'>"&rs("loc")&"<td WIDTH=99 align='left'>"&rs("guia_d")&"<td WIDTH=134 align='center'>"&rs("distribuidor")&"<td WIDTH=102 align='left'>"&rs("fecha_in")&"<td WIDTH=160 align='center' >"&rs("artefacto")&"<td WIDTH=100 align='left' >"&rs("serie")&"<td WIDTH=80 align='center' >"&rs("estado")&"<td WIDTH=102 align='left' >"&rs("fecha_avi")&"<td WIDTH=102 align='center' >"&rs("fecha_ret")&"<td WIDTH=82 align='left' >"&rs("guia_sta")&"<td WIDTH=70 align='center' >"&rs("gtia")&"<td WIDTH=100 align='left' >"&rs("tecnico")&"<td WIDTH=90 align='center' >"&rs("cod_auto")&"<td WIDTH=100 align='left' >"&rs("difes")&"<td WIDTH=90 align='center' >"&rs("difftot")%>
<br> </tr>
<%rs.Movenext%>
</table></center>
<%loop

end if


rs.Close

set rs = nothing

Cnn.Close

set oCnn = nothing

%>


</body>
</html>

De Antemano muchas gracias