<?php
header("Content-Type: application/vnd.ms-excel"); 
header('Content-Disposition: attachment; filename="gonad.xls"');
?>
<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;
}
.style37 {color: #FFFFFF}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (Untitled-1) -->
<?
	 
	  	$yy = $_GET["y"];
		  require_once("reportlenght.inc.php");
		  $spname = getspname($_GET["lstsp"]);
	  ?>
<br>
<table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="stylewhite">
  <tr bordercolor="#FFFFFF">
    <td bgcolor="#FFFFFF" class="styleblack"> <span class="styleblacklarge">Gonad maturity</span></td>
  </tr>
</table>
<table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
  <tr bgcolor="#FFFFFF" class="styleblack">
    <td colspan="13" class="stylewhitesmall">
      <div align="left" class="styleblack">Year : <? echo $yy; ?></div>
    <div align="left"></div></td>
  </tr>
  <tr bgcolor="#FFFFFF" class="styleblack">
    <td colspan="13" class="styleblack">Species : <? echo  $spname; ?> </td>
  </tr>
  <tr class="styleblack">
    <td width="21%" class="stylegreen"><div align="center">Month/Sex<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Jan<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Feb<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Mar<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Apr<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">May<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Jun<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">July<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Aug<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Sep<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Oct<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Nov<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Dec<br>
    </div></td>
  </tr>
  <?
		include "reportgonad.inc.php";
		$smjan = getnumsex($yy,'M',1,$_GET["lstsp"]);
		$smfeb = getnumsex($yy,'M',2,$_GET["lstsp"]);
		$smmar = getnumsex($yy,'M',3,$_GET["lstsp"]);
		$smapr = getnumsex($yy,'M',4,$_GET["lstsp"]);
		$smmay = getnumsex($yy,'M',5,$_GET["lstsp"]);
		$smjun = getnumsex($yy,'M',6,$_GET["lstsp"]);
		$smjul = getnumsex($yy,'M',7,$_GET["lstsp"]);
		$smaug = getnumsex($yy,'M',8,$_GET["lstsp"]);
		$smsep = getnumsex($yy,'M',9,$_GET["lstsp"]);
		$smoct = getnumsex($yy,'M',10,$_GET["lstsp"]);
		$smnov = getnumsex($yy,'M',11,$_GET["lstsp"]);
		$smdec = getnumsex($yy,'M',12,$_GET["lstsp"]);
		//female
		$sfjan = getnumsex($yy,'F',1,$_GET["lstsp"]);
		$sffeb = getnumsex($yy,'F',2,$_GET["lstsp"]);
		$sfmar = getnumsex($yy,'F',3,$_GET["lstsp"]);
		$sfapr = getnumsex($yy,'F',4,$_GET["lstsp"]);
		$sfmay = getnumsex($yy,'F',5,$_GET["lstsp"]);
		$sfjun = getnumsex($yy,'F',6,$_GET["lstsp"]);
		$sfjul = getnumsex($yy,'F',7,$_GET["lstsp"]);
		$sfaug = getnumsex($yy,'F',8,$_GET["lstsp"]);
		$sfsep = getnumsex($yy,'F',9,$_GET["lstsp"]);
		$sfoct = getnumsex($yy,'F',10,$_GET["lstsp"]);
		$sfnov = getnumsex($yy,'F',11,$_GET["lstsp"]);
		$sfdec = getnumsex($yy,'F',12,$_GET["lstsp"]);
		//unidentify
		$sjan = getnumsex($yy,'',1,$_GET["lstsp"]);
		$sfeb = getnumsex($yy,'',2,$_GET["lstsp"]);
		$smar = getnumsex($yy,'',3,$_GET["lstsp"]);
		$sapr = getnumsex($yy,'',4,$_GET["lstsp"]);
		$smay = getnumsex($yy,'',5,$_GET["lstsp"]);
		$sjun = getnumsex($yy,'',6,$_GET["lstsp"]);
		$sjul = getnumsex($yy,'',7,$_GET["lstsp"]);
		$saug = getnumsex($yy,'',8,$_GET["lstsp"]);
		$ssep = getnumsex($yy,'',9,$_GET["lstsp"]);
		$soct = getnumsex($yy,'',10,$_GET["lstsp"]);
		$snov = getnumsex($yy,'',11,$_GET["lstsp"]);
		$sdec = getnumsex($yy,'',12,$_GET["lstsp"]);
		?>
  <tr align="center" bgcolor="#FFFFFF" class="styleblack">
    <td height="15" class="styleblack">Male</td>
    <td height="15" class="styleblack"><? echo $smjan;  ?></td>
    <td height="15" class="styleblack"><? echo $smfeb;  ?></td>
    <td height="15" class="styleblack"><? echo $smmar;  ?></td>
    <td height="15" class="styleblack"><? echo $smapr;  ?></td>
    <td height="15" class="styleblack"><? echo $smmay;  ?></td>
    <td height="15" class="styleblack"><? echo $smjun;  ?></td>
    <td height="15" class="styleblack"><? echo $smjul;  ?></td>
    <td height="15" class="styleblack"><? echo $smaug;  ?></td>
    <td height="15" class="styleblack"><? echo $smsep;  ?></td>
    <td height="15" class="styleblack"><? echo $smoct;  ?></td>
    <td height="15" class="styleblack"><? echo $smnov;  ?></td>
    <td height="15" class="styleblack"><? echo $smdec;  ?></td>
  </tr>
  <tr align="center" bgcolor="#FFFFFF" class="styleblack">
    <td height="15" class="styleblack">Female</td>
    <td height="15" class="styleblack"><? echo $sfjan; ?>&nbsp;</td>
    <td height="15"><? echo $sffeb;  ?></td>
    <td height="15"><? echo $sfmar;  ?></td>
    <td height="15"><? echo $sfapr;  ?></td>
    <td height="15"><? echo $sfmay;  ?></td>
    <td height="15"><? echo $sfjun;  ?></td>
    <td height="15"><? echo $sfjul;  ?></td>
    <td height="15"><? echo $sfaug;  ?></td>
    <td height="15"><? echo $sfsep;  ?></td>
    <td height="15"><? echo $sfoct;  ?></td>
    <td height="15"><? echo $sfnov;  ?></td>
    <td height="15"><? echo $sfdec;  ?></td>
  </tr>
  <tr align="center" bgcolor="#FFFFFF" class="styleblack">
    <td height="17" class="styleblack">Unidentify</td>
    <td height="15" class="styleblack"><? echo $sjan; ?>&nbsp;</td>
    <td height="15"><? echo $sfeb;  ?></td>
    <td height="15"><? echo $smar;  ?></td>
    <td height="15"><? echo $sapr;  ?></td>
    <td height="15"><? echo $smay;  ?></td>
    <td height="15"><? echo $sjun;  ?></td>
    <td height="15"><? echo $sjul;  ?></td>
    <td height="15"><? echo $saug;  ?></td>
    <td height="15"><? echo $ssep;  ?></td>
    <td height="15"><? echo $soct;  ?></td>
    <td height="15"><? echo $snov;  ?></td>
    <td height="15"><? echo $sdec;  ?></td>
  </tr>
  <tr align="center" bgcolor="#FFFFFF" class="styleblack">
    <td height="17" colspan="13" class="stylewhitesmall">&nbsp;</td>
  </tr>
</table>
<table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
  <tr class="styleblack">
    <td width="21%" bgcolor="#FFFFFF" class="stylegreen"><div align="center">Month/Stage<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Jan<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Feb<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Mar<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Apr<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">May<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Jun<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">July<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Aug<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Sep<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Oct<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><div align="center">Nov<br>
    </div></td>
    <td bgcolor="#FFFFFF" class="styleblack"><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,$_GET["lstsp"]);
			$numstagefeb = getnumstage($yy,$dbstageid,2,$_GET["lstsp"]);
			$numstagemar = getnumstage($yy,$dbstageid,3,$_GET["lstsp"]);
			$numstageapr = getnumstage($yy,$dbstageid,4,$_GET["lstsp"]);
			$numstagemay = getnumstage($yy,$dbstageid,5,$_GET["lstsp"]);
			$numstagejun = getnumstage($yy,$dbstageid,6,$_GET["lstsp"]);
			$numstagejul = getnumstage($yy,$dbstageid,7,$_GET["lstsp"]);
			$numstageaug = getnumstage($yy,$dbstageid,8,$_GET["lstsp"]);
			$numstagesep = getnumstage($yy,$dbstageid,9,$_GET["lstsp"]);
			$numstageoct = getnumstage($yy,$dbstageid,10,$_GET["lstsp"]);
			$numstagenov = getnumstage($yy,$dbstageid,11,$_GET["lstsp"]);
			$numstagedec = getnumstage($yy,$dbstageid,12,$_GET["lstsp"]);
			?>
  <tr align="center" class="styleblack">
    <td height="8" bgcolor="#FFFFFF" class="styleblack"><? echo $dbstageid."-".$dbstagename; ?> </td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstagejan; ?>&nbsp;</td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstagefeb; ?>&nbsp;</td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstagemar; ?>&nbsp;</td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstageapr; ?></td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstagemay; ?></td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstagejun; ?></td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstagejul; ?></td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstageaug; ?></td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstagesep; ?></td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstageoct; ?></td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstagenov; ?></td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numstagedec; ?></td>
  </tr>
  <?
		}
			$numjan = getnumstage($yy,$ss,'',1,$_GET["lstsp"]);
			$numfeb = getnumstage($yy,$ss,'',2,$_GET["lstsp"]);
			$nummar = getnumstage($yy,$ss,'',3,$_GET["lstsp"]);
			$numapr = getnumstage($yy,$ss,'',4,$_GET["lstsp"]);
			$nummay = getnumstage($yy,$ss,'',5,$_GET["lstsp"]);
			$numjun = getnumstage($yy,$ss,'',6,$_GET["lstsp"]);
			$numjul = getnumstage($yy,$ss,'',7,$_GET["lstsp"]);
			$numaug = getnumstage($yy,$ss,'',8,$_GET["lstsp"]);
			$numsep = getnumstage($yy,$ss,'',9,$_GET["lstsp"]);
			$numoct = getnumstage($yy,$ss,'',10,$_GET["lstsp"]);
			$numnov = getnumstage($yy,$ss,'',11,$_GET["lstsp"]);
			$numdec = getnumstage($yy,$ss,'',12,$_GET["lstsp"]);
		?>
  <tr align="center" class="styleblack">
    <td height="8" bgcolor="#FFFFFF" class="styleblack">Unidentify</td>
    <td height="15" bgcolor="#FFFFFF" class="styleblack"><? echo $numjan; ?></td>
    <td height="15" bgcolor="#FFFFFF"><? echo $numfeb; ?>&nbsp;</td>
    <td height="15" bgcolor="#FFFFFF"><? echo $nummar; ?>&nbsp;</td>
    <td height="15" bgcolor="#FFFFFF"><? echo $numapr; ?></td>
    <td height="15" bgcolor="#FFFFFF"><? echo $nummay; ?></td>
    <td height="15" bgcolor="#FFFFFF"><? echo $numjun; ?></td>
    <td height="15" bgcolor="#FFFFFF"><? echo $numjul; ?></td>
    <td height="15" bgcolor="#FFFFFF"><? echo $numaug; ?></td>
    <td height="15" bgcolor="#FFFFFF"><? echo $numsep; ?></td>
    <td height="15" bgcolor="#FFFFFF"><? echo $numoct; ?></td>
    <td height="15" bgcolor="#FFFFFF"><? echo $numnov; ?></td>
    <td height="15" bgcolor="#FFFFFF"><? echo $numdec; ?></td>
  </tr>
  <tr align="center" class="styleblack">
    <td height="9" colspan="13" bgcolor="#FFFFFF" class="stylewhitesmall"><div align="right"></div></td>
  </tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>