<?php widget("fhead");include($path_cache.DS."mod_agent_Shared_fhead.php"); ?>
<body class="mainbg">
	<div id="mainhearder"><span>您的位置：<a href="<?php echo $vd['root']; ?>index.php?m=mod_b2b&c=Dealer&a=home">经销商管理系统</a> >> 业务员管理 >> 业务员业绩查询 </span></div>
	<div id="hearder"><span>业务员业绩查询</span></div>
	<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
	<td class="tableleft">
		<form name="history" method="get" action="index.php">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table1">
		<tr>
		<td width="22%" class="tableleft1">选择业务员：</td>
		<td width="78%" align="left" class="tableright1">
		<select name="saleid">
		<option value="">所有业务员</option>
		<?php foreach($vd['sales'] as $item){ ?>
		<option value="<?php echo $item['id']; ?>" <?php if($vd['saleid'] == $item['id']){ ?> selected<?php } ?>><?php echo $item['realname']; ?>(<?php (DisplayCode($item['id'],3)); ?>)</option>
		<?php } ?>
		</select>
		</td>
		</tr>
		<tr>
		<td class="tableleft1">查询时间段：</td>
		<td align="left" class="tableright1">
    <input type="text" name="startdate" value="<?php echo $vd['startdate']; ?>" class="input" id="startdate"/> 
    <strong>至</strong>&nbsp;<input type="text" name="enddate" value="<?php echo $vd['enddate']; ?>" class="input" id="enddate"/>
    </td>
		</tr>
		<tr>
		<td class="tableleft1">&nbsp;</td>
		<td align="left" class="tableright1">
			<input type="hidden" name="m" value="mod_agent"/> 
			<input type="hidden" name="c" value="sales"/> 
			<input type="hidden" name="a" value="Achievement"/> 
			<input type="submit" name="Submit" value="确认查询" class="button"> <input type="reset" name="reset" value="重置查询" class="button"></td>
		</tr>
		</table>
		</td>
		</tr>
		</table>
		</form>
	<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="26%" class="heardertop1">购买商品</td>
		<td width="10%" class="heardertop1">下属客户</td>
		<td width="8%" class="heardertop1">购买单价</td>
		<td width="8%" class="heardertop1">数量</td>
		<td width="8%" class="heardertop1">我的进价</td>
		<td width="8%" class="heardertop1">销售金额</td>
		<td width="8%" class="heardertop1">业务员</td>
		<td width="6%" class="heardertop1">比例</td>
		<td width="8%" class="heardertop1">业绩金额</td>
		</tr>
		<?php $cprice_sum = 0;$dollars_sum = 0;$qty_sum = 0;$selldollars_sum = 0;foreach($vd['items'] as $item) { ?>
		<tr class="stline" onmouseover="this.className='nd'" onmouseout="this.className='stline'">
		<td><?php echo $item['orddate']; ?></td>
		<td align=left><?php echo $item['pname']; ?></td>
		<td><?php (DisplayCode($item['cid'])); ?></td>
		<td><?php if($vd['canseeprice']){ ?><?php echo $item['cprice']; ?><?php }else{ ?>--<?php } ?></td>
		<td><strong><?php echo $item['qty']; ?></strong>个</td>
		<td><?php if($vd['canseeprice']){ ?><?php echo $item['bossprice']; ?><?php }else{ ?>--<?php } ?>&nbsp;</td>
		<td><?php echo $item['dollars']; ?></td>
		<td><?php (DisplayCode($item['saleid'], 3)); ?></td>
		<td><?php echo $item['sellscale']* 100; ?>%</td>
		<td><?php echo $item['selldollars']; ?></td>
		</tr>
		<?php $cprice_sum=$cprice_sum+$item['cprice']*$item['qty'];$dollars_sum=$dollars_sum+$item['dollars'];$qty_sum=$qty_sum+$item['qty'];$selldollars_sum=$selldollars_sum+$item['selldollars'];} ?>
		
		<tr class="thr"><td colspan=4>本页合计：</td><td><?php echo $qty_sum; ?></td><td>&nbsp;</td><td><?php if($vd['canseeprice']){echo round($dollars_sum,3);}else{ ?>--<?php } ?></td><td colspan=2>&nbsp;</td><td><?php echo round($selldollars_sum,3); ?></td></tr>
		<tr class="thr"><td colspan=4>查询合计：</td><td><?php echo $vd['tradedata']['qty_sum']; ?>&nbsp;</td><td>&nbsp;</td><td><?php if($vd['canseeprice']){echo round($vd['tradedata']['dollars_sum'],3);}else{ ?>--<?php } ?></td><td colspan=2>&nbsp;</td><td><?php echo round($vd['tradedata']['selldollars_sum'],3); ?></td></tr>
		</table>
	</td>
	</tr>
	</table>
	<div id="page" align="right">
		<?php widget("fpage");include($path_cache.DS."mod_agent_Shared_fpage.php"); ?>
	</div>
	
</body>
</html>
