<%@ 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="com.soarwell.weixin.append.*" %>
<%@ page import="com.soarwell.weixin.oa.User" %>
<%@ include file="/sessionInfoWeixin.jsp"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />
<%@ include file="/share/oa_app_title.jsp"%>
<link href="<%=strLevel_SESSION%>app/images/soarwell_css.css" rel="stylesheet" type="text/css" />
</head>
<%
    //获取提交的参数
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sSearchName = SzConvert.strWriteData(request.getParameter("txtSearchName"));
    String txtDate1 = SzConvert.strWriteData(request.getParameter("txtDate1"));
    String txtDate2 = SzConvert.strWriteData(request.getParameter("txtDate2")); 

    String sTable_type = "";
    //读取数据
    CustMessage custMessage = new CustMessage();
    CustMessageInfo custMessageInfo = null;
    String sCond = "1=1";
    if (!isBarManager_SESSION) {
    	sCond = "WXDLID=" + iDLID_SESSION;
    }
    if (!txtDate1.equals("")) {
    	sCond += " AND WXSJ>='" + txtDate1 + "'";
    }
    if (!txtDate2.equals("")) {
    	sCond += " AND WXSJ<='" + txtDate2 + "'";
    }      
    String sSortField = SzConvert.toSpaceStr(request.getParameter("txtSortField")); 
    int iSortOrder    = Integer.parseInt(SzConvert.toZeroStr(request.getParameter("txtSortOrder"))); 
    if (sSortField.equals("")) { 
      sSortField = "WXID";
      iSortOrder = SzProperties.I_SortOrder_DESC;
    } 
    int iCurrentPage = 1;
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }
    int iPageSize = SzProperties.I_PageSize_APP;
    Iterator iter = custMessage.getArrayList(sCond, sSortField, iSortOrder, iCurrentPage, iPageSize, sSearch).iterator();

    SzPageInfo pageInfo = custMessage.getPageInfo();
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;
%>
<!-----上面的工具栏------>
<%@ include file="/app/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%>">
  
  <tr>
    <td>
      <%=SzPageHelp.deleteButton()%>
  接收日期<input type="text" class="txtClass100" name="txtDate1" value="<%=txtDate1%>"><%=SzPageHelp.calendarSelect2("formBar.txtDate1")%>-<input type="text" class="txtClass100" name="txtDate2" value="<%=txtDate2%>"><%=SzPageHelp.calendarSelect2("formBar.txtDate2")%>
  <input type="button" class="btnClass" value="查询" OnClick="javascript:FormSubmit(formBar, 'index.jsp');">
          
    </td>
  </tr>
  </form>
</table>

<!-----信息列表----->
<table width="100%" border="0" cellspacing="3" cellpadding="3" style="border:#D7D7D9 1px solid;">
  <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%>">  
<% 
    String s = "";
		User user = new User(); 
    while (iter != null && iter.hasNext()) {
    		custMessageInfo = (CustMessageInfo)iter.next();
        i++;  
%>
<%
	if (i>1) {
%>
  <tr>
    <td height="8" align="left" background="../images/line.gif"></td>
  </tr> 
<% } %> 
  <tr>
    <td><span class="product_name"><%=i%></span>
          <input type="checkbox" name="chkId" id="chkId" value="<%=custMessageInfo.getWXID()%>">
    <% if (isBarManager_SESSION) { %>
      <a href="javascript:FormSubmit(formPage,'update.jsp?OPERATOR=reply&type=<%=sType%>&KEY=<%=custMessageInfo.getWXID()%>');">回复</a>
    <% } %>  
    <% if (isSystemManager_SESSION) { %>
      <a href="javascript:FormSubmit(formPage,'bind.jsp?OPERATOR=bind&type=<%=sType%>&KEY=<%=custMessageInfo.getWXID()%>');">绑定</a>
    <% } %>
    </td>
  </tr> 
  <tr>  
    <td><span class="product_content">
        <b>[微信昵称]</b><%=custMessageInfo.getWXNC()%>&nbsp;
        </span>
    </td>
  </tr>  
  <tr>  
    <td><span class="product_content">
        <b>[OA绑定用户]</b><%=user.getBindLoginName(custMessageInfo.getWXOPENID())%>&nbsp;
        </span>
    </td>
  </tr>  
  <tr>  
    <td><span class="product_content">
        <b>[接收时间]</b><%=user.getBindLoginName(custMessageInfo.getWXSJ())%>&nbsp;
        </span>
    </td>
  </tr>    
  <tr>  
    <td><span class="product_content">
        <b>[发送内容]</b><%=user.getBindLoginName(custMessageInfo.getWXNR())%>&nbsp;
        </span>
    </td>
  </tr>
  <tr>  
    <td><span class="product_content">
        <b>[回复人员]</b><%=user.getBindLoginName(custMessageInfo.getWXHFRY())%>&nbsp;
        </span>
    </td>
  </tr>
  <tr>  
    <td><span class="product_content">
        <b>[回复时间]</b><%=user.getBindLoginName(custMessageInfo.getWXHFSJ())%>&nbsp;
        </span>
    </td>
  </tr>
  <tr>  
    <td><span class="product_content">
        <b>[回复内容]</b><%=user.getBindLoginName(custMessageInfo.getWXHFNR())%>&nbsp;
        </span>
    </td>
  </tr>        

<%
    }
    out.println(SzPageHelp.printTableBlankApp(i, iPageSize));
%>

  </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%>">  
  <%@ include file="/app/share/page_include.jsp" %>
  </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%>">  
</form>
<script language="javascript" src="../../share/js/commonTool.js"></script>
<%
    ////如果要使用日历控件，必须输出这个calendarFrame
    out.println(SzPageHelp.calendarFrame2());
%>

