Example #1
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 #2
0
 public function parse($str)
 {
     $ret = $this->default_json();
     if (CoreLocal::get('memberID') == '0') {
         $ret['output'] = DisplayLib::boxMsg(_("Apply member number first"), _('No member selected'), false, array_merge(array('Member Search [ID]' => 'parseWrapper(\'ID\');'), DisplayLib::standardClearButton()));
         return $ret;
     }
     if ($str == 'ACCESS') {
         if (CoreLocal::get('AccessQuickMenu') != '' && class_exists('QuickMenuLauncher')) {
             $qm = new QuickMenuLauncher();
             return $qm->parse('QM' . CoreLocal::get('AccessQuickMenu'));
         } else {
             $str = 'ACCESS0';
         }
     }
     if ($str !== 'ACCESS6' && CoreLocal::get('AccessSelection') === '') {
         CoreLocal::set('AccessSelection', $str);
         $ret['main_frame'] = MiscLib::baseURL() . 'gui-modules/adminlogin.php?class=AccessProgramParser';
         return $ret;
     } else {
         CoreLocal::set('AccessSelection', '');
     }
     $selection = substr($str, 6);
     TransRecord::addRecord(array('upc' => 'ACCESS', 'description' => 'ACCESS SIGNUP', 'quantity' => 1, 'ItemQtty' => 1, 'numflag' => $selection));
     $ret['output'] = DisplayLib::lastpage();
     $ret['receipt'] = 'accessSignupSlip';
     return $ret;
 }
Example #3
0
    function head_content()
    {
        $base = MiscLib::baseURL();
        ?>
        <script type="text/javascript" src="<?php 
        echo $base;
        ?>
js/selectSubmit.js"></script>
        <script type="text/javascript">
        function qmNumberPress()
        {
            var qm_submitted = false;
            $('#ddQKselect').keyup(function(event) {
                if (event.which >= 49 && event.which <= 57) {
                    if (!qm_submitted) {
                        qm_submitted = true;
                        $('#qmform').submit();
                    }
                } else if (event.which >= 97 && event.which <= 105) {
                    if (!qm_submitted) {
                        qm_submitted = true;
                        $('#qmform').submit();
                    }
                }
            });
        }
        </script>
        <?php 
    }
Example #4
0
 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;
 }
Example #5
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 #6
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") {
             CoreLocal::set("msgrepeat", 0);
             CoreLocal::set("toggletax", 0);
             CoreLocal::set("togglefoodstamp", 0);
             $this->change_page(MiscLib::baseURL() . "gui-modules/pos2.php");
             return false;
         } elseif ($input == "") {
             $this->change_page('BitCoinPaymentPage.php?amount=' . CoreLocal::get('amtdue'));
             return false;
         } elseif ($input != "" && substr($input, -2) != "CL") {
             // any other input is an alternate amount
             // convert cents to dollars and make sure it's valid
             $this->amt = $input;
             if (is_numeric($input)) {
                 $this->amt = MiscLib::truncate2($this->amt / 100.0);
             }
             if ($this->validateAmount($this->amt)) {
                 $this->change_page('BitCoinPaymentPage.php?amount=' . $this->amt);
                 return false;
             }
         }
     }
     // post?
     return true;
 }
Example #7
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 #8
0
 public function getHeader()
 {
     ob_start();
     $my_url = $this->page_url;
     ?>
     <!DOCTYPE html>
     <html>
     <?php 
     echo "<head>";
     echo "<title>COREPOS</title>";
     // 18Aug12 EL Add content/charset.
     echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
     echo "<link rel=\"stylesheet\" type=\"text/css\"\n            href=\"{$my_url}css/pos.css\">";
     if (MiscLib::win32()) {
         echo "<script type=\"text/javascript\"\n                src=\"{$my_url}js/jquery-1.8.3.min.js\"></script>";
     } else {
         echo "<script type=\"text/javascript\"\n                src=\"{$my_url}js/jquery.js\"></script>";
     }
     $this->paycard_jscript_functions();
     $this->head_content();
     echo "</head>";
     echo '<body class="' . $this->body_class . '">';
     echo "<div id=\"boundingBox\">";
     $this->input_header($this->action);
     return ob_get_clean();
 }
Example #9
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 #10
0
 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;
 }
Example #11
0
 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;
 }
Example #12
0
 public function priceInfo($row, $quantity = 1)
 {
     if (is_array($this->savedInfo)) {
         return $this->savedInfo;
     }
     $ret = array();
     $ret["regPrice"] = $row['normal_price'];
     $ret["unitPrice"] = $row['special_price'];
     /* if not by weight, just use the sticker price 
           (for scaled items, the UPC parse module
           calculates a weight estimate and sets a quantity
           so normal_price can be used. This could be done
           for all items, but typically the deli doesn't
           keep good track of whether their items are
           marked scale correctly since it only matters when an
           item goes on sale
        */
     if (isset($row['stickerprice']) && $row['scale'] == 0) {
         $ret['regPrice'] = $row['stickerprice'];
     }
     $ret['discount'] = ($ret['regPrice'] - $row['special_price']) * $quantity;
     $ret['memDiscount'] = 0;
     if ($row['line_item_discountable'] == 1 && CoreLocal::get("itemPD") > 0) {
         $discount = $row['special_price'] * (CoreLocal::get("itemPD") / 100);
         $ret["unitPrice"] = $row['special_price'] - $discount;
         $ret["discount"] += $discount * $quantity;
     }
     // enforce per-transaction limit
     if ($row['specialpricemethod'] == 0 && $row['specialquantity'] > 0) {
         $tdb = Database::tDataConnect();
         $chkQ = "SELECT sum(ItemQtty) FROM\n                localtemptrans WHERE upc='{$row['upc']}'";
         if (strlen($row['mixmatchcode']) > 0 && $row['mixmatchcode'][0] == 'b') {
             $chkQ .= " OR mixMatch='{$row['mixmatchcode']}'";
         }
         $chkR = $tdb->query($chkQ);
         $prevSales = 0;
         if ($tdb->num_rows($chkR) > 0) {
             $prevSales = array_pop($tdb->fetch_row($chkR));
         }
         if ($prevSales >= $row['specialquantity']) {
             // already sold the limit; use non-sale price
             $ret['unitPrice'] = $row['normal_price'];
             $ret['discount'] = 0;
         } else {
             if ($prevSales + $quantity > $row['specialquantity']) {
                 // this multiple qty ring will pass the limit
                 // set discount based on appropriate quantity
                 // and adjust unitPrice so total comes out correctly
                 $discountQty = $row['specialquantity'] - $prevSales;
                 $ret['discount'] = ($ret['regPrice'] - $row['special_price']) * $discountQty;
                 $total = $ret['regPrice'] * $quantity - $ret['discount'];
                 $ret['unitPrice'] = MiscLib::truncate2($total / $quantity);
             }
         }
     }
     $this->savedRow = $row;
     $this->savedInfo = $ret;
     return $ret;
 }
Example #13
0
 public static function adminLoginCallback($success)
 {
     if ($success) {
         return MiscLib::base_url() . 'ajax-callbacks/ddd.php';
     } else {
         return false;
     }
 }
Example #14
0
 public function apply()
 {
     if (CoreLocal::get('memberID') && in_array(CoreLocal::get('memberID'), CoreLocal::get('InactiveMemList')) && CoreLocal::get('InactiveMemApproval')) {
         return MiscLib::baseURL() . 'gui-modules/adminlogin.php?class=InactiveMemTotalAction';
     } else {
         return true;
     }
 }
Example #15
0
 public static function adminLoginCallback($success)
 {
     if ($success) {
         return MiscLib::base_url() . 'gui-modules/undo.php';
     } else {
         return false;
     }
 }
Example #16
0
 function addItem($row, $quantity, $priceObj)
 {
     if ($quantity == 0) {
         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['discounttype'] > 0 ? 0 : $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;
 }
Example #17
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 #18
0
 public function calculate($discountable_total = 0)
 {
     $discount = parent::calculate();
     if (CoreLocal::get('NeedDiscountFlag') === 1) {
         $extra = 0.05 * CoreLocal::get('discountableTotal');
         $discount = MiscLib::truncate2($discount + $extra);
     }
     return $discount;
 }
Example #19
0
    function body_content()
    {
        $stem = MiscLib::baseURL() . 'graphics/';
        ?>
        <div class="baseHeight">
        <div class="centeredDisplay colored rounded">
        <span class="larger">gift card transaction</span>
        <form name="selectform" method="post" id="selectform"
            action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
">
        <?php 
        if (CoreLocal::get('touchscreen')) {
            ?>
        <button type="button" class="pos-button coloredArea"
            onclick="scrollDown('#selectlist');">
            <img src="<?php 
            echo $stem;
            ?>
down.png" width="16" height="16" />
        </button>
        <?php 
        }
        ?>
        <select id="selectlist" name="selectlist" 
            onblur="$('#selectlist').focus()">
        <option value="">Sale
        <option value="AC">Activate
        <option value="AV">Add Value
        <option value="PV">Balance
        </select>
        <?php 
        if (CoreLocal::get('touchscreen')) {
            ?>
        <button type="button" class="pos-button coloredArea"
            onclick="scrollUp('#selectlist');">
            <img src="<?php 
            echo $stem;
            ?>
up.png" width="16" height="16" />
        </button>
        <?php 
        }
        ?>
        <p>
            <button class="pos-button" type="submit">Select [enter]</button>
            <button class="pos-button" type="submit" onclick="$('#selectlist').val('');">
                Cancel [clear]
            </button>
        </p>
        </div>
        </form>
        </div>
        <?php 
    }
Example #20
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 #21
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 #22
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 #23
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 #24
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 #25
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 #26
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 #27
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 #28
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 #29
0
 /**
   Apply action
   @return [boolean] true if the action
     completes successfully (or is not
     necessary at all) or [string] url
     to redirect to another page for
     further decisions/input.
 */
 public function apply()
 {
     $temp = PrehLib::chargeOk();
     if (CoreLocal::get("balance") < CoreLocal::get("memChargeTotal") && CoreLocal::get("memChargeTotal") > 0) {
         if (CoreLocal::get('msgrepeat') == 0) {
             CoreLocal::set("boxMsg", sprintf("<b>A/R Imbalance</b><br />\n                    Total AR payments \$%.2f exceeds AR balance %.2f<br />", CoreLocal::get("memChargeTotal"), CoreLocal::get("balance")));
             CoreLocal::set('boxMsgButtons', array('Confirm [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
             CoreLocal::set("strEntered", "TL");
             return MiscLib::baseURL() . "gui-modules/boxMsg2.php?quiet=1";
         }
     }
     return true;
 }
Example #30
0
 public static function adminLoginCallback($success)
 {
     if ($success) {
         CoreLocal::set('strRemembered', '');
         CoreLocal::set("isMember", 1);
         CoreLocal::set("memType", 1);
         CoreLocal::set("boxMsg", "Member Status Toggled!");
         CoreLocal::set('boxMsgButtons', array('Dismiss [clear]' => '$(\'#reginput\').val(\'\');submitWrapper();'));
         return MiscLib::baseURL() . 'gui-modules/boxMsg2.php';
     } else {
         return false;
     }
 }