// Libreria di funzioni dedicate a questo sito function PfMoreR(){ // Aggiunta riga proforma invoice var nmax=document.getElementById('Pf_nmax').value*1; var nact=0; var lst=0; for(n=1;n<=nmax;n++){ if(document.getElementById('Pf_riga_'+n).style.display=='block'){nact++; lst=n;} } if(nact0 && ix<7){err++;}else{tot=tot+valore*1*qta*1;} } if(err>0 || tot==0){document.getElementById('Pf_fullit').value='N';}else{document.getElementById('Pf_fullit').value='S';} tot=Cents(tot,'.',',',2); document.getElementById('Pf_totfatt').innerHTML=tot+' '; PfInsertMO('0','BottPresa'); } function PfInsertMO(tp,classe){ var objj=document.getElementById('pfinvia1'); var fullit=document.getElementById('Pf_fullit').value; var paese=document.getElementById('pfid_paese_iso').value; var motivo=document.getElementById('pfmotivo').value; var valuta=document.getElementById('pfid_valuta_dogana').value; if(fullit=='S' && paese!='0' && motivo!='' && valuta!='0'){var err=0;}else{var err=1;} //alert(err+'|'+fullit+'|'+paese+'|'+motivo+'|'+valuta); if(err==0){ if(tp=='1'){objj.className=classe+'On';}else{objj.className=classe+'Off';} document.getElementById('fullit_txt').innerHTML=""; }else{objj.className=classe+'Dsb'; document.getElementById('fullit_txt').innerHTML=document.getElementById('fullit_txtBk').innerHTML;} } function PfInv_submit(){ // Trasferisce i valori nei campi jsdettx1_vl e jsdettx2_vl var fullit=document.getElementById('Pf_fullit').value; var paese=document.getElementById('pfid_paese_iso').value; var motivo=document.getElementById('pfmotivo').value; var valuta=document.getElementById('pfid_valuta_dogana').value; if(fullit=='S' && paese!='0' && motivo!='' && valuta!='0'){var err=0;}else{var err=1;} if(err==0){ var frmSTmisunt=document.getElementById('frmSTmisunt').value; var jsdettx1_vl="MAIN|-*|"+paese+"|-*|"+motivo+"|-*|"+valuta+"|-*|"+frmSTmisunt; document.getElementById('jsdettx1_vl').value=jsdettx1_vl; var nmax=document.getElementById('Pf_nmax').value*1; var err=0; var ix=0; var jsdettx2_vl=""; var virg=''; for(n=1;n<=nmax;n++){ var descri=document.getElementById('Pf_descri_'+n).value; var peso_netto=document.getElementById('Pf_peso_netto_'+n).value; var peso_lordo=document.getElementById('Pf_peso_lordo_'+n).value; var peso_unit=document.getElementById('Pf_peso_unit_'+n).value; var voce=document.getElementById('Pf_voce_'+n).value; var qta=document.getElementById('Pf_qta_'+n).value; var qta_unit=document.getElementById('Pf_qta_unit_'+n).value; var valore=document.getElementById('Pf_valore_'+n).value; if(descri!=''){ jsdettx2_vl=jsdettx2_vl+virg+"REC"+"|-*|"+descri+"|-*|"+voce+"|-*|"+qta+"|-*|"+qta_unit+"|-*|"+peso_netto+"|-*|"+peso_lordo+"|-*|"+peso_unit+"|-*|"+valore; virg='!#RGQ!#'; } } if(jsdettx2_vl!=''){ document.getElementById('jsdettx2_vl').value=jsdettx2_vl; document.getElementById('Win900').style.display='none'; GreyScreen('none'); MostraBottoni('block'); }else{alert('Some mandatory fields are empty');} } } function PfInv2_submit(){ // Invia via post i dettagli della proforma var fullit=document.getElementById('Pf_fullit').value; var paese=document.getElementById('pfid_paese_iso').value; var motivo=document.getElementById('pfmotivo').value; var valuta=document.getElementById('pfid_valuta_dogana').value; if(fullit=='S' && paese!='0' && motivo!='' && valuta!='0'){var err=0;}else{var err=1;} if(err==0){ var jsdettx1_vl="MAIN|-*|"+paese+"|-*|"+motivo+"|-*|"+valuta+"|-*|"; var nmax=document.getElementById('Pf_nmax').value*1; var err=0; var ix=0; var jsdettx2_vl=""; var virg=''; for(n=1;n<=nmax;n++){ var descri=document.getElementById('Pf_descri_'+n).value; var peso_netto=document.getElementById('Pf_peso_netto_'+n).value; var peso_lordo=document.getElementById('Pf_peso_lordo_'+n).value; var peso_unit=document.getElementById('Pf_peso_unit_'+n).value; var voce=document.getElementById('Pf_voce_'+n).value; var qta=document.getElementById('Pf_qta_'+n).value; var qta_unit=document.getElementById('Pf_qta_unit_'+n).value; var valore=document.getElementById('Pf_valore_'+n).value; if(descri!=''){ jsdettx2_vl=jsdettx2_vl+virg+"REC"+"|-*|"+descri+"|-*|"+voce+"|-*|"+qta+"|-*|"+qta_unit+"|-*|"+peso_netto+"|-*|"+peso_lordo+"|-*|"+peso_unit+"|-*|"+valore; virg='!#RGQ!#'; } } if(jsdettx2_vl!=''){ var idtmp=document.getElementById('idtmp').value; var valori='idsped='+idtmp+'&jsdettx1_vl='+encodeURIComponent(jsdettx1_vl)+'&jsdettx2_vl='+encodeURIComponent(jsdettx2_vl); axLoaderPostScript('presa_proforma_ins.php','PfInv2_submitExe',valori); // document.getElementById('Win900').style.display='none'; // GreyScreen('none'); SpedDetail2(idtmp); }else{alert('Some mandatory fields are empty');} } } function PfInv2_submitExe(esito){ if(esito!='OK'){alert('Someting goes wrong saving the proforma\n('+esito+')');} SpedDetail2(); } function ProFormaShow2(event,idsped){ var windiv=document.getElementById('Win900').style; document.getElementById('Win900Body').innerHTML="



Loading in progress
"; document.getElementById('Win900Tit').innerHTML="Custom details (Proforma Invoice)"; GreyScreen('block'); // Controlla e adatta la posizione della finestra allo schermo var xp=DoveXY(); var lx=(xp[4]-900)/2+xp[2]; var ty=(xp[5]-570)/2+xp[3]; windiv.left=lx+"px"; windiv.top=ty+"px"; windiv.display='block'; var valori='idtmp='+idsped; axLoaderPostScript('presa_proforma.php','ProFormaShow2Exe',valori); } function ProFormaShow2Exe(esito){ var j=esito.split('||'); var titolo=j[0]; var htm=j[1]; document.getElementById('Win900Body').innerHTML=htm; document.getElementById('Win900Tit').innerHTML=titolo; } var KoFl='spedyformFLerr'; var OkFl='spedyformFL'; // Cambia sfonso al campo indicato (per form contattaci) function FldBluCnt(id, classe){ var campo=document.getElementById(id+'DV'); campo.className=classe; } function UpdAlertCond2(){ var klklcmd=document.getElementById('condiz'); klkl=klklcmd.value; var laico=document.getElementById('condiz_DVM'); if(klkl=='S'){klkl='N'; cheico="off";}else{klkl='S'; cheico="on";} klklcmd.value=klkl; laico.style.background='url(images/radio14x13_'+cheico+'.png) no-repeat left top'; } function InvioContatto(formid){ // Verifica preseza campi obbligatori e correttezza campi mail e tel var condiz=document.getElementById('condiz'); var nome=document.getElementById('nome'); var citta=document.getElementById('citta'); var email=document.getElementById('email'); var tele=document.getElementById('tele'); var testo=document.getElementById('testo'); var nomedv=document.getElementById('nomeDV'); var cittadv=document.getElementById('cittaDV'); var emaildv=document.getElementById('emailDV'); var teledv=document.getElementById('teleDV'); var testodv=document.getElementById('testoDV'); // Controllo campi obbligatori var errfld="I campi indicati in rosso sono obbligatori o non sono stati compilati con un dato valido\n"; var err=0; var errtxt=''; if(nome.value==''){err++; nomedv.className='Campo180_bg_err'; if(errtxt==''){errtxt+=errfld;} }else{nomedv.className='Campo180_bg_off';} if(citta.value==''){err++; cittadv.className='Campo180_bg_err'; if(errtxt==''){errtxt+=errfld;} }else{cittadv.className='Campo180_bg_off';} if(testo.value==''){err++; testodv.className='Campo584_bg_err'; if(errtxt==''){errtxt+=errfld;} }else{testodv.className='Campo584_bg_off';} if(tele.value!='' && checkTel(tele.value)==0){err++; teledv.className='Campo180_bg_err'; if(errtxt==''){errtxt+=errfld;} }else{teledv.className='Campo180_bg_off';} if(email.value=='' || checkEmail(email.value)==0){err++; emaildv.className='Campo180_bg_err'; if(errtxt==''){errtxt+=errfld;} }else{emaildv.className='Campo180_bg_off';} if(condiz.value!='S'){err++; errtxt+="Non è stata accettata l’informativa sulla privacy\n";} if(err==0){document.getElementById(formid).submit();}else{alert(errtxt);} } // Richiama la funzione per la generazione dei PDF function ToPdf(aurl,filename){ window.location.href='http://'+window.location.hostname+'/erp/pdf_generator.php?url='+aurl+'&filename='+filename; } // Richiama la funzione per la generazione dei PDF, da nuovo server function ToPdfLx(aurl,filename){ window.location.href='http://'+window.location.hostname+'/erp/pdf_generatorlx.php?url='+aurl+'&filename='+filename; } function GoLogin(){ //var idd=document.getElementById('idd').value; var pwd=document.getElementById('pwd').value; //window.location.href='index.php?idd='+idd+'&pwd='+pwd; document.getElementById('LLogi').submit(); } function GoLoginAjx(){ var idd=document.getElementById('idd').value; var pwd=document.getElementById('pwd').value; var valori='idd='+encodeURIComponent(idd)+'&pwd='+encodeURIComponent(pwd); var url="verif_utente_ajx.php"; axLoaderPostScript(url,'GoLoginAjxExe',valori); } function LogOutAjx(){ var url="verif_utente_out_ajx.php"; axLoaderScript(url,'GoLoginAjxExe'); } function GoLoginAjxExe(esito){ if(esito=='OK'){window.location.href=window.location.href;}else{alert(esito);} } function GraphCheckbox(id,script){ // Legge ed inverte l'attuale impostazione del ckeckbox indicato (S/N) quindi chiama un eventuale script se passato var klklcmd=document.getElementById(id); klkl=klklcmd.value; var laico=document.getElementById(id+'_DVM'); if(klkl=='S'){klkl='N'; cheico="off";}else{klkl='S'; cheico="on";} klklcmd.value=klkl; laico.style.background='url(images/radio14x13_'+cheico+'.png) no-repeat left top'; if(script!=''){eval(script+";");} } // Mostra la finestra con la fattura proforma function FatturaOpen1(event,id,id2){ FatturaOpen(id,id2); } function FatturaOpen(id,id2){ var windiv=document.getElementById('WinP640').style; // leggere la posizione attuale del dive controllare se cambiarla (se esce dalla finestra) (creare funzione a cui passare tutti i dati in modo da usarla anche altrove) var corpo=""; document.getElementById('WinP640Body').innerHTML=corpo; document.getElementById('WinP640Tit').innerHTML="Fattura proforma della spedizione"; if(id2==''){var passa='idtmp='+id}else{var passa='idmlt='+id2;} document.getElementById('pageFrame').src='fatt_proforma.php?'+passa+'&chiudijs=1'; // Controlla e adatta la posizione della finestra allo schermo var xp=DoveXY(); var lx=(xp[4]-700)/2+xp[2]; var ty=(xp[5]-520)/2+xp[3]; windiv.left=lx+"px"; windiv.top=ty+"px"; GreyScreen('block'); windiv.display='block'; } // Mostra la finestra con l'etichetta della spedizione function EtichettaOpen1(event,id,id2){ EtichettaOpen(id,id2); } function EtichettaOpen(id,id2){ var windiv=document.getElementById('Win640').style; // leggere la posizione attuale del dive controllare se cambiarla (se esce dalla finestra) (creare funzione a cui passare tutti i dati in modo da usarla anche altrove) var corpo=""; document.getElementById('Win640Body').innerHTML=corpo; document.getElementById('Win640Tit').innerHTML="LDV spedizione, da apporre sul/i colli"; if(id2==''){var passa='idtmp='+id}else{var passa='idmlt='+id2;} document.getElementById('pageFrame').src='etichetta.php?'+passa+'&chiudijs=1'; // Controlla e adatta la posizione della finestra allo schermo var xp=DoveXY(); var lx=(xp[4]-700)/2+xp[2]; var ty=(xp[5]-520)/2+xp[3]; windiv.left=lx+"px"; windiv.top=ty+"px"; GreyScreen('block'); windiv.display='block'; } function EtichettaCrgOpen(id){ var corpo=""; document.getElementById('WinB640Body').innerHTML=corpo; document.getElementById('pageFrame').src='etichettaCargo.php?idtmp='+id; } // Mostra un messaggio di errore (sostituire alert con finestra grafica) function ShowAlert(msg){ alert(msg); } // Mostra / nasconde un DIV con la modalità "display" function DispBlock(id){ ShowHide(id); } // Mostra il calendario del form prese function CalendarioX(nd,tp,cm,td,ai,af,di,df,ln,id,tb,swnm,posiz){ // nd => nome DIV che contiene il calendario // tp => tipo oggetto che contiene il programma (P = pop-up, D =DIV) // cm => nome del campo ove copiare la data selezionata (es: "data1") // dt => data del giorno selezionato (formato dd/mm/yyyy o hh:mm:ss dd/mm/yyyy) // td => tipo del campo, dt = datetime (formato hh:mm:ss dd/mm/yyyy), nullo o diverso = data (formato dd/mm/yyyy) // ai => anno di partenza tendina, anno (es: 1970) o anni meno dell'attuale (es: m10) // af => anno di partenza tendina, anno (es: 2015) o anni oltre l'attuale (es: p10) // di => data minima selezionabile, data (es: dd/mm/yyyy) o oggi (fisso: O). aggiungere ":NSU" per rendere non selezionabili le domeniche, ":NWK" per rendere non selezionabili i sabati e le domeniche // df => data massima selezionabile, data (es: dd/mm/yyyy) o oggi (fisso: O) // ln => Lingua da utilizzare (IT,GB,GE,ES,FR,PT) // id => id del record per update nel DB // tb => nome della tabella per update nel DB // swnm => nome dello script da chiamare per l'update immediato // posiz => posizione assoluta "left:top" ove mostrare in DIV var dt=document.getElementById(cm).value; var w=183; var h=155; if(td=='dt'){h=175;} var url='calendariox.php?nd='+nd+'&dt='+dt+'&td='+td+'&tp='+tp+'&cm='+cm; if(ai!=''){url+='&ai='+ai;} if(af!=''){url+='&af='+af;} if(di!=''){url+='&di='+di;} if(df!=''){url+='&df='+df;} if(ln!=''){url+='&ln='+ln;} if(id!=''){url+='&id='+id;} if(tb!=''){url+='&tb='+tb;} if(swnm!=''){url+='&swnm='+swnm;} var posx=10; var posy=20; if(posiz){ if(posiz!=''){var a=posiz.split(':'); posx=a[0]; posy=a[1];} } document.getElementById('PRcalendarFR').src=url; document.getElementById('PRcalendar').style.left=posx+'px'; document.getElementById('PRcalendar').style.top=posy+'px'; document.getElementById('PRcalendar').style.display='block'; } // Aggiornamento campo txt della pagina di gestione profilo/anagrafica (sito) function ProfUpd(nome){ var campo=document.getElementById(nome); exeg='S'; var vall=campo.value; var tlx=document.getElementById('tlx').value; var id=document.getElementById('id').value; // Controllo aggiornamenro pw (lunghezza minima e sostituzione title che la mostra) if(nome=='lpw' && campo.value.length>=8){ var tmp="Password di accesso #PW#, minimo 8 caratteri"; tmp=tmp.replace(/#PW#/,campo.value); document.getElementById(nome+'_DVM').title=tmp; }else if(nome=='lpw'){alert("La password deve essere di almeno 8 caratteri"); exeg='N';} // Controllo disponibilità login scelto if(nome=='loginn'){exeg='N'; var qwqw=InProgress(290,120,"Attendere operazione in corso",'ON'); axLoaderScript('profilo_chk_lgn.php?id='+id+'&val='+campo.value,'ProfUpd2');} if(exeg=='S'){var qwqw=InProgress(290,120,"Attendere operazione in corso",'ON'); var url='profilo_upd.php?tlx='+tlx+'&id='+id+'&cmn='+nome+'&val='+campo.value; axLoaderScript(url,'ProfUpdExe');} } function ProfUpd2(esito){ // Riceve: OK||esito (0 o 1) var j=esito.split('||'); if(j[0]=='OK'){ var exeg=j[1]; var nome='loginn'; var campo=document.getElementById(nome); var tlx=document.getElementById('tlx').value; var id=document.getElementById('id').value; if(exeg=='OK'){var url='profilo_upd.php?tlx='+tlx+'&id='+id+'&cmn='+nome+'&val='+campo.value; axLoaderScript(url,'ProfUpdExe');} else{var qwqw=InProgress('','','','OFF'); alert(j[1]);} }else{var qwqw=InProgress('','','','OFF'); alert("Errore: "+esito);} } function ProfUpdExe(esito){ // Riceve: OK||nome campo||qpcls (FAX, SMS, MAIL o POSTA)||stato var qwqw=InProgress('','','','OFF'); var j=esito.split('||'); if(j[0]=='OK'){ var nome=j[1]; var val=j[3]; var campo=document.getElementById(nome); if(campo.value!=val){campo.value=val;} }else{var qwqw=InProgress('','','','OFF'); alert("Errore: "+esito);} CheckInvii(); } // Roll over icone permission della pagina di gestione profilo (sito) function ProfIcoRoll(nome,stato){ var campo=document.getElementById('IC'+nome); var campoh=document.getElementById(nome); campo.className="Prof_"+nome+"_"+campoh.value+"_"+stato; } // Cambio di stato icone permission della pagina di gestione profilo (sito) function ProfIcoCng(nome){ var campo=document.getElementById('IC'+nome); var campoh=document.getElementById(nome); if(campoh.value=='S'){campoh.value='N';}else{campoh.value='S';} campo.className="Prof_"+nome+"_"+campoh.value+"_On"; var qwqw=InProgress(290,120,"Attendere operazione in corso",'ON'); var tlx=document.getElementById('tlx').value; var id=document.getElementById('id').value; var url='profilo_upd.php?tlx='+tlx+'&id='+id+'&cmn='+nome+'&val='+campoh.value; axLoaderScript(url,'ProfIcoCngExe'); } function ProfIcoCngExe(esito){ // Riceve: OK||nome campo||qpcls (FAX, SMS, MAIL o POSTA)||stato var qwqw=InProgress('','','','OFF'); var j=esito.split('||'); if(j[0]=='OK'){ var nome=j[1]; var qpcls=j[2]; var stato=j[3]; var campo=document.getElementById('IC'+nome); var campoh=document.getElementById(nome); if(campoh.value!=stato){campoh.value=stato; campo.className="Prof_"+nome+"_"+campoh.value+"_Off";} }else{var qwqw=InProgress('','','','OFF'); alert("Errore: "+esito);} CheckInvii(); } // Roll over icone della pagina di gestione profilo (sito) function ProfIcoRoll2(nome,qpcls,stato){ var campo=document.getElementById('IC'+nome); var campoh=document.getElementById(nome); campo.className="Prof"+qpcls+"_"+campoh.value+"_"+stato; } // Cambio di stato icone della pagina di gestione profilo (sito) function ProfIcoCng2(nome,qpcls){ var campo=document.getElementById('IC'+nome); var campoh=document.getElementById(nome); if(campoh.value=='S'){campoh.value='N';}else{campoh.value='S';} campo.className="Prof"+qpcls+"_"+campoh.value+"_On"; var qwqw=InProgress(290,120,"Attendere operazione in corso",'ON'); var tlx=document.getElementById('tlx').value; var id=document.getElementById('id').value; var url='profilo_upd.php?tlx='+tlx+'&id='+id+'&cmn='+nome+'&qpcls='+qpcls+'&val='+campoh.value; axLoaderScript(url,'ProfIcoCng2Exe'); } function ProfIcoCng2Exe(esito){ // Riceve: OK||nome campo||qpcls (FAX, SMS, MAIL o POSTA)||stato var qwqw=InProgress('','','','OFF'); var j=esito.split('||'); if(j[0]=='OK'){ var nome=j[1]; var qpcls=j[2]; var stato=j[3]; var campo=document.getElementById('IC'+nome); var campoh=document.getElementById(nome); if(campoh.value!=stato){campoh.value=stato; campo.className="Prof"+qpcls+"_"+campoh.value+"_Off";} }else{var qwqw=InProgress('','','','OFF'); alert("Errore: "+esito);} CheckInvii(); } // Controlla se i campi per gli invii sono completi pagina di gestione profilo (sito) function CheckInvii(){ var tlx=document.getElementById('tlx').value; if(tlx=='A'){ var Vcell=document.getElementById('cell').value; var Vfax=document.getElementById('fax').value; var Vmail=document.getElementById('mail').value; var dmail=document.getElementById('delivered_mail').value; var amail=document.getElementById('alert_mail').value; var omail=document.getElementById('contab_mail').value; // var afax=document.getElementById('alert_fax').value; var ofax=document.getElementById('contab_fax').value; if(document.getElementById('commerc_fax')){var cfax=document.getElementById('commerc_fax').value;}else{var cfax='N';} if(document.getElementById('commerc_mail')){var cmail=document.getElementById('commerc_mail').value; }else{var cmail='N';} // var dsms=document.getElementById('delivered_sms').value; var msgerr=""; var msgerrbase="Attenzione i campi Cellulare, Fax e eMail devono essere completi per poter ricevere gli avvisi selezionati tramite i relativi metodi"; if(Vmail=='' && (dmail=='S' || amail=='S' || cmail=='S' || omail=='S')){var msgerr=msgerrbase;} // if(Vfax=='' && (afax=='S' || cfax=='S' || ofax=='S')){var msgerr=msgerrbase;} // if(Vcell=='' && (dsms=='S')){var msgerr=msgerrbase;} document.getElementById('TXTerrori').innerHTML=msgerr; } if(tlx=='C'){ var Vfax=document.getElementById('fax').value; var Vmail=document.getElementById('mail').value; var dmail=document.getElementById('delivered_mail').value; var amail=document.getElementById('alert_mail').value; // var afax=document.getElementById('alert_fax').value; var ifax=document.getElementById('fatt_sped_fax').value; var msgerr=""; var msgerrbase="Attenzione i campi Fax e eMail devono essere completi per poter ricevere gli avvisi selezionati tramite i relativi metodi"; if(Vmail=='' && (dmail=='S' || amail=='S')){var msgerr=msgerrbase;} // if(Vfax=='' && (afax=='S' || ifax=='S')){var msgerr=msgerrbase;} document.getElementById('TXTerrori').innerHTML=msgerr; } } // Funzione di eliminazione profilo function ProfiloDel(id){ var flag=confirm("Conferma l’eliminazione del profilo selezionato?"); if(flag==true){Gox('index.php?pp=prof&tlx=L&del=1&id='+id);} } // Funzione di eliminazione profilo function ProfSwList(id){ if(id==''){ if(document.getElementById('swids')){var id=document.getElementById('swids').value;}else{var id='';} } if(document.getElementById('zn_id_paese_iso')){var iso=document.getElementById('zn_id_paese_iso').value;}else{var iso='';} if(id!=''){Gox('index.php?pp=prof&tlx=S&id='+id+'&iso='+iso);}//else{alert('Selezionare il servizio '+id+iso);} } // Funzione di invio form di ricerca rubrica function Fatt_cerca(opz){ if(opz!=''){document.getElementById('fltt').value=opz;} document.getElementById('spedfrm').submit(); } // Funzione di invio form di ricerca rubrica function Rubr_cerca(opz){ if(opz!=''){document.getElementById('fltt').value=opz;} document.getElementById('spedfrm').submit(); } // Funzione di invio form di ricerca spedizioni function Sped_cerca(opz){ if(opz!='' && opz!='8' && opz!='1'){document.getElementById('fltt').value=opz;} if(opz=='8'){FastSelect("consegna","D");} if(opz=='1'){FastSelect("consegna","T");} document.getElementById('spedfrm').submit(); } // Funzione di campio numero di pagina e numero record per pagina function GGoPage(opz,val,val2){ var pag=document.getElementById('z'); var nxpag=document.getElementById('n'); var ord=document.getElementById('ord'); var ver=document.getElementById('ver'); var mpag=document.getElementById('totpag'); var pdel=document.getElementById('spddel'); var fkt=document.getElementById('fkt'); var fktid=document.getElementById('fktid'); var fktr=document.getElementById('fktr'); if(opz=='z' && val=='0'){pag.value=pag.value*1-1;}else if(opz=='z'){pag.value=pag.value*1+1;} // Cambia pagina if(opz=='n'){nxpag.value=val; pag.value=0;} // Cambia numero di record per pagina // Cambia ordinamento pagina if(opz=='o'){ if(ord.value!=val){ver.value="0";}else{ if(ver.value=="0"){ver.value="1";}else{ver.value="0";} } // Controlla l'ordine (ASC/DESC) ord.value=val; } if(opz=='d'){pdel.value=val;} // Cancella la spedizione indicata if(opz=='c'){fktid.value=val; fkt.value=val2; pag.value=0;} // Filtro su click if(opz=='r'){fktid.value=val; fktr.value=val2; pag.value=0;} // Rimuove il filtro document.getElementById('spedfrm').submit(); } // Funzione di campio numero di pagina e numero record per pagina function GGoPageCont(opz,val,val2){ var pag=document.getElementById('z'); var nxpag=document.getElementById('n'); var mpag=document.getElementById('totpag'); if(opz=='z' && val=='0'){pag.value=pag.value*1-1;}else if(opz=='z'){pag.value=pag.value*1+1;} // Cambia pagina document.getElementById('spedfrm').submit(); } // Funzione che cambia lo stato di un radio grafico function UpdGRadio(id){ var idcmd=id.replace(/_DVM/,''); var klklcmd=document.getElementById(idcmd); klkl=klklcmd.value; var laico=document.getElementById(id); if(klkl=='S'){klkl='N'; cheico="off";}else{klkl='S'; cheico="on";} klklcmd.value=klkl; laico.style.background='url(images/radio14x13_'+cheico+'.png) no-repeat left top'; } // Funzione di campio modalità di ricerca (gestione rubrica e ricerca spedizioni) function CercaSwitch(quale){ if(quale=='A'){var SboxEasy="none"; var SboxAdvance="block"; var SboxMailing="none";} if(quale=='E'){var SboxEasy="block"; var SboxAdvance="none"; var SboxMailing="none";} if(quale=='M'){var SboxEasy="none"; var SboxAdvance="none"; var SboxMailing="block"; if(document.getElementById('rifmlt')){document.getElementById('rifmlt').value="";} } if(document.getElementById('SboxEasy')){document.getElementById('SboxEasy').style.display=SboxEasy;} if(document.getElementById('SboxAdvance')){document.getElementById('SboxAdvance').style.display=SboxAdvance;} if(document.getElementById('SboxMailing')){document.getElementById('SboxMailing').style.display=SboxMailing;} document.getElementById('ricv').value=quale; } // Funzione di pulizia form di ricerca spedizioni function Sped_reset(){ document.getElementById('ldv').value=""; document.getElementById('rif_int').value=""; document.getElementById('id_cliente').value=""; document.getElementById('destin').value=""; document.getElementById('sped_dal').value=""; document.getElementById('citta').value=""; document.getElementById('sped_al').value=""; document.getElementById('sped_dalx').value=""; document.getElementById('sped_alx').value=""; document.getElementById('multic').value=""; document.getElementById('fttt').value=""; document.getElementById('fltt').value=""; document.getElementById('colli').value=""; document.getElementById('owner_user').value=""; document.getElementById('rifmlt').value=""; FastSelect("consegnae",""); FastSelect("consegna",""); FastSelect("geozona",""); FastSelect("id_paese","0"); FastSelect("money",""); Sped_cerca(''); } // Funzione di pulizia form di ricerca fatture function Fatt_reset(){ document.getElementById('fttt').value=""; document.getElementById('fltt').value=""; FastSelect("anni","0"); FastSelect("st_pagam",""); } // Funzione di pulizia form di ricerca indirizzi function Rubr_reset(){ document.getElementById('multic').value=""; document.getElementById('fltt').value=""; document.getElementById('nome').value=""; document.getElementById('adress').value=""; document.getElementById('cap').value=""; document.getElementById('citta').value=""; document.getElementById('prov').value=""; document.getElementById('attenzione').value=""; document.getElementById('last_use_date').value=""; document.getElementById('counter').value=""; FastSelect("id_paese","0"); FastSelect("owner",""); document.getElementById('listack').value="N"; document.getElementById('listack_DVM').style.background='url(images/radio14x13_off.png) no-repeat left top'; FastSelect("lst_id_paese","0"); document.getElementById('lst_key').value=""; // FastSelect("lista",""); Rubr_cerca(''); } // Funzione di eliminazione spedizioni function SpedDel(event,id){ var flag=confirm("Conferma l’eliminazione della spedizione?"); if(flag==true){GGoPage('d',id);} } // Funzione di eliminazione spedizioni function RubrDel(event,id){ var flag=confirm("Conferma l’eliminazione dell’indirizzo?"); if(flag==true){GGoPage('d',id);} } // Funzione rollover Off del'icone preferito della rubrica (se la cella contiene 2 spazi è Off se uno Dsb) function RbrPrfOff(event,id){ var cmd=document.getElementById('RbrPrf'+id); var claz=cmd.innerHTML; var clas=cmd.className; if(claz=='  '){var newcls='BLstPrefOff';}else{var newcls='BLstPrefDsb';} cmd.className=newcls; } // Funzione per settare/desettare un indirizzo come preferito function RubrSetPref(event,id){ var qwqw=InProgress(290,120,"Attendere operazione in corso",'ON'); var url='gest_rubr_pref_ajax.php?id='+id; axLoaderScript(url,'RubrSetPrefExe'); } function RubrSetPrefExe(esito){ // Riceve: OK||id||stato var qwqw=InProgress('','','','OFF'); var j=esito.split('||'); if(j[0]=='OK'){ var id=j[1]; var stato=j[2]; var cmd=document.getElementById('RbrPrf'+id); var claz=cmd.innerHTML; var clas=cmd.className; if(stato=='N'){var newcls='BLstPrefDsb'; cmd.innerHTML=' ';} if(stato=='S'){var newcls='BLstPrefOff'; cmd.innerHTML='  ';} if(clas!='BLstPrefOn'){cmd.className=newcls;} }else{alert("Errore: "+esito);} } // Funzione rollover Off del'icone preferito della rubrica (se la cella contiene 2 spazi è Off se uno Dsb) function RbrLstOff(event,id){ var cmd=document.getElementById('RbrLst'+id); var claz=cmd.innerHTML; var clas=cmd.className; if(claz=='  '){var newcls='BLstListaOff';}else{var newcls='BLstListaDsb';} cmd.className=newcls; } function Lista_insert(){ var cmdnm=document.getElementById('newlst'); if(cmdnm.value=='' || cmdnm.value==' '){alert("Inserire il nome della lista da creare");} else{ var url='gest_rubr_listanw_ajax.php?nm='+cmdnm.value; axLoaderScript(url,'Lista_insertExe'); } } function Lista_insertExe(esito){ // Riceve: OK||Tendina liste var qwqw=InProgress('','','','OFF'); var j=esito.split('||'); if(j[0]=='OK'){ var cmd=j[1]; document.getElementById('lista_DVM').innerHTML=cmd; document.getElementById('newlst').value=''; document.getElementById('listack').checked=false; Rubr_cerca(''); }else{alert("Errore: "+esito);} } // Funzione per settare/desettare un indirizzo come preferito function RubrSetLista(event,id){ var idl=document.getElementById('lista').value; if(idl!=''){ var qwqw=InProgress(290,120,"Attendere operazione in corso",'ON'); var url='gest_rubr_lista_ajax.php?id='+id+'&idl='+idl; axLoaderScript(url,'RubrSetListaExe'); }else{alert("Selezionare prima la lista da gestire");} } function RubrSetListaExe(esito){ // Riceve: OK||id||stato var qwqw=InProgress('','','','OFF'); var j=esito.split('||'); if(j[0]=='OK'){ var id=j[1]; var stato=j[2]; var cmd=document.getElementById('RbrLst'+id); var claz=cmd.innerHTML; var clas=cmd.className; if(stato=='N'){var newcls='BLstListaDsb'; cmd.innerHTML=' ';} if(stato=='S'){var newcls='BLstListaOff'; cmd.innerHTML='  ';} if(clas!='BLstListaOn'){cmd.className=newcls;} }else{alert("Errore: "+esito);} } // Funzione di eliminazione spedizioni function Lista_del(){ var lista=document.getElementById('lista').value; if(lista!=''){ var flag=confirm("Conferma l’eliminazione della lista selezionata?"); if(flag==true){ var qwqw=InProgress(290,120,"Attendere operazione in corso",'ON'); var url='gest_rubr_listadel_ajax.php?idl='+lista; axLoaderScript(url,'Lista_delExe'); } }else{alert("Selezionare prima la lista da eliminare");} } function Lista_delExe(esito){ // Riceve: OK||Tendina liste var qwqw=InProgress('','','','OFF'); var j=esito.split('||'); if(j[0]=='OK'){ var cmd=j[1]; document.getElementById('lista_DVM').innerHTML=cmd; document.getElementById('listack').checked=false; Rubr_cerca(''); }else{alert("Errore: "+esito);} } // Mostra la finestra con i dettagli della spedizione 640x470 function SpedDetail(event,id){ var windiv=document.getElementById('Win900').style; document.getElementById('Win900Body').innerHTML="



Caricamento in corso
"; document.getElementById('Win900Tit').innerHTML="Scheda spedizione LDV "+id; GreyScreen('block'); // Controlla e adatta la posizione della finestra allo schermo var xp=DoveXY(); var lx=(xp[4]-900)/2+xp[2]; var ty=(xp[5]-570)/2+xp[3]; windiv.left=lx+"px"; windiv.top=ty+"px"; windiv.display='block'; axLoaderScript('sped_detail.php?idtmp='+id+'&rnd='+Randnum(6),'SpedDetailexe'); } function SpedDetail2(id){ var windiv=document.getElementById('Win900').style; document.getElementById('Win900Body').innerHTML="



Caricamento in corso
"; document.getElementById('Win900Tit').innerHTML="Scheda spedizione LDV "+id; GreyScreen('block'); windiv.display='block'; axLoaderScript('sped_detail.php?idtmp='+id+'&rnd='+Randnum(6),'SpedDetailexe'); } function SpedDetailexe(esito){ var j=esito.split('||'); var awb=j[0]; var htm=j[1]; document.getElementById('Win900Body').innerHTML=htm; document.getElementById('Win900Tit').innerHTML=awb; } function FileSpedDelExe(esito){ var j=esito.split('||'); if(j[0]=='OK'){ document.getElementById('SpdDttFl'+j[1]).style.display='none'; } } function SpedDetailAddCrm(quale,id){ var cmd=document.getElementById('crm_txt'+quale); var txt=cmd.value; if(txt!=''){ axLoaderPostScript('sped_detail_crm.php?id='+id+'&quale='+quale+'&rnd='+Randnum(6),'SpedDetailAddCrmExe','txt='+encodeURIComponent(txt)); }else{alert(document.getElementById('FLSdtlDgAddErr').innerHTML);} } function SpedDetailAddCrmExe(esito){ j=esito.split('|*+*|'); var quale=j[0]; var html=j[1]; document.getElementById('DgCrmLst'+quale).innerHTML=html; SpedDetailAddCrmChiudi(quale); } function SpedDetailAddCrmChiudi(quale){ document.getElementById('crm_txt'+quale).value=''; document.getElementById('FLSdtlDgAdd'+quale+'Txt').style.display='none'; } function CargoOfferta(id,otp,opz){ if(opz=='R'){var flag=confirm("ATTENZIONE confermando l’offerta verrà rifiutata e chiusa, confermi?");} if(opz=='A'){var flag=confirm("Confermi l’accettazione dell’offerta?");} if(flag==true){ var url='cargo_offert.php?id='+id+'&opz='+opz+'&otp='+otp+'&rnd='+Randnum(6); axLoaderScript(url,'CargoOffertaExe'); } } function CargoOffertaExe(esito){ var j=esito.split('||'); if(j[2]=='A'){alert("Vi contatteremo per organizzare la spedizione, verificate di aver caricato gli eventuali documenti necessari al trasporto / sdoganamento");} document.getElementById('Win900').style.display='none'; GreyScreen('none'); // Se chiamata dalla home la ricarica per aggiornare la lista delle spedizioni cargo if(document.getElementById('chepaghh')){ if(document.getElementById('chepaghh').value=='home'){Gox('index.php');} } } // Funzione di eliminazione spedizioni function FileDWsped(id,otp){window.location.href='filedwsped.php?id='+id+'&otp='+otp+'&rnd='+Randnum(6);} // Funzione di eliminazione spedizioni function FileSpedDel(id,otp){ var flag=confirm("Confermi l’eliminazione del file"); if(flag==true){ var url='filedelsped.php?id='+id+'&otp='+otp+'&rnd='+Randnum(6); axLoaderScript(url,'FileSpedDelExe'); } } function FileSpedDelExe(esito){ var j=esito.split('||'); if(j[0]=='OK'){ document.getElementById('SpdDttFl'+j[1]).style.display='none'; } } function FileSendSped(maxfiles){ var err=0; // Controlla che non ci siano files in errore for(i=1;i<=maxfiles;i++){ if(document.getElementById('CargoFile'+i+'Err').value!='0' || (document.getElementById('CargoFile'+i).value!='' && document.getElementById('CargoFile'+i+'Tx').value=='')){err++;} } if(err==0){document.getElementById('spdsttfiles').submit();}else{alert("Controllare i files selezionati e le relative descrizioni");} } function FileSendSpedExe(esito){ document.getElementById('FLSdtlBox').innerHTML=esito; document.getElementById('FLSdtlAdd').style.display='none'; document.getElementById('FLSdtlAdd').innerHTML="
Chiudi e riapri la finestra per caricare altri files
"; } function FileUpdCheck(numfile,maxfiles){ numfile=numfile*1; // Controlla formato e peso del file e riporta il valore per i controlli di inserimento della spedizione if(document.getElementById('CargoFile'+numfile+'Err').value!=''){var esito=FileCheckUpload('CargoFile'+numfile,'b2bfilemaxmb','b2bfileext');}else{var esito=0;} var cmdflerr=document.getElementById('CargoFile'+numfile+'Err'); cmdflerr.value=esito; var cmdfl=document.getElementById('CargoFile'+numfile); if(cmdflerr.value!='0'){cmdfl.className=KoFl;}else{cmdfl.className=OkFl;} // Mostra il file successivo a quello inserito if(numfile"; txt+=""+idrc+""+jc[i]+"\n"; } } document.getElementById(idct+'_db').value=ctelenc; if(document.getElementById(idct+"_h")){document.getElementById(idct+"_h").innerHTML=txt+'';} document.getElementById(idct+'_h').style.display='block'; if(nocanc==0){document.getElementById(idct).value='';} document.getElementById(idct).focus(); } } // Messaggio di errore if(err!=''){ShowAlert("Il CAP "+err); document.getElementById('cap').className=KoFl; document.getElementById('controll').value='S';} else{document.getElementById('cap').className=OkFl; document.getElementById('controll').value='N';} }else{alert("Errore: "+esito);} } // Aggiorna i dettagli dell'indirizzo della rubrica function RubricaProv(iso){ if(document.getElementById('cap')){ var cap=document.getElementById('cap'); if(cap.value!=''){ var qwqw=InProgress(290,120,"Attendere operazione in corso",'ON'); var url='erp/addres_cap_ajax.php?frm=S&iso='+iso+'&wh='+151+'&cap='+cap.value+'&qlc=d'; axLoaderScript(url,'RubricaProvExe'); } }else{RubricaProvExe('NOCAP');} } function RubricaProvExe(esito){ var qwqw=InProgress('','','','OFF'); var provval=document.getElementById('prov').value; var usa_prov=document.getElementById('usa_prov').value; var controll=document.getElementById('controll'); var contr='N'; if(esito!='NOCAP'){ // Riceve: OK||$cap||$iso||$idreg||$idpr||$sgpr||$airport||$qlc||$citl||$cmp||$err // cap corretto, ISO paese, id regione, nome provincia, sigla provincia, aeroporto DHL, quale, città o elenco città, campo provincia, eventuale errore var j=esito.split('||'); if(j[0]=='OK'){ var cap=j[1]; var id_paese=j[2]; var regione=j[3]; var prov=j[4]; var sgprov=j[5]; var airport=j[6]; var quale=j[7]; var citta=j[8]; var provcmd=j[9]; var errcap=j[10]; } if(provval!='' && provval!=prov && provval!=sgprov){contr='S';} // Setta errore se la provincia inserita è diversa da quella indicata dal cappario if(errcap!=''){contr='S';} // Setta errore se il CAP è in errore } if(provval=='' && usa_prov=='S'){contr='S';} // Setta errore se non è settata una provincia obbligatoria controll.value=contr; } function RubricaUpd(){ var err=0; var ko=0; var nome=document.getElementById('nome'); var adress=document.getElementById('adress'); var citta=document.getElementById('citta'); var usa_prov=document.getElementById('usa_prov'); var tel=document.getElementById('tel'); var cell=document.getElementById('cell'); var mail=document.getElementById('mail'); var controll=document.getElementById('controll'); if(nome.value==''){err++; ko++; nome.className=KoFl;}else{nome.className=OkFl;} if(adress.value==''){err++; ko++; adress.className=KoFl;}else{adress.className=OkFl;} if(citta.value==''){err++; ko++; citta.className=KoFl;}else{citta.className=OkFl;} if(document.getElementById('cap')){var cap=document.getElementById('cap'); if(cap.value==''){err++; cap.className=KoFl;}else{cap.className=OkFl;} } if(document.getElementById('prov')){var prov=document.getElementById('prov'); if(prov.value=='' && usa_prov.value=='S'){err++; prov.className=KoFl;}else{prov.className=OkFl;} } if(tel.value!='' && checkTel(tel.value)==0){err++; ko++; tel.className=KoFl;}else{tel.className=OkFl;} if(cell.value!='' && checkTel(cell.value)==0){err++; ko++; cell.className=KoFl;}else{cell.className=OkFl;} if(mail.value!='' && checkEmail(mail.value)==0){err++; ko++; mail.className=KoFl;}else{mail.className=OkFl;} if(err>0 && ko==0){var flag=confirm("Alcuni dati non sono stati compilati sei sicuro di voler procedere?\nUn indirizzo incompleto e/o con dati errati può generare problemi alle relative spedizioni");} if(ko>0){alert("Attenzione alcuni dati obbligatori sono vuoti o mail compilati.\nI telefoni devono essere solo in formato numerico, senza altri caratteri oltre a + e.\nIl mail deve essere valido e senza spazi");} if(ko==0 && (flag==true || err==0)){ if(err>0){controll.value='S';} document.getElementById('pprr').submit();} } function RubricaAdd(){ document.getElementById('pprr').submit(); } // Apre la finestra DIV di avviso B (alternativa a quella di rubrica, LDV ecc.) function ApriFinestra(sorgente,titolo){ // Riceve: sorgente (nome del campo da cui leggere l'HTML da mostrare) ed il titolo da mostrare nella barra della finestra var windiv=document.getElementById('WinB640').style; document.getElementById('WinB640Body').innerHTML=document.getElementById(sorgente).value; document.getElementById('WinB640Tit').innerHTML=titolo; var xp=DoveXY(); var lx=(xp[4]-700)/2+xp[2]; var ty=(xp[5]-520)/2+xp[3]; windiv.left=lx+"px"; windiv.top=ty+"px"; GreyScreen('block'); windiv.display='block'; }