var simhoursforbid = false; var mytime = parseInt(Date.now()/1000); var howmanyrowsoninvoicetable = 0; var availableTags = ['2 WEEK CALLBACKS','3 DAY CALLBACKS','4 DAY CALLBACKS','4 WEEK CALLBACKS','AUDIT HOURS','AUGMENT CALLBACK 1','BRIEFING HOURS','CANCELLATION FEES','CLIENT VISIT','COMPLETED 1ST CALLBACK','COMPLETED 2ND CALLBACK','COMPLETED 3RD CALLBACK','COMPLETED AA INTERVIEWS','COMPLETED AUGMENTS','COMPLETED CALLBACKS','COMPLETED GENERAL','COMPLETED HISP INTERVIEWS','COMPLETED INTERVIEWS','COMPLETED MALL INTERVIEWS','COMPLETED NON-USERS','COMPLETED PAIRED INTERVIEWS','COMPLETED PAR/KIDS','COMPLETED PLACEMENTS','COMPLETED PRR INTERVIEWS','COMPLETED RANDOM','COMPLETED TASTE TESTS','CONCEPT ONLY','CONTROL INTERVIEWS','COPIES MADE','DATA ENTRY','DIARY RETURNS','DRIVE TIME','EXPENSES','FACILITY RENTAL','FOCUS GROUP','FRIDGE FEES','GIFT CARDS','INCENTIVES PAID','INTERVIEWING HOURS','KITCHEN HELP','LABELING TIME','MAIL FEES','MILES DRIVEN','MISCELLANEOUS EXP','PHONE CALLS','PIZZA PARTY','POSTAGE / SHIPPING COSTS','PROJECT MANAGEMENT FEE','RANDOM CALLBACK 1','REMINDER CALLS','RESCHEDULE FEES','SET UP AND PREP','SHELF RENTAL','SHELF SET UP PER HOUR','SHOPPING TIME','TABLET FEES','TEST INTERVIEWS','TT SUPPLIES','VIDEO RECORDINGS' ]; var globallastjobdone = ""; var mylevel = ""; var mylastarcspersonid = 0; String.prototype.replaceAll = function(search, replacement) { var target = this; return target.replace(new RegExp(search, 'g'), replacement); }; function urldecode(str) { console.log(str) // return decodeURIComponent(str.replace(/\+/g, ' ')); var mystring = str; try { mystring = decodeURIComponent((str+'').replace(/\+/g, '%20')); } catch(err) { } return mystring; } function urlencode(text) { return encodeURIComponent(text).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'); } function setCookie(cname, cvalue) { document.cookie = cname + "=" + cvalue + "; "; } function delete_cookie( name ) { document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; } function getCookie(name) { var r = document.cookie.match("\\b" + name + "=([^;]*)\\b"); return r ? r[1] : undefined; } function timeStamp(d) { var now = new Date(d*1000); var date = [ now.getMonth() + 1, now.getDate(), now.getFullYear() ]; var time = [ now.getHours(), now.getMinutes(), now.getSeconds() ]; var suffix = ( time[0] < 12 ) ? "AM" : "PM"; time[0] = ( time[0] < 12 ) ? time[0] : time[0] - 12; time[0] = time[0] || 12; for ( var i = 1; i < 3; i++ ) if ( time[i] < 10 ) time[i] = "0" + time[i]; return date.join("/") + " " + time.join(":") + " " + suffix; } function timeStamp24hour(d) { var now = new Date(d*1000); var date = [ now.getMonth() + 1, now.getDate(), now.getFullYear() ]; var time = [ now.getHours(), now.getMinutes(), now.getSeconds() ]; // var suffix = ( time[0] < 12 ) ? "AM" : "PM"; time[0] = ( time[0] < 12 ) ? time[0] : time[0] - 12; time[0] = time[0] || 12; for ( var i = 1; i < 3; i++ ) if ( time[i] < 10 ) time[i] = "0" + time[i]; return date.join("/") + " " + time.join(":"); } var arrayUnique = function(a) { return a.reduce(function(p, c) { if (p.indexOf(c) < 0) p.push(c); return p; }, []); }; function validateEmail(email) { var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } function simulatehoursonbids(that) { $("#simulatesectiontotals").css("display", "block"); $(that).css("background-color", "lightgreen"); $(that).html("simulating"); simhoursforbid=true; var mydate; $(".hoursclasstoreplace").each(function() { var mynp = $("").attr({"type":"number","id":"manualhourtextbox_" + $(this).attr("empid")}).css({"width":"50px"}); mydate = $(this).attr("thedate"); mynp.on("focus", function() { var mytempdata = $(this).val(); $(this).one("blur", function() { if ($(this).val() != mytempdata) { $.getJSON("/json/updatemanualhours.php?date=" + $(this).parent().attr("thedate") + "&emp=" + $(this).parent().attr("empid") + "&hour=" + $(this).val(), function(data) { }); console.log("send new"); } }); }); $(this).empty(); $(this).append( mynp); }); $(".percenttoclearforman").empty(); $(".totalfordaytoclearforman").empty(); $(".totaltoclearforman").empty(); $.getJSON("/json/getmanhoursfor.php?number=&date=" + mydate, function(data) { $.each(data, function(key, val) { console.log(val); if( $("#" + key ).is('input') ) { $("#" + key ).val(val); } else { $("#" + key ).html(val); } }); console.log(data); }); } function logoutfrommanagertools() { delete_cookie("managerpass"); // $("#managerstoolsdropdown").css("display","none"); // $("#enablemanagerstoolsul").css("display","block"); window.location.assign("/"); } function enablemanagertools() { var person = prompt("Please input the managers password", ""); $.getJSON("/inputs/confirmmanagerpass.php?pass=" + urlencode(person), function (data) { if (data.result == "ok") { setCookie("managerpass", data.manmd5); window.location.assign("/"); // $("#managerstoolsdropdown").css("display","block"); // $("#enablemanagerstoolsul").css("display","none"); } }); } function billjobnowforwips(theid, billstatus, thisa) { var that = thisa; $.getJSON("/inputs/wipsmanagement.php?get=wips&status=" + billstatus + "&number=&do=bill&id=" + theid, function(data) { $(that).parent().html('' + data.change + ''); console.log(data); }); } function shipjobnowforwips(theid, billstatus, thisa) { var that = thisa; $.getJSON("/inputs/wipsmanagement.php?get=wips&status=" + billstatus + "&number=&do=ship&id=" + theid, function(data) { $(that).parent().html('' + data.change + ''); console.log(data); }); } function givestriketoemp(name, number) { mytime = parseInt(Date.now()/1000); $.getJSON( "/json/getstrikeinfo.php?temptime=" + mytime + "&number=&num=" + number, function( data ) { $("#givestriketoempfield").html(urldecode(name)); $("#strikeempnumber").val(urldecode(number)); $("#previousstrikeul").html(""); $.each(data, function(key, value) { var d = new Date(value.tima*1000); var li = $("
") .addClass("ui-menu-item") .attr("role", "menuitem") .html(urldecode(value.reason) + " - " + timeStamp(value.tima) + "") .appendTo($("#previousstrikeul")); }); $("#givestrikeprompt").modal(); }); } function validateinvoiceform() { console.log(howmanyrowsoninvoicetable); for(tempx=0;tempxfile | "; textforfilelist+="desc | "; textforfilelist+="uploader | "; textforfilelist+="date | "; textforfilelist+="
---|---|---|---|
" + urldecode(value.origname) + " | "; textforfilelist+="" + urldecode(value.description) + " | "; textforfilelist+="" + value.username + " | "; textforfilelist+="" + value.uploaddate + " |