<% 'Response.Write now Set oBDOco = Server.CreateObject("ADODB.Connection") oBDOco.ConnectionString = sCnnOco : oBDOco.Open '------------------------- Acao = Request.Form("Acao") sData = Request.Form("txtData") sSerie = Request.Form("cboSerie") sTurma = Request.Form("cboTurma") CodOco = Request.Form("cboOCO") CodDiscip = Request.Form("cboDiscip") sMsg = "" '------------------------- If Acao = "2" Then 'Salva Dados On Error Resume Next sDataQry = Split(sData, "/") Set rsAlunos = oBD.Execute("Select RGM From ALUNOS Where SERIE = '" & sSerie & "' And TURMA = '" & sTURMA & "'") Do While Not rsAlunos.Eof sQuery = "Delete from OCORREN Where DATA = '" & _ Right(sDataQry(2),2) & "/" & sDataQry(1) & "/" & sDataQry(0) & "' And RGM = '" & rsAlunos("RGM") & "' And COD_DISCIP = '" & _ CodDiscip & "' And COD_DESCRI = '" & CODOCO & "'" oBD.Execute(sQuery) rsAlunos.MoveNext Loop sDescDiscip = "" if CodDiscip <> "000" then Set rsDiscip = oBD.Execute("Select MATDESMAT From ADEDMAT Where MATCODMAT = '" & CodDiscip & "'") if not rsDiscip.Eof Then sDescDiscip = rsDiscip(0) if rsDiscip.State = 1 then rsDiscip.Close Set rsDiscip = Nothing end if Set rsOCOR = oBDOco.Execute("Select DESCRICAO From TIPOCORRENCIA Where CODIGO = " & CodOco) sDescOco = "" if not rsOCOR.Eof Then sDescOco = rsOCOR(0) if rsOCOR.State = 1 then rsOCOR.Close Set rsOCOR = Nothing sAno = Year(date) For Each item In Request.Form if Left(item, 4) = "chk_" then if not isEmpty(Request.Form("Obs" & Right(item, 5))) then sDesc = sDataQry(0) & "/" & sDataQry(1) & "/" & sDataQry(2) & " - " & sDescDiscip & " - " & Trim(Replace(Request.Form("Obs" & Right(item, 5)), chr(13), "
")) else sDesc = sDataQry(0) & "/" & sDataQry(1) & "/" & sDataQry(2) & " - " & sDescDiscip & " - " & sDescOco end if sSQL = "Insert Into OCORREN(RGM,DATA,COD_DISCIP,COD_DESCRI,DESCRI,ANO,MES) Values ('" & Right(item, 5) & "','" & _ Right(sDataQry(2),2) & "/" & sDataQry(1) & "/" & sDataQry(0) & "','" & CodDiscip & "','" & CodOco & "','" & sDesc & "','" & sAno & "','" & sDataQry(1) & "')" 'Response.Write sSQL oBD.Execute(sSQL) '& " - " & Request.form(item) & "
") end if Next if err.number = 0 then sMsg = "Dados Gravados com Sucesso" else sMsg = "ERRO - " & err.number & " - " & Replace(err.Description, "'", "") 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 rsOCOR = oBDOco.Execute("Select DESCRICAO,DISCIP,EHDIGITAVEL From TIPOCORRENCIA Where CODIGO = " & CodOco) sDescOco = "" if not rsOCOR.Eof Then bEhDigitavel = false 'Response.Write "ehdigitavel = " & rsOCOR(1) if CBool(rsOCOR(2)) then bEhDigitavel = true sDescOco = rsOCOR(0) if rsOCOR(1) = "N" then CodDiscip = "000" end if if rsOCOR.State = 1 then rsOCOR.Close Set rsOCOR = Nothing '----------------------------- Set rsDiscip = oBD.Execute("Select MATDESMAT From ADEDMAT Where MATCODMAT = '" & CodDiscip & "'") 'response.Write("Select MATDESMAT From ADEDMAT Where MATDESMAT = '" & CodDiscip & "'") ': Response.End() sDescDiscip = "" if not rsDiscip.Eof Then sDescDiscip = rsDiscip(0) if rsDiscip.State = 1 then rsDiscip.Close Set rsDiscip = Nothing '----------------------------- sSQL = "Select RGM,NOME,NUMERO From ALUNOS Where SERIE = '" & sSerie & "' And TURMA = '" & sTURMA & "' Order By NUMERO" 'Response.Write sSQL Set rsAlunos = oBD.Execute(sSQL) If Not rsAlunos.Eof Then sDataQry = Split(sData, "/") %>
<% Do While Not rsAlunos.Eof sQuery = "Select DESCRI from OCORREN Where DATA = '" & _ Right(sDataQry(2),2) & "/" & sDataQry(1) & "/" & sDataQry(0) & "' And RGM = '" & rsAlunos("RGM") & "' And COD_DISCIP = '" & _ CodDiscip & "' And COD_DESCRI = '" & CODOCO & "'" 'Response.Write(sQuery) : Response.End() Set rsVerifica = oBD.Execute(sQuery) bAchou = False if not rsVerifica.Eof then bAchou = True sDesc = rsVerifica(0) end if if rsVerifica.state = 1 then rsVerifica.Close %> <% rsAlunos.MoveNext Loop Set rsAlunos = Nothing %>
Data: <%= sData %> Série: <%= sSerie %> Turma: <%= sTurma %> <%= sDescOco %> <%= sDescDiscip %>
  <%if not (bEhDigitavel) then Response.Write "Selecionar todos" if (bEhDigitavel) then %> <%end if %>
<%=rsAlunos("NUMERO") & "/" & rsAlunos("RGM") %> <%= rsAlunos("NOME") %> " <% if bAchou = True Then %> checked="checked" <% end if %> type="checkbox" value="S"> <%if (bEhDigitavel) then if sDesc = "" then sDesc = sDescOco %> " type="text" value="<%= sDesc %>" size="90" maxlength="255"> <% end if %>

<%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 %>
Informe os dados:
Data: <% Function pd(n, totalDigits) if totalDigits > len(n) then pd = String(totalDigits-len(n),"0") & n else pd = n end if End Function If sData = "" then sData = pd(DAY(date()),2) & "/" & _ pd(MONTH(date()),2) & "/" & _ YEAR(Date()) End If %>
Série:
Turma:
Ocorrência:
Disciplina:
<% End If 'Acao = "" %> <% if oBD.State=1 then oBD.Close Set oBD = Nothing if oBDOco.State=1 then oBDOco.Close Set oBDOco = Nothing %>