Exemplo n.º 1
0
}
?>
 <br><br />
<form action="Show_set_yieldOb.php" method="post"
	enctype="multipart/form-data" id="form1">

<?php 
echo "Enter the Yield Obtained per Section";
echo "<table><tr><td></td></tr>";
$i = 0;
while ($info = mysql_fetch_array($data)) {
    $lot = $info['lotno'];
    //TODO:Sunil
    $currlot = addslashes($lot);
    $year = $_POST['year'];
    echo '<tr><td>' . $lot . '/' . $year . '(' . getExten($currlot, $divi) . ')</td><td><input type="text" name="' . $i . '" onkeypress=\\"return isNumberKey(event)\\ value="' . get_yield_obtained($currlot, $divi, $year) . '"/></td></tr>';
    $i++;
}
echo '</table>';
?>
<input type=hidden name=count value=<?php 
echo $i;
?>
 />
<input type="hidden" name='divi' value=<?php 
echo $divi;
?>
 />
<input type="hidden" name='year' value=<?php 
echo $year;
?>
Exemplo n.º 2
0
function AvgYield($lotno, $divi, $kapa)
{
    $obt[] = array();
    $obt[0] = get_yield_obtainedSS($lotno, $divi, $kapa - 1);
    $obt[1] = get_yield_obtained($lotno, $divi, $kapa - 2);
    $obt[2] = get_yield_obtained($lotno, $divi, $kapa - 3);
    $zero = 0;
    for ($i = 0; $i < 3; $i++) {
        if ($obt[$i] == 0) {
            $zero++;
        }
    }
    $sum = $obt[0] + $obt[1] + $obt[2];
    if ($zero == 3) {
        return 0;
    } else {
        $avg = $sum / (3 - $zero);
        return round($avg, 2);
    }
}