<?
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}
.style38 {	color: #CC0000;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10px;
	font-weight: bold;
}
.style37 {color: #FFFFFF}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (Untitled-1) -->
<table width="1024" height="799" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F3F3F3" id="Table_01">
<tr>
		<td height="50" colspan="2" bgcolor="#ADCE4C" class="stylewhite">&nbsp;Fish Landing Data Management System</td>
  </tr>
	<tr class="stylewhitesmall">
	  <td height="20" colspan="2" 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"> Sampling Port </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="fishoperation.php">Fishing Operation</a> | <a href="biology.php">Biology Data</a> | <a href="report.php">Report</a> |<span class="style1"> <a href="logout.php">Logout</a></span></td>
  </tr>
	<tr>
	  <td width="203" height="705" valign="top" bgcolor="#CCCCCC"><table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
          <tr>
            <td bgcolor="#000000"><div align="center"><span class="stylewhite">
                Report</span></div></td>
          </tr>
          <div align="center"> <span class="stylegreen">
            <?
	  include "connect.inc.php";
	  $sqlgetyear = "select distinct year(SamplingDate) as dyear from fishoperation order by dyear";
	  //echo $sqlgetship;
	  $qrygetyear = mysql_query($sqlgetyear);
	  $numgetyear = mysql_num_rows($qrygetyear);
	   for($i=1;$i<=$numgetyear;$i++)
		{
			$resgetyear = mysql_fetch_array($qrygetyear);
			$dbyear= $resgetyear["dyear"];
			?>
            </span>
              <tr class="styleblack">
                <td align="center" bgcolor="#006666" class="stylewhitesmall"><a href="totalcatchbyfishingzone.php?y=<? echo $dbyear; ?>">
                  <? 
				echo $dbyear;
				require_once("fishing_function.inc.php");
				echo " (".getNumYear($dbyear)." operations) ";
				
				?>
                  </a><br>                </td>
              </tr>
              <span class="stylegreen">
              <?
        }
      ?>
            </span></div>
	      <tr>
            <td bgcolor="#000000"><div align="right"><span class="styleblack">&nbsp;&nbsp; </span></div></td>
          </tr>
        </table>	    
	  <p>&nbsp;</p></td>
      <td width="815" valign="top" bgcolor="#CCCCCC">
	  <br><table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="stylewhite">
        <tr bordercolor="#FFFFFF" class="stylewhite">
          <td bgcolor="#006666" class="stylewhite">Total Catch by Fishing zone <? echo $_GET["y"]; ?></td>
        </tr>
      </table>
	  <?
	  if(isset($_GET["y"]))
	  {
	  	  include "connect.inc.php";
		  $yy = $_GET["y"];
		  require_once("totalcatch_report.inc.php");
			$totalcatchyear = ttcatchyear($yy);
			
		  
		  $sqlgetzone = "select distinct(FishingZone) as zid from fishoperation where year(SamplingDate) = '$yy' order by FishingZone";
		 // echo $sqlgetdistrict;
		  $qrygetzone = mysql_query($sqlgetzone);
		  $numgetzone = mysql_num_rows($qrygetzone);
	  ?>
	  <table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
        <tr bgcolor="#000000" class="styleblack">
          <td width="9%" class="stylewhitesmall"><div align="center">Fishing Zone</div></td>
          <td class="stylewhitesmall"><div align="center">Jan<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">Feb<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">Mar<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">Apr<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">May<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">Jun<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">July<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">Aug<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">Sep<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">Oct<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">Nov<br>
            kg.</div></td>
          <td class="stylewhitesmall"><div align="center">Dec<br>
            kg.</div></td>
          <td width="12%" class="stylewhitesmall"><div align="center">Total Catch<br>kg.</div></td>
          <td width="10%" class="stylewhitesmall"><div align="center">%Total Catch</div></td>
        </tr>
        <?
		for($i=1;$i<=$numgetzone;$i++)
		{
			$resgetzone = mysql_fetch_array($qrygetzone);
			$dbdtname = $resgetzone["zid"];
			$dbdttid = $resgetzone["zid"];
			require_once("totalcatch_report.inc.php");
			$ttcm1 = ttcatchzone($yy,1,$dbdttid);
			$sumjan = $sumjan+$ttcm1;
			require_once("totalcatch_report.inc.php");
			$ttcm2 = ttcatchzone($yy,2,$dbdttid);
			$sumfeb = $sumfeb+$ttcm2;
			require_once("totalcatch_report.inc.php");
			$ttcm3 = ttcatchzone($yy,3,$dbdttid);
			$summar = $summar+$ttcm3;
			require_once("totalcatch_report.inc.php");
			$ttcm4 = ttcatchzone($yy,4,$dbdttid);
			$sumapr = $sumapr+$ttcm4;
			require_once("totalcatch_report.inc.php");
			$ttcm5 = ttcatchzone($yy,5,$dbdttid);
			$summay  = $summay+$ttcm5;
			require_once("totalcatch_report.inc.php");
			$ttcm6 = ttcatchzone($yy,6,$dbdttid);
			$sumjun  = $sumjun+$ttcm6;
			require_once("totalcatch_report.inc.php");
			$ttcm7 = ttcatchzone($yy,7,$dbdttid);
			$sumjul  = $sumjul+$ttcm7;
			require_once("totalcatch_report.inc.php");
			$ttcm8 = ttcatchzone($yy,8,$dbdttid);
			$sumaug  = $sumaug+$ttcm8;
			require_once("totalcatch_report.inc.php");
			$ttcm9 = ttcatchzone($yy,9,$dbdttid);
			$sumsep  = $sumsep+$ttcm9;
			require_once("totalcatch_report.inc.php");
			$ttcm10 = ttcatchzone($yy,10,$dbdttid);
			$sumoct  = $sumoct+$ttcm10;
			require_once("totalcatch_report.inc.php");
			$ttcm11= ttcatchzone($yy,11,$dbdttid);
			$sumnov  = $sumnov+$ttcm11;
			require_once("totalcatch_report.inc.php");
			$ttcm12 = ttcatchzone($yy,12,$dbdttid);
			$sumdec  = $sumdec+$ttcm12;
			$totalyear =$ttcm1+$ttcm2+$ttcm3+$ttcm4+$ttcm5+$ttcm6+$ttcm7+$ttcm8+$ttcm9+$ttcm10+$ttcm11+$ttcm12;		
		?>
        <tr class="styleblack">
          <td bgcolor="#ADCE4C" class="styleblack">
		    <div align="center"><? echo $dbdtname; ?>          </div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm1,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm2,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm3,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm4,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm5,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm6,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm7,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm8,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm9,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm10,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm11,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($ttcm12,2,'.',''); ?>&nbsp;</div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format($totalyear,2,'.',''); ?></div></td>
          <td bgcolor="#ADCE4C" class="styleblack"><div align="center"><? echo number_format(($totalyear/$totalcatchyear)*100,2,'.',''); ?></div></td>
        </tr>
		<?
		  }
			
			  ?>
        <tr class="styleblack">
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center">Total</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumjan,2,'.',''); ?></div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumfeb,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($summar,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumapr,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($summay,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumjun,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumjul,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumaug,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumsep,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumoct,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumnov,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo number_format($sumdec,2,'.',''); ?>&nbsp;</div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center"><? echo $totalcatchyear; ?></div></td>
          <td height="17" bgcolor="#6B716F" class="stylewhitesmall"><div align="center">100</div></td>
        </tr>
      </table>
      <? 
	   }
      else
			  {
			  ?>
      <table width="70%" height="47" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="4" align="right" bgcolor="#6B716F">&nbsp;</td>
        </tr>
        <tr>
          <td height="5" align="right" bgcolor="#ADCE4C" class="styleblack"><div align="center">
              <p>&nbsp;</p>
            <p>Select Year</p>
            <p>&nbsp;</p>
          </div></td>
        </tr>
        <tr>
          <td height="9" align="right" bgcolor="#6B716F">&nbsp;</td>
        </tr>
      </table>
      <?
			  }
			  ?>
	 </td>
  </tr>
	<tr>
	  <td colspan="2" bgcolor="#006666"><div align="right"><span class="styleblack">@SEAFDEC 2012</span></div></td>
  </tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>