예제 #1
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;
 }
예제 #2
0
파일: QMDisplay.php 프로젝트: phpsmith/IS4C
    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 
    }
예제 #3
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;
 }
예제 #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;
 }
예제 #5
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;
     }
 }
예제 #6
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 
    }
예제 #7
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;
     }
 }
예제 #8
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;
 }
예제 #9
0
 public function testMiscLib()
 {
     chdir(dirname(__FILE__) . '/../../pos/is4c-nf/gui-modules/');
     $rel = MiscLib::baseURL();
     $this->assertEquals('../', $rel);
     $this->assertEquals(1, MiscLib::nullwrap(1));
     $this->assertEquals(1.5, MiscLib::nullwrap(1.5));
     $this->assertEquals('test', MiscLib::nullwrap('test'));
     $this->assertEquals(0, MiscLib::nullwrap(False));
     $this->assertEquals(1, MiscLib::truncate2(1));
     $this->assertEquals(1.99, MiscLib::truncate2(1.99));
     $this->assertEquals(1.99, MiscLib::truncate2("1.99"));
     $this->assertEquals(1.35, MiscLib::truncate2("1.345"));
     $hostCheck = MiscLib::pingport(CoreLocal::get('localhost'), CoreLocal::get('DBMS'));
     $this->assertInternalType('integer', $hostCheck);
     $hostCheck = MiscLib::win32();
     $this->assertInternalType('integer', $hostCheck);
     $scale = MiscLib::scaleObject();
     if ($scale !== 0) {
         $this->assertInstanceOf('ScaleDriverWrapper', $scale);
     }
 }
예제 #10
0
파일: PrehLib.php 프로젝트: phpsmith/IS4C
 /**
   Enforce age-based restrictions
   @param $required_age [int] age in years
   @param $ret [array] Parser-formatted return value
   @return [array]
    0 - boolean age-related approval required
    1 - array Parser-formatted return value
 */
 public static function ageCheck($required_age, $ret)
 {
     $my_url = MiscLib::baseURL();
     if (CoreLocal::get("cashierAge") < 18 && CoreLocal::get("cashierAgeOverride") != 1) {
         $ret['main_frame'] = $my_url . "gui-modules/adminlogin.php?class=AgeApproveAdminLogin";
         return array(true, $ret);
     }
     if (CoreLocal::get("memAge") == "") {
         CoreLocal::set("memAge", date('Ymd'));
     }
     $stamp = strtotime(CoreLocal::get("memAge"));
     $of_age_on_day = mktime(0, 0, 0, date('n', $stamp), date('j', $stamp), date('Y', $stamp) + $required_age);
     $today = strtotime(date('Y-m-d'));
     if ($of_age_on_day > $today) {
         $ret['udpmsg'] = 'twoPairs';
         $ret['main_frame'] = $my_url . 'gui-modules/requestInfo.php?class=UPC';
         return array(true, $ret);
     }
     return array(false, $ret);
 }
예제 #11
0
    function head_content()
    {
        if (!$this->run_transaction) {
            return '';
        }
        $e2e = new MercuryE2E();
        ?>
<script type="text/javascript">
function emvSubmit()
{
    $('div.baseHeight').html('Processing transaction');
    // POST XML request to driver using AJAX
    var xmlData = '<?php 
        echo json_encode($e2e->prepareDataCapVoid($this->id));
        ?>
';
    if (xmlData == '"Error"') { // failed to save request info in database
        location = '<?php 
        echo MiscLib::baseURL();
        ?>
gui-modules/boxMsg2.php';
        return false;
    }
    $.ajax({
        url: 'http://localhost:8999',
        type: 'POST',
        data: xmlData,
        dataType: 'text',
        success: function(resp) {
            // POST result to PHP page in POS to
            // process the result.
            console.log('success');
            console.log(resp);
            var f = $('<form id="js-form"></form>');
            f.append($('<input type="hidden" name="xml-resp" />').val(resp));
            $('body').append(f);
            $('#js-form').submit();
        },
        error: function(resp) {
            // display error to user?
            // go to dedicated error page?
            console.log('error');
            console.log(resp);
            var f = $('<form id="js-form"></form>');
            f.append($('<input type="hidden" name="xml-resp" />').val(resp));
            $('body').append(f);
            $('#js-form').submit();
        }
    });
}
</script>
        <?php 
    }
예제 #12
0
 function preprocess()
 {
     // initialize the payment on bitcoinpay.com
     // when page first loads
     if (isset($_REQUEST['amount'])) {
         $payment = $this->initPayment($_REQUEST['amount']);
         if ($payment === false) {
             CoreLocal::set('boxMsg', 'Error initializing Bitcoin payment');
             $this->change_page(MiscLib::baseURL() . 'gui-modules/boxMsg2.php');
             return false;
         }
         $this->payment_id = $payment['payment_id'];
         $this->payment_url = $payment['payment_url'];
         return true;
     }
     // Check for clear button to cancel request
     if (isset($_REQUEST['reginput'])) {
         $input = strtoupper(trim($_REQUEST['reginput']));
         // CL always exits
         if ($input == "CL") {
             $this->change_page(MiscLib::baseURL() . "gui-modules/pos2.php");
             return false;
         }
     }
     // Check for payment complete notification
     // add tender and return to main screen
     if (isset($_REQUEST['finish'])) {
         TransRecord::addtender('BITCOIN', CoreLocal::get('BitCoinTender'), -1 * $_REQUEST['finish']);
         CoreLocal::set('strRemembered', 'TO');
         CoreLocal::set('msgrepeat', 1);
         $this->change_page(MiscLib::baseURL() . "gui-modules/pos2.php");
         return false;
     }
     return true;
 }
예제 #13
0
    function body_content()
    {
        $default = '';
        if (CoreLocal::get('fntlDefault') === '' || CoreLocal::get('fntlDefault') == 1) {
            $default = 'EC';
        } else {
            if (CoreLocal::get('fntlDefault') == 0) {
                $default = 'EF';
            }
        }
        ?>
        <div class="baseHeight">
        <div class="centeredDisplay colored rounded">
        <?php 
        if (empty($this->tendertype)) {
            ?>
        <span class="larger">Customer is using the</span>
        <?php 
        }
        ?>
        <form id="selectform" method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
">

        <?php 
        if (empty($this->tendertype)) {
            ?>
            <?php 
            $stem = MiscLib::baseURL() . 'graphics/';
            ?>
            <?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 size="2" name="selectlist" 
                id="selectlist" onblur="$('#selectlist').focus();">
            <option value='EC' <?php 
            echo $default == 'EC' ? 'selected' : '';
            ?>
>Cash Portion
            <option value='EF' <?php 
            echo $default == 'EF' ? 'selected' : '';
            ?>
>Food Portion
            </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 
        } else {
            ?>
            <input type="text" id="tenderamt" 
                name="tenderamt" onblur="$('#tenderamt').focus();" />
            <br />
            <span class="larger">Press [enter] to tender 
            $<?php 
            printf("%.2f", $this->tendertype == 'EF' ? CoreLocal::get("fsEligible") : CoreLocal::get("runningTotal"));
            ?>
            as <?php 
            echo $this->tendertype == "EF" ? "EBT Food" : "EBT Cash";
            ?>
            or input a different amount</span>
            <br />
            <input type="hidden" name="tendertype" value="<?php 
            echo $this->tendertype;
            ?>
" />
        <?php 
        }
        ?>
        <p>
            <button class="pos-button" type="submit">Select [enter]</button>
            <button class="pos-button" type="submit" 
                onclick="$('#selectlist').append($('<option>').val(''));$('#selectlist').val('');">
                Cancel [clear]
            </button>
        </p>
        </div>
        </form>
        </div>
        <?php 
        if (empty($this->tendertype)) {
            $this->add_onload_command("\$('#selectlist').focus();\n");
            $this->add_onload_command("selectSubmit('#selectlist', '#selectform')\n");
        } else {
            $this->add_onload_command("\$('#tenderamt').focus();\n");
        }
    }
예제 #14
0
파일: adminlist.php 프로젝트: phpsmith/IS4C
    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");
    }
예제 #15
0
 /**
   Use a dedicated dispatch function to launch
   page classes.
   @param $redirect [boolean, default true]
     go to login page if an error occurs
   
   This method checks for the session variable
   CashierNo as a general indicator that the current
   session has been properly initialized
 */
 public static function dispatch($redirect = true)
 {
     $bt = debug_backtrace();
     if (count($bt) == 1) {
         $page = basename($_SERVER['PHP_SELF']);
         $class = substr($page, 0, strlen($page) - 4);
         if (CoreLocal::get('CashierNo') !== '' && $class != 'index' && class_exists($class)) {
             $page = new $class();
         } elseif ($redirect) {
             $url = MiscLib::baseURL();
             header('Location: ' . $url . 'login.php');
         } else {
             trigger_error('Missing class ' . $class, E_USER_NOTICE);
         }
     }
 }
예제 #16
0
    function body_content()
    {
        $stem = MiscLib::baseURL() . 'graphics/';
        ?>
        <div class="baseHeight">
        <div class="centeredDisplay colored rounded">
        <span class="larger">process card transaction</span>
        <form name="selectform" method="post" id="selectform"
            action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
">
        <input type="hidden" name="clear-to-home" value="<?php 
        echo $this->clear_to_home;
        ?>
" />
        <?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" size="5" style="width: 10em;"
            onblur="$('#selectlist').focus()">
        <?php 
        $i = 0;
        foreach ($this->menu as $val => $label) {
            printf('<option %s value="%s">%s</option>', $i == 0 ? 'selected' : '', $val, $label);
            $i++;
        }
        ?>
        </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 
    }
예제 #17
0
    function body_content()
    {
        $stem = MiscLib::baseURL() . 'graphics/';
        ?>
        <div class="baseHeight">
        <div class="centeredDisplay colored rounded">
        <span class="larger">WIC Mode is <?php 
        echo CoreLocal::get('WicMode') ? 'ON' : 'OFF';
        ?>
</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" size="5" style="width: 10em;"
            onblur="$('#selectlist').focus()">
        <?php 
        if (CoreLocal::get('WicMode')) {
            echo '<option value="WICOFF" selected>Exit WIC Mode</option>';
        } else {
            echo '<option value="WICON" selected>Enter WIC Mode</option>';
        }
        ?>
            <option value="WICT">Tender WIC</option>
        </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 
    }
예제 #18
0
 public static function touchScreenScrollButtons($selector = '#search')
 {
     $stem = MiscLib::baseURL() . 'graphics/';
     return '
     <button type="button" class="pos-button coloredArea"
         onclick="pageUp(\'' . $selector . '\');">
         <img src="' . $stem . 'pageup.png" width="16" height="16" />
     </button>
     <br /><br />
     <button type="button" class="pos-button coloredArea"
         onclick="scrollUp(\'' . $selector . '\');">
         <img src="' . $stem . 'up.png" width="16" height="16" />
     </button>
     <br /><br />
     <button type="button" class="pos-button coloredArea"
         onclick="scrollDown(\'' . $selector . '\');">
         <img src="' . $stem . 'down.png" width="16" height="16" />
     </button>
     <br /><br />
     <button type="button" class="pos-button coloredArea"
         onclick="pageDown(\'' . $selector . '\');">
         <img src="' . $stem . 'pagedown.png" width="16" height="16" />
     </button>';
 }
예제 #19
0
    function body_content()
    {
        ?>
        <div class="baseHeight">
        <div class="centeredDisplay colored rounded">
        <span class="larger">reason for refund</span>
        <form name="selectform" method="post" 
            id="selectform" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
">
        <?php 
        if (isset($_POST['selectlist']) && $_POST['selectlist'] == 'Other') {
            ?>
            <input type="text" id="selectlist" name="selectlist" 
                onblur="$('#selectlist').focus();" />
        <?php 
        } else {
            $stem = MiscLib::baseURL() . 'graphics/';
            ?>
            <?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>Overcharge</option>
            <option>Spoiled</option>
            <option>Did not Need</option>
            <option>Did not Like</option>
            <option>Other</option>
            </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 
            $this->add_onload_command("selectSubmit('#selectlist', '#selectform')\n");
        }
        ?>
        <p>
            <button class="pos-button" type="submit">Select [enter]</button>
            <button class="pos-button" type="submit" 
                onclick="$('#selectlist').append($('<option>').val(''));$('#selectlist').val('');">
                Cancel [clear]
            </button>
        </p>
        </div>
        </form>
        </div>    
        <?php 
        $this->add_onload_command("\$('#selectlist').focus();\n");
        //if (isset($_POST['selectlist']) && $_POST['selectlist'] == 'Other')
    }
예제 #20
0
 function parse($str)
 {
     /**
       If customer card is available, prevent other tenders
       unless specficially allowed (e.g., coupons).
     */
     if (CoreLocal::get('PaycardsBlockTenders') == 1) {
         $tender_code = strtoupper(substr($str, -2));
         $exceptions = strtoupper(CoreLocal::get('PaycardsBlockExceptions'));
         $except_array = preg_split('/[^A-Z]+/', $exceptions, 0, PREG_SPLIT_NO_EMPTY);
         if (CoreLocal::get('ccTermState') == 'ready' && !in_array($tender_code, $except_array)) {
             CoreLocal::set('boxMsg', _('Tender customer card before other tenders'));
             CoreLocal::set('boxMsgButtons', array('Charge Card [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
             CoreLocal::set('strEntered', 'CCFROMCACHE');
             $ret = $this->default_json();
             $ret['main_frame'] = MiscLib::baseURL() . 'gui-modules/boxMsg2.php';
             return $ret;
         }
     }
     if (strlen($str) > 2) {
         $left = substr($str, 0, strlen($str) - 2);
         $right = substr($str, -2);
         $ret = PrehLib::tender($right, $left);
         return $ret;
     } else {
         $ret = $this->default_json();
         $base_object = new TenderModule($str, False);
         $tender_object = 0;
         $map = CoreLocal::get("TenderMap");
         if (is_array($map) && isset($map[$str])) {
             $class = $map[$str];
             $tender_object = new $class($str, False);
         }
         $errors = $base_object->ErrorCheck();
         if ($errors !== True) {
             $ret['output'] = $errors;
             return $ret;
         }
         if (is_object($tender_object)) {
             $errors = $tender_object->ErrorCheck();
             if ($errors !== True) {
                 $ret['output'] = $errors;
                 return $ret;
             }
         }
         if (is_object($tender_object) && !$tender_object->AllowDefault()) {
             $ret['output'] = $tender_object->DisabledPrompt();
             return $ret;
         } elseif (is_object($tender_object) && $tender_object->AllowDefault()) {
             CoreLocal::set('RepeatAgain', true);
             $ret['main_frame'] = $tender_object->DefaultPrompt();
             return $ret;
         } else {
             if ($base_object->AllowDefault()) {
                 CoreLocal::set('RepeatAgain', true);
                 $ret['main_frame'] = $base_object->DefaultPrompt();
                 return $ret;
             } else {
                 $ret['output'] = $base_object->DisabledPrompt();
                 return $ret;
             }
         }
     }
 }
예제 #21
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;
 }
예제 #22
0
파일: pos2.php 프로젝트: phpsmith/IS4C
 function preprocess()
 {
     $this->display = "";
     $sd = MiscLib::scaleObject();
     $entered = "";
     if (isset($_REQUEST["reginput"])) {
         $entered = strtoupper(trim($_REQUEST["reginput"]));
     }
     if (substr($entered, -2) == "CL") {
         $entered = "CL";
     }
     if ($entered == "RI") {
         $entered = CoreLocal::get("strEntered");
     }
     if (CoreLocal::get("msgrepeat") == 1 && $entered != "CL") {
         $entered = CoreLocal::get("strRemembered");
         CoreLocal::set('strRemembered', '');
     }
     CoreLocal::set("strEntered", $entered);
     $json = array();
     if ($entered != "") {
         if (in_array("Paycards", CoreLocal::get("PluginList"))) {
             /* this breaks the model a bit, but I'm putting
              * putting the CC parser first manually to minimize
              * code that potentially handles the PAN */
             if (CoreLocal::get("PaycardsCashierFacing") == "1" && substr($entered, 0, 9) == "PANCACHE:") {
                 /* cashier-facing device behavior; run card immediately */
                 $entered = substr($entered, 9);
                 CoreLocal::set("CachePanEncBlock", $entered);
             }
             $pe = new paycardEntered();
             if ($pe->check($entered)) {
                 $valid = $pe->parse($entered);
                 $entered = "PAYCARD";
                 CoreLocal::set("strEntered", "");
                 $json = $valid;
             }
             CoreLocal::set("quantity", 0);
             CoreLocal::set("multiple", 0);
         }
         /* FIRST PARSE CHAIN:
          * Objects belong in the first parse chain if they
          * modify the entered string, but do not process it
          * This chain should be used for checking prefixes/suffixes
          * to set up appropriate session variables.
          */
         $parser_lib_path = $this->page_url . "parser-class-lib/";
         if (!is_array(CoreLocal::get("preparse_chain"))) {
             CoreLocal::set("preparse_chain", PreParser::get_preparse_chain());
         }
         foreach (CoreLocal::get("preparse_chain") as $cn) {
             if (!class_exists($cn)) {
                 continue;
             }
             $p = new $cn();
             if ($p->check($entered)) {
                 $entered = $p->parse($entered);
             }
             if (!$entered || $entered == "") {
                 break;
             }
         }
         if ($entered != "" && $entered != "PAYCARD") {
             /* 
              * SECOND PARSE CHAIN
              * these parser objects should process any input
              * completely. The return value of parse() determines
              * whether to call lastpage() [list the items on screen]
              */
             if (!is_array(CoreLocal::get("parse_chain"))) {
                 CoreLocal::set("parse_chain", Parser::get_parse_chain());
             }
             $result = False;
             foreach (CoreLocal::get("parse_chain") as $cn) {
                 if (!class_exists($cn)) {
                     continue;
                 }
                 $p = new $cn();
                 if ($p->check($entered)) {
                     $result = $p->parse($entered);
                     break;
                 }
             }
             if ($result && is_array($result)) {
                 // postparse chain: modify result
                 if (!is_array(CoreLocal::get("postparse_chain"))) {
                     CoreLocal::set("postparse_chain", PostParser::getPostParseChain());
                 }
                 foreach (CoreLocal::get('postparse_chain') as $class) {
                     if (!class_exists($class)) {
                         continue;
                     }
                     $obj = new $class();
                     $result = $obj->parse($result);
                 }
                 $json = $result;
                 if (isset($result['udpmsg']) && $result['udpmsg'] !== False) {
                     if (is_object($sd)) {
                         $sd->WriteToScale($result['udpmsg']);
                     }
                 }
             } else {
                 $arr = array('main_frame' => false, 'target' => '.baseHeight', 'output' => DisplayLib::inputUnknown());
                 $json = $arr;
                 if (is_object($sd)) {
                     $sd->WriteToScale('errorBeep');
                 }
             }
         }
     }
     CoreLocal::set("msgrepeat", 0);
     if (isset($json['main_frame']) && $json['main_frame'] != False) {
         $this->change_page($json['main_frame']);
         return False;
     }
     if (isset($json['output']) && !empty($json['output'])) {
         $this->display = $json['output'];
     }
     if (isset($json['retry']) && $json['retry'] != False) {
         $this->add_onload_command("setTimeout(\"inputRetry('" . $json['retry'] . "');\", 150);\n");
     }
     if (isset($json['receipt']) && $json['receipt'] != False) {
         $ref = isset($json['trans_num']) ? $json['trans_num'] : ReceiptLib::mostRecentReceipt();
         $this->add_onload_command("receiptFetch('" . $json['receipt'] . "', '" . $ref . "');\n");
     }
     if (CoreLocal::get('CustomerDisplay') === true) {
         $child_url = MiscLib::baseURL() . 'gui-modules/posCustDisplay.php';
         $this->add_onload_command("setCustomerURL('{$child_url}');\n");
         $this->add_onload_command("reloadCustomerDisplay();\n");
     }
     return true;
 }