Пример #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;
 }
Пример #2
0
 function tender_out($asTender)
 {
     $ret = $this->default_json();
     Database::getsubtotals();
     if (CoreLocal::get("amtdue") <= 0.005) {
         CoreLocal::set("change", -1 * CoreLocal::get("amtdue"));
         $cash_return = CoreLocal::get("change");
         if ($asTender != "FS") {
             TransRecord::addchange($cash_return, 'CA');
         }
         CoreLocal::set("End", 1);
         $ret['output'] = DisplayLib::printReceiptFooter();
         $ret['redraw_footer'] = true;
         $ret['receipt'] = 'full';
         TransRecord::finalizeTransaction();
     } else {
         CoreLocal::set("change", 0);
         CoreLocal::set("fntlflag", 0);
         $ttl_result = PrehLib::ttl();
         TransRecord::debugLog('Tender Out (PrehLib): ' . print_r($ttl_result, true));
         TransRecord::debugLog('Tender Out (amtdue): ' . print_r(CoreLocal::get('amtdue'), true));
         $ret['output'] = DisplayLib::lastpage();
     }
     return $ret;
 }
Пример #3
0
 function parse($str)
 {
     $ret = $this->default_json();
     $qty = 1;
     if ($str != "RRR") {
         $split = explode("*", $str);
         if (!is_numeric($split[0])) {
             return true;
         }
         $qty = $split[0];
     }
     $no_trans = CoreLocal::get('LastID') == 0 ? true : false;
     $this->add($qty);
     $ret['output'] = DisplayLib::lastpage();
     $ret['udpmsg'] = 'goodBeep';
     Database::getsubtotals();
     if ($no_trans && CoreLocal::get("runningTotal") == 0) {
         TransRecord::finalizeTransaction(true);
     }
     return $ret;
 }
Пример #4
0
 /**
   Add a tender to the transaction
 
   @right tender amount in cents (100 = $1)
   @strl tender code from tenders table
   @return An array see Parser::default_json()
    for format explanation.
 
   This function will automatically end a transaction
   if the amount due becomes <= zero.
 */
 public static function tender($right, $strl)
 {
     $ret = array('main_frame' => false, 'redraw_footer' => false, 'target' => '.baseHeight', 'output' => "");
     $strl = MiscLib::centStrToDouble($strl);
     if (CoreLocal::get('RepeatAgain')) {
         // the default tender prompt utilizes boxMsg2.php to
         // repeat the previous input, plus amount, on confirmation
         // the tender's preReqCheck methods will need to pretend
         // this is the first input rather than a repeat
         CoreLocal::set('msgrepeat', 0);
         CoreLocal::set('RepeatAgain', false);
     }
     $tender_mods = self::getTenderMods($right);
     $tender_object = null;
     foreach ($tender_mods as $class) {
         if (!class_exists($class)) {
             $ret['output'] = DisplayLib::boxMsg(_('tender is misconfigured'), _('Notify Administrator'), false, DisplayLib::standardClearButton());
             return $ret;
         }
         $tender_object = new $class($right, $strl);
         /**
           Do tender-specific error checking and prereqs
         */
         $error = $tender_object->ErrorCheck();
         if ($error !== true) {
             $ret['output'] = $error;
             return $ret;
         }
         $prereq = $tender_object->PreReqCheck();
         if ($prereq !== true) {
             $ret['main_frame'] = $prereq;
             return $ret;
         }
     }
     // add the tender record
     $tender_object->Add();
     Database::getsubtotals();
     // see if transaction has ended
     if (CoreLocal::get("amtdue") <= 0.005) {
         CoreLocal::set("change", -1 * CoreLocal::get("amtdue"));
         $cash_return = CoreLocal::get("change");
         TransRecord::addchange($cash_return, $tender_object->ChangeType(), $tender_object->ChangeMsg());
         CoreLocal::set("End", 1);
         $ret['receipt'] = 'full';
         $ret['output'] = DisplayLib::printReceiptFooter();
         TransRecord::finalizeTransaction();
     } else {
         CoreLocal::set("change", 0);
         CoreLocal::set("fntlflag", 0);
         Database::setglobalvalue("FntlFlag", 0);
         $chk = self::ttl();
         if ($chk === true) {
             $ret['output'] = DisplayLib::lastpage();
         } else {
             $ret['main_frame'] = $chk;
         }
     }
     $ret['redraw_footer'] = true;
     return $ret;
 }
Пример #5
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");
}
Пример #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;
 }