function getItemForm($orderID) { global $FANNIE_OP_DB, $canEdit; $dbc = FannieDB::get($FANNIE_OP_DB); $ret = "<form onsubmit=\"addUPC();return false;\">"; $ret .= '<b>UPC</b>: <input type="text" id="newupc" maxlength="35" />'; $ret .= ' '; $ret .= '<b>Cases</b>: <input id="newcases" maxlength="2" value="1" size="3" />'; $ret .= ' '; $ret .= '<input type="submit" value="Add Item" />'; $ret .= ' '; $ret .= '<input type="submit" onclick="searchWindow();return false;" value="Search" />'; $ret .= '</form>'; $ret .= '<p />'; // find the order in pending or completed table $table = "PendingSpecialOrder"; if ($table == "PendingSpecialOrder" && $canEdit) { $ret .= editableItemList($orderID); } else { $ret .= itemList($orderID, $table); } // disable manual-close for now if ($canEdit && true) { $ret .= '<p />'; $ret .= '<b><a href="" onclick="$(\'#manualclosebuttons\').toggle();return false;">Manually close order</a></b>'; $ret .= sprintf('<span id="manualclosebuttons" style="display:none;"> as: <input type="submit" value="Completed" onclick="confirmC(%d,7);return false;" /> <input type="submit" value="Canceled" onclick="confirmC(%d,8);return false;" /> <input type="submit" value="Inquiry" onclick="confirmC(%d,9);return false;" /> <br /> <b style="color:red;">Closing an order means slips for these items will no longer scan at the registers</b></span>', $orderID, $orderID, $orderID); } return $ret; }
<?php require_once "session.php"; include "lib.php"; include "db.php"; if (isset($_GET[logout])) { logout(); } $upload_dir = "img"; $items = itemList(items); if (isset($_GET[id])) { $id = abs(clrInt($_GET[id])); delItem('items', $id); header('Location: admin.php'); } if (isset($_GET[order_id])) { $id = clrStr($_GET[order_id]); delItem('orders', $id); header('Location: admin.php'); } if ($_SERVER[REQUEST_METHOD] == "POST") { $name = clrStr($_POST['name']); $price = clrInt($_POST['price']); $photo = $_FILES['f']['name']; $quantity = clrInt($_POST['quantity']); $tmp_name = $_FILES['f']['tmp_name']; if (getItem($name, $price, $photo, $quantity)) { if (move_uploaded_file($tmp_name, "{$upload_dir}/{$photo}")) { header('Location: admin.php'); echo "Товар успешно добавлен!</br>"; }
protected function get_orderID_items_handler() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $ret = <<<HTML <form> <div class="form-inline"> <div class="input-group"> <span class="input-group-addon">UPC</span> <input type="text" id="newupc" class="form-control input-sm" maxlength="35" /> </div> <div class="input-group"> <span class="input-group-addon">Cases</span> <input id="newcases" maxlength="2" value="1" size="3" class="form-control input-sm" /> </div> <button type="submit" class="btn btn-default btn-sm">Add Item</button> <button type="button" class="btn btn-default btn-sm btn-search">Search</button> </div> </form> <p /> HTML; if (FannieAuth::validateUserQuiet('ordering_edit')) { $ret .= $this->editableItemList($this->orderID); } else { $ret .= itemList($this->orderID); } $ret .= '<p />'; $ret .= '<b><a href="" onclick="$(\'#manualclosebuttons\').toggle();return false;">Manually close order</a></b>'; $ret .= sprintf('<span id="manualclosebuttons" class="collapse"> as: <a href="" class="btn btn-default close-order-btn" data-close="7">Completed</a> <a href="" class="btn btn-default close-order-btn" data-close="8">Canceled</a> <a href="" class="btn btn-default close-order-btn" data-close="9">Inquiry</a> <br /> <div class="alert alert-danger">Closing an order means slips for these items will no longer scan at the registers</div></span>', $this->orderID, $this->orderID, $this->orderID); echo $ret; return false; }