<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="#activitysta/fundSta" name="stanpform">
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>活动</label>
                                            <select class="form-control" name="id" id="selId">
                                                <option value="0">请选择活动期</option>
                                                <?php foreach ($activityId as $id => $name) { ?>
                                                    <option value="<?php echo $id;?>" <?php if($id == $curId) echo 'selected';?>><?php echo $name;?></option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                        <button type="button" class="btn btn-primary" onclick="show()">查询</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 style="text-align: center;vertical-align: middle;">类型</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第1天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第2天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第3天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第4天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第5天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第6天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第7天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第8天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第9天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第10天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第11天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第12天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第13天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第14天</th>
                                                <th style="text-align: center;vertical-align: middle;">活动第15天</th>
                                                <th style="text-align: center;vertical-align: middle;">合计</th>
                                            </tr>
                                            </thead>
                                            <tbody id="reportBody" style="overflow-y: scroll;">
                                                <tr>
                                                    <td style="text-align: center;vertical-align: middle;">首购</td>
                                                    <?php foreach (array_column($showData,"orderInfo1812") as $key => $val) {?>
                                                        <td style="text-align: center;vertical-align: middle;"><?php echo intval($val); ?></td>
                                                    <?php } ?>
                                                    <td style="text-align: center;vertical-align: middle;"><?php echo array_sum(array_column($showData,"orderInfo1812")); ?></td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: center;vertical-align: middle;">首购率</td>
                                                    <?php foreach (array_column($showData,"pro1812") as $key => $val) {?>
                                                        <td style="text-align: center;vertical-align: middle;"><?php echo $val; ?>%</td>
                                                    <?php } ?>
                                                    <td style="text-align: center;vertical-align: middle;"><?php echo count(array_column($showData,"pro1812")) == 0 ? 0 : array_sum(array_column($showData,"pro1812"))/count(array_column($showData,"pro1812")); ?>%</td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: center;vertical-align: middle;">复购</td>
                                                    <?php foreach (array_column($showData,"orderInfo1813") as $key => $val) {?>
                                                        <td style="text-align: center;vertical-align: middle;"><?php echo intval($val); ?></td>
                                                    <?php } ?>
                                                    <td style="text-align: center;vertical-align: middle;"><?php echo array_sum(array_column($showData,"orderInfo1813")); ?></td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: center;vertical-align: middle;">首购率</td>
                                                    <?php foreach (array_column($showData,"pro1813") as $key => $val) {?>
                                                        <td style="text-align: center;vertical-align: middle;"><?php echo $val; ?>%</td>
                                                    <?php } ?>
                                                    <td style="text-align: center;vertical-align: middle;"><?php echo count(array_column($showData,"pro1813")) == 0 ? 0 : array_sum(array_column($showData,"pro1813"))/count(array_column($showData,"pro1813")); ?>%</td>
                                                </tr>
                                            </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">
    function show(){
        window.location.href="#activitysta/fundSta/"+$("#selId").val();
    }
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });
</script>