<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>

<div class="content_wrapper">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#statistics/slotLevelStatistics" name="stanpform" id="formSlot">
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>开始时间</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($stime) echo $stime;?>" placeholder="开始时间" name="stime" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>结束时间</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($etime) echo $etime;?>" placeholder="结束时间" name="etime" />
                                        </div>
                                        <button type="submit" class="btn btn-primary">查询</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
            <div class="row">
                <div class="col-sm-12">
                    <aside>
                        <header><i class="fa fa-fw fa-file"></i>老虎机关卡概率统计</header>
                        <section>
                            <div class="container-fluid">
                                <div class="row">
                                    <div class="col-sm-12">
                                        <div class="table-responsive">
                                            <style>
                                                #slotBody td{
                                                        text-align: center;
                                                        vertical-align: middle;
                                                }
                                            </style>
                                            <table id="reportTable" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                                <thead>
                                                <tr>
                                                    <!--                                    <th rowspan="2" style="text-align: center;vertical-align: middle;">序号</th>-->
                                                    <th rowspan="2" style="text-align: center;vertical-align: middle;">关卡</th>
                                                    <th rowspan="2" style="text-align: center;vertical-align: middle;">类型</th>
                                                    <th colspan="13" style="text-align: center;vertical-align: middle;">类型</th>
                                                    <th rowspan="2" style="text-align: center;vertical-align: middle;">关卡汇总</th>
                                                </tr>
                                                <tr>
                                                    <th>金币</th>
                                                    <th>体力</th>
                                                    <th>盾牌</th>
                                                    <th>偷</th>
                                                    <th>攻击</th>
                                                    <th>活动</th>
                                                    <th style="color: red;">1个金币</th>
                                                    <th style="color: red;">2个金币</th>
                                                    <th style="color: red;">3个金币</th>
                                                    <th style="color: red;">1个金袋</th>
                                                    <th style="color: red;">2个金袋</th>
                                                    <th style="color: red;">3个金袋</th>
                                                    <th>无奖励</th>
                                                </tr>
                                                </thead>
                                                <tbody id="slotBody">
                                                <?php
                                                if(is_array($data)){
                                                    foreach ($data as $levelId => $val) {
                                                        ?>
                                                        
                                                        <?php if($val['count'] != 0){ ?>
                                                        
                                                        <tr>
                                                            <td style="white-space: nowrap" rowspan="3"><?php echo $levelId;?></td>
                                                            <td style="white-space: nowrap">次数</td>
                                                            <td style="white-space: nowrap"><?php echo $val['money'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['spins'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['shield'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['steal'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['attack'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['activity'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['money1'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['money2'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['money3'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['money4'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['money5'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['money6'];?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['nothing']<=0 ? "<=0" : $val['nothing'];?></td>
                                                            <td style="white-space: nowrap" rowspan="2"><?php echo $val['count'];?></td>
                                                        </tr>
                                                        <tr>
                                                            <td style="white-space: nowrap">概率</td>
                                                            <td style="white-space: nowrap"><?php echo round($val['money']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['spins']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['shield']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['steal']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['attack']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['activity']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['money1']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['money2']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['money3']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['money4']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['money5']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo round($val['money6']/$val['count']*100,2)."%";?></td>
                                                            <td style="white-space: nowrap"><?php echo $val['nothing']<=0? "<=0%": round($val['nothing']/$val['count']*100,2)."%";?></td>
                                                        </tr>
                                                            <tr>
                                                                <!--                                                                1攻击 2偷袭 3体力 4护盾 5一个金币 6二个金币 7三个金币 8一个金袋 9二个金袋 10三个金袋 11没有奖励 12活动-->
                                                                <td style="white-space: nowrap">消耗体力</td>
                                                                <td style="white-space: nowrap">
                                                                    <?php
                                                                    $temp = 0;
                                                                    for($i = 5; $i <= 10; $i++){
                                                                        $temp += $dataSpins[$i][$levelId];
                                                                    }
                                                                    echo empty($temp)?0:$temp;
                                                                    ?>
                                                                </td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[3][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[4][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[2][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[1][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[12][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[5][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[6][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[7][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[8][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[9][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[10][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap"><?php echo $dataSpins[11][$levelId] ?? 0;?></td>
                                                                <td style="white-space: nowrap">
                                                                    <?php
                                                                    $temp = 0;
                                                                    for($i = 1; $i <= 12; $i++){
                                                                        $temp += $dataSpins[$i][$levelId];
                                                                    }
                                                                    echo empty($temp)?0:$temp;
                                                                    ?>
                                                                </td>
                                                            </tr>
                                                        <?php }else{ ?>
                                                            <tr>
                                                                <td style="white-space: nowrap"><?php echo $levelId;?></td>
                                                                <td style="white-space: nowrap">--</td>
                                                                <td colspan="13">0</td>
                                                                <td style="white-space: nowrap"><?php echo $val['count'];?></td>
                                                            </tr>
                                                        <?php } ?>
                                                    <?php } } else{?>
                                                    <tr>
                                                        <td colspan="10">暂无数据</td>
                                                    </tr>
                                                <?php } ?>
                                                </tbody>

                                            </table>
                                        </div>

                                    </div>
                                </div>
                            </div>
                        </section>
                    </aside>
                </div>
            </div>
    </div>
</div>
</div>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/highcharts.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/exporting.js"></script>
<script type="text/javascript">
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });
    
</script>