<?php include_once(mvc::$cfg['PATH_TPL'].'public/headBase2.php');?>
<div class="layui-card">
	<div class="layui-card-body">
		<div style="padding:0 10px 10px 0;">
			<form>
			  <div class="layui-inline">
				<label class="layui-form-label">时间区间</label>
				<div class="layui-input-block">
					<input type="text" name="betime" id="betime" class="layui-input" value="<?php echo $Params['betime'];?>" placeholder=" ~ ">
				</div>
			  </div>
			  <div class="layui-inline">
				<button class="layui-btn act-btn" type="submit">
				  <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
				</button>
			  </div>
			</form>
		</div>
		<table class="layui-table" style="width:450px">
		  <thead>
			<tr>
			  <th width="100" rowspan="2">日期</th>
			  <?php $i= 0; foreach($typeArr as $type=>$tname){?>
			  <th colspan="2" class="center tdbg<?php echo $i;?>"><?php echo $tname;?></th>
			  <?php $i++;}?>
			</tr> 
			<tr>
			  <?php $i= 0; foreach($typeArr as $type=>$tname){?>
			  <th class="center tdbg<?php echo $i;?>">金额</th>
			  <th class="center tdbg<?php echo $i;?>">单数</th>
			  <?php $i++;}?>
			</tr> 
			<tr>
				<th>汇总</th>
				<?php  $i= 0; foreach($typeArr as $type=>$tname){?>
				<th class="red tdbg<?php echo $i;?>"><?php if(!empty($sum[$type]['paymoney'])) echo sprintf('%.2f', $sum[$type]['paymoney']);?></th>
				<th class="red tdbg<?php echo $i;?>"><?php if(!empty($sum[$type]['count'])) echo $sum[$type]['count'];?></th>
				<?php $i++;}?>
			</tr>
		  </thead>
		  <tbody>
			<?php foreach($tjArr as $k => $v ){ ?>
			<tr>
				<td><?php echo $k;?></td>
				<?php $i= 0; foreach($typeArr as $type=>$tname){?>
				<td class="tdbg<?php echo $i;?>"><?php if(!empty($v[$type]['paymoney'])) echo sprintf('%.2f', $v[$type]['paymoney']);?></td>
				<td class="tdbg<?php echo $i;?>"><?php if(!empty($v[$type]['count']))  echo $v[$type]['count'];?></td>
				<?php $i++;}?>
			</tr>
			<?php }?>
			
		  </tbody>
		</table>
	</div>
</div>
<?php include_once(mvc::$cfg['PATH_TPL'].'public/footBase.php');?>
<script>
layui.use(['table', 'laydate'], function(){
  var table = layui.table,laydate = layui.laydate;
	
	laydate.render({
      elem: '#betime'
      ,range: '~'
    });
});
</script>