
19/12/2003, 17:22
|
| | Fecha de Ingreso: diciembre-2003
Mensajes: 5
Antigüedad: 21 años, 4 meses Puntos: 0 | |
El codigo que tengo es el siguiente:
<%@ Language=VBScript %>
<%
':::Declaro variables
Dim MyMonth ':::Month of calendario
Dim MyYear ':::Year of calendario
Dim FirstDay ':::First day of the month. 1 = Monday
Dim CurrentDay ':::Used to print dates in calendario
Dim Col ':::calendario column
Dim Row ':::calendario row
MyMonth = Request.Querystring("Month")
MyYear = Request.Querystring("Year")
':::Asigno Valores a las variables
if Request.Querystring("Month")<> "" then
MyMonth=Request.Querystring("Month")
else if Request.Form("txtmes")<>"" then
MyMonth=Request.Form("txtmes")
else
MyMonth=Month(Date)
end if
end if
'Mes=Request.Form("txtmes")
if Request.Querystring("Year")<> "" then
MyYear=Request.Querystring("MyYear")
else if Request.Form("Year") then
MyYear=Request.Form("txtYear")
else
MyYear=Year(Date)
end if
end if
'If IsEmpty(MyMonth) then MyMonth = Month(Date)
'if IsEmpty(MyYear) then MyYear = Year(Date)
Call ShowHeader (MyMonth, MyYear)
FirstDay = WeekDay(DateSerial(MyYear, MyMonth, 1)) -1
CurrentDay = 1
':::Imprime calendario
For Row = 0 to 5
For Col = 0 to 6
If Row = 0 and Col < FirstDay then
response.write "<td> </td>"
elseif CurrentDay > LastDay(MyMonth, MyYear) then
response.write "<td> </td>"
else
response.write "<td"
if cInt(MyYear) = Year(Date) and cInt(MyMonth) = Month(Date) and CurrentDay = Day(Date) then
response.write " class='calCeldaResaltado' align='center'>"
else
response.write " align='center'>"
end if
caja1=currentday
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 & "<br>"
':::Imprimo los valores correspondientes a los dias del mes
Registro="Registro" & CurrentDay & MyMonth & MyYear
'If Request.Cookies(Registro)("Turno")="" then
' Response.write "<input type='text' name='txt" & CurrentDay & MyMonth & MyYear & "' size='1'>" & "</div></a></td>"
'else
Response.write "<input type='text' name='txt" & CurrentDay & MyMonth & MyYear & "' value='" & Request.Cookies(Registro)("Turno") & "' size='1'>" & "</div></a></td>"
'end if
CurrentDay = CurrentDay + 1
End If
Next
response.write "</tr>"
Next
response.write "</table></body></html>"
':::Ejecuto la accion segun el boton presionado
':::Boton Grabar
Contador="Contador"
if Request.Form("Grabar")<> "" then
':::Recorro los dias del mes actual para imprimir los turnos que el usuario selecciono
Response.Cookies(Contador)("Numero")=Request.Cooki es(Contador)("Numero")+ 1
for i=1 to currentday-1
'::: Grabo la cookie contadora
M="M"& Request.Cookies(Contador)("Numero")
Response.Cookies(M)("Mes")=Mymonth
Response.Cookies(M)("Anio")=MyYear
'::: Grabo la cookie que lleva los registros
Registro="Registro" & i & MyMonth & MyYear
Response.Cookies(Registro)("Dia")=i
Response.Cookies(Registro)("Mes")= Request.Querystring("Month")
If Request.Form("txt" & i & MyMonth & MyYear )<> "" then
Response.Cookies(Registro)("Turno")=Request.Form(" txt" & i & MyMonth & MyYear )
else
Response.Cookies(Registro)("Turno")=""
end if
Response.Cookies(Registro)("Fecha")=i & "/" & MyMonth & "/" & MyYear
next
for i=1 to currentday-1
Registro="Registro" & i & MyMonth & MyYear
Response.write Request.Cookies(Registro)("Turno") & "<br>"
next
end if ':::Cierro sentencia del request.form grabar
'::Boton Salir
If Request.Form("Salir") <>"" then
reg=Request.Cookies("Contador")("Numero")
Response.redirect "inicio.asp?tam=" & reg
end if
'------ Sub and functions
Sub ShowHeader(MyMonth,MyYear)
%>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<style>
.calFondocalendarioio {background-color:gainsboro}
.calEncabe {font-family:Arial, Helvetica, sans-serif; font-size:11px}
.calFondoEncabe {background-color:lightgreen}
.calDias {font-family:Arial, Helvetica, sans-serif; font-size:9px; font-weight:900}
.calSimbolo {font-family:Arial, Helvetica, sans-serif; font-size:11px; text-decoration:none; font-weight:200; color:blue}
.calResaltado {font-family:Arial, Helvetica, sans-serif; font-size:11px; text-decoration:none; font-weight:700}
.calCeldaResaltado {background-color:white}
</style>
<title>calendario Inicial</title></head>
<body bgcolor='#ffffcc'>
<br>
<form name="form1" method="post" action="calendario.asp">
<div align="center"><font color="#0000A0" face="Arial, Helvetica, sans-serif" size="2"><b>Mes:
<input type="text" name="txtmes" value="<%=MyMonth%>" >
</b></font><b><font face="Arial, Helvetica, sans-serif" size="2"><br>
<font color="#0000A0">Año:</font></font> <font face="Arial, Helvetica, sans-serif" size="2">
<input type="text" name="año" value="<%=MyYear%>" >
</font></b><br><br>
<input type="submit" name="Grabar" value="Grabar">
<input type="submit" name="Salir" value="Salir">
</div><%Response.write MyMonth%>
<br>
<table border='1' cellspacing='3' cellpadding='3' width='200' align='center' class="calFondocalendarioio">
<tr align='center'>
<td colspan='7'>
<table border='0' cellspacing='1' cellpadding='1' width='100%' class="calFondoEncabe">
<tr>
<td align='left'>
<%
response.write "<a href = 'calendario.asp?"
if MyMonth - 1 = 0 then
response.write "month=12&year=" & MyYear -1
else
response.write "month=" & MyMonth - 1 & "&year=" & MyYear
end if
response.write "'><span class='calSimbolo'><<</span></a>"
response.write "<span class='calEncabe'> <b>" & MonthName(MyMonth) & "</b> </span>"
response.write "<a href = 'calendario.asp?"
if MyMonth + 1 = 13 then
response.write "month=1&year=" & MyYear + 1
else
response.write "month=" & MyMonth + 1 & "&year=" & MyYear
end if
response.write "'><span class='calSimbolo'>>></span></a>"
%>
</td>
<td align='center'>
<%
response.write "<a href ='calendario.asp?"
response.write "month=" & Month(Date()) & "&year=" & Year(Date())
response.write "'><div class='calSimbolo'><b>Hoy</b></div></a>"
%>
</td>
<td align='right'>
<%
response.write "<a href = 'calendario.asp?"
response.write "month=" & MyMonth & "&year=" & MyYear -1
response.write "'><span class='calSimbolo'><<</span></a>"
response.write "<span class='calEncabe'> <b>" & MyYear & "</b> </span>"
response.write "<a href = 'calendario.asp?"
response.write "month=" & MyMonth & "&year=" & MyYear + 1
response.write "'><span class='calSimbolo'>>></span></a>"
%>
</td>
</tr>
</table>
</td>
</tr>
<tr align='center'>
<td width="19">
<div class='calDias'>
<div align="center">D</div>
</div>
</td>
<td width="15">
<div class='calDias' align="center">L</div>
</td>
<td width="18">
<div class='calDias' align="center">M</div>
</td>
<td width="16">
<div class='calDias'>
<div align="center">M</div>
</div>
</td>
<td width="15">
<div class='calDias' align="center">J</div>
</td>
<td width="16">
<div class='calDias'>
<div align="center">V</div>
</div>
</td>
<td width="19">
<div class='calDias'>
<div align="center">S</div>
</div>
</td>
</tr>
<%
End Sub
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
%>
</table>
</form>
Lo que quiere es que cuqndo pulso el boton grabar, los valores de la caja de texto se muestren en la caja correspondiente, y que cuando cambia a otro mes, los valores tambien se muestren. |