<?php
header("Content-Type: application/vnd.ms-excel"); 
header('Content-Disposition: attachment; filename="recovery.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;
}
.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) -->
<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="styleblacklarge">Length Frequency </td>
  </tr>
</table>
<?
	 
				$yy = $_GET["y"];
				
	  	  
		  if($_GET["lstunit"] == 0.1)
		  {
		  	$unt = "CM";
		  }
		  else
		  {
		  	$unt = "MM";
		  }
		  if( $_GET["lstlength"] == "tl")
		  {
		  $typeoflength = "Total Length";
		  }
		  elseif ( $_GET["lstlength"] == "bl")
		  {
		  $typeoflength = "Body Length";
		  }
		   elseif ( $_GET["lstlength"] == "fl")
		  {
		  $typeoflength = "Fork Length";
		  }
		   elseif ( $_GET["lstlength"] == "sl")
		  {
		  $typeoflength = "Standard Length";
		  }
		  
		  require_once("reportlenght.inc.php");
		  
		  $spname = getspname($_GET["lstsp"]);
	  ?>
<table width="95%" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#000000" bgcolor="#000000">
  <tr bordercolor="#000000" bgcolor="#FFFFFF" class="styleblack">
    <td colspan="15" class="stylewhitesmall">
      <div align="left" class="styleblack">Year : <? echo $yy; ?></div>
    <div align="left"></div></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#FFFFFF" class="styleblack">
    <td colspan="15" class="styleblack">Species : <? echo  $spname; ?> </td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#FFFFFF" class="styleblack">
    <td colspan="15" class="styleblack">Length : <? echo $typeoflength; ?></td>
  </tr>
  <tr bordercolor="#000000" class="styleblack">
    <td width="13%" bgcolor="#FFFFFF" class="stylegreen"><div align="center" class="styleblack">Lower Limit<br>
            <? echo $unt; ?></div></td>
    <td width="13%" bgcolor="#FFFFFF" class="stylegreen"><div align="center" class="styleblack">Upper Limit<br>
            <? echo $unt; ?> </div></td>
    <td width="13%" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="stylegreen"><div align="center" class="styleblack">Mid Length<br>
            <? echo $unt; ?> </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>
  <?
		 $interval = $_GET["txtinterval"];
		 $interval2 = $interval-1;
		 $lowerlimit = $_GET["txtlower"];
		 $modlower =  $lowerlimit%$interval;
		 		

		 $min = $lowerlimit-$modlower; 
		 require_once("reportlenght.inc.php");
		 $tlen = $_GET["lstlength"];
		 //echo "type of length =".$tlen;
		 $max = maxlength($tlen,$yy,$ss);
		 //echo "max =".$max;
		 $minimum = $min;
		 $maximum = $max; 
		 $unit = $_GET["lstunit"];
		 //echo "unit =".$unit;
						for($b=$minimum;$b<=$maximum;$b=$b+$interval)
						{
						$lower = $b;
						$upper = $b+$interval2;
						$showlower = $lower*$unit;
						$showupper = $upper*$unit;
						$midlength = ($b+($b+$interval2))/2;
						$showmid = $midlength*$unit;
						 require_once("reportlenght.inc.php");
						$ljan = getlength($tlen,$yy,1,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$lfeb = getlength($tlen,$yy,2,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$lmar = getlength($tlen,$yy,3,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$lapr = getlength($tlen,$yy,4,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$lmay = getlength($tlen,$yy,5,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$ljun = getlength($tlen,$yy,6,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$ljul = getlength($tlen,$yy,7,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$laug = getlength($tlen,$yy,8,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$lsep = getlength($tlen,$yy,9,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$loct = getlength($tlen,$yy,10,$_GET["lstsp"],$lower,$upper);
						 require_once("reportlenght.inc.php");
						$lnov = getlength($tlen,$yy,11,$_GET["lstsp"],$lower,$upper );
						 require_once("reportlenght.inc.php");
						$ldec = getlength($tlen,$yy,12,$_GET["lstsp"],$lower,$upper );
						?>
  <tr align="center" bordercolor="#000000" bgcolor="#FFFFFF" class="styleblack">
    <td height="17" class="styleblack"><? echo $showlower; ?></td>
    <td height="17" class="styleblack"><? echo $showupper; ?></td>
    <td height="17" class="styleblack"><? echo $showmid; ?></td>
    <td height="17" class="styleblack"><? echo $ljan; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $lfeb; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $lmar; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $lapr; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $lmay; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $ljun; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $ljul; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $laug; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $lsep; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $loct; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $lnov; ?>&nbsp;</td>
    <td height="17" class="styleblack"><? echo $ldec; ?>&nbsp;</td>
  </tr>
  <?
						}
						?>
  <tr bordercolor="#000000" bgcolor="#FFFFFF" class="styleblack">
    <td height="8" colspan="3" class="stylewhitesmall"><div align="right">
        <p align="center" class="styleblack">Total number of fishes
            <?  
		   require_once("reportlenght.inc.php");
						$sjan = getsumlength($tlen,$yy,1,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$sfeb = getsumlength($tlen,$yy,2,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$smar = getsumlength($tlen,$yy,3,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$sapr = getsumlength($tlen,$yy,4,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$smay = getsumlength($tlen,$yy,5,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$sjun = getsumlength($tlen,$yy,6,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$sjul = getsumlength($tlen,$yy,7,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$saug = getsumlength($tlen,$yy,8,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$ssep = getsumlength($tlen,$yy,9,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$soct = getsumlength($tlen,$yy,10,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$snov = getsumlength($tlen,$yy,11,$_GET["lstsp"]);
						 require_once("reportlenght.inc.php");
						$sdec = getsumlength($tlen,$yy,12,$_GET["lstsp"]);
		  ?>
        </p>
    </div></td>
    <td height="17" align="center" class="styleblack"><? echo $sjan; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $sfeb; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $smar; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $sapr; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $smay; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $sjun; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $sjul; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $saug; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $ssep; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $soct; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $snov; ?>&nbsp;</td>
    <td height="17" align="center" class="styleblack"><? echo $sdec; ?>&nbsp;</td>
  </tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>