ecccode,$eccPos);
+ $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
+ $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
+
+ $dataPos += $dl;
+ $eccPos += $el;
+ $blockNo++;
+ }
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function getCode()
+ {
+ $ret;
+
+ if($this->count < $this->dataLength) {
+ $row = $this->count % $this->blocks;
+ $col = $this->count / $this->blocks;
+ if($col >= $this->rsblocks[0]->dataLength) {
+ $row += $this->b1;
+ }
+ $ret = $this->rsblocks[$row]->data[$col];
+ } else if($this->count < $this->dataLength + $this->eccLength) {
+ $row = ($this->count - $this->dataLength) % $this->blocks;
+ $col = ($this->count - $this->dataLength) / $this->blocks;
+ $ret = $this->rsblocks[$row]->ecc[$col];
+ } else {
+ return 0;
+ }
+ $this->count++;
+
+ return $ret;
+ }
+ }
+
+ //##########################################################################
+
+ class QRcode {
+
+ public $version;
+ public $width;
+ public $data;
+
+ //----------------------------------------------------------------------
+ public function encodeMask(QRinput $input, $mask)
+ {
+ if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
+ throw new Exception('wrong version');
+ }
+ if($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
+ throw new Exception('wrong level');
+ }
+
+ $raw = new QRrawcode($input);
+
+ QRtools::markTime('after_raw');
+
+ $version = $raw->version;
+ $width = QRspec::getWidth($version);
+ $frame = QRspec::newFrame($version);
+
+ $filler = new FrameFiller($width, $frame);
+ if(is_null($filler)) {
+ return NULL;
+ }
+
+ // inteleaved data and ecc codes
+ for($i=0; $i<$raw->dataLength + $raw->eccLength; $i++) {
+ $code = $raw->getCode();
+ $bit = 0x80;
+ for($j=0; $j<8; $j++) {
+ $addr = $filler->next();
+ $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
+ $bit = $bit >> 1;
+ }
+ }
+
+ QRtools::markTime('after_filler');
+
+ unset($raw);
+
+ // remainder bits
+ $j = QRspec::getRemainder($version);
+ for($i=0; $i<$j; $i++) {
+ $addr = $filler->next();
+ $filler->setFrameAt($addr, 0x02);
+ }
+
+ $frame = $filler->frame;
+ unset($filler);
+
+
+ // masking
+ $maskObj = new QRmask();
+ if($mask < 0) {
+
+ if (QR_FIND_BEST_MASK) {
+ $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel());
+ } else {
+ $masked = $maskObj->makeMask($width, $frame, (intval(QR_DEFAULT_MASK) % 8), $input->getErrorCorrectionLevel());
+ }
+ } else {
+ $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel());
+ }
+
+ if($masked == NULL) {
+ return NULL;
+ }
+
+ QRtools::markTime('after_mask');
+
+ $this->version = $version;
+ $this->width = $width;
+ $this->data = $masked;
+
+ return $this;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeInput(QRinput $input)
+ {
+ return $this->encodeMask($input, -1);
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeString8bit($string, $version, $level)
+ {
+ if(string == NULL) {
+ throw new Exception('empty string!');
+ return NULL;
+ }
+
+ $input = new QRinput($version, $level);
+ if($input == NULL) return NULL;
+
+ $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string));
+ if($ret < 0) {
+ unset($input);
+ return NULL;
+ }
+ return $this->encodeInput($input);
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeString($string, $version, $level, $hint, $casesensitive)
+ {
+
+ if($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) {
+ throw new Exception('bad hint');
+ return NULL;
+ }
+
+ $input = new QRinput($version, $level);
+ if($input == NULL) return NULL;
+
+ $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
+ if($ret < 0) {
+ return NULL;
+ }
+
+ return $this->encodeInput($input);
+ }
+
+ //----------------------------------------------------------------------
+ public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->encodePNG($text, $outfile, $saveandprint=false);
+ }
+
+ //----------------------------------------------------------------------
+ public static function text($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->encode($text, $outfile);
+ }
+
+ //----------------------------------------------------------------------
+ public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->encodeRAW($text, $outfile);
+ }
+ }
+
+ //##########################################################################
+
+ class FrameFiller {
+
+ public $width;
+ public $frame;
+ public $x;
+ public $y;
+ public $dir;
+ public $bit;
+
+ //----------------------------------------------------------------------
+ public function __construct($width, &$frame)
+ {
+ $this->width = $width;
+ $this->frame = $frame;
+ $this->x = $width - 1;
+ $this->y = $width - 1;
+ $this->dir = -1;
+ $this->bit = -1;
+ }
+
+ //----------------------------------------------------------------------
+ public function setFrameAt($at, $val)
+ {
+ $this->frame[$at['y']][$at['x']] = chr($val);
+ }
+
+ //----------------------------------------------------------------------
+ public function getFrameAt($at)
+ {
+ return ord($this->frame[$at['y']][$at['x']]);
+ }
+
+ //----------------------------------------------------------------------
+ public function next()
+ {
+ do {
+
+ if($this->bit == -1) {
+ $this->bit = 0;
+ return array('x'=>$this->x, 'y'=>$this->y);
+ }
+
+ $x = $this->x;
+ $y = $this->y;
+ $w = $this->width;
+
+ if($this->bit == 0) {
+ $x--;
+ $this->bit++;
+ } else {
+ $x++;
+ $y += $this->dir;
+ $this->bit--;
+ }
+
+ if($this->dir < 0) {
+ if($y < 0) {
+ $y = 0;
+ $x -= 2;
+ $this->dir = 1;
+ if($x == 6) {
+ $x--;
+ $y = 9;
+ }
+ }
+ } else {
+ if($y == $w) {
+ $y = $w - 1;
+ $x -= 2;
+ $this->dir = -1;
+ if($x == 6) {
+ $x--;
+ $y -= 8;
+ }
+ }
+ }
+ if($x < 0 || $y < 0) return null;
+
+ $this->x = $x;
+ $this->y = $y;
+
+ } while(ord($this->frame[$y][$x]) & 0x80);
+
+ return array('x'=>$x, 'y'=>$y);
+ }
+
+ } ;
+
+ //##########################################################################
+
+ class QRencode {
+
+ public $casesensitive = true;
+ public $eightbit = false;
+
+ public $version = 0;
+ public $size = 3;
+ public $margin = 4;
+
+ public $structured = 0; // not supported yet
+
+ public $level = QR_ECLEVEL_L;
+ public $hint = QR_MODE_8;
+
+ //----------------------------------------------------------------------
+ public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = new QRencode();
+ $enc->size = $size;
+ $enc->margin = $margin;
+
+ switch ($level.'') {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ $enc->level = $level;
+ break;
+ case 'l':
+ case 'L':
+ $enc->level = QR_ECLEVEL_L;
+ break;
+ case 'm':
+ case 'M':
+ $enc->level = QR_ECLEVEL_M;
+ break;
+ case 'q':
+ case 'Q':
+ $enc->level = QR_ECLEVEL_Q;
+ break;
+ case 'h':
+ case 'H':
+ $enc->level = QR_ECLEVEL_H;
+ break;
+ }
+
+ return $enc;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeRAW($intext, $outfile = false)
+ {
+ $code = new QRcode();
+
+ if($this->eightbit) {
+ $code->encodeString8bit($intext, $this->version, $this->level);
+ } else {
+ $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
+ }
+
+ return $code->data;
+ }
+
+ //----------------------------------------------------------------------
+ public function encode($intext, $outfile = false)
+ {
+ $code = new QRcode();
+
+ if($this->eightbit) {
+ $code->encodeString8bit($intext, $this->version, $this->level);
+ } else {
+ $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
+ }
+
+ QRtools::markTime('after_encode');
+
+ if ($outfile!== false) {
+ file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
+ } else {
+ return QRtools::binarize($code->data);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodePNG($intext, $outfile = false,$saveandprint=false)
+ {
+ try {
+
+ ob_start();
+ $tab = $this->encode($intext);
+ $err = ob_get_contents();
+ ob_end_clean();
+
+ if ($err != '')
+ QRtools::log($outfile, $err);
+
+ $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
+
+ QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint);
+
+ } catch (Exception $e) {
+
+ QRtools::log($outfile, $e->getMessage());
+
+ }
+ }
+ }
+
+
diff --git a/webapp/php/admin.php b/webapp/php/admin.php
index 4125a46..07376ea 100644
--- a/webapp/php/admin.php
+++ b/webapp/php/admin.php
@@ -1228,7 +1228,11 @@ class Admin {
array("austriabind",0,false),
array("doublereceipt",0,false),
array("printextraprice",1,false),
- array("turbo",5,false)
+ array("turbo",5,false),
+ array("guestqrtext",null,false),
+ array("guestqrsize",null,false),
+ array("guestqrfontsize",null,false),
+ array("reservationitem",null,false)
);
if (is_null($pdo)) {
@@ -1423,7 +1427,7 @@ class Admin {
$view = "preferences.html";
}
- echo json_encode($view . "?v=1.5.33");
+ echo json_encode($view . "?v=1.6.1");
}
}
@@ -1644,31 +1648,31 @@ class Admin {
if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['modus'] == 0) {
- if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.5.33"); }
+ if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.6.1"); }
} else {
- if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.5.33"); }
+ if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.6.1"); }
}
- if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.5.33"); }
- if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.5.33"); }
- if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.5.33"); }
+ if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.6.1"); }
+ if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.6.1"); }
+ if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.6.1"); }
if ($_SESSION['modus'] == 0) {
- if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.5.33"); }
+ if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.6.1"); }
}
- if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.5.33"); }
- if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.5.33"); }
- if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.5.33"); }
- if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.5.33"); }
- if ($_SESSION['right_tasks'] || $_SESSION['right_tasksmanagement']) { $mainMenu[] = array("name" => $taskstxt[$lang], "link" => "tasks.html?v=1.5.33"); }
- if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.5.33"); }
- if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.5.33"); }
- if ($_SESSION['right_pickups']) { $mainMenu[] = array("name" => $pickupstxt[$lang], "link" => "pickups.html?v=1.5.33"); }
- if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.5.33"); }
- if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.5.33"); }
- $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.5.33");
- if ($_SESSION['right_timetracking'] || $_SESSION['right_timemanager']) { $mainMenu[] = array("name" => $timetrackingtxt[$lang], "link" => "timetracking.html?v=1.5.33"); }
+ if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.6.1"); }
+ if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.6.1"); }
+ if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.6.1"); }
+ if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.6.1"); }
+ if ($_SESSION['right_tasks'] || $_SESSION['right_tasksmanagement']) { $mainMenu[] = array("name" => $taskstxt[$lang], "link" => "tasks.html?v=1.6.1"); }
+ if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.6.1"); }
+ if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.6.1"); }
+ if ($_SESSION['right_pickups']) { $mainMenu[] = array("name" => $pickupstxt[$lang], "link" => "pickups.html?v=1.6.1"); }
+ if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.6.1"); }
+ if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.6.1"); }
+ $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.6.1");
+ if ($_SESSION['right_timetracking'] || $_SESSION['right_timemanager']) { $mainMenu[] = array("name" => $timetrackingtxt[$lang], "link" => "timetracking.html?v=1.6.1"); }
- $mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.5.33");
- $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.5.33");
+ $mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.6.1");
+ $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.6.1");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@@ -2288,7 +2292,11 @@ class Admin {
"logolocation" => array("dbcol" => "logolocation","checknum" => 1),
"austriabind" => array("dbcol" => "austriabind","checknum" => 0),
"doublereceipt" => array("dbcol" => "doublereceipt","checknum" => 0),
- "printextraprice" => array("dbcol" => "printextraprice","checknum" => 0)
+ "printextraprice" => array("dbcol" => "printextraprice","checknum" => 0),
+ "guestqrtext" => array("dbcol" => "guestqrtext","checknum" => 0),
+ "guestqrsize" => array("dbcol" => "guestqrsize","checknum" => 1),
+ "guestqrfontsize" => array("dbcol" => "guestqrfontsize","checknum" => 1),
+ "reservationitem" => array("dbcol" => "reservationitem","checknum" => 0)
);
$problem = false;
foreach ($changedValues as $aChangeSet) {
diff --git a/webapp/php/closing.php b/webapp/php/closing.php
index 088145b..7a11f24 100644
--- a/webapp/php/closing.php
+++ b/webapp/php/closing.php
@@ -189,6 +189,7 @@ $newClosingId = $maxIdVal + 1;
$closingEntrySql = "INSERT INTO `%closing%` (`id`,`closingdate`,`remark`,`billcount`,`billsum`,`signature`) VALUES (?,?,?,?,?,?)";
CommonUtils::execSql($pdo, $closingEntrySql, array($newClosingId,$closingTime,$remark,0,0.0,null));
+set_time_limit(60*60);
$sql = "SELECT id FROM %bill% WHERE closingid is null AND (tableid >= '0' OR status='c') ";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
@@ -207,9 +208,11 @@ if (!$ok) {
return(array("status" => "ERROR", "code" => ERROR_INCONSISTENT_DB, "msg" => ERROR_INCONSISTENT_DB_MSG));
}
+set_time_limit(60*60);
$sql = "UPDATE %bill% SET closingid='$newClosingId' WHERE closingid is null AND (tableid >= '0' OR status='c') AND (paymentid <> ?)";
CommonUtils::execSql($pdo, $sql, array(8));
+set_time_limit(60*60);
$sql = "SELECT count(id) as billstotake FROM %bill% WHERE closingid=? AND (tableid >= '0' OR status='c')";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($newClosingId));
@@ -238,9 +241,11 @@ $pricesumstr = number_format($pricesum, 2, ".", '');
$data = "I($newClosingId)-S($prevClosingDate)-E($closingTime)-D($billsToTake)-S($pricesumstr)";
$signature = md5($data);
+set_time_limit(60*60);
$sql = "UPDATE %closing% SET billcount=?, billsum=?,signature=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($billsToTake,$pricesum,$signature,$newClosingId));
+set_time_limit(60*60);
$sql = "SELECT value as val FROM %work% WHERE item=?";
$indexunclosedqueue = 0;
$r = CommonUtils::fetchSqlAll($pdo, $sql, array('indexunclosedqueue'));
@@ -250,15 +255,18 @@ if (!is_null($rval)) {
$indexunclosedqueue = intval($rval);
}
}
+set_time_limit(60*60);
$sql = "UPDATE %queue% Q,%work% W SET Q.clsid=? WHERE Q.id > ? AND Q.clsid is null";
CommonUtils::execSql($pdo, $sql, array($newClosingId,$indexunclosedqueue));
+set_time_limit(60*60);
$sql = "UPDATE %queue% SET toremove='1' WHERE billid is null AND clsid=?";
CommonUtils::execSql($pdo, $sql, array($newClosingId));
+set_time_limit(60*60);
$sql = "UPDATE %queue% set paidtime=?,delivertime=? WHERE billid is not null AND paidtime is null";
CommonUtils::execSql($pdo, $sql, array($closingTime,$closingTime));
@@ -272,6 +280,7 @@ CommonUtils::execSql($pdo, "OPTIMIZE TABLE %printjobs%", null);
$sql = "DELETE FROM %work% WHERE item=?";
CommonUtils::execSql($pdo, $sql, array("sumuphash"));
+set_time_limit(60*60);
$sql = "UPDATE %queue% SET isclosed=?";
CommonUtils::execSql($pdo, $sql, array(1));
diff --git a/webapp/php/customers.php b/webapp/php/customers.php
index f9585c3..f1e176e 100644
--- a/webapp/php/customers.php
+++ b/webapp/php/customers.php
@@ -878,7 +878,7 @@ class Customers {
$txt = "";
$txt .= "" . self::$CUS_OVERVIEW[$lang] . " ";
$txt .= ' ';
- $txt .= ' ';
+ $txt .= ' ';
$txt .= "";
return $txt;
}
diff --git a/webapp/php/debug.php b/webapp/php/debug.php
index cea4b58..2a73bb4 100644
--- a/webapp/php/debug.php
+++ b/webapp/php/debug.php
@@ -27,7 +27,7 @@ if (isset($_POST["cmd"])) {
if (strlen($status) > 150) {
$status = substr($status, 0,149);
}
- $version = "1.5.33";
+ $version = "1.6.1";
$arr = array("cmd" => $cmd,"fct" => $fct, "xhr" => $xhr,"errormsg" => $errormsg,"status" => $status,"version" => $version,"phpversion" => $phpversion);
} else {
diff --git a/webapp/php/reports.php b/webapp/php/reports.php
index 772ee71..6f6259f 100644
--- a/webapp/php/reports.php
+++ b/webapp/php/reports.php
@@ -84,7 +84,11 @@ class Reports {
echo json_encode(array("status" => "OK","msg" => $values));
break;
case 'getProds':
- $values = $this->sumSortedByProducts($pdo, $allDates['last30days'][0], $allDates['currentTimeStr']);
+ $days = null;
+ if (isset($_GET['days'])) {
+ $days = intval($_GET['days']);
+ }
+ $values = $this->sumSortedByProducts($pdo, $allDates['last30days'][0], $allDates['currentTimeStr'],null,null,$days);
echo json_encode(array("status" => "OK","msg" => $values));
break;
case 'getRatings':
@@ -204,7 +208,7 @@ class Reports {
$retArrayLastMonth = $this->iterateForDays($pdo, $allDates['monthAndYearOfLastMonth'],intval($allDates['lastDayOfLastMonth']),true);
// products in the last 30 days:
- $retArrayProds = $this->sumSortedByProducts($pdo, $allDates['last30days'][0], $allDates['currentTimeStr']);
+ $retArrayProds = $this->sumSortedByProducts($pdo, $allDates['last30days'][0], $allDates['currentTimeStr'],null,null,null);
$retRatings = $this->getRatings($pdo,$allDates['last30days'],$allDates['lastMonthComplete'], $allDates['currentTimeStr']);
@@ -305,16 +309,15 @@ class Reports {
}
return ($asum < $bsum) ? 1 : -1;
}
-
- /*
- * returns a sorted by prices list:
- * array("prodid" => $aProdId,"prodname" => $aProd['prodname'], "sum" => $sumprice);
- * array("prodid" => $aProdId,"prodname" => $aProd['prodname'], "sum" => $sumprice);
- * (...)
- */
- public function sumSortedByProducts($pdo,$startDateTime,$endDateTime,$closidstart=null,$closidend=null) {
+
+ public function sumSortedByProducts($pdo,$startDateTime,$endDateTime,$closidstart=null,$closidend=null,$days=null) {
// first get all products and with their id and name
+ if (!is_null($days)) {
+ date_default_timezone_set(DbUtils::getTimeZone());
+ $startDateTime = date("Y-m-d", strtotime('-' . ($days - 1) . ' day') );
+ }
+
if (is_null($closidstart)) {
$sql = "SELECT DISTINCT productid from %queue%,%bill%,%products% ";
$sql .= "WHERE %queue%.productid=%products%.id ";
diff --git a/webapp/php/reservation.php b/webapp/php/reservation.php
index 7fa9cd1..9c525a4 100644
--- a/webapp/php/reservation.php
+++ b/webapp/php/reservation.php
@@ -13,11 +13,11 @@ class Reservation {
echo json_encode(array("status" => "ERROR", "code" => ERROR_RES_NOT_AUTHOTRIZED, "msg" => ERROR_RES_NOT_AUTHOTRIZED_MSG));
} else {
if ($command == 'createReservation') {
- $this->createReservation($_POST['day'],$_POST['month'],$_POST['year'],$_POST['start'],$_POST['name'],$_POST['email'],$_POST['persons'],$_POST['duration'],$_POST['phone'],$_POST['remark'],$_POST["tableid"]);
+ $this->createReservation($_POST['day'],$_POST['month'],$_POST['year'],$_POST['starthour'],$_POST['startmin'],$_POST['name'],$_POST['email'],$_POST['persons'],$_POST['durationhours'],$_POST['durationmins'],$_POST['phone'],$_POST['remark'],$_POST["tableid"]);
} else if ($command == 'getReservations') {
$this->getReservations($_GET['day'],$_GET['month'],$_GET['year']);
} else if ($command == 'changeReservation') {
- $this->changeReservation($_POST['id'],$_POST['day'],$_POST['month'],$_POST['year'],$_POST['start'],$_POST['name'],$_POST['email'],$_POST['persons'],$_POST['duration'],$_POST['phone'],$_POST['remark'],$_POST["tableid"]);
+ $this->changeReservation($_POST['id'],$_POST['day'],$_POST['month'],$_POST['year'],$_POST['starthour'],$_POST['startmin'],$_POST['name'],$_POST['email'],$_POST['persons'],$_POST['durationhours'],$_POST['durationmins'],$_POST['phone'],$_POST['remark'],$_POST["tableid"]);
} else if ($command == 'delReservation') {
$this->delReservation($_POST['id']);
} else if ($command == 'emailConfirmReservation') {
@@ -42,7 +42,7 @@ class Reservation {
}
}
- private function createReservation($day,$month,$year,$start,$name,$email,$persons,$duration,$phone,$remark,$tableid) {
+ private function createReservation($day,$month,$year,$start,$startmin,$name,$email,$persons,$durationhours,$durationmins,$phone,$remark,$tableid) {
$userid = $_SESSION['userid'];
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
@@ -56,11 +56,11 @@ class Reservation {
$pdo->beginTransaction();
$sql = "INSERT INTO `%reservations%` (
- `id` , `creator`,`creationdate`,`scheduledate`,`name`,`email`,`starttime`,`duration`,`persons`,`phone`,`remark`,`tableid`)
+ `id` , `creator`,`creationdate`,`scheduledate`,`name`,`email`,`starttime`,`starttimemin`,`duration`,`durationmins`,`persons`,`phone`,`remark`,`tableid`)
VALUES (
- NULL , ?,?,?,?,?,?,?,?,?,?,?)";
+ NULL , ?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
- $stmt->execute(array($userid,$currentTime,$scheduledDate,$name,$email,$start,$duration,$persons,$phone,$remark,$tableid));
+ $stmt->execute(array($userid,$currentTime,$scheduledDate,$name,$email,$start,$startmin,$durationhours,$durationmins,$persons,$phone,$remark,$tableid));
$pdo->commit();
echo json_encode(array("status" => "OK"));
}
@@ -70,7 +70,7 @@ class Reservation {
}
}
- private function changeReservation($id,$day,$month,$year,$start,$name,$email,$persons,$duration,$phone,$remark,$tableid) {
+ private function changeReservation($id,$day,$month,$year,$startHour,$startMin,$name,$email,$persons,$durationHours,$durationMins,$phone,$remark,$tableid) {
$userid = $_SESSION['userid'];
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
@@ -80,8 +80,8 @@ class Reservation {
try {
$pdo->beginTransaction();
- $sql = "UPDATE `%reservations%` SET creator=?,creationdate=?,scheduledate=?,name=?,email=?,starttime=?,duration=?,persons=?,phone=?,remark=?,tableid=? WHERE id=?";
- CommonUtils::execSql($pdo, $sql, array($userid,$currentTime,$scheduledDate,$name,$email,$start,$duration,$persons,$phone,$remark,$tableid,$id));
+ $sql = "UPDATE `%reservations%` SET creator=?,creationdate=?,scheduledate=?,name=?,email=?,starttime=?,starttimemin=?,duration=?,durationmins=?,persons=?,phone=?,remark=?,tableid=? WHERE id=?";
+ CommonUtils::execSql($pdo, $sql, array($userid,$currentTime,$scheduledDate,$name,$email,$startHour,$startMin,$durationHours,$durationMins,$persons,$phone,$remark,$tableid,$id));
$pdo->commit();
echo json_encode(array("status" => "OK"));
}
@@ -144,7 +144,7 @@ class Reservation {
$txt = "";
$txt .= "Reservierungsübersicht ";
$txt .= ' ';
- $txt .= ' ';
+ $txt .= ' ';
$txt .= "";
$txt .= "";
$txt .= "Reservierungsübersicht für $day.$month.$year ";
@@ -170,7 +170,8 @@ class Reservation {
}
private static function getSqlForResByTime() {
// REM* roomname and tablename only for the html output
- $sql = "SELECT R.id,U.username as username,creationdate,scheduledate,starttime,name,email,persons,duration,phone,remark,tableid, ";
+ $sqlEndTime = self::sqlForEndTime();
+ $sql = "SELECT R.id,U.username as username,creationdate,scheduledate,starttime as starthour,starttimemin as startmin,$sqlEndTime,name,email,persons,duration,durationmins,phone,remark,tableid, ";
$sql .= "IF(tableid is null,'-1',(SELECT RO.id as roomid FROM %room% RO,%resttables% T WHERE T.id=tableid AND T.roomid=RO.id)) as roomid, ";
$sql .= "IF(tableid is null,'-1',(SELECT RO.sorting as roomsorting FROM %room% RO,%resttables% T WHERE T.id=tableid AND T.roomid=RO.id)) as roomsorting, ";
$sql .= "IF(tableid is null,'',(SELECT RO.roomname as roomname FROM %room% RO,%resttables% T WHERE T.id=tableid AND T.roomid=RO.id)) as roomname, ";
@@ -180,14 +181,25 @@ class Reservation {
$sql .= "WHERE DATE(scheduledate)=? AND R.creator=U.id ";
return $sql;
}
+ // REM* the end time may be in next day, and the minutes may also need an hiour to be increased
+ private static function sqlForEndTime() {
+ $sqlEndTimeStamp = 'ADDTIME(CONCAT(starttime,":",starttimemin,":00"),CONCAT(duration,":",durationmins,":00"))';
+ // REM* will return something like 26:15:00 in case endtime is on next day
+ $sqlEndHour = 'HOUR(' . $sqlEndTimeStamp . ') as endhour';
+ $sqlEndMin = 'MINUTE(' . $sqlEndTimeStamp . ') as endmin';
+ $sqlEndTime = "$sqlEndHour,$sqlEndMin";
+ return $sqlEndTime;
+ }
private function getReservations($day,$month,$year) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
+ $sqlEndTime = self::sqlForEndTime();
+
// REM* the many sortings in the sql allow the sorting by time, room-sort and table-sort
$sql = self::getSqlForResByTime();
$timeSortedReservations = $this->getReservationsCore($pdo,$day,$month,$year,$sql . " ORDER BY starttime,roomsorting,tablesorting");
// REM* and now by table
- $sql = "SELECT DISTINCT R.tableid as tableid,ROOM.id as roomid,ROOM.sorting as roomsorting,T.sorting as tablesorting FROM %reservations% R,%room% ROOM,%resttables% T ";
+ $sql = "SELECT DISTINCT R.tableid as tableid,T.tableno as tablename,ROOM.id as roomid,ROOM.sorting as roomsorting,T.sorting as tablesorting FROM %reservations% R,%room% ROOM,%resttables% T ";
$sql .= " WHERE DATE(scheduledate)=? AND tableid is not null AND tableid >= '0' ";
$sql .= " AND R.tableid = T.id AND T.roomid=ROOM.id ";
$sql .= " ORDER BY ROOM.sorting,T.sorting ";
@@ -198,23 +210,23 @@ class Reservation {
$byTables = array();
foreach($allTablesOfResAtThatDate as $tableRes) {
- $sql = "SELECT R.id,U.username as creator,creationdate,scheduledate,starttime as start,name as guest,email,persons,duration,(starttime + duration) as endhour,";
+ $sql = "SELECT R.id,U.username as creator,creationdate,scheduledate,YEAR(scheduledate) as year,MONTH(scheduledate) as month, DAY(scheduledate) as day,starttime as starthour,starttimemin as startmin,name as guest,email,persons,duration as durationhours,durationmins,$sqlEndTime,";
$sql .= " phone,remark,tableid,'" . $tableRes["roomid"] . "' as roomid ";
$sql .= "FROM %reservations% R,%user% U ";
$sql .= "WHERE DATE(scheduledate)=? AND R.creator=U.id AND tableid=? ";
$sql .= "ORDER BY starttime";
$allResOfThatTable = CommonUtils::fetchSqlAll($pdo, $sql, array($scheduledDate,$tableRes["tableid"]));
- $byTables[] = array("tableid" => $tableRes["tableid"],"roomid" => $tableRes["roomid"], "reservations" => $allResOfThatTable);
+ $byTables[] = array("tableid" => $tableRes["tableid"],"tablename" => $tableRes["tablename"],"roomid" => $tableRes["roomid"], "reservations" => $allResOfThatTable);
}
// REM* these were all reservations by table at the given date. Let's add all reservations without a table assignment
- $sql = "SELECT R.id,U.username as creator,creationdate,scheduledate,starttime as start,name as guest,email,persons,duration,(starttime + duration) as endhour,";
+ $sql = "SELECT R.id,U.username as creator,creationdate,scheduledate,YEAR(scheduledate) as year,MONTH(scheduledate) as month, DAY(scheduledate) as day,starttime as starthour,starttimemin as startmin,name as guest,email,persons,duration as durationhours,durationmins,$sqlEndTime,";
$sql .= " phone,remark,'-1' as tableid,'-1' as roomid ";
$sql .= "FROM %reservations% R,%user% U ";
$sql .= "WHERE DATE(scheduledate)=? AND R.creator=U.id AND (tableid is null OR tableid='-1') ";
$sql .= "ORDER BY starttime";
$allResOfUndefinedTable = CommonUtils::fetchSqlAll($pdo, $sql, array($scheduledDate));
if (count($allResOfUndefinedTable) > 0) {
- $byTables[] = array("tableid" => '-1',"roomid" => '-1', "reservations" => $allResOfUndefinedTable);
+ $byTables[] = array("tableid" => '-1',"tablename" => "?","roomid" => '-1', "reservations" => $allResOfUndefinedTable);
}
$msg = array("bytimes" => $timeSortedReservations,"bytables" => $byTables);
@@ -239,21 +251,22 @@ class Reservation {
$resArray = array();
foreach($result as $row) {
- $datetimeparts = explode(" ",$row['scheduledate']);
- $thedate = $datetimeparts[0];
- $thedateparts = explode("-",$thedate);
$resArray[] = array(
"id" => $row['id'],
"creator" => $row['username'],
"creationdate" => $row['creationdate'],
- "day" => $thedateparts[2],
- "month" => $thedateparts[1],
- "year" => $thedateparts[0],
- "start" => $row['starttime'],
+ "day" => $row['day'],
+ "month" => $row['month'],
+ "year" => $row['year'],
+ "starthour" => $row['starthour'],
+ "startmin" => $row['startmin'],
+ "endhour" => $row['endhour'],
+ "endmin" => $row['endmin'],
"guest" => $row['name'],
"email" => $row['email'],
"persons" => $row['persons'],
- "duration" => $row['duration'],
+ "durationhours" => $row['duration'],
+ "durationmins" => $row['durationmins'],
"phone" => $row['phone'],
"remark" => $row['remark'],
"roomid" => $row['roomid'],
@@ -286,4 +299,4 @@ class Reservation {
return array();
}
}
-}
+}
\ No newline at end of file
diff --git a/webapp/php/roomtables.php b/webapp/php/roomtables.php
index 8ef798e..021a38f 100644
--- a/webapp/php/roomtables.php
+++ b/webapp/php/roomtables.php
@@ -38,13 +38,17 @@ class Roomtables {
} else if ($command == 'getRoomfieldAlsoInactive') {
$this->getRoomfieldAlsoInactive();
} else if ($command == 'setRoomInfo') {
- if ($this->hasCurrentUserAdminRights()) {
+ if (self::hasCurrentUserAdminRights()) {
$this->setRoomInfo($_POST['rooms'],$_POST['togoworkprinter']);
}
+ } else if ($command == 'createTableCodes') {
+ self::createTableCodes();
+ } else if ($command == 'tableqrcodes') {
+ self::tableqrcodes();
}
}
- private function hasCurrentUserAdminRights() {
+ private static function hasCurrentUserAdminRights() {
if(session_id() == '') {
session_start();
}
@@ -55,6 +59,27 @@ class Roomtables {
}
}
+ private static function createTableCodes() {
+ if (!self::hasCurrentUserAdminRights()) {
+ echo json_encode(array("status" => "ERROR","msg" => "Benutzerrechte nicht ausreichend"));
+ return;
+ }
+ try {
+ $pdo = DbUtils::openDbAndReturnPdoStatic();
+ $sql = "SELECT id FROM %resttables% WHERE removed is null AND (code is NULL OR code='')";
+ $activeTables = CommonUtils::fetchSqlAll($pdo, $sql);
+ $updateSql = "UPDATE %resttables% SET code=? WHERE id=?";
+ foreach($activeTables as $table) {
+ $tableid = $table["id"];
+ $uniqid = md5(uniqid());
+ CommonUtils::execSql($pdo, $updateSql, array($uniqid,$tableid));
+ }
+ echo json_encode(array("status" => "OK"));
+ } catch (Exception $ex) {
+ echo json_encode(array("status" => "ERROR","msg" => "Datenbank nicht erreichbar"));
+ }
+ }
+
function showAllRooms() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$roomtables = $this->getAllTablesAndRooms($pdo);
@@ -220,9 +245,22 @@ class Roomtables {
return '';
}
+ private static function sqlForEndTime() {
+ $sqlEndTimeStamp = 'ADDTIME(CONCAT(starttime,":",starttimemin,":00"),CONCAT(duration,":",durationmins,":00"))';
+ $sqlEndHour = 'HOUR(' . $sqlEndTimeStamp . ') as endhour';
+ $sqlEndMin = 'MINUTE(' . $sqlEndTimeStamp . ') as endmin';
+ $sqlEndTime = "$sqlEndHour,$sqlEndMin";
+ return $sqlEndTime;
+ }
+
private function getAllTablesAndRooms($pdo)
{
- $sql = "SELECT tableid,GROUP_CONCAT(DISTINCT CONCAT(starttime,':00-',(starttime+duration),':00') ORDER BY starttime) as times from %reservations% R ";
+ $sqlEndTimeStamp = 'ADDTIME(CONCAT(starttime,":",starttimemin,":00"),CONCAT(duration,":",durationmins,":00"))';
+ $sqlEndHour = 'HOUR(' . $sqlEndTimeStamp . ') ';
+ $sqlEndMin = 'LPAD(MINUTE(' . $sqlEndTimeStamp . '),2,0)';
+
+ $sql = "SELECT tableid,GROUP_CONCAT(DISTINCT CONCAT(starttime,':',LPAD(starttimemin,2,0),'-',($sqlEndHour),':',($sqlEndMin)) ORDER BY starttime) as times from %reservations% R ";
+ //$sql = "SELECT tableid,GROUP_CONCAT(DISTINCT CONCAT(starttime,':00-',(starttime+duration),':00') ORDER BY starttime) as times from %reservations% R ";
$sql .= "WHERE DATE(scheduledate)=CURDATE() AND (HOUR(NOW())-1) <= starttime GROUP BY tableid";
$reservations = CommonUtils::fetchSqlAll($pdo, $sql);
@@ -484,4 +522,85 @@ class Roomtables {
$result = CommonUtils::fetchSqlAll($pdo, $sql, array(1,1));
return $result;
}
+
+ private static function createSingleQRCode($guesturl,$tablename,$tableid,$code,$addOnText,$guestqrsize,$guestqrfontsize) {
+ $arg = $guesturl . '/index.php?code=' . $code . "_" . $tableid;
+ $txt = '
';
+ $txt .= 'Tisch: ' . $tablename . '
';
+ if (!is_null($code) && ($code != '')) {
+ $txt .= '
';
+ } else {
+ $txt .= '
Tischcode wurde noch nicht zugewiesen ';
+ }
+ $txt .= '
' . $addOnText . ' ';
+ $txt .= '
';
+ return $txt;
+ }
+
+ private static function createQrCodeForTables($pdo,$guesturl,$addOnText,$guestqrsize,$guestqrfontsize) {
+ $maxCols = round(500.0/($guestqrsize + 20));
+ $allTables = self::getTablesForGuestsystem($pdo);
+ $txt = '';
+ $col = 0;
+ foreach($allTables as $aTable) {
+ $code = $aTable['code'];
+ $tableid = $aTable['id'];
+ $tablename = $aTable['name'];
+ if ($col == 0) {
+ $txt .= "";
+ }
+ $txt .= '' . self::createSingleQRCode($guesturl, $tablename, $tableid, $code, $addOnText, $guestqrsize, $guestqrfontsize);
+ $col++;
+ if ($col == $maxCols) {
+ $col = 0;
+ $txt .= " ";
+ }
+ }
+ $txt .= "
";
+ return $txt;
+ }
+
+ private static function tableqrcodes() {
+ header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
+ header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
+ header( "Cache-Control: no-cache, must-revalidate" );
+ header( "Content-Type: text/html; charset=utf8" );
+
+ $pdo = DbUtils::openDbAndReturnPdoStatic();
+ $guestUrl = CommonUtils::getConfigValue($pdo, 'guesturl', '');
+
+ if (CommonUtils::strEndsWith($guestUrl, "/")) {
+ $guestUrl = substr($guestUrl, 0, strlen($guestUrl) - 1);
+ }
+
+ if (CommonUtils::strEndsWith($guestUrl, "/index.php")) {
+ $guestUrl = substr($guestUrl, 0, strlen($guestUrl) - strlen("/index.php"));
+ }
+
+ $guestqrtext = CommonUtils::getConfigValue($pdo, 'guestqrtext', '');
+ $guestqrsize = CommonUtils::getConfigValue($pdo, 'guestqrsize', '');
+ if (($guestqrsize < 20) || ($guestqrsize > 500)) {
+ $guestqrsize = 150;
+ }
+ $guestqrfontsize = CommonUtils::getConfigValue($pdo, 'guestqrfontsize', '');
+ if (($guestqrfontsize < 5) || ($guestqrfontsize > 50)) {
+ $guestqrfontsize = 15;
+ }
+ if (is_null($guestUrl) || ($guestUrl == '')) {
+ echo "Gastbestell-URL noch nicht konfiguriert";
+ return;
+ }
+
+ $txt = "";
+ $txt .= "Tisch QR-Codes für die Gastbestellung ";
+ $txt .= ' ';
+ $txt .= ' ';
+ $txt .= "";
+ $txt .= "";
+ $txt .= "Tisch QR-Codes für die Gastbestellung ";
+
+ $txt .= self::createQrCodeForTables($pdo,$guestUrl,$guestqrtext,$guestqrsize,$guestqrfontsize);
+ $txt .= "";
+ echo $txt;
+ }
}
diff --git a/webapp/php/utilities/osqrcode.php b/webapp/php/utilities/osqrcode.php
new file mode 100644
index 0000000..f119af1
--- /dev/null
+++ b/webapp/php/utilities/osqrcode.php
@@ -0,0 +1,23 @@
+calcStartDate($startMonth, $startYear);
$endDate = $this->calcEndDate($endMonth, $endYear);
- $prodStat = $reports->sumSortedByProducts($pdo, $startDate, $endDate,null,null);
+ $prodStat = $reports->sumSortedByProducts($pdo, $startDate, $endDate,null,null,null);
} else {
- $prodStat = $reports->sumSortedByProducts($pdo, 0,0,$closidstart,$closidend);
+ $prodStat = $reports->sumSortedByProducts($pdo, 0,0,$closidstart,$closidend,null);
}
$this->setProdsTableHeader();
diff --git a/webapp/php/utilities/version.php b/webapp/php/utilities/version.php
index ff6f57d..787c82a 100644
--- a/webapp/php/utilities/version.php
+++ b/webapp/php/utilities/version.php
@@ -1287,6 +1287,26 @@ class Version {
return array(true);
}
+ public static function upd_1533_1600($pdo, $prefix, $dbname) {
+ try {
+ self::execSql($pdo, "ALTER TABLE %reservations% ADD starttimemin INT(3) NULL AFTER `starttime`");
+ self::execSql($pdo, "UPDATE %reservations% SET starttimemin='0'");
+ self::execSql($pdo, "ALTER TABLE %reservations% ADD durationmins INT(3) NULL AFTER `duration`");
+ self::execSql($pdo, "UPDATE %reservations% SET durationmins='0'");
+ self::insertOrUpdateConfigItem($pdo, 'guestqrtext', 'Gastbestellung');
+ self::insertOrUpdateConfigItem($pdo, 'guestqrfontsize', '15');
+ self::insertOrUpdateConfigItem($pdo, 'guestqrsize', '150');
+ self::insertOrUpdateConfigItem($pdo, 'reservationitem', "{Name} \n{Start-Stunde}:{Start-Minute}-{Ende-Stunde}:{Ende-Minute}\nDauer: {Dauer-Stunden}:{Dauer-Minuten}\n{Personen} Personen\n{Bemerkung}");
+ return array(true);
+ } catch (PDOException $e) {
+ return array(false,$e);
+ }
+ }
+
+ public static function upd_1600_1601($pdo, $prefix, $dbname) {
+ return array(true);
+ }
+
public static $updateOrder = array(
"1.3.0" => array("upd_1300_1301","1.3.1"),
"1.3.1" => array("upd_1301_1302","1.3.2"),
@@ -1367,7 +1387,9 @@ class Version {
"1.5.29" => array("upd_1529_1530","1.5.30"),
"1.5.30" => array("upd_1530_1531","1.5.31"),
"1.5.31" => array("upd_1531_1532","1.5.32"),
- "1.5.32" => array("upd_1532_1533","1.5.33")
+ "1.5.32" => array("upd_1532_1533","1.5.33"),
+ "1.5.33" => array("upd_1533_1600","1.6.0"),
+ "1.6.0" => array("upd_1600_1601","1.6.1")
);
public static function runUpdateProcess($pdo,$prefix, $dbname, $untilVersion,$checkValidVersion) {
diff --git a/webapp/pickups.html b/webapp/pickups.html
index a3a40d9..8e3eff2 100644
--- a/webapp/pickups.html
+++ b/webapp/pickups.html
@@ -5,7 +5,7 @@
-
+
@@ -13,7 +13,7 @@
-
+
diff --git a/webapp/preferences.html b/webapp/preferences.html
index 92b0701..9239af7 100644
--- a/webapp/preferences.html
+++ b/webapp/preferences.html
@@ -5,7 +5,7 @@
-
+
@@ -13,7 +13,7 @@
-
+
diff --git a/webapp/products.html b/webapp/products.html
index b6572fc..f9f363e 100644
--- a/webapp/products.html
+++ b/webapp/products.html
@@ -7,16 +7,16 @@
-
+
-
-
-
+
+
+
diff --git a/webapp/productsdesktop.php b/webapp/productsdesktop.php
index da2a712..c080146 100644
--- a/webapp/productsdesktop.php
+++ b/webapp/productsdesktop.php
@@ -4,7 +4,7 @@
-
+
@@ -15,7 +15,7 @@
-
+
-
+
diff --git a/webapp/reports.html b/webapp/reports.html
index 6cb0431..0410b6f 100644
--- a/webapp/reports.html
+++ b/webapp/reports.html
@@ -7,14 +7,14 @@
-
+
-
+
@@ -51,9 +51,9 @@ var REP_THIS_MONTH_TXT = ["Diese Übersicht umfasst alle Einnahmen dieses Monats
var REP_LAST_MONTH_TXT = ["Diese Übersicht umfasst Einnahmen des letzten Monats.",
"This overview shows all revenues of the last month.",
"Este parte muestra todo el cobro del mes pasado."];
-var REP_PROD_LAST30_TXT = ["Diese Übersicht zeigt die Einnahmen, die mit den in den letzten 30 Tagen verkauften Produkten erzielt wurden.",
- "This overview displays the revenue that could be achieved with all sold products in the last 30 days.",
- "Este parte muestra el cobro con el productos vendido en los últimos 30 días."];
+var REP_PROD_LAST30_TXT = ["Diese Übersicht zeigt die Einnahmen, die mit den in den letzten Tagen verkauften Produkten erzielt wurden.",
+ "This overview displays the revenue that could be achieved with all sold products in the last days.",
+ "Este parte muestra el cobro con el productos vendido en los últimos días."];
var REP_NO_DATA = ["Es liegen keine Daten vor.", "There is no data.", "No hay ningún datos."];
var REP_PRODREP = ["Produktstatistik","Product report","Estadistica de productos"];
var REP_TITLE = ["Statistik","Statistics","Estadisticas"];
@@ -76,6 +76,7 @@ var REP_RECORD_ACTION = [
["Tischwechsel Produktbuchung","Received moved products","Recibo productos de otra mesa"]
];
var REP_NO_ENTRIES = ["Keine Einträge","No entries","Ningún data"];
+var REP_PRODSLIDER_LABEL = ["Seit wievielen Tagen","Since how many days","Desce hace cuantos dias"];
var lang = 0;
var allorders = [];
@@ -193,6 +194,27 @@ function setLanguage(language) {
});
}
+ function getProdsSlider() {
+ var txt = '';
+ txt += '' + REP_PRODSLIDER_LABEL[lang] + ' : ';
+ txt += ' ';
+ txt += '
';
+ return txt;
+ }
+
+ function bindProdsSlider() {
+ $("#prodsslider").off("slidestop").on("slidestop", function (e) {
+ e.stopImmediatePropagation();
+ e.preventDefault();
+ requestNewProdStat();
+ });
+ }
+
+ function requestNewProdStat() {
+ var days = $("#prodsslider").val();
+ $("#content_prods_section .divaroundtable").html(' ');
+ doAjax("GET", "php/contenthandler.php?module=reports&command=getProds&days=" + days, null, updateProdsStat, "Fehler keine Daten für Produktverkäufe",true);
+ }
function fillUsersums(answer) {
if (answer.status == "OK") {
var htmlTable = createTableWithData(answer.msg,REP_USER[lang],"center",15,10,75);
@@ -230,10 +252,18 @@ function setLanguage(language) {
function fillProds(answer) {
if (answer.status == "OK") {
var htmlTable = createTableWithData(answer.msg,REP_PROD[lang],"left",30,10,60);
- $("#content_prods_section").html(htmlTable);
+ var prodsSlider = getProdsSlider();
+ $("#content_prods_section").html(prodsSlider + htmlTable);
+ $("#prodsliderarea").trigger("create");
+ bindProdsSlider();
+ }
+ }
+ function updateProdsStat(answer) {
+ if (answer.status == "OK") {
+ var htmlTable = createTableWithData(answer.msg,REP_PROD[lang],"left",30,10,60);
+ $("#content_prods_section .divaroundtable").html(htmlTable);
}
}
-
function fillRatings(answer) {
if (answer.status == "OK") {
var htmlPart = createRatingsPartCore(answer.msg,REP_DAY[lang],10,10,40,40);
@@ -459,10 +489,11 @@ function setLanguage(language) {
function createTableWithData(values,iterObjName,iterAlignment,width1,width2,width3) {
var maxValue = values.max;
- var content = REP_NO_DATA[lang];
+ var content = "" + REP_NO_DATA[lang] + "
";
if (maxValue != 0.0) {
- var content = "";
+ var content = "";
+ content += "
";
content += aTableHeader(iterObjName,REP_SUM[lang],"Graph",width1,width2,width3);
var contentValues = values.content;
@@ -475,7 +506,7 @@ function setLanguage(language) {
width1,width2,width3);
});
- content += "
";
+ content += "