Example #1
0
 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;
 }
Example #2
0
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 function parse($str)
 {
     $ret = $this->default_json();
     if ($str == "FNTL") {
         $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/fsTotalConfirm.php';
     } elseif ($str == "TETL") {
         $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/requestInfo.php?class=Totals';
     } elseif ($str == "FTTL") {
         PrehLib::finalttl();
     } elseif ($str == "TL") {
         CoreLocal::set('End', 0);
         $chk = PrehLib::ttl();
         if ($chk !== True) {
             $ret['main_frame'] = $chk;
         }
     } elseif ($str == "MTL") {
         $chk = PrehLib::omtr_ttl();
         if ($chk !== True) {
             $ret['main_frame'] = $chk;
         }
     } elseif ($str == "WICTL") {
         $ttl = PrehLib::wicableTotal();
         $ret['output'] = DisplayLib::boxMsg(_('WIC Total') . sprintf(': $%.2f', $ttl), '', true, DisplayLib::standardClearButton());
         // return early since output has been set
         return $ret;
     }
     if (!$ret['main_frame']) {
         $ret['output'] = DisplayLib::lastpage();
         $ret['redraw_footer'] = True;
     }
     return $ret;
 }
Example #5
0
 public static function adminLoginCallback($success)
 {
     if ($success) {
         return MiscLib::base_url() . 'ajax-callbacks/ddd.php';
     } else {
         return false;
     }
 }
Example #6
0
 public static function adminLoginCallback($success)
 {
     if ($success) {
         return MiscLib::base_url() . 'gui-modules/undo.php';
     } else {
         return false;
     }
 }
Example #7
0
 public function handle($deptID, $amount, $json)
 {
     if (CoreLocal::get('msgrepeat') == 0) {
         CoreLocal::set("boxMsg", "<b>A/R Payment Sale</b><br>remember to retain you<br>\n                reprinted receipt");
         CoreLocal::set('boxMsgButtons', array('Confirm [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
         $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php?quiet=1';
     }
     return $json;
 }
Example #8
0
 public function handle($deptID, $amount, $json)
 {
     if (CoreLocal::get('msgrepeat') == 0) {
         // invert has not happened yet
         CoreLocal::set('strEntered', 100 * $amount * -1 . 'DP' . $deptID);
         CoreLocal::set('msgrepeat', 1);
         $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php?autoconfirm=1';
     }
     return $json;
 }
Example #9
0
 public static function adminLoginCallback($success)
 {
     if ($success) {
         CoreLocal::set('refundComment', CoreLocal::get('strEntered'));
         return MiscLib::base_url() . 'gui-modules/refundComment.php';
     } else {
         CoreLocal::set('refundComment', '');
         return false;
     }
 }
Example #10
0
 /**
   Set up state and redirect if needed
   @return True or a URL to redirect
 */
 public function preReqCheck()
 {
     $my_url = MiscLib::base_url();
     if (CoreLocal::get("approvetender") != 1) {
         CoreLocal::set("approvetender", 1);
         return $my_url . "gui-modules/adminlogin.php?class=ManagerApproveTender";
     } else {
         CoreLocal::set("approvetender", 0);
         return true;
     }
 }
Example #11
0
 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;
 }
Example #12
0
 function parse($str)
 {
     global $CORE_LOCAL;
     $return_value = $this->default_json();
     if ($CORE_LOCAL->get("LastID") != "0") {
         $return_value['output'] = DisplayLib::boxMsg("transaction in progress");
     } else {
         $return_value['main_frame'] = MiscLib::base_url() . 'gui-modules/HelloWorld.php';
     }
     return $return_value;
 }
Example #13
0
 /**
   Set up state and redirect if needed
   @return True or a URL to redirect
 */
 public function preReqCheck()
 {
     $my_url = MiscLib::base_url();
     if (CoreLocal::get("transfertender") != 1) {
         CoreLocal::set("transfertender", 1);
         return $my_url . "gui-modules/adminlogin.php?class=StoreTransferTender";
     } else {
         CoreLocal::set("transfertender", 0);
         return true;
     }
 }
Example #14
0
 /**
   Constructor
 
   The constructor automatically runs
   the preprocess and print_page methods
   (if applicable). Creating a new instance
   will output the entire page contents
 */
 public function __construct()
 {
     $this->page_url = MiscLib::base_url();
     if (file_exists(dirname(__FILE__) . '/../graphics/is4c.gif')) {
         $this->body_class = 'mainBGimage';
     } elseif (file_exists(dirname(__FILE__) . '/../graphics/your_logo_here.gif')) {
         $this->body_class = 'placeholderBGimage';
     }
     ob_start();
     $this->drawPage();
     ob_end_flush();
 }
Example #15
0
 function parse($str)
 {
     $ret = $this->default_json();
     if (strlen($str) > 2) {
         $comment = substr($str, 2);
         TransRecord::addcomment($comment);
         $ret['output'] = DisplayLib::lastpage();
     } else {
         $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/bigComment.php';
     }
     return $ret;
 }
Example #16
0
 function parse($str)
 {
     $my_url = MiscLib::base_url();
     $amt = substr($str, 0, strlen($str) - 2);
     if ($amt === "") {
         $amt = 100 * CoreLocal::get("amtdue");
     }
     $ret = $this->default_json();
     CoreLocal::set("tenderTotal", $amt);
     $ret['main_frame'] = $my_url . 'gui-modules/tenderlist.php';
     return $ret;
 }
Example #17
0
 function parse($str)
 {
     $rt = CoreLocal::get("receiptToggle");
     if ($rt == 1) {
         CoreLocal::set("receiptToggle", 0);
     } else {
         CoreLocal::set("receiptToggle", 1);
     }
     $ret = $this->default_json();
     // redirect to main screen so receipt icon reloads
     $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/pos2.php';
     return $ret;
 }
Example #18
0
 function parse($str)
 {
     $ret = $this->default_json();
     switch (strtoupper($str)) {
         case 'PLU':
             TransRecord::add_log_record(array('upc' => 'PLU', 'description' => 'MISKEY'));
             CoreLocal::set('plainmsg', 'PLU logged');
             $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/pos2.php';
             $ret['udpmsg'] = 'goodBeep';
             break;
     }
     return $ret;
 }
Example #19
0
 function parse($str)
 {
     global $CORE_LOCAL;
     $my_url = MiscLib::base_url();
     $amt = substr($str, 0, strlen($str) - 2);
     if ($amt === "") {
         $amt = 100 * $CORE_LOCAL->get("amtdue");
     }
     $ret = $this->default_json();
     $CORE_LOCAL->set("tenderTotal", $amt);
     $ret['main_frame'] = $my_url . 'plugins/CoopCred/tenderlist_coopCred.php';
     //$ret['main_frame'] = $my_url.'gui-modules/tenderlist_coopCred.php';
     return $ret;
 }
Example #20
0
 function preprocess()
 {
     /**
       Bounce through this page and back to pos2.php. This lets
       TenderModules use the msgrepeat feature during input parsing.
     */
     if (isset($_REQUEST['autoconfirm'])) {
         CoreLocal::set('strRemembered', CoreLocal::get('strEntered'));
         CoreLocal::set('msgrepeat', 1);
         $this->change_page(MiscLib::base_url() . 'gui-modules/pos2.php');
         return False;
     }
     return True;
 }
Example #21
0
 /**
   Set up state and redirect if needed
   @return True or a URL to redirect
 */
 public function preReqCheck()
 {
     if (CoreLocal::get('msgrepeat') == 0) {
         CoreLocal::set('strRemembered', $this->amount * 100 . $this->tender_code);
         CoreLocal::set('lastRepeat', 'signStoreCharge');
         return MiscLib::base_url() . 'gui-modules/SigCapturePage.php?type=' . $this->name_string . '&amt=' . $this->amount . '&code=' . $this->tender_code;
     } else {
         if (CoreLocal::get('msgrepeat') == 1 && CoreLocal::get('lastRepeat') == 'signStoreCharge') {
             CoreLocal::set('msgrepeat', 0);
             CoreLocal::set('lastRepeat', '');
         }
     }
     return true;
 }
Example #22
0
 public function handle($deptID, $amount, $json)
 {
     if (CoreLocal::get("memberID") == "0" || CoreLocal::get("memberID") == CoreLocal::get("defaultNonMem")) {
         CoreLocal::set('strEntered', '');
         CoreLocal::set('boxMsg', 'Equity requires member.<br />Apply member number first');
         $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php';
         return $json;
     }
     if (CoreLocal::get('msgrepeat') == 0) {
         CoreLocal::set("boxMsg", "<b>Equity Sale</b><br>please confirm");
         CoreLocal::set('boxMsgButtons', array('Confirm [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
         $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php?quiet=1';
     }
     return $json;
 }
Example #23
0
 /**
   Constructor
 
   The constructor automatically runs
   the preprocess and print_page methods
   (if applicable). Creating a new instance
   will output the entire page contents
 */
 function __construct()
 {
     $this->onload_commands = "";
     $this->page_url = MiscLib::base_url();
     if (file_exists(dirname(__FILE__) . '/../graphics/is4c.gif')) {
         $this->body_class = 'mainBGimage';
     } elseif (file_exists(dirname(__FILE__) . '/../graphics/your_logo_here.gif')) {
         $this->body_class = 'placeholderBGimage';
     }
     if ($this->preprocess()) {
         ob_start();
         $this->print_page();
         ob_end_flush();
     }
 }
Example #24
0
 public function handle($deptID, $amount, $json)
 {
     if (CoreLocal::get('msgrepeat') == 0) {
         // invert has not happened yet
         CoreLocal::set('strEntered', 100 * $amount * -1 . 'DP' . $deptID);
         CoreLocal::set('msgrepeat', 1);
         // $json['main_frame'] = MiscLib::base_url().'gui-modules/boxMsg2.php?autoconfirm=1';
         $json['main_frame'] = MiscLib::base_url() . 'gui-modules/PaidOutComment.php';
         CoreLocal::set("refundComment", CoreLocal::get("strEntered"));
     }
     //if (CoreLocal::get("refundComment") == ""){
     //$json['main_frame'] = MiscLib::base_url().'gui-modules/PaidOutComment.php';
     //CoreLocal::set("refundComment",CoreLocal::get("strEntered"));
     //}
     return $json;
 }
Example #25
0
 function parse($str)
 {
     CoreLocal::set("msgrepeat", 0);
     CoreLocal::set("strendered", "");
     CoreLocal::set("strRemembered", "");
     CoreLocal::set("SNR", 0);
     // added by apbw 6/04/05 to correct voiding of refunded items
     CoreLocal::set("refund", 0);
     //CoreLocal::set("autoReprint",0);
     if (CoreLocal::get("tare") > 0) {
         TransRecord::addTare(0);
     }
     $ret = $this->default_json();
     $ret['main_frame'] = MiscLib::base_url() . "gui-modules/pos2.php";
     return $ret;
 }
Example #26
0
 /**
   Set up state and redirect if needed
   @return True or a URL to redirect
 */
 public function preReqCheck()
 {
     $pref = CoreState::getCustomerPref('store_charge_see_id');
     if ($pref == 'yes') {
         if (CoreLocal::get('msgrepeat') == 0) {
             CoreLocal::set("boxMsg", "<BR>please verify member ID</B><BR>press [enter] to continue<P><FONT size='-1'>[clear] to cancel</FONT>");
             CoreLocal::set('lastRepeat', 'storeChargeSeeID');
             return MiscLib::base_url() . 'gui-modules/boxMsg2.php?quiet=1';
         } else {
             if (CoreLocal::get('msgrepeat') == 1 && CoreLocal::get('lastRepeat') == 'storeChargeSeeID') {
                 CoreLocal::set('msgrepeat', 0);
                 CoreLocal::set('lastRepeat', '');
             }
         }
     }
     return true;
 }
Example #27
0
 function display($id = "")
 {
     $ret = "";
     if ($this->img == "") {
         $ret .= sprintf('
             <button type="submit"
                 name="quickkey_submit" id="%s"
                 value="%s"
                 class="quick_button pos-button coloredBorder">
                 %s
             </button>
             <input type="hidden" name="%s"
                 value="%s" />', $id, $this->title, $this->title, md5($this->title), $this->output_text);
     } else {
         $ret .= sprintf("<input type=\"submit\"\n                name=\"quickkey_submit\" id=\"%s\"\n                value=\"%s\" class=\"quick_button\" \n                src=\"%s\" />\n                <input type=\"hidden\" name=\"%s\"\n                value=\"%s\" />", $id, $this->title, MiscLib::base_url() . "quickkeys/imgs/" . $this->img, md5($this->title), $this->output_text);
     }
     return $ret;
 }
Example #28
0
 function preprocess()
 {
     // check for posts before drawing anything, so we can redirect
     if (isset($_REQUEST['reginput'])) {
         $input = strtoupper(trim($_REQUEST['reginput']));
         // CL always exits
         if ($input == "CL") {
             PaycardLib::paycard_reset();
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return false;
         } elseif ($input == "" || $input == 'MANUAL') {
             $this->action = "onsubmit=\"return false;\"";
             $this->add_onload_command("emvSubmit();");
             if ($input == 'MANUAL') {
                 $this->prompt = true;
             }
             $this->run_transaction = true;
         }
         // if we're still here, we haven't accepted a valid amount yet; display prompt again
     } elseif (isset($_REQUEST['xml-resp'])) {
         $xml = $_REQUEST['xml-resp'];
         $e2e = new MercuryE2E();
         $json = array();
         $plugin_info = new Paycards();
         $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvSuccess.php';
         $json['receipt'] = false;
         $success = $e2e->handleResponseDataCapBalance($xml);
         if ($success === PaycardLib::PAYCARD_ERR_OK) {
             $json = $e2e->cleanup($json);
             CoreLocal::set("strEntered", "");
             CoreLocal::set("strRemembered", "");
             CoreLocal::set("msgrepeat", 0);
             if ($json['receipt']) {
                 $json['main_frame'] .= '?receipt=' . $json['receipt'];
             }
         } else {
             CoreLocal::set("msgrepeat", 0);
             $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php';
         }
         header('Location: ' . $json['main_frame']);
         return false;
     }
     return true;
 }
Example #29
0
 public function defaultPrompt()
 {
     if (CoreLocal::get("enableFranking") != 1) {
         return parent::defaultPrompt();
     }
     CoreLocal::set('RepeatAgain', false);
     $ref = trim(CoreLocal::get("CashierNo")) . "-" . trim(CoreLocal::get("laneno")) . "-" . trim(CoreLocal::get("transno"));
     if ($this->amount === false) {
         $this->amount = $this->defaultTotal();
     }
     $msg = "<br />" . _("insert") . " " . $this->name_string . ' for $' . sprintf('%.2f', $this->amount) . '<br />';
     if (CoreLocal::get("LastEquityReference") == $ref) {
         $msg .= "<div style=\"background:#993300;color:#ffffff;\n                margin:3px;padding: 3px;\">\n                There was an equity sale on this transaction. Did it get\n                endorsed yet?</div>";
     }
     CoreLocal::set('strEntered', 100 * $this->amount . $this->tender_code);
     CoreLocal::set("boxMsg", $msg);
     CoreLocal::set('boxMsgButtons', array('Endorse [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
     return MiscLib::base_url() . 'gui-modules/boxMsg2.php?endorse=check&endorseAmt=' . $this->amount;
 }
Example #30
0
 public function handle($deptID, $amount, $json)
 {
     if (CoreLocal::get("memberID") == "0" || CoreLocal::get("memberID") == CoreLocal::get("defaultNonMem")) {
         CoreLocal::set('strEntered', '');
         CoreLocal::set('boxMsg', 'Equity requires member.<br />Apply member number first');
         $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php';
         return $json;
     }
     if (CoreLocal::get('msgrepeat') == 0) {
         $ref = trim(CoreLocal::get("CashierNo")) . "-" . trim(CoreLocal::get("laneno")) . "-" . trim(CoreLocal::get("transno"));
         if (CoreLocal::get("LastEquityReference") != $ref) {
             CoreLocal::set("equityAmt", $amount);
             CoreLocal::set("boxMsg", "<b>Equity Sale</b><br>Insert paperwork");
             CoreLocal::set('boxMsgButtons', array('Confirm [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
             $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php?quiet=1&endorse=stock&endorseAmt=' . $amount;
         }
     }
     return $json;
 }