<div id="main" class="span-24 last"> <h2>Administration</h2><h3>Stock</h3> <br /> <form action = "admin-stock.php" method = "get"> <label for="inv_item">Choose Inventory Item: </label> <span id="inv_item"> <input id="autocompleteItem" name="item"></input> </span> <input id="submitBTN" type="submit" value="Submit" /> </form> <?php if (isset($_GET['item'])) { try { $inv_stocks = Inv_stock::findByItem($_GET['item']); $item = new Inv_item($_GET['item']); printf("<br /><h3>%s - %s</h3><table><thead><tr><th>Branch</th><th>Quantity</th><th width=\"100\">Update</th></tr></thead><tbody>", $item->prepareId(), $item->prepareDescription()); foreach ($inv_stocks as $inv_stock) { $branch = new Branch($inv_stock->getBranchId()); printf("<tr><td>%s</td><td><input type=\"text\" value=\"%s\" /> %s</td><td><input class=\"updateBTN\" id=\"%s\" type=\"button\" value=\"Update\"/></td></tr>", $branch->prepareName() . " [" . $branch->prepareId() . "]", $inv_stock->getQuantity(), $item->prepareUnitOfMeasure(), $inv_stock->getId()); } echo "</tbody></table>"; } catch (fExpectedException $e) { echo $e->printMessage(); } } ?> </div> </div> <div id="messageBox" style="display: none;">Loading</div> <?php $tmpl->place('footer');
} printf("<table><thead><tr><th>Item ID</th><th>Description</th><th>Quantity</th></tr></thead><tbody>"); foreach ($inv_stocks as $inv_stock) { $inv_item = new Inv_item($inv_stock->getItemId()); printf("<tr><td>%s</td><td>%s</td><td>%s</td></tr>", $inv_item->prepareId(), $inv_item->prepareDescription(), $inv_stock->prepareQuantity() . " " . $inv_item->prepareUnitOfMeasure()); } echo "</tbody></table>"; } catch (fExpectedException $e) { echo $e->printMessage() . $inv_stock->getItemId(); } } else { if (isset($_GET['item'])) { try { $inv_stocks = Inv_stock::findByItem($_GET['item']); $item = new Inv_item($_GET['item']); printf("<br /><h3>%s - %s</h3><table><thead><tr><th>Branch</th><th>Quantity</th></tr></thead><tbody>", $item->prepareId(), $item->prepareDescription()); foreach ($inv_stocks as $inv_stock) { $branch = new Branch($inv_stock->getBranchId()); printf("<tr><td>%s</td><td>%s</td></tr>", $branch->prepareName() . " [" . $branch->prepareId() . "]", $inv_stock->prepareQuantity() . " " . $item->prepareUnitOfMeasure()); } echo "</tbody></table>"; } catch (fExpectedException $e) { echo $e->printMessage(); } } } ?> </div> </div> <?php $tmpl->place('footer');