protected function get_type_handler() { if ($this->type == '') { echo ''; return false; } $this->connection->selectDB($this->config->get('OP_DB')); $model = new CustomReceiptModel($this->connection); $model->type($this->type); $ret = '<table class="table table-bordered"> <tr> <th>Line #</th> <th>Text</th> <th>' . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon() . '</th> </tr>'; foreach ($model->find('seq') as $obj) { $ret .= sprintf('<tr> <td>%d<input type="hidden" name="id[]" value="%d" /></td> <td><input type="text" maxlength="55" name="line[]" class="form-control" value="%s" /></td> <td><input type="checkbox" name="del[]" value="%d" /></td> </tr>', $obj->seq(), $obj->seq(), $obj->text(), $obj->seq()); } $ret .= '<tr><td>NEW</td><td><input type="text" name="newLine" class="form-control" /></td> <td> </td></tr>'; $ret .= '</table>'; echo $ret; return false; }
function get_view() { global $FANNIE_OP_DB, $FANNIE_URL; $dbc = FannieDB::get($FANNIE_OP_DB); $ret = '<form onsubmit="save();return false;"> <div class="form-group"> <label>UPC</label> <input type="text" id="upc" class="form-control" required /> </div> <div class="form-group"> <label>Limit</label> (max uses per transaction) <input type="number" id="limit" class="form-control" value="0" required /> </div> <div class="form-group"> <label>Reason</label> <input type="text" id="reason" class="form-control" required /> </div> <p> <button type="submit" class="btn btn-default">Save</button> </p> </form> <hr/>'; $model = new DisableCouponModel($dbc); $ret .= '<table class="table"> <tr><th>UPC</th><th>Limit</th><th>Reason</th><th></th></tr>'; foreach ($model->find('upc') as $obj) { $ret .= sprintf('<tr><td><a href="" onclick="loadcoupon(\'%s\');return false;">%s</a></td> <td>%d</td><td>%s</td> <td><a href="" onclick="deletecoupon(\'%s\');return false;">%s</a></td> </tr>', $obj->upc(), $obj->upc(), $obj->threshold(), $obj->reason(), $obj->upc(), \COREPOS\Fannie\API\lib\FannieUI::deleteIcon()); } $ret .= '</table>'; $this->add_onload_command("\$('#upc').focus();\n"); return $ret; }
function body_content() { $this->addScript('type-editor.js'); global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $model = new BatchTypeModel($dbc); $ret = '<table class="table">'; $ret .= '<tr> <th>ID#</th> <th>Description</th> <th>Discount Type</th> <th>Dated Signs</th> <th title="Special Order Eligible">SO Eligible</th> <th>Editing Interface</th> <th> </td> </tr>'; foreach ($model->find('batchTypeID') as $obj) { $ret .= sprintf('<tr> <td>%d</td> <td><input type="text" class="form-control" onchange="saveDesc.call(this,this.value,%d)" value="%s" /></td> <td><select onchange="saveType.call(this, $(this).val(),%d);" class="form-control">', $obj->batchTypeID(), $obj->batchTypeID(), $obj->typeDesc(), $obj->batchTypeID()); $found = false; foreach ($this->price_methods as $id => $desc) { if ($id == $obj->discType()) { $found = true; $ret .= sprintf('<option value="%d" selected>%d %s</option>', $id, $id, $desc); } else { $ret .= sprintf('<option value="%d">%d %s</option>', $id, $id, $desc); } } if (!$found) { $ret .= sprintf('<option value="%d" selected>%d (Custom)</option>', $w['discType'], $w['discType']); } $ret .= '</select></td>'; $ret .= sprintf('<td align="center"> <input type="checkbox" %s onchange="saveDated.call(this, %d);" /> </td>', $obj->datedSigns() ? 'checked' : '', $obj->batchTypeID()); $ret .= sprintf('<td align="center"> <input type="checkbox" %s onchange="saveSO.call(this, %d);" /> </td>', $obj->specialOrderEligible() ? 'checked' : '', $obj->batchTypeID()); $ret .= sprintf('<td> <select onchange="saveUI.call(this, $(this).val(),%d);" class="form-control">', $obj->batchTypeID()); foreach ($this->editor_uis as $id => $desc) { $ret .= sprintf('<option %s value="%d">%s</option>', $id == $obj->editorUI() ? 'selected' : '', $id, $desc); } $ret .= '</select></td>'; $ret .= sprintf('<td><a href="BatchTypeEditor.php?deltype=yes&bid=%d" class="btn btn-danger btn-sm" onclick="return confirm(\'Are you sure?\');">%s</a> </td></tr>', $obj->batchTypeID(), \COREPOS\Fannie\API\lib\FannieUI::deleteIcon()); } $ret .= '</table>'; $ret .= '<p><button onclick="location=\'BatchTypeEditor.php?addtype=yes\';" class="btn btn-default">Create New Type</button></p>'; return $ret; }
public function get_view() { $lib_class = $this->lib_class; $dbc = $lib_class::getDB(); $model = $lib_class::getCategory($dbc); $model->hasSales(1); $map = $lib_class::getCategoryMap($dbc); $supers = 'SELECT s.superID, s.super_name FROM ' . $this->config->get('OP_DB') . $dbc->sep() . 'superDeptNames AS s ORDER BY s.super_name'; $res = $dbc->query($supers); $sdepts = array(); while ($row = $dbc->fetch_row($res)) { $sdepts[$row['superID']] = $row['super_name']; } $ret = '<div class="col-sm-5">'; $ret .= '<form method="post">'; $ret .= '<table class="table">'; $ret .= '<tr> </tr>'; foreach ($model->find() as $cat) { $ret .= '<tr><th colspan="2">' . $cat->name() . '</th> <td>' . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon('Check box for row to delete') . ' </td></tr>'; $map->obfCategoryID($cat->obfCategoryID()); foreach ($map->find() as $obj) { $ret .= sprintf('<tr> <input type="hidden" name="id[]" value="%d" /> <input type="hidden" name="superID[]" value="%d" /> <td>%s</td> <td><div class="input-group"> <input type="text" name="growth[]" class="form-control" required value="%.3f" /> <span class="input-group-addon">%%</span> </div></td> <td><input type="checkbox" name="delete[]" value="%d:%d" /></td> </tr>', $obj->obfCategoryID(), $obj->superID(), $sdepts[$obj->superID()], $obj->growthTarget() * 100, $obj->obfCategoryID(), $obj->superID()); unset($sdepts[$obj->superID()]); } } $ret .= '</table>'; $ret .= '<p><button type="submit" class="btn btn-default">Save Mapping</button></p>'; $ret .= '</form>'; $ret .= '</div>'; $ret .= '<div class="col-sm-5">'; $ret .= '<div class="panel panel-default"><div class="panel-body">'; $ret .= '<form method="post"> <div class="form-group form-inline">'; $ret .= '<label>Add</label> <select name="add" class="form-control">'; foreach ($sdepts as $id => $name) { $ret .= sprintf('<option value="%d">%s</option>', $id, $name); } $ret .= '</select>'; $ret .= ' <label>to</label> <select name="cat" class="form-control">'; foreach ($model->find() as $cat) { $ret .= sprintf('<option value="%d">%s</option>', $cat->obfCategoryID(), $cat->name()); } $ret .= '</select></div>'; $ret .= '<p><button type="submit" class="btn btn-default">Add New Mapping</button>'; $ret .= ' '; $ret .= '<button type="button" class="btn btn-default" onclick="location=\'index.php\';return false;">Home</button></p>'; $ret .= '</form>'; $ret .= '</div>'; $ret .= '<div class="panel-footer">Note: percentages are sales growth targets for categories</div>'; $ret .= '</div>'; $ret .= '</div>'; return $ret; }
public function get_view() { $dbc = $this->connection; $settings = $this->config->get('PLUGIN_SETTINGS'); $dbc->selectDB($settings['ScheduledEmailDB']); $templates = new ScheduledEmailTemplatesModel($dbc); $ret = '<table class="table table-bordered table-striped"> <thead> <tr> <th>ID</th> <th>Name</th> <th> </th> <th> </th> </tr> </thead> <tbody>'; foreach ($templates->find('scheduledEmailTemplateID') as $t) { $ret .= sprintf('<tr> <td>%d</td> <td>%s</td> <td><a class="btn btn-default btn-xs" href="?id=%d">%s</a></td> <td><a class="btn btn-danger btn-xs" href="?_method=delete&id=%d" onclick="return confirm(\'Delete template %s?\');">%s</a></td> </tr>', $t->scheduledEmailTemplateID(), $t->name(), $t->scheduledEmailTemplateID(), \COREPOS\Fannie\API\lib\FannieUI::editIcon(), $t->scheduledEmailTemplateID(), $t->name(), \COREPOS\Fannie\API\lib\FannieUI::deleteIcon()); } $ret .= '</tbody></table>'; $ret .= '<p> <a href="?_method=put" class="btn btn-default">Create New Template</a> </p>'; return $ret; }
function list_content() { global $FANNIE_OP_DB, $FANNIE_URL; $dbc = FannieDB::get($FANNIE_OP_DB); $supertype = FormLib::get_form_value('supertype', 'dept'); $manufacturer = FormLib::get_form_value('manufacturer', ''); $mtype = FormLib::get_form_value('mtype', 'prefix'); $deptStart = FormLib::get_form_value('deptStart', 0); $deptEnd = FormLib::get_form_value('deptEnd', 0); $deptMulti = FormLib::get('departments', array()); $subDepts = FormLib::get('subdepts', array()); $super = FormLib::get_form_value('deptSub'); $vendorID = FormLib::get('vendor'); $upc_list = FormLib::get('u', array()); $inUse = FormLib::get('inUse', 1); $store = FormLib::get('store', 0); $sort = FormLib::get_form_value('sort', 'Department'); $order = 'dept_name'; if ($sort === 'UPC') { $order = 'i.upc'; } elseif ($sort === 'Description') { $order = 'i.description, i.upc'; } $ret = 'Report sorted by ' . $sort . '<br />'; if ($supertype == 'dept' && $super === '') { $ret .= 'Department ' . $deptStart . ' to ' . $deptEnd . '<br />'; } else { if ($supertype == 'dept') { $ret .= 'Sub department ' . $super . '<br />'; } else { if ($supertype == 'manu') { $ret .= _('Brand') . ' ' . $manufacturer . '<br />'; } else { if ($supertype == 'vendor') { $vendor = new VendorsModel($dbc); $vendor->vendorID($vendorID); $vendor->load(); $ret .= 'Vendor ' . $vendor->vendorName() . '<br />'; } } } } $ret .= date("F j, Y, g:i a") . '<br />'; $page_url = sprintf('ProductListPage.php?supertype=%s&deptStart=%s&deptEnd=%s&deptSub=%s&manufacturer=%s&mtype=%s&vendor=%d', $supertype, $deptStart, $deptEnd, $super, $manufacturer, $mtype, $vendorID); if (!$this->excel) { $ret .= '<form action="' . filter_input(INPUT_SERVER, 'PHP_SELF') . '" method="post" id="excel-form"> <input type="hidden" name="supertype" value="' . $supertype . '" /> <input type="hidden" name="deptStart" value="' . $deptStart . '" /> <input type="hidden" name="deptEnd" value="' . $deptEnd . '" /> <input type="hidden" name="deptSub" value="' . $super . '" /> <input type="hidden" name="manufacturer" value="' . $manufacturer . '" /> <input type="hidden" name="mtype" value="' . $mtype . '" /> <input type="hidden" name="vendor" value="' . $vendorID . '" /> <input type="hidden" name="inUse" value="' . $inUse . '" /> <input type="hidden" name="excel" value="yes" />'; if (is_array($subDepts)) { foreach ($subDepts as $s) { $ret .= '<input type="hidden" name="subdepts[]" value="' . $s . '" />'; } } if (is_array($upc_list)) { foreach ($upc_list as $u) { $ret .= '<input type="hidden" name="u[]" value="' . $u . '" />'; } } $ret .= '</form>'; $ret .= sprintf('<a href="" onclick="$(\'#excel-form\').submit();return false;">Save to Excel</a> <a href="%s">Back</a><br />', basename(__FILE__)); } /** base select clause and joins **/ $query = "\n SELECT i.upc,\n i.description,\n i.brand,\n d.dept_name as department,\n i.normal_price,\n (CASE WHEN i.tax = 1 THEN 'X' WHEN i.tax=0 THEN '-' ELSE LEFT(t.description,1) END) as Tax, \n (CASE WHEN i.foodstamp = 1 THEN 'X' ELSE '-' END) as FS,\n (CASE WHEN i.discount = 0 THEN '-' ELSE 'X'END) as DISC,\n (CASE WHEN i.scale = 1 THEN 'X' ELSE '-' END) as WGHd,\n (CASE WHEN i.local > 0 AND o.originID IS NULL THEN 'X' \n WHEN i.local > 0 AND o.originID IS NOT NULL THEN LEFT(o.shortName,1) ELSE '-' END) as local,\n COALESCE(v.vendorName, x.distributor) AS distributor,\n i.cost,\n i.store_id,\n l.description AS storeName\n FROM products as i \n LEFT JOIN departments as d ON i.department = d.dept_no\n LEFT JOIN taxrates AS t ON t.id = i.tax\n LEFT JOIN prodExtra as x on i.upc = x.upc\n LEFT JOIN vendors AS v ON i.default_vendor_id=v.vendorID\n LEFT JOIN Stores AS l ON i.store_id=l.storeID\n LEFT JOIN origins AS o ON i.local=o.originID"; /** add extra joins if this lookup requires them **/ if ($supertype == 'dept' && $super !== '') { if ($super >= 0) { $query .= ' LEFT JOIN superdepts AS s ON i.department=s.dept_ID '; } elseif ($super == -2) { $query .= ' LEFT JOIN MasterSuperDepts AS s ON i.department=s.dept_ID '; } } elseif ($supertype == 'vendor') { $query .= ' LEFT JOIN vendors AS z ON z.vendorName=x.distributor '; } /** build where clause and parameters based on the lookup type **/ $query .= ' WHERE 1=1 '; $args = array(); if ($supertype == 'dept' && $super !== '') { if ($super >= 0) { $query .= ' AND s.superID=? '; $args = array($super); } elseif ($super == -2) { $query .= ' AND s.superID <> 0 '; } if ($deptStart != 0 && $deptEnd != 0) { $query .= ' AND i.department BETWEEN ? AND ? '; $args[] = $deptStart; $args[] = $deptEnd; } elseif (count($deptMulti) > 0) { $query .= ' AND i.department IN ('; foreach ($deptMulti as $d) { $query .= '?,'; $args[] = $d; } $query = substr($query, 0, strlen($query) - 1) . ')'; } if (is_array($subDepts) && count($subDepts) > 0) { $query .= ' AND i.subdept IN ('; foreach ($subDepts as $s) { $query .= '?,'; $args[] = $s; } $query = substr($query, 0, strlen($query) - 1) . ')'; } } elseif ($supertype == 'manu' && $mtype == 'prefix') { $query .= ' AND i.upc LIKE ? '; $args = array('%' . $manufacturer . '%'); } elseif ($supertype == 'manu' && $mtype != 'prefix') { $query .= ' AND (i.brand LIKE ? OR x.manufacturer LIKE ?) '; $args = array('%' . $manufacturer . '%', '%' . $manufacturer . '%'); } elseif ($supertype == 'vendor') { $query .= ' AND (i.default_vendor_id=? OR z.vendorID=?) '; $args = array($vendorID, $vendorID); } elseif ($supertype == 'upc') { $inp = ''; foreach ($upc_list as $u) { $inp .= '?,'; $args[] = $u; } $inp = substr($inp, 0, strlen($inp) - 1); $query .= ' AND i.upc IN (' . $inp . ') '; } else { $query .= ' AND i.department BETWEEN ? AND ? '; $args = array($deptStart, $deptEnd); if (is_array($subDepts) && count($subDepts) > 0) { $query .= ' AND i.subdept IN ('; foreach ($subDepts as $s) { $query .= '?,'; $args[] = $s; } } } if ($inUse == 1) { $query .= ' AND i.inUse=1 '; } else { $query .= ' AND i.inUse=0 '; } if ($store > 0) { $query .= ' AND i.store_id=? '; $args[] = $store; } /** finish building query w/ order clause **/ $query .= 'ORDER BY ' . $order; if ($order != "i.upc") { $query .= ",i.upc"; } $prep = $dbc->prepare_statement($query); $result = $dbc->exec_statement($prep, $args); if ($result === false || $dbc->num_rows($result) == 0) { return 'No data found!'; } $ret .= '<table class="table table-striped table-bordered tablesorter small"> <thead> <tr>'; $ret .= "<th>UPC</th><th>Brand</th><th>Description</th><th>Dept</th><th>" . _('Vendor') . "</th><th>Cost</th><th>Price</th>"; $ret .= "<th>Tax</th><th>FS</th><th>Disc</th><th>Wg'd</th><th>Local</th>"; if (!$this->excel && $this->canEditItems !== false) { $ret .= '<th> </th>'; } $ret .= "</tr></thead><tbody>"; $multi = $this->config->get('STORE_MODE') == 'HQ' ? true : false; while ($row = $dbc->fetch_row($result)) { $ret .= '<tr id="' . $row[0] . '">'; $enc = base64_encode($row[1]); if (!$this->excel) { $ret .= "<td align=center class=\"td_upc\"><a href=ItemEditorPage.php?searchupc={$row['0']}>{$row['0']}</a>"; if ($multi) { $ret .= ' (' . substr($row['storeName'], 0, 1) . ')'; } if ($this->canDeleteItems !== false) { $ret .= " <a href=\"\" onclick=\"deleteCheck('{$row['0']}','{$enc}'); return false;\">"; $ret .= \COREPOS\Fannie\API\lib\FannieUI::deleteIcon() . '</a>'; } $ret .= '</td>'; $ret .= '<input type="hidden" class="hidden_upc" value="' . $row[0] . '" />'; $ret .= '<input type="hidden" class="hidden_store_id" value="' . $row['store_id'] . '" />'; } else { $ret .= "<td align=center>{$row['0']}</td>"; } $ret .= "<td align=center class=\"td_brand clickable\">{$row['brand']}</td>"; $ret .= "<td align=center class=\"td_desc clickable\">{$row['description']}</td>"; $ret .= "<td align=center class=\"td_dept clickable\">{$row['department']}</td>"; $ret .= "<td align=center class=\"td_supplier clickable\">{$row['distributor']}</td>"; $ret .= "<td align=center class=\"td_cost clickable\">" . sprintf('%.2f', $row['cost']) . "</td>"; $ret .= "<td align=center class=\"td_price clickable\">{$row['normal_price']}</td>"; $ret .= "<td align=center class=td_tax>{$row['Tax']}</td>"; $ret .= "<td align=center class=td_fs>{$row['FS']}</td>"; $ret .= "<td align=center class=td_disc>{$row['DISC']}</td>"; $ret .= "<td align=center class=td_wgt>{$row['WGHd']}</td>"; $ret .= "<td align=center class=td_local>{$row['local']}</td>"; if (!$this->excel && $this->canEditItems !== False) { $ret .= "<td align=center class=td_cmd><a href=\"\" \n class=\"edit-link\"\n onclick=\"edit(\$(this).closest('tr')); return false;\">" . \COREPOS\Fannie\API\lib\FannieUI::editIcon() . '</a> <a href="" class="save-link collapse" onclick="save($(this).closest(\'tr\')); return false;">' . \COREPOS\Fannie\API\lib\FannieUI::saveIcon() . '</a></td>'; } $ret .= "</tr>\n"; } $ret .= '</tbody></table>'; if ($this->excel) { header('Content-Type: application/ms-excel'); header('Content-Disposition: attachment; filename="itemList.csv"'); $array = \COREPOS\Fannie\API\data\DataConvert::htmlToArray($ret); $ret = \COREPOS\Fannie\API\data\DataConvert::arrayToCsv($array); } else { $this->add_script('../src/javascript/tablesorter/jquery.tablesorter.min.js'); $this->add_onload_command("\$('.tablesorter').tablesorter();\n"); } return $ret; }
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; }
function body_content() { global $FANNIE_OP_DB, $FANNIE_URL; $filter = FormLib::get_form_value('filter', 1); $order = FormLib::get_form_value('order', 'num'); $orderby = ''; switch ($order) { case 'num': default: $orderby = 'emp_no'; break; case 'name': $orderby = 'FirstName'; break; case 'pass': $orderby = 'CashierPassword'; break; case 'fes': $orderby = 'frontendsecurity'; break; } $ret = '<div id="alert-area"></div><div class="form-inline">'; $ret .= "<label>Showing</label> <select class=\"form-control\"\n onchange=\"location='ViewCashiersPage.php?filter='+this.value;\">"; if ($filter == 1) { $ret .= "<option value=1 selected>Active Cashiers</option>"; $ret .= "<option value=0>Disabled Cashiers</option>"; } else { $ret .= "<option value=1>Active Cashiers</option>"; $ret .= "<option value=0 selected>Disabled Cashiers</option>"; } $ret .= "</select></div><hr />"; $ret .= "<table class=\"table\"><tr>"; $ret .= "<th><a href=ViewCashiersPage.php?filter={$filter}&order=num>#</th>"; $ret .= "<th><a href=ViewCashiersPage.php?filter={$filter}&order=name>Name</th>"; $ret .= "<th><a href=ViewCashiersPage.php?filter={$filter}&order=pass>Password</th>"; $ret .= "<th><a href=ViewCashiersPage.php?filter={$filter}&order=fes>Privileges</th>"; $ret .= "<th> </th><th> </th></tr>"; $dbc = FannieDB::get($FANNIE_OP_DB); $employees = new EmployeesModel($dbc); $employees->EmpActive($filter); foreach ($employees->find($orderby) as $emp) { $ret .= sprintf("<tr><td>%d</td><td>%s</td><td>%d</td><td>%s</td>", $emp->emp_no(), $emp->FirstName() . ' ' . $emp->LastName(), $emp->CashierPassword(), $emp->frontendsecurity() <= 20 ? 'Regular' : 'Manager'); $ret .= sprintf("<td><a href=\"CashierEditor.php?emp_no=%d\">%s</a></td>\n <td><a href=\"\" onclick=\"deleteEmp(%d,%d); return false;\">%s</a></td></tr>", $emp->emp_no(), \COREPOS\Fannie\API\lib\FannieUI::editIcon(), $emp->emp_no(), $filter, \COREPOS\Fannie\API\lib\FannieUI::deleteIcon()); } $ret .= "</table>"; return $ret; }
function body_content() { ob_start(); ?> <div id="bdiv"> <p><a href="#" onclick="window.open('SaScanningPage.php','scan','width=320, height=200, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no');">Enter a new scan</a></p> <p><a href="SaHandheldPage.php">Alternate Scan Page</a></p> <p><?php echo $this->sql_actions; ?> </p> <p><?php echo $this->status; ?> </p> <p><a href="?view=dept">view by pos department</a> <a href="SaReportPage.php">view by scanned section</a></p> <p><a href="?excel=yes">download as csv</a></p> <?php if ($this->scans) { $clear = '<div><a href="SaReportPage.php?clear=yes">Clear Old</a></div>'; print_r($clear); } $table = ''; $view = FormLib::get_form_value('view', 'dept'); $counter = $view == 'dept' ? 'd' : 's'; $counter_total = 0; foreach ($this->scans as $row) { if (!isset($counter_number)) { if ($counter == 'd') { $counter_number = $row['dept_no']; } else { $counter_number = $row['section']; } $counter_total = $row['quantity'] * $row['normal_retail']; if ($counter == 'd') { $caption = $row['dept_name'] . ' Department'; } else { $caption = 'Section #' . $row['section']; } $table .= ' <table class="table shelf-audit"> <caption>' . $caption . '</caption> <thead> <tr> <th>Date+Time</th> <th>UPC</th> <th>Description</th> <th>Qty</th> <th>Unit Cost</th> <th>Total Cost</th> <th>Retail (Normal)</th> <th>Retail (Current)</th> <th>Sale</th> <th>Total Retail</th> <th>Delete</th> </tr> </thead> <tbody> <tr> <td id="col_a" class="small">' . $row['datetime'] . '</td> <td id="col_b">' . $row['upc'] . '</td> <td id="col_c">' . $row['description'] . '</td> <td id="col_d" class="right">' . $row['quantity'] . '</td> <td id="col_e" class="right">' . money_format('%.2n', $row['cost']) . '</td> <td id="col_h" class="right">' . money_format('%!.2n', $row['quantity'] * $row['cost']) . '</td> <td id="col_e" class="right">' . money_format('%.2n', $row['normal_retail']) . '</td> <td id="col_f" class="right">' . money_format('%.2n', $row['actual_retail']) . '</td> <td id="col_g">' . ($row['retailstatus'] ? $row['retailstatus'] : ' ') . '</td> <td id="col_h" class="right">' . money_format('%!.2n', $row['quantity'] * $row['normal_retail']) . '</td> <td id="col_i"><a href="SaReportPage.php?delete=yes&id=' . $row['id'] . '">' . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon() . '</td> </tr>'; } else { if ($counter_number != $row['section'] && $counter_number != $row['dept_no']) { if ($counter == 'd') { $counter_number = $row['dept_no']; } else { $counter_number = $row['section']; } if ($counter == 'd') { $caption = $row['dept_name'] . ' Department'; } else { $caption = 'Section #' . $row['section']; } $table .= ' </tbody> <tfoot> <tr> <td colspan=6> </td> <td class="right">' . money_format('%.2n', $counter_total) . '</td> <td> </td> </tr> </tfoot> </table> <table class="table shelf-audit"> <caption>' . $caption . '</caption> <thead> <tr> <th>Date+Time</th> <th>UPC</th> <th>Description</th> <th>Qty</th> <th>Unit Cost</th> <th>Total Cost</th> <th>Retail (Normal)</th> <th>Retail (Current)</th> <th>Sale</th> <th>Total Retail</th> <th>Delete</th> </tr> </thead> <tbody> <tr> <td id="col_a" class="small">' . $row['datetime'] . '</td> <td id="col_b">' . $row['upc'] . '</td> <td id="col_c">' . $row['description'] . '</td> <td id="col_d" class="right">' . $row['quantity'] . '</td> <td id="col_e" class="right">' . money_format('%.2n', $row['cost']) . '</td> <td id="col_h" class="right">' . money_format('%!.2n', $row['quantity'] * $row['cost']) . '</td> <td id="col_e" class="right">' . money_format('%.2n', $row['normal_retail']) . '</td> <td id="col_f" class="right">' . money_format('%.2n', $row['actual_retail']) . '</td> <td id="col_g">' . ($row['retailstatus'] ? $row['retailstatus'] : ' ') . '</td> <td id="col_h" class="right">' . money_format('%!.2n', $row['quantity'] * $row['normal_retail']) . '</td> <td id="col_i"><a href="SaReportPage.php?delete=yes&id=' . $row['id'] . '">' . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon() . '</td> </tr>'; $counter_total = $row['quantity'] * $row['normal_retail']; } else { $counter_total += $row['quantity'] * $row['normal_retail']; $table .= ' <tr> <td id="col_a" class="small">' . $row['datetime'] . '</td> <td id="col_b">' . $row['upc'] . '</td> <td id="col_c">' . $row['description'] . '</td> <td id="col_d" class="right">' . $row['quantity'] . '</td> <td id="col_e" class="right">' . money_format('%.2n', $row['cost']) . '</td> <td id="col_h" class="right">' . money_format('%!.2n', $row['quantity'] * $row['cost']) . '</td> <td id="col_e" class="right">' . money_format('%.2n', $row['normal_retail']) . '</td> <td id="col_f" class="right">' . money_format('%.2n', $row['actual_retail']) . '</td> <td id="col_g">' . ($row['retailstatus'] ? $row['retailstatus'] : ' ') . '</td> <td id="col_h" class="right">' . money_format('%!.2n', $row['quantity'] * $row['normal_retail']) . '</td> <td id="col_i"><a href="SaReportPage.php?delete=yes&id=' . $row['id'] . '">' . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon() . '</td> </tr>'; } } } $table .= ' </tbody> <tfoot> <tr> <td colspan=6> </td> <td class="right">' . money_format('%.2n', $counter_total) . '</td> <td> </td> </tr> </tfoot> </table> </div> '; if (!empty($table)) { print_r($table); } ?> <?php return ob_get_clean(); }
private function vendorDeptDisplay($id) { global $FANNIE_OP_DB, $FANNIE_URL; $dbc = FannieDB::get($FANNIE_OP_DB); $v = new VendorsModel($dbc); $v->vendorID($id); $v->load(); $name = $v->vendorName(); $ret = "<strong>Subcategories in {$name}</strong><br />"; $ret .= "<table class=\"table\">"; $ret .= "<tr><th>No.</th><th>Name</th><th>Margin</th><th>POS Dept#</th>\n <th> </th><th> </th></tr>"; $deptQ = $dbc->prepare_statement("\n SELECT d.vendorID,\n deptID,\n name,\n margin,\n testing,\n posDeptID\n FROM vendorDepartments AS d\n WHERE d.vendorID=?\n ORDER BY deptID"); $deptR = $dbc->exec_statement($deptQ, array($id)); while ($row = $dbc->fetch_row($deptR)) { $ret .= sprintf("<tr id=\"row-%d\">\n <td>%d</td>\n <td id=nametd%d>%s</td>\n <td id=margintd%d>%.2f%%</td>\n <td id=posdepttd%d>%d</td>\n <td id=button%d>\n <a href=\"\" onclick=\"edit(%d);return false;\"\n class=\"edit-link\">%s</a>\n <a href=\"\" onclick=\"save(%d);return false;\"\n class=\"save-link collapse\">%s</a>\n </td>\n <td><a href=\"\" onclick=\"deleteCat(%d,'%s');return false\">%s</a></td>\n <td><a href=\"../../reports/VendorCategory/VendorCategoryReport.php?id=%d&category=%d\"\n title=\"View Items in this Category\">\n <span class=\"glyphicon glyphicon-th-list\"></span>\n </a></td>\n </tr>", $row['deptID'], $row['deptID'], $row['deptID'], $row['name'], $row['deptID'], $row['margin'] * 100, $row['deptID'], $row['posDeptID'], $row['deptID'], $row['deptID'], \COREPOS\Fannie\API\lib\FannieUI::editIcon(), $row['deptID'], \COREPOS\Fannie\API\lib\FannieUI::saveIcon(), $row['deptID'], $row['name'], \COREPOS\Fannie\API\lib\FannieUI::deleteIcon(), $id, $row['deptID']); } $ret .= "</table>"; $ret .= '<p><a href="VendorIndexPage.php?vid=' . $id . '" class="btn btn-default">Home</a></p>'; return $ret; }
public function get_view() { global $FANNIE_OP_DB; $reasons = new ShrinkReasonsModel(FannieDB::get($FANNIE_OP_DB)); $ret = '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <div id="alert-area"></div> <table class="table">'; foreach ($reasons->find('shrinkReasonID') as $reason) { $ret .= sprintf('<tr> <td><input type="text" class="form-control" name="desc[]" value="%s" /></td> <td><a href="%s?_method=delete&id=%d">%s</a></td> <input type="hidden" name="id[]" value="%d" /> </tr>', $reason->description(), $_SERVER['PHP_SELF'], $reason->shrinkReasonID(), \COREPOS\Fannie\API\lib\FannieUI::deleteIcon(), $reason->shrinkReasonID()); } $ret .= '</table>'; $ret .= '<p> <button type="submit" class="btn btn-default">Save Reasons</button> <a href="' . $_SERVER['PHP_SELF'] . '?new=1" class="btn btn-default">Add New Reason</a> </p> </form>'; return $ret; }
function batchListDisplay($filter = '', $mode = '', $maxBatchID = '') { global $FANNIE_URL; $dbc = $this->con; if ($mode === '') { $mode = $this->config->get('BATCH_VIEW', 'all'); } $colors = array('#ffffff', '#ffffcc'); $c = 0; $ret = ""; $ret .= "<b>Display</b>: "; if ($mode != 'pending') { $ret .= "<a href=\"\" onclick=\"changeTimeSlice('pending'); return false;\">Pending</a> | "; } else { $ret .= "Pending | "; } if ($mode != 'current') { $ret .= "<a href=\"\" onclick=\"changeTimeSlice('current'); return false;\">Current</a> | "; } else { $ret .= "Current | "; } if ($mode != 'historical') { $ret .= "<a href=\"\" onclick=\"changeTimeSlice('historical'); return false;\">Historical</a> | "; } else { $ret .= "Historical | "; } if ($mode != 'all') { $ret .= "<a href=\"\" onclick=\"changeTimeSlice('all'); return false;\">All</a>"; } else { $ret .= "All<br />"; } $sort = \COREPOS\Fannie\API\lib\FannieUI::tableSortIcons(); $ret .= '<table class="table tablesorter tablesorter-core"><thead>'; $ret .= "<tr><th bgcolor={$colors[$c]}>Batch Name{$sort}</th>"; $ret .= "<th bgcolor={$colors[$c]}>Type{$sort}</th>"; $ret .= "<th bgcolor={$colors[$c]}>Items{$sort}</th>"; $ret .= "<th bgcolor={$colors[$c]}>Start date{$sort}</th>"; $ret .= "<th bgcolor={$colors[$c]}>End date{$sort}</th>"; $ret .= "<th bgcolor={$colors[$c]}>Owner/Super Dept.{$sort}</th>"; $ret .= "<th colspan=\"3\"> </th></tr></thead><tbody>"; // owner column might be in different places // depending if schema is up to date $ownerclause = "'' as owner FROM batches AS b"; $batchesTable = $dbc->tableDefinition('batches'); $owneralias = ''; if (isset($batchesTable['owner'])) { $ownerclause = 'b.owner FROM batches AS b'; $owneralias = 'b'; } else { if ($dbc->tableExists('batchowner')) { $ownerclause = 'o.owner FROM batches AS b LEFT JOIN batchowner AS o ON b.batchID=o.batchID'; $owneralias = 'o'; } } // the 'all' query // where clause is for str_ireplace below $fetchQ = "SELECT b.batchName,\n b.batchType,\n b.startDate,\n b.endDate,\n b.batchID,\n t.typeDesc,\n COUNT(l.upc) AS items,\n {$ownerclause}\n LEFT JOIN batchType AS t ON b.batchType = t.batchTypeID\n LEFT JOIN batchList AS l ON b.batchID=l.batchID\n WHERE 1=1 "; $args = array(); switch ($mode) { case 'pending': $fetchQ .= ' AND ' . $dbc->datediff("b.startDate", $dbc->now()) . ' > 0 '; break; case 'current': $fetchQ .= ' AND ' . $dbc->datediff("b.startDate", $dbc->now()) . ' <= 0 AND ' . $dbc->datediff("b.endDate", $dbc->now()) . ' >= 0 '; break; case 'historical': $fetchQ .= ' AND ' . $dbc->datediff("b.startDate", $dbc->now()) . ' <= 0 '; break; } // use a filter - only works in 'all' mode if ($filter != '') { $fetchQ .= ' AND ' . $owneralias . '.owner = ? '; $args[] = $filter; } $fetchQ .= ' GROUP BY b.batchName, b.batchType, b.startDate, b.endDate, b.batchID, t.typeDesc, ' . $owneralias . '.owner '; $fetchQ .= ' ORDER BY b.batchID DESC'; $fetchQ = $dbc->add_select_limit($fetchQ, 50); if (is_numeric($maxBatchID)) { $fetchQ = str_replace("WHERE ", "WHERE b.batchID < ? AND ", $fetchQ); array_unshift($args, $maxBatchID); } $fetchR = $dbc->exec_statement($fetchQ, $args); $count = 0; $lastBatchID = 0; while ($fetchW = $dbc->fetch_array($fetchR)) { /** strtotime() and date() are not reciprocal functions date('Y-m-d', strtotime('0000-00-00')) results in -0001-11-30 instead of the expected 0000-00-00 */ if ($fetchW['startDate'] == '0000-00-00 00:00:00') { $fetchW['startDate'] = ''; } if ($fetchW['endDate'] == '0000-00-00 00:00:00') { $fetchW['endDate'] = ''; } $c = ($c + 1) % 2; $id = $fetchW['batchID']; $ret .= '<tr id="batchRow' . $fetchW['batchID'] . '" class="batchRow">'; $ret .= "<td bgcolor={$colors[$c]} id=name{$id}><a id=namelink{$id} \n href=\"EditBatchPage.php?id={$id}\">{$fetchW['batchName']}</a></td>"; $ret .= "<td bgcolor={$colors[$c]} id=type{$id}>" . $fetchW['typeDesc'] . "</td>"; $ret .= "<td bgcolor={$colors[$c]}>" . $fetchW['items'] . "</td>"; $ret .= "<td bgcolor={$colors[$c]} id=startdate{$id}>" . (strtotime($fetchW['startDate']) ? date('Y-m-d', strtotime($fetchW['startDate'])) : '') . "</td>"; $ret .= "<td bgcolor={$colors[$c]} id=enddate{$id}>" . (strtotime($fetchW['endDate']) ? date('Y-m-d', strtotime($fetchW['endDate'])) : '') . "</td>"; $ret .= "<td bgcolor={$colors[$c]} id=owner{$id}>{$fetchW['owner']}</td>"; $ret .= "<td bgcolor={$colors[$c]} id=edit{$id}>\n <a href=\"\" onclick=\"editBatchLine({$id}); return false;\" class=\"batchEditLink btn btn-default btn-xs\">\n " . \COREPOS\Fannie\API\lib\FannieUI::editIcon() . "\n </a>\n <a href=\"\" onclick=\"saveBatchLine({$id}); return false;\" class=\"batchSaveLink btn btn-default btn-xs collapse\">\n " . \COREPOS\Fannie\API\lib\FannieUI::saveIcon() . "\n </a>\n </td>"; $ret .= "<td bgcolor={$colors[$c]}><a href=\"\" class=\"btn btn-danger btn-xs\"\n onclick=\"deleteBatch({$id},'" . str_replace("'", '', $fetchW['batchName']) . "'); return false;\">" . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon() . '</a></td>'; $ret .= "<td bgcolor={$colors[$c]}><a href=\"batchReport.php?batchID={$id}\">Report</a></td>"; $ret .= "</tr>"; $count++; $lastBatchID = $fetchW[4]; } $ret .= "</tbody></table>"; if (is_numeric($maxBatchID)) { $ret .= sprintf("<a href=\"\" \n onclick=\"scroll(0,0); batchListPager('%s','%s',''); return false;\">First page</a>\n | ", $filter, $mode); } if ($count >= 50) { $ret .= sprintf("<a href=\"\" \n onclick=\"scroll(0,0); batchListPager('%s','%s',%d); return false;\">Next page</a>", $filter, $mode, $lastBatchID); } else { $ret .= "Next page"; } return $ret; }
private function editableItemList($orderID) { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $TRANS = $this->config->get('TRANS_DB') . $dbc->sep(); $deptP = $dbc->prepare_statement("SELECT dept_no,dept_name FROM departments order by dept_no"); $deptR = $dbc->exec_statement($deptP); $depts = array(0 => 'Unassigned'); while ($deptW = $dbc->fetch_row($deptR)) { $depts[$deptW['dept_no']] = $deptW['dept_name']; } $ret = '<table class="table table-bordered table-striped">'; $ret .= '<tr><th>UPC</th><th>SKU</th><th>Description</th><th>Cases</th><th>SRP</th><th>Actual</th><th>Qty</th><th>Dept</th><th> </th></tr>'; $prep = $dbc->prepare_statement("SELECT o.upc,o.description,total,quantity,department,\n v.sku,ItemQtty,regPrice,o.discounttype,o.charflag,o.mixMatch,\n o.trans_id,o.unitPrice,o.memType,o.staff\n FROM {$TRANS}PendingSpecialOrder as o\n left join vendorItems as v on o.upc=v.upc AND vendorID=1\n WHERE order_id=? AND trans_type='I' \n ORDER BY trans_id DESC"); $res = $dbc->exec_statement($prep, array($orderID)); $num_rows = $dbc->num_rows($res); $prev_id = 0; while ($row = $dbc->fetch_row($res)) { if ($row['trans_id'] == $prev_id) { continue; } $ret .= sprintf(' <tbody> <tr> <td>%s</td> <td>%s</td> <td><input class="form-control input-sm item-field" name="description" value="%s" /></td> <td>%d</td> <td><input size="5" class="form-control input-sm price-field item-field" id="srp%d" name="srp" value="%.2f" /></td> <td><input size="5" class="form-control input-sm price-field item-field" id="act%d" value="%.2f" name="actual" /></td> <td><input size="4" class="form-control input-sm price-field item-field" value="%.2f" name="qty" /></td> <td><select class="form-control input-sm editDept item-field" name="dept">', $row['upc'], !empty($row['sku']) ? $row['sku'] : ' ', $row['description'], $row['ItemQtty'], $row['trans_id'], $row['regPrice'], $row['trans_id'], $row['total'], $row['quantity']); foreach ($depts as $id => $name) { $ret .= sprintf('<option value="%d" %s>%d %s</option>', $id, $id == $row['department'] ? 'selected' : '', $id, $name); } $ret .= sprintf('</select></td> <td><a href="" data-order="%d" data-trans="%d" class="btn btn-danger btn-xs btn-delete">%s</a></td> </tr>', $orderID, $row['trans_id'], \COREPOS\Fannie\API\lib\FannieUI::deleteIcon()); $ret .= '<tr>'; $ret .= sprintf('<td colspan="2" align="right" class="form-inline">Unit Price: <input type="text" size="4" value="%.2f" id="unitp%d" name="unitPrice" class="form-control input-sm price-field item-field" /></td>', $row['unitPrice'], $row['trans_id']); $ret .= sprintf('<td class="form-inline">Supplier: <input type="text" value="%s" size="12" class="form-control input-sm item-field" name="vendor" maxlength="26" /></td>', $row['mixMatch']); $ret .= '<td>Discount</td>'; if ($row['discounttype'] == 1 || $row['discounttype'] == 2) { $ret .= '<td class="disc-percent" id="discPercent' . $row['trans_id'] . '">Sale</td>'; } else { if ($row['regPrice'] != $row['total']) { $ret .= sprintf('<td class="disc-percent" id="discPercent%d">%d%%</td>', $row['upc'], round(100 * (($row['regPrice'] - $row['total']) / $row['regPrice']))); } else { $ret .= '<td class="disc-percent" id="discPercent' . $row['upc'] . '">0%</td>'; } } $ret .= sprintf('<td colspan="2">Printed: %s</td>', $row['charflag'] == 'P' ? 'Yes' : 'No'); if ($num_rows > 1) { $ret .= sprintf('<td colspan="2"><a href="" class="btn btn-default btn-sm" onclick="orderView.doSplit(%d,%d);return false;">Split Item to New Order</a><br /> O <input type="checkbox" class="itemChkO" %s data-order="%d" data-trans="%d" /> A <input type="checkbox" class="itemChkA" %s data-order="%d" data-trans="%d" /> </td>', $orderID, $row['trans_id'], $row['memType'] > 0 ? 'checked' : '', $orderID, $row['trans_id'], $row['staff'] > 0 ? 'checked' : '', $orderID, $row['trans_id']); } else { $ret .= '<td colspan="2"></td>'; } $ret .= '</tr>'; $ret .= '<tr><td class="small" colspan="9"><span style="font-size:1;"> </span>'; $ret .= '<input type="hidden" name="transID" class="item-field" value="' . $row['trans_id'] . '" /></td></tr>'; $ret .= '</tbody>'; $prev_id = $row['trans_id']; } $ret .= '</table>'; return $ret; }
public function get_view() { $obj = $this->getCRUDModel(); $id_col = $this->getIdCol(); $columns = $obj->getColumns(); $ret = '<form class="crud-form" method="post">'; $ret .= '<div class="flash-div">'; $ret .= array_reduce(\FormLib::get('flash', array()), function ($carry, $item) { $css = ''; switch (substr($item, 0, 1)) { case 's': $css = 'alert-success'; break; case 'd': $css = 'alert-danger'; break; } $carry .= '<div class="alert ' . $css . '" role="alert">' . substr($item, 1) . '<button type="button" class="close" data-dismiss="alert">' . '<span>×</span></button>' . '</div>'; return $carry; }, ''); $ret .= '</div>'; $ret .= '<table class="table table-bordered">'; $ret .= '<tr>'; foreach ($columns as $col_name => $c) { if ($col_name != $id_col) { if (isset($this->column_name_map[$col_name])) { $col_name = $this->column_name_map[$col_name]; } $ret .= '<th>' . ucwords($col_name) . '</th>'; } } $ret .= '</tr>'; $sort = !empty($this->display_sorting) ? $this->display_sorting : $id_col; foreach ($obj->find($sort) as $o) { $ret .= '<tr>'; foreach ($columns as $col_name => $c) { if ($col_name == $id_col) { $ret .= '<input type="hidden" name="id[]" value="' . $o->{$id_col}() . '" />'; } else { $css = 'form-control'; if (strtoupper($c['type'] == 'DATETIME')) { $css .= ' date-field'; } $ret .= sprintf('<td><input type="text" class="%s" name="%s[]" value="%s" /></td>', $css, $col_name, $o->{$col_name}()); } } $ret .= sprintf('<td> <a href="?_method=delete&id=%s" class="btn btn-xs btn-default btn-danger" onclick="return confirm(\'Delete entry?\');"> ' . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon() . '</a> </td>', $o->{$id_col}()); $ret .= '</tr>'; } $ret .= '</table>'; $ret .= '<p> <button type="submit" class="btn btn-default">Save Changes</button> <a href="" onclick="addEntry(); return false;" class="btn btn-default">Add Entry</a> </p>'; $ret .= '</form>'; $ret .= '<script type="text/javascript"> function addEntry() { $.ajax({ method: "PUT", dataType: "json", success: function(resp) { if (resp.added) { $("form.crud-form").submit(); } else { showBootstrapAlert(".flash-div", "danger", "Error adding entry"); } } }); } </script>'; return $ret; }
protected function get_view() { $privs = new UserKnownPrivsModel($this->connection); $pages = FannieAPI::listModules('FanniePage'); sort($pages); $custom = new PagePermissionsModel($this->connection); $ret = '<form method="post"> <div class="panel panel-default"> <div class="panel-heading">Create Custom Permissions</div> <div class="panel-body"> <div class="form-group"> <label>Page</label> <select name="page" class="form-control"> <option value="">Choose page</option> ' . array_reduce($pages, function ($carry, $page) { return $carry . '<option>' . $page . '</option>'; }) . ' </select> </div> <div class="form-group"> <label>Permission Class</label> <select name="auth" class="form-control"> ' . $privs->toOptions(-1, true) . ' </select> </div> <div class="form-group"> <button type="submit" class="btn btn-default btn-core">Create</button> </div> </div> </div> </form> <div class="panel panel-default"> <div class="panel-heading">Pages With Custom Permissions</div> <div class="panel-body"> <table class="table table-bordered table-striped"> <tr><th>Name</th><th>Description</th><th> </th></tr> ' . array_reduce($custom->find('pageClass'), function ($carry, $obj) { $page_class = $obj->pageClass(); $page = new $page_class(); return $carry . sprintf('<tr><td>%s</td><td>%s</td><td> <a href="_method=delete&id=%s" class="btn btn-danger btn-xs">%s</a></td></tr>', $page_class, $page->description, $page_class, \COREPOS\Fannie\API\lib\FannieUI::deleteIcon()); }) . ' </table> </div> </div> '; return $ret; }
private function pairedTableBody($dbc, $result) { $colors = array('#ffffff', '#ffffcc'); $cur = 0; $FANNIE_URL = $this->config->get('URL'); $ret = ''; while ($fetchW = $dbc->fetch_array($result)) { $cur = ($cur + 1) % 2; $ret .= "<tr>"; $fetchW[0] = rtrim($fetchW[0]); if (substr($fetchW[0], 0, 2) == "LC") { $likecode = rtrim(substr($fetchW[0], 2)); $ret .= "<td bgcolor={$colors[$cur]}>" . $fetchW['upc']; $ret .= " <a href=\"\" onclick=\"\$('.lc-item-{$likecode}').toggle(); return false;\">[+]</a>"; $ret .= "</td>"; } else { $ret .= "<td bgcolor={$colors[$cur]}><a href={$FANNIE_URL}item/ItemEditorPage.php?searchupc={$fetchW['0']} target=_new{$fetchW['0']}>{$fetchW['0']}</a></td>"; } $ret .= "<td bgcolor={$colors[$cur]}>{$fetchW['1']}</td>"; $ret .= "<td bgcolor={$colors[$cur]}>\n <a href=\"\" class=\"down-arrow\" onclick=\"swapQualifierToDiscount(this, '{$fetchW['0']}'); return false;\">\n <img src=\"{$FANNIE_URL}src/img/buttons/arrow_down.gif\" alt=\"Make Discount Item\" /></a>\n <a href=\"\" class=\"up-arrow collapse\" onclick=\"swapDiscountToQualifier(this, '{$fetchW['0']}'); return false;\">\n <img src=\"{$FANNIE_URL}src/img/buttons/arrow_up.gif\" alt=\"Make Qualifying Item\" />\n </a>\n </td>"; $ret .= "<td bgcolor={$colors[$cur]}><a href=\"\" onclick=\"deleteUPC.call(this, {$fetchW['batchID']}, '{$fetchW['0']}'); return false;\">" . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon() . '</a></td>'; $ret .= "</tr>"; if (substr($fetchW['upc'], 0, 2) == "LC") { $likecode = rtrim(substr($fetchW['upc'], 2)); $ret .= self::likeToTable($dbc, $likecode, $fetchW['salePrice']); } } return $ret; }