var MAN_CLS_COINS_NOTES_FIELDS_NOT_CORRECTLY_FILLED=["Entweder müssen alle oder gar kein Feld des Zählprotokolls korrekt ausgefüllt sein.","Either all or no fields of the counting protocol must be filled in correctly.","Todos o ninguno de los campos del protocolo de conteo deben ser llenados."];var MAN_COUNTING_SUM=["Summe","Sum","Total"];var MAN_NO_COUNTING_DONE=["Zählprotokoll wurde nicht erfasst.","No counting protocol available.","No hay ningun protocolo de conteo."];var MAN_NOTES_VALUE=["Wert","Value","Valor"];var MAN_COIN_NOTE_TYPE=["Typ","Type","Typo"];var MAN_COIN_NOTE_SUM=["Summe","Sum","Total"];var MAN_COIN_NOTE_COUNT=["Anzahl","Number","Numero"];function Closing(b,c,a){this.closingListExpanded=false;this.areaHeader="";this.coinsHeader="";this.notesHeader="";this.hint="";this.l=c;this.coins=[];this.notes=[];this.decpoint=b;this.currency=a;this.bindNewClosingExpand=function(g,f,e,h){var d=this;this.areaHeader=g;this.coinsHeader=f;this.notesHeader=e;this.hint=h;$("#closinglist").off("collapsibleexpand").on("collapsibleexpand",function(i){i.stopImmediatePropagation();i.preventDefault();if(!d.closingListExpanded){d.closingListExpanded=true;d._createGui()}})};this._createGui=function(){var d=this;doAjax("GET","php/contenthandler.php?module=admin&command=getcoinsandnotes",null,d._handleCoinsAndNotesAndCreateGui.bind(d),"Fehler Münzen/Banknoten")};this._handleCoinsAndNotesAndCreateGui=function(e){var d='
";if(e.status=="OK"){this.coins=e.msg.coins;this.notes=e.msg.notes;var g=e.msg.coinvalname;var f=e.msg.notevalname;d+="
"+this._createGuiCore(this.coins,this.coinsHeader,g,"c");d+=this._createGuiCore(this.notes,this.notesHeader,f,"n")}d+='
";d+=' '+f;d+='
'+this.hint+"
";$("#countingprotocol").html(d);this._bindCountingChange()};this._bindCountingChange=function(){var d=this;$(".countingfield").off("keyup").on("keyup",function(f){d._calcSum()})};this._calcSum=function(){var d=0;this.coins.forEach(function(i,g){var f="#coinnote_c_"+i;var h=$(f).val().trim();if(h!=""){h=parseInt(h);if(isInt(h)){d+=h*i}else{$("#countingsum").val("?")}}});this.notes.forEach(function(i,g){var f="#coinnote_n_"+i;var h=$(f).val().trim();if(h!=""){h=parseInt(h);if(isInt(h)){d+=h*100*i}else{$("#countingsum").val("?")}}});var e=(d/100).toFixed(2).replace(".",this.decpoint);$("#countingsum").val(e)};this._createGuiCore=function(g,f,h,e){var d='
";g.forEach(function(j,i){d+=' ';d+=" * "+j+" "+h+" "});return d};this.checkCoinsNotesValues=function(){var d=this._checkCoinNoteFieldsAreFilled("c",this.coins);var g=this._checkCoinNoteFieldsAreFilled("n",this.notes);var f=d.filled+g.filled;var h=d.unfilled+g.unfilled;var e=this._getCounted();if((f>0)&&(h>0)){return{status:false,msg:MAN_CLS_COINS_NOTES_FIELDS_NOT_CORRECTLY_FILLED[this.l]}}else{if(f>0){coinscount=this._getCountOfCoinNoteFields("c",this.coins);notescount=this._getCountOfCoinNoteFields("n",this.notes);return{status:true,msg:"OK",counting:1,coinscount:coinscount,notescount:notescount,counted:e}}else{return{status:true,msg:"OK",counting:0}}}};this._checkCoinNoteFieldsAreFilled=function(d,e){var f=0;var g=0;e.forEach(function(j,i){var h="#coinnote_"+d+"_"+j;var k=$(h).val().trim();if(k==""){g++}else{f++}});return{filled:f,unfilled:g}};this._getCountOfCoinNoteFields=function(d,e){var f=[];e.forEach(function(j,h){var g="#coinnote_"+d+"_"+j;var i=$(g).val().trim();f[f.length]={value:j,count:i}});return f};this.clearCountingFields=function(){this.coins.forEach(function(f,e){var d="#coinnote_c_"+f;$(d).val("")});this.notes.forEach(function(f,e){var d="#coinnote_n_"+f;$(d).val("")});$("#countingsum").val("")};this._getCounted=function(){this._calcSum();var d=$("#countingsum").val();if(d==""){return 0}else{return d.replace(",",".")}};this._createSubPartCategorySums=function(e){var d="";if(e.length>0){d+='';d+=""+MAN_CATEGORY[lang]+" "+MAN_BILLSUMALL[lang]+" ("+this.currency+") ";for(var f=0;f"+MAN_FOOD_CAT[lang]}else{if(g.kind==1){d+=" "+MAN_DRINKS_CAT[lang]}else{continue}}d+=" "+g.brutto.replace(".",this.decpoint);d+=" "}d+="
"}return d};this._createSubPartUserSums=function(n){var k="";if(n.length>0){var e=0;var f=0;var l=0;var g=0;k+='';k+=""+MAN_USERNAME[lang]+" Umsätze (Bar) Umsätze (Unbar) Ein-/Auslagen Summe ";for(var j=0;j"+d.username;k+=" "+m.toString().replace(".",this.decpoint);k+=" "+h.toString().replace(".",this.decpoint);k+=" "+d.sumcash.replace(".",this.decpoint);k+=" "+d.billsumall.replace(".",this.decpoint);e+=parseFloat(m);f+=parseFloat(h);l+=parseFloat(d.sumcash);g+=parseFloat(d.billsumall)}k+=" Summe "+e.toFixed(2).replace(".",this.decpoint)+" "+f.toFixed(2).replace(".",this.decpoint)+" "+l.toFixed(2).replace(".",this.decpoint)+" "+g.toFixed(2).replace(".",this.decpoint)+" ";k+="
"}return k};this._createSubPartTaxesSums=function(h,k){var d="";if(h.length>0){d+='';d+=""+MAN_TAX[lang]+" "+MAN_BILLSUMNETTO[lang]+" ("+this.currency+") "+MAN_BILLSUMALL[lang]+" ("+this.currency+") ";var f=0;var e=0;for(var g=0;g"+j.tax;d+=" "+j.netto.replace(".",this.decpoint);d+=" "+j.brutto.replace(".",this.decpoint);d+="";f+=parseFloat(j.netto);e+=parseFloat(j.brutto)}d+=" Summen (alle Steuersätze) "+f.toFixed(2).replace(".",this.decpoint)+" "+e.toFixed(2).replace(".",this.decpoint)+" ";if(k!=null){d+=""+MAN_BILLSUMCASH[lang]+" "+k.replace(".",this.decpoint)+" "}d+="
"}return d};this._createSubPartCountingProtocol=function(f,d,e){var l=" "+MAN_COUNTING_PROTOCOL[lang]+": ";if(f.length>0){l+='';l+=""+MAN_COIN_NOTE_COUNT[lang]+" "+MAN_NOTES_VALUE[lang]+" "+MAN_COIN_NOTE_SUM[lang]+" ("+this.currency+") "+MAN_COIN_NOTE_TYPE[lang]+" ";var o=0;for(var k=0;k"+n+" "+q.value+" "+j+" "+h+" "+m+""}var p=o.toFixed(2).replace(".",this.decpoint);l+=' '+MAN_COIN_NOTE_SUM[lang]+": "+p+" "+this.currency+" ";l+="
"}else{l+=MAN_NO_COUNTING_DONE[lang]}return l};this._createClosingPart=function(j,g){var d=$("#admin-page").data("decpoint");var i=$("#admin-page").data("currency");var e=g.id;var f='';f+="
"+toHtml(j)+" ";f+="
Alle Angaben in "+i;var d=$("#admin-page").data("decpoint");var k=g.barTotalBeforeTE;var h=g.barTotalAfterTE;f+="
Gesamtdaten zur Erfassung ";f+="
";f+="Bargeld in Kasse vor TE "+k.replace(".",d)+" ";f+="Bargeld in Kasse nach TE (errechnet) "+h.replace(".",d)+" ";if(g.countingprotocol.length>0){f+="Bargeld in Kasse nach TE (gezählt) "+g.counted.replace(".",d)+" ";f+="Bargelddifferenz "+g.diffsollist.toFixed(2).replace(".",d)+" "}f+="
";f+="
Änderungen mit dieser Erfassung ";f+=this._createSubPartUserSums(g.usersums);f+=this._createSubPartTaxesSums(g.taxessums,g.cashops);f+=this._createSubPartCategorySums(g.categorysums);f+=this._createSubPartCountingProtocol(g.countingprotocol,g.coinname,g.notename);f+="
"+MAN_CLOSING_DET_TXT[lang]+"
";f+="
";f+='
';f+='
';f+=' '+MAN_CSV_EXP_RECEIPTS[lang]+" ";f+="
";f+='
';f+=' '+MAN_XLSX_EXP_RECEIPTS[lang]+" ";f+="
";f+="
";f+='
'+MAN_CSV_EXP_ALL[lang]+" ";var l=$("#receiveremail").val();f+='
';f+='';f+='
';f+=''+MAN_EMAIL_DATA[lang]+"
";f+=''+MAN_PRINT_ALL[lang]+" ";f+=''+MAN_PRINT_RECEIPT[lang]+" ";f+=''+MAN_CLOS_HTML[lang]+" ";f+=''+MAN_CSV_EXP_GUEST[lang]+" ";f+="";f+=" ";return f};this.displayClosings=function(f){var d=this;var e="";$.each(f,function(j,l){var k=l.closingDate;var h=MAN_DAYNAMES[l.daynameno-1][lang];var m=l.remark;var g=k+" ("+h+")";if(m!=""){e+=d._createClosingPart(l.id+": "+g+": "+m,l)}else{e+=d._createClosingPart(l.id+": "+g,l)}});$("#partofclosings").html(e);$("#partofclosings").trigger("create")};this._displayCountingOfAClosing=function(d){}};