159 lines
3.8 KiB
PHP
159 lines
3.8 KiB
PHP
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Load Data</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
|
|
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="center">
|
|
|
|
<div class="header">
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-3 right">
|
|
<div class="aside">
|
|
<?php include("tonsin.php");?>
|
|
<?php include("tonsintot.php");?>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
|
|
<table style="margin: 0px auto;">
|
|
<tr>
|
|
<th>
|
|
<form method="POST" action="search.php">
|
|
<?php include("dayselect.php");?>
|
|
<?php include("growerselect.php");?><br>
|
|
<input id="option" type="checkbox" name="over" value="100000">
|
|
<label for="option"><span></span>OVERLOADS</label>
|
|
<input type="submit" value="Search" />
|
|
</form>
|
|
</th>
|
|
</tr>
|
|
</table>
|
|
<?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));
|
|
}
|
|
|
|
//select data from db
|
|
$sql = "SELECT LoadData.LoadId_Pk,
|
|
LoadData.CropDay,
|
|
LoadData.TractId_Fk,
|
|
LoadData.TareWt,
|
|
LoadData.GrossWt,
|
|
LoadData.Tons,
|
|
LoadData.FarmerId_Fk,
|
|
CONVERT(varchar, LoadData.DateOut, 100) [TIME],
|
|
LoadData.Parked,
|
|
Tract.AccountName
|
|
FROM LoadData RIGHT JOIN Tract ON LoadData.FarmerId_Fk = Tract.AccountId_Pk
|
|
WHERE CropDay = 90
|
|
GROUP BY LoadData.LoadId_Pk,
|
|
LoadData.CropDay,
|
|
LoadData.TractId_Fk,
|
|
LoadData.TareWt,
|
|
LoadData.GrossWt,
|
|
LoadData.Tons,
|
|
LoadData.FarmerId_Fk,
|
|
LoadData.DateOut,
|
|
LoadData.Parked,
|
|
Tract.AccountName
|
|
ORDER by LoadId_Pk DESC";
|
|
|
|
$stmt = sqlsrv_query( $conn, $sql );
|
|
if( $stmt === false) {
|
|
die( print_r( sqlsrv_errors(), true) );
|
|
}
|
|
|
|
$tonsin = 0;
|
|
$tonsin2 = 0;
|
|
?>
|
|
<table style="margin: 0px auto;" class="stat">
|
|
<tr>
|
|
<th>Live Scale Load Data</th>
|
|
</tr>
|
|
</table>
|
|
<table class="stat">
|
|
<thead>
|
|
<tr>
|
|
<th>Load</th>
|
|
<th>Day</th>
|
|
<th>Tract</th>
|
|
<th>Grower</th>
|
|
<th>Gross</th>
|
|
<th>Tare</th>
|
|
<th>Tons</th>
|
|
<th>Out Time</th>
|
|
</tr>
|
|
</thead>
|
|
<?php
|
|
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
|
|
$tonsin += $row['Tons'];
|
|
echo "<tr>";
|
|
echo "<td>".$row ['LoadId_Pk']."</td>";
|
|
echo "<td><b>".$row ['CropDay']."</b></td>";
|
|
echo "<td>".$row ['TractId_Fk']."</td>";
|
|
echo "<td>".$row ['AccountName']."</td>";
|
|
echo "<td>".$row ['GrossWt']." </td>";
|
|
echo "<td>".$row ['TareWt']." </td>";
|
|
echo "<td>".$row ['Tons']." </td>";
|
|
echo "<td>".$row ['TIME']." </td>";
|
|
echo "</tr>";
|
|
}
|
|
|
|
//end
|
|
sqlsrv_free_stmt( $stmt);
|
|
sqlsrv_close( $conn);
|
|
?>
|
|
</table>
|
|
<table style="margin: 0px auto;">
|
|
<tr>
|
|
<th id="vtitle" id="padded">Total Tons:</th>
|
|
<th align="right" id="sum-count"><?php echo $tonsin; ?></th>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<a href="#" class="back-to-top">Back to Top</a>
|
|
</div>
|
|
<?php include 'footer.php';?>
|
|
<script type="text/javascript">
|
|
// create the back to top button
|
|
$('body').prepend('<a href="#" class="back-to-top">Back to Top</a>');
|
|
|
|
var amountScrolled = 300;
|
|
|
|
$(window).scroll(function() {
|
|
if ($(window).scrollTop() > amountScrolled) {
|
|
$('a.back-to-top').fadeIn('slow');
|
|
} else {
|
|
$('a.back-to-top').fadeOut('slow');
|
|
}
|
|
});
|
|
|
|
$('a.back-to-top, a.simple-back-to-top').click(function() {
|
|
$('body').animate({
|
|
scrollTop: 0
|
|
}, 'fast');
|
|
return false;
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|