OrderSprinter 1.1.13

This commit is contained in:
Geno 2020-11-19 22:55:20 +01:00
parent 6f9dcaf7ea
commit f2edfca41b
26 changed files with 462 additions and 174 deletions

Binary file not shown.

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -67,6 +67,8 @@ var BILL_UPDATE = ["Aktualisieren","Update","Actualizar"];
var BILL_PRINT = ["Drucken","Print","Imprimir"];
var BILL_STORNO = ["Storno","Cancel","Contrapartida"];
var BILL_CLOSED = ["abgeschlossen","closed","cerrado"];
var BILL_DO_HOST = ["Bewirtungsbeleg","Guest receipt","Tique de invitados"];
var BILL_UNDO_HOST = ["Rückgängig Bewirtungsbeleg","Undo guest receipt","No tique de invitados"];
var BILL_TITLE = ["Kassenbons","Receipts","Tiques"];
var BILL_YES = ["Ja","Yes","Si"];
var BILL_NO = ["Nein","No","No"];
@ -77,6 +79,9 @@ var BILL_NO_CANCEL_POSS = ["Der Stornovorgang ist fehlgeschlagen. Die wahrschein
"Contrapartida no fue posible. Probablemente el tique esta ya cerrado."];
var BILL_DATE = ["Datum","Date","Fecha"];
var BILL_STORNO_REASON = ["Stornogrund","Reason","Razón"];
var BILL_TOGGLE_HOST = ["Der ursprüngliche Bon wurde storniert und mit geänderter Bewirtungseigenschaft neu angelegt. Er befindet sich an erster Stelle in der Bonliste.",
"Der original receipt was discarded and recreated with the changed guest receipt property. The new receipt is on top of the list",
"El tique original esta descartado y iniciado de nuevo en la forma modificada"];;
var lang = 0;
@ -151,6 +156,14 @@ function cancelBill(jsonText) {
setTimeout(function(){location.reload()},1000);
}
function changeHostBill(jsonText) {
if (jsonText.status != "OK") {
alert("Fehler " + jsonText.code + ": " + jsonText.msg);
return;
}
alert(BILL_TOGGLE_HOST[lang]);
setTimeout(function(){location.reload()},1000);
}
function displayBillsWithContent (jsonContent) {
if (jsonContent.status != "OK") {
@ -233,6 +246,19 @@ function displayBillsWithContent (jsonContent) {
doAjaxCancelBill(billid,$("#stornocode").val(),$("#stornoreason").val());
});
});
$(".changehostbuttons").off("click").on("click", function (e) {
var billid = this.id.split("_")[1];
var isNowHost = this.id.split("_")[2];
$("#stornocode").val("");
$("#stornoreason").val("");
var data = {
billid: billid,
isNowHost: isNowHost
};
doAjax("POST","php/contenthandler.php?module=bill&command=changeBillHost",data,changeHostBill,"Bonänderung abgebrochen");
});
});
}
@ -262,10 +288,16 @@ function getBillWithId(id) {
var printbuttonid = 'print_' + id;
var cancelbuttonid = 'cancel_' + id;
var changehostbuttonid = 'changehost_' + id + "_" + entry.host;
var collapse_elem_id = 'collapse_' + id;
var printbutton = '<a href="#" data-role="button" id="' + printbuttonid + '" data-theme="f" class="printbuttons">' + BILL_PRINT[lang] + '</a>';
var cancelButton = '<a href="#" data-role="button" id="' + cancelbuttonid + '" data-theme="f" class="cancelbuttons">' + BILL_STORNO[lang] + '</a>';
var toggleHostTxt = BILL_DO_HOST[lang];
if (entry.host == 1) {
toggleHostTxt = BILL_UNDO_HOST[lang];
}
var changehostbutton = '<a href="#" data-role="button" id="' + changehostbuttonid + '" data-theme="f" class="changehostbuttons">' + toggleHostTxt + '</a>';
var bi = entry.billcontent.billoverallinfo;
var date_time = bi.billday + "." + bi.billmonth + "." + bi.billyear + " " + bi.billhour + ":" + bi.billmin;
@ -273,7 +305,7 @@ function getBillWithId(id) {
var txt = '<center>' + printbutton;
if (entry.isClosed == 0) {
// REM* bill is not closed - so can be printed AND cancelled
txt += cancelButton + '<br>' + content + '</center>';
txt += cancelButton + changehostbutton + '<br>' + content + '</center>';
} else {
// REM* bill is closed - only printing possible, no cancelling
txt += '<p><center>' + '<br>' + content + '</center>';

View File

@ -51,7 +51,7 @@
# !Extraname (ID:8) # 12,34 ; (45),Langname eines Produkts,(49),(50)
# - Die ID-Angabe ist optional (kann weggelassen werden)
# - Der Wert 12,34 ist der Aufpreis
# - Hinter dem Semikolo können Komma-getrennt Produte angegebenen werden, die
# - Hinter dem Semikolon können Komma-getrennt Produkte angegebenen werden, die
# dieses Extra haben dürfen. Angabe entweder ID des Produkts in Klammern oder
# der Langname eines Produkts. (Gibt es den Langnamen mehrfach, wird das Extra
# auch mehrfach zugewiesen.)

View File

@ -33,7 +33,7 @@
# !Extraname (ID:8) # 12,34 ; (45),Langname eines Produkts,(49),(50)
# - Die ID-Angabe ist optional (kann weggelassen werden)
# - Der Wert 12,34 ist der Aufpreis
# - Hinter dem Semikolo können Komma-getrennt Produte angegebenen werden, die
# - Hinter dem Semikolon können Komma-getrennt Produkte angegebenen werden, die
# dieses Extra haben dürfen. Angabe entweder ID des Produkts in Klammern oder
# der Langname eines Produkts. (Gibt es den Langnamen mehrfach, wird das Extra
# auch mehrfach zugewiesen.)

View File

@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,8 +7,8 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -679,7 +679,7 @@ $(document).ready(function() {
<tr id=updateline>
<td>&nbsp;</td>
<td align=center>
<button id="updatebtn">Update -> 1.1.12</button>
<button id="updatebtn">Update -> 1.1.13</button>
</td>
<td>&nbsp;</td>
</tr>

View File

@ -579,7 +579,7 @@ $stmt->execute();
$sql = "UPDATE %user% SET keeptypelevel=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1));
$stmt->execute(array(0));
$sql = "ALTER TABLE %user% MODIFY keeptypelevel INT(1) NOT NULL";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
@ -802,6 +802,36 @@ return false;
}
}
function updateUserTable1112_1113($prefix,$version) {
$pdo = $this->pdo;
try {
if ($version != "1.1.12") {
$ret = $this->updateUserTable1111_1112($prefix,$version);
if (!$ret) {
return false;
}
}
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %queue% ADD pricechanged INT(1) NULL AFTER anoption";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %queue% ADD togo INT(1) NULL AFTER pricechanged";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "UPDATE %queue% SET pricechanged=?,togo=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(0,0));
$this->updateVersion($pdo, '1.1.13');
return true;
} catch (PDOException $e) {
return false;
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
try {
@ -873,7 +903,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'billlanguage', $billlanguage)");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'currency', '$currency')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'receiptfontsize', '12')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.1.12')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.1.13')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'paymentconfig', '0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'remoteaccesscode', null)");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'decpoint', '$decpoint')");
@ -965,7 +995,7 @@ $pdo = $this->pdo;
$userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_manager`,`right_reservation`,`right_rating`,`language`,`prefertablemap`,`keeptypelevel`,`extrasapplybtnpos`,`active`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'1','1')";
$stmt = $pdo->prepare(DbUtils::substTableAlias($userInsertSql));
$stmt->execute(array($username,$md5adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_manager,$right_reservation,$right_rating,$lang,$prefertablemap,1));
$stmt->execute(array($username,$md5adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_manager,$right_reservation,$right_rating,$lang,$prefertablemap,0));
$newUserIdForHist = $pdo->lastInsertId();
@ -1246,7 +1276,7 @@ return;
$supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27","1.0.28","1.0.29",
"1.0.30","1.0.31","1.0.32","1.0.33","1.0.34","1.0.35","1.0.36","1.0.37","1.0.38","1.0.39",
"1.0.40","1.0.41","1.0.42","1.0.43",
"1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.1.8", "1.1.9","1.1.10","1.1.11"
"1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.1.8", "1.1.9","1.1.10","1.1.11","1.1.12"
);
if (!in_array($version, $supportedVersions)) {
@ -1254,7 +1284,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1111_1112($_POST['prefix'], $version);
$ret = $admin->updateUserTable1112_1113($_POST['prefix'], $version);
if(session_id() == '') {
session_start();

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -631,47 +631,15 @@ function generateListItem(theme,icon,id,content,classname) {
return li;
}
function addAllToUnten(jsonContent,tablename) {
$("#payall").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var entryListForReceipt = [];
$("#oben li a.info-go").each(function() {
var id_in_jsonText = $(this).attr('id');
var entry = {
idx : id_in_jsonText,
prodid: jsonContent[id_in_jsonText]["prodid"],
queueid: jsonContent[id_in_jsonText]["id"],
longname: jsonContent[id_in_jsonText]["longname"],
price: jsonContent[id_in_jsonText]["price"],
tax: jsonContent[id_in_jsonText]["tax"],
extras: jsonContent[id_in_jsonText]["extras"],
pricelevelname: jsonContent[id_in_jsonText]["pricelevelname"]
};
entryListForReceipt[entryListForReceipt.length] = entry;
});
$.each(entryListForReceipt, function (i, entry) {
addToUnten(entry.prodid,entry.longname,entry.price,entry.tax,entry.pricelevelname,entry.extras,entry.idx);
$("#oben li .info-go").each(function() {
$(this).closest('li').remove().promise();
});
refreshList("#oben");
});
});
}
function createHashOfPayableItem(aProd) {
var longname = aProd["longname"];
if (aProd["pricelevelname"] != "A") {
longname += " (" + aProd["pricelevelname"] + ")";
}
longname += " - " + (parseFloat(aProd["price"]).toFixed(2).replace(".",decpoint));
if (aProd["togo"] == 1) {
longname = "To-Go: " + longname;
}
var extratxt = createExtraParagraph(aProd["extras"]);
return toHtml(longname) + extratxt;
}
@ -721,12 +689,12 @@ function clearUntenAndReceipt() {
//
// entry:
// [0]: prodid queueid longname price pricelevelname
// REM* [2]: name, [3]: price, [4]: tax, [5] extras, [6]: pricelevel
// REM* [2]: name, [3]: price, [4]: tax, [5]: togo, [6] extras, [7]: pricelevel
function addEntryOrIncreaseCount(arrayToFill,entry) {
var index=0;
var found = false;
var combinedIdPricelevelPriceExtras = entry.prodid + "-" + entry.extras.join("_") + entry.price + "-" + entry.pricelevelname + "#" + entry.tax;
var combinedIdPricelevelPriceExtras = entry.prodid + "-" + entry.extras.join("_") + entry.price + "-" + entry.pricelevelname + "#" + entry.tax + "_" + entry.togo;
for (index=0;index<arrayToFill.length;index++) {
var anEntry = arrayToFill[index];
// REM* entry = prodid,queueid,longname,price,pricelevelname
@ -854,6 +822,7 @@ function createAllEntriesInReceipt() {
longname: item["longname"],
price: item["price"],
tax: item["tax"],
togo: item["togo"],
extras: item["extras"],
pricelevelname: item["pricelevelname"]
};
@ -1098,7 +1067,7 @@ function bindHostButton() {
createAllEntriesInReceipt();
} else {
if (lang == 0) {
alert("Bewirtungsbeleg steht nur f<EFBFBD>r deutsche Kassenbons zur Verf<72>gung.");
alert("Bewirtungsbeleg steht nur für deutsche Kassenbons zur Verfügung.");
} else if (lang == 1) {
alert("Bewirtungsbeleg is only possible for German receipts.");
} else if (lang == 2) {

View File

@ -540,6 +540,8 @@ class Admin {
$stmt->execute(array($view,$userid));
}
echo json_encode(array("status" => "OK"));
} else {
echo json_encode(array("status" => "Error","msg" => "Benutzer nicht eingeloggt"));
}
}
@ -1106,19 +1108,19 @@ class Admin {
$right_rating = $_SESSION['right_rating'];
if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.1.12"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.1.12"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.1.12"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.1.12"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.1.13"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.1.13"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.1.13"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.1.13"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html"); };
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.1.12"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.1.12"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.1.12"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.1.12"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.1.12"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.1.12"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.1.12");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.1.12");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.1.13"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.1.13"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.1.13"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.1.13"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.1.13"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.1.13"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.1.13");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.1.13");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1127,7 +1129,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
// CAUTION: change version also in config.txt!!!
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.1.12",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.1.13",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1199,7 +1201,7 @@ class Admin {
$userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_reservation`,`right_rating`,`right_changeprice`,`right_manager`,`language`,`receiptprinter`,`prefertablemap`,`keeptypelevel`,`extrasapplybtnpos`,`active`) VALUES (";
$userInsertSql .= " NULL, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($userInsertSql));
$stmt->execute(array($username,$password_hash,$isAdmin,$rWaiter,$rKitchen,$rBar,$rSupply,$rPayDesk,$rStat,$rBill,$rProducts,$rReservation,$rRating,$rChangeprice,$rManager,$lang,1,1,1,1,1));
$stmt->execute(array($username,$password_hash,$isAdmin,$rWaiter,$rKitchen,$rBar,$rSupply,$rPayDesk,$rStat,$rBill,$rProducts,$rReservation,$rRating,$rChangeprice,$rManager,$lang,1,1,0,1,1));
$lastId = $pdo->lastInsertId();

View File

@ -107,11 +107,22 @@ class Bill {
return;
}
if ($command == 'changeBillHost') {
if ($this->hasCurrentUserPaydeskRights()) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$this->changeBillHost($pdo,$_POST['billid'],$_POST['isNowHost']);
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_PAYDESK_NOT_AUTHOTRIZED, "msg" => ERROR_PAYDESK_NOT_AUTHOTRIZED_MSG));
}
return;
}
if ($this->hasCurrentUserBillRights()) {
if ($command == 'getLastBillsWithContent') {
$this->getLastBillsWithContent($_GET['day'],$_GET['month'],$_GET['year']);
} else if ($command == 'cancelBill') {
$this->cancelBill($_POST['billid'],$_POST['stornocode'],$_POST['reason']);
$pdo = DbUtils::openDbAndReturnPdoStatic();
$this->cancelBill($pdo,$_POST['billid'],$_POST['stornocode'],$_POST['reason'],true,true,true);
}
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_AUTHOTRIZED, "msg" => ERROR_BILL_NOT_AUTHOTRIZED_MSG));
@ -284,15 +295,19 @@ class Bill {
}
// now get all products of this bill
$sql = "select productname,price,%pricelevel%.name as pricelevelname,count(%queue%.productname) as count from %queue%,%pricelevel%,%billproducts% where %billproducts%.billid=? AND %billproducts%.queueid=%queue%.id AND %queue%.pricelevel = %pricelevel%.id group by productname,price,pricelevelname";
$sql = "select productname,price,%pricelevel%.name as pricelevelname,togo,count(%queue%.productname) as count from %queue%,%pricelevel%,%billproducts% where %billproducts%.billid=? AND %billproducts%.queueid=%queue%.id AND %queue%.pricelevel = %pricelevel%.id group by productname,price,pricelevelname,togo";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
$result = $stmt->fetchAll();
$prodarray = array();
foreach($result as $zeile) {
$productname = $zeile['productname'];
if ($zeile["togo"] == 1) {
$productname = "To-Go: " . $productname;
}
$prodarray[] = array("count" => $zeile['count'],
"productname" => $zeile['productname'],
"productname" => $productname,
"pricelevel" => $zeile['pricelevelname'],
"price" => $sign . $zeile['price']
);
@ -410,7 +425,7 @@ class Bill {
$commonUtils = new CommonUtils();
$sql = "SELECT id,billdate,brutto,tableid,closingid,status FROM %bill% WHERE tableid >= '0' AND $whenClause ORDER BY billdate DESC ";
$sql = "SELECT id,billdate,brutto,tableid,closingid,status,host FROM %bill% WHERE tableid >= '0' AND $whenClause ORDER BY id DESC,billdate DESC ";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($startDate,$endDate));
$result = $stmt->fetchAll();
@ -437,7 +452,8 @@ class Bill {
"brutto" => $zeile['brutto'],
"tablename" => $commonUtils->getTableNameFromId($pdo,$zeile['tableid']),
"billcontent" => $this->getBillWithId($pdo,$theId,$l,0),
"isClosed" => $isClosed
"isClosed" => $isClosed,
"host" => $zeile['host']
);
$resultarray[] = $arr;
@ -479,11 +495,99 @@ class Bill {
}
}
private function changeBillHost($pdo,$billid,$isNowHost) {
$sql = "SELECT host,closingid FROM %bill% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($billid));
$row = $stmt->fetchObject();
if ($row->host != $isNowHost) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_WO_HOST, "msg" => ERROR_BILL_NOT_WO_HOST_MSG));
return;
}
if (!is_null($row->closingid)) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_ALREADY_CLOSED, "msg" => ERROR_BILL_ALREADY_CLOSED_MSG));
return;
}
$pdo->beginTransaction();
$sql = "SELECT queueid FROM %billproducts% WHERE billid=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($billid));
$idsOfBill = $stmt->fetchAll();
$ids = array();
foreach($idsOfBill as $anId) {
$ids[] = $anId["queueid"];
}
$sql = "SELECT brutto,netto,tableid,paymentid,tax FROM %bill% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($billid));
$row = $stmt->fetchObject();
$ok = $this->cancelBill($pdo, $billid, "", "OrderSprinter-Bewirtungseigenschaft", false, false, false);
if (!$ok) {
$pdo->rollBack();
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_CANCEL_IMOSSIBLE, "msg" => ERROR_BILL_CANCEL_IMOSSIBLE_MSG));
return;
}
$this->recreateBill($pdo, $ids, $row->brutto, $row->netto, $row->tableid, $row->paymentid, $row->tax, 1-$isNowHost);
$pdo->commit();
echo json_encode(array("status" => "OK", "code" => OK));
}
function recreateBill($pdo,$ids_array,$brutto,$netto,$tableid,$paymentId,$tax,$host) {
$userid = $this->getUserId();
// current time
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
$billid = (-1);
// find highest bill id
$sql = "SELECT id from %bill% ORDER BY id DESC";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$numberOfIds = $stmt->rowCount();
$row =$stmt->fetchObject();
$billid = intval($row->id)+1;
$commonUtils = new CommonUtils();
$commonUtils->setLastBillIdInWorkTable($pdo, $billid);
if (is_null($tableid)) {
$tableid = 0;
}
// now calculate the signature for the bill entry
$signature = $commonUtils->calcSignatureForBill($pdo,$currentTime, $brutto, $netto, '0.00', $userid);
$billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`,`host`,`signature`) VALUES (?,?,?,?,?,?,?,NULL,NULL,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billInsertSql));
$stmt->execute(array($billid,$currentTime,$brutto,$netto,$tableid,$paymentId,$userid,$host,$signature));
// now declare them all to be paid:
for ($i=0;$i<count($ids_array);$i++) {
$queueid = $ids_array[$i];
$updateSql = "UPDATE %queue% SET paidtime=?, billid=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($updateSql));
$stmt->execute(array($currentTime,$billid,$queueid));
$billProdsSql = "INSERT INTO `%billproducts%` (`queueid`,`billid`) VALUES ( ?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billProdsSql));
$stmt->execute(array($queueid,$billid));
}
}
/*
* Cancel a bill - set all queue items to not paid and drop the bill entry
*/
private function cancelBill($billid,$stornocode,$reason) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
private function cancelBill($pdo,$billid,$stornocode,$reason,$doOwnTransaction,$doEcho,$checkStornoCode) {
// current time
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
@ -496,25 +600,35 @@ class Bill {
$numberOfVals = $row->countid;
if ($numberOfVals != 1) {
// stornocode not fixed
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_STORNO_CODE, "msg" => ERROR_BILL_NOT_STORNO_CODE_MSG));
return;
if ($doEcho) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_STORNO_CODE, "msg" => ERROR_BILL_NOT_STORNO_CODE_MSG));
}
return false;
}
$stornocodeInDb = $row->setting;
if ($stornocode != $stornocodeInDb) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_WRONG_STORNO_CODE, "msg" => ERROR_BILL_WRONG_STORNO_CODE_MSG));
return;
if ($checkStornoCode) {
if ($stornocode != $stornocodeInDb) {
if ($doEcho) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_WRONG_STORNO_CODE, "msg" => ERROR_BILL_WRONG_STORNO_CODE_MSG));
}
return false;
}
}
if (!is_numeric($billid)) {
// this may be an attack...
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_WRONG_NUMERIC_VALUE, "msg" => ERROR_BILL_WRONG_NUMERIC_VALUE_MSG));
return;
if ($doEcho) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_WRONG_NUMERIC_VALUE, "msg" => ERROR_BILL_WRONG_NUMERIC_VALUE_MSG));
}
return false;
}
// Do transactional cancel
$pdo->beginTransaction();
// Do transactional cancel
if ($doOwnTransaction) {
$pdo->beginTransaction();
}
// is the bill already closed? In this case no cancel is allowed!
$sql = "SELECT brutto,netto,tax,tableid,closingid,status,paymentid FROM %bill% WHERE id=?";
@ -536,31 +650,42 @@ class Bill {
if (!is_null($closingId) || ($status == 's') || ($status == 'x')) {
// no cancel possible anymore!
$pdo->rollBack();
if (($status == 's') || ($status == 'x')) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_ALREADY_CANCELLED, "msg" => ERROR_BILL_ALREADY_CANCELLED_MSG));
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_ALREADY_CLOSED, "msg" => ERROR_BILL_ALREADY_CLOSED_MSG));
if ($doOwnTransaction) {
$pdo->rollBack();
}
return;
if ($doEcho) {
if (($status == 's') || ($status == 'x')) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_ALREADY_CANCELLED, "msg" => ERROR_BILL_ALREADY_CANCELLED_MSG));
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_ALREADY_CLOSED, "msg" => ERROR_BILL_ALREADY_CLOSED_MSG));
}
}
return false;
}
// is bill correct with signature?
$commonUtils = new CommonUtils();
$correct = $commonUtils->verifyBill($pdo, $billid);
if (!$correct) {
$pdo->rollBack();
echo json_encode(array("status" => "ERROR", "code" => ERROR_INCONSISTENT_DB, "msg" => ERROR_INCONSISTENT_DB_MSG));
return;
if ($doOwnTransaction) {
$pdo->rollBack();
}
if ($doEcho) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_INCONSISTENT_DB, "msg" => ERROR_INCONSISTENT_DB_MSG));
}
return false;
}
// Test if it is allowed to insert new bill as storno bill or if manipulation has happened
$nextbillid = $this->testForNewBillIdAndUpdateWorkTable($pdo);
if ($nextbillid < 0) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_INCONSISTENT_DB, "msg" => ERROR_INCONSISTENT_DB_MSG));
$pdo->rollBack();
return;
if ($doEcho) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_INCONSISTENT_DB, "msg" => ERROR_INCONSISTENT_DB_MSG));
}
if ($doOwnTransaction) {
$pdo->rollBack();
}
return false;
}
// 0. find the queueitems that are related to that bill
@ -610,11 +735,15 @@ class Bill {
$stmt->execute(array($aQueueid,$refIdOfStornoEntry));
}
$pdo->commit();
if ($doOwnTransaction) {
$pdo->commit();
}
// end of transactional cancel
echo json_encode(array("status" => "OK", "code" => OK));
return;
if ($doEcho) {
echo json_encode(array("status" => "OK", "code" => OK));
}
return true;
}
private function autoBackupPdfSummary($remoteaccesscode) {
@ -780,6 +909,7 @@ class Bill {
}
$sql .= " AND %bill%.userid = %user%.id ";
$sql .= "ORDER BY billdate";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
if ($onlyClosingId == null) {

View File

@ -80,6 +80,11 @@ define ( 'PARSE_ERROR_MSG', 'Fehler beim Parsen');
define ( 'NUMBERFORMAT_ERROR', 27);
define ( 'NUMBERFORMAT_ERROR_MSG', 'Falsches Zahlenformat');
define ( 'ERROR_BILL_NOT_WO_HOST', '28');
define ( 'ERROR_BILL_NOT_WO_HOST_MSG', 'Bewirtungseigenschaft falsch');
define ( 'ERROR_BILL_CANCEL_IMOSSIBLE', '7');
define ( 'ERROR_BILL_CANCEL_IMOSSIBLE_MSG', 'Stornierung unmöglich');
define ( 'FOOD_PRINT_TYPE', 1);
define ( 'DRINK_PRINT_TYPE', 2);
define ( 'PAY_PRINT_TYPE', 3);

View File

@ -811,10 +811,17 @@ class QueueContent {
} else {
$price = $theChangedPrice;
}
// now check if the product is a togo article that might have been booked on a table
$togo = $aProd["togo"];
$tax = $normaltax;
if (is_null($theTableid)) {
$tax = $togotax;
}
if ($togo == 1) {
$tax = $togotax;
}
if (!is_null($row->tax)) {
$tax = $row->tax;
}
@ -845,14 +852,14 @@ class QueueContent {
$ordertime = date('Y-m-d H:i:s');
$insertSql = "INSERT INTO `%queue%` (
`id` , `tablenr`,`productid`,`pricelevel`,`price`,`tax`,`productname`,`ordertime`,`orderuser`,`anoption`,`readytime`,`delivertime`,`paidtime`,`billid`,`toremove`,`cooking`,`workprinted`)
`id` , `tablenr`,`productid`,`pricelevel`,`price`,`tax`,`productname`,`ordertime`,`orderuser`,`anoption`,`pricechanged`,`togo`,`readytime`,`delivertime`,`paidtime`,`billid`,`toremove`,`cooking`,`workprinted`)
VALUES (
NULL , ?,?,?,?,?,?,?,?,?, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL,NULL,'0',NULL,'0');";
NULL , ?,?,?,?,?,?,?,?,?,?,?, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL,NULL,'0',NULL,'0');";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($insertSql));
$stmt->execute(array($theTableid,$productid,$currentPriceLevelId,$price,$tax,$productname,$ordertime,$_SESSION['userid'],$theOption));
$stmt = $pdo->prepare(DbUtils::substTableAlias($insertSql));
$stmt->execute(array($theTableid,$productid,$currentPriceLevelId,$price,$tax,$productname,$ordertime,$_SESSION['userid'],$theOption,($theChangedPrice == "NO" ? 0 : 1),$togo));
$queueid = $pdo->lastInsertId();
if (!is_null($extras) && ($extras != "")) {
for ($j=0;$j<count($extras);$j++) {
$anExtra = $extras[$j];
@ -1007,7 +1014,7 @@ class QueueContent {
}
$prods = array();
$sql = "SELECT readytime,paidtime,cooking,productname,anoption,productname FROM %queue% WHERE id=?";
$sql = "SELECT readytime,paidtime,cooking,productname,anoption,productname,togo,pricechanged,price FROM %queue% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
foreach ($resultids as $anId) {
$stmt->execute(array($anId));
@ -1032,6 +1039,9 @@ class QueueContent {
"id" =>$anId,
"longname" => $row->productname,
"option" => $row->anoption,
"pricechanged" => $row->pricechanged,
"togo" => $row->togo,
"price" => $row->price,
"extras" => $extras,
"isready" => $isReady,
"isPaid" => $isPaid,
@ -1098,7 +1108,7 @@ class QueueContent {
function getJsonProductsOfTableToPay($tableid) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT %queue%.id as id,longname,%queue%.price as price,%queue%.tax,%pricelevel%.name as pricelevelname,%products%.id as prodid
$sql = "SELECT %queue%.id as id,longname,%queue%.price as price,%queue%.tax,%pricelevel%.name as pricelevelname,%products%.id as prodid,%queue%.togo as togo
FROM %queue%
INNER JOIN %products% ON %queue%.productid = %products%.id
INNER JOIN %pricelevel% ON %queue%.pricelevel = %pricelevel%.id ";
@ -1118,12 +1128,13 @@ class QueueContent {
$theTax = $zeile['tax'];
$thePriceLevelName = $zeile['pricelevelname'];
$longName = $zeile['longname'];
$togo = $zeile["togo"];
$queueid = $zeile['id'];
$extras = $this->getExtrasOfQueueItem($pdo,$queueid);
$prodId = $zeile['prodid'];
$prodsToPay[] = array("id" => $queueid, "prodid" => $prodId, "longname" => $longName, "pricelevelname" => $thePriceLevelName, "price" => $thePrice, "tax" => $theTax, "extras" => $extras);
$prodsToPay[] = array("id" => $queueid, "prodid" => $prodId, "longname" => $longName, "pricelevelname" => $thePriceLevelName, "price" => $thePrice, "tax" => $theTax, "togo" => $togo, "extras" => $extras);
}
echo json_encode(array("status" => "OK", "msg" => $prodsToPay));
}

View File

@ -495,6 +495,8 @@ class Basedb {
`ordertime` DATETIME NULL ,
`orderuser` INT(10) NOT NULL ,
`anoption` VARCHAR( 150 ) NULL ,
`pricechanged` INT(1) NULL ,
`togo` INT(1) NULL ,
`readytime` DATETIME NOT NULL,
`delivertime` DATETIME NULL,
`paidtime` DATETIME NULL,

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -92,7 +92,7 @@ function createReceiptFooterFromDbTaxes(lang, companyInfo,sum,taxes,decPoint) {
return footer;
}
function generateOneProdLine(count,productname,price,pricelevelname,decPoint) {
function generateOneProdLine(count,productname,price,pricelevelname,decPoint,togo) {
var priceStyle = 'style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';
var noStyle = 'style="border: solid black 0px;padding: 3px;text-align:center;vertical-align:bottom;"';
@ -101,6 +101,10 @@ function generateOneProdLine(count,productname,price,pricelevelname,decPoint) {
if (pricelevelname != "A") {
productname += " (" + pricelevelname + ")";
}
if (togo == 1) {
productname = "To-Go: " + productname;
}
var totalPrice = count * price;
var formattedTotal = totalPrice.toFixed(2).replace(".",decPoint);
@ -134,10 +138,10 @@ function generateProdPart(decPoint,entryListForReceipt) {
var prodEntry = anEntry[1];
var productname = prodEntry.longname;
var price = prodEntry.price;
var tax = prodEntry.tax;
var togo = prodEntry.togo;
var pricelevelname = prodEntry.pricelevelname;
tablecontent += generateOneProdLine(count,productname,price,pricelevelname,decPoint);
tablecontent += generateOneProdLine(count,productname,price,pricelevelname,decPoint,togo);
}
return tablecontent;
}

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.13">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -54,6 +54,8 @@ var W_FOOD_FOR = ["Speisen für","Food for","Comidas para"];
var W_DRINKS_FOR = ["Getränke für","Beverage for","Bebidas para"];
var W_ACT_NEW_ORD_EL = ["Aktion auswählen","Select action","Que acción?"];
var W_ACT_CHANGE = ["Ändern","Modify","Modificar"];
var W_ACT_CHANGE_ALL = ["Alle Ändern","Modify all","Modificar todo"];
var W_ACT_CHANGE_ONE = ["Einen Artikel ändern","Modify one item","Modificar un artículo"];
var W_APPLY = ["Anwenden","Apply","Aplicar"];
var W_CANCEL = ["Abbrechen","Cancel","Cancelar"];
var W_STILL_UNSENT_ORDERS = ["Es sind noch ungesendete Orders vorhanden!","There are unsent orders in the list","Hay elementos in la liste que no han enviados"];
@ -81,6 +83,9 @@ var W_UNDELIVERED = ["nicht serviert (+ unbezahlt)","not served (and unpaid)","n
var W_MOVE_PRODS = ["Produkte verschieben","Move products","Productos a otra mesa"];
var W_NO_PRODS_SELECTED = ["Es wurden keine Produkte ausgewählt!","You have not chosen any products!","No ha seleccionado ningún producto!"];
var CHANGE_ALL = 0;
var CHANGE_ONE = 1
function Grouping(set,hashFct) {
// initialization during construction of class
this.set = set;
@ -208,7 +213,8 @@ var groupedNewOrders = {
prodids: [],
extras: [],
origidxs: [],
changedPrices: []
changedPrices: [],
togos: []
};
var levelOneType = 0; // first selectedtype under 0
@ -313,7 +319,8 @@ function setLanguage(language) {
$("#actdiscount").html(discounttxt);
}
$("#actionneworderconfirm").html(W_ACT_CHANGE[lang]);
$("#actionneworderconfirm_all").html(W_ACT_CHANGE_ALL[lang]);
$("#actionneworderconfirm_one").html(W_ACT_CHANGE_ONE[lang]);
$("#actionnewordercancel").html(W_CANCEL[lang]);
$("#select-comment").off("click").on("click", function (e) {
@ -429,8 +436,7 @@ function generateSearchResults() {
e.preventDefault();
var prodid = this.id.split("_")[1];
selectedProdCount = getSearchProdCount(prodid);
$("#searchField").val("");
generateSearchResults();
clearSearchAndGoToHigherTypeIfExtrasOpen();
levelOneType = 0;
handleClickOnProd(prodid);
});
@ -487,8 +493,7 @@ function initializeMainMenu(moduleEntries,menuid,user,version,forward) {
};
$(".modulebutton").off("click").on("click", function (e) {
var view = $(this).attr("href");
doJsonAjax("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",
{ view: view}, null, "Problem Benutzerdatenpflege");
doJsonAjaxAsync("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",{ view: view}, null, "Problem Benutzerdatenpflege",false);
});
}
@ -562,7 +567,7 @@ function hideMenuProd() {
});
}
function addProductToQueueNoGuiUpdate(productid,option,extras,changedPrice) {
function addProductToQueueNoGuiUpdate(productid,option,extras,changedPrice,togo) {
var prodprop = getProdProperties(productid);
var prodname = prodprop.name;
var prodprice = prodprop.price;
@ -572,7 +577,8 @@ function addProductToQueueNoGuiUpdate(productid,option,extras,changedPrice) {
extras: extras,
prodid: productid,
price: prodprice,
changedPrice : changedPrice
changedPrice : changedPrice,
togo: togo
};
for (var i=0;i<selectedProdCount;i++) {
@ -581,7 +587,7 @@ function addProductToQueueNoGuiUpdate(productid,option,extras,changedPrice) {
selectedProdCount = 1;
}
function addProductToQueue(productid,extras,changedPrice) {
function addProductToQueue(productid,extras,changedPrice,togo) {
var option=$('#optionfield').val();
$('#optionfield').val("");
@ -599,7 +605,8 @@ function addProductToQueue(productid,extras,changedPrice) {
prodid: productid,
price: prodprice,
extras: extras,
changedPrice: changedPrice
changedPrice: changedPrice,
togo: togo
};
for (var i=0;i<selectedProdCount;i++) {
@ -636,6 +643,7 @@ function updateNewOrdersList() {
optiontext = "<p>" + toHtml(optiontext) + "</p>";
}
var changedPrice = groupedNewOrders.changedPrices[i];
var togo = groupedNewOrders.togos[i];
var extrastxt = "";
var extras = groupedNewOrders.extras[i];
if ((extras != null ) && (extras != "")) {
@ -644,10 +652,18 @@ function updateNewOrdersList() {
if (changedPrice != "NO") {
changedPrice = changedPrice.replace(".",decpoint);
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + prodid + '" class="neworder_el ' + getProdSizeClass() + '">' + lname + optiontext + extrastxt + ' (' + changedPrice + ')' + '</a></li>';
if (togo != 0) {
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + prodid + '" class="neworder_el ' + getProdSizeClass() + '">' + lname + optiontext + extrastxt + ' (' + changedPrice + ' - To-Go)' + '</a></li>';
} else {
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + prodid + '" class="neworder_el ' + getProdSizeClass() + '">' + lname + optiontext + extrastxt + ' (' + changedPrice + ')' + '</a></li>';
}
}
else {
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + prodid + '" class="neworder_el ' + getProdSizeClass() + '">' + lname + optiontext + extrastxt + '</a></li>';
if (togo != 0) {
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + prodid + '" class="neworder_el ' + getProdSizeClass() + '">' + lname + optiontext + extrastxt + ' - To-Go</a></li>';
} else {
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + prodid + '" class="neworder_el ' + getProdSizeClass() + '">' + lname + optiontext + extrastxt + '</a></li>';
}
}
}
$("#neworders").html(li);
@ -679,13 +695,15 @@ function binding_neworderelem() {
extras: groupedNewOrders.extras[index],
prodid: groupedNewOrders.prodids[index],
origidxs: groupedNewOrders.origidxs[index],
changedPrices: groupedNewOrders.changedPrices[index]
changedPrices: groupedNewOrders.changedPrices[index],
togos: groupedNewOrders.togos[index]
};
$("#actiononneworderel").data("entry",selectedEntry);
$("#actiononneworderel").data("newcount",selectedEntry.count);
$("#actiononneworderel").data("groupedListIndex",index);
$("#act-optionfield").val(selectedEntry.option);
$("#togocheckbox").prop('checked',selectedEntry.togos == 1 ? true : false);
actionSelOnNewOrderElem();
});
}
@ -807,7 +825,7 @@ $(document).on("pageinit", "#info-page", function () {
function intervalFetchRoomTableInfoFromServer(seconds) {
var fetchTimer = setInterval(function() {
if (tableListActive) {
doJsonAjaxAsync("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,updateTableViewIfListStillOpen);
doJsonAjaxAsync("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,updateTableViewIfListStillOpen,true);
}
}, seconds * 1000);
}
@ -956,6 +974,9 @@ $(document).on("pagebeforeshow", "#tables-page", function () {
hideMenuTable();
checkForLogIn();
$("#searchField").val("");
generateSearchResults();
$("#tableselbackbtn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
@ -1443,6 +1464,8 @@ function displayTypesProds(ref,extras) {
$(this).off("click").on("click", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
$("#searchField").val("");
generateSearchResults();
var theId = this.id;
var idParts = theId.split("_");
if (idParts[0] == 't') {
@ -1493,31 +1516,42 @@ function displayTypesProds(ref,extras) {
});
}
function getHigherType() {
var prodtypes = $("#typprodpage").data("types_prods");
var thetypes = prodtypes.types;
var higherType = 0;
if (!extrasMenuOpen) {
for (var i=0;i<thetypes.length;i++) {
var aType = thetypes[i];
if (aType.id == idOfHigherType) {
higherType = aType.ref;
break;
}
}
} else {
higherType = idOfHigherType;
}
return higherType;
}
function clearSearchAndGoToHigherTypeIfExtrasOpen() {
$("#searchField").val("");
generateSearchResults();
var higherType = getHigherType();
displayTypesProds(higherType,null);
}
function bindHigherButtons() {
$(".typehigher").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var prodtypes = $("#typprodpage").data("types_prods");
var thetypes = prodtypes.types;
var higherType = 0;
if (!extrasMenuOpen) {
for (var i=0;i<thetypes.length;i++) {
var aType = thetypes[i];
if (aType.id == idOfHigherType) {
higherType = aType.ref;
break;
}
}
} else {
higherType = idOfHigherType;
}
displayTypesProds(higherType,null);
clearSearchAndGoToHigherTypeIfExtrasOpen();
});
$(".typetop").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
$("#searchField").val("");
generateSearchResults();
displayTypesProds(0,null);
});
}
@ -1560,9 +1594,10 @@ function addProductToNewOrdersList(prodid,extras) {
var roominfo = $("#typprodpage").data("table-info");
var tableid = roominfo[1];
addProductToQueue(prodid,extras,"NO");
addProductToQueue(prodid,extras,"NO",0);
var audioFile = getProdAudio(parseInt(prodid));
var vol = parseInt($("#typprodpage").data("ordervolume")) / 10.0;
if (audioFile != "") {
var audioUrl = "customer/" + audioFile;
if (audioFile.match(/mp3$/)) {
@ -1573,10 +1608,14 @@ function addProductToNewOrdersList(prodid,extras) {
$("#audiofile").html('<source src="' + audioUrl + '" type="audio/wav" />');
}
var vol = parseInt($("#typprodpage").data("ordervolume")) / 10.0;
document.getElementById('audiofile').load();
document.getElementById('audiofile').volume=vol;
document.getElementById('audiofile').play();
} else {
if (vol > 0.5) {
beep();
}
}
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid=" + tableid;
@ -1588,8 +1627,13 @@ function addProductToNewOrdersList(prodid,extras) {
refreshList("#typeproducts-list");
}
function beep() {
var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9ILU5mBjFANmRwlVJ3/6jYDAmxaiDG3/6xjQQCCKkRb/6kg/wW+kSJ5//rLobkLSiKmqP/0ikJuDaSaSf/6JiLYLEYnW/+kXg1WRVJL/9EmQ1YZIsv/6Qzwy5qk7/+tEU0nkls3/zIUMPKNX/6yZLf+kFgAfgGyLFAUwY//uQZAUABcd5UiNPVXAAAApAAAAAE0VZQKw9ISAAACgAAAAAVQIygIElVrFkBS+Jhi+EAuu+lKAkYUEIsmEAEoMeDmCETMvfSHTGkF5RWH7kz/ESHWPAq/kcCRhqBtMdokPdM7vil7RG98A2sc7zO6ZvTdM7pmOUAZTnJW+NXxqmd41dqJ6mLTXxrPpnV8avaIf5SvL7pndPvPpndJR9Kuu8fePvuiuhorgWjp7Mf/PRjxcFCPDkW31srioCExivv9lcwKEaHsf/7ow2Fl1T/9RkXgEhYElAoCLFtMArxwivDJJ+bR1HTKJdlEoTELCIqgEwVGSQ+hIm0NbK8WXcTEI0UPoa2NbG4y2K00JEWbZavJXkYaqo9CRHS55FcZTjKEk3NKoCYUnSQ0rWxrZbFKbKIhOKPZe1cJKzZSaQrIyULHDZmV5K4xySsDRKWOruanGtjLJXFEmwaIbDLX0hIPBUQPVFVkQkDoUNfSoDgQGKPekoxeGzA4DUvnn4bxzcZrtJyipKfPNy5w+9lnXwgqsiyHNeSVpemw4bWb9psYeq//uQZBoABQt4yMVxYAIAAAkQoAAAHvYpL5m6AAgAACXDAAAAD59jblTirQe9upFsmZbpMudy7Lz1X1DYsxOOSWpfPqNX2WqktK0DMvuGwlbNj44TleLPQ+Gsfb+GOWOKJoIrWb3cIMeeON6lz2umTqMXV8Mj30yWPpjoSa9ujK8SyeJP5y5mOW1D6hvLepeveEAEDo0mgCRClOEgANv3B9a6fikgUSu/DmAMATrGx7nng5p5iimPNZsfQLYB2sDLIkzRKZOHGAaUyDcpFBSLG9MCQALgAIgQs2YunOszLSAyQYPVC2YdGGeHD2dTdJk1pAHGAWDjnkcLKFymS3RQZTInzySoBwMG0QueC3gMsCEYxUqlrcxK6k1LQQcsmyYeQPdC2YfuGPASCBkcVMQQqpVJshui1tkXQJQV0OXGAZMXSOEEBRirXbVRQW7ugq7IM7rPWSZyDlM3IuNEkxzCOJ0ny2ThNkyRai1b6ev//3dzNGzNb//4uAvHT5sURcZCFcuKLhOFs8mLAAEAt4UWAAIABAAAAAB4qbHo0tIjVkUU//uQZAwABfSFz3ZqQAAAAAngwAAAE1HjMp2qAAAAACZDgAAAD5UkTE1UgZEUExqYynN1qZvqIOREEFmBcJQkwdxiFtw0qEOkGYfRDifBui9MQg4QAHAqWtAWHoCxu1Yf4VfWLPIM2mHDFsbQEVGwyqQoQcwnfHeIkNt9YnkiaS1oizycqJrx4KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=");
snd.play();
}
function fetchTypeProdsFromServer() {
doJsonAjaxAsync("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,attachAndDisplayFirstRefTypes);
doJsonAjaxAsync("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,attachAndDisplayFirstRefTypes,true);
}
@ -1621,6 +1665,15 @@ function createTxtAssignedProd(p) {
optiontext = "&nbsp;(" + toHtml(p.option) + ")";
}
var prodname = p.longname;
if (p.togo == 1) {
prodname = "To-Go: " + prodname;
}
if (p.pricechanged == 1) {
prodname += " - " + p.price.replace(".", decpoint);
}
var status = "";
if (p.isready == '1') {
status += " &#9758";
@ -1632,7 +1685,7 @@ function createTxtAssignedProd(p) {
status += " &#9745";
}
return toHtml(p.longname) + optiontext + status + "<br>" + createExtraParagraph(p.extras);
return toHtml(prodname) + optiontext + status + "<br>" + createExtraParagraph(p.extras);
}
@ -1739,7 +1792,7 @@ function bindingOfAssignedProds(assignedProdsGrouping) {
}
function fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered) {
doJsonAjaxAsync("GET", urlProdOfTableNotDelivered, null, fillAssignedProdList);
doJsonAjaxAsync("GET", urlProdOfTableNotDelivered, null, fillAssignedProdList,true);
}
function fillOrderVolume(volume) {
@ -2123,7 +2176,7 @@ function bindSendNewOrdersButton() {
url : url,
dataType : "json",
data : data,
async : false,
async : true,
success : function(jsonContent) {
if (functionToCallIfSuccess != null) {
functionToCallIfSuccess(jsonContent);
@ -2140,13 +2193,13 @@ function bindSendNewOrdersButton() {
});
}
function doJsonAjaxAsync(getOrPost, url, data, functionToCallIfSuccess) {
function doJsonAjaxAsync(getOrPost, url, data, functionToCallIfSuccess,doAsync) {
$.ajax({
type : getOrPost,
url : url,
dataType : "json",
data : data,
async : true,
async : doAsync,
success : function(jsonContent) {
if (functionToCallIfSuccess != null) {
functionToCallIfSuccess(jsonContent);
@ -2192,7 +2245,18 @@ function bindSendNewOrdersButton() {
$("#act-select-comment").html(predefinedComments);
$.mobile.changePage("#actiononneworderel");
if (count == 1) {
$("#actionneworderconfirm_all").html(W_ACT_CHANGE[lang]);
$("#actionneworderconfirm_one").hide();
} else {
$("#actionneworderconfirm_all").html(W_ACT_CHANGE_ALL[lang]);
$("#actionneworderconfirm_one").html(W_ACT_CHANGE_ONE[lang]);
$("#actionneworderconfirm_one").show();
}
$('#act-select-comment').selectmenu('refresh');
$("#togocheckbox").checkboxradio('refresh');
// start binding
$("#actminusone").off("click").on(
@ -2224,14 +2288,21 @@ function bindSendNewOrdersButton() {
actionSelOnNewOrderElem($("#actiononneworderel").data(
"entry"), $("#actiononneworderel").data(
"groupedListIndex"));
actionNewOrderConfirm();
actionNewOrderConfirm(CHANGE_ONE);
});
$("#actionneworderconfirm").off("click").on("click", function(e) {
$("#actionneworderconfirm_all").off("click").on("click", function(e) {
e.stopImmediatePropagation();
e.preventDefault();
$("#actiononneworderel").dialog("close");
actionNewOrderConfirm();
actionNewOrderConfirm(CHANGE_ALL);
});
$("#actionneworderconfirm_one").off("click").on("click", function(e) {
e.stopImmediatePropagation();
e.preventDefault();
$("#actiononneworderel").dialog("close");
actionNewOrderConfirm(CHANGE_ONE);
});
$("#actionnewordercancel").off("click").on("click", function(e) {
@ -2258,7 +2329,8 @@ function bindSendNewOrdersButton() {
});
}
function actionNewOrderConfirm() {
function actionNewOrderConfirm(howmany) {
// which entry was modified?
var groupEntry = $("#actiononneworderel").data("entry");
@ -2266,7 +2338,7 @@ function bindSendNewOrdersButton() {
var option = $("#act-optionfield").val();
if (rightchangeprice == 1) {
changedPrice = $("#act-changepricefield").val().trim();
var changedPrice = $("#act-changepricefield").val().trim();
changedPrice = changedPrice.replace(",", ".");
if (changedPrice == "") {
changedPrice = "NO";
@ -2282,11 +2354,27 @@ function bindSendNewOrdersButton() {
changedPrice = "NO";
}
var allIdx = groupEntry.origidxs;
for (i = 0; i < allIdx.length; i++) {
var idx = allIdx[i];
neworders[idx].option = option;
neworders[idx].changedPrice = changedPrice;
var togo = $("#togocheckbox").prop('checked');
if (togo) {
togo = 1;
} else {
togo = 0;
}
if (howmany == CHANGE_ONE) {
var allIdx = groupEntry.origidxs;
neworders[allIdx[0]].option = option;
neworders[allIdx[0]].changedPrice = changedPrice;
neworders[allIdx[0]].togo = togo;
} else {
var allIdx = groupEntry.origidxs;
for (i = 0; i < allIdx.length; i++) {
var idx = allIdx[i];
neworders[idx].option = option;
neworders[idx].changedPrice = changedPrice;
neworders[idx].togo = togo;
}
}
$("#act-optionfield").val("");
@ -2311,11 +2399,11 @@ function bindSendNewOrdersButton() {
var sampleIdx = allIdx[0]; // take for copy
var prodid = neworders[sampleIdx].prodid;
var changedPrice = neworders[sampleIdx].changedPrice;
var togo = neworders[sampleIdx].togo;
var option = neworders[sampleIdx].option;
var extras = neworders[sampleIdx].extras;
for (i = 0; i < diff; i++) {
addProductToQueueNoGuiUpdate(prodid, option, extras,
changedPrice);
addProductToQueueNoGuiUpdate(prodid, option, extras,changedPrice,togo);
}
}
@ -2356,6 +2444,7 @@ function bindSendNewOrdersButton() {
var prodids = [];
var origidxs = [];
var changedPrices = [];
var togos = [];
var grouped = {
count : counts,
@ -2366,7 +2455,8 @@ function bindSendNewOrdersButton() {
extras : extras,
prodids : prodids,
origidxs : origidxs,
changedPrices : changedPrices
changedPrices : changedPrices,
togos : togos
};
var i = 0;
@ -2377,6 +2467,7 @@ function bindSendNewOrdersButton() {
var option = anEntry.option;
var prodid = anEntry.prodid;
var changedPrice = anEntry.changedPrice;
var togo = anEntry.togo;
var extra = anEntry.extras;
var extrastxt = "";
@ -2389,8 +2480,10 @@ function bindSendNewOrdersButton() {
var joinedNeedle = name + "-" + option + "-" + extrastxt;
if (changedPrice != "NO") {
joinedNeedle = name + "-" + option + "-" + extrastxt
+ changedPrice;
joinedNeedle = name + "-" + option + "-" + extrastxt + changedPrice;
}
if (togo == 1) {
joinedNeedle += " - To-Go";
}
var index = grouped.joinedvals.indexOf(joinedNeedle);
if (index >= 0) {
@ -2412,6 +2505,7 @@ function bindSendNewOrdersButton() {
grouped.extras[gLength] = extrastxt;
grouped.prodids[gLength] = prodid;
grouped.changedPrices[gLength] = changedPrice;
grouped.togos[gLength] = togo;
grouped.origidxs[gLength] = [ i ];
}
}
@ -2548,6 +2642,14 @@ function bindSendNewOrdersButton() {
</div>
<a href="#" data-role="button" data-theme="c" data-rel="back" id="actminusone">-1</a>
<a href="#" data-role="button" data-theme="c" data-rel="back" id="actplusone">+1</a>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<input type="checkbox" name="togocheckbox" id="togocheckbox" class="custom" data-theme="c" />
<label for="togocheckbox">To-Go</label>
</fieldset>
</div>
<a href="#" data-role="button" data-theme="d" data-rel="back" id="actdel"><span id=actdeltxt>x</span></a>
<div id="actremark"></div>
@ -2557,7 +2659,8 @@ function bindSendNewOrdersButton() {
<div id=actchangepricesection></div>
</p>
<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="actionneworderconfirm">Ja</a>
<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="actionneworderconfirm_all">Ja</a>
<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="actionneworderconfirm_one">Ja</a>
<a href="#" data-role="button" data-theme="b" data-rel="back" id="actionnewordercancel">Nein</a>
</div>
</div>