Exemplo n.º 1
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;
 }
Exemplo n.º 2
0
 /**
   Input processing function
 */
 function preprocess()
 {
     // a selection was made
     if (FormLib::get('comment') !== '') {
         if (FormLib::get('cleared') === '1') {
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return False;
         }
         $comment = str_replace("\r", '', FormLib::get('comment'));
         // remove trailing newline from double enter
         $comment = substr($comment, 0, strlen($comment) - 1);
         $lines = explode("\n", $comment);
         foreach ($lines as $line) {
             $line = trim($line);
             if (strlen($line) == 0) {
                 continue;
             } elseif (strlen($line) <= 30) {
                 TransRecord::addcomment($line);
             } else {
                 $wrap = wordwrap($line, 30, "\n", True);
                 $shorter_lines = explode("\n", $wrap);
                 foreach ($shorter_lines as $short_line) {
                     TransRecord::addcomment($short_line);
                 }
             }
         }
         $this->change_page($this->page_url . "gui-modules/pos2.php");
         return False;
     }
     return True;
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
0
 function preprocess()
 {
     if (FormLib::get('input') !== '') {
         $arr = $this->mgrauthenticate(FormLib::get('input'));
         echo JsonLib::array_to_json($arr);
         return False;
     } else {
         // beep on initial page load
         if (CoreLocal::get('LoudLogins') == 1) {
             UdpComm::udpSend('twoPairs');
         }
     }
     return True;
 }
Exemplo n.º 5
0
 function body_content()
 {
     $this->add_onload_command("selectSubmit('#ddQKselect', '#qmform');\n");
     $this->add_onload_command('$(\'#ddQKselect\').focus()');
     echo "<div class=\"baseHeight\" style=\"border: solid 1px black;\">";
     echo "<form id=\"qmform\" action=\"" . $_SERVER["PHP_SELF"] . "\" \n            method=\"post\" onsubmit=\"return false;\">";
     /**
       Where can the menu be found?
     */
     $my_menu = array();
     if (is_array(CoreLocal::get('qmNumber'))) {
         /** Calling code provided the menu array via session data */
         $my_menu = CoreLocal::get('qmNumber');
     } else {
         /** New way:
                 Get menu options from QuickLookups table
             */
         $db = Database::pDataConnect();
         if ($db->table_exists('QuickLookups')) {
             $model = new QuickLookupsModel($db);
             $model->lookupSet(CoreLocal::get('qmNumber'));
             foreach ($model->find(array('sequence', 'label')) as $obj) {
                 $my_menu[$obj->label()] = $obj->action();
             }
         }
         if (count($my_menu) == 0 && file_exists(realpath(dirname(__FILE__) . "/quickmenus/" . CoreLocal::get("qmNumber") . ".php"))) {
             /** Old way:
                     Menu is defined in a PHP file
                 */
             include realpath(dirname(__FILE__) . "/quickmenus/" . CoreLocal::get("qmNumber") . ".php");
         }
     }
     echo '<br /><br />';
     echo '<select name="ddQKselect" id="ddQKselect" style="width:380px;" size="10"
         onblur="$(\'#ddQKselect\').focus();" >';
     $i = 1;
     foreach ($my_menu as $label => $value) {
         printf('<option value="%s" %s>%d. %s</option>', $value, $i == 1 ? 'selected' : '', $i, $label);
         $i++;
     }
     echo '</select>';
     $this->add_onload_command("qmNumberPress();\n");
     echo "<input type=\"hidden\" value=\"0\" name=\"clear\" id=\"doClear\" />";
     echo FormLib::tokenField();
     echo "</form>";
     echo "</div>";
 }
Exemplo n.º 6
0
 public function preprocess()
 {
     if (FormLib::get('reginput', false) !== false) {
         $inp = FormLib::get('reginput');
         $this->step = FormLib::get('step', 0);
         // clear backtracks through steps
         if ($inp == 'CL' && $this->step == 0) {
             $this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php');
             return false;
         } elseif ($inp == 'CL') {
             $this->step--;
             return true;
         }
         switch ($this->step) {
             case 0:
                 if (strlen($inp) != 8 || !is_numeric($inp)) {
                     $this->box_color = "errorColoredArea";
                     $this->errMsg = 'Invalid Date: MMDDYYYY';
                 } else {
                     $stamp = mktime(0, 0, 0, substr($inp, 0, 2), substr($inp, 2, 2), substr($inp, -4));
                     $today = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
                     if ($stamp > $today) {
                         $this->box_color = "errorColoredArea";
                         $this->errMsg = 'Note valid until ' . date('m/d/Y', $stamp);
                     } else {
                         $this->step++;
                     }
                 }
                 break;
             case 1:
                 if (strlen($inp) != 8 || !is_numeric($inp)) {
                     $this->box_color = "errorColoredArea";
                     $this->errMsg = 'Invalid Date: MMDDYYYY';
                 } else {
                     $stamp = mktime(0, 0, 0, substr($inp, 0, 2), substr($inp, 2, 2), substr($inp, -4));
                     $today = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
                     if ($stamp < $today) {
                         $this->box_color = "errorColoredArea";
                         $this->errMsg = 'Expired ' . date('m/d/Y', $stamp);
                     } else {
                         $this->step++;
                     }
                 }
                 break;
             case 2:
                 if ($inp !== '') {
                     $this->box_color = "errorColoredArea";
                     $this->errMsg = '[enter] to continue';
                 } else {
                     $this->step++;
                 }
                 break;
             case 3:
                 if (!is_numeric($inp)) {
                     $this->box_color = "errorColoredArea";
                     $this->errMsg = 'Invalid amount';
                 } elseif ($inp / 100 - CoreLocal::get('amtdue') > 0.005) {
                     $this->box_color = "errorColoredArea";
                     $this->errMsg = 'Max amount is ' . CoreLocal::get('amtdue');
                 } else {
                     $tender = $inp . 'WT';
                     CoreLocal::set('strRemembered', $tender);
                     CoreLocal::set('msgrepeat', 1);
                     CoreLocal::set('RepeatAgain', true);
                     $this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php');
                     return false;
                 }
                 break;
         }
     }
     return true;
 }
Exemplo n.º 7
0
 /**
   Initialize transaction variable in session.
   This function is called after the end of every
   transaction so these values will be the
   the defaults every time.
 */
 public static function transReset()
 {
     /**
       @var End
       Indicates transaction has ended
       0 => transaction in progress
       1 => transaction is complete
     */
     CoreLocal::set("End", 0);
     /**
       @var memberID
       Current member number
     */
     CoreLocal::set("memberID", "0");
     /**
       @var TaxExempt
       Tax exempt status flag
       0 => transaction is taxable
       1 => transaction is tax exempt
     */
     CoreLocal::set("TaxExempt", 0);
     /**
       @var yousaved
       Total savings on the transaction (as float).
       Includes any if applicable:
       - transaction level percent discount
       - sale prices (localtemptrans.discount)
       - member prices (localtemptrans.memDiscount)
     */
     CoreLocal::set("yousaved", 0);
     /**
       @var couldhavesaved
       Total member savings that were not applied.
       Consists of localtemptrans.memDiscount on
       non-member purchases
     */
     CoreLocal::set("couldhavesaved", 0);
     /**
       @var specials
       Total saving via sale prices. Consists
       of localtemptrans.discount and when applicable
       localtemptrans.memDiscount
     */
     CoreLocal::set("specials", 0);
     /**
       @var tare
       Current tare setting (as float)
     */
     CoreLocal::set("tare", 0);
     /**
       @var change
       Amount of change due (as float)
     */
     CoreLocal::set("change", 0);
     /**
       @var toggletax
       Alter the next item's tax status
       - 0 => do nothing
       - 1 => change next tax status    
     */
     CoreLocal::set("toggletax", 0);
     /**
       @var togglefoodstamp
       Alter the next item's foodstamp status
       - 0 => do nothing
       - 1 => change next foodstamp status    
     */
     CoreLocal::set("togglefoodstamp", 0);
     /**
       @var toggleDiscountable
       Alter the next item's discount status
       - 0 => do nothing
       - 1 => change next discount status    
     */
     CoreLocal::set("toggleDiscountable", 0);
     /**
       @var refund
       Indicates current ring is a refund. This
       is set as a session variable as it could
       apply to items, open rings, or potentially
       other kinds of input.
       - 0 => not a refund
       - 1 => refund
     */
     CoreLocal::set("refund", 0);
     /**
       @var casediscount
       Line item case discount percentage (as
       integer; 5 = 5%). This feature may be redundant
       in that it could be handled with the generic
       line-item discount. It more or less just differs
       in that the messages say "Case".
     */
     CoreLocal::set("casediscount", 0);
     /**
       @var multiple
       Cashier used the "*" key to enter
       a multiplier. This currently makes the
       products.qttyEnforced flag work. This may
       be redundant and the quantity setting below
       is likely sufficient to determine whether
       a multiplier was used.
     */
     CoreLocal::set("multiple", 0);
     /**
       @var quantity
       Quantity for the current ring. A non-zero
       value usually means the cashier used "*" 
       to enter a multiplier. A value of zero
       gets converted to one unless the item requires
       a quantity via products.scale or
       products.qttyEnforced.
     */
     CoreLocal::set("quantity", 0);
     /**
       @var strEntered
       Stores the last user input from the main
       POS screen. Used in conjunction with the
       msgrepeat option.
     */
     CoreLocal::set("strEntered", "");
     /**
       @var strRemembered
       Value to use as input the next time
       the main POS screen loads. Used in
       conjunction with the msgrepeat
       option.
     */
     CoreLocal::set("strRemembered", "");
     /**
           @var msgrepeat
           Controls repeat input behavior
           - 0 => do nothing
           - 1 => set POS input to the value
              in strRemembered
     
           strEntered, strRemembered, and msgrepeat
           are strongly interrelated.
     
           When parsing user input on the main POS screen,
           the entered value is always stored as strEntered.
     
           msgrepeat gets used in two slightly different
           ways. If you're on a page other than the main
           screen, set msgrepeat to 1 and strRemembered to
           the desired input, then redirect to pos2.php. This
           will run the chosen value through standard input
           processing.
     
           The other way msgrepeat is used is with boxMsg2.php.
           This page is a generic enter to continue, clear to
           cancel prompt. If you redirect to boxMsg2.php and the
           user presses enter, POS will set msgrepeat to 1 and
           copy strEntered into strRemembered effectively repeating
           the last input. Code using this feature will interpret
           a msgrepeat value of 1 to indicate the user has given
           confirmation.
     
           msgrepeat is always cleared back to zero when input
           processing finishes.
     */
     CoreLocal::set("msgrepeat", 0);
     /**
       @var lastRepeat
       [Optional] Reason for the last repeated message
       Useful to set & check in situations where multiple
       confirmations may be required.
     */
     CoreLocal::set('lastRepeat', '');
     /**
       @var boxMsg
       Message string to display on the boxMsg2.php page
     */
     CoreLocal::set("boxMsg", "");
     /**
       @var itemPD
       Line item percent discount (as integer; 5 = 5%).
       Applies a percent discount to the current ring.
     */
     CoreLocal::set("itemPD", 0);
     /**
       @var cashierAgeOverride
       This flag indicates a manager has given approval
       for the cashier to sell age-restricted items. This
       setting only comes into effect if the cashier is
       too young. The value persists for the remainder of
       the transaction so the manager does not have to give
       approval for each individual item.
       - 0 => no manager approval
       - 1 => manager has given approval
     */
     CoreLocal::set("cashierAgeOverride", 0);
     /**
       @var voidOverride
       This flag indicates a manager has given approval
       for the cashier to void items beyond the per
       transaction limit.
       The value persists for the remainder of
       the transaction so the manager does not have to give
       approval for each individual item.
       - 0 => no manager approval
       - 1 => manager has given approval
     */
     CoreLocal::set("voidOverride", 0);
     /**
       @var lastWeight
       The weight of the last by-weight item entered into
       the transaction. It's used to monitor for scale 
       problems. Consecutive items with the exact same
       weight often indicate the scale is stuck or not
       responding properly.
     */
     CoreLocal::set("lastWeight", 0.0);
     /**
       @var CachePanEncBlcok
       Stores the encrypted string of card information
       provided by the CC terminal. If the terminal is
       facing the customer, the customer may swipe their
       card before the cashier is done ringing in items
       so the value is stored in session until the
       cashier is ready to process payment
     */
     CoreLocal::set("CachePanEncBlock", "");
     /**
       @var CachePinEncBlock
       Stores the encrypted string of PIN data.
       Similar to CachePanEncBlock.
     */
     CoreLocal::set("CachePinEncBlock", "");
     /**
       @var CacheCardType
       Stores the selected card type.
       Similar to CachePanEncBlock.
       Known values are:
       - CREDIT
       - DEBIT
       - EBTFOOD
       - EBTCASH
     */
     CoreLocal::set("CacheCardType", "");
     /**
       @var CacheCardCashBack
       Stores the select cashback amount.
       Similar to CachePanEncBlock.
     */
     CoreLocal::set("CacheCardCashBack", 0);
     /**
       @var ccTermState
       Stores a string representing the CC 
       terminals current display. This drives
       an optional on-screen icon to let the 
       cashier know what the CC terminal is
       doing if they cannot see its screen.
     */
     CoreLocal::set('ccTermState', 'swipe');
     /**
       @var paycard_voiceauthcode
       Stores a voice authorization code for use
       with a paycard transaction. Not normally used
       but required to pass Mercury's certification
       script.
     */
     CoreLocal::set("paycard_voiceauthcode", "");
     /**
       @var ebt_authcode
       Stores a foodstamp authorization code.
       Similar to paycard_voiceauthcode.
     */
     CoreLocal::set("ebt_authcode", "");
     /**
       @var ebt_vnum
       Stores a foodstamp voucher number.
       Similar to paycard_voiceauthcode.
     */
     CoreLocal::set("ebt_vnum", "");
     /**
       @var paycard_keyed
       - True => card number was hand keyed
       - False => card was swiped
     
       Normally POS figures this out automatically
       but it has to be overriden to pass Mercury's
       certification script. They require some
       keyed transactions even though the CC terminal
       is only capable of producing swipe-style data.
     */
     CoreLocal::set("paycard_keyed", False);
     if (!is_array(CoreLocal::get('PluginList'))) {
         CoreLocal::set('PluginList', array());
     }
     if (is_array(CoreLocal::get('PluginList'))) {
         foreach (CoreLocal::get('PluginList') as $p) {
             if (!class_exists($p)) {
                 continue;
             }
             $obj = new $p();
             $obj->plugin_transaction_reset();
         }
     }
     if (is_array(CoreLocal::get('Notifiers'))) {
         foreach (CoreLocal::get('Notifiers') as $n) {
             if (!class_exists($n)) {
                 continue;
             }
             $obj = new $n();
             $obj->transactionReset();
         }
     }
     FormLib::clearTokens();
     DiscountModule::transReset();
 }
Exemplo n.º 8
0
    function body_content()
    {
        $stem = MiscLib::baseURL() . 'graphics/';
        ?>
        <div class="baseHeight">
        <div class="centeredDisplay colored rounded">
            <span class="larger"><?php 
        echo _("administrative tasks");
        ?>
</span>
            <br />
        <form id="selectform" method="post" 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 name="selectlist" id="selectlist" onblur="$('#selectlist').focus();">
        <option value=''><?php 
        echo _("Select a Task");
        ?>
        <option value='SUSPEND'>1. <?php 
        echo _("Suspend Transaction");
        ?>
        <option value='RESUME'>2. <?php 
        echo _("Resume Transaction");
        ?>
        <?php 
        if (CoreLocal::get('SecurityTR') != 30 || $this->security >= 30) {
            ?>
            <option value='TR'>3. <?php 
            echo _("Tender Report");
            ?>
        <?php 
        }
        ?>
        <?php 
        if ($this->security >= 30) {
            ?>
            <option value='OTR'>4. <?php 
            echo _("Any Tender Report");
            ?>
            <option value='UNDO'><?php 
            echo _('Undo Transaction');
            ?>
        <?php 
        }
        ?>
        </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 
        }
        ?>
        <?php 
        echo FormLib::tokenField();
        ?>
        <div class="smaller">
            <?php 
        echo _("use arrow keys to navigate");
        ?>
        </div>
        <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 
        $this->add_onload_command("\$('#selectlist').focus();");
        $this->add_onload_command("selectSubmit('#selectlist', '#selectform')\n");
    }
Exemplo n.º 9
0
    function body_content()
    {
        $this->input_header();
        echo DisplayLib::printheaderb();
        $mode = FormLib::get('qty-mode', 0);
        $this->add_onload_command("formAdd('#formlocal','qty-mode','{$mode}');\n");
        $item = FormLib::get('entered-item', CoreLocal::get('strEntered'));
        $this->add_onload_command("formAdd('#formlocal','entered-item','{$item}');\n");
        ?>
        <div class="baseHeight">
        <div class="<?php 
        echo $this->box_color;
        ?>
 centeredDisplay">
        <span class="larger">
        <?php 
        echo $this->msg;
        ?>
        </span><br />
        <p>
        <?php 
        echo _("enter quantity or clear to cancel");
        ?>
        </p> 
        </div>
        </div>

        <?php 
        CoreLocal::set("msgrepeat", 2);
        CoreLocal::set("item", CoreLocal::get("strEntered"));
        UdpComm::udpSend('errorBeep');
        echo "<div id=\"footer\">";
        echo DisplayLib::printfooter();
        echo "</div>";
    }