public function parse($str) { $my_url = MiscLib::base_url(); $split = explode("DP", $str); $dept = $split[1]; $amt = $split[0]; if (strstr($amt, '.')) { $amt = round($amt * 100); } $ret = $this->default_json(); /** This "if" is the new addition to trigger the department select screen */ if (empty($split[1])) { // no department specified, just amount followed by DP // maintain refund if needed if (CoreLocal::get("refund")) { $amt = "RF" . $amt; } // save entered amount CoreLocal::set("departmentAmount", $amt); // go to the department select screen $ret['main_frame'] = $my_url . 'gui-modules/deptlist.php'; } else { if (CoreLocal::get("refund") == 1 && CoreLocal::get("refundComment") == "") { if (CoreLocal::get("SecurityRefund") > 20) { $ret['main_frame'] = $my_url . "gui-modules/adminlogin.php?class=RefundAdminLogin"; } else { $ret['main_frame'] = $my_url . 'gui-modules/refundComment.php'; } CoreLocal::set("refundComment", CoreLocal::get("strEntered")); } } /* apply any appropriate special dept modules */ $deptmods = CoreLocal::get('SpecialDeptMap'); $db = Database::pDataConnect(); if (!is_array($deptmods) && $db->table_exists('SpecialDeptMap')) { $model = new \COREPOS\pos\lib\models\op\SpecialDeptMapModel($db); $deptmods = $model->buildMap(); CoreLocal::set('SpecialDeptMap', $deptmods); } $index = (int) ($dept / 10); if (is_array($deptmods) && isset($deptmods[$index])) { foreach ($deptmods[$index] as $mod) { $obj = new $mod(); $ret = $obj->handle($dept, $amt / 100, $ret); } } if (!$ret['main_frame']) { $ret = PrehLib::deptkey($amt, $dept, $ret); } return $ret; }
function parse($str) { $dept = CoreLocal::get('roundUpDept'); if ($dept === '') { $dept = 701; } $ret = $this->default_json(); if ($str == "RU") { Database::getsubtotals(); $ttl = CoreLocal::get("amtdue"); $next = ceil($ttl); $amt = sprintf('%.2f', $ttl == $next ? 1.0 : $next - $ttl); $ret = PrehLib::deptkey($amt * 100, $dept . '0', $ret); } else { $amt = substr($str, 0, strlen($str) - 2); $ret = PrehLib::deptkey($amt, $dept . '0', $ret); } return $ret; }
public function cleanup($json) { switch (CoreLocal::get("paycard_mode")) { case PaycardLib::PAYCARD_MODE_BALANCE: $resp = CoreLocal::get("paycard_response"); CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n <p>Gift card balance: \$" . $resp["Balance"] . "\n <p>\"rp\" to print\n <br>[enter] to continue</font>"); break; case PaycardLib::PAYCARD_MODE_ADDVALUE: case PaycardLib::PAYCARD_MODE_ACTIVATE: CoreLocal::set("autoReprint", 1); $ttl = CoreLocal::get("paycard_amount"); PrehLib::deptkey($ttl * 100, 9020); $resp = CoreLocal::get("paycard_response"); CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n <p>New card balance: \$" . $resp["Balance"] . "\n <p>[enter] to continue\n <br>\"rp\" to reprint slip</font>"); break; case PaycardLib::PAYCARD_MODE_AUTH: CoreLocal::set("autoReprint", 1); $record_id = $this->last_paycard_transaction_id; $charflag = $record_id != 0 ? 'PT' : ''; TransRecord::addFlaggedTender("Gift Card", "GD", $amt, $record_id, $charflag); $resp = CoreLocal::get("paycard_response"); CoreLocal::set("boxMsg", "<b>Approved</b><font size=-1>\n <p>Used: \$" . CoreLocal::get("paycard_amount") . "\n <br />New balance: \$" . $resp["Balance"] . "\n <p>[enter] to continue\n <br>\"rp\" to reprint slip\n <br>[void] to cancel and void</font>"); break; case PaycardLib::PAYCARD_MODE_VOID: case PaycardLib::PAYCARD_MODE_VOIDITEM: CoreLocal::set("autoReprint", 1); $v = new Void(); $v->voidid(CoreLocal::get("paycard_id"), array()); $resp = CoreLocal::get("paycard_response"); CoreLocal::set("boxMsg", "<b>Voided</b><font size=-1>\n <p>New balance: \$" . $resp["Balance"] . "\n <p>[enter] to continue\n <br>\"rp\" to reprint slip</font>"); break; } return $json; }
public function cleanup($json) { switch (CoreLocal::get("paycard_mode")) { case PaycardLib::PAYCARD_MODE_ADDVALUE: case PaycardLib::PAYCARD_MODE_ACTIVATE: CoreLocal::set("autoReprint", 1); $ttl = CoreLocal::get("paycard_amount"); PrehLib::deptkey($ttl * 100, 9020); $bal = CoreLocal::get('GiftBalance'); CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n <p>New card balance: \$" . $bal . "\n <p>[enter] to continue\n <br>\"rp\" to reprint slip</font>"); break; case PaycardLib::PAYCARD_MODE_BALANCE: $bal = CoreLocal::get('DatacapBalanceCheck'); CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n <p>Card balance: \$" . $bal . "\n <p>\"rp\" to print\n <br>[enter] to continue</font>"); break; case PaycardLib::PAYCARD_MODE_AUTH: // cast to string. tender function expects string input // numeric input screws up parsing on negative values > $0.99 $amt = "" . -1 * CoreLocal::get("paycard_amount"); $type = CoreLocal::get("CacheCardType"); $t_type = 'CC'; if (CoreLocal::get('paycard_issuer') == 'American Express') { $t_type = 'AX'; } if ($type == 'EBTFOOD') { // extra tax exemption steps TransRecord::addfsTaxExempt(); CoreLocal::set("fntlflag", 0); Database::setglobalvalue("FntlFlag", 0); } list($tender_code, $tender_description) = PaycardLib::getTenderInfo($type, CoreLocal::get('paycard_issuer')); // if the transaction has a non-zero paycardTransactionID, // include it in the tender line $record_id = $this->last_paycard_transaction_id; $charflag = $record_id != 0 ? 'PT' : ''; TransRecord::addFlaggedTender($tender_description, $tender_code, $amt, $record_id, $charflag); $appr_type = 'Approved'; if (CoreLocal::get('paycard_partial')) { $appr_type = 'Partial Approval'; } elseif (CoreLocal::get('paycard_amount') == 0) { $appr_type = 'Declined'; $json['receipt'] = 'ccDecline'; } CoreLocal::set('paycard_partial', false); $isCredit = CoreLocal::get('CacheCardType') == 'CREDIT' || CoreLocal::get('CacheCardType') == '' ? true : false; $needSig = CoreLocal::get('paycard_amount') > CoreLocal::get('CCSigLimit') || CoreLocal::get('paycard_amount') < 0 ? true : false; if (($isCredit || CoreLocal::get('EmvSignature') === true) && $needSig) { CoreLocal::set("boxMsg", "<b>{$appr_type}</b>\n <font size=-1>\n <p>Please verify cardholder signature\n <p>[enter] to continue\n <br>\"rp\" to reprint slip\n <br>[void] " . _('to reverse the charge') . "\n </font>"); if (CoreLocal::get('PaycardsSigCapture') != 1) { $json['receipt'] = 'ccSlip'; } } else { CoreLocal::set("boxMsg", "<b>{$appr_type}</b>\n <font size=-1>\n <p>No signature required\n <p>[enter] to continue\n <br>[void] " . _('to reverse the charge') . "\n </font>"); } break; case PaycardLib::PAYCARD_MODE_VOID: $void = new Void(); $void->voidid(CoreLocal::get("paycard_id"), array()); // advanced ID to the void line CoreLocal::set('paycard_id', CoreLocal::get('paycard_id') + 1); CoreLocal::set("boxMsg", "<b>Voided</b>\n <p><font size=-1>[enter] to continue\n <br>\"rp\" to reprint slip</font>"); break; } return $json; }