<% '------------------------- Acao = Request.Form("Acao") sData = Request.Form("txtData") sSerie = Request.Form("cboSerie") sTurma = Request.Form("cboTurma") CodOco = Request.Form("cboOCO") CodDiscip = Request.Form("cboDiscip") sTrim = Request.Form("cboTrim") sDescDiscip = Request.Form("hDescDiscip") sMsg = "" '------------------------- If Acao = "2" Then 'Salva Dados '--nome dos campos sNota = "NOTA0" & sTrim sRec = "REC0" & sTrim sFalta = "FALTA0" & sTrim On Error Resume Next oBD.BeginTrans For Each item In Request.Form if Left(item, 4) = "RGM_" then 'varre 1º o hidden p/ pegar o RGM aCampos = Split(item, "_") sRGM = aCampos(1) sCampo = "txt_" & sRGM & "_Not" Nota = Replace(trim(Request.Form(sCampo)), ",", ".") sCampo = "txt_" & sRGM & "_Fal" Falta = Replace(trim(Request.Form(sCampo)), ",", ".") sCampo = "txt_" & sRGM & "_Rec" Rec = Replace(trim(Request.Form(sCampo)), ",", ".") sSQL = "Select count(*) from NOTAS Where RGM = '" & sRGM & "' and CODDISCIPLINA = '" & CodDiscip & "'" Set rsNota = oBD.Execute(sSQL) if CInt(rsNota(0)) = 0 then sSQL = "Insert Into NOTAS(ANO,RGM,CODDISCIPLINA," & sNota & "," & sRec & "," & sFalta & ",DISCIPLINA) Values ('" & year(now) & "','" & sRGM & "','" & CodDiscip & "'," & Nota & "," & Rec & "," & Falta & ",'" & sDescDiscip & "')" oBD.Execute(sSQL) 'Response.Write sSQL & "
" else sSQL = "Insert Into NOTASLOG(RGM,CODDISCIP,NOTA01,REC01,FALTA01,NOTA02,REC02,FALTA02,NOTA03,REC03,FALTA03,QUEM,TIPO) " & _ "select RGM,CODDISCIPLINA,NOTA01,REC01,FALTA01,NOTA02,REC02,FALTA02,NOTA03,REC03,FALTA03,'" & Session("USUARIO") & "','1' from NOTAS Where RGM = '" & sRGM & "' and CODDISCIPLINA = '" & CodDiscip & "'" 'Response.Write sSQL : Response.End() 'oBD.Execute(sSQL) 'Response.Write sSQL & "
" sSQL = "Update NOTAS Set " & sNota & "=" & Nota & "," & sRec & "=" & Rec& "," & sFalta & "=" & Falta & " Where RGM = '" & sRGM & "' and CODDISCIPLINA = '" & CodDiscip & "'" 'Response.Write sSQL & "
" oBD.Execute(sSQL) sSQL = "Insert into NOTASLOG(RGM,CODDISCIP,NOTA01,REC01,FALTA01,NOTA02,REC02,FALTA02,NOTA03,REC03,FALTA03,QUEM,TIPO) " & _ "select RGM,CODDISCIPLINA,NOTA01,REC01,FALTA01,NOTA02,REC02,FALTA02,NOTA03,REC03,FALTA03,'" & Session("USUARIO") & "','2' from NOTAS Where RGM = '" & sRGM & "' and CODDISCIPLINA = '" & CodDiscip & "'" 'Response.Write sSQL & "
" 'oBD.Execute(sSQL) end if if rsNota.State = 1 then rsNota.Close 'Response.Write "Insert into NOTAS values (" & sRGM & "," & Nota & "," & Rec & ")
" end if Next '---------------------- if err.number = 0 then sMsg = "Dados Gravados com Sucesso" oBD.CommitTrans else sMsg = "ERRO - " & err.number & " - " & Replace(err.Description, "'", "") oBD.RollbackTrans end if Acao = "" ElseIf Acao = "3" Then 'Exclue Dados 'sQuery = "Delete from TIPOCORRENCIA Where CODIGO = " & CodOco 'Response.Write(sQuery) : Response.End() 'oBD.Execute sQuery if err.number = 0 then sMsg = "Registro Excluido com Sucesso" else sMsg = "ERRO - " & err.number & " - " & Replace(err.Description, "'", "") end if Acao = "" ElseIf Acao = "4" Then 'Cancelou -> apenas ZERA Acao = "" End If %> <% if sMsg <> "" then Response.Write("") %> <% if Acao = "1" then '----------------------------- Set rsMat = oBD.Execute("Select distinct CODDISCIPLINA,MATREDMAT,MATDESMAT From NOTAS,ADEDMAT Where RGM in (select RGM From ALUNOS where SERIE = '" &sSerie & "' and TURMA = '" & sTURMA & "') and MATCODMAT=CODDISCIPLINA order by CODDISCIPLINA") 'response.Write("Select MATDESMAT From ADEDMAT Where MATDESMAT = '" & CodDiscip & "'") ': Response.End() dim aCodMat(50) : dim aRedMat(50) : dim aDesMat(50) : dim iTot : iTot = 0 do while not rsMat.eof iTot = iTot + 1 aCodMat(iTot) = rsMat("CODDISCIPLINA") aRedMat(iTot) = rsMat("MATREDMAT") aDesMat(iTot) = rsMat("MATDESMAT") rsMat.MoveNext : loop if rsMat.State = 1 then rsMat.Close : set rsMat = Nothing 'Response.End() sDescDiscip = "" '----------------------------- sSQL = "Select RGM,NOME,NUMERO,res_ata From ALUNOS Where SERIE = '" & sSerie & "' And TURMA = '" & sTURMA & "' Order By NUMERO" 'Response.Write sSQL : Response.End() Set rsAlunos = oBD.Execute(sSQL) If Not rsAlunos.Eof Then%>
" method="post" name="frm" id="frm"> <% for N = 1 to iTot%> <%next%> <% dim Nota(4) : dim Exame : dim iApr'qtd aprovado Do While Not rsAlunos.Eof sResAta = "" if not isNull(rsAlunos("res_ata")) then sResAta = UCase(rsAlunos("res_ata")) iApr = 0 sRGM = rsAlunos("RGM") 'if not rsNota.eof then 'If IsNull(rsNota(sNota)) Then nota=0 else Nota = CSng(rsNota(sNota)) 'If IsNull(rsNota(sfalta)) Then falta=0 else Falta = CSng(rsNota(sFalta)) 'If IsNull(rsNota(srec)) Then rec=0 else Rec = CSng(rsNota(sRec)) 'end if 'if rsNota.state = 1 then rsNota.Close %> <%for N = 1 to iTot sSQL = "Select NOTA01,NOTA02,NOTA03,NOTA04,EXAME from NOTAS Where RGM = '" & sRGM & "' and CODDISCIPLINA = '" & aCodMat(N) & "'" set rsNota = oBD.Execute(sSQL) if not rsNota.eof then for NN = 1 to 4 Nota(NN) = 0 if not IsNull(rsNota("NOTA0" & NN)) then Nota(NN) = rsNota("NOTA0" & NN) next MediaFinal = (Nota(1)+Nota(2)+Nota(3)+Nota(4))/4 Exame = 0 If not IsNull(rsNota("EXAME")) then if rsNota("EXAME") > 0 then Exame = rsNota("EXAME") end if if Exame > 0 then MediaFinal = (((Nota(1)+Nota(2)+Nota(3)+Nota(4))/4) +exame)/2 if MediaFinal > 4.7 then iApr = iApr + 1 else if MediaFinal > 5.7 then iApr = iApr + 1 end if %> <%else'se nao achou nota mostra traco%> <%end if'if not rsnota.eof next if iApr = iTot then sRes = "A" else sRes = "R"'se qtd apr = totDiscip entao res=Aprovado senao Reprovado if sResAta <> "" then sRes = sResAta%> <% rsAlunos.MoveNext Loop rsAlunos.Close : Set rsAlunos = Nothing %>
Data: <%= Now %> Série: <%= sSerie %> Turma: <%= sTurma %> ATA RESULTADO FINAL
<%=aRedMat(N)%>
<%= rsAlunos("RGM") %> <%= rsAlunos("NUMERO") & " - " & rsAlunos("NOME") %><%=FormatNumber(MediaFinal,1)%>-<%=sRes%>
<%for N = 1 to iTot%> <%Next%>
<%=aRedMat(N) & " - " & aDesMat(N)%>

<% else response.write "
Nao foi encontrado registros. Reveja os dados e tente novamente.
" End If 'if not rsAlunos.Eof End If 'Acao = 1 %> <% if Acao = "" then %>
" name="frm">
Informe os dados p/ visualizar ata resultado final:
Série:
Turma:
<% End If 'Acao = "" %> <% if oBD.State=1 then oBD.Close Set oBD = Nothing 'if oBD.State=1 then oBD.Close 'Set Banco = Nothing %>