Location: PHPKode > projects > Network Asset Management Archive > nama/redcounts2.php
<?php
$now = date("m/j/y h:i:s",time());
include "connect.php";

$now = date("j/m/y h:i:s",time());
echo '<body bgcolor="#FFFFCC">';

$stmt2 = "Select count(a.ip_address) as counttotal, l.lab FROM  ARP_TABLE a, SUBNETS s, LAB l, OWNER o WHERE  (L.LIASO = O.SERIAL) AND (S.LAB = L.SERIAL) AND (S.SUBNET = A.SUBNET) and (s.lab<6) group by l.lab";
#echo $stmt2 . '<br>';
echo '<table width="500" border="2">';
$sth2 = ibase_query($dbh, $stmt2);
$i = 0;
$totalmachines=0;
$totalreds=0;
$totalnorton=0;
echo '<tr><th>Lab</th><th>Machines</th><th>Complete</th><th>Incomplete</th><th>% Complete</th><th>% Incomplete</th><th>Norton AV</th><th>Update Server</th></tr>';
while ($row2 = ibase_fetch_object($sth2)) {
$stmt = "Select count(a.ip_address) as countred, l.lab FROM  ARP_TABLE a, SUBNETS s, LAB l, OWNER o WHERE  (L.LIASO = O.SERIAL) AND (S.LAB = L.SERIAL) AND (S.SUBNET = A.SUBNET) and (L.LAB ='" . $row2->LAB . "') and ((owner is null) or (building is null) or (room is null) or (barcode is null) or (os is null)) and (s.lab<6) group by l.lab";
#echo $stmt2;
$stmt3 = "Select count(a.ip_address) as counttotal, l.lab FROM  ARP_TABLE a, SUBNETS s, LAB l, OWNER o WHERE  (L.LIASO = O.SERIAL) AND (S.LAB = L.SERIAL) and (L.LAB ='" . $row2->LAB . "') AND (S.SUBNET = A.SUBNET) and (s.lab<6) and (av_server is not null) group by l.lab";
#echo $stmt3;
$stmtu = "Select count(a.ip_address) as counttotal, l.lab FROM  ARP_TABLE a, SUBNETS s, LAB l, OWNER o WHERE  (L.LIASO = O.SERIAL) AND (S.LAB = L.SERIAL) and (L.LAB ='" . $row2->LAB . "') AND (S.SUBNET = A.SUBNET) and (s.lab<6) and (update_server is not null) group by l.lab";
$sth = ibase_query($dbh, $stmt);
$sth3 = ibase_query($dbh, $stmt3);
$sthu = ibase_query($dbh, $stmtu);
$row = ibase_fetch_object($sth);
$row3 = ibase_fetch_object($sth3);
$rowu = ibase_fetch_object($sthu);
$totalmachines=$totalmachines + $row2->COUNTTOTAL;
$totalreds=$totalreds + $row->COUNTRED;
$totalnorton = $totalnorton + $row3->COUNTTOTAL;
$totalupdate = $totalupdate + $rowu->COUNTTOTAL;
echo '<tr>';
echo '<td>' . $row2->LAB  . '</td>' ;
echo '<td>' . $row2->COUNTTOTAL . '</td>';
echo '<td>' . ($row2->COUNTTOTAL - $row->COUNTRED) . '</td>';
echo '<td>' . $row->COUNTRED . '</td>';
echo '<td>' . round((($row2->COUNTTOTAL - $row->COUNTRED) / $row2->COUNTTOTAL * 100),2) . '</td>';
echo '<td>' . round(($row->COUNTRED / $row2->COUNTTOTAL * 100),2) . '</td>';
echo '<td>' . $row3->COUNTTOTAL . '</td>';
echo '<td>' . $rowu->COUNTTOTAL . '</td>';
echo '</tr>';
}
echo '<tr bgcolor="#FFFFAA">';
echo '<td><b>Total</b></td>' ;
echo '<td>' . $totalmachines . '</td>';
echo '<td>' . ($totalmachines - $totalreds) . '</td>';
echo '<td>' . $totalreds . '</td>';
echo '<td>' . round((($totalmachines - $totalreds) / $totalmachines * 100),2) . '</td>';
echo '<td>' . round(($totalreds / $totalmachines * 100),2) . '</td>';
echo '<td>' . $totalnorton . '</td>';
echo '<td>' . $totalupdate . '</td>';
echo '</tr>';
echo "</table>";
?>

Return current item: Network Asset Management Archive