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

Ayuda Programacion de Calendario

Estas en el tema de Ayuda Programacion de Calendario en el foro de ASP Clásico en Foros del Web. Tengo un calendario en el cual se imprime los dias del mes y abajo de cada dia se imprime una caja de texto, el nombre ...
  #1 (permalink)  
Antiguo 19/12/2003, 14:29
 
Fecha de Ingreso: diciembre-2003
Mensajes: 5
Antigüedad: 21 años, 4 meses
Puntos: 0
Pregunta Ayuda Programacion de Calendario

Tengo un calendario en el cual se imprime los dias del mes y abajo de cada dia se imprime una caja de texto, el nombre de la caja de texto es la fecha completa, el problema que tengo es que cuando grabo en el mes actual, le doy un response.redirect y le asigno a la caja de texto el valor de la cookie turno que previamente almacene cuando el usuario pulso el boton de grabar,y no me despliega todos los valores en cada caja de texto, solo en algunas cajas me muestra el valor, sin embargo en la cookie si estan almacenados todos los valores.

Por favor si alguien me pudiera explicar como puedo hacer para que cuando grabe los valores en la cookie, le de un response.redirect y me muestra en la caja de texto los valores almacenados.

Gracias.
  #2 (permalink)  
Antiguo 19/12/2003, 16:46
 
Fecha de Ingreso: noviembre-2003
Ubicación: Distrito Federal
Mensajes: 225
Antigüedad: 21 años, 5 meses
Puntos: 0
Como que no te entiendo, podrias poner el codigo con comentarios para ver si te puedo ayudar
  #3 (permalink)  
Antiguo 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>&nbsp;</td>"
elseif CurrentDay > LastDay(MyMonth, MyYear) then
response.write "<td>&nbsp;</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&ntilde;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.
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 11:38.