<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>合同统计表</title>
	<meta name="decorator" content="default"/>
	<%@include file="/webpage/include/treetable.jsp" %>
	<style>
		body{
			background-color:transparent;
			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
			color:#ffffff;
			background-color:rgba(255,255,255,0);
			height:100%;
		}
	</style>
</head>
<body>
<div class="wrapper wrapper-content">
	<sys:message content="${message}"/>
	<div class="layui-row">
		<div class="full-width fl">
			<div class="contentShadow layui-row" id="queryDiv">
				<form:form id="searchForm" modelAttribute="workContractData" action="${ctx}/workcontractData/workcontractData/list" method="post" class="form-inline">
					<form:hidden path="companyId"/>
					<%--以下三行照抄--%>
					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
					<div class="commonQuery">
						<div class="layui-item query athird">
							<label class="layui-form-label">签订日期：</label>
							<div class="layui-input-block">
								<input id="beginDate" placeholder="开始时间" name="beginDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
									   value="<fmt:formatDate value="${workContractData.beginDate}" pattern="yyyy-MM-dd"/>"/>
								</input>
								<span class="group-sep">-</span>
								<input id="endDate" placeholder="结束时间" name="endDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
									   value="<fmt:formatDate value="${workContractData.endDate}" pattern="yyyy-MM-dd"/>"/>
								</input>
							</div>
						</div>
						<div class="layui-item query athird">
							<label class="layui-form-label"></label>
							<div class="layui-input-block with-icon">
							</div>
						</div>
						<div class="layui-item athird">
							<div class="input-group">
								<a href="#" id="moresee"><i class="glyphicon glyphicon-menu-down"></i></a>
								<button id="searchReset" class="fixed-btn searchReset fr" onclick="resetSearch()">重置</button>
								<button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
							</div>
						</div>
						<div style="    clear:both;"></div>
					</div>
					<div id="moresees" style="clear:both;display:none;">
						<div style="clear:both;"></div>
					</div>
				</form:form>
			</div>
		</div>

		<div class="full-width fl">
			<div class="contentShadow layui-form contentDetails">
				<div class="nav-btns">
					<shiro:hasPermission name="workcontractData:workcontractData:export">
						<table:exportExcel url="${ctx}/workcontractData/workcontractData/export"></table:exportExcel><!-- 导出按钮 -->
					</shiro:hasPermission>
					<c:choose>
						<c:when test="${not empty backState}">
							<a class="nav-btn nav-btn-refresh" onClick="javascript :history.back(-1);"  data-toggle="tooltip" data-placement="left" title="返回"><i class="glyphicon glyphicon-repeat"></i>&nbsp;返回</a>
						</c:when>
					</c:choose>
				<div style="clear: both;"></div>
				</div>
				<table class="oa-table layui-table" id="contentTable"></table>
				<!-- 分页代码 -->
				<div style="clear: both;"></div>
			</div>
		</div>
	</div>
	<div id="changewidth"></div>
</div>
<script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
<script>
    layui.use('table', function(){
        layui.table.render({
            limit:${list.size()},
            elem: '#contentTable'
            ,page: false
            ,cols: [[
                // {checkbox: true, fixed: true},
                {field:'index',align:'center',  width:40,title: '序号'}
                ,{field:'name',align:'center',title:"分公司", minWidth:150,templet:function(d){
                    ////对操作进行初始化
                        var xml = "<a class=\"attention-info\" onclick=\"isSign('"+d.id+"','"+d.sign+"')\" >" +
                            "<span title=" + d.name + ">" + d.name + "</span></a>";
                        return xml;
                }}
                ,{field:'contractCount', align:'center',title: '合同数量',width:80}
                ,{field:'projectCount', align:'center',title: '项目数量',width:80}
                ,{field:'reportCount', align:'center',title: '报告数量',width:80}
                ,{field:'invoiceMoney', align:'center',title: '开票金额',width:150}
                ,{field:'incomeMoney', align:'center',title: '收款金额',width:150}
                ,{field:'reimbursementMoney', align:'center',title: '报销金额',width:150}

            ]]
            ,data: [
                <c:if test="${ not empty list}">
                <c:forEach items="${list}" var="workContractData" varStatus="index">
                <c:if test="${index.index != 0}">,</c:if>
                {
                    "index":"${index.index+1}"
                    ,"id":"${workContractData.id}"
                    ,"sign":"${workContractData.sign}"
                    ,"name":"${fns:abbr(workContractData.name,30)}"
                    ,"contractCount":"${workContractData.contractCount}"
                    ,"projectCount":"${workContractData.projectCount}"
                    ,"reportCount":"${workContractData.reportCount}"
                    ,"invoiceMoney":"<fmt:formatNumber value="${workContractData.invoiceMoney}" pattern="#,#00.00"/>"
                    ,"incomeMoney":"<fmt:formatNumber value="${workContractData.incomeMoney}" pattern="#,#00.00"/>"
                    ,"reimbursementMoney":"<fmt:formatNumber value="${workContractData.reimbursementMoney}" pattern="#,#00.00"/>"
                }
                </c:forEach>
                </c:if>
            ]
            // ,even: true
            // ,height: 315
        });

    })

    resizeListTable();
</script>
<script>
    function isSign(companyId,sign){
        $.ajax({
            type:'post',
            url:'${ctx}/workreimbursementcount/workInvoiceCount/signlist',
            data:{
                "companyId":companyId,"sign":sign
            },
            success:function(data){
                if(data==0){
                    window.location.href='${ctx}/workcontractData/workcontractData/officeList?companyId='+companyId;
                }else{
                    window.location.href='${ctx}/workcontractData/workcontractData/list?companyId='+companyId;
                }
            }
        })
    }
    resizeListWindow1();
    $(window).resize(function(){
        resizeListWindow1();
    });
</script>
<script type="text/javascript">
    $(document).ready(function() {
        $("#cus_name").show();
        $("#cus_name").siblings().hide();
        //搜索框收放
        $('#moresee').click(function(){
            if($('#moresees').is(':visible'))
            {
                $('#moresees').slideUp(0,resizeListWindow1);
                $('#moresee i').removeClass("glyphicon glyphicon-menu-up").addClass("glyphicon glyphicon-menu-down");
            }else{
                $('#moresees').slideDown(0,resizeListWindow1);
                $('#moresee i').removeClass("glyphicon glyphicon-menu-down").addClass("glyphicon glyphicon-menu-up");
            }
        });

        laydate.render({
            elem: '#beginDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
            event: 'focus', //响应事件。如果没有传入event，则按照默认的click
            type : 'date'
        });
        laydate.render({
            elem: '#endDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
            event: 'focus', //响应事件。如果没有传入event，则按照默认的click
            type : 'date'
        });
    });
    function switchInput(obj){
        $("#"+obj).show();
        $("#"+obj).siblings().hide();
    }
</script>
</body>
</html>
</html>