<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Map" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.*" %>
<%@ page import="net.sz600.database.*" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.formEngine.*" %>
<%@ include file="/sessionInfo.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%
    //获取提交的参数
    String sName = SzConvert.toZeroStr(request.getParameter("name"));
    String sFormID = SzConvert.toZeroStr(request.getParameter("FormID"));
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    String sKEY = SzConvert.toZeroStr(request.getParameter("KEY"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sSearchName = SzConvert.strWriteData(request.getParameter("txtSearchName"));
		String sSearchTitle = SzConvert.strWriteData(request.getParameter("txtSearchTitle"));    
    String txtDate1 = SzConvert.strWriteData(request.getParameter("txtDate1"));
    String txtDate2 = SzConvert.strWriteData(request.getParameter("txtDate2"));
    BdAlertControl bdAlertControl = new BdAlertControl();
		String str[] = null;
    //String sCond = bdAlertControl.genCond(sName, sFormID, txtDate1, txtDate2, iDLID_SESSION, false);
    //2015-01:不传入sName，sFormID获取多个sName
    String sCond = bdAlertControl.genDetailCond(SzConvert.toInt(sFormID), SzConvert.toInt(sKEY), iDLID_SESSION, isBarManager_SESSION);
    String sSortField = SzConvert.toSpaceStr(request.getParameter("txtSortField"));
    int iSortOrder    = Integer.parseInt(SzConvert.toZeroStr(request.getParameter("txtSortOrder")));
    if (sSortField.equals("")) {
    	sSortField = "TXID";
    	iSortOrder = SzProperties.I_SortOrder_DESC;
    }
    int iCurrentPage = 1;
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }
    if (!sSearchTitle.equals("")) {
    	sCond += " AND TXNR LIKE '%" + sSearchTitle + "%'";
    }   
    Iterator iter = bdAlertControl.getArrayList(sCond).iterator();

    SzPageInfo pageInfo = bdAlertControl.getPageInfo();
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;
    
%>
<!-----上面的工具栏------>
<%@ include file="/share/titleNameOnly.jsp"%>
<table width="100%">
  <form name="formBar" method="post">
  <input type="hidden" name="name" value="<%=sName%>">
  <input type="hidden" name="FormID" value="<%=sFormID%>">
  <input type="hidden" name="page" value="<%=sPage%>">  
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>">
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">
  <tr>
    <td align="right">
  <span class="yellowClass">&nbsp;表示已过时3天内&nbsp;</span>
  <span class="redClass">&nbsp;表示即将到来3天内&nbsp;</span>        
      <%=SzPageHelp.closeButton() %>  
    </td>
  </tr>
  </form>
</table>

<!-----信息列表----->
<table width="100%" border="1"  class="tableClass" cellpadding="1" cellspacing="0">

  <form name="formList" method="post">
  <input type="hidden" name="name" value="<%=sName%>">
  <input type="hidden" name="FormID" value="<%=sFormID%>">
  <input type="hidden" name="page" value="<%=iCurrentPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>">
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">
  <input type="hidden" name="txtDate1" value="<%=txtDate1%>">
  <input type="hidden" name="txtDate2" value="<%=txtDate2%>">  
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">   
  <tr class="trClassTitle">
  <!-- TXID,TXMC,TXBDID,TXXXID,TXNR,TXSJ,TXDLID,TXLX,TXXH,TXTQSJ,TXTQLX,TXCS,TXTXSJ  -->
    <td width="5"><input type="checkbox" name="chkCheckAll" OnClick="javascript:CheckAll(formList, chkCheckAll, 'chkId');"></td>
    <td>提醒内容</td>    
    <td width="120">时间</td>
    <td>提醒类型</td>
    <td>已提醒</td>
    <td>提醒时间</td>
    <td>邮件</td>
    <td>微信</td>    
  </tr>
<%
    BdAlert bdAlert = new BdAlert();
		String temp = "";
		String sClass = "";
    while (iter != null && iter.hasNext()) {
        str = (String[])iter.next();
        i++;
			temp = bdAlert.getAlertTypeName(SzConvert.toInt(str[7]));
			if (SzConvert.toInt(str[7]) == 2) {
				//循环
				temp += " " + bdAlert.getRepeatTypeName(SzConvert.toInt(str[8]));
			}
			if (SzConvert.toInt(str[7]) != 0 && SzConvert.toInt(str[7]) != 3) {
				temp += " 提前" + str[9] + " " + bdAlert.getBeforeTypeName(SzConvert.toInt(str[10]));
			}
			
			sClass = bdAlertControl.getClass(str[12], 3);
			
			
%>
  <tr  onMouseOver="javascript:this.className='trMouseOver'" onMouseOut="javascript:this.className='trMouseOut'" >
    <td width="5" title="<%=i%>"><input type="checkbox" name="chkId" id="chkId" value="<%=str[0]%>"></td>
		<td><%=str[4]%>&nbsp;</td>
		<td><%=str[5]%>&nbsp;</td>
		<td><%=temp%>&nbsp;</td>
		<td><%=str[11]%>次</td>
		<td class="<%=sClass%>"><%=str[12]%>&nbsp;</td>
		<td>
		<%
			if (str[13].equals("1")) {
				out.println("有");
			} else {
				out.println("&nbsp;");
			}
		%>
		</td>
		<td>
		<%
			if (str[14].equals("1")) {
				out.println("有");
			} else {
				out.println("&nbsp;");
			}
		%>		
		</td>
  </tr>
<%
    }
    int iLen = 8;
    out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, iLen));
%>

  </form>
</table>

<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  <input type="hidden" name="name" value="<%=sName%>">
  <input type="hidden" name="FormID" value="<%=sFormID%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>">
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">  
  <input type="hidden" name="txtDate1" value="<%=txtDate1%>">
  <input type="hidden" name="txtDate2" value="<%=txtDate2%>"> 
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">    
  <tr>
    <td align="right">

    </td>
  </tr>
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
	<input type="hidden" name="name" value="<%=sName%>">
  <input type="hidden" name="FormID" value="<%=sFormID%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="page" value="<%=iCurrentPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>">
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">
  <input type="hidden" name="txtDate1" value="<%=txtDate1%>">
  <input type="hidden" name="txtDate2" value="<%=txtDate2%>">
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">   
</form>
<script language="javascript" src="../../share/js/commonTool.js"></script>
<%
    ////如果要使用日历控件，必须输出这个calendarFrame
    out.println(SzPageHelp.calendar2Frame2());
%>
