Files
2026-02-17 09:29:34 -06:00

88 lines
2.4 KiB
PHP

<?php include "session.php";
include "userAccess.php";
$serverName = "SQLSERVER";
$uid = "crw";
$pwd = "rp02751";
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd,'ReturnDatesAsStrings'=> true, "CharacterSet" => 'utf-8', "Database"=>"TruckTracking" );
/* 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 * FROM DumpHistory ORDER by ScanDate DESC";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
?>
<html>
<link href="style.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="http://lasuca.com/images/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<title>RFID Truck Log</title>
</head>
<body>
<div class="center">
<div class="header">
<h1>LASUCA CONTROLS</h1>
<p>General Overview</p>
</div>
<div class="row">
<?php include("menuinclude.php");
$dump="SELECT
SUM(NetWt) AS totalwt,
SUM(CASE WHEN DumpLocation='Truck Dump' THEN NetWt END) AS truckwt
FROM DumpHistory";
$dumpquery=sqlsrv_query($conn,$dump);
$dumparray=sqlsrv_fetch_array($dumpquery,SQLSRV_FETCH_ASSOC); ?>
<table style="margin: auto; border: solid black 1px;">
<thead>
<tr>
<th>West Table Total</th>
<th>Truck Dump Total</th>
</tr>
</thead>
<tr> <?php
echo "<td>".($dumparray['totalwt']-$dumparray['truckwt'])."</td>";
echo "<td>".$dumparray['truckwt']."</td>";
?>
</tr>
</table>
<table style="margin: auto; border: solid black 1px;">
<thead>
<tr>
<th>Load Number</th>
<th>Vehicle ID</th>
<th>Dump Location</th>
<th>Scan Date</th>
<th>Net Weight</th>
<th>Crop Day</th>
</tr>
</thead>
<?php while ($array=sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
echo "<tr>";
echo "<td>".$array['LoadNo']."</td>";
echo "<td>".$array['VehicleId']."</td>";
echo "<td>".$array['DumpLocation']."</td>";
echo "<td>".$array['ScanDate']."</td>";
echo "<td>".$array['NetWt']."</td>";
echo "<td>".$array['CropDay']."</td>";
echo "</tr>"; } ?>
</tr>
</table>
</div>
<?php include 'footer.php';?>
</body>
</html>