var jsBackOffice="Back-Office"; var jsTitrePage="Travel Technology Interactiv - Back-Office"; var jsDateIncorrecte="la date saisie n'est pas correcte"; var jsLeMois="le mois"; var jsContient="contient"; var jsVeuillezCorriger="jours , veuillez le corriger !"; var jsMoisSuperieurADouze="le mois choisi est supérieur à 12, veuillez le corriger !"; var jsMoisInferieurAZero="le mois choisi est inférieur à 0, veuillez le corriger !"; var jsJourInferieurAZero=""; var jsAjouterSetLocal="Il faut ajouter dans la page le setlocal, contactez TTI"; var jsGetLocale="1036"; var nbdays = new Array(12); nbdays[0] = 31; nbdays[1] = 28; nbdays[2] = 31; nbdays[3] = 30; nbdays[4] = 31; nbdays[5] = 30; nbdays[6] = 31; nbdays[7] = 31; nbdays[8] = 30; nbdays[9] = 31; nbdays[10] = 30; nbdays[11] = 31; var vMainTitle=jsBackOffice; NS4 = (document.layers) ? 1 : 0; IE4 = (document.all) ? 1 : 0; //initialisation feuilles de stydfsdle// if (""=="1") { document.write (""); } if (""=="1") { document.write (""); } function ns (e) { nsx=e.x;nsy=e.y; } function InfoBulle(Unebulle, texte) { if (document.layers) { document.layers[Unebulle].document.write(texte); document.layers[Unebulle].document.close(); document.layers[Unebulle].top=nsy+10; document.layers[Unebulle].left=nsx-10; document.layers[Unebulle].visibility="show";} if (document.all) { var f=window.event; doc=document.body.scrollTop; document.all[Unebulle].innerHTML=texte; document.all[Unebulle].style.top=f.clientY+doc+10; document.all[Unebulle].style.left=f.x-10; document.all[Unebulle].style.visibility="visible"; } } function CreateBulle(Unebulle) { if (document.layers) { window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=ns; document.write(""); } if (document.all) { document.write(""); } } function HideBulle(Unebulle) { if (document.layers) {document.layers[Unebulle].visibility="hide";} if (document.all) {document.all[Unebulle].style.visibility="hidden";} } function HideBulle(BullName) { if (document.layers) {document.layers[BullName].visibility="hide";} if (document.all) {document.all[BullName].style.visibility="hidden";} } function main_init(){ document.title = jsTitrePage; } function SetTitrePage(title){ if (document.all.TitrePage) if(IE4) document.all.TitrePage.innerHTML = "
"+vMainTitle+"
"+title+"
"; } function SetTitre(Title,SubTitle){ if (document.all.TitrePage) if(IE4) document.all.TitrePage.innerHTML = "
"+document.title+"
"; } function open_url(url){ self.document.location.href=url; } function isNumeric(strg){ var fdot = false; if(strg == '' ) return false; for (var j=0 ; j<(strg.length) ; j++) { if(strg.charAt(j) == '.' || strg.charAt(j) == ','){ if(!fdot) fdot = true; else return(false); } else{ if(!(strg.charAt(j) == '-' && j == 0)){ if (isNaN(strg.charAt(j))){ return(false); } } } } return(true); } /********************************************************************** /* _getDateFromString /* /* Fabrique un objet Date en fonction des conventions /* propres au pays actif dans le système /* Exemples /* Francais : jj/mm/aaaa /* Anglais : mm/jj/aaaa /* args /* sDate1 : String /* /* return /* Objet Date initialisé /**********************************************************************/ function _dateAdapter(sDate1) { var SelLocal; var jour1; var mois1; var annee1; // Récupération du contexte linguistique SelLocal = jsGetLocale; tableauDate = sDate1.split("/"); switch (SelLocal) { case "1033" : // Dates Anglaises mm/jj/aaaa this.jour = tableauDate[1] this.mois = tableauDate[0] this.annee = tableauDate[2] //Alert("Case English"); break; default : // Dates Francaises & Autres jj/mm/aaaa this.jour = tableauDate[0] this.mois = tableauDate[1] this.annee = tableauDate[2] //Alert("Case Default"); break; } } function _getDateFromString(sDate1) { var date1 = new Date(); dateAdaptee = new _dateAdapter(sDate1); date1.setYear(dateAdaptee.annee); date1.setMonth((dateAdaptee.mois -1)); date1.setDate(dateAdaptee.jour); return date1; } /********************************************************************** /* cmpDate /* Compare 2 chaines de caractères représentant des dates /* en suivant les conventions propres au pays actif dans le système /* Le séparateur est indifférent /* Exemples /* Francais : jj/mm/aaaa /* Anglais : mm/jj/aaaa /* args /* sDate1 : String /* SDate2 : String /* return /* 1 si date1 > date2 /* 0 si date1 = date2 /* -1 si date1 < date2 /**********************************************************************/ function cmpdate(sDate1,sDate2) { var date1 = _getDateFromString(sDate1) var date2 = _getDateFromString(sDate2) // Initialisation des paramètres par défaut en cas de paramètres vides if (sDate1 == '' && sDate2 != '') { date1=''; date2= date2.toString(); } else if (sDate1 != '' && sDate2 == '') { date1=date1.toString(); date2=''; } if (sDate1 == '' && sDate2 == '') { date1=''; date2=''; } // Comparaison des dates if(date1>date2) return 1; // comparaison de 2 chaines ou 2 dates if(date1==date2) return 0; // comparaison de 2 chaines vides if(date1pivot) { if(jma.substring(4,6)-pivot<5) an="20"; else an="19"; } else { if(pivot-jma.substring(4,6)<5) an="20"; else an="19"; } jma=jma.substring(0,4) + an + jma.substring(4,6); } if(withctrl) { // controle de la date if(isNaN(jma)) val="-1"; else { var SelLocal; SelLocal = jsGetLocale; if (SelLocal == '1033'){ jj=parseInt(jma.substring(2,4),10); mm=parseInt(jma.substring(0,2),10); } else{ jj=parseInt(jma.substring(0,2),10); mm=parseInt(jma.substring(2,4),10); } an=parseInt(jma.substring(4,8),10); if(mm<1 || mm>12) jma="-1"; if(mm!=2) { if(jj>nbdays[mm-1]) jma="-1"; } else { if(jj>29) jma="-1"; else if(jj>28 && (an / 4)!=Math.floor(an / 4)) jma="-1"; } } } if(jma!="-1") jma=jma.substring(0,2)+"/"+jma.substring(2,4)+"/"+jma.substring(4,8); return jma; } function nextdatefromday(d,jma) { var SelLocal; SelLocal = jsGetLocale; if (SelLocal == '1033'){ jj=parseInt(jma.substring(3,5),10); mm=parseInt(jma.substring(0,2),10); } else{ jj=parseInt(jma.substring(0,2),10); mm=parseInt(jma.substring(3,5),10); } if(jma.length>8) an=jma.substring(8,10); else an=jma.substring(6,8); if(an.length<2) an = "0" + an; an=parseInt("20"+an,10); //jj=parseInt(jma.substring(0,2),10); //mm=parseInt(jma.substring(3,5),10); nbd=nbdays[mm]; if(mm==2 && an/4==Math.floor(an/4)) nbd=nbdays[1]+1; do { jj=jj+1; if(jj>nbd) { jj=1; mm = mm + 1 ; nbd=nbdays[mm]; if(mm==2 && an/4==Math.floor(an/4)) nbd=nbdays[1]+1; if(mm>12) { mm = 1; nbd=31; an = an +1; } } dt = new Date(an,mm-1, jj); }while(dt.getDay()!=d); jj = new String(jj); if(jj.length<2) jj = "0" + jj; mm = new String(mm); if(mm.length<2) mm = "0" + mm; an = new String(an); if(an.length<2) an = "0" + an; if (SelLocal == '1033') return mm+jj+an else{ return jj+mm+an } } function SetDate(ctrl,jma,withctrl,oblig) { var SelLocal; SelLocal = jsGetLocale; if (ctrl.value.length==1 && !isNaN(ctrl.value)) ctrl.value = "0"+ctrl.value if (SelLocal==''){ alert(jsAjouterSetLocal); ctrl.value=''; return false; } val="-1"; //jma = '01/03/2004'; ctrlannee = ctrl.value.substring(4,6) if(ctrl.value.charAt(1)=='/') ctrl.value = "0"+ctrl.value //alert(ctrl.value.substring(0,2)+'--'+ctrl.value.substring(3,4)+'---'+ctrl.value.substring(5,10)); if(ctrl.value.charAt(4)=='/') ctrl.value = ctrl.value.substring(0,2)+"/0"+ctrl.value.substring(3,4)+"/"+ctrl.value.substring(5,10) if (SelLocal == '1033'){ ctrlmois = ctrl.value.substring(0,2) ctrljour = ctrl.value.substring(2,4) mm=parseInt(jma.substring(0,2),10); jmajour = jma.substring(3,5); jmamois = jma.substring(0,2); } else{ ctrlmois = ctrl.value.substring(2,4) ctrljour = ctrl.value.substring(0,2) mm=parseInt(jma.substring(3,5),10); jmajour = jma.substring(0,2); jmamois = jma.substring(3,5); } if(jma.length>8) an=jma.substring(8,10); else an=jma.substring(6,8); // test sur la validité de jour au cas de deux chifres if (ctrl.value.length==2){ nbd = nbdays[jmamois-1]; if (ctrl.value>nbd) { alert(jsLeMois + jmamois + jsContient + nbd + jsVeuillezCorriger); ctrl.value=''; return false; } } if (ctrlmois>12 && ctrl.value.length>=4){ alert(jsMoisSuperieurADouze); ctrl.value=''; return false; } if (ctrlmois!='' && ctrlmois==0 && ctrl.value.length>=4){ alert(jsInferieurAZero); ctrl.value=''; return false; } //test sur la validité de jour par rapport au mois nbd = nbdays[ctrlmois-1]; // pour le mois de Fevrier 28 ou 29 jours selon l'annee if (ctrlannee!=''){ if (ctrlmois==2 && ctrlannee/4==Math.floor(ctrlannee/4)) nbd=nbdays[1]+1; } else{ if(ctrlmois==2 && an/4==Math.floor(an/4) && ctrlmois>jmamois) nbd=nbdays[1]+1; if(ctrlmois==2 && (parseInt(an,10)+1)/4==Math.floor((parseInt(an,10)+1)/4) && ctrlmoisnbd){ alert(jsLeMois + ctrlmois + jsContient + nbd + jsVeuillezCorriger); ctrl.value=''; return false; } if(ctrl.value.length==1 || ctrl.value.length==2) { if (SelLocal == '1033'){ switch(ctrl.value) { case 'm': case 'M': ctrl.value = nextdatefromday(1,jma); break; case 'tu': case 'Tu': ctrl.value = nextdatefromday(2,jma); break; case 'we': case 'We': ctrl.value = nextdatefromday(3,jma); break; case 'th': case 'Th': ctrl.value = nextdatefromday(4,jma); break; case 'fr': case 'Fr': ctrl.value = nextdatefromday(5,jma); break; case 'sa': case 'Sa': ctrl.value = nextdatefromday(6,jma); break; case 'su': case 'Su': ctrl.value = nextdatefromday(0,jma); break; } ctrlmois = ctrl.value.substring(0,2) ctrljour = ctrl.value.substring(2,4) } else { switch(ctrl.value) { case 'l': case 'L': ctrl.value = nextdatefromday(1,jma); break; case 'ma': case 'MA': ctrl.value = nextdatefromday(2,jma); break; case 'm': case 'M': ctrl.value = nextdatefromday(3,jma); break; case 'j': case 'j': ctrl.value = nextdatefromday(4,jma); break; case 'v': case 'v': ctrl.value = nextdatefromday(5,jma); break; case 's': case 's': ctrl.value = nextdatefromday(6,jma); break; case 'd': case 'D': ctrl.value = nextdatefromday(0,jma); break; } ctrlmois = ctrl.value.substring(2,4) ctrljour = ctrl.value.substring(0,2) } } anpropose = parseInt(an,10); if(!isNaN(ctrl.value) && (ctrl.value.length==2 || ctrl.value.length==4)) { //mm=parseInt(jma.substring(3,5),10); if(ctrljour12) { mm=1; anpropose = anpropose + 1; } } if(ctrl.value.length==2) { // Ajoute le mois mm = new String(mm); if(mm.length<2) mm = "0" + mm; if (SelLocal == '1033'){ ctrl.value = mm + ctrl.value; ctrlmois = ctrl.value.substring(0,2) ctrljour = ctrl.value.substring(2,4) } else{ ctrl.value = ctrl.value + mm; } mm=parseInt(mm,10); } } if(!isNaN(ctrl.value) && ctrl.value.length==4) { // validité de jour si Jour<0 error if(ctrljour<=0){ alert(jsInferieurAZero); ctrl.value = ''; return false; } if(parseInt(ctrlmois,10)"); document.write(""); document.write(""); document.write(""); document.write(""); } function write_btt_menu(lib, lien, onclickevt, comments){ document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write("
"+ lib + "" + comments + "
"); } function write_btt_comments(lib, lien, onclickevt, comments){ document.write(""); document.write(""); if(!(comments=='')) document.write(""); else document.write(""); document.write(""); document.write("
"); write_btt(lib, lien, onclickevt); document.write("" + comments + "
"); } function write_btt(lib, lien, onclickevt,pos){ document.write(""); document.write(""); document.write('"); document.write(""); document.write("
'); document.write("" + lib + "
"); } function write_btt_pos(lib, lien, onclickevt, pos){ document.write(""); document.write(""); document.write(""); document.write("
"); document.write(""); document.write(""); document.write(""); document.write(""); document.write("
" + lib + "
"); document.write("
"); } function write_stitre(lib){ document.write(""); document.write(""); document.write(""); document.write(""); document.write("
" + lib + "
"); } function write_titre(lib){ document.write(""); document.write(""); document.write(""); document.write(""); document.write("
" + lib + "
"); } function write_comments(lib){ document.write(""); document.write(""); document.write(""); document.write(""); document.write("
"+ lib + "
"); } function write_errors(lib){ document.write(""); document.write(""); document.write(""); document.write(""); document.write("
"+ lib + "
"); } function write_success(lib){ document.write(""); document.write(""); document.write(""); document.write(""); document.write("
"+ lib + "
"); } function write_POST_form(nom,action){ document.write("
"); } function write_POST_form_file(nom,action){ document.write(""); } function write_endform(){ document.write("
"); } function write_textfield(lib, varname, value, s, vonblur){ var mysize=60; if(!(isNaN(parseInt(s,10)))) mysize=s; if(typeof vonblur == 'undefined') vonblur = ''; //alert(vonblur); ///alert(parseInt(size,10)); document.write(""); document.write(""); document.write(""); document.write('"); document.write("
" + lib + "
"); } function write_textfieldarea(lib, varname, value, cols, rows){ var mysize=60; ///alert(parseInt(size,10)); document.write(""); document.write(""); document.write(""); document.write('"); document.write(""); document.write("
" + lib + "
"); } function write_chkboxfield(lib, varname, value, onclickevt, checked, tw){ document.write(""); document.write(""); document.write("" + lib + ""); document.write(""); document.write(""); } function write_chkboxfields(varname, lib , tlib, tvalue ,tchkd ,tw){ var strtmp ; var tabLib = new Array(); var tabValue = new Array(); var tabChkd = new Array(); tabLib = tlib.split(","); tabValue = tvalue.split(","); tabChkd = tchkd.split(","); document.write(""); document.write(""); document.write("" + lib + ""); document.write(""); document.write(""); document.write(""); document.write(""); var j = 0 ; for (var i=0 ; i < tabValue.length ; ++i){ if (j >= 4) { document.write(""); document.write(""); j = 0 ; } strtmp = "" ; document.write(strtmp); //document.write(""); j = j + 1 ; } document.write(""); document.write("
" + tabLib[i] + "
"); document.write(""); document.write(""); document.write(""); } //------------------------------------------------------ var curdatefieldname; var mywincalend; function get_calend(fieldbox){ if(mywincalend==null||mywincalend.closed) mywincalend=window.open("/otds/tools/calendrier/calendrier.asp","neww","width=215,height=395,scrolling=0"); curdatefieldname=fieldbox; mywincalend.focus(); } function get_calend2(fieldbox,id_sessionlangue){ if(mywincalend==null||mywincalend.closed) mywincalend=window.open("/otds/tools/calendrier/calendrier.asp?Id_SessionLangue=" + id_sessionlangue ,"neww","width=215,height=395,scrolling=0"); curdatefieldname=fieldbox; mywincalend.focus(); } function set_datefieldvalue(v){ curdatefieldname.value=v; } //------------------------------------------------------ function show_help(param){ window.open('/otds/help/help_main.asp'+param, 'Help', 'width=700, height=600,scrollbars=1'); } function write_filefield(lib, varname, value,s){ var mysize=45; if(!(isNaN(parseInt(s,10)))) mysize=s; ///alert(parseInt(size,10)); document.write(""); document.write(""); document.write(""); document.write(''); document.write(""); document.write("
" + lib + "
"); } function Displayday(aa,mm,jj,iddiv,langue) { // 2 dimensions en prévision des langues étrangères jours = new Array(7); jours[0]="Dimanche"; jours[1]="Lundi"; jours[2]="Mardi"; jours[3]="Mercredi"; jours[4]="Jeudi"; jours[5]="Vendredi"; jours[6]="Samedi"; if(langue==2) { jours[0]="Sunday"; jours[1]="Monday"; jours[2]="Tuesday"; jours[3]="Wednesday"; jours[4]="Thursday"; jours[5]="Friday"; jours[6]="Saturday"; } if (langue == 4) { jours[0]="Domingo"; jours[1]="Lunes"; jours[2]="Martes"; jours[3]="Miércoles"; jours[4]="Jueves"; jours[5]="Viernes"; jours[6]="Sábado"; } dt = new Date(aa,mm-1, jj); iddiv.style.visibility = 'hidden'; if (NS4) { with(document.iddiv.document) { write(jours[dt.getDay()]); close(); } } else iddiv.innerHTML = jours[dt.getDay()]; iddiv.style.visibility = 'visible'; } function Displayday2(aa,mmaller,mm,jjaller,jj,iddiv,langue) { // 2 dimensions en prévision des langues étrangères jours = new Array(7); jours[0]="Dimanche"; jours[1]="Lundi"; jours[2]="Mardi"; jours[3]="Mercredi"; jours[4]="Jeudi"; jours[5]="Vendredi"; jours[6]="Samedi"; //alert(langue); if(langue==2) { jours[0]="Sunday"; jours[1]="Monday"; jours[2]="Tuesday"; jours[3]="Wednesday"; jours[4]="Thursday"; jours[5]="Friday"; jours[6]="Saturday"; } if (langue == 4) { jours[0]="Domingo"; jours[1]="Lunes"; jours[2]="Martes"; jours[3]="Miércoles"; jours[4]="Jueves"; jours[5]="Viernes"; jours[6]="Sábado"; } dateItems = new Date(); jour = dateItems.getDate(); if ((mmaller>mm) || (mmaller==mm && jj 0.5) TmpAmount += 0.1; TmpAmount = Math.round(TmpAmount) / Math.pow(10, MoneySubdivision); return (Sign * TmpAmount); } function gotoNewIDP(id) { if(!isNaN(id) && "" != id ) { var href = ""; href='/TTIDotNet/Transport/TransportNetBO2/Billing/Facture.aspx?view=FactureCreation&IdFacture='+ id +'&IdLangue=1&IdSociete=2&UID='; self.document.location.href= href; return false; } else alert('Le numéro de facture doit être numérique.'); }