content; $printer = $row->printer; $origJob = json_decode($origJobJson, true); $refworkid = $origJob["workid"]; $table = $origJob["table"]; $time = $origJob["time"]; $products = $origJob["products"]; $sql = "SELECT productname,productid,price FROM %queue% WHERE id=?"; $res = CommonUtils::fetchSqlAll($pdo, $sql, array($queueid)); if (count($res) > 0) { $longname = $res[0]["productname"]; $prodid = $res[0]["productid"]; $price = $res[0]["price"]; $sql = "select %extras%.name as name,%extras%.id FROM %queueextras%,%extras% WHERE extraid=%extras%.id AND queueid=?"; $extrares = CommonUtils::fetchSqlAll($pdo, $sql, array($queueid)); $extrasArr = array(); foreach($extrares as $e) { $extrasArr[] = $e["name"]; } $extrasStr = implode(",",$extrasArr); $sql = "select kind,category from %products%,%prodtype% where %products%.category=%prodtype%.id AND %products%.id=?"; $reskind = CommonUtils::fetchSqlAll($pdo, $sql, array($prodid)); $kind = $reskind[0]["kind"]; $cancelJob = array( "workid" => $workid, "refworkid" => $refworkid, "table" => $table, "time" => $time, "longname" => $longname, "kind" => $kind, "price" => $price, "extras" => $extrasStr); $cancelJobJson = json_encode($cancelJob); $printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`,`printer`) VALUES ( NULL,?,?,?)"; $stmt = $pdo->prepare(DbUtils::substTableAlias($printInsertSql)); $type = PrintQueue::$CANCELFOOD; if ($kind == 1) { $type = PrintQueue::$CANCELDRINK; } $stmt->execute(array($cancelJobJson,$type,$printer)); $idOfWorkJob = $pdo->lastInsertId(); CommonUtils::log($pdo,"QUEUE","Create cancel work job with id=$idOfWorkJob for tableid $table of kind $kind for printer=$printer"); } } } catch (Exception $ex) { $msg = $ex->getMessage(); return; } } } }