<?php
	session_start();
	header("Content-type:text/html;charset=gb2312");
	//判断是否登录系统		
	if($_SESSION["main_viplogined"]!="1" |$_SESSION["main_vipno"]=="")
	{
		//没有登录开始启动登录
		header('location:login.php?stext=');
		exit;
	}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="gb2312">	
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
	<meta name="apple-mobile-web-app-capable" content="1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=0">
	<meta name="apple-touch-fullscreen" content="1">

	<title>微信会员</title>

	<script src="jsp4/jquery.js"></script>
	<link rel="stylesheet" href="css/mycss.css"> 
	
	<!--<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">-->
	<!--<script src="jsp4/jquery.mobile-1.4.3.min.js"></script>-->
	<script src="jsp5/jquery.mobile-1.4.5.min.js"></script>
	<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">
	
</head>

<script>	
	//隐藏维信右上角菜单
	function onBridgeReady(){
		WeixinJSBridge.call('hideOptionMenu');
	}

	if (typeof WeixinJSBridge == "undefined")
	{
		if( document.addEventListener )
		{
			document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		}
		else if (document.attachEvent)
		{
			document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
			document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		}
	}
	else
	{
		onBridgeReady();
	}
</script>

<?php
	require_once("db/db.php");	
	require_once("common/common.php");
	require_once("../Wx.Config.php");	//只加载一次
	
?>

<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<!--第一个页面的内容实现---------------------------->
<section data-role="page" id="hispage1">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;">
		<table width="100%" height="45" border="0" cellpadding="0" cellspacing="0" bgcolor="<?php echo WxMainConfig::colHeadBkColorBook;?>">
			<tr>
				<td height="45" width="35" align="right" valign="middle">
					<a href="vipmain.php" target="_blank"data-iconpos="notext">
						<div style="width:30;height:26px; ">
							<img src="images\back.png" width="12" height="21" border="0" style="margin-top:3px;">
						</div>
                    </a>
				</td>
				<td height="45" width="10"></td>
				<td height="45" align="left">
					<!--<a href="vipmain.php" target="_blank" >-->
						<div style="padding-top:2px;">
						<table width="100%" height="45" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td align="center">
									<span id="MsgTxt" style="color:<?php echo WxMainConfig::colHeadTextColorBook;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:19px;text-shadow:none;">分销报表</span>
								</td>
								<td width="50"></td> <!--align="center"-->
							</tr>
						</table>
					</div><!--</a>-->
				</td>
			</tr>
			<tr>
				<td height="1" colspan="3" bgcolor="#F2E2E2"></td>
			</tr>
			<tr>
				<td height="35" colspan="3" bgcolor="#fff">
					<table width="100%" height="37" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="5%" height="35" align="center"></td>
							<td width="20%" height="35" align="center">
								<div onClick="window.location = 'marketrep1.php';">	
									<table width="100%" height="37" border="0" cellpadding="0" cellspacing="0">
										<tr><td align="center">
											<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-weight:bold; font-size:15px;">下级会员</span>
										</tr></td>
									</table>
								</div>
							</td>
							<td width="5%" height="35" align="center"></td>
							<td width="25%" height="35" align="center">
								<div onClick="window.location = 'marketrep2.php';">
									<table width="100%" height="37" border="0" cellpadding="0" cellspacing="0">
										<tr><td align="center">
											<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-weight:bold; font-size:15px;">未分润</span>
										</tr></td>
									</table>
								</div>
							</td>
							<td width="5%" height="35" align="center"></td>
							<td width="25%" height="35" align="center">
									<table width="100%" height="37" border="0" cellpadding="0" cellspacing="0">
										<tr><td align="center">
											<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-weight:bold; font-size:15px;">已分润</span>
										</tr></td>
									</table>
							</td>
							<td width="10%" height="35" align="center"></td>
						</tr>
						<tr>
							<td width="5%" height="2" align="center"></td>
							<td width="25%" height="2" align="center"></td>
							<td width="5%" height="2" align="center"></td>
							<td width="25%" height="2" align="center"></td>
							<td width="5%" height="2" align="center"></td>
							<td width="25%" height="2" align="center" bgcolor="#BBBB00"></td>
							<td width="10%" height="2" align="center"></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</header>
	
	<article data-role="none">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#66FFFF">
			<tr>
				<td height="4" width="4"></td>
				<td height="4" align="left"></td>
				<td height="4" width="4"></td>
			</tr>
			
			<?php
				$intRowIndex = 0;
				
				$sql=sprintf("select b.Chain_Name,CONVERT(varchar(10), b.StartDay, 23)AS StartDay,CONVERT(varchar(10), b.EndDay, 23)As EndDay,a.VIPCountA,a.VIPCountB,a.VIPCountC,a.RetValA,a.RetValB,a.RetValC
							from VIP_Market_ReportList a,VIP_Market_Report b Where a.BListNo=b.ListNo And a.Sub_No='%s' And a.SendFlag=1 Order By b.StartDay DESC,b.Chain_Name ASC",$_SESSION["main_vipno"]);
				
				$result = querySql($sql);
											
				while($row = fetch_array($result))
				{
					$strChainName=$row['Chain_Name'];
					$strStarDay=$row['StartDay'];
					$strEndDay=$row['EndDay'];
					$intVIPCount1=$row['VIPCountA'];
					$intVIPCount2=$row['VIPCountB'];
					$intVIPCount3=$row['VIPCountC'];
					$fltRetVal1 =$row['RetValA'];
					$fltRetVal2 =$row['RetValB'];
					$fltRetVal3 =$row['RetValC'];
					
					$fltSumRetVal = $fltRetVal1 + $fltRetVal2 + $fltRetVal3;
					
					$intRowIndex = $intRowIndex + 1;
			?>
			<tr>
				<td width="4"></td>
				<td align="left">
					<div style="width:100%;height:102px;border-radius:4px;border-top:1px solid #F2E2E2;border-bottom:1px solid #F2E2E2;border-left:1px solid #F2E2E2;border-right:1px solid #F2E2E2;">
						<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
							<tr>
								<td height="2" width="6"></td>
								<td height="2" align="left"></td>
								<td height="2" width="6"></td>
							</tr>
														
							<tr>
								<td height="20" width="6"></td>
								<td height="20" align="left" valign="middle">
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td height="28" width="30">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;"><?php echo $intRowIndex;?>.</span>
											</td>
											<td height="28">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;">账期：<?php echo $strStarDay;?> 至 <?php echo $strEndDay;?></span>
											</td>
										</tr>
									</table>
								</td>
								
								<td height="20" width="6"></td>
							</tr>
							
							<tr>
								<td height="1" width="6"></td>
								<td height="1" align="left" bgcolor="#F2E2E2"></td>
								<td height="1" width="6"></td>
							</tr>
							
							<tr><td height="3" colspan="3"></td></tr>
							
							<tr>
								<td height="20" width="6"></td>
								<td height="20" align="left">
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td height="20" width="40">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;">酒店：</span>
											</td>
											<td height="20">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;"><?php echo $strChainName;?></span>
											</td>
											<td height="20" width="95">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">提成：<?php echo number_format($fltSumRetVal,1);?></span>
											</td>
										</tr>
									</table>
									
								</td>
								<td height="20" width="6"></td>
							</tr>
														
							<tr>
								<td height="20" width="6"></td>
								<td height="20" align="left">
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td height="20" width="40">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;">提成：</span>
											</td>
											<td height="20" width="85">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">一级 <?php echo number_format($fltRetVal1,1);?></span>
											</td>
											<td height="20" width="85">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">二级 <?php echo number_format($fltRetVal2,1);?></span>
											</td>
											<td height="20">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">三级 <?php echo number_format($fltRetVal3,1);?></span>
											</td>
										</tr>
									</table>
								</td>
								<td height="20" width="6"></td>
							</tr>
							
							<tr>
								<td height="20" width="6"></td>
								<td height="20" align="left">
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td height="20" width="40">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;">会员：</span>
											</td>
											<td height="20" width="85">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">一级 <?php echo $intVIPCount1;?> 位</span>
											</td>
											<td height="20" width="85">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">二级 <?php echo $intVIPCount2;?> 位</span>
											</td>
											<td height="20">
												<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">三级 <?php echo $intVIPCount3;?> 位</span>
											</td>
										</tr>
									</table>
								</td>
								<td height="20" width="6"></td>
							</tr>
							
							<tr><td height="5" colspan="3"></td></tr>
														
						</table>
					</div>
				</td>
				<td width="4"></td>
			</tr>
			
			<tr>
				<td height="8" width="4"></td>
				<td height="8" align="left"></td>
				<td height="8" width="4"></td>
			</tr>
			<?php 
				}
				//释放数据库
				freeResult($result);
				closeDb();
			?>
									
		</table>
				
	</article>
</section>

</body>
	
</html>