<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>">
<link href=images/style.css rel=stylesheet type=text/css>
<script language="JavaScript" src="js/common.js" type="text/javascript"></script>
<script type="text/javascript" src="../include/calendar.php"></script>
<link rel="stylesheet" rev="stylesheet" href="../include/calendar/calendar.css" type="text/css" media="all" />
<body>
<table width=100% border=0 align=center cellpadding=0 cellspacing=1 class=tableborder>
<form method="post" name="search">
  <tr>
    <td align="center" class="tablerow">
	<select name="type">
	<option value="">类型</option> 
	<option value="userids" <?=($typeid == 'userids') ? 'selected' : ''?>>用户</option>
	<option value="comids" <?=($typeid == 'comids') ? 'selected' : ''?>>商家</option> 
    <option value="webhome" <?=($typeid == 'webhome') ? 'selected' : ''?>>网站</option>
	</select>&nbsp;&nbsp;<input name='uid' type='text' value="<?=$uid?>" size=12>
	&nbsp;&nbsp;
	开始日期：<input name="begindate" type="text" id="begindate" size="12" value="<?=$begindate?>" onClick="return showCalendar('begindate', '%Y-%m-%d', false, false, 'begindate');" />&nbsp;&nbsp;截止日期：<input name="enddate" type="text" id="enddate" size="12" value="<?=$enddate?>" onClick="return showCalendar('enddate', '%Y-%m-%d', false, false, 'enddate');" />&nbsp;&nbsp;<input type="submit" name="search" value="查 询"></td>
  </tr>
  </form>
</table>
<h3>财务汇总明细记录&nbsp;<? if(!empty($begindate) || !empty($enddate)){ ?>(<?=$begindate?> - <?=$enddate?>)<? } ?></h3>
<table width=100% border=0 align=center cellpadding=0 cellspacing=1 class=tableborder>
          <?php
          if($typeid=="userids"){
           if(empty($uid)){
          ?>
          <tr>
              <td align=right width="25%">注册会员</td>
			  <td align=left width="70%"><?=$count_user?></td>
          </tr>
          <tr>
              <td align=right width="25%">绑定<?=$CFG[cardname]?>会员</td>
			  <td align=left width="70%"><?=$count_card_user?></td>
          </tr>
          <? } ?>
          <tr bgcolor=#CED4E8>
              <td align=right width="25%" class="fb">消费</td>
			  <td align=left width="70%"></td>
          </tr>
          <tr>
              <td align=right width="25%">消费交易总量</td>
			  <td align=left width="70%"><?=$re[jyl]?>次</td>
          </tr>
          <tr>
              <td align=right width="25%">交易总金额</td>
			  <td align=left width="70%">￥<? echo number_format($re[zje],2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">折扣优惠金额</td>
			  <td align=left width="70%">-￥<? echo number_format($re[zje]-$re[zkj],2) ?></td>
          </tr>
          <tr>
              <td align=right width="25%"></td>
			  <td align=left width="70%">折扣优惠(-￥<? echo number_format($re[zje]-$re[zkj]-$re[lej]-$re[soj],2)?>)</td>
          </tr>
          <tr>
              <td align=right width="25%"></td>
			  <td align=left width="70%"><?=$CFG[lejuan]?>优惠(-￥<? echo number_format($re[lej],2)?>)</td>
          </tr>
          <tr>
              <td align=right width="25%"></td>
			  <td align=left width="70%">首单立减优惠(-￥<? echo number_format($re[soj],2)?>)</td>
          </tr>
          <tr>
              <td align=right width="25%">实际交易支出总额</td>
			  <td align=left width="70%">￥<? echo number_format($re[zkj],2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">单次消费均额</td>
			  <td align=left width="70%">￥<?php echo $re[zkj]>0 || $re[jyl]>0 ? number_format($re[zkj]/$re[jyl],2) : 0;?></td>
          </tr>
          <tr bgcolor=#CED4E8>
              <td align=right width="25%" class="fb">充值/提现</td>
			  <td align=left width="70%"></td>
          </tr>
          <tr>
              <td align=right width="25%">充值总额</td>
			  <td align=left width="70%">￥<?=number_format($cong_user,2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">提现总额</td>
			  <td align=left width="70%">￥<?=number_format($tx_user,2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">会员帐户总余额</td>
			  <td align=left width="70%">￥<?=number_format($info_user[money],2)?></td>
          </tr>
          <tr bgcolor=#CED4E8>
              <td align=right width="25%" class="fb">积分</td>
			  <td align=left width="70%"></td>
          </tr>
          <tr>
              <td align=right width="25%">获取积分总数</td>
			  <td align=left width="70%"><?=$re[jifen]?></td>
          </tr>
          <tr>
              <td align=right width="25%">兑现总积分</td>
			  <td align=left width="70%"><?=$jf_user[jifen]?></td>
          </tr>
          <tr>
              <td align=right width="25%">兑现总金额</td>
			  <td align=left width="70%">￥<?=number_format($jf_user[money],2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">会员剩余积分总数</td>
			  <td align=left width="70%"><?=$info_user[jifen]?></td>
          </tr>
          <tr bgcolor=#CED4E8>
              <td align=right width="25%" class="fb"><?=$CFG[lejuan]?></td>
			  <td align=left width="70%"></td>
          </tr>
          <tr>
              <td align=right width="25%">领取<?=$CFG[lejuan]?>总数</td>
			  <td align=left width="70%"><?=$juan_user[nums]?></td>
          </tr>
          <tr>
              <td align=right width="25%"><?=$CFG[lejuan]?>总额</td>
			  <td align=left width="70%">￥<?=number_format($juan_user[money],2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">已消费券额</td>
			  <td align=left width="70%">￥<? echo number_format($re[lej],2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">未消费券额</td>
			  <td align=left width="70%">￥<?=number_format($juan_user[money]-$re[lej],2)?></td>
          </tr>
          <? } ?>
          <?php
          if($typeid=="comids"){
          ?>
          <tr bgcolor=#CED4E8>
              <td align=right width="25%" class="fb">收支汇总</td>
			  <td align=left width="70%"></td>
          </tr>
          <tr>
              <td align=right width="25%">商家交易总额</td>
			  <td align=left width="70%">￥<? echo number_format($re[zje],2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">折扣优惠总额</td>
			  <td align=left width="70%">-￥<? echo number_format($re[zje]-$re[zkj],2) ?></td>
          </tr>
          <tr>
              <td align=right width="25%"></td>
			  <td align=left width="70%">折扣优惠(-￥<? echo number_format($re[zje]-$re[zkj]-$re[lej]-$re[soj],2)?>)</td>
          </tr>
          <tr>
              <td align=right width="25%"></td>
			  <td align=left width="70%"><?=$CFG[lejuan]?>优惠(-￥<? echo number_format($re[lej],2)?>)</td>
          </tr>
          <tr>
              <td align=right width="25%"></td>
			  <td align=left width="70%">首单立减优惠(-￥<? echo number_format($re[soj],2)?>)</td>
          </tr>
          <tr>
              <td align=right width="25%">平台服务费</td>
			  <td align=left width="70%">-￥<? echo number_format($re[fc],2)?></td>
          </tr>
         <tr>
              <td align=right width="25%">售卡消费分成</td>
			  <td align=left width="70%">￥<? echo number_format($card_fc,2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">商家实收总额</td>
			  <td align=left width="70%">￥<? echo number_format($re[siso]+$card_fc,2)?></td>
          </tr>
          <tr bgcolor=#CED4E8>
              <td align=right width="25%" class="fb">增值服务购买</td>
			  <td align=left width="70%"></td>
          </tr>
          <tr>
              <td align=right width="25%">积分消费</td>
			  <td align=left width="70%">￥<? echo number_format($com_credit['money'],2)?> (<? echo floor($com_credit['nums'])?> 分)</td>
          </tr>
          <tr>
              <td align=right width="25%">剩余积分总数</td>
			  <td align=left width="70%"><?=$com_sp[jf_num]?></td>
          </tr>
          <tr bgcolor=#CED4E8>
              <td align=right width="25%" class="fb">余额</td>
			  <td align=left width="70%"></td>
          </tr>
           <tr>
              <td align=right width="25%">已提现总额</td>
			  <td align=left width="70%">￥<? echo number_format($tx_com,2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">店铺帐户余额</td>
			  <td align=left width="70%">￥<? echo number_format($com_yuer,2)?></td>
          </tr>
          <? } ?>
          <?php
          if($typeid=="webhome"){
          ?>
          <tr>
              <td align=right width="25%">消费提成收入</td>
			  <td align=left width="70%">￥<? echo number_format($re[fc],2)?></td>
          </tr>
          <tr>
              <td align=right width="25%">分销售卡消费提成支出(<?=$CFG['com_shop_card']?>%)</td>
			  <td align=left width="70%">-￥<?=$card_fc?></td>
          </tr>
          <tr>
              <td align=right width="25%">积分收入</td>
			  <td align=left width="70%">￥<?=$com_credit['money']?></td>
          </tr>
          <tr>
              <td align=right width="25%"><?=$CFG['lejuan']?>支出</td>
			  <td align=left width="70%">-￥<?=$re['lej']?></td>
          </tr>
          <tr>
              <td align=right width="25%">会员卡费</td>
			  <td align=left width="70%">￥<?=$card_money?></td>
          </tr>
          
          <tr>
              <td align=right width="25%">支付宝手续费支出</td>
			  <td align=left width="70%">￥</td>
          </tr>
          <tr>
              <td align=right width="25%">网站总收入</td>
			  <td align=left width="70%">￥<? echo number_format($re[fc]+$com_credit['money']+$com_sms['money']-$re['lej']+$card_money-$card_fc,2)?></td>
          </tr>
          <? } ?>
        </table>
       
</body>
</html>