function preprocess() { $AR_department = '990'; if (CoreLocal::get("store") == 'WEFC_Toronto') { $AR_department = '1005'; } if (isset($_REQUEST['reginput'])) { $dec = $_REQUEST['reginput']; $amt = CoreLocal::get("old_ar_balance"); CoreLocal::set("msgrepeat", 0); CoreLocal::set("strRemembered", ""); if (strtoupper($dec) == "CL") { if (CoreLocal::get('memType') == 0) { PrehLib::setMember(CoreLocal::get("defaultNonMem"), 1); } $this->change_page($this->page_url . "gui-modules/pos2.php"); return False; } elseif ($dec == "" || strtoupper($dec) == "BQ") { if (strtoupper($dec) == "BQ") { $amt = CoreLocal::get("balance"); } CoreLocal::set("strRemembered", $amt * 100 . "DP{$AR_department}0"); CoreLocal::set("msgrepeat", 1); $memtype = CoreLocal::get("memType"); $type = CoreLocal::get("Type"); if ($memtype == 1 || $memtype == 3 || $type == "INACT") { CoreLocal::set("isMember", 1); PrehLib::ttl(); } $this->change_page($this->page_url . "gui-modules/pos2.php"); return False; } } return True; }
function preprocess() { $this->box_color = "coloredArea"; $this->msg = "Undo transaction"; if (isset($_REQUEST['reginput'])) { $trans_num = strtoupper($_REQUEST['reginput']); // clear/cancel undo attempt if ($trans_num == "" || $trans_num == "CL") { $this->change_page($this->page_url . "gui-modules/pos2.php"); return False; } // error: malformed transaction number if (!strpos($trans_num, "-")) { $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } $temp = explode("-", $trans_num); // error: malformed transaction number (2) if (count($temp) != 3) { $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } $emp_no = $temp[0]; $register_no = $temp[1]; $old_trans_no = $temp[2]; // error: malformed transaction number (3) if (!is_numeric($emp_no) || !is_numeric($register_no) || !is_numeric($old_trans_no)) { $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } $db = 0; $query = ""; if ($register_no == CoreLocal::get("laneno")) { // look up transation locally $db = Database::tDataConnect(); $query = "select upc, description, trans_type, trans_subtype,\n trans_status, department, quantity, scale, unitPrice,\n total, regPrice, tax, foodstamp, discount, memDiscount,\n discountable, discounttype, voided, PercentDiscount,\n ItemQtty, volDiscType, volume, VolSpecial, mixMatch,\n matched, card_no, trans_id\n from localtranstoday where register_no = {$register_no}\n and emp_no = {$emp_no} and trans_no = {$old_trans_no}\n and datetime >= " . $db->curdate() . "\n and trans_status <> 'X'\n order by trans_id"; } else { if (CoreLocal::get("standalone") == 1) { // error: remote lookups won't work in standalone $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } else { // look up transaction remotely $db = Database::mDataConnect(); $query = "select upc, description, trans_type, trans_subtype,\n trans_status, department, quantity, scale, unitPrice,\n total, regPrice, tax, foodstamp, discount, memDiscount,\n discountable, discounttype, voided, PercentDiscount,\n ItemQtty, volDiscType, volume, VolSpecial, mixMatch,\n matched, card_no, trans_id\n from dtransactions where register_no = {$register_no}\n and emp_no = {$emp_no} and trans_no = {$old_trans_no}\n and datetime >= " . $db->curdate() . "\n and trans_status <> 'X'\n order by trans_id"; } } $result = $db->query($query); // transaction not found if ($db->num_rows($result) < 1) { $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } /* change the cashier to the original transaction's cashier */ $prevCashier = CoreLocal::get("CashierNo"); CoreLocal::set("CashierNo", $emp_no); CoreLocal::set("transno", Database::gettransno($emp_no)); /* rebuild the transaction, line by line, in reverse */ $card_no = 0; TransRecord::addcomment("VOIDING TRANSACTION {$trans_num}"); while ($row = $db->fetch_array($result)) { $card_no = $row["card_no"]; if ($row["upc"] == "TAX") { //TransRecord::addtax(); } elseif ($row["trans_type"] == "T") { if ($row["description"] == "Change") { TransRecord::addchange(-1 * $row["total"]); } elseif ($row["description"] == "FS Change") { TransRecord::addfsones(-1 * $row["total"]); } else { TransRecord::addtender($row["description"], $row["trans_subtype"], -1 * $row["total"]); } } elseif (strstr($row["description"], "** YOU SAVED")) { $temp = explode("\$", $row["description"]); TransRecord::adddiscount(substr($temp[1], 0, -3), $row["department"]); } elseif ($row["upc"] == "FS Tax Exempt") { TransRecord::addfsTaxExempt(); } elseif (strstr($row["description"], "% Discount Applied")) { $temp = explode("%", $row["description"]); TransRecord::discountnotify(substr($temp[0], 3)); } elseif ($row["description"] == "** Order is Tax Exempt **") { TransRecord::addTaxExempt(); } elseif ($row["description"] == "** Tax Excemption Reversed **") { TransRecord::reverseTaxExempt(); } elseif ($row["description"] == " * Manufacturers Coupon") { TransRecord::addCoupon($row["upc"], $row["department"], -1 * $row["total"]); } elseif (strstr($row["description"], "** Tare Weight")) { $temp = explode(" ", $row["description"]); TransRecord::addTare($temp[3] * 100); } elseif ($row["upc"] == "DISCOUNT") { //TransRecord::addTransDiscount(); } elseif ($row["trans_status"] != "M" && $row["upc"] != "0" && (is_numeric($row["upc"]) || strstr($row["upc"], "DP"))) { $row["trans_status"] = "V"; $row["total"] *= -1; $row["discount"] *= -1; $row["memDiscount"] *= -1; $row["quantity"] *= -1; $row["ItemQtty"] *= -1; TransRecord::addRecord($row); } } PrehLib::setMember($card_no, 1); CoreLocal::set("autoReprint", 0); /* do NOT restore logged in cashier until this transaction is complete */ $this->change_page($this->page_url . "gui-modules/undo_confirm.php"); return False; } return True; }
function preprocess() { $entered = ""; if (isset($_REQUEST['idSearch']) && strlen($_REQUEST['idSearch']) > 0) { $entered = $_REQUEST['idSearch']; } elseif (isset($_REQUEST['search'])) { $entered = strtoupper(trim($_REQUEST["search"])); $entered = str_replace("'", '', $entered); } else { return true; } if (substr($entered, -2) == "ID") { $entered = substr($entered, 0, strlen($entered) - 2); } // No input available, stop if (!$entered || strlen($entered) < 1 || $entered == "CL") { $this->change_page($this->page_url . "gui-modules/pos2.php"); return false; } $personNum = false; $memberID = false; $this->submitted = true; if (strstr($entered, "::") !== false) { // User selected a :: delimited item from the list interface list($memberID, $personNum) = explode("::", $entered, 2); } else { // search for the member $lookups = AutoLoader::ListModules('MemberLookup', True); foreach ($lookups as $class) { if (!class_exists($class)) { continue; } $obj = new $class(); if (is_numeric($entered) && !$obj->handle_numbers()) { continue; } else { if (!is_numeric($entered) && !$obj->handle_text()) { continue; } else { if (is_numeric($entered)) { $chk = $obj->lookup_by_number($entered); if ($chk['url'] !== false) { $this->change_page($chk['url']); return false; } foreach ($chk['results'] as $key => $val) { $this->results[$key] = $val; } } elseif (!is_numeric($entered)) { $chk = $obj->lookup_by_text($entered); if ($chk['url'] !== false) { $this->change_page($chk['url']); return false; } foreach ($chk['results'] as $key => $val) { $this->results[$key] = $val; } } } } } if (count($this->results) == 1 && (CoreLocal::get('verifyName') == 0 || $entered == CoreLocal::get('defaultNonMem'))) { $members = array_keys($this->results); $match = $members[0]; list($memberID, $personNum) = explode('::', $match, 2); } } // we have exactly one row and // don't need to confirm any further if ($memberID !== false && $personNum !== false) { $callback = $this->getCallbackAction($memberID); if ($callback != false) { $callback->apply(); } if ($memberID == CoreLocal::get('defaultNonMem')) { $personNum = 1; } PrehLib::setMember($memberID, $personNum); if (CoreLocal::get('store') == "WEFC_Toronto") { $error_msg = $this->wefcCardCheck($memberID); if ($error_msg !== true) { $this->temp_message = $error_msg; return true; } } // don't bother with unpaid balance check if there is no balance if ($memberID != CoreLocal::get("defaultNonMem") && CoreLocal::get('balance') > 0) { $unpaid = PrehLib::check_unpaid_ar($memberID); if ($unpaid) { $this->change_page($this->page_url . "gui-modules/UnpaidAR.php"); } else { $this->change_page($this->page_url . "gui-modules/pos2.php"); } } else { $this->change_page($this->page_url . "gui-modules/pos2.php"); } return false; } return true; }