Ver Mensaje Individual
  #7 (permalink)  
Antiguo 23/05/2008, 09:05
Lebennin
 
Fecha de Ingreso: septiembre-2005
Mensajes: 135
Antigüedad: 18 años, 8 meses
Puntos: 1
Respuesta: calendario anual

Espero que les guste este código. Una vez lo entiendan pueden hacer como hago yo, colorear los días, hacer un link en cada día, etc..

Espero que les guste. Tienen que enviar una fecha y les hace el calendario del año entero.

Copienlo entero y pruebenlo. Yo lo he sacado de mi intranet y le he quitado algo de codigo, pero quizas tenga algo que no sirva.


Código:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
 <%	'Lo primero será calcular cuantas columnas nos harán falta.
	FecMaestra = Request("Fecha")
	If Trim(FecMaestra) = "" Then FecMaestra = "01/01/" & Year(Date())
	FecIni = FecMaestra
	Indice = 0
	ColumnasSup = 0
	Do While Year(FecIni) = Year(FecMaestra)
		Columnas = 1
		For A = 1 To WeekDay(FecIni,2) - 1
			Columnas = Columnas + 1
		Next
		Mes = Month(FecIni)
		Do While CInt(Month(FecIni)) = Mes 
			FecIni = DateAdd("d",1,FecIni)
			Columnas = Columnas + 1
		Loop
		If CInt(Columnas) > CInt(ColumnasSup) Then	ColumnasSup = Columnas
	Loop	%>
	<table style="border-collapse:collapse" border="1" bordercolor="#999999">
				<tr>
					<td class="paLibDetail" align="center"><a href=""><img src="../../img/flecha2.ico" alt="año anterior" width="16" align="16" border="0" /></a></td>
					<td colspan="<%=ColumnasSup - 3%>" class="paLibDetail" align="center">A&ntilde;o <%=Year(FecMaestra)%></td>
					<td colspan="2" class="paLibDetail" align="center"><a href=""><img src="../../img/flecha1.ico" alt="año siguiente" width="16" height="16" border="0" /></a></td>
				</tr>
				<tr>
					<td class="resume" width="25" bgcolor="#DFDFDF">&nbsp;</td>
				<%	Colum = 1
					For Col = 1 To ColumnasSup - 1
					Select Case CInt(Colum)
						Case 1
							Letra = "L"
						Case 2
							Letra = "M"
						Case 3
							Letra = "X"
						Case 4
							Letra = "J"
						Case 5
							Letra = "V"
						Case 6
							Letra = "S"
						Case 7
							Letra = "D"
						End Select	%>
						<td class="resume" width="15" align="center" bgcolor="#DFDFDF"><%=Letra%></td>
					<%	If Letra = "S" Or Letra = "D" Then
							Redim Preserve ColFestivos(Indice)
							ColFestivos(Indice) = Col + 1
							Indice = Indice + 1
						End If
						Colum = Colum + 1
						If CInt(Colum) = 8 Then Colum = 1
					Next	%>
				</tr>
			<%	FecIni = FecMaestra
				Do While Year(FecIni) = Year(FecMaestra)
					Columnas = 1	%>
					<tr>
						<td class="resume"><%=Left(MonthName(Month(FecIni)),3)%></td>
					<%	For A = 1 To WeekDay(FecIni,2) - 1
							Columnas = Columnas + 1	%>
							<td class="resume_normal"
						<%	For B = 0 To Indice - 1
								If CInt(ColFestivos(B)) = CInt(Columnas) Then Response.Write("bgcolor='#DFDFDF'")
							Next	%>>&nbsp;
								</td>
					<%	Next
						Mes = Month(FecIni)
						Do While CInt(Month(FecIni)) = Mes	%>
							<td 
							<%	If CInt(WeekDay(FecIni,2)) = 6 Or CInt(WeekDay(FecIni,2)) = 7 Then
									Response.Write("bgColor='#DFDFDF'")
								End If%>>
								<%=Day(FecIni)%>
							</td>
					<%		FecIni = DateAdd("d",1,FecIni)
							Columnas = Columnas + 1
						Loop
						For A = Columnas To ColumnasSup - 1
							Columnas = Columnas + 1	%>
							<td class="resume_normal"
								<%	For B = 0 To Indice - 1
										If CInt(ColFestivos(B)) = CInt(Columnas) Then Response.Write("bgcolor='#DFDFDF'")
									Next	%>>&nbsp;
								
							</td>
					<%	Next	%>
					</tr>
				<%	Loop	%>	
				</table>
</body>
</html>

Última edición por Lebennin; 23/05/2008 a las 09:12