OrderSprinter 1.5.0

This commit is contained in:
Geno 2020-11-19 23:11:27 +01:00
parent 9ec356f06b
commit a29e2865af
37 changed files with 1361 additions and 153 deletions

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" href="css/gueststyle.css?v=1.4.18" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css?v=1.4.18" />
<link rel="stylesheet" href="css/gueststyle.css?v=1.5.0" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css?v=1.5.0" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-1.11.3.min.js"></script>
@ -105,7 +105,7 @@
<div data-role="footer" data-theme="b" id="thefooter1">
<div class="ui-grid-a">
<div class="ui-block-a">&nbsp;&nbsp;OrderSprinter</div>
<div class="ui-block-b grid_right" id="versioninfo">1.4.18&nbsp;&nbsp;</div>
<div class="ui-block-b grid_right" id="versioninfo">1.5.0&nbsp;&nbsp;</div>
</div><!-- /grid-a -->
</div>
</div>

View File

@ -90,10 +90,10 @@ if (isset($_POST['code'])) {
} else {
echo "<html>";
echo "<head><title>Installation Gastsystem</title>";
echo '<link rel="stylesheet" type="text/css" href="css/gueststyle.css?v=1.4.18">';
echo '<link rel="stylesheet" type="text/css" href="css/gueststyle.css?v=1.5.0">';
echo "</head>";
echo "<body><div class=surround>";
echo "<span class=headerline>Installation OrderSprinter-Gastsystem 1.4.18</span><br><br>";
echo "<span class=headerline>Installation OrderSprinter-Gastsystem 1.5.0</span><br><br>";
echo "<form action='install.php' method='post'><input class=installfield name=code id=code type=text placeholder='Installationscode' />";
echo "<br><input type=submit value='Installation starten' class=installbtn />";
echo "</form></div></html>";

View File

@ -85,7 +85,7 @@ class Installer {
}
Database::dropTables($pdo);
Database::createEmptyTables($pdo, $prefix);
Database::setVersion($pdo,$prefix,"1.4.18");
Database::setVersion($pdo,$prefix,"1.5.0");
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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -13,8 +13,8 @@
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-2.0.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
<script src="utilities.js"></script>
<script src="kitchenbar.js"></script>
<script src="utilities.js?v=1.5.0"></script>
<script src="kitchenbar.js?v=1.5.0"></script>
<style>
#tableWithEntriesToCook,#tableWithCookedEntries,#headertableToCook

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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -21,6 +21,7 @@ Speisen = KBF = 1
Suzukakia 2 Hacksteaks; 10,00 # Kurzname:Suzukakia 2H ; Bildnr: 1
Souvlaki; 10,00 # ID:9 ; Bildnr: 1
Schaschlik; 5,00 # Bildnr: 23
Chili Con Carne; 9,00 # Bildnr:24
Italienische Küche = KBF = 1
Ital. Tagesspecial; 6,00 # Kurzname:Special ; Bildnr: 1
Pizza = KBF = 1
@ -30,6 +31,15 @@ Speisen = KBF = 1
Salami = KBF = 1
Pizza Salami klein; 6,00 # Kurzname:klein; Bildnr: 1
Pizza Salami groß; 7,00 # Kurzname:groß; Bildnr: 1
Salata = KBF = 1
Blattsalat ; 2,00 # Bildnr:25
Bunter Salat; 3,00 # Bildnr:26
Deftiges = KBF = 1
Mittagsgericht ; 12,00 # Bildnr:28
Pasta ; 5,00 # Bildnr:29
Kartoffelspalten ; 5,00 # Bildnr:27
Rinderroulade ; 6,00 # Bildnr:31
Rosenkohl; 3,00 # Bildnr:32
Dessert = KBF = 1
Mohnkuchen; 1,50 # Bildnr: 8
Kuchen all; 1,50 # Bildnr: 1
@ -37,6 +47,8 @@ Speisen = KBF = 1
Schokoteilchen; 3,20 # Bildnr: 21
Kirschstreusel; 3,20 # Bildnr: 17
Vanilleteilchen; 3,40 # Bildnr: 22
Suessigkeitenteller ; 10,00 # Bildnr:33
Eliseplätzchen ; 5,00 # Bildnr:30
Kategorie Selbstbedienung = F = 1
Frühstücksbuffet; 8,00 # Bildnr: 1
Frühstücksbuffet + Kaffe; 12,00 # Bildnr: 1

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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<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.4.18">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.5.0">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -215,7 +215,7 @@ function handleResultOfInstallCheck(is_installed) {
if (is_installed == "Yes") {
useInstallation();
} else {
setTimeout(function(){document.location.href = "install.html?v=1.4.18"},500);
setTimeout(function(){document.location.href = "install.html?v=1.5.0"},500);
}
}

View File

@ -727,7 +727,7 @@ $(document).ready(function() {
<tr id=updateline>
<td>&nbsp;</td>
<td align=center>
<button id="updatebtn">Update -> 1.4.18</button>
<button id="updatebtn">Update -> 1.5.0</button>
<span id="updateinprogresstxt" style="display:none;">Update... bitte warten.</span>
</td>
<td>&nbsp;</td>

View File

@ -413,7 +413,7 @@ $zones[] = $timezone_identifiers[$i];
echo json_encode($zones);
} else if ($command == 'update') {
set_time_limit(60*30);
$installerVersion = "1.4.18";
$installerVersion = "1.5.0";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);

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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -13,8 +13,8 @@
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-2.0.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
<script src="utilities.js"></script>
<script src="kitchenbar.js"></script>
<script src="utilities.js?v=1.5.0"></script>
<script src="kitchenbar.js?v=1.5.0"></script>
<style>
#tableWithEntriesToCook,#tableWithCookedEntries,#headertableToCook

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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -74,6 +74,8 @@ var MAN_CUSTOMERS = ["Gäste","Guests","Clientes"];
var MAN_MANAGER = ["Verwaltung","Administration","Administración"];
var MAN_CLOSINGRIGHT = ["Tageserfassung","Closing","Cerrar día"];
var MAN_DASHRIGHT = ["Dashboard","Dashboard","Dashboard"];
var MAN_TIMETRACKINGRIGHT = ["Zeiterfassung","Time Tracking","Tiempos de Trabajo"];
var MAN_TIMEMANAGERRIGHT = ["Zeitmanagement","Time management","Administrar Tiempos de Trabajo"];
var MAN_USER_NAME = ["Benutzername","User name","Nombre de usario"];
var MAN_USER_PASS = ["Passwort","Password","Contraseña"];
var MAN_YES = ["Ja","Yes","Si"];
@ -286,7 +288,10 @@ var MAN_STARTPRODSEARCH = ["Starte Produktsuche ab # Zeichen","Start product sea
var MAN_DISCOUNTNAME1 = ["Bezeichnung Rabatt 1","Name of discount 1","Nombre del descuento 1"];
var MAN_DISCOUNTNAME2 = ["Bezeichnung Rabatt 2","Name of discount 2","Nombre del descuento 2"];
var MAN_DISCOUNTNAME3 = ["Bezeichnung Rabatt 3","Name of discount 3","Nombre del descuento 3"];
var MAN_TIMETRACKING = ["Zeiterfassung:","Time tracking:","Tiempos de los empleados:"];
var MAN_MEMORYLIMIT = ["PHP Memory Limit (MB)","PHP Memory Limit (MB)","PHP Memory Limit (MB)"];
var MAN_MINBEFORECOME = ["'Kommen' stempelt Minuten früher","'Come' counts additional minutes earlier","'Venir' añade minutos más temprano"];
var MAN_MINAFTERGO = ["'Gehen' stempelt Minuten später","'Go' counts additional minutes later","'Irse' añade minutos despues"];
var MAN_UPDATEURL = ["Update-Server","Update server","Servidor de actualizar"];
var MAN_TMPDIR = ["PHP-Temp-Verzeichnis","PHP temp directory","PHP Tmp"];
var MAN_FTPHOST = ["Ftp-Server","Ftp server","Ftp servidor"];
@ -409,6 +414,9 @@ var MAN_DAYNAMES = [
["Samstag","Saturday","Sábado"],
["Sonntag","Sunday","Domingo"]
];
var MAN_CATEGORY = ["Kategorie","Category","Categoria"];
var MAN_FOOD_CAT = ["Speisen","Food","Comidas"];
var MAN_DRINKS_CAT = ["Getränke","Drinks","Bebidas"];
var lang = 0;
var generalVals = [12,2,0,3,0,1,1,0,0,1, 0,50,20,10,1,0,0,0,1,0,1,0,0,1,1, 1,1,1,1,1,1,1,1,1,1, 1,2,3, 1,0, 1,0,1, 1,1,0,0, 0,0];
@ -508,6 +516,8 @@ var generalValuesSettings = [
["discountname3",MAN_DISCOUNTNAME3[lang],"i",0,""],
["memorylimit",MAN_MEMORYLIMIT[lang],"i",0,""],
["minbeforecome",MAN_MINBEFORECOME[lang],"i",0,""],
["minaftergo",MAN_MINAFTERGO[lang],"i",0,""],
["updateurl",MAN_UPDATEURL[lang],"i",0,""],
["tmpdir",MAN_TMPDIR[lang],"i",0,""],
["ftphost",MAN_FTPHOST[lang],"i",0,""],
@ -586,6 +596,8 @@ function setLanguage(l) {
$("#discountname3txt").html(MAN_DISCOUNTNAME3[l]);
$("#memorylimittxt").html(MAN_MEMORYLIMIT[l]);
$("#minbeforecometxt").html(MAN_MINBEFORECOME[l]);
$("#minaftergotxt").html(MAN_MINAFTERGO[l]);
$("#updateurltxt").html(MAN_UPDATEURL[l]);
$("#tmpdirtxt").html(MAN_TMPDIR[l]);
$("#tmpdirhint").html(MAN_TMPDIRHINT[l]);
@ -660,6 +672,7 @@ function setLanguage(l) {
$("#digiprinthint").html(MAN_DIGI_PRINTWORK_HINT[l]);
$("#generalsectiontxt").html(MAN_GENSECTION_TXT[l]);
$("#mobilviewsectiontxt").html(MAN_MOBILSECTION_TXT[l]);
$("#timetrackingtxt").html(MAN_TIMETRACKING[l]);
$("#desktopviewsectiontxt").html(MAN_DESKTOP_SECTION_TXT[l]);
$("#specialsettingssectiontxt").html(MAN_SPECIAL_SETTINGS_TXT[l]);
$("#guestsystemsectiontxt").html(MAN_GUEST_SYSTEM_TXT[l]);
@ -927,6 +940,8 @@ function insertGeneralConfigItems(configResult) {
$("#discountname3").val(values.discountname3);
$("#memorylimit").val(values.memorylimit);
$("#minbeforecome").val(values.minbeforecome);
$("#minaftergo").val(values.minaftergo);
$("#updateurl").val(values.updateurl);
$("#tmpdir").val(values.tmpdir);
$("#ftphost").val(values.ftphost);
@ -1276,7 +1291,7 @@ function initRestoreFileUpload() {
} else {
alert("Import war erfolgreich.");
setTimeout(function(){
document.location.href = "index.html?v=1.4.18";
document.location.href = "index.html?v=1.5.0";
},250);
}
},
@ -1485,7 +1500,9 @@ function bindingExports() {
window.open("php/contenthandler.php?module=bill&command=exportPdfSummary&" + dateparams,'_blank');
} else if (theId == "createlogexport") {
window.open("php/contenthandler.php?module=admin&command=exportLog",'_blank');
}
} else if (theId == "createtimesexport") {
window.location.href = "php/contenthandler.php?module=timetracking&command=exportTimesCsv&" + dateparams;
}
});
}
@ -1814,9 +1831,9 @@ function handleUpdateCheckResult(answer) {
var millis=getMillis();
setTimeout(function(){
document.location.href = "install.html?v=1.4.18&mode=onlyupdate&n=" + millis;
document.location.href = "install.html?v=1.5.0&mode=onlyupdate&n=" + millis;
},250);
document.location.href = "install.html?v=1.4.18&mode=onlyupdate&n=" + millis;
document.location.href = "install.html?v=1.5.0&mode=onlyupdate&n=" + millis;
}
function handleUpdateReplace(answer) {
@ -2313,14 +2330,15 @@ function displayReceivedClosings(closingresult) {
var cashsum = aClosing.cashsum;
var usersums = aClosing.usersums;
var taxessums = aClosing.taxessums;
var categorysums = aClosing.categorysums;
var cashops = aClosing.cashops;
var closDateTxt = closingDate + ' (' + dayname + ')';
if (remark != "") {
closingParts += createClosingPart(id + ": " + closDateTxt + ": " + remark,id,totalsum,cashsum,usersums,taxessums,cashops);
closingParts += createClosingPart(id + ": " + closDateTxt + ": " + remark,id,totalsum,cashsum,usersums,taxessums,categorysums,cashops);
} else {
closingParts += createClosingPart(id + ": " + closDateTxt,id,totalsum,cashsum,usersums,taxessums,cashops);
closingParts += createClosingPart(id + ": " + closDateTxt,id,totalsum,cashsum,usersums,taxessums,categorysums,cashops);
}
});
$("#partofclosings").html(closingParts);
@ -2431,7 +2449,7 @@ function createCollapsibeOfUser(id,username,roleid,forNewUser,roles) {
return collapsiblePart;
}
function createCollapsibeOfRole(id,name,isAdmin,rWaiter,rKitchen,rBar,rSupply,rPay,rStat,rBill,rProd,rReservation,rRating,rChangeprice,rCustomers,rClosing, rDash, rManager,forNewRole) {
function createCollapsibeOfRole(id,name,isAdmin,rWaiter,rKitchen,rBar,rSupply,rPay,rStat,rBill,rProd,rReservation,rRating,rChangeprice,rCustomers,rClosing, rDash, rTimetracking, rTimeManager, rManager,forNewRole) {
var collapsiblePart = '<div data-role="collapsible" id="' + id + '"';
if (forNewRole) {
collapsiblePart += ' data-theme="d" data-content-theme="d">';
@ -2459,6 +2477,8 @@ function createCollapsibeOfRole(id,name,isAdmin,rWaiter,rKitchen,rBar,rSupply,rP
collapsiblePart += createLabelWithOption("rolelabel_",id,"customers",MAN_CUSTOMERS[lang],possibleValues,rCustomers);
collapsiblePart += createLabelWithOption("rolelabel_",id,"closingright",MAN_CLOSINGRIGHT[lang],possibleValues,rClosing);
collapsiblePart += createLabelWithOption("rolelabel_",id,"dash",MAN_DASHRIGHT[lang],possibleValues,rDash);
collapsiblePart += createLabelWithOption("rolelabel_",id,"timetracking",MAN_TIMETRACKINGRIGHT[lang],possibleValues,rTimetracking);
collapsiblePart += createLabelWithOption("rolelabel_",id,"timemanager",MAN_TIMEMANAGERRIGHT[lang],possibleValues,rTimeManager);
collapsiblePart += createLabelWithOption("rolelabel_",id,"manager",MAN_MANAGER[lang],possibleValues,rManager);
if (forNewRole) {
@ -2534,13 +2554,15 @@ function fillRoleListIntoGui(answer) {
aRole.right_customers,
aRole.right_closing,
aRole.right_dash,
aRole.right_timetracking,
aRole.right_timemanager,
aRole.right_manager,
false
);
}
rolesPart += createCollapsibeOfRole(
"roleid_newrole",MAN_NEW_ROLE[lang],
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,true);
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,true);
$("#rolescontentpart").html(rolesPart);
$("#rolescontentpart").trigger("create");
@ -2593,7 +2615,9 @@ function collectRoleInfo(roleid) {
["rCustomers", "#rolelabel_customers", true,true],
["rManager", "#rolelabel_manager", true,true],
["rClosing", "#rolelabel_closingright", true,true],
["rDash", "#rolelabel_dash", true,true]
["rDash", "#rolelabel_dash", true,true],
["rTimetracking","#rolelabel_timetracking",true,true],
["rTimemanager", "#rolelabel_timemanager", true,true]
];
var data = {};
@ -2765,7 +2789,7 @@ function invokeCmd(theCommand) {
doAjax("GET","php/contenthandler.php?module=admin&command=" + theCommand,null,handleResultOfDbAction,"Problemkommando " . theCommand);
}
function createClosingPart (aText,id,totalsum,cashsum,usersums,taxessums,cashops) {
function createClosingPart (aText,id,totalsum,cashsum,usersums,taxessums,categorysums,cashops) {
var decpoint = $("#admin-page").data("decpoint");
var currency = $("#admin-page").data("currency");
var closingPart = '<div data-role="collapsible" data-theme="e" data-content-theme="d">';
@ -2806,6 +2830,25 @@ function createClosingPart (aText,id,totalsum,cashsum,usersums,taxessums,cashops
closingPart += '</table><br>';
}
if (categorysums.length > 0) {
closingPart += '<br><table class="categorysums">';
closingPart += '<tr><th>' + MAN_CATEGORY[lang] + '<th>' + MAN_BILLSUMALL[lang] + ' (' + currency + ')</tr>';
for (var i=0;i<categorysums.length;i++) {
var aSum = categorysums[i];
if (aSum.kind == 0) {
closingPart += '<tr><td>' + MAN_FOOD_CAT[lang];
} else if (aSum.kind == 1) {
closingPart += '<tr><td>' + MAN_DRINKS_CAT[lang];
} else {
continue;
}
closingPart += '<td>' + aSum.brutto.replace(".", decpoint);
closingPart += '</tr>';
}
closingPart += '</table><br>';
}
closingPart += '<i>' + MAN_CLOSING_INCOME[lang] + ' (' + currency + '):</i> <b>' + (parseFloat(Math.round(totalsum * 100) / 100).toFixed(2)).replace(".", decpoint) + "</b><br>";
closingPart += '<i>' + MAN_CLOSING_INCOME_CASH[lang] + ' (' + currency + '):</i> <b>' + (parseFloat(Math.round(cashsum * 100) / 100).toFixed(2)).replace(".", decpoint) + "</b><br>";
closingPart += '<p>' + MAN_CLOSING_DET_TXT[lang] + '</p>';
@ -3255,6 +3298,7 @@ $(document).on("pageinit", "#admin-page", function () {
<button type="submit" data-theme="f" class="cancelButton exportbtn" data-icon="check" id="createprodexport">Export Produktdaten</button>
<button type="submit" data-theme="f" class="cancelButton exportbtn" data-icon="check" id="createuserexport">Export Benutzerdaten</button>
<button type="submit" data-theme="f" class="cancelButton exportbtn" data-icon="check" id="createconfigexport">Export Konfiguration</button>
<button type="submit" data-theme="f" class="cancelButton exportbtn" data-icon="check" id="createtimesexport">Export Zeiterfassung</button>
<button type="submit" data-theme="f" class="cancelButton exportbtn" data-icon="check" id="createlogexport">Export Log</button>
</form>
</div><!-- Datenexport -->
@ -3467,7 +3511,7 @@ $(document).on("pageinit", "#admin-page", function () {
<input type="text" value="" data-mini="true" placeholder="EUR" id="hscurrency" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="hs3refresh"><span id="hs3refreshtxt">PHP Memory Limit:</span></label>
<label for="hs3refresh"><span id="hs3refreshtxt">HS/3 Refresh:</span></label>
<input type="text" value="" data-mini="true" placeholder="60" id="hs3refresh" data-theme="c" class="genConfigEl"/>
</div>
</div>
@ -3546,6 +3590,16 @@ $(document).on("pageinit", "#admin-page", function () {
</div>
</div>
<br><b><u><span id="timetrackingtxt">Zeitmanagement</span></u></b><br><br>
<div data-role="fieldcontain">
<label for="minbeforecome"><span id="minbeforecometxt">Stempelminuten früher:</span></label>
<input type="text" value="" data-mini="true" placeholder="0" id="minbeforecome" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="minaftergo"><span id="minaftergotxt">Stempelminuten später</span></label>
<input type="text" value="" data-mini="true" placeholder="0" id="minaftergo" data-theme="c" class="genConfigEl"/>
</div>
<br><b><u><span id="mobilviewsectiontxt">MOBILANSICHT</span></u></b><br><br>
<div id="partOfProminentSearch"></div>

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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -497,9 +497,7 @@ class Admin {
$sql = "SELECT *,%user%.id as id FROM %user%,%roles% WHERE %user%.id=? AND active='1' AND %user%.roleid=%roles%.id";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($userid));
$result = $stmt->fetchAll();
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($userid));
$numberOfEntries = count($result);
if ($numberOfEntries == 1) {
@ -555,7 +553,7 @@ class Admin {
$zeile['right_bar'],$zeile['right_supply'],$zeile['right_paydesk'],
$zeile['right_statistics'],$zeile['right_bill'],$zeile['right_products'],
$zeile['right_reservation'],$zeile['right_changeprice'],$zeile['right_customers'],$zeile['right_manager'],
$zeile['right_closing'],$zeile['right_dash']);
$zeile['right_closing'],$zeile['right_dash'],$zeile['right_timetracking'],$zeile['right_timemanager']);
$right_rating = $zeile['right_rating'];
if (self::isOnlyRatingUser($rights,$right_rating, 1)) {
@ -576,6 +574,8 @@ class Admin {
$_SESSION['right_manager'] = false;
$_SESSION['right_closing'] = false;
$_SESSION['right_dash'] = false;
$_SESSION['right_timetracking'] = false;
$_SESSION['right_timemanager'] = false;
$_SESSION['keeptypelevel'] = false;
} else {
$_SESSION['is_admin'] = ($zeile['is_admin'] == 1 ? true : false);
@ -600,6 +600,8 @@ class Admin {
$_SESSION['right_manager'] = ($zeile['right_manager'] == 1 ? true : false);
$_SESSION['right_closing'] = ($zeile['right_closing'] == 1 ? true : false);
$_SESSION['right_dash'] = ($zeile['right_dash'] == 1 ? true : false);
$_SESSION['right_timetracking'] = ($zeile['right_timetracking'] == 1 ? true : false);
$_SESSION['right_timemanager'] = ($zeile['right_timemanager'] == 1 ? true : false);
$_SESSION['keeptypelevel'] = ($zeile['keeptypelevel'] == 1 ? true : false);
}
@ -607,7 +609,7 @@ class Admin {
$_SESSION['right_bar'], $_SESSION['right_supply'], $_SESSION['right_paydesk'], $_SESSION['right_statistics'],
$_SESSION['right_bill'], $_SESSION['right_products'], $_SESSION['right_reservation'], $_SESSION['right_rating'],
$_SESSION['right_changeprice'], $_SESSION['right_customers'],$_SESSION['right_manager'], $_SESSION['right_closing'],
$_SESSION['right_dash']);
$_SESSION['right_dash'],$_SESSION['right_timetracking'],$_SESSION['right_timemanager']);
$assoc = array ("0" => "roombtnsize","1" => "tablebtnsize","2" => "prodbtnsize");
@ -1124,6 +1126,8 @@ class Admin {
$discountname3 = trim(CommonUtils::getConfigValueStmt($pdo,$stmt, "discountname3", ''));
$memorylimit = CommonUtils::getConfigValueStmt($pdo,$stmt,"memorylimit",256);
$minbeforecome = CommonUtils::getConfigValueStmt($pdo,$stmt,"minbeforecome",0);
$minaftergo = CommonUtils::getConfigValueStmt($pdo,$stmt,"minaftergo",0);
$updateurl = CommonUtils::getConfigValueStmt($pdo,$stmt,"updateurl","");
$tmpdir = CommonUtils::getConfigValueStmt($pdo,$stmt,"tmpdir","");
$ftphost = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftphost","");
@ -1169,6 +1173,7 @@ class Admin {
"webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "cancelguestcode" => $cancelguestcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3,
"austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "oneprodworkrecf" => $oneprodworkrecf, "oneprodworkrecd" => $oneprodworkrecd,
"digiprintwork" => $digiprintwork, "memorylimit" => $memorylimit, "updateurl" => $updateurl, "tmpdir" => $tmpdir, "hs3refresh" => $hs3refresh,
"minbeforecome" => $minbeforecome, "minaftergo" => $minaftergo,
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "rksvserver" => $rksvserver, "addreceipttoprinter" => $addreceipttoprinter,
"printandqueuejobs" => $printandqueuejobs, "cashenabled" => $cashenabled, "returntoorder" => $returntoorder, "beepcooked" => $beepcooked,"beepordered" => $beepordered, "restaurantmode" => $restaurantmode,
"discountname1" => $discountname1,"discountname2" => $discountname2,"discountname3" => $discountname3, "dblog" => $dblog,"startprodsearch" => $startprodsearch,
@ -1257,7 +1262,8 @@ class Admin {
"rating.html" => 'right_rating',
"customers.html" => 'right_customers',
"waiterdesktop.php" => 'right_waiter',
"dash.php" => 'right_dash'
"dash.php" => 'right_dash',
"timetracking.html" => 'right_timetracking'
);
$valid = false;
@ -1276,7 +1282,7 @@ class Admin {
$view = "preferences.html";
}
echo json_encode($view . "?v=1.4.18");
echo json_encode($view . "?v=1.5.0");
}
}
@ -1464,6 +1470,7 @@ class Admin {
$lang = $_SESSION['language'];
$waiterdesktxt = array("Kellneransicht","Waiter's View","Vista de camareros");
$kitchentxt = array("K&uuml;che","Kitchen","Cocina");
$timetrackingtxt = array("Zeiterfassung","Time tracking","Tiempos");
$waitertxt = array("Bestellung","Orderdesk","Camarero");
$paydesktxt = array("Kasse","Paydesk","Caja");
$settingtxt = array("Einstellungen","Preferences","Propriedades");
@ -1482,32 +1489,33 @@ class Admin {
$_SESSION['right_bar'],$_SESSION['right_supply'],$_SESSION['right_paydesk'],
$_SESSION['right_statistics'],$_SESSION['right_bill'],$_SESSION['right_products'],
$_SESSION['right_reservation'],$_SESSION['right_changeprice'],$_SESSION['right_customers'],
$_SESSION['right_manager'],$_SESSION['right_closing'],$_SESSION['right_dash']);
$_SESSION['right_manager'],$_SESSION['right_closing'],$_SESSION['right_dash'],$_SESSION['right_timetracking'],$_SESSION['right_timemanager']);
$right_rating = $_SESSION['right_rating'];
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.4.18"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.5.0"); }
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.4.18"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.5.0"); }
}
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.4.18"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.4.18"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.4.18"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.5.0"); }
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.5.0"); }
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.5.0"); }
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.4.18"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.5.0"); }
}
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.4.18"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.4.18"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.4.18"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.4.18"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.4.18"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.4.18"); };
if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.4.18"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.4.18"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.4.18");
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.4.18");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.4.18");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.5.0"); }
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.5.0"); }
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.5.0"); }
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.5.0"); }
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.5.0"); }
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.5.0"); }
if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.5.0"); }
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.5.0"); }
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.5.0");
if ($_SESSION['right_timetracking'] || $_SESSION['right_timemanager']) { $mainMenu[] = array("name" => $timetrackingtxt[$lang], "link" => "timetracking.html?v=1.5.0"); }
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.5.0");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.5.0");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -2036,6 +2044,8 @@ class Admin {
"discountname3" => array("dbcol" => "discountname3","checknum" => 0),
"memorylimit" => array("dbcol" => "memorylimit","checknum" => 0),
"minbeforecome" => array("dbcol" => "minbeforecome","checknum" => 0),
"minaftergo" => array("dbcol" => "minaftergo","checknum" => 0),
"updateurl" => array("dbcol" => "updateurl","checknum" => 0),
"tmpdir" => array("dbcol" => "tmpdir","checknum" => 0),
"ftphost" => array("dbcol" => "ftphost","checknum" => 0),
@ -2096,6 +2106,30 @@ class Admin {
}
}
}
if ($name == "minbeforecome") {
$aVal = trim($aVal);
if ($aVal != "-1") {
if (!ctype_digit($aVal)) {
$aVal = "0";
}
$aVal = intval($aVal);
if ($aVal < 0) {
$aVal = 0;
}
}
}
if ($name == "minaftergo") {
$aVal = trim($aVal);
if ($aVal != "-1") {
if (!ctype_digit($aVal)) {
$aVal = "0";
}
$aVal = intval($aVal);
if ($aVal < 0) {
$aVal = 0;
}
}
}
if ($name == "guesttimeout") {
if (is_numeric($aVal)) {
@ -2397,11 +2431,11 @@ class Admin {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$this->writeCsvHeader("datenexport-benutzer.csv");
echo("Eintragsid; Datum ; Benutzerid; Benutzername; Adminrechte; Kellnerrechte;Kuechenrechte; Barrechte; Bereitstellungsrechte; Kassenrechte; Reportrechte; Kassenbonrechte; Angebotsrechte; Beurteilungsrechte; Preisänderungsrechte; Gästerechte; Tageserfassungsrecht; Dashboardrechte; Managerrechte; Aktiviert\n");
echo("Eintragsid; Datum ; Benutzerid; Benutzername; Adminrechte; Kellnerrechte;Kuechenrechte; Barrechte; Bereitstellungsrechte; Kassenrechte; Reportrechte; Kassenbonrechte; Angebotsrechte; Beurteilungsrechte; Preisänderungsrechte; Gästerechte; Tageserfassungsrecht; Dashboardrechte; Zeiterfassung; Zeitmanagement; Managerrechte; Aktiviert\n");
$sql = "SELECT DISTINCT %hist%.id as id,date,";
$sql .= "IFNULL(userid,'') as userid,IFNULL(username,'') as username,is_admin,right_waiter,right_kitchen,right_bar,right_supply,";
$sql .= "right_paydesk,right_statistics,right_bill,right_products,right_rating,right_changeprice,right_customers,right_closing,right_dash,right_manager,active,";
$sql .= "right_paydesk,right_statistics,right_bill,right_products,right_rating,right_changeprice,right_customers,right_closing,right_dash,right_timetracking,right_timemanager,right_manager,active,";
$sql .= "description ";
$sql .= " FROM %hist%, %histuser%, %histactions% ";
$sql .= " WHERE (refid=%histuser%.id) ";
@ -2432,12 +2466,14 @@ class Admin {
$val16 = ($zeile['right_customers'] == '1' ? "Ja" : "Nein");
$val17 = ($zeile['right_closing'] == '1' ? "Ja" : "Nein");
$val18 = ($zeile['right_dash'] == '1' ? "Ja" : "Nein");
$val19 = ($zeile['right_manager'] == '1' ? "Ja" : "Nein");
$val20 = ($zeile['active'] == '1' ? "Ja" : "Nein");
$val21 = $zeile['description'];
$val19 = ($zeile['right_timetracking'] == '1' ? "Ja" : "Nein");
$val20 = ($zeile['right_timemanager'] == '1' ? "Ja" : "Nein");
$val21 = ($zeile['right_manager'] == '1' ? "Ja" : "Nein");
$val22 = ($zeile['active'] == '1' ? "Ja" : "Nein");
$val23 = $zeile['description'];
echo "$val1; $val2; $val3; $val4; $val5; $val6; $val7; $val8; $val9; $val10;";
echo "$val11;$val12;$val13;$val14;$val15;$val16;$val17;$val18;$val19;$val20; $val21\n";
echo "$val11;$val12;$val13;$val14;$val15;$val16;$val17;$val18;$val19;$val20; $val21; $val22; $val23\n";
}
}
@ -2476,13 +2512,13 @@ class Admin {
private function getAllTablesToBackupRestore() {
return array("closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config",
"roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","records","recordsqueue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","times","records","recordsqueue","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","prodimages","products","config",
"roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","records","recordsqueue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","times","records","recordsqueue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"extras","extrasprods","queueextras");
}
@ -3139,6 +3175,11 @@ class Admin {
try {
self::doSql($pdo, "DELETE FROM %customerlog%", null);
self::doSql($pdo, "DELETE FROM %times%", null);
self::doSql($pdo, "DELETE FROM %recordsqueue%", null);
self::doSql($pdo, "DELETE FROM %records%", null);
self::doSql($pdo, "DELETE FROM %hist%", null);
self::doSql($pdo, "DELETE FROM %histprod%", null);
self::doSql($pdo, "DELETE FROM %histconfig%", null);

View File

@ -903,6 +903,9 @@ class Bill {
$stmt->execute(array($aQueueid,$refIdOfStornoEntry));
}
if ($tableid == 0) {
$tableid = null;
}
$sql = "INSERT INTO %records% (date,userid,tableid,action) VALUES(?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($currentTime,$userIdOfStornoUser,$tableid,$recordaction));
$recordid = $pdo->lastInsertId();

View File

@ -345,6 +345,16 @@ $row = $stmt->fetchObject();
return ($row->cashsum);
}
private function getCategoriasBruttoOfClosing($pdo,$closingid) {
$sql = "SELECT SUM(price) as brutto,kind FROM %queue% Q,%bill%,%closing%,%prodtype% T,%products% P ";
$sql .= " WHERE billid=%bill%.id AND %bill%.closingid=%closing%.id AND closingid=? ";
$sql .= " AND Q.productid=P.id AND P.category=T.id ";
$sql .= " GROUP BY kind";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($closingid));
return ($stmt->fetchAll(PDO::FETCH_OBJ));
}
/*
* Get all closings that are requested:
* if month and year is null or empty ==> last 30 closings
@ -375,9 +385,10 @@ $totalSum = $this->getSumOfBillsWithClosingId($pdo,$theId, false);
$cashSum = $this->getSumOfBillsWithClosingId($pdo,$theId, true);
$userSums = $this->getUserGroupedSumOfClosing($pdo, $theId);
$taxessums = $this->getTaxesGroupedOfClosing($pdo,$theId);
$categorysums = $this->getCategoriasBruttoOfClosing($pdo,$theId);
$cashops = $this->getCashOpsOfClosing($pdo,$theId);
$daynameno = date('N', strtotime($closingDate));
$closingEntry = array("id" => $theId, "closingDate" => $closingDate, "daynameno" => $daynameno, "remark" => $remark, "totalsum" => $totalSum, "cashsum" => $cashSum, "usersums" => $userSums, "taxessums" => $taxessums,"cashops" => $cashops);
$closingEntry = array("id" => $theId, "closingDate" => $closingDate, "daynameno" => $daynameno, "remark" => $remark, "totalsum" => $totalSum, "cashsum" => $cashSum, "usersums" => $userSums, "taxessums" => $taxessums, "categorysums" => $categorysums, "cashops" => $cashops);
$resultarray[] = $closingEntry;
}
@ -561,7 +572,7 @@ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Expires: 0");
$csv .= $this->t['ID'][$l] . ";" . $this->t['Date'][$l] . ";" . $this->t['Tablename'][$l] . ";" . $this->t['Prod'][$l] . ";" . $this->t['Option'][$l] . ";" . $this->t['Brutto'][$l] . "($currency);";
$csv .= $this->t['ID'][$l] . ";" . $this->t['Date'][$l] . ";" . $this->t['Tablename'][$l] . ";" . $this->t['Prod'][$l] . ";" . $this->t['Category'][$l] . ";" . $this->t['Option'][$l] . ";" . $this->t['Brutto'][$l] . "($currency);";
$csv .= $this->t['Netto'][$l] . "($currency);";
$csv .= $this->t['Tax'][$l] . ";";
$csv .= $this->t['PayWay'][$l] . ";";
@ -637,6 +648,7 @@ $retValues[] = array (
"tablename" => '',
"paidtime" => $billdate,
"productname" => $this->t['cashaction'][$l], // Kassenaktion
"kind" => "-",
"option" => '',
"price" => $brutto,
"netto" => $netto,
@ -647,18 +659,18 @@ $retValues[] = array (
"status" => $statusTxt,
"ref" => $ref);
if ($doCsvExport || $onlyresultreturn) {
$csv .= "$aBillId; \"$billdate\" ; \"$tablename\" ; \"" . $this->t['cashaction'][$l] . "\" ; \"$brutto\" ; \"$netto\" ; \"$tax\" ; \"$paymentArray[$paymentid]\";$userid; \"$username\"; \"$statusTxt\"; $ref\n";
$csv .= "$aBillId; \"$billdate\" ; \"$tablename\" ; \"" . $this->t['cashaction'][$l] . "\" ; - ; \"\" ; \"$brutto\" ; \"$netto\" ; \"$tax\" ; \"$paymentArray[$paymentid]\";$userid; \"$username\"; \"$statusTxt\"; $ref\n";
}
} else {
$sql = "SELECT DISTINCT productname,price,%queue%.tax as tax,anoption FROM %queue%,%billproducts% WHERE %billproducts%.billid=? AND %billproducts%.queueid=%queue%.id";
$sql = "SELECT DISTINCT productname,price,Q.tax as tax,anoption,kind FROM %queue% Q,%billproducts%,%prodtype%,%products% P WHERE %billproducts%.billid=? AND %billproducts%.queueid=Q.id AND Q.productid=P.id AND P.category=%prodtype%.id";
if ($status == 'x') {
$statusTxt = $this->t["laterCancelled"][$l];
} else if ($status == 's') {
$statusTxt = $this->t["storno"][$l];
} else {
$statusTxt = "";
$sql = "SELECT productname,anoption,paidtime,price,tax FROM %queue% WHERE billid=?";
$sql = "SELECT productname,anoption,paidtime,price,Q.tax as tax,kind FROM %queue% Q,%prodtype%,%products% P WHERE billid=? AND Q.productid=P.id AND P.category=%prodtype%.id";
}
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
@ -668,6 +680,10 @@ foreach ($result as $zeile) {
$productname = $zeile['productname'];
$option = $zeile['anoption'];
$tax = $zeile['tax'];
$kind = "Speise";
if ($zeile['kind'] == 1) {
$kind = "Getraenk";
}
$paidtime = ($billdate == null ? "" : $billdate) ;
$price = ($status == 's' ? 0.0-floatval($zeile['price']) : $zeile['price']);
@ -682,6 +698,7 @@ $retValues[] = array (
"tablename" => $tablename,
"paidtime" => $paidtime,
"productname" => $productname,
"kind" => $kind,
"option" => $option,
"price" => $price,
"netto" => $netto,
@ -694,7 +711,7 @@ $retValues[] = array (
$productname = str_replace('"','""',$productname);
$option = str_replace('"','""',$option);
if ($doCsvExport || $onlyresultreturn) {
$csv .= "$aBillId; \"$paidtime\" ; \"$tablename\" ; \"$productname\" ; \"$option\" ; \"$price\" ; \"$netto\" ; \"$formattedtax\" ; \"$paymentArray[$paymentid]\"; $userid; \"$username\"; \"$statusTxt\"; $ref\n";
$csv .= "$aBillId; \"$paidtime\" ; \"$tablename\" ; \"$productname\" ; \"$kind\" ; \"$option\" ; \"$price\" ; \"$netto\" ; \"$formattedtax\" ; \"$paymentArray[$paymentid]\"; $userid; \"$username\"; \"$statusTxt\"; $ref\n";
}
}
}

View File

@ -20,6 +20,7 @@ require_once ('workreceipts.php');
require_once ('utilities/Logger.php');
require_once ('utilities/roles.php');
require_once ('guestsync.php');
require_once ('timetracking.php');
$module = $_GET["module"];
$command = $_GET["command"];
@ -79,6 +80,8 @@ if ($module == 'admin') {
$updater->handleCommand($command);
} else if ($module == 'guestsync') {
Guestsync::handleCommand($command);
} else if ($module == 'timetracking') {
Timetracking::handleCommand($command);
}

View File

@ -117,6 +117,7 @@ class DbUtils {
$out = str_replace("%roles%",$prefix . 'roles', $out);
$out = str_replace("%recordsqueue%",$prefix . 'recordsqueue', $out);
$out = str_replace("%records%",$prefix . 'records', $out);
$out = str_replace("%times%",$prefix . 'times', $out);
return (str_replace("%prodtype%",$prefix . 'prodtype',$out));
}
@ -160,6 +161,8 @@ class DbUtils {
array("col" => 'right_manager', "hist" => 1, "new" => 'rManager', "update" => 'rManager'),
array("col" => 'right_closing', "hist" => 1, "new" => 'rClosing', "update" => 'rClosing'),
array("col" => 'right_dash', "hist" => 1, "new" => 'rDash', "update" => 'rDash'),
array("col" => 'right_timetracking',"hist" => 1, "new" => 'rTimetracking', "update" => 'rTimetracking'),
array("col" => 'right_timemanager', "hist" => 1, "new" => 'rTimemanager', "update" => 'rTimemanager'),
array("col" => 'active', "hist" => 1, "new" => null ,"default" => 1, "update" => null),
array("col" => 'lastmodule', "hist" => 0, "new" => null ,"default" => null, "update" => null),
array("col" => 'ordervolume', "hist" => 0, "new" => null ,"default" => null, "update" => null),

View File

@ -27,7 +27,7 @@ if (isset($_POST["cmd"])) {
if (strlen($status) > 150) {
$status = substr($status, 0,149);
}
$version = "1.4.18";
$version = "1.5.0";
$arr = array("cmd" => $cmd,"fct" => $fct, "xhr" => $xhr,"errormsg" => $errormsg,"status" => $status,"version" => $version,"phpversion" => $phpversion);
} else {

View File

@ -41,8 +41,8 @@ class Products {
$cmdArray = array('showDbProducts', 'getMenuLevelUp', 'applySingleProdData', 'createExtra', 'applyExtra', 'upExtra', 'delExtra','sortup','sortdown', 'delproduct',
'reassign', 'applyType', 'delType', 'getSingleProdData', 'getSingleTypeData', 'getPriceLevelInfo','setPriceLevelInfo', 'createProduct','createProdType',
'addGeneralComment','changeGeneralComment','delGeneralComment','upGeneralComment','downGeneralComment','sortProdAlpha','getOnlyAllProds','loadprodimage',
'deleteImageProdAssignment');
'addGeneralComment','changeGeneralComment','delGeneralComment','upGeneralComment','downGeneralComment','sortProdAlpha','getOnlyAllProds','loadprodimage','loadfullprodimageset',
'deleteImageProdAssignment','cleanprodimagestable','getkeynames','assignProdImageToKey','prodimghmlexport');
if (in_array($command, $cmdArray)) {
if (!($this->userrights->hasCurrentUserRight('right_products'))) {
if ($command == 'createProdType') {
@ -153,6 +153,8 @@ class Products {
$this->deleteImageProdAssignment($_POST['prodid']);
} else if ($command == 'loadprodimage') {
$this->loadprodimage();
} else if ($command == 'loadfullprodimageset') {
$this->loadfullprodimageset();
} else if ($command == 'getprodimage') {
if ($_GET['prodid']) {
$size = 'h';
@ -165,6 +167,14 @@ class Products {
}
} else if ($command == 'prodimghmlexport') {
self::exportImgHml();
} else if ($command == 'cleanprodimagestable') {
$pdo = DbUtils::openDbAndReturnPdoStatic();
self::cleanProdImagesTable($pdo);
echo json_encode(array("status" => "OK"));
} else if ($command == 'assignProdImageToKey') {
self::assignProdImageToKey($_POST['prodid'],$_POST['prodimageid']);
} else if ($command == 'getkeynames') {
self::getkeynames();
} else {
echo "Command not supported.";
}
@ -191,10 +201,19 @@ class Products {
);
public static function exportImgHml() {
$file_name = "bilddaten.ocs";
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=$file_name");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Expires: 0");
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT imgh,imgm,imgl from %prodimages% where id='24'";
$sql = "SELECT id,keyname,imgh,imgm,imgl from %prodimages% order by id";
$result = CommonUtils::fetchSqlAll($pdo, $sql, null);
echo $result[0]['imgh'] . ";" . $result[0]['imgm'] . ";" . $result[0]['imgl'];
for ($i=0;$i<count($result);$i++) {
echo ($i+1) . ";" . $result[$i]['keyname'] . ';' . $result[$i]['imgh'] . ";" . $result[$i]['imgm'] . ";" . $result[$i]['imgl'] . "\n";
}
}
function getDateValueAsBoolInterpretatedIcon($aValue) {
if ($aValue != '0' ) {
@ -1092,7 +1111,6 @@ class Products {
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$this->sorter->delproduct($pdo, $prodid);
self::cleanProdImagesTable($pdo);
$pdo->commit();
echo json_encode("OK");
@ -1213,6 +1231,25 @@ class Products {
return $retStr;
}
private static function getkeynames() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT id,keyname FROM %prodimages% ORDER BY keyname";
$result = CommonUtils::fetchSqlAll($pdo, $sql, null);
echo json_encode(array("status" => "OK","msg" => $result));
}
private static function assignProdImageToKey($prodid,$prodimageid) {
try {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "UPDATE %products% SET prodimageid=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($prodimageid,$prodid));
$ret = array("status" => "OK","prodid" => $prodid);
echo json_encode($ret);
} catch (Exception $ex) {
echo json_encode(array("status" => "ERROR","msg" => $ex->getMessage()));
}
}
public static function cleanProdImagesTable($pdo) {
$sql = "UPDATE %products% SET prodimageid=? WHERE removed is not null";
CommonUtils::execSql($pdo, $sql, array(null));
@ -1307,7 +1344,6 @@ class Products {
try{
$sql = "UPDATE %products% SET prodimageid=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array(null,$prodid));
self::cleanProdImagesTable($pdo);
HistFiller::updateProdInHist($pdo, $prodid);
$pdo->commit();
} catch (Exception $ex) {
@ -1349,15 +1385,29 @@ class Products {
$pdo->beginTransaction();
try {
$sql = "INSERT INTO %prodimages% (imgh,imgm,imgl) VALUES(?,?,?)";
CommonUtils::execSql($pdo, $sql, array($imageBaseh_64,$imageBasem_64,$imageBasel_64));
$prodimageid = $pdo->lastInsertId();
$sql = "SELECT SUBSTRING(REPLACE(longname,';','_'),1,30) as longname FROM %products% WHERE id=?";
$prodnameResult = CommonUtils::fetchSqlAll($pdo, $sql, array($prodid));
$keyname = "Bild_" . $prodid;
if (count($prodnameResult) > 0) {
$keyname = $prodnameResult[0]['longname'];
}
$sql = "UPDATE %products% SET prodimageid=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($prodimageid,$prodid));
$sql = "SELECT id FROM %prodimages% WHERE keyname=?";
$res = CommonUtils::fetchSqlAll($pdo, $sql, array($keyname));
if (count($res) > 0) {
$sql = "UPDATE %prodimages% SET imgh=?,imgm=?,imgl=? WHERE keyname=?";
CommonUtils::execSql($pdo, $sql, array($imageBaseh_64,$imageBasem_64,$imageBasel_64,$keyname));
CommonUtils::execSql($pdo, "UPDATE %products% SET prodimageid=? WHERE id=?", array($res[0]["id"],$prodid));
} else {
$sql = "INSERT INTO %prodimages% (keyname,imgh,imgm,imgl) VALUES(?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($keyname,$imageBaseh_64,$imageBasem_64,$imageBasel_64));
$prodimageid = $pdo->lastInsertId();
$sql = "UPDATE %products% SET prodimageid=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($prodimageid,$prodid));
}
HistFiller::updateProdInHist($pdo,$prodid);
self::cleanProdImagesTable($pdo);
} catch (Exception $ex) {
echo json_encode(array("status" => "ERROR","msg" => $ex->getMessage()));
$pdo->rollBack();
@ -1368,6 +1418,60 @@ class Products {
echo json_encode(array("status" => "OK"));
}
function loadfullprodimageset() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
if ($_FILES['textfile']['error'] != UPLOAD_ERR_OK
&& is_uploaded_file($_FILES['textfile']['tmp_name'])) {
echo json_encode(array("status" => "ERROR","msg" => "Kann Datei nicht laden."));
exit();
}
if(!file_exists($_FILES['textfile']['tmp_name'])) {
echo json_encode(array("status" => "ERROR","msg" => "Datei existiert nicht. Bitte PHP-Variablen upload_max_filesize und post_max_size_checken."));
exit();
}
if(!is_uploaded_file($_FILES['textfile']['tmp_name'])) {
echo json_encode(array("status" => "ERROR","msg" => "Datei konnte nicht hochgeladen werden."));
exit();
}
$file = $_FILES['textfile']['tmp_name'];
$handle = fopen ($file, "r");
$pdo->beginTransaction();
try {
while (!feof($handle)) {
$textline = trim(fgets($handle));
if ($textline != "") {
$parts = explode(';', $textline);
$keyname = $parts[1];
$sql = "SELECT id FROM %prodimages% WHERE keyname=?";
$res = CommonUtils::fetchSqlAll($pdo, $sql, array($keyname));
if (count($res) > 0) {
$sql = "UPDATE %prodimages% SET imgh=?,imgm=?,imgl=? WHERE keyname=?";
CommonUtils::execSql($pdo, $sql, array($parts[2],$parts[3],$parts[4],$keyname));
} else {
$sql = "INSERT INTO %prodimages% (keyname,imgh,imgm,imgl) VALUES(?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($keyname,$parts[2],$parts[3],$parts[4]));
}
}
}
fclose ($handle);
$pdo->commit();
} catch (Exception $ex) {
echo json_encode(array("status" => "ERROR","msg" => $ex->getMessage()));
$pdo->rollBack();
exit();
}
echo json_encode(array("status" => "OK"));
}
function sortProdAlpha($typeid) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$pdo->beginTransaction();

330
webapp/php/timetracking.php Normal file
View File

@ -0,0 +1,330 @@
<?php
require_once ('dbutils.php');
require_once ('commonutils.php');
require_once ('queuecontent.php');
class Timetracking {
private static $ACTION_COME = 1;
private static $ACTION_GO = 2;
private static $rights = array(
"come" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timetracking","timemanager")),
"go" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timetracking","timemanager")),
"getusers" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timetracking","timemanager")),
"getoverview" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timetracking","timemanager")),
"delentry" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timemanager")),
"newadmincome" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timemanager")),
"newadmingo" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timemanager")),
"exportTimesCsv" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timemanager"))
);
private static function checkRights($command) {
if (session_id() == '') {
session_start();
}
if (!array_key_exists($command, self::$rights)) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_NOT_FOUND, "msg" => ERROR_COMMAND_NOT_FOUND_MSG));
return false;
}
$cmdRights = self::$rights[$command];
if ($cmdRights["loggedin"] == 1) {
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
return false;
}
}
if ($cmdRights["isadmin"] == 1) {
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
return false;
} else {
if ($_SESSION['is_admin'] == false) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_NOT_ADMIN, "msg" => ERROR_COMMAND_NOT_ADMIN_MSG));
return false;
}
}
}
if (!is_null($cmdRights["rights"])) {
foreach ($cmdRights["rights"] as $aRight) {
if ($aRight == 'timetracking') {
if (($_SESSION['is_admin']) || ($_SESSION['right_timetracking'])) {
return true;
}
} else if ($aRight == 'timemanager') {
if ($_SESSION['right_timemanager']) {
return true;
}
}
}
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
return false;
}
return true;
}
public static function handleCommand($command) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
if (!self::checkRights($command)) {
return false;
}
$ret = array("status" => "ERROR", "msg" => "Falsches Kommando");
if ($command == 'come') {
$ret = self::come($pdo,$_POST['comment']);
} else if ($command == 'go') {
$ret = self::go($pdo,$_POST['comment']);
} else if ($command == 'getusers') {
$ret = self::getusers($pdo);
} else if ($command == 'getoverview') {
$ret = self::getoverview($pdo,$_POST['userid'],$_POST['startday'],$_POST['startmonth'],$_POST['startyear'],$_POST['endday'],$_POST['endmonth'],$_POST['endyear']);
} else if ($command == 'delentry') {
$ret = self::delentry($pdo,$_POST['id']);
} else if ($command == 'newadmincome') {
$ret = self::newadmincome($pdo,$_POST['day'],$_POST['month'],$_POST['year'],$_POST['userid'],$_POST['time'],$_POST['comment']);
} else if ($command == 'newadmingo') {
$ret = self::newadmingo($pdo,$_POST['day'],$_POST['month'],$_POST['year'],$_POST['userid'],$_POST['time'],$_POST['comment']);
} else if ($command == 'exportTimesCsv') {
self::exportTimesCsv($pdo,$_GET['startMonth'],$_GET['startYear'],$_GET['endMonth'],$_GET['endYear']);
return;
}
echo json_encode($ret);
}
private static function come($pdo,$comment) {
$minBeforeCome = intval(CommonUtils::getConfigValue($pdo, 'minbeforecome', 0));
date_default_timezone_set(DbUtils::getTimeZone());
$now = date('Y-m-d H:i:s', strtotime("-$minBeforeCome minutes"));
return self::insertAction($pdo, self::$ACTION_COME, $comment,$now);
}
private static function go($pdo,$comment) {
$minAfterGo = intval(CommonUtils::getConfigValue($pdo, 'minaftergo', 0));
date_default_timezone_set(DbUtils::getTimeZone());
$now = date('Y-m-d H:i:s', strtotime("+$minAfterGo minutes"));
return self::insertAction($pdo, self::$ACTION_GO, $comment,$now);
}
private static function insertAction($pdo,$action,$comment,$dateTimeToRegister) {
try {
if (is_null($comment)) {
$comment = "";
}
$userid = $_SESSION['userid'];
$sql = "INSERT INTO %times% (date,userid,action,comment) VALUES(?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($dateTimeToRegister,$userid,$action,$comment));
return array("status" => "OK");
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private static function getusers($pdo) {
$ownuserid = $_SESSION['userid'];
$username = $_SESSION['currentuser'];
if ($_SESSION['right_timemanager']) {
$sql = "SELECT id,username FROM %user% WHERE active=?";
$users = CommonUtils::fetchSqlAll($pdo, $sql, array(1));
$mayManageTimes = 1;
} else {
$sql = "SELECT id,username FROM %user% WHERE active=? AND id=?";
$users = CommonUtils::fetchSqlAll($pdo, $sql, array(1,$ownuserid));
$mayManageTimes = 0;
}
return array("status" => "OK","msg" => array("ownuserid" => $ownuserid, "users" => $users, "username" => $username, "maymanageusers" => $mayManageTimes));
}
private static function getoverview($pdo,$userid,$startday,$startmonth,$startyear,$endday,$endmonth,$endyear) {
$timesOfSelectedUser = self::getoverviewofuser($pdo, $userid, $startday, $startmonth, $startyear, $endday, $endmonth, $endyear);
if ($_SESSION['right_timemanager']) {
$sql = "SELECT id,username FROM %user% WHERE active=?";
$users = CommonUtils::fetchSqlAll($pdo, $sql, array(1));
$workTimes = array();
foreach($users as $aUser) {
$uid = $aUser["id"];
$uname = $aUser["username"];
$times = self::getoverviewofuser($pdo, $uid, $startday, $startmonth, $startyear, $endday, $endmonth, $endyear);
if (($times["status"] == "OK") && ($times["msg"]["totalduration"]["status"] == "OK")) {
$workMinutesOfUser = $times["msg"]["totalduration"]["minutes"];
$workTimes[] = array("userid" => $uid,"username" => $uname,"minutes" => $workMinutesOfUser);
} else {
$workTimes[] = array("userid" => $uid,"username" => $uname,"minutes" => (-1));
}
}
$timesOfSelectedUser["allusertimes"] = $workTimes;
}
return $timesOfSelectedUser;
}
private static function getoverviewofuser($pdo,$userid,$startday,$startmonth,$startyear,$endday,$endmonth,$endyear) {
$ownuserid = $_SESSION['userid'];
if ($ownuserid != $userid) {
if (!$_SESSION['right_timemanager']) {
return array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG);
}
}
$sday = sprintf("%02s", $startday);
$smonth = sprintf("%02s", $startmonth);
$startDate = "$startyear-$smonth-$sday";
$eday = sprintf("%02s", $endday);
$emonth = sprintf("%02s", $endmonth);
$endDate = "$endyear-$emonth-$eday";
$begin = new DateTime( $startDate );
$end = new DateTime( $endDate );
$interval = DateInterval::createFromDateString('1 day');
$end->add($interval);
$period = new DatePeriod($begin, $interval, $end);
$sql = "SELECT id,date,TIME(date) as thetime,HOUR(date) as timehour,MINUTE(date) as timemin,action,comment FROM %times% WHERE userid=? AND DATE(date)=? ORDER BY date";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$totalWorkTime = 0;
$timesCalcOk = true;
$times = array();
foreach ( $period as $dt ) {
$aDate = $dt->format( "Y-m-d\n" );
$stmt->execute(array($userid,$aDate));
$timesOfDate = $stmt->fetchAll(PDO::FETCH_ASSOC);
$workMinutes = self::calcWorkTime($timesOfDate);
if ($workMinutes["status"] == "OK") {
$totalWorkTime += $workMinutes["minutes"];
} else {
$timesCalcOk = false;
}
$daynameno = date('N', strtotime($aDate));
$times[] = array("dayno" => $daynameno, "date" => $aDate, "timesofdate" => $timesOfDate,"workminutes" => $workMinutes);
}
if ($timesCalcOk) {
$totalWorkMinutes = array("status" => "OK","minutes" => $totalWorkTime);
} else {
$totalWorkMinutes = array("status" => "ERROR","minutes" => $totalWorkTime);
}
return array("status" => "OK","msg" => array("times" => $times, "totalduration" => $totalWorkMinutes));
}
private static function calcWorkTime($timesOfDay) {
$workDuration = 0;
if (count($timesOfDay) == 0) {
return array("status" => "OK","minutes" => 0);
}
$currentEntry = $timesOfDay[0];
$entryStatus = $currentEntry['action'];
if ($entryStatus == self::$ACTION_COME) {
$waitstatus = self::$ACTION_COME;
} else {
$lastCome = 0;
$waitstatus = self::$ACTION_GO;
}
for ($i=0;$i<count($timesOfDay);$i++) {
$currentEntry = $timesOfDay[$i];
$entryStatus = $currentEntry['action'];
$hour = intval($currentEntry['timehour']);
$min = intval($currentEntry['timemin']);
$minuteOfDay = ($hour * 60 + $min);
if ($entryStatus != $waitstatus) {
return array("status" => "ERROR","minutes" => $workDuration);
} else {
if ($entryStatus == self::$ACTION_COME) {
$lastCome = $minuteOfDay;
$waitstatus = self::$ACTION_GO;
} else {
$workDuration += $minuteOfDay - $lastCome;
$waitstatus = self::$ACTION_COME;
}
if (($i+1) == count($timesOfDay)) {
if ($waitstatus == self::$ACTION_GO) {
$workDuration += (24*60 - $minuteOfDay);
return array("status" => "OK","minutes" => $workDuration);
}
}
}
}
return array("status" => "OK","minutes" => $workDuration);
}
private static function delentry($pdo,$timeid) {
try {
$sql = "DELETE FROM %times% WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($timeid));
return array("status" => "OK");
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private static function newadmincome($pdo,$day,$month,$year,$userid,$time,$comment) {
return self::createAdminComeGoEntry($pdo, $day, $month, $year, $userid, $time, $comment, self::$ACTION_COME);
}
private static function newadmingo($pdo,$day,$month,$year,$userid,$time,$comment) {
return self::createAdminComeGoEntry($pdo, $day, $month, $year, $userid, $time, $comment, self::$ACTION_GO);
}
private static function parseTime($timeStr) {
$parts = explode(':',$timeStr);
if (count($parts) != 2) {
return array(false,0,0);
}
if (!is_numeric($parts[0]) || !is_numeric($parts[1])) {
return array(false,0,0);
}
$hour = sprintf("%02s", $parts[0]);
$min = sprintf("%02s", $parts[1]);
return array(true,$hour,$min);
}
private static function createAdminComeGoEntry($pdo,$day,$month,$year,$userid,$time,$comment,$action) {
$timevalues = self::parseTime($time);
if (!$timevalues[0]) {
return array("status" => "ERROR","msg" => "Falsches Uhrzeitformat");
}
try {
$day = sprintf("%02s", $day);
$month = sprintf("%02s", $month);
$hour = $timevalues[1];
$min = $timevalues[2];
$date = "$year-$month-$day $hour:$min:00";
$sql = "INSERT INTO %times% (date,userid,action,comment) VALUES(?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($date,$userid,$action,$comment));
return array("status" => "OK");
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private static function exportTimesCsv($pdo,$startMonth,$startYear,$endMonth,$endYear) {
$startMonth = sprintf("%02s", $startMonth);
$endMonth = sprintf("%02s", $endMonth);
$startDate = $startYear . "-" . $startMonth . "-01";
$endDate = $endYear . "-" . $endMonth . "-01";
$lastdayOfMonth = date("t", strtotime($endDate));
$endDate = $endYear . "-" . $endMonth . "-" . $lastdayOfMonth;
$sql = "SELECT date,userid,username,IF(action=1,'Kommen','Gehen') as action,comment FROM %times% t,%user% u WHERE t.userid=u.id AND DATE(date) >= ? AND DATE(date) <= ? ORDER BY date";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($startDate,$endDate));
$txt = "Zeitstempel;Benutzer-ID;Benutzername;Aktion;Kommentar\n";
foreach($result as $r) {
$txt .= $r['date'] . ";" . $r['userid'] .';"' . $r['username'] . '";"' . $r['action'] . '";"' . $r['comment'] . '";' . "\n";
}
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=\"ordersprinter-zeiterfassung.csv\"");
header("Cache-Control: max-age=0");
echo $txt;
}
}

View File

@ -4,6 +4,7 @@ $this->t = array(
"Tablename" => array("Tisch","Table","Mesa"),
"Date" => array("Zahlungsdatum","Pay date","Fecha de pago"),
"Prod" => array("Produkt","Product","Producto"),
"Category" => array("Kategorie","Category","Categoria"),
"Option" => array("Bemerkung","Comment","Comentario"),
"Brutto" => array("Bruttopreis","Gross","Bruto"),
"Netto" => array("Nettopreis","Net","Neto"),

View File

@ -113,6 +113,7 @@ class Basedb {
$this->doSQLcatch($pdo, "drop TABLE `%billproducts%`");
$this->doSQLcatch($pdo, "drop TABLE `%recordsqueue%`");
$this->doSQLcatch($pdo, "drop TABLE `%records%`");
$this->doSQLcatch($pdo, "drop TABLE `%times%`");
$this->doSQLcatch($pdo, "drop TABLE `%queue%`");
$this->doSQLcatch($pdo, "drop TABLE `%printjobs%`");
$this->doSQLcatch($pdo, "drop TABLE `%customerlog%`");
@ -774,6 +775,21 @@ class Basedb {
$stmt->execute();
}
function createTimesTable($pdo) {
$sql = "
CREATE TABLE `%times%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`date` DATETIME NOT NULL ,
`userid` INT (10) NULL,
`action` INT(1) NULL,
`comment` VARCHAR(200) NULL,
FOREIGN KEY (userid) REFERENCES %user%(id)
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
}
function getPrivkey($pdo) {
$sql = "SELECT signature FROM %work% WHERE item=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
@ -1126,12 +1142,12 @@ class Basedb {
$file = "../customer/prodimages.txt";
$handle = fopen ($file, "r");
$sql = "INSERT INTO %prodimages% (imgh,imgm,imgl) VALUES(?,?,?)";
$sql = "INSERT INTO %prodimages% (keyname,imgh,imgm,imgl) VALUES(?,?,?,?)";
while (!feof($handle)) {
$textline = trim(fgets($handle));
if ($textline != "") {
$parts = explode(';', $textline);
CommonUtils::execSql($pdo, $sql, array($parts[1],$parts[2],$parts[3]));
CommonUtils::execSql($pdo, $sql, array($parts[1],$parts[2],$parts[3],$parts[4]));
}
}

View File

@ -16,10 +16,10 @@ class Roles {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Admin",1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0));
$stmt->execute(array("Admin",1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1));
$id = $pdo->lastInsertId();
return $id;
}
@ -28,10 +28,10 @@ class Roles {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Manager",0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1));
$stmt->execute(array("Manager",0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1));
$id = $pdo->lastInsertId();
return $id;
}
@ -40,10 +40,10 @@ class Roles {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Manager",0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1));
$stmt->execute(array("Manager",0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1));
$id = $pdo->lastInsertId();
return $id;
}
@ -52,10 +52,10 @@ class Roles {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Kellner",0,1,1,1,1,1,0,1,0,0,1,0,1,0,1,0));
$stmt->execute(array("Kellner",0,1,1,1,1,1,0,1,0,0,1,0,1,0,1,0,1,0));
$id = $pdo->lastInsertId();
return $id;
}
@ -64,10 +64,10 @@ class Roles {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Kellner",0,1,0,0,0,1,0,1,0,0,1,0,1,0,1,0));
$stmt->execute(array("Kellner",0,1,0,0,0,1,0,1,0,0,1,0,1,0,1,0,1,0));
$id = $pdo->lastInsertId();
return $id;
}
@ -76,10 +76,10 @@ class Roles {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Koch",0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0));
$stmt->execute(array("Koch",0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0));
$id = $pdo->lastInsertId();
return $id;
}

View File

@ -858,6 +858,37 @@ class Version {
}
}
public static function upd_1418_1500($pdo, $prefix, $dbname) {
try {
self::execSql($pdo, "ALTER TABLE %roles% ADD right_timetracking INT(1) NULL AFTER right_dash");
self::execSql($pdo, "ALTER TABLE %roles% ADD right_timemanager INT(1) NULL AFTER right_timetracking");
self::execSql($pdo, "ALTER TABLE %histuser% ADD right_timetracking INT(1) NULL AFTER right_dash");
self::execSql($pdo, "ALTER TABLE %histuser% ADD right_timemanager INT(1) NULL AFTER right_timetracking");
self::execSqlWithParam($pdo, "UPDATE %roles% SET right_timetracking=?,right_timemanager=?", array(1,0));
self::execSqlWithParam($pdo, "UPDATE %histuser% SET right_timetracking=?,right_timemanager=?", array(1,0));
self::execSqlWithParam($pdo, "UPDATE %roles% SET right_timemanager=? WHERE right_manager=? OR is_admin=?", array(1, 1, 1));
self::execSqlWithParam($pdo, "UPDATE %histuser% SET right_timemanager=? WHERE right_manager=? OR is_admin=?", array(1, 1, 1));
self::execSql($pdo, "OPTIMIZE TABLE %roles%");
self::execSql($pdo, "OPTIMIZE TABLE %histuser%");
$basedb = new BaseDb(); $basedb->createTimesTable($pdo);
self::insertOrUpdateConfigItem($pdo, 'minbeforecome', '0');
self::insertOrUpdateConfigItem($pdo, 'minaftergo', '0');
self::execSql($pdo, "ALTER TABLE %config% MODIFY name VARCHAR(30) NULL");
$sql = "ALTER TABLE %config% ADD INDEX tconfig (name)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
self::execSql($pdo, "ALTER TABLE %prodimages% ADD keyname VARCHAR(30) NULL AFTER id");
self::execSql($pdo, "UPDATE %prodimages% set keyname=CONCAT('Bild_',id)");
return array(true);
} catch (PDOException $e) {
return array(false,$e);
}
}
public static $updateOrder = array(
"1.3.0" => array("upd_1300_1301","1.3.1"),
"1.3.1" => array("upd_1301_1302","1.3.2"),
@ -904,7 +935,8 @@ class Version {
"1.4.14" => array("upd_1414_1415","1.4.15"),
"1.4.15" => array("upd_1415_1416","1.4.16"),
"1.4.16" => array("upd_1416_1417","1.4.17"),
"1.4.17" => array("upd_1417_1418","1.4.18")
"1.4.17" => array("upd_1417_1418","1.4.18"),
"1.4.18" => array("upd_1418_1500","1.5.0")
);
// RE;* also for install process no check is required

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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -78,6 +78,9 @@ var PROD_APPLIED = ["Aktion wurde durchgeführt.","Action was performed.","Acci
var PROD_TYPEPROPS = ["Kategorieeigenschaften ein-/ausblenden","Show/hide properties of type","Mostrar o ocultar characterística de typo"];
var PROD_CATS_LIST = ["Unterkategorien","Sub Categories","Categorias contenidas"];
var PROD_PRODUCTS_LIST = ["Produkte","Products","Productos"];
var PROD_SET_TITLE = ["Gesamtes Bildmaterial","Full image set","Todos los imagenes"];
var PROD_CLEAN_PRODIMAGES = ["Entferne nicht zugewiesene Bilder in der DB","Remove unassigned images from database","Removar imagenes non usados"];
var PROD_DOWNLOAD_PRODIMAGES = ["Download gesamtes Bildmaterial","Download complete Image Set","Download todos los imagenes"];
// this is the maximal price that a product may cost
var MAX_PRICE = 999.99;
@ -99,6 +102,7 @@ var audiofiles;
var p_allextras = [];
var p_currenttypeid = null;
var keynames = [];
function setLanguage(language) {
lang = language;
@ -107,6 +111,9 @@ function setLanguage(language) {
$("#extrasheader").html(PROD_EXTRAS[lang]);
$("#prodimagesheader").html(PROD_PRODIMAGES[lang]);
$("#menuheader").html(PROD_MENU[lang]);
$("#headeroffullprodset").html(PROD_SET_TITLE[lang]);
$("#cleantxt").html(PROD_CLEAN_PRODIMAGES[lang]);
$("#downloadprodimagestxt").html(PROD_DOWNLOAD_PRODIMAGES[lang]);
}
function getAudioFiles() {
@ -137,6 +144,17 @@ function setLanguage(language) {
}
function getProdsForProdsImageArea() {
doAjax("GET","php/contenthandler.php?module=products&command=getkeynames",null,insertkeynamesAndContinue,null);
}
function insertkeynamesAndContinue(answer) {
if (answer.status == "OK") {
keynames = answer.msg;
getAllIndividualProdsForProdsImageArea();
} else {
alert("Fehler: " + answer.msg);
}
}
function getAllIndividualProdsForProdsImageArea() {
doAjax("GET","php/contenthandler.php?module=products&command=getOnlyAllProds",null,fillProdImagesArea,null);
}
function fillProdImagesArea(answer) {
@ -167,6 +185,13 @@ function setLanguage(language) {
txt += '<a href="#" data-role="button" data-icon="delete" data-theme="d" data-ajax="false" id="prodimagedelete_' + prodid + '" class="deleteprodimage" >Bildzuordnung entfernen</a> '
txt += '<select id="prodimageassignbox_' + prodid +'" data-theme="e" class="prodimageassbox">';
txt += '<option value="0">&nbsp;</option>';
keynames.forEach(function(aKey,index) {
txt += '<option value="' + aKey.id + '">' + aKey.keyname + '</option>';
});
txt += '</select>';
txt += "</div>";
return txt;
@ -188,12 +213,34 @@ function setLanguage(language) {
e.preventDefault();
var prodid = this.id.split('_')[1];
doAjax("POST","php/contenthandler.php?module=products&command=deleteImageProdAssignment",{prodid:prodid},createProdEntryArea,"Aufhebnung der Zuordnung ist fehlgeschlagen");
doAjax("POST","php/contenthandler.php?module=products&command=deleteImageProdAssignment",{prodid:prodid},createProdEntryArea,"Aufhebung der Zuordnung ist fehlgeschlagen");
});
$(".prodimageassbox").off("change").on("change", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var id = this.id;
var prodid = id.split('_')[1];
var prodimageid = $("#" + id).val();
if (prodimageid != 0) {
var data = {
prodid: prodid,
prodimageid: prodimageid
};
doAjax("POST","php/contenthandler.php?module=products&command=assignProdImageToKey",data,createProdEntryAreaOfId,"Zuordnung ist fehlgeschlagen");
}
});
}
function createProdEntryAreaOfId(answer) {
if (answer.status == "OK") {
createProdEntryArea(answer.prodid);
} else {
alert("Fehler: " + answer.msg);
}
}
function createProdEntryArea(prodid) {
updateProdImagePart(prodid)
updateProdImagePart(prodid);
var txt = "";
txt = '&nbsp;&nbsp;<div id="restorefilearea_' + prodid + '" >Upload</div>';
txt += '<div id="restorestatus_' + prodid + '" ></div>';
@ -209,6 +256,37 @@ function setLanguage(language) {
$("#prodimageentry_" + prodid + " .imagepart img").attr("src", src);
}
function initFullProdimageSetFileUpload() {
var settings = {
url: "php/contenthandler.php?module=products&command=loadfullprodimageset",
method: "POST",
allowedTypes:"ocs,txt",
fileName: "textfile",
multiple: false,
uploadQueueOrder: 'replace',
showFileCounter: false,
dragDropStr: "<span>Datei</span>",
extErrorStr: " ist nicht erlaubt. Erlaubte Dateiendung: ",
onSuccess:function(files,data,xhr)
{
var answer = jQuery.parseJSON(data);
if (answer.status != "OK") {
alert("Upload war nicht erfolgreich: " + answer.msg);
} else {
alert("Import war erfolgreich.");
getProdsForProdsImageArea();
}
},
onError: function(files,status,errMsg)
{
$("#uploadprodsetstatus").html("<font color='red'>Upload fehlgeschlagen</font>");
}
};
$("#uploadprodsetfilearea").uploadFile(settings);
$("#uploadprodsetfilearea").trigger("create");
}
function initRestoreFileUpload(prodid) {
var settings = {
url: "php/contenthandler.php?module=products&command=loadprodimage&prodid=" + prodid,
@ -228,13 +306,13 @@ function setLanguage(language) {
} else {
//alert("Import war erfolgreich.");
updateProdImagePart(prodid)
}
};
},
onError: function(files,status,errMsg)
{
$("#restorestatus_" + prodid).html("<font color='red'>Upload fehlgeschlagen</font>");
}
}
};
$("#restorefilearea_" + prodid).uploadFile(settings);
$("#restorefilearea_" + prodid).trigger("create");
@ -754,7 +832,7 @@ function setLanguage(language) {
usekitchen: useKit,
usesupply: useSupply,
printer: printer
}
};
doAjax("POST","php/contenthandler.php?module=products&command=applyType",data,null,"Fehler Kategorieänderung");
}
}
@ -781,7 +859,7 @@ function setLanguage(language) {
if (result.status != "OK") {
alert("Fehler aufgetreten - bitte Aktion wiederholen!");
} else {
setTimeout(function(){document.location.href = "products.html"},250);
setTimeout(function(){document.location.href = "products.html";},250);
}
}
@ -1049,8 +1127,30 @@ function setLanguage(language) {
$("#radio-pricelevel-c").off("click").on("click", function (e) {
setPriceLevel(3);
});
$("#cleanprodimageindb").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
// cleanprodimagestable
doAjax("POST","php/contenthandler.php?module=products&command=cleanprodimagestable",null,handleCleanProcess,"Extras");
});
$("#downloadprodimages").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
window.location.href = "php/contenthandler.php?module=products&command=prodimghmlexport";
});
}
function handleCleanProcess(answer) {
if (answer.status == "OK") {
alert("OK");
getProdsForProdsImageArea();
} else {
alert("Fehler: " + answer.msg);
}
}
function getGeneralConfigItems() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItems", null, insertDecPointStartRest, "Fehler Konfigurationsdaten");
}
@ -1069,6 +1169,8 @@ function setLanguage(language) {
createExtrasArea();
binding();
initFullProdimageSetFileUpload();
} else {
setTimeout(function(){document.location.href = "index.html"},250); // not logged in
}
@ -1112,19 +1214,27 @@ function setLanguage(language) {
<div id="extrasarea">
<div data-role="collapsible" data-content-theme="f" data-theme="c">
<h3><span id="extrasheader">Extras/Optionen</span></h3>
<p>
<div id=extraslist></div>
</p>
<p><div id=extraslist></div>
</div>
</div>
<div id="prodimagesarea">
<div data-role="collapsible" data-content-theme="f" data-theme="c">
<h3><span id="prodimagesheader">Bildzuweisung</span></h3>
<p>
<div id=prodimageslist></div>
</p>
</div>
<div data-role="collapsible" data-content-theme="f" data-theme="c">
<h3><span id="prodimagesheader">Bildzuweisung</span></h3>
<p><div id="prodsetimageuploadarea">
<div class="roundedborderarea">
<h3><span id="headeroffullprodset">Setmanipulation</span></h3>
<div id="uploadprodsetfilearea">Bildset-Upload</div>
<div id="uploadprodsetstatus"></div>
<p><button id="cleanprodimageindb" type="submit" data-theme="e"><span id="cleantxt">Bereinigen</span></button>
<p><button id="downloadprodimages" type="submit" data-theme="e"><span id="downloadprodimagestxt">Download</span></button>
</div>
</div>
<p><div id=prodimageslist></div>
</div>
</div>
</div>
@ -1141,6 +1251,7 @@ function setLanguage(language) {
<div data-role="dialog" id="assigndialog" data-title="Zuweisung">
<div data-role="content">
<h3 id="assignheader">?</h3>
<div id=assprodlist></div>
<button id="assignprodbtnaftersel" type="submit" data-theme="b" class="oscmd" data-icon="check">Ja</button>

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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<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.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

471
webapp/timetracking.html Normal file
View File

@ -0,0 +1,471 @@
<html>
<head>
<title>Ansicht Zeiterfassung</title>
<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.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-1.11.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.5.min.js"></script>
<script src="utilities.js"></script>
<link rel="stylesheet" href="php/3rdparty/jqueryui1-11-4/jquery-ui.min.css" />
<script src="php/3rdparty/jqueryui1-11-4/jquery-ui.min.js"></script>
<script src="php/3rdparty/jqueryui1-11-4/jquery-ui-i18n.min.js"></script>
<link rel="stylesheet" href="php/3rdparty/jquerymobiledatepicker/jquery.mobile.datepicker.css" />
<script src="php/3rdparty/jquerymobiledatepicker/jquery.mobile.datepicker.js"></script>
</head>
<body>
<script>
var TIME_DATE_START = ["Startdatum","Start date","Fecha de inicio"];
var TIME_DATE_END = ["Enddatum","End date","Fecha del fin"];
var TIME_USER_ACTIONS_TITLE = ["Benutzeraktionen","User actions","Acciones del usario"];
var TIME_COME = ["Kommen","Coming","Venir"];
var TIME_GO = ["Gehen","Go","Irse"];
var TIME_OVERVIEW = ["Übersicht","Overview","Resumen"];
var TIME_ACTION_FAILED = ["Aktion konnte nicht ausgeführt werden","Action failed","Error en accion"];
var TIME_ACTION_OK = ["Aktion wurde ausgeführt","Action was executed","Completado"];
var TIME_DAYNAMES = [
["Montag","Monday","Lunes"],
["Dienstag","Tuesday","Martes"],
["Mittwoch","Wednesday","Miércoles"],
["Donnerstag","Thursday","Jueves"],
["Freitag","Friday","Viernes"],
["Samstag","Saturday","Sábado"],
["Sonntag","Sunday","Domingo"]
];
var TIME_NEW_OVERVIEW_TABLE = ["Liste der Einträge für","List of entries für","Lista de las entradas para"];
var TIME_NEW_ENTRY = ["Neuen Eintrag erstellen","Create new entry","Crear entrada nueva"];
var TIME_TIME = ["Uhrzeit","Time","Hora"];
var TIME_NO_TIME_ERROR = ["Zeitangabe fehlt","Missing time entry","No tiempo"];
var TIME_SUM = ["Arbeitszeit","Work time","Horas de trabajo"];
var TIME_NON_CALCULABLE = ["nicht berechenbar","not calculable","no posible calcular"];
var TIME_TOTAL_SUM = ["Gesamte Arbeitszeit im gewählten Zeitraum","Total work time in chosen date frame","Horas de trabajo total"];
var TIME_ALL_USERS_TIMES = ["Arbeitszeiten aller Benutzer","Work times of all users","Horas de trabajos de cada usario"];
var lang = 0;
var maymanageusers = 0;
var activeuserid = 0;
var activeusername = "";
var allusers = null;
function setLanguage(language) {
lang = language;
$("#datestarttxt").html(TIME_DATE_START[lang]);
$("#dateendtxt").html(TIME_DATE_END[lang]);
$("#useractionstitle").html(TIME_USER_ACTIONS_TITLE[lang]);
$(".comebtntxt").html(TIME_COME[lang]);
$(".gobtntxt").html(TIME_GO[lang]);
$("#useroverview").html(TIME_OVERVIEW[lang]);
$("#newentrytxt").html(TIME_NEW_ENTRY[lang]);
$("#listofentriestxt").html(TIME_NEW_OVERVIEW_TABLE[lang]);
$("#timetxt").html(TIME_TIME[lang]);
$("#listofalluserstimestxt").html(TIME_ALL_USERS_TIMES[lang]);
}
function initializeOverviewDateFields() {
var langtxt = "de";
if (lang == 1) {
langtxt = "en";
} else if (lang == 2) {
langtxt = "es";
};
var currentYear = new Date().getFullYear();
var yearRangeTxt = (currentYear-1) + ":" + (currentYear+1);
$("#datepickerstart").datepicker($.datepicker.regional[langtxt]).datepicker("option", {
changeMonth: true,
changeYear: true,
yearRange: yearRangeTxt,
});
var date = new Date();
var firstDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1);
$('#datepickerstart').datepicker('setDate', firstDayOfMonth);
$("#datepickerend").datepicker($.datepicker.regional[langtxt]).datepicker("option", {
changeMonth: true,
changeYear: true,
yearRange: yearRangeTxt,
});
$('#datepickerend').datepicker('setDate', new Date());
$("#datepickernew").datepicker($.datepicker.regional[langtxt]).datepicker("option", {
changeMonth: true,
changeYear: true,
yearRange: yearRangeTxt,
});
$('#datepickernew').datepicker('setDate', new Date());
}
function getGeneralConfigItems() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItems", null, insertGenConfigStartRest, "Fehler Konfigurationsdaten");
}
function insertGenConfigStartRest(configResult) {
if (configResult.status == "OK") {
var values = configResult.msg;
setLanguage(values.userlanguage);
} else {
setTimeout(function(){document.location.href = "index.html";},250); // not logged in
}
}
function bindComeGoBtns() {
$(".actionsbtn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var id = this.id;
var comment = $("#comment").val();
var data = {
comment: comment
};
if (id == "comebtn") {
doAjax("POST","php/contenthandler.php?module=timetracking&command=come",data,handleActionAnswer,"Problem Zeiterfassung");
} else if (id == "gobtn") {
doAjax("POST","php/contenthandler.php?module=timetracking&command=go",data,handleActionAnswer,"Problem Zeiterfassung");
}
});
}
function bindUserSelection() {
$("#userselbox").off("change").on("change", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
activeuserid = $("#userselbox").val();
activeusername = $("#userselbox option:selected").text();
updateUserSelBox();
getOverview();
});
}
function bindNewEntryBtns() {
$(".newactionsbtn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var id = this.id;
var date = $("#datepickernew").datepicker("getDate");
var userid = $("#userselbox").val();
var comment = $("#commentnewentry").val();
var time = $("#timenew").val().trim();
if (time == '') {
alert(TIME_NO_TIME_ERROR[lang]);
return;
}
var data = {
day: date.getDate(),
month: (date.getMonth() + 1),
year: date.getFullYear(),
userid: userid,
time: time,
comment: comment
};
if (id == "newcomebtn") {
doAjax("POST","php/contenthandler.php?module=timetracking&command=newadmincome",data,handleActionAnswer,"Problem Zeiterfassung");
} else if (id == "newgobtn") {
doAjax("POST","php/contenthandler.php?module=timetracking&command=newadmingo",data,handleActionAnswer,"Problem Zeiterfassung");
}
});
}
function handleActionAnswer(answer) {
if (answer.status != "OK") {
alert(TIME_ACTION_FAILED[lang] + ": " + answer.msg);
} else {
clearNewEntryFields();
alert(TIME_ACTION_OK[lang] + ".");
$("#comment").val("");
getOverview();
}
}
function handleDateChangeEvents() {
$(".overviewdatepicker").off("change").on("change", function (e) {
getOverview();
});
}
function createUsersSelectBox() {
var txt = "<select id='userselbox' data-theme='f'>";
allusers.forEach(function(aUser, index) {
var userid = aUser.id;
var username = aUser.username;
var selected = "";
if (userid == activeuserid) {
selected = " selected ";
}
txt += "<option value='" + userid + "' " + selected + ">" + toHtml(username) + "</option>";
});
txt += "</select>";
return txt;
}
function getAllowedOverviewUsers() {
doAjax("GET","php/contenthandler.php?module=timetracking&command=getusers",null,handleUsersAnswer,null);
}
function updateUserSelBox() {
var userSelBox = createUsersSelectBox();
$("#userselpart").html(userSelBox);
$('#userselpart').trigger('create');
$("#selectedusername").html(activeusername);
}
function handleUsersAnswer(answer) {
if (answer.status == "OK") {
maymanageusers = answer.msg.maymanageusers;
if (maymanageusers == 1) {
showCreateNewEntryAreaAndAllUsersList();
}
activeuserid = answer.msg.ownuserid;
activeusername = answer.msg.username;
allusers = answer.msg.users;
updateUserSelBox();
initializeOverviewDateFields();
getOverview();
bindUserSelection();
bindNewEntryBtns();
}
}
function showCreateNewEntryAreaAndAllUsersList() {
$("#newentrypart").show();
$("#listofalluserspart").show();
}
function getOverview() {
var startdate = $("#datepickerstart").datepicker("getDate");
var enddate = $("#datepickerend").datepicker("getDate");
var userid = activeuserid;
var data = {
startday: startdate.getDate(),
startmonth: (startdate.getMonth() + 1),
startyear: startdate.getFullYear(),
endday: enddate.getDate(),
endmonth: (enddate.getMonth() + 1),
endyear: enddate.getFullYear(),
userid: userid
};
doAjax("POST","php/contenthandler.php?module=timetracking&command=getoverview",data,handleOverviewAnswer,null);
}
function handleOverviewAnswer(answer) {
if (answer.status == "OK") {
var txt = "";
txt += "<p><i><b>" + TIME_TOTAL_SUM[lang] + ": <u>";
if (answer.msg.totalduration.status == "OK") {
txt += minutesToHourMin(answer.msg.totalduration.minutes);
} else {
txt += TIME_NON_CALCULABLE[lang];
}
txt += "</u></i><b><p>";
answer.msg.times.forEach(function(aTimeEntry, index) {
var aDate = aTimeEntry.date;
var dayno = aTimeEntry.dayno;
var dayname = TIME_DAYNAMES[dayno-1][lang];
var timesofdate = aTimeEntry.timesofdate;
if (timesofdate.length > 0) {
txt += "<p><table class='infotable'>";
txt += "<tr><th colspan=2 class='heading'>" + aDate + " (" + dayname + ")</tr>";
timesofdate.forEach(function(aTime,index2) {
txt += "<tr>";
var id = aTime.id;
var actionid = aTime.action;
var thetime = aTime.thetime;
var timeparts = thetime.split(':');
thetime = timeparts[0] + ":" + timeparts[1];
var comment = toHtml(aTime.comment);
var actiontxt = TIME_COME[lang];
if (actionid == 2) {
actiontxt = TIME_GO[lang];
}
txt += "<td>" + thetime + " - " + actiontxt;
if (comment != '') {
txt += " (" + comment + ")";
}
if (maymanageusers == 1) {
txt += '<td><img src=img/delete.png class="deltimeentry" id="timeentry_' + id + '" />';
}
txt += "</tr>";
});
var workMinutesOfDay = aTimeEntry.workminutes;
if (workMinutesOfDay.status == "OK") {
txt += "<tr><td class='relevantdata' colspan=2>" + TIME_SUM[lang] + ": " + minutesToHourMin(workMinutesOfDay.minutes) + "</tr>";
} else {
txt += "<tr><td class='relevantdata' colspan=2>" + TIME_SUM[lang] + ": " + TIME_NON_CALCULABLE[lang] + "</tr>";
}
txt += "</table>";
}
});
$("#overviewtable").html(txt);
if (answer["allusertimes"] != undefined) {
txt = "<table class='infotable'>";
var allusers = answer.allusertimes;
allusers.forEach(function(aUserEntry,index) {
var username = aUserEntry.username;
var minutes = aUserEntry.minutes;
if (minutes != "-1") {
txt += "<tr><td>" + username + "<td>" + minutesToHourMin(minutes) + "</tr>";
} else {
txt += "<tr><td>" + username + "<td>" + TIME_NON_CALCULABLE[lang] + "</tr>";
}
});
txt += "</table>";
$("#allusersoverviewtable").html(txt);
};
bindUserSelection();
bindDelTimeEntry();
}
}
function bindDelTimeEntry() {
$(".deltimeentry").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var id = this.id.split("_")[1];
doAjax("POST","php/contenthandler.php?module=timetracking&command=delentry",{id:id},handleActionAnswer,null);
});
}
function clearNewEntryFields() {
$("#timenew").val("");
$("#commentnewentry").val("");
}
function minutesToHourMin(minutes) {
var hour = Math.floor(minutes/60);
var min = minutes % 60;
return hour + "h " + min + " min";
}
$(document).on("pageinit", "#time-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
$.ajaxSetup({ cache: false });
$("#time-page").data("date",new Date());
$("#comment").val("");
clearNewEntryFields();
getGeneralConfigItems();
bindComeGoBtns();
getAllowedOverviewUsers();
handleDateChangeEvents();
});
</script>
<div data-role="page" id="time-page">
<div data-role="panel" id="modulepanel" data-position="right" data-display="overlay">
<ul data-role="listview" id="modulemenu" data-divider-theme="a" data-inset="true">
<li data-theme="b" data-role="heading">Hauptmenü</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
<h1><span id="timetitletxt">Zeiterfassung</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1>
<div data-type="horizontal" style="top:0px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right">
<a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch"><span id="modulstxt2">Hauptmenü</span></a>
</div>
</div>
<div data-role="content" id="fullcontent">
<div data-role="collapsible" data-content-theme="c" data-collapsed="false" data-theme="e" id="useractions">
<H2><span id="useractionstitle">Aktionen</span></H2>
<p>
<input name="comment" id="comment" type="text" class="whiteinput" placeholder="Kommentar" />
<div class="ui-grid-a" >
<div class="ui-block-a"><button id="comebtn" type="submit" data-theme="f" class="actionsbtn" ><span class="comebtntxt">Kommen</span></button></div>
<div class="ui-block-b"><button id="gobtn" type="submit" data-theme="f" class="actionsbtn" ><span class="gobtntxt">Gehen</span></button></div>
</div>
</div> <!-- useractions -->
<div data-role="collapsible" data-content-theme="c" data-collapsed="false" data-theme="e" id="timeoverview">
<H2><span id="useroverview">Übersicht</span></H2>
<div id="userselpart"></div>
<div data-role="fieldcontain">
<label for="datepickerstart"><span id=datestarttxt>Datum S</span>: </label>
<input data-role="date" data-inline="true" type="text" id="datepickerstart" data-theme="d" class="overviewdatepicker">
</div>
<div data-role="fieldcontain">
<label for="datepickerend"><span id=dateendtxt>Datum E</span>: </label>
<input data-role="date" data-inline="true" type="text" id="datepickerend" data-theme="d" class="overviewdatepicker">
</div>
<p><div class="roundedborderarea">
<h2><span id="listofentriestxt">Liste</span> <span id="selectedusername"></span></h2>
<div id="overviewtable"></div>
</div>
<p><div id="newentrypart" style="display:none;" class="roundedborderarea">
<h2><span id="newentrytxt">Neueintrag</span></h2>
<div data-role="fieldcontain" >
<label for="datepickernew"><span id=datetxt>Datum </span>: </label>
<input data-role="date" data-inline="true" type="text" id="datepickernew" data-theme="d" >
</div>
<div data-role="fieldcontain" >
<label for="timenew"><span id=timetxt>Uhrzeit</span>: </label>
<input type="text" id="timenew" name="timenew" class="whiteinput" placeholder="hh:mm" >
</div>
<input name="commentnewentry" id="commentnewentry" type="text" class="whiteinput" placeholder="Kommentar" />
<div class="ui-grid-a" >
<div class="ui-block-a"><button id="newcomebtn" type="submit" data-theme="f" class="newactionsbtn" ><span class="comebtntxt">Kommen</span></button></div>
<div class="ui-block-b"><button id="newgobtn" type="submit" data-theme="f" class="newactionsbtn" ><span class="gobtntxt">Gehen</span></button></div>
</div>
</div> <!-- newentrypart -->
<p><div id="listofalluserspart" class="roundedborderarea" style="display:none;">
<h2><span id="listofalluserstimestxt">Liste</span></h2>
<div id="allusersoverviewtable"></div>
</div>
</div> <!-- time overview -->
<br>
</div>
<div data-role="footer" data-theme="b" id="thefooterr">
<div class="ui-grid-a">
<div class="ui-block-a userinfo" id="loggedinuser"></div>
<div class="ui-block-b grid_right" id="versioninfo"></div>
</div><!-- /grid-a -->
</div> <!-- footer -->
</div> <!-- first page -->
</body>
</html>

View File

@ -4,8 +4,8 @@
<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.4.18">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.4.18">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.0">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.5.0">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />