123 lines
2.9 KiB
PHP
123 lines
2.9 KiB
PHP
<?php
|
|
|
|
$serverName = "LASUCA2K8\CBM";
|
|
$uid = "cbm";
|
|
$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.TareIN,
|
|
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 = ( SELECT Max(CropDay)FROM LoadData)
|
|
GROUP BY LoadData.LoadId_Pk,
|
|
LoadData.CropDay,
|
|
LoadData.TractId_Fk,
|
|
LoadData.TareIN,
|
|
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) );
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
<table style="margin: 0px auto;">
|
|
<tr>
|
|
<th>
|
|
<form action="search.php">
|
|
<input id="option" type="checkbox" name="over" value="100000">
|
|
<label for="option"><span></span>OVERLOAD</label>
|
|
<input type="submit" value="Search" />
|
|
</form>
|
|
</th>
|
|
</tr>
|
|
</table>
|
|
|
|
<table width="100%" style="margin: 0px auto;" class="stat" cellpadding="4">
|
|
<tr id="title">
|
|
<th>Live Scale Load Data</th>
|
|
</tr>
|
|
</table>
|
|
<table width="100%" border="2" cellspacing="0" cellpadding="4">
|
|
<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) ) {
|
|
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 ['TareIN']." </td>";
|
|
echo "<td>".$row ['Tons']." </td>";
|
|
echo "<td>".$row ['TIME']." </td>";
|
|
echo "</tr>";
|
|
}
|
|
|
|
//end
|
|
sqlsrv_free_stmt( $stmt);
|
|
sqlsrv_close( $conn);
|
|
?>
|
|
</table>
|
|
|
|
|
|
<a href="#" class="back-to-top">Back to Top</a>
|
|
</div>
|
|
|
|
<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>
|