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='

'+this.areaHeader+"";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+='

'+MAN_COUNTING_SUM[lang]+"
";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='

'+f+"
";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+="";for(var f=0;f"}d+="
"+MAN_CATEGORY[lang]+""+MAN_BILLSUMALL[lang]+" ("+this.currency+")
"+MAN_FOOD_CAT[lang]}else{if(g.kind==1){d+="
"+MAN_DRINKS_CAT[lang]}else{continue}}d+=""+g.brutto.replace(".",this.decpoint);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+="";for(var j=0;j";k+="
"+MAN_USERNAME[lang]+"Umsätze (Bar)Umsätze (Unbar)Ein-/AuslagenSumme
"+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)+"

"}return k};this._createSubPartTaxesSums=function(h,k){var d="";if(h.length>0){d+='
';d+="";var f=0;var e=0;for(var g=0;g";f+=parseFloat(j.netto);e+=parseFloat(j.brutto)}d+="";if(k!=null){d+=""}d+="
"+MAN_TAX[lang]+""+MAN_BILLSUMNETTO[lang]+" ("+this.currency+")"+MAN_BILLSUMALL[lang]+" ("+this.currency+")
"+j.tax;d+=""+j.netto.replace(".",this.decpoint);d+=""+j.brutto.replace(".",this.decpoint);d+="
Summen (alle Steuersätze)"+f.toFixed(2).replace(".",this.decpoint)+""+e.toFixed(2).replace(".",this.decpoint)+"
"+MAN_BILLSUMCASH[lang]+""+k.replace(".",this.decpoint)+"

"}return d};this._createSubPartCountingProtocol=function(f,d,e){var l="
"+MAN_COUNTING_PROTOCOL[lang]+": ";if(f.length>0){l+='
';l+="";var o=0;for(var k=0;k"}var p=o.toFixed(2).replace(".",this.decpoint);l+='";l+="
"+MAN_COIN_NOTE_COUNT[lang]+""+MAN_NOTES_VALUE[lang]+""+MAN_COIN_NOTE_SUM[lang]+" ("+this.currency+")"+MAN_COIN_NOTE_TYPE[lang]+"
"+n+""+q.value+" "+j+""+h+""+m+"
'+MAN_COIN_NOTE_SUM[lang]+": "+p+" "+this.currency+"

"}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+="";f+="";if(g.countingprotocol.length>0){f+="";f+=""}f+="
Bargeld in Kasse vor TE"+k.replace(".",d)+"
Bargeld in Kasse nach TE (errechnet)"+h.replace(".",d)+"
Bargeld in Kasse nach TE (gezählt)"+g.counted.replace(".",d)+"
Bargelddifferenz"+g.diffsollist.toFixed(2).replace(".",d)+"
";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+=' ";f+="
";f+='
';f+=' ";f+="
";f+="
";f+='";var l=$("#receiveremail").val();f+='
';f+='
';f+='
';f+='
";f+='";f+='";f+='";f+='";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){}};