<?php
$t1=0;$t2=0;$t3=0;$t4=0;$t='';
//if(request('tpl')!='agentorderprofit' && request('tpl')!='agentproductprofit'){
  $t1 = 1;
//}
if(request('tpl')=='agentorderprofit'){
  $t3 = 1;
}
if(request('tpl')=='agentproductprofit'){
  $t4 = 1;
}
if(request('tpl')!='agent' && request('tpl')!='agentorderprofit' && request('tpl')!='ykt' && request('tpl')!='agentproductprofit'){
  $t2 = 1;
}
$t = $t3 ? '(代理)' : ($t4 ? '(供货)' : '(余额)');
?>
<!--$ishistory=intval(request('ishistory'));-->
<!--if($vd['table']==0){-->
{load(head)}
<body>
<div class="titleDiv" id="titleList">
<div style="float:left"><a href="index.php?a=home"><img src="{$vd['sc']}images/home.png" style="vertical-align:middle" border="0"/></a></div><div style="float:left;padding-top:8px;padding-left:3px;"><a href="index.php?a=home" title="回到后台首页"><font color="#000">桌面</font></a> <span style="font-size:7px;">>></span> <span style="font-size:12px;"><a href="index.php?m=mod_b2b&c=trade&{$vd['op']}" title="点击重新获取订单列表资料" onclick="loadDisp(1)"><font color="#000">用户帐务<!--if($ishistory==1){-->历史<!--}-->报表</font></a></span> (共 <b><span id="tol1">{$vd['totlerow']}</span></b> 个)</div>
<div style="float:right"><a href="index.php" onFocus="this.blur()" title="查看订单相关帮助"><img src="{$vd['sc']}images/help.gif" style="vertical-align:middle" border="0"/></a></div>
</div>
<div class="mytitle" id="mytitle">
  <div class="titleOp2" onmouseover="this.className='iconbg2'" onmouseout="this.className='titleOp2'" onclick="tableRefresh()"><samp title="点击刷新本页刷新数据,并保持原来勾选状态">
    <div style="padding-top:10px;padding-left:9px;">刷新</div></samp>
  </div>
  <div style="float:right;padding-top:4px;">
    <form action="index.php?m=mod_b2b&c=trade&tradetype={$vd['tradetype']}&tpl=<!--echo request('tpl');-->&ishistory={$ishistory}" method="post" style="margin:0px 0px 0px 0px;" onsubmit="return searchSubmit()">
    <input type="text" name="startdate" size="18" value="{$vd['startdate']}" style="vertical-align:middle;" id="startdate" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" />
    <img src="{$vd['sc']}images/calender.gif" onclick="dateDialog('startdate')" style="vertical-align:middle;cursor:pointer;margin-left:0px;"/>
    到 <input type="text" name="enddate" size="18" value="{$vd['enddate']}" style="vertical-align:middle;"  id="enddate" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" />
    <img src="{$vd['sc']}images/calender.gif" onclick="dateDialog('enddate')" style="vertical-align:middle;cursor:pointer;margin-left:0px;"/>
    <input type="text" name="keywords" size="16" value="{$vd['keywords']}" style="vertical-align:middle;" class="custsearch" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" />
    <select name="stype" style="vertical-align:middle;font-size:14px;">
      {#Option($vd['sarray'], $vd['stype'])}
    </select>
    <input type="submit" value="搜索" style="vertical-align:middle;" class="button"/><input type="button" value="&gt;&gt;" onFocus="this.blur()" onclick="disp('adddiv')" class="button" style="vertical-align:middle;border-left:0px;padding-left:1px"/>
    </form>
  </div>
</div>

<div id="contentTip" style="display:none;"></div>
<div id="adddiv" style="position:absolute;top:100px;left:230px;;width:320px;display:none">
  <div class="popbg">
  <div class="poptitle">高级搜索</div>
  <div style="float:right;"><img src="{$vd['sc']}images/destroy.gif" onclick="disp('adddiv')" style="cursor:pointer"/></div>
  <form action="index.php?m=mod_b2b&c=trade&tradetype={$vd['tradetype']}&tpl=<!--echo request('tpl');-->&ishistory={$ishistory}" method="post" onsubmit="return searchSubmit()" style="clear:both">
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
    <tr>
      <td width="25%">起始日期</td>
      <td width="75%">
        <input type="text" name="startdate" size="18" value="{$vd['startdate']}" style="vertical-align:middle;" id="tstartdate" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" />
        <img src="{$vd['sc']}images/calender.gif" onclick="dateDialog('tstartime')" style="vertical-align:middle;cursor:pointer;margin-left:0px;"/>
      </td>
    </tr>
    <tr>
      <td width="25%">终止日期</td>
      <td width="75%">
        <input type="text" name="enddate" size="18" value="{$vd['enddate']}" style="vertical-align:middle;"  id="tenddate" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" />
        <img src="{$vd['sc']}images/calender.gif" onclick="dateDialog('tendtime')" style="vertical-align:middle;cursor:pointer;margin-left:0px;"/>
      </td>
    </tr>
    <tr>
      <td width="25%">关键词</td>
      <td width="75%">
        <input type="text" name="keywords" size="25" value="{$vd['keywords']}" style="vertical-align:middle;" class="custsearch" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" />
      </td>
    </tr>
    <tr>
      <td width="25%">搜索类型</td>
      <td width="75%">
        <select name="stype" style="vertical-align:middle;font-size:14px;">
          {#Option($vd['sarray'], $vd['stype'])}
        </select>
      </td>
    </tr>
    <tr>
      <td width="25%">交易类型</td>
      <td width="75%">
        <select name="tradetype" style="vertical-align:middle;font-size:14px;">
          {#Option($vd['tradetypes'], $vd['tradetype'])}
        </select>
      </td>
    </tr>
    <tr>
      <td width="25%">对应平台</td>
      <td width="75%">
        <select name="comefrom" style="vertical-align:middle;font-size:14px;">
        {#Option($vd['cfarray'], $vd['comefrom'])}
        </select>
      </td>
    </tr>
    <tr>
      <td width="25%">状态</td>
      <td width="75%">
        <select name="state" style="vertical-align:middle;font-size:14px;">
        <option value="-2">所有</option>
        <option value="-1">无效</option>
        <option value="5" selected >有效</option>
        </select>
      </td>
    </tr>
    <tr>
      <td width="25%"></td>
      <td width="75%">
        <input type="hidden" value="inrecycle" value="{$vd['inrecycle']}"/>
        <input type="submit" value="搜 索" class="button"/>
        <input type="button" value="取 消" onclick="disp('adddiv')" class="button"/>
      </td>
    </tr>
  </table>
  </form>
  </div>
</div>

<div id="menuMask" class="menuMask" style="display:none">
  <form action="?m=mod_b2b&c=tpl&tpl=trade" method="post" style="margin:0px">
  <div class="menuContent">
  <input type="checkbox" name="id[]" value="view" id="view" class="checkbox" onFocus='this.blur()'/> 查看交易<br/>
  <input type="checkbox" name="id[]" value="aid" id="aid" class="checkbox" onFocus='this.blur()'/> 用户<br/>
  <input type="checkbox" name="id[]" value="fbt" id="fbt" class="checkbox" onFocus='this.blur()'/> 交易前<br/>
  <input type="checkbox" name="id[]" value="fat" id="fat" class="checkbox" onFocus='this.blur()'/> 交易后<br/>
  <input type="checkbox" name="id[]" value="state" id="state" class="checkbox" onFocus='this.blur()'/> 状态<br/>
  <input type="checkbox" name="id[]" value="price" id="price" class="checkbox" onFocus='this.blur()'/> 用户进价<br/>
  <input type="checkbox" name="id[]" value="operator" id="operator" class="checkbox" onFocus='this.blur()'/> 操作员<br/>
  <input type="checkbox" name="id[]" value="listprice" id="listprice" class="checkbox" onFocus='this.blur()'/> 下家购价<br/>
  <input type="checkbox" name="id[]" value="qty" id="qty" class="checkbox" onFocus='this.blur()'/> 购买量<br/>
  <input type="checkbox" name="id[]" value="ordno" id="ordno" class="checkbox" onFocus='this.blur()'/> 订单号<br/>
  <input type="checkbox" name="id[]" value="orddate" id="orddate" class="checkbox" onFocus='this.blur()'/> 时间<br/>
  <input type="checkbox" name="id[]" value="otherside" id="otherside" class="checkbox" onFocus='this.blur()'/> 交易方<br/>
  <input type="checkbox" name="id[]" value="ttradetype" id="ttradetype" class="checkbox" onFocus='this.blur()'/> 交易类型<br/>
  </div>
  <div class="menuOp">
  <input type="submit" value="保存" class="button"/>
  <input type="button" value="重置" class="button" onclick="tInfoReset()"/>
  <input type="button" value="取消" class="button" onclick="setMenuMask()"/>
  </div>
  </form>
</div>

<table id="thead" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="30px">
      <input name="chkall" disabled id="chkall" type="checkbox" class="checkbox" onclick="CheckAll(this)" onFocus='this.blur()'/></td>
    <td width="280px"><b>说明</b></td>
    <!--if($t1){-->
    <td width="100px" align="center"><b>支出</b></td>
    <!--}-->
    <td width="100px" align="center"><b>收入</b></td>
    <!--if($t2){-->
    <td width="100px" align="center"><b>净利润</b></td>
    <!--}-->
    <!--if(request('tpl')=='ykt'){-->
    <td width="150px"><b>一卡通卡号</b></td>
    <!--}-->
<!--//thead-->
<td width="22px"><img src="{$vd['sc']}images/icon_view.gif"/></td>
<td width="50px"><b>用户</b></td>
<td width="100px"><b>交易后</b></td>
<td width="140px"><b>交易时间</b></td>
<td width="180px"><b>交易类型</b></td>
<!--//endthead-->
    <td class="endtd">
      <div class="infoicon" onclick="setMenuMask()"><b><u>>></u></b></div>
    </td>
  </tr>
</table>
<div id="tip" style="display:none">
  <span id="tiptable">此页中所有 <b><span id="ncheck"><!--echo $vd['nrows'] < $vd['totlerow'] ? $vd['nrows'] : $vd['totlerow']--></span></b> 条记录已选中 </span> 
  <span id="tipspan">
    <a href="javascript:CheckTotle({$vd['totlerow']},0)">点此选择当前列表中所有 <b>{$vd['totlerow']}</b> 条记录>></a>
  </span>
</div>
<div id="content">
<!--}-->
  <!--if($vd['totlerow'] == 0) {-->
  <table  width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="right" colspan="20">无任何记录</td>
  </tr>
  </table>
  <!--}-->
  <form id="cform" name="form" method="post" action="index.php?m=mod_b2b&c=trade&a=ItemDeal" onsubmit="return Check();">
  <table id="tbody"  border="0" cellspacing="0" cellpadding="0">
  
  <!--$profit = 0;$sum_income=0;$sum_outcome=0;foreach($vd['items'] as $item) {-->
  <tr onmouseover="setoverbg(this)" onmouseout="setoutbg(this)">
    <td width="30px">
      <input type="checkbox" disabled name="id[]" id="idchk_{$item['tid']}" class="checkbox" value="{$item['tid']}" onclick="CheckThis(this)" onFocus='this.blur()'></input>
    </td>
    <td width="280px"><nobr><samp title="{$item['content']}"><!--if($item['admname'] != ''){-->(<a href="index.php?m=mod_b2b&c=Trade&tpl=agent&stype=admname&keywords={$item['admname']}">{$item['admname']}</a>)<!--}-->{$item['content']}</samp></nobr></td>
    <!--if($t1){-->
    <td width="100px" align="center"><!--if($item['outcome'] != 0){-->- {$item['outcome']}<!--}--></td>
    <!--}-->
    <td width="100px" align="center"><!--if($item['income'] != 0){-->+ {$item['income']}<!--}--></td>
    <!--if($t2){-->
    <td width="100px" align="center">{$item['income']}</td>
    <!--}-->
    <!--if(request('tpl')=='ykt'){-->
    <td width="150px"><nobr><a href="index.php?m=mod_b2b&c=trade&tpl=ykt&stype=yktnumber&keywords={$item['yktnumber']}&by=1&ishistory={$ishistory}" title="查询 {$item['yktnumber']} 一卡通所支付的记录">{$item['yktnumber']}</a></nobr></td>
    <!--}-->
<!--//tbody-->
<td width="22px"><!--if($item['tradetype'] == 1 || $item['tradetype'] == 11 || $item['tradetype'] == 12){--><a href="index.php?m=mod_b2b&c=order&a=detail&ubzordno={$item['ordno']}&ishistory=<!--echo intval(request('ishistory'));-->" title="查看订单" onFocus="this.blur()" onclick="loadDisp(1)"><img src="{$vd['sc']}images/icon_view.gif"/></a><!--}else if($item['tradetype'] == 2 || $item['tradetype'] == 99){--><a href="index.php?m=mod_b2b&c=Funds&by=1&keywords={$item['ordno']}&stype=ordno" title="查看订单" onFocus="this.blur()" onclick="loadDisp(1)"><img src="{$vd['sc']}images/icon_view.gif"/></a><!--}else{--><font color="#cccccc">无</font><!--}--></td>
<td width="50px"><a href="index.php?m=mod_b2b&c=trade&by=1&stype=aid&keywords={$item['aid']}&tpl=<!--echo getVar('tpl');-->&tradetype=<!--echo getVar('tradetype');-->"><font color="#ff0000">{#DisplayCode($item['aid'])}</font></a></td>
<td width="100px">{$item['fat']}</td>
<td width="140px">{$item['createdate']}</td>
<td width="180px"><nobr><a href="index.php?m=mod_b2b&c=trade&tradetype={$item['tradetype']}&by=1&tpl=<!--echo $item['tradetype']==11 ? 'agentorderprofit' : (request('tpl')=='ykt'||$item['tradetype']==101|$item['tradetype']==100 ? 'ykt' : 'agent');-->">{#TxtByOption($vd['tradetypes'],$item['tradetype'])}</a></nobr></td>
<!--//endtbody-->
    <td class="endtd"></td>
  </tr>
  <!--if($item['state'] > 0){-->
  <!--$profit=$profit+$item['income'];$sum_income=$sum_income+$item['income'];$sum_outcome=$sum_outcome+$item['outcome'];}-->
  <!--}-->
  <!--if($vd['totlerow'] > 0) {-->
  <tr>
    <td></td>
    <td>本页统计</td>
    <!--if($t1){-->
    <td width="100px" align="center"><!--echo round($sum_outcome,3);--></td>
    <!--}-->
    <td width="100px" align="center"><!--echo round($sum_income,3);--></td>
    <!--if($t2){-->
    <td width="100px" align="center"><!--echo round($profit,3);--></td>
    <!--}-->
    <td class="endtd" colspan="21" ></td>
  </tr>
  <tr>
    <td></td>
    <td>查询统计</td>
    <!--if($t1){-->
    <td width="100px" align="center"><!--echo round($vd['record']['outcome'],3);--></td>
    <!--}-->
    <td width="100px" align="center"><!--echo round($vd['record']['income'],3);--></td>
    <!--if($t2){-->
    <td width="100px" align="center"><!--echo round($vd['record']['income'],3);--></td>
    <!--}-->
    <td class="endtd" colspan="21" ></td>
  </tr>
  <!--}-->
</table>
</form>
<input type="hidden" value="{$vd['totlepage']}" id="totlePage"/>
<input type="hidden" value="{$vd['thispage']}" id="thisPage"/>
<!--if($vd['table']==0){-->
</div>

<input type="hidden" value="index.php?m=mod_b2b&c=trade&a=deals&{$vd['op']}&ishistory={$ishistory}" id="op"/>
<input type="hidden" value="index.php?m=mod_b2b&c=trade&istable=1&state=<!--echo request('state');-->&tpl=<!--echo request('tpl');-->&{$vd['op']}&ishistory={$ishistory}" id="url"/>
<input type="hidden" value="{$vd['op']}" id="params"/>
<div style="position:absolute;bottom:0px">
  <div class="tbBottom" id="tbBottom">
    <div style="float:left;padding-top:8px;">
      <strong> 总计 <font color="#ff0000"><span id="tol2">{$vd['totlerow']}</span></font> 条</strong>
    </div>
    <div style="float:right;text-align:right;">
    <form id="actionform" method="post" action="index.php?m=mod_b2b&c=trade&{$vd['op']}&tpl=<!--echo request('tpl');-->&ishistory={$ishistory}" style="margin:0px;" onsubmit="loadDisp(1)">
    <div id="page"></div>
    <div style="float:left;margin-top:3px">
      每页显示<input type="text" name="nrows" size="2" value="{$vd['nrows']}" class="pagetxt" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" /> 个 
      到第<input type="text" name="page" size="2" value="{$vd['thispage']}" class="pagetxt" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" />页<input type="submit" value=" 确 定 &gt;&gt;" class="pagesub" />
    </div>
    </form>
    </div>
  </div>
</div>
<div id="load" style="display:none;">
  <div id="loadcontent" >页面加载中请稍等...</div>
</div>
</body>
<script type="text/javascript">
//第一参数，后边保留显示的列数
//第二参数，除最后一个参数外的保留参数的总宽度
tRows   = <!--echo $vd['nrows'] < $vd['totlerow'] ? $vd['nrows'] : $vd['totlerow']-->;
tInfoA  = Array(0,0);
totleRows = {$vd['totlerow']};
deltxt  = "销毁订单将无法恢复,您确定进行销毁操作吗？";
thisaction = "销毁";
thisdel = 0;
onedel  = 0;
sc = "{$vd['sc']}";
statistics = 2;
var resizeidx = 1;
</script>
<script type="text/javascript">
//当前表格配置
<!--//tinfo-->
 tInfo = Array('view','aid','fat','orddate','ttradetype');
<!--//endtinfo-->
function openScript(url,name,width,height)
{
  var Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no,status=no');
}
</script>
<script src="{$vd['sc']}js/tools.js" type="text/javascript"></script>
</html>
<!--}-->