-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelatorio.asp
177 lines (147 loc) · 6.55 KB
/
relatorio.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<%
if request.form("relaos") = "" then %>
<html>
<head><title>CFP 1.16 - Ordem de Serviço</title></head>
<body bgcolor=#F0FFF0>
<table bgcolor=#C1CDC1 width=510 height=370 align=center cellspacing=0 cellpadding=0>
<tr height=15>
<td align=center>
<% Session.LCID = 1046
response.expires = -1000
response.write " <i><font face=verdana, arial size=1 color=#ff0000>" & date() & " - Usuário: " & session("func") & "</font></i>"
%> </td>
</tr>
<tr bgcolor=#8B8682 height=15>
<td align=center>RELATÓRIO</td>
</tr>
<tr>
<td align=center>
<form method=post action=relatorio.asp target=_new>
<table align=center border=0>
<tr>
<td align=center>
<select name=relaopfr>
<option selected value=1>OS ABERTA</option>
<option value=2>OS FECHADA</option>
</select>
</td>
<td valign=center>
<input type=hidden name=relaos value=sim>
</td>
</tr>
</table>
</font>
</td>
</tr>
<tr>
<td valign=bottom>
<!--#include file=botoes.asp-->
</td>
</tr>
</form>
</table>
</body>
</html> <%
else
response.ContentType = "application/x-msexcel"
response.write "<html><head><title>RELATÓRIO OS</title></head><body>"
set conexao = server.createobject("adodb.connection")
conexao.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("oscadastroteste.mdb") & ";uid=sa;pwd=;"
set bdcarg = conexao.execute("select codfunc, codcarg, codnucl from func where func = '" & session("func") & "'")
usuario = bdcarg("codfunc")
cargo = bdcarg("codcarg")
executor = bdcarg("codfunc")
codnucl = bdcarg("codnucl")
set bdcarg = nothing
if cargo = 5 then 'Consulta de usuario
set bdrela = conexao.execute("select * from relatorio where codfunc = '" & usuario & "' and codsitua = " & request.form("relaopfr") & " order by nros")
else
if cargo = 4 then 'Consulta de executor
set bdrela = conexao.execute("select * from relatorio where executor = '" & usuario & "' and codsitua = " & request.form("relaopfr") & " order by nros")
else
if cargo = 2 then 'Consulta de coordenardor
set bdrela = conexao.execute("select * from relatorio where codnucl = " & codnucl & " and codsitua = " & request.form("relaopfr") & " order by nros")
else 'Consulta de administrador
set bdrela = conexao.execute("select * from relatorio where codnucl = 8 and codsitua = " & request.form("relaopfr") & " order by nros")
end if
end if
end if
if not bdrela.eof then 'encontrou o registro procurado
if request.form("relaopfr") = 1 then
tipo = "ABERTA"
else
tipo = "FECHADA"
end if
response.write "<center><b>RELATÓRIO OS " & tipo & "</b></center><br><i><font face=verdana, arial size=2>" & date() & " - " & session("func") & "</font></i>"
response.write "<table width=1000 border=1 bordercolor=#8B8682 cellpadding=0 cellspacing=0><tr>"
response.write "<td width=2% align=center><font face=Arial size=1>OS</font></td>"
response.write "<td width=2% align=center><font face=Arial size=1>NI</font></td>"
response.write "<td width=12% align=center><font face=Arial size=1>LOCAL</font></td>"
if cargo = 4 or cargo = 1 or cargo = 2 then
response.write "<td width=10% align=center><font face=Arial size=1>SOLICITANTE</font></td>"
response.write "<td width=10% align=center><font face=Arial size=1>RAMAL</font></td>"
end if
if cargo = 5 or cargo = 1 or cargo = 2 then
response.write "<td width=10% align=center><font face=Arial size=1>EXECUTOR</font></td>"
end if
response.write "<td width=25% align=center><font face=Arial size=1>SERVIÇO SOLICITADO</font></td>"
if tipo = "FECHADA" then
response.write "<td width=25% align=center><font face=Arial size=1>SERVIÇO EXECUTADO</font></td>"
end if
if tipo = "FECHADA" then
response.write "<td width=25% align=center><font face=Arial size=1>MAT.UTIL.</font></td>"
end if
if tipo = "FECHADA" then
response.write "<td width=25% align=center><font face=Arial size=1>OBSERVAÇÕES</font></td>"
end if
response.write "<td width=5% align=center><font face=Arial size=1>ABERTA</font></td>"
if tipo = "FECHADA" then
response.write "<td width=5% align=center><font face=Arial size=1>FECHADA</font></td></tr>"
end if
while not bdrela.eof
response.write "<tr><td align=center valign=top><font face=Arial size=1>" & bdrela("nros") & "</font></td>"
response.write "<td align=center valign=top><font face=Arial size=1>" & bdrela("nipatr") & "</font></td>"
response.write "<td valign=top><font face=Arial size=1>" & bdrela("local") & "</font></td>"
if cargo = 4 or cargo = 1 or cargo = 2 then
set bdsolic = conexao.execute("select func, ramal from func where codfunc = '" & bdrela("codfunc") & "'")
response.write "<td valign=top><font face=Arial size=1>" & bdsolic("func") & "</font></td>"
response.write "<td align=center valign=top><font face=Arial size=1>" & bdsolic("ramal")
set bdsolic = Nothing
end if
if cargo = 5 or cargo = 1 or cargo = 2 then
set bdnomeexecutor = conexao.execute("select func from func where codfunc = '" & bdrela("executor") & "'")
response.write "<td valign=top><font face=Arial size=1>" & bdnomeexecutor("func")
set bdnomeexecutor = Nothing
response.write "</font></td>"
end if
response.write "<td valign=top><font face=Arial size=1>" & bdrela("servso") & "</font></td>"
if tipo = "FECHADA" then
response.write "<td valign=top><font face=Arial size=1>TESTE</font></td>"
end if
if tipo = "FECHADA" then
response.write "<td valign=top><font face=Arial size=1>" & bdrela("matutil") & "</font></td>"
end if
if tipo = "FECHADA" then
response.write "<td valign=top><font face=Arial size=1>" & bdrela("obs") & "</font></td>"
end if
response.write "<td align=center valign=top><font face=Arial size=1>" & mid(bdrela("dtabe"),1,10) & "</font></td>"
if tipo = "FECHADA" then
response.write "<td align=center valign=top><font face=Arial size=1>" & mid(bdrela("dtsol"),1,10) & "</td></font>"
end if
' if bdrela("datasolucao") <> "" then
' response.write "<tr><td valign=top>Tempo gasto (hs)</td><td>" & bdrela("tpreal") & "</td></tr>"
' end if
response.write "</tr>"
bdrela.Movenext
wend
response.write "</table>"
else
response.write "<center><font face=Arial size=2 color=#ff0000>Não existe ordem de serviço cadastrada para sua busca!</font></center>"
end if
conexao.close
set bdrela = nothing
set conexao = nothing
session("ossitua") = ""
response.write "</body></html>"
end if
%>