<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="#operate/marketLaunch/1" name="stanpform">
                                        <input type="hidden" name="payuserpost" 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="payuserindex_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="payuserindex_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">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                    	<thead>
							<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>
							</tr>
						</thead>
						<tbody>
							<?php
								foreach($data as $key => $row){
									$temp = explode("_",$row['name']);
									$countryTemp = $temp[1];
									$peopleTemp = $temp[0];
									$adTypeTemp = $temp[2];
									echo '<tr>';
									echo '<td>'.$row['country'].'</td>';
									echo '<td>'.$peopleTemp.'</td>';
									echo '<td>'.$adTypeTemp.'</td>';
									echo '<td>'.$row['kpi_values'][6].'</td>';//花费金额
									echo '<td>'.$row['kpi_values'][0].'</td>';//展示次数
									echo '<td>'.round($row['kpi_values'][11],2).'</td>';//千次展示费用
									echo '<td>'.$row['kpi_values'][8].'</td>';//点击量
									echo '<td>'.(round($row['kpi_values'][12]*100,2)).'</td>';//点击率
									echo '<td>'.$row['kpi_values'][2].'</td>';//应用安装
									echo '<td>'.$row['kpi_values'][13].'</td>';//单次应用花费安装
									echo '<td>'.(empty($row['kpi_values'][8])?0:(round($row['kpi_values'][2]/$row['kpi_values'][8]*100,2))).'</td>';//转化率
									echo '<td>'.$row['kpi_values'][14].'</td>';//付费人数
									echo '<td>'.round($row['kpi_values'][10],2).'</td>';//付费金额
									echo '<td>'.(empty($row['kpi_values'][6])?0:(round($row['kpi_values'][10]/$row['kpi_values'][6]*100,2))).'</td>';//当日回收
									echo '<td>'.(empty($row['kpi_values'][2])?0:(round($row['kpi_values'][14]/$row['kpi_values'][2]*100,2))).'</td>';//付费率
									echo '</tr>';
								}
							?>
						</tbody>
                    </table>
                </div>
            </div>                    
        </div>
    </div>
</div>
<!--<script type="text/javascript" src="--><?php //echo base_url().'public/js/chart/chart.js';?><!--"></script>-->
<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>