Foros del Web » Programando para Internet » ASP Clásico »

Calendario que muestre dias con eventos y dias vacios

Estas en el tema de Calendario que muestre dias con eventos y dias vacios en el foro de ASP Clásico en Foros del Web. Hola, estoy usando este script que saque del sitio con el cual puedo ver en un calendario, en forma clara, marcados con link los dias ...
  #1 (permalink)  
Antiguo 10/03/2006, 13:08
 
Fecha de Ingreso: diciembre-2005
Mensajes: 33
Antigüedad: 19 años, 4 meses
Puntos: 0
Exclamación Calendario que muestre dias con eventos y dias vacios

Hola, estoy usando este script que saque del sitio con el cual puedo ver en un calendario, en forma clara, marcados con link los dias que tengo eventos con fecha cargados en una db. Los dias que el recordset me da bof o eof false, o sea que hay evento, me los marca. Lo que estoy tratando es que los dias que me de bof o eof true, es decir, en la logica de lo que quiero hacer, los dias que tengo disponibles para alquilar el predio, me los muestre con el mismo sistema de links pero con otro color, ya sea de fondo de la tabla como del link. Esto ultimo, no es grave.. (lo del color) sino que lo que no le encuentro la vuelta es que marce tanto los "llenos" como los "vacios".

agradezco de antemano su ayuda.


Código HTML:
<%
Function NombreMes (mes)
select case mes
	case 1
		NombreMes = "Enero"
	case 2
		NombreMes = "Febrero"
	case 3
		NombreMes = "Marzo"
	case 4
		NombreMes = "Abril"
	case 5
		NombreMes = "Mayo"
	case 6
		NombreMes = "Junio"
	case 7
		NombreMes = "Julio"
	case 8
		NombreMes = "Agosto"
	case 9
		NombreMes = "Septiembre"
	case 10
		NombreMes = "Octubre"
	case 11
		NombreMes = "Noviembre"
	case 12
		NombreMes = "Diciembre"
end select
End Function 'NombreMes
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
'Utilizaba esta variable para depurar
'Dim sOrigen

'iDia, iMes, iAno --> la fecha seleccionada
Dim iDia, iMes, iAno, sEnviado

'iDiasDelMes: numero de días del mes
'iDiaSemana: día de la semana en que cae la fecha
'iPrimerDiaSemanaMes: el día de la semana en que empieza el mes
Dim iDiasDelMes, iDiaSemana, iPrimerDiaSemanaMes

Dim dFecha 'la fecha enterita

'Para pintar la tabla necesito
Dim iActual, iPosicion

'Recojo los valores del form
iDia = Request.Form("Dia")
iMes = Request.Form("Mes")
iAno = Request.Form("Ano")
sEnviado = Request.Form("Enviado")
'sOrigen = "form"

'Establezco la fecha según lo enviado
if sEnviado <> "" then
	iDia = CInt(iDia)
	iMes = CInt(iMes)
	iAno = CInt(iAno)
else
	'¿La he enviado desde un link?
	if Request.QueryString("Dia") <> "" then
		iDia = CInt(Request.QueryString("Dia"))
		iMes = CInt(Request.QueryString("Mes"))
		iAno = CInt(Request.QueryString("Ano"))
		'sOrigen = "qrs"
	else
	'La pongo a la fecha de hoy
		iDia = Day(Now)
		iMes = Month(Now)
		iAno = Year(Now)
		'sOrigen = "auto"
	end if
end if

if not IsDate(DateSerial(iAno, iMes, iDia)) then
	'Avisamos y utilizamos la de hoy
	Response.Write("<b>No es una fecha válida. Se utilizará la fecha de hoy.</b><br>")
	dFecha = Date
	iMes = Month(dFecha)
	iDia = Day(dFecha)
	iAno = Year(dFecha)
else
	'Formamos la expresión de fecha
	dFecha = DateSerial(iAno, iMes, iDia)
end if

'Hallo los días del mes
select case iMes
	case 1,3,5,7,8,10,12
		iDiasDelMes = 31
	case 2
		if iAno mod 4 = 0 then
			'Año bisiesto!
			iDiasDelMes = 29
		else
			iDiasDelMes = 28
		end if
	case else
		iDiasDelMes = 30
end select

'Hallo el día de la semana
iDiaSemana = DatePart("w", DateSerial(iAno, iMes, iDia))

'Y el día de la semana en que empieza el mes
iPrimerDiaSemanaMes = DatePart("w", DateAdd("d", - iDia+1, DateSerial(iAno, iMes, iDia)), 2)

'Las siguientes líneas las utilizo para depurar. ;-)
Response.Write(dFecha)
Response.Write( iDia & "/" & iMes & "/" & iAno & "<br>")
Response.Write "Origen: " & sOrigen & "<br>"
Response.Write "Dia: " & iDia & ", Mes: " & iMes &", Año: " & iAno & "<br>"
Response.Write "Días del mes: " & iDiasDelMes & "<br>"
Response.Write "El mes empieza en: " & iPrimerDiaSemanaMes & "<br>"

'Vamos a pintar la tabla
%>
<TABLE BORDER="1" CELLPADDING="1" CELLSPACING="0">
	<TR>
		<TD bgcolor=#FF0000><center><A HREF="calendario1.asp?Dia=<%=iDia%>&Mes=<%=DatePart("m", DateAdd("m", -1, dFecha))%>&Ano=<%=Year(DateAdd("m", -1, dFecha))%>">&lt;&lt;</A></center></TD>
		<TD COLSPAN="5" bgcolor=#0000FF> <FONT COLOR=#FFFFFF><B><CENTER><%=NombreMes(iMes)& " " & Year(dFecha)%></CENTER></B></FONT> </TD>
		<TD bgcolor=#FF0000><center><A HREF="calendario1.asp?Dia=<%=iDia%>&Mes=<%=DatePart("m", DateAdd("m", 1, dFecha))%>&Ano=<%=Year(DateAdd("m", 1, dFecha))%>">&gt;&gt;</A></center></TD>
	</TR>
	<TR>
		<TD><IMG SRC="espacio.gif" HEIGHT="1" WIDTH="30" ALT="" BORDER="0"><br><B><CENTER>L</CENTER></B></TD>
		<TD><IMG SRC="espacio.gif" HEIGHT="1" WIDTH="30" ALT="" BORDER="0"><br><B><CENTER>M</CENTER></B></TD>
		<TD><IMG SRC="espacio.gif" HEIGHT="1" WIDTH="30" ALT="" BORDER="0"><br><B><CENTER>X</CENTER></B></TD>
		<TD><IMG SRC="espacio.gif" HEIGHT="1" WIDTH="30" ALT="" BORDER="0"><br><B><CENTER>J</CENTER></B></TD>
		<TD><IMG SRC="espacio.gif" HEIGHT="1" WIDTH="30" ALT="" BORDER="0"><br><B><CENTER>V</CENTER></B></TD>
		<TD><IMG SRC="espacio.gif" HEIGHT="1" WIDTH="30" ALT="" BORDER="0"><br><B><CENTER>S</CENTER></B></TD>
		<TD><IMG SRC="espacio.gif" HEIGHT="1" WIDTH="30" ALT="" BORDER="0"><br><B><CENTER>D</CENTER></B></TD>
	</TR>

<%
'Relleno con blancos si el mes no empieza en Lunes!
if iPrimerDiaSemanaMes <> 1 then
	iPosicion = 1
	Response.Write vbTab & "<TR> " & VbCrLf
	do while iPosicion < iPrimerDiaSemanaMes
		Response.Write vbTab & vbTab & "<TD>&nbsp;</TD>" & vbcrlf
		iPosicion = iPosicion + 1
	loop
end if

' preparo fecha para conexion a base de datos
if len(iMes) = 1 then
xmes = 0&iMes
end if


 'conexion a base de datos
		dim con2,rs2,sql2,xdia
		set con2 = server.CreateObject("ADODB.Connection")
Set con2= Server.CreateObject("ADODB.Connection")
con2.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("basdatos/eventos.mdb"))
set rs2 = CreateObject("ADODB.Recordset")
'		set rs2 = server.CreateObject("ADODB.Recordset")
		sql2 = "SELECT *FROM EVENTOS WHERE FECHA LIKE '%/"&xmes&"/%' order by FECHA "
		rs2.open sql2,con2,1,2

		
'''''' aca cambia para los registros que tengo
		rs2.MoveFirst
		

'Pintamos el calendario
iActual = 1
iPosicion = iPrimerDiaSemanaMes
do while iActual <= iDiasDelMes
	
		if iPosicion = 1 then
			'Empezamos nueva semana, es decir nueva fila
			Response.Write vbTab & "<TR>" & VbCrLf 
		end if


	if Cint(iActual) = Cint(day(rs2.Fields("FECHA"))) then			


		if iActual = iDia then
			
			'Resaltamos la fecha seleccionada
				Response.Write (vbTab & vbTab & "<TD CLASS='diaActual'><B><A HREF='diax.asp?dia="&day(rs2.Fields("FECHA"))&"'>"& iActual & "</A></B><br></TD>" & vbCrLf)
				rs2.MoveNext
		else
				Response.Write (vbTab & vbTab & "<TD ALIGN='CENTER'><A Target= 'detalle' HREF='diax.asp?dia="&day(rs2.Fields("FECHA"))&"&imes="&month(rs2.Fields("FECHA"))&"&ano="&year(rs2.Fields("FECHA"))&"'>" & iActual & "</A><br></TD>" & vbCrLf)
				
		end if
		
	else
		if iActual = iDia then
			
			'Resaltamos la fecha seleccionada
				Response.Write vbTab & vbTab & "<TD CLASS='diaActual'><B>"& iActual & "</B><br></TD>" & vbCrLf
			
		else
				Response.Write vbTab & vbTab & "<TD ALIGN='CENTER'>" & iActual & "<br></TD>" & vbCrLf
		end if
	end if


	
		if iPosicion = 7 then
		'Estamos en domingo, cerramos la semana :)
			Response.Write vbTab & "</TR>" & vbCrLf
			'Pongo iPosicion a cero pq voy a sumarle uno ahorita mismo
			iPosicion = 0
		end if

		'Incrementamos!
		iActual = iActual + 1
		iPosicion = iPosicion + 1
loop

'Relleno con blancos si no termino en domingo
'Primero compruebo que no sea uno, pues si terminamos en 7 (domingo)
'al incrementar por ultima vez se queda en 1. Típico en los bucles :-)
if iPosicion <> 1 then
	while iPosicion <= 7
	'Las celdas blancas...
		Response.Write vbTab & vbTab & "<TD>&nbsp;</TD>" & vbCrLf
		iPosicion = iPosicion + 1
	wend
	'... y el fin de fila!
	Response.Write vbTab & "</TR>" & vbCrLf

end if



%>
</TABLE> 
  #2 (permalink)  
Antiguo 12/03/2006, 10:39
Avatar de sjam7  
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 23 años, 4 meses
Puntos: 16
Bueno,yo uso este que saca eventos de una base de datos access y ademas marca algunos dias festivos de Mexico
Código:
<%
RS2 = Server.MapPath("base.mdb")
Set conexion2 = Server.CreateObject("ADODB.Connection")
conexion2.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & RS2 & ";"
Set RS2 = Server.CreateObject("ADODB.Recordset")

Function GetDaysInMonth(iMonth, iYear)
    Dim dTemp
    dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1))
    GetDaysInMonth = Day(dTemp)
End Function

Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth)
    Dim dTemp
    dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth)
    GetWeekdayMonthStartsOn = WeekDay(dTemp)
End Function

Function SubtractOneMonth(dDate)
    SubtractOneMonth = DateAdd("m", -1, dDate)
End Function

Function AddOneMonth(dDate)
    AddOneMonth = DateAdd("m", 1, dDate)
End Function


Dim dDate     
Dim iDIM      
Dim iDOW     
Dim iCurrent  
Dim iPosition 


If IsDate(Request.QueryString("date")) Then
    dDate = CDate(Request.QueryString("date"))
Else
    If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Then
        dDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year"))
    Else
        dDate = Date()
        ' The annoyingly bad solution for those of you running IIS3
        If Len(Request.QueryString("month")) <> 0 Or Len(Request.QueryString("day")) <> 0 Or Len(Request.QueryString("year")) <> 0 Or Len(Request.QueryString("date")) <> 0 Then
            Response.Write "La fecha seleccionada no es valida.  El calendario regresa al dia de hoy.<BR><BR>"
        End If
        ' The elegant solution for those of you running IIS4
        'If Request.QueryString.Count <> 0 Then Response.Write "The date you picked was not a valid date.  The calendar was set to today's date.<BR><BR>"
    End If
End If

mes=Month(CDate(dDate))
if mes=1 then mesactual="Enero"
if mes=2 then mesactual="Febrero"
if mes=3 then mesactual="Marzo"
if mes=4 then mesactual="Abril"
if mes=5 then mesactual="Mayo"
if mes=6 then mesactual="Junio"
if mes=7 then mesactual="Julio"
if mes=8 then mesactual="Agosto"
if mes=9 then mesactual="Septiembre"
if mes=10 then mesactual="Octubre"
if mes=11 then mesactual="Noviembre"
if mes=12 then mesactual="Diciembre"

'MonthName(Month(dDate))
'Now we've got the date.  Now get Days in the choosen month and the day of the week it starts on.
iDIM = GetDaysInMonth(Month(dDate), Year(dDate))
iDOW = GetWeekdayMonthStartsOn(dDate)


%>
<!-- Outer Table is simply to get the pretty border-->

<TABLE width="150" BORDER=0 CELLPADDING=0 CELLSPACING=0>
  <TR>
<TD>
<TABLE width="150" BORDER=0 CELLPADDING=0 CELLSPACING=1 class="bordenegroTODO">
        <TR bgcolor="#CCCCCC"> 
          <TD ALIGN="center" COLSPAN=7> 
            <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
              <TR background="images/fondotoptabla.gif"> 
                <TD width="29%" height="20" ALIGN="left" background="images/fondotoptabla.gif"><A HREF="agenda.asp?date=<%= SubtractOneMonth(dDate)%>" alt="Ir al mes anterior"><FONT COLOR=#000099 SIZE="1" face="Arial, Verdana, Helvetica, sans-serif"><b>&lt;&lt; 
                  </b></FONT></A></TD>
                <TD width="43%" ALIGN="center" background="images/fondotoptabla.gif"><FONT COLOR=#000099 size="2" face="Arial, Verdana, Helvetica, sans-serif"><B><%=mesactual%></B></FONT></TD>
                <TD width="28%" ALIGN="right" background="images/fondotoptabla.gif"><A HREF="agenda.asp?date=<%= AddOneMonth(dDate)%>" alt="Ir al siguiente mes"><FONT COLOR=#000099 SIZE="1" face="Arial, Verdana, Helvetica, sans-serif"><b> 
                  &gt;&gt;</b></FONT></A></TD>
              </TR>
            </TABLE></TD>
        </TR>
        <TR valign="middle" bgcolor="#CCCCCC"> 
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>D</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>L</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>M</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>M</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>J</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>V</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>S</B></FONT></TD>
        </TR>
        <%
If iDOW <> 1 Then
    Response.Write vbTab & "<TR>" & vbCrLf
    iPosition = 1
    Do While iPosition < iDOW
        Response.Write vbTab & vbTab & "<TD>&nbsp;</TD>" & vbCrLf
        iPosition = iPosition + 1
    Loop
End If

iCurrent = 1
iPosition = iDOW
Do While iCurrent <= iDIM
    If iPosition = 1 Then
        Response.Write vbTab & "<TR>" & vbCrLf
    End If

    if iPosition=1 then
     fondo="#eeeeee"
    else
     fondo=""
    end if 

'ESTO ES LO DE LOS DIAS FESTIVOS, SE PONE EL DIA Y EL NUMERO DE MES
if iCurrent = "5" and Month(dDate)="5" then
     fondo="#CCCCCC"
elseif iCurrent = "16" and Month(dDate)="9" then
     fondo="#CCCCCC"
elseif iCurrent = "1" and Month(dDate)="1" then
     fondo="#CCCCCC"
elseif iCurrent = "25" and Month(dDate)="12" then
     fondo="#CCCCCC"
elseif iCurrent = "5" and Month(dDate)="2" then
     fondo="#CCCCCC"
end if


    
    If iCurrent = Day(dDate) Then
        Response.Write vbTab & vbTab & "<TD class=bordenegroTODO onmouseover=""this.style.background='#eeeeee'"" onmouseout=""this.style.background='#eeeeee'"" width=18 height=20 ALIGN=center BGCOLOR=#ff6666 background=images/fondotoptabla.gif><A HREF=""./agenda.asp?date=" & iCurrent & "-" & Month(dDate) & "-" & Year(dDate) & """ class=a2><FONT face=""Verdana"" SIZE=""1"" COLOR=#000099><b>" & iCurrent & "</b></FONT></A></TD>" & vbCrLf
    Else
        fechahoy= iCurrent & "/" & Month(dDate) & "/" & Year(dDate)
        SQL2="SELECT * FROM eventos WHERE fecha=#"&fechahoy&"# order by fecha"
        RS2.Open SQL2,conexion2,2,3,1
        if not rs2.eof then
        Response.Write vbTab & vbTab & "<TD class=bordenegroTODO onmouseover=""this.style.background='#3D87CA'"" onmouseout=""this.style.background='#3D87CA'"" width=18 height=20 ALIGN=center BGcolor=#3D87CA><A HREF=""./agenda.asp?date=" & iCurrent & "-" & Month(dDate) & "-" & Year(dDate) & """ class=a2><FONT face=""Verdana"" SIZE=""1"" color=#ffffff>" & iCurrent & "</FONT></A></TD>" & vbCrLf
        else
        Response.Write vbTab & vbTab & "<TD onmouseover=""this.style.background='#66FFCC'"" onmouseout=""this.style.background='"&fondo&"'"" width=18 height=20 ALIGN=center BGcolor="&fondo&"><A HREF=""./agenda.asp?date=" & iCurrent & "-" & Month(dDate) & "-" & Year(dDate) & """ class=a2><FONT face=""Verdana"" SIZE=""1"">" & iCurrent & "</FONT></A></TD>" & vbCrLf
        end if
        rs2.close
    End If
    
    If iPosition = 7 Then
        Response.Write vbTab & "</TR>" & vbCrLf
        iPosition = 0
    End If
    
    iCurrent = iCurrent + 1
    iPosition = iPosition + 1
Loop

If iPosition <> 1 Then
    Do While iPosition <= 7
        Response.Write vbTab & vbTab & "<TD>&nbsp;</TD>" & vbCrLf
        iPosition = iPosition + 1
    Loop
    Response.Write vbTab & "</TR>" & vbCrLf
End If
%>
      </TABLE>
</TD>
</TR>
</TABLE>
<table height="5" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td></td>
  </tr>
</table>
<table width="150" border="0" cellspacing="2" cellpadding="0">
  <tr> 
    <td width="18" height="20" bgcolor="#CCCCCC" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td width="126" height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Dia 
      festivo</font></td>
  </tr>
  <tr> 
    <td height="20" bgcolor="#eeeeee" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Domingo</font></td>
  </tr>
  <tr> 
    <td height="20" bgcolor="#3D87CA" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Dia 
      con evento</font></td>
  </tr>
  <tr> 
    <td height="20" bgcolor="#66FFCC" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Puntero</font></td>
  </tr>
  <tr> 
    <td height="20" background="images/fondotoptabla.gif" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Dia 
      actual </font></td>
  </tr>
</table>
Este lo puedes ver funcionando en www.parasuevento.com entra a Agenda o bien en www.bosquepinardelaventa.com es el mismo, espero te sirva o por lo menos para que veas ideas
  #3 (permalink)  
Antiguo 12/03/2006, 22:26
 
Fecha de Ingreso: diciembre-2005
Mensajes: 33
Antigüedad: 19 años, 4 meses
Puntos: 0
Muchas gracias sjam7. Me ayudo muchisimo. Ahora tengo otro problema. Al hacer click en el calendario, yo quiero que me mustre en la pagina diax.asp el detalle, hora por hora(separado de 1 hora entre si) de cada registro. Si hay, que lo imprima, si no, que le deje en blanco. Para eso escribi este bucle. PEro resulta que no lo puedo hacer funcionar del todo. Tengo dos tablas, una el de las reservas(id, hora_comienzo, hora_fin, miembro_id,fecha) y otra, la de los usuarios.Imprime solo la 1ra linea, o sea el 1er registro, pero cuando al for le pongo al final el rs3.movenext y asi pase al siguiente hasta que escriba en la hora que corresponde y asi, pasa el lo siguiente "ocurrio una excepcion" linea 58(es la que esta en negrita) alguna ayuda??


<%

fechahoy=Request.Querystring("date")
RS3 = Server.MapPath("pelegrinadb.mdb")
Set conexion3 = Server.CreateObject("ADODB.Connection")
conexion3.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & RS3 & ";"
Set RS3 = Server.CreateObject("ADODB.Recordset")

SQL3="SELECT * FROM reservas_futbol_cancha1 WHERE fecha=#"&fechahoy&"# order by hora_comienzo"
RS3.Open SQL3,conexion3,2,3,1

if rs3.eof then ' chequeo si esta vacio
i=1
n=5
response.write"<table width='100%' border='0' align='left'>"
For i= 1 to 17
n=n+1
hora= FormatDateTime(TIMESERIAL (n+1, 00, 00), 4)
response.write"<tr>"
response.write"<td width='15%' bgcolor='#CCCC00'><div align='center'>"
response.write(hora)
response.write"</div></td>"
response.write"<td width='85%' rowspan='2' bgcolor='#ffffff'><div align='center'>"
response.write"Disponible"
response.write"</td>"
response.write" </tr>"
response.write"<tr>"
Response.write"<td bgcolor='#CCCC00'><div align='center'>"
hora =FormatDateTime(TIMESERIAL (n+2, 00, 00), 4)
response.write(hora)
response.write"</div></td>"
Response.write"</tr>"

next
response.write"</table>"

else
i=1
n=5
response.write"<table width='100%' border='0' align='left'>"
For i= 1 to 17
' RS3.movenext
n=n+1
hora= FormatDateTime(TIMESERIAL (n+1, 00, 00), 4)
hora_sql=FormatDateTime(TIMESERIAL (n, 00, 00), 3)
nueva = Dateadd("h",1, hora_sql)
response.write(nueva)
if RS3.fields("hora_comienzo") = CDATE(nueva) then ' para ver la hora
id_user = rs3.Fields("miembro_id")
user=Csng(id_user)
' response.write (id_user)'control
SQL_user="SELECT * FROM usuarios_p WHERE id="&user&"" ' busco usuario
Set RS_user = Server.CreateObject("ADODB.Recordset")
RS_user.Open SQL_user,conexion3,2,3,1

response.write"<tr>"
response.write"<td width='15%' bgcolor='#CCCC00'><div align='center'>"
'response.write"0"
hora =FormatDateTime(TIMESERIAL (n+1, 00, 00), 4)
response.write(hora)
'response.write":00"
response.write"</div></td>"
response.write"<td width='85%' rowspan='2' bgcolor='#CCCC99'><div align='center'>"
response.write(RS_user.Fields("Nombre"))
response.write" "
response.write(RS_user.Fields("Apellido"))
response.write"<br>"
response.write"Lote: "
response.write(RS_user.Fields("Lote"))
response.write" | Telefono: "
response.write(RS_user.Fields("Telefono"))
response.write"</td>"
response.write" </tr>"
response.write"<tr>"
Response.write"<td bgcolor='#CCCC00'><div align='center'>"
hora =FormatDateTime(TIMESERIAL (n+2, 00, 00), 4)
response.write(hora)
response.write"</div></td>"
Response.write"</tr>"
rs3.movenext
else
response.write"<tr>"
response.write"<td width='15%' bgcolor='#CCCC00'><div align='center'>"
response.write(hora)
response.write"</div></td>"
response.write"<td width='85%' rowspan='2' bgcolor='#ffffff'><div align='center'>"
response.write"Disponible"
response.write"</td>"
response.write" </tr>"
response.write"<tr>"
Response.write"<td bgcolor='#CCCC00'><div align='center'>"
hora =FormatDateTime(TIMESERIAL (n+2, 00, 00), 4)
response.write(hora)
response.write"</div></td>"
Response.write"</tr>"

end if

next

response.write"</table>"
end if
%>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:00.