ordersprinter/gastsystem/php/queue.php

36 lines
910 B
PHP

<?php
require_once 'dbutils.php';
require_once 'config.php';
require_once 'ossystem.php';
class Queue {
public static function putintoqueue($pdo,$prodid,$tableid,$tablecode,$dailycode) {
$timezone = OsSystem::getTimeZone($pdo);
date_default_timezone_set($timezone);
$ordertime = date('Y-m-d H:i:s');
$pdo->beginTransaction();
$sql = "INSERT INTO %queue% (date,prodid,tableid,tablecode,dailycode) VALUES(?,?,?,?,?)";
DbUtils::execSql($pdo, $sql, array($ordertime,$prodid,$tableid,$tablecode,$dailycode));
$pdo->commit();
return array("status" => "OK");
}
}
if (isset($_GET["command"])) {
$command = $_GET["command"];
$pdo = DbUtils::openDbAndReturnPdoStatic();
switch ($command) {
case "putintoqueue":
$ret = Queue::putintoqueue($pdo,$_POST["prodid"],$_POST["tableid"],$_POST["tablecode"],$_POST["dailycode"]);
echo json_encode($ret);
break;
default:
break;
}
}