OrderSprinter 1.3.1

This commit is contained in:
Geno 2020-11-19 23:02:12 +01:00
parent 40828e9b5b
commit 127558265b
27 changed files with 393 additions and 230 deletions

View File

@ -85,7 +85,7 @@ class Installer {
}
Database::dropTables($pdo);
Database::createEmptyTables($pdo, $prefix);
Database::setVersion($pdo,$prefix,"1.3.0");
Database::setVersion($pdo,$prefix,"1.3.1");
Database::setAccessPassword($pdo,$prefix,$adminpass);
Database::setRefreshRate($pdo,$prefix,"5"); // default: 5 times per hour
return array("status" => "OK","msg" => "Installation successful");

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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -74,8 +74,12 @@ var CUS_PRINTBILL = ["Drucken","Print","Imprimir"];
var CUS_DECLARE_ALL_PAY = ["Alle als bezahlt deklarieren","Declare all as paid","Declarar todo pagado"];
var CUS_PRINT_ALL = ["Alle Bons drucken","Print all receipts","Imprimir todos los tiquetes"];
var CUS_FILTER_OPEN_BILLS = ["Filter Gäste mit offenen Rechnungen","Filter on customers with ooen bills","Filtrar clientes con tiquets non-pagados"];
var CUS_LOGBTN = ["Rechnungslog (csv)","Log of payments (csv)","Protocolo de los pagos (csv)"];
var CUS_SEND_EMAIL = ["Email an alle Gruppenmitglieder senden","Send email to all group members","Enviar email a todos los miembros"];
var CUS_EMAIL_WARNING = ["Emails lassen sich nur versenden, wenn die Email-Konfiguration vorgenommen wurde","Emails can only be sent if the email configuration was done","Sólo puede enviar emails si la configuración es completada"];
var CUS_STORNO_QUEST_TITLE = ["Storno?","Cancel?","Contrapartida?"];
var CUS_STORNO_QUEST_TEXT = ["Bon als vom Gast unbezahlt deklarieren?","Cancel the payment of the guest?","Contrapartida del tique por el cliente?"];
var CUS_YES = ["Ja","Yes","Si"];
var l = 0;
@ -95,6 +99,7 @@ function setLanguage(language) {
$("#newguestheader").html(CUS_NEW_CUS_HEADER[l]);
$("#customerdatetxt").html(CUS_DATE[l]);
$("#customeropenbillstxt").html(CUS_FILTER_OPEN_BILLS[l]);
$("#customerlog").html(CUS_LOGBTN[l]);
}
$(document).on("pageinit", "#info-page", function () {
@ -159,12 +164,12 @@ $(document).on("pageinit", "#info-page", function () {
<div class="ui-field-contain">
<label for="newcustomerphone" id="newcusphonelabel">Tel.:</label>
<input id='newcustomerphone' type="text" value="" data-mini="true" placeholder="E-Mail" class="whiteinput" />
<input id='newcustomerphone' type="text" value="" data-mini="true" placeholder="01234 - 56789" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label for="newcustomermobil" id="newcusmobillabel">Handy:</label>
<input id='newcustomermobil' type="text" value="" data-mini="true" placeholder="E-Mail" class="whiteinput" />
<input id='newcustomermobil' type="text" value="" data-mini="true" placeholder="0170 - 1234567" class="whiteinput" />
</div>
<div class="ui-field-contain">
@ -174,7 +179,7 @@ $(document).on("pageinit", "#info-page", function () {
<div class="ui-field-contain">
<label for="newcustomerwww">Homepage:</label>
<input id='newcustomerwww' type="text" value="" data-mini="true" placeholder="E-Mail" class="whiteinput" />
<input id='newcustomerwww' type="text" value="" data-mini="true" placeholder="www.the-homepage-of-the-guest.de" class="whiteinput" />
</div>
<div data-role="fieldcontain" id="datepickerareacheckin">
@ -202,6 +207,10 @@ $(document).on("pageinit", "#info-page", function () {
</div>
<div id="customersearchresult"></div>
<div id="logarea">
<button type="submit" data-theme="f" class="" data-icon="check" id="customerlog">Rechnungsprotokoll</button>
</div>
</div>
<div id="groupsarea" style="display:none;">
@ -253,6 +262,23 @@ $(document).on("pageinit", "#info-page", function () {
</div>
</div>
<!-- Dialog page -->
<div data-role="dialog" id="cancelsure" data-title="Entfernen?">
<div data-role="content">
<h3 class="sure-1">?</h3>
<p class="sure-2">?</p>
<form>
<label for="stornoreason"><span id="stornoreasontxt">Stornogrund:</span></label>
<input type="text" id="stornoreason" value="" data-mini="true /">
<label for="stornocode">Stornocode: </label>
<input type="password" id="stornocode" value="" data-mini="true">
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back"><span id="stornoyes">Ja</span></a>
<a href="#" data-role="button" data-theme="c" id="nocancelbtn"><span id="stornono">Nein</span></a>
</form>
</div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -9,8 +9,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.3.0">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.1">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -203,7 +203,7 @@ function handleResultOfInstallCheck(is_installed) {
if (is_installed == "Yes") {
useInstallation();
} else {
setTimeout(function(){document.location.href = "install.html?v=1.3.0"},500);
setTimeout(function(){document.location.href = "install.html?v=1.3.1"},500);
}
}

View File

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

View File

@ -1780,6 +1780,34 @@ return false;
}
}
function updateUserTable1300_1301($prefix, $version, $dbname) {
$pdo = $this->pdo;
try {
if ($version != "1.3.0") {
$ret = $this->updateUserTable1222_1300($prefix, $version, $dbname);
if (!$ret) {
echo "Version update v1.2.22 to 1.3.0 not successful.";
return false;
}
}
DbUtils::overrulePrefix($prefix);
$this->basedb->createCustomerLogTable($pdo);
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('cancelguestcode',''));
$this->updateVersion($pdo, '1.3.1');
return true;
} catch (PDOException $e) {
echo "Error in v1.3.0 to 1.3.1: $e";
return false;
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
@ -1857,6 +1885,7 @@ $this->basedb->createGroupsTable($pdo);
$this->basedb->createGroupCustomerTable($pdo);
$this->basedb->createVacationsTable($pdo);
$this->basedb->createBillTable($pdo);
$this->basedb->createCustomerLogTable($pdo);
$this->basedb->createQueueTable($pdo);
$this->basedb->createBillProductsTable($pdo);
$this->basedb->createHistTables($pdo);
@ -1905,7 +1934,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.3.0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.1')");
$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')");
@ -2286,7 +2315,7 @@ $zones[] = $timezone_identifiers[$i];
}
echo json_encode($zones);
} else if ($command == 'update') {
$installerVersion = "1.3.0";
$installerVersion = "1.3.1";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -2317,7 +2346,7 @@ $supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27"
"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","1.1.13","1.1.14","1.1.15","1.1.16","1.1.17",
"1.1.18","1.1.19","1.1.20","1.1.21","1.1.22","1.1.23","1.1.24","1.1.25","1.1.26","1.1.27","1.1.28","1.1.29","1.1.30",
"1.2.0","1.2.1","1.2.2", "1.2.3", "1.2.4","1.2.5","1.2.6","1.2.7","1.2.8","1.2.9","1.2.10","1.2.11","1.2.12","1.2.13","1.2.14","1.2.15","1.2.16","1.2.17",
"1.2.18","1.2.19","1.2.20","1.2.21","1.2.22"
"1.2.18","1.2.19","1.2.20","1.2.21","1.2.22","1.3.0"
);
if (!in_array($version, $supportedVersions)) {
@ -2325,7 +2354,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1222_1300($_POST['prefix'], $version, $_POST['db']);
$ret = $admin->updateUserTable1300_1301($_POST['prefix'], $version, $_POST['db']);
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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -102,6 +102,7 @@ var MAN_XLSX_EXP_RECEIPTS = ["... Excel","... Excel","... Excel"];
var MAN_CSV_EXP_ALL = ["CSV-Export komplett","CSV export all","Grabar todo en CSV"];
var MAN_PRINT_ALL = ["Drucken Komplettbericht","Print all","Imprimir todo"];
var MAN_PRINT_RECEIPT = ["Drucken Zusammenfassung auf Bon","Print summary on receipt","Imprimir resumen en tique"];
var MAN_CSV_EXP_GUEST = ["CSV-Export Gastbezahlprotokoll","CSV Export Guest payments log","CSV Export Pagos del cliente"];
var MAN_OF = [" vom "," of "," de "];
var MAN_PERIOD = ["Zeitraum: ","Period: ","Período: "];
var MAN_1ST_CLOSING = ["Erste Erstellung einer Tageslosung","First creation of a closing","Primer acción de cerrar"];
@ -275,6 +276,7 @@ var MAN_TAX_USE = ["Wenn kein Steuersatz beim Produkt angegeben ist: MwSt/Tax/IV
"If no tax is specified for a product, these tax settings are used. <b>For Austria other tax settings are relevant</b>, see above!",
"Si no un producto no tiene un IVA asignado, se usa estas IVAs"];
var MAN_CANCEL_UNPAID_CODE = ["Stornierungscode unbez. Best.", "Cancel code unpaid items","Codigo para cancelor productos impagados"];
var MAN_CANCEL_GUEST_CODE = ["Stornierungscode Bezahlung (Modul Gast)","Cancel code for payment (module guest)","Codigo para cancelar pagado por cliente"];
var MAN_ROOM_PRINTER_NO = ["Kategorieeinstellung","Category setting","Configuración/categoria"];
var MAN_ROOM_PRINTER_1 = ["Drucker 1","Printer 1","Imprimadora 1"];
@ -371,6 +373,7 @@ var generalValuesSettings = [
["reservationnote",MAN_RES_NOTE[lang],"i",0],
["remoteaccesscode",MAN_REMOTE_ACCESS[lang],"i",0,""],
["cancelunpaidcode",MAN_CANCEL_UNPAID_CODE[lang],"i",0,""],
["cancelguestcode",MAN_CANCEL_GUEST_CODE[lang],"i",0,""],
// REM SMTP settings
["smtphost",MAN_SMTPHOST[lang],"i",0,""],
["smtpauth",MAN_SMTPAUTH[lang],"s",5],
@ -635,6 +638,7 @@ function insertGeneralConfigItems(configResult) {
$("#webimpressum").val(values.webimpressum);
$("#cancelunpaidcode").val(values.cancelunpaidcode);
$("#cancelguestcode").val(values.cancelguestcode);
$("#hsinfile").val(values.hsinfile);
$("#hsoutfile").val(values.hsoutfile);
@ -1045,6 +1049,13 @@ function binding() {
window.location.href = "php/contenthandler.php?module=closing&command=exportCsv&closingid=" + closingid;
});
$(".csvExportGuestButton").off("click").on("click", function (e) {
var button_id = this.id;
var pos_underscore = button_id.indexOf("_");
var closingid = button_id.substr(pos_underscore+1,button_id.length-1);
window.location.href = "php/contenthandler.php?module=closing&command=exportGuestCsv&closingid=" + closingid;
});
$(".csvEmailAllButton").off("click").on("click", function (e) {
var button_id = this.id;
var pos_underscore = button_id.indexOf("_");
@ -2079,6 +2090,8 @@ function createClosingPart (aText,id,totalsum,cashsum,usersums,taxessums,cashops
closingPart += '<button type="submit" data-theme="f" class="printsummary" data-icon="check" id="printsummary_' + id + '">' + MAN_PRINT_RECEIPT[lang] + '</button>';
closingPart += '<button type="submit" data-theme="f" class="csvExportGuestButton" data-icon="check" id="csvguestexport_' + id + '">' + MAN_CSV_EXP_GUEST[lang] + '</button>';
closingPart += '</p>';
closingPart += '</div>';
@ -2500,6 +2513,10 @@ $(document).on("pageinit", "#admin-page", function () {
<label for="cancelunpaidcode">Stornocode (unbez. Bestellungen):</label>
<input type="password" value="" data-mini="true" id="cancelunpaidcode" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="cancelguestcode">Stornocode (Modul Gast):</label>
<input type="password" value="" data-mini="true" id="cancelguestcode" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="printpass">Printcode:</label>
<input type="password" value="" data-mini="true" id="printpass" class="genConfigEl"/>

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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -777,6 +777,7 @@ class Admin {
$version = CommonUtils::getConfigValue($pdo,"version",null);
$payprinttype = CommonUtils::getConfigValue($pdo,"payprinttype",null);
$cancelunpaidcode = CommonUtils::getConfigValue($pdo,"cancelunpaidcode",null);
$cancelguestcode = CommonUtils::getConfigValue($pdo,"cancelguestcode",null);
$tax = CommonUtils::getConfigValue($pdo,"tax",null);
$togotax = CommonUtils::getConfigValue($pdo,"togotax",null);
$taxaustrianormal = CommonUtils::getConfigValue($pdo,"taxaustrianormal",null);
@ -863,7 +864,7 @@ class Admin {
"rightchangeprice" => $right_changeprice, "bigfontworkreceipt" => $bigfontworkreceipt, "prominentsearch" => $prominentsearch,"groupworkitems" => $groupworkitems,
"sday" => $now["mday"],"smonth" => $now["mon"], "syear" => $now["year"], "shour" => $now["hours"], "smin" => $now["minutes"],
"smtphost" => $smtphost,"smtpauth" => $smtpauth,"smtpuser" => $smtpuser,"smtppass" => $smtppass,"smtpsecure" => $smtpsecure,"smtpport" => $smtpport,
"webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3,
"webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "cancelguestcode" => $cancelguestcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3,
"austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "oneprodworkreceipts" => $oneprodworkreceipts,
"digiprintwork" => $digiprintwork, "memorylimit" => $memorylimit, "hs3refresh" => $hs3refresh,
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "addreceipttoprinter" => $addreceipttoprinter,
@ -960,7 +961,7 @@ class Admin {
$view = "preferences.html";
}
echo json_encode($view . "?v=1.3.0");
echo json_encode($view . "?v=1.3.1");
}
}
@ -1167,25 +1168,25 @@ 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.3.0"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.1"); };
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.0"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.1"); };
}
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.0"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.0"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.0"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.1"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.1"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.1"); };
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.0"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.1"); };
}
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.0"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.0"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.0"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.0"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.0"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.0"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.0"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.0");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.0");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.1"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.1"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.1"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.1"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.1"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.1"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.1"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.1");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.1");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1194,7 +1195,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
// CAUTION: change version also in config.txt!!!
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.0",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.1",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1469,6 +1470,7 @@ class Admin {
"remoteaccesscode" => array("dbcol" => "remoteaccesscode","checknum" => 0),
"webimpressum" => array("dbcol" => "webimpressum","checknum" => 0),
"cancelunpaidcode" => array("dbcol" => "cancelunpaidcode","checknum" => 0),
"cancelguestcode" => array("dbcol" => "cancelguestcode","checknum" => 0),
"printandqueuejobs" => array("dbcol" => "printandqueuejobs","checknum" => 0),
"cashenabled" => array("dbcol" => "cashenabled","checknum" => 0),
"beepcooked" => array("dbcol" => "beepcooked","checknum" => 0),
@ -1932,13 +1934,13 @@ class Admin {
private function getAllTablesToBackupRestore() {
return array("closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config",
"user","reservations","customers","groups","groupcustomer","vacations","bill","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"extras","extrasprods","queueextras");
}
private function getAllWithLogsTablesToBackupRestore() {
return array("log","closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config",
"user","reservations","customers","groups","groupcustomer","vacations","bill","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"extras","extrasprods","queueextras");
}

View File

@ -4,6 +4,7 @@ require_once ('dbutils.php');
require_once ('commonutils.php');
require_once ('globals.php');
require_once ('admin.php');
require_once ('customers.php');
require_once ('utilities/Emailer.php');
class Closing {
@ -34,6 +35,8 @@ $this->createClosing($_POST['remark']);
$this->getClosings($_GET['month'], $_GET['year']);
} else if ($command == 'exportCsv') {
$this->exportCsv($_GET['closingid']);
} else if ($command == 'exportGuestCsv') {
$this->exportGuestCsv($_GET['closingid']);
} else if ($command == 'emailCsv') {
$this->emailCsv($_GET['closingid'],$_GET['emailaddress'],$_GET['topic']);
} else if ($command == 'getClosing') {
@ -324,6 +327,14 @@ $pdo = DbUtils::openDbAndReturnPdoStatic();
$this->retrieveClosingFromDb($pdo,$closingid, true, false);
}
private function exportGuestCsv($closingid) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$prevClosingDate = self::getDateOfPreviousClosing($pdo,$closingid);
$sql = "SELECT closingdate FROM %closing% WHERE id=?";
$curClosingDateRow = CommonUtils::getRowSqlObject($pdo, $sql, array($closingid));
$curClosingDate = $curClosingDateRow->closingdate;
Customers::exportLog($pdo, $prevClosingDate, $curClosingDate);
}
private function emailCsvCore($pdo,$closingid,$toEmail,$topic,$startdate,$enddate,$billsum,$billcount) {
$msg = $this->retrieveClosingFromDb($pdo,$closingid, false, true);

View File

@ -29,9 +29,14 @@ class Customers {
"printbill" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"payallbills" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"printallbills" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"emailGroup" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers"))
"emailGroup" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"exportLog" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"getPaymentsForGuest" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers"))
);
public static $CANCEL = 0;
public static $PAY = 1;
private static function checkRights($command) {
if(session_id() == '') {
session_start();
@ -114,17 +119,21 @@ class Customers {
} else if ($command == 'getBills') {
echo json_encode($this->getBills($pdo,$_GET['cusid']));
} else if ($command == 'pay') {
echo json_encode($this->pay($pdo,$_POST['id']));
echo json_encode($this->pay($pdo,$_POST['id'],$_POST['paymentid']));
} else if ($command == 'unpay') {
echo json_encode($this->unpay($pdo,$_POST['id']));
echo json_encode($this->unpay($pdo,$_POST['id'],$_POST["code"],$_POST["remark"]));
} else if ($command == 'printbill') {
echo json_encode($this->printBill($pdo,$_POST['id']));
} else if ($command == 'payallbills') {
echo json_encode($this->payallbills($pdo,$_POST['id']));
echo json_encode($this->payallbills($pdo,$_POST['id'],$_POST['paymentid']));
} else if ($command == 'printallbills') {
echo json_encode($this->printallbills($pdo,$_POST['id']));
} else if ($command == 'emailGroup') {
echo json_encode($this->emailGroup($pdo,$_POST['groupid'],$_POST["subject"],$_POST["text"]));
} else if ($command == 'getPaymentsForGuest') {
echo json_encode($this->getPaymentsForGuest($pdo));
} else if ($command == 'exportLog') {
self::exportLog($pdo);
} else {
echo "Command not supported.";
}
@ -172,7 +181,7 @@ class Customers {
$cusid = $pdo->lastInsertId();
self::addVacationsCore($pdo,$cusid,$checkin,$checkout,$room,null);
$pdo->commit();;
$pdo->commit();
return array("status" => "OK","code" => $code, "value" => $number);
} catch (Exception $e) {
$pdo->rollBack();
@ -267,14 +276,18 @@ class Customers {
}
}
private static function payOrUnpay($pdo,$id,$value) {
private static function payOrUnpay($pdo,$id,$value,$doTransaction,$remark=null) {
try {
$pdo->beginTransaction();
if ($doTransaction) {
$pdo->beginTransaction();
}
$sql = "SELECT count(id) as countid FROM %bill% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($id));
if ($row->countid != 1) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => "Bill entry not found");
if ($doTransaction) {
$pdo->rollBack();
}
return array("status" => "ERROR","msg" => "Bill with id=$id not found");
} else {
$sql = "SELECT intguestid FROM %bill% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($id));
@ -282,20 +295,43 @@ class Customers {
$sql = "UPDATE %bill% SET intguestpaid=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($value,$id));
$pdo->commit();
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
if(session_id() == '') {
session_start();
}
$userid = $_SESSION['userid'];
$sql = "INSERT INTO %customerlog% (date,action,customerid,userid,billid,remark) VALUES(?,?,?,?,?,?)";
$action = (is_null($value) ? self::$CANCEL : self::$PAY);
CommonUtils::execSql($pdo, $sql, array($currentTime,$action,$cusid,$userid,$id,$remark));
if ($doTransaction) {
$pdo->commit();
}
return array("status" => "OK","cusid" => $cusid);
}
} catch (Exception $ex) {
$pdo->rollBack();
if ($doTransaction) {
$pdo->rollBack();
}
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private function pay($pdo,$id) {
return (self::payOrUnpay($pdo, $id, 1));
private function pay($pdo,$id,$paymentid) {
$paymentname = self::getPaymentName($pdo,$paymentid);
return (self::payOrUnpay($pdo, $id, 1,true,$paymentname));
}
private function unpay($pdo,$id) {
return (self::payOrUnpay($pdo, $id, null));
private function unpay($pdo,$id,$code,$remark) {
$stornocode = CommonUtils::getConfigValue($pdo, 'cancelguestcode', null);
if (is_null($stornocode)) {
return array("status" => "ERROR","msg" => "Es wurde noch kein Stornocode in der Verwaltung festgelegt");
}
if ($stornocode != $code) {
return array("status" => "ERROR","msg" => "Falscher Stornocode");
}
return (self::payOrUnpay($pdo, $id, null,true,$remark));
}
private function printBill($pdo,$billid) {
@ -321,11 +357,19 @@ class Customers {
return array("status" => "OK");
}
private function payallbills($pdo,$cusid) {
private function payallbills($pdo,$cusid,$paymentid) {
try {
$pdo->beginTransaction();
$sql = "UPDATE %bill% SET intguestpaid=? WHERE intguestid=?";
CommonUtils::execSql($pdo, $sql, array(1,$cusid));
$paymentname = self::getPaymentName($pdo,$paymentid);
$sql = "SELECT id FROM %bill% WHERE intguestpaid is null AND intguestid=?";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($cusid));
foreach($result as $aBill) {
$ok = self::payOrUnpay($pdo, $aBill["id"], 1,false,$paymentname);
if ($ok["status"] != "OK") {
$pdo->rollBack();
return $ok;
}
}
$pdo->commit();
return array("status" => "OK","cusid" => $cusid);
} catch (Exception $ex) {
@ -557,4 +601,85 @@ class Customers {
return array("status" => "ERROR","msg" => 'Not all emails could be sent');
}
}
public static function exportLog($pdo,$startDate = null, $endDate = null) {
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=Gastbezahlungen.csv");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Expires: 0");
echo("Datum; Gast-ID; Gastname; Bon-ID; Aktion; Benutzer-ID; Benutzername; Stornobemerkung oder Zahlungsweg\n");
$sql = "SELECT %customerlog%.date as date,CASE WHEN action=0 THEN 'Bezahlung storniert' WHEN action=1 THEN 'bezahlt' ELSE 'undefiniert' END as action,";
$sql .= " %customerlog%.billid as billid,%customerlog%.remark as remark, userid, username, customerid, %user%.username as username, %customers%.name as customername ";
$sql .= " FROM %customerlog%,%user%,%customers% ";
$sql .= " WHERE (userid=%user%.id AND customerid=%customers%.id) ";
$where = '';
if (is_null($startDate) && (!is_null($endDate))) {
$where = " AND (date <= '$endDate') ";
} else if (!is_null($startDate) && (!is_null($endDate))) {
$where = " AND (date <= '$endDate') AND (date >= '$startDate') ";
}
$sql .= $where;
$result = CommonUtils::fetchSqlAll($pdo, $sql, null);
foreach($result as $aLog) {
echo $aLog["date"] . ";";
echo $aLog["customerid"] . ";";
echo self::quoteForCsv($aLog["customername"]) . ";";
echo $aLog["billid"] . ";";
echo $aLog["action"] . ";";
echo $aLog["userid"] . ";";
echo self::quoteForCsv($aLog["username"]) . ";";
echo self::quoteForCsv($aLog["remark"]) . ";";
echo "\r\n";
}
}
public static function quoteForCsv($txt) {
$txt = str_replace("\"","\"\"",$txt);
return '"' . $txt . '"';
}
private function getPaymentsForGuest($pdo) {
if(session_id() == '') {
session_start();
}
$where = " WHERE (id <> 7) AND (id <> 8)";
$lang = $_SESSION['language'];
$sql = "SELECT id,name FROM %payment% $where";
if ($lang == 1) {
$sql = "SELECT id,name_en as name FROM %payment% $where";
} else if ($lang == 2) {
$sql = "SELECT id,name_esp as name FROM %payment% $where";
}
$result = CommonUtils::fetchSqlAll($pdo, $sql, null);
return array("status" => "OK","msg" => $result);
}
private static function getPaymentName ($pdo,$paymentid) {
if(session_id() == '') {
session_start();
}
$lang = $_SESSION['language'];
$sql = "SELECT id,name FROM %payment% WHERE id=?";
if ($lang == 1) {
$sql = "SELECT id,name_en as name FROM %payment% WHERE id=?";
} else if ($lang == 2) {
$sql = "SELECT id,name_esp as name FROM %payment% WHERE id=?";
}
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($paymentid));
return $row->name;
}
}

View File

@ -2,43 +2,6 @@
// Datenbank-Verbindungsparameter
require_once ('config.php');
define ('DB_QUEUE_TABLE', TAB_PREFIX . 'queue');
define ('DB_PRODUCTS_TABLE', TAB_PREFIX . 'products');
define ('DB_USER_TABLE', TAB_PREFIX . 'user');
define ('DB_ROOM_TABLE', TAB_PREFIX . 'room');
define ('DB_RESTTABLES_TABLE', TAB_PREFIX . 'resttables');
define ('DB_PRODTYPE_TABLE', TAB_PREFIX . 'prodtype');
define ('DB_TABLEMAPS_TABLE', TAB_PREFIX . 'tablemaps');
define ('DB_TABLEPOS_TABLE', TAB_PREFIX . 'tablepos');
define ('DB_BILL_TABLE', TAB_PREFIX . 'bill');
define ('DB_CUSTOMERS_TABLE', TAB_PREFIX . 'customers');
define ('DB_GROUPS_TABLE', TAB_PREFIX . 'groups');
define ('DB_GROUPCUSTOMER_TABLE', TAB_PREFIX . 'groupcustomer');
define ('DB_VACATIONS_TABLE', TAB_PREFIX . 'vacations');
define ('DB_PRICELEVEL_TABLE', TAB_PREFIX . 'pricelevel');
define ('DB_CONFIG_TABLE', TAB_PREFIX . 'config');
define ('DB_CLOSING_TABLE', TAB_PREFIX . 'closing');
define ('DB_PRINTJOB_TABLE', TAB_PREFIX . 'printjob');
define ('DB_WORK_TABLE', TAB_PREFIX . 'work');
define ('DB_COMMENTS_TABLE', TAB_PREFIX . 'comments');
define ('DB_HSIN_TABLE', TAB_PREFIX . 'hsin');
define ('DB_HSOUT_TABLE', TAB_PREFIX . 'hsout');
define ('DB_LOGO_TABLE', TAB_PREFIX . 'logo');
define ('DB_EXTRAS_TABLE', TAB_PREFIX . 'extras');
define ('DB_EXTRASPRODS_TABLE', TAB_PREFIX . 'extrasprods');
define ('DB_HIST_TABLE', TAB_PREFIX . 'hist');
define ('DB_HIST_PROD_TABLE', TAB_PREFIX . 'histprod');
define ('DB_HIST_CONFIG_TABLE', TAB_PREFIX . 'histconfig');
define ('DB_HIST_USER_TABLE', TAB_PREFIX . 'histuser');
define ('DB_HIST_ACTIONS_TABLE', TAB_PREFIX . 'histactions');
define ('DB_HIST_PAYMENT_TABLE', TAB_PREFIX . 'payment');
define ('DB_BILLPRODUCTS_TABLE', TAB_PREFIX . 'billproducts');
define ('DB_RESERVATIONS_TABLE', TAB_PREFIX . 'reservations');
define ('DB_QUEUEEXTRAS_TABLE', TAB_PREFIX . 'queueextras');
define ('DB_RATINGS_TABLE', TAB_PREFIX . 'ratings');
class DbUtils {
private static $timezone = null;
private static $prefix = null;
@ -81,7 +44,6 @@ class DbUtils {
function testDbAccess($host,$dbname,$user,$pass) {
$dsn = 'mysql:host=' . $host . ';dbname=' . $dbname;
$user = $user;
$password = $pass;
$pdo = null;
try {
@ -109,13 +71,17 @@ class DbUtils {
if (!is_null(self::$prefix)) {
$prefix = self::$prefix;
}
return self::substTableAliasCore($sqlString, $prefix);
}
public static function substTableAliasCore($sqlString,$prefix) {
$out = str_replace("%queue%",$prefix . 'queue',$sqlString);
$out = str_replace("%products%",$prefix . 'products',$out);
$out = str_replace("%user%",$prefix . 'user',$out);
$out = str_replace("%room%",$prefix . 'room',$out);
$out = str_replace("%resttables%",$prefix . 'resttables',$out);
$out = str_replace("%bill%",$prefix . 'bill',$out);
$out = str_replace("%customerlog%", $prefix . 'customerlog', $out);
$out = str_replace("%customers%",$prefix . 'customers',$out);
$out = str_replace("%groups%",$prefix . 'groups',$out);
$out = str_replace("%groupcustomer%",$prefix . 'groupcustomer',$out);
@ -220,4 +186,3 @@ class DbUtils {
array("col" => 'removed', "hist" => 0)
);
}
?>

View File

@ -142,6 +142,22 @@ class Products {
}
}
private static $proddefs = array(
array("id" => "id","get" => "%products%.id as id","histid" => "prodid","histget" => "prodid","histexportname" => "Produktid","isnumber" => "0"),
array("id" => "shortname", "get" => "shortname","histid" => "shortname","histget" => "shortname","histexportname" => "Kurzname","isnumber" => "0"),
array("id" => "longname", "get" => "longname","histid" => "longname","histget" => "longname","histexportname" => "Langname","isnumber" => "0"),
array("id" => "available", "get" => "available","histid" => "available","histget" => "available","histexportname" => "","histexportname" => "Verfügbarkeit","isnumber" => "0"),
array("id" => "priceA", "get" => "priceA","histid" => "priceA","histget" => "priceA","histexportname" => "Preis (Stufe A)","isnumber" => "1"),
array("id" => "priceB", "get" => "priceB","histid" => "priceB","histget" => "priceB","histexportname" => "Preis (Stufe B)","isnumber" => "1"),
array("id" => "priceC", "get" => "priceC","histid" => "priceC","histget" => "priceC","histexportname" => "Preis (Stufe C)","isnumber" => "1"),
array("id" => "tax", "get" => "IF(tax is not null, tax, 'null') as tax","histid" => "tax","histget" => "tax","histexportname" => "Steuer","isnumber" => "1"),
array("id" => "taxaustria", "get" => "IF(taxaustria is not null, taxaustria, 'null') as taxaustria","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
array("id" => "amount", "get" => "IF(amount is not null, amount, 'null') as amount","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
array("id" => "audio", "get" => "IF(audio is not null, audio, '') as audio","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
array("id" => "favorite", "get" => "IF(favorite is not null, favorite, '') as favorite","histid" => "prodid","histget" => "favorite","histexportname" => "Favorit","isnumber" => "0"),
array("id" => "type", "get" => "'p' as type","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
);
function getDateValueAsBoolInterpretatedIcon($aValue) {
if ($aValue != '0' ) {
$imgFile = "ok.png";
@ -254,28 +270,22 @@ class Products {
*/
private function getProductsWithReferenz($pdo,$ref) {
$prods = array();
$sql = "SELECT id,shortname,longname,priceA,priceB,priceC,IF(tax is not null, tax, 'null') as tax,IF(taxaustria is not null, taxaustria, 'null') as taxaustria,available,IF(amount is not null, amount, 'null') as amount,audio from %products% where removed is null AND category is null ORDER BY sorting";
$sqlselecttxt = self::getSqlSearchForProducts();
$sql = "SELECT $sqlselecttxt from %products% where removed is null AND category is null ORDER BY sorting";
if ($ref > 0) {
$sql = "SELECT id,shortname,longname,priceA,priceB,priceC,IF(tax is not null, tax, 'null') as tax,IF(taxaustria is not null, taxaustria, 'null') as taxaustria,available,IF(amount is not null, amount, 'null') as amount,audio from %products% where removed is null AND category=$ref ORDER BY sorting";
$sql = "SELECT $sqlselecttxt from %products% where removed is null AND category=$ref ORDER BY sorting";
}
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$result = $stmt->fetchAll();
foreach($result as $zeile) {
$prod_entry = array(
"id" => $zeile['id'],
"shortname" => $zeile['shortname'],
"longname" => $zeile['longname'],
"available" => $zeile['available'],
"priceA" => $zeile['priceA'],
"priceB" => $zeile['priceB'],
"priceC" => $zeile['priceC'],
"tax" => $zeile['tax'],
"taxaustria" => $zeile['taxaustria'],
"amount" => $zeile['amount'],
"audio" => ($zeile['audio'] == null ? '' : $zeile['audio']),
"type" => "p");
$prod_entry = array("type" => "p");
foreach(self::$proddefs as $aProdDef) {
$prod_entry[$aProdDef["id"]] = $zeile[$aProdDef["id"]];
}
$prods[] = $prod_entry;
}
@ -378,12 +388,13 @@ class Products {
}
$containedTypes = $stmt->fetchAll(PDO::FETCH_OBJ);
$sqlselecttxt = self::getSqlSearchForProducts();
if (!is_null($ref) && ($ref>0)) {
$sql = "SELECT id,shortname,longname,priceA,priceB,priceC,IF(tax is not null, tax, 'null') as tax,IF(taxaustria is not null, taxaustria, 'null') as taxaustria,available,IF(amount is not null, amount, 'null') as amount,favorite,audio,'p' as type from %products% where removed is null AND category=? ORDER BY sorting";
$sql = "SELECT $sqlselecttxt from %products% where removed is null AND category=? ORDER BY sorting";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($ref));
} else {
$sql = "SELECT id,shortname,longname,priceA,priceB,priceC,IF(tax is not null, tax, 'null') as tax,IF(taxaustria is not null, taxaustria, 'null') as taxaustria,available,IF(amount is not null, amount, 'null') as amount,favorite,audio,'p' as type from %products% where removed is null AND category is null ORDER BY sorting";
$sql = "SELECT $sqlselecttxt from %products% where removed is null AND category is null ORDER BY sorting";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
@ -437,6 +448,35 @@ class Products {
return($row->setting);
}
public static function getSqlSearchForProducts() {
$sqlselect = array();
foreach(self::$proddefs as $aProdDef) {
$sqlselect[] = $aProdDef["get"];
}
return (join(",",$sqlselect));
}
public static function getSqlSearchForHistProducts() {
$sqlselect = array();
foreach(self::$proddefs as $aProdDef) {
$theHistId = $aProdDef["histget"];
if ($theHistId != '') {
$sqlselect[] = $aProdDef["histget"];
}
}
return (join(",",$sqlselect));
}
public static function getHistProdExportNames() {
$sqlselect = array();
foreach(self::$proddefs as $aProdDef) {
$theHistId = $aProdDef["histexportname"];
if ($theHistId != '') {
$sqlselect[] = $aProdDef["histexportname"];
}
}
return (join(";",$sqlselect));
}
private function exportCsv() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
@ -447,12 +487,14 @@ class Products {
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Expires: 0");
echo("Eintragsid; Datum ; Produktid; Kurzname; Langname; Preis (Stufe A); Preis (Stufe B);");
echo("Preis (Stufe C); Steuer; Verfügbarkeit; Favorit; Extras/Optionen; Beschreibung");
echo("Eintragsid; Datum ;");
echo self::getHistProdExportNames();
echo("; Extras/Optionen; Beschreibung");
echo("\n");
$sql = "SELECT DISTINCT %hist%.id as id,date,";
$sql .= "prodid,shortname,longname,priceA,priceB,priceC,IF(tax is not null, tax, '-') as tax,available,favorite,extras,description ";
$sql .= self::getSqlSearchForHistProducts();
$sql .= ",extras,description ";
$sql .= " FROM %hist%, %histprod%, %histactions% ";
$sql .= " WHERE (refid=%histprod%.id) ";
$sql .= " AND (action='1' OR action='4' OR action='5') ";
@ -463,21 +505,35 @@ class Products {
$stmt->execute();
$result = $stmt->fetchAll();
foreach($result as $zeile) {
$val1 = $zeile['id'];
$val2 = $zeile['date'];
$val3 = $zeile['prodid'];
$val4 = str_replace('"','""',$zeile['shortname']);
$val5 = str_replace('"','""',$zeile['longname']);
$val6 = str_replace(".",$decpoint,$zeile['priceA']);
$val7 = str_replace(".",$decpoint,$zeile['priceB']);
$val8 = str_replace(".",$decpoint,$zeile['priceC']);
$val9 = str_replace(".",$decpoint,$zeile['tax']);
$val10 = ($zeile['available'] == '1' ? "Ja" : "Nein");
$val11 = ($zeile['favorite'] == '1' ? "Ja" : "Nein");
$val12 = $zeile['extras'];
$val13 = $zeile['description'];
echo "$val1; $val2; $val3; \"$val4\"; \"$val5\"; $val6; $val7; $val8; $val9; $val10; $val11; $val12; $val13\n";
echo $zeile['id'] . ";" . $zeile['date'] . ";";
foreach(self::$proddefs as $aProdDef) {
$item = $aProdDef["histexportname"];
$itemsql = $aProdDef["histget"];
if ($item != "") {
if ($itemsql == 'tax') {
// IF(tax is not null, tax, '-') as tax
$value = ($zeile['tax']);
if ($value == null) {
$value = '-';
}
$value = str_replace(".",$decpoint,$value);
} else if ($itemsql == 'available') {
$value = ($zeile['available'] == '1' ? "Ja" : "Nein");
} else if ($itemsql == 'favorite') {
$value = ($zeile['favorite'] == '1' ? "Ja" : "Nein");
} else {
$isNumber = $aProdDef["isnumber"];
$value = $zeile[$aProdDef["histget"]];
if ($isNumber == '1') {
$value = str_replace(".",$decpoint,$value);
} else {
$value = str_replace('"','""',$value);
}
}
echo $value . ";";
}
}
echo $zeile['extras'] . ";" . $zeile['description'] . "\n";
}
}
@ -654,8 +710,6 @@ class Products {
}
private function delExtra($id) {
// TODO: hist!
// TODO: extrasprods cleanen
try {
$pdo = $this->dbutils->openDbAndReturnPdo();
$sql = "UPDATE %extras% SET removed='1' WHERE id=?";
@ -995,17 +1049,6 @@ class Products {
function createProduct(ProductEntry $prodEntry) {
$typeId = $prodEntry->getCategory();
$available = $prodEntry->getAvailable();
$favorite = $prodEntry->getFavorite();
$priceA = $prodEntry->getPriceA();
$priceB = $prodEntry->getPriceB();
$priceC = $prodEntry->getPriceC();
$tax = $prodEntry->getTax();
$taxaustria = $prodEntry->getTaxAustria();
$audioFile = $prodEntry->getAudio();
$shortname = $prodEntry->getShortName();
$longname = $prodEntry->getLongName();
$amount = $prodEntry->getAmount();
if (!is_numeric($typeId)) {
return;

View File

@ -91,43 +91,7 @@ class Basedb {
}
function resolveTablenamesInSqlString($sqlString) {
$out = str_replace("%queue%",$this->prefix . "queue",$sqlString);
$out = str_replace("%products%",$this->prefix . "products",$out);
$out = str_replace("%user%",$this->prefix . "user",$out);
$out = str_replace("%room%",$this->prefix . "room",$out);
$out = str_replace("%resttables%",$this->prefix . "resttables",$out);
$out = str_replace("%tablemaps%",$this->prefix . "tablemaps",$out);
$out = str_replace("%tablepos%",$this->prefix . "tablepos",$out);
$out = str_replace("%bill%",$this->prefix . "bill",$out);
$out = str_replace("%customers%",$this->prefix . "customers",$out);
$out = str_replace("%groups%",$this->prefix . "groups",$out);
$out = str_replace("%groupcustomer%",$this->prefix . "groupcustomer",$out);
$out = str_replace("%vacations%",$this->prefix . "vacations",$out);
$out = str_replace("%pricelevel%",$this->prefix . "pricelevel",$out);
$out = str_replace("%config%",$this->prefix . "config",$out);
$out = str_replace("%closing%",$this->prefix . "closing",$out);
$out = str_replace("%printjobs%",$this->prefix . "printjob",$out);
$out = str_replace("%hist%",$this->prefix . "hist",$out);
$out = str_replace("%histprod%",$this->prefix . "histprod",$out);
$out = str_replace("%histconfig%",$this->prefix . "histconfig",$out);
$out = str_replace("%histuser%",$this->prefix . "histuser",$out);
$out = str_replace("%histactions%",$this->prefix . "histactions",$out);
$out = str_replace("%payment%",$this->prefix . "payment",$out);
$out = str_replace("%billproducts%",$this->prefix . "billproducts",$out);
$out = str_replace("%work%",$this->prefix . "work",$out);
$out = str_replace("%comments%",$this->prefix . "comments",$out);
$out = str_replace("%hsin%",$this->prefix . "hsin",$out);
$out = str_replace("%hsout%",$this->prefix . "hsout",$out);
$out = str_replace("%reservations%",$this->prefix . "reservations",$out);
$out = str_replace("%logo%",$this->prefix . "logo",$out);
$out = str_replace("%log%",$this->prefix . "log",$out);
$out = str_replace("%extras%",$this->prefix . "extras",$out);
$out = str_replace("%extrasprods%",$this->prefix . "extrasprods", $out);
$out = str_replace("%queueextras%",$this->prefix . "queueextras", $out);
$out = str_replace("%ratings%",$this->prefix . "ratings", $out);
$out = str_replace("%hsin%",$this->prefix . "hsin", $out);
$out = str_replace("%hsout%",$this->prefix . "hsout", $out);
return (str_replace("%prodtype%",$this->prefix . "prodtype",$out));
return DbUtils::substTableAliasCore($sqlString, $this->prefix);
}
function dropTables($pdo) {
@ -149,6 +113,7 @@ class Basedb {
$this->doSQLcatch($pdo, "drop TABLE `%billproducts%`");
$this->doSQLcatch($pdo, "drop TABLE `%queue%`");
$this->doSQLcatch($pdo, "drop TABLE `%printjobs%`");
$this->doSQLcatch($pdo, "drop TABLE `%customerlog%`");
$this->doSQLcatch($pdo, "drop TABLE `%bill%`");
$this->doSQLcatch($pdo, "drop TABLE `%ratings%`");
$this->doSQLcatch($pdo, "drop TABLE `%user%`");
@ -172,45 +137,24 @@ class Basedb {
$this->doSQLcatch($pdo, "drop TABLE `%log%`");
}
function dropTablesNoCatch($pdo) {
$this->doSQL($pdo, "DROP TABLE `%hsin%`");
$this->doSQL($pdo, "DROP TABLE `%hsout%`");
$this->doSQL($pdo, "DROP TABLE `%comments%`");
$this->doSQL($pdo, "DROP TABLE `%reservations%`");
$this->doSQL($pdo, "DROP TABLE `%work%`");
$this->doSQL($pdo, "DROP TABLE `%hist%`");
$this->doSQL($pdo, "DROP TABLE `%histprod%`");
$this->doSQL($pdo, "DROP TABLE `%histconfig%`");
$this->doSQL($pdo, "DROP TABLE `%histuser%`");
$this->doSQL($pdo, "DROP TABLE `%histactions%`");
$this->doSQL($pdo, "drop TABLE `%queueextras%`");
$this->doSQL($pdo, "drop TABLE `%extrasprods%`");
$this->doSQL($pdo, "drop TABLE `%extras%`");
$this->doSQL($pdo, "drop TABLE `%billproducts%`");
$this->doSQL($pdo, "drop TABLE `%queue%`");
$this->doSQL($pdo, "drop TABLE `%printjobs%`");
$this->doSQL($pdo, "drop TABLE `%bill%`");
$this->doSQL($pdo, "drop TABLE `%ratings%`");
$this->doSQL($pdo, "drop TABLE `%user%`");
$this->doSQL($pdo, "drop TABLE `%closing%`");
$this->doSQL($pdo, "drop TABLE `%config%`");
$this->doSQL($pdo, "drop TABLE `%products%`");
$this->doSQL($pdo, "drop TABLE `%prodtype%`");
$this->doSQL($pdo, "drop TABLE `%pricelevel%`");
$this->doSQL($pdo, "drop TABLE `%tablepos%`");
$this->doSQL($pdo, "drop TABLE `%tablemaps%`");
$this->doSQL($pdo, "drop TABLE `%resttables%`");
$this->doSQL($pdo, "drop TABLE `%room%`");
$this->doSQL($pdo, "drop TABLE `%payment%`");
$this->doSQL($pdo, "drop TABLE `%logo%`");
$this->doSQL($pdo, "drop TABLE `%log%`");
$this->doSQL($pdo, "drop TABLE `%groupcustomer%`");
$this->doSQL($pdo, "drop TABLE `%vacations%`");
$this->doSQL($pdo, "drop TABLE `%groups%`");
$this->doSQL($pdo, "drop TABLE `%customers%`");
function createCustomerLogTable($pdo) {
$sql = "
CREATE TABLE `%customerlog%` (
`id` INT (3) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`date` DATETIME NULL,
`customerid` INT(10) NULL,
`billid` INT(10) NULL,
`action` INT(2) NULL,
`userid` INT(3) NULL,
`remark` VARCHAR ( 500 ) NULL,
FOREIGN KEY (billid) REFERENCES %bill%(id),
FOREIGN KEY (customerid) REFERENCES %customers%(id),
FOREIGN KEY (userid) REFERENCES %user%(id)
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createLogTable($pdo) {
@ -875,6 +819,7 @@ class Basedb {
$this->createGroupCustomerTable($pdo);
$this->createVacationsTable($pdo);
$this->createBillTable($pdo);
$this->createCustomerLogTable($pdo);
$this->createQueueTable($pdo);
$this->createBillProductsTable($pdo);
$this->createHistTables($pdo);

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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<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.3.0">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.1">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />