public function post_id_handler() { global $FANNIE_OP_DB; $upcs = FormLib::get_form_value('upc', array()); $descs = FormLib::get_form_value('desc', array()); $prices = FormLib::get_form_value('price', array()); $brands = FormLib::get_form_value('brand', array()); $skus = FormLib::get_form_value('sku', array()); $sizes = FormLib::get_form_value('size', array()); $units = FormLib::get_form_value('units', array()); $vendors = FormLib::get_form_value('vendor', array()); $ppos = FormLib::get_form_value('ppo', array()); $counts = FormLib::get_form_value('counts', array()); $dbc = FannieDB::get($FANNIE_OP_DB); $tag = new ShelftagsModel($dbc); for ($i = 0; $i < count($upcs); $i++) { $upc = $upcs[$i]; $desc = isset($descs[$i]) ? $descs[$i] : ''; $price = isset($prices[$i]) ? $prices[$i] : 0; $brand = isset($brands[$i]) ? $brands[$i] : ''; $size = isset($sizes[$i]) ? $sizes[$i] : ''; $sku = isset($skus[$i]) ? $skus[$i] : ''; $unit = isset($units[$i]) ? $units[$i] : 1; $vendor = isset($vendors[$i]) ? $vendors[$i] : ''; $ppo = isset($ppos[$i]) ? $ppos[$i] : ''; $count = isset($counts[$i]) ? $counts[$i] : 1; $tag->id($this->id); $tag->upc($upc); $tag->description($desc); $tag->normal_price($price); $tag->brand($brand); $tag->sku($sku); $tag->size($size); $tag->units($unit); $tag->vendor($vendor); $tag->pricePerUnit($ppo); $tag->count($count); $tag->save(); } header("Location: ShelfTagIndex.php"); return false; }
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; }
$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>"; echo "<tr><th>UPC</th><th>Desc</th><th>Price</th><th>Brand</th><th>SKU</th>"; echo "<th>Size</th><th>Units</th><th>Vendor</th><th>PricePer</th></tr>"; $class = array("one", "two");
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"; }
$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; } $model = new BatchListModel($dbc); $model->batchID($bid);
} $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"> <link rel="stylesheet" type="text/css" href="../src/javascript/bootstrap-default/css/bootstrap-theme.min.css"> <script type="text/javascript" src="../src/javascript/jquery/jquery.min.js"></script>