=== sbiftrade.bf JS Source Files === --- js/login.js?v=3 --- //******************************************************************************************************************* //initialisation lors du chargement de la page //Affichage aithentif function handleSlideslide() { $("#login").velocity("transition.slideUpIn", 1250); $(".row").delay(500).velocity("transition.slideLeftIn", { stagger: 500 }); }; //Regles function champsAuthentificationValides() { return $.trim($("#usernameInput").val()) == "" || $.trim($("#passwordInput").val()) == ""; } function initLoginHandlers() { handleSlideslide(); $('#loginButton').click(function () { $("body").css("cursor", "progress"); if (!champsAuthentificationValides()) { Make_Login($("#usernameInput").val(), $("#passwordInput").val()); } else { $("body").css("cursor", "default"); alertify.alert("Le nom d'utilisateur ou le mot de passe est incorrect!"); } }); $('#b_reset_form').click(function () { $("#usernameInput").val("") //usernameInput.value = ""; //passwordInput.value = ""; $("#passwordInput").val("") $('#usernameInput').focus(); }); } /********************************* Connexion ***********************************/ //appel service authentification function Make_Login(_Login, _Password) { $("#alertify").css("height", ""); $.ajax({ async: false, cache: false, url: URL_SERVICE + "Service.svc/Auth", type: "GET", crossDomain: true, dataType: "jsonp", data: { log: _Login, psw: stringify(CryptoJS.SHA1(_Password)), resolution: '' }, success: typeofDevice == 'mobile' ? OnConnectTTMSuccess : loginInitialisation, error: function (a, b, c) { OnError(msgErrorServer); } }); } function loginInitialisation(Str_Login_Rep, errc, data1) { var arr_Login_Rep = Str_Login_Rep.split('|'); if (arr_Login_Rep[0].indexOf("prob_undefined") > -1) { OnErrorWithMsg(msgErrorServer); } else { if ((arr_Login_Rep[0].indexOf("incorrects") > -1) || (arr_Login_Rep[0].indexOf("insuffisant") > -1) || (arr_Login_Rep[0].indexOf("Ce compte est") > -1) || (arr_Login_Rep[0].indexOf("actuellement") > -1)) { OnErrorWithMsg(arr_Login_Rep[0]); $("body").css("cursor", "default"); passwordInput.value = ""; $('#passwordInput').focus(); } else if ((arr_Login_Rep.length > 12) && (arr_Login_Rep[13].toLowerCase() == "0")) { OnErrorWithMsg("Il est actuellement Impossible d'accèder à Votre compte, Veuillez contacter S.B.I.F !"); }else if (arr_Login_Rep[0].indexOf("Ce compte a été verrouillé après") > -1) { OnErrorWithMsg(arr_Login_Rep[0]); } else { //mylist| clientId | config| Civ_Corresp | Corresp | TYPE_CPT | Mandataire | cleweb | Depositaire Cli_CPT = arr_Login_Rep[0]; Cli_CIV = arr_Login_Rep[1]; Cli_NOM = arr_Login_Rep[2]; Cli_CPT_TYPE = arr_Login_Rep[3]; Cli_CONS = arr_Login_Rep[4];//gest Cli_CIN = arr_Login_Rep[5]; Cli_MYLIST = arr_Login_Rep[6]; Cli_NO = arr_Login_Rep[7]; Cli_MYCONFIG = arr_Login_Rep[8]; Cli_CivCORRESP = arr_Login_Rep[9]; Cli_CORRESP = arr_Login_Rep[10]; Cli_COMPTEJOINT = arr_Login_Rep[11]; Cli_COMPTEMANDATAIRE = arr_Login_Rep[12]; Cli_DEPOSITAIRE = arr_Login_Rep[14]; Cli_AVIS_OPERE = arr_Login_Rep[15]; Cli_REL_TRIMESTRIEL = arr_Login_Rep[16]; Cli_FRAIS = arr_Login_Rep[17]; Cli_PF = arr_Login_Rep[18]; Cli_initPassWeb = arr_Login_Rep[19]; Cli_fraisSGI = arr_Login_Rep[20]; Cli_fraisBRVM = arr_Login_Rep[21]; Cli_facSGI = arr_Login_Rep[22]; Cli_facBRVM = arr_Login_Rep[23]; Cli_exclu = arr_Login_Rep[24]; Cli_BourseEnLigne = arr_Login_Rep[26]; Cli_Conformite = arr_Login_Rep[27]; $("#feuille").load('web/main.html', function () { nbauth = 0; initMainHandlers('externe'); }); marketDataInfo(); if (typeofDevice == "web") { setTimeout(function () { if (Cli_initPassWeb == "1") { afficherReinitMotDePasse(); } }, 3000); } $("body").css("cursor", "default"); pingTimeout = setTimeout(function () { VerifPing(1) }, 15000); } } } /********************************* Ping ***********************************/ //vérification pour la continuité de la varible de session du service function VerifPing(pingFROM) { try { if (pingTimeout != null) { pingTimeout = null; clearTimeout(pingTimeout); } $.ajax({ url: URL_SERVICE + "Service.svc/Ping", type: "GET", data: { from: pingFROM }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { if (data != "expired") { var result = $.parseJSON(data).split("###"); } if (pingFROM == 0) { //appel depuis init() => reload de la page if (data == "expired") { etatPlatforme = "expired"; alertify.alert("Votre session a expiré, merci de vous identifier de nouveau!", function () { Log_Out(); }); }else{ if (result[0] == "1") { $("#td_Etat_Con").css("background-color", "green"); //rechargement des données de session var sessionData = result[1].split("$$"); Cli_CPT = sessionData[0];//Session("cpt") Cli_CPT_TYPE = sessionData[1];// Session("typeNouvCompte") Cli_MYLIST = sessionData[2];//Session("myList") Cli_MYCONFIG = sessionData[3];//Session("myConfig") Cli_CIV = sessionData[4];//Session("civilite") Cli_NOM = sessionData[5];//Session("Nom") Cli_CIN = sessionData[6];// Session("cin") Cli_CONS = sessionData[7];// Session("cons") Cli_COMPTEJOINT = sessionData[8];// Session("compteJoint") Cli_COMPTEMANDATAIRE = sessionData[9];//Session("compteMandataire") Cli_DEPOSITAIRE = sessionData[10];//Session("compteDepositaire") Cli_CivCORRESP = sessionData[11]; // Session("civCorresp") Cli_CORRESP = sessionData[12]; //Session("Corresp") Cli_AVIS_OPERE = sessionData[13]; //Session("displayAvisOperer") Cli_REL_TRIMESTRIEL = sessionData[14]; //Session("clientType") Cli_FRAIS = sessionData[15]; Cli_initPassWeb = sessionData[16]; CliInitPassWebMobile = sessionData[16]; Cli_fraisSGI = sessionData[17]; Cli_fraisBRVM = sessionData[18]; Cli_facSGI = sessionData[19]; Cli_facBRVM = sessionData[20]; Cli_exclu = sessionData[21]; Cli_BourseEnLigne = sessionData[22]; Cli_Conformite = sessionData[23]; marketDataInfo(); if (typeofDevice == "web") { $("#feuille").load('web/main.html', function () { initMainHandlers(typeCLient); $("#td_Etat_Con").css("background-color", "green"); }); setTimeout(function () { if (Cli_initPassWeb == "1") { afficherReinitMotDePasse(); //alert("initPassWeb = 1") } }, 3000); } else if (typeofDevice == "mobile") { if (CliInitPassWebMobile == "1") { ouvrirFenetreReinitPasswordMobile(); //alert("initPassWeb = 1") } } pingTimeout = setTimeout(function () { VerifPing(1) }, 15000); } else { if (typeofDevice == "web") { $("#feuille").load('web/login.html', function () { initLoginHandlers(); }); } else if (typeofDevice == "mobile") { $("#feuille").load('web/mobile/sgiAccessMobile.html', function () { initLoginMobile(); }); } } } } else if (pingFROM == 1) { //appel depuis le setTimeOut if (data == "expired") { etatPlatforme = "expired"; alertify.alert("Votre session a expiré, merci de vous identifier de nouveau!", function () { Log_Out(); }); } else { if (result[0] == "0") { pingTimeout = null; clearTimeout(pingTimeout); refreshSession(); $("#td_Etat_Con").css("background-color", "red"); //alertify.alert("Votre session a expiré merci de vous identifier de nouveau!", function () { // Log_Out(); //}); } else if (result[0] == "1") { $("#td_Etat_Con").css("background-color", "green"); pingTimeout = setTimeout(function () { VerifPing(1) }, 15000); console.log("Connexion maintenue"); } } } }, error: function (a, b, c) { $("#td_Etat_Con").css("background-color", "red"); } }); } catch (errc) { $("#td_Etat_Con").css("background-color", "red"); console.log('Error Ping : ' + errc.message); } } function Log_Out() { nbauth = 0; $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/Ajlogweb", dataType: "jsonp", data: { Rq: "LOGOUT" }, crossDomain: true, success: function (data, errc, data1) { clearTimeout(updateMkt); window.location.replace("index.html"); }, error: function (a, b, c) { OnErrorWithMsg(msgErrorServer); } }); } /********************************* Traitement Liste des compte ***********************************/ //appel du service lors du changement de compte function getlistOfAccount() { $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/authentficationLogedIn_2", crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { listeDesComptes.length = 0; var nbComptes = data.length; for (var i = 0; i < nbComptes; i++) { listeDesComptes.push(data[i]); } if (nbComptes > 0) { if (nbComptes == 1) { ClientAccountDiv = ""; ClientAccountDiv = "Compte " + Cli_CPT_TYPE + " N° " + Cli_CPT + ", " + Cli_CIV + " " + Cli_NOM; } else { ClientAccountDiv = ""; } } if (listeDesComptes.length > 0) { if (listeDesComptes.length == 1) { $("#Div3_CLI_NAME").html(ClientAccountDiv); //affichagePortefeuille(); } else { $("#Div3_CLI_NAME").append($(ClientAccountDiv)); //affichageSommePF(); } } }, error: function (a, b, c) { OnError(msgErrorServer) } }); } //modification des variables en relation du nouveau compte séléctionné function changerCompte() { var selectaccount = document.getElementById('listeComptes').selectedIndex; var compteChoisi = listeDesComptes[selectaccount]; clearTimeout(pingTimeout); $.ajax({ async: false, cache: false, type: "GET", crossDomain: true, dataType: "jsonp", url: URL_SERVICE + "Service.svc/updateSessionCpt", data: { nouvCpt: compteChoisi.NumCompte, nouvRelTrim: compteChoisi.AffReleveTrim, nouvAvisOp: compteChoisi.AffAvisOpere, nouvTYPECPT: compteChoisi.TypeCompte, nouvFrais: compteChoisi.CliFrais }, success: function (a, b, c) { Cli_CPT = compteChoisi.NumCompte; Cli_CIV = compteChoisi.Civilite; Cli_NOM = compteChoisi.NomClient; Cli_CPT_TYPE = compteChoisi.TypeCompte; Cli_REL_TRIMESTRIEL = compteChoisi.AffReleveTrim; Cli_AVIS_OPERE = compteChoisi.AffAvisOpere; Cli_CivCORRESP = compteChoisi.CiviliteCorres; Cli_CORRESP = compteChoisi.nouvPrenomCotit; Cli_FRAIS = compteChoisi.CliFrais; Cli_fraisSGI = compteChoisi.fraisSGI; Cli_fraisBRVM = compteChoisi.fraisBRVM; Cli_facSGI = compteChoisi.facSGI; Cli_facBRVM = compteChoisi.facBRVM; var displayAO = Cli_AVIS_OPERE == "1" ? "initial" : "none", displayRT = Cli_REL_TRIMESTRIEL == "1" ? "initial" : "none"; //displayORDRE = (Cli_CPT_TYPE.toLowerCase().indexOf('cgp') > -1 || Cli_CPT_TYPE.toLowerCase().indexOf('gere') > -1 || (Cli_CPT_TYPE).toLowerCase().indexOf("ceo") > -1) ? "none" : "initial"; //$("#B_Rel_Trimes").css("display", displayRT); //$("#B_Avis_Ope").css("display", displayAO); $("#B_Rel_Trimes").css("display", "initial"); $("#B_Avis_Ope").css("display", "initial"); //$("#B_ORDRE").css("display", displayORDRE); ouvrirResumeMarche(NomTabResume); //Fermer les élements de la borne inférieure hideWindow(configWindow, AffConfig); hideWindow(updatePassWordWindow, Aff_UpdatPSW); hideWindow(releveEspeceWindow, Aff_RELEVE_ESPECE); hideWindow(releveTitreWindow, Aff_RELEVE_TITRE); hideWindow(PORTEFEUILLE, AffPORTF); hideWindow(TRIMESTRIEL, AffRelTri); hideWindow(OPERE, AffAvOp); hideWindow(Enc, AffAvEnc); cacherImpression(); cacherOrder(); var MnETitSuivis = []; for (var i = 0; i < list_cli_suivi_tit.length; i++) { MnETitSuivis.push({ pos: getMnePosition(list_cli_suivi_tit[i][0]), posX: list_cli_suivi_tit[i][4], posY: list_cli_suivi_tit[i][5], hidden: list_cli_suivi_tit[i][6] }); } for (var i = 0; i < MnETitSuivis.length; i++) { var pos = MnETitSuivis[i].pos; xPosBeforeChange = MnETitSuivis[i].posX; yPosBeforeChange = MnETitSuivis[i].posY; RES_TIT_CLI[pos].close(); ResTitCliClick(pos); if (MnETitSuivis[i].hidden == 0) { ResTitCliClick(pos); } } xPosBeforeChange = ""; yPosBeforeChange = ""; }, error: function (a, b, c) { OnError(msgErrorServer) } }); pingTimeout = setTimeout(function () { VerifPing(1) }, 30000); } function refreshSession() { $.ajax({ async: false, cache: false, type: "POST", crossDomain: true, dataType: "jsonp", url: URL_SERVICE + "Service.svc/refreshSession", data: { cptNo: Cli_CPT }, success: function () { pingTimeout = setTimeout(function () { VerifPing(1) }, 15000); }, error: function (a, b, c) { OnError(msgErrorServer) } }); } function afficherAlert() { alertify.alert("En cours de développement !"); } function stringify(wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var hexChars = []; for (var i = 0; i < sigBytes; i++) { var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; hexChars.push((bite >>> 4).toString(16)); hexChars.push((bite & 0x0f).toString(16)); } return hexChars.join(''); } function afficherAlerte() { alertify.alert('Pour des difficultés d’accès à votre compte :
1-Merci de respecter la casse de vos identifiants (Majuscules, minuscules)
2-Effacer votre historique de navigation si le message «Paramètres de connexion incorrects» persiste.
Pour les clients en gestion LIBRE, une nouvelle convention web doit être signée pour la passation des ordres de bourse. Sans cette convention web signée, vous aurez juste accès à la plateforme web en mode consultation. Les clients sous mandat de gestion ne sont pas concernés par cette nouvelle convention.'); $("#alertify").css("height", "320px"); } --- js/sgi.js?v=1 --- var URL_SERVICE = "https://www.sbiftrade.bf/SBIFTradeServer/"; //var URL_SERVICE = "http://localhost:52237/"; var WY, WHeight, listUsed = [], idResumeMarche, origineOrdre = 0; var pingTimeout = null, updateMkt = null; var Cli_DEPOSITAIRE = "", Cli_Password = "", Cli_Login = "", Cli_CPT = "", Cli_NO = "", Cli_CIV = "", Cli_NOM = "", Cli_CPT_TYPE = "", Cli_CONS = "", Cli_CIN = "", Cli_REL_TRIMESTRIEL = "", Cli_AVIS_OPERE = "", Cli_MYLIST = "", Cli_MYCONFIG = "", Cli_CivCORRESP = "", Cli_CORRESP = "", Cli_COMPTEJOINT = "", Cli_COMPTEMANDATAIRE = "", Cli_CONDWEB = "", Cli_FRAIS = 0, Cli_PF = "", Cli_exclu = "False", Cli_Conformite = ""; typeCLient = "externe", //typeCLient = "interne", resumeWnd = null, nbauth = 0, listeDesComptes = new Array, ClientAccountDiv = "", msgErrorServer = 'Problème de communication avec le serveur', o_ordre = "", etatBoucle = 0, Array_liste_titre_execution = "", SeqExec = 0, tit_hist_jour_inv = [[]], modulo_refresh = 0; var TypeMarche = ["continu", "fixing", "Auction_1_1", "Auction_1_N", "obligation", "selection", "indices"]; var resumData_All = new Array, resumData_continu = new Array, resumData_fixing = new Array, resumData_Auction_1_1 = new Array, resumData_Auction_1_N = new Array, resumData_oblig = new Array, resumData_indices = new Array, resumData_selection = new Array, dataContinuForConfig = new Array, dataFixingForConfig = new Array, dataAuctionForConfig = new Array, dataObligationsForConfig = new Array, dataSelectionFromLastConfig = new Array, dataSelectionForConfigTemp = new Array, tit_hist_jour = [[]], //Suivi des executions list_client_tit = new Array, // list_cli_suivi_tit = new Array, // LIM5_1 = [[]], ResumeTop5H = new Array, ResumeTop5B = new Array, ResumeTop5V = new Array, objTop5H = null, objTop5B = null, objTop5V = null, Show_PTOVTOQTO = 0, Show_Ticker = 1, Show_Ticker_FromConf, showTickerWithImages, ouvTime = "", preOuvTime = "", fermTime = "", mktState = "", lastSeqM = "", lastTimeMarket = "", firstResumeState = false, firstIndicesState = false, fluxMarketState = false, LastValBRVM10 = 0, LastVarBRVM10 = 0, minBRVM10 = 0, maxBRVM10 = 0, oldBRVM10 = 0, LastValBRVMC = 0, LastVarBRVMC = 0, minBRVMC = 0, maxBRVMC = 0, oldBRVMC = 0, LastValBRVMPRES = 0, LastVarBRVMPRES = 0, minBRVMPRES = 0, maxBRVMPRES = 0, oldBRVMPRES = 0, LastVolumeActions = 0, LastVolumeObligations = 0, RES_TIT_CLI = new Array, AffFAQ = 0, FAQ = null, ResumeWND = null, AffResume = 0, TabResume = 0, NomTabResume = "", WY, WHeight, idResumeMarche, objResumeMKT, $gridResume, wResumeTOP5H = null, AffTOP5H = 0, wResumeTOP5B = null, AffTOP5B = 0, wResumeTOP5V = null, AffTOP5V = 0, ResumeBRVM10 = null, AffBRVM10 = 0, ResumeBRVMPRES = null, AffBRVMPRES = 0, ResumeBRVMC = null, AffBRVMC = 0, ResumeMESS = null, AffMESS = 0, PALMARES = null, detailsPalmares = null, AffPALM = 0, PalmaresX = -5, PalmaresY = -5, PalmaresStartDate = -5, PalmaresEndDate = -5, IMPRESSION = null, AffIMPRIMER = 0, IMPRESSIONORDER = null, AffIMPRIMER_ORDER = 0, ECHANGES = null, AffECH = 0, PORTEFEUILLE = null, AffPORTF = 0, sommePFWINDOW = null, affSommePF = 0, GrapheBRVM10Historique = null, BRVM10HistoAFF = 0, GrapheBRVMPRESHistorique = null, BRVMPRESHistoAFF = 0, GrapheBRVMCHistorique = null, BRVMCHistoAFF = 0, EXECUTION = null, AffEXECU = 0, VUE_GRAPHIQUE = null, Aff_VUE_Gra = 0, SAVECONFIG = null, configWindow = null, AffConfig = 0, OPERE = null, AffAvOp = 0, Enc = null, AffAvEnc = 0, TRIMESTRIEL = null, AffRelTri = 0, AVISANN = null, AffAvisAnn = 0, WINDOW_INFOS = null, AFFINFOS = 0, updatePassWordWindow = null, Aff_UpdatPSW = 0, AnalyseTecWindow = null, Aff_AnalyseTec = 0, releveTitreWindow = null, Aff_RELEVE_TITRE = 0, releveEspeceWindow = null, Aff_RELEVE_ESPECE = 0, ORDER = null, AffOrder = 0, messagesBRVM = new Array, nbmessagesBRVM = 0; var xBRVM10 = "", yBRVM10 = "", xBRVMC = "", yBRVMC = "", xHausses = "", yHausses = "", xBaisses = "", yBaisses = "", xVolumes = "", yVolumes = "", xTunindex = "", yTunindex = "", xMessages = "", yMessages = "", xPosBeforeChange = "", yPosBeforeChange = ""; //résumé marché var IntervalVerifFirstMarche1 = null, IntervalVerifFirstMarche2 = null, IntervalVerifFirstIndices = null, IntervalVerifMarche = null, scrollAuto = 0; function OnErrorWithMsg(errorMessage) { alertify.set({ buttonFocus: "ok", labels: { ok: "Ok" } }); alertify.alert(errorMessage); } function getIndexInBOC(mne) { switch (mne.toLowerCase()) { case 'brvm-c': return 0; case 'brvm-10': return 1; case 'brvm-ind': return 2; case 'brvm-spu': return 3; case 'brvm-fin': return 4; case 'brvm-trp': return 5; case 'brvm-agr': return 6; case 'brvm-dis': return 7; case 'brvm-aut': return 8; case 'brvm-30': return 9; case 'brvm-pres': return 10; default: break; } return indexInBOC; } function getMnePosition(Mne) { var k = -1; for (var i = 0; i < resumData_All.length; i++) { if (resumData_All[i][0] == Mne) { k = i; break; } } return k; } function getNamePositionAll(Name) { var k = -1; for (var i = 0; i < resumData_All.length; i++) { if (resumData_All[i][47] == Name) { k = i; break; } } return k; } function getNamePositionCli(Name) { var k = -1; for (var i = 0; i < resumData_selection.length; i++) { if (resumData_selection[i][1] == Name) { k = i; break; } } return k; } function getConvPosGrid(Posall) { var dataIndx = 0; switch (Posall) { case 47: dataIndx = 1; break; //Titre --VALIDEE //case 54: dataIndx = 2; case 16: dataIndx = 3; break;//QteAchat1--VALIDEE case 17: dataIndx = 4; break;//CoursAchat1--VALIDEE case 18: dataIndx = 5; break;//CoursVente1--VALIDEE case 19: dataIndx = 6; break;//QteVente1--VALIDEE case 6: dataIndx = 7; break; //Dernier_cours--VALIDEE case 48: dataIndx = 8; break;//QtEE--VALIDEE case 50: dataIndx = 9; break;//susp--VALIDEE case 7: dataIndx = 10; break; //Var.%--VALIDEE case 51: dataIndx = 11; break;//Var--VALIDEE case 8: dataIndx = 12; break; //Qte_echangee--VALIDEE case 9: dataIndx = 13; break; //Seuil_bas--VALIDEE case 10: dataIndx = 14; break; //Seuil_haut--VALIDEE case 3: dataIndx = 15; break; //Cours_veille --VALIDEE case 46: dataIndx = 16; break; //CMP--VALIDEE case 11: dataIndx = 17; break; //Prx theorique case 12: dataIndx = 18; break; //Qte_theorique case 13: dataIndx = 19; break; //Variation_theorique case 14: dataIndx = 20; break; //Cours_ouv case 45: dataIndx = 21; break; //volume case 49: dataIndx = 22; break; //Dern case 4: dataIndx = 25; break;//Cours_min case 5: dataIndx = 26; break;//Cours_max //case 54: colIndx = 2; default: -1; } return dataIndx; } function get_conv_pos_grid(Posall) { var i = 0; switch (Posall) { case 47: i = 1; break; //Titre case 16: i = 2; break;//QteAchat1 case 17: i = 3; break;//CoursAchat1 case 18: i = 4; break;//CoursVente1 case 19: i = 5; break;//QteVente1 case 6: i = 6; break; //Dernier_cours case 48: i = 7; break;//QtEE case 50: i = 8; break;//susp case 7: i = 9; break; //Var.% case 51: i = 10; break;//Var case 8: i = 11; break; //Qte_echangee case 9: i = 12; break; //Seuil_bas case 10: i = 13; break; //Seuil_haut case 3: i = 14; break; //Cours_veille case 46: i = 15; break; //CMP case 11: i = 16; break; //Prx theorique case 12: i = 17; break; //Qte_theorique case 13: i = 18; break; //Variation_theorique case 14: i = 19; break; //Cours_ouv case 45: i = 20; break; //volume case 49: i = 21; break; //Dern case 4: i = 24; break;//Cours_min case 5: i = 25; break;//Cours_max default: -1; } return i; } function getTimeStampTime(dateTimeValue) { var d = dateTimeValue, dArr = d.split('/'), ts = new Date(dArr[1] + "/" + dArr[0] + "/" + dArr[2]).getTime(); return ts; } function format(valeur, decimale, separateur) { var deci = Math.round(Math.pow(10, decimale) * (Math.abs(valeur) - Math.floor(Math.abs(valeur)))); var val = Math.floor(Math.abs(valeur)); if ((decimale == 0) || (deci == Math.pow(10, decimale))) { val = Math.floor(Math.abs(valeur)); deci = 0; } var val_format = val + ""; var nb = val_format.length; for (var i = 1; i < 4; i++) { if (val >= Math.pow(10, (3 * i))) { val_format = val_format.substring(0, nb - (3 * i)) + separateur + val_format.substring(nb - (3 * i)); } } if (decimale > 0) { var decim = ""; for (var j = 0; j < (decimale - deci.toString().length) ; j++) { decim += "0"; } deci = decim + deci.toString(); val_format = val_format + "." + deci; } if (parseFloat(valeur) < 0) { val_format = "-" + val_format; } return val_format; } function isNullOrUndefined(ob) { return (ob == null || ob == undefined); } /*Formatage dd/mm/yyyy to Date()*/ function fromddmmyyyyToDate(dt) { var day = dt.substring(0, 2); var month = Number(dt.substring(3, 5)) - 1; var year = dt.substring(6, dt.length); return new Date(year, month, day); } /***************************************/ /**********Fonctions Prototype**********/ /***************************************/ /* Cette fonction permet de formater une variable de type number : c est le nombre de chiffres décimaux, d est le séparateur ente partie entière et partie décimale, t est le séparateur ente chaque 3 chiffres de la partie entière*/ Number.prototype.formatMoney = 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) : ""); }; /* Cette fonction permet de formater une variable de type Date sous le format suivant dd/mm/yyyy exemple 21/05/2015 */ Date.prototype.ddmmyyyy = function () { var yyyy = this.getFullYear().toString(); var mm = (this.getMonth() + 1).toString(); // getMonth() is zero-based var dd = this.getDate().toString(); return (dd[1] ? dd : "0" + dd[0]) + '/' + (mm[1] ? mm : "0" + mm[0]) + '/' + yyyy; // padding }; /*Cette fonction permet de retourner sous format dd/mm/yyyy la date correspondate Il y a un an */ Date.prototype.getLastYearDate = function () { if (estBissextile(this.getFullYear()) && this.getMonth == 1) {//bissextile et mois février this.setDate(28); } this.setFullYear(this.getFullYear() - 1); return this.ddmmyyyy(); } /*Cette fonction permet dr retourner sous format dd/mm/yyyy la date coresponante il y a 3 mois*/ Date.prototype.getLastThreeMonthsDate = function () { var todayYear = this.getFullYear(), todayMonth = this.getMonth() + 1, todayDate = this.getDate(); var yearValue, monthValue, dayValue; if (todayMonth - 3 <= 0) { this.setFullYear(todayYear - 1); switch (todayMonth - 3) { case 0: //Mars -> Decembre this.setMonth(11); break; //Compteur mois commence à 0 case -1: //Février -> Novembre this.setMonth(10); break; case -2: //Janvier -> Octobre this.setMonth(9); break; default: break; } this.setDate(todayDate); } else { this.setFullYear(todayYear); this.setMonth(todayMonth - 4); if (todayDate == maxMonthDays[todayMonth - 1]) { switch (this.getMonth() + 1) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: this.setDate(31); break; case 2: if (estBissextile(this.getFullYear())) { this.setDate(29); } else { this.setDate(28); } break; case 4: case 6: case 9: case 11: this.setDate(30); break; } } else { this.setDate(todayDate); } } return this.ddmmyyyy(); } /*Cette fonction retourne la date correpondante en retranchant (-j) ou en ajoutant (j) avec j nobmre de jours */ Date.prototype.retrancherDate = function (j) { return new Date(this.getTime() + (1000 * 60 * 60 * 24 * j)); } Date.isLeapYear = function (year) { return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)); }; Date.getDaysInMonth = function (year, month) { return [31, (Date.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; }; Date.prototype.isLeapYear = function () { return Date.isLeapYear(this.getFullYear()); }; Date.prototype.getDaysInMonth = function () { return Date.getDaysInMonth(this.getFullYear(), this.getMonth()); }; Date.prototype.addMonths = function (value) { var n = this.getDate(); this.setDate(1); this.setMonth(this.getMonth() + value); this.setDate(Math.min(n, this.getDaysInMonth())); return this; }; Date.prototype.addDays = function (days) { var dat = new Date(this.valueOf()); dat.setDate(dat.getDate() + days); return dat; }; // Warn if overriding existing method if (Array.prototype.equals) console.warn("Overriding existing Array.prototype.equals. Possible causes: New API defines the method, there's a framework conflict or you've got double inclusions in your code."); // attach the .equals method to Array's prototype to call it on any array Array.prototype.equals = function (array) { // if the other array is a falsy value, return if (!array) return false; // compare lengths - can save a lot of time if (this.length != array.length) return false; for (var i = 0, l = this.length; i < l; i++) { // Check if we have nested arrays if (this[i] instanceof Array && array[i] instanceof Array) { // recurse into the nested arrays if (!this[i].equals(array[i])) return false; } else if (this[i] != array[i]) { // Warning - two different object instances will never be equal: {x:20} != {x:20} return false; } } return true; } // Hide method from for-in loops Object.defineProperty(Array.prototype, "equals", { enumerable: false }); /*****************variables module ORDRE***************************/ var BeginAnnulOrd = 0, type_nav, type_ord, val_navigation, ref_nav = "", var_num_oper = "", var_num_ord = "", sicav_bloquee = [], ordre_ANNUL = "", qte_min = "", Array_Titre = [], Array_Titre_Vente = [], Array_Cotation = [], cours_initial, montant_calcul, qte_disponible_vente, variation_limite = 0, number_day_valid = 0, Array_final = [], Array_Titre_Sousc, Qte_cr, Qte_db, Qte_utc, Qte_sk, QteDispD, Qte_sous, code_Ds, Qte_Res, total_lq_sicav = 0, disp = 0, Array_Sicav = [], etat_marche = "", taux = "", variation = "", max_variation = "", date_validitee = "", code_titre_array = "", nouv_taux_cota = "", chaine_blocage = "", CH = "", CH1 = "", origine_type_annulation = "", nom_titre = "", type_ordre_resum_portf = "", type_resum_port = "", cours_resum_portf = 0, qte_res_titre_vente = 0, var_nature = "", viz_liste_order = false, var_type = "", var_titre = "", rowData, Sup_ordvalid = "", Sup_num_oper = "", Sup_ord_qte = "", Sup_qte_exec = "", Sup_type_ord = "", Sup_type_ord_final = 0, DataListOrd = []; --- js/main.js?v=2 --- function initMainHandlers(typeOfCLIENT) { var displayAO = Cli_AVIS_OPERE == "1" ? "initial" : "none", displayRT = Cli_REL_TRIMESTRIEL == "1" ? "initial" : "none", displayFnCompte = typeCLient.toLowerCase() == 'externe' ? 'table-row' : 'none'; //displayORDRE = (Cli_CPT_TYPE.toLowerCase().indexOf('cgp') > -1 || Cli_CPT_TYPE.toLowerCase().indexOf('gere') > -1 || (Cli_CPT_TYPE).toLowerCase().indexOf("ceo") > -1) ? "none" : "initial", //textORDRES = displayORDRE = "initial" ? "Mes Ordres:" : ""; //for (var i = 0; i < 5; i++) { // ResumeTop5H.push(["", "", ""]); // ResumeTop5B.push(["", "", ""]); // ResumeTop5V.push(["", ""]); //} typeCLient = (typeOfCLIENT == undefined || "") ? "externe" : typeOfCLIENT; var ch = ""; //Test pour autres clients if (Cli_MYLIST != "rien" && $.trim(Cli_MYLIST) != "") { var listeSuivie = Cli_MYLIST.split("!"); for (var countLS = 0; countLS < listeSuivie.length; countLS++) { list_client_tit.push(listeSuivie[countLS].split(",")[1]); } } if (Cli_COMPTEJOINT == "0" && Cli_COMPTEMANDATAIRE == "0") { getlistOfAccount(); } else { if (Cli_COMPTEJOINT == "1" || Cli_COMPTEMANDATAIRE == "1") { if (Cli_COMPTEJOINT == "1") { ClientAccountDiv = "Compte " + Cli_CPT_TYPE + " N° " + Cli_CPT + ", " + Cli_CIV + " " + Cli_NOM + " ou " + Cli_CivCORRESP + " " + Cli_CORRESP; $("#Div3_CLI_NAME").html(ClientAccountDiv); } else { if (Cli_COMPTEMANDATAIRE == "1") { ClientAccountDiv = "Compte " + Cli_CPT_TYPE + " N° " + Cli_CPT + ", " + Cli_CIV + " " + Cli_NOM; $("#Div3_CLI_NAME").html(ClientAccountDiv); } } } } $('').appendTo('body'); switch (mktState.toLowerCase()) { case 'p': $("#Div1_Etat_M").html("Préouverture du marché"); break; case 'o': $("#Div1_Etat_M").html("Marché ouvert"); break; case 'f': $("#Div1_Etat_M").html("Marché fermé"); break; default: break; } $("#B_MESS").button({ icons: { primary: "messages" }, label: "(0)" }).attr("title", "(0) messages").click(function () { if (AffMESS == 0) { affichageMessages(); } else { hideWindow(ResumeMESS, AffMESS); } }); $("#B_PALM").button({ icons: { primary: "palmares" }, label: " " }).attr("title", "Palmarès").click(function () { if (AffPALM == 0) { affichagePalmares(); } else { hideWindow(PALMARES, AffPALM); } }); $("#B_PTO").button({ icons: { primary: "pto" }, label: " " }).attr("title", "Montrer PTO.VTO.QTO, Cours Min et Cours Max").click(function () { if (AffResume == 1) { if (Show_PTOVTOQTO == 0) { Show_PTOVTOQTO = 1; $("#B_PTO").attr("title", "Masquer PTO.VTO.QTO, Cours Min et Cours Max"); $.extend(objResumeMKT.colModel[17], { hidden: true }); $.extend(objResumeMKT.colModel[18], { hidden: true }); $.extend(objResumeMKT.colModel[19], { hidden: true }); if (TabResume != 6) { $("#grid_resume").pqGrid("option", "freezeCols", 0); } } else { Show_PTOVTOQTO = 0; $("#B_PTO").attr("title", "Montrer PTO.VTO.QTO, Cours Min et Cours Max"); $.extend(objResumeMKT.colModel[16], { hidden: false }); $.extend(objResumeMKT.colModel[17], { hidden: false }); $.extend(objResumeMKT.colModel[18], { hidden: false }); if (TabResume != 6) { $("#grid_resume").pqGrid("option", "freezeCols", 2); } } } $("#grid_resume").pqGrid("refreshDataAndView"); }); $("#B_EXEC").button({ icons: { primary: "exec" }, label: " " }).click(function () { if (mktState != 'F') { if (Show_Ticker == 1) { Show_Ticker = 0; $("#B_EXEC").attr("title", "Afficher le Ticker d'execution"); $("#main_ticker").hide(); } else { Show_Ticker = 1; $("#B_EXEC").attr("title", "Masquer le Ticker d'execution"); $("#main_ticker").show(); } } else { Show_Ticker = 0; $("#B_EXEC").attr("title", "Le Ticker des executions n'est diponible qu'en cours de séance"); $("#main_ticker").hide(); } //affichageResMarche(Nom_Tab_Resume); if (PALMARES != null) { var posPalmX = 0, posPalmY = 0; cssPalm = PALMARES.getContainer()[0].style.cssText.split(';'); for (var i = 0; i < cssPalm.length - 1 ; i++) { var currentElement = cssPalm[i].split(':'); if (currentElement[0].replace(' ', '') == "left") { posPalmX = Number(currentElement[1].replace('px', '')); } if (currentElement[0].replace(' ', '') == "top") { posPalmY = Number(currentElement[1].replace('px', '')); } } detailsPalmares = { PosX: posPalmX, PosY: posPalmY, DateDu: $("#datedu").val(), DateAu: $("#dateau").val() }; hideWindow(PALMARES, AffPALM); affichageResMarche(NomTabResume); affichagePalmares(); } else { affichageResMarche(NomTabResume); } }); $("#B_PRINT").button({ icons: { primary: "print" }, label: " " }).attr("title", "Imprimer").click(function () { if (AffIMPRIMER == 0) { affichageImpression(); } else { hideWindow(IMPRESSION, AffIMPRIMER); } }); $("#B_BRVM10").button({ label: "BRVM30" }).attr("title", "Détails BRVM30").click(function () { if (AffBRVM10 == 0) { affichageBRVM10(); } else { cacherBRVM10(); } }); $("#B_BRVMPRES").button({ label: "BRVM PRESTIGE" }).attr("title", "Détails BRVM PRESTIGE").click(function () { if (AffBRVMPRES == 0) { affichageBRVMPRES(); } else { cacherBRVMPRES(); } }); $("#B_BRVMC").button({ label: "BRVM C" }).attr("title", "Détails BRVM Composite").click(function () { if (AffBRVMC == 0) { affichageBRVMC(); } else { cacherBRVMC(); } }); $("#B_TOP5H").button({ label: "%" }).attr("title", "Les 5 plus fortes hausses").click(function () { if (AffTOP5H == 0) { affichageTOP5H(); } else { hideWindow(wResumeTOP5H, AffTOP5H); } }); $("#B_TOP5B").button({ label: "%" }).attr("title", "Les 5 plus fortes baisses").click(function () { if (AffTOP5B == 0) { affichageTOP5B(); } else { hideWindow(wResumeTOP5B, AffTOP5B); } }); $("#B_TOP5V").button({ icons: { primary: "volume" }, label: " " }).attr("title", "Les 5 meuilleurs volumes").click(function () { if (AffTOP5V == 0) { affichageTOP5V(); } else { hideWindow(wResumeTOP5V, AffTOP5V); } }); $("#B_EXCH_EX").button({ icons: { primary: "lampe" }, label: " " }).attr("title", "Echanges exceptionnels").click(function () { if (AffECH == 0) { affichageEchanges(); } else { hideWindow(ECHANGES, AffECH); } }); $("#B_HIDE_M").button({ icons: { primary: "hidemarket" }, label: " " }).attr("title", "Voir le Résumé du marché").click(function () { if (AffResume == 0) { if (PALMARES != null) { var posPalmX = 0, posPalmY = 0; cssPalm = PALMARES.getContainer()[0].style.cssText.split(';'); for (var i = 0; i < cssPalm.length - 1 ; i++) { var currentElement = cssPalm[i].split(':'); if (currentElement[0].replace(' ', '') == "left") { posPalmX = Number(currentElement[1].replace('px', '')); } if (currentElement[0].replace(' ', '') == "top") { posPalmY = Number(currentElement[1].replace('px', '')); } } detailsPalmares = { PosX: posPalmX, PosY: posPalmY, DateDu: $("#datedu").val(), DateAu: $("#dateau").val() }; hideWindow(PALMARES, AffPALM); affichageResMarche(NomTabResume); affichagePalmares(); } else { affichageResMarche(NomTabResume); } } else { cacherResMarche(); } }); $("#B_SAVE").button({ icons: { primary: "save" }, label: " " }).attr("title", "Enregistrer la configuration en cours").click(function () { affichageSaveConfig(); }); $("#B_CONF").button({ icons: { primary: "conf" }, label: " " }).attr("title", "Configurer ma sélection").click(function () { afficherConfiguration(); }); $("#B_FAQ").button({ label: "FAQ" }).attr("title", "Foire aux questions").click(function () { //alert("En cours de Développement"); if (AffFAQ == 0) { affichageFAQ(); } else { hideWindow(FAQ, AffFAQ); } }); $("#B_PORTEF").button({ icons: { primary: "pf" }, label: " " }).attr("title", "Portefeuille").click(function () { if (AffPORTF == 0) { affichagePortefeuille(); } else { hideWindow(PORTEFEUILLE, AffPORTF); } }); $("#B_RELEVE_TITRE").button({ icons: { primary: "rel" }, label: " " }).attr("title", "Relevé Titres").click(function () { if (Aff_RELEVE_TITRE == 0) { affichage_releve_titre(); } else { hideWindow(releveTitreWindow, Aff_RELEVE_TITRE); } }); $("#B_RELEVE_ESPECE").button({ icons: { primary: "relEsp" }, label: " " }).attr("title", "Relevé Espèce").click(function () { if (Aff_RELEVE_ESPECE == 0) { affichage_releve_espece(); } else { hideWindow(releveEspeceWindow, Aff_RELEVE_ESPECE); } }); $("#B_CHGMOTP").button({ icons: { primary: "chgmotp" }, label: " " }).attr("title", "Changer le mot de passe").click(function () { afficherChangerMotDePasse(); }); //$("#B_ORDRE").parent().parent().prev().children().html(textORDRES); $("#B_ORDRE").button({ icons: { primary: "ordre" }, label: " " }).attr("title", "Ordres");//.css("display", displayORDRE); $("#B_DEC").button({ icons: { primary: "dec" }, label: " " }).attr("title", "Se déconnecter").click(function () { clearTimeout(pingTimeout); alertify.set({ buttonFocus: "cancel", labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer la déconnexion ?", function (e) { if (e) { clearTimeout(updateMkt); Log_Out(); } else { pingTimeout = setTimeout(function () { VerifPing(1) }, 15000); } }); }); //$("#B_Avis_Ope").button({ icons: { primary: "avop" }, label: " " }).attr("title", "Avis d'opéré").css("display", displayAO).click(function () { $("#B_Avis_Ope").button({ icons: { primary: "avop" }, label: " " }).attr("title", "Avis d'opéré").css("display", "initial").click(function () { if (AffAvOp == 0) { affichageAvisOpere(); } else { hideWindow(OPERE, AffAvOp); } }); $("#B_Avis_Enc").button({ icons: { primary: "avenc" }, label: " " }).attr("title", "Avis Enc. Dividende").css("display", "initial").click(function () { if (AffAvEnc == 0) { affichageAvisEnc(); } else { hideWindow(Enc, AffAvEnc); } }); //$("#B_Rel_Trimes").button({ icons: { primary: "reltri" }, label: " " }).attr("title", "Relevé trimestriel").css("display", displayRT).click(function () { $("#B_Rel_Trimes").button({ icons: { primary: "reltri" }, label: " " }).attr("title", "Relevé trimestriel").css("display", "initial").click(function () { if (AffRelTri == 0) { affichage_rel_trimes(); } else { hideWindow(TRIMESTRIEL, AffRelTri); } }); $("#B_AvisAnn").button({ icons: { primary: "avisann" }, label: " " }).attr("title", "Avis d'annuité").css("display", "initial").click(function () { if (AffAvisAnn == 0) { affichage_avisAnns(); } else { hideWindow(AVISANN, AffAvisAnn); } }); $("#B_TARIF").button({ label: "Tarifications et réglements" }).attr("title", "Tarifications et réglements").click(function () { affichageTarificationEtReglements(); //var printURL_TARIF = URL_SERVICE + "Default.aspx?R=TARIF"; //window.open(printURL_TARIF, '_blank'); }); $("#div_boutons_compte").css("display", displayFnCompte); IntervalVerifFirstMarche1 = setInterval(function () { VerifFirstMarche1() }, 250); IntervalVerifFirstMarche2 = setInterval(function () { VerifFirstMarche2() }, 250); loadMarche(); } function VerifFirstMarche1() { if (mktState != "") { clearInterval(IntervalVerifFirstMarche1); } } function VerifFirstMarche2() { if (firstResumeState) { var considerLastConfig = false, tabIndice = 5, tabResumeExterne = "selection", afficherResume = true; clearInterval(IntervalVerifFirstMarche2); IntervalVerifFirstIndices = setInterval(function () { VerifFirstindices() }, 250); loadIndices(); if (Cli_MYCONFIG.indexOf("rien") == -1) { if (Cli_MYCONFIG.indexOf("!") != -1) { var detailsConfig = Cli_MYCONFIG.split("!"); ScreeWidthFomLastConfig = detailsConfig[0].split(';')[1]; ScreeHeightFomLastConfig = detailsConfig[0].split(';')[2]; considerLastConfig = (ScreeWidthFomLastConfig == screen.width && ScreeHeightFomLastConfig == screen.height) ? true : false; for (var i = 1; i < detailsConfig.length; i++) { if (detailsConfig[i] != undefined) { detailsConfigSplitted = detailsConfig[i].split(";"); if (detailsConfigSplitted[0] == 'TabNavigatorSelectedIndex') { tabIndice = Number(detailsConfigSplitted[1]); tabResumeExterne = TypeMarche[tabIndice]; } if (detailsConfigSplitted[0] == 'selectedCanvas') { tabResumeExterne = detailsConfigSplitted[1] != "" ? detailsConfigSplitted[1] : "selection"; tabIndice = TypeMarche.indexOf(tabResumeExterne) == -1 ? 5 : TypeMarche.indexOf(tabResumeExterne); } if (detailsConfigSplitted[0] == 'vertcallScroll') { scrollAuto = detailsConfigSplitted[1] == 1 ? 1 : 0; } switch (i) { case 1: Show_Ticker_FromConf = detailsConfigSplitted[1] == 1 ? 1 : 0; showTickerWithImages = Show_Ticker_FromConf == 1 ? detailsConfigSplitted[2] == 1 ? 1 : 0 : 0; if (mktState.toLowerCase() == 'o') { if (Show_Ticker_FromConf == 1) { Show_Ticker = 1; $("#B_EXEC").attr("title", "Masquer le Ticker d'execution"); $("#main_ticker").show(); } else { Show_Ticker = 0; $("#B_EXEC").attr("title", "Montrer le Ticker d'execution"); $("#main_ticker").hide(); } } else { Show_Ticker = 0; $("#B_EXEC").attr("title", "Le Ticker des executions n'est diponible qu'en cours de séance"); $("#main_ticker").hide(); } break; case 2: afficherResume = detailsConfigSplitted[3] == 1 ? true : false; break; case 3: if (considerLastConfig) { if (detailsConfigSplitted[3] == 1) { xHausses = detailsConfigSplitted[1]; yHausses = detailsConfigSplitted[2]; affichageTOP5H(); } else { hideWindow(wResumeTOP5H, AffTOP5H); } } break; case 4: if (considerLastConfig) { if (detailsConfigSplitted[3] == 1) { xBaisses = detailsConfigSplitted[1]; yBaisses = detailsConfigSplitted[2]; affichageTOP5B(); } else { hideWindow(wResumeTOP5B, AffTOP5B); } } break; case 5: if (considerLastConfig) { if (detailsConfigSplitted[3] == 1) { xVolumes = detailsConfigSplitted[1]; yVolumes = detailsConfigSplitted[2]; affichageTOP5V(); } else { hideWindow(wResumeTOP5V, AffTOP5V); } } break; case 6: if (considerLastConfig) { if (detailsConfigSplitted[3] == 1) { xMessages = detailsConfigSplitted[1]; yMessages = detailsConfigSplitted[2]; affichageMessages(); } else { hideWindow(ResumeMESS, AffMESS); } } break; case 7: if (considerLastConfig) { if (detailsConfigSplitted[3] == 1) { xBRVM10 = detailsConfigSplitted[1]; yBRVM10 = detailsConfigSplitted[2]; affichageBRVM10(); } else { cacherBRVM10(); } } break; case 8: if (considerLastConfig) { if (detailsConfigSplitted[3] == 1) { xBRVMC = detailsConfigSplitted[1]; yBRVMC = detailsConfigSplitted[2]; affichageBRVMC(); } else { cacherBRVMC(); } } break; case 9: case 10: case 11: case 12: case 13: if (considerLastConfig) { if ($.trim(detailsConfigSplitted) != "" && detailsConfigSplitted[0] != "vertcallScroll" && detailsConfigSplitted[0] != "TabNavigatorSelectedIndex" && detailsConfigSplitted[0] != "selectedCanvas" && detailsConfigSplitted[0] != "gridScrollposition") { RESAjouterTitreInit(detailsConfigSplitted[0], Number(detailsConfigSplitted[1]), Number(detailsConfigSplitted[2]), Number(detailsConfigSplitted[4]), Number(detailsConfigSplitted[3])); } } break; default: break; } } } if (afficherResume) { affichageResMarche(tabResumeExterne); } } else { if (mktState.toLowerCase() == 'o') { Show_Ticker = 0; $("#B_EXEC").attr("title", "Montrer le Ticker d'execution"); $("#main_ticker").hide(); } else { Show_Ticker = 0; $("#B_EXEC").attr("title", "Le Ticker des executions n'est diponible qu'en cours de séance"); $("#main_ticker").hide(); } affichageResMarche(tabResumeExterne); } } else { if (mktState.toLowerCase() == 'o') { Show_Ticker = 0; $("#B_EXEC").attr("title", "Montrer le Ticker d'execution"); $("#main_ticker").hide(); } else { Show_Ticker = 0; $("#B_EXEC").attr("title", "Le Ticker des executions n'est diponible qu'en cours de séance"); $("#main_ticker").hide(); } affichageResMarche(tabResumeExterne); } VerifMarche(); } } function VerifFirstindices() { if (firstIndicesState == true) { clearInterval(IntervalVerifFirstIndices); updateMkt = setTimeout(function () { Upd_Marche() }, 30000); PRO_TIKER(18, 80, 180, "main_ticker"); } } function VerifMarche() { if (fluxMarketState == true) { fluxMarketState = false; Upd_Marche(); } else { setTimeout(function () { VerifMarche(); }, 2000); } } function TypeMarPARNumMar(NomMarche) { for (var i = 0; i < TypeMarche.length; i++) { if (TypeMarche[i] == NomMarche.trim()) { return i; } } return -1; } function abc(idSelected) { var nomTickSelected = idSelected; var indiceTickSelected = getNamePositionAll(nomTickSelected); ResTitCliClick(indiceTickSelected); } function mouseOverAchat(img) { img.src = "img/plus2B.png"; } function mouseOverVente(img) { img.src = "img/moins2B.png"; } function mouseOutAchat(img) { img.src = "img/plus1B.png"; } function mouseOutVente(img) { img.src = "img/moins1B.png"; } //fausse ne donne pas un resultat correcte lorsque le mois possedent 31 jours alors que celui d'avant 4 mois possede que 30jours function GetLasThreeMonthDate(dt) { var month, day, year; year = dt.substring(6, dt.length); month = dt.substring(3, 5); date = dt.substring(0, 2); if ((Number(month) - 3) <= 0) { year = String(Number(year) - 1); switch (month) { case "01": month = "10"; break; case "02": month = "11"; break; case "03": month = "12"; break; default: break; } } else { month = Math.abs(month - 3); if (month <= 9) { month = "0" + month; if (month == "02") { if (date == "29") date == "28"; } } else { month = String(month); } } return date + "/" + month + "/" + year; } //**********************scroll automatique when internal client function scrollauto() { var heightLigne, heightGridAffiche, sens = 1, nbr_ligne_affiche, lg = 0, data_resume; function change_row() { if (sens == 1) { lg = parseInt(lg) + parseInt(nbr_ligne_affiche); if (lg < data_resume) { $("#grid_resume").pqGrid("scrollRow", { rowIndxPage: lg }); } if (lg >= data_resume) { lg = data_resume - 1; $("#grid_resume").pqGrid("scrollRow", { rowIndxPage: lg }); sens = -1; lg = parseInt(lg) - parseInt(nbr_ligne_affiche) + 1; } } else { lg = parseInt(lg) - parseInt(nbr_ligne_affiche); if (lg > 0) { $("#grid_resume").pqGrid("scrollRow", { rowIndxPage: lg }); } if (lg <= 0) { lg = 0; $("#grid_resume").pqGrid("scrollRow", { rowIndxPage: lg }); sens = 1; lg = parseInt(nbr_ligne_affiche) - 1; } } } if (heightLigne != undefined) { var heightLigne = $("#grid_resume table tbody tr").filter("[class~='pq-grid-row']").css("height"); heightGridAffiche = $("#grid_resume div").filter("[class~='pq-cont']").css("height"); nbr_ligne_affiche = heightGridAffiche.substring(0, heightGridAffiche.length - 2) / heightLigne.substring(0, heightLigne.length - 2); lg = parseInt(nbr_ligne_affiche) - 1; data_resume = $("#grid_resume").pqGrid("option", "dataModel.data").length; setInterval(change_row, 4500); } } //*********************************************************** --- js/Order.js?v=13 --- var actionOrder = ""; var BeginAnnulOrd = 0; var date_hier = new Date().addDays(-1).ddmmyyyy(); var Cli_Non_Depositaire = false; //ATP --> marché //OUV --> meilleure limite //Cours Limité --> Cours Limité var varTimerOrder; function initORDER(origineOrdre) { $("#Order_Tab").buttonset(); $("#radio").buttonset(); $('#Sicav_Achat').hide(); $('#Position_Vente').hide(); $('#Div_souscription').hide(); //tootip ajout order $("#tooltip_img").each(function () { $(this).tooltip({ content: $(this).attr('title') }) }); $("#lb_qte_devoilee").inputmask({ "mask": "9", "repeat": 9, "greedy": false, rightAlign: true }); $("#lb_qte").inputmask({ "mask": "9", "repeat": 9, "greedy": false, rightAlign: true }); $("#lb_cours").inputmask({ "mask": "9", "repeat": 9, "greedy": false, rightAlign: true }); $("#prixPrcObl").inputmask({ 'alias': 'numeric', 'groupSeparator': ' ', 'autoGroup': true, 'digits': 4, "repeat": 9, 'digitsOptional': false, 'prefix': '', 'placeholder': '0', rightAlign: true }); //boutons du module ordre $("#bajouter_ord").button({ icons: { primary: "bajout" } }); $("#bmodifier_ord").button({ icons: { primary: "bajout" } }); $("#bannuler_ord").button({ icons: { primary: "bannuler" } }); $("#bvalider_ord").button({ icons: { primary: "bvalider" } }); $("#bsupprimer_ord").button({ icons: { primary: "bsupprimer" } }); $("#bediter_ord").button({ icons: { primary: "bediter" } }); //afficher la liste des ordres $('#Div_liste_order').hide(); $("#bt_val_liste_ord").button({ icons: { primary: "val_liste" } }); $("#bt_val_liste_ord").click(function () { Valider_liste_ordre(); }); $("#title_liste").click(function () { liste_ordre(); }); $("#bannuler_ord").attr("disabled", "disabled"); $("#bvalider_ord").attr("disabled", "disabled"); $("#bannuler_ord").css({ opacity: 0.4 }); $("#bvalider_ord").css({ opacity: 0.4 }); $("#div_ord_annule").hide(); $("#img_ordre_valid").hide(); //les boutons $("#li_achat").click(function () { Achat_order(); }); $("#li_vente").click(function () { Vente_order(); }); $("#li_sousc").click(function () { Souscription_order(); }); $("#bajouter_ord").click(function () { actionOrder = "ajout"; origineOrdre = "4"; etat_f_ordre(1); }); $("#bmodifier_ord").click(function () { appel_etat_marcheModif(); }); $("#bannuler_ord").click(function () { annuler_ord(); }); $("#bvalider_ord").click(function () { bt_valider_annuler_OFF(); if ($("#cb_type_titre option:selected").text() != "Obligations") { calcul_variation_max(); } else { pre_control_validObligation(); } }); $("#bsupprimer_ord").click(function () { origine_type_annulation = "bt_annul"; supprimer_ord(); }); $("#bediter_ord").click(function () { editer_ord(); }); //type1: First, type2:previous, type3:next, type4:last $("#bfirst_ord").click(function () { find_order(var_Type_Ord, "-2"); }); $("#bprecedent_ord").click(function () { find_order(var_Type_Ord, "-1"); }); $("#bsuivant_ord").click(function () { find_order(var_Type_Ord, "1"); }); $("#blast_ord").click(function () { find_order(var_Type_Ord, "2"); }); $("#bhistOrd").click(function () { getHistModifications(); }); $('#checkbloc').change(function () { if (this.checked) { $("#lb_qte_minimale").attr("disabled", "disabled"); $("#lb_qte_minimale").css({ opacity: 0.4 }); $("#lb_qte_minimale").val("0"); } else { $("#lb_qte_minimale").removeAttr("disabled"); $("#lb_qte_minimale").css({ opacity: 1 }); } }); //change des combobx $("#filtre_nature_ord").change(function () { change_nature(); }); $("#checkTitre").change(function () { func_check(); }); $("#checkType").change(function () { func_check(); }); $("#filtre_type_ord").change(function () { change_type($("#filtre_type_ord").val()); }); //Combo-nature $("#filtre_nature_ord").append($("")); $("#filtre_nature_ord").append($("")); $("#filtre_nature_ord").append($("")); $("#filtre_nature_ord").append($("")); $("#filtre_nature_ord").append($("")); //Comb-type $("#filtre_type_ord").empty(); $("#filtre_type_ord").append($("")); $("#filtre_type_ord").append($("")); $("#filtre_type_ord").append($("")); $("#filtre_type_ord").append($("")); $("#filtre_type_ord").attr("disabled", "disabled"); $("#filtre_titre_ord").attr("disabled", "disabled"); $("#filtre_type_ord").css({ opacity: 0.4 }); $("#filtre_titre_ord").css({ opacity: 0.4 }); //Combo-Type Titre $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); //Combo-Type Ordre $("#cb_type_ordre").append($("")); $("#cb_type_ordre").append($("")); $("#cb_type_ordre").append($("")); $('#lb_a_v_s2').hide(); $('#lb_a_v_s3').hide(); $('#dg_sicav_bloquer').hide(); $('#lb_a_v_s1').show(); // test pour montrer ou non la colum passer order dans le grid et mettre ou non les bouton ordre if ((String(Cli_CPT_TYPE).toLowerCase().indexOf("cgp") > -1) || (String(Cli_CPT_TYPE).toLowerCase().indexOf("gere") > -1) || (String(Cli_CPT_TYPE).toLowerCase().indexOf("ceo") > -1) || Cli_exclu == "True" || Cli_BourseEnLigne == "0" || Cli_Conformite == "0") { $("#bannuler_ord").attr("disabled", "disabled"); $("#bvalider_ord").attr("disabled", "disabled"); $("#bsupprimer_ord").attr("disabled", "disabled"); $("#bajouter_ord").attr("disabled", "disabled"); $("#bmodifier_ord").attr("disabled", "disabled"); $("#bannuler_ord").css({ opacity: 0.4 }); $("#bvalider_ord").css({ opacity: 0.4 }); $("#bsupprimer_ord").css({ opacity: 0.4 }); $("#bajouter_ord").css({ opacity: 0.4 }); $("#bmodifier_ord").css({ opacity: 0.4 }); } // d'ou a été passé l'ordre --- 1:Resume, 2:titre, 3:portefeuille, 4: directement à travers le module ordre if (origineOrdre == 4) { Achat_order(); } else { etat_f_ordre(1); } varTimerOrder = setInterval(timerOrder, 5000); } /****************************************** Click sur les boutons du Menu : Achat, Vente, Souscription ***************************************************/ function Achat_order() { document.getElementById("title_liste").innerHTML = "Afficher la liste des ordres"; var_Type_Ord = 1; $('#Div_liste_order').hide(); $('#lb_a_v_s2').hide(); $('#lb_a_v_s3').hide(); $("#lb_a_v_s1").css("color", "#153f0c"); $("#tabs_A_V_S").css("background-color", "#F4FDEF"); $("#tabs_A_V_S").css("border-color", "#007903"); $("#tabs").css("background-color", "#85e356"); $("#table_donnee1").css("background-color", "#F4FDEF"); $("#table_donnee2").css("background-color", "#F4FDEF"); $("#div_cache").css("background-color", "rgba(204, 243, 184, 0.5)"); $("#cb_titre").removeAttr("disabled"); $("#cb_titre").css({ opacity: 1 }); $("#lb_validite").removeAttr("disabled"); $("#lb_validite").css({ opacity: 1 }); $("#lb_qte").removeAttr("disabled"); $("#lb_qte").css({ opacity: 1 }); $("#lb_cours").removeAttr("disabled"); $("#lb_cours").css({ opacity: 1 }); $("#cb_type_ordre").removeAttr("disabled"); $("#cb_type_ordre").css({ opacity: 1 }); $("#lb_qte_minimale").removeAttr("disabled"); $("#lb_qte_minimale").css({ opacity: 1 }); $('#lb_a_v_s1').show(); $('#tabs_A_V_S').show(); $('#Tr1').show(); etat_first = true; find_order(var_Type_Ord, "2"); } function Vente_order() { document.getElementById("title_liste").innerHTML = "Afficher la liste des ordres"; var_Type_Ord = 2; $('#Div_liste_order').hide(); $('#lb_a_v_s1').hide(); $('#lb_a_v_s3').hide(); $("#lb_a_v_s2").css("color", "#5b130c"); $("#tabs_A_V_S").css("background-color", "#FDF0F0"); $("#tabs_A_V_S").css("border-color", "#832324"); $("#tabs").css("background-color", "#e65c5c"); $("#table_donnee1").css("background-color", "#FDF0F0"); $("#table_donnee2").css("background-color", "#FDF0F0"); $("#div_cache").css("background-color", "rgba(244, 187, 187, 0.5)"); $("#cb_titre").removeAttr("disabled"); $("#cb_titre").css({ opacity: 1 }); $("#lb_validite").removeAttr("disabled"); $("#lb_validite").css({ opacity: 1 }); $("#lb_qte").removeAttr("disabled"); $("#lb_qte").css({ opacity: 1 }); $("#lb_cours").removeAttr("disabled"); $("#lb_cours").css({ opacity: 1 }); $("#cb_type_ordre").removeAttr("disabled"); $("#cb_type_ordre").css({ opacity: 1 }); $("#lb_qte_minimale").removeAttr("disabled"); $("#lb_qte_minimale").css({ opacity: 1 }); $('#lb_a_v_s2').show(); $('#tabs_A_V_S').show(); $('#Tr1').show(); find_order(var_Type_Ord, "2"); } function Souscription_order() { document.getElementById("title_liste").innerHTML = "Afficher la liste des ordres"; var_Type_Ord = 3; $('#Div_liste_order').hide(); $('#lb_a_v_s1').hide(); $('#lb_a_v_s2').hide(); $('#Tr1').hide(); $("#lb_a_v_s3").css("color", "#160f57"); $("#tabs_A_V_S").css("background-color", "#FFFFFF"); $("#tabs_A_V_S").css("border-color", "#343B81"); $("#tabs").css("background-color", "#98b9fd"); $("#table_donnee1").css("background-color", "#FFFFFF"); $("#table_donnee2").css("background-color", "#FFFFFF"); $("#div_cache").css("background-color", "rgba(189, 210, 255, 0.5)"); $("#cb_titre").removeAttr("disabled"); $("#cb_titre").css({ opacity: 1 }); $("#lb_validite").removeAttr("disabled"); $("#lb_validite").css({ opacity: 1 }); $("#lb_qte").removeAttr("disabled"); $("#lb_qte").css({ opacity: 1 }); $("#lb_cours").removeAttr("disabled"); $("#lb_cours").css({ opacity: 1 }); $("#cb_type_ordre").removeAttr("disabled"); $("#cb_type_ordre").css({ opacity: 1 }); $("#lb_qte_minimale").removeAttr("disabled"); $("#lb_qte_minimale").css({ opacity: 1 }); $('#lb_a_v_s3').show(); $('#tabs_A_V_S').show(); find_order(var_Type_Ord, "2"); } /******************************************* navigation Ordre ************************************************************************************/ //type_ord , type_nav , ByVal ref_nav As String, var type_nav; var type_ord; var val_navigation; var ref_nav = ""; var var_num_oper = ""; var var_num_ord = ""; var sicav_bloquee = []; var ordre_ANNUL = ""; /******************************************* Click sur first, nexte,previous,last *********************************************************************/ var qte_min = ""; function find_order(var_Type_Ord, type_nav) { val_navigation = type_nav; if (type_nav == '-1' || type_nav == '1' || type_nav == '0') { ref_nav = var_num_oper; } else { ref_nav = ""; } type_ord = var_Type_Ord; $.ajax({ async: false, cache: false, type: "POST", url: URL_SERVICE + "Service.svc/navigation_ordre", data: { type_ord: type_ord, type_nav: type_nav, ref_nav: ref_nav }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { OnSuccessFind_ordre(data1); }, error: OnError }); } var varORDVALID = false; var varReqToFIX = ''; var codeTitreSel = ''; function OnSuccessFind_ordre(data1) { var result = data1.responseJSON; var result_obj = $.parseJSON(result); if (result_obj.Navigation_Order != undefined) { var resp_leng = result_obj.Navigation_Order.length; if (resp_leng != 0) { codeTitreSel = result_obj.Navigation_Order[0].CODE_TITRE; $('#div_Aucun_Ord').hide(); //First,Previous,Next,Last Order $("#cb_titre").empty(); $("#cb_titre").append($("")); $("#cb_type_titre").empty(); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#cb_type_titre").val(String(result_obj.Navigation_Order[0].type_titre)); if (String(result_obj.Navigation_Order[0].type_titre) == "Obligations") { $("#lb_cours").inputmask({ 'alias': 'numeric', 'groupSeparator': ' ', 'autoGroup': true, 'digits': 2, "repeat": 6, 'digitsOptional': false, 'prefix': '', 'placeholder': '0', rightAlign: true }); $("#prixPrcObl").val(result_obj.Navigation_Order[0].prixStop); $("#rowPrixPrc").show(); } else { $("#lb_cours").inputmask({ "mask": "9", "repeat": 9, "greedy": false, rightAlign: true }); $("#prixPrcObl").val(""); $("#rowPrixPrc").hide(); } $("#cb_type_ordre").val(String(result_obj.Navigation_Order[0].traitement)); $("#lb_qte").val(result_obj.Navigation_Order[0].QTE_MAX); $("#lb_cours").val(result_obj.Navigation_Order[0].VAL_UNIT); $("#lb_validite").val(dateformat(result_obj.Navigation_Order[0].DATE_VALID)) document.getElementById("lb_cpt_client").innerHTML = String(result_obj.Navigation_Order[0].CPT_NO).substr(0, 6); document.getElementById("lb_num_ordre").innerHTML = result_obj.Navigation_Order[0].NUM_ORD; document.getElementById("ref").innerHTML = result_obj.Navigation_Order[0].RefClient; document.getElementById("lb_dt_ordre").innerHTML = dateformat(String(result_obj.Navigation_Order[0].DATE_ORD).substr(0, 10)) + " à " + String(result_obj.Navigation_Order[0].DATE_ORD).substr(11, 8); document.getElementById("lb_qte_executee").innerHTML = result_obj.Navigation_Order[0].QTE_EXEC; document.getElementById("lb_montant").innerHTML = format(Math.round((Number(result_obj.Navigation_Order[0].MONTANT) * 100) / 100), 0, " "); document.getElementById("lb_qte_minimale").value = result_obj.Navigation_Order[0].QteMin; var_num_ord = result_obj.Navigation_Order[0].NUM_ORD; var_num_oper = result_obj.Navigation_Order[0].NUM_OPER; ordre_ANNUL = result_obj.Navigation_Order[0].ANNUL; qte_min = result_obj.Navigation_Order[0].QteMin; varORDVALID = result_obj.Navigation_Order[0].ORDVALID; varReqToFIX = result_obj.Navigation_Order[0].REQ_TO_FIX; if (result_obj.Navigation_Order[0].lib != "") { var o = new Object(); var lib = result_obj.Navigation_Order[0].lib.split(';') sicav_bloquee = []; for (var i = 0; i < lib.length - 1; i++) { var lg = lib[i].split(','); o.tit = lg[0]; if (o.tit == "Liquidités") { o.qte = format(lg[1], 3, " "); } else { o.qte = parseInt(lg[1]); } sicav_bloquee.push({ tit: o.tit, qte: o.qte }) } $('#dg_sicav_bloquer').show(); var obj_sicav = { width: 305, height: 50, showTop: false, showBottom: false, showHeader: true, numberCell: { show: false }, scrollModel: { pace: 'fast', autoFit: true, theme: true }, sortable: false, resizable: false }; obj_sicav.colModel = [ { title: "Réservations", dataIndx: "tit", halign: "center", width: 100, dataType: "String", align: "left", editable: false, resizable: false, sortable: false }, { title: "Qte", dataIndx: "qte", halign: "center", width: 80, dataType: "float", align: "left", editable: false, resizable: false, sortable: false } ]; obj_sicav.dataModel = { data: sicav_bloquee }; $("#dg_sicav_bloquer").pqGrid(obj_sicav); $("#dg_sicav_bloquer").pqGrid("refreshDataAndView"); } if (Number(result_obj.Navigation_Order[0].VAL_UNIT) != 0) { if (Number(result_obj.Navigation_Order[0].QTE_EXEC) != 0) { document.getElementById("lb_cour_exec").innerHTML = result_obj.Navigation_Order[0].VAL_UNIT + " / " + result_obj.Navigation_Order[0].coursexec; } else { document.getElementById("lb_cour_exec").innerHTML = result_obj.Navigation_Order[0].VAL_UNIT; } } else { if (Number(result_obj.Navigation_Order[0].QTE_EXEC) != 0) { document.getElementById("lb_cour_exec").innerHTML = result_obj.Navigation_Order[0].traitement + " / " + result_obj.Navigation_Order[0].coursexec; } else { document.getElementById("lb_cour_exec").innerHTML = result_obj.Navigation_Order[0].traitement; } } if ((String(result_obj.Navigation_Order[0].ORDVALID)) == "true" && (String(result_obj.Navigation_Order[0].ANNUL) == "false")) { document.getElementById("lb_ord_valid").innerHTML = "Oui"; document.getElementById("lb_ord_annul").innerHTML = "Non"; document.getElementById("lb_dt_annul").innerHTML = dateformat(String(result_obj.Navigation_Order[0].DATE_ORD).substr(0, 10)); document.getElementById("lb_time_annul").innerHTML = String(result_obj.Navigation_Order[0].DATE_ORD).substr(11, 8); } else if ((String(result_obj.Navigation_Order[0].ORDVALID) == "false") && (String(result_obj.Navigation_Order[0].ANNUL) == "true")) { document.getElementById("lb_ord_valid").innerHTML = "Non"; document.getElementById("lb_ord_annul").innerHTML = "oui"; document.getElementById("lb_dt_annul").innerHTML = dateformat(String(result_obj.Navigation_Order[0].DATEA).substr(0, 10)); document.getElementById("lb_time_annul").innerHTML = String(result_obj.Navigation_Order[0].DATEA).substr(11, 8); } else { document.getElementById("lb_ord_valid").innerHTML = "Non"; document.getElementById("lb_ord_annul").innerHTML = "Non"; document.getElementById("lb_dt_annul").innerHTML = ""; document.getElementById("lb_time_annul").innerHTML = ""; } $("#rowBloc").show(); if (String(result_obj.Navigation_Order[0].DONNEUR).indexOf("B") > -1) { $('#checkbloc').prop('checked', true); } else { $('#checkbloc').prop('checked', false); } if (var_Type_Ord == 1) { $('#lb_a_v_s2').hide(); $('#lb_a_v_s3').hide(); $('#lb_a_v_s1').show(); $('#row1').show(); $('#row2').show(); if (actionOrder != "modif") { $("#dg_sicav_bloquer").pqGrid("refreshDataAndView"); $('#dg_sicav_bloquer').show(); } $("#bmodifier_ord").removeAttr("disabled"); $("#bmodifier_ord").css({ opacity: 1 }); } else if (var_Type_Ord == 2) { sicav_bloquee = []; $('#dg_sicav_bloquer').hide(); $('#lb_a_v_s1').hide(); $('#lb_a_v_s3').hide(); $('#lb_a_v_s2').show(); $('#row1').show(); $('#row2').show(); $("#bmodifier_ord").removeAttr("disabled"); $("#bmodifier_ord").css({ opacity: 1 }); } else if (var_Type_Ord == 3) { $("#cb_type_titre").empty(); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $('#row1').hide(); $('#row2').hide(); $('#lb_a_v_s1').hide(); $('#lb_a_v_s2').hide(); $('#lb_a_v_s3').show(); $("#dg_sicav_bloquer").pqGrid("refreshDataAndView"); $('#dg_sicav_bloquer').show(); } $('#Sicav_Achat').hide(); $('#Position_Vente').hide(); $('#Div_souscription').hide(); $('#div_cache').show(); } else if (resp_leng == 0) { $('#div_Aucun_Ord').show(); if (val_navigation == '1') { var_num_oper = Number(var_num_oper) + 1; } else if (val_navigation == '-1') { var_num_oper = Number(var_num_oper) - 1; } } } if (ordre_ANNUL == true || varORDVALID == false) { $("#bmodifier_ord").attr("disabled", "disabled"); $("#bmodifier_ord").css({ opacity: 0.4 }); } else { $("#bmodifier_ord").removeAttr("disabled"); $("#bmodifier_ord").css({ opacity: 1 }); } if (ordre_ANNUL == true) { $("#bsupprimer_ord").attr("disabled", "disabled"); $("#bsupprimer_ord").css({ opacity: 0.4 }); } else { $("#bsupprimer_ord").removeAttr("disabled"); $("#bsupprimer_ord").css({ opacity: 1 }); } } /****************************************** Fonctions diverses *******************************************************************************/ function dateformat(dt) { var dateFormatted; var date = dt.substr(0, 10); var year = date.substring(0, 4); var month = date.substring(5, 7); var day = date.substring(8, 10); return dateFormatted = day + "/" + month + "/" + year; } function formDt2(dt) { var day = dt.substring(0, 2); var month = Number(dt.substring(3, 5)) - 1; var year = dt.substring(6, dt.length); return new Date(year, month, day); } function bloquer_boutons() { if (actionOrder != "") { $("#bajouter_ord").attr("disabled", "disabled"); $("#bajouter_ord").css({ opacity: 0.4 }); $("#bmodifier_ord").attr("disabled", "disabled"); $("#bmodifier_ord").css({ opacity: 0.4 }); $("#bannuler_ord").attr("disabled", "disabled"); $("#bannuler_ord").css({ opacity: 0.4 }); $("#bvalider_ord").attr("disabled", "disabled"); $("#bvalider_ord").css({ opacity: 0.4 }); $("#bsupprimer_ord").attr("disabled", "disabled"); $("#bsupprimer_ord").css({ opacity: 0.4 }); $("#bediter_ord").attr("disabled", "disabled"); $("#bediter_ord").css({ opacity: 0.4 }); $("#bfirst_ord").attr("disabled", "disabled"); $("#bfirst_ord").css({ opacity: 0.4 }); $("#bfirst_ord").off('click'); $("#bprecedent_ord").attr("disabled", "disabled"); $("#bprecedent_ord").css({ opacity: 0.4 }); $("#bprecedent_ord").off('click'); $("#bsuivant_ord").attr("disabled", "disabled"); $("#bsuivant_ord").css({ opacity: 0.4 }); $("#bsuivant_ord").off('click'); $("#blast_ord").attr("disabled", "disabled"); $("#blast_ord").css({ opacity: 0.4 }); $("#blast_ord").off('click'); $("#Order_Tab").attr("disabled", "disabled"); $("#Order_Tab").css({ opacity: 0.4 }); $("#li_achat").attr("disabled", "disabled"); $("#li_achat").css({ opacity: 0.4 }); $("#li_vente").attr("disabled", "disabled"); $("#li_vente").css({ opacity: 0.4 }); $("#li_sousc").attr("disabled", "disabled"); $("#li_sousc").css({ opacity: 0.4 }); $("#bhistOrd").attr("disabled", "disabled"); $("#bhistOrd").css({ opacity: 0.4 }); } } function debloquer_boutons() { actionOrder = ""; if (actionOrder == "") { $("#rowPrixPrc").hide(); $("#rowIntUnit").hide(); $("#rowInterets").hide(); $("#rowValeurFaciale").hide(); // test pour montrer ou non la colonne passer order dans le grid et mettre ou non les boutons ordre if ((String(Cli_CPT_TYPE).toLowerCase().indexOf("cgp") > -1) || (String(Cli_CPT_TYPE).toLowerCase().indexOf("gere") > -1) || (String(Cli_CPT_TYPE).toLowerCase().indexOf("ceo") > -1) || Cli_exclu == "True" || Cli_BourseEnLigne == "0" || Cli_Conformite == "0") { $("#bannuler_ord").attr("disabled", "disabled"); $("#bvalider_ord").attr("disabled", "disabled"); $("#bsupprimer_ord").attr("disabled", "disabled"); $("#bajouter_ord").attr("disabled", "disabled"); $("#bmodifier_ord").attr("disabled", "disabled"); $("#bannuler_ord").css({ opacity: 0.4 }); $("#bvalider_ord").css({ opacity: 0.4 }); $("#bsupprimer_ord").css({ opacity: 0.4 }); $("#bajouter_ord").css({ opacity: 0.4 }); $("#bmodifier_ord").css({ opacity: 0.4 }); } else { $("#bajouter_ord").removeAttr("disabled"); $("#bajouter_ord").css({ opacity: 1 }); $("#bmodifier_ord").removeAttr("disabled"); $("#bmodifier_ord").css({ opacity: 1 }); $("#bsupprimer_ord").removeAttr("disabled"); $("#bsupprimer_ord").css({ opacity: 1 }); } $("#bediter_ord").removeAttr("disabled"); $("#bediter_ord").css({ opacity: 1 }); $("#bhistOrd").removeAttr("disabled"); $("#bhistOrd").css({ opacity: 1 }); $("#bfirst_ord").removeAttr("disabled"); $("#bfirst_ord").css({ opacity: 1 }); $("#bfirst_ord").on("click", function () { find_order(var_Type_Ord, "-2"); }); $("#bprecedent_ord").removeAttr("disabled"); $("#bprecedent_ord").css({ opacity: 1 }); $("#bprecedent_ord").on("click", function () { find_order(var_Type_Ord, "-1"); }); $("#bsuivant_ord").removeAttr("disabled"); $("#bsuivant_ord").css({ opacity: 1 }); $("#bsuivant_ord").on("click", function () { find_order(var_Type_Ord, "1"); }); $("#blast_ord").removeAttr("disabled"); $("#blast_ord").css({ opacity: 1 }); $("#blast_ord").on("click", function () { find_order(var_Type_Ord, "2"); }); $("#Order_Tab").removeAttr("disabled"); $("#Order_Tab").css({ opacity: 1 }); $("#li_achat").removeAttr("disabled"); $("#li_achat").css({ opacity: 1 }); $("#li_vente").removeAttr("disabled"); $("#li_vente").css({ opacity: 1 }); $("#li_sousc").removeAttr("disabled"); $("#li_sousc").css({ opacity: 1 }); } } function OnError(request, status, error) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert('Problème de communication avec le serveur'); } //ajout de jour à une date function DateAdd(timeU, byMany, dateObj) { var millisecond = 1; var second = millisecond * 1000; var minute = second * 60; var hour = minute * 60; var day = hour * 24; var year = day * 365; var newDate; var dVal = dateObj.valueOf(); switch (timeU) { case "ms": newDate = new Date(dVal + millisecond * byMany); break; case "s": newDate = new Date(dVal + second * byMany); break; case "mi": newDate = new Date(dVal + minute * byMany); break; case "h": newDate = new Date(dVal + hour * byMany); break; case "d": newDate = new Date(dVal + day * byMany); break; case "y": newDate = new Date(dVal + year * byMany); break; } return newDate; } /****************************************** Fonction de chargement , 0 : Consultation , 1 : Ajout , 2 : Modification ***************************/ /****************************************** 1 : Achat , 2 : Vente , 3 : Souscription ***********************************************************/ var var_Type_Ord = 1; var qteModif = ""; var coursModif = ""; var montantAncienModif = ""; var montantNouveauModif = ""; //Montant à bloquer en tenant compte des exécution partielles var mntBloc2 = ""; function etat_f_ordre(param) { //consultation if (param == 0) { find_order(var_Type_Ord, "2"); } //ajout else if (param == 1) { $("#prixPrcObl").blur(function () { if ($("#prixPrcObl").val() != "" && Number($("#prixPrcObl").val()) < 50) { $("#prixPrcObl").val("50.0000"); } if ($("#cb_type_ordre").val() == "Cours limité") { changePrixPrcObl(); } calculMontantObl(); }); $("#prixPrcObl").keyup(function () { if (Number($("#prixPrcObl").val()) >= 50) { changePrixPrcObl(); calculMontantObl(); } }); $("#lb_cours").keyup(function () { changeCoursObl(); calculMontantObl(); }); $('#checkbloc').prop('checked', false); $("#rowBloc").show(); $("#rowPrixPrc").hide(); $("#cb_type_titre").removeAttr("disabled"); $("#cb_type_titre").css({ opacity: 1 }); $("#cb_titre").removeAttr("disabled"); $("#cb_titre").css({ opacity: 1 }); $('#div_Aucun_Ord').hide(); //disable les buttons bloquer_boutons(); $("#title_liste").attr("disabled", "disabled"); $("#title_liste").css({ opacity: 0.4 }); //enable les buttons $("#bannuler_ord").removeAttr("disabled"); $("#bvalider_ord").removeAttr("disabled"); $("#bannuler_ord").css({ opacity: 1 }); $("#bvalider_ord").css({ opacity: 1 }); $("#cb_type_ordre").val("Cours limité"); $("#lb_cours").inputmask({ "mask": "9", "repeat": 9, "greedy": false, rightAlign: true }); //ajout ordre d'achat if (var_Type_Ord == 1) { $("#cb_type_titre").empty(); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#tabs_A_V_S").css("background-color", "#F4FDEF"); $("#tabs_A_V_S").css("border-color", "#007903"); $("#table_donnee1").css("background-color", "#F4FDEF"); $("#table_donnee2").css("background-color", "#F4FDEF"); $("#tabs").css("background-color", "#85e356"); $("#lb_cours").removeAttr("disabled"); $("#lb_cours").css({ opacity: 1 }); $("#lb_validite").removeAttr("disabled"); $("#lb_validite").css({ opacity: 1 }); document.getElementById("lb_num_ordre").innerHTML = ""; document.getElementById("ref").innerHTML = ""; document.getElementById("lb_dt_ordre").innerHTML = ""; document.getElementById("lb_qte_executee").innerHTML = ""; document.getElementById("lb_ord_valid").innerHTML = ""; //document.getElementById("lb_montant").innerHTML = "0.000"; document.getElementById("lb_montant").innerHTML = "0"; document.getElementById("lb_ord_annul").innerHTML = ""; document.getElementById("lb_dt_annul").innerHTML = ""; document.getElementById("lb_time_annul").innerHTML = ""; $("#lb_qte").val(""); $("#lb_qte_minimale").val("0"); //change des combos // $("#cb_type_titre").click(function () { change_type_titre(); }); $("#cb_type_titre").change(function () { change_type_titre(); origineOrdre = 4; }); $("#cb_titre").change(function () { origineOrdre = 4; change_titre(); }); $("#cb_type_ordre").change(function () { change_type_ordre(); }); //change des autres composants $("#lb_validite").change(function () { if ($("#cb_type_titre option:selected").text() != "Obligations") { calcul_validite(date_validitee, $("#lb_validite").val()); } else { calculMontantObl(); } }); $("#lb_qte").keyup(function () { change_quantite(); }); $("#lb_cours").change(function () { if ($("#cb_type_titre option:selected").text() != "Obligations") { calcul_montant(); } else { calculMontantObl(); } }); $("#lb_qte_minimale").change(function () { change_quantite_minimale(); }); $("#dg_sicav_bloquer").hide(); $("#div_ord_annule").hide(); $("#img_ordre_valid").hide(); $("#row2").hide(); $("#div_cache").hide(); change_type_ordre(); appel_cotation(); $("#cb_type_titre").val("Actions Cotées"); appel_etat_marche(); } else if (var_Type_Ord == 2) { $("#cb_type_titre").empty(); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); $("#tabs_A_V_S").css("background-color", "#FDF0F0"); $("#tabs_A_V_S").css("border-color", "#832324"); $("#table_donnee1").css("background-color", "#FDF0F0"); $("#table_donnee2").css("background-color", "#FDF0F0"); $("#tabs").css("background-color", "#e65c5c"); $("#lb_a_v_s2").css("color", "#5b130c"); $("#lb_cours").removeAttr("disabled"); $("#lb_cours").css({ opacity: 1 }); $("#lb_validite").removeAttr("disabled"); $("#lb_validite").css({ opacity: 1 }); document.getElementById("lb_num_ordre").innerHTML = ""; document.getElementById("ref").innerHTML = ""; document.getElementById("lb_dt_ordre").innerHTML = ""; document.getElementById("lb_qte_executee").innerHTML = ""; document.getElementById("lb_ord_valid").innerHTML = ""; document.getElementById("lb_montant").innerHTML = "0"; document.getElementById("lb_ord_annul").innerHTML = ""; document.getElementById("lb_dt_annul").innerHTML = ""; document.getElementById("lb_time_annul").innerHTML = ""; if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : "; } if ($("#lb_qte_rest_vente").length > 0) { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : "; } $("#lb_qte").val(""); $("#lb_qte_minimale").val("0"); $("#cb_type_titre").change(function () { change_type_titre(); }); $("#cb_titre").change(function () { change_titre(); }); $("#cb_type_ordre").change(function () { change_type_ordre(); }); $("#lb_validite").change(function () { calcul_validite(date_validitee, $("#lb_validite").val()); }); $("#lb_qte").keyup(function () { change_quantite(); }); $("#lb_qte").change(function () { change_quantite(); }); $("#lb_cours").change(function () { calcul_montant(); }); $("#lb_qte_minimale").change(function () { change_quantite_minimale(); }); $("#dg_sicav_bloquer").hide(); $("#div_ord_annule").hide(); $("#img_ordre_valid").hide(); $("#row2").hide(); $("#div_cache").hide(); change_type_ordre(); appel_etat_marche(); } //ajout ordre de souscription else if (var_Type_Ord == 3) { $("#lb_cours").attr("disabled", "disabled"); $("#lb_cours").css({ opacity: 0.4 }); $("#lb_validite").attr("disabled", "disabled"); $("#lb_validite").css({ opacity: 0.4 }); document.getElementById("lb_num_ordre").innerHTML = ""; document.getElementById("ref").innerHTML = ""; document.getElementById("lb_dt_ordre").innerHTML = ""; document.getElementById("lb_qte_executee").innerHTML = ""; document.getElementById("lb_ord_valid").innerHTML = ""; document.getElementById("lb_montant").innerHTML = "0"; document.getElementById("lb_ord_annul").innerHTML = ""; document.getElementById("lb_dt_annul").innerHTML = ""; document.getElementById("lb_time_annul").innerHTML = ""; $("#lb_qte").val(""); $("#lb_qte_minimale").val("0"); $("#cb_type_titre").change(function () { change_type_titre(); }); $("#cb_titre").change(function () { change_titre(); }); $("#cb_type_ordre").change(function () { change_type_ordre(); }); $("#lb_qte").keyup(function () { change_quantite(); }); $("#lb_qte").change(function () { verif_parite_sous(); }); $("#lb_validite").change(function () { calcul_validite(date_validitee, $("#lb_validite").val()); }); $("#lb_cours").change(function () { calcul_montant(); }); $("#lb_qte_minimale").change(function () { change_quantite_minimale(); }); $("#dg_sicav_bloquer").hide(); $("#div_ord_annule").hide(); $("#img_ordre_valid").hide(); $("#row2").hide(); $("#div_cache").hide(); $("#cb_type_titre").empty(); $("#cb_type_titre").append($("")); $("#cb_type_titre").append($("")); change_type_ordre(); appel_cotation(); appel_etat_marche(); } } //modification else if (param == 2) { calcul_sicavModif(); $("#lb_qte").blur(function () { change_quantite_modif(); }); $("#lb_qte").keyup(function () { change_quantite(); }); qteModif = $("#lb_qte").val(); coursModif = $("#lb_cours").val(); montantAncienModif = $("#lb_montant").text().replace(/\s/g, ""); $('#div_Aucun_Ord').hide(); bloquer_boutons(); $("#title_liste").attr("disabled", "disabled"); $("#title_liste").css({ opacity: 0.4 }); $("#bannuler_ord").removeAttr("disabled"); $("#bvalider_ord").removeAttr("disabled"); $("#bannuler_ord").css({ opacity: 1 }); $("#bvalider_ord").css({ opacity: 1 }); $("#div_cache").hide(); $("#dg_sicav_bloquer").hide(); if ($("#cb_type_ordre").val() == "Meilleure limite" || $("#cb_type_ordre").val() == "Marché") { $("#rowBloc").hide(); var now = new Date(); var h = now.getHours(); var m = now.getMinutes(); var dateValiditeMarche = ""; if (etat_marche != 3) { dateValiditeMarche = new Date(); } else { if (h >= 14) { dateValiditeMarche = new Date().addDays(1); } else if (h >= 00) { dateValiditeMarche = new Date(); } } if (dateValiditeMarche.getDay() == 6) { dateValiditeMarche = dateValiditeMarche.addDays(2); } else if (dateValiditeMarche.getDay() == 0) { dateValiditeMarche = dateValiditeMarche.addDays(1); } $("#lb_validite").datepicker("option", "disabled", true); $("#lb_validite").val(dateValiditeMarche.ddmmyyyy()); } else { $("#rowBloc").show(); $("#lb_validite").datepicker("option", "disabled", false); } if ($("#cb_type_ordre").val() == "Meilleure limite" || $("#cb_type_ordre").val() == "Marché") { $("#lb_qte_minimale").attr("disabled", "disabled"); $("#lb_qte_minimale").css({ opacity: 0.4 }); $("#lb_cours").attr("disabled", "disabled"); $("#lb_cours").css({ opacity: 0.4 }); $("#lb_qte_minimale").val("0"); appel_cotation(); } else { $("#lb_qte_minimale").removeAttr("disabled"); $("#lb_qte_minimale").css({ opacity: 1 }); $("#lb_cours").removeAttr("disabled"); $("#lb_cours").css({ opacity: 1 }); } if ($("#cb_type_ordre").val() == "Cours limité") { //date_validte_achat.enabled = true; $("#lb_validite").removeAttr("disabled"); $("#lb_validite").css({ opacity: 1 }); var parts = $("#lb_validite").val().split("/"); var dt = new Date(parseInt(parts[2], 10), parseInt(parts[1], 10) - 1, parseInt(parts[0], 10) + 1 ); var daynextyear = dt.getDate() + '/' + (dt.getMonth() + 1) + '/' + (dt.getFullYear() + 1); $("#lb_validite").datepicker({ minDate: $("#lb_validite").val(), maxDate: daynextyear, changeMonth: true, changeYear: true, beforeShowDay: $.datepicker.noWeekends }); $("#lb_validite").datepicker("option", "disabled", false); } else { //date_validte_achat.enabled=false; } //Bloquer les 2 Combos Type Titre, Nom Titre. $("#cb_type_titre").attr("disabled", "disabled"); $("#cb_type_titre").css({ opacity: 0.4 }); $("#cb_titre").attr("disabled", "disabled"); $("#cb_titre").css({ opacity: 0.4 }); if (var_Type_Ord == 1) { $("#Sicav_Achat").show(); } if (var_Type_Ord == 2) { //remplir les label if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : "; } if ($("#lb_qte_rest_vente").length > 0) { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : "; } $("#Position_Vente").show(); $("#lb_qte").keyup(function () { change_quantite(); }); } $("#cb_type_ordre").change(function () { change_type_ordre(); }); } } /****************************************** Fonction incluant tout les changements sur les composants lors de l'ajout ou de la modification **************/ var Array_Titre = []; var Array_Titre_Vente = []; var Array_Cotation = []; var cours_initial; var montant_calcul; var qte_disponible_vente; var variation_limite = 0; var number_day_valid = 0; var Array_final = []; function change_type_titre() { var typeTitre = ""; if ($("#cb_type_titre option:selected").text() == "Actions Cotées") { typeTitre = "actionsCotees"; } if ($("#cb_type_titre option:selected").text() == "Actions") { typeTitre = "actions"; } else if ($("#cb_type_titre option:selected").text() == "Droits d'attributions") { typeTitre = "droitsAttrib"; } else if ($("#cb_type_titre option:selected").text() == "Droits de souscriptions") { typeTitre = "droitsSousc"; } else if ($("#cb_type_titre option:selected").text() == "Obligations") { $("#lb_cours").inputmask({ 'alias': 'numeric', 'groupSeparator': ' ', 'autoGroup': true, 'digits': 2, "repeat": 9, 'digitsOptional': false, 'prefix': '', 'placeholder': '0', rightAlign: true }); typeTitre = "Obligations"; } if (typeTitre != "Obligations") { $("#lb_cours").inputmask({ "mask": "9", "repeat": 9, "greedy": false, rightAlign: true }); $("#cb_type_ordre").prop('disabled', false); $("#cb_type_ordre").css({ opacity: 1 }); $("#lb_cours").prop('disabled', false); $("#lb_cours").css({ opacity: 1 }); $("#rowPrixPrc").hide(); $("#rowIntUnit").hide(); $("#rowInterets").hide(); $("#rowValeurFaciale").hide(); if (var_Type_Ord == 1) { $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/get_Titres", data: { type_titre: $("#cb_type_titre option:selected").text() }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { OnSuccesschange_type_titre(data1); }, error: OnError }); } if (var_Type_Ord == 2) { $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/get_Titres_VENTE", data: { type_titre: typeTitre }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { OnSuccesschange_type_titre(data1); }, error: OnError }); } if (var_Type_Ord == 3) { var param_type = ""; if ($("#cb_type_titre option:selected").text() == "Actions") { param_type = "Actions_SOUSC"; } else if ($("#cb_type_titre option:selected").text() == "Obligations") { param_type = "Obligations_SOUSC"; } $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/get_Titres", data: { type_titre: param_type }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { OnSuccesschange_type_titre(data1); }, error: OnError }); } } else { $("#rowPrixPrc").show(); $("#rowIntUnit").show(); $("#rowInterets").show(); $("#rowValeurFaciale").show(); $("#lb_cours").prop('disabled', true); $("#lb_cours").css({ opacity: 0.4 }); $("#lb_qte").val(""); $("#lb_montant").text(""); appelGetTitresOBL(); } } var Array_Titre_Sousc; var nomCTitres; var codesTitres; function OnSuccesschange_type_titre(data1) { nomCTitres = []; codesTitres = []; var result = data1.responseJSON; var result_obj = $.parseJSON(result); if (result_obj.listetitres != undefined) { var resp_leng = result_obj.listetitres.length; if (resp_leng != 0) { $("#cb_titre").empty(); Array_Titre = []; Array_Titre_Vente = []; Array_Titre_Sousc = []; for (var i = 0; i < resp_leng; i++) { $("#cb_titre").append($("")); nomCTitres[i] = result_obj.listetitres[i].Nom_C; if (var_Type_Ord == 1 || var_Type_Ord == 3) { codesTitres[i] = result_obj.listetitres[i].Code_titre; } else { codesTitres[i] = result_obj.listetitres[i].code_titre; } if (var_Type_Ord == 1) { Array_Titre.push([result_obj.listetitres[i].Nom_L, result_obj.listetitres[i].Code_titre, result_obj.listetitres[i].DernCours]); } else if (var_Type_Ord == 2) { Array_Titre_Vente.push([result_obj.listetitres[i].Nom_L, result_obj.listetitres[i].code_titre, result_obj.listetitres[i].DernCours, result_obj.listetitres[i].Qtedispon]); } else if (var_Type_Ord == 3) { Array_Titre_Sousc.push([result_obj.listetitres[i].Nom_L, result_obj.listetitres[i].Code_titre, result_obj.listetitres[i].valeur_n, result_obj.listetitres[i].date_fin, result_obj.listetitres[i].codeDS, result_obj.listetitres[i].qu_cr, result_obj.listetitres[i].Qu_Deb]); } } $("#cb_titre").removeAttr("disabled"); $("#cb_titre").css({ opacity: 1 }); $("#lb_validite").removeAttr("disabled"); $("#lb_validite").css({ opacity: 1 }); $("#lb_qte").removeAttr("disabled"); $("#lb_qte").css({ opacity: 1 }); $("#lb_cours").removeAttr("disabled"); $("#lb_cours").css({ opacity: 1 }); $("#cb_type_ordre").removeAttr("disabled"); $("#cb_type_ordre").css({ opacity: 1 }); $("#lb_qte_minimale").removeAttr("disabled"); $("#lb_qte_minimale").css({ opacity: 1 }); change_titre(); } //pas de titres surtout dans le cas de souscription else { $("#cb_titre").attr("disabled", "disabled"); $("#cb_titre").css({ opacity: 0.4 }); $("#lb_validite").attr("disabled", "disabled"); $("#lb_validite").css({ opacity: 0.4 }); $("#lb_qte").attr("disabled", "disabled"); $("#lb_qte").css({ opacity: 0.4 }); $("#lb_cours").attr("disabled", "disabled"); $("#lb_cours").css({ opacity: 0.4 }); $("#cb_type_ordre").attr("disabled", "disabled"); $("#cb_type_ordre").css({ opacity: 0.4 }); $("#lb_qte_minimale").attr("disabled", "disabled"); $("#lb_qte_minimale").css({ opacity: 0.4 }); $("#cb_titre").val(""); console.log("vider validité ligne 1147"); $("#lb_qte").val(""); document.getElementById("lb_cours").value = ""; $("#Sicav_Achat").hide(); $("#Position_Vente").hide(); } } } var codeTitreObl = ''; function change_titre() { var exist = false; if (nom_titre == "") { } else { if (var_Type_Ord == 2 && Array_Titre_Vente.length > 0) { var i = 0; while (i < Array_Titre_Vente.length && exist == false) { if (nom_titre == Array_Titre_Vente[i][0]) { exist = true; } else { exist = false; } i++; } pos = getPositionTitreByNomC(nomCSelectedTitre); if (pos > -1) { $("#cb_type_titre").val(type_ordre_resum_portf); $("#cb_titre")[0].selectedIndex = pos; $("#lb_cours").val(cours_resum_portf); nom_titre = ""; } else { if (pos == -1) { alertify.alert("Vous ne pouvez pas passer des ordres sur ce titre!"); bt_valider_annuler_ON(); } } } else { $("#cb_type_titre").val(type_ordre_resum_portf); pos = getPositionTitreByNomC(nomCSelectedTitre); if (pos == -1) { alertify.alert("Vous ne pouvez pas passer des ordres sur ce titre!"); bt_valider_annuler_ON(); } $("#cb_titre")[0].selectedIndex = pos; $("#lb_cours").val(cours_resum_portf); nom_titre = ""; } } if (var_Type_Ord == 1) { if (Array_Titre.length != 0) { if ($("#cb_type_titre option:selected").text() != "Obligations") { for (var i = 0; i < Array_Titre.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre[i][0]) { if (origineOrdre == 1 || origineOrdre == 2 || origineOrdre == 3) { $("#lb_cours").val(format(cours_initial, 0, " ")); } else { cours_initial = format(Array_Titre[i][2], 2, " "); document.getElementById("lb_cours").value = Array_Titre[i][2]; } } } } else { $("#lb_qte").val(""); $("#lb_cours").val(""); $("#prixPrcObl").val(""); $("#lb_montant").text(""); for (var i = 0; i < Array_Titre.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre[i].nomL) { $("#valeurFaciale").text(format(Array_Titre[i].valeurFaciale, ".", " ")); $("#intUnitObl").text(format(Array_Titre[i].interet, ".", " ")); var dt = formDt2(dateformat(Array_Titre[i].dateNextCoupon)).retrancherDate(-1) var maxDateObl = dt.getDate() + '/' + (dt.getMonth() + 1) + '/' + (dt.getFullYear()); $("#lb_validite").datepicker('option', 'maxDate', maxDateObl); $("#lb_validite").datepicker('option', 'minDate', 0); $("#lb_validite").val(new Date().ddmmyyyy()); if (Array_Titre[i].prix != 0 && Array_Titre[0].prix != undefined) { prixObl = Array_Titre[i].prix; } else { prixObl = Array_Titre[i].valeurFaciale; } prixOblPrc = (Number(prixObl) / Number($("#valeurFaciale").text().replace(/\ /g, ""))) * 100; if (prixOblPrc >= 107.5 || prixOblPrc <= 92.5) { prixObl = Array_Titre[i].valeurFaciale; } if ($("#cb_type_ordre").val() == "Cours limité") { $("#lb_cours").val("0"); $("#prixPrcObl").val("0.0000"); } else { $("#lb_cours").val(prixObl); $("#prixPrcObl").val((Number(prixObl) / Number($("#valeurFaciale").text().replace(/\ /g, ""))) * 100); } datePrevCouponObl = Array_Titre[i].datePreviousCoupon; dateNextCouponObl = Array_Titre[i].dateNextCoupon; montantCouponObl = Array_Titre[i].interet; codeTitreObl = Array_Titre[i].codeTitre; calculInteretsObl(); } } } } $("#cb_type_ordre").val("Cours limité"); if ($("#cb_type_titre option:selected").text() != "Obligations") { $("#lb_validite").val(date_validitee); } $("#lb_qte").val(""); change_type_ordre(); appel_cotation(); } if (var_Type_Ord == 2) { if (Array_Titre_Vente.length != 0) { //alert("changeTitre Vente") if ($("#cb_type_titre option:selected").text() != "Obligations") { for (var i = 0; i < Array_Titre_Vente.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre_Vente[i][0]) { qte_disponible_vente = Number(Array_Titre_Vente[i][3]); cours_initial = Number(Array_Titre_Vente[i][2]); } } $("#lb_cours").val(format(cours_initial, 0, " ")); } else { $("#lb_qte").val(""); $("#lb_cours").val(""); $("#prixPrcObl").val(""); $("#lb_montant").text(""); for (var i = 0; i < Array_Titre_Vente.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre_Vente[i].nomL) { $("#valeurFaciale").text(format(Array_Titre_Vente[i].valeurFaciale, ".", " ")); $("#intUnitObl").text(format(Array_Titre_Vente[i].interet, ".", " ")); var dt = formDt2(dateformat(Array_Titre_Vente[i].dateNextCoupon)).retrancherDate(-1) var maxDateObl = dt.getDate() + '/' + (dt.getMonth() + 1) + '/' + (dt.getFullYear()); $("#lb_validite").datepicker('option', 'maxDate', maxDateObl); if (Array_Titre_Vente[i].prix != 0) { prixObl = Array_Titre_Vente[i].prix; } else { prixObl = Array_Titre_Vente[i].valeurFaciale; } prixOblPrc = (Number(prixObl) / Number($("#valeurFaciale").text().replace(/\ /g, ""))) * 100; if (prixOblPrc >= 107.5 || prixOblPrc <= 92.5) { prixObl = Array_Titre_Vente[i].valeurFaciale; } if ($("#cb_type_ordre").val() == "Cours limité") { $("#lb_cours").val("0"); $("#prixPrcObl").val("0.0000"); } else { $("#lb_cours").val(prixObl); $("#prixPrcObl").val((Number(prixObl) / Number($("#valeurFaciale").text().replace(/\ /g, ""))) * 100); } datePrevCouponObl = Array_Titre_Vente[i].datePreviousCoupon; dateNextCouponObl = Array_Titre_Vente[i].dateNextCoupon; montantCouponObl = Array_Titre_Vente[i].interet; qteDisponibleObl = Array_Titre_Vente[i].qteDisponible; codeTitreObl = Array_Titre_Vente[i].codeTitre; calculInteretsObl(); } } } } $("#lb_qte").val(""); $("#lb_validite").val(date_validitee); $("#Position_Vente").show; } if (var_Type_Ord == 3) { Date.isLeapYear = function (year) { return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)); }; Date.getDaysInMonth = function (year, month) { return [31, (Date.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; }; Date.prototype.isLeapYear = function () { return Date.isLeapYear(this.getFullYear()); }; Date.prototype.getDaysInMonth = function () { return Date.getDaysInMonth(this.getFullYear(), this.getMonth()); }; Date.prototype.addMonths = function (value) { var n = this.getDate(); this.setDate(1); this.setMonth(this.getMonth() + value); this.setDate(Math.min(n, this.getDaysInMonth())); return this; }; if (Array_Titre_Sousc.length != 0) { for (var i = 0; i < Array_Titre_Sousc.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre_Sousc[i][0]) { if (origineOrdre == 1 || origineOrdre == 2 || origineOrdre == 3) { document.getElementById("lb_cours").value = cours_initial; } else { cours_initial = format(Array_Titre_Sousc[i][2], 2, " "); document.getElementById("lb_cours").value = Array_Titre_Sousc[i][2]; } var d = new Date(String(Array_Titre_Sousc[i][3]).substr(0, 10)) var DD = d.addMonths(+1); var month = DD.getMonth() + 1; var day = d.getDate(); var t = (day < 10 ? '0' + day : '' + day) + '/' + (month < 10 ? '0' + month : '' + month) + '/' + d.getFullYear() $("#lb_validite").val(t); if (Array_Titre_Sousc[i][4].trim() != "") { Qte_cr = Array_Titre_Sousc[i][5]; Qte_db = Array_Titre_Sousc[i][6]; code_Ds = Array_Titre_Sousc[i][4]; $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/qte_PORTEFEUILLE", data: { codetitre: (Array_Titre_Sousc[i][1]).trim() }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { typeofDevice == 'mobile' ? onSuccess_qte_portefeuilleM(data) : OnSuccess_qte_portefeuille(data1); }, error: OnError }); } else { document.getElementById("stock_ds").innerHTML = ""; document.getElementById("nb_ds").innerHTML = $('#Div_souscription').hide(); } } } } $("#cb_type_ordre").val("Cours limité"); $("#lb_qte").val(""); change_type_ordre(); } change_quantite(); calcul_montant(); calcul_sicav(); if ($("#cb_type_titre option:selected").text() == "Obligations") { if (var_Type_Ord == 2) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : " + qteDisponibleObl; document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + "0"; } } } var Qte_cr, Qte_db, Qte_utc, Qte_sk, QteDispD, Qte_sous, code_Ds; function OnSuccess_qte_portefeuille(data1) { var result = data1.responseJSON; var result_obj = $.parseJSON(result); var resp_leng = result_obj.qte_portefeuille.length; if (resp_leng != 0) { Qte_sous = Number($("#lb_qte").val()); Qte_sk = result_obj.qte_portefeuille[0].qte; document.getElementById("stock_ds").innerHTML = "Stock DS : " + Qte_sk; QteDispD = Number(Qte_sk); var Q = (QteDispD - Qte_sous) / (Number(Qte_cr) * Number(Qte_db)); var qte_final = QteDispD - Q; document.getElementById("nb_ds").innerHTML = "Nb DS Total/Nb DS Restants : " + String(QteDispD) + "/" + String(QteDispD); $('#Div_souscription').show(); } } var prixOblPrc; function change_type_ordre() { if ($("#cb_type_ordre").val() == "Meilleure limite" || $("#cb_type_ordre").val() == "Marché") { $("#rowBloc").hide(); $('#checkbloc').prop('checked', false); $("#row3").hide(); $("#lb_qte_minimale").val("0"); $("#lb_cours").val(Number(cours_initial.toString().split(" ").join(""))); var dateValiditeMarche = ""; var now = new Date(); var h = now.getHours(); var m = now.getMinutes(); if (etat_marche != 3) { dateValiditeMarche = new Date(); } else { if (h >= 14) { dateValiditeMarche = new Date().addDays(1); } else if (h >= 00) { dateValiditeMarche = new Date(); } } if (dateValiditeMarche.getDay() == 6) { dateValiditeMarche = dateValiditeMarche.addDays(2); } else if (dateValiditeMarche.getDay() == 0) { dateValiditeMarche = dateValiditeMarche.addDays(1); } $("#lb_validite").datepicker("option", "disabled", true); $("#lb_validite").val(dateValiditeMarche.ddmmyyyy()); } else { if (cours_initial != undefined) { $("#lb_cours").val(Number(cours_initial.toString().split(" ").join(""))); } $('#checkbloc').prop('checked', false); $("#rowBloc").show(); $("#row3").show(); $("#lb_validite").datepicker("option", "disabled", false); } if (type_ord == 3) { $("#rowBloc").hide(); $('#checkbloc').prop('checked', false); $("#lb_cours").attr("disabled", "disabled"); $("#lb_cours").css({ opacity: 0.4 }); $("#lb_validite").attr("disabled", "disabled"); $("#lb_validite").css({ opacity: 0.4 }); } else { if ($("#cb_type_ordre").val() == "Meilleure limite" || $("#cb_type_ordre").val() == "Marché") { $("#lb_qte_minimale").attr("disabled", "disabled"); $("#lb_qte_minimale").css({ opacity: 0.4 }); $("#lb_cours").attr("disabled", "disabled"); $("#lb_cours").css({ opacity: 0.4 }); $("#lb_qte_minimale").val("0"); appel_cotation(); } else { $("#lb_qte_minimale").removeAttr("disabled"); $("#lb_qte_minimale").css({ opacity: 1 }); $("#lb_cours").removeAttr("disabled"); $("#lb_cours").css({ opacity: 1 }); } } if (actionOrder == "modif" && ($("#cb_type_ordre").val() == "Marché" || $("#cb_type_ordre").val() == "Meilleure limite") && $("#cb_type_titre option:selected").text() != "Obligations") { $("#lb_cours").val(format(cours_initial, 0, " ")); } else if (actionOrder == "modif" && ($("#cb_type_ordre").val() == "Cours limité")) { if (coursModif == 0) { $("#lb_cours").val(format(cours_initial, 0, " ")); } else { $("#lb_cours").val(format(coursModif, 0, " ")); } } if (type_ord == 2) { change_quantite(); } calcul_sicav(); if ($("#cb_type_titre option:selected").text() != "Obligations") { calcul_montant(); } else { if (actionOrder == "ajout") { if ($("#cb_type_ordre").val() == "Marché" || $("#cb_type_ordre").val() == "Meilleure limite") { $("#prixPrcObl").attr("disabled", "disabled"); $("#prixPrcObl").css({ opacity: 0.4 }); $("#lb_cours").attr("disabled", "disabled"); $("#lb_cours").css({ opacity: 0.4 }); $("#lb_cours").val(prixObl); prixOblPrc = (Number(prixObl) / Number($("#valeurFaciale").text().replace(/\ /g, ""))) * 100; $("#prixPrcObl").val((Number(prixObl) / Number($("#valeurFaciale").text().replace(/\ /g, ""))) * 100); } else { $("#prixPrcObl").removeAttr("disabled", "disabled"); $("#prixPrcObl").css({ opacity: 1 }); $("#lb_cours").val("0"); $("#prixPrcObl").val("0.0000"); } } if (actionOrder == "modif") { if ($("#cb_type_ordre").val() == "Marché" || $("#cb_type_ordre").val() == "Meilleure limite") { $("#prixPrcObl").attr("disabled", "disabled"); $("#prixPrcObl").css({ opacity: 0.4 }); $("#lb_cours").attr("disabled", "disabled"); $("#lb_cours").css({ opacity: 0.4 }); } else { $("#prixPrcObl").removeAttr("disabled", "disabled"); $("#prixPrcObl").css({ opacity: 1 }); } } calculMontantObl(); } } function change_quantite_modif() { if (actionOrder == "modif" && $("#lb_qte_executee").text().trim() != "0") { if (Number($("#lb_qte").val()) < Number(qteModif)) { $("#lb_qte").val(qteModif); } } change_quantite(); } var Qte_Res; var QteResVente; function change_quantite() { if ($("#cb_type_titre option:selected").text() != "Obligations") { if (actionOrder == "modif" && ($("#cb_type_ordre").val() == "Marché" || $("#cb_type_ordre").val() == "Meilleure limite")) { if (var_Type_Ord == 1) { for (var i = 0; i < Array_Titre.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre[i][0]) { cours_initial = Number(Array_Titre[i][2]); } } } if (var_Type_Ord == 2) { if (Array_Titre_Vente.length != 0) { for (var i = 0; i < Array_Titre_Vente.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre_Vente[i][0]) { qte_disponible_vente = Number(Array_Titre_Vente[i][3]); cours_initial = Number(Array_Titre_Vente[i][2]); } } } } if (actionOrder == "modif" && $("#cb_type_ordre").val() == "Marché") { $("#lb_cours").val(format(cours_initial, 0, " ")); } if (actionOrder == "modif" && $("#cb_type_ordre").val() == "Meilleure limite") { $("#lb_cours").val(format(cours_initial, 0, " ")); } } if (var_Type_Ord == 1) { calcul_sicav(); calcul_montant(); } else if (var_Type_Ord == 3) { if (code_Ds != "" && code_Ds != undefined) { Qte_sous = parseInt($("#lb_qte").val()); Qte_utc = parseInt((Qte_sous * Qte_db) / Qte_cr); Qte_Res = Number(Qte_sk) - Number(Qte_utc); document.getElementById("nb_ds").innerHTML = "Nb DS Total/Nb DS Restants : " + String(Qte_sk) + "/" + String(Qte_Res); if (Qte_Res < 0) { $("#nb_ds").css("color", "red"); } else { $("#nb_ds").css("color", "black"); } } calcul_sicav(); calcul_montant(); } else if (var_Type_Ord == 2) { if (Cli_Non_Depositaire == true) { if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = format(String(Math.round((Number($("#lb_qte").val()) * Number($("#lb_cours").val()) * 0.99 * 100) / 100)), 0, " "); } } else { if ($("#lb_qte").val() != "" && $("#lb_cours").val() != "") { if (Number($("#lb_qte").val()) > qte_disponible_vente) { if (actionOrder == "ajout") { $("#lb_qte").val(qte_disponible_vente); } else if (actionOrder == "modif") { if (Number($("#lb_qte").val()) >= qteDisponibleVenteModif) { $("#lb_qte").val(qteDisponibleVenteModif); console.log("lb_qte 1736" + $("#lb_qte").val()) } } if (actionOrder != "modif") { if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : " + qte_disponible_vente; } if ($("#lb_qte_rest_vente").length > 0) { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + "0"; QteResVente = 0; } } if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = format(String(Math.round((Number($("#lb_qte").val()) * Number($("#lb_cours").val()) * 0.99 * 100) / 100)), 0, " "); } } else { if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = format(String(Math.round((Number($("#lb_qte").val()) * Number($("#lb_cours").val()) * 0.99 * 100) / 100)), 0, " "); } if (actionOrder != "modif") { if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : " + qte_disponible_vente; } } if ($("#lb_qte_rest_vente").length > 0) { if ((actionOrder == "ajout") || ((actionOrder == "modif") && qteModif != $("#lb_qte").val())) { if (actionOrder == "ajout") { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + (Number(qte_disponible_vente) - Number($("#lb_qte").val())); } else if (actionOrder == "modif") { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + (Number(qteDisponibleVenteModif) - Number($("#lb_qte").val())); } } else { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + qte_disponible_vente; } QteResVente = Number(qte_disponible_vente) - Number($("#lb_qte").val()); } } } else { if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = "0"; } if (actionOrder != "modif") { if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : " + qte_disponible_vente; } } if ($("#lb_qte_rest_vente").length > 0) { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + qte_disponible_vente; QteResVente = qte_disponible_vente; } } } } if ($("#lb_qte_minimale").val() != "0") { change_quantite_minimale(); } if (actionOrder == "modif") { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + (Number(qteDisponibleVenteModif) - Number($("#lb_qte").val())); } } else { if (var_Type_Ord == 2) { if (Number($("#lb_qte").val()) > qteDisponibleObl) { $("#lb_qte").val(qteDisponibleObl); if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : " + qteDisponibleObl; } if ($("#lb_qte_rest_vente").length > 0) { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + "0"; } } else { if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : " + qteDisponibleObl; } if ($("#lb_qte_rest_vente").length > 0) { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + (Number(qteDisponibleObl) - Number($("#lb_qte").val())); } } } if ($("#lb_qte").val() != "" && $("#lb_cours").val() != "") { calculMontantObl(); } } } function verif_parite_sous() { if (code_Ds != "" && code_Ds != undefined) { Qte_sous = parseInt($("#lb_qte").val()); if (Qte_sous % Qte_cr != 0) { $("#lb_qte").val(Qte_sous - (Qte_sous % Qte_cr)); change_quantite(); } } } function change_quantite_devoilee() { if (Number($("#lb_qte_devoilee").val()) >= Number($("#lb_qte").val())) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité Dévoilée doit être < Quantité de l'ordre !", function () { bt_valider_annuler_ON(); }); $("#lb_qte_devoilee").val("0"); } if (Number($("#lb_qte_devoilee").val()) < 10 && Number($("#lb_qte").val()) != 0) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité dévoilée doit être >= 10 !", function () { bt_valider_annuler_ON(); }); $("#lb_qte_devoilee").val("0"); } } function change_quantite_minimale() { if (Number($("#lb_qte_minimale").val()) >= Number($("#lb_qte").val())) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité Minimale doit être < Quantité de l'ordre !", function () { bt_valider_annuler_ON(); }); $("#lb_qte_minimale").val("0"); } } /***************************************** Fonctions se rattachant à l'ajout d'ordre ****************************************************************/ var total_lq_sicav = 0; var disp = 0; var Array_Sicav = []; var etat_marche = ""; var taux = ""; var variation = ""; var max_variation = ""; var date_validitee = ""; var code_titre_array = ""; var nouv_taux_cota = ""; var chaine_blocage = ""; //calcul de la variation lors du changement de la valeurs du cours function calcul_variation_max() { if ($("#cb_type_titre").val() == "Droits d'attributions" || $("#cb_type_titre").val() == "Droits d`attributions" || $("#cb_type_titre").val() == "Droits de souscriptions") { pre_control_valid(); } else { var variation_saisie = Math.abs(1 - (Number($("#lb_cours").val().replace(/\s/g, "")) - Number(cours_initial.toString().replace(/\s/g, "")))) if ($("#lb_validite").val() == date_validitee) { variation_limite = max_variation; if (nouv_taux_cota != 0) { variation_limite = nouv_taux_cota; } } if (fromddmmyyyyToDate($("#lb_validite").val()) > fromddmmyyyyToDate(date_validitee)) { variation_limite = variation; if (nouv_taux_cota != 0) { variation_limite = nouv_taux_cota; } } if (variation_saisie > variation_limite) { if (actionOrder != "modif" && $("#cb_type_ordre").val() != "Marché") { if (Number($("#lb_cours").val().replace(/\s/g, "")) < (Number(cours_initial.toString().replace(/\s/g, "")) * (1 - variation_limite))) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Le cours est inférieur à " + format((Number(cours_initial.toString().replace(/\s/g, "")) * (1 - variation_limite)), 2, " ") + " ! Il ne peut varier que de +- " + format(String(Number(variation_limite) * 100), 2, " ") + "%", function () { pre_control_valid(); }); } else if (Number($("#lb_cours").val().replace(/\s/g, "")) > (Number(cours_initial.toString().replace(/\s/g, "")) * (1 + variation_limite))) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Le cours est superieur à " + format((Number(cours_initial.toString().replace(/\s/g, "")) * (1 + variation_limite)), 2, " ") + " ! Il ne peut varier que de +- " + format(String(Number(variation_limite) * 100), 2, " ") + "%", function () { pre_control_valid(); }); if ((actionOrder == "modif" && $("#cb_type_ordre").val() == "Marché")) { $("#lb_cours").val(format(cours_initial.toString().split(" ").join(""), 0, " ")); } } else { pre_control_valid(); } } else { if ((actionOrder == "modif" && $("#cb_type_ordre").val() == "Marché") || actionOrder == "ajout") { $("#lb_cours").val(format(cours_initial.toString().split(" ").join(""), 0, " ")); } pre_control_valid(); } } else { pre_control_valid(); } } calcul_montant(); } function calcul_validite(Date1, Date2) { startDate = formDt2(Date1); endDate = formDt2(Date2); var millisecondsPerDay = 86400 * 1000; startDate.setHours(0, 0, 0, 1); endDate.setHours(23, 59, 59, 999); var diff = endDate - startDate; var days = Math.ceil(diff / millisecondsPerDay); var weeks = Math.floor(days / 7); days = days - (weeks * 2); var startDay = startDate.getDay(); var endDay = endDate.getDay(); if (startDay - endDay > 1) days = days - 2; if (startDay === 0 && endDay != 6) days = days - 1; if (endDay === 6 && startDay !== 0) days = days - 1; number_day_valid = days; if (Number(number_day_valid) < 0) { alertify.set({ buttonFocus: "ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Date erronée...", function () { bt_valider_annuler_ON(); }); $("#lb_validite").val(date_validitee); } else if (Number(number_day_valid) == 0) { if (mktState == "O") { } else { alertify.set({ buttonFocus: "ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Date erronée...", function () { bt_valider_annuler_ON(); }); $("#lb_validite").val(date_validitee); } } calcul_sicav(); calcul_montant(); } //calcul du montant de l'ordre function calcul_montant() { if (var_Type_Ord == 1 || var_Type_Ord == 3) { if ($("#cb_type_ordre").val() == "Cours limité") { if (Number($("#lb_qte").val()) != 0 && $("#lb_cours").val() != "") { if ($("#lb_montant").length > 0) { if (var_Type_Ord == 1) { document.getElementById("lb_montant").innerHTML = format(Math.round((String(Number($("#lb_qte").val()) * Number($("#lb_cours").val().replace(/\ /g, "")) * (1.00 + Number(Cli_FRAIS))) * 100) / 100), 0, " "); } else { document.getElementById("lb_montant").innerHTML = format(Math.round((String(Number($("#lb_qte").val()) * Number($("#lb_cours").val().replace(/\ /g, "")) * 1.00) * 100) / 100), 0, " "); } } } else { if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = "0"; } } } else { for (var i = 0; i < Array_Titre.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre[i][0]) { code_titre_array = Array_Titre[i][1]; } } Array_final = []; dt = date_validitee; var dt1 = $("#lb_validite").val(); var da1 = new Date(dt.substring(3, 5) + '-' + dt.substring(0, 2) + '-' + dt.substring(6, 10)); var dalim1 = new Date(dt1.substring(3, 5) + '-' + dt1.substring(0, 2) + '-' + dt1.substring(6, 10)); while (da1 <= dalim1) { if (da1.getDay() == 0 || da1.getDay() == 6) { da1 = DateAdd("d", 1, da1); } else { f = 0; for (var i = 0; i < Array_Cotation.length; i++) { da2 = new Date(Array_Cotation[i][1].substring(3, 5) + '-' + Array_Cotation[i][1].substring(0, 2) + '-' + Array_Cotation[i][1].substring(6, 10)); if (da1.toLocaleString("fr-FR") == da2.toLocaleString("fr-FR") && code_titre_array.trim() == Array_Cotation[i][0].trim()) { t = Array_Cotation[i][2]; f = 1; } } if (f == 0) { t = taux; } Array_final.push([code_titre_array.trim(), da1, t]); da1 = DateAdd("d", 1, da1); }; } var total_taux = 1; if ($("#lb_montant").length > 0) { if (var_Type_Ord == 1) { document.getElementById("lb_montant").innerHTML = format(Math.round((((total_taux) * Number($("#lb_qte").val()) * Number($("#lb_cours").val().replace(/\ /g, "")) * (1.00 + Number(Cli_FRAIS))) * 100) / 100), 0, " "); } else { document.getElementById("lb_montant").innerHTML = format(Math.round((((total_taux) * Number($("#lb_qte").val()) * Number($("#lb_cours").val().replace(/\ /g, "")) * 1.00) * 100) / 100), 0, " "); } } } if (var_Type_Ord == 3) { if (Array_Titre_Sousc != undefined) { for (var i = 0; i < Array_Titre_Sousc.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre_Sousc[i][0]) { code_titre_array = Array_Titre_Sousc[i][1]; } } } } $("#Position_Vente").hide(); $("#Sicav_Achat").show(); } else if (var_Type_Ord == 2) { if (Cli_Non_Depositaire == true) { if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = format(String(Math.round((Number($("#lb_qte").val()) * Number($("#lb_cours").val().replace(/\ /g, "")) * 0.99 * 100) / 100)), 0, " "); } } else { if ($("#lb_qte").val() != "" && $("#lb_cours").val() != "" && actionOrder == "ajout") { if (Number($("#lb_qte").val()) > qte_disponible_vente) { $("#lb_qte").val(qte_disponible_vente); if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = "0"; } if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : " + qte_disponible_vente; } if ($("#lb_qte_rest_vente").length > 0) { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + "0"; } } else { if ($("#lb_montant").length > 0) { if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = format(Math.round((String(Number($("#lb_qte").val()) * Number($("#lb_cours").val().replace(/\ /g, "")) * 0.99) * 100) / 100), 0, " "); } if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : " + qte_disponible_vente; } if ((actionOrder == "ajout") || ((actionOrder == "modif") && qteModif != $("#lb_qte").val())) { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + (Number(qte_disponible_vente) - Number($("#lb_qte").val())); } else { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + qte_disponible_vente; } } } } else { if (actionOrder == "modif") { if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = "0"; } if ($("#lb_qte_dispo_vente").length > 0) { document.getElementById("lb_qte_dispo_vente").innerHTML = "Quantité disponible : " + qteDisponibleVenteModif; } if ($("#lb_qte_rest_vente").length > 0) { document.getElementById("lb_qte_rest_vente").innerHTML = "Quantité restante : " + (Number(qteDisponibleVenteModif) - Number($("#lb_qte").val())); } } if ($("#lb_montant").length > 0) { document.getElementById("lb_montant").innerHTML = format(Math.round((String(Number($("#lb_qte").val()) * Number($("#lb_cours").val().replace(/\ /g, "")) * 0.99) * 100) / 100), 0, " "); } } } if (document.getElementById("lb_qte_dispo_vente").innerHTML != "undefined") { $("#Sicav_Achat").hide(); $("#Position_Vente").show(); } else { $("#Sicav_Achat").hide(); $("#Position_Vente").hide(); } } calcul_sicav(); montantNouveauModif = $("#lb_montant").text().replace(/\s/g, ""); } function calcul_sicav() { $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/SICAV_LISTE", crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { typeofDevice == 'mobile' ? onSuccessSicavM(data) : OnSuccess_SICAV_LISTE(data1); }, error: OnError }); } function OnSuccess_SICAV_LISTE(data1) { var result = data1.responseJSON; var result_obj = $.parseJSON(result); var liq_neg = 0; var mnt_bloc = 0; var str_mnt_bloc = ""; if (result_obj.sicav_liste != undefined) { var resp_leng = result_obj.sicav_liste.length; total_lq_sicav = 0; if (resp_leng != 0) { Array_Sicav = []; for (var i = 0; i < resp_leng; i++) { if (i == 0) { if (Number(result_obj.sicav_liste[i].qte) == 0) { liq_neg = 0; total_lq_sicav = total_lq_sicav + Number("0.000"); Array_Sicav.push([result_obj.sicav_liste[i].Nom_Titre, result_obj.sicav_liste[i].Val_Sicav, "0.000", result_obj.sicav_liste[i].Code]); } else if (Number(result_obj.sicav_liste[i].qte) < 0) { liq_neg = -Number(result_obj.sicav_liste[i].qte); total_lq_sicav = total_lq_sicav + Number(result_obj.sicav_liste[i].qte); Array_Sicav.push([result_obj.sicav_liste[i].Nom_Titre, result_obj.sicav_liste[i].Val_Sicav, result_obj.sicav_liste[i].qte, result_obj.sicav_liste[i].Code]); } else { //dans le cas d'achat si c'est un FCP on ne le prend pas en compte pour le total du montant disponible if ((type_ord == 1 && (result_obj.sicav_liste[i].Code).trim() == "XX000001133") || (type_ord == 1 && (result_obj.sicav_liste[i].Code).trim() == "XX000001398")) { } else { liq_neg = 0; total_lq_sicav = total_lq_sicav + Number(result_obj.sicav_liste[i].qte); Array_Sicav.push([result_obj.sicav_liste[i].Nom_Titre, result_obj.sicav_liste[i].Val_Sicav, result_obj.sicav_liste[i].qte, result_obj.sicav_liste[i].Code]); } } } else { if ((type_ord == 1 && (result_obj.sicav_liste[i].Code).trim() == "XX000001133") || (type_ord == 1 && (result_obj.sicav_liste[i].Code).trim() == "XX000001398")) { } else { total_lq_sicav = total_lq_sicav + Number(Number(result_obj.sicav_liste[i].qte) * Number(result_obj.sicav_liste[i].Val_Sicav)); Array_Sicav.push([result_obj.sicav_liste[i].Nom_Titre, result_obj.sicav_liste[i].Val_Sicav, result_obj.sicav_liste[i].qte, result_obj.sicav_liste[i].Code]); } } } } } if (actionOrder == "ajout") { if ($("#lb_montant").length >= 0) { disp = Number(total_lq_sicav) - Number((document.getElementById("lb_montant").innerHTML).replace(/ /g, "")); } if (disp > 0) { if ($("#montant_disp_sicav").length >= 0) { document.getElementById("montant_disp_sicav").innerHTML = "Montant disponible (SICAV et Liquiditées) : " + format(Number(disp), 3, " "); $("#montant_disp_sicav").css("color", "green"); } } else { if ($("#montant_disp_sicav").length >= 0) { document.getElementById("montant_disp_sicav").innerHTML = "Solde insuffisant" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " : " + format(Number(disp), 3, " "); $("#montant_disp_sicav").css("color", "red"); } } if ($("#montant_reserv_sicav").length >= 0) { document.getElementById("montant_reserv_sicav").innerHTML = "Montant à réserver" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " : " + format(Number((document.getElementById("lb_montant").innerHTML).replace(/ /g, "")), 3, " "); $("#montant_reserv_sicav").css("color", "black"); } if ($("#lb_montant").length > 0) { mnt_bloc = liq_neg + Number(document.getElementById("lb_montant").innerHTML.replace(/\ /g, "")); str_mnt_bloc = mnt_bloc.toString().replace(/\ /g, ""); CALC_BLOCAGE_ORDER(document.getElementById("lb_montant").innerHTML == undefined ? "0" : str_mnt_bloc); } } else if (actionOrder == "modif") { console.log("Modif"); diffMontantsModif = Number(montantNouveauModif) - Number(montantAncienModif); if ($("#lb_montant").length >= 0) { disp = Number(total_lq_sicav) - diffMontantsModif; } if (disp > 0) { if ($("#montant_disp_sicav").length >= 0) { document.getElementById("montant_disp_sicav").innerHTML = "Montant disponible (SICAV et Liquiditées) : " + format(Number(disp), 3, " "); $("#montant_disp_sicav").css("color", "green"); } } else { if ($("#montant_disp_sicav").length >= 0) { document.getElementById("montant_disp_sicav").innerHTML = "Solde insuffisant" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " : " + format(Number(disp), 3, " "); $("#montant_disp_sicav").css("color", "red"); } } if ($("#montant_reserv_sicav").length >= 0) { document.getElementById("montant_reserv_sicav").innerHTML = "Montant à réserver" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " : " + format(Number((document.getElementById("lb_montant").innerHTML).replace(/ /g, "")), 3, " "); $("#montant_reserv_sicav").css("color", "black"); } } } function CALC_BLOCAGE_ORDER(mnt) { var j = 1; if (Number(Array_Sicav[0][2]) < 0) { Array_Sicav[0][2] = "0"; } var rest = Number(mnt) - Number(Array_Sicav[0][2]); if (Number(mnt) <= Number(Array_Sicav[0][2])) { chaine_blocage = Array_Sicav[0][3].trim() + "," + mnt.trim() + ";"; } else { if (Array_Sicav[0][3].trim() == 'LQ0000000000' && Number(Array_Sicav[0][2]) == 0) { chaine_blocage = ""; } else { chaine_blocage = Array_Sicav[0][3].trim() + "," + Array_Sicav[0][2] + ";"; } while (j < Array_Sicav.length && Number(rest) > 0) { var i = 0; while (i < Array_Sicav[j][2] && Number(rest) > 0) { rest = rest - Array_Sicav[j][1]; i++; } chaine_blocage = chaine_blocage + Array_Sicav[j][3].trim() + "," + i + ";"; j++; } } if (code_Ds != undefined && var_Type_Ord == 3 && code_Ds != "") { chaine_blocage = chaine_blocage + code_Ds.trim() + "," + String(Qte_utc) + ";" } return chaine_blocage; } function appel_cotation() { $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/Nouvelle_COTATION", data: {}, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { typeofDevice == 'mobile' ? onSuccessAppelCotationMobile(data) : OnSuccess_Nouvelle_COTATION(data1); }, error: OnError }); } function OnSuccess_Nouvelle_COTATION(data1) { var result = data1.responseJSON; var result_obj = $.parseJSON(result); if (result_obj.GET_NOUV_COT != undefined) { var resp_leng = result_obj.GET_NOUV_COT.length; if (resp_leng != 0) { for (var i = 0; i < Array_Titre.length; i++) { if ($("#cb_titre option:selected").text() == Array_Titre[i][0]) { code_titre_array = Array_Titre[i][1]; } } var cotation_trouvee = false; var i = 0; Array_Cotation = []; for (var i = 0; i < (Number(resp_leng) - 1) ; i++) { Array_Cotation.push([result_obj.GET_NOUV_COT[i].Code_Titre.replace(" ", ""), dateformat(result_obj.GET_NOUV_COT[i].Date_Cot), result_obj.GET_NOUV_COT[i].Taux_Cot]); } while (i < resp_leng && cotation_trouvee == false) { var d = new Date() if (code_titre_array == result_obj.GET_NOUV_COT[i].Code_Titre && dateformat(result_obj.GET_NOUV_COT[i].Date_Cot) == date_validitee) { nouv_taux_cota = result_obj.GET_NOUV_COT[i].Taux_Cot; cotation_trouvee = true; } else { nouv_taux_cota = "0"; i++; } } } } } //Appelle à la méthode qui permet de retourner l'état du marché 1:Préouverture, 2:Ouverture et 3:Fermeture/taux/variation/variation_max function appel_etat_marche(type) { $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/get_ETAT_MARCHE", data: {}, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { typeofDevice == 'mobile' ? onSuccessEtatMarcheMobile(data, type) : OnSuccess_ETAT_MARCHE(data, type); }, error: OnError }); } function OnSuccess_ETAT_MARCHE(data, type) { var result_obj = $.parseJSON(data); if (result_obj.ETATMARCHE != undefined) { if (actionOrder != "modif") { var resp_leng = result_obj.ETATMARCHE.length; if (resp_leng != 0) { etat_marche = result_obj.ETATMARCHE[0].etat; taux = result_obj.ETATMARCHE[0].taux; variation = result_obj.ETATMARCHE[0].variation; max_variation = result_obj.ETATMARCHE[0].variation_max; date_validitee = dateformat(result_obj.ETATMARCHE[0].date_validite_min); } $("#lb_validite").mask("99/99/9999"); var datenow = new Date() var year = datenow.getFullYear(); var month = datenow.getMonth() + 1; var day = datenow.getDate(); if (month <= 9) { month = "0" + month; if (month == "02") { if (day == "29") day == "28"; } } else { month = String(month); } if (day <= 9) { day = "0" + day; } else { day = String(day); } datenow = day + '/' + month + '/' + year; var parts = date_validitee.split("/"); var dt = new Date(parseInt(parts[2], 10), parseInt(parts[1], 10) - 1, parseInt(parts[0], 10)); var daynextyear = dt.getDate() + '/' + (dt.getMonth() + 1) + '/' + (dt.getFullYear() + 1); var currentdate = new Date(); var maxDatePThreeMonths = new Date((currentdate.setMonth(currentdate.getMonth() + 3))); if (date_validitee == datenow) { $("#lb_validite").datepicker({ minDate: 0, maxDate: maxDatePThreeMonths, changeMonth: true, changeYear: true, beforeShowDay: $.datepicker.noWeekends }); } else { $("#lb_validite").datepicker({ minDate: +1, maxDate: maxDatePThreeMonths, changeMonth: true, changeYear: true, beforeShowDay: $.datepicker.noWeekends }); } $("#lb_validite").blur(function () { try { $.datepicker.parseDate('dd/mm/yy', lb_validite.value); } catch (e) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Date erronée...", function () { bt_valider_annuler_ON(); }); $("#lb_validite").val(date_validitee); }; }); $("#lb_validite").datepicker("option", "showAnim", "slide"); appel_get_titre(); } else { var resp_leng = result_obj.ETATMARCHE.length; if (resp_leng != 0) { etat_marche = result_obj.ETATMARCHE[0].etat; } } } } function appel_get_titre() { if (type_ordre_resum_portf == "Droits d'attributions" && origineOrdre == 1) typeTitreSel = "Droits d'attributions"; else typeTitreSel = $("#cb_type_titre option:selected").text(); if (var_Type_Ord == 1) { $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/get_Titres", data: { type_titre: typeTitreSel }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { OnSuccesschange_type_titre(data1); }, error: OnError }); } if (var_Type_Ord == 2) { var typeTitre = ""; if ($("#cb_type_titre option:selected").text() == "Actions Cotées") { typeTitre = "actionsCotees"; } if ($("#cb_type_titre option:selected").text() == "Actions") { typeTitre = "actions"; } else if ($("#cb_type_titre option:selected").text() == "Droits d'attributions") { typeTitre = "droitsAttrib"; } else if ($("#cb_type_titre option:selected").text() == "Droits de souscriptions") { typeTitre = "droitsSousc"; } else if ($("#cb_type_titre option:selected").text() == "Obligations") { typeTitre = "Obligations"; } $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/get_Titres_VENTE", data: { type_titre: typeTitre }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { OnSuccesschange_type_titre(data1); }, error: OnError }); } if (var_Type_Ord == 3) { var param_type = ""; if ($("#cb_type_titre option:selected").text() == "Actions") { param_type = "Actions_SOUSC"; } else if ($("#cb_type_titre option:selected").text() == "Obligations") { param_type = "Obligations_SOUSC"; } $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/get_Titres", data: { type_titre: param_type }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { OnSuccesschange_type_titre(data1); }, error: OnError }); } } /****************************************************** Annuler l'ajout d'ordre ********************************************************************************/ function annuler_ord() { var msg = "Annuler l'ordre ?"; if (actionOrder == "ajout") { msg = "Annuler l'ajout de l'ordre ?"; } else if (actionOrder == "modif") { msg = "Annuler la modification de l'ordre ?"; } alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm(msg, function (e) { if (e) { $("#title_liste").removeAttr("disabled"); $("#title_liste").css({ opacity: 1 }); $("#bannuler_ord").attr("disabled", "disabled"); $("#bannuler_ord").css({ opacity: 0.4 }); $("#bvalider_ord").attr("disabled", "disabled"); $("#bvalider_ord").css({ opacity: 0.4 }); if ($("#montant_disp_sicav").length > 0) { document.getElementById("montant_disp_sicav").innerHTML = ""; } if ($("#montant_reserv_sicav").length > 0) { document.getElementById("montant_reserv_sicav").innerHTML = ""; } $("#grid_resume").pqGrid("enable"); $("#Sicav_Achat").hide(); $("#Position_Vente").hide(); $("#div_cache").show(); if (var_Type_Ord == 1) { Achat_order(); } else if (var_Type_Ord == 2) { Vente_order(); } else if (var_Type_Ord == 3) { Souscription_order(); } debloquer_boutons(); if (actionOrder == "modif") { find_order(var_Type_Ord, "0"); } else { find_order(var_Type_Ord, "2"); } actionOrder = ""; } else { } }); } /***************************************** Validation de l'ajout d'ordre **************************************************************************/ var CH = ""; var CH1 = ""; function bt_valider_annuler_ON() { $("#bannuler_ord").removeAttr("disabled"); $("#bannuler_ord").css({ opacity: 1 }); $("#bvalider_ord").removeAttr("disabled"); $("#bvalider_ord").css({ opacity: 1 }); } function bt_valider_annuler_OFF() { $("#bannuler_ord").attr("disabled", "disabled"); $("#bannuler_ord").css({ opacity: 0.4 }); $("#bvalider_ord").attr("disabled", "disabled"); $("#bvalider_ord").css({ opacity: 0.4 }); } function pre_control_valid() { if (var_Type_Ord == 1) { if (Number($("#lb_qte").val()) == 0 || $("#lb_qte").val() == "") { document.getElementById("lb_qte").focus(); alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité invalide !", function () { bt_valider_annuler_ON(); }); } else if (disp < 0 && actionOrder == "ajout") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Solde insuffisant ", function () { bt_valider_annuler_ON(); }); } else { GetSeuilBasHaut(); } } else if (var_Type_Ord == 2) { if (Cli_Non_Depositaire == true) { if (Number($("#lb_qte").val()) == 0 || $("#lb_qte").val() == "") { document.getElementById("lb_qte").focus(); alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité invalide !", function () { bt_valider_annuler_ON(); }); } else { GetSeuilBasHaut(); } } else { if (Number($("#lb_qte").val()) == 0 || $("#lb_qte").val() == "") { document.getElementById("lb_qte").focus(); alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité invalide !", function () { bt_valider_annuler_ON(); }); } else if ((Number(qte_disponible_vente) - Number($("#lb_qte").val())) < 0 && actionOrder == "ajout") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité disponible insuffisante !", function () { bt_valider_annuler_ON(); }); } else if ((Number(qteDisponibleVenteModif) - Number($("#lb_qte").val())) < 0 && actionOrder == "modif") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité disponible insuffisante !", function () { bt_valider_annuler_ON(); }); } else { GetSeuilBasHaut(); } } } else if (var_Type_Ord == 3) { if (Cli_CIN.length < 4) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("CIN Obligatoire pour les souscriptions !", function () { bt_valider_annuler_ON(); }); } else if ($("#lb_qte").val() == "") { document.getElementById("lb_qte").focus(); alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité invalide !", function () { bt_valider_annuler_ON(); }); } else if (Number($("#lb_qte").val()) == 0 || Number($("#lb_qte").val()) < 1) { document.getElementById("lb_qte").focus(); alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("La quantitée minimale doit être supérieure ou égale à 1 !", function () { bt_valider_annuler_ON(); }); } else if (disp < 0) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Solde insuffisant !", function () { bt_valider_annuler_ON(); }); } else if (code_Ds != "" && Qte_Res < 0) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité DS insuffisante !", function () { bt_valider_annuler_ON(); }); } else { if (actionOrder == "ajout") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer L'ordre ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } else if (actionOrder == "modif") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer la modification ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } } } } function getPositionTitreByNomC(NomC) { var k = -1; for (var i = 0; i < nomCTitres.length; i++) { if ($.trim(nomCTitres[i]) == NomC) { k = i; break; } } return k; } function getNamePositionAllOrder(Name) { var k = -1; for (var i = 0; i < resumData_All.length; i++) { if (resumData_All[i][0] == Name) { k = i; break; } } return k; } function GetSeuilBasHaut() { var today = new Date().ddmmyyyy(); var posTIT = getNamePositionAllOrder($.trim(nomCTitres[$("select[id='cb_titre'] option:selected").index()])) var seuilH = Number(resumData_All[posTIT][10].split(" ").join("")); var seuilB = Number(resumData_All[posTIT][9].split(" ").join("")); code_titre_array = codesTitres[$("#cb_titre")[0].selectedIndex]; var cours = Number($("#lb_cours").val().split(" ").join("")); if (etat_marche == "2") { if ($("#lb_validite").val() == today) { if ((seuilH + seuilB) != 0) { if (cours > seuilH || cours < seuilB) { alertify.set({ buttonFocus: "Ok", labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Ordre Hors Fourchette : Seuil Haut = " + format(seuilH, 3, " ") + " FCFA. Seuil Bas = " + format(seuilB, 3, " ") + " FCFA.Souhaitez-vous réserver la valeur?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } else { if (actionOrder == "ajout") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer L'ordre ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } else if (actionOrder == "modif") { console.log("lb_qte 2756 " + $("#lb_qte").val()) alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer la modification ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } } } else { if (actionOrder == "ajout") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer L'ordre ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } else if (actionOrder == "modif") { console.log("lb_qte 2683 " + $("#lb_qte").val()) alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer la modification ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } } } else { if (actionOrder == "ajout") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer L'ordre ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } else if (actionOrder == "modif") { console.log("lb_qte 2810 " + $("#lb_qte").val()) alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer la modification ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } } } else { if (actionOrder == "ajout") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer L'ordre ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } else if (actionOrder == "modif") { console.log("lb_qte 2637 " + $("#lb_qte").val()) alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer la modification ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } } } function pre_control_validObligation() { if (var_Type_Ord == 1) { if (Number($("#lb_qte").val()) == 0 || $("#lb_qte").val() == "") { document.getElementById("lb_qte").focus(); alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité invalide !", function () { bt_valider_annuler_ON(); }); } else if ($("#cb_type_ordre").val() == "Cours limité" && (Number($("#prixPrcObl").val()) == 0 || $("#prixPrcObl").val() == "")) { document.getElementById("lb_qte").focus(); alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Veuillez saisir le prix en pourcentage !", function () { bt_valider_annuler_ON(); }); } else if (disp < 0) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Solde insuffisant ", function () { bt_valider_annuler_ON(); }); } else { if (actionOrder == "ajout") { alertify.set({ buttonFocus: "Ok", labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer L'ordre ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } else if (actionOrder == "modif") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer la modification ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } } } else if (var_Type_Ord == 2) { if (Number($("#lb_qte").val()) == 0 || $("#lb_qte").val() == "") { document.getElementById("lb_qte").focus(); alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité invalide !", function () { bt_valider_annuler_ON(); }); } else if ((Number(qteDisponibleObl) - Number($("#lb_qte").val())) < 0) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Quantité disponible insuffisante !", function () { bt_valider_annuler_ON(); }); } else { if (actionOrder == "ajout") { alertify.set({ buttonFocus: "Ok", labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer L'ordre ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } else if (actionOrder == "modif") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Confirmer la modification ?", function (e) { if (e) { validerLimitesOrd(); } else { bt_valider_annuler_ON(); } }); } } } } function Valider_Ajout_order() { //Achat if (var_Type_Ord == 1) { CH = ""; CH1 = ""; if ($("#cb_type_titre").val() == "Actions Cotées" || $("#cb_type_titre").val() == "Actions non Cotées") { CH = "AA "; } else if ($("#cb_type_titre").val() == "Droits d'attributions" || $("#cb_type_titre").val() == "Droits d`attributions") { CH = "AAA "; } else if ($("#cb_type_titre").val() == "Droits de souscriptions") { CH = "AAS "; } else if ($("#cb_type_titre").val() == "Obligations") { CH = "OA "; } if ($("#cb_type_ordre").val() == "Meilleure limite" || $("#cb_type_ordre").val() == "Marché") { CH1 = "0"; } else { CH1 = $("#lb_cours").val(); } call_ajout_order(); } else if (var_Type_Ord == 2) { if (Number(document.getElementById("lb_montant").innerHTML) < 0.89) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Le présent ordre de vente occasionne un décaissement ! Veuillez contacter votre chargé de compte.", function () { bt_valider_annuler_ON(); }); } else { CH = ""; CH1 = ""; if ($("#cb_type_titre").val() == "Actions Cotées" || $("#cb_type_titre").val() == "Actions non Cotées") { CH = "AV "; } else if ($("#cb_type_titre").val() == "Droits d'attributions" || $("#cb_type_titre").val() == "Droits d`attributions") { CH = "AVA "; } else if ($("#cb_type_titre").val() == "Droits de souscriptions") { CH = "AVS "; } else if ($("#cb_type_titre").val() == "Obligations") { CH = "OV "; } if ($("#cb_type_ordre").val() == "Meilleure limite" || $("#cb_type_ordre").val() == "Marché") { CH1 = "0"; } else { CH1 = $("#lb_cours").val(); } call_ajout_order(); } } else if (var_Type_Ord == 3) { CH = ""; CH1 = ""; if ($("#cb_type_titre").val() == "Actions") { CH = "AS "; } else { CH = "OS "; } CH1 = $("#lb_cours").val(); call_ajout_order(); } actionOrder = ""; } var codeTitreOrd; function call_ajout_order() { var ch100 = ""; if ($("#cb_type_titre option:selected").text() != "Obligations") { codeTitreOrd = code_titre_array; } else { codeTitreOrd = codeTitreObl; } if (var_Type_Ord == 1 || var_Type_Ord == 2) { if ($("#cb_type_ordre").val() == "Meilleure limite" || $("#cb_type_ordre").val() == "Cours limité") { ch100 = " "; } else { ch100 = " T"; } } if ($("#checkbloc").is(':checked')) { ch100 = ch100 + " B"; } else { } if (var_Type_Ord == 2) { $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/f_AJORDRE", data: { type: String(var_Type_Ord), ch: CH, codetitre: $.trim(codeTitreOrd), qte: $("#lb_qte").val().split(" ").join(""), Ch1: CH1.split(" ").join(""), Montant: document.getElementById("lb_montant").innerHTML.split(" ").join(""), datevalid: $("#lb_validite").val(), Ch2: chaine_blocage, PrixPrc: $("#prixPrcObl").val().replace(/\ /g, ""), donneur: ch100, qteMin: $("#lb_qte_minimale").val(), qteDev: "0", usern: "WWW" }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { OnSuccessAjoutOrder(data1); }, error: OnError }); } else { if ((document.getElementById("lb_montant").innerHTML).toString().replace(/\ /g, "") == "" || (document.getElementById("lb_montant").innerHTML).toString().replace(/\ /g, "") == undefined || (document.getElementById("lb_montant").innerHTML).toString().replace(/\ /g, "") == " " || chaine_blocage == "LQ0000000000,0;" ) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Ordre non validé, veuillez contacter votre chargé de clientèle", function () { bt_valider_annuler_ON(); }); } else { if ($("#cb_type_titre option:selected").text() != "Obligations") { codeTitreOrd = code_titre_array; } else { codeTitreOrd = codeTitreObl; } $.ajax({ async: false, cache: false, type: "GET", url: URL_SERVICE + "Service.svc/f_AJORDRE", data: { type: String(var_Type_Ord), ch: CH, codetitre: codeTitreOrd.trim(), qte: $("#lb_qte").val(), Ch1: CH1.toString().replace(/\ /g, ""), Montant: document.getElementById("lb_montant").innerHTML.toString().replace(/\ /g, ""), datevalid: $("#lb_validite").val(), Ch2: chaine_blocage, PrixPrc: $("#prixPrcObl").val().replace(/\ /g, ""), donneur: ch100, qteMin: $("#lb_qte_minimale").val(), qteDev: "0", usern: "WWW" }, crossDomain: true, dataType: "jsonp", success: function (data, errc, data1) { OnSuccessAjoutOrder(data1); }, error: OnError }); } } } function OnSuccessAjoutOrder(data1) { var result = data1.responseJSON; var result_obj = $.parseJSON(result); if (result_obj.fajordre != undefined) { var resp_leng = result_obj.fajordre.length; if (resp_leng != 0) { if (Number(result_obj.fajordre[0].num_ord) != 0) { if (var_Type_Ord == 3) { debloquer_boutons(); find_order(var_Type_Ord, "2"); } else { OnSuccessUpdate_ordre(); } } else { if (String(result_obj.fajordre[0].date_ord) == "01/01/1915") { alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Journée clôturée !", function () { bt_valider_annuler_ON(); }); } else { alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Ordre rejeté !", function () { bt_valider_annuler_ON(); }); } } } } } function OnSuccessUpdate_ordre() { $("#title_liste").removeAttr("disabled").css({ opacity: 1 }); $("#bannuler_ord").attr("disabled", "disabled").css({ opacity: 0.4 }); $("#bvalider_ord").attr("disabled", "disabled").css({ opacity: 0.4 }); debloquer_boutons(); appel_service(date_hier); find_order(var_Type_Ord, "2"); } function OnSuccessUpdate_ordre(data1) { $("#title_liste").removeAttr("disabled"); $("#title_liste").css({ opacity: 1 }); $("#bannuler_ord").attr("disabled", "disabled"); $("#bannuler_ord").css({ opacity: 0.4 }); $("#bvalider_ord").attr("disabled", "disabled"); $("#bvalider_ord").css({ opacity: 0.4 }); debloquer_boutons(); appel_service(date_hier); find_order(var_Type_Ord, "2"); } function supprimer_ord() { Sup_num_oper = document.getElementById("lb_num_ordre").innerHTML; Sup_type_ord = type_ord; if (ordre_ANNUL == true) { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Ordre déja annulé !"); } else { if (Number(document.getElementById("lb_qte_executee").innerHTML) == Number($("#lb_qte").val()) && document.getElementById("lb_ord_valid").innerHTML == "Non") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Ordre déja exécuté !"); } if (Number(document.getElementById("lb_qte_executee").innerHTML) == 0 && document.getElementById("lb_ord_valid").innerHTML == "Non") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Ordre non valide !"); } if (Number(document.getElementById("lb_qte_executee").innerHTML) == 0 && document.getElementById("lb_ord_valid").innerHTML == "Oui") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Annuler l'ordre ?", function (e) { if (e) { cancelORD(var_num_oper, Sup_type_ord); } else { } }); } if (Number(document.getElementById("lb_qte_executee").innerHTML) < Number($("#lb_qte").val()) && Number(document.getElementById("lb_qte_executee").innerHTML) != 0) { if (document.getElementById("lb_ord_valid").innerHTML == "Non") { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Ordre non valide !"); } else { alertify.set({ buttonFocus: "Ok" }); alertify.set({ labels: { ok: "Oui", cancel: "Non" } }); alertify.confirm("Quantité exécutée partiellement, voulez vous stoper l'ordre ?", function (e) { if (e) { cancelORD(var_num_oper, Sup_type_ord); } else { } }); } } } } var IMPRESSION_ORDER; var Aff_IMPRIMER = 0; function editer_ord() { if (ordre_ANNUL == false) { if (var_Type_Ord == 1) { var printURL_Order_Achat = URL_SERVICE + "Default.aspx?R=oa&typ=PDF&p1=" + Cli_CPT.trim() + "&p2=" + var_num_ord + "&p3=" + var_num_oper + "&p4=1"; window.open(printURL_Order_Achat, '_blank'); } else if (var_Type_Ord == 2) { var printURL_Order_Vente = URL_SERVICE + "Default.aspx?R=ov&typ=PDF&p1=" + Cli_CPT.trim() + "&p2=" + var_num_ord + "&p3=" + var_num_oper + "&p4=1"; window.open(printURL_Order_Vente, '_blank'); } else if (var_Type_Ord == 3) { var printURL_Order_Sousc = URL_SERVICE + "Default.aspx?R=os&typ=PDF&p1=" + Cli_CPT.trim() + "&p2=" + var_num_ord + "&p3=" + var_num_oper + "&p4=1"; window.open(printURL_Order_Sousc, '_blank'); } cacher_Impression(); } else { if (IMPRESSION_ORDER == null) { var ImpressionContentLoaded = $('