<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.mail.*" %>
<%@ 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 sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    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"));   
    String sTable_type = "";
    //读取数据
    YjMailAlert yjMailAlert = new YjMailAlert();
    YjMailAlertInfo yjMailAlertInfo = null;
    String sCond = "1=1";
    if (!isBarManager_SESSION) {
    	sCond = "TXDLID=" + iDLID_SESSION;
    }
    if (!txtDate1.equals("")) {
    	sCond += " AND TXSJ>='" + txtDate1 + "'";
    }
    if (!txtDate2.equals("")) {
    	sCond += " AND TXSJ<='" + txtDate2 + "'";
    }    

    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 (!sSearchName.equals("")) {
    	sCond += " AND TXDLXM ='" + sSearchName + "'";
    }   
    if (!sSearchTitle.equals("")) {
    	sCond += " AND TXBT LIKE '%" + sSearchTitle + "%'";
    }      
    

    Iterator iter = yjMailAlert.getArrayList(sCond, sSortField, iSortOrder, iCurrentPage, sSearch).iterator();

    SzPageInfo pageInfo = yjMailAlert.getPageInfo();
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;
%>
<!-----上面的工具栏------>
<%@ include file="/share/title.jsp"%>
<table width="100%">
  <form name="formBar" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <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="sCond" value="<%=sCond%>">  
  <tr>
    <td>
    <% if (isBarManager_SESSION) { %>
      <%=SzPageHelp.deleteButton()%>
    <% } %>
  	 提醒日期<input type="text" class="txtClassSearch" name="txtDate1" value="<%=txtDate1%>"><%=SzPageHelp.calendar2Select2("formBar.txtDate1")%>-<input type="text" class="txtClassSearch" name="txtDate2" value="<%=txtDate2%>"><%=SzPageHelp.calendar2Select2("formBar.txtDate2")%>
      收件人员<input type="text" name="txtSearchName" class="txtClassSearch" value="<%=sSearchName%>" OnDblClick="javascript:OpenWin32('../../','','formBar.txtSearchName');">
		 提醒标题<input type="text" name="txtSearchTitle" class="txtClassSearch" value="<%=sSearchTitle%>">      
  
  <input type="button" class="btnClass" value="查询" OnClick="javascript:FormSubmit(formBar, 'index.jsp');">
    
    </td>
  </tr>
  </form>
</table>

<!-----信息列表----->
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">
  <form name="formList" method="post">
  <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="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">   
  <tr class="trClassTitle">
    <td width="5"><input type="checkbox" name="chkCheckAll" OnClick="javascript:CheckAll(formList, chkCheckAll, 'chkId');"></td>
    <td><%=SzPageHelp.sortTitle("提醒标题", "TXBT", sSortField, iSortOrder)%></td>
    <td width="120"><%=SzPageHelp.sortTitle("提醒时间", "TXSJ", sSortField, iSortOrder)%></td>
    <td width="120"><%=SzPageHelp.sortTitle("收件人员", "TXDLXM", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("收件地址", "TXYJDZ", sSortField, iSortOrder)%></td>
    <td width="60"><%=SzPageHelp.sortTitle("状态", "TXFSBZ", sSortField, iSortOrder)%></td>
  </tr>
<%
	String disabled = "";
	String s = "";
    while (iter != null && iter.hasNext()) {
    	yjMailAlertInfo = (YjMailAlertInfo)iter.next();
      
        i++;
%>
  <tr>
    <td width="5" title="<%=i%>">
    <%
    if (yjMailAlertInfo.getTXFSBZ() == 1) {
    	s = "已发";
    	disabled = "";
    } else {
    	s = "<font color='blue'>未发</font>";
    	//disabled = "disabled";
    }      
    %>
    <input type="checkbox" name="chkId" id="chkId" value="<%=yjMailAlertInfo.getTXID()%>" <%=disabled%>></td>
    <td><%=yjMailAlertInfo.getTXBT()%>&nbsp;</td>
    <td><%=yjMailAlertInfo.getTXSJ()%>&nbsp;</td>
    <td><%=yjMailAlertInfo.getTXDLXM()%>&nbsp;</td>
    <td><%=yjMailAlertInfo.getTXYJDZ()%>&nbsp;</td>
    <td><%=yjMailAlert.getForeignMailStateName(yjMailAlertInfo.getTXFSBZ())%>&nbsp;</td>
  </tr>
<%
    }
    out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 6));
%>

  </form>
</table>

<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  <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">
      <%@ include file="/share/page/page_include.jsp"%>
    </td>
  </tr>
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
  <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="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">    
</form>
<script language="javascript" src="../../share/js/commonTool.js"></script>
<%
    ////如果要使用日历控件，必须输出这个calendarFrame
    out.println(SzPageHelp.calendar2Frame2());
%>
