<?php widget("fhead");include($path_cache.DS."mod_agent_Shared_fhead.php"); ?>
</head>
<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="query" method="get" action="index.php">
		<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table1">
		<tr>
		<td width="22%" class="tableleft1">关键字：</td>
		<td width="78%" align="left" class="tableright1"><input type="text" size="30" name="keywords" class='input' value=""></td>
		</tr>
		<tr>
		<td class="tableleft1">查询条件：</td>
		<td align="left" class="tableright1">
		<select name="stype">
		<option value="pname">商品名称</option>
		<option value="listprice">商品面值</option>
		</select>
		<select name="ptype">
		<option value="-1" selected>全部类型</option>
		<option value="0">虚拟卡密</option>
		<option value="2">手工充值</option>
		<option value="1">自动充值</option>
		<option value="3">选号商品</option>
		</select>
		</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="Product"/>
	    <input type="hidden" name="a" value="Stock"/>
			<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" cellpadding="0" cellspacing="0">
	<tr>
	<td class="tableleft">
		<table class="table" width="100%" cellspacing="0" cellpadding="0" border="0">
		<tr>
		<td width="6%" class="heardertop1">商品ID</td>
		<td width="26%" class="heardertop1">商品名称</td>
		<td width="7%" class="heardertop1">商品类型</td>
		<td width="6%" class="heardertop1">面值</td>
		<td width="6%" class="heardertop1">进价</td>
		<td width="5%" class="heardertop1">范围</td>
		<td width="5%" class="heardertop1">状态</td>
		<td width="8%" class="heardertop1">数量</td>
		<td width="8%" class="heardertop1">价值</td>
		<td width="7%" class="heardertop1">类型</td>
		<td width="16%" class="heardertop1">库存管理</td>
		</tr>
		<?php $qty_sum=0;$dollars_sum=0;foreach($vd['items'] as $item) { ?>
		<tr class="stline" onmouseover="this.className='nd'" onmouseout="this.className='stline'">
		<td><?php echo $item['pid']; ?></td>
		<td align=left><?php echo $item['pname']; ?></td>
		<td><?php (ProductType($item['ptype'])); ?></td>
		<td><?php echo $item['listprice']; ?></td>
		<td><?php echo $item['price']; ?></td>
		<td><?php if($item['tosys']==1){ ?><font color=#ff0000>全局</font><?php }else{ ?><font color=#0000ff>下级</font><?php } ?></td>
		<td><?php if($item['sell']==0){ ?><font color=#ff0000>禁售</font><?php }else{ ?><font color=#0000ff>销售</font><?php } ?></td>
		<td><?php echo $item['mystock']; ?></td>
		<td><?php if($item['ptype']==1||$item['ptype']==2){ ?>----<?php }else{ echo $item['mystock']*$item['price'];$dollars_sum+=$item['mystock']*$item['price'];} ?></td>
		<td><?php (ProductType($item['ptype'])); ?></td>
		<td align=center>
			<?php if($item['ptype']==0||$item['ptype']==3){ ?>
			<a href="javascript:openScript('index.php?m=mod_agent&c=Card&a=add&id=<?php echo $item['pid']; ?>','importcard',780,550);"><img src=<?php echo $vd['content']; ?>images/importcard.gif border=0></a>
			<a href="javascript:openScript('index.php?m=mod_agent&c=Card&by=1','importcardhistory',780,550);"><img src=<?php echo $vd['content']; ?>images/importcardhistory.gif border=0></a>  
			<a href="javascript:openScript('index.php?m=mod_agent&c=Card&by=1','inventorymanage',780,550);"><img src=<?php echo $vd['content']; ?>images/inventorymanage.gif border=0></a><br>
			<?php }else if($item['ptype']==1){ ?>
			<a href="#"><img src=<?php echo $vd['content']; ?>images/autosaveinventory.gif border=0></a>
			<?php }else{ ?>
			----
			<?php } ?>
		</td>
		</tr>
		<?php $qty_sum+=$item['mystock'];} ?>
		<tr class=thr><td colspan=2 align=center>本页合计：</td><td colspan=5>&nbsp;</td><td align=center><?php echo $qty_sum; ?></td><td align=center><?php echo $dollars_sum; ?></td><td colspan=2>&nbsp;</td></tr>
		</table>
	</td>
	</tr>
	</table>
	<div id="page" align="right">
		<?php widget("fpage");include($path_cache.DS."mod_agent_Shared_fpage.php"); ?>
	</div>
	<script type="text/javascript">
  function openScript(url,name,width, height)
  {
  var Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
  }
  </script>
</body>
</html>
