<div class="row" style="margin: 0px;">
<div class="col-sm-6 bg-primary text-white" style=" font-weight: bold; font-size: 30px; padding-top: 3px; padding-right: 5px;">
- <i class="fas fa-map-marker-alt white"></i> <span id="commandtable"></span>
+ <i class="fas fa-map-marker-alt white"></i> <span id="pay_commandtable"></span>
</div>
<div class="btn-group btn-group-toggle col-sm-6" data-toggle="buttons">
<label class="btn btn-secondary btn-block" style="font-size: 20px;">
- <input type="radio" name="payementtype" id="cash" autocomplete="off"><i class="far fa-square"></i> BAR</span>
+ <input type="radio" name="payementtype" id="cash" autocomplete="off" onchange="setpayementtype('cash');"><i class="far fa-square"></i> BAR</span>
</label>
<label class="btn btn-secondary btn-block" style="font-size: 20px;">
- <input type="radio" name="payementtype" id="card" autocomplete="off"><i class="far fa-check-square"></i> KARTE
+ <input type="radio" name="payementtype" id="card" autocomplete="off" onchange="setpayementtype('card');"><i class="far fa-check-square"></i> KARTE
</label>
</div>
Zu Bezahlen:
</div>
<div class="col-sm-6" style="background-color: black; font-weight: bold; text-align: right; border: 1px solid red;; height: 40px; font-size: 30px; color: red; vertical-align: middle; padding-right: 5px;border-left: 0px;">
- <span id="sumtotal">0,00</span>€
+ <span id="pay_sumtotal">0,00</span>€
</div>
</div>
<div class="row" style="margin: 0px;">
Erhalten:
</div>
<div class="col-sm-6" style="background-color: black; font-weight: bold; text-align: right; border: 1px solid white; height: 40px; font-size: 30px; color: white; vertical-align: middle; padding-right: 5px;border-left: 0px;">
- <span id="sumtotalgiven">0,00</span>€
+ <span id="sumtotalcashamount">0,00</span>€
</div>
</div>
<div class="row" style="margin: 0px;">
Wechselgeld:
</div>
<div class="col-sm-6" style="background-color: black; font-weight: bold; text-align: right; border: 1px solid yellow; height: 40px; font-size: 30px; color: yellow; vertical-align: middle; padding-right: 5px;border-left: 0px;">
- <span id="sumtotalpayed">0,00</span>€
+ <span id="sumtotalchangeamount">0,00</span>€
</div>
</div>
- <div class="row" style="margin: 0px;">
+ <!-- <div class="row" style="margin: 0px;">
<div class="col-sm-6" style="background-color: black; font-weight: bold; text-align: left; border: 1px solid green; height: 40px; font-size: 30px; color: green; vertical-align: middle; padding-left: 5px;border-right: 0px;">
Bezahlt
</div>
<div class="col-sm-6" style="background-color: black; font-weight: bold; text-align: right; border: 1px solid green; height: 40px; font-size: 30px; color: green; vertical-align: middle; padding-right: 5px;border-left: 0px;">
- <span id="sumtotalpayed">0,00</span>€
+ <span id="sumtotalpayedamount"></span>€
</div>
- </div>
+ </div> -->
<div id="keypad" class="row justify-content-center" >
<div class="row" style="margin: 0px;">
<div class="btn-group" role="group" >
- <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('1');">1</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('2');">2</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('3');">3</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('1',0);">1</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('2',0);">2</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('3',0);">3</button>
</div>
<div class="btn-group" role="group">
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('5');"><i class="fas fa-backspace"></i></button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('10');"><i class="fas fa-undo"></i></button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('20');">1:1</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue(null,3);"><i class="fas fa-backspace"></i></button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue(null,4);"><i class="fas fa-undo"></i></button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue(null,2);">1:1</button>
</div>
</div>
<div class="row" style="margin: 0px;">
<div class="btn-group" role="group" >
- <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('4');">4</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('5');">5</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('6');">6</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('4',0);">4</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('5',0);">5</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('6',0);">6</button>
</div>
<div class="btn-group" role="group" >
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('5');">5 €</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('10');">10 €</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('20');">20 €</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('5',1);">5 €</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('10',1);">10 €</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('20',1);">20 €</button>
</div>
</div>
<div class="row" style="margin: 0px;">
<div class="btn-group" role="group" >
- <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('7');">7</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('8');">8</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('9');">9</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('7',0);">7</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('8',0);">8</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('9',0);">9</button>
</div>
<div class="btn-group" role="group" >
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('50');">50 €</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('100');">100 €</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('200');">200 €</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('50',1);">50 €</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('100',1);">100 €</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue('200',1);">200 €</button>
</div>
</div>
<div class="row" style="margin: 0px;">
<div class="btn-group" role="group" >
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 75px;" onclick="addvalue(',');">,</button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 75px;" onclick="addvalue(',00');">,00</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 150px;" onclick="addvalue(',',0);">,</button>
+ <!-- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 75px;" onclick="addvalue(',00');">,00</button> -->
</div>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary border-white" style="width: 150px;font-size: 20px;">
- <input type="checkbox" name="printticket" id="printticket" autocomplete="off"><i class="far fa-square"></i> Ticket
+ <input type="checkbox" name="printticket" id="printticket" autocomplete="off"><i class="far fa-square" onchange="setprinttype('ticket');"></i> Ticket
</label>
<label class="btn btn-secondary border-white" style="width: 150px;font-size: 20px;">
- <input type="checkbox" name="printreceipt" id="printreceipt" autocomplete="off"><i class="far fa-check-square"></i> KassenBon
+ <input type="checkbox" name="printreceipt" id="printreceipt" autocomplete="off" onchange="setprinttype('receipt');"><i class="far fa-check-square"></i> KassenBon
</label>
</div>
var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var config = {};
+var localconfig = {};
var shoppingcart = {products:{},transaction:{}};
var tblheight1=winh-180;
function initpage(){
loadconfig();
load_group_selects();
- load_local_config_product_tables();
+ //load_local_config_product_tables();
$('#checkout').bootstrapTable({
height: tblheight1,
});
}
console.log("config loaded");
console.log(config);
+ localconfig = parent.usersystem.getPreference('paywindow');
+
}
function loadadmin(){
parent.browserapp.loadmodule('overview');
}
-function load_local_config_product_tables(){
+// function load_local_config_product_tables(){
-}
+// }
function load_group_selects(){
var sql = "select productgroup from products group by productgroup;";
sum += shoppingcart["products"][i].quantity * parseFloat(shoppingcart["products"][i].grossamount);
}
$("#sumtotal").html(sum.toFixed(2).replace('.',',') );
+ shoppingcart['transaction']['grossamount'] = sum;
return sum.toFixed(2);
+
}
function clean_shoppingcart(){
function book_shoppingcart(ptype){
shoppingcart['transaction']['id']= appdb.generate_uuid();
- // appdb.dbexec("INSERT INTO transactions (id, payementtype, id_table, payedamount, cashbackamount, status, statusdate) VALUES('"+shoppingcart['transaction']['id']+"', '"+ptype+"', '"+shoppingcart['transaction']['id_table']+"', 0, 0, '', now());");
+ if (shoppingcart['transaction']['table'] && shoppingcart['transaction']['table']['name']){
+ $("#pay_commandtable").html(shoppingcart['transaction']['table']['name']);
+ } else {
+ $("#pay_commandtable").html("");
+ }
+ if (shoppingcart['transaction']['grossamount']){
+ $("#pay_sumtotal").html(shoppingcart['transaction']['grossamount'].toFixed(2).replace('.',','));
+ }
+
+ shoppingcart['transaction']['paymenttype'] = ptype;
+ shoppingcart['transaction']['changeamount'] = null;
+ shoppingcart['transaction']['cashamount'] = null;
+ shoppingcart['transaction']['payedamount'] = null;
+ $("#sumtotalcashamount").html("");
+ $("#sumtotalchangeamount").html("");
+ //$("#sumtotalpayedamount").html("");
+ if (localconfig && localconfig['printtype'] && localconfig['printtype']['receipt'] && localconfig['printtype']['receipt'] == 1){
+ $("#printreceipt").attr("checked","checked");
+ }
+ if (localconfig && localconfig['printtype'] && localconfig['printtype']['ticket'] && localconfig['printtype']['ticket'] == 1){
+ $("#printticket").attr("checked","checked");
+ }
+ $('#'+ptype).attr('checked', 'checked');
+ //$('#'+ptype).attr('checked', 'checked');
+ //parent.usersystem.setPreference('paywindow',localconfig);
+ // appdb.dbexec("INSERT INTO transactions (id, payementtype, id_table, payedamount, cashbackamount, status, statusdate) VALUES('"+shoppingcart['transaction']['id']+"', '"+ptype+"', '"+shoppingcart['transaction']['id_table']+"', 0, 0, '', now());");
+
$('#dlgPayement').modal('show');
}
+function setprinttype(id){
+ console.log("set printtypes");
+ if (!localsystem['printtype']){
+ localsystem['printtype'] = {};
+ }
+ if ($("#print"+id).prop('checked')){
+ localsystem['printtype'][id] = 1;
+ }else {
+ localsystem['printtype'][id] = 0;
+ }
+ parent.usersystem.setPreference('paywindow',localconfig);
+}
+
function view_tables(){
var tbls = appdb.dbquery("select id,name from tables;");
$("#tableslist").html("");
function setTable(id,name){
$("#commandtable").html(name);
- shoppingcart['transaction']['id_table'] = id;
+ if (!shoppingcart['transaction']['table']){
+ shoppingcart['transaction']['table'] ={};
+ }
+ shoppingcart['transaction']['table']['id'] = id;
+ shoppingcart['transaction']['table']['name'] = name;
$('#dlgTables').modal('hide');
+}
+
+function setpayementtype(ptype){
+ console.log("set payement type: " + ptype);
+ if ($("#"+id).prop('checked')){
+ shoppingcart['transaction']['payementtype'] =ptype;
+ }
+}
+
+function addvalue(num,type){
+ //type 0=string add, 1 = sum add, 2 = 1:1, 3 =backspace, 4=clear
+ if (type == 1){
+ var cval = $("#sumtotalcashamount").html();
+ if (cval == ""){ cval = 0;}
+ else {
+ cval = parseFloat(cval.replace(',','.'))
+ }
+ cval = cval+parseFloat(num);
+ $("#sumtotalcashamount").html(cval.toString().replace('.',','));
+ } else if (type == 0) {
+ var cval = $("#sumtotalcashamount").html();
+ if (num == ','){
+ if (cval.indexOf(',') < 0){
+ $("#sumtotalcashamount").html(cval + num);
+ }
+ }else {
+ $("#sumtotalcashamount").html(cval + num);
+ }
+ } else if (type == 2) {
+ $("#sumtotalcashamount").html($("#pay_sumtotal").html());
+ } else if (type == 3) {
+ var cval = $("#sumtotalcashamount").html();
+ cval = cval.substring(0,cval.length-1);
+ $("#sumtotalcashamount").html(cval);
+ } else if (type == 4) {
+ $("#sumtotalcashamount").html("");
+ }
+ var ncash = $("#sumtotalcashamount").html();
+ var ntotal = parseFloat($("#pay_sumtotal").html().replace(',','.'));
+ if (ncash == ""){
+ ncash = 0.00;
+ }else {
+ ncash = parseFloat(ncash.replace(',','.'));
+ }
+ nchange = ncash-ntotal;
+ if (nchange > 0.00){
+ $("#sumtotalchangeamount").html(nchange.toFixed(2).replace('.',','));
+ }else {
+ $("#sumtotalchangeamount").html("");
+ }
+ // if (ncash >= ntotal){
+ // $("#sumtotalpayedamount").html($("#sumtotalcashamount").html());
+ // } else {
+ // $("#sumtotalpayedamount").html($("#pay_sumtotal").html());
+ // }
}
\ No newline at end of file