var id_label; var id_attivita; var id_punto; var id_operatore; var id_culture; var id_calendly; var versione; var ScadenzaT; var ID_consulente; var ID_ChargeBee; var ID_ChargeBee_WeGest; var ID_ChargeBee_App; var ID_ChargeBee_WeGestPlus; var Scadenza; var Scadenza_app; var Scadenza_plus; var id_agente; var Agente; var ID_esterno; var Codice_WG; var Nome_Punto; var Indirizzo; var Civico; var Comune_Punto; var Provincia_Punto; var Regione_Punto; var Cap_Punto; var Email_Punto; var Pec; var Amministratore_Nome; var Amministratore_Cognome; var Computer_Punto; var Telefono_Punto; var Cellulare_Punto; var Codice_Destinatario; var Piva; var Stampante_Fiche_Punto; var Stampante_Ricevute_Punto; var Stampante_Scontrini; var Prodotto_consulenza; var Settore1, Settore2, Settore3 ; var Accetta_Contratto; var Contratto_Accettato; var Etichette; var Versione_software; var TW; var WAI; var Scarica_anagrafica; var Nexi_attivo; var ID_POS; var ID_Business; var id_cliente; var piattaforma; var dominio; var pollici_schermo; var a1; var a2; var a3; var a4; var b12; var SG; var SGN; var ftp1; var ftp2; var Punto_attivo; var Consulenza; var Landing; var Whatsapp; var Whatsapp_P; var App_clienti; var Invia_notifiche; var Prenotado; var Privilegi; var Culture; var Pet; var Dashboard; var ID_dashboard; var ajax_timeout; var ajax_timeout_msg_errore; var giorni_settimana; var giorni_settimana_DB; var ultima_chiusura_cassa; function PrintProtocol() {return document.location.protocol+"//safe";} function Stampa_ricevuta(sr_id_ricevuta, sr_ip) {var stampa_ricevute_IP; if (stampa_impostazioni_Stampa_ricevute == "si") {if (stampa_impostazioni_IP_Fisso_fiscale_tipo == "Windows") {stampa_ricevute_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+":"+stampa_impostazioni_IP_Fisso_fiscale_porta+"/?idr="+sr_id_ricevuta+"&stampante=ricevute"; $.ajax({url: stampa_ricevute_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} else {Stampa_Scontrino(Stampante_Scontrini, sr_id_ricevuta);}}} function Stampa_ricevuta_desktop(sr_id_ricevuta) {if (typeof Stampante_ricevute_usa !== 'undefined') {if (Stampante_ricevute_usa == "True") {jsobject.callNET_Stampa_ricevuta(sr_id_ricevuta);}}} function Stampa_fattura(sr_id_ricevuta, sr_ip) {var stampa_ricevute_IP, stampa_ricevute_Tipo; if (stampa_impostazioni_Stampa_ricevute == "si") {}} function Ritira_File(rs_tipo_stampante, rs_metodo, var_get) {var xmlhttp; var http_url; http_url = "https://www.i-salon.eu/Stampa/RT/"+rs_tipo_stampante+"/"+rs_metodo+"/?"+var_get; xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET', http_url, false); xmlhttp.send(); return xmlhttp.responseText;} function Stampa_Scontrino(rs_tipo_stampante, ss_ID_movimento) {var testo_soap = ""; var metodo = "Scontrino"; if (id_punto == "7" || id_punto == "1352") {metodo = "Scontrino2";} var url = dominio+"Stampa/RT/"+rs_tipo_stampante+"/"+metodo+"/?idr="+ss_ID_movimento; $.ajax({url: url, timeout: ajax_timeout * 3, success: function(data) {switch (Stampante_Scontrini) {case "RCH": testo_soap = Elabora_Testo_RCH(data); break; case "Epson": testo_soap = Elabora_Testo_Epson(data); break; default: testo_soap = Elabora_Testo_RCH(data); break;} if (Stampante_Scontrini == "Epson") {StatoEpson({scontrino_soap: testo_soap, id_movimento: ss_ID_movimento, comando: "stato", comando_successivo: "receipt_number"});} else {SendWebservice({"testo_soap":testo_soap, "id_movimento":ss_ID_movimento});}}, error: function (xhr, ajaxOptions, thrownError) {if (ajaxOptions == "timeout") {} else {} mostra_Modale_Growl({titolo:"Errore nella stampa: "+rs_tipo_stampante+" - "+rs_metodo, azione:"info", icona:"exclamation-triangle"});}});} function StatoEpson(args) {var scontrino_soap = (typeof args.scontrino_soap === 'undefined' ? "" : args.scontrino_soap); var se_ID_movimento = (typeof args.id_movimento === 'undefined' ? "" : args.id_movimento); var comando = (typeof args.comando === 'undefined' ? "stato" : args.comando); var comando_successivo = (typeof args.comando_successivo === 'undefined' ? "" : args.comando_successivo); var tentativo = (typeof args.tentativo === 'undefined' ? 1 : args.tentativo); var testo_soap = ""; switch (comando) {case "stato": testo_soap = ""+""+""+""+""+""+""+""; break; case "receipt_number": testo_soap = ""+""+""+""+""+""+""+""; break; default: console.log("errore comando"); break;} var xmlhttp = new XMLHttpRequest(); xmlhttp.open('POST', PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+'/cgi-bin/fpmate.cgi', true); xmlhttp.timeout = 2000; xmlhttp.ontimeout = function (e) {if (tentativo < 3) {StatoEpson({scontrino_soap: scontrino_soap, id_movimento: se_ID_movimento, comando: comando, comando_successivo: comando_successivo, tentativo: tentativo+1});} else {wDialog({tipo: "avviso2", testo1: "E' avvenuto un errore durante la stampa dello scontrino.", testo2: "Verifica che la stampante sia accesa e collegata correttamente. (timeout stato)", annulla_testo: " Non stampare", conferma_testo: " Ristampa nuovamente lo scontrino", conferma_funzione_callback: Stampa_Scontrino, conferma_argomenti: ["Epson", se_ID_movimento]});}}; xmlhttp.onreadystatechange = function () {if (xmlhttp.readyState == 4) {if (xmlhttp.status == 200) {var xmlDoc = xmlhttp.responseXML; var response; switch (comando) {case "stato": response = xmlDoc.getElementsByTagName('fpStatus')[0]; break; case "receipt_number": response = xmlDoc.getElementsByTagName('printerStatus')[0]; break; default: console.log("errore xml"); break;} var response_child = response.childNodes[0]; var ftstatus = response_child.nodeValue; if (ftstatus.substring(0,1) == "0" || ftstatus.substring(0,1) == "2") {if (comando == "stato" && ftstatus.substring(0,1) == "2") {mostra_Modale_Growl({titolo:"Carta stampante in esaurimento", azione:"info", icona:"print"});} switch (comando_successivo) {case "receipt_number": StatoEpson({scontrino_soap: scontrino_soap, id_movimento: se_ID_movimento, comando: "receipt_number", comando_successivo: "webservice"}); break; case "webservice": SendWebservice({"testo_soap":scontrino_soap, "id_movimento":se_ID_movimento}); break; default: console.log("errore comando successivo"); break;}} else {wDialog({tipo: "avviso2", testo1: "E' avvenuto un errore durante la stampa dello scontrino.", testo2: "Verifica lo stato della stampante, che il coperchio non sia aperto, o la carta esaurita o inceppata.", annulla_testo: " Non stampare", conferma_testo: " Ristampa nuovamente lo scontrino", conferma_funzione_callback: Stampa_Scontrino, conferma_argomenti: ["Epson", se_ID_movimento]});}}}}; xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.send(testo_soap);} function SendWebservice(args) {var testo_soap = (typeof args.testo_soap === 'undefined' ? "" : args.testo_soap); var id_movimento = (typeof args.id_movimento === 'undefined' ? "" : args.id_movimento); var tentativo = (typeof args.tentativo === 'undefined' ? 1 : args.tentativo); var elabora_risposta = (typeof args.elabora_risposta === 'undefined' ? true : args.elabora_risposta); var url; switch (Stampante_Scontrini) {case "RCH": url = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+'/service.cgi'; break; case "Epson": url = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+'/cgi-bin/fpmate.cgi'; break; default: break;} var xmlhttp = new XMLHttpRequest(); xmlhttp.open('POST', url, true); xmlhttp.timeout = 10000; xmlhttp.ontimeout = function (e) {if (elabora_risposta) {wDialog({tipo: "avviso2", testo1: "E' avvenuto un errore durante la stampa.", testo2: "Verifica lo stato della stampante, che il coperchio non sia aperto, o la carta esaurita o inceppata. (timeout stampa)", annulla_testo: " Non stampare", conferma_testo: " Ristampa nuovamente lo scontrino", conferma_funzione_callback: Stampa_Scontrino, conferma_argomenti: [Stampante_Scontrini, id_movimento]});}}; xmlhttp.onreadystatechange = function () {if (xmlhttp.readyState == 4) {if (xmlhttp.status == 200) {switch (Stampante_Scontrini) {case "Epson": if (elabora_risposta) {var xmlDoc = xmlhttp.responseXML; var response = xmlDoc.getElementsByTagName('response')[0]; var success = response.getAttribute('success'); if (success != "true") {wDialog({tipo: "avviso2", testo1: "E' avvenuto un errore durante la stampa.", testo2: "Verifica lo stato della stampante, che il coperchio non sia aperto, o la carta esaurita o inceppata.", annulla_testo: " Non stampare", conferma_testo: " Ristampa nuovamente lo scontrino", conferma_funzione_callback: Stampa_Scontrino, conferma_argomenti: [Stampante_Scontrini, id_movimento]});}} break;}}}}; xmlhttp.onerror = function (e) {console.error(xmlhttp.statusText);}; xmlhttp.setRequestHeader('Content-Type', 'text/xml; charset=UTF-8'); var domain = (new URL(window.location.href)); domain = domain.hostname.replace('www.',''); if (typeof piattaforma == "undefined" && domain == "we-gest.com") {xmlhttp.setRequestHeader('Origin-Trial', 'AragbqR1mQgeYQ3FG8Qn0leuHCUuSmfDsLIJVn+tor4LTWbiSaxu5v60MNLbxgTB1WNUyBvWzjd1/KIChisTBgcAAACCeyJvcmlnaW4iOiJodHRwOi8vd2UtZ2VzdC5jb206ODAiLCJmZWF0dXJlIjoiUHJpdmF0ZU5ldHdvcmtBY2Nlc3NOb25TZWN1cmVDb250ZXh0c0FsbG93ZWQiLCJleHBpcnkiOjE2NjYxMzc1OTksImlzU3ViZG9tYWluIjp0cnVlfQ==');} xmlhttp.send(testo_soap); return true;} function Scontrino_RCH(rs_ID_movimento) {var scontrino = Ritira_File("RCH", "Scontrino", "idr="+rs_ID_movimento); var testo_soap = Elabora_Testo_RCH(scontrino); SendWebservice({"testo_soap":testo_soap});} function Elabora_Testo_RCH(testo) {var rows = testo.split("\n"); var output = ""; for(var i = 0; i < rows.length; i++){if (rows[i] != "" && rows[i] != "=C1" && rows[i] != "=K") {output += ""+rows[i]+"";}} var testo_soap = (""+output+"").replace(/(\r\n|\n|\r)/gm,""); return testo_soap;} function Scontrino_Epson(rs_ID_movimento) {var scontrino = ""; if (id_punto == "7" || id_punto == "1352") {scontrino = Ritira_File("Epson", "Scontrino2", "idr="+rs_ID_movimento);} else {scontrino = Ritira_File("Epson", "Scontrino", "idr="+rs_ID_movimento);} var output = Elabora_Testo_Epson(scontrino); SendWebservice({"testo_soap":output});} function Elabora_Testo_Epson(testo) {var rows = testo.split("\n"); var columns; var output = ""; var outputMessage = ""; var outputItem = ""; var outputDirectIO = ""; var outputTotal = ""; var lotteryCodePadded; for(var r = 0; r < rows.length; r++){columns = rows[r].split("|"); switch (columns[0]) {case "printRecMessage": outputMessage += "\n"; break; case "printRecItem": outputItem += "\n"; break; case "printRecItemAdjustment": outputItem += "\n"; break; case "printRecLotteryCode": lotteryCodePadded = columns[2].replace(/[\n\r]+/g, '').padEnd(16); outputDirectIO += "\n"; break; case "printRecSubtotal": outputTotal += "\n"; break; case "printRecSubtotalAdjustment": outputTotal += "\n"; break; case "printRecTotal": outputTotal += "\n"; break; default: break;}} output = "\n"+"\n"+"\n"+"\n"+"\n"+outputItem+outputDirectIO+outputMessage+outputTotal+"\n"+"\n"+"\n"+""; return output;} function ping(args) {var polling_frequency = (typeof args.polling_frequency === 'undefined' ? 60000 : args.polling_frequency); var testo_soap = ""; var xmlhttp = new XMLHttpRequest(); if (stampa_impostazioni_Polling) {switch (Stampante_Scontrini) {case "RCH": testo_soap = ""+""+""+""+""+""+""+""; xmlhttp.open('POST', PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+'/service.cgi', true); break; case "Epson": testo_soap = ""+""+""+""+""+""+""+""; xmlhttp.open('POST', PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+'/cgi-bin/fpmate.cgi', true); break; default: break;} xmlhttp.timeout = 20000; xmlhttp.ontimeout = function (e) {}; xmlhttp.onreadystatechange = function () {if (xmlhttp.readyState == 4) {if (xmlhttp.status == 200) {}}}; xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.send(testo_soap); setTimeout(function(){ping({"polling_frequency": polling_frequency});}, polling_frequency);}} function AnnulloScontrino(args) {var chiusura = ""; var AnnulloScontrino_IP; var AnnulloScontrino_Date; var AnnulloScontrino_DateParts; var AnnulloScontrino_DateParts = args.d.split("/"); var AnnulloScontrino_Date = new Date(+AnnulloScontrino_DateParts[2], AnnulloScontrino_DateParts[1] - 1, +AnnulloScontrino_DateParts[0]); var AnnulloScontrino_RTDate; if (stampa_impostazioni_IP_Fisso_fiscale_tipo == "Windows") {} else {switch (Stampante_Scontrini) {case "RCH": AnnulloScontrino_RTDate = (AnnulloScontrino_Date.getDate() < 10 ? "0" : "")+AnnulloScontrino_Date.getDate().toString()+((AnnulloScontrino_Date.getMonth()+1) < 10 ? "0" : "")+(AnnulloScontrino_Date.getMonth()+1).toString()+AnnulloScontrino_Date.getFullYear().toString().substr(-2); chiusura = ""+""+"=K"+"=k/&"+AnnulloScontrino_RTDate+"/["+args.z+"/]"+args.n+""+"=K"+""; break; case "Epson": AnnulloScontrino_RTDate = (AnnulloScontrino_Date.getDate() < 10 ? "0" : "")+AnnulloScontrino_Date.getDate().toString()+((AnnulloScontrino_Date.getMonth()+1) < 10 ? "0" : "")+(AnnulloScontrino_Date.getMonth()+1).toString()+AnnulloScontrino_Date.getFullYear().toString(); chiusura = ""+""+""+""+""+""+""+""+""+""; break; default: break;} SendWebservice({"testo_soap":chiusura, "elabora_risposta":false});}} function ChiusuraCassa() {var ChiusuraCassa_IP; if (stampa_impostazioni_IP_Fisso_fiscale_tipo == "Windows") {ChiusuraCassa_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+":"+stampa_impostazioni_IP_Fisso_fiscale_porta+"/?stampante=chiusura"; $.ajax({url: ChiusuraCassa_IP, async:true, cache: false, type: "POST", timeout: 20000, dataType: "json"});} else {switch (Stampante_Scontrini) {case "RCH": var chiusura = Ritira_File(Stampante_Scontrini, "Chiusura", ""); chiusura = Elabora_Testo_RCH(chiusura); break; case "Epson": chiusura = ""+""+""; break; default: break;} SendWebservice({"testo_soap":chiusura, "elabora_risposta":false});} ultima_chiusura_cassa = new Date();} function StatoCassa() {var StatoCassa_IP; if (stampa_impostazioni_IP_Fisso_fiscale_tipo == "Windows") {StatoCassa_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+":"+stampa_impostazioni_IP_Fisso_fiscale_porta+"/?stampante=stato"; $.ajax({url: StatoCassa_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} else {switch (Stampante_Scontrini) {case "RCH": var stato = Ritira_File(Stampante_Scontrini, "Stato", ""); stato = Elabora_Testo_RCH(stato); break; case "Epson": stato = ""; break; default: break;} SendWebservice({"testo_soap":stato, "elabora_risposta":false});}} function RistampaUltimoScontrino() {var RistampaUltimoScontrino; if (stampa_impostazioni_IP_Fisso_fiscale_tipo == "Windows") {RistampaUltimoScontrino = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+":"+stampa_impostazioni_IP_Fisso_fiscale_porta+"/?stampante=ristampa"; $.ajax({url: RistampaUltimoScontrino, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} else {switch (Stampante_Scontrini) {case "RCH": var ristampa = ""; break; case "Epson": ristampa = ""; break; default: break;} SendWebservice({"testo_soap":ristampa, "elabora_risposta":false});}} function SincronizzaMetodiPagamento() {var Metodi_IP; if (stampa_impostazioni_IP_Fisso_fiscale_tipo == "Windows") {Metodi_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+":"+stampa_impostazioni_IP_Fisso_fiscale_porta+"/?stampante=metodi"; $.ajax({url: Metodi_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} else {var testo = Ritira_File(Stampante_Scontrini, "Metodi", ""); var testo_soap = Elabora_Testo_RCH(testo); SendWebservice({"testo_soap":testo_soap});}} function SincronizzaRepartiFiscali(sr_id_punto) {var Reparti_IP; if (stampa_impostazioni_IP_Fisso_fiscale_tipo == "Windows") {Reparti_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+":"+stampa_impostazioni_IP_Fisso_fiscale_porta+"/?stampante=reparti&id1="+sr_id_punto; $.ajax({url: Reparti_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} else {var testo = Ritira_File(Stampante_Scontrini, "Reparti", "id_punto="+sr_id_punto); var testo_soap = Elabora_Testo_RCH(testo); SendWebservice({"testo_soap":testo_soap});}} function SincronizzaIva(sr_id_punto) {var Iva_IP; if (stampa_impostazioni_IP_Fisso_fiscale_tipo == "Windows") {Iva_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+":"+stampa_impostazioni_IP_Fisso_fiscale_porta+"/?stampante=iva&id1="+sr_id_punto; $.ajax({url: Iva_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} else {var testo = Ritira_File(Stampante_Scontrini, "Iva", ""); var testo_soap = Elabora_Testo_RCH(testo); SendWebservice({"testo_soap":testo_soap});}} function ImpostaIndirizzoIP(ip, gateway) {var II_IP; if (stampa_impostazioni_IP_Fisso_fiscale_tipo == "Windows") {II_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso_fiscale+":"+stampa_impostazioni_IP_Fisso_fiscale_porta+"/?stampante=ip&a="+ip+"&b="+gateway; $.ajax({url: II_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} else {var testo = Ritira_File(Stampante_Scontrini, "IP", "ip="+ip+"&gw="+gateway); var testo_soap = Elabora_Testo_RCH(testo); SendWebservice({"testo_soap":testo_soap});}} function Stampa_fiche_desktop(sr_id_cliente, sr_id_punto) {if (typeof Stampante_fiche_usa !== 'undefined') {if (Stampante_fiche_usa == "True") {jsobject.callNET_Stampa_fiche(sr_id_cliente, sr_id_punto);}}} function Stampa_fiche(sr_id_cliente, sr_id_punto, sr_ip) {var stampa_fiche_IP, stampa_fiche_Tipo; if (stampa_impostazioni_IP_Fisso_usa) {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso; stampa_fiche_Tipo = stampa_impostazioni_IP_Fisso_tipo;} else {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_print_server; stampa_fiche_Tipo = stampa_impostazioni_Tipo_print_server;} stampa_fiche_IP += ":8080"; stampa_fiche_IP += "/?id1="+sr_id_cliente+"&id2="+sr_id_punto+"&stampante=fiche"; $.ajax({url: stampa_fiche_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} function Stampa_voucher_desktop(sv_id_cliente, sv_id_punto, sv_id_voucher) {if (typeof Stampante_fiche_usa !== 'undefined') {if (Stampante_fiche_usa == "True") {jsobject.callNET_Stampa_voucher(sv_id_cliente, sv_id_punto, sv_id_voucher);}}} function Stampa_voucher(sv_id_cliente, sv_id_punto, sv_id_voucher, sr_ip) {var stampa_voucher_IP, stampa_vouchere_Tipo; if (stampa_impostazioni_IP_Fisso_usa) {stampa_voucher_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso; stampa_voucher_Tipo = stampa_impostazioni_IP_Fisso_tipo;} else {stampa_voucher_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_print_server; stampa_voucher_Tipo = stampa_impostazioni_Tipo_print_server;} stampa_voucher_IP += ":8080"; stampa_voucher_IP += "/?id1="+sv_id_cliente+"&id2="+sv_id_punto+"&id3="+sv_id_voucher+"&stampante=voucher"; $.ajax({url: stampa_voucher_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} function Stampa_preconto_desktop(sp_id_cliente, sp_id_punto, sp_id_movimento) {if (typeof Stampante_fiche_usa !== 'undefined') {if (Stampante_fiche_usa == "True") {jsobject.callNET_Stampa_preconto(sp_id_cliente, sp_id_punto, sp_id_movimento);}}} function Stampa_preconto(sp_id_cliente, sp_id_punto, sp_id_movimento, sp_ip) {var stampa_fiche_IP, stampa_fiche_Tipo; if (stampa_impostazioni_IP_Fisso_usa) {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso; stampa_fiche_Tipo = stampa_impostazioni_IP_Fisso_tipo;} else {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_print_server; stampa_fiche_Tipo = stampa_impostazioni_Tipo_print_server;} stampa_fiche_IP += ":8080"; stampa_fiche_IP += "/?id1="+sp_id_cliente+"&id2="+sp_id_punto+"&id3="+sp_id_movimento+"&stampante=preconto"; $.ajax({url: stampa_fiche_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} function Stampa_corrispettivi_desktop(sp_id_punto, sp_id_culture) {if (typeof Stampante_fiche_usa !== 'undefined') {if (Stampante_fiche_usa == "True") {jsobject.callNET_Stampa_corrispettivi(sp_id_punto, sp_id_culture);}}} function Stampa_corrispettivi(sp_id_punto, sp_id_culture, sp_ip) {var stampa_fiche_IP, stampa_fiche_Tipo; if (stampa_impostazioni_IP_Fisso_usa) {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso; stampa_fiche_Tipo = stampa_impostazioni_IP_Fisso_tipo;} else {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_print_server; stampa_fiche_Tipo = stampa_impostazioni_Tipo_print_server;} stampa_fiche_IP += ":8080"; stampa_fiche_IP += "/?id_punto="+sp_id_punto+"&id_culture="+sp_id_culture+"&stampante=corrispettivi"; $.ajax({url: stampa_fiche_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} function Stampa_appuntamento_desktop(sp_id_punto, sp_id_appuntamento) {if (typeof Stampante_fiche_usa !== 'undefined') {if (Stampante_fiche_usa == "True") {jsobject.callNET_Stampa_appuntamento(sp_id_punto, sp_id_appuntamento);}}} function Stampa_appuntamento(sp_id_punto, sp_id_appuntamento, sp_ip) {var stampa_fiche_IP, stampa_fiche_Tipo; if (stampa_impostazioni_IP_Fisso_usa) {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso; stampa_fiche_Tipo = stampa_impostazioni_IP_Fisso_tipo;} else {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_print_server; stampa_fiche_Tipo = stampa_impostazioni_Tipo_print_server;} stampa_fiche_IP += ":8080"; stampa_fiche_IP += "/?id_punto="+sp_id_punto+"&id_appuntamento="+sp_id_appuntamento+"&stampante=appuntamento"; $.ajax({url: stampa_fiche_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} function Stampa_punti_cliente_desktop(sp_id_punto, sp_id_cliente) {if (typeof Stampante_fiche_usa !== 'undefined') {if (Stampante_fiche_usa == "True") {jsobject.callNET_Stampa_punti_cliente(sp_id_punto, sp_id_cliente);}}} function Stampa_punti_cliente(sp_id_punto, sp_id_cliente, sp_ip) {var stampa_fiche_IP, stampa_fiche_Tipo; if (stampa_impostazioni_IP_Fisso_usa) {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso; stampa_fiche_Tipo = stampa_impostazioni_IP_Fisso_tipo;} else {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_print_server; stampa_fiche_Tipo = stampa_impostazioni_Tipo_print_server;} stampa_fiche_IP += ":8080"; stampa_fiche_IP += "/?id_punto="+sp_id_punto+"&id_cliente="+sp_id_cliente+"&stampante=punti"; $.ajax({url: stampa_fiche_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} function Stampa_appuntamenti_cliente(sp_id_punto, sp_id_cliente) {var stampa_fiche_IP, stampa_fiche_Tipo; if (stampa_impostazioni_IP_Fisso_usa) {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_Fisso; stampa_fiche_Tipo = stampa_impostazioni_IP_Fisso_tipo;} else {stampa_fiche_IP = PrintProtocol().replace("safe", "")+stampa_impostazioni_IP_print_server; stampa_fiche_Tipo = stampa_impostazioni_Tipo_print_server;} stampa_fiche_IP += ":8080"; stampa_fiche_IP += "/?id_punto="+sp_id_punto+"&id_cliente="+sp_id_cliente+"&stampante=appuntamenti_cliente"; $.ajax({url: stampa_fiche_IP, async:true, cache: false, type: "POST", timeout: 10000, dataType: "json"});} function Chiudi_programma() {jsobject.callNET_Chiudi_programma();} function Minimizza_finestra() {jsobject.callNET_Minimizza_finestra();} function Massimizza_finestra() {jsobject.callNET_Massimizza_finestra();} function Normale_finestra() {jsobject.callNET_Normale_finestra();} function Handshake_print_server(hps_id_punto) {jsobject.callNET_Handshake_print_server(hps_id_punto);} function is_function(func) {return typeof window[func] !== 'undefined' && $.isFunction(window[func]);} function ByRef(br_val) {this.value = br_val;} function get_pollici_schermo() {var dpi_x = document.getElementById('dpi').offsetWidth; var dpi_y = document.getElementById('dpi').offsetHeight; var width = screen.width / dpi_x; var height = screen.height / dpi_y; return Math.sqrt(Math.pow(width,2)+Math.pow(height,2)).toFixed(1);} function getDensityDirectoryName() {if(!window.devicePixelRatio) {return 'mdpi';} if(window.devicePixelRatio > 1.5) {return 'xhdpi';} else if(window.devicePixelRatio > 1.0) {return 'hdpi';} return 'mdpi';} function pixel() {return "\"\"";} String.prototype.hexDecode = function(){var r=''; for(var i=0;i= 35 && event.keyCode <= 39)) {return;} else {if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) {event.preventDefault();}}});} function isNumber(n) {'use strict'; n = n.replace(/\./g, '').replace(',', '.'); return !isNaN(parseFloat(n)) && isFinite(n);} function input_solo_numeri_virgola_mobile(obj_input) {obj_input.keydown(function(event) {if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 || (event.keyCode == 65 && event.ctrlKey === true) || (event.keyCode >= 35 && event.keyCode <= 39)) {return;} else {if (event.shiftKey || event.keyCode == 44 || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) {event.preventDefault();}}});} function input_validate(obj_input) {var valore_input_precedente = obj_input.val(); obj_input.on('change keyup', function(event) {if (!event.target.validity.valid) {obj_input.val(valore_input_precedente);} else {valore_input_precedente = obj_input.val();}});} function em(input) {var emSize = parseFloat($("body").css("font-size")); return (emSize * input);} function form_provincia(path, name_provincia, name_comune, id_database_comune, prefisso_comune) {var select_provincia = $(path+" select[name='"+name_provincia+"']"); var provincia_selezionata = select_provincia.val(); var comune; var comune_messaggio = $(path+" ."+prefisso_comune+"_messaggio"); var comune_box = $(path+" ."+prefisso_comune+"_box"); select_provincia.chosen({width: "200px", allow_single_deselect: true}); select_provincia.trigger("chosen:updated"); select_provincia.chosen().change(function(e) {comune_box.html("Selezionare prima una provincia");}); if (provincia_selezionata == '0') {comune_messaggio.html("Selezionare prima una provincia").show(); comune_box.hide();} if (id_database_comune != '' && provincia_selezionata != '0') {$.ajax({type: "POST", url: (typeof dominio === 'undefined' || !dominio ? "" : dominio)+"ajax_comuni.asp", contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15", data: {'provincia' : provincia_selezionata, 'id_comune' : id_database_comune, 'nome_select_comune' : prefisso_comune}, success: function(msg){if(msg == "errore") {} else {comune_box.html(msg); comune_box.show(); comune_messaggio.hide(); comune = $(path+" select[name='"+name_comune+"']"); comune.chosen({allow_single_deselect: true}); comune.trigger("chosen:updated");}}, error: function(xhr, status, error) {}});} if (select_provincia.attr("change") != "ok") {select_provincia.change(function() {provincia_selezionata = select_provincia.val(); if (provincia_selezionata == '0') {comune_messaggio.html("Selezionare prima una provincia").show(); comune_box.hide();} else {$.ajax({type: "POST", url: (typeof dominio === 'undefined' || !dominio ? "" : dominio)+"ajax_comuni.asp", contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15", data: {'provincia' : provincia_selezionata, 'id_comune' : id_database_comune, 'nome_select_comune' : prefisso_comune}, success: function(msg){if(msg == "errore") {} else {comune_box.html(msg).show(); comune_messaggio.hide(); comune = $(path+" select[name='"+name_comune+"']"); comune.chosen({allow_single_deselect: true}); comune.trigger("chosen:updated");}}, error: function(xhr, status, error) {}});}});} select_provincia.attr("change", "ok");} function GetURLParameter(sParam) {var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) {var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) {return sParameterName[1];}}} function VarSet(varString, newValue) {eval(varString+" = "+newValue);} function Select_HTML_da_JSON(shj_json, shj_valore_selezionato, shj_option, shj_value, shj_name_select) {var shj_output; shj_output = ""; return shj_output;} function login_esegui() {$.ajax({url: dominio+"login_punto_ajax.asp?piattaforma="+piattaforma, contentType: "application/x-www-form-urlencoded;charset=ISO-8859-1", type: "POST", data: $("#pannello_login .pannello_login_form").serialize(), dataType: "text", success: function(data) {var login = $.parseJSON(data); if (login.Risposta == "Errore") {$("#pannello_login .pannello_login_scorrevole_status").html(login.Testo_errore).css('background-color','#C00'); if (login.Codice_errore == "8") {$("#pannello_login .pannello_login_scorrevole_status").append("Rinnova online");} return false} else {id_label = login.ID_label; id_attivita = login.ID_attivita; id_punto = login.ID_punto; id_operatore = login.ID_operatore; id_culture = login.Culture.ID_culture; id_agente = login.ID_agente; Agente = login.Agente; Nome_Punto = login.Nome_punto; Provincia_Punto = login.Provincia_Punto; Email_Punto = login.Email_punto; Computer_Punto = login.Computer_Punto; Telefono_Punto = login.Telefono_Punto; Cellulare_Punto = login.Cellulare_Punto; Stampante_Fiche_Punto = login.Stampante_Fiche_Punto; Stampante_Ricevute_Punto = login.Stampante_Ricevute_Punto; Scadenza = login.Scadenza; a1 = login.a1; a2 = login.a2; a3 = login.a3; a4 = login.a4; Consulenza = login.Consulenza; App_clienti = login.App_clienti; Prenotado = login.Prenotado; Culture = login.Culture; $("#pannello_login input[type='button']").hide(); $("#pannello_login .pannello_login_scorrevole_status").html("Accesso in corso").css('background-color','#090'); carica_pannelli(login.File, 0); $(".pannello_login_immagini").backstretch("destroy", true); if (piattaforma == "desktop") {Handshake_print_server(id_punto);}}}, error: function (xhr, ajaxOptions, thrownError) {$("#pannello_login input[type='button']").show();}});} function login2_esegui(le_form, le_button, le_status, le_spinner) {le_button.hide(); le_spinner.show(); if (!login_in_corso) {login_in_corso = true; $.ajax({url: dominio+"login_punto_ajax.asp?piattaforma="+piattaforma, contentType: "application/x-www-form-urlencoded;charset=ISO-8859-1", type: "POST", data: le_form.serialize(), timeout: 2500, dataType: "text", success: function(data) {var login = $.parseJSON(data); if (login.Risposta == "Errore") {le_status.html(login.Testo_errore).css({"background-color":"#C00", "color":"#FFF"}).show(); if (login.Codice_errore == "8") {le_status.append("
Per informazioni chiamare il numero: 091.5640490.
");} le_button.show(); le_spinner.hide(); login_in_corso = false; return false} else {le_form.find(".password_container i").remove(); id_label = login.ID_label; id_attivita = login.ID_attivita; id_punto = login.ID_punto; id_operatore = login.ID_operatore; id_culture = login.Culture.ID_culture; id_agente = login.ID_agente; id_calendly = login.ID_calendly; ID_esterno = login.ID_E; Codice_WG = login.ID_C; Agente = login.Agente; Nome_Punto = login.Nome_punto; Indirizzo = login.Indirizzo; Civico = login.Civico; Comune_Punto = login.Comune_Punto; Provincia_Punto = login.Provincia_Punto; Regione_Punto = login.Regione_Punto; Cap_Punto = login.Cap_Punto; Email_Punto = login.Email_punto; Pec = login.Pec; Amministratore_Nome = login.Amministratore_Nome; Amministratore_Cognome = login.Amministratore_Cognome; Computer_Punto = login.Computer_Punto; Telefono_Punto = login.Telefono_Punto; Cellulare_Punto = login.Cellulare_Punto; Codice_Destinatario = login.Codice_Destinatario; Piva = login.Piva; Stampante_Fiche_Punto = login.Stampante_Fiche_Punto; Stampante_Ricevute_Punto = login.Stampante_Ricevute_Punto; Stampante_Scontrini = login.Stampante_Scontrini; Prodotto_consulenza = login.Prodotto_consulenza; Scadenza = login.Scadenza; Scadenza_app = login.Scadenza_app; Scadenza_plus = login.Scadenza_plus; ScadenzaT = login.ScadenzaT; a1 = login.a1; b12 = login.b12; a2 = login.a2; a3 = login.a3; a4 = login.a4; ftp1 = login.FTP1; ftp2 = login.FTP2; Punto_attivo = login.Punto_attivo; Consulenza = login.Consulenza; Landing = login.Landing; Whatsapp = login.WA; Whatsapp_P = login.WAP; Whatsapp_S = login.WAS; App_clienti = login.App_clienti; Prenotado = login.Prenotado; Invia_notifiche = login.Invia_notifiche; TW = login.TW; WAI = login.WAI; Culture = login.Culture; Versione_software = login.Versione_software; Scarica_anagrafica = login.SC; Accetta_Contratto = login.AC; Contratto_Accettato = login.CA; ID_consulente = login.ID_consulente; ID_ChargeBee = login.ID_ChargeBee; ID_ChargeBee_WeGest = login.ID_ChargeBee_WeGest; ID_ChargeBee_App = login.ID_ChargeBee_App; ID_ChargeBee_WeGestPlus = login.ID_ChargeBee_WeGestPlus; Settore1 = login.Settore1; Settore2 = login.Settore2; Settore3 = login.Settore3; Pet = login.Pe; SG = login.SG; SGN = login.SGN; Etichette = login.Etichette; Nexi_attivo = login.POS_attivo; ID_POS = login.ID_POS; ID_Business = login.ID_Business; Privilegi = []; moment.locale(Culture.Locale); document.title = "WeGest - "+Nome_Punto; le_status.html("Accesso in corso").css({"background-color":"#090", "color":"#FFF"}); carica_pannelli2(login.File, 0); if (piattaforma == "desktop") {Handshake_print_server(id_punto);}}}, error: function (xhr, ajaxOptions, thrownError) {le_button.show(); le_spinner.hide(); login_in_corso = false; if (ajaxOptions == "timeout") {le_status.html("Stiamo riscontrando dei problemi in fase di accesso. La invitiamo a riavviare il modem, verificare la sua connessione di rete riprovare tra qualche minuto.").css({"background-color":"#C00", "color":"#FFF"}).show();}}});}} function stringa_url() {var d_ts = new Date(); var n_ts = d_ts.getTime(); return "id_attivita="+id_attivita+"&id_punto="+id_punto+"&id_operatore="+id_operatore+"&id_culture="+id_culture+"&a1="+a1+"&a2="+a2+"&a3="+a3+"&a4="+a4+"&piattaforma="+piattaforma+"×tamp="+n_ts;} function dateAdd(date, interval, units) {var ret = new Date(date); switch(interval) {case 'year' : ret.setFullYear(ret.getFullYear()+units); break; case 'quarter': ret.setMonth(ret.getMonth()+3*units); break; case 'month' : ret.setMonth(ret.getMonth()+units); break; case 'week' : ret.setDate(ret.getDate()+7*units); break; case 'day' : ret.setDate(ret.getDate()+units); break; case 'hour' : ret.setTime(ret.getTime()+units*3600000); break; case 'minute' : ret.setTime(ret.getTime()+units*60000); break; case 'second' : ret.setTime(ret.getTime()+units*1000); break; default : ret = undefined; break;} return ret;} function getDatePlusNMonths(date, months){var splitted = date.split("/"); var date_dd = parseInt(splitted[0]) < 10 ? ("0"+parseInt(splitted[0])) : parseInt(splitted[0]); var date_mm = parseInt(splitted[1]) < 10 ? ("0"+parseInt(splitted[1])) : parseInt(splitted[1]); var date_yyyy = parseInt(splitted[2]); date = new Date(date_mm+"/"+date_dd+"/"+date_yyyy); var newDate = new Date(date.setMonth(date.getMonth()+months)); var dd = (newDate.getDate()); var mm = (newDate.getMonth() +1); var aaaa = (newDate.getFullYear()); if (dd < 10) {dd = "0"+dd;} if (mm < 10) {mm = "0"+mm;} return dd+"/"+mm+"/"+aaaa;} function getCurrentTime() {const now = new Date(); const hours = now.getHours().toString().padStart(2, '0'); const minutes = now.getMinutes().toString().padStart(2, '0'); const seconds = now.getSeconds().toString().padStart(2, '0'); const milliseconds = now.getMilliseconds().toString().padStart(3, '0'); return `${hours}:${minutes}:${seconds} ${milliseconds}`;} function parseDateFromXml(date){var amd = date.split('-'); return amd[2]+"/"+amd[1]+"/"+amd[0];} function convertHex(hex, opacity){hex = hex.replace('#',''); r = parseInt(hex.substring(0,2), 16); g = parseInt(hex.substring(2,4), 16); b = parseInt(hex.substring(4,6), 16); result = 'rgba('+r+','+g+','+b+','+opacity/100+')'; return result;} function convertHex2RGB(hex){hex = hex.replace('#',''); r = parseInt(hex.substring(0,2), 16); g = parseInt(hex.substring(2,4), 16); b = parseInt(hex.substring(4,6), 16); result = 'rgb('+r+','+g+','+b+')'; return result;} function ahex2rgba(hex){hex = hex.replace('#',''); a = parseInt(hex.substring(0,2), 16); r = parseInt(hex.substring(0,2), 16); g = parseInt(hex.substring(2,4), 16); b = parseInt(hex.substring(4,6), 16); var rgba = "rgba("+r+","+g+","+b+","+(a/100)+")"; return rgba;} function shadeRGBColor(color, percent) {var f = color.split(","); var t = percent < 0 ? 0 :255; var p = percent < 0 ? percent*-1 : percent; var R = parseInt(f[0].slice(4)); var G = parseInt(f[1]); var B = parseInt(f[2]); return "rgb("+(Math.round((t-R)*p)+R)+","+(Math.round((t-G)*p)+G)+","+(Math.round((t-B)*p)+B)+")";} function shadeHexColor(colore, quantita) {var r = parseInt(colore.substring(0,2), 16); var g = parseInt(colore.substring(2,4), 16); var b = parseInt(colore.substring(4,6), 16); r = Math.round(Math.min(Math.max(0, r - quantita), 255)); g = Math.round(Math.min(Math.max(0, g - quantita), 255)); b = Math.round(Math.min(Math.max(0, b - quantita), 255)); return "rgb("+r+","+g+","+b+")";} function Button_Accordion_Inizializza(bai_prefix) {bai_prefix.find(".button_accordion").each(function(index) {$(this) .find(".nome_button").html(" "+$(this).attr("nome")) .end() .find(".riga_dati:even").addClass("alternata");}); bai_prefix.find(".button_accordion").not("input").click(function(e) {if ($(this).find(".totale_riepilogo").is(":visible")) {$(this) .find(".totale_riepilogo").fadeOut() .end() .find(".nome_button").html(" "+$(this).attr("nome")); $(this).find(".button_dati").slideToggle("slow");} else {if (e.target.type != "text" && $(e.target).hasClass('no_accordion_click') == false) {$(this) .find(".totale_riepilogo").fadeIn() .end() .find(".nome_button").html(" "+$(this).attr("nome")); $(this).find(".button_dati").slideToggle("slow");}}}); bai_prefix.find(".button_accordion:first").click();} function ValidateEmail(value) {var mailformat = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/; if (value.match(mailformat) === null) {return false;} else {return true;}} function ValidateUrl(value) {var urlformat = /http(s?):\/\/(www\.)?[A-Za-z0-9\.-]{3,}\.[A-Za-z]{2,}/g; if (value.match(urlformat) === null) {return false;} else {return true;}} function ValidateNumber(value, decimal_separator) {var numberformat; if (decimal_separator === ".") {numberformat = /^(\d+|\d{1,3}(\,\d{3})*)(.\d+)?$/;} else {numberformat = /^(\d+|\d{1,3}(\.\d{3})*)(,\d+)?$/;} if (value.match(numberformat) === null) {return false;} else {return true;}} function LogHandler(args){var url = "https://www.t0p.it/logs/"; var userAgent = navigator ? navigator.userAgent : "-"; var origine = window.location.href ? window.location.href : "/?"; var parametri = args.Parametri; var risposta = args.Risposta; if (typeof args.Parametri != "string"){parametri = JSON.stringify(args.Parametri);} if (args.Risposta){if (typeof args.Risposta != "string"){risposta = JSON.stringify(args.Risposta);}} else{risposta = "";} $.ajax({type: "POST", url: url, data: {ID_punto: id_punto, ID_cliente: args.ID_cliente, Piattaforma: "wegest", Url: args.Url, Metodo: args.Metodo, Parametri: parametri, Risposta: risposta, Risposta_codice: args.Risposta_codice, Etichetta: args.Etichetta, Note: args.Note, UserAgent: userAgent, Origine: origine}, success: function (r) {}});} function LogAppuntamenti(args){$.ajax({type: "POST", url: "https://www.t0p.it/logs/agenda/", data: {ID_appuntamento: args.ID_appuntamento, ID_punto: id_punto, ID_cliente: args.ID_cliente, Data: args.Data, Inizio: args.Inizio, Azione: args.Azione, Servizi: args.Servizi, Piattaforma: "wegest", Note: args.Note}, success: function (r) {}});} function LogAnagrafica(args){$.ajax({type: "POST", url: "https://www.t0p.it/logs/anagrafica/", data: {ID_punto: id_punto, ID_cliente: args.ID_cliente, Azione: args.Azione, Nome_precedente: args.Nome_precedente, Nome: args.Nome, Dettagli: args.Dettagli, Piattaforma: "wegest", Note: args.Note}, success: function (r) {}});} function LogNoteTecniche(args){$.ajax({type: "POST", url: "https://www.t0p.it/logs/note_tecniche/index.php", data: {ID_punto: id_punto, ID_cliente: args.ID_cliente, ID_nota_tecnica: args.ID_nota_tecnica, Dettagli: args.Dettagli, Azione: args.Azione, Piattaforma: "wegest",}, success: function (r) {}});} function convertURLParamsToObj(urlEncodedString){const urlParams = new URLSearchParams(urlEncodedString); const obj = {}; for (const [key, value] of urlParams) {if (obj[key]) {obj[key].push(value);} else {obj[key] = [value];}} return obj;} function objectToUri(obj) {const keyValuePairs = []; for (const key in obj) {if (Object.hasOwnProperty.call(obj, key)) {const value = encodeURIComponent(obj[key]); keyValuePairs.push(`${key}=${value}`);}} return `?${keyValuePairs.join('&')}`;} var obj_window; var obj_window_altezza; var obj_window_larghezza; var box_wrapper; var box_wrapper_altezza; var box_wrapper_larghezza; var box_pannelli; var box_menu; function ReLayout() {obj_window = $(window); obj_window_altezza = obj_window.height(); obj_window_larghezza = obj_window.width(); box_wrapper = $("#wrapper"); box_wrapper.outerHeight(obj_window_altezza); box_wrapper.outerWidth(obj_window_larghezza); box_wrapper_altezza = obj_window_altezza; box_wrapper_larghezza = obj_window_larghezza; box_pannelli = $(".pannello"); box_pannelli.outerHeight(box_wrapper_altezza); box_pannelli.each(function(index, element) {if ($(this).attr("relayout") != "no") {$(this).outerWidth(box_wrapper_larghezza);}}); $(".pannello_interno").css('max-height', (box_wrapper_altezza - parseInt($(".pannello_interno").css('margin-top')))+"px"); box_menu = $("#menu"); box_menu.outerHeight(box_wrapper_altezza);} $(function() {$("#pulsante_chiudi").click(function(e) {Chiudi_programma();}); $("#pulsante_minimizza").click(function(e) {Minimizza_finestra();}); $("#pulsante_massimizza").click(function(e) {Massimizza_finestra(); $(this).hide(); $("#pulsante_normale").show();}); $("#pulsante_normale").click(function(e) {Normale_finestra(); $(this).hide(); $("#pulsante_massimizza").show();}); $("#pulsante_impostazioni").click(function(e) {$("#menu .pulsante_menu").removeClass("selezionato"); box_pannelli.hide(); $("#pannello_impostazioni").show(); eval("pannello_impostazioni_inizializza()");}); $(window).resize(function() {ReLayout();});}); function carica_pannelli(cp_array_pannelli, cp_indice) {var numero_pannelli = cp_array_pannelli.length; if (cp_indice < numero_pannelli) {$.each(cp_array_pannelli[cp_indice], function(key, value) {if (value.indexOf(".js") > 0) {$.getScript(dominio+value, function (pannello) {$("#bip").html(key); carica_pannelli(cp_array_pannelli, cp_indice+1);});} else {$.get(dominio+value, function (pannello) {box_wrapper.append(pannello); $("#bip").html(key); carica_pannelli(cp_array_pannelli, cp_indice+1);});}});} else {ReLayout(); $("#pannello_dashboard").css({"display":"flex"}); $("#pannello_menu").show(); pannello_dashboard_inizializza(); $("#pannello_login").animate({'top': (obj_window_altezza +30)*-1}, {duration:900, complete: function() {$(this).hide(); $("#pulsante_impostazioni").show();}}); $("input").keypress(function (e) {if (e.which == 13) {e.preventDefault();}}); $("button").click(function(e) {e.preventDefault();});}} function carica_pannelli2(cp_array_pannelli, cp_indice) {var numero_pannelli = cp_array_pannelli.length; if (cp_indice < numero_pannelli) {$.each(cp_array_pannelli[cp_indice], function(key, value) {if (value.indexOf(".js") > 0) {$.getScript(dominio+value, function (pannello) {$("#pannello_login .avanzamento").html(key); carica_pannelli2(cp_array_pannelli, cp_indice+1);});} else {$.get(dominio+value, function (pannello) {if (key == "Menu") {box_wrapper.find(".wrapper_menu").append(pannello);} else {box_wrapper.find(".wrapper_contents").append(pannello);} $("#pannello_login .avanzamento").html(key); carica_pannelli2(cp_array_pannelli, cp_indice+1);});}});} else {$("#wrapper .wrapper_contents").show(); $("#wrapper .wrapper_menu").show(); ReLayout(); box_pannelli.hide(); $("#pannello_menu").show(); setTimeout(function() {switch (a1) {case "0": case "1": $("#pannello_dashboard").show(); pannello_dashboard_inizializza(); break; case "2": $("#pannello_statistiche").show(); pannello_statistiche_inizializza(); break; default: break;}}, 100); $("#pannello_login").animate({'top': (obj_window_altezza +30)*-1}, {duration:900, complete: function() {$(this).hide(); if (a1 == '1' && b12 == 'no') {$("#pulsante_impostazioni").hide();} else {$("#pulsante_impostazioni").show();}}}); $("input").keypress(function (e) {if (e.which == 13) {e.preventDefault();}}); $("button").click(function(e) {e.preventDefault();});}} function carica_pannelli3(cp_array_pannelli, cp_indice) {var numero_pannelli = cp_array_pannelli.length; if (cp_indice < numero_pannelli) {$.each(cp_array_pannelli[cp_indice], function(key, value) {if (value.indexOf(".js") > 0) {$.getScript(dominio+value, function (pannello) {$("#pannello_login .avanzamento").html(key); carica_pannelli3(cp_array_pannelli, cp_indice+1);});} else {$.get(dominio+value, function (pannello) {if (key == "Menu") {box_wrapper.find(".wrapper_menu").append(pannello);} else {box_wrapper.find(".wrapper_contents").append(pannello);} $("#pannello_login .avanzamento").html(key); carica_pannelli3(cp_array_pannelli, cp_indice+1);});}});} else {$("#wrapper .wrapper_contents").show(); $("#wrapper .wrapper_menu").show(); ReLayout(); box_pannelli.hide(); $("#pannello_menu").show(); setTimeout(function() {switch (a1) {case "0": case "1": if (Privilegi.includes("Dashboard") && Privilegi.includes("Agenda") && Privilegi.includes("Statistiche") && Privilegi.includes("Cassa") && Privilegi.includes("Marketing") && Privilegi.includes("Clienti")) {$("#pannello_dashboard").show(); pannello_dashboard_inizializza();} else if (Privilegi.includes("Dashboard")) {if (Privilegi.includes("Agenda")) menu_hide("pannello_clienti_cerca"); if (Privilegi.length < 5 && !(Privilegi.includes("Impostazioni"))) $("#pulsante_impostazioni").hide(); menu_hide("pannello_marketing"); $("#pannello_dashboard").show(); pannello_dashboard_inizializza(); break;} else if (Privilegi.includes("Cassa") && Privilegi.includes("Clienti")) {if (Privilegi.length < 5 && !(Privilegi.includes("Impostazioni"))) $("#pulsante_impostazioni").hide(); menu_hide("pannello_marketing"); $("#pannello_clienti_cerca").show(); pannello_clienti_cerca_inizializza("layout"); break;} else if (Privilegi.includes("Agenda")) {if (Privilegi.length < 5 && !(Privilegi.includes("Impostazioni"))) $("#pulsante_impostazioni").hide(); menu_hide("pannello_clienti_cerca"); $("#pannello_agenda").show(); pannello_agenda_inizializza(); break;} else if (Privilegi.includes("Statistiche")) {if (Privilegi.length < 5 && !(Privilegi.includes("Impostazioni"))) $("#pulsante_impostazioni").hide(); $("#pannello_statistiche").show(); eval("pannello_statistiche_inizializza()"); break;} else if (Privilegi.includes("Marketing")) {if (Privilegi.length < 5 && !(Privilegi.includes("Impostazioni"))) $("#pulsante_impostazioni").hide(); $("#pannello_marketing").show(); pannello_marketing_inizializza(); break;} else if (Privilegi.includes("Consulenza")) {if (Privilegi.length < 5 && !(Privilegi.includes("Impostazioni"))) $("#pulsante_impostazioni").hide(); if (Privilegi.includes("Statistiche")) menu_hide("pannello_statistiche"); $("#pannello_consulenza").show(); pannello_consulenza_inizializza(); break;} case "2": $("#pannello_statistiche").show(); pannello_statistiche_inizializza(); break; default: break;}}, 100); $("#pannello_login").animate({'top': (obj_window_altezza +30)*-1}, {duration:900, complete: function() {$(this).hide(); if (a1 == '1' && b12 == 'no') {$("#pulsante_impostazioni").hide();} else {if (Privilegi.length < 5 && !(Privilegi.includes("Impostazioni"))) {$("#pulsante_impostazioni").hide();} else {$("#pulsante_impostazioni").show();}}}}); $("input").keypress(function (e) {if (e.which == 13) {e.preventDefault();}}); $("button").click(function(e) {e.preventDefault();});}} piattaforma = GetURLParameter("piattaforma"); versione = parseInt(GetURLParameter("v")); dominio = "http://www.i-salon.eu/"; dominio = window.location.protocol+"//"+window.location.host+"/"; ajax_timeout = 6000; ajax_timeout_msg_errore = "Tempo assegnato all'operazione scaduto: verificare la connessione e riprovare."; Number.prototype.formatEuro = function(c, d, t){var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c))+"", j = (j = i.length) > 3 ? j % 3 : 0; return s+(j ? i.substr(0, j)+t : "")+i.substr(j).replace(/(\d{3})(?=\d)/g, "$1"+t)+(c ? d+Math.abs(n - i).toFixed(c).slice(2) : "");}; jQuery.expr[':'].Contains = function(a,i,m){return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;}; moment.lang('it', {relativeTime : {future: "%s", past: "%s", s: "alcuni secondi", m: "un minuto", mm: "%d minuti", h: "un'ora", hh: "%d ore", d: "un giorno", dd: "%d giorni", M: "un mese", MM: "%d mesi", y: "un anno", yy: "%d anni"}}); giorni_settimana_DB = ["Lunedi","Martedi","Mercoledi","Giovedi","Venerdi","Sabato","Domenica"]; ion.sound({sounds: [ {name: "computer_error"}, {name: "glass",} ], volume: 1, path: dominio+"media/suoni/", preload: true}); $(function() {$.datepicker.setDefaults($.datepicker.regional[ "it" ]); ReLayout(); $("#pannello_login").show(); pollici_schermo = parseInt(get_pollici_schermo()); if (box_wrapper_larghezza > 1600 && box_wrapper_larghezza < 2000) {$("body").css("font-size","18px");} else if (box_wrapper_larghezza >= 2000) {$("body").css("font-size","22px");} $.support.cors = true;}); if (navigator.userAgent.indexOf("MSIE", 0) != -1 || navigator.userAgent.indexOf("Trident", 0) != -1 || navigator.userAgent.indexOf("Edge/", 0) != -1) {window.location = dominio+"browser_non_compatibile.asp";} else {if (piattaforma != "electron") {window.onbeforeunload = function() {return 'Sei sicuro di voler lasciare la pagina?';};}}