Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Pedrex

Erro na Função Salvar e Fechar

Recommended Posts

Bom dia pessoal!!!

 

Estou desenvolvendo uma parte de uma rotina, e não estou conseguindo finalizar de forma correta. Por gentileza se algum dos amigos puderem ajudar com relação aos erros contidos no código, ficaria muito grato. Segue abaixo o input e o código da função que estão marcados pelos asteriscos... A questão é, que deveria ao clicar no submit, chamar a função e por consequência salvar os dados no banco, realizando o updadte nas tabelas. Da forma que esta postado não há nenhuma ação ao clicar no submit, não acontece nada...

 

Obrigado mais uma vez!!!

 

<%
AtualizaFooter = "nao"
PaginaMenuLog = "1102"
%>
<!--#INCLUDE FILE="../Function/header.asp" -->
<%

id_Parametro = filtracaracteres(request("id_parametro"),"[^A-Z0-9\-]")
tipoMostra = request("tipoMostra")

Dim strSql
'Busca nome do Professor
strSql = "Select nomexx_pes from pessoa where codpes_pes = '" & session("codpes") & "' "
set qry = Conexao.execute(strSql)
nm_Professor = qry("nomexx_pes")

strEtapa=mid(id_parametro,1,6)
strCurso=mid(id_parametro,7,3)
strSerie=mid(id_parametro,10,1)
strTurma=mid(id_parametro,11,1)

If len(id_parametro)=22 then
	strCoddis=mid(id_parametro,12,4)
	strCodpro=mid(id_parametro,16,3)
	strFase=mid(id_parametro,19,2) 
	strTpNota=mid(id_parametro,21,2)
End If	
If len(id_parametro)=21 then
	strCoddis=mid(id_parametro,12,3)
	strCodpro=mid(id_parametro,15,3)
	strFase=mid(id_parametro,18,2) 
	strTpNota=mid(id_parametro,20,2)
End If	

'Checa se existe registros de Notas/Faltas liberados para digitação
strSql = "select * from TBADM_NotasDigitadas where etapa='" & strEtapa & "' and "
strSql = strSql & "curso='" & strCurso & "' and serie='" & strSerie & "' and "
strSql = strSql & "turma='" & strTurma & "' and coddisciplina='" & strCoddis & "' and "
strSql = strSql & "codprofessor='" & strCodpro & "' and fase='" & strFase & "' and "
strSql = strSql & "tiponota='" & strTpNota & "' "
set pes = conexao.execute(strSql)
if pes.eof then
	'Busca Nr.de Matrícula/Chamada/Situação nas tabelas QiClass da turma em questão.
	strSql = "select codigo_atu,nrocha_atu,sitalu_atu from alutur inner join "
	strSql = strSql & "turmas on alutur.etapax_atu=turmas.etapax_trm and "
	strSql = strSql & "alutur.cursox_atu=turmas.cursox_trm and alutur.codtur_atu=turmas.codtur_trm "
	strSql = strSql & "where alutur.etapax_atu='" & strEtapa & "' and "
	strSql = strSql & "alutur.cursox_atu = '" & strCurso & "' and turmas.seriex_trm='" & strSerie & "' "
	strSql = strSql & "and turmas.turmax_trm='" & strTurma & "' and "
	strSql = strSql & "alutur.sitalu_atu in (1,2,3,4,5,6) "
	strSql = strSql & "order by alutur.nrocha_atu "
	set alu = conexao.execute(strSql)
	if not alu.eof then
		while not alu.eof
			strcodigo=alu.fields("codigo_atu")
			strNroCha=alu.fields("nrocha_atu")
			strSitAlu=alu.fields("sitalu_atu")
			strStatus="0"
			'Grava liberação para Digitação de Notas/Faltas
			strSql = "insert into TBADM_NotasDigitadas (etapa,curso,serie,turma,coddisciplina,codprofessor,"
			strSql = strSql & "fase,tiponota,matrícula,nrocha,sitalu,status,codpes) values('" & strEtapa & "',"
			strSql = strSql & "'" & strCurso & "','" & strSerie & "','" & strTurma & "',"
			strSql = strSql & "'" & strCoddis & "','" & strCodpro & "','" & strFase & "',"
			strSql = strSql & "'" & strTpNota & "','" & strCodigo & "','" & strNrocha & "','" & strsitalu & "',"
			strSql = strSql & "'" & strStatus & "','" & session("codpes") & "')"
			set gra = conexao.execute(strSql)
			alu.movenext
		wend
	End If
End If
%>
<script>
	window.top.MainFrame.FrameCentral.location.href="<%=Session("ProjetoEndereco")%>/divcentral.asp?idopcao=<%=PaginaMenuLog%>"
</SCRIPT>
<%
'Busca nome dos Alunos para Tela de Digitação de Notas/Faltas
strSql = "select left(pessoa.nomexx_pes,40) as Nome, nrocha as NroCha, "
strSql = strSql & "nota as Nota, falta as Falta, "
strSql = strSql & "matricula as Matricula, curso as curso, serie as serie, "
strSql = strSql & "turma as turma, coddisciplina as CodDis, etapa as Etapa, "
strSql = strSql & "fase as Fase, TipoNota as TpNota "
strSql = strSql & "from TBADM_NotasDigitadas inner join "
strSql = strSql & "alupes on TBADM_NotasDigitadas.matricula=alupes.codigo_ape inner join "
strSql = strSql & "pessoa on alupes.codpes_ape=pessoa.codpes_pes where "
strSql = strSql & "TBADM_NotasDigitadas.etapa='" & strEtapa & "' and "
strSql = strSql & "TBADM_NotasDigitadas.curso='" & strCurso & "' and "
strSql = strSql & "TBADM_NotasDigitadas.serie='" & strSerie & "' and "
strSql = strSql & "TBADM_NotasDigitadas.turma='" & strTurma & "' and "
strSql = strSql & "TBADM_NotasDigitadas.coddisciplina='" & strCoddis & "' and "
strSql = strSql & "TBADM_NotasDigitadas.codprofessor='" & strCodpro & "' and "
strSql = strSql & "TBADM_NotasDigitadas.fase='" & strFase & "' and "
strSql = strSql & "TBADM_NotasDigitadas.tiponota='" & strTpNota & "' and "
strSql = strSql & "alupes.tippes_ape=1 "
strSql = strSql & "order by nrocha "
set pes = conexao.execute(strSql)
Dim strEtapa1(50)
Dim strMatric1(50)
Dim strCurso1(50)
Dim strSerie1(50)
Dim strTurma1(50)
Dim strCodDis1(50)
Dim strFase1(50)
Dim strTpNota1(50)
Dim strNome(50)
Dim strNro(50)
Dim strNota(50)
Dim strFal(50)
Dim strQtdAda
dim intIdx
strQtdAda=0
If not pes.eof then
	intidx=0
	' Verifica se já contém digitação anterior
	while not pes.eof
		intidx=intidx+1
		strEtapa1(intidx)=pes.fields("Etapa")
		strMatric1(intidx)=pes.fields("matricula")
		strCurso1(intidx)=pes.fields("curso")
		strSerie1(intidx)=pes.fields("serie")
		strTurma1(intidx)=pes.fields("turma")
		strCodDis1(intidx)=pes.fields("coddis")
		strFase1(intidx)=pes.fields("fase")
		strTpNota1(intidx)=pes.fields("TpNota")
		strNome(intidx)=pes.fields("nome")
		strNro(intidx) =pes.fields("nrocha")
		if pes.fields("Nota")=NULL then
			strNota(intidx)="00,0"
		else
			strNota(Intidx)=pes.fields("Nota")
		End If
		if pes.fields("Falta")=NULL then
			strFal(intidx)=""
		else
			strFal(Intidx)=pes.fields("Falta")
		End If		
		pes.movenext
	wend
	intctd=intidx
End If%>


<HEAD>

<script>
var a = true;
function formatar(src, mask)
{
var i = src.value.length;
if(i == 1 && src.value > 1) {
   a = false;
if(a==false){
   mask = '#,#'
}
}
var saida = mask.substring(0,1);
var texto = mask.substring(i)
if (texto.substring(0,1) != saida)
{
src.value += texto.substring(0,1);
}
}
</script>

</HEAD>
<div align="left">
<table border="0" cellpadding="1" cellspacing="2" width="600">
   <tr>
	  <td width="60%" valign=top align="left" colspan=1>
	  <font face=Arial size="3"><b>Lançamento de Notas/Faltas</b></font></td>
   </tr>
</table>
</div>
<div align="left">
<table border="0" cellpadding="2" cellspacing="0" width="600" bordercolor="<%=cor_linha%>">
   <tr>
	  <td colspan=20><hr size="1" color="<%= cor_linha %>" width=600></td>
   </tr>
   <tr>
	  <td valign="top" align="left" colspan="20">
		 <table border=0 width=600 bordercolor=black>
			<tr>
			   <td bgcolor=#DADADA width=20% colspan=3> Etapa : <b><%=stretapa%></b></td>
			   <td bgcolor=#DADADA width=60% colspan=12> Curso : <b><%=session("Descrc")%></b></td>
			   <td bgcolor=#DADADA width=20% colspan=5> Série : <b><%=strserie%></b></td>
			</tr>
			<tr>
			   <td bgcolor=#DADADA width=50% colspan=10> Turma : <b><%=strturma%></b></td>
			   <td bgcolor=#DADADA width=50% colspan=10> Trimestre : <b><%=strfase%></b></td>
			</tr>
			<tr>
			   <td bgcolor=#DADADA width=50% colspan=10> Disciplina : <b><%=session("discip")%></b></td>
			   <td bgcolor=#DADADA width=50% colspan=10> Status : <b><%=session("statusd")%></b></td>
			</tr>
		 </table>
	  </td>
   </tr>
   <tr>
	  <td colspan=20><hr size="1" color="<%=session("cor_letra")%>" width=600></td>
   </tr>
   <% 'if snAulas = "S" and folha = 1 then %>
   <tr>
	  <td colspan=20><b>Aulas Dadas ou Dias Letivos</b> :
	  <input type="text" name="AulasDadas" align="right"  size=4 maxlength=5 value="<%=strQtdAda%>"></td>
   </tr>
   <% 'end if %>
   <tr>
	  <td colspan=20>
		 <table border=1 cellpadding="0" bordercolor=black cellspacing="0" width=600>
			<tr>
			   <td width="73%" valign="top" align="left" bgcolor=#DADADA> <b>Nome do Aluno</b></td>
			   <td width="10%" valign="top" align="center" bgcolor=#DADADA> <b>NºCham</b></td>
			   <td width="10%" valign="top" align="center" bgcolor=#DADADA> <b>Nota</b></td>
			   <td width="7%" valign="top" align="center" bgcolor=#DADADA> <b>Faltas</b></td>
			</tr>
			<tr>
			   <%
				intidx=0
				while intidx < intctd
				   intidx=intidx+1%>
				   <td valign="center" align="left"> <b><%=strnome(intidx)%> </td>
				   <td valign="center" align="center"><%=strnro(intidx)%></td>
				   <td valign="center" align="center"> 
				   <input type="numeric" name="Nota" size=5 maxlength=4 OnKeyPress="formatar(this, '##,#')" style="<%=session("estilo_textbox")%>" style="text-align:right" value="<%=strNota(intidx)%>"></td>
				   <td valign="center" align="center"> 
				   <input type="numeric" name="Falta"  size=3 maxlength=2 style="<%=session("estilo_textbox")%>" value="<%=strFal(intidx)%>"></td>
			</tr>
			<%wend%>
		 </table>
	  </td>
   </tr>
   <tr>
	  <td colspan=20>
		 <table border=0 cellpadding="0" bordercolor=black cellspacing="0" width=600>
			 <tr>
				<td>  <br> <br><br> <b><%=nm_Professor%></td>
				<td align="center" colspan=5>
				<input type="button" size="1" value="Imprimir" name="Imprimir" style="<%= Botao_Normal %>"></td>
				<td align="center" colspan=5>
				<input type="button" size="1" value="Fechar sem Salvar" name="Fechar" style="<%= Botao_Normal %>" onclick="window.close()"></td>
********************************************************************************
***********************************************
A parte do input que esta chamando a função que precisa ser avaliada.
				
																<td align="center" colspan=10>
				<input type="submit" size="1" value="Salvar e Fechar" name="Salvar" style="<%= Botao_Normal %>" onclick="Salvar()"></td>
********************************************************************************
***********************************************
			</tr>
			<tr>
				<td colspan=3> </td>
			 </tr>
		 </table>
	  </td>
   </tr>
   <tr>
	  <td width=5%><td width=5%><td width=5%><td width=5%><td width=5%>
	  <td width=5%><td width=5%><td width=5%><td width=5%><td width=5%>
	  <td width=5%><td width=5%><td width=5%><td width=5%><td width=5%>
	  <td width=5%><td width=5%><td width=5%><td width=5%><td width=5%>
   </tr>
</table>
</div>

<!--#INCLUDE FILE="../function/VBS/PCase.Vbs" -->
<!--#INCLUDE FILE="../function/VBS/ProcuraAspas.Vbs" -->
<!--#INCLUDE FILE="../function/VBS/TiraLetras.Vbs" -->
<!--#INCLUDE FILE="../function/VBS/ValidaData.Vbs" -->
<!--#INCLUDE FILE="../function/VBS/TestaData.Vbs" -->
<!--#INCLUDE FILE="../function/VBS/Numerico.Vbs" -->

<script language=VbScript>
function VerNota(valor)
	if len(valor)=0 then valor = 0
	valor = Numerico(valor,1)
	valor = cdbl(TiraLetras(valor))
	if valor > 100 then 
		alert("Nota Inválida")
		valor = 0
	end if
	VerNota = Numerico(valor/10,1)
end function
</script>%>

********************************************************************************
***********************************************
Função salvar() --> Salva os registros de notas no banco e fecha atela (Gostaria de saber se tem algo errado neste código!!!)
********************************************************************************
***********************************************
																																																
<script language=VbScript>																																						
function Salvar()																																										 
	intidx=0																																					   
	while intidx < intctd
		intidx=intidx+1
		strsql="update TBADM_NotasDigitadas set nota='" & strnota(intidx) & "', falta='" & strfal(intidx) & "' "
		strsql=strsql & "where etapa='" & strEtapa1(intidx) & "' and matricula='" & strmatric1(intidx) & "' and "
		strsql=strsql & "curso='" & strcurso1(intidx) & "' and serie='" & strserie1(intidx) & "' and "
		strsql=strsql & "turma='" & strturma1(intidx) & "' and coddisciplina='" & strcoddis1(intidx) & "' and "
		strsql=strsql & "fase='" & strfase1(intidx) & "' and TipoNota='" & strTpNota1(intidx) & "' "
		set grav = conexao.execute(strSql)
	Wend
end function
</script>

********************************************************************************
***********************************************
Fim da função
********************************************************************************
***********************************************
</body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

aparece algum errro?

Compartilhar este post


Link para o post
Compartilhar em outros sites

no onclick você esta chamando o window.close() !!

ele gera algum erro, se sim poste o numero da linha com erro

Compartilhar este post


Link para o post
Compartilhar em outros sites

Não Xanburzum o (onclick que estou tendo problema, é quando chamo a função Salvar()) Quando clico no botão Salvar e fechar não acontece nada, não aparece nenhum erro também segue o input e a função separados:

 

********************************************************************************
***********************************************
A parte do input que esta chamando a função que precisa ser avaliada.
				
<td align="center" colspan=10>
<input type="submit" size="1" value="Salvar e Fechar" name="Salvar" style="<%= Botao_Normal %>" onclick="Salvar()"></td>
********************************************************************************
***********************************************

********************************************************************************
***********************************************
Função salvar() --> Salva os registros de notas no banco e fecha atela (Gostaria de saber se tem algo errado neste código!!!)
********************************************************************************
***********************************************
																																																
<script language=VbScript>																																						
function Salvar()																																										 
	intidx=0																																					   
	while intidx < intctd
		intidx=intidx+1
		strsql="update TBADM_NotasDigitadas set nota='" & strnota(intidx) & "', falta='" & strfal(intidx) & "' "
		strsql=strsql & "where etapa='" & strEtapa1(intidx) & "' and matricula='" & strmatric1(intidx) & "' and "
		strsql=strsql & "curso='" & strcurso1(intidx) & "' and serie='" & strserie1(intidx) & "' and "
		strsql=strsql & "turma='" & strturma1(intidx) & "' and coddisciplina='" & strcoddis1(intidx) & "' and "
		strsql=strsql & "fase='" & strfase1(intidx) & "' and TipoNota='" & strTpNota1(intidx) & "' "
		set grav = conexao.execute(strSql)
	Wend
end function
</script>

********************************************************************************
***********************************************
Fim da função
********************************************************************************
***********************************************

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.