Ver Mensaje Individual
  #4 (permalink)  
Antiguo 17/12/2004, 06:13
Fegna
 
Fecha de Ingreso: julio-2004
Mensajes: 30
Antigüedad: 19 años, 9 meses
Puntos: 0
Baklao:

El código que tengo es:
<%
Call Main()

Sub Main()
If Request.Form("Submit") <> "" Then
Session("cVar2") = Request.Form("lstComponente")
Session("cVar3") = Request.Form("lstSubComponente")
Session("cVar4") = Request.Form("lstTarea")
Session("cVar5") = Request.Form("strWorkProduct")
Session("cVar6") = Request.Form("strComentarios")
Session("cVar7") = Request.Form("strFecha")
Session("cVar8") = Request.Form("strCompleta")
Session("cVar9") = Request.Form("strHora")
Session("cVar10") = Request.Form("strMinutos")
Response.Redirect "Grabar.asp"
Exit Sub
End If

Dim oConn
Dim strSQL

%>
<!-- #include file="Include/Base.inc" -->
<%

Dim rsComponente
Dim rsSubComponente
Dim rsTarea

Dim strComponente
Dim strSubComponente
Dim strTarea

Set rsComponente = Server.CreateObject("ADODB.Recordset")
Set rsSubComponente = Server.CreateObject("ADODB.Recordset")
Set rsTarea = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT ID_Componente, Nombre FROM Componente WHERE Activo = 'S'"
Set rsComponente = oConn.Execute(strSQL)

strComponente = Request.Form("lstComponente")
If strComponente = "" Then
If Not rsComponente.EOF Then
strComponente = rsComponente("ID_Componente")
End If
End If
If strComponente <> "" Then
strSQL = "SELECT ID_Subcomponente, Nombre FROM SubComponente WHERE ID_Componente=" & strComponente & " AND Activo = 'S'"
Set rsSubComponente = oConn.Execute(strSQL)
strSubComponente = Request.Form("lstSubComponente")
If strSubComponente = "" Or Request.Form("hid_Componente_Changed") = "True" Then
If Not rsSubComponente.EOF Then
strSubComponente = rsSubComponente("ID_SubComponente")
End If
End If
strSQL = "SELECT ID_Modulo, Nombre FROM Modulo WHERE ID_SubComponente=" & strSubComponente & " AND Activo = 'S'"
Set rsTarea = oConn.Execute(strSQL)
End If
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">

</HEAD>
<BODY>

<FORM NAME=frmPaginar2 ACTION="Paginar.asp" METHOD="post" ID="frmPaginar2">


<INPUT TYPE=HIDDEN NAME=hid_Componente_Changed>
<INPUT TYPE=HIDDEN NAME=hid_SubComponente_Changed>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="10%"></td>
<td width="10%">&nbsp;</td>
<%
Response.Write "<td width='60%' colspan='6'><H2> <p align='center'>"
Response.Write cNombre
Response.Write "</p></H2></td>"
%>
<td width="10%">&nbsp;</td>
<td width="10%">&nbsp;</td>
</tr>
</table>
<table border="0" width="100%">
<tr>
<td width="12%"><font face="Verdana" size="1"><b>Nivel 1:</b></font></td>
<td width="88%"><font face="Verdana" size="1"><SELECT id=lstComponente name=lstComponente onchange="ChangeComponente()" >
<%
If Not rsComponente.EOF Then
Do While Not rsComponente.EOF
strComponente = rsComponente("Nombre")
If cInt(rsComponente("ID_Componente")) = cInt(Request.Form("lstComponente")) Then
%>
<OPTION Value="<%=rsComponente("ID_Componente")%>" SELECTED> <%=strComponente%></OPTION>
<%
Else
%>
<OPTION Value="<%=rsComponente("ID_Componente")%>" > <%=strComponente%></OPTION>
<%
End If
rsComponente.MoveNext
Loop
End If
rsComponente.MoveFirst
%>
</SELECT></font></td>
</tr>
<tr>
<td width="12%"><font face="Verdana" size="1"><b>Nivel 2:</b></font></td>
<td width="88%"><font face="Verdana" size="1"><SELECT id=lstSubComponente name=lstSubComponente onchange="ChangeSubComponente()" >
<%
If Not rsSubComponente.EOF Then
Do While Not rsSubComponente.EOF
strSubComponente = rsSubComponente("Nombre")
response.write "+" &rsSubComponente("ID_SubComponente") & "+ --- +" & Request.Form("lstSubComponente") & "+"
If rsSubComponente("ID_SubComponente") = CDbl(Request.Form("lstSubComponente")) Then
%>
<OPTION Value="<%=rsSubComponente("ID_SubComponente")%>" SELECTED> <%=strSubComponente%></OPTION>
<%
Else
%>
<OPTION Value="<%=rsSubComponente("ID_SubComponente")%>" > <%=strSubComponente%></OPTION>
<%
End If
rsSubComponente.MoveNext
Loop
End If
rsSubComponente.MoveFirst
%>
</SELECT></font></td>
</tr>
<tr>
<td width="12%"><font face="Verdana" size="1"><b>Tarea</b></font></td>
<td width="88%"><font face="Verdana" size="1"><SELECT id=lstTarea name=lstTarea >
<OPTION Value="0">Escoja una tarea</OPTION>
<%
If Not rsTarea.EOF Then
Do While Not rsTarea.EOF
strTarea = rsTarea("Nombre")
%>
<OPTION Value="<%=rsTarea("ID_Modulo")%>" > <%=strTarea%></OPTION>
<%
rsTarea.MoveNext
Loop
End If
%>
</SELECT></font></td>
</tr>
</TABLE>

<table border="0" width="100%" height="86">

<TR>
<TD height="3">

</TD>
<TD height="3">

</TD>
<TD height="3">

</TD>
<TD height="3">

</TD>
</TR>
<TR>
<TD ALIGN="center" colspan="4" height="27">

<INPUT TYPE="button" NAME "Grabar" VALUE="Grabar" ID="Grabar" onclick="Validar()" >
</TD>
</TR>
</TABLE>

</FORM>
<script language="JavaScript">
<!-- // create calendar object(s) just after form tag closed
// specify form element as the only parameter (document.forms['formname'].elements['inputname']);
// note: you can have as many calendar objects as you need for your application
var cal1 = new calendar1(document.forms['frmPaginar2'].elements['strFecha'],00,00);
cal1.year_scroll = false;
cal1.time_comp = false;


function Borrar( wValue )
{
var wRet ;

wRet = confirm('¿Seguro de borrar esta tarea?');
if ( wRet )
{
open( 'Elimina.asp?Borra=' + wValue, 'principal', null );
}
}

function Traspasar( wValue )
{
var wRet ;

wRet = 1;
}

function Validar( wParam )
{
var wRet = 0;
var wHora = 0;
var dblTiempo = 0;
var i = 0;
var cDatos = "";

if ( frmPaginar2.strFecha.value == '' ) wRet = 1

if ( frmPaginar2.strWorkProduct.value == '' ) wRet = 1

if ( frmPaginar2.strComentarios.value == '' ) wRet = 1

if ( frmPaginar2.lstTarea.selectedIndex == 0 ) wRet = 1

if ( frmPaginar2.strHora.selectedIndex == 0 )
{
if ( frmPaginar2.strMinutos.selectedIndex == 0 ) wRet = 1
}
/*---------------------------*/
if( wRet != 1 )
{
dblTiempo = frmPaginar2.strHora.selectedIndex;
if (frmPaginar2.strMinutos.selectedIndex != 0 )
{
dblTiempo += 0.5;
}
cDatos = "', #" + frmPaginar2.strFecha.value + "#, " + frmPaginar2.lstTarea.selectedIndex + ", '" + frmPaginar2.strWorkProduct.value + "', '" + frmPaginar2.strComentarios.value + "', '" + frmPaginar2.strCompleta.value + "', cDbl('" +dblTiempo + "'), #'";
cDatos = 'Grabar.asp?V1=' + frmPaginar2.strFecha.value + '&V2=' + frmPaginar2.lstTarea.selectedIndex + '&V3=' + frmPaginar2.strWorkProduct.value + '&V4=' + frmPaginar2.strComentarios.value + '&V5=' + frmPaginar2.strCompleta.value + '&V6=' + dblTiempo;
i = frmPaginar2.lstTarea.selectedIndex
open( 'Grabar.asp?V1=' + frmPaginar2.strFecha.value + '&V2=' + frmPaginar2.lstTarea.options[i].value + '&V3=' + frmPaginar2.strWorkProduct.value + '&V4=' + frmPaginar2.strComentarios.value + '&V5=' + frmPaginar2.strCompleta.value + '&V6=' + dblTiempo, 'principal', null );
}
else
{
alert('Debe Completar los campos ..... ');
}
}

//-->
</script>
<p>&nbsp;</p>
</BODY>
<SCRIPT LANGUAGE="JavaScript">

function ChangeComponente()
{
document.frmPaginar2.hid_Componente_Changed.value = "True";
document.frmPaginar2.submit();
}

function ChangeSubComponente()
{
document.frmPaginar2.hid_SubComponente_Changed.val ue = "True";
document.frmPaginar2.submit();
}
-->
</SCRIPT>
<%
' Cerrar conexiones y Recordset
Set oConn = Nothing
Set rsComponente = Nothing
Set rsSubComponente = Nothing
End Sub
%>

Lo que necesito es que, al entrar me permita cargar el último Componente, Subcomponente y Área que el usuario ingresó.

Atte.
Fernando