Initial commit
This commit is contained in:
163
OLD/loaddata/search.php
Normal file
163
OLD/loaddata/search.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<!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 action="index.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="Reset Search" />
|
||||
</form>
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
print_r($_POST);
|
||||
$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
|
||||
|
||||
$grower = $_POST['grower'];
|
||||
$cropday = $_POST['cropday'];
|
||||
|
||||
|
||||
|
||||
$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.AccountName
|
||||
WHERE CropDay LIKE '%".$cropday."%' OR AccountName LIKE '%".$grower."%'
|
||||
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>
|
||||
</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>
|
||||
Reference in New Issue
Block a user