<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%@include file="/pages/includes/taglibs.jsp" %>

<head>
<script type="text/javascript" src="<%=request.getContextPath() %>/resource/js/jquery-1.8.3.js"></script>
 <script type="text/ecmascript" src="<%=request.getContextPath() %>/resource/plugin/jqgrid/js/jquery.jqGrid.min.js"></script>
 <script type="text/ecmascript" src="<%=request.getContextPath() %>/resource/plugin/jqgrid/js/i18n/grid.locale-cn.js"></script>
 
<script type="text/ecmascript" src="<%=request.getContextPath()%>/resource/js/system/jqdatagrid.js"></script>
<script src="<%=request.getContextPath()%>/resource/js/datePicker/WdatePicker.js" type="text/javascript"></script>
 <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resource/plugin/jqueryui/css/custom-theme/jquery-ui-1.9.2.custom.css" />
 <link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath() %>/resource/plugin/jqgrid/css/ui.jqgrid.css" />

<script type="text/javascript">

function queryData(){
	// 日期
	var recordDate = $("#recordDate").val();
	$("#recordDateQ").val(recordDate);
	jQuery("#gridTable").jqGrid('setGridParam',{url:"/statisticsAnalysisBranch/analysisBranchMainList.action?recordDate="+recordDate}).trigger("reloadGrid");
}

function sendRequest(passData){
$("#formView").attr("action", passData).submit();
}

function queryClear(){
	$("#recordDate").val("");
}

$(function(){
	showJqGrid();
});

// 加载jqgrid表格
function showJqGrid(){
	// 日期
	var recordDate = $("#recordDate").val();
	$("#recordDateQ").val(recordDate);
	var recordDateQ = $("#recordDateQ").val();
	jQuery("#gridTable").jqGrid({
	   	url:"/statisticsAnalysisBranch/analysisBranchMainList.action?recordDate="+recordDate,
		datatype: "json",
	   	colNames:['编号', '名称','日期','操作'],
	   	colModel:[
	   		{ name: 'id', index: 'id', width: 200, align: 'center', hidden: true},
			{ name: 'wpName', index: 'wpName', width: 200, align: 'center'},
			{ name: 'recordDate', index: 'recordDate', width: 200, align: 'center'},
			{ name: 'operate', index: 'operate', width: 200, align: 'center'}
	   	],
	   	rowNum:10,
	   	height:'670',
width:'1610',
	   	rowList:[10,20,30],
	   	pager: '#gridPager',
	   	sortname: 'recordDate',
	    viewrecords: true,
	    autowidth: true,
	    sortorder: "desc",
	    caption: "统计分析列表",
		afterInsertRow:function(rowid,rowdata,rowelem){
			var operateLink = "<a href=\"#\" onclick=\"requestAction('/statisticsAnalysisBranch/index.action?id=" + rowdata.id + "&recordDateQ=" + recordDateQ + "&recordDate=" + rowdata.recordDate + "')\">查看</a>";
			jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{operate:operateLink});
		}
		
	});
}

function requestAction(url){
	$("#f1").attr("action",url);
	$("#f1").submit();
}
</script>
</head>

<body>
<form action="" method="post" id="formView">
</form>

<table width="100%">
	<tr>
		<td align="left" class="navbar" style="font-size: 12px;">分公司统计分析</td>
	</tr>
</table>
<hr/>
<fieldset style="height: 60px" id="fst">
    <legend  class="item_Name">统计分析查询项</legend>
   <table width="1000px" cellpadding="0" cellspacing="0" class="dataform">
		<tr>
			<td width="6%">
				日期:
			</td>
			<td width="20%">
				<s:textfield
					cssClass="Wdate"
					onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
					id="recordDate" name="recordDate" title="日期" />
				<s:textfield
					cssClass="Wdate"
					onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
					id="recordDateQ" name="recordDateQ" title="日期" style="display:none"/>
			</td>
			<td style="text-align: right">
				<input type="button" class="button" onclick="javascript:queryData();" value="查询"/>
				<input type="button" class="button" onclick="javascript:queryClear();" value="清空"/>
			</td>
		</tr>
	</table>
  </fieldset>
<br/>
<table id='gridTable'></table>
<div id='gridPager'></div>
<form action="" method="post" id="f1">
</body>