<?php
	session_start();
	if($_SESSION['kbuid'])
	{
		$userid= $_SESSION['kbuid'];
	}
	else
	{
		header('location:../login.php');
	}
?>
<?php
	include'connection.php';
	
	$query="SELECT * FROM income WHERE Userid='$userid'";
	$result=mysqli_query($con,$query);
	
	$sponser=0;
	$level1=0;
	$level2=0;
	$level3=0;
	$level4=0;
	$level5=0;
	$level6=0;
	$level7=0;
	$level8=0;
	$totalIncme=0;
	while($data=mysqli_fetch_array($result))
	{
		if($data['TxnType']=="Sponser")
		{
			$sponser=$sponser=$data['Txn'];
		}
		if($data['TxnType']=="Level 1")
		{
			$level1=$level1=$data['Txn'];
		}
		if($data['TxnType']=="Level 2")
		{
			$level2=$level2=$data['Txn'];
		}
		if($data['TxnType']=="Level 3")
		{
			$level3=$level3=$data['Txn'];
		}
		if($data['TxnType']=="Level 4")
		{
			$level4=$level4=$data['Txn'];
		}
		if($data['TxnType']=="Level 5")
		{
			$level5=$level5=$data['Txn'];
		}
		if($data['TxnType']=="Level 6")
		{
			$level6=$level6=$data['Txn'];
		}
		if($data['TxnType']=="Level 7")
		{
			$level7=$level7=$data['Txn'];
		}
		if($data['TxnType']=="Level 8")
		{
			$level8=$level8=$data['Txn'];
		}
		
		$totalIncme=$totalIncme+$data['Txn'];
	}
?>
<html>
<head>
	<title>Income Summary</title>
	<!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
	<link rel="icon" href="images/logo.png" type="image/gif" sizes="16x16">
	
	<!-- Admin CSS File Link -->
	<link rel="stylesheet" href="css/style.css">
	
	<!-- User JAVA SCRIPT File Link -->
	<script type="text/javascript" src="js/script.js"></script>

	
	<!-- Font Awesome Icone -->
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
	
	<style>
		.div1{
			background:;
			width:100%;
			height:550px;
			display:flex;
			justify-content:center;
		}
		.bank{
			background:#f7f7f7;
			width:350px;
			height:420px;
			border-radius:5px;
			box-shadow:5px 5px 15px 4px #aaaaaa;
			text-align:center;
			margin-top:20px;
		}
		.bank h3{margin:5px 0px;}
		.bank table{
			width:330px;
			margin:10px;
		}
		
		.bank table th{ height:35px; width:55%; text-align:right; padding-right:10px; font-size:15px;}
		.bank table td{ height:35px; text-align:left; padding-left:50px; font-size:15px;}
		.bank table tr{background:#ebf8ee;}
		#sponser{background:#cff9d8; color:; font-size:18px;}
		#commission{background:gray; color:white; font-size:18px;}
		#gst{background:gray; color:white; font-size:18px;}
		#total{background:green; color:white; font-size:18px;}
		@media(max-width:768px)
		{
			.div1{
				background:;
				width:100%;
				height:auto;
				margin-top:10px;
				text-align:center;
				padding:1%;
			}
			.bank{
				width:96%;
				margin:2%;
			}
			.bank table{
				width:95%;
				font-size:14px;
			}
			
		
		}
	</style>
	
	<link rel="stylesheet" href="css/mediaStyle.css">
</head>
<body>
	<!--Header Divison-->
	<?php
		require'header.php';
	?>
	
	<!--Container Division-->
	<div class="container">
		<?php
			include'menu.php';
		?>
		<div class="content">
			<div class="head">
				<div class="title"><p>Income Summary :-</p></div>
				<div class="msg"><marquee><?php include'msg.php'; ?></marquee></msg>
			</div><hr>
			<div class="data-content">
				<div class="div1">
					<div class='bank'>
						<h3>Income Summary</h3><hr>
						<table border='0'>
							<tr id="sponser"><th>Sponser Income : </th><td><i class="fa fa-inr"></i> <?php echo $sponser; ?></td></tr>
							<tr><th> Level 1 Income : </th><td><i class="fa fa-inr"></i> <?php echo $level1; ?></td></tr>
							<tr><th> Level 2 Income : </th><td><i class="fa fa-inr"></i> <?php echo $level2; ?></td></tr>
							<tr><th> Level 3 Income : </th><td><i class="fa fa-inr"></i> <?php echo $level3; ?></td></tr>
							<tr><th> Level 4 Income : </th><td><i class="fa fa-inr"></i> <?php echo $level4; ?></td></tr>
							<tr><th> Level 5 Income : </th><td><i class="fa fa-inr"></i> <?php echo $level5; ?></td></tr>
							<tr><th> Level 6 Income : </th><td><i class="fa fa-inr"></i> <?php echo $level6; ?></td></tr>
							<tr><th> Level 7 Income : </th><td><i class="fa fa-inr"></i> <?php echo $level7; ?></td></tr>
							<tr><th> Level 8 Income : </th><td><i class="fa fa-inr"></i> <?php echo $level8; ?></td></tr>
							<tr id="total"><th>Total Income : </th><td><i class="fa fa-inr"></i> <?php echo $totalIncme; ?></td></tr>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
	<?php
		require'footer.php';
	?>
</body>
</html>