<?
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}
.styletextbox {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color:#000000; }
-->
</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" 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> | <a href="usr.php">User</a> |<span class="style1"> <a href="fishingzone.php">Fishing Area |</a> <a href="district.php">State/Province </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="705" valign="top" bgcolor="#CCCCCC"><?
	 
	  	$yy = $_GET["y"];
		$ss = $_GET["s"]; 
		$stype = $_GET["ss"]; 
				
	  	  if($_POST["submit"])
		  {
		  require_once("reportlenght.inc.php");
		  $spname = getspname($_POST["lstsp"]);
		  $yy = $_POST["lstyear"];
	  ?>
	    <br>
	    <table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="stylewhite">
        <tr bordercolor="#FFFFFF">
          <td bgcolor="#006666" class="stylewhite"> Gonad maturity <? echo $_GET["y"]; ?></td>
        </tr>
        </table>
	    <table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
        <tr bgcolor="#000000" class="styleblack">
          <td colspan="13" bgcolor="#6B716F" class="stylewhitesmall"> <div align="left">Year : <? echo $yy; ?></div>            
          <div align="left"></div></td>
        </tr>
        <tr bgcolor="#000000" class="styleblack">
          <td colspan="13" bgcolor="#6B716F" class="stylewhitesmall">Species : <? echo  $spname; ?>  </td>
        </tr>
        <tr class="styleblack">
          <td width="21%" class="stylegreen"><div align="center">Month/Sex<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Jan<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Feb<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Mar<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Apr<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">May<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Jun<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">July<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Aug<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Sep<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Oct<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Nov<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Dec<br>
          </div></td>
        </tr>
		<?
		include "reportgonad.inc.php";
		$smjan = getnumsex($yy,'M',1,$_POST["lstsp"]);
		$smfeb = getnumsex($yy,'M',2,$_POST["lstsp"]);
		$smmar = getnumsex($yy,'M',3,$_POST["lstsp"]);
		$smapr = getnumsex($yy,'M',4,$_POST["lstsp"]);
		$smmay = getnumsex($yy,'M',5,$_POST["lstsp"]);
		$smjun = getnumsex($yy,'M',6,$_POST["lstsp"]);
		$smjul = getnumsex($yy,'M',7,$_POST["lstsp"]);
		$smaug = getnumsex($yy,'M',8,$_POST["lstsp"]);
		$smsep = getnumsex($yy,'M',9,$_POST["lstsp"]);
		$smoct = getnumsex($yy,'M',10,$_POST["lstsp"]);
		$smnov = getnumsex($yy,'M',11,$_POST["lstsp"]);
		$smdec = getnumsex($yy,'M',12,$_POST["lstsp"]);
		//female
		$sfjan = getnumsex($yy,'F',1,$_POST["lstsp"]);
		$sffeb = getnumsex($yy,'F',2,$_POST["lstsp"]);
		$sfmar = getnumsex($yy,'F',3,$_POST["lstsp"]);
		$sfapr = getnumsex($yy,'F',4,$_POST["lstsp"]);
		$sfmay = getnumsex($yy,'F',5,$_POST["lstsp"]);
		$sfjun = getnumsex($yy,'F',6,$_POST["lstsp"]);
		$sfjul = getnumsex($yy,'F',7,$_POST["lstsp"]);
		$sfaug = getnumsex($yy,'F',8,$_POST["lstsp"]);
		$sfsep = getnumsex($yy,'F',9,$_POST["lstsp"]);
		$sfoct = getnumsex($yy,'F',10,$_POST["lstsp"]);
		$sfnov = getnumsex($yy,'F',11,$_POST["lstsp"]);
		$sfdec = getnumsex($yy,'F',12,$_POST["lstsp"]);
		//unidentify
		$sjan = getnumsex($yy,'',1,$_POST["lstsp"]);
		$sfeb = getnumsex($yy,'',2,$_POST["lstsp"]);
		$smar = getnumsex($yy,'',3,$_POST["lstsp"]);
		$sapr = getnumsex($yy,'',4,$_POST["lstsp"]);
		$smay = getnumsex($yy,'',5,$_POST["lstsp"]);
		$sjun = getnumsex($yy,'',6,$_POST["lstsp"]);
		$sjul = getnumsex($yy,'',7,$_POST["lstsp"]);
		$saug = getnumsex($yy,'',8,$_POST["lstsp"]);
		$ssep = getnumsex($yy,'',9,$_POST["lstsp"]);
		$soct = getnumsex($yy,'',10,$_POST["lstsp"]);
		$snov = getnumsex($yy,'',11,$_POST["lstsp"]);
		$sdec = getnumsex($yy,'',12,$_POST["lstsp"]);
		?>
        <tr align="center" class="styleblack">
          <td height="8" bgcolor="#006666" class="stylewhitesmall">Male</td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smjan;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smfeb;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smmar;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smapr;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smmay;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smjun;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smjul;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smaug;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smsep;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smoct;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smnov;  ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $smdec;  ?></td>
        </tr>
        <tr align="center" class="styleblack">
          <td height="9" bgcolor="#006666" class="stylewhitesmall">Female</td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $sfjan; ?>&nbsp;</td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sffeb;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfmar;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfapr;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfmay;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfjun;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfjul;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfaug;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfsep;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfoct;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfnov;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfdec;  ?></td>
        </tr>
        <tr align="center" class="styleblack">
          <td height="17" bgcolor="#006666" class="stylewhitesmall">Unidentify</td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $sjan; ?>&nbsp;</td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sfeb;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $smar;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sapr;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $smay;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sjun;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sjul;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $saug;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $ssep;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $soct;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $snov;  ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $sdec;  ?></td>
        </tr>
        <tr align="center" class="styleblack">
          <td height="17" colspan="13" bgcolor="#6B716F" class="stylewhitesmall">&nbsp;</td>
        </tr>
        </table>
	    <table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
        <tr class="styleblack">
          <td width="21%" class="stylegreen"><div align="center">Month/Stage<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Jan<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Feb<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Mar<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Apr<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">May<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Jun<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">July<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Aug<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Sep<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Oct<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Nov<br>
          </div></td>
          <td bgcolor="#000000" class="stylewhitesmall"><div align="center">Dec<br>
          </div></td>
        </tr>
		<?
		include "connect.inc.php";
		 $sqlgetstage = "SELECT stageid,stagename FROM stage order by stageid";
	  //echo $sqlgetship;
	  $qrygetstage = mysql_query($sqlgetstage);
	  $numgetstage = mysql_num_rows($qrygetstage);
	   for($s=1;$s<=$numgetstage;$s++)
		{
			$resgetstage = mysql_fetch_array($qrygetstage);
			$dbstageid = $resgetstage["stageid"];
			$dbstagename = $resgetstage["stagename"];
			$numstagejan = getnumstage($yy,$dbstageid,1,$_POST["lstsp"]);
			$numstagefeb = getnumstage($yy,$dbstageid,2,$_POST["lstsp"]);
			$numstagemar = getnumstage($yy,$dbstageid,3,$_POST["lstsp"]);
			$numstageapr = getnumstage($yy,$dbstageid,4,$_POST["lstsp"]);
			$numstagemay = getnumstage($yy,$dbstageid,5,$_POST["lstsp"]);
			$numstagejun = getnumstage($yy,$dbstageid,6,$_POST["lstsp"]);
			$numstagejul = getnumstage($yy,$dbstageid,7,$_POST["lstsp"]);
			$numstageaug = getnumstage($yy,$dbstageid,8,$_POST["lstsp"]);
			$numstagesep = getnumstage($yy,$dbstageid,9,$_POST["lstsp"]);
			$numstageoct = getnumstage($yy,$dbstageid,10,$_POST["lstsp"]);
			$numstagenov = getnumstage($yy,$dbstageid,11,$_POST["lstsp"]);
			$numstagedec = getnumstage($yy,$dbstageid,12,$_POST["lstsp"]);
			?>
        <tr align="center" class="styleblack">
          <td height="8" bgcolor="#006666" class="stylewhitesmall"><? echo $dbstageid."-".$dbstagename; ?> </td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstagejan; ?>&nbsp;</td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstagefeb; ?>&nbsp;</td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstagemar; ?>&nbsp;</td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstageapr; ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstagemay; ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstagejun; ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstagejul; ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstageaug; ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstagesep; ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstageoct; ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstagenov; ?></td>
          <td height="0" bgcolor="#ADCE4C" class="styleblack"><? echo $numstagedec; ?></td>
        </tr>
		<?
		}
			$numjan = getnumstage($yy,'',1,$_POST["lstsp"]);
			$numfeb = getnumstage($yy,'',2,$_POST["lstsp"]);
			$nummar = getnumstage($yy,'',3,$_POST["lstsp"]);
			$numapr = getnumstage($yy,'',4,$_POST["lstsp"]);
			$nummay = getnumstage($yy,'',5,$_POST["lstsp"]);
			$numjun = getnumstage($yy,'',6,$_POST["lstsp"]);
			$numjul = getnumstage($yy,'',7,$_POST["lstsp"]);
			$numaug = getnumstage($yy,'',8,$_POST["lstsp"]);
			$numsep = getnumstage($yy,'',9,$_POST["lstsp"]);
			$numoct = getnumstage($yy,'',10,$_POST["lstsp"]);
			$numnov = getnumstage($yy,'',11,$_POST["lstsp"]);
			$numdec = getnumstage($yy,'',12,$_POST["lstsp"]);
		?>
        <tr align="center" class="styleblack">
          <td height="8" bgcolor="#006666" class="stylewhitesmall">Unidentify</td>
          <td height="8" bgcolor="#ADCE4C" class="styleblack"><? echo $numjan; ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $numfeb; ?>&nbsp;</td>
          <td height="0" bgcolor="#ADCE4C"><? echo $nummar; ?>&nbsp;</td>
          <td height="0" bgcolor="#ADCE4C"><? echo $numapr; ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $nummay; ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $numjun; ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $numjul; ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $numaug; ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $numsep; ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $numoct; ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $numnov; ?></td>
          <td height="0" bgcolor="#ADCE4C"><? echo $numdec; ?></td>
        </tr>
        <tr align="center" class="styleblack">
          <td height="9" colspan="13" bgcolor="#6B716F" class="stylewhitesmall"><div align="right">Export <a href="gonad_excel.php?y=<? echo $yy; ?>&lstsp=<? echo $_POST["lstsp"]; ?>"><img src="images/excel_4.jpg" width="35" height="29" border="0"></a></div></td>
        </tr>
        </table>
	    <p><br>	  
        <?
	  }
	  ?>
            </p>
	    <form name="form1" method="post" action="">
	    <div align="center"><br>
	      <table width="59%" height="29" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td height="4" colspan="2" align="right" bgcolor="#6B716F">&nbsp;</td>
            </tr>
            <tr>
              <td width="31%" align="right" bgcolor="#ADCE4C" class="styleblack">Year&nbsp; </td>
              <td width="69%" align="left" bgcolor="#ADCE4C" class="styleblack"> 
               <select name="lstyear" class="styleblack" id="lstsector">
              <?
			  include "connect.inc.php";
              $sqlgetyear = "SELECT distinct year(DepartureDate) as yy FROM catch INNER JOIN fishspecies ON catch.spid = fishspecies.spid INNER JOIN fishoperation ON fishoperation.Optid = catch.Optid INNER JOIN ship ON fishoperation.VesselId = ship.ShipName INNER JOIN shiptype ON ship.fishsector = shiptype.shptid INNER JOIN fishingsector ON shiptype.sid = fishingsector.sid ORDER BY fishingsector.sid, year(DepartureDate)";
	  //echo $sqlgetship;
	  $qrygetyear = mysql_query($sqlgetyear);
	  $numgetyear = mysql_num_rows($qrygetyear);
	   for($i=1;$i<=$numgetyear;$i++)
		{
			$resgetyear = mysql_fetch_array($qrygetyear);
			$dbyear= $resgetyear["yy"];
			echo "<option value='$dbyear'>$dbyear</option>";
		}
		?>
        </select>		</td>
            </tr>
            <tr>
              <td height="0" align="right" bgcolor="#ADCE4C" class="styleblack">Species&nbsp; </td>
              <td width="69%" align="left" bgcolor="#ADCE4C" class="styleblack">
			 
			  <?
			 include "connect.inc.php";
			  $sqlgetcatch = "select distinct(biology.spid),fishspecies.scientific from biology inner join fishspecies on biology.spid = fishspecies.spid  inner join fishoperation on biology.Optid = fishoperation.Optid INNER JOIN ship ON fishoperation.VesselId = ship.ShipName INNER JOIN shiptype ON ship.fishsector = shiptype.shptid INNER JOIN fishingsector ON shiptype.sid = fishingsector.sid";
				//echo $sqlgetcatch;
				$qrygetcatch = mysql_query($sqlgetcatch);
				$numgetcatch = mysql_num_rows($qrygetcatch);
				?>
                <select name="lstsp" class="styleblack" id="select">
                  <?
				
				for($i=1;$i<=$numgetcatch;$i++)
				{
				$resgetcatch = mysql_fetch_array($qrygetcatch);
				$dbspid = $resgetcatch["spid"];
				$dbspname = $resgetcatch["scientific"];
				echo "<option value='$dbspid'>$dbspname</option>";
				}
				?>
                </select>
                <input name="submit" type="submit" class="styleblack" id="submit2" value="Submit"></td>
            </tr>
            <tr>
              <td height="9" colspan="2" align="right" bgcolor="#6B716F">&nbsp;</td>
            </tr>
          </table>
        </div>
	    </form>	    <p>&nbsp;</p></td>
    </tr>
	<tr>
	  <td bgcolor="#006666"><div align="right"><span class="styleblack">@SEAFDEC 2012</span></div></td>
  </tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>