<body background="i.jpg">
<?php include("../../include/dbconnect.php");

?>


<title>Turnover Report</title>
<body background=blater01.gif  topmargin=0>
<center> 
<table cellpadding=0 cellspacing=4 width=1091>
  <tr> 
    <td style="padding:3px;" colspan=2 bgcolor="#93BEE2"  align="center"><font face="Verdana, Arial, Helvetica, sans-serif"><b><b> Annual Turnover Comparison</b></font></td>
  </tr>
</table>

<table width="668" border="1"  cellpadding="1">  
	<tr >

	<td width="60"  bgcolor="#FFE1C4" ><font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">Year</font></td>
	<td width="356" bgcolor="#FFE1C4"><font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">April</font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">May </font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">June </font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">July</font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">August</font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">September </font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">October </font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">November</font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">December</font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">January</font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">February</font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">March</font></td>
	<td width="117" bgcolor="#FFE1C4"> <font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">Total</font></td>
	</tr>
	

<?
$totvalue=0;
$grandtotal=0;
$ind=1;
$sBuyQuery = mysql_query("SELECT distinct account_year from turnover where compcode = '$compcode' order by account_year  ") or die(mysql_error());
while($row1 = mysql_fetch_row($sBuyQuery))
{

	$maxresult = mysql_query("select max(turnover) from turnover where compcode ='$compcode' and account_year='$row1[0]' ") or die(mysql_error());
	$maxrow = mysql_fetch_row($maxresult);
	$maxamt = $maxrow[0];

	$maxresult = mysql_query("select sum(turnover) from turnover where compcode ='$compcode' and account_year='$row1[0]' ") or die(mysql_error());
	$maxrow = mysql_fetch_row($maxresult);
	$sumamt = $maxrow[0];
	
	
	?>
	<tr>
	<td width="60"  bgcolor="#D9D9FF" ><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif"><? echo($row1[0]);?></font></td>
	<?
	$turnslct = mysql_query("select month, year, turnover,account_year from turnover where account_year ='$row1[0]' and compcode ='$compcode' order by year,month") or die(mysql_error());
	while($turnrow = mysql_fetch_row($turnslct))
	{
		if($turnrow[2]== $maxamt)
		{	
			?>
				<td width="60"  align="right"  bgcolor="#CC0000" ><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif"><? echo($turnrow[2]);?></font></td>
			<?
		}
		else
		{
			?>
				<td width="60" align="right"  ><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif"><? echo($turnrow[2]);?></font></td>
			<?
	
		}

	}
	?>
	<td width="60" bgcolor="#FF99CC"><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif"><? echo($sumamt);?></font></td>
	</tr>
	<?

}





?>
</table>






<br><br><font size=1><center><a href= "../../index.html">Return to index page</a></center></font>
</body></form>
