<extend name="Public/base"/>

<block name="body">
    <link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css"/>
    <script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
    <script type="text/javascript" src="__JS__/select2.min.js"></script>
    <style>
        .select2-container--default .select2-selection--single {
            color: #000;
            resize: none;
            border-width: 1px;
            border-style: solid;
            border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
            box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
            height:28px;border-radius:3px;font-size:12px;
        }
        .select2-container--default .select2-selection--single .select2-selection__rendered {
            line-height:35px;
            line-height:28px;
        }
        .select2-container--default .select2-selection--single .select2-selection__arrow {
            height:26px;
        }
        .select2-container--default .select2-search--dropdown .select2-search__field {
            height:26px;line-height:26px;font-size:12px;
        }
        .select2-results__option[aria-selected] {font-size:12px;}
        .layui-layer-dialog .layui-layer-content{color:red}
        .butnbox {padding:10px 0 10px;}
        .butnbox .butnlist {overflow:hidden;clear:both;}
        .butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
        .butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
        .butnbox .butnlist .butn.last {background:#009900;}
        .butnbox .butnlist .butn~.butn {margin-left:20px;}
        .data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
        .layui-layer-title {
            text-align: center;
            height: 80px;
            line-height: 80px;
            font-weight: 600;
            font-size: 18px;
        }
        </style>
    <!-- 标题栏 -->
    <div class="cf main-place top_nav_list navtab_list">
        <h3 class="page_title">汇总结算单管理</h3>
    </div>



    <div class="cf top_nav_list">
        <!-- <div class="fl button_list">
            <a class="confirm ajax-post" id="dtnn" target-form="ids" url="{:U('Member/delprovide')}"><span class="button_icon button_icon2 "></span>批量删除</a>
        </div> -->
        <!-- 高级搜索 -->
        <div class="jssearch fl cf search_list">
            <div class="input-list search-title-box">
              <label>搜索:</label>
            </div>
            <div class="input-list input-list-game search_label_rehab">
                <select id="settlement_type" name="settlement_type" class="select_gallery">
                    <option value="">选择汇总结算单类型</option>
                    <option value="1" <?php echo I('settlement_type') == 1 ? "selected" : "" ?> >上游结算单</option>
                    <option value="2" <?php echo I('settlement_type') == 2 ? "selected" : "" ?> >下游-内团结算单</option>
                    <option value="3" <?php echo I('settlement_type') == 3 ? "selected" : "" ?>>下游-外团结算单</option>
                    <option value="4" <?php echo I('settlement_type') == 4 ? "selected" : "" ?>>下游-个人结算单</option>
                </select>
            </div>
            <div class="input-list input-list-game search_label_rehab">
                <select id="settlement_time_type" name="settlement_time_type" class="select_gallery">
                    <option value="">选择汇总结算单类型</option>
                    <option value="1" <?php echo I('settlement_time_type') == 1 ? "selected" : "" ?> >周结</option>
                    <option value="2" <?php echo I('settlement_time_type') == 2 ? "selected" : "" ?> >月结</option>
                </select>
            </div>
            <div class="input-list input-list-game search_label_rehab">
                <select id="all_status" name="all_status" class="select_gallery">
                    <option value="">申请状态</option>
                    <option value="1" <?php echo I('all_status') == 1 ? "selected" : "" ?> >审核通过</option>
                    <option value="2" <?php echo I('all_status') == 2 ? "selected" : "" ?> >审核未通过</option>
                    <option value="3" <?php echo I('statall_statusus') == 3 ? "selected" : "" ?> >待审核</option>
                </select>
            </div>
            <div class="input-list">
                <input type="text" readonly id="create-time-start" name="create_time_start" class="" value="{:I('create_time_start')}"
                       placeholder="申请开始时间"/>
                -
                <div class="input-append date" id="datetimepicker" style="display:inline-block">
                    <input type="text" readonly id="create-time-end" name="create_time_end" class="" value="{:I('create_time_end')}"
                           placeholder="申请结束时间"/>
                    <span class="add-on"><i class="icon-th"></i></span>
                </div>
            </div>
            <div class="input-list input-list-game search_label_rehab">
                <select id="creater_id" name="creater_id" class="select_gallery" >
                    <option value="">选择申请人</option>
                    <?php foreach ($admin_users as $user):?>
                    <option value="{$user['uid']}" <?php if ($user['uid'] == I('creater_id')):?>selected<?php endif;?> >{$user['nickname']}</option>
                    <?php endforeach;?>
                </select>   
            </div>
            <div class="input-list">
                <a class="sch-btn" href="javascript:;" id="search"
                   url="{:U('settlement/sheetList','model='.$model['name'],false)}">
                    搜索
                </a>
            </div>
        </div>
        
    </div>

    <div class="butnbox" >
        <div class="butnlist jscheckbutn" style="margin-left: 2px">
            <a class="butn" href="{:U('settlement/generateSettlementSheet')}">
                生成报销单
            </a>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data_list">
        <div class="">
            <table>
                <!-- 表头 -->
                <thead>
                <tr>
                    <!-- <th class="">
                        <input class="check-all" type="checkbox">
                    </th> -->
                    <th>结算单单号</th>
                    <th>结算单类型</th>
                    <th>时间</th>
                    <th>结算方式</th>
                    <th>申请时间</th>
                    <th>申请人</th>
                    <th>审核状态</th>
                    <th>当前审核人</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
                </thead>
                <!-- 列表 -->
                <tbody>
                <empty name="list_data">
                    <td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
                    <else/>
                    <volist name="list_data" id="data">
                        <tr>
                            <!-- <td><input class="ids" type="checkbox" value="{$data['id']}" name="ids"></td> -->
                            <td>{$data.orderid}</td>
                            <td>{$data.settlement_type_name}</td>
                            <td >{:date('Y-m-d', $data['time_start'])} - {:date('Y-m-d', $data['time_end'])}</td>
                            <td>{$data.settlement_time_type_name}</td>
                            <td>{$data.create_time|date='Y-m-d H:i:s',###}</td>
                            <td>{:get_admin_nickname($data['creater_id'])}</td>
                            <td>{$data.status_name}</td>
                            <td>{:get_admin_nickname($data['audit_users'][$data['step']-1])}</td>
                            <td>{$data.remark}</td>
                            <td>
                                <a href="{:U('settlement/sheetDetail',array('id'=>$data['id']))}">查看 </a>
                                <a class="ajax-get confirm" href="{:U('settlement/generateSettlementSheet',array('id'=>$data['id'], 'delete'=>1))}">删除 </a>
                            </td>
                        </tr>
                    </volist>
                </empty>
                </tbody>
            </table>
        </div>
    </div>
    <div class="page">
        {$_page|default=''}
    </div>

		<div class="common_settings">
			<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
			<form class="addShortcutIcon">
				<input type="hidden" name="title" value="{$m_title}">
				<input type="hidden" name="url" value="settlement/sheetList">
			</form>
			<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
		</div>

</block>

<block name="script">
    <script src="__STATIC__/layer/layer.js"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
  <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
  <script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
  <script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
  <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
  <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
  <link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
  <script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
  <script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<style>
  .layui-layer-demo .layui-layer-title {background:#F0F5F7;font-weight:bold;}
  .layui-layer-demo .layui-layer-content {}
  .layui-layer-demo .layui-layer-content table{width:100%;border:0;border-spacing:0;padding:0;}
  .layui-layer-demo .layui-layer-content td {height:42px;padding-left:20px;}
  .layui-layer-demo .layui-layer-content tr:hover {background:#F0F5F7;}
  .layui-layer-demo .layui-layer-content tr~tr {border-top:1px solid #ccc;}
  .layui-layer-demo .layui-layer-content td~td {border-left:1px solid #ccc;}
  .layui-layer-demo .layui-layer-content tr:last-child td {}
</style>
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('settlement/sheetList')}');
        $(function () {
            $(".select_gallery").select2();

            //搜索功能
            $("#search").click(function () {
                var sdate = Date.parse($('#time-start').val()) / 1000;
                var edate = Date.parse($('#time-end').val()) / 1000;
                if (sdate > edate) {
                    layer.msg('开始时间必须小于等于结束时间');
                    return false;
                }
                if ((edate - sdate) > 2592000) {
                    layer.msg('时间间隔不能超过31天,请重新选择日期');
                    return false;
                }

                var url = $(this).attr('url');
                var query = $('.jssearch').find('input').serialize();
                query += "&" + $('.jssearch').find('select').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                query = query.replace(/^&/g, '');
                if (url.indexOf('?') > 0) {
                    url += '&' + query;
                } else {
                    url += '?' + query;
                }
                window.location.href = url;
            });

            //回车自动提交
            $('.jssearch').find('input').keyup(function (event) {
                if (event.keyCode === 13) {
                    $("#search").click();
                }
            });
            $('#create-time-start').datetimepicker({
                format: 'yyyy-mm-dd',
                language: "zh-CN",
                minView: 2,
                autoclose: true
            });

            $('#datetimepicker').datetimepicker({
                format: 'yyyy-mm-dd',
                language: "zh-CN",
                minView: 2,
                autoclose: true,
                pickerPosition: 'bottom-left'
            })

        })
    </script>
</block>