Initial commit
This commit is contained in:
29
includes/cropday.php
Normal file
29
includes/cropday.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
$serverName = "CBM2K12\SQLEXPRESS";
|
||||
$uid = "cbmclient";
|
||||
$pwd = "ascbm2k";
|
||||
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd,'ReturnDatesAsStrings'=> true, "CharacterSet" => 'utf-8', "Database"=>"SugarCaneScale" );
|
||||
|
||||
/* Connect using SQL Server Authentication. */
|
||||
$conn = sqlsrv_connect( $serverName, $connectionInfo);
|
||||
if( $conn === false )
|
||||
{
|
||||
echo "Unable to connect.</br>";
|
||||
die( print_r( sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$sql = "SELECT CropDay FROM Parameters";
|
||||
|
||||
$stmt = sqlsrv_query( $conn, $sql );
|
||||
if( $stmt === false) {
|
||||
die( print_r( sqlsrv_errors(), true) );
|
||||
}
|
||||
|
||||
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
|
||||
echo $row['CropDay'];
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
sqlsrv_close( $conn);
|
||||
?>
|
||||
9
includes/dbconnect.php
Normal file
9
includes/dbconnect.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$host="192.168.0.2";
|
||||
$username="corey";
|
||||
$password="41945549";
|
||||
$database="controls";
|
||||
|
||||
$con = mysqli_connect($host ,$username, $password, $database);
|
||||
@mysqli_select_db($con, $database) or die( "Unable to select database");
|
||||
?>
|
||||
6
includes/dbinfo.php
Normal file
6
includes/dbinfo.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$host="192.168.0.10";
|
||||
$username="corey";
|
||||
$password="41945549";
|
||||
$database="controls";
|
||||
?>
|
||||
6
includes/dbinfo3.php
Normal file
6
includes/dbinfo3.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$host="192.168.0.16";
|
||||
$username="corey";
|
||||
$password="41945549";
|
||||
$database="controls";
|
||||
?>
|
||||
17
includes/items.php
Normal file
17
includes/items.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
$con=mysqli_connect('192.168.0.10', 'corey', '41945549', 'controls');
|
||||
$query="SELECT ID, Name, ROUND(Value, 0) AS Value, ROUND(Value, 1) AS RoundedValue1, ROUND(Value, 2) AS RoundedValue, Timestamp FROM items ORDER BY ID ASC";
|
||||
$result=mysqli_query($con, $query);
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
while ($row=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
|
||||
$value[$row['Name']] = $row['Value'];
|
||||
$rounded[$row['Name']] = $row['RoundedValue'];
|
||||
$time[$row['Name']] = $row['Timestamp'];
|
||||
$ID[$row['ID']] = $row['Value'];
|
||||
$roundedid[$row['ID']] = $row['RoundedValue'];
|
||||
$rounded1[$row['ID']] = $row['RoundedValue1'];
|
||||
$rounded1[$row['Name']] = $row['RoundedValue1'];
|
||||
}
|
||||
?>
|
||||
13
includes/items2dec.php
Normal file
13
includes/items2dec.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$con=mysqli_connect('192.168.0.10', 'corey', '41945549', 'controls');
|
||||
$query="SELECT ID, Name, ROUND(Value, 2) AS Value, Timestamp FROM items ORDER BY ID ASC";
|
||||
$result=mysqli_query($con, $query);
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
while ($row=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
|
||||
$value[$row['Name']] = $row['Value'];
|
||||
$time[$row['Name']] = $row['Timestamp'];
|
||||
$ID[$row['ID']] = $row['Value'];
|
||||
}
|
||||
?>
|
||||
17
includes/itemsAI.php
Normal file
17
includes/itemsAI.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
$con=mysqli_connect('192.168.0.16', 'corey', '41945549', 'controls');
|
||||
$query="SELECT ID, Name, ROUND(Value, 0) AS Value, ROUND(Value, 1) AS RoundedValue1, ROUND(Value, 2) AS RoundedValue, Timestamp FROM items ORDER BY ID ASC";
|
||||
$result=mysqli_query($con, $query);
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
while ($row=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
|
||||
$value[$row['Name']] = $row['Value'];
|
||||
$rounded[$row['Name']] = $row['RoundedValue'];
|
||||
$time[$row['Name']] = $row['Timestamp'];
|
||||
$ID[$row['ID']] = $row['Value'];
|
||||
$roundedid[$row['ID']] = $row['RoundedValue'];
|
||||
$rounded1[$row['ID']] = $row['RoundedValue1'];
|
||||
$rounded1[$row['Name']] = $row['RoundedValue1'];
|
||||
}
|
||||
?>
|
||||
14
includes/record.php
Normal file
14
includes/record.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include("dbinfo.php");
|
||||
|
||||
$con=mysqli_connect($host,$username,$password,$database);
|
||||
$query = "SELECT DISTINCT record FROM record ORDER BY record DESC LIMIT 1";
|
||||
$result=mysqli_query($con,$query);
|
||||
|
||||
$include1=mysqli_fetch_array($result,MYSQLI_ASSOC);
|
||||
|
||||
mysqli_close($con);
|
||||
?>
|
||||
|
||||
|
||||
<?php echo round($include1['record']); ?>
|
||||
14
includes/recorddate.php
Normal file
14
includes/recorddate.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include("dbinfo.php");
|
||||
|
||||
$con=mysqli_connect($host,$username,$password,$database);
|
||||
$query = "SELECT DISTINCT record, timestamp FROM record ORDER BY record DESC LIMIT 1";
|
||||
$result=mysqli_query($con,$query);
|
||||
|
||||
$include1=mysqli_fetch_array($result,MYSQLI_ASSOC);
|
||||
|
||||
mysqli_close($con);
|
||||
?>
|
||||
|
||||
|
||||
<?php echo date('F, d', strtotime($include1['timestamp'])); ?>
|
||||
35
includes/tonsin.php
Normal file
35
includes/tonsin.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
$serverName = "CBM2K12\SQLEXPRESS";
|
||||
$uid = "cbmclient";
|
||||
$pwd = "ascbm2k";
|
||||
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd,'ReturnDatesAsStrings'=> true, "CharacterSet" => 'utf-8', "Database"=>"SugarCaneScale" );
|
||||
|
||||
/* Connect using SQL Server Authentication. */
|
||||
$conn = sqlsrv_connect( $serverName, $connectionInfo);
|
||||
if( $conn === false )
|
||||
{
|
||||
echo "Unable to connect.</br>";
|
||||
die( print_r( sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$sql = "SELECT ROUND (Tons,0) AS Tons FROM LoadData WHERE CropDay = ( SELECT Max(CropDay) FROM LoadData)";
|
||||
|
||||
$stmt = sqlsrv_query( $conn, $sql );
|
||||
if( $stmt === false) {
|
||||
die( print_r( sqlsrv_errors(), true) );
|
||||
}
|
||||
$tonsin = 0;
|
||||
while( $rowtonsin = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) )
|
||||
{
|
||||
$tonsin += $rowtonsin['Tons'];
|
||||
|
||||
}
|
||||
|
||||
//end
|
||||
|
||||
?>
|
||||
<?php echo $tonsin; ?>
|
||||
<?
|
||||
$db = null;
|
||||
?>
|
||||
28
includes/totground.php
Normal file
28
includes/totground.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$servername = "192.168.0.2";
|
||||
$username = "corey";
|
||||
$password = "41945549";
|
||||
$dbname = "controls";
|
||||
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
$query = "SELECT DISTINCT PREVTONS FROM totaltons";
|
||||
$result=$conn->query($query);
|
||||
$tonsin = 0;
|
||||
if ($result->num_rows > 0) {
|
||||
// output data of each row
|
||||
while($rowtotground = $result->fetch_assoc()) {
|
||||
$tonsin += $rowtotground['PREVTONS'];
|
||||
|
||||
}
|
||||
} else {
|
||||
echo "0 results";
|
||||
}
|
||||
$conn->close();
|
||||
|
||||
?>
|
||||
<?php echo ($tonsin)+0; ?>
|
||||
13
includes/w15minavg.php
Normal file
13
includes/w15minavg.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
include("dbinfo.php");
|
||||
|
||||
$con=mysqli_connect($host,$username,$password,$database);
|
||||
$query = "SELECT AVG(wtonshr) AS rate FROM (SELECT wtonshr FROM milling ORDER BY id DESC LIMIT 900) tbl";
|
||||
$result=mysqli_query($con,$query);
|
||||
|
||||
$row3=mysqli_fetch_assoc($result);
|
||||
|
||||
mysqli_close($con);
|
||||
?>
|
||||
|
||||
<?php echo round($row3['rate'],0); ?>
|
||||
13
includes/w24hravg.php
Normal file
13
includes/w24hravg.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
include("dbinfo.php");
|
||||
|
||||
$con=mysqli_connect($host,$username,$password,$database);
|
||||
$query = "SELECT AVG(wtonshr) AS rate FROM (SELECT wtonshr FROM milling ORDER BY id DESC LIMIT 600) tbl";
|
||||
$result=mysqli_query($con,$query);
|
||||
|
||||
$roww24hravg=mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
echo round($roww24hravg['rate'],0)*24;
|
||||
?>
|
||||
33
includes/w24hravgtotal.php
Normal file
33
includes/w24hravgtotal.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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 (SELECT AVG(wtonshr) FROM milling ORDER BY id DESC LIMIT 600) AS rate, (SELECT avgtcd FROM milling ORDER BY id DESC LIMIT 1) AS eavg";
|
||||
$result=mysql_query($query);
|
||||
|
||||
$num=mysql_numrows($result);
|
||||
|
||||
mysql_close();
|
||||
?>
|
||||
|
||||
<?php
|
||||
$i=0;
|
||||
while ($i < $num) {
|
||||
|
||||
$f1=mysql_result($result,$i,"rate");
|
||||
$f2=mysql_result($result,$i,"eavg");
|
||||
?>
|
||||
|
||||
|
||||
<?php echo round($f1,0)*24; ?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
15
includes/west15minavg.php
Normal file
15
includes/west15minavg.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
include("dbinfo.php");
|
||||
|
||||
$con=mysqli_connect($host,$username,$password,$database);
|
||||
$query = "SELECT ((SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 1) - (SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 899, 1))*4 AS westavg";
|
||||
$result=mysqli_query($con,$query);
|
||||
|
||||
$include4=mysqli_fetch_array($result,MYSQLI_ASSOC);
|
||||
|
||||
mysqli_close($con);
|
||||
?>
|
||||
|
||||
|
||||
<?php echo round($include4['westavg']); ?>
|
||||
|
||||
32
includes/wruntime.php
Normal file
32
includes/wruntime.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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 AVG(wtonshr) AS rate FROM (SELECT wtonshr FROM milling ORDER BY id DESC LIMIT 600) tbl";
|
||||
$result=mysql_query($query);
|
||||
|
||||
$num=mysql_numrows($result);
|
||||
|
||||
mysql_close();
|
||||
?>
|
||||
|
||||
<?php
|
||||
$i=0;
|
||||
while ($i < $num) {
|
||||
|
||||
$f1=mysql_result($result,$i,"rate");
|
||||
?>
|
||||
|
||||
|
||||
<?php echo round($f1,0); ?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user