<?php
include("../../dbinfo.php");

$con=mysqli_connect($host,$username,$password,$database);
$query = "(SELECT * FROM milling ORDER BY id DESC LIMIT 1)"; 
$result=mysqli_query($con, $query);

mysqli_close($con);

?>

<?php /*
$i=0;
while ($i < $num) {

$f1=mysql_result($result,$i,"livstmpr");
$f2=mysql_result($result,$i,"mainspd");
$f3=mysql_result($result,$i,"mill1spd");
$f4=mysql_result($result,$i,"tonshr");
$f5=mysql_result($result,$i,"mccoutput");
$f6=mysql_result($result,$i,"exhaustpr");
$f7=mysql_result($result,$i,"mill1wsp");
$f8=mysql_result($result,$i,"canetot");
$f9=mysql_result($result,$i,"15minavg");
$f10=mysql_result($result,$i,"weightwsp");
$f11=mysql_result($result,$i,"Levelswitch");
$f12=mysql_result($result,$i,"cercoutput");
$f13=mysql_result($result,$i,"crecpv");
$f14=mysql_result($result,$i,"crecsp");
$f15=mysql_result($result,$i,"netablwt");
$f16=mysql_result($result,$i,"vaporpres");
$f17=mysql_result($result,$i,"pan8lvl");
$f18=mysql_result($result,$i,"pan8evapvapor");
$f19=mysql_result($result,$i,"pan7hdrpres");
$f20=mysql_result($result,$i,"pan9exhaust");
$f21=mysql_result($result,$i,"mill1lvl");
$f22=mysql_result($result,$i,"mill2lvl");
$f23=mysql_result($result,$i,"mill3lvl");
$f24=mysql_result($result,$i,"mill4lvl");
$f25=mysql_result($result,$i,"mill5lvl");
$f26=mysql_result($result,$i,"mill6lvl");
$f27=mysql_result($result,$i,"mill1pres");
$f28=mysql_result($result,$i,"mill2pres");
$f29=mysql_result($result,$i,"mill3pres");
$f30=mysql_result($result,$i,"mill4pres");
$f31=mysql_result($result,$i,"mill5pres");
$f32=mysql_result($result,$i,"mill6pres");
$f33=mysql_result($result,$i,"mill2spd");
$f34=mysql_result($result,$i,"mill3spd");
$f35=mysql_result($result,$i,"mill4spd");
$f36=mysql_result($result,$i,"mill5spd");
$f37=mysql_result($result,$i,"mill6spd");
$f38=mysql_result($result,$i,"mill1spd");
$f39=mysql_result($result,$i,"knife1pres");
$f40=mysql_result($result,$i,"knife2pres");
$f41=mysql_result($result,$i,"knife3pres");
$f42=mysql_result($result,$i,"knife1spd");
$f43=mysql_result($result,$i,"knife2spd");
$f44=mysql_result($result,$i,"knife3spd");
$f45=mysql_result($result,$i,"knife1op");
$f46=mysql_result($result,$i,"knife2op");
$f47=mysql_result($result,$i,"knife3op");
$f48=mysql_result($result,$i,"kc1");
$f49=mysql_result($result,$i,"kc2");
$f50=mysql_result($result,$i,"kc3");
$f51=mysql_result($result,$i,"neoutput");
$f52=mysql_result($result,$i,"nescale");
$f53=mysql_result($result,$i,"nesetpoint");
$f54=mysql_result($result,$i,"seoutput");
$f55=mysql_result($result,$i,"sescale");
$f56=mysql_result($result,$i,"sesetpoint");
$f57=mysql_result($result,$i,"woutput");
$f58=mysql_result($result,$i,"wscale");
$f59=mysql_result($result,$i,"wsetpoint");
$f60=mysql_result($result,$i,"latchon");
$f61=mysql_result($result,$i,"runhrstoday");
$f62=mysql_result($result,$i,"prevtons");
$f63=mysql_result($result,$i,"prevtime");
$f64=mysql_result($result,$i,"canetot");
$f65=mysql_result($result,$i,"avgtcd");
$f66=mysql_result($result,$i,"juicetankbit");
$f67=mysql_result($result,$i,"juicelvl");
$f68=mysql_result($result,$i,"nam");
$f69=mysql_result($result,$i,"sam");
$f70=mysql_result($result,$i,"wam");
$f71=mysql_result($result,$i,"tdoutput");
$f72=mysql_result($result,$i,"mill1highlvl");
$f73=mysql_result($result,$i,"mill5highlvl");
$f74=mysql_result($result,$i,"mill6highlvl");
$f75=mysql_result($result,$i,"imbflow");
$f76=mysql_result($result,$i,"imbsp");
$f77=mysql_result($result,$i,"pan8hrdpress");
$f78=mysql_result($result,$i,"mill1automan");
$f79=mysql_result($result,$i,"mill1output");
$f80=mysql_result($result,$i,"mill1automan1");
$f81=mysql_result($result,$i,"losstime");
$f82=mysql_result($result,$i,"tdratio");
$f83=mysql_result($result,$i,"tdsetpoint");
$f84=mysql_result($result,$i,"tdinput");
$f85=mysql_result($result,$i,"tdmg");
$f86=mysql_result($result,$i,"mill1sp");
$f87=mysql_result($result,$i,"mill2sp");
$f88=mysql_result($result,$i,"mill3sp");
$f89=mysql_result($result,$i,"mill4sp");
$f90=mysql_result($result,$i,"mill5sp");
$f91=mysql_result($result,$i,"mill6sp");
$f92=mysql_result($result,$i,"nesetpoint3");
$f93=mysql_result($result,$i,"nespswitch");
$f94=mysql_result($result,$i,"wsetpoint3");
$f95=mysql_result($result,$i,"wspswitch");
$f96=mysql_result($result,$i,"tdratios");
$f97=mysql_result($result,$i,"exhaustam");
$f98=mysql_result($result,$i,"b1pidswitch");
$f99=mysql_result($result,$i,"b1sf");
$f100=mysql_result($result,$i,"b2sf");
$f101=mysql_result($result,$i,"b3sf");
$f102=mysql_result($result,$i,"b4sf");
$f103=mysql_result($result,$i,"b5sf");
$f104=mysql_result($result,$i,"b6sf");
$f105=mysql_result($result,$i,"ttlstmflo");
$f106=mysql_result($result,$i,"tdsetpoint3");
$f107=mysql_result($result,$i,"tdsetpoint3switch");
$f108=mysql_result($result,$i,"stblsp3");
$f109=mysql_result($result,$i,"stblsp3switch");
$f110=mysql_result($result,$i,"dmbeltrunning");
$f111=mysql_result($result,$i,"tdbeltscale");
$f112=mysql_result($result,$i,"tdbeltscaleonoff");
$f113=mysql_result($result,$i,"syrupoverflow");
$f114=mysql_result($result,$i,"molbreclvl");
$f115=mysql_result($result,$i,"syruprcvrlvl");
$f116=mysql_result($result,$i,"amollvl");
$f117=mysql_result($result,$i,"amoloverflow");
$f118=mysql_result($result,$i,"bmoloverflow");
*/
?>

<table class="tftable1">

<!-- ****************************************** ROW START ******************************************** -->

<tr>
<td><font color="#e0e0e0">Mill 1 Set Point:</font></td>
<?php
		if ($row['MILL1AUTOMAN1'] == 1)
			echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#0B3B17\"><font color=\"#e0e0e0\">A</font></td>";
		if ($row['MILL1AUTOMAN1'] == 0)
			echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#8A0808\"><font color=\"#e0e0e0\">M</font></td>";
		?>
<?php
		if ($row['LEVELSWITCH'] == 1)
			echo "<td align=\"right\"><font color=\"00FF00\"><b>". $row['WEIGHTWSP']." </b></font></td>";
		if ($row['LEVELSWITCH'] == 0)
			echo "<td align=\"right\"><font color=\"00FF00\"><b> ".$row['MILL1WSP']." </b></font></td>";
		?>
<?php
		if ($row['LEVELSWITCH'] == 1)
			echo "<td><font color=\"#e0e0e0\">Tons/Hr</font></td>";
		if ($row['LEVELSWITCH'] == 0)
			echo "<td><font color=\"#e0e0e0\">%</font></td>";
		?>

<td><font color="#e0e0e0">Grinding Rate:</font></td>
<?php
$color = "#FFFFFF";

if (($row['TONSHR'] >= 0) && ($row['TONSHR'] <= 299))
   $color = "#FF0000";
else if (($row['TONSHR'] >= 200) && ($row['TONSHR'] <= 399))
   $color = "#FFFF00";
else if ($row['TONSHR'] >= 400)
   $color = "#00FF00";

echo "<td align=\"right\"><font color=\"$color\"><b>". $row['TONSHR']." </b></font></td>";
?>
<td><font color="#e0e0e0">Tons/Hr</font></td>

<td colspan="2"><font color="#e0e0e0">Total Tons Ground:</font></td>
<td align="right"><font color="00FF00"><b><?php include("../data/totground.php");?></b></font></td>
<td><font color="#e0e0e0">Tons</font></td>
</tr>

<!-- ****************************************** ROW END ******************************************** -->

<!-- ****************************************** ROW START ******************************************** -->

<tr>
<td><font color="#e0e0e0">Mill 1 Turbine Output:</font></td>
<?php
		if ($row['MILL1AUTOMAN'] == 0)
			echo "<td align=\"center\" bgcolor=\"#0B3B17\"><font color=\"#e0e0e0\">A</font></td>";
		if ($row['MILL1AUTOMAN'] == 1)
			echo "<td align=\"center\" bgcolor=\"#8A0808\"><font color=\"#e0e0e0\">M</font></td>";
		?>
<td align="right"><font color="00FF00"><b><?php echo $row['MILL1OUTPUT']; ?></b></font></td>
<td><font color="#e0e0e0">%</font></td>

<td><font color="#e0e0e0">15 Min Average:</font></td>
<td align="right"><font color="00FF00"><b><?php echo $row['15MINAVG']; ?></b></font></td>
<td><font color="#e0e0e0">Tons/Hr</font></td>

<td colspan="2"><font color="#e0e0e0">Prev Tons Ground:</font></td>
<td align="right"><font color="00FF00"><b><?php echo $row['PREVTONS']; ?></b></font></td>
<td><font color="#e0e0e0">Tons</font></td>
</tr>

<!-- ****************************************** ROW END ******************************************** -->

<!-- ****************************************** ROW START ******************************************** -->

<tr>
<td colspan="2"><font color="#e0e0e0">MCC FPM:</font></td>
<td align="right" width="75"><font color="00FF00"><b><?php echo $row['MAINSPD']; ?></b></font></td>
<td><font color="#e0e0e0">FPM</font></td>

<td><font color="#e0e0e0">Tons Ground:</font></td>
<td align="right"><font color="00FF00"><b><?php echo $row['CANETOT']; ?></b></font></td>
<td><font color="#e0e0e0">Tons</font></td>

<td colspan="2"><font color="#e0e0e0">Run Hours:</font></td>
<td align="right"><font color="00FF00"><b><?php echo $row['RUNHRSTODAY']; ?></b></font></td>
<td><font color="#e0e0e0">Hours</font></td>
</tr>

<!-- ****************************************** ROW END ******************************************** -->

<!-- ****************************************** ROW START ******************************************** -->

<tr>
<td><font color="#e0e0e0">MCC Output:</font></td>
	<?php
		if ($row['B1PIDSWITCH'] == 1)
		echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#0B3B17\"><font color=\"#e0e0e0\">2</font></td>";
		if ($row['B1PIDSWITCH'] == 0)
		echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#8A0808\"><font color=\"#e0e0e0\">1</font></td>";
	?>
<td align="right"><font color="00FF00"><b><?php echo $row['MCCOUTPUT']; ?></b></font></td>
<td><font color="#e0e0e0">%</font></td>

<td><font color="#e0e0e0">Average Tons/Day:</font></td>
<td align="right"><font color="00FF00"><b><?php echo $row['AVGTCD']; ?></b></font></td>
<td><font color="#e0e0e0">Tons</font></td>

<td colspan="2"><font color="#e0e0e0">Prev Run Hours:</font></td>
<td align="right"><font color="00FF00"><b><?php echo $row['PREVTIME']; ?></b></font></td>
<td><font color="#e0e0e0">Hours</font></td>
</tr>

<!-- ****************************************** ROW END ******************************************** -->

<!-- ****************************************** ROW START ******************************************** -->

<tr>
<td colspan="2"><font color="#e0e0e0">MCC Tons:</font></td>
<td align="right"><font color="00FF00"><b><?php echo $row['NETABLWT']; ?></b></font></td>
<td><font color="#e0e0e0">Tons</font></td>

<td><font color="#e0e0e0">Imibition Flow:</font></td>
<td align="right" id="lsp"><font color="00FF00"><b><?php echo $row['IMBFLOW']; ?></b></font></td>
<td><font color="#e0e0e0">GPM</font></td>

<td colspan="2"><font color="#e0e0e0">Today's Tons In:</font></td>
<td align="right"><font color="00FF00"><b><?php include("tonsin.php");?></b></font></td>
<td><font color="#e0e0e0">Tons</font></td>
</tr>

<!-- ****************************************** ROW END ******************************************** -->

<!-- ****************************************** ROW START ******************************************** -->

<tr>
		<?php
		if ($row['JUICETANKBIT'] == 0)
			echo "<td colspan=\"2\"><font color=\"#e0e0e0\">One Juice Tank</font></td>";
		if ($row['JUICETANKBIT'] == 1)
			echo "<td colspan=\"2\"><font color=\"#e0e0e0\">Two Juice Tanks</font></td>";
		?>
<td align="right"><font color="00FF00"><b><?php echo $row['JUICELVL']; ?></b></font></td>
<td><font color="#e0e0e0">%</font></td>

<td><font color="#e0e0e0">Imibition SP:</font></td>
<td align="right" id="lsp"><font color="00FF00"><b><?php echo $row['IMBSP']; ?></b></font></td>
<td><font color="#e0e0e0">GPM</font></td>

<td colspan="2"><font color="#e0e0e0">Today's Loss Time:</font></td>
<td align="right" id="lsp"><font color="00FF00"><b><?php echo $row['LOSSTIME']; ?></b></font></td>
<td><font color="#e0e0e0">Hours</font></td>
</tr>

<!-- ****************************************** ROW END ******************************************** -->

</table>


<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF PAGE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->

<?php
$i++;

?>