<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>
                    <header><i class="fa fa-fw fa-file"></i><?php echo $title; ?></header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#adjuststa/dayPayData" name="stanpform">
                                        <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>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>版本</label>
                                            <select class="form-control" name="user_os">
                                                <option value="" <?php echo $user_os == ""?"selected":""; ?> >all</option>
                                                <option value="Android" <?php echo $user_os == "Android"?"selected":""; ?> >Android</option>
                                                <option value="iOS" <?php echo $user_os == "iOS"?"selected":""; ?> >iOS</option>
                                                <option value="windows" <?php echo $user_os == "windows"?"selected":""; ?> >windows</option>
                                            </select>
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>国家</label>
                                            <input type="text" class="form-control" value="<?php if($address) echo $address;?>" placeholder="国家" name="address" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>广告渠道</label>
                                            <select class="form-control" name="trackers_group_type">
                                                <option value="" <?php echo $trackers_group_type == ""?"selected":""; ?> >all</option>
                                                <option value="fb_ads" <?php echo $trackers_group_type == "fb_ads"?"selected":""; ?> >fb_ads</option>
                                                <option value="google_ads" <?php echo $trackers_group_type == "google_ads"?"selected":""; ?> >google_ads</option>
                                                <option value="ins_ads" <?php echo $trackers_group_type == "ins_ads"?"selected":""; ?> >ins_ads</option>
                                                <option value="orignic_all" <?php echo $trackers_group_type == "orignic_all"?"selected":""; ?> >orignic_all</option>
                                            </select>
                                        </div>
                                        <span class="gap"></span>
                                        <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>
                    <div class="table-responsive">
                        <table id="reportTable" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                            <thead>
                            <tr>
                                <th style="text-align: center;vertical-align: middle;width:200px;">日期</th>
                                <th style="text-align: center;vertical-align: middle;">版本</th>
                                <th style="text-align: center;vertical-align: middle;">国家</th>
                                <th style="text-align: center;vertical-align: middle;">广告渠道</th>
                                <th style="text-align: center;vertical-align: middle;">DAU</th>
                                <th style="text-align: center;vertical-align: middle;">支付总额</th>
                                <th style="text-align: center;vertical-align: middle;">内购收入</th>
                                <th style="text-align: center;vertical-align: middle;">本地收入</th>
                                <th style="text-align: center;vertical-align: middle;">广告收入</th>
                                <th style="text-align: center;vertical-align: middle;">激励视频收入</th>
                                <th style="text-align: center;vertical-align: middle;">支付次数</th>
                                <th style="text-align: center;vertical-align: middle;">支付人数</th>
                                <th style="text-align: center;vertical-align: middle;">付费渗透率（总）</th>
                                <th style="text-align: center;vertical-align: middle;">广告ARPU</th>
                                <th style="text-align: center;vertical-align: middle;">内购ARPU</th>
                                <th style="text-align: center;vertical-align: middle;">ARPPU</th>
                                <th style="text-align: center;vertical-align: middle;">当日注册人数</th>
                                <th style="text-align: center;vertical-align: middle;">当日注册的付费人数</th>
                                <th style="text-align: center;vertical-align: middle;">当日注册玩家付费率</th>
                                <th style="text-align: center;vertical-align: middle;">当日注册用户支付总额</th>
                                <th style="text-align: center;vertical-align: middle;">当日注册ARPU</th>
                                <th style="text-align: center;vertical-align: middle;">当日注册内购ARPU</th>
                                <th style="text-align: center;vertical-align: middle;">当日注册广告ARPU</th>
                                <th style="text-align: center;vertical-align: middle;">当日注册ARPPU</th>
                            </tr>
                            </thead>
                            <tbody id="reportBody">
                            <?
                            if(!empty($list)){ foreach($list as $date => $vos){
                                foreach($vos as $user_os_temp => $vo){
                                    if($user_os && $user_os_temp != $user_os){
                                        continue;
                                    }
                                    foreach($vo as $address_temp => $v){
                                        if($address && $address_temp != $address){
                                            continue;
                                        }
                                        foreach($v as $trackers_group_type => $row){

                                            ?>
                                            <tr>
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo $date; ?></td>
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo $user_os_temp;//版本 ?></td>
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo $address_temp;//地区 ?></td>
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo $trackers_group_type; ?></td>
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo $row['dau'] ?? 0; ?></td><!--DAU-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--支付总额-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo $row['period_0_kpis'][4] ?? 0; ?></td><!--内购收入-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--本地收入-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo $row['advert_0'][4] ?? 0; ?></td><!--广告收入-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--激励视频收入-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--支付次数-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo $row['advert_0'][2] ?? 0; ?></td><!--支付人数-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo empty($row['dau']) ? 0 : number_format($row['advert_0'][2] / $row['dau'],2,',',''); ?></td><!--付费渗透率（总）-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--广告ARPU-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--内购ARPU-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo empty($row['install']) ? 0 :number_format($row['period_0_kpis'][2] / $row['install'] * 100,2,'.',''); ?></td><!--ARPPU-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--当日注册人数-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--当日注册的付费人数-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--当日注册玩家付费率-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--当日注册用户支付总额-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo empty($row['install']) ? 0 :number_format($row['period_0_kpis'][2] / $row['install'] * 100,2,'.',''); ?></td><!--当日注册ARPU-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--当日注册内购ARPU-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;">-</td><!--当日注册广告ARPU-->
                                                <td style="text-align: center;vertical-align: middle;width:200px;"><?php echo empty($row['period_0_kpis'][2]) ? 0 :number_format($row['period_0_kpis'][3] / $row['period_0_kpis'][2],2,'.',''); ?></td><!--当日注册ARPPU-->
                                            </tr>
                                        <?php } } } } } ?>
                            </tbody>
                        </table>
                    </div>
                </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">


</script>
<script type="text/javascript">
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });
</script>