<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/moneyinout/<?php echo $isChart?>" name="stanpform">
                                        <input type="hidden" name="moneyinout_post" value="1">
                                        <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="moneyinout_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="moneyinout_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">
                                            <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 colspan="12" style="text-align: center;vertical-align: middle;">发放</th>
                                                    <th colspan="5" style="text-align: center;vertical-align: middle;">消耗</th>
                                                    <!--                                    <th colspan="7" style="text-align: center">其他</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>卡组进度</th>
                                                    <th>大转盘</th>
                                                    <th>偷取金币</th>
                                                    <th>视频广告</th>
                                                    <th>攻击建筑</th>
                                                    <th>发放汇总</th>
                                                    <th>被偷金币</th>
                                                    <th>升级建筑</th>
                                                    <th>升级矿工</th>
                                                    <th>购买宝箱</th>
                                                    <th>消耗汇总</th>

                                                </tr>
                                                </thead>
                                                <tbody id="reportBody">
                                                <?php
                                                    function formatChipRound($value, $round=2)
                                                    {
                                                        if(1 <= abs($valueB = round($value / 1000000000, $round))) {
                                                            return  $valueB . 'B';
                                                        }else if(1 <= abs($valueM=round($value / 1000000, $round))) {
                                                            return $valueM . 'M';
                                                        }else if(1 <= abs($valueK = round($value / 1000), $round)) {
                                                            return $valueK . 'K';
                                                        }else {
                                                            return $value;
                                                        }
                                                    }
                                                ?>
                                                <?php
                                                if(is_array($data)){
                                                    foreach ($data as $val) {
                                                        ?>
                                                        <tr>
                                                            <td style="white-space: nowrap"><?php echo $val['date'];?></td>
                                                            <td><?php echo formatChipRound($val['server']);?></td>
                                                            <td><?php echo formatChipRound($val['slot']);?></td>
                                                            <td><?php echo formatChipRound($val['friend_gift']);?></td>
                                                            <td><?php echo formatChipRound($val['mining']);?></td>
                                                            <td><?php echo formatChipRound($val['shop']);?></td>
                                                            <td><?php echo formatChipRound($val['card']);?></td>
                                                            <td><?php echo formatChipRound($val['card_progress']);?></td>
                                                            <td><?php echo formatChipRound($val['wheel']);?></td>
                                                            <td><?php echo formatChipRound($val['steal']);?></td>
                                                            <td><?php echo formatChipRound($val['advertising']);?></td>
                                                            <td><?php echo formatChipRound($val['attack']);?></td>
                                                            <td style="font-weight: bold"><?php echo formatChipRound($val['add']);?></td>
                                                            <td><?php echo formatChipRound($val['stealed']);?></td>
                                                            <td><?php echo formatChipRound($val['uplevel']);?></td>
                                                            <td><?php echo formatChipRound($val['upminig']);?></td>
                                                            <td><?php echo formatChipRound($val['bug_chest']);?></td>
                                                            <td style="font-weight: bold"><?php echo formatChipRound($val['low']);?></td>
                                                            <td style="font-weight: bold"><?php echo formatChipRound($val['add']-$val['low']);?></td>
                                                        </tr>
                                                    <?php } } else{?>
                                                    <tr>
                                                        <td colspan="10">暂无数据</td>
                                                    </tr>
                                                <?php } ?>
                                                </tbody>

                                            </table>
                                        </div>

                                        <nav>
                                            <ul class="pagination">
                                                <li class="disabled"><a href="#">共<span class="pagetotal"><?php echo $totalNum;?></span>条</a></li>
                                                <?php echo $pageurl;?>
                                            </ul>
                                        </nav>
                                    </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>