<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.tool.*" %>
<%@ page import="net.sz600.database.*" %>
<%@ page import="net.sz600.database.other.*" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ include file="/sessionInfoWeixin.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=strSkin_SESSION%>/css2007app.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../share/js/commonTool.js"></script>

<script language="javascript">
  function GoUrl(url, name) {  	
  	document.location.href = url + "?txtName2=" + encodeURIComponent(name);
  }
</script>
</head>
<%@ include file="/app/title.jsp"%>
<%
    //获取提交的参数
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sNumber = SzConvert.strWriteData(request.getParameter("txtNumber"));
    String sNumber2 = SzConvert.strWriteData(request.getParameter("txtNumber2"));
    String sName = SzConvert.strWriteData(request.getParameter("txtName"));
    String sName2 = SzConvert.strWriteData(request.getParameter("txtName2"));
    String PointName = SzConvert.strWriteData(request.getParameter("PointName"));
    String sState = SzConvert.strWriteData(request.getParameter("txtState"));

    StringBuffer sbCond = new StringBuffer("A.PointId=B.PointId");

    if (!PointName.equals("")) {
    	sbCond.append(" AND PointName = '" + PointName + "'");
    }
    if (!sName2.equals("")) {
    	sbCond.append(" AND BillNo = '" + sName2 + "'");
    }    
    if (!sName.equals("")) {
    	sbCond.append(" AND Content LIKE '%" + sName + "%'");
    }     

    
    String sSortField = SzConvert.toSpaceStr(request.getParameter("txtSortField")); 
    int iSortOrder    = Integer.parseInt(SzConvert.toZeroStr(request.getParameter("txtSortOrder"))); 
    if (sSortField.equals("")) { 
    	sSortField = "BillNo";
    	iSortOrder = SzProperties.I_SortOrder_DESC;
    }
    int iPageSize = SzProperties.I_PageSize;
    int iCurrentPage = 1;    
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }	  
    int iColumnCount = 6;
    String sTable = "X_ReviewRecordDetail A, X_comPointMaster B";
	  String sField = "A.BillNo,A.RowCode,A.RowNo,B.PointName,A.AccessoryId,A.Content";
	  String sCond = sbCond.toString();
	  
		SzDataReaderZs dr = new SzDataReaderZs();
	  
		ArrayList list = dr.readInfoArray(sTable, sField, sCond, sSortField, iSortOrder, iCurrentPage, iPageSize, iColumnCount);
	  SzPageInfo pageInfo = dr.getPageInfo();				
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;
    
    String s_id[] = {"","0","1","2","3","4"};
    String s_name[] = {"全部","未确认","确认","已取消","无效","退货"};
    
    
    ArrayList list2 = dr.readInfoArray("X_comPointMaster", "PointName", "1=1", "PointId", 0, 1, 100, 1);
    

%>
<!-----上面的工具栏------>
<table width="100%">
  <form name="formBar" method="post">
  <tr>
    <td>
  <input type="hidden" name="page" value="<%=sPage%>"> 
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">  
      单据编号
     <input type="text" name="txtName2" value="<%=sName2%>" class="txtClass80">     
	    农事活动分类
	   <%
  	  StringBuffer sb = new StringBuffer("");
  	  sb.append("<select name='PointName'>");
  	  sb.append("\n");
  	  sb.append("<option value=''>===请选择===</option>");
  	  String s2[] = null;
	   	for (int ii=0; ii<list2.size(); ii++) {
	   		s2 = (String[])list2.get(ii);
	   		sb.append("<option value=\"");
	   	  sb.append(s2[0]);
				sb.append("\"");
	   	  if (PointName.equals(s2[0])) {
	   	     sb.append(" selected");
	   	  }
	   	  sb.append(">");
	   	  sb.append(s2[0]);
	   	  sb.append("</option>");
	   	  sb.append("\n");
	   	}
	   	sb.append("</select>");
	   	out.println(sb.toString());
	   %> 
	    农事活动内容<input type="text" name="txtName" value="<%=sName%>" class="txtClass80">	    
      
	  <input type="button" name="btnOk" 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="<%=sPage%>">  
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">  
  <input type="hidden" name="txtNumber" value="<%=sNumber%>">
  <input type="hidden" name="txtNumber2" value="<%=sNumber2%>">
  <input type="hidden" name="txtName" value="<%=sName%>">
  <input type="hidden" name="PointName" value="<%=PointName%>">
  <input type="hidden" name="txtState" value="<%=sState%>">
  <tr class="trClassTitle">
    <td width="5"></td>
    <td><%=SzPageHelp.sortTitle("单据编号", "BillNo", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("行项标识号", "RowCode", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("序号", "RowNo", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("农事活动分类", "B.PointName", sSortField, iSortOrder)%></td> 
  </tr> 
<%
		//A.BillNo,A.BillDate,A.ProdBaseId,B.ProdBaseName,A.ProductId,C.ProductName,A.BatchId,D.BatchName
	  Iterator iter = null;
    if (list != null) {
    	iter = list.iterator();
    }
		String str[] = null;
    while (iter != null && iter.hasNext()) {
    	str = (String[])iter.next();
      i++;
%>
  <tr  onMouseOver="javascript:this.className='trMouseOver'" onMouseOut="javascript:this.className='trMouseOut'">
  	<td align="center"><%=i%></td>
  	<td align="center"><%=str[0]%></td>
  	<td align="center"><%=str[1]%></td>
    <td align="center"><%=str[2]%></td>
    <td align="center"><%=str[3]%></td>
  </tr>
  <tr >
  	<td align="center" colspan="2" height="50"><b>农事活动内容：</b></td>
    <td align="left" colspan="3"><%=str[5]%></td>
  </tr>  
<%
    }
    out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 5));
%>
  </form>
</table>

<!-----这里包含要提交的内容--->
<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">  
  <input type="hidden" name="txtNumber" value="<%=sNumber%>">
  <input type="hidden" name="txtNumber2" value="<%=sNumber2%>">
  <input type="hidden" name="txtName" value="<%=sName%>">
  <input type="hidden" name="txtState" value="<%=sState%>">  
  <input type="hidden" name="PointName" value="<%=PointName%>">
  <tr>
    <td align="right">
      <%@ include file="/share/page/page_only_include.jsp"%>
    </td>
  </tr>
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post"> 
</form>
<script language="javascript">

</script>

