<?php
include "header.php";
include "conn.php";
?>
<script language="javascript">
<!--
var state = 'none';
function showhide(layer_ref) {
if (state == 'block') {
state = 'none';
}
else {
state = 'block';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}
}
//-->
</script>
<table width="*" border="0" align="center" cellpadding="1" cellspacing="0">
<tr class="tableTitle">
<td width="135">Part #</td>
<td width="50">Rev</td>
<td width="152">Customer Name</td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action=""><input name="partNum" type="text" /></td>
<td> <input name="partRev" type="text" size="1" /></td>
<td><input name="customerName" type="text" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="right"><input type="submit" name="Search" value="Search" /></form></td>
</tr>
</table>
<br />
<br />
<div align="center" class="title1" >Inventory Database</div>
<br />
<?php
// Lets count how many parts we have in stock
$invcnt = mysql_fetch_row(mysql_query("SELECT COUNT(*) AS count FROM invDB"));
echo "<div align=\"center\">Total Parts:". $invcnt[0];
$result = mysql_query('SELECT quant FROM invDB');
if (mysql_num_rows($result) > 0) {
while ($myrow = mysql_fetch_array($result)) {
$sum[] = $myrow['quant']; // sum
}
$sum = array_sum($sum);
print " Total Quantity: $sum</div>";
}
?>
<div align="right" class="link2"><a href="#" onclick="showhide('addItem');">ADD NEW ITEM <img height="11" width="11" border="0" src="/images/plus-glow.png" /></a></div>
<table width="800" border="1" cellspacing="0" cellpadding="0">
<tr class="tableTitle">
<td width="130">Part # <a href="index.php?id=SortPartDown"><img height="11" border="0" width="11" src="/images/arrow-down-glow.png" /></a> <a href="index.php?id=SortPartUp"><img height="11" border="0" width="11" src="/images/arrow-up-glow.png" /></a></td>
<td width="40">Rev</td>
<td width="100">Quantity <a href="index.php?id=SortQuantDown"><img height="11" border="0" width="11" src="/images/arrow-down-glow.png" /></a> <a href="index.php?id=SortQuantUp"><img height="11" border="0" width="11" src="/images/arrow-up-glow.png" /></a></td>
<td width="200">Customer Name <a href="index.php?id=SortCustDown"><img height="11" border="0" width="11" src="/images/arrow-down-glow.png" /></a> <a href="index.php?id=SortCustUp"><img height="11" border="0" width="11" src="/images/arrow-up-glow.png" /></a></td>
<td width="55">Bin</td>
<td width="55">Shelf</td>
<td width="220">Special Notes</td>
</tr>
<?php
//lets fetch all the current Item's
$query_1 = mysql_query("SELECT * FROM invDB");
while($row_1 = mysql_fetch_array($query_1)){
//Ok lets put it all together and put it in a nice little table :)
echo "<tr>\n <td><a href=\"part.php?id=". $row_1['partNum']. "\">". $row_1['partNum']. "</a></td>";
echo "\n <td>". $row_1['revNum']. "</td>";
echo "\n <td>". $row_1['quant']. "</td>";
echo "\n <td>". $row_1['customerName']. "</td>";
echo "\n <td>". $row_1['bin']. "</td>";
echo "\n <td>". $row_1['shelf']. "</td>";
echo "\n <td>". $row_1['specialNotes']. "</td>";
echo "</tr>\n";
}
// were done lets end the table.
echo "</table>";
// Lets close out of php and build the popup window to add new items
?>
<div id="addItem" style="display: none; position: absolute; left:245px; top:300px; background-color:#4D535D;">
<table border="5" bordercolor="#CCCCCC" width="300" height="200"cellpadding="0" cellspacing="0"><tr><td>
<table width="300" height="200" border="0" cellpadding="0" cellspacing="0">
<tr><td width="289" height="22" align="center" class="title1">ADD NEW ITEM</td>
<td><a href="#" onclick="showhide('addItem');"><img height="22" border="0" width="22" src="/images/cross-glow.png" /></a></td>
</tr>
<tr><td colspan="2" align="center">
<form method="post" action="additem.php">
<table>
<tr><td align="left">Part Number:</td><td><input name="partNum" type="text" /></td></tr>
<tr><td align="left">Rev:</td><td><input name="rev" type="text" /></td></tr>
<tr><td align="left">Quantity:</td><td><input name="quant" type="text" /></td></tr>
<tr><td align="left">Customer Name:</td><td><input name="custName" type="text" /></td></tr>
<tr><td align="left">Bin:</td><td><input name="bin" type="text" /></td></tr>
<tr><td align="left">Shelf:</td><td><input name="shelf" type="text" /></td></tr>
<tr><td colspan="2" align="left">Special Notes:</td></tr>
<tr><td colspan="2"><textarea name="snotes" cols="31" rows="3"></textarea><br />
<input type="submit" name="AddItem" value="Add Item" />
</td></tr></table>
</form>
</td></tr></table>
</td></tr></table>
</div>
<?php
// Lets close out of php and build the popup window for items instock
?>
<div id="partInf" style="display: none; position: absolute; left:245px; top:300px; background-color:#4D535D;">
<table border="5" bordercolor="#CCCCCC" width="300" height="200"cellpadding="0" cellspacing="0"><tr><td>
<table width="300" height="200" border="0" cellpadding="0" cellspacing="0">
<tr><td width="289" height="22" align="center" class="title1">ADD NEW ITEM</td>
<td><a href="#" onclick="showhide('addItem');"><img height="22" border="0" width="22" src="/images/cross-glow.png" /></a></td>
</tr>
<tr><td colspan="2" align="center">
<form method="post" action="additem.php">
<table>
<tr><td align="left">Part Number:</td><td><input name="partNum" type="text" /></td></tr>
<tr><td align="left">Rev:</td><td><input name="rev" type="text" /></td></tr>
<tr><td align="left">Quantity:</td><td><input name="quant" type="text" /></td></tr>
<tr><td align="left">Customer Name:</td><td><input name="custName" type="text" /></td></tr>
<tr><td align="left">Bin:</td><td><input name="bin" type="text" /></td></tr>
<tr><td align="left">Shelf:</td><td><input name="shelf" type="text" /></td></tr>
<tr><td colspan="2" align="left">Special Notes:</td></tr>
<tr><td colspan="2"><textarea name="snotes" cols="31" rows="3"></textarea><br />
<input type="submit" name="AddItem" value="Add Item" />
</td></tr></table>
</form>
</td></tr></table>
</td></tr></table>
</div>
<?php
include "footer.php";
?>