<%
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set Conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
Set rs1 = Server.CreateObject("ADODB.Recordset")
Set rs2 = Server.CreateObject("ADODB.Recordset")
'Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("\DATABASE\PURUSCARE.mdb")&"; Jet OLEDB:System Database=system.mdw;"
Conn.Open "Provider=Microsoft.ACE.OleDb.12.0;Data Source="&Server.MapPath("\DATABASE\PURUSCARE.mdb")&"; Jet OLEDB:System Database=system.mdw;"
Function OptionAllWorkers()
sSql = "SELECT USERNAME, NAME FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' "
Set rs = Conn.Execute(sSql)
While Not rs.eof
response.Write ""
rs.movenext
wend
End function
Function OptionTeamList()
sSql = "SELECT USERNAME, NAME FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' AND CHEFIA='"&session("USER")&"'"
Set rs = Conn.Execute(sSql)
While Not rs.eof
response.Write ""
rs.movenext
wend
End function
Function FuelOptionTeamList()
sSql = "SELECT USERNAME, NAME FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' AND CHEFIA='"&session("USER")&"' or GALPFROTA=TRUE AND ACT='1' AND CHEFIA='"&session("USER")&"'"
Set rs = Conn.Execute(sSql)
While Not rs.eof
response.Write ""
rs.movenext
wend
End function
Function FuelWorkerByLocal()
sSql = "SELECT CONCESSAO FROM USERS GROUP BY CONCESSAO ORDER BY CONCESSAO"
Set rs = Conn.Execute(sSql)
caso = 0
While Not rs.eof
response.Write "case "&caso&":"
sSql = "SELECT NAME, USERNAME FROM USERS WHERE CONCESSAO='"&rs("CONCESSAO")&"' AND COLABORADOR=TRUE AND ACT='1' OR CONCESSAO='"&rs("CONCESSAO")&"' AND GALPFROTA=TRUE ORDER BY NAME"
Set rs1 = Conn.Execute(sSql)
While Not rs1.eof
response.Write "conteudo=conteudo+"""";"
rs1.movenext
Wend
response.Write "break;"
caso = caso + 1
rs.movenext
Wend
End Function
Function OptionWorkersList()
sSql = "SELECT USERNAME, NAME FROM USERS WHERE COLABORADOR=TRUE AND ACT='1'"
Set rs = Conn.Execute(sSql)
While Not rs.eof
response.Write ""
rs.movenext
wend
End function
Function allBrands()
sSql = "SELECT MARCA FROM GAMA GROUP BY MARCA "
Set rs1 = Conn.Execute(sSql)
While Not rs1.EOF
response.Write""
rs1.movenext
Wend
End Function
Function listModels()
sSql = "SELECT MARCA FROM GAMA GROUP BY MARCA ORDER BY MARCA"
Set rs = Conn.Execute(sSql)
caso = 1
While Not rs.eof
response.Write "case "&caso&":"
sSql = "SELECT * FROM GAMA WHERE MARCA='"&rs("MARCA")&"' ORDER BY MODELO"
Set rs1 = Conn.Execute(sSql)
response.Write "conteudo=conteudo+"""";"
While Not rs1.eof
response.Write "conteudo=conteudo+"""";"
rs1.movenext
Wend
response.Write "break;"
caso = caso + 1
rs.movenext
Wend
End Function
Function WorkerLocalList()
sSql = "SELECT CONCESSAO FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' AND CHEFIA='"&SESSION("USER")&"' GROUP BY CONCESSAO"
Set rs = Conn.Execute(sSql)
while not rs.eof
if request.Form("WorkerLocal")=rs("CONCESSAO") then
response.Write""
else
response.Write""
end if
rs.movenext
wend
End Function
Function WorkerDepartmentList()
sSql = "SELECT DEPARTAMENTO FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' AND CHEFIA='"&SESSION("USER")&"' GROUP BY DEPARTAMENTO"
Set rs = Conn.Execute(sSql)
while not rs.eof
if request.Form("WorkerDepartment")=rs("DEPARTAMENTO") then
response.Write""
else
response.Write""
end if
rs.movenext
wend
End Function
Function WorkerFunctionList()
sSql = "SELECT FUNCAO FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' AND CHEFIA='"&SESSION("USER")&"' GROUP BY FUNCAO"
Set rs = Conn.Execute(sSql)
while not rs.eof
if request.Form("WorkerFunction")=rs("FUNCAO") then
response.Write""
else
response.Write""
end if
rs.movenext
wend
End Function
Function AllLocalList()
sSql = "SELECT CONCESSAO FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' GROUP BY CONCESSAO"
Set rs = Conn.Execute(sSql)
while not rs.eof
if request.Form("WorkerLocal")=rs("CONCESSAO") then
response.Write""
else
response.Write""
end if
rs.movenext
wend
End Function
Function AllDepartmentList()
sSql = "SELECT DEPARTAMENTO FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' GROUP BY DEPARTAMENTO"
Set rs = Conn.Execute(sSql)
while not rs.eof
if request.Form("WorkerDepartment")=rs("DEPARTAMENTO") then
response.Write""
else
response.Write""
end if
rs.movenext
wend
End Function
Function AllFunctionList()
sSql = "SELECT FUNCAO FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' GROUP BY FUNCAO"
Set rs = Conn.Execute(sSql)
while not rs.eof
if request.Form("WorkerFunction")=rs("FUNCAO") then
response.Write""
else
response.Write""
end if
rs.movenext
wend
End Function
Function DepartmentByLocal()
sSql = "SELECT CONCESSAO FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' GROUP BY CONCESSAO ORDER BY CONCESSAO"
Set rs = Conn.Execute(sSql)
caso = 0
While Not rs.eof
response.Write "case "&caso&":"
sSql = "SELECT DEPARTAMENTO FROM USERS WHERE CONCESSAO = '"&rs("CONCESSAO")&"' AND COLABORADOR=TRUE AND ACT='1' GROUP BY DEPARTAMENTO ORDER BY DEPARTAMENTO"
Set rs1 = Conn.Execute(sSql)
response.Write "conteudo=conteudo+"""";"
While Not rs1.eof
response.Write "conteudo=conteudo+"""";"
rs1.movenext
Wend
response.Write "break;"
caso = caso + 1
rs.movenext
Wend
End Function
Function WorkerFunctionByLocal()
sSql = "SELECT CONCESSAO FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' GROUP BY CONCESSAO ORDER BY CONCESSAO"
Set rs = Conn.Execute(sSql)
caso = 0
While Not rs.eof
response.Write "case "&caso&":"
sSql = "SELECT FUNCAO FROM USERS WHERE CONCESSAO = '"&rs("CONCESSAO")&"' AND COLABORADOR=TRUE AND ACT='1' GROUP BY FUNCAO ORDER BY FUNCAO"
Set rs1 = Conn.Execute(sSql)
response.Write "conteudo=conteudo+"""";"
While Not rs1.eof
response.Write "conteudo=conteudo+"""";"
rs1.movenext
Wend
response.Write "break;"
caso = caso + 1
rs.movenext
Wend
End Function
Function WorkerFunctionByBoss()
sSql = "SELECT CONCESSAO FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' AND CHEFIA='"&SESSION("USER")&"' GROUP BY CONCESSAO ORDER BY CONCESSAO"
Set rs = Conn.Execute(sSql)
caso = 0
While Not rs.eof
response.Write "case "&caso&":"
sSql = "SELECT FUNCAO FROM USERS WHERE CONCESSAO = '"&rs("CONCESSAO")&"' AND COLABORADOR=TRUE AND ACT='1' AND CHEFIA='"&SESSION("USER")&"' GROUP BY FUNCAO ORDER BY FUNCAO"
Set rs1 = Conn.Execute(sSql)
While Not rs1.eof
response.Write "conteudo=conteudo+"""";"
rs1.movenext
Wend
response.Write "break;"
caso = caso + 1
rs.movenext
Wend
End Function
Function AllMatriculationKms()
sSql = "SELECT MATRICULATION FROM REGISTRY_KMS GROUP BY MATRICULATION"
Set rs = Conn.Execute(sSql)
while not rs.eof
if request.Form("MatriculationKms")=rs("MATRICULATION") then
response.Write""
else
response.Write""
end if
rs.movenext
wend
End Function
Function AllPrinters()
sSql = "SELECT IMPRESSORA FROM CONSUMIVEIS GROUP BY IMPRESSORA"
Set rs = Conn.Execute(sSql)
while not rs.eof
if request.Form("printer")=rs("IMPRESSORA") then
response.Write""
else
response.Write""
end if
rs.movenext
wend
End Function
Function AllPrinters1()
sSql = "SELECT PRINTER_NAME FROM PRINTERS GROUP BY PRINTER_NAME"
Set rs = Conn.Execute(sSql)
while not rs.eof
if request.Form("printer")=rs("PRINTER_NAME") then
response.Write""
else
response.Write""
end if
rs.movenext
wend
End Function
Function ListConsumable()
sSql = "SELECT PRINTER_NAME FROM PRINTERS GROUP BY PRINTER_NAME ORDER BY PRINTER_NAME"
Set rs = Conn.Execute(sSql)
caso = 1
While Not rs.eof
response.Write "case "&caso&":"
sSql = "SELECT PRINTER_CONSUMABLE FROM PRINTERS WHERE PRINTER_NAME = '"&rs("PRINTER_NAME")&"' GROUP BY PRINTER_CONSUMABLE ORDER BY PRINTER_CONSUMABLE"
Set rs1 = Conn.Execute(sSql)
While Not rs1.eof
response.Write "conteudo=conteudo+"""";"
rs1.movenext
Wend
response.Write "break;"
caso = caso + 1
rs.movenext
Wend
End Function
%>
<% if request.QueryString("pag")="fuel-information-month.asp" or request.QueryString("pag")="fuel-information-month-team.asp" or request.QueryString("pag")="spending-information.asp" or request.QueryString("pag")="spending-information-team.asp" or request.QueryString("pag")="processes-information.asp" then%>
<%elseif request.QueryString("pag")="spending-information-month-worker.asp" or request.QueryString("pag")="vacation-worker.asp" then%>