Ir para conteúdo
Fórum Script Brasil
  • 0

Problemas com data em ASP


JOSE CARLOS_FROTA

Pergunta

OLÁ PESSOAL. SOU INICIANTE EM ASP E ME METI A DESENVOLVER UM SISTEMA ONDE TRABALHO. TRABALHO EM UMA ESCOLA ESTADUAL E CREI UMA BASE DE DADOS NO ACCESS CHAMADO DOCENTE. TEM A TABELA CAD_FUNC COM VÁRIOS CAMPOS. CRIEI UMA OUTRA TABELA CHAMADA MOVIMENTO ONDE DIGITO AS AUSÊNCIAS DO PROFESSOR.

FIZ UM SISTEMINHA EM ASP PARA QUE O PROFESSOR SABER QUAL OU QUAIS SÃO AS SUAS FALTAS. TIPO EXTRATO BANCÁRIO. MAS É AI QUE TA. QUANDO DIGITO A DATA INICIAL E A DATA FINAL. NÃO APARECE NADA, MAS O REGISTRO TA NO BD.

VEJA O CÓDIGO. SÃO DOIS ARQUIVOS. DENOMINEI OS NOMES PARA TESTES.

TRES.HTML

<html>

<head>

<meta http-equiv="Content-Language" content="pt-br">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>CONSULTA DO CADASTRO DOCENTE</title>

</head>

<body>

<div style="position: absolute; width: 390px; height: 18px; z-index: 1; left: 241px; top: 12px" id="camada1" align="center">

<font face="Arial Narrow" color="#FF0000">CONSULTA DO CADASTRO DOCENTE</font></div>

<div style="position: absolute; width: 290px; height: 100px; z-index: 2; left: 241px; top: 61px" id="camada2">

<form method="POST" action="extrato.asp" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">

<p><font face="Arial Unicode MS">Digite o RG: </font>

<font face="Arial Unicode MS">

&nbsp;<!--webbot bot="Validation" s-data-type="Number" s-number-separators="x," --><input type="text" name="rg" size="18"></font></p>

<table border="1" width="100%" id="table1" style="border-width: 0px">

<tr>

<td style="border-style: none; border-width: medium" width="130">

<font face="Arial Unicode MS">Data Início</font></td>

<td style="border-style: none; border-width: medium">

<font face="Arial Unicode MS">

<input type="text" name="dti" size="20"></font></td>

</tr>

<tr>

<td style="border-style: none; border-width: medium" width="130">

<font face="Arial Unicode MS">Data Final</font></td>

<td style="border-style: none; border-width: medium">

<font face="Arial Unicode MS">

<input type="text" name="dtf" size="20"></font></td>

</tr>

</table>

<p><input type="submit" value="Enviar" name="B1"></p>

</form>

<p>&nbsp;</div>

</body>

EXTRATO.ASP

<%

Option Explicit

'-------------------------------------------

'---- Generated by the ASP Table Wizard ----

'---- http://www.paulsimmons.com ----

'-------------------------------------------

Response.Write(ConverterDataBanco(Date()))

Dim iCount

Dim sRowColor

Dim objDB

Dim objRS

Dim sDBName

Dim rgi

Dim rdti

Dim rdtf

rgi = Request.Form("rg")

rdti = Request.Form("dti")

rdtf = Request.Form("dtf")

'TODO: Verify database path...

sDBName = "driver={Microsoft Access Driver (*.mdb)};dbq=E:\home\marlenefratt\dados\CADASTRO.mdb"

Set objDB = Server.CreateObject("ADODB.Connection")

objDB.Open sDBName

'TODO: Modify the next line to only return the records you want...

Set objRS = objDB.Execute("select * from MOVIMENTO where COD_FUNC = "& rgi &" and DATA Between "& rdti &" and "& rdtf &" ORDER BY DATA")

Response.Write("<html>")

Response.Write("<head>")

Response.Write("<title>Extrato de Ausências</title>")

Response.Write("</head>")

Response.Write("<body bgcolor=white>")

Response.Write("<p><center><font face=Arial Narrow Size =2>Extrato das Ausências</font></p>")

Response.Write("<p><center><font face=Arial Narrow>RG</font></p>")

Response.Write("<p><center><font face=Arial Narrow>Período Inicial:</font></p>")

Response.Write("<p><center><font face=Arial Narrow>Período Final:</font></p>")

If objRS.EOF Then

Response.Write("<b>No matching records found.</b>")

objRS.Close

objDB.Close

Set objRS = Nothing

Set objDB = Nothing

Response.End

End If

Response.Write("<center><table border=0 cellpadding=2 cellspacing=2>")

Response.Write("<tr bgcolor=silver>")

'COOL TIP: the <filter> tag is used by Excel 97 and later...

'if your users save this file from the browser and open it in XL, XL will

'parse all the table cells into XL ranges and turn on filtering...

Response.Write("<CENTER><th filter=ALL>DATA</th>")

Response.Write("<th filter=ALL>MOTIVO</th>")

Response.Write("<th filter=ALL>PERIODO</th>")

Response.Write("<th filter=ALL>E.F.</th>")

Response.Write("<th filter=ALL>E.M.</th>")

Response.Write("<th filter=ALL>EVENTUAL</th>")

Response.Write("</tr>")

Do While Not objRS.EOF

'this code alternates the color of the table rows...

iCount = iCount + 1

If iCount Mod 2 = 0 Then

sRowColor = "skyblue"

Else

sRowColor = "#C4CEE5"

End If

Response.Write("<tr bgcolor=" & sRowColor & ">")

Response.Write("<td>" & objRS("DATA") & "</td>")

Response.Write("<td>" & objRS("NOMEAUSENCIA") & "</td>")

Response.Write("<td>" & objRS("PERIODO") & "</td>")

Response.Write("<td>" & objRS("EFAULAS") & "</td>")

Response.Write("<td>" & objRS("EMAULAS") & "</td>")

Response.Write("<td>" & objRS("NOM_FUNC") & "</td>")

Response.Write("</tr>")

objRS.MoveNext

Loop

Response.Write("</table>")

Response.Write("</body>")

Response.Write("</html>")

objRS.Close

objDB.Close

Set objRS = Nothing

Set objDB = Nothing

%>

SE EU TIRAR O BETWEEN ELE FUNCIONA, MAS TRAS TODAS AS AUSÊNCIAS. EU QUERO QUE ELE MOSTRE SOMENTE AS AUSÊNCIAS DO PERIODO DESEJADO.

DESCULPE, MAS COMO DISSE, AINDA CAMINHA A PASSOS LENTOS.

SE ALGUÉM PUDER ME SOCORRER, AGRADEÇO

Link para o comentário
Compartilhar em outros sites

12 respostass a esta questão

Posts Recomendados

  • 0

Não entendo nadinha de Access mas acho que deve-se utilizar o # como indicador de data.

Testa ai por favor:

'TODO: Modify the next line to only return the records you want...
Set objRS = objDB.Execute("select * from MOVIMENTO where COD_FUNC = "& rgi &" and DATA Between #"& rdti &"# and #"& rdtf &"# ORDER BY DATA")

Editado por jothaz
Link para o comentário
Compartilhar em outros sites

  • 0

José, o Jothaz está certo. você tem que abraçar as datas com cerquilha, PORÉM, para isto no bd o campo tem que estar com formaro data/hora, podes confirmar isso?

você confirma tb que o seu bd é access?

bom, confirmando as duas pergutas e a dica do Jothaz não funcionando proponho que você debug sua query para termos certeza de que está tudo certo:

Set objRS = objDB.Execute("select * from MOVIMENTO where COD_FUNC = "& rgi &" and DATA Between "& rdti &" and "& rdtf &" ORDER BY DATA")
'inicio do debug
response.write objRS
response.end
'fim do debug

após... poste aqui o resultado do debug...

[]'s Rafael Spilki

Link para o comentário
Compartilhar em outros sites

  • 0

OLA!

FIZ AS ALTERAÇÕES EM MEU BD. É ACCESS E COLOQUEI MASCARA NO CAMPO DATE.

O PROGRAMA FUNCIONA, MAS TEM UM PROBLEMA:

EU DIGITO DD/MM/AAAA E ELE ESTA BUSCANDO NO SERVIDOR: MM/DD/AAAA

PORTANTO: SE EU QUERO SABER AS AUSÊNCIAS DO PROFESSOR ENTRE UMA DETERMINADA DATA. ELE INTERPRETA MM/DD/AAAA.

O QUE TENHO DE FAZER PARA RESOLVER ESTE PROBLEMA?

Link para o comentário
Compartilhar em outros sites

  • 0

Pode tentar colocando no inicio de seu codigo

Session.LCID = 1046
ou simplesmente formatar o campo data pela função cdate assim:
seu_campo_data = Cdate(day (seu_campo_data) &"/"& month (seu_campo_data) &"/"& year (seu_campo_data))

qualquer. coisa poste aí!

[]'s Rafael Spilki

Link para o comentário
Compartilhar em outros sites

  • 0

já tentou inclusive assim:

seu_campo_data = Cdate(month (seu_campo_data) &"/"& day (seu_campo_data) &"/"& year (seu_campo_data))

?

caso sim e mesmo assim não tenha dado certo sugiro:

tire todas as Session.Lcids de seu código e comece desde o início...

coloque a session.lcid = 1033 (padrão ameicano) no inicio de seu códio o forçando as datas para este padrão, funcionando tente inverter pela função cdate...

caso continue não funcionando o jeito será usar a função datePart para separar dia mes e ano e depois unificá-los todos em uma mesma string...

qualquer. coisa posta aí

[]'s Rafael Spilki

Link para o comentário
Compartilhar em outros sites

  • 0
Guest --FROTAJC --

Valeu, Rafael, pela grande ajuda.

Fiz o que você orientou. Acontece que:

Estou trabalhando com duas datas:

data incio e data fim

Ao digitar as datas, o sistema processa a primeira como sendo mm/dd e a segunda não. porque os registros apresentam até o final que determinei na data final, entende?

Pode isso acontecer? Entre duas datas?

Link para o comentário
Compartilhar em outros sites

  • 0

Bom dia, Rafael! você é o máximo. Ah, já sou cadastrado no fórum.

Ufa!

Vamos lá. Vou postar os dois códigos que estou utilizando.

tres.asp

<%@ CodePage="708" LCID="1046" %>

<% Option Explicit %>

<html>

<head>

<meta http-equiv="Content-Language" content="pt-br">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>CONSULTA DO CADASTRO DOCENTE</title>

</head>

<body>

<div style="position: absolute; width: 390px; height: 18px; z-index: 1; left: 241px; top: 12px" id="camada1" align="center">

<font face="Arial Narrow" color="#FF0000">CONSULTA DO CADASTRO DOCENTE</font></div>

<div style="position: absolute; width: 450px; height: 100px; z-index: 2; left: 241px; top: 61px" id="camada2">

<form method="POST" action="extra.asp" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">

<p><font face="Arial Unicode MS">Digite o RG: </font>

<font face="Arial Unicode MS">

&nbsp;<!--webbot bot="Validation" s-data-type="Number" s-number-separators="x," --><input type="text" name="rg" size="18"></font></p>

<table border="1" width="100%" id="table1" style="border-width: 0px">

<tr>

<td style="border-style: none; border-width: medium" width="164">

<font face="Arial Unicode MS">Data Início</font></td>

<td><input name="dti" type="text" class="texto" style="width: 90" OnKeyUp="this.value=mascara_data(this.value)" onBlur="verifica_data(this)">

</tr>

<tr>

<td style="border-style: none; border-width: medium" width="164">

<font face="Arial Unicode MS">Data Final</font></td>

<td><input name="dtf" type="text" class="texto" style="width: 90" OnKeyUp="this.value=mascara_data(this.value)" onBlur="verifica_data(this)">

</tr>

</table>

<p><input type="submit" value="Enviar" name="B1"></p>

</form>

<p>&nbsp;</div>

<script language="JavaScript">

function mascara_data(data){

var mydata = '';

mydata = mydata + data;

if (mydata.length == 2){

mydata = mydata + '/';

}

if (mydata.length == 5){

mydata = mydata + '/';

}

return mydata;

}

function verifica_data(data) {

if (data.value != "") {

dia = (data.value.substring(0,2));

mes = (data.value.substring(3,5));

ano = (data.value.substring(6,10));

situacao = "";

if ((dia < 01)||(dia < 01 || dia > 30) && ( mes == 04 || mes == 06 || mes == 09 || mes == 11 ) || dia > 31) {

situacao = "falsa";

}

if (mes < 01 || mes > 12 ) {

situacao = "falsa";

}

if (mes == 2 && ( dia < 01 || dia > 29 || ( dia > 28 && (parseInt(ano / 4) != ano / 4)))) {

situacao = "falsa";

}

if (situacao == "falsa") {

data.focus();

data.select();

alert("Data inválida!");

}

}

}

</script>

</body>

</html>

extra.asp

<%LCID= 1046%>

<%

Function DataInvertida(data)

dia=day(Data)

mes=month(Data)

ano=year(Data)

DataInvertida=dia&"/"&mes&"/"&ano

End Function

Dim iCount

Dim sRowColor

Dim objDB

Dim objRS

Dim sDBName

rgi = Request.Form("rg")

rdti = DataInvertida(Request.Form("dti"))

rdtf = DataInvertida(Request.Form("dtf"))

'TODO: Verify database path...

sDBName = "driver={Microsoft Access Driver (*.mdb)};dbq=E:\home\marlenefratt\dados\CADASTRO.mdb"

Set objDB = Server.CreateObject("ADODB.Connection")

objDB.Open sDBName

Set objRS = objDB.Execute("select * from CAD_FUNC where COD_FUNC = "& rgi &"")

'TODO: Modify the next line to only return the records you want...

Response.Write "<html>"

Response.Write ""

Response.Write "<head>"

Response.Write "<meta http-equiv='Content-Language' content='pt-br'>"

Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>"

Response.Write "<title>CONSULTA AUSÊNCIAS</title>"

Response.Write "</head>"

Response.Write ""

Response.Write "<body>"

Response.Write ""

Response.Write "<div style='position: absolute; width: 980px; height: 25px; z-index: 1; left: 4px; top: 20px; background-color: #0000FF' id='camada1'>"

Response.Write " <p align='left'><font color='#FFFFFF'><font face='Arial Unicode MS'><b>EE "

Response.Write " PROFA. MARLENE FRATTINI </b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"

Response.Write " <b>EXTRATO DAS AUSÊNCIAS DOCENTE</b></font></div>"

Response.Write ""

Response.Write "<p>&nbsp;</p>"

Response.Write "<div style='position: absolute; width: 817px; height: 100px; z-index: 2; left: 76px; top: 55px' id='camada2'>"

Response.Write " <table border='1' width='788' id='table1' style='border-width: 0px'>"

Response.Write " <tr>"

Response.Write " <td style='border-style: none; border-width: medium' width='62'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>RG</font></td>"

Response.Write " <td style='border-style: none; border-width: medium' width='716' colspan='5'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>" & objRS("COD_FUNC") & "</font></td>"

Response.Write " </tr>"

Response.Write " <tr>"

Response.Write " <td style='border-style: none; border-width: medium' width='62'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>NOME</font></td>"

Response.Write " <td style='border-style: none; border-width: medium' width='716' colspan='5'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>"

Response.Write " <b>" & objRS("NOM_FUNC") & "</font></td>"

Response.Write " </tr>"

Response.Write " <tr>"

Response.Write " <td style='border-style: none; border-width: medium' width='62'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>RSPV</font></td>"

Response.Write " <td style='border-style: none; border-width: medium' width='125'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>" & objRS("RSPV_FUNC") & "</font></td>"

Response.Write " <td style='border-style: none; border-width: medium' width='69'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>CARGO</font></td>"

Response.Write " <td style='border-style: none; border-width: medium' width='116'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>" & objRS("CARGO_FUNC") & "</font></td>"

Response.Write " <td style='border-style: none; border-width: medium' width='168'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>SITUAÇÃO</font></td>"

Response.Write " <td style='border-style: none; border-width: medium' width='220'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>"

Response.Write " <b>" & objRS("CAT_FUNC") & "</td>"

Response.Write " </tr>"

Response.Write " <tr>"

Response.Write " <td style='border-style: none; border-width: medium' width='187' colspan='2'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>PERÍODO&nbsp; INÍCIAL</font></td>"

Response.Write " <td style='border-style: none; border-width: medium' width='185' colspan='2'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>"

Response.Write (rdti)

Response.Write " <td style='border-style: none; border-width: medium' width='168'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>PERÍODO FINAL</font></td>"

Response.Write " <td style='border-style: none; border-width: medium' width='220'>"

Response.Write " <font face='AvantGarde Bk BT' size='2'> "

Response.Write (rdtf)

Response.Write " </tr>"

Response.Write " </table>"

Response.Write "</div>"

Set objRS = objDB.Execute("select * from MOVIMENTO where COD_FUNC = "& rgi &" and DATA BETWEEN #"& rdti &"# and #"& rdtf &"# ORDER BY Data ")

If objRS.EOF Then

Response.Write "<p>&nbsp;</p>"

Response.Write "<p>&nbsp;</p>"

Response.Write "<p>&nbsp;</p>"

Response.Write("<b>Sem lançamentos a registrar.</b>")

objRS.Close

objDB.Close

Set objRS = Nothing

Set objDB = Nothing

Response.End

End If

Response.Write "<p>&nbsp;</p>"

Response.Write "<p>&nbsp;</p>"

Response.Write "<p>&nbsp;</p>"

Response.Write " <font face='AvantGarde Bk BT' size='2'>"

Response.Write("<table border=0 cellpadding=2 cellspacing=2>")

Response.Write("<tr bgcolor=silver>")

'COOL TIP: the <filter> tag is used by Excel 97 and later...

'if your users save this file from the browser and open it in XL, XL will

'parse all the table cells into XL ranges and turn on filtering...

Response.Write "<div style='position: absolute; width: 817px; height: 100px; z-index: 2; left: 76px; top: 55px' id='camada2'>"

Response.Write " <table border='1' width='788' id='table1' style='border-width: 0px'>"

Response.Write " <tr>"

Response.Write("<CENTER><th filter=ALL>DATA</th>")

Response.Write("<th filter=ALL>MOTIVO</th>")

Response.Write("<th filter=ALL>PERIODO</th>")

Response.Write("<th filter=ALL>E.F.</th>")

Response.Write("<th filter=ALL>E.M.</th>")

Response.Write("<th filter=ALL>EVENTUAL</th>")

Response.Write("</tr>")

Do While Not objRS.EOF

'this code alternates the color of the table rows...

iCount = iCount + 1

If iCount Mod 2 = 0 Then

sRowColor = "skyblue"

Else

sRowColor = "#C4CEE5"

End If

'Response.Write FormataData("data")

Response.Write("<tr bgcolor=" & sRowColor & ">")

Response.Write("<td>" & objRS("DATA") & "</td>")

Response.Write("<td>" & objRS("NOMEAUSENCIA") & "</td>")

Response.Write("<td>" & objRS("PERIODO") & "</td>")

Response.Write("<td>" & objRS("EFAULAS") & "</td>")

Response.Write("<td>" & objRS("EMAULAS") & "</td>")

Response.Write("<td>" & objRS("NOM_FUNC") & "</td>")

Response.Write("</tr>")

objRS.MoveNext

Loop

Response.Write("</table>")

Response.Write("</body>")

Response.Write("</html>")

Response.Write Cdate(now)

objRS.Close

objDB.Close

Set objRS = Nothing

Set objDB = Nothing

%>

Ainda continua dando pau quando a primeira data é igual ou menor que 12.

Valeu mais uma vez!

Link para o comentário
Compartilhar em outros sites

  • 0

Dois testes para você. experimente e poste aqui o resultado:

primeiro:

<%'LCID= 1046%>
<%
'Function DataInvertida(data)
'dia=day(Data)
'mes=month(Data)
'ano=year(Data)
'DataInvertida=dia&"/"&mes&"/"&ano
'End Function

Dim iCount
Dim sRowColor
Dim objDB
Dim objRS
Dim sDBName

rgi = Request.Form("rg")
'rdti = DataInvertida(Request.Form("dti"))
'rdtf = DataInvertida(Request.Form("dtf"))
rdti = Request.Form("dti")
rdti = Cdate(month (rdti) &"/"& day (rdti) &"/"& year (rdti))
rdtf = Request.Form("dtf")
rdtf = Cdate(month (rdtf) &"/"& day (rdtf) &"/"& year (rdtf))


'TODO: Verify database path...
sDBName = "driver={Microsoft Access Driver (*.mdb)};dbq=E:\home\marlenefratt\dados\CADASTRO.mdb"
Set objDB = Server.CreateObject("ADODB.Connection")
objDB.Open sDBName
Set objRS = objDB.Execute("select * from CAD_FUNC where COD_FUNC = "& rgi &"")

'TODO: Modify the next line to only return the records you want...

Response.Write "<html>"
Response.Write ""
Response.Write "<head>"
Response.Write "<meta http-equiv='Content-Language' content='pt-br'>"
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>"
Response.Write "<title>CONSULTA AUSÊNCIAS</title>"
Response.Write "</head>"
Response.Write ""
Response.Write "<body>"
Response.Write ""
Response.Write "<div style='position: absolute; width: 980px; height: 25px; z-index: 1; left: 4px; top: 20px; background-color: #0000FF' id='camada1'>"
Response.Write " <p align='left'><font color='#FFFFFF'><font face='Arial Unicode MS'><b>EE "
Response.Write " PROFA. MARLENE FRATTINI </b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
Response.Write " <b>EXTRATO DAS AUSÊNCIAS DOCENTE</b></font></div>"
Response.Write ""
Response.Write "<p>&nbsp;</p>"
Response.Write "<div style='position: absolute; width: 817px; height: 100px; z-index: 2; left: 76px; top: 55px' id='camada2'>"
Response.Write " <table border='1' width='788' id='table1' style='border-width: 0px'>"
Response.Write " <tr>"
Response.Write " <td style='border-style: none; border-width: medium' width='62'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>RG</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='716' colspan='5'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>" & objRS("COD_FUNC") & "</font></td>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td style='border-style: none; border-width: medium' width='62'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>NOME</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='716' colspan='5'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>"
Response.Write " <b>" & objRS("NOM_FUNC") & "</font></td>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td style='border-style: none; border-width: medium' width='62'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>RSPV</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='125'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>" & objRS("RSPV_FUNC") & "</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='69'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>CARGO</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='116'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>" & objRS("CARGO_FUNC") & "</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='168'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>SITUAÇÃO</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='220'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>"
Response.Write " <b>" & objRS("CAT_FUNC") & "</td>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td style='border-style: none; border-width: medium' width='187' colspan='2'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>PERÍODO&nbsp; INÍCIAL</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='185' colspan='2'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>"
Response.Write (rdti)
Response.Write " <td style='border-style: none; border-width: medium' width='168'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>PERÍODO FINAL</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='220'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'> "
Response.Write (rdtf)
Response.Write " </tr>"
Response.Write " </table>"
Response.Write "</div>"

Set objRS = objDB.Execute("select * from MOVIMENTO where COD_FUNC = "& rgi &" and DATA BETWEEN #"& rdti &"# and #"& rdtf &"# ORDER BY Data ")



If objRS.EOF Then
Response.Write "<p>&nbsp;</p>"
Response.Write "<p>&nbsp;</p>"
Response.Write "<p>&nbsp;</p>"

Response.Write("<b>Sem lançamentos a registrar.</b>")
objRS.Close
objDB.Close
Set objRS = Nothing
Set objDB = Nothing
Response.End
End If
Response.Write "<p>&nbsp;</p>"
Response.Write "<p>&nbsp;</p>"
Response.Write "<p>&nbsp;</p>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>"
Response.Write("<table border=0 cellpadding=2 cellspacing=2>")
Response.Write("<tr bgcolor=silver>")

'COOL TIP: the <filter> tag is used by Excel 97 and later...
'if your users save this file from the browser and open it in XL, XL will
'parse all the table cells into XL ranges and turn on filtering...
Response.Write "<div style='position: absolute; width: 817px; height: 100px; z-index: 2; left: 76px; top: 55px' id='camada2'>"
Response.Write " <table border='1' width='788' id='table1' style='border-width: 0px'>"
Response.Write " <tr>"

Response.Write("<CENTER><th filter=ALL>DATA</th>")
Response.Write("<th filter=ALL>MOTIVO</th>")
Response.Write("<th filter=ALL>PERIODO</th>")
Response.Write("<th filter=ALL>E.F.</th>")
Response.Write("<th filter=ALL>E.M.</th>")
Response.Write("<th filter=ALL>EVENTUAL</th>")
Response.Write("</tr>")
Do While Not objRS.EOF
'this code alternates the color of the table rows...
iCount = iCount + 1
If iCount Mod 2 = 0 Then
sRowColor = "skyblue"
Else
sRowColor = "#C4CEE5"
End If

'Response.Write FormataData("data")

Response.Write("<tr bgcolor=" & sRowColor & ">")

Response.Write("<td>" & objRS("DATA") & "</td>")
Response.Write("<td>" & objRS("NOMEAUSENCIA") & "</td>")
Response.Write("<td>" & objRS("PERIODO") & "</td>")
Response.Write("<td>" & objRS("EFAULAS") & "</td>")
Response.Write("<td>" & objRS("EMAULAS") & "</td>")
Response.Write("<td>" & objRS("NOM_FUNC") & "</td>")
Response.Write("</tr>")

objRS.MoveNext
Loop

Response.Write("</table>")
Response.Write("</body>")
Response.Write("</html>")
Response.Write Cdate(now)

objRS.Close
objDB.Close
Set objRS = Nothing
Set objDB = Nothing

%>
segundo:
<%'LCID= 1046%>
<%
'Function DataInvertida(data)
'dia=day(Data)
'mes=month(Data)
'ano=year(Data)
'DataInvertida=dia&"/"&mes&"/"&ano
'End Function

Dim iCount
Dim sRowColor
Dim objDB
Dim objRS
Dim sDBName

rgi = Request.Form("rg")
'rdti = DataInvertida(Request.Form("dti"))
'rdtf = DataInvertida(Request.Form("dtf"))
rdti = Request.Form("dti")
rdti = Cdate(day (rdti) &"/"& month (rdti) &"/"& year (rdti))
rdtf = Request.Form("dtf")
rdtf = Cdate(day (rdtf) &"/"& month (rdtf) &"/"& year (rdtf))


'TODO: Verify database path...
sDBName = "driver={Microsoft Access Driver (*.mdb)};dbq=E:\home\marlenefratt\dados\CADASTRO.mdb"
Set objDB = Server.CreateObject("ADODB.Connection")
objDB.Open sDBName
Set objRS = objDB.Execute("select * from CAD_FUNC where COD_FUNC = "& rgi &"")

'TODO: Modify the next line to only return the records you want...

Response.Write "<html>"
Response.Write ""
Response.Write "<head>"
Response.Write "<meta http-equiv='Content-Language' content='pt-br'>"
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>"
Response.Write "<title>CONSULTA AUSÊNCIAS</title>"
Response.Write "</head>"
Response.Write ""
Response.Write "<body>"
Response.Write ""
Response.Write "<div style='position: absolute; width: 980px; height: 25px; z-index: 1; left: 4px; top: 20px; background-color: #0000FF' id='camada1'>"
Response.Write " <p align='left'><font color='#FFFFFF'><font face='Arial Unicode MS'><b>EE "
Response.Write " PROFA. MARLENE FRATTINI </b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
Response.Write " <b>EXTRATO DAS AUSÊNCIAS DOCENTE</b></font></div>"
Response.Write ""
Response.Write "<p>&nbsp;</p>"
Response.Write "<div style='position: absolute; width: 817px; height: 100px; z-index: 2; left: 76px; top: 55px' id='camada2'>"
Response.Write " <table border='1' width='788' id='table1' style='border-width: 0px'>"
Response.Write " <tr>"
Response.Write " <td style='border-style: none; border-width: medium' width='62'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>RG</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='716' colspan='5'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>" & objRS("COD_FUNC") & "</font></td>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td style='border-style: none; border-width: medium' width='62'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>NOME</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='716' colspan='5'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>"
Response.Write " <b>" & objRS("NOM_FUNC") & "</font></td>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td style='border-style: none; border-width: medium' width='62'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>RSPV</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='125'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>" & objRS("RSPV_FUNC") & "</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='69'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>CARGO</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='116'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>" & objRS("CARGO_FUNC") & "</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='168'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>SITUAÇÃO</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='220'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>"
Response.Write " <b>" & objRS("CAT_FUNC") & "</td>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td style='border-style: none; border-width: medium' width='187' colspan='2'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>PERÍODO&nbsp; INÍCIAL</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='185' colspan='2'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>"
Response.Write (rdti)
Response.Write " <td style='border-style: none; border-width: medium' width='168'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>PERÍODO FINAL</font></td>"
Response.Write " <td style='border-style: none; border-width: medium' width='220'>"
Response.Write " <font face='AvantGarde Bk BT' size='2'> "
Response.Write (rdtf)
Response.Write " </tr>"
Response.Write " </table>"
Response.Write "</div>"

Set objRS = objDB.Execute("select * from MOVIMENTO where COD_FUNC = "& rgi &" and DATA BETWEEN #"& rdti &"# and #"& rdtf &"# ORDER BY Data ")



If objRS.EOF Then
Response.Write "<p>&nbsp;</p>"
Response.Write "<p>&nbsp;</p>"
Response.Write "<p>&nbsp;</p>"

Response.Write("<b>Sem lançamentos a registrar.</b>")
objRS.Close
objDB.Close
Set objRS = Nothing
Set objDB = Nothing
Response.End
End If
Response.Write "<p>&nbsp;</p>"
Response.Write "<p>&nbsp;</p>"
Response.Write "<p>&nbsp;</p>"
Response.Write " <font face='AvantGarde Bk BT' size='2'>"
Response.Write("<table border=0 cellpadding=2 cellspacing=2>")
Response.Write("<tr bgcolor=silver>")

'COOL TIP: the <filter> tag is used by Excel 97 and later...
'if your users save this file from the browser and open it in XL, XL will
'parse all the table cells into XL ranges and turn on filtering...
Response.Write "<div style='position: absolute; width: 817px; height: 100px; z-index: 2; left: 76px; top: 55px' id='camada2'>"
Response.Write " <table border='1' width='788' id='table1' style='border-width: 0px'>"
Response.Write " <tr>"

Response.Write("<CENTER><th filter=ALL>DATA</th>")
Response.Write("<th filter=ALL>MOTIVO</th>")
Response.Write("<th filter=ALL>PERIODO</th>")
Response.Write("<th filter=ALL>E.F.</th>")
Response.Write("<th filter=ALL>E.M.</th>")
Response.Write("<th filter=ALL>EVENTUAL</th>")
Response.Write("</tr>")
Do While Not objRS.EOF
'this code alternates the color of the table rows...
iCount = iCount + 1
If iCount Mod 2 = 0 Then
sRowColor = "skyblue"
Else
sRowColor = "#C4CEE5"
End If

'Response.Write FormataData("data")

Response.Write("<tr bgcolor=" & sRowColor & ">")

Response.Write("<td>" & objRS("DATA") & "</td>")
Response.Write("<td>" & objRS("NOMEAUSENCIA") & "</td>")
Response.Write("<td>" & objRS("PERIODO") & "</td>")
Response.Write("<td>" & objRS("EFAULAS") & "</td>")
Response.Write("<td>" & objRS("EMAULAS") & "</td>")
Response.Write("<td>" & objRS("NOM_FUNC") & "</td>")
Response.Write("</tr>")

objRS.MoveNext
Loop

Response.Write("</table>")
Response.Write("</body>")
Response.Write("</html>")
Response.Write Cdate(now)

objRS.Close
objDB.Close
Set objRS = Nothing
Set objDB = Nothing

%>

[]'s Rafael Spilki

Link para o comentário
Compartilhar em outros sites

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.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,2k
×
×
  • Criar Novo...