<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>查询</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#vip/getRank" name="stanpform">
                                        <input type="hidden" value="1" name="payuserpost"/>
                                        <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 id="container1" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            
            <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;">付费/免费积分来源</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>
                            </tr>
                        
                        </thead>
                        <tbody id="reportBody">
                        	<?php
                        		$count = 0;
                        		$point = 0;
                        		$pointTotal = 0;
								foreach($data['sumDay'] as $k => $v){
									$count += $v['count'];
									$point += $goods[$v['sl_gid']]['gprice']*$rate;
									$pointTotal += $v['count'] * $goods[$v['sl_gid']]['gprice'] * $rate;
							?>
                        	<tr>
                        		<th style="text-align: center;vertical-align: middle;"><?php echo $k+1; ?></th>
                        		<td style="text-align: center;vertical-align: middle;"><?php echo $goods[$v['sl_gid']]['gname']; ?></td>
                        		<td style="text-align: center;vertical-align: middle;"><?php echo $v['count']; ?></td>
                        		<td style="text-align: center;vertical-align: middle;"><?php echo $goods[$v['sl_gid']]['gprice']*$rate; ?></td>
                        		<td style="text-align: center;vertical-align: middle;"><?php echo $v['count'] * $goods[$v['sl_gid']]['gprice'] * $rate; ?></td>
                        	</tr>
                        	<?php
								}
							?>
							<tr>
								<th style="text-align: center;vertical-align: middle;">合计</th>
								<td style="text-align: center;vertical-align: middle;">--</td>
								<td style="text-align: center;vertical-align: middle;"><?php echo $count; ?></td>
								<td style="text-align: center;vertical-align: middle;"><?php echo $point; ?></td>
								<td style="text-align: center;vertical-align: middle;"><?php echo $pointTotal; ?></td>
							</tr>
                        </tbody>
                    </table>
                </div>
            </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">

    Highcharts.chart('container1', {
        chart: {
            type: 'line'
        },
        title: {
            text: '积分获得排行'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php 
            	foreach($data['day'] as $k => $v){
            		echo '"'.$k.'",';
            	}
            ?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name:'数值',
                data:[<?php echo implode(',',$data['day']); ?>]
            }
        ]
    });


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