<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
        $(document).ready(function() {

            $('#contentTable thead tr th input.i-checks').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
                $('#contentTable tbody tr td input.i-checks').iCheck('check');
            });

            $('#contentTable thead tr th input.i-checks').on('ifUnchecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
                $('#contentTable tbody tr td input.i-checks').iCheck('uncheck');
            });
        });

        function getSelectedItem(){

            var size = $("#contentTable tbody tr td input.i-checks:checked").size();
            if(size == 0 ){
                top.layer.alert('请至少选择一条数据!', {icon: 0, title:'警告'});
                return "-1";
            }

            if(size > 1 ){
                top.layer.alert('只能选择一条数据!', {icon: 0, title:'警告'});
                return "-1";
            }
            var id =  $("#contentTable tbody tr td input.i-checks:checkbox:checked").attr("id");
            var number = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel1").html();
            var name = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel2").html();
            var typeName = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel3").html();
            var masterName = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel4").html();
            var createDate = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel5").html();
            var masterId = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel6").html();
            var type = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel7").html();
            return {'id':id,'name':name,'number':number,'master':{'name':masterName,'id':masterId},'typeName':typeName,'type':type,'createDate':createDate};
        }
        function page(n,s){
            if(n) $("#pageNo").val(n);
            if(s) $("#pageSize").val(s);
            $("#searchForm").attr("action","${url}");
            $("#searchForm").submit();
            return false;
        }
	</script>
</head>
<body class="gray-bg">
<div class="">
	<div class="ibox-content">
		<!-- 查询条件 -->
		<table id="contentTable" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
			<thead>
			<tr>
				<th></th>
				<th  class="sort-column planMonthly">计划月份</th>
				<th  class=" officeName">所属部门</th>
				<th  class=" estimatePrice">合同预计收费</th>
				<th  class=" accumulativePrice">合同累计收费</th>
				<th  class=" yearSumMoney">本年度预计收费</th>
				<th  class=" beforeSumMoney">本年度已收费</th>
				<th  class=" thisSumMoney">本月计划收费</th>
			</tr>
			</thead>
			<tbody>
			<c:forEach items="${list}" var="objPlan">
				<tr>
					<td style="text-align:center;"> <input type="checkbox" id="${objPlan.id}" class="i-checks"></td>
					<td>
						<fmt:formatDate value="${objPlan.planMonthly}" pattern="yyyy-MM"/>
					</td>
					<td>
							${objPlan.officeName}
					</td>
					<td>
						<fmt:formatNumber value="${objPlan.estimatePrice}"/>

					</td>
					<td>
						<fmt:formatNumber value="${objPlan.accumulativePrice}" />

					</td>
					<td>
						<fmt:formatNumber value="${objPlan.yearSumMoney}" />

					</td>
					<td>
						<fmt:formatNumber value="${objPlan.beforeSumMoney}" />

					</td>
					<td>
						<fmt:formatNumber value="${objPlan.thisSumMoney}" />
					</td>
				</tr>
			</c:forEach>
			</tbody>
		</table>
		<table:page page="${page}"></table:page>
		<br/>
		<br/>
	</div>
</div>
</body>
</html>