Ola pessoal tenho uma duvida que queria a ajuda de você ok. Vou colocar um codigo que fiz de um sistema bom ele faz o seguinte quando abro a base de dados access o sistema traz uma tela com informação de rota de tecnico. Bom é o seguinte coloquei num loop um <select> para que o usuario mude o tecnico e atualize na tabela, o que eu quero é o seguinte quando ele der o jumpmenu ele volte com o tecnico selecionado assim sabremos em qual paramos entendem? A via o codigo:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Atribuicao de rotas</title>
<link href="css/estilos.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">
<!--
<!--
//-->
function AbrirJanela(janela,Pos1,Pos2,Pos3,Pos4)
{
window.open(janela,"SESSAO","left="+Pos1+",top="+Pos2+",width="+Pos3+",height="+Pos4)
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
</script>
<script language="javascript" src="jsp/ajax.js"></script>
</head>
<body>
<!--#include file="strCon.asp"-->
<%
dim Conexao, strSql, strData
call abreConexao()
if Request.QueryString("atc") = "New" then
strNoOs = Request.QueryString("NoOs")
stridTecnico = Request.QueryString("idTecnico")
data = date
dia = datepart ("d", data)
mes = datepart ("m", data)
ano = datepart ("yyyy", data)
strdata = (mes&"/"&dia&"/"&ano)
strSql = "Select * from tabDTH where DatCompromisso = #" & strData & "# "
strSql = strSql & " and NoOs = " & Request.QueryString("NoOs") & " order by idEmpresa"
set rsRota = Conexao.Execute(StrSql)
if not rsRota.Eof then
strSql = "Update tabDth Set "
strSql = StrSql & " idTecnico=" & strIdTecnico
strSql = strSql & " where idDth=" & rsRota("idDth")
Conexao.Execute(StrSql)
end if
end if
data = date
dia = datepart ("d", data)
mes = datepart ("m", data)
ano = datepart ("yyyy", data)
strdata = (mes&"/"&dia&"/"&ano)
strSql = "Select * from tabDTH where DatCompromisso = #" & strData & "# order by idEmpresa"
set rsRota = Conexao.Execute(StrSql)
status = "Rota Geral "
%>
<form action="atribuidanosmateriais.asp?atc=New&NoOs=<%=rsRota("NoOs")%>&idEmpresa=<%=rsRota("idEmpresa")%>&idServico=<%=rsRota("idServico")%>" method="post" name="frmDanos" id="frmDanos">
<table width="700" height="450" border="0" align="center" cellpadding="0" cellspacing="0" class="Tabela">
<tr>
<td width="20" class="aviso"> </td>
<td width="678" class="aviso"> </td>
</tr>
<tr>
<td> </td>
<td class="SubTitulo">Ola<%=Session("Usuario")%> você está em <strong>Intranet DTH 25</strong> <strong>» Atribuição » <%=status%></strong></td>
</tr>
<tr>
<td> </td>
<td class="Texto"> </td>
</tr>
<tr>
<td height="5%"> </td>
<td class="Titulo"><%=Session("Erros")%></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td height="370" colspan="2" valign="top"><table width="700" border="0" align="center" cellpadding="0" cellspacing="1" class="Tabela1">
<%
Bg="#FFFFFF"
%>
<tr bgcolor="<%=Bg%>">
<td width="70" align="center" class="SubTitulo">No. Os</td>
<td width="78" align="center" class="SubTitulo">CEP</td>
<td width="55" align="center" class="SubTitulo">Serviço</td>
<td width="70" align="center" class="SubTitulo">Tipo Os </td>
<td width="55" align="center" class="SubTitulo">Periodo</td>
<td width="90" align="center" class="SubTitulo"><p>BAIRRO</p> </td>
<td width="60" align="center" class="SubTitulo">T. RES. </td>
<td width="50" align="center" class="SubTitulo">Status</td>
<td width="50" align="center" class="SubTitulo">Pontos</td>
<td width="100" align="center" class="SubTitulo">Tecnicos</td>
</tr>
<tr>
<td colspan="11" valign="top"><div>
<table width="99%" border="0" align="left" cellpadding="1" cellspacing="1" class="Tabela1" style="margin-left:0">
<%
if not rsRota.Eof then
TotalOs = 0
TotalAB = 0
TotalAC = 0
TotalCA = 0
TotalNF = 0
TotalRP = 0
strSql = "Select * from tabEmpresa where Empresa = '" & rsRota("idEmpresa") & "'"
'R'esponse.Write(strsql)
'response.End()
strIdEmpresa = rsRota("idEmpresa")
strNoOS = rsRota("NoOs")
strPrim = 0
TotalOs = 0
TotalAB = 0
TotalAC = 0
TotalCA = 0
TotalNF = 0
TotalRP = 0
strSql = "Select * from tabEmpresa where Empresa = '" & strIdEmpresa & "'"
set rsEmpresa = Conexao.Execute(strSql)
if rsEmpresa.eof then strEmpresa = "não Consta na tabela de empresa" else strEmpresa = rsEmpresa("Responsavel")
do while Not rsRota.EOF
strSql = "Select * from tabCliente where NoOs = '" & rsRota("NoOs") & "' order by NoOs"
set rsCliente = Conexao.Execute(strSql)
if rsCliente.eof then
strCep = ""
else
strCep = rsCliente("Cep")
strBairro = left(rsCliente("Bairro"),22)
strTResid = left(rsCliente("TipoResidencia"),8)
strPeriodo= rsRota("Periodo")
end if
strSql = "Select * from tabTipoOs where idTipoOs=" & Cint(rsRota("idTipoOs"))
set rsTipoOs = Conexao.Execute(strSql)
if rsTipoOs.Eof then strTipoOs = "" else strTipoOs = Left(rsTipoOs("Descricao"),25)
strSql = "Select * from tabEstados where IdEstado = " & rsCliente("idEstado")
set rsEstado = Conexao.Execute(strSql)
if rsEstado.Eof then strEstado = "" else strEstado = rsEstado("Estado")
strSql = "Select * from tabCidades where idCidade = " & rsCliente("idCidade")
set rsCidade = Conexao.Execute(StrSql)
if rsCidade.Eof then strCidade = "" else strCidade = rsCidade("Cidade")
strIdServico = rsRota("idServico")
if strNoOs <> rsRota("NoOs") and strPrim = 0 then
i=i+1
if Bg="#FFFFFF" then
Bg="#5082B4"
else
Bg="#FFFFFF"
end if
NoOs =rsRota("NoOs")
%>
<tr bgcolor="<%=Bg%>">
<td width="64" height="10" class="SubTitulo"><%=NoOs%></td>
<td width="73" align="left" class="SubTitulo"><%=strCep%></td>
<td width="60" align="center" class="SubTitulo"><%=strIdServico%></td>
<td width="64" align="center" class="SubTitulo"><%=strTipoOs%></td>
<td width="55" align="center" class="SubTitulo"><%=strPeriodo%></td>
<td width="91" align="center" class="SubTitulo"><%=strBairro%></td>
<td width="55" align="center" class="SubTitulo"><%=strTResid%></td>
<td width="48" align="center" class="SubTitulo"><%=rsRota("Status")%></td>
<td width="60" align="center" class="SubTitulo"><%=rsRota("QtdPontos")%></td>
<td width="80" align="center" class="SubTitulo">
<select name="mnuTecnico" style="width:80" class="campo" id="mnuEmpresa" onChange="MM_jumpMenu('this',this,0)">
<option>Selecione</option>
<%
strSql = "Select * from tabTecnicos order by Tecnico "
set rsTecnico = Conexao.Execute(strSql)
if not rsTecnico.Eof then
while not rsTecnico.Eof
%>
<option value="atribuidanostecnicos.asp?atc=New&NoOs=<%=rsRota("NoOs")%>&idtecnico=<%=rsTecnico("idTecnico")%>"<%if Request.QueryString("idTecnico") = rsTecnico("idTecnico") then%><%if Request.Form("mnuTecnico") = rsTecnico("Tecnico") then%>selected<%end if%><%end if%>><%=rsTecnico("Tecnico")%></option>
<%
rsTecnico.MoveNext
wEnd
end if
%>
</select></td>
</tr>
<%
TotalOs = 0
TotalAB = 0
TotalAC = 0
TotalCA = 0
TotalNF = 0
TotalRP = 0
strNoOS = rsRota("NoOs")
strPeriodo=rsRota("periodo")
strInfoAdc=rsRota("InfoAdcionais")
strIdEmpresa = rsRota("idEmpresa")
strDanos = rsRota("Danos")
strSql = "Select * from tabEmpresa where Empresa = '" & strIdEmpresa & "'"
set rsEmpresa = Conexao.Execute(strSql)
if rsEmpresa.eof then strEmpresa = "não Consta na tabela de empresa" else strEmpresa = rsEmpresa("Responsavel")
end if
TotalOs = TotalOs + 1
if rsRota("Status") = "AB" then TotalAB = TotalAb + 1
if rsRota("Status") = "AC" then TotalAC = TotalAC + 1
if rsRota("Status") = "CA" then TotalCA = TotalCA + 1
if rsRota("Status") = "NF" then TotalNF = TotalNF + 1
if rsRota("Status") = "RP" then TotalRP = TotalRP + 1
rsRota.MoveNext
loop
strSql = "Select * from tabEmpresa where Empresa = '" & strIdEmpresa & "'"
set rsEmpresa = Conexao.Execute(strSql)
if rsEmpresa.eof then strEmpresa = "não Consta na tabela de empresa" else strEmpresa = rsEmpresa("Responsavel")
i=i+1
if Bg="#FFFFFF" then
Bg="#5082B4"
else
Bg="#FFFFFF"
end if
%>
<%
end if
%>
</table>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top"> </td>
</tr>
</table>
</form>
</body>
</html>
<%
call fechaConexao()
set conexao = nothing
set rsRota = nothing
set empresa = nothing
%>
Pergunta
Clauido José
Ola pessoal tenho uma duvida que queria a ajuda de você ok. Vou colocar um codigo que fiz de um sistema bom ele faz o seguinte quando abro a base de dados access o sistema traz uma tela com informação de rota de tecnico. Bom é o seguinte coloquei num loop um <select> para que o usuario mude o tecnico e atualize na tabela, o que eu quero é o seguinte quando ele der o jumpmenu ele volte com o tecnico selecionado assim sabremos em qual paramos entendem? A via o codigo:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Atribuicao de rotas</title> <link href="css/estilos.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript"> <!-- <!-- //--> function AbrirJanela(janela,Pos1,Pos2,Pos3,Pos4) { window.open(janela,"SESSAO","left="+Pos1+",top="+Pos2+",width="+Pos3+",height="+Pos4) } function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } </script> <script language="javascript" src="jsp/ajax.js"></script> </head> <body> <!--#include file="strCon.asp"--> <% dim Conexao, strSql, strData call abreConexao() if Request.QueryString("atc") = "New" then strNoOs = Request.QueryString("NoOs") stridTecnico = Request.QueryString("idTecnico") data = date dia = datepart ("d", data) mes = datepart ("m", data) ano = datepart ("yyyy", data) strdata = (mes&"/"&dia&"/"&ano) strSql = "Select * from tabDTH where DatCompromisso = #" & strData & "# " strSql = strSql & " and NoOs = " & Request.QueryString("NoOs") & " order by idEmpresa" set rsRota = Conexao.Execute(StrSql) if not rsRota.Eof then strSql = "Update tabDth Set " strSql = StrSql & " idTecnico=" & strIdTecnico strSql = strSql & " where idDth=" & rsRota("idDth") Conexao.Execute(StrSql) end if end if data = date dia = datepart ("d", data) mes = datepart ("m", data) ano = datepart ("yyyy", data) strdata = (mes&"/"&dia&"/"&ano) strSql = "Select * from tabDTH where DatCompromisso = #" & strData & "# order by idEmpresa" set rsRota = Conexao.Execute(StrSql) status = "Rota Geral " %> <form action="atribuidanosmateriais.asp?atc=New&NoOs=<%=rsRota("NoOs")%>&idEmpresa=<%=rsRota("idEmpresa")%>&idServico=<%=rsRota("idServico")%>" method="post" name="frmDanos" id="frmDanos"> <table width="700" height="450" border="0" align="center" cellpadding="0" cellspacing="0" class="Tabela"> <tr> <td width="20" class="aviso"> </td> <td width="678" class="aviso"> </td> </tr> <tr> <td> </td> <td class="SubTitulo">Ola<%=Session("Usuario")%> você está em <strong>Intranet DTH 25</strong> <strong>» Atribuição » <%=status%></strong></td> </tr> <tr> <td> </td> <td class="Texto"> </td> </tr> <tr> <td height="5%"> </td> <td class="Titulo"><%=Session("Erros")%></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td height="370" colspan="2" valign="top"><table width="700" border="0" align="center" cellpadding="0" cellspacing="1" class="Tabela1"> <% Bg="#FFFFFF" %> <tr bgcolor="<%=Bg%>"> <td width="70" align="center" class="SubTitulo">No. Os</td> <td width="78" align="center" class="SubTitulo">CEP</td> <td width="55" align="center" class="SubTitulo">Serviço</td> <td width="70" align="center" class="SubTitulo">Tipo Os </td> <td width="55" align="center" class="SubTitulo">Periodo</td> <td width="90" align="center" class="SubTitulo"><p>BAIRRO</p> </td> <td width="60" align="center" class="SubTitulo">T. RES. </td> <td width="50" align="center" class="SubTitulo">Status</td> <td width="50" align="center" class="SubTitulo">Pontos</td> <td width="100" align="center" class="SubTitulo">Tecnicos</td> </tr> <tr> <td colspan="11" valign="top"><div> <table width="99%" border="0" align="left" cellpadding="1" cellspacing="1" class="Tabela1" style="margin-left:0"> <% if not rsRota.Eof then TotalOs = 0 TotalAB = 0 TotalAC = 0 TotalCA = 0 TotalNF = 0 TotalRP = 0 strSql = "Select * from tabEmpresa where Empresa = '" & rsRota("idEmpresa") & "'" 'R'esponse.Write(strsql) 'response.End() strIdEmpresa = rsRota("idEmpresa") strNoOS = rsRota("NoOs") strPrim = 0 TotalOs = 0 TotalAB = 0 TotalAC = 0 TotalCA = 0 TotalNF = 0 TotalRP = 0 strSql = "Select * from tabEmpresa where Empresa = '" & strIdEmpresa & "'" set rsEmpresa = Conexao.Execute(strSql) if rsEmpresa.eof then strEmpresa = "não Consta na tabela de empresa" else strEmpresa = rsEmpresa("Responsavel") do while Not rsRota.EOF strSql = "Select * from tabCliente where NoOs = '" & rsRota("NoOs") & "' order by NoOs" set rsCliente = Conexao.Execute(strSql) if rsCliente.eof then strCep = "" else strCep = rsCliente("Cep") strBairro = left(rsCliente("Bairro"),22) strTResid = left(rsCliente("TipoResidencia"),8) strPeriodo= rsRota("Periodo") end if strSql = "Select * from tabTipoOs where idTipoOs=" & Cint(rsRota("idTipoOs")) set rsTipoOs = Conexao.Execute(strSql) if rsTipoOs.Eof then strTipoOs = "" else strTipoOs = Left(rsTipoOs("Descricao"),25) strSql = "Select * from tabEstados where IdEstado = " & rsCliente("idEstado") set rsEstado = Conexao.Execute(strSql) if rsEstado.Eof then strEstado = "" else strEstado = rsEstado("Estado") strSql = "Select * from tabCidades where idCidade = " & rsCliente("idCidade") set rsCidade = Conexao.Execute(StrSql) if rsCidade.Eof then strCidade = "" else strCidade = rsCidade("Cidade") strIdServico = rsRota("idServico") if strNoOs <> rsRota("NoOs") and strPrim = 0 then i=i+1 if Bg="#FFFFFF" then Bg="#5082B4" else Bg="#FFFFFF" end if NoOs =rsRota("NoOs") %> <tr bgcolor="<%=Bg%>"> <td width="64" height="10" class="SubTitulo"><%=NoOs%></td> <td width="73" align="left" class="SubTitulo"><%=strCep%></td> <td width="60" align="center" class="SubTitulo"><%=strIdServico%></td> <td width="64" align="center" class="SubTitulo"><%=strTipoOs%></td> <td width="55" align="center" class="SubTitulo"><%=strPeriodo%></td> <td width="91" align="center" class="SubTitulo"><%=strBairro%></td> <td width="55" align="center" class="SubTitulo"><%=strTResid%></td> <td width="48" align="center" class="SubTitulo"><%=rsRota("Status")%></td> <td width="60" align="center" class="SubTitulo"><%=rsRota("QtdPontos")%></td> <td width="80" align="center" class="SubTitulo"> <select name="mnuTecnico" style="width:80" class="campo" id="mnuEmpresa" onChange="MM_jumpMenu('this',this,0)"> <option>Selecione</option> <% strSql = "Select * from tabTecnicos order by Tecnico " set rsTecnico = Conexao.Execute(strSql) if not rsTecnico.Eof then while not rsTecnico.Eof %> <option value="atribuidanostecnicos.asp?atc=New&NoOs=<%=rsRota("NoOs")%>&idtecnico=<%=rsTecnico("idTecnico")%>"<%if Request.QueryString("idTecnico") = rsTecnico("idTecnico") then%><%if Request.Form("mnuTecnico") = rsTecnico("Tecnico") then%>selected<%end if%><%end if%>><%=rsTecnico("Tecnico")%></option> <% rsTecnico.MoveNext wEnd end if %> </select></td> </tr> <% TotalOs = 0 TotalAB = 0 TotalAC = 0 TotalCA = 0 TotalNF = 0 TotalRP = 0 strNoOS = rsRota("NoOs") strPeriodo=rsRota("periodo") strInfoAdc=rsRota("InfoAdcionais") strIdEmpresa = rsRota("idEmpresa") strDanos = rsRota("Danos") strSql = "Select * from tabEmpresa where Empresa = '" & strIdEmpresa & "'" set rsEmpresa = Conexao.Execute(strSql) if rsEmpresa.eof then strEmpresa = "não Consta na tabela de empresa" else strEmpresa = rsEmpresa("Responsavel") end if TotalOs = TotalOs + 1 if rsRota("Status") = "AB" then TotalAB = TotalAb + 1 if rsRota("Status") = "AC" then TotalAC = TotalAC + 1 if rsRota("Status") = "CA" then TotalCA = TotalCA + 1 if rsRota("Status") = "NF" then TotalNF = TotalNF + 1 if rsRota("Status") = "RP" then TotalRP = TotalRP + 1 rsRota.MoveNext loop strSql = "Select * from tabEmpresa where Empresa = '" & strIdEmpresa & "'" set rsEmpresa = Conexao.Execute(strSql) if rsEmpresa.eof then strEmpresa = "não Consta na tabela de empresa" else strEmpresa = rsEmpresa("Responsavel") i=i+1 if Bg="#FFFFFF" then Bg="#5082B4" else Bg="#FFFFFF" end if %> <% end if %> </table> </div></td> </tr> </table></td> </tr> <tr> <td colspan="2" valign="top"> </td> </tr> </table> </form> </body> </html> <% call fechaConexao() set conexao = nothing set rsRota = nothing set empresa = nothing %>Editado por Clauido JoséLink para o comentário
Compartilhar em outros sites
10 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.