<?php
error_reporting(E_ERROR);
$username="corey";
$password="41945549";
$database="controls";

mysql_connect('127.0.0.1',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "(SELECT * FROM milling ORDER BY id DESC LIMIT 1)";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>

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

$f4=mysql_result($result,$i,"tonshr");
$f7=mysql_result($result,$i,"mill1wsp");
$f9=mysql_result($result,$i,"15minavg");
$f10=mysql_result($result,$i,"weightwsp");
$f11=mysql_result($result,$i,"Levelswitch");
$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");
$f38=mysql_result($result,$i,"mill1spd");
$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");
$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");
$f81=mysql_result($result,$i,"losstime");
$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");
$f15=mysql_result($result,$i,"netablwt");
$f2=mysql_result($result,$i,"mainspd");
$f5=mysql_result($result,$i,"mccoutput");
$f57=mysql_result($result,$i,"imb5flow");
$f58=mysql_result($result,$i,"imb5sp");
$f75=mysql_result($result,$i,"imbflow");
$f76=mysql_result($result,$i,"imbsp");
$f78=mysql_result($result,$i,"mill1automan");
$f79=mysql_result($result,$i,"mill1output");
$f80=mysql_result($result,$i,"mill1automan1");
$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");
$f119=mysql_result($result,$i,"wtonshr");
$f80=mysql_result($result,$i,"wmill1lvl");
$f82=mysql_result($result,$i,"wmill2lvl");
$f83=mysql_result($result,$i,"wmill3lvl");
$f84=mysql_result($result,$i,"wmill4lvl");
$f85=mysql_result($result,$i,"wmill5lvl");
$f200=mysql_result($result,$i,"wmill1spd");
$f201=mysql_result($result,$i,"wmill2spd");
$f202=mysql_result($result,$i,"wmill3spd");
$f203=mysql_result($result,$i,"wmill4spd");
$f204=mysql_result($result,$i,"wmill5spd");
$f205=mysql_result($result,$i,"wimbflow");
?>
<table width="100%">
	<tr>
	<td width="40%">
	<table class="tftable24k">
		<tr>
		<td width="40%" align="center" colspan="5" border="0"><font color="#00BFFF"><i>EAST MILL TANDEM</i></font></td>
		</tr>
	</table>

	<table class="tftableEAST4k">
		<tr height="30">
			<td align="center"><font color="#e0e0e0"></font></td>
			<td align="center"><font color="#e0e0e0">Level</font></td>
			<td align="center"><font color="#e0e0e0">SP</font></td>
			<td align="center"><font color="#e0e0e0">RPM</font></td>
			<td align="left" colspan="1"><font color="#e0e0e0">Mill 1 Output</font></td>
			<?php
			if ($f78 == 0)
			echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#0B3B17\"><font color=\"#e0e0e0\">A</font></td>";
			if ($f78 == 1)
			echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#8A0808\"><font color=\"#e0e0e0\">M</font></td>";
			?>
			<td width="50" align="right"><font color="#00FF00"><?php echo $f79; ?></font></td>
			<td width="112" align="left"><font color="#e0e0e0">%</font></td>
		</tr>

		<tr height="30">
			<td width="30" bgcolor="#0B3B17" align="center"><font color="#e0e0e0">1</font></td>
			<td width="210" bgcolor="#0B3B17" align="left"><progress id="progressmills" data-label="<?php echo $f21; ?>%" max="100" value="<?php echo $f21; ?>"></progress></td>
			<td width="80" bgcolor="#0B3B17" align="center"><font color="#e0e0e0"><?php echo $f86; ?></font></td>
			<td width="90" bgcolor="#0B3B17" align="center"><font color="#00FF00"><?php echo $f38; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">MCC FPM</font></td>
			<td width="50" align="right"><font color="#00FF00"><?php echo $f2; ?></font></td>
			<td colspan="2" width="110" align="left"><font color="#e0e0e0">FPM</font></td>

		</tr>
		<tr>
			<td bgcolor="#D7DF01" align="center"><font color="#000000">2</font></td>
			<td bgcolor="#D7DF01" align="left"><progress id="progressmills" data-label="<?php echo $f22; ?>%" max="100" value="<?php echo $f22; ?>"></progress></td>
			<td bgcolor="#D7DF01" align="center"><font color="#ffffff"><?php echo $f87; ?></font></td>
			<td bgcolor="#D7DF01" align="center"><font color="#298A08"><?php echo $f33; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">MCC Output</font></td>
			<td align="right"><font color="#00FF00"><?php echo $f5; ?></font></td>
			<td colspan="2" align="left"><font color="#e0e0e0">%</font></td>
		</tr>
		<tr>
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0">3</font></td>
			<td bgcolor="#04B404" align="left"><progress id="progressmills" data-label="<?php echo $f23; ?>%" max="100" value="<?php echo $f23; ?>"></progress></td>
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0"><?php echo $f88; ?></font></td>
			<td bgcolor="#04B404" align="center"><font color="#00FF00"><?php echo $f34; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">MCC Tons</font></td>
			<td align="right"><font color="#00FF00"><?php echo $f15; ?></font></td>
			<td colspan="2" align="left"><font color="#e0e0e0">Tons</font></td>
		</tr>
		<tr>
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0">4</font></td>
			<td bgcolor="#DF7401" align="left"><progress id="progressmills" data-label="<?php echo $f24; ?>%" max="100" value="<?php echo $f24; ?>"></progress></td>
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0"><?php echo $f89; ?></font></td>
			<td bgcolor="#DF7401" align="center"><font color="#00FF00"><?php echo $f35; ?></font></td>
			<td align="left"><font color="#e0e0e0">Mill 1 SP</font></td><?php
				if ($f80 == 1)
					echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#0B3B17\"><font color=\"#e0e0e0\">A</font></td>";
				if ($f80 == 0)
					echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#8A0808\"><font color=\"#e0e0e0\">M</font></td>";
				?>
				<?php
				if ($f11 == 1)
					echo "<td align=\"right\"><font color=\"00FF00\"><b> $f10 </b></font></td>";
				if ($f11 == 0)
					echo "<td align=\"right\"><font color=\"00FF00\"><b> $f7 </b></font></td>";
				?>
				<?php
				if ($f11 == 1)
					echo "<td colspan=\"2\"><font color=\"#e0e0e0\">Tons/Hr</font></td>";
				if ($f11 == 0)
					echo "<td colspan=\"2\"><font color=\"#e0e0e0\">%</font></td>";
				?>
		</tr>
		<tr>
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0">5</font></td>
			<td bgcolor="#5858FA" align="left"><progress id="progressmills" data-label="<?php echo $f25; ?>%" max="100" value="<?php echo $f25; ?>"></progress></td>
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0"><?php echo $f90; ?></font></td>
			<td bgcolor="#5858FA" align="center"><font color="#00FF00"><?php echo $f36; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">Grinding Rate</font></td>
			<td align="right"><font color="#00FF00"><?php echo $f4; ?></font></td>
			<td colspan="2" align="left"><font color="#e0e0e0">Tons/Hr</font></td>
		</tr>
		<tr>
			<td bgcolor="#8A0808" align="center"><font color="#e0e0e0">6</font></td>
			<td bgcolor="#8A0808" align="left"><progress id="progressmills" data-label="<?php echo $f26; ?>%" max="100" value="<?php echo $f26; ?>"></progress></td>
			<td bgcolor="#8A0808" align="center"><font color="#e0e0e0"><?php echo $f91; ?></font></td>
			<td bgcolor="#8A0808" align="center"><font color="#00FF00"><?php echo $f37; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">Average Rate</font></td>
			<td align="right"><font color="#00FF00"><?php echo $f9; ?></font></td>
			<td colspan="2" align="left"><font color="#e0e0e0">Tons/15Min</font></td>

		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan="2"><font color="#e0e0e0">Imibition 6 Flow:</font></td>
			<td bgcolor="#2E2E2E" align="right" id="lsp"><font color="00FF00"><b><?php echo $f75; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">GPM</font></td>

			<td colspan="2"><font color="#e0e0e0">Imibition 6 SP:</font></td>
			<td align="right" id="lsp"><font color="00FF00"><b><?php echo $f76; ?></b></font></td>
			<td colspan="2"><font color="#e0e0e0">GPM</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan="2"><font color="#e0e0e0">Imibition 5 Flow:</font></td>
			<td bgcolor="#2E2E2E" align="right" id="lsp"><font color="00FF00"><b><?php echo $f57; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">GPM</font></td>

			<td colspan="2"><font color="#e0e0e0">Imibition 5 SP:</font></td>
			<td align="right" id="lsp"><font color="00FF00"><b><?php echo $f58; ?></b></font></td>
			<td colspan="2"><font color="#e0e0e0">GPM</font></td>
		</tr>
	</table>
	</td>

	<td width="20%">
	<table class="tftable24k">
		<tr>
		<td width="20%" align="center" colspan="3" border="0"><font color="#00BFFF"><i>GENERAL INFO</i></font></td>
		</tr>
	</table>
	<table class="tftableWEST4k">
		<tr>
			<td bgcolor="#2E2E2E" colspan=""><font color="#e0e0e0">Total Tons Ground:</font></td>
			<td bgcolor="#2E2E2E" align="right"><font color="00FF00"><b><?php include("../data/totground.php");?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Tons</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan=""><font color="#e0e0e0">Today's Tons In:</font></td>
			<td bgcolor="#2E2E2E" align="right"><font color="00FF00"><b><?php include("tonsin.php");?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Tons</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Tons Ground:</font></td>
			<td bgcolor="#2E2E2E" align="right"><font color="00FF00"><b><?php echo $f64; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Tons</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Average Tons/Day:</font></td>
			<td bgcolor="#2E2E2E" align="right"><font color="00FF00"><b><?php echo $f65; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Tons</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan=""><font color="#e0e0e0">Prev Tons Ground:</font></td>
			<td bgcolor="#2E2E2E" align="right"><font color="00FF00"><b><?php echo $f62; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Tons</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan=""><font color="#e0e0e0">Run Hours:</font></td>
			<td bgcolor="#2E2E2E" align="right"><font color="00FF00"><b><?php echo $f61; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Hours</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan=""><font color="#e0e0e0">Prev Run Hours:</font></td>
			<td bgcolor="#2E2E2E" align="right"><font color="00FF00"><b><?php echo $f63; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Hours</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan=""><font color="#e0e0e0">Today's Loss Time:</font></td>
			<td bgcolor="#2E2E2E" align="right" id="lsp"><font color="00FF00"><b><?php echo $f81; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">Hours</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan=""><font color="#e0e0e0">Total Tons/Hr:</font></td>
			<td bgcolor="#2E2E2E" height="35" colspan="2" align="center"><font size="6" color="00FFFF"><b><?php echo ($f4 + $f119); ?></b></font></td>
		</tr>
	</table>
	</td>

	<td width="40%">
	<table class="tftable24k">
		<tr>
		<td width="40%" align="center" colspan="6" border="0"><font color="#00BFFF"><i>WEST MILL TANDEM</i></font></td>
		</tr>
	</table>
	<table class="tftableWEST4k">
		<tr height="30">
			<td align="center"><font color="#e0e0e0"></font></td>
			<td align="center"><font color="#e0e0e0">Level</font></td>
			<td align="center"><font color="#e0e0e0">SP</font></td>
			<td align="center"><font color="#e0e0e0">RPM</font></td>
			<td colspan="4" align="center"><font color="#e0e0e0"></font></td>
		</tr>
		<tr>
			<td width="30" bgcolor="#0B3B17" align="center"><font color="#e0e0e0">1</font></td>
			<td width="210" bgcolor="#0B3B17" align="left"><progress id="progressmills" max="100" value=""><?php echo $f80; ?></progress></td>
			<td width="80" bgcolor="#0B3B17" align="center"><font color="#e0e0e0"></font></td>
			<td width="90" bgcolor="#0B3B17" align="center"><font color="#00FF00"><?php echo $f200; ?></font></td>
			<td align="left"><font color="#e0e0e0">MCC FPM</font></td>
			<td width="50" align="right"><font color="#00FF00"></font></td>
			<td width="110" align="left"><font color="#e0e0e0">FPM</font></td>
		</tr>
		<tr>
			<td bgcolor="#D7DF01" align="center"><font color="#000000">2</font></td>
			<td bgcolor="#D7DF01" align="left"><progress id="progressmills" max="100" value=""><?php echo $f82; ?></progress></td>
			<td bgcolor="#D7DF01" align="center"><font color="#ffffff"></font></td>
			<td bgcolor="#D7DF01" align="center"><font color="#298A08"><?php echo $f201; ?></font></td>
			<td align="left"><font color="#e0e0e0">MCC Output</font></td>
			<td align="right"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">%</font></td>
		</tr>
		<tr>
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0">3</font></td>
			<td bgcolor="#04B404" align="left"><progress id="progressmills" max="100" value=""><?php echo $f83; ?></progress></td>
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0"></font></td>
			<td bgcolor="#04B404" align="center"><font color="#00FF00"><?php echo $f202; ?></font></td>
			<td align="left"><font color="#e0e0e0">MCC Tons</font></td>
			<td align="right"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">Tons</font></td>
		</tr>
		<tr>
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0">4</font></td>
			<td bgcolor="#DF7401" align="left"><progress id="progressmills" max="100" value=""><?php echo $f84; ?></progress></td>
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0"></font></td>
			<td bgcolor="#DF7401" align="center"><font color="#00FF00"><?php echo $f203; ?></font></td>
			<td align="left"><font color="#e0e0e0">Mill 1 SP</font></td>
			<td align="right"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">%</font></td>
		</tr>
		<tr>
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0">5</font></td>
			<td bgcolor="#5858FA" align="left"><progress id="progressmills" max="100" value=""><?php echo $f85; ?></progress></td>
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0"></font></td>
			<td bgcolor="#5858FA" align="center"><font color="#00FF00"><?php echo $f204 ?></font></td>
			<td align="left"><font color="#e0e0e0">Grinding Rate</font></td>
			<td align="right"><font color="#00FF00"><?php echo $f119 ?></font></td>
			<td align="left"><font color="#e0e0e0">Tons/Hr</font></td>
		</tr>
		<tr>
			<td bgcolor="#8A0808" colspan="4" align="center"><font color="#e0e0e0"></font></td>
			<td align="left"><font color="#e0e0e0">Average Rate</font></td>
			<td align="right"><font color="#00FF00"><?php include("w15minavg.php");?></font></td>
			<td align="left"><font color="#e0e0e0">Tons/15Min</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan="2"><font color="#e0e0e0">Imibition Flow:</font></td>
			<td bgcolor="#2E2E2E" align="right" id="lsp"><font color="00FF00"><b><?php echo $f205; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">GPM</font></td>

			<td colspan="1"><font color="#e0e0e0">Imibition 5 SP:</font></td>
			<td align="right" id="lsp"><font color="00FF00"><b></b></font></td>
			<td><font color="#e0e0e0">GPM</font></td>
		</tr>
		<tr>
			<td height="35" colspan="9"><font color="#e0e0e0"></font></td>
		</tr>
	</table>
	</td>
</tr>
</table>
<?php
$i++;
}
?>
