<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <title>游戏登陆列表|----软件管理平台</title>
    <link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/module.css">
    <link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
    <script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
    <script src="__STATIC__/table2excel.js"></script>
</head>
<style>
    html {
        min-width:100%;
    }
    body {
        padding: 0px;
    }
</style>
<body>
    <div style="margin:auto;font-size: 20px;color: red;line-height: 3;padding: 20px;">
        导出进行中。。。<br/>
        如果导出成功你也可以手动关闭此页面
    </div>

    <!-- 数据列表 -->
    <table border="1" id="exporttable" style="opacity: 0;">
        <!-- 表头 -->
        <thead>
        <tr>
            <th>游戏名</th>
            <th>游戏合作方</th>
            <th>结算时间</th>
            <th>奖惩确认时间</th>
            <th>事件说明</th>
            <th>奖惩性质</th>
            <!-- 惩罚方 -->
            <th>奖惩类型</th>
            <th>结算公司类型</th>
            <th>结算方</th>
            <th>会长账号</th>
            <th>奖惩金额</th>
            <th>结算方式</th>

            <!-- 奖励方 -->
            <th>奖惩类型</th>
            <th>结算公司类型</th>
            <th>结算方</th>
            <th>会长账号</th>
            <th>奖惩金额</th>
            <th>结算方式</th>

            <th>添加人</th>
        </tr>
        </thead>

        <!-- 列表 -->
        <tbody>
        <if condition = "empty($list)">
            <tr>
                <td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
            </tr>
        </if>
        <notemtpy name = "list">
            <volist name="list" id="data">
                    <!-- 如果没有子级 -->
                    <?php if(!$data['maxCount']):?>
                        <tr>
                            <td>{$data['relation_game_name']}</td>
                            <td>{$data['relation_game_partner']}</td>
                            <td>{$data['settlement_time']}</td>
                            <td>{$data['confirm_time']}</td>
                            <td>{$data['content']}</td>
                            <td>{$data['reward_type_text']}</td>
                            <td>惩罚方</td>
                            <td>无</td>
                            <td>无</td>
                            <td>无</td>
                            <td>无</td>
                            <td>无</td>

                            <td>奖励方</td>
                            <td>无</td>
                            <td>无</td>
                            <td>无</td>
                            <td>无</td>
                            <td>无</td>

                            <td>{:get_admin_name($data['creater_id'])}</td>
                        </tr>
                    <!-- 如果有子级 -->
                    <?php else:?>
                        <?php for($i=0; $i<$data['maxCount']; $i++):?>
                            <?php if($i == 0):?>
                                <tr>
                                    <td rowspan="{$data['maxCount']}">{$data['relation_game_name']}</td>
                                    <td rowspan="{$data['maxCount']}">{$data['relation_game_partner']}</td>
                                    <td rowspan="{$data['maxCount']}">{$data['settlement_time']}</td>
                                    <td rowspan="{$data['maxCount']}">{$data['confirm_time']}</td>
                                    <td rowspan="{$data['maxCount']}">{$data['content']}</td>
                                    <td rowspan="{$data['maxCount']}">{$data['reward_type_text']}</td>
                                    <td rowspan="{$data['maxCount']}">惩罚方</td>
                                    <td><?=$data['detail'][2][$i]['company_type_text'] ?? '无'?></td>
                                    <td><?=$data['detail'][2][$i]['company_name'] ?? '无'?></td>
                                    <td><?=$data['detail'][2][$i]['promote_account'] ?? '无'?></td>
                                    <td><?=$data['detail'][2][$i]['amount'] ?? '无'?></td>
                                    <td><?=$data['detail'][2][$i]['settlement_type_text'] ?? '无'?></td>

                                    <td rowspan="{$data['maxCount']}">奖励方</td>
                                    <td><?=$data['detail'][1][$i]['company_type_text'] ?? '无'?></td>
                                    <td><?=$data['detail'][1][$i]['company_name'] ?? '无'?></td>
                                    <td><?=$data['detail'][1][$i]['promote_account'] ?? '无'?></td>
                                    <td><?=$data['detail'][1][$i]['amount'] ?? '无'?></td>
                                    <td><?=$data['detail'][1][$i]['settlement_type_text'] ?? '无'?></td>

                                    <td rowspan="{$data['maxCount']}">{:get_admin_name($data['creater_id'])}</td>
                                </tr>
                            <?php else:?>
                                <tr>
                                    <td><?=$data['detail'][2][$i]['company_type_text'] ?? '无'?></td>
                                    <td><?=$data['detail'][2][$i]['company_name'] ?? '无'?></td>
                                    <td><?=$data['detail'][2][$i]['promote_account'] ?? '无'?></td>
                                    <td><?=$data['detail'][2][$i]['amount'] ?? '无'?></td>
                                    <td><?=$data['detail'][2][$i]['settlement_type_text'] ?? '无'?></td>

                                    <td><?=$data['detail'][1][$i]['company_type_text'] ?? '无'?></td>
                                    <td><?=$data['detail'][1][$i]['company_name'] ?? '无'?></td>
                                    <td><?=$data['detail'][1][$i]['promote_account'] ?? '无'?></td>
                                    <td><?=$data['detail'][1][$i]['amount'] ?? '无'?></td>
                                    <td><?=$data['detail'][1][$i]['settlement_type_text'] ?? '无'?></td>
                                </tr>
                            <?php endif;?>
                        <?php endfor;?>
                    <?php endif;?>
            </volist>
        </notemtpy>
        <tr>
            <td colspan="10" class="text-center">合计</td>
            <td class="text-center" id="total_reward">-{:array_sum(array_column($list, 'totalPunish'))}</td>
            <td colspan="5" class="text-center">合计</td>
            <td class="text-center" id="total_punish">{:array_sum(array_column($list, 'totalReward'))}</td>
            <td colspan="2" class="text-center"></td>
        </tr>
        </tbody>
    </table>

<script>
    $(function(){
        $("#exporttable").table2excel({
            filename: "奖惩列表.xls", // do include extension
            preserveColors: false // set to true if you want background colors and font colors preserved
        });

    //搜索功能
    $("#search").click(function(){
        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.parent.reloadIframe(url);
        parent.document.getElementsByTagName('iframe').src = url;
    });

    });
</script>

</body>
</html>