
08/09/2005, 02:04
|
| | Fecha de Ingreso: enero-2002
Mensajes: 1.438
Antigüedad: 23 años, 3 meses Puntos: 0 | |
Código:
<%
' Funciones calendario
Function MonthName(MyMonth)
Select Case MyMonth
Case 1
MonthName = "Enero"
Case 2
MonthName = "Febrero"
Case 3
MonthName = "Marzo"
Case 4
MonthName = "Abril"
Case 5
MonthName = "Mayo"
Case 6
MonthName = "Junio"
Case 7
MonthName = "Julio"
Case 8
MonthName = "Agosto"
Case 9
MonthName = "Septiembre"
Case 10
MonthName = "Octubre"
Case 11
MonthName = "Noviembre"
Case 12
MonthName = "Diciembre"
Case Else
MonthName = "ERROR!"
End Select
End Function
Function LastDay(MyMonth, MyYear)
' Returns the last day of the month. Takes into account leap years
' Usage: LastDay(Month, Year)
' Example: LastDay(12,2000) or LastDay(12) or Lastday
Select Case MyMonth
Case 1, 3, 5, 7, 8, 10, 12
LastDay = 31
Case 4, 6, 9, 11
LastDay = 30
Case 2
If IsDate(MyYear & "-" & MyMonth & "-" & "29") Then LastDay = 29 Else LastDay = 28
Case Else
LastDay = 0
End Select
End Function
%>
<%
Dim MyMonth 'Month of calendar
Dim MyYear 'Year of calendar
Dim FirstDay 'First day of the month. 1 = Monday
Dim CurrentDay 'Used to print dates in calendar
Dim Col 'Calendar column
Dim Row 'Calendar row
MyMonth = Request.Querystring("Month")
If IsEmpty(MyMonth) then MyMonth = Month(Date)
if IsEmpty(MyYear) then MyYear = Year(Date)
FirstDay = WeekDay(DateSerial(MyYear, MyMonth, 1)) -2
if firstDay = -1 then FirstDay = 6
CurrentDay = 1
set Festivo = Server.CreateObject("ADODB.Recordset")
Festivo.ActiveConnection = MM_MyEmpresas_STRING
Festivo.Source = "SELECT * FROM Trafico WHERE Fecha Between '"& MyYear &"-"& MyMonth & "-1' and '2006-01-01' ORDER BY Fecha"
Festivo.CursorType = 0
Festivo.CursorLocation = 2
Festivo.LockType = 3
Festivo.Open()
Festivo_numRows = 0
'fin calendario
%>
Código:
<% 'inicio calendario %> <table border='1' cellspacing='0' width='90%' align='center' class="calFondoCalendario">
<tr align='center'>
<td colspan='7'> <table border='0' cellspacing='1' cellpadding='1' width='100%' class="calFondoEncabe">
<tr>
<td align='left'> <div align="center"><font size="-2"><b><a href="../ADR/RestriccionesTrafico.asp">Restricciones
tráfico de MM.PP.</a></b></font><br>
<%
response.write "<a href = 'Micuenta.asp?"
if MyMonth - 1 = 0 then
response.write "month=12"
else
response.write "month=" & MyMonth - 1
end if
response.write "'><span class='calSimbolo'><<</span></a>"
response.write "<span class='calEncabe'> <b>" & MonthName(MyMonth) & " 2005</b> </span>"
response.write "<a href = 'micuenta.asp?"
if MyMonth + 1 = 13 then
response.write "month=1"
else
response.write "month=" & MyMonth + 1
end if
response.write "'><span class='calSimbolo'>>></span></a>"
%>
</div></td>
</tr>
</table></td>
</tr>
<tr align='center'>
<td> <div class='calDias'>L</div></td>
<td> <div class='calDias'>M</div></td>
<td> <div class='calDias'>X</div></td>
<td> <div class='calDias'>J</div></td>
<td> <div class='calDias'>V</div></td>
<td> <div class='calDias'>S</div></td>
<td> <div class='calDias'>D</div></td>
</tr>
<%
For Row = 0 to 5
For Col = 0 to 6
If Row = 0 and Col < FirstDay then
response.write "<td><font size='-7'> </font></td>"
elseif CurrentDay > LastDay(MyMonth, MyYear) then
Response.write "<td><font size='-7'> </font></td>"
if col = 6 then
row = 5
end if
else
MM_Celda = "<td"
MM_Celda_class = " align='Center'"
if col=6 or col=5 then
if col=5 then
MM_Celda_class = " class='calRojo' align='center' title='P. Vasco: Desde las 22h restricciones para vehículos de más de 7500 Kg en carreteras del anexo II. Cataluña: Restricciones especiales, para vehículos de más de 3500 Kg'"
else
MM_Celda_class = " class='calRojo' align='center' title='Estatal: Restricción de 8h a 24h; P. Vasco: de 0h a 24h para vehículos de más de 7500 Kg con MMPP en carreteras del anexo II'"
end if
if CurrentDay = LastDay(MyMonth, MyYear) then
row = 5
end if
end if
if CurrentDay=Day(Festivo.Fields.Item("Fecha").Value) and cInt(MyMonth)= Month(Festivo.Fields.Item("Fecha").Value) then
if col=5 then
MM_Celda_class = " class='calRojo' align='center' title='Restricción de "& (Festivo.Fields.Item("de").Value) & "h a "& (Festivo.Fields.Item("a").Value) & "h ("& (Festivo.Fields.Item("ambito").Value) & "); P. Vasco: Desde las 22h restricciones para vehículos de más de 7500Kg en carreteras del anexo II; Cataluña: Restricciones especiales, para vehículos de más de 3500 Kg'"
else
MM_Celda_class = " class='calRojo' align='center' title='Restricción de "& (Festivo.Fields.Item("de").Value) & "h a "& (Festivo.Fields.Item("a").Value) & "h ("& (Festivo.Fields.Item("ambito").Value) & ")'"
end if
festivo.MoveNext()
end if
MM_Celda = MM_Celda & MM_Celda_class & ">"
response.Write (MM_Celda)
if cInt(MyYear) = Year(Date) and cInt(MyMonth) = Month(Date) and CurrentDay = Day(Date) then
Response.Write "<div class='calResaltado'>"
else
Response.Write "<div class='calSimbolo'>"
end if
Response.Write CurrentDay & "</div></a></td>"
CurrentDay = CurrentDay + 1
End If
Next
response.write "</tr>"
Next
Festivo.Movefirst()
%>
<%
Festivo.Close()
'final calendario
%>
|