<?php session_start();  //Developed by ITechScripts
require 'include/configurations.php'; // ITECHBIDS Configuration File
require 'include/header.php';
?>

<style type="text/css">
<!--
.style1 {
	color: #666666;
	font-weight: bold;
}
.style3 {color: #666666; font-size: 11px; font-family:Arial, Helvetica, sans-serif}
-->
</style>
<html>
<head>
<title>Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table align="center" width="100%" height="35" class="ft" heught=25">
  <tr>
    <td width="19%" align="center"><a href="earnings.php" id="link3"><b>Admin Earnings </b></a></td>
  </tr>
</table><br>
<table align="center" width="90%"><tr>
<td align="center"><a id="tablink" href="earnings.php?mode=end">End Auction Early</a></td>
<td align="center"><a id="tablink" href="earnings.php?mode=fea">Featured Item</a></td>
</tr></table><br>
<table align="center" width="80%" class="ft">
		<tr class="ct" height="25"> <td height="22" colspan="3">Admin Commission</td></tr>
		<?
		     $mode=$_GET[mode];
		    if($mode=="" || $mode=="end")
			{
			$sql="select * from admin_earnings where type='endauctionearly'";
			 $amt_sql="select sum(amount) as total from admin_earnings where type='endauctionearly'";
			}
			else
			{
			$sql="select * from admin_earnings where type='feature_fee'";
			$amt_sql="select sum(amount) as total from admin_earnings where type='feature_fee'";
			}
			 $result=mysql_query($sql);
		    
			 $amt_result=mysql_query($amt_sql);
			 $amt_row=mysql_fetch_array($amt_result);
			 if(mysql_num_rows($result)>0)
			 {
		?>
		<tr ><td><b>Date</b></td><td><b>User Id</b></td><td><b>Amount</b></td></tr>
		<?	
				while($row=mysql_fetch_array($result))
				{
				$user_sql="select * from member_details where user_id=".$row['user_id'];
				$user_res=mysql_query($user_sql);
				$user_row=mysql_fetch_array($user_res);
		?>
		<tr ><td><?=$row['payment_date']?></td>
		<td><a href="useritechds.php?type=gen&id=<?= $row['user_id'];?>"><?= $user_row[user_name] ?></a></td><td align=right><?=$row['amount'];?></td>
		</tr>
		<?
			}
		?>
			<tr ><td colspan="2" align="right">
			 <b>Total</b> </td><td align=right> <?= $amt_row[total]; ?></td></tr>			
<?			}
			else {
		?>
		<tr ><td>No Commission Earned</td></tr>
		<?
			}
		?>

		
</table>
		<tr><td colspan="12"><? require 'include/footer.php' ?></td></tr>
</body>
</html>
