<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="#statistics/buildSta" 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="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>
        
        <?php
        function formatChipRound($value, $round=2)
        {
            $value = ceil($value);

            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;
            }
        }
        ?>
                                            
		
        <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="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 colspan="5" style="text-align: center;vertical-align: middle;">建筑统计</th>
                                            <th colspan="5" 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>
                                        </tr>
                                        </thead>
                                        <tbody id="reportBody">
                                        <?php
                                         if(is_array($data)){
                                            foreach($data as $k => $val){
                                                ?>
                                                <tr>
                                                	<td style="white-space: nowrap" rowspan="1"><?php echo $val['date'];?></td>
													<td style="white-space: nowrap" rowspan="1"><?php echo $val['data']['build']['total'];?></td>
													<td style="white-space: nowrap" rowspan="1"><?php echo $val['data']['build']['userNumber'];?></td>
													<td style="white-space: nowrap" rowspan="1"><?php echo number_format($val['data']['build']['total']/$val['data']['build']['userNumber'],2);?></td>
                                                	<td style="white-space: nowrap" rowspan="1"><?php echo $val['data']['build']['money'];?></td>
                                                	
													<td style="white-space: nowrap" rowspan="1"><?php echo $val['data']['repair']['total'];?></td>
													<td style="white-space: nowrap" rowspan="1"><?php echo $val['data']['repair']['userNumber'];?></td>
													<td style="white-space: nowrap" rowspan="1"><?php echo number_format($val['data']['repair']['total']/$val['data']['repair']['userNumber'],2);?></td>
													<td style="white-space: nowrap" rowspan="1"><?php echo $val['data']['repair']['money'];?></td>
                                                </tr>
                                                <?php
                                            }
                                         }
                                        ?>
                                        </tbody>
                                    </table>
                                </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>