public function preprocess() { $this->upc = FormLib::get('upc'); if (FormLib::get('reginput', false) !== false) { $inp = FormLib::get('reginput'); if (strtoupper($inp) == 'CL') { $this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php'); return false; } $dbc = Database::pDataConnect(); $empP = $dbc->prepare(' SELECT emp_no FROM employees WHERE EmpActive=1 AND frontendsecurity >= ? AND (CashierPassword=? OR AdminPassword=?)'); if ($dbc->getValue($empP, array(30, $inp, $inp)) !== false) { CoreLocal::set('strRemembered', $this->upc); CoreLocal::set('msgrepeat', 1); $arr = CoreLocal::get('WicOverride'); if (!is_array($arr)) { $arr = array(); } $arr[] = ltrim($this->upc, '0'); CoreLocal::set('WicOverride', $arr); $this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php'); return false; } else { $this->box_color = 'errorColoredArea'; } } return true; }
/** Display the notification @return [string] html */ public function draw() { if (CoreLocal::get('PaycardsCashierFacing') == '1') { return ''; } // style box to look like a little screen $ret = '<div style="background:#ccc;border:solid 1px black;padding:7px;text-align:center;font-size:120%;">'; $rdy = '<div style="background:#0c0;border:solid 1px black;padding:7px;text-align:center;font-size:120%;">'; switch (CoreLocal::get('ccTermState')) { case 'swipe': return $ret . 'Slide<br />Card</div>'; break; case 'ready': return $rdy . 'Ready</div>'; break; case 'pin': return $ret . 'Enter<br />PIN</div>'; break; case 'type': return $ret . 'Card<br />Type</div>'; break; case 'cashback': return $ret . 'Cash<br />Back</div>'; break; } return ''; }
function addItem($row, $quantity, $priceObj) { if ($quantity == 0) { return False; } // enforce limit on discounting sale items $dsi = CoreLocal::get('DiscountableSaleItems'); if ($dsi == 0 && $dsi !== '' && $priceObj->isSale()) { $row['discount'] = 0; } /* Use "quantity" field in products record as a per-transaction limit. This is analogous to a similar feature with sale items. */ if (!$priceObj->isSale() && $row['quantity'] > 0) { $db = Database::tDataConnect(); $query = "SELECT SUM(quantity) as qty FROM localtemptrans\n WHERE upc='{$row['upc']}'"; $result = $db->query($query); if ($db->num_rows($result) > 0) { $chkRow = $db->fetch_row($result); if ($chkRow['qty'] + $quantity > $row['quantity']) { $this->error_msg = _("item only allows ") . $row['quantity'] . _(" per transaction"); return False; } } } $pricing = $priceObj->priceInfo($row, $quantity); TransRecord::addRecord(array('upc' => $row['upc'], 'description' => $row['description'], 'trans_type' => 'I', 'trans_subtype' => isset($row['trans_subtype']) ? $row['trans_subtype'] : '', 'department' => $row['department'], 'quantity' => $quantity, 'unitPrice' => $pricing['unitPrice'], 'total' => MiscLib::truncate2($pricing['unitPrice'] * $quantity), 'regPrice' => $pricing['regPrice'], 'scale' => $row['scale'], 'tax' => $row['tax'], 'foodstamp' => $row['foodstamp'], 'discount' => $pricing['discount'], 'memDiscount' => $pricing['memDiscount'], 'discountable' => $row['discount'], 'discounttype' => $row['discounttype'], 'ItemQtty' => $quantity, 'volDiscType' => $row['pricemethod'], 'volume' => $row['quantity'], 'VolSpecial' => $row['groupprice'], 'mixMatch' => $row['mixmatchcode'], 'cost' => isset($row['cost']) ? $row['cost'] * $quantity : 0.0, 'numflag' => isset($row['numflag']) ? $row['numflag'] : 0, 'charflag' => isset($row['charflag']) ? $row['charflag'] : '')); return true; }
function preprocess() { if (isset($_REQUEST['doLookup'])) { $ref = $_REQUEST['id']; $local = $_REQUEST['local']; $mode = $_REQUEST['mode']; $obj = null; $resp = array(); foreach (CoreLocal::get('RegisteredPaycardClasses') as $rpc) { $obj = new $rpc(); if ($obj->myRefNum($ref)) { break; } else { $obj = null; } } if ($obj === null) { $resp['output'] = DisplayLib::boxMsg('Invalid Transaction ID' . '<br />Local System Error', '', true); $resp['confirm_dest'] = MiscLib::base_url() . 'gui-modules/pos2.php'; $resp['cancel_dest'] = MiscLib::base_url() . 'gui-modules/pos2.php'; } else { if ($local == 0 && $mode == 'verify') { $resp['output'] = DisplayLib::boxMsg('Cannot Verify - Already Complete' . '<br />Local System Error', '', true); $resp['confirm_dest'] = MiscLib::base_url() . 'gui-modules/pos2.php'; $resp['cancel_dest'] = MiscLib::base_url() . 'gui-modules/pos2.php'; } else { $resp = $obj->lookupTransaction($ref, $local, $mode); } } echo JsonLib::array_to_json($resp); return false; } return true; }
public function body_content() { echo $this->noinput_header(); ?> <div class="baseHeight"> <?php if (CoreLocal::get("plainmsg") && strlen(CoreLocal::get("plainmsg")) > 0) { echo DisplayLib::printheaderb(); echo "<div class=\"centerOffset\">"; echo DisplayLib::plainmsg(CoreLocal::get("plainmsg")); echo "</div>"; } else { // No input and no messages, so // list the items if (CoreLocal::get("End") == 1) { echo DisplayLib::printReceiptfooter(true); } else { echo DisplayLib::lastpage(true); } } echo "</div>"; // end base height echo "<div id=\"footer\">"; echo DisplayLib::printfooter(true); echo '</div>'; }
public function __construct($refNum) { $this->refNum = $refNum; $this->today = date('Ymd'); // numeric date only, it goes in an 'int' field as part of the primary key $this->now = date('Y-m-d H:i:s'); // full timestamp $this->cashierNo = CoreLocal::get("CashierNo"); $this->laneNo = CoreLocal::get("laneno"); $this->transNo = CoreLocal::get("transno"); $this->transID = CoreLocal::get("paycard_id"); $this->setType(CoreLocal::get('CacheCardType')); $this->amount = CoreLocal::get("paycard_amount"); if (($this->type == "Debit" || $this->type == "EBTCASH") && $this->amount > CoreLocal::get("amtdue")) { $this->cashback = $this->amount - CoreLocal::get("amtdue"); $this->amount = CoreLocal::get("amtdue"); } else { $this->cashback = 0; } $this->mode = $this->amount < 0 ? 'Return' : 'Sale'; $this->manual = CoreLocal::get("paycard_keyed") === True ? 1 : 0; $this->live = 1; if (CoreLocal::get("training") != 0 || CoreLocal::get("CashierNo") == 9999) { $this->live = 0; } $this->cardholder = 'Cardholder'; }
protected function ajax() { CoreLocal::set("cabReference", $_REQUEST['input']); $receipt = ReceiptLib::printReceipt('cab', CoreLocal::get('cabReference')); ReceiptLib::writeLine($receipt); return 'Done'; }
function preprocess() { if (isset($_REQUEST["selectlist"])) { $input = $_REQUEST["selectlist"]; if ($input == "CL") { CoreLocal::set("msgrepeat", 0); CoreLocal::set("strRemembered", ""); CoreLocal::set("refundComment", ""); } else { if ($input == "Other") { return True; } else { $input = str_replace("'", "", $input); CoreLocal::set("strRemembered", CoreLocal::get("refundComment")); // add comment calls additem(), which wipes // out refundComment; save it TransRecord::addcomment("PO: " . $input); CoreLocal::set("refundComment", CoreLocal::get("strRemembered")); CoreLocal::set("msgrepeat", 1); //CoreLocal::set("refund",1); } } $this->change_page($this->page_url . "gui-modules/pos2.php"); return False; } return True; }
public function handle($upc, $json) { $my_url = MiscLib::base_url(); switch (ltrim($upc, '0')) { case '8006': if (CoreLocal::get("memberID") == 0) { $json['main_frame'] = $my_url . 'gui-modules/memlist.php'; } else { if (CoreLocal::get("msgrepeat") == 0) { CoreLocal::set("boxMsg", "<B>" . $total . " stock payment</B><BR>insert form<BR>press [enter] to endorse<P><FONT size='-1'>[clear] to cancel</FONT>"); $ret["main_frame"] = $my_url . "gui-modules/boxMsg2.php?endorse=stock&endorseAmt=" . $total; } } break; case '8005': if (CoreLocal::get("memberID") == 0) { $json['main_frame'] = $my_url . 'gui-modules/memlist.php'; } elseif (CoreLocal::get("isMember") == 0) { $json['output'] = DisplayLib::boxMsg(_("member discount not applicable"), '', false, DisplayLib::standardClearButton()); } elseif (CoreLocal::get("percentDiscount") > 0) { $json['output'] = DisplayLib::boxMsg(CoreLocal::get("percentDiscount") . "% discount already applied", '', false, DisplayLib::standardClearButton()); } break; } // magic plu, but other conditions not matched if ($json['main_frame'] === false && empty($json['output'])) { $json['output'] = DisplayLib::boxMsg($upc . "<br />is not a valid item", '', false, DisplayLib::standardClearButton()); } return $json; }
function kickOnSignOut() { if (CoreLocal::get('training') == 1) { return False; } return True; }
function parse($str) { $curID = CoreLocal::get("currentid"); $dbc = Database::tDataConnect(); $query = "SELECT trans_type,tax,foodstamp FROM localtemptrans WHERE trans_id={$curID}"; $res = $dbc->query($query); if ($dbc->num_rows($res) == 0) { return True; } // shouldn't ever happen $item = $dbc->fetch_row($res); $query = "SELECT MAX(id) FROM taxrates"; $res = $dbc->query($query); $tax_cap = 0; if ($dbc->num_rows($res) > 0) { $taxID = $dbc->fetch_row($res); $max = $taxID[0]; if (!empty($max)) { $tax_cap = $max; } } $dbc->query($query); $next_tax = $item['tax'] + 1; $next_fs = 0; if ($next_tax > $max) { $next_tax = 0; $next_fs = 1; } $query = "UPDATE localtemptrans \n set tax={$next_tax},foodstamp={$next_fs} \n WHERE trans_id={$curID}"; $dbc->query($query); $ret = $this->default_json(); $ret['output'] = DisplayLib::listItems(CoreLocal::get("currenttopid"), $curID); return $ret; // maintain item cursor position }
/** Implementation function @return SQL result object */ public function fetch($empNo = false, $laneNo = false, $transNo = false) { $op_db = CoreLocal::get('pDatabase'); $sql = Database::tDataConnect(); $join_table = $op_db . $sql->sep() . 'MasterSuperDepts'; $column = 's.super_name'; if (!$sql->table_exists($join_table)) { $join_table = $op_db . $sql->sep() . 'subdepts'; $column = 's.subdept_name'; } $query = 'SELECT l.upc,l.trans_type,l.description, l.total,l.percentDiscount,l.trans_status, l.charflag,l.scale,l.quantity,l.unitPrice, l.ItemQtty,l.matched,l.numflag,l.tax, l.foodstamp,l.trans_id,l.department, l.trans_subtype,l.regPrice, ' . $column . ' AS category FROM localtemptrans AS l LEFT JOIN ' . $join_table . ' AS s ON l.department=s.dept_ID WHERE trans_type <> \'L\' ORDER BY trans_id DESC'; if ($empNo && $laneNo && $transNo) { $query = sprintf("SELECT l.upc,l.trans_type,l.description,\n l.total,l.percentDiscount,l.trans_status,\n l.charflag,l.scale,l.quantity,l.unitPrice,\n l.ItemQtty,l.matched,l.numflag,l.tax,\n l.foodstamp,l.trans_id,l.department,\n l.trans_subtype,l.regPrice,\n " . $column . " AS category \n FROM localtranstoday as l \n LEFT JOIN " . $join_table . " AS s ON l.department=s.dept_ID\n WHERE trans_type <> 'L' AND\n emp_no=%d AND register_no=%d AND trans_no=%d\n AND datetime >= " . $sql->curdate() . "\n ORDER BY trans_id DESC", $empNo, $laneNo, $transNo); } $result = $sql->query($query); return $result; }
function check($str) { // only check & warn once per transaction if (CoreLocal::get('cashDropWarned') == True) { return False; } // checking one time CoreLocal::set('cashDropWarned', True); // cannot check in standalone if (CoreLocal::get('standalone') == 1) { return False; } // lookup cashier total $db = Database::mDataConnect(); $q = sprintf("SELECT sum(-total) FROM dtransactions WHERE\n trans_subtype='CA' AND trans_status <> 'X' AND emp_no=%d", CoreLocal::get('CashierNo')); $r = $db->query($q); $ttl = 0; if ($db->num_rows($r) > 0) { $row = $db->fetch_row($r); $ttl = $row[0]; } if ($ttl > CoreLocal::get('cashDropThreshold')) { return True; } else { return False; } }
function tender_out($asTender) { $ret = $this->default_json(); Database::getsubtotals(); if (CoreLocal::get("amtdue") <= 0.005) { CoreLocal::set("change", -1 * CoreLocal::get("amtdue")); $cash_return = CoreLocal::get("change"); if ($asTender != "FS") { TransRecord::addchange($cash_return, 'CA'); } CoreLocal::set("End", 1); $ret['output'] = DisplayLib::printReceiptFooter(); $ret['redraw_footer'] = true; $ret['receipt'] = 'full'; TransRecord::finalizeTransaction(); } else { CoreLocal::set("change", 0); CoreLocal::set("fntlflag", 0); $ttl_result = PrehLib::ttl(); TransRecord::debugLog('Tender Out (PrehLib): ' . print_r($ttl_result, true)); TransRecord::debugLog('Tender Out (amtdue): ' . print_r(CoreLocal::get('amtdue'), true)); $ret['output'] = DisplayLib::lastpage(); } return $ret; }
/** localtranstoday used to be a view; recreate it as a table if needed. */ public function normalize($db_name, $mode = BasicModel::NORMALIZE_MODE_CHECK, $doCreate = False) { if ($db_name == CoreLocal::get('pDatabase')) { $this->connection = Database::pDataConnect(); } else { if ($db_name == CoreLocal::get('tDatabase')) { $this->connection = Database::tDataConnect(); } else { echo "Error: Unknown database ({$db_name})"; return false; } } if ($this->connection->isView($this->name)) { if ($mode == BasicModel::NORMALIZE_MODE_CHECK) { echo "View {$this->name} should be a table!\n"; echo "==========================================\n"; printf("%s table %s\n", "Check complete. Need to drop view & create replacement table.", $this->name); echo "==========================================\n\n"; return 999; } else { $drop = $this->connection->query('DROP VIEW ' . $this->name); echo "==========================================\n"; printf("Dropping view %s %s\n", $this->name, $drop ? "OK" : "failed"); if ($drop) { $cResult = $this->create(); printf("Update complete. Creation of table %s %s\n", $this->name, $cResult ? "OK" : "failed"); } echo "==========================================\n"; return true; } } else { return parent::normalize($db_name, $mode, $doCreate); } }
function check($str) { $this->ret = $this->default_json(); if (substr($str, -2) == "DA") { $strl = substr($str, 0, strlen($str) - 2); if (substr($str, 0, 2) == "VD") { $this->ret = PrehLib::percentDiscount(0, $this->ret); } elseif (!is_numeric($strl)) { return false; } elseif (CoreLocal::get("tenderTotal") != 0) { $this->ret['output'] = DisplayLib::boxMsg(_("discount not applicable after tender"), '', false, DisplayLib::standardClearButton()); } elseif ($strl > 50) { $this->ret['output'] = DisplayLib::boxMsg(_("discount exceeds maximum"), '', false, DisplayLib::standardClearButton()); } elseif ($strl <= 0) { $this->ret['output'] = DisplayLib::boxMsg(_("discount must be greater than zero"), '', false, DisplayLib::standardClearButton()); } elseif ($strl <= 50 and $strl > 0) { $this->ret = PrehLib::percentDiscount($strl, $this->ret); $this->ret['redraw_footer'] = true; } else { return false; } return true; } return false; }
/** Input processing function */ function preprocess() { // a selection was made if (isset($_REQUEST['search'])) { $entered = strtoupper($_REQUEST['search']); if ($entered == "" || $entered == "CL") { // should be empty string // javascript causes this input if the // user presses CL{enter} // Redirect to main screen CoreLocal::set("tenderTotal", "0"); $this->change_page($this->page_url . "gui-modules/pos2.php"); return False; } if (!empty($entered)) { // built department input string and set it // to be the next POS entry // Redirect to main screen $input = CoreLocal::get("tenderTotal") . "CQ" . $entered; CoreLocal::set("msgrepeat", 1); CoreLocal::set("strRemembered", $input); $this->change_page($this->page_url . "gui-modules/pos2.php"); return False; } } return True; }
function body_content() { ?> <div class="baseHeight"> <?php // generate message to print $type = CoreLocal::get("paycard_type"); $mode = CoreLocal::get("paycard_mode"); $amt = CoreLocal::get("paycard_amount"); if ($amt == 0) { if ($mode == PaycardLib::PAYCARD_MODE_ACTIVATE) { echo PaycardLib::paycard_msgBox($type, "Enter Activation Amount", "Enter the amount to put on the card", "[clear] to cancel"); } else { if ($mode == PaycardLib::PAYCARD_MODE_ADDVALUE) { echo PaycardLib::paycard_msgBox($type, "Enter Add-Value Amount", "Enter the amount to put on the card", "[clear] to cancel"); } } } else { if (!is_numeric($amt) || $amt < 0.005) { echo PaycardLib::paycard_msgBox($type, "Invalid Amount", "Enter a positive amount to put on the card", "[clear] to cancel"); } else { if ($mode == PaycardLib::PAYCARD_MODE_ACTIVATE) { echo PaycardLib::paycard_msgBox($type, "Activate " . PaycardLib::paycard_moneyFormat($amt) . "?", "", "[enter] to continue if correct<br>Enter a different amount if incorrect<br>[clear] to cancel"); } else { if ($mode == PaycardLib::PAYCARD_MODE_ADDVALUE) { echo PaycardLib::paycard_msgBox($type, "Add Value " . PaycardLib::paycard_moneyFormat($amt) . "?", "", "[enter] to continue if correct<br>Enter a different amount if incorrect<br>[clear] to cancel"); } } } } CoreLocal::set("msgrepeat", 2); ?> </div> <?php }
function parse($str) { $lines = CoreLocal::get('screenLines'); if (!$lines === '' || !is_numeric($lines)) { $lines = 11; } $ret = $this->default_json(); if ($str == "U") { $ret["output"] = DisplayLib::listItems(CoreLocal::get("currenttopid"), $this->next_valid(CoreLocal::get("currentid"), True)); } elseif ($str == "D") { $ret["output"] = DisplayLib::listItems(CoreLocal::get("currenttopid"), $this->next_valid(CoreLocal::get("currentid"), False)); } else { $change = (int) substr($str, 1); $curID = CoreLocal::get("currenttopid"); $newID = CoreLocal::get("currentid"); if ($str[0] == "U") { $newID -= $change; } else { $newID += $change; } if ($newID == $curID || $newID == $curID + $lines) { $curID = $newID - 5; } if ($curID < 1) { $curID = 1; } $ret["output"] = DisplayLib::listItems($curID, $newID); } return $ret; }
function body_content() { $this->input_header(); ?> <div class="baseHeight"> <?php $due = CoreLocal::get("amtdue"); if ($this->amt == 0) { $this->amt = $due; } $amt = $this->amt; if (!is_numeric($amt) || abs($amt) < 0.005) { echo DisplayLib::boxMsg("Invalid Amount: {$amt}", "Enter a different amount"); } elseif ($amt > 0 && $due < 0) { echo DisplayLib::boxMsg("Invalid Amount", "Enter a negative amount"); } elseif ($amt < 0 && $due > 0) { echo DisplayLib::boxMsg("Invalid Amount", "Enter a positive amount"); } elseif ($amt > 0) { $msg = "Tender " . sprintf('$%.2f', $amt) . ' using Bitcoin'; echo DisplayLib::boxMsg("[enter] to continue if correct<br>Enter a different amount if incorrect<br>[clear] to cancel", $msg, true); } elseif ($amt < 0) { $msg = "Refund " . sprintf('$%.2f', $amt) . ' using Bitcoin'; echo DisplayLib::boxMsg("[enter] to continue if correct<br>Enter a different amount if incorrect<br>[clear] to cancel", $msg, true); } else { echo DisplayLib::boxMsg("Enter a different amount", "[clear] to cancel", "Invalid Amount"); } CoreLocal::set("msgrepeat", 2); ?> </div> <?php echo "<div id=\"footer\">"; echo DisplayLib::printfooter(); echo "</div>"; }
/** Check for errors @return True or an error message string */ public function errorCheck() { if ($this->amount > CoreLocal::get("amtdue") + 0.005 && CoreLocal::get("amtdue") >= 0) { return DisplayLib::xboxMsg(_("tender cannot exceed purchase amount"), DisplayLib::standardClearButton()); } return true; }
private static function basicAdminXml() { $e2e = new MercuryE2E(); $termID = $e2e->getTermID(); $operatorID = CoreLocal::get("CashierNo"); $mcTerminalID = CoreLocal::get('PaycardsTerminalID'); $refNum = $e2e->refnum(CoreLocal::get('LastID')); $dc_host = CoreLocal::get('PaycardsDatacapLanHost'); if (empty($dc_host)) { $dc_host = '127.0.0.1'; } $msgXml = '<?xml version="1.0"?' . '> <TStream> <Transaction> <HostOrIP>' . $dc_host . '</HostOrIP> <MerchantID>' . $termID . '</MerchantID> <TerminalID>' . $mcTerminalID . '</TerminalID> <OperatorID>' . $operatorID . '</OperatorID> <MerchantLanguage>' . self::caLanguage() . '</MerchantLanguage> <TranCode>{{TranCode}}</TranCode> <SecureDevice>{{SecureDevice}}</SecureDevice> <ComPort>{{ComPort}}</ComPort> <SequenceNo>{{SequenceNo}}</SequenceNo> <InvoiceNo>' . $refNum . '</InvoiceNo> <RefNo>' . $refNum . '</RefNo> </Transaction> </TStream>'; return $msgXml; }
public function errorCheck() { if ($this->amount - CoreLocal::get('amtdue') > 0 && CoreLocal::get('amtdue') > 0) { return DisplayLib::boxMsg(_('max tender is ') . CoreLocal::get('amtdue'), _('no change allowed'), false, DisplayLib::standardClearButton()); } return true; }
public function normalize($db_name, $mode = BasicModel::NORMALIZE_MODE_CHECK, $doCreate = False) { if ($db_name == CoreLocal::get('pDatabase')) { $this->connection = Database::pDataConnect(); } else { if ($db_name == CoreLocal::get('tDatabase')) { $this->connection = Database::tDataConnect(); } else { echo "Error: Unknown database ({$db_name})"; return false; } } $viewSQL = $this->connection->getViewDefinition($this->name); echo "==========================================\n"; printf("%s view %s\n", $mode == BasicModel::NORMALIZE_MODE_CHECK ? "Checking" : "Updating", "{$db_name}.{$this->name}"); echo "==========================================\n"; if (strstr($viewSQL, '0 AS memType') || strstr($viewSQL, '0 AS ' . $this->connection->identifier_escape('memType'))) { /** Structure-check 27Dec2013 Make sure memType is calcluated instead of hardcoded to zero */ echo "==========================================\n"; if ($mode == BasicModel::NORMALIZE_MODE_CHECK) { echo "View needs to be rebuild to calculate memType correctly\n"; } else { echo "Rebuilding view to calculate memType correctly... "; $this->connection->query('DROP VIEW ' . $this->connection->identifier_escape($this->name)); $success = $this->create(); echo ($success ? 'succeeded' : 'failed') . "\n"; } } return 0; }
function check($str) { $as_upc = str_pad($str, 13, '0', STR_PAD_LEFT); if (substr($str, -3) == "QK9") { $this->remainder = str_replace("QK9", "QM9", $str); return True; } else { if (substr($str, -4) == "QK10") { $this->remainder = str_replace("QK10", "QM10", $str); return True; } else { if (($as_upc == '0000000001112' || $as_upc == '0000000001113') && CoreLocal::get('msgrepeat') == 0) { $this->remainder = 'QM708'; return true; } elseif (preg_match('/(\\d+)\\*0*1112/', $str, $matches) && CoreLocal::get('msgrepeat') == 0) { $this->remainder = $matches[1] . '*QM708'; return true; } elseif (preg_match('/(\\d+)\\*0*1113/', $str, $matches) && CoreLocal::get('msgrepeat') == 0) { $this->remainder = $matches[1] . '*QM708'; return true; } elseif ($as_upc == '0049999900047') { $this->remainder = '0049999900048'; return true; } } } return False; }
/** Determine whether to open the drawer when a cashier signs out @return boolean */ public function kickOnSignOut() { if (CoreLocal::get('training') == 1) { return false; } return true; }
function check($str) { $this->ret = $this->default_json(); if (substr($str, -2) == "SD") { $strl = substr($str, 0, strlen($str) - 2); if (!is_numeric($strl)) { return False; } elseif (CoreLocal::get("tenderTotal") != 0) { $this->ret['output'] = DisplayLib::boxMsg(_("discount not applicable after tender"), '', false, DisplayLib::standardClearButton()); } elseif ($strl > 50) { $this->ret['output'] = DisplayLib::boxMsg(_("discount exceeds maximum"), '', false, DisplayLib::standardClearButton()); } elseif ($strl <= 0) { $this->ret['output'] = DisplayLib::boxMsg(_("discount must be greater than zero"), '', false, DisplayLib::standardClearButton()); } elseif ($strl <= 50 and $strl > 0) { $existingPD = CoreLocal::get("percentDiscount"); $stackablePD = $strl; $equivalentPD = $existingPD + $stackablePD; // sum discounts $this->ret = PrehLib::percentDiscount($equivalentPD, $this->ret); } else { return false; } return true; } return false; }
protected function ajax() { $decision = strtoupper(FormLib::get('input', 'CL')); $ret = array('dest_page' => MiscLib::base_url() . 'gui-modules/pos2.php', 'endorse' => false, 'cleared' => false); $repeat_cmd = CoreLocal::get('strEntered'); $requested_cmd = FormLib::get('cmd'); if (!empty($requested_cmd)) { $repeat_cmd = $requested_cmd; } if ($decision == "CL") { CoreLocal::set("msgrepeat", 0); CoreLocal::set("lastRepeat", ''); CoreLocal::set("toggletax", 0); CoreLocal::set("togglefoodstamp", 0); CoreLocal::set("RepeatAgain", false); $ret['cleared'] = true; } elseif (strlen($decision) > 0) { CoreLocal::set("msgrepeat", 1); CoreLocal::set("strRemembered", $repeat_cmd); } else { CoreLocal::set("msgrepeat", 1); CoreLocal::set("strRemembered", $repeat_cmd); } return $ret; }
function parse($str) { if ($str == "0ID") { // Member zero clears member info from the transaction PrehLib::clearMember(); $ret = array("main_frame" => false, "output" => DisplayLib::lastpage(), "target" => ".baseHeight", "redraw_footer" => true); return $ret; } else { if (CoreLocal::get('RestrictDefaultNonMem') == 1 && $str == CoreLocal::get('defaultNonMem') . 'ID') { // PrehLib::ttl will automatically prompt for member if it // has not been entered; otherwise just total $ret = $this->default_json(); $try = PrehLib::ttl(); if ($try !== true) { $ret['main_frame'] = $try . '?idSearch=' . CoreLocal::get('defaultNonMem'); } else { $ret['output'] = DisplayLib::lastpage(); } return $ret; } else { // always re-apply other member numbers $ret = PrehLib::memberID(substr($str, 0, strlen($str) - 2)); return $ret; } } }
public function preprocess() { $this->box_css_class = 'coloredArea'; $this->msg = _('please enter your password'); $this->body_class = ''; if (isset($_REQUEST['reginput']) || isset($_REQUEST['userPassword'])) { $passwd = ''; if (isset($_REQUEST['reginput']) && !empty($_REQUEST['reginput'])) { $passwd = $_REQUEST['reginput']; UdpComm::udpSend('goodBeep'); } elseif (isset($_REQUEST['userPassword']) && !empty($_REQUEST['userPassword'])) { $passwd = $_REQUEST['userPassword']; } if (Authenticate::checkPassword($passwd)) { Database::testremote(); $sd = MiscLib::scaleObject(); if (is_object($sd)) { $sd->ReadReset(); } /** Find a drawer for the cashier */ $my_drawer = ReceiptLib::currentDrawer(); if ($my_drawer == 0) { $available = ReceiptLib::availableDrawers(); if (count($available) > 0) { ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $available[0]); $my_drawer = $available[0]; } } else { ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $my_drawer); } TransRecord::addLogRecord(array('upc' => 'SIGNIN', 'description' => 'Sign In Emp#' . CoreLocal::get('CashierNo'))); /** Use Kicker object to determine whether the drawer should open The first line is just a failsafe in case the setting has not been configured. */ if (session_id() != '') { session_write_close(); } $kicker_class = CoreLocal::get("kickerModule") == "" ? 'Kicker' : CoreLocal::get('kickerModule'); $kicker_object = new $kicker_class(); if ($kicker_object->kickOnSignIn()) { ReceiptLib::drawerKick(); } if ($my_drawer == 0) { $this->change_page($this->page_url . "gui-modules/drawerPage.php"); } else { $this->change_page($this->page_url . "gui-modules/pos2.php"); } return false; } else { $this->box_css_class = 'errorColoredArea'; $this->msg = _('password invalid, please re-enter'); } } return true; }