Beispiel #1
0
 /**
   Suspends the current transaction
   If the remote server is available, it will be suspended
   there. Otherwise it is suspended locally.
   @return [string] transaction identifier
 */
 public static function suspendorder()
 {
     $query_a = "select emp_no, trans_no from localtemptrans";
     $db_a = Database::tDataConnect();
     $result_a = $db_a->query($query_a);
     $row_a = $db_a->fetch_array($result_a);
     $cashier_no = substr("000" . $row_a["emp_no"], -2);
     $trans_no = substr("0000" . $row_a["trans_no"], -4);
     $trans_num = ReceiptLib::receiptNumber();
     if (CoreLocal::get("standalone") == 0) {
         $db_a->add_connection(CoreLocal::get("mServer"), CoreLocal::get("mDBMS"), CoreLocal::get("mDatabase"), CoreLocal::get("mUser"), CoreLocal::get("mPass"), false, true);
         $cols = Database::getMatchingColumns($db_a, "localtemptrans", "suspended");
         $db_a->transfer(CoreLocal::get("tDatabase"), "select {$cols} from localtemptrans", CoreLocal::get("mDatabase"), "insert into suspended ({$cols})");
         $db_a->close(CoreLocal::get("mDatabase"), True);
     } else {
         $query = "insert into suspended select * from localtemptrans";
         $result = $db_a->query($query);
     }
     /* ensure the cancel happens */
     $cancelR = $db_a->query("UPDATE localtemptrans SET trans_status='X',charflag='S'");
     TransRecord::finalizeTransaction(true);
     CoreLocal::set("plainmsg", _("transaction suspended"));
     $recall_line = CoreLocal::get("standalone") . " " . CoreLocal::get("laneno") . " " . $cashier_no . " " . $trans_no;
     /**
       If the transaction is marked as complete but somehow did not
       actually finish, this will prevent the suspended receipt from
       adding tax/discount lines to the transaction
     */
     CoreLocal::set('End', 0);
     return $trans_num;
 }
Beispiel #2
0
*********************************************************************************/
ini_set('display_errors', 'Off');
include_once dirname(__FILE__) . '/../lib/AutoLoader.php';
/*
 * Mark items as shrink/unsellable.
 *
 * DDD is WFC lingo for unsaleable goods (dropped, dented, damaged,
 * etc) Functionally this works like canceling a transaction, but
 * marks items with a different trans_status (Z) so these items can be
 * pulled out in later reports.  A mappable reason code is stored in
 * localtemptrans.numflag.
 */
$shrinkReason = 0;
if (CoreLocal::get('shrinkReason') > 0) {
    $shrinkReason = CoreLocal::get('shrinkReason');
}
$db = Database::tDataConnect();
$query = "UPDATE localtemptrans SET trans_status='Z', numflag=" . (int) $shrinkReason;
$db->query($query);
CoreLocal::set("plainmsg", "items marked as shrink/unsellable");
CoreLocal::set("End", 2);
CoreLocal::set('shrinkReason', 0);
$_REQUEST['receiptType'] = 'ddd';
$_REQUEST['ref'] = ReceiptLib::receiptNumber();
TransRecord::finalizeTransaction(true);
ob_start();
include realpath(dirname(__FILE__) . '/ajax-end.php');
ob_end_clean();
if (!headers_send()) {
    header("Location: " . MiscLib::base_url() . "gui-modules/pos2.php");
}
Beispiel #3
0
 /**
   A return array for parse() with proper keys
   @return array
 
   See parse() method
 */
 function default_json()
 {
     return array('main_frame' => false, 'target' => '.baseHeight', 'output' => false, 'redraw_footer' => false, 'receipt' => false, 'trans_num' => ReceiptLib::receiptNumber(), 'scale' => false, 'udpmsg' => false, 'retry' => false);
 }
Beispiel #4
0
    function head_content()
    {
        ?>
        <script type="text/javascript">
        var formSubmitted = false;
        function submitWrapper(){
            var str = $('#reginput').val();
            if (str.toUpperCase() == 'RP'){
                $.ajax({url: '<?php 
        echo $this->page_url;
        ?>
ajax-callbacks/ajax-end.php',
                    cache: false,
                    type: 'post',
                    data: 'receiptType='+$('#rp_type').val()+'&ref=<?php 
        echo ReceiptLib::receiptNumber();
        ?>
',
                    success: function(data) {
                        // If a paper signature slip is requested during
                        // electronic signature capture, abort capture
                        // Paper slip will be used instead.
                        if ($('input[name=doCapture]').length != 0) {
                            $('input[name=doCapture]').val(0);    
                            $('div.boxMsgAlert').html('Verify Signature');
                            $('#sigInstructions').html('[enter] to approve, [void] to reverse the charge<br />[reprint] to print slip');
                        }
                    }
                });
                $('#reginput').val('');
                return false;
            }
            // avoid double submit
            if (!formSubmitted) {
                formSubmitted = true;
                return true;
            } else {
                return false;
            }
        }
        function parseWrapper(str) {
            if (str.substring(0, 7) == 'TERMBMP') {
                var fn = '<?php 
        echo $this->bmp_path;
        ?>
' + str.substring(7);
                $('<input>').attr({
                    type: 'hidden',
                    name: 'bmpfile',
                    value: fn
                }).appendTo('#formlocal');

                var img = $('<img>').attr({
                    src: fn,
                    width: 250 
                });
                $('#imgArea').append(img);
                $('.boxMsgAlert').html('Approve Signature');
                $('#sigInstructions').html('[enter] to approve, [void] to reverse the charge');
            } 
        }
        function addToForm(n, v) {
            $('<input>').attr({
                name: n,
                value: v,
                type: 'hidden'
            }).appendTo('#formlocal');
        }
        </script>
        <style type="text/css">
        #imgArea img { border: solid 1px; black; margin:5px; }
        </style>
        <?php 
    }
Beispiel #5
0
 public static function debugLog($val)
 {
     $tdate = "";
     if (CoreLocal::get("DBMS") == "mssql") {
         $tdate = strftime("%m/%d/%y %H:%M:%S %p", time());
     } else {
         $tdate = strftime("%Y-%m-%d %H:%M:%S", time());
     }
     $trans_num = ReceiptLib::receiptNumber();
     $lastID = CoreLocal::get('LastID');
     $db = Database::tDataConnect();
     if ($db->table_exists('DebugLog')) {
         $prep = $db->prepare('INSERT INTO DebugLog 
                           (tdate, transNum, transID, entry)
                           VALUES
                           (?, ?, ?, ?)');
         $res = $db->execute($prep, array($tdate, $trans_num, $lastID, $val));
         return $res ? true : false;
     } else {
         return false;
     }
 }
Beispiel #6
0
 function mgrauthenticate($password)
 {
     $ret = array('cancelOrder' => false, 'msg' => _('password invalid'), 'heading' => _('re-enter password'), 'giveUp' => false);
     $password = strtoupper($password);
     $password = str_replace("'", "", $password);
     if (!isset($password) || strlen($password) < 1 || $password == "CL") {
         $ret['giveUp'] = true;
         return $ret;
     }
     $priv = sprintf("%d", CoreLocal::get("SecurityCancel"));
     if (Authenticate::checkPermission($password, $priv)) {
         $this->cancelorder();
         $ret['cancelOrder'] = true;
         $ret['trans_num'] = ReceiptLib::receiptNumber();
         $dbc = Database::tDataConnect();
         $dbc->query("update localtemptrans set trans_status = 'X'");
         TransRecord::finalizeTransaction(true);
         if (CoreLocal::get('LoudLogins') == 1) {
             UdpComm::udpSend('twoPairs');
         }
     } else {
         if (CoreLocal::get('LoudLogins') == 1) {
             UdpComm::udpSend('errorBeep');
         }
     }
     return $ret;
 }
Beispiel #7
0
    /**
       Include some paycard submission javascript functions.
       Automatically called during page print.
    */
    protected function paycard_jscript_functions()
    {
        $plugin_info = new Paycards();
        ?>
        <script type="text/javascript">
        function paycard_submitWrapper(){
            $.ajax({url: '<?php 
        echo $plugin_info->pluginUrl();
        ?>
/ajax/ajax-paycard-auth.php',
                cache: false,
                type: 'post',
                dataType: 'json',
                success: function(data){
                    var destination = data.main_frame;
                    if (data.receipt){
                        $.ajax({url: '<?php 
        echo $this->page_url;
        ?>
ajax-callbacks/ajax-end.php',
                            cache: false,
                            type: 'post',
                            data: 'receiptType='+data.receipt+'&ref=<?php 
        echo ReceiptLib::receiptNumber();
        ?>
',
                            error: function(){
                                location = destination;
                            },
                            success: function(data){
                                location = destination;
                            }
                        });
                    }
                    else
                        location = destination;
                },
                error: function(){
                    location = '<?php 
        echo $plugin_info->pluginUrl();
        ?>
/gui/paycardboxMsgAuth.php';
                }
            });
            paycard_processingDisplay();
            return false;
        }
        function paycard_processingDisplay(){
            var content = $('div.baseHeight').html();
            if (content.length >= 23)
                content = 'Waiting for response.';
            else
                content += '.';
            $('div.baseHeight').html(content);
            setTimeout('paycard_processingDisplay()',1000);
        }
        </script>
        <?php 
    }