<%@ VERSION="0.92" %>
<%@ LANGUAGE="javascript" %>

<%@ IMPORT="util.es" %>

<SCRIPT RUNAT="server">
  var connection = "demo";
  var title = "*** Emp & Dept Productions ***";
</SCRIPT>

<%
  var sqlStatement = "SELECT * FROM emp WHERE deptno = " + parameters.deptno;

  var emps = sqlRowSet(connection, sqlStatement);

  if (emps == null)
  {
    showErrorPage("Database Error", dbError);
    return;
  }
%>

<HTML>
<HEAD>
  <TITLE>Department List</TITLE>
</HEAD>
<BODY BGCOLOR="#fcefc4">
  <CENTER>
  <H1><%= page.title %></H1>

  <BR>
  <TABLE BORDER="1">
    <CAPTION>
      <STRONG>Employee List<STRONG><HR>
    </CAPTION>
    <TR>
      <TH>Empno</TH>
      <TH>Ename</TH>
      <TH>Hiredate</TH>
      <TH>Job</TH>
      <TH>Sal</TH>
    </TR>
    <%
      for (var i = 0; i < emps.length; i++)
      {
        %>
	  <TR>
	    <TD ALIGN="right"><%= emps[i].empno %></TD>
	    <TD><%= emps[i].ename %></TD>
	    <TD><%= formatDate(emps[i].hiredate, "MM/dd/yyyy") %> &nbsp;</TD>
	    <TD><%= emps[i].job %></TD>
	    <TD ALIGN="right"><%= formatCurrency(emps[i].sal) %></TD>
	  </TR>
	<%
      }
    %>
  </TABLE>
  </CENTER>
</BODY>
</HTML>
