public function report_description_content() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $prod = new ProductsModel($dbc); $prod->upc(BarcodeLib::padUPC($this->form->upc)); $prod->load(); return array('Weekly Sales For ' . $prod->upc() . ' ' . $prod->description()); }
public function report_description_content() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $prod = new ProductsModel($dbc); $prod->upc(BarcodeLib::padUPC(FormLib::get('upc'))); $prod->load(); $ret = array('Recent Sales For ' . $prod->upc() . ' ' . $prod->description() . '<br />'); if ($this->report_format == 'html') { $ret[] = sprintf('<a href="../ItemLastQuarter/ItemLastQuarterReport.php?upc=%s">Weekly Sales Details</a> | ', $prod->upc()); $ret[] = sprintf('<a href="../ItemOrderHistory/ItemOrderHistoryReport.php?upc=%s">Recent Order History</a>', $prod->upc()); } return $ret; }
public function testItemFlags() { $config = FannieConfig::factory(); $connection = FannieDB::get($config->OP_DB); /** Setup preconditions for the test */ $upc = BarcodeLib::padUPC('16'); $product = new ProductsModel($connection); $product->upc($upc); $product->store_id(0); $product->load(); if ($product->numflag() != 0) { $product->numflag(0); } $product->save(); $module = new ItemFlagsModule(); $module->setConnection($connection); $module->setConfig($config); $form = new \COREPOS\common\mvc\ValueContainer(); $module->setForm($form); $saved = $module->saveFormData($upc); $this->assertEquals(true, $saved, 'Handled empty input'); $product->reset(); $product->upc($upc); $product->load(); $this->assertEquals(0, $product->numflag(), 'Wrong numflag value ' . $product->numflag()); /** Simulate real form input */ $form = new \COREPOS\common\mvc\ValueContainer(); $form->flags = array(1, 3); // 0b101 == 5 $module->setForm($form); $saved = $module->saveFormData($upc); $this->assertEquals(true, $saved, 'Saving item flags failed'); $product->reset(); $product->upc($upc); $product->load(); $this->assertEquals(5, $product->numflag(), 'Wrong numflag value ' . $product->numflag()); /* put record back to normal */ $product->numflag(0); $product->save(); $form = new \COREPOS\common\mvc\ValueContainer(); $form->flags = 'not_an_array'; $module->setForm($form); $saved = $module->saveFormData($upc); $this->assertEquals(false, $saved, 'Accepted invalid input'); }
function preprocess() { global $FANNIE_OP_DB; if (FormLib::get_form_value('deptStart', False) !== false) { $start = FormLib::get_form_value('deptStart'); $end = FormLib::get_form_value('deptEnd'); $pageID = FormLib::get_form_value('sID', 0); $dbc = FannieDB::get($FANNIE_OP_DB); $prodP = $dbc->prepare_statement("\n SELECT p.upc\n FROM products AS p\n WHERE p.department BETWEEN ? AND ?\n "); $prodR = $dbc->exec_statement($prodP, array($start, $end)); $tag = new ShelftagsModel($dbc); $product = new ProductsModel($dbc); while ($row = $dbc->fetch_row($prodR)) { $product->upc($row['upc']); $info = $product->getTagData(); $tag->id($pageID); $tag->upc($row['upc']); $tag->setData($info); $tag->save(); } $this->msgs = sprintf('<em>Created tags for departments #%d through #%d</em> <br /><a href="ShelfTagIndex.php">Home</a>', $start, $end); } return true; }
public function get_id_view() { $dbc = FannieDB::get($this->config->get('OP_DB')); $model = new ProductsModel($dbc); $model->upc(BarcodeLib::padUPC($this->id)); if (!$model->load()) { return '<div class="alert alert-danger">Item ' . $this->id . ' does not exist</dv>'; } $ret = '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <input type="hidden" name="id" value="' . $model->upc() . '" /> <p> Create a copy of ' . $model->upc() . ' (' . $model->description() . ') </p> <div class="form-group"> <label>New Item UPC</label> <input type="text" name="new-upc" class="form-control" id="new-upc" required /> </div> <p> <button type="submit" class="btn btn-default">Clone Item</button> </p> </form>'; $this->addOnloadCommand("enableLinea('#new-upc');\n"); $this->addOnloadCommand("\$('#new-upc').focus();\n"); return $ret; }
function post_id_handler() { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $upc = BarcodeLib::padUPC($this->id); $model = new ProductsModel($dbc); $model->upc($upc); $model->store_id(1); $model->discounttype(0); $model->special_price(0); $model->modified(date('Y-m-d H:i:s')); $model->save(); $batchID = FormLib::get_form_value('batchID'); $batchUPC = FormLib::get_form_value('batchUPC'); if ($batchID !== '' && $batchUPC !== '') { if (substr($batchUPC, 0, 2) != 'LC') { $batchUPC = BarcodeLib::padUPC($batchUPC); } $batchP = $dbc->prepare_statement('DELETE FROM batchList WHERE upc=? AND batchID=?'); $batchR = $dbc->exec_statement($batchP, array($batchUPC, $batchID)); } require 'laneUpdates.php'; updateProductAllLanes($upc); header('Location: ItemEditorPage.php?searchupc=' . $upc); return False; }
function unsale($batchID) { global $sql, $FANNIE_SERVER_DBMS; if ($FANNIE_SERVER_DBMS == "MSSQL") { $unsale1Q = $sql->prepare("update products set special_price=0,\n discounttype=0,start_date='',end_date='',\n specialpricemethod=0,specialquantity=0,\n specialgroupprice=0\n from\n products as p left join\n batchlist as b on p.upc=b.upc\n where b.batchID=?"); $unsale2Q = $sql->prepare("update products set special_price=0,\n discounttype=0,start_date='',end_date='',\n specialpricemethod=0,specialquantity=0,\n specialgroupprice=0\n from products as p left join\n upcLike as v on v.upc=p.upc left join\n batchlist as l on l.upc='LC'+convert(varchar,v.likecode)\n left join batches as b on b.batchID = l.batchID\n where b.batchID=?"); $sql->execute($unsale1Q, array($batchID)); $sql->execute($unsale2Q, array($batchID)); } else { $unsale1Q = $sql->prepare("update products as p\n left join batchList as b ON p.upc=b.upc\n set special_price=0,\n p.discounttype=0,start_date='',end_date='',\n specialpricemethod=0,specialquantity=0,\n specialgroupprice=0\n where b.batchID=?"); $unsale2Q = $sql->prepare("update products as p left join\n upcLike as v on v.upc=p.upc left join\n batchList as l on l.upc=concat('LC',convert(v.likeCode,char))\n left join batches as b on b.batchID = l.batchID\n set special_price=0,\n p.discounttype=0,start_date='',end_date='',\n specialpricemethod=0,specialquantity=0,\n specialgroupprice=0\n where b.batchID=?"); $sql->execute($unsale1Q, array($batchID)); $sql->execute($unsale2Q, array($batchID)); } $q = $sql->prepare("SELECT upc FROM batchList WHERE batchID=?"); $r = $sql->execute($q, array($batchID)); $q2 = $sql->prepare("SELECT upc FROM upcLike WHERE likeCode=?"); while ($w = $sql->fetch_row($r)) { $upcs = array($w['upc']); if (substr($w['upc'], 0, 2) == 'LC') { $upcs = array(); $lc = substr($w['upc'], 2); $r2 = $sql->execute($q2, array($lc)); while ($w2 = $sql->fetch_row($r2)) { $upcs[] = $w2['upc']; } } foreach ($upcs as $u) { $model = new ProductsModel(); $model->upc($u); $model->pushToLanes(); } } }
function preprocess() { global $FANNIE_OP_DB; $this->title = _("Fannie") . ' : ' . _("Manufacturer Shelf Tags"); $this->header = _("Manufacturer Shelf Tags"); if (FormLib::get_form_value('manufacturer', False) !== false) { $manu = FormLib::get_form_value('manufacturer'); $pageID = FormLib::get_form_value('sID', 0); $cond = ""; if (is_numeric($_REQUEST['manufacturer'])) { $cond = " p.upc LIKE ? "; } else { $cond = " p.brand LIKE ? "; } $dbc = FannieDB::get($FANNIE_OP_DB); $prodP = $dbc->prepare_statement("\n SELECT\n p.upc\n FROM\n products AS p\n WHERE {$cond}\n "); $prodR = $dbc->exec_statement($prodP, array('%' . $manu . '%')); $tag = new ShelftagsModel($dbc); $product = new ProductsModel($dbc); while ($prodW = $dbc->fetch_row($prodR)) { $product->upc($prodW['upc']); $info = $product->getTagData(); $tag->id($pageID); $tag->upc($prodW['upc']); $tag->setData($info); $tag->save(); } $this->msgs = '<em>Created tags for manufacturer</em> <br /><a href="ShelfTagIndex.php">Home</a>'; } return true; }
public function get_id_confirm_view() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $upc = BarcodeLib::padUPC($this->id); $model = new ProductsModel($dbc); $model->upc($upc); foreach ($model->find('store_id') as $obj) { $obj->delete(); } if (substr($upc, 0, 3) == '002') { $scaleQ = $dbc->prepare_statement("DELETE FROM scaleItems WHERE plu=?"); $dbc->exec_statement($scaleQ, array($upc)); $plu = substr($upc, 3, 4); \COREPOS\Fannie\API\item\HobartDgwLib::deleteItemsFromScales($plu); \COREPOS\Fannie\API\item\EpScaleLib::deleteItemsFromScales($plu); } $userP = $dbc->prepare("DELETE FROM productUser WHERE upc=?"); $dbc->execute($userP, array($upc)); if ($dbc->tableExists('prodExtra')) { $extraP = $dbc->prepare("DELETE FROM prodExtra WHERE upc=?"); $dbc->execute($extraP, array($upc)); } return '<div class="alert alert-success">Item deleted</div>'; }
function preprocess() { global $FANNIE_OP_DB; // custom: can delete items from report results if (isset($_REQUEST['deleteItem'])) { $upc = FormLib::get_form_value('deleteItem', ''); if (is_numeric($upc)) { $upc = BarcodeLib::padUPC($upc); } $dbc = FannieDB::get($FANNIE_OP_DB); $model = new ProductsModel($dbc); $model->upc($upc); $model->store_id(1); $model->delete(); echo 'Deleted'; return false; } elseif (FormLib::get('deactivate') !== '') { $upc = BarcodeLib::padUPC(FormLib::get('deactivate')); $dbc = FannieDB::get($FANNIE_OP_DB); $model = new ProductsModel($dbc); $model->upc($upc); $model->store_id(1); $model->inUse(0); $model->save(); echo 'Deactivated'; } $ret = parent::preprocess(); // custom: needs extra JS for delete option if ($this->content_function == 'report_content' && $this->report_format == 'html') { $this->add_script("../../src/javascript/jquery.js"); $this->add_script('delete.js'); } return $ret; }
/** Helper: create a vendorItems record for an existing product if one does not exist */ public function createIfMissing($upc, $vendorID) { // look for entry directly by UPC or via SKU mapping $findP = $this->connection->prepare(' SELECT v.upc FROM vendorItems AS v LEFT JOIN vendorSKUtoPLU AS m ON v.vendorID=m.vendorID AND v.sku=m.sku WHERE v.vendorID=? AND (v.upc=? OR m.upc=?)'); $findR = $this->connection->execute($findP, array($vendorID, $upc, $upc)); if ($this->connection->num_rows($findR) == 0) { // create item from product $prod = new ProductsModel($this->connection); $prod->upc($upc); $prod->load(); $vend = new VendorItemsModel($this->connection); $vend->vendorID($vendorID); $vend->upc($upc); $vend->sku($upc); $vend->brand($prod->brand()); $vend->description($prod->description()); $vend->cost($prod->cost()); $vend->saleCost(0); $vend->vendorDept(0); $vend->units(1); $vend->size($prod->size() . $prod->unitofmeasure()); $vend->save(); } }
function process_file($linedata) { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $upc_index = $this->get_column_index('upc'); $price_index = $this->get_column_index('price'); $cool_index = $this->get_column_index('cool'); $itemP = $dbc->prepare(' SELECT itemdesc, description, weight FROM scaleItems AS s LEFT JOIN products AS p ON s.plu=p.upc WHERE plu=?'); $saveP = $dbc->prepare(' UPDATE scaleItems SET price=?, itemdesc=?, modified=' . $dbc->now() . ' WHERE plu=?'); $product = new ProductsModel($dbc); $prodPricing = FormLib::get('prodPricing') === '' ? false : true; $scale_items = array(); foreach ($linedata as $line) { $upc = trim($line[$upc_index]); $upc = BarcodeLib::padUPC($upc); $price = str_replace('$', '', $line[$price_index]); $price = trim($price); $cool = $line[$cool_index]; if (!is_numeric($upc) || !is_numeric($price)) { continue; } $item = $dbc->getRow($itemP, array($upc)); if ($item === false) { continue; } $itemdesc = !empty($item['itemdesc']) ? $item['itemdesc'] : $item['description']; if (strstr($itemdesc, "\n")) { list($line1, $line2) = explode("\n", $itemdesc); $itemdesc = $line1 . "\n" . $cool; } else { $itemdesc .= "\n" . $cool; } $dbc->execute($itemP, array($price, $itemdesc, $upc)); if ($prodPricing) { $product->upc($upc); foreach ($product->find() as $obj) { $obj->normal_price($price); $obj->save(); } } $scale_info = array('RecordType' => 'ChangeOneItem', 'PLU' => substr($upc, 3, 4), 'Description' => $itemdesc, 'Price' => $price, 'Type' => $item['weight'] == 0 ? 'Random Weight' : 'Fixed Weight', 'ReportingClass' => 1); $scale_items[] = $scale_info; } $scales = $this->getScales(FormLib::get('scales')); HobartDgwLib::writeItemsToScales($scale_items, $scales); EpScaleLib::writeItemsToScales($scale_items, $scales); return true; }
public function get_id_break_handler() { $dbc = FannieDB::get($this->config->get('OP_DB')); $model = new VendorBreakdownsModel($dbc); $model->vendorID($this->id); $original = new VendorItemsModel($dbc); $product = new ProductsModel($dbc); foreach ($model->find() as $obj) { $original->vendorID($this->id); $original->sku($obj->sku()); if (!$original->load()) { $this->addOnloadCommand("showBootstrapAlert('#alert-area', 'danger', 'Vendor SKU #" . $obj->sku() . " not found');\n"); continue; } $split_factor = false; $unit_size = ''; if (preg_match('/^\\d+$/', $original->size())) { $split_factor = $original->size(); } elseif (preg_match('/(\\d+)\\s*\\/\\s*(.+)/', $original->size(), $matches)) { $split_factor = $matches[1]; $unit_size = $matches[2]; } elseif (preg_match('/(\\d+)\\s*CT/', $original->size(), $matches)) { $split_factor = $matches[1]; } elseif (preg_match('/(\\d+)\\s*PKT/', $original->size(), $matches)) { $split_factor = $matches[1]; } if (!$split_factor) { $this->addOnloadCommand("showBootstrapAlert('#alert-area', 'danger', 'Vendor SKU #" . $original->size() . " cannot be broken down');\n"); continue; } // add an entry using the store UPC/PLU in place of the vendor SKU // since two records from the same vendor with same SKU are not // permitted in the table $original->sku($obj->upc()); $original->upc($obj->upc()); $original->units(1); $original->size($unit_size); $original->cost($original->cost() / $split_factor); $original->saleCost($original->saleCost() / $split_factor); if ($original->save()) { // update cost in products table, too $product->reset(); $product->upc($obj->upc()); foreach ($product->find('store_id') as $p) { if ($p->load() && $p->default_vendor_id() == $this->id) { $p->cost($original->cost()); $p->save(); $original->description($p->description()); $original->save(); } } } else { $this->addOnloadCommand("showBootstrapAlert('#alert-area', 'success', 'Error saving vendor SKU #" . $obj->sku() . "');\n"); } } return true; }
public function report_description_content() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $prod = new ProductsModel($dbc); $prod->upc(BarcodeLib::padUPC($this->form->upc)); $prod->load(); $ret = array('Order History For ' . $prod->upc() . ' ' . $prod->description()); if (FormLib::get('all')) { $ret[] = 'All [known] orders'; if ($this->report_format = 'html') { $ret[] = sprintf('<a href="ItemOrderHistoryReport.php?upc=%s">Show Recent</a>', $prod->upc()); } } else { $ret[] = 'Since ' . date('F d, Y', strtotime('92 days ago')); if ($this->report_format = 'html') { $ret[] = sprintf('<a href="ItemOrderHistoryReport.php?upc=%s&all=1">Show All</a>', $prod->upc()); } } return $ret; }
public function mergeDescription() { if ($this->itemdesc() != '') { return $this->itemdesc(); } else { $p = new ProductsModel($this->connection); $p->upc($this->plu()); if ($p->load()) { return $p->description(); } } return $this->itemdesc(); }
public function showEditForm($upc, $display_mode = 1, $expand_mode = 1) { $upc = BarcodeLib::padUPC($upc); $dbc = $this->db(); $prod = new ProductsModel($dbc); $prod->upc($upc); if (FannieConfig::config('STORE_MODE') == 'HQ') { $prod->store_id(FannieConfig::config('STORE_ID')); } $prod->load(); $ret = '<div id="FreshDealsFieldset" class="panel panel-default">'; $ret .= "<div class=\"panel-heading\">\n <a href=\"\" onclick=\"\$('#FreshDealsDiv').toggle();return false;\">\n Fresh Deals</a>\n </div>"; $ret .= '<div id="FreshDealsDiv" class="panel-body">'; $ret .= sprintf('<table class="table table-bordered"><tr> <td>%s</td> <td>%s</td> <td>%s</td> <td>$%.2f</td> <td>$%.2f</td> </tr></table>', $prod->brand(), $prod->description(), $prod->upc(), $prod->cost(), $prod->normal_price()); $ret .= '</div></div>'; return $ret; }
function MarginFS($upc, $cost, $deptID) { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $price = 'None'; $prod = new ProductsModel($dbc); $prod->upc($upc); if ($prod->load()) { $price = $prod->normal_price(); } $dm = 'Unknown'; $dept = new DepartmentsModel($dbc); $dept->dept_no($deptID); if ($dept->load()) { $dm = $dept->margin(); } if ((empty($dm) || $dm == 'Unknown') && $dbc->tableExists('deptMargin')) { $prep = $dbc->prepare_statement("SELECT margin FROM deptMargin WHERE dept_ID=?"); $dm = $dbc->exec_statement($prep, array($deptID)); if ($dbc->num_rows($dm) > 0) { $row = $dbc->fetch_row($dm); $dm = $dm['margin']; } } $ret = "Desired margin on this department is "; if ($dm == "Unknown") { $ret .= $dm; } else { $ret .= sprintf("%.2f%%", $dm * 100); } $ret .= "<br />"; $actual = 0; if ($price != 0) { $actual = ($price - $cost) / $price; } if ($actual > $dm && is_numeric($dm) || !is_numeric($dm)) { $ret .= sprintf("<span style=\"color:green;\">Current margin on this item is %.2f%%<br />", $actual * 100); } else { if (!is_numeric($price)) { $ret .= "<span style=\"color:green;\">No price has been saved for this item<br />"; } else { $ret .= sprintf("<span style=\"color:red;\">Current margin on this item is %.2f%%</span><br />", $actual * 100); $srp = getSRP($cost, $dm); $ret .= sprintf("Suggested price: \$%.2f ", $srp); $ret .= sprintf("(<a href=\"\" onclick=\"setPrice(%.2f); return false;\">Use this price</a>)", $srp); } } echo $ret; }
public function get_id_handler() { $upc = BarcodeLib::padUPC($this->id); $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $product = new ProductsModel($dbc); $product->upc($upc); $matches = $product->find('store_id'); if (count($matches) > 0) { $product = $matches[0]; $stores = new StoresModel($dbc); foreach ($stores->find('storeID') as $store) { $product->store_id($store->storeID()); $product->save(); } } return '../ItemEditorPage.php?searchupc=' . $upc; }
public function get_id_handler() { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $upc = BarcodeLib::padUPC($this->id); $product = new ProductsModel($dbc); $product->upc($upc); if (!$product->load()) { $this->add_onload_command("showBootstrapAlert('#alert-area', 'danger', 'Item not found');\n"); $this->__route_stem = 'get'; } else { $this->description = $product->description(); $this->cost = $product->cost(); $this->price = $product->normal_price(); $this->department = $product->department(); $this->upc = $upc; } return true; }
public function post_start_number_handler() { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $dept_no = FormLib::get('department', 0); $desc = FormLib::get('description', 'NEW PLU'); if (empty($desc)) { $desc = 'NEW PLU'; } $dept = new DepartmentsModel($dbc); $dept->dept_no($dept_no); $dept->load(); $model = new ProductsModel($dbc); $model->normal_price(0); $model->pricemethod(0); $model->quantity(0); $model->groupprice(0); $model->special_price(0); $model->specialpricemethod(0); $model->specialquantity(0); $model->specialgroupprice(0); $model->advertised(0); $model->tareweight(0); $model->start_date(''); $model->end_date(''); $model->discounttype(0); $model->wicable(0); $model->inUse(1); $model->tax($dept->dept_tax()); $model->foodstamp($dept->dept_fs()); $model->discount($dept->dept_discount()); $model->department($dept_no); for ($i = 0; $i < $this->number; $i++) { $upc = BarcodeLib::padUPC($this->start + $i); $model->upc($upc); $model->store_id(1); $model->description($desc . ' ' . ($i + 1)); $model->save(); } header('Location: ItemEditorPage.php?searchupc=' . $this->start); return false; }
public function SaveFormData($upc) { $upc = BarcodeLib::padUPC($upc); $dbc = $this->db(); $model = new ProductsModel($dbc); $model->upc($upc); $model->store_id(1); $method = FormLib::get_form_value('vp_method', 0); $qty = FormLib::get_form_value('vp_qty', 0); $price = FormLib::get_form_value('vp_price', 0); $mixmatch = FormLib::get_form_value('vp_mm', 0); $model->pricemethod($method); $model->quantity($qty); $model->groupprice($price); $model->mixmatchcode($mixmatch); $r1 = $model->save(); if ($r1 === false) { return false; } else { return true; } }
public function logUpdate($type = 'UNKNOWN', $user = false) { if (!$user) { $user = FannieAuth::getUID(FannieAuth::checkLogin()); } $product = new ProductsModel($this->connection); $product->upc($this->upc()); $exists = $product->load(); if (!$exists) { return false; } $this->storeID($product->store_id()); $this->updateType($type); $this->description($product->description()); $this->price($product->normal_price()); $this->salePrice($product->special_price()); $this->cost($product->cost()); $this->dept($product->department()); $this->tax($product->tax()); $this->fs($product->foodstamp()); $this->scale($product->scale()); $this->modified($product->modified()); $this->forceQty($product->qttyEnforced()); $this->noDisc($product->discount()); $this->inUse($product->inUse()); $this->user($user); $likecode = 0; if ($this->connection->table_exists('upcLike')) { $upcQ = $this->connection->prepare('SELECT likeCode FROM upcLike WHERE upc=?'); $upcR = $this->connection->execute($upcQ, array($this->upc())); if ($this->connection->num_rows($upcR) > 0) { $upcW = $this->connection->fetch_row($upcR); $this->likeCode($upcW['likeCode']); } } $this->save(); return true; }
public function SaveFormData($upc) { $local = $this->db(); $upc = BarcodeLib::padUPC($upc); $pu = new ProductUserModel($local); $pu->upc($upc); $pu->enableOnline(FormLib::get('u_online') == 1 ? 1 : 0); $pu->soldOut(FormLib::get('u_soldout') == 1 ? 1 : 0); $pu->save(); include dirname(__FILE__) . '/../../src/Credentials/OutsideDB.tunneled.php'; $remote = $dbc; $pu->load(); if ($pu->enableOnline() && $remote->isConnected()) { $pu->setConnection($remote); $pu->save(); $prod = new ProductsModel($local); $prod->upc($upc); $prod->load(); $prod->setConnection($remote); $prod->save(); } elseif (FormLib::get('u_already_online') && $remote->isConnected()) { $prod = new ProductsModel($remote); $prod->upc($upc); $prod->delete(); } if ($local->tableExists('productExpires')) { $e = new ProductExpiresModel($local); $e->upc($upc); $e->expires(FormLib::getDate('u_expires', date('Y-m-d'))); $e->save(); if ($e->expires() && $remote->isConnected()) { $e->setConnection($remote); $e->save(); } } }
public function run() { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $now = date('Y-m-d 00:00:00'); $sale_upcs = array(); // ensure likecode items are mixmatch-able if ($dbc->dbms_name() == 'mssql') { $dbc->query("UPDATE products\n SET mixmatchcode=convert(varchar,u.likecode+500)\n FROM \n products AS p\n INNER JOIN upcLike AS u\n ON p.upc=u.upc"); } else { $dbc->query("UPDATE products AS p\n INNER JOIN upcLike AS u ON p.upc=u.upc\n SET p.mixmatchcode=convert(u.likeCode+500,char)"); } $likeP = $dbc->prepare('SELECT u.upc FROM upcLike AS u INNER JOIN products AS p ON u.upc=p.upc WHERE likeCode=?'); $product = new ProductsModel($dbc); $b_def = $dbc->tableDefinition('batches'); // lookup current batches $query = 'SELECT l.upc, l.batchID, l.pricemethod, l.salePrice, l.groupSalePrice, l.quantity, b.startDate, b.endDate, b.discounttype ' . (isset($b_def['transLimit']) ? ',b.transLimit' : ',0 AS transLimit') . ' FROM batches AS b INNER JOIN batchList AS l ON b.batchID = l.batchID WHERE b.discounttype <> 0 AND b.startDate <= ? AND b.endDate >= ? ORDER BY l.upc, l.salePrice DESC'; $t_def = $dbc->tableDefinition('batchList'); if (!isset($t_def['groupSalePrice'])) { $query = str_replace('l.groupSalePrice', 'NULL AS groupSalePrice', $query); } /** In HQ mode, join on junction table to get UPC+storeID rows when applying sale pricing */ if ($this->config->get('STORE_MODE') === 'HQ') { $query = str_replace('WHERE', ' LEFT JOIN StoreBatchMap AS s ON b.batchID=s.batchID WHERE ', $query); $query = str_replace('SELECT', 'SELECT s.storeID,', $query); } $prep = $dbc->prepare($query); $result = $dbc->execute($prep, array($now, $now)); while ($row = $dbc->fetch_row($result)) { // all items affected by this bathcList record // could be more than one in the case of likecodes $item_upcs = array(); // use products column names for readability below $special_price = $row['salePrice']; $specialpricemethod = $row['pricemethod']; if ($row['groupSalePrice'] != null) { $specialgroupprice = $row['groupSalePrice']; } else { $specialgroupprice = abs($row['salePrice']); } $specialquantity = $row['quantity']; $special_limit = $row['transLimit']; $start_date = $row['startDate']; $end_date = $row['endDate']; $discounttype = $row['discounttype']; $batchID = $row['batchID']; // pricemethod 3 and 4 (AB pricing, typically) // has some overly complicated rules $mixmatch = false; if ($specialpricemethod == 3 || $specialpricemethod == 4) { if ($special_price >= 0) { $mixmatch = $row['batchID']; } else { $mixmatch = -1 * $row['batchID']; } } // unpack likecodes, if needed if (substr($row['upc'], 0, 2) == 'LC') { $likeCode = substr($row['upc'], 2); $likeR = $dbc->execute($likeP, array($likeCode)); while ($likeW = $dbc->fetch_row($likeR)) { $item_upcs[] = $likeW['upc']; if ($mixmatch !== false) { $mixmatch = $likeCode + 500; } } } else { $item_upcs[] = $row['upc']; } // check each item to see if it is on // sale with the correct parameters foreach ($item_upcs as $upc) { $product->reset(); $product->upc($upc); $this->cronMsg('Checking item ' . $upc, FannieLogger::INFO); /** Transistion mechanism. A batch that is set to apply to zero stores really should apply to zero stores. For now it fails over to using the local store's ID */ if ($this->config->get('STORE_MODE') === 'HQ') { $storeID = $row['storeID']; if ($storeID == null) { $storeID = $this->config->get('STORE_ID'); } $product->store_id($storeID); } if (!$product->load()) { $this->cronMsg("\tError: item does not exist in products", FannieLogger::NOTICE); continue; } // list of UPCs that should be on sale $sale_upcs[] = $upc; $changed = false; if ($product->special_price() != $special_price) { $changed = true; $product->special_price($special_price); } if ($product->specialpricemethod() != $specialpricemethod) { $changed = true; $product->specialpricemethod($specialpricemethod); } if ($product->specialgroupprice() != $specialgroupprice) { $changed = true; $product->specialgroupprice($specialgroupprice); } if ($product->specialquantity() != $specialquantity) { $changed = true; $product->specialquantity($specialquantity); } if ($product->special_limit() != $special_limit) { $changed = true; $product->special_limit($special_limit); } if ($product->start_date() != $start_date) { $changed = true; $product->start_date($start_date); } if ($product->end_date() != $end_date) { $changed = true; $product->end_date($end_date); } if ($product->discounttype() != $discounttype) { $changed = true; $product->discounttype($discounttype); } if ($mixmatch !== false && $product->mixmatchcode() != $mixmatch) { $changed = true; $product->mixmatchcode($mixmatch); } if ($product->batchID() != $batchID) { $changed = true; $product->batchID($batchID); } if ($changed) { $product->save(); $this->cronMsg("\tUpdated item", FannieLogger::INFO); } } // end loop on batchList record items } // end loop on batchList records // No sale items; need a filler value for // the query below if (count($sale_upcs) == 0) { $this->cronMsg('Notice: nothing is currently on sale', FannieLogger::WARNING); $sale_upcs[] = 'notValidUPC'; } // now look for anything on sale that should not be // and take those items off sale $upc_in = ''; foreach ($sale_upcs as $upc) { $upc_in .= '?,'; } $upc_in = substr($upc_in, 0, strlen($upc_in) - 1); $lookupQ = 'SELECT p.upc FROM products AS p WHERE upc NOT IN (' . $upc_in . ') AND ( p.discounttype <> 0 OR p.special_price <> 0 OR p.specialpricemethod <> 0 OR p.specialgroupprice <> 0 OR p.specialquantity <> 0 )'; $lookupP = $dbc->prepare($lookupQ); $lookupR = $dbc->execute($lookupP, $sale_upcs); while ($lookupW = $dbc->fetch_row($lookupR)) { $this->cronMsg('Taking ' . $lookupW['upc'] . ' off sale', FannieLogger::INFO); $product->reset(); if ($this->config->get('STORE_MODE') === 'HQ') { $product->store_id($this->config->get('STORE_ID')); } $product->upc($lookupW['upc']); $product->discounttype(0); $product->special_price(0); $product->specialgroupprice(0); $product->specialquantity(0); $product->start_date(''); $product->end_date(''); $product->batchID(0); $product->save(); } }
function process_file($linedata) { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); if (!isset($_SESSION['vid'])) { $this->error_details = 'Missing vendor setting'; return False; } $VENDOR_ID = $_SESSION['vid']; $p = $dbc->prepare_statement("SELECT vendorID,vendorName FROM vendors WHERE vendorID=?"); $idR = $dbc->exec_statement($p, array($VENDOR_ID)); if ($dbc->num_rows($idR) == 0) { $this->error_details = 'Cannot find vendor'; return False; } $idW = $dbc->fetch_row($idR); $vendorName = $idW['vendorName']; $SKU = $this->get_column_index('sku'); $BRAND = $this->get_column_index('brand'); $DESCRIPTION = $this->get_column_index('desc'); $QTY = $this->get_column_index('qty'); $SIZE1 = $this->get_column_index('size'); $UPC = $this->get_column_index('upc'); $CATEGORY = $this->get_column_index('vDept'); $REG_COST = $this->get_column_index('cost'); $NET_COST = $this->get_column_index('saleCost'); $REG_UNIT = $this->get_column_index('unitCost'); $NET_UNIT = $this->get_column_index('unitSaleCost'); $SRP = $this->get_column_index('srp'); // PLU items have different internal UPCs // map vendor SKUs to the internal PLUs $SKU_TO_PLU_MAP = array(); $skusP = $dbc->prepare('SELECT sku, upc FROM vendorSKUtoPLU WHERE vendorID=?'); $skusR = $dbc->execute($skusP, array($VENDOR_ID)); while ($skusW = $dbc->fetch_row($skusR)) { $SKU_TO_PLU_MAP[$skusW['sku']] = $skusW['upc']; } $itemP = $dbc->prepare("\n INSERT INTO vendorItems (\n brand, \n sku,\n size,\n upc,\n units,\n cost,\n description,\n vendorDept,\n vendorID,\n saleCost,\n modified,\n srp\n ) VALUES (\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?\n )"); $srpP = false; if ($dbc->tableExists('vendorSRPs')) { $srpP = $dbc->prepare_statement("INSERT INTO vendorSRPs (vendorID, upc, srp) VALUES (?,?,?)"); } $pm = new ProductsModel($dbc); foreach ($linedata as $data) { if (!is_array($data)) { continue; } if (!isset($data[$UPC])) { continue; } // grab data from appropriate columns $sku = $data[$SKU]; $brand = $BRAND === false ? $vendorName : substr($data[$BRAND], 0, 50); $description = substr($data[$DESCRIPTION], 0, 50); if ($QTY === false) { $qty = 1.0; } else { $qty = $data[$QTY]; if (!is_numeric($qty)) { $qty = 1.0; } } $size = $SIZE1 === false ? '' : substr($data[$SIZE1], 0, 25); $upc = $data[$UPC]; $upc = str_replace(' ', '', $upc); $upc = str_replace('-', '', $upc); if (strlen($upc) > 13) { $upc = substr($upc, -13); } else { $upc = str_pad($upc, 13, '0', STR_PAD_LEFT); } // zeroes isn't a real item, skip it if ($upc == "0000000000000") { continue; } if ($_SESSION['vUploadCheckDigits']) { $upc = '0' . substr($upc, 0, 12); } if (isset($SKU_TO_PLU_MAP[$sku])) { $upc = $SKU_TO_PLU_MAP[$sku]; } $category = $CATEGORY === false ? 0 : $data[$CATEGORY]; $reg_unit = ''; if ($REG_UNIT !== false) { $reg_unit = trim($data[$REG_UNIT]); $reg_unit = $this->priceFix($reg_unit); } if (!is_numeric($reg_unit) && $REG_COST !== false) { $reg = trim($data[$REG_COST]); $reg = $this->priceFix($reg); if (is_numeric($reg)) { $reg_unit = $reg / $qty; } } // skip the item if prices aren't numeric // this will catch the 'label' line in the first CSV split // since the splits get returned in file system order, // we can't be certain *when* that chunk will come up // can't process items w/o price (usually promos/samples anyway) if (empty($reg_unit) || !is_numeric($reg_unit)) { continue; } $net_unit = ''; if ($NET_UNIT !== false) { $net_unit = trim($data[$NET_UNIT]); $net_unit = $this->priceFix($net_unit); } if (!is_numeric($net_unit) && $NET_COST !== false) { $net = trim($data[$NET_COST]); $net = $this->priceFix($net); if (is_numeric($net)) { $net_unit = $net / $qty; } } // blank spreadsheet cell if (empty($net_unit)) { $net_unit = 0.0; } $srp = $SRP === false ? 0.0 : trim($data[$SRP]); if ($net_unit == $reg_unit) { $net_unit = 0.0; // not really a sale } // syntax fixes. kill apostrophes in text fields, // trim $ off amounts as well as commas for the // occasional > $1,000 item $srp = $this->priceFix($srp); if (!is_numeric($srp)) { $srp = 0; } $brand = str_replace("'", "", $brand); $description = str_replace("'", "", $description); $args = array($brand, $sku, $size, $upc, $qty, $reg_unit, $description, $category, $VENDOR_ID, $net_unit, date('Y-m-d H:i:s'), $srp); $dbc->execute($itemP, $args); if ($srpP) { $dbc->exec_statement($srpP, array($VENDOR_ID, $upc, $srp)); } if ($_SESSION['vUploadChangeCosts']) { $pm->reset(); $pm->upc($upc); $pm->default_vendor_id($VENDOR_ID); foreach ($pm->find('store_id') as $obj) { $obj->cost($reg_unit); $obj->save(); } } } return true; }
function post_save_handler() { global $FANNIE_OP_DB; $upcs = FormLib::get('upc', array()); if (!is_array($upcs) || empty($upcs)) { echo 'Error: invalid data'; return false; } $dept = FormLib::get('dept'); $tax = FormLib::get('tax'); $local = FormLib::get('local'); $brand = FormLib::get('brand'); $vendor = FormLib::get('vendor'); $dbc = FannieDB::get($FANNIE_OP_DB); $vlookup = new VendorsModel($dbc); for ($i = 0; $i < count($upcs); $i++) { $model = new ProductsModel($dbc); $upc = BarcodeLib::padUPC($upcs[$i]); $model->upc($upc); $model->store_id(1); if (isset($dept[$i])) { $model->department($dept[$i]); } if (isset($tax[$i])) { $model->tax($tax[$i]); } if (isset($local[$i])) { $model->local($local[$i]); } if (isset($brand[$i])) { $model->brand($brand[$i]); } if (isset($vendor[$i])) { $vlookup->reset(); $vlookup->vendorName($vendor[$i]); foreach ($vlookup->find('vendorID') as $obj) { $model->default_vendor_id($obj->vendorID()); break; } } if (in_array($upc, FormLib::get('fs', array()))) { $model->foodstamp(1); } else { $model->foodstamp(0); } if (in_array($upc, FormLib::get('disc', array()))) { $model->discount(1); } else { $model->discount(0); } if (in_array($upc, FormLib::get('scale', array()))) { $model->scale(1); } else { $model->scale(0); } $model->modified(date('Y-m-d H:i:s')); $try = $model->save(); if ($try) { $model->pushToLanes(); } else { $this->save_results[] = 'Error saving item ' . $upc; } if (isset($vendor[$i]) && $vendor[$i] != '' || isset($brand[$i]) && $brand[$i] != '') { $extra = new ProdExtraModel($dbc); $extra->upc($upc); if (isset($vendor[$i]) && $vendor[$i] != '') { $extra->distributor($vendor[$i]); } if (isset($brand[$i]) && $brand[$i] != '') { $extra->manufacturer($brand[$i]); } $extra->save(); } $this->upcs[] = $upc; } return true; }
public function post_id_sku_field_value_handler() { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $item = new VendorItemsModel($dbc); $item->vendorID($this->id); $item->sku($this->sku); $ret = array('error' => 0); if ($this->field === 'brand') { $item->brand($this->value); } elseif ($this->field === 'description') { $item->description($this->value); } elseif ($this->field === 'unitSize') { $item->size($this->value); } elseif ($this->field === 'caseQty') { $item->units($this->value); } elseif ($this->field === 'cost') { $item->cost($this->value); } else { $ret['error'] = 1; $ret['error_msg'] = 'Unknown field'; } if ($ret['error'] == 0) { $saved = $item->save(); if (!$saved) { $ret['error'] = 1; $ret['error_msg'] = 'Save failed'; } else { /** If cost was updated, update the corresponding product cost */ $prodP = $dbc->prepare(' SELECT p.upc FROM products AS p INNER JOIN vendorItems AS v ON p.upc=v.upc AND p.default_vendor_id=v.vendorID WHERE v.vendorID=? AND v.sku=?'); $prodR = $dbc->execute($prodP, array($this->id, $this->sku)); $model = new ProductsModel($dbc); while ($prodW = $dbc->fetch_row($prodR)) { $model->reset(); $model->upc($prodW['upc']); foreach ($model->find('store_id') as $obj) { $obj->cost($this->value); $obj->save(); } } } } echo json_encode($ret); return false; }
$model->pushToLanes(); $update = new ProdUpdateModel($sql); $update->upc($upc); $update->logUpdate(ProdUpdateModel::UPDATE_BATCH); } else { $lc = substr($upc, 2); $unsaleQ = $sql->prepare("UPDATE products AS p LEFT JOIN upcLike as u on p.upc=u.upc\n LEFT JOIN batchList as b ON b.upc=concat('LC',convert(u.likeCode,char))\n set p.discounttype=0,special_price=0,start_date=0,end_date=0 \n WHERE u.likeCode=? and b.batchID=?"); if ($FANNIE_SERVER_DBMS == "MSSQL") { $unsaleQ = $sql->prepare("update products set discounttype=0,special_price=0,start_date=0,end_date=0\n from products as p, batches as b, upcLike as u\n where u.likeCode=? and u.upc=p.upc and b.startdate=p.start_date and b.enddate=p.end_date\n and b.batchID=?"); } $unsaleR = $sql->execute($unsaleQ, array($lc, $id)); $prep = $sql->prepare('SELECT upc FROM upcLike WHERE likeCode=?'); $all = $sql->execute($prep, array($lc)); while ($row = $sql->fetch_row($all)) { $model = new ProductsModel($sql); $model->upc($row['upc']); $model->pushToLanes(); $update = new ProdUpdateModel($sql); $update->upc($upc); $update->logUpdate(ProdUpdateModel::UPDATE_BATCH); } } $delQ = $sql->prepare("delete from batchList where batchID=? and upc=?"); $delR = $sql->execute($delQ, array($id, $upc)); $delQ = $sql->prepare("delete from batchBarcodes where upc=? and batchID=?"); $delR = $sql->execute($delQ, array($upc, $id)); $audited = $_GET['audited']; if ($audited == "1") { \COREPOS\Fannie\API\lib\AuditLib::batchNotification($id, $upc, \COREPOS\Fannie\API\lib\AuditLib::BATCH_DELETE, substr($upc, 0, 2) == 'LC' ? true : false); } $out .= showBatchDisplay($id);
function SaveFormData($upc) { /* check if data was submitted */ if (FormLib::get('s_plu') === '') { return False; } $desc = FormLib::get('descript', ''); if (is_array($desc)) { $desc = array_pop($desc); } $longdesc = FormLib::get('s_longdesc', ''); if (trim($longdesc) !== '') { $desc = $longdesc; } $price = FormLib::get('price', 0); if (is_array($price)) { $price = array_pop($price); } $tare = FormLib::get('s_tare', 0); $shelf = FormLib::get('s_shelflife', 0); $bycount = FormLib::get('s_bycount', 0); $graphics = FormLib::get('s_graphics', 0); $type = FormLib::get('s_type', 'Random Weight'); $weight = $type == 'Random Weight' ? 0 : 1; $text = FormLib::get('s_text', ''); $align = FormLib::get('s_label', 'horizontal'); $netWeight = FormLib::get('s_netwt', 0); $label = \COREPOS\Fannie\API\item\ServiceScaleLib::attributesToLabel($align, $type == 'Fixed Weight' ? true : false, $graphics != 0 ? true : false); $dbc = $this->db(); // apostrophes might make a mess // double quotes definitely will // DGW quotes text fields w/o any escaping $desc = str_replace("'", "", $desc); $text = str_replace("'", "", $text); $desc = str_replace("\"", "", $desc); $text = str_replace("\"", "", $text); /** Safety check: A fixed-weight item sticked by the each flagged as scalable will interact with the register's quantity * upc functionality incorrectly */ if ($weight == 1 && $bycount == 1) { $p = new ProductsModel($dbc); $p->upc($upc); $p->store_id(1); if ($p->load()) { $p->Scale(0); $p->save(); } } $scaleItem = new ScaleItemsModel($dbc); $scaleItem->plu($upc); $action = 'ChangeOneItem'; if (!$scaleItem->load()) { // new record $action = "WriteOneItem"; } $scaleItem->price($price); $scaleItem->itemdesc($desc); $scaleItem->weight($type == 'Fixed Weight' ? 1 : 0); $scaleItem->bycount($bycount); $scaleItem->tare($tare); $scaleItem->shelflife($shelf); $scaleItem->text($text); $scaleItem->label($label); $scaleItem->graphics($graphics ? 121 : 0); $scaleItem->netWeight($netWeight); $scaleItem->save(); // extract scale PLU preg_match("/^002(\\d\\d\\d\\d)0/", $upc, $matches); $s_plu = $matches[1]; if ($s_plu == '0000') { preg_match("/^0020(\\d\\d\\d\\d)/", $upc, $matches); $s_plu = $matches[1]; } $item_info = array('RecordType' => $action, 'PLU' => $s_plu, 'Description' => $desc, 'Tare' => $tare, 'ShelfLife' => $shelf, 'Price' => $price, 'Label' => $label, 'ExpandedText' => $text, 'ByCount' => $bycount); if ($netWeight != 0) { $item_info['NetWeight'] = $netWeight; } if ($graphics) { $item_info['Graphics'] = 121; } // normalize type + bycount; they need to match if ($item_info['ByCount'] && $type == 'Random Weight') { $item_info['Type'] = 'By Count'; } else { if ($type == 'Fixed Weight') { $item_info['Type'] = 'Fixed Weight'; $item_info['ByCount'] = 1; } else { $item_info['Type'] = 'Random Weight'; $item_info['ByCount'] = 0; } } $scales = array(); $scaleIDs = FormLib::get('scaleID', array()); $model = new ServiceScalesModel($dbc); /** Send item to requested scales */ if (count($scaleIDs) > 0) { $chkMap = $dbc->prepare('SELECT upc FROM ServiceScaleItemMap WHERE serviceScaleID=? AND upc=?'); $addMap = $dbc->prepare('INSERT INTO ServiceScaleItemMap (serviceScaleID, upc) VALUES (?, ?)'); foreach ($scaleIDs as $scaleID) { $model->reset(); $model->serviceScaleID($scaleID); if (!$model->load()) { // scale doesn't exist continue; } $repr = array('host' => $model->host(), 'dept' => $model->scaleDeptName(), 'type' => $model->scaleType(), 'new' => false); $exists = $dbc->execute($chkMap, array($scaleID, $upc)); if ($dbc->num_rows($exists) == 0) { $repr['new'] = true; $dbc->execute($addMap, array($scaleID, $upc)); } $scales[] = $repr; } HobartDgwLib::writeItemsToScales($item_info, $scales); EpScaleLib::writeItemsToScales($item_info, $scales); } /** Delete item from scales if that option was unchecked */ $mapP = $dbc->prepare(' SELECT serviceScaleID FROM ServiceScaleItemMap WHERE upc=?'); $mapR = $dbc->execute($mapP, array($upc)); $delP = $dbc->prepare(' DELETE FROM ServiceScaleItemMap WHERE serviceScaleID=? AND upc=?'); if ($mapR && $dbc->numRows($mapR)) { $scales = array(); while ($mapW = $dbc->fetchRow($mapR)) { if (in_array($mapW['serviceScaleID'], $scaleIDs)) { // item sent to that scale continue; } $model->reset(); $model->serviceScaleID($mapW['serviceScaleID']); if (!$model->load()) { // scale doesn't exist continue; } $repr = array('host' => $model->host(), 'dept' => $model->scaleDeptName(), 'type' => $model->scaleType(), 'new' => false); $scales[] = $repr; $dbc->execute($delP, array($mapW['serviceScaleID'], $upc)); } if (count($scales) > 0) { HobartDgwLib::deleteItemsFromScales($item_info['PLU'], $scales); } } }
//Update all like coded items to $upc $likeQuery = $sql->prepare("UPDATE products SET normal_price = ?,department = ?,tax = ?,scale=?,foodstamp=?,inUse=?, modified = ?,\n pricemethod=?,groupprice=?,quantity=?,local=?\n WHERE upc IN (SELECT u.upc FROM upcLike AS u WHERE u.likeCode = ?)"); $likeResult = $sql->execute($likeQuery, array($price, $dept, $tax, $Scale, $FS, $inUse, $modDate, $price_method, $vol_price, $vol_qtty, $local, $likeCode)); //INSERTED HERE TO INSERT UPDATE INTO prodUpdate for likecoded items. $selectQ = $sql->prepare("SELECT * FROM upcLike WHERE likecode = ?"); //echo $selectQ; $selectR = $sql->execute($selectQ, array($likeCode)); $prodUpdate = new ProdUpdateModel($sql); while ($selectW = $sql->fetch_array($selectR)) { $upcL = $selectW['upc']; if ($upcL != $upc) { $prodUpdate->reset(); $prodUpdate->upc($upcL); $prodUpdate->logUpdate(ProdUpdateModel::UPDATE_EDIT); $p_model = new ProductsModel($sql); $p_model->upc($upcL); $p_model->pushToLanes(); } } $delQ = $sql->prepare("DELETE FROM upcLike WHERE upc = ?"); $delR = $sql->execute($delQ, array($upc)); $updateLikeQ = $sql->prepare("INSERT INTO upcLike VALUES(?,?)"); $updateLikeR = $sql->execute($updateLikeQ, array($upc, $likeCode)); } } } echo "<table>"; echo "<tr><td align=right><b>UPC</b></td><td><font color='red'>" . $row[0] . "</font><input type=hidden value='{$row['0']}' name=upc></td>"; echo "</tr><tr><td><b>Description</b></td><td>{$row['1']}</td>"; echo "<td><b>Price</b></td><td>\${$row['2']}</td></tr></table>"; echo "<table border=0><tr>";