I updated this version to add links for the server name. However, one thing I noticed even before making the update, was that I only get a list generated for the very first query (expired). Is anyone else seeing this issue or is it a local issue? I get the tables generated for 30, 60, 90 days sections just no servers listed like the query is blank. I verified that the query's do work by themselves. I even moved the queries around and it will only generate a complete table with servers listed for the very first query all others are just blank tables with the headers. Any Ideas? Also, I noticed that the queries for 30, 60, 90 days will also return the expired items. I think there needs to be some more logic in the each of the 30, 60, 90 day queries to filter the previous tables items. I didn't fix that yet. Thanks, Ernie
<?php //Warranty $tab['reports']['mytab3'] = 'Warranty Expires'; $tabhandler['reports']['mytab3'] = 'getMyServers3'; function displayHeader () { echo "<th align=center>Count</th>"; echo "<th align=center>Name</th>"; echo "<th align=center>Barcode</th>"; echo "<th align=center>Assett Tag</th>"; echo "<th align=center>Date Warranty <br> Expires</th>"; $count = 0; } function displayTable ($row) { echo "<tr>"; printf("<td>%s</td>", $count += 1); echo "<td><a href='".makeHref(array('page'=>'object', 'object_id'=>$row['id']))."'>${row['name']}</a></td>"; printf("<td>%s</td>", $row['barcode']); printf("<td>%s</td>", $row['asset_no']); printf("<td>%s</td>", $row['string_value']); echo "</tr>\n"; } function getMyServers3 () { $query = "SELECT a.string_value, r.id, r.name, r.barcode, r.asset_no FROM AttributeValue a Left JOIN RackObject r ON a.object_id = r.id where a.attr_id=22 and STR_TO_DATE(a.string_value, '%m/%d/%Y') < curdate() "; $result = useSelectBlade ($query, __FUNCTION__); echo "<style type='text/css'>\n"; echo "tr.has_problems {\n"; echo "background-color: #ffa0a0;\n"; echo "}\n"; echo "</style>\n"; echo " <center> <h3> Warranty Has Expired</h3><br>"; echo "<table align=center border=1><tr valign=top>"; displayHeader(); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { displayTable($row); } echo "</table>\n"; $query = "SELECT a.string_value, r.name, r.barcode, r.asset_no FROM AttributeValue a Left JOIN RackObject r ON a.object_id = r.id where a.attr_id=22 and STR_TO_DATE(a.string_value, '%m/%d/%Y') < curdate() "; $result = useSelectBlade ($query, __FUNCTION__); echo "<style type='text/css'>\n"; echo "tr.has_problems {\n"; echo "background-color: #ffa0a0;\n"; echo "}\n"; echo "</style>\n"; echo " <center> <h3> Warranty expires within 30 Days </h3><br>"; echo "<table align=center border=1><tr valign=top>"; displayHeader(); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { displayTable($row); } echo "</table>\n"; $query = "SELECT a.string_value, r.name, r.barcode, r.asset_no FROM AttributeValue a Left JOIN RackObject r ON a.object_id = r.id where a.attr_id=22 and STR_TO_DATE(a.string_value, '%m/%d/%Y') < DATE_ADD(curdate(), INTERVAL 60 DAY) "; $result = useSelectBlade ($query, __FUNCTION__); echo "<style type='text/css'>\n"; echo "tr.has_problems {\n"; echo "background-color: #ffa0a0;\n"; echo "}\n"; echo "</style>\n"; echo " <center> <h3> Warranty expires within 60 Days </h3><br>"; echo "<table align=center border=1><tr valign=top>"; displayHeader(); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { displayTable($row); } echo "</table>\n"; $query = "SELECT a.string_value, r.name, r.barcode, r.asset_no FROM AttributeValue a Left JOIN RackObject r ON a.object_id = r.id where a.attr_id=22 and STR_TO_DATE(a.string_value, '%m/%d/%Y') < DATE_ADD(curdate(), INTERVAL 90 DAY) "; $result = useSelectBlade ($query, __FUNCTION__); echo "<style type='text/css'>\n"; echo "tr.has_problems {\n"; echo "background-color: #ffa0a0;\n"; echo "}\n"; echo "</style>\n"; echo " <center> <h3> Warranty expires within 90 Days </h3><br>"; echo "<table align=center border=1><tr valign=top>"; displayHeader(); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { displayTable($row); } echo "</table>\n"; } ?>
On Jan 25, 2010, at 12:10 PM, Lacayo, Luis F wrote: > Hi All, > > I saw this on the list, and I modified it a little bit. This is a > report that will tell you the servers (you can add others) which have > the warranty expiration in 3 sections. > > Expired, with-in 30, 60 and 90 days. This is a little bit more useful > to us so we can plan for replacements or extend the warranty contract. > > I am sorry but I deleted the email of the original contributor so I am > not able to give credit to the correct individual. (but you know who you > are!!) > > Thanks, > > Luis > <rack_warr.php>