<%@ Language= VBScript%>
<%
'set up the connection object if not already connected
Set Myconn = Server.CreateObject("ADODB.Connection"
'Connect to ODBC Source
MyConn.Open "timesheet"
UserNo=request.cookies("UserID"

("EmpNo"
If request.querystring="" then
EmpNo=1
End If
assign=request.querystring("assign"
Set RS=MyConn.Execute("Select EmployeeNo, Firstname, Surname, LineManager from employee where LineManagerStatus=FALSE"
If request.querystring <>"" then
EmpNo=request.querystring("EmployeeNo"

updatecheck=request.querystring("update"
If updatecheck = "true" then
strSQL = "update employee set"
strSQL = strSQL & " LineManagerStatus=true "
strSQL = strSQL & "WHERE EmployeeNo=" & EmpNo
Set RS6 = MyConn.Execute(strSQL)
End If
End If
Set RS2=MyConn.Execute("Select EmployeeNo, FirstName, Surname, LineManager from employee where EmployeeNo=" & EmpNo)
Set RS3=MyConn.Execute("Select FirstName, Surname from employee where EmployeeNo=" & RS2("LineManager"

)
Set RS4=MyConn.Execute("Select EmployeeNo, FirstName, Surname from Employee where EmployeeNo<>" & RS2("EmployeeNo"

)
Set RS5=MyConn.Execute("Select EmployeeNo, FirstName, Surname from Employee where EmployeeNo=" & RS2("LineManager"

)
%>
<HTML>
<HEAD>
<TITLE>Line Manager Administration Screen</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function jump_menu(targ, selObj){
eval(targ+".location='AssignLMStatus.asp?EmployeeNo=" + selObj.options[selObj.selectedIndex].value + "'"

;
}
function AssignStatus(targ, selObj){
eval(targ+".location='AssignLMStatus.asp?EmployeeNo=" + <%=RS2("EmployeeNo"

%> + "&update=true&assign=true'"

;
}
function addemployee(targ, selObj){
eval(targ+".location='AssignLMStatus.asp?EmployeeNo=" + selObj.options[selObj.selectedIndex].value + "&update=true&assign=true + <%=RS2("LineManager"

%>'"

;
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" BACKGROUND="pagebackground.jpg">
<DIV ALIGN="Center"> </DIV>
<P ALIGN="Center"><I><B><FONT COLOR="#336600" SIZE="5">Assign LineManager Status</FONT></B></I></P>
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="10" CELLSPACING="0">
<TR>
<TD>
<TABLE WIDTH="100%" CELLPADDING="5" BORDER="0" ALIGN="center">
</TR>
<TR VALIGN="top">
<TD align=center>
<form>
<Select name ="NonLineManagers" onChange="jump_menu('this', this)">
<OPTION VALUE=""SELECTED></OPTION>
<% ON ERROR RESUME NEXT
RS.MOVEFIRST
DO WHILE NOT (RS.EOF)
%>
<OPTION VALUE ="<%=RS("employeeno"

%>" Name="<%=RS("employeeno"

%>"><%=RS("firstname"

%> <%=RS("surname"

%></OPTION>
<%
RS.MOVENEXT
LOOP
RS.CLOSE
%>
</select>
</form>
</TD>
</TR>
<TR>
<TD><TABLE WIDTH= 100% COLSPAN= 8 CELLPADDING=1 BORDER= 0 CELLSPACING= 1 ALIGN="center">
<TD ALIGN="Center" BGCOLOR="336600" WIDTH="15%"><FONT FACE="Arial, Helvetica, Sans-Serif" COLOR="#ffffff" SIZE="2"> <B>EMPLOYEE NO</B></FONT></TD>
<TD ALIGN="Center" BGCOLOR="336600" WIDTH=15%><FONT FACE="Arial, Helvetica, Sans-Serif" COLOR="#ffffff" SIZE="2"> <B>FIRSTNAME</B></FONT></TD>
<TD ALIGN="Center" BGCOLOR="336600" WIDTH=15%><FONT FACE="Arial, Helvetica, Sans-Serif" COLOR="#ffffff" SIZE="2"> <B>SURNAME</B></FONT></TD>
<TD ALIGN="Center" BGCOLOR="336600" WIDTH=15%><FONT FACE="Arial, Helvetica, Sans-Serif" COLOR="#ffffff" SIZE="2"> <B>DEPARTMENT</B></FONT></TD>
<TD ALIGN="Center" BGCOLOR="336600" WIDTH=15%><FONT FACE="Arial, Helvetica, Sans-Serif" COLOR="#ffffff" SIZE="2"> <B>LINE MANAGER</B></FONT></TD>
</TR>
<TR BGCOLOR="#ECFFEC">
<TD ALIGN="Center" WIDTH=15%><FONT FACE="Arial Helvetica, Sans-Serif" SIZE="2"> <%=RS2("employeeno"

%></FONT></TD>
<TD ALIGN="Center" WIDTH=15%><FONT FACE="Arial Helvetica, Sans-Serif" SIZE="2"> <%=RS2("Firstname"

%></FONT></TD>
<TD ALIGN="Center" WIDTH=15%><FONT FACE="Arial Helvetica, Sans-Serif" SIZE="2"> <%=RS2("Surname"

%></FONT></TD>
<TD ALIGN="Center" WIDTH=15%><FONT FACE="Arial Helvetica, Sans-Serif" SIZE="2"> <%=RS2("Department"

%></FONT></TD>
<TD ALIGN="Center" WIDTH=15%><FONT FACE="Arial Helvetica, Sans-Serif" SIZE="2"> <%=RS3("firstname"

%> <%=RS3("surname"

%></FONT></TD>
</TR>
</table>
</TD>
</TR>
</TABLE>
</TABLE>
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="50" CELLSPACING="0">
<TR><ROWSPAN=20>
<TD>
<TABLE WIDTH="0%" BORDER="1" ALIGN="Center">
<TR VALIGN="TOP">
<form>
<INPUT TYPE="button" value="ASSIGN LM STATUS" ONCLICK="AssignStatus('this', this)">
</form>
</TR>
</TD>
</TR>
</TABLE>
<TR VALIGN="top">
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="100" CELLSPACING="0">
<TR>
<TD align="left" WIDTH="45%" valign="top">
<form>
<%if assign="true" then%>
<Select name ="Employees4Team" SIZE=10 MULTIPLE
<OPTION VALUE=""SELECTED></OPTION>
<% ON ERROR RESUME NEXT
RS4.MOVEFIRST
DO WHILE NOT (RS4.EOF)
%>
<OPTION VALUE="<%=RS4("employeeno"

%>" Name="<%=RS4("employeeno"

%>"><%=RS4("firstname"

%> <%=RS4("surname"

%></OPTION>
<%
RS4.MOVENEXT
LOOP
RS4.CLOSE
%>
</select>
</td>
</form>
<td WIDTH="10%" VALIGN="MIDDLE" >
<ALIGN="MIDDLE"><I><B><FONT COLOR="#336600" SIZE="2">Add</FONT></B></I>
<input type ="button" value=">>" ALIGN="TOP" onclick="addemployee('this' , 'Employees4Team')">
<ALIGN="middle"><I><B><FONT COLOR="#336600" SIZE="2">Remove</FONT></B></I>
<INPUT TYPE="button" VALUE="<<" ALIGN="BoTTOm" onclick="addemployee">
</td>
</FORM>
<form>
<td align="right" WIDTH="45%" cellPADDING="50" valign="top">
<Select name ="assembledTeam" SIZE=10 MULTIPLE>
<OPTION VALUE=""SELECTED></OPTION>
<% ON ERROR RESUME NEXT
RS5.MOVEFIRST
DO WHILE NOT (RS5.EOF)
%>
<OPTION VALUE="<%=RS5("employeeno"

%>"
Name="<%=RS5("employeeno"

%>"><%=RS5("firstname"

%> <%=RS5("surname"

%></OPTION>
<%
RS5.MOVENEXT
LOOP
RS5.CLOSE
%>
</select>
<%end if%>
</td>
</form>
</TR>
</Table>
</BODY>
</HTML>