} $units = ''; if (isset($_POST["units"][$i])) { $units = $_POST["units"][$i]; } $vendor = ''; if (isset($_POST["vendor"][$i])) { $vendor = $_POST["vendor"][$i]; } $ppo = ''; if (isset($_POST["ppo"][$i])) { $ppo = $_POST["ppo"][$i]; } $tag->id($id); $tag->upc($upc); $tag->description($desc); $tag->normal_price($price); $tag->brand($brand); $tag->sku($sku); $tag->size($size); $tag->units($units); $tag->vendor($vendor); $tag->pricePerUnit($ppo); $tag->save(); } header("Location: index.php"); return; } echo "<html><head><title>Edit shelftags</title>\n<style type=text/css>\n.one {\n background: #ffffff;\n}\n.two {\n background: #ffffcc;\n}\n</style></head>"; echo "<form action=edit.php method=post>"; echo "<table cellspacing=0 cellpadding=4 border=1>";
function post_createBatch_handler() { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $type = $this->form->batchType; $name = $this->form->batchName; $startdate = $this->form->startDate; $enddate = $this->form->endDate; $owner = $this->form->batchOwner; $priority = 0; $upcs = $this->form->upc; $prices = $this->form->price; $btype = new BatchTypeModel($dbc); $btype->batchTypeID($type); if (!$btype->load()) { echo 'Invalid Batch Type ' . $type; return false; } $discounttype = $btype->discType(); // make sure item data is present before creating batch if (!is_array($upcs) || !is_array($prices) || count($upcs) != count($prices) || count($upcs) == 0) { echo 'Invalid item data'; return false; } $batch = new BatchesModel($dbc); $batch->startDate($startdate); $batch->endDate($enddate); $batch->batchName($name); $batch->batchType($type); $batch->discountType($discounttype); $batch->priority($priority); $batch->owner($owner); $batchID = $batch->save(); if ($this->config->get('STORE_MODE') === 'HQ') { StoreBatchMapModel::initBatch($batchID); } if ($dbc->tableExists('batchowner')) { $insQ = $dbc->prepare_statement("insert batchowner values (?,?)"); $insR = $dbc->exec_statement($insQ, array($batchID, $owner)); } // add items to batch for ($i = 0; $i < count($upcs); $i++) { $upc = $upcs[$i]; $price = isset($prices[$i]) ? $prices[$i] : 0.0; $list = new BatchListModel($dbc); $list->upc(BarcodeLib::padUPC($upc)); $list->batchID($batchID); $list->salePrice($price); $list->groupSalePrice($price); $list->active(0); $list->pricemethod(0); $list->quantity(0); $list->save(); } /** If tags were requested and it's price change batch, make them Lookup vendor info for each item then add a shelftag record */ $tagset = $this->form->tagset; if ($discounttype == 0 && $tagset !== '') { $vendorID = $this->form->preferredVendor; $tag = new ShelftagsModel($dbc); $product = new ProductsModel($dbc); for ($i = 0; $i < count($upcs); $i++) { $upc = $upcs[$i]; $price = isset($prices[$i]) ? $prices[$i] : 0.0; $product->upc($upc); $info = $product->getTagData($price); $tag->id($tagset); $tag->upc($upc); $tag->description($info['description']); $tag->normal_price($price); $tag->brand($info['brand']); $tag->sku($info['sku']); $tag->size($info['size']); $tag->units($info['units']); $tag->vendor($info['vendor']); $tag->pricePerUnit($info['pricePerUnit']); $tag->save(); } } return 'Location: newbatch/BatchManagementTool.php?startAt=' . $batchID; }
private function addToPos($upc, $vid, $price, $dept, $tags = -1) { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $p = $dbc->prepare_statement("SELECT i.*,v.vendorName FROM vendorItems AS i\n LEFT JOIN vendors AS v ON v.vendorID=i.vendorID\n WHERE i.vendorID=? AND upc=?"); $vinfo = $dbc->exec_statement($p, array($vid, $upc)); $vinfo = $dbc->fetch_row($vinfo); $p = $dbc->prepare_statement("SELECT * FROM departments WHERE dept_no=?"); $dinfo = $dbc->exec_statement($p, array($dept)); $dinfo = $dbc->fetch_row($dinfo); $model = new ProductsModel($dbc); $model->upc(BarcodeLib::padUPC($upc)); $model->description($vinfo['description']); $model->normal_price($price); $model->department($dept); $model->tax($dinfo['dept_tax']); $model->foodstamp($dinfo['dept_fs']); $model->cost($vinfo['cost']); $model->default_vendor_id($vid); $model->brand($vinfo['brand']); $model->store_id(1); $model->save(); $xInsQ = $dbc->prepare_statement("INSERT INTO prodExtra (upc,manufacturer,distributor,cost,margin,variable_pricing,location,\n case_quantity,case_cost,case_info) VALUES\n (?,?,?,?,0.00,0,'','',0.00,'')"); $args = array($upc, $vinfo['brand'], $vinfo['vendorName'], $vinfo['cost']); $dbc->exec_statement($xInsQ, $args); if ($tags !== -1) { $tag = new ShelftagsModel($dbc); $tag->id($tags); $tag->upc($upc); $info = $model->getTagData(); $tag->normal_price($info['normal_price']); $tag->description($info['description']); $tag->brand($info['brand']); $tag->vendor($info['vendor']); $tag->sku($info['sku']); $tag->size($info['size']); $tag->units($info['units']); $tag->pricePerUnit($info['pricePerUnit']); $tag->save(); } echo "Item added"; }
public function delete_id_upc_view() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $tag = new ShelftagsModel($dbc); $tag->id($this->id); $tag->upc(BarcodeLib::padUPC($this->upc)); $tag->load(); $ret = <<<HTML <form action="{{SELF}}" method="post"> <div class="panel panel-default"> <div class="panel-heading">Selected Tag</div> <div class="panel-body"> {{upc}} - {{brand}} {{description}} </div> </div> <div class="panel panel-default"> <div class="panel-heading">Delete</div> <div class="panel-body"> <div class="form-group"> <a href="?_method=delete&id={{id}}&upc={{upc}}&confirm=1" class="btn btn-danger"> {{ICON}} Remove Tag from Queue </a> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading">Move</div> <div class="panel-body"> <div class="form-group"> <label>Move to another Queue</label> <select name="newID" class="form-control"> {{QUEUES}} </select> </div> <div class="form-group"> <button class="btn btn-default" type="submit">Move Tag</button> </div> <input type="hidden" name="oldID" value="{{id}}" /> <input type="hidden" name="upc" value="{{upc}}" /> </div> </div> </form> HTML; $queues = new ShelfTagQueuesModel($dbc); $ret = str_replace('{{SELF}}', $_SERVER['PHP_SELF'], $ret); $ret = str_replace('{{id}}', $this->id, $ret); $ret = str_replace('{{upc}}', $this->upc, $ret); $ret = str_replace('{{brand}}', $tag->brand(), $ret); $ret = str_replace('{{description}}', $tag->description(), $ret); $ret = str_replace('{{QUEUES}}', $queues->toOptions(), $ret); $ret = str_replace('{{ICON}}', \COREPOS\Fannie\API\lib\FannieUI::deleteIcon(), $ret); return $ret; }
$price = FormLib::get_form_value('price', 0); $model = new BatchListModel($dbc); $model->batchID($bid); $model->upc($upc); $model->salePrice($price); $model->pricemethod(0); $model->quantity(0); $model->save(); $product = new ProductsModel($dbc); $product->upc($upc); $info = $product->getTagData($price); /* create a shelftag */ $tag = new ShelftagsModel($dbc); $tag->id($sid); $tag->upc($upc); $tag->description($info['description']); $tag->normal_price($price); $tag->brand($info['brand']); $tag->sku($info['sku']); $tag->size($info['size']); $tag->units($info['units']); $tag->vendor($info['vendor']); $tag->pricePerUnit($info['pricePerUnit']); $tag->save(); break; case 'batchDel': $vid = FormLib::get_form_value('vendorID'); $bid = FormLib::get_form_value('batchID'); $sid = FormLib::get_form_value('queueID', 0); if ($sid == 99) { $sid = 0;
protected function updateShelftagItem($upc, $brand, $description) { $dbc = $this->getDB(); $model = new \ShelftagsModel($dbc); $model->id($this->source_id); $model->upc(\BarcodeLib::padUPC($upc)); $model->brand($brand); $model->description($description); return $model->save(); }
if ($units == '') { $units = 'NULL'; } $size = $_REQUEST['size']; $ppo = $_REQUEST['ppo']; $vendor = $_REQUEST['vendor']; $sku = $_REQUEST['sku']; $price = $_REQUEST['price']; $id = $_REQUEST['subID']; $count = FormLib::get('count', 1); $shelftag = new ShelftagsModel($dbc); $shelftag->id($id); $shelftag->upc($upc); $shelftag->normal_price($price); $shelftag->pricePerUnit($ppo); $shelftag->description($description); $shelftag->brand($brand); $shelftag->sku($sku); $shelftag->size($size); $shelftag->units($units); $shelftag->vendor($vendor); $shelftag->count($count); $insR = $shelftag->save(); ?> <!doctype html> <html> <head> <title>Add Shelf Tag</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="../src/javascript/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../src/javascript/bootstrap-default/css/bootstrap.min.css">