<?php widget("fhead");include($path_cache.DS."mod_agent_Shared_fhead.php"); ?>
<script language="javascript">
function openScript(url,name,width,height)
{
var Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no,status=no');
}
</script>
<body class="mainbg">
	
	<div id="mainhearder"><span>您的位置：<a href="<?php echo $vd['root']; ?>index.php?m=mod_b2b&a=Home">直销商管理系统</a> >> 销售记录 >> 员工结帐记录</span></div>
	<div id="tabs5">
		<ul class="menu5" id="menu5">
		<li onclick="location.href='index.php?m=mod_agent&c=check&a=Add';"><span class="xg">员工结帐</span></li>
		<li onclick="location.href='index.php?m=mod_agent&c=check';" class="hover"><span class="jl">结帐记录</span></li>
	</ul>
	</div>
	<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
	<td class="tableleft">
		<form name="checkouthistory" method="get" action="index.php">
		<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table1">
		<tr style="display:none">
		<td width="22%" height="30" class="tableleft1">关 键 字：</td>
		<td width="78%" class="tableright1"><input type="text" name="keywords" size="20" class="input" value=""></td>
		</tr>
		<tr>
		<td class="tableleft1">查询条件：</td>
		<td class="tableright1">
		  <select name="stype">
        <?php (Option($vd['tradetypes'], $vd['tradetype'])); ?>
      </select>
    </td>
		</tr>
		<tr>
		<td class="tableleft1">选择员工：</td>
		<td class="tableright1">
			<select name="keywords">
		  <option value="" selected>所有员工(含总帐号)</option>
		  <?php foreach($vd['staff'] as $item){ ?>
      <option value="<?php echo $item['staffid']; ?>" <?php if(intval(request('keywords'))==$item['staffid']){ ?> selected <?php } ?>><?php echo $item['realname']; ?>(<?php (DisplayCode($item['staffid'],2,0)); ?>)</option>
      <?php } ?>
		  </select>
		 </td>
		</tr>
		<tr>
		<td height="35" class="tableleft1">查询时间段：</td>
		<td class="tableright1">
    <input type="text" name="startdate" size="18" value="<?php echo $vd['startdate']; ?>" style="vertical-align:middle;" id="startdate"/>

    <strong>至</strong>&nbsp;<input type="text" name="enddate" size="18" value="<?php echo $vd['enddate']; ?>" style="vertical-align:middle;" id="enddate"/>
    </td>
		</tr>
		<tr>
		<td height="30" class="tableleft1">&nbsp;</td>
		<td class="tableright1">
			<input type="hidden" name="m" value="mod_agent" />
			 <input type="hidden" name="c" value="Check" />
			<input type="submit" name="Submit" value="确认查询" class="button"> <input type="reset" name="reset" value="重置查询" class="button"></td>
		</tr>
		</table>
		</form>
	</td>
	</tr>
	</table>
	<br>
	<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
	<td class="tableleft">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
		<tr>
		<td width="10%" class="heardertop1">结帐时间</td>
		<td width="10%" class="heardertop1">交班对像</td>
		<td width="10%" class="heardertop1">接班对像</td>
		<td width="8%" class="heardertop1">帐面金额</td>
		<td width="8%" class="heardertop1">交款金额</td>
		<td width="12%" class="heardertop1">开始时间</td>
		<td width="12%" class="heardertop1">结束时间</td>
		<td width="15%" class="heardertop1">结帐备注</td>
		<td width="8%" class="heardertop1">当时余额</td>
		<td width="7%" class="heardertop1">操作</td>
		</tr>
		<?php if(count($vd['items']) > 0){ ?>
		<?php $ar_sum=0;$ap_sum=0;foreach($vd['items'] as $item) { ?>
		<tr class="stline" onmouseover="this.className='nd'" onmouseout="this.className='stline'">
		<td><?php echo $item['createdate']; ?></td>
		<td><?php if($item['staffid']>0){ ?><?php echo $item['staffname']; ?>(员工)<?php }else{ ?>总账号<?php } ?></td>
		<td><?php if($item['otherid']>0){ ?><?php echo $item['otherstaff']; ?>(员工)<?php }else{ ?>总账号<?php } ?></td>
		<td><?php echo $item['ar']; ?></td>
		<td><?php echo $item['ap']; ?></td>
		<td><?php echo $item['startdate']; ?></td>
		<td><?php echo $item['enddate']; ?></td>
		<td align=left><?php echo $item['remarks']; ?>&nbsp;</td>
		<td><?php if($item['remain']===null){ ?>--<?php }else{ ?><?php echo $item['remain']; ?><?php } ?></td>
		<td>
        <?php if(0){ ?>
        <a href="javascript:openScript('#','',690,500)">
        <font color="#0000ff">打印</font>
        </a>
        <?php }else{ ?>
        <?php if(isset($vd['agent'][9]) && $vd['agent'][9] > 0){ ?>
        <?php }else{ ?>
        <a href="index.php?m=mod_agent&c=check&a=del&id=<?php echo $item['id']; ?>">
        <font color="#0000ff">删除</font>
        </a>
        <?php } ?>
        <?php } ?>
    </td>
		</tr>
		<?php $ar_sum=$ar_sum+$item['ar'];$ap_sum=$ap_sum+$item['ap'];} ?>
		<tr class="thr"><td colspan=2 align=center>本页合计：</td><td align=center><?php echo $ar_sum; ?></td><td align=center><?php echo $ap_sum; ?></td><td colspan=6>&nbsp;</td></tr>
		<tr class="thr"><td colspan=2 align=center>查询合计：</td><td align=center><?php echo $vd['checkdata']['ar']; ?></td><td align=center><?php echo $vd['checkdata']['ap']; ?></td><td colspan=6>&nbsp;</td></tr>
		
		<?php }else{ ?>
		<tr class=stline><td colspan=10 align=center>对不起，没有任何记录！</td></tr>
		<?php } ?>
		</table>
	</td>
	</tr>
	</table>
	<div id="page" align="right">
		<?php widget("fpage");include($path_cache.DS."mod_agent_Shared_fpage.php"); ?>
	</div>
	
</body>
</html>
