<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>收入登记管理</title>
	<meta name="decorator" content="default"/>
	<%--<script src="${ctxStatic}/layer-v2.3/laydate/laydate.js"></script>--%>

	<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">
	<%--<div class="ibox-title">
		<h5>收入登记列表 </h5>
		<div class="ibox-tools">
			<a class="collapse-link">
				<i class="fa fa-chevron-up"></i>
			</a>
			<a class="dropdown-toggle" data-toggle="dropdown" href="#">
				<i class="fa fa-wrench"></i>
			</a>
			<ul class="dropdown-menu dropdown-user">
				<li><a href="#">选项1</a>
				</li>
				<li><a href="#">选项2</a>
				</li>
			</ul>
			<a class="close-link">
				<i class="fa fa-times"></i>
			</a>
		</div>
	</div>--%>

	<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="workReceiptsRegister" action="${ctx}/workreceiptsregister/workReceiptsRegister/" method="post" class="form-inline">
					<%--以下三行照抄--%>
					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
					<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->

					<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="${workReceiptsRegister.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="${workReceiptsRegister.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">
                                <form:input path="clientAccno" htmlEscape="false" maxlength="255"  class=" form-control layui-input"/>
                            </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 class="layui-item query athird">
							<label class="layui-form-label">对方户名：</label>
							<div class="layui-input-block">
								<form:input path="clientAccname" htmlEscape="false" maxlength="255"  class=" form-control layui-input"/>
							</div>
						</div>
                        <div class="layui-item query athird">
                            <label class="layui-form-label">到账金额：</label>
                            <div class="layui-input-block">
                                <input id="minArr" name="minArr" type="text" maxlength="20" class=" form-control layui-input number query-group"
                                       value="<fmt:formatNumber value="${workReceiptsRegister.minArr}" pattern="#,##0.00#"/>" onchange="formatNum(this);"/>
                                </input>
                                <span class="group-sep">-</span>
                                <input id="maxArr" name="maxArr" type="text" maxlength="20" class="form-control layui-input number query-group"
                                       value="<fmt:formatNumber value="${workReceiptsRegister.maxArr}" pattern="#,##0.00#"/>" onchange="formatNum(this);"/>
                                </input>
                            </div>
                        </div>
                        <div class="layui-item query athird">
                            <label class="layui-form-label">确认金额：</label>
                            <div class="layui-input-block">
                                <input id="minReg" name="minReg" type="text" maxlength="20" class="form-control layui-input number query-group"
                                       value="<fmt:formatNumber value="${workReceiptsRegister.minReg}" pattern="#,##0.00#"/>" onchange="formatNum(this);" />
                                </input>
                                <span class="group-sep">-</span>
                                <input id="maxReg" name="maxReg" type="text" maxlength="20" class="form-control layui-input number query-group"
                                       value="<fmt:formatNumber value="${workReceiptsRegister.maxReg}" pattern="#,##0.00#"/>" onchange="formatNum(this);" />
                                </input>
                            </div>
                        </div>
                        <div class="layui-item query athird">
                            <label class="layui-form-label">收入状态：</label>
                            <div class="layui-input-block">
                                <form:select path="status" htmlEscape="false" maxlength="255"  class=" form-control simple-select">
                                    <form:option value="0" label="未登记"/>
                                    <form:option value="1" label="已登记"/>
                                </form:select>
                            </div>
                        </div>
						<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">
					<%--此处按钮样式包括 nav-btn-add nav-btn-refresh nav-btn-import nav-btn-export nav-btn-query nav-btn-reset--%>
					<shiro:hasPermission name="workreceiptsregister:workReceiptsRegister:add">
						<table:addRow url="${ctx}/workreceiptsregister/workReceiptsRegister/form" title="收入登记"></table:addRow><!-- 增加按钮 -->
					</shiro:hasPermission>
					<shiro:hasPermission name="workreceiptsregister:workReceiptsRegister:edit">
						<table:importExcel9 url="${ctx}/workreceiptsregister/workReceiptsRegister/ajaxImport"></table:importExcel9><!-- 导入按钮 -->
					</shiro:hasPermission>
					<%--<shiro:hasPermission name="workreceiptsregister:workReceiptsRegister:export">--%>
						<%--<table:exportExcel url="${ctx}/workreceiptsregister/workReceiptsRegister/export"></table:exportExcel><!-- 导出按钮 -->--%>
					<%--</shiro:hasPermission>--%>
					<button class="nav-btn nav-btn-refresh" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"><i class="glyphicon glyphicon-repeat"></i>&nbsp;刷新</button>
					<div style="clear: both;"></div>
				</div>
				<table class="oa-table layui-table" id="contentTable1"></table>

				<!-- 分页代码 -->
				<table:page page="${page}"></table:page>
				<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:${ page.pageSize }
            ,elem: '#contentTable1'
            ,page: false
            ,cols: [[
                // {checkbox: true, fixed: true},
                {field:'index',align:'center', title: '序号',width:40}
                ,{field:'arrivalDate',align:'center', title: '到账时间',minWidth:100, templet:function(d){
                        var xml = "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openDialogView('查看报销单', '${ctx}/workreceiptsregister/workReceiptsRegister/view?id=" + d.id + "','95%','95%')\">" +
                            d.arrivalDate + "</a>";
                        return xml;
                    }}
                ,{field:'clientAccno',align:'center', title: '对方账号',minWidth:200,templet:function(d){
                        return "<span title='"+ d.clientAccno +"'>" + d.clientAccno + "</span>";
                    }}
                ,{field:'clientAccname',align:'center', title: '对方户名',minWidth:200,templet:function(d){
                        return "<span title='"+ d.clientAccname +"'>" + d.clientAccname + "</span>";
                    }}
                ,{field:'arrivalAmt', align:'center',title: '到账金额', width:150}
                ,{field:'registerAmt', align:'center',title: '确认金额',width:150}
                ,{field:'status',align:'center', title: '收入状态', width:100}
                ,{field:'op',align:'center',title:"操作",width:130,templet:function(d){
                        ////对操作进行初始化
                        var xml = "";
                        if(d.canedit != undefined && d.canedit == "1")
                            xml += "<a href=\"#\" onclick=\"openDialog('收入登记', '${ctx}/workreceiptsregister/workReceiptsRegister/regist?id=" + d.id + "', '95%' , '95%')\"   class=\"op-btn op-btn-cancel\"><i class=\"fa fa-edit\"></i> 登记</a>";
                        if(d.candelete != undefined && d.candelete == "1")
                            xml +="<a href=\"${ctx}/workreceiptsregister/workReceiptsRegister/delete?id=" + d.id + "\" onclick=\"return confirmx('确认要删除该收入登记吗？', this.href)\"   class=\"op-btn op-btn-delete\"><i class=\"fa fa-trash\"></i> 删除</a>";

                        return xml;
                    }}
            ]]
            ,data: [
                <c:if test="${ not empty page.list}">
                <c:forEach items="${page.list}" var="workReceiptsRegister" varStatus="index">
                <c:if test="${index.index != 0}">,</c:if>
                {
                    "index":"${index.index+1}"
                    ,"id":"${workReceiptsRegister.id}"
                    ,"arrivalDate":"<fmt:formatDate value="${workReceiptsRegister.arrivalDate}" pattern="yyyy-MM-dd"/>"
                    ,"clientAccno":"<c:out value="${workReceiptsRegister.clientAccno}" escapeXml="true"/>"
                    ,"clientAccname":"<c:out value="${workReceiptsRegister.clientAccname}" escapeXml="true"/>"
                    ,"arrivalAmt":"<fmt:formatNumber pattern="#,##0.00#" value="${workReceiptsRegister.arrivalAmt}"/>"
                    ,"registerAmt":"<fmt:formatNumber pattern="#,##0.00#" value="${workReceiptsRegister.registerAmt}"/>"
                    ,"status":<c:if test="${workReceiptsRegister.status eq '0'}">"未登记"</c:if> <c:if test="${workReceiptsRegister.status eq '1'}">"已登记"</c:if>
                    <c:if test="${flag == '1' or fns:getUser().id == workReceiptsRegister.createBy.id}">
                    <shiro:hasPermission name="workreceiptsregister:workReceiptsRegister:edit">
                    ,"canedit":"1"
                    </shiro:hasPermission>
                    <shiro:hasPermission name="workreceiptsregister:workReceiptsRegister:del">
                    ,"candelete":<c:if test="${workReceiptsRegister.detailCou == 0}">"1"</c:if><c:if test="${workReceiptsRegister.detailCou != 0}">"0"</c:if>
                    </shiro:hasPermission>
                    </c:if>
                }
                </c:forEach>
                </c:if>
            ]
            // ,even: true
            // ,height: 315
        });

    })

    resizeListTable(130);/*消除由于有竖向滚动条造成table出现横向滚动条*/
    $("a").on("click",addLinkVisied);
</script>
<script type="text/javascript">
    var validateForm;
    $(document).ready(function() {
        $('#moresee').click(function(){
            if($('#moresees').is(':visible'))
            {
                $('#moresees').slideUp(0,resizeWindow);
                $('#moresee i').removeClass("glyphicon glyphicon-menu-up").addClass("glyphicon glyphicon-menu-down");
            }else{
                $('#moresees').slideDown(0,resizeWindow);
                $('#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'
        });

        validateForm = $("#searchForm").validate({
            errorContainer: "#messageBox",
            errorPlacement: function(error, element) {
                $("#messageBox").text("输入有误，请先更正。");
                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                    error.appendTo(element.parent().parent());
                } else {
                    error.insertAfter(element);
                }
            }
        });
    });
    function formatNum(obj) {
        var val = $(obj).val();
        if(val==null||val==''|| isNaN(val))return;
        var money = parseFloat((val + "").replace(/[^\d\.-]/g, "")).toFixed(2) + "";
        var l = money.split(".")[0].split("").reverse(),
            r = money.split(".")[1];
        t = "";
        for(i = 0; i < l.length; i ++ )
        {
            t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
        }
        $(obj).val(t.split("").reverse().join("") + "." + r);
    }
</script>
<script>
    function resizeWindow()
    {
        var winH = $(window).height();
        var updiv= $("#queryDiv").height();
        $(".contentDetails").css('min-height',(winH - updiv - 16 - 1) +'px');//这里的div，选择你的那个div
    }
    resizeWindow();
    $(window).resize(function(){
        resizeWindow();
    });
</script>
</body>
</html>