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; }
function preprocess() { $this->bmp_path = $this->page_url . 'scale-drivers/drivers/NewMagellan/ss-output/tmp/'; // check for input if (isset($_REQUEST["reginput"])) { $input = strtoupper(trim($_POST["reginput"])); // capture file if present; otherwise re-request // signature via terminal if (isset($_REQUEST['doCapture']) && $_REQUEST['doCapture'] == 1 && $input == '') { if (isset($_REQUEST['bmpfile']) && !empty($_REQUEST['bmpfile']) && file_exists($_REQUEST['bmpfile'])) { $bmp = file_get_contents($_REQUEST['bmpfile']); $format = 'BMP'; $img_content = $bmp; $dbc = Database::tDataConnect(); $capQ = 'INSERT INTO CapturedSignature (tdate, emp_no, register_no, trans_no, trans_id, filetype, filecontents) VALUES (?, ?, ?, ?, ?, ?, ?)'; $capP = $dbc->prepare_statement($capQ); $args = array(date('Y-m-d H:i:s'), CoreLocal::get('CashierNo'), CoreLocal::get('laneno'), CoreLocal::get('transno'), CoreLocal::get('paycard_id'), $format, $img_content); $capR = $dbc->exec_statement($capP, $args); unlink($_REQUEST['bmpfile']); // continue to below. finishing transaction is the same // as with paper signature slip } else { UdpComm::udpSend('termSig'); return true; } } $mode = CoreLocal::get("paycard_mode"); $type = CoreLocal::get("paycard_type"); $tender_id = CoreLocal::get("paycard_id"); if ($input == "") { // [enter] exits this screen // remember the mode, type and transid before we reset them CoreLocal::set("boxMsg", ""); /** paycard_mode is sometimes cleared pre-emptively perhaps by a double keypress on enter so tender out if the last record in the transaction is a tender record */ $peek = PrehLib::peekItem(true); if ($mode == PaycardLib::PAYCARD_MODE_AUTH || $peek !== false && isset($peek['trans_type']) && $peek['trans_type'] == 'T') { CoreLocal::set("strRemembered", "TO"); CoreLocal::set("msgrepeat", 1); CoreLocal::set('paycardTendered', true); } else { TransRecord::debugLog('Not Tendering Out (mode): ' . print_r($mode, true)); } // only reset terminal if the terminal was used for the transaction // activating a gift card should not reset terminal if (CoreLocal::get("paycard_type") == PaycardLib::PAYCARD_TYPE_ENCRYPTED) { UdpComm::udpSend('termReset'); CoreLocal::set('ccTermState', 'swipe'); CoreLocal::set("CacheCardType", ""); } PaycardLib::paycard_reset(); $this->change_page($this->page_url . "gui-modules/pos2.php"); return false; } elseif ($mode == PaycardLib::PAYCARD_MODE_AUTH && $input == "VD" && (CoreLocal::get('CacheCardType') == 'CREDIT' || CoreLocal::get('CacheCardType') == 'EMV' || CoreLocal::get('CacheCardType') == 'GIFT' || CoreLocal::get('CacheCardType') == '')) { $plugin_info = new Paycards(); $this->change_page($plugin_info->pluginUrl() . "/gui/PaycardEmvVoid.php"); return false; } } /* shouldn't happen unless session glitches but getting here implies the transaction succeeded */ $var = CoreLocal::get("boxMsg"); if (empty($var)) { CoreLocal::set("boxMsg", "<b>Approved</b><font size=-1>\n <p> \n <p>[enter] to continue\n <br>[void] " . _('to reverse the charge') . "\n </font>"); } return True; }