<?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 class="layui-form">
			  <div class="layui-inline">
				<label class="layui-form-label">时间区间</label>
				<div class="layui-input-inline">
					<input type="text" name="betime" id="betime" class="layui-input" value="<?php echo $Params['betime'];?>" placeholder=" ~ ">
				</div>
				<div class="layui-input-inline">
					<?php foreach($fastTime as $k=>$v){?>
					<a href="javascript:;" data-betime="<?php echo $v;?>" style="margin-left:10px;" class="a_blue"><?php echo $k;?></a>
				<?php }?>
				</div>
			  </div>
			   <div class="layui-inline">
				<label class="layui-form-label">统计类型</label>
				<div class="layui-input-block w100">
					<select name="group">
						<?php foreach($groupByArr as $k=>$v){?>
						<option value="<?php echo $k;?>"<?php if($Params['group'] === $k) echo ' selected'; ?>><?php echo $v[0];?></option>
						<?php }?>
					</select>
				</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>
		<?php foreach($sum as $acc => $av ){ ?>
		<blockquote class="layui-elem-quote" style="width:520px"><b><?php echo $accArr[$acc]['acc_name'];?></b></blockquote>
		<table class="layui-table" style="width:550px">
		  <?php foreach($av as $type => $avv ){ ?>
		  <tbody>
			<tr>
				<th colspan="4" class="center"><b class="red2"><?php echo $payArr[$type]? $payArr[$type]: '全部';?></b></th>
			</tr>
			<tr>
			  <th width="80">日期</th>
			   <th class="center">科目</th>
			   <th class="center tdbg1">借方</th>
			   <th class="center tdbg0">贷方</th>
			</tr> 
			<tr>
				<td>小计</td>
				<td> </td>
				<td class="tdbg1"><?php if($tj[$acc][$type]['vol_jiefang'] > 0) echo sprintf('%.2f', $tj[$acc][$type]['vol_jiefang']);?></td>
				<td class="tdbg0"><?php if($tj[$acc][$type]['vol_daifang'] > 0) echo sprintf('%.2f', $tj[$acc][$type]['vol_daifang']);?></td>
			</tr>
			<?php foreach($avv as $vvv){?>
			<tr <?php echo $vvv['vok_code'] ==  'PJLYHCK'? ' class="red"': '';?>>
				<td><?php echo $vvv['vol_date'];?></td>
				<td><?php echo $vvv['vok_name'];?></td>
				<td class="tdbg1"><?php if($vvv['vol_jiefang'] > 0) echo sprintf('%.2f', $vvv['vol_jiefang']);?></td>
				<td class="tdbg0"><?php if($vvv['vol_daifang'] > 0) echo sprintf('%.2f', $vvv['vol_daifang']);?></td>
			</tr>
		    <?php }?>
			<tr style="border:0px;">
				<td colspan="4" style="border:0px;"></td>
			</tr>
		  </tbody>
		  <?php }?>
		</table>
		<br><br><br>
		<?php }?>
	</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: '~'
    });
	$('[data-betime]').click(function(){
		$('[name="betime"]').val($(this).data('betime'));
		$("form").submit();
	});
});
</script>