';
var parametri = new URLSearchParams();
parametri.append("azione", "sincronizzaDocumentiSysint");
parametri.append("data", dataDocumenti);
const queryString = parametri.toString();
const url = "API-gestione-ordini-logistica";
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: queryString
})
.then(response => response.json())
.then(data => {
if (data.error === "no") {
document.getElementById("popup_resp_TESTO").innerHTML=data.message;
} else {
alert(data.message);
}
})
.catch(error => {
alert("Errore nella richiesta. " + error);
})
.finally(() => {
});
}
function sblocca_consegna_sottocosto(id_ordine){
document.getElementById("oscuramento_nero").style.display="block";
var parametri = new URLSearchParams();
parametri.append("azione", "autorizzaOrdineSottocosto");
parametri.append("codice_ordine", id_ordine);
const queryString = parametri.toString();
const url = "API-gestione-ordini-logistica";
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: queryString
})
.then(response => response.json())
.then(data => {
if (data.error === "no") {
document.getElementById("modifica_giro_ordineBLOCCATO"+id_ordine).innerHTML = data.selectGiro;
document.getElementById("vendita_sottocosto_pulsante"+id_ordine).innerHTML='';
} else {
alert(data.message);
}
})
.catch(error => {
alert("Errore nella richiesta. " + error);
})
.finally(() => {
document.getElementById("oscuramento_nero").style.display="none";
});
}
function invia_modulo_conferma_azione(azione)
{
//1 posticipa
//2 elimina
document.getElementById("azione_massiva").value=azione;
document.conferma_massiva_form.action = "gestione_ordini_sysint.php";
document.conferma_massiva_form.submit();
}
function conferma_massiva()
{
var i = 0;
var flag;
var modulo = document.getElementsByTagName("input");
flag=0;
document.getElementById("elenco_ordini_massivi").value='';
for (i=0; i
INSERISCI LA DESTINAZIONE DIVERSA
';
document.getElementById("popup_resp").style.display="block";
}
else
{
alert("Per modificare gli ordini devi essere loggato come amministratore");
}
}
function aggiungi_nota_ordine(div, cod_ordine, disabled)
{
if(disabled.trim()!='disabled')
{
destinazione_esistente= document.getElementById(div).innerHTML;
document.getElementById("oscuramento_nero").style.display="block";
document.getElementById("popup_resp_TESTO").innerHTML='
INSERISCI LA NOTA PER IL CLIENTE
';
document.getElementById("popup_resp").style.display="block";
}
else
{
alert("Per modificare gli ordini devi essere loggato come amministratore");
}
}
function memorizza_nota_cliente(div, cod_ordine)
{
note_ordine_cliente=document.getElementById("NOTA_ORDINE_text").value;
if(note_ordine_cliente.trim()!='')
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(div).innerHTML=note_ordine_cliente;
//document.getElementById(div).style.display='none';
$("div#caricamento").css("display","none");
document.getElementById("popup_resp").style.display="none";
document.getElementById("oscuramento_nero").style.display="none";
}
}
xmlhttp.open("GET","funzioni_gestione_ordini_aggiungi_nota.php?codice_ordine="+cod_ordine+"¬e_ordine_cliente="+note_ordine_cliente,true);
xmlhttp.send();
//$("div#oscuramento").css("display","block");
}
else
{
alert("La destinazione che hai inserito sembra essere vuota. Verifica per favore.");
}
}
function memorizza_destinazione_diversa(div, cod_ordine)
{
destinazione_inserita=document.getElementById("destinazione_diversa_text").value;
if(destinazione_inserita.trim()!='')
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(div).innerHTML='' +destinazione_inserita;
//document.getElementById(div).style.display='none';
$("div#caricamento").css("display","none");
document.getElementById("popup_resp").style.display="none";
document.getElementById("oscuramento_nero").style.display="none";
}
}
xmlhttp.open("GET","funzioni_gestione_ordini_aggiungi_destinazione.php?codice_ordine="+cod_ordine+"&destinazione="+destinazione_inserita,true);
xmlhttp.send();
//$("div#oscuramento").css("display","block");
}
else
{
alert("La destinazione che hai inserito sembra essere vuota. Verifica per favore.");
}
}
function mostra_nascondi_dettagli_ordine(div)
{
if(document.getElementById(div).style.display=='none')
{
document.getElementById(div).style.display='block';
}
else
{
document.getElementById(div).style.display='none';
}
}
function ordine_confermata_completezza(codice_ordine)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
//funziondocument.getElementById("div_settori").innerHTML=xmlhttp.responseText;
$("div#oscuramento_nero").css("display","none");
$("div#ordine_potenzialmente_aperto"+codice_ordine).css("display","none");
document.getElementById("flag_conf_compl"+codice_ordine).value=0;
}
}
xmlhttp.open("GET","funzioni_gestione_ordini_ord_apert_ajax.php?codice_ordine="+codice_ordine,true);
xmlhttp.send();
$("div#oscuramento_nero").css("display","block");
}
function mostra_nascondi_ultime_etichette()
{
if(document.getElementById("elenco_etichette").style.display=="block")
{
$("div#elenco_etichette").slideUp("fast");
document.getElementById("elenco_etichette").style.display="none";
}
else
{
$("div#elenco_etichette").slideDown("slow");
document.getElementById("elenco_etichette").style.display="block";
}
}
function mostra_nascondi_dettagli_ordine(div)
{
if(document.getElementById(div).style.display=='none')
{
document.getElementById(div).style.display='block';
}
else
{
document.getElementById(div).style.display='none';
}
}
function abilita_tasto_conferma(codice)
{
if(codice!=0)
{
document.getElementById("tasto_conferma").disabled=false;
}
else
{
document.getElementById("tasto_conferma").disabled=true;
}
}
function visualizzazione(n)
{
var x = document.createElement("INPUT");
x.setAttribute("type", "hidden");
x.setAttribute("value", n);
x.setAttribute("name", "tipo_visualizzazione");
x.setAttribute("id", "tipo_visualizzazione");
document.getElementById("form_filtri").appendChild(x);
document.getElementById("form_filtri").submit();
return;
document.getElementById("tipo_visualizzazione").value = n;
if(document.getElementById("tipo_visualizzazione").value == n ) {
document.getElementById("form_filtri").submit();
} else {
alert("Errore");
}
}
function informazioni_sincronizzazione_dati()
{
document.getElementById("oscuramento_nero").style.display="block";
document.getElementById("popup_resp").style.display="block";
document.getElementById("popup_resp_TESTO").innerHTML='
';
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
//funziondocument.getElementById("div_settori").innerHTML=xmlhttp.responseText;
document.getElementById("popup_resp_TESTO").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","funzioni_gestione_ordini_vis_ultimi_ordseq_ajax.php",true);
xmlhttp.send();
$("div#oscuramento_nero").css("display","block");
}
function cerca_consegna_giri_chiusi()
{
testo_ricerca=document.getElementById("cerca_cons").value;
if(testo_ricerca.trim().length<3 || testo_ricerca=='')
{
alert("Inserisci un testo valido per la ricerca. Devi mettere almeno 3 lettere");
return;
}
document.getElementById("oscuramento_nero").style.display="block";
document.getElementById("popup_resp").style.display="block";
document.getElementById("popup_resp_TESTO").innerHTML='
';
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
//funziondocument.getElementById("div_settori").innerHTML=xmlhttp.responseText;
document.getElementById("popup_resp_TESTO").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","funzioni_cerca_ordine_confermato_ajax.php?testo_ricerca="+testo_ricerca,true);
xmlhttp.send();
$("div#oscuramento_nero").css("display","block");
}
function cambia_colore_marker(colore,codordine)
{
//alert (colore);
if(colore == undefined)
{
colore='000000';
alert("Impossibile modificare il colore del marker. L'ordine e' stato tuttavia correttamente assegnato.");
}
var pinColor = colore;
var pinImage = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + pinColor);
window['marker_'+codordine].setIcon(pinImage);
infoWindow.close(map);
}
function verifica_flag_modifica_giro(nome_select, codice_ordine)
{
if(document.getElementById("flag_conf_compl"+codice_ordine).value==1 )
{
document.getElementById(nome_select).style.display="none";
alert("ATTENZIONE! Quest'ordine sembra esportato solo parzialmente, quindi alcuni articoli potrebbero non essere presenti nell'ordine. \nE' indispensabile che verichi che l'ordine presente su Sysint sia uguale a quello esportato.")
document.getElementById(nome_select).style.display="inline-block";
}
}
function modifica_giro_ordine(giro, codice_ordine, cod_cli, crediti)
{
if (crediti==1 )
{
if(!confirm('Il cliente risulta bloccato. Hai verificato/chiesto all amministrazione se si puo consegnare?'))
{
return;
}
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
//funziondocument.getElementById("div_settori").innerHTML=xmlhttp.responseText;
$("div#oscuramento_nero").css("display","none");
//se presente, cambia colore al marker
//alert("prova");
var element = document.getElementById("marker_"+codice_ordine);
//if(typeof(element) != 'undefined' && element != null)
{
//alert(typeof(element) );
cambia_colore_marker(colori_giri[giro],codice_ordine);
}
}
}
xmlhttp.open("GET","funzioni_gestione_ordini_ajax.php?giro="+giro+"&codice_ordine="+codice_ordine+"&cod_cli="+cod_cli+"&crediti="+crediti,true);
xmlhttp.send();
$("div#oscuramento_nero").css("display","block");
}
function elimina_coordinate_cliente(id_coordinate, nome_marker)
{
if(confirm("Vuoi eliminare le coordinate del cliente selezionato?"))
{
document.getElementById("oscuramento_nero").style.display="block";
document.getElementById("popup_resp_TESTO").innerHTML='