Ver Mensaje Individual
  #12 (permalink)  
Antiguo 10/09/2005, 16:01
snomar
 
Fecha de Ingreso: septiembre-2005
Mensajes: 20
Antigüedad: 19 años, 8 meses
Puntos: 0
Falta algo

El codigo parece bueno, tendria que comprobar coincidencias en la BD, pero falta algo que no acierto a ver que si bien el calendario funciona no hace la comprobacion!

Por otro lado al canviar de mes la fecha canvia del formato 5-9-2005 a 05-09-2005

He probado lo que se me ha ocurrido pero no veo donde esta


Cita:
Iniciado por sjam7
checa este: OJO, checa los datos de la BD, esta tiene los campos:
id
fecha
evento
nombre
lugar
hora
comentarios

Código:
<%
RS = Server.MapPath("db/base.mdb")
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & RS & ";"
Set RS = Server.CreateObject("ADODB.Recordset")
et 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()
		
		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
		
		'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"


iDIM = GetDaysInMonth(Month(dDate), Year(dDate))
iDOW = GetWeekdayMonthStartsOn(dDate)
%>
<TABLE width="150" BORDER=0 CELLPADDING=0 CELLSPACING=0>
  <TR>
<TD>
<TABLE width="150" BORDER=0 CELLPADDING=0 CELLSPACING=1 class="bordeTODO" bgcolor="#33FFFF">
		<TR bgcolor="#CCCCCC"> 
		  <TD ALIGN="center" COLSPAN=7> 
			<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
			  <TR> 
			 <TD width="29%" height="13" ALIGN="left" background="images/fondobtn2.gif"><A HREF="agenda.asp?date=<%= SubtractOneMonth(dDate)%>" alt="Ir al mes anterior"><FONT COLOR=#FFFFFF style="font-size:10px" face="Trebuchet MS, Arial, Verdana"><b>&lt;&lt; 
				 </b></FONT></A></TD>
			 <TD width="43%" height="13" ALIGN="center" background="images/fondobtn2.gif"><FONT COLOR=#ffffff style="font-size:11px" face="Trebuchet MS, Arial, Verdana"><B><%=mesactual%></B></FONT></TD>
			 <TD width="28%" height="13" ALIGN="right" background="images/fondobtn2.gif"><A HREF="agenda.asp?date=<%= AddOneMonth(dDate)%>" alt="Ir al siguiente mes"><FONT COLOR=#ffffff style="font-size:10px" face="Trebuchet MS, Arial, Verdana"><b> 
				 &gt;&gt;</b></FONT></A></TD>
			  </TR>
			</TABLE></TD>
		</TR>
		<TR valign="middle" bgcolor="#CCCCCC"> 
		 <TD height="20" ALIGN="center"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>D</B></FONT></TD>
		 <TD height="20" ALIGN="center"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>L</B></FONT></TD>
		 <TD height="20" ALIGN="center"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>M</B></FONT></TD>
		 <TD height="20" ALIGN="center"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>M</B></FONT></TD>
		 <TD height="20" ALIGN="center"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>J</B></FONT></TD>
		 <TD height="20" ALIGN="center"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>V</B></FONT></TD>
		 <TD height="20" ALIGN="center"><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 


if iCurrent = "5" and Month(dDate)="5" then
	 fondo="#0099CC"
elseif iCurrent = "16" and Month(dDate)="9" then
	 fondo="#0099CC"
elseif iCurrent = "1" and Month(dDate)="1" then
	 fondo="#0099CC"
elseif iCurrent = "25" and Month(dDate)="12" then
	 fondo="#0099CC"
elseif iCurrent = "5" and Month(dDate)="2" then
	 fondo="#0099CC"
end if
	
	If iCurrent = Day(dDate) Then
		if base="mysql" then
		Response.Write vbTab & vbTab & "<TD class=bordeTODO onmouseover=""this.style.background='#99ccc'"" onmouseout=""this.style.background='#00FFFF'"" width=18 height=20 ALIGN=center BGCOLOR=#00FFFF><A HREF=""./agenda.asp?date=" & Year(dDate) & "-" & Month(dDate) & "-" & iCurrent & """ class=a2><FONT face=""Verdana"" SIZE=""1"" COLOR=#000099><b>" & iCurrent & "</b></FONT></A></TD>" & vbCrLf
		else
		Response.Write vbTab & vbTab & "<TD class=bordeTODO onmouseover=""this.style.background='#99ccc'"" onmouseout=""this.style.background='#00FFFF'"" width=18 height=20 ALIGN=center BGCOLOR=#00FFFF><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
		end if
	Else
		fechahoy= iCurrent & "/" & Month(dDate) & "/" & Year(dDate)
		SQL2="SELECT * FROM eventos WHERE fecha="&fechahoy&" order by fecha"

		RS2.Open SQL2,oConn,1,1
		if not rs2.eof then
		if base="mysql" then
		Response.Write vbTab & vbTab & "<TD class=bordeTODO onmouseover=""this.style.background='#99cccc'"" onmouseout=""this.style.background='#3D87CA'"" width=18 height=20 ALIGN=center BGcolor=#3D87CA><A HREF=""./agenda.asp?date=" & Year(dDate) & "-" & Month(dDate) & "-" & iCurrent & """ class=a2><FONT face=""Verdana"" SIZE=""1"" color=#ffffff>" & iCurrent & "</FONT></A></TD>" & vbCrLf
		else
		Response.Write vbTab & vbTab & "<TD class=bordeTODO onmouseover=""this.style.background='#99cccc'"" 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
		end if
		else
	    Response.Write vbTab & vbTab & "<TD onmouseover=""this.style.background='#99cccc'"" 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" cellpadding="0" cellspacing="2" bgcolor="#66FFFF" class="bordeTODO">
  <tr> 
	<td width="18" height="20" bgcolor="#0099CC" class="bordeTODO"><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 class="bordeTOP"> 
	<td height="20" bgcolor="#eeeeee" class="bordeTODO"><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 class="bordeTOP"> 
	<td height="20" bgcolor="#3D87CA" class="bordeTODO"><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 class="bordeTOP"> 
	<td height="20" bgcolor="#99cccc" class="bordeTODO"><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 class="bordeTOP"> 
	<td height="20" bgcolor="#00FFFF" class="bordeTODO"><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>