<% 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%>
">
<%elseif request.QueryString("pag")="spending-information-worker.asp" then%>
">
<%elseif request.QueryString("pag")="vacation-validation.asp" then%>
">
<% if Session("DEPARTMENT")="Pós Venda" then %>
<%end if%>
<%elseif request.QueryString("pag")="vacation-analytics.asp" then%>
">
<% if Session("DEPARTMENT")="RH" or Session("USER")="joaoalberto@pc" or Session("USER")="pedromatos@AM098" then %>
<%end if%>
<%elseif request.QueryString("pag")="vacation-analytics-worker.asp" then%>
">
<%elseif request.QueryString("pag")="contacts-list.asp" or request.QueryString("pag")="registry-vn-list.asp" then%>
">
">
<%elseif request.QueryString("pag")="lab-production.asp" or request.QueryString("pag")="laboratory.asp" or request.QueryString("pag")="lab-ps.asp" or request.QueryString("pag")="lab-lousa.asp" then%>
">
">
<%elseif request.QueryString("pag")="consumable-analytics.asp" then%>
">
<%End if%>
<%Dim pageMenu pageMenu = Request.QueryString("pag") Select Case pageMenu Case "" %> <% case "vacation-profile.asp" %> <% case "vacation-validation.asp" %> <% case "vacation-worker.asp" %> <% case "vacation-analytics.asp" %> <% case "vacation-analytics-worker.asp" %> <% case "contacts-profile.asp" %> <% case "contacts-list.asp" %> <% case "contacts-team.asp" %> <% case "news-list.asp" %> <% case "news-edit.asp" %> <% case "consumable-list.asp" %> <% case "consumable-analytics.asp" %> <% case "vcard.asp" %> <% case "lab-production.asp" %> <% case "laboratory.asp" %> <% case "lab-ps.asp" %> <% case "lab-lousa.asp" %> <% case "analytics.asp" %> <% case "formacoes.asp" %> <%End Select%>
Home
Contactos
<%if session("USER")="joaoalberto@pc" or session("USER")="andretavares@LP098" or session("USER")="miguelrasquinho@AB45" or session("USER")="nelsongoncalves@AM044" then%>
Consumíveis
<%end if%> <%if session("ECONOMATO")=TRUE then%>
Consumíveis
<%end if%>
Despesas
<%if Session("CHEFE")=TRUE or session("USER")="joaoalberto@pc" then%>
Despesas Team
<%end if%> <%if session("USER")="joaoalberto@pc" or session("USER")="pedromatos@AM098" or session("USER")="josetavares@AM054" then%>
Despesas Analytics
<%end if%>
Férias
<%if Session("CHEFE")=TRUE or session("USER")="joaoalberto@pc" then%>
Férias Team
<%end if%> <%if session("USER")="joaoalberto@pc" or session("USER")="pedromatos@AM098" or session("FUNCTION")="RH" then%>
Férias Analytics
<%end if%> <%if session("USER")="jarbasmelo@pc" then%>
Laboratório
<%end if%> <%if session("USER")="jessicapina@pc" then%>
Laboratório
<%end if%> <%if session("USER")="joaoalberto@pc" then%>
Laboratório
<%end if%> <%if session("USER")="joaoalberto@pc" or session("USER")="pedromatos@AM098" or session("FUNCTION")="Marketing" then%>
Notícias
<%end if%>
Logout
<% sSql = "SELECT * FROM USERS WHERE USERNAME='"&Session("USER")&"'" Set rs = Conn.Execute(sSql) %>
<% Set objFolder = objFSO.GetFolder(Server.MapPath("workers")&"\"&Session("USER")&"\") photo=0 For Each objFile in objFolder.Files if photo<1 then %>
/<%=replace(objFile.Name," ","%20")%>);">
<% photo=2 end if next%>
<%=Session("NAME")%>">
<%=Session("FUNCTION")%>
<%=Session("EMAIL")%>
<%=rs.fields("CONTACTO")%>

Departamento:
<%=Session("DEPARTMENT")%>

Concessão:
<%=Session("CONCESSAO")%>

<%if Session("BOSS")<>Session("USER") then%> Chefia:
<% Set objFolder = objFSO.GetFolder(Server.MapPath("workers")&"\"&Session("BOSS")&"\") photo=0 For Each objFile in objFolder.Files if photo<1 then %>
/<%=replace(objFile.Name," ","%20")%>);">
<% photo=2 end if next%> <%end if%>
Equipa:
<% if session("CHEFE")=TRUE then sSql = "SELECT * FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' AND CHEFIA='"&Session("USER")&"' AND USERNAME<>'"&Session("USER")&"' AND DEPARTAMENTO='"&Session("DEPARTMENT")&"'" else sSql = "SELECT * FROM USERS WHERE COLABORADOR=TRUE AND ACT='1' AND CHEFIA='"&Session("BOSS")&"' AND DEPARTAMENTO='"&Session("DEPARTMENT")&"' AND USERNAME<>'"&Session("USER")&"' AND USERNAME<>'"&Session("BOSS")&"' " end if Set rs = Conn.Execute(sSql) while not rs.eof Set objFolder = objFSO.GetFolder(Server.MapPath("workers")&"\"&rs("USERNAME")&"\") photo=0 For Each objFile in objFolder.Files if photo<1 then %> ">
/<%=replace(objFile.Name," ","%20")%>);">
<% photo=2 end if next rs.MoveNext wend %>
<% conn.close Set rs = Nothing Set rs1 = Nothing Set rs2 = Nothing Set Conn = Nothing %>