<?
session_start();
ob_start();
?>
<html>
<head>

<title>Fish landing data management system</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
#wrapper {
		border: 1px solid black;
		background-color: #E0E0EF;
		color:#FFFFFF;
		padding:10px;
        height:800px;
        width:1024px;
		text-align:center;
    }
.stylewhite {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: bold;
	color: #FFFFFF;
}
.stylewhitesmall {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #FFFFFF;
}
.stylegreen {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #00661F;
}
.styleblack {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #000000;
}
.styleblacklarge {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: bold;
	color: #000000;
}
a:link {
	color: #FFFFFF;
	text-decoration: none;
}
a:visited {
	color: #FFFFFF;
	text-decoration: none;
}
a:hover {
	color: #FF0000;
	text-decoration: none;
}
a:active {
	color: #FFFFFF;
	text-decoration: none;
}
.style1 {color: #FF0000}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (Untitled-1) -->
<table width="1024" height="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F3F3F3" id="Table_01">
<tr>
		<td height="50" bgcolor="#ADCE4C" class="stylewhite">&nbsp;Fish Landing Data Management System</td>
  </tr>
	<tr class="stylewhitesmall">
	  <td height="20" bgcolor="#006666"><span class="styleblack">&nbsp;</span><a href="main.php">Home</a><span class="style1">&nbsp;</span> |&nbsp;<a href="usr.php">User</a> |<span class="style1"> <a href="fishingzone.php">Fishing Zone |</a> <a href="district.php">District</a> </span>|<a href="samplingport.php"> Landing Site </a>| <a href="fgmethod.php">Fishing Gear and Method</a> | <a href="vessel.php">Fishing Vessel</a> | <a href="species.php">Fish Species</a> | <a href="catchdata.php">Catch Data </a> | <a href="biology.php">Biology Data</a> | <a href="report.php"> </a><a href="report.php">Report</a> |<span class="style1"> <a href="logout.php">Logout</a></span></td>
  </tr>
	<tr>
	  <td height="597" valign="top" bgcolor="#CCCCCC"><p>&nbsp;</p>
	    <table width="50%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
          <tr bgcolor="#000000" class="stylewhite">
            <td colspan="3"><div align="center">Yearly Catch Data (in kg.)</div></td>
          </tr>
          <tr bgcolor="#000000" class="styleblacklarge">
            <td bgcolor="#CCCCCC"><div align="center">Year</div></td>
            <td bgcolor="#CCCCCC"><div align="center">Fishing Sector</div></td>
            <td bgcolor="#CCCCCC"><div align="center">Total Weight(kg.)</div></td>
          </tr>
          <?
		  include "connect.inc.php";
		  $sqlgetrptYearly = "SELECT year(DepartureDate) as yy,sector,sum(Weight) as sw FROM catch";
		  $sqlgetrptYearly = $sqlgetrptYearly." INNER JOIN fishspecies ON catch.spid = fishspecies.spid";
		  $sqlgetrptYearly = $sqlgetrptYearly." INNER JOIN fishoperation ON fishoperation.Optid = catch.Optid";
		  $sqlgetrptYearly = $sqlgetrptYearly." INNER JOIN ship ON fishoperation.VesselId = ship.ShipName";
		  $sqlgetrptYearly = $sqlgetrptYearly." INNER JOIN shiptype ON ship.fishsector = shiptype.shptid";
		  $sqlgetrptYearly = $sqlgetrptYearly." INNER JOIN fishingsector ON shiptype.sid = fishingsector.sid";
		  $sqlgetrptYearly = $sqlgetrptYearly." GROUP BY year(DepartureDate),fishingsector.sid";
		  $sqlgetrptYearly = $sqlgetrptYearly." ORDER BY fishingsector.sid, year(DepartureDate)";
		  //echo  $sqlgetrptYearly;
		  $qryRptYearly = mysql_query($sqlgetrptYearly) or die(mysql_error());
		  $numRptYearly = mysql_num_rows($qryRptYearly);
		  for($i=1;$i<=$numRptYearly;$i++)
		  { 
		   $resRptYearly = mysql_fetch_array($qryRptYearly);
		   $dby = $resRptYearly["yy"];
		   $dbsector = $resRptYearly["sector"];
		   $dbweight = $resRptYearly["sw"];
		  ?>
          <tr bgcolor="#000000" class="styleblack">
            <td bgcolor="#006666" class="stylewhitesmall"><div align="center"><? echo $dby; ?></div></td>
            <td bgcolor="#006666" class="stylewhitesmall"><div align="center"><? echo $dbsector; ?></div></td>
            <td bgcolor="#006666" class="stylewhitesmall"><div align="center"><? echo $dbweight; ?></div></td>
          </tr>
          <?
		  }
		  ?>
          <tr bgcolor="#A8C47A" class="styleblack">
            <td height="17" colspan="3" class="stylewhitesmall"><div align="right">Export <a href="NewYearlyReport_excel.php"><img src="images/excel_4.jpg" width="35" height="29" border="0"></a></div></td>
          </tr>
        </table>
	    <p>&nbsp;</p>
	    <p>&nbsp;</p>
	    <p>&nbsp;</p>
	    </td>
	</tr>
	<tr>
	  <td height="25" align="center" bgcolor="#006666"><div align="right"><span class="styleblack">@SEAFDEC 2012</span></div></td>
  </tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>