<?php
include_once("inc/conn.php");		
include_once("inc/function.php");
login_check();
business_check();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>商户中心-<?=$web_name;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="<?=$web_keywords;?>" />
<meta name="description" content="<?=$web_description;?>" />
<META http-equiv=X-UA-Compatible content=IE=EmulateIE7>
<link href="style/default.css" rel="stylesheet" type="text/css" />
</head>
<?php include_once("top.php");?>
<DIV class="wrapper">
	<DIV class="page_content">
  		<!--主体右边 Start-->
    	<div class="area260 fl">
			<DIV class="news-title">
				 <H3>商户中心</H3>
			</DIV>
			<ul class="area260-info business-list">
				<LI><A href="businessnotice.php">商户公告</A></LI>
                <LI><A href="businessusers.php">商户汇豆</A></LI>
                <LI><A href="businesscardlog.php">汇豆记录</A></LI>
                <LI class="my_nav_on"><A href="businesscardback.php">查看库存</A></LI>
                <LI><A href="businesspay.php">我要进货</A></LI>
                <LI><A href="businesslog.php">进货记录</A></LI>
			</ul>
			 <DIV class="area260-b h5px"></DIV>
			 <DIV class=blank10></DIV>
		</div>
		<!--主体左边 Start-->
		<div class="area690 fr">
			<DIV class="users-title">
				 <H3>查看库存</H3>
			</DIV>
        	<div class="users-content">
				<ul class="bgk">
				<?
				$businessid=showbusinessid(intval($_COOKIE["usersid"]));
				$query=$db->query("Select * FROM {$web_dbtop}card where businessid=".$businessid." and state=0 Order by id desc");
				if($db->fetch_array($query)) 
						$intnum=$db->num_rows($query);
				?>
				<li class="bb21">您的当前帐户总卡数为：<?=$intnum?> 张</li>
				<?
				$query=$db->query("Select * FROM {$web_dbtop}cardtype Order by id desc");
				while($rs=$db->fetch_array($query)){
					$query_f=$db->query("Select * FROM {$web_dbtop}card where cardtype=".$rs["id"]." and businessid=".$businessid." and state=0 Order by id desc");
					if($rs_f=$db->fetch_array($query_f)){
						$cardnum=$db->num_rows($query_f);
					}else{
						$cardnum=0;
					}
				?>
				<li class="b22" style="MARGIN-LEFT: 0px;"><span style="padding-left:10px"><?=$rs["cardname"]?></span></li>
				<li class="b21a"><span style="padding-left:5px"><?=$cardnum?> 张</span></li>
				<?
				}
				?>
				<li class="b200c">类型</li>
				<li class="b150c">卡号</li>
				<li class="b150c">密码</li>
					<?php
					$intpage = 20;
					if (isset($_GET['page'])) {
						$rsnum = (intval($_GET['page']) -1)*$intpage;
					}
					else {
						$rsnum = 0;
					}
					$sql="Select * from {$web_dbtop}card where businessid=".$businessid." and state=0 Order by id desc";
					$query=$query=$db->query($sql);
					if($db->fetch_array($query)) 
						$intnum=$db->num_rows($query);
					$query=$query=$db->query($sql." limit $rsnum,$intpage");
					while($rs=$db->fetch_array($query)){
						echo"<LI cl<li class=\"b200\">".showcardtype($rs["cardtype"])."</li>";
						echo"<li class=\"b150\">".$rs["cardid"]."</li>";
						echo"<li class=\"b150\">".(showcontent("business","auto",$businessid)==1?$rs["cardpaw"]:substr($rs["cardpaw"],0,strlen($rs["cardpaw"])-10)."**********")."</li>";
					}
					include_once("inc/page_class.php");
					$page=new page(array('total'=>$intnum,'perpage'=>$intpage));
					echo "<li class=\"bb\">".$page->show(5,"","")."</li>";
					?>
				  </ul>
			</div>
			<div class="area690-b h5px"></div>
        	<div class="blank10"></div>
		</div>
		<!--主体左边 End-->
	</DIV>
	<!--Flink End-->
	<div class="blank10"></div>
	<!--Footer Start-->
<?php include_once("footer.php");?>
</DIV>