<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.tool.SzDateHelp"%>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.drivingSchool.*" %>
<%@ include file="/sessionInfo.jsp"%>

<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../share/js/commonTool.js"></script>

</head>
<%
	String sSearchBegin = SzConvert.strWriteData(request.getParameter("txtSearchBegin"));
	String sSearchEnd = SzConvert.strWriteData(request.getParameter("txtSearchEnd"));
	//教练
	String JL = SzConvert.strWriteData(request.getParameter("JL"));
	//条件sCond
	StringBuffer sCond = new StringBuffer("");
	//如果开始时间和结束时间都为空，就默认为当前月
	Date currentDate = null;
	
	//如果开始时间和结束时间都为空，就默认为当前月
	if(sSearchBegin.equals("")){
		sSearchBegin = SzDateHelp.dateToYMD(SzDateHelp.getFirstDateMonth());
	}
	if (sSearchEnd.equals("")){
		sSearchEnd = SzDateHelp.dateToYMD(SzDateHelp.getLastDateMonth());
	}
	//查询的结束时间
	String searchEnd = SzDateHelp.dateToYMD(SzDateHelp.nextDay(SzDateHelp.stringToDate(sSearchEnd)));
	
	
	if (!JL.equals("")){
		sCond.append(" AND XXMC2='");
		sCond.append(JL);
		sCond.append("'");
	}
	//out.println(sCond.toString());
	//
	Coach coach = new Coach();
	StatHelp statHelp = new StatHelp();
	//取得分点招收的各状态的人数
	Map studentCountOfCoachMap = statHelp.getStudentCountOfCoach(sSearchBegin,searchEnd);
	//获取学员信息
	String[] field = new String[]{"XXMC1","XXMC2"};
	ArrayList<String[]> coachList = coach.getCoachList(field,sCond.toString());
	int iSize = coachList.size();
	
	//学员
	String[] coachInfo = null;
	//学员状态
	String[] stateName = new String[]{"在学","暂停","休学(长时间不来)","领证"};
%>
<%@ include file="/share/title.jsp"%>
<table width="100%">
  <form name="formBar" method="post">
  <tr>
    <td>  
      教练<input type="text" name="JL" class="txtClassSearch" value="<%=JL %>">
      开始<input type="text" name="txtSearchBegin" class="txtClassSearch" value="<%=sSearchBegin%>" readonly>
      <%=SzPageHelp.calendar2Select("../../","formBar.txtSearchBegin")%>
      结束<input type="text" name="txtSearchEnd" class="txtClassSearch" value="<%=sSearchEnd%>" readonly>
      <%=SzPageHelp.calendar2Select("../../","formBar.txtSearchEnd")%>
      <%=SzPageHelp.button("btnClass", "查询", "javascript:FormSubmit(formBar,'statStudentCountOfCoach.jsp');", "btnSearch")%>
    </td>
  </tr>
  </form>
</table>
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">
  <form name="formUpdate" method="post">
  <input type="hidden" name="OPERATOR" value="add"> 
  <input type="hidden" name="SzDLXM" value="<%=sDLXM_SESSION %>">
  <input type="hidden" name="SzDLID" value="<%=iDLID_SESSION %>">
  <input type="hidden" name="SzBMMC" value="<%=sBMMC_SESSION %>">
  <input type="hidden" name="SzBMID" value="<%=iBMID_SESSION %>">
  <input type="hidden" name="JL" value="<%=JL %>">
  
  <tr class="trClassTitle">
  	<td width="150">教练</td>
	<td>在学人数</td>
	<td>暂停人数</td>
	<td>休学人数</td>
	<td>领证人数</td>
  </tr>
  <%
		//ToSetUpCourse toSetUpCourse = new ToSetUpCourse();
		Iterator iterStat = coachList.iterator();
		String strStatInfo[] = null;
		while (iterStat.hasNext()) {
			coachInfo = (String[])iterStat.next();
	%>
  <tr>
  	<td align="center"><%=coachInfo[1] %></td>
		<%
			int iCount = 0;
			for (int i = 0;i<stateName.length;i++) {
				//取得已分配教练
				strStatInfo = (String[])studentCountOfCoachMap.get(new String(coachInfo[0] + ":" + stateName[i]));
				iCount = strStatInfo==null? 0:Integer.valueOf(strStatInfo[0]);
				
				out.print("<td align=\"center\">");
				out.print(iCount);		
				out.println("</td>");
			}
		%>
	<%		
		}
  %>
    </tr>

  </form>
</table>

<%
    ////如果要使用日历控件，必须输出这个calendarFrame
    out.println(SzPageHelp.calendar2Frame("../../"));
%>


