diff --git a/Js/fonctions.js b/Js/fonctions.js index e69de29b..1ea27030 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -0,0 +1,91594 @@ + +var triggerTabList = [].slice.call(document.querySelectorAll('#myTab a')); +triggerTabList.forEach(function (triggerEl) { + var tabTrigger = new bootstrap.Tab(triggerEl) + + triggerEl.addEventListener('click', function (event) { + event.preventDefault() + tabTrigger.show() + }) +}) + +function showHideElt(param) { + var GenerauxId = document.getElementById('Generaux'); + var ProductionId = document.getElementById('Production'); + var MedicalId = document.getElementById('Medical'); + var PrestationId = document.getElementById('Prestation'); + + GenerauxId.style.display = "none"; + ProductionId.style.display = "none"; + MedicalId.style.display = "none"; + PrestationId.style.display = "none"; + + if (param === 'Production') { + ProductionId.style.display = "block"; + } else if (param === 'Generaux') { + GenerauxId.style.display = "block"; + } else if (param === 'Medical') { + MedicalId.style.display = "block"; + } else if (param === 'Prestation') { + PrestationId.style.display = "block"; + } +} + + +function alert_ebene(p_msg, p_msg_eng) { + // Récupération de la langue sélectionnée + let codeLangue = $("#codeLangue").val(); + + // Choix du message en fonction de la langue + let message = (codeLangue === "en_US") ? p_msg_eng : p_msg; + + // Utilisation de SweetAlert pour afficher le message + Swal.fire({ + title: message, + icon: 'info', // Icône de type information + confirmButtonText: codeLangue === "en_US" ? 'OK' : 'D\'accord' + }); +} + + +function confirm_ebene(p_msg, p_msg_eng) { + // Récupération de la langue sélectionnée + let codeLangue = $("#codeLangue").val(); + + // Choix du message en fonction de la langue + let message = (codeLangue === "en_US") ? p_msg_eng : p_msg; + + // Utilisation de SweetAlert avec une promesse + return Swal.fire({ + title: message, + icon: 'warning', + showCancelButton: true, + confirmButtonText: codeLangue === "en_US" ? 'Yes' : 'Oui', + cancelButtonText: codeLangue === "en_US" ? 'No' : 'Non' + }).then((result) => { + return result.isConfirmed; // Retourne true si l'utilisateur confirme, false sinon + }); +} + + +function prompt_ebene(p_msg, p_msg_eng, p_retour, callback) { + let codeLangue = $("#codeLangue").val(); + let message = (codeLangue === "en_US") ? p_msg_eng : p_msg; + + Swal.fire({ + title: message, + input: 'text', + inputValue: p_retour, + showCancelButton: true, + confirmButtonText: 'OK', + cancelButtonText: 'Annuler' + }).then((result) => { + if (result.isConfirmed) { + callback(result.value); // Exécute la fonction callback avec la valeur saisie + } else { + callback(null); // Annule l'opération + } + }); +} + + +function addslashes(ch) +{ + ch = ch.replace(/\\/g,"\\\\"); + ch = ch.replace(/\'/g,"\\'"); + ch = ch.replace(/\"/g,"\\\""); + return ch; +} + +function adherents_police() +{ + if ($("#idPolice_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Listeadherent/"); + } +} + +function college_police() +{ + if ($("#idPolice_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Collegepolice/"); + } +} + +function facturer_police() +{ + etat=$("#codeEtatPolice_C").val(); + + /* O,n peut cquand même facturer + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + if ($("#idPolice_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Facturerpolice/"); + } +} + +$.prototype.enable = function () { + $.each(this, function (index, el) { + $(el).removeAttr('disabled'); + }); +} + +$.prototype.disable = function () { + $.each(this, function (index, el) { + $(el).attr('disabled', 'disabled'); + }); +} + +$.prototype.unreadable = function () { + $.each(this, function (index, el) { + $(el).attr('READONLY', 'READONLY'); + }); +} + +$.prototype.readable = function () { + $.each(this, function (index, el) { + $(el).removeAttr('READONLY'); + }); +} + +Date.estAnneeBissextile = function (annee) { + return (((annee % 4 === 0) && (annee % 100 !== 0)) || (annee % 400 === 0)); +}; + +Date.getDaysInMonth = function (annee, month) { + return [31, (Date.estAnneeBissextile(annee) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; +}; + +Date.prototype.estAnneeBissextile = function () { + return Date.estAnneeBissextile(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())); + this.setDate(this.getDate()-1); + return this; +}; + +$( ".datepicker" ).datepicker({ + inline: true, + changeMonth: true, + changeYear: true, + yearRange: "c-60:c+20" + +}); + +/*les fonctions courantes et globales */ + +function get_age(dater) +{ + var td2 = $("#datejourfr_C").datepicker("getDate"); + return age = td2.getFullYear()-dater.getFullYear(); +} + +function get_age_relatif(dateNaissance, dateEffet) +{ + return age = dateEffet.getFullYear()-dateNaissance.getFullYear(); +} + +function controle_age(dater, codeLienParente) +{ + + ageMax = parseInt($("#ageMax").val()); + + age = get_age(dater); + $("#agepersonne").val("Âge : "+age); + + if (age>ageMax) + { + v_msg="Âge "+age+" supérieur à " +ageMax+ " ans!"; + v_msgEng="Age "+age+" over " +ageMax+ "!"; + alert_ebene(v_msg, v_msgEng); + + return false; + } + + + return true; +} + +function controle_age_relatif(dateNaissance, dateEffet, codeLienParente) +{ + ageMax = parseInt($("#ageMax").val()); + + age = get_age_relatif(dateNaissance, dateEffet); + + + + $("#agepersonne").val("Âge : "+age); + + if (age>ageMax) + { + v_msg="Âge "+age+" supérieur à " +ageMax+ " ans!"; + v_msgEng="Age "+age+" over " +ageMax+ "!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateNaissance").val(""); + $("#agepersonne").val("0"); + + return false; + } + + return true; +} + +/* Début JS client */ +function selectionner_client(id,no) +{ + $("#idClient_C").val(id); + $("#numeroClient_C").val(no); + $("#nomClient_C").val(""); +} + +function selectionner_client_d(id,no) +{ + $("#idClient_d_C").val(id); + $("#numeroClient_d_C").val(no); + $("#nomClient_d_C").val(""); +} + +function afficher_client_id() +{ + idClient=$("#idClient_C").val(); + + if (idClient>"") + { + ajax_context_client_afficher(idClient); + } +} + +function afficher_client_d_id() +{ + idClient=$("#idClient_d_C" ).val(); + + if (idClient>"") + { + ajax_context_client_d_afficher(idClient); + } +} + + +/* Fin JS client */ + +/* Début JS police */ +function selectionner_police(id,no) +{ + $("#idPolice_C" ).val(id); + $("#numeroPolice_C" ).val(no); +} + +function selectionner_police_d(id,no) +{ + $("#idPolice_d_C" ).val(id); + $("#numeroPolice_d_C" ).val(no); +} + +function afficher_police_id() +{ + idPolice=$("#idPolice_C" ).val(); + + if (idPolice>"") + { + ajax_context_police_afficher(idPolice); + }/*else{ + window.location.assign($("#racineWeb" ).val()+"Remboursementclassique/"); + }*/ +} + +function afficher_garant(codeGcAssureur) +{ + //alert(codeGcAssureur); + //return; + if (codeGcAssureur>"") + { + ajax_context_garant_afficher(codeGcAssureur); + } +} + +function afficher_police_d_id() +{ + idPolice=$("#idPolice_d_C" ).val(); + + if (idPolice>"") + { + ajax_context_police_d_afficher(idPolice); + + //window.location.assign($("#racineWeb" ).val()+"Fichedevis/"); + } +} + +function afficher_police_d_id_init() +{ + idPolice=$("#idPolice_d_C" ).val(); + + if (idPolice>"") + { + ajax_context_police_d_afficher(idPolice); + } +} + +function detail_quittance(idQuittance) +{ + if (idQuittance>"0") + { + window.location.assign($("#racineWeb" ).val()+"Beneficiairequittance/"+idQuittance+"/"); + } +} + + +/* Fin JS client */ + +/* Début JS adherent */ +function selectionner_adherent(id,no) +{ + $("#idAdherent_C" ).val(id); + $("#numeroAdherent_C" ).val(no); +} + +function afficher_adherent() +{ + if ($("#numeroAdherent_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Ficheadherent/"+$("#numeroAdherent_C" ).val()+"/"); + } +} + +function afficher_adherent_id() +{ + nomForm = $('#nomForm').val(); + + if(nomForm != "ficheBeneficiaire"){ + idAdherent = $("#idAdherent_C" ).val(); + }else{ + idAdherent = $("#idAdherent" ).val(); + } + + //alert(idAdherent); + //return; + + if (idAdherent>"0") + { + window.location.assign($("#racineWeb" ).val()+"Ficheadherent/"+idAdherent+"/"); + } +} +/* Fin JS adherent */ + +/* Début JS bénéficiare */ +function selectionner_beneficiaire(id,no) +{ + $("#idBeneficiaire_C" ).val(id); + $("#numeroBeneficiaire_C" ).val(no); +} + +function afficher_beneficiaire() +{ + if ($("#numeroBeneficiaire_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"+$("#numeroBeneficiaire_C" ).val()+"/"); + } +} + +function afficher_beneficiaire_id() +{ + if ($("#idBeneficiaire_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"+$("#idBeneficiaire_C" ).val()+"/"); + } +} + + + +/// pour la reedition des cartes + +function Reeditioncarte() +{ + + idBeneficiaire_C = $("#idBeneficiaire_C" ).val() + donnees = "idBeneficiaire_C="+idBeneficiaire_C; + + $("#div_patienter").html('
' + '
'); + + //alert(window.location.assign($("#racineWeb" ).val())); + if ($("#idBeneficiaire_C" ).val()>"") + { + //window.location.assign($("#racineWeb" ).val()+"Reeditioncarte/"+$("#idBeneficiaire_C" ).val()+"/"); + $.ajax({ + url: $("#racineWeb").val()+"Reeditioncarte/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + /*$("#div_examens_prescrits").html(data); + appliquerDataTable(); + $("#div_examens_prescrits").modal("show");*/ + $("#div_patienter").empty(); + + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Reeditioncarte/"+$("#idBeneficiaire_C" ).val()+"/"); + } + }); + } +} + +function permutation_numero_beneficiaire() +{ + + + numeroBeneficiaire_C = $("#numeroBeneficiaire_C" ).val() + + donnees = "numeroBeneficiaire_C="+numeroBeneficiaire_C; + + //donnees = "numeroBeneficiaire="+numeroBeneficiaire; + + $("#div_patienter").html('
' + '
'); + + + v_msg="Etes-vous sur de vouloir générer un nouveau numéro?"; + v_msgEng="Are you sure you want to generate a new number?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + if (numeroBeneficiaire_C>"") + { + //window.location.assign($("#racineWeb" ).val()+"Reeditioncarte/"+$("#idBeneficiaire_C" ).val()+"/"); + $.ajax({ + url: $("#racineWeb").val()+"Reeditioncarte/permutation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + /*$("#div_examens_prescrits").html(data); + appliquerDataTable(); + $("#div_examens_prescrits").modal("show");*/ + $("#div_patienter").empty(); + + }, + complete: function() { + afficher_beneficiaire_id(); + } + }); + } + } else { + afficher_beneficiaire_id(); + } + }); + +} + +function modifier_prime_beneficiaire(idBeneficiaire) +{ + // alert("Attention!"); + // return; + + if (idBeneficiaire>"0") + { + window.location.assign($("#racineWeb" ).val()+"Modifierprimebeneficiaire/"+$("#idBeneficiaire_C" ).val()+"/"); + } +} + +function afficher_adherent_assure() +{ + if ($("#idAdherent_C" ).val()<=" ") + { + return; + } + window.location.assign($("#racineWeb" ).val()+"ficheadherentassure/"); +} + + +function afficher_echeance_assure() +{ + if ($("#idAdherent_C" ).val()<=" ") + { + return; + } + window.location.assign($("#racineWeb" ).val()+"Echeanceassure/"); +} + +function afficher_echeance_adherent() +{ + if ($("#idAdherent_C" ).val()<=" ") + { + return; + } + window.location.assign($("#racineWeb" ).val()+"Echeanceadherent/"); +} + +function afficher_assure() +{ + if ($("#idAdherent_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"ficheadherentassure/"+$("#idAdherent_C" ).val()+"/"); + } +} + +function afficher_beneficiaire_assure() +{ + if ($("#idBeneficiaire_C" ).val()<=" ") + { + return; + } + window.location.assign($("#racineWeb" ).val()+"fichebeneficiaireassure/"+$("#idBeneficiaire_C" ).val()+"/"); +} + +function changer_photo_beneficiaire_id() +{ +} + +function fermerFenetre() +{ + v_msg="Etes-vous sur de vouloir quitter?"; + v_msgEng="Are you sure you want to exit?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + ajax_deconnexion(); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_ligne_Tb(id,libelle) +{ + v_msg="Confirmez-vous la suppression de la ligne : "+libelle+"?"; + v_msgEng="Do you confirm the deletion of the line : "+libelle+"?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Tbliste"+$("#nomtable").val()+"/supprimer/"+id+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function modifier_ligne_Tb() +{ + if ($("#idLigne" ).val()<="") + { + v_msg="Veuillez sélectionner une ligne!"; + v_msgEng="Please select a line!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Tbmodifier"+$("#nomtable").val()+"/"+$("#idLigne" ).val()+"/"); +} + +function selectionner_ligne_Tb(id) +{ + $("#idLigne" ).val(id); +} + +/* */ + +function selectionner_Tb(lientable) +{ + $("#lientable" ).val(lientable); +} + +function modifier_Tb() +{ + if ($("#lientable" ).val()<="") + { + v_msg="Veuillez sélectionner une table!"; + v_msgEng="Please select a table!"; + alert_ebene(v_msg, v_msgEng); + + return; + } else + window.location.assign($("#racineWeb" ).val()+$("#lientable" ).val()); +} + +function afficher_Tb() +{ + if ($("#lientable" ).val()<="") + { + v_msg="Veuillez sélectionner une table!"; + v_msgEng="Please select a table!"; + alert_ebene(v_msg, v_msgEng); + + return; + } else + window.location.assign($("#racineWeb" ).val()+$("#lientable" ).val()); +} + +function ajaxListerVille() +{ + donnees = "codePays="+$("#codePays").val(); + + //alert(donnees); + //return; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxville/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#listeville").html(data); + }, + complete: function() { + } + }); +} + +function ajaxListerLocalite() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlocalite/", + type : 'post', + data: "codePays="+$("#codePays").val()+"&codeVille="+$("#codeVille").val(), + error: function(errorData) { + }, + success: function(data) { + $("#listelocalite").html(data); + } + }); +} + +function ajaxListerTitre(typeClient) +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtitretypeclient/", + type : 'post', + data: "typeClient="+$("#typeClient").val(), + error: function(errorData) { + }, + success: function(data) { + $("#codeTitre").html(data); + } + }); +} + +function controletytpeclient() +{ + var typeClient = $("#typeClient").val(); + + //alert(typeClient); + //return; + if (typeClient=="E") + { + ajaxListerTitre(typeClient); + $("#nomMandataire").removeAttr('readonly','readonly'); + $("#telephonePortablemandataire").removeAttr('readonly','readonly'); + $("#telephoneFixemandataire").removeAttr('readonly','readonly'); + $("#emailMandataire").removeAttr('readonly','readonly'); + $("#prenoms").attr('readonly','readonly'); + } else + { + ajaxListerTitre(typeClient); + $("#prenoms").removeAttr('readonly','readonly'); + $("#nomMandataire").attr('readonly','readonly'); + $("#telephonePortablemandataire").attr('readonly','readonly'); + $("#telephoneFixemandataire").attr('readonly','readonly'); + $("#emailMandataire").attr('readonly','readonly'); + } +} + +function enregistrer_client() +{ + $("#formficheclient").submit(); +} + +function modifier_client() +{ + if ($("#idClient_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Modifierclient/"); + } +} + +function modifier_client_d() +{ + if ($("#idClient_d_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Modifierprospect/"); + } +} + +function modifier_police() +{ + idPolice = $("#idPolice_C").val(); + if (idPolice>"0") + { + window.location.assign($("#racineWeb" ).val()+"Modifierpolice/"); + } +} + +function modifier_devis() +{ + idPolice = $("#idPolice_d_C").val(); + + transforme = $("#transforme").val(); + if (transforme=="1") + { + v_msg="Cotation déjà transformée!"; + v_msgEng="Quote already transformed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (idPolice>"0") + { + window.location.assign($("#racineWeb" ).val()+"Modifierdevis/"); + } +} + + +function transformer_devis() +{ + idDevis = $("#idPolice_d_C").val(); + + transforme = $("#transforme").val(); + if (transforme=="1") + { + v_msg="Cotation déjà transformée!"; + v_msgEng="Quote already transformed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + primeTtc_total = $("#primeTtc_total").val(); + nbTotalCollege = $("#nbTotalCollege").val(); + + // if (primeTtc_total=="0") + if (nbTotalCollege=="0") + { + v_msg="Rien à transformer!"; + v_msgEng="Nothing to transform!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous la transformation en contrat?"; + v_msgEng="Do you confirm the transformation into a contract?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + numeroOptionTarif = $("#numeroOptionTarif").val(); + donnees = 'idDevis='+idDevis+"&numeroOptionTarif="+numeroOptionTarif; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtransformerdevis/", + type: 'POST', + data: donnees, + success: function() { + }, + error: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Fichepolice/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + +} + + +function supprimer_client() +{ + v_msg="Confirmez-vous la suppression de ce client?"; + v_msgEng="Do you confirm the deletion of this customer?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Ficheclient/supprimer/"+$("#idClient_C").val()+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_prospect() +{ + v_msg="Confirmez-vous la suppression de ce prospect?"; + v_msgEng="Do you confirm the deletion of this prospect?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Ficheprospect/supprimer/"+$("#idClient_d_C").val()+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function CalculerEcheance() +{ + $("#dateEcheance").disable(); + + codePeriodicite=$("#codePeriodicite").val(); + + var typdate = $("#dateEffet").datepicker("getDate"); + + switch (codePeriodicite) { + case "A": + typdate.addMonths(12); + break; + case "S": + typdate.addMonths(6); + break; + case "T": + typdate.addMonths(3); + break; + case "M": + typdate.addMonths(1); + break; + case "L": + $("#dateEcheance").enable(); + typdate = $("#dateEcheance").datepicker("getDate"); + break; + default: + typdate.addMonths(12); + } + + $( "#dateEcheance" ).datepicker( "setDate", typdate ); +} + +function CalculerFin() +{ + $("#dateFin").disable(); + + codeFractionnement=$("#codeFractionnement").val(); + + var typdate = $("#dateEffet").datepicker("getDate"); + var dtech = $("#dateEcheance").datepicker("getDate"); + + switch (codeFractionnement) { + case "A": + typdate.addMonths(12); + break; + case "S": + typdate.addMonths(6); + break; + case "T": + typdate.addMonths(3); + break; + case "M": + typdate.addMonths(1); + break; + default: + typdate.addMonths(12); + } + if (typdate>dtech) + { + typdate=dtech; + } + $( "#dateFin" ).datepicker( "setDate", typdate ); +} + +function ControlerEcheance() +{ + codePeriodicite=$("#codePeriodicite").val(); + if (codePeriodicite!="L") return true; + else { + var eff = $("#dateEffet").datepicker("getDate"); + var ech = $("#dateEcheance").datepicker("getDate"); + + if (echeff.addMonths(12)) { + v_msg="Période supérieur à un an!"; + v_msgEng="Period greater than one year!"; + alert_ebene(v_msg, v_msgEng); + } + } +} + +function ChangerPass() +{ + if ($("#ancmdp" ).val()<=' ') + { + alert_ebene("Veuillez saisir l\'ancien mot de passe!", "Please enter the old password!"); + $("#ancmdp").focus(); + return false; + } + + if ($("#nvmdp" ).val()<=' ') + { + v_msg="Veuillez saisir un mot de passe!"; + v_msgEng="Please enter a password!"; + alert_ebene(v_msg, v_msgEng); + + $("#nvmdp").focus(); + return false; + } + + if ($("#nvmdp").val()=='0000' || $("#nvmdp").val()=='radiant') + { + alert_ebene("Veuillez changer de mot de passe!", "Please change password!"); + $("#nvmdp").focus(); + return false; + } + + longueur = $("#nvmdp").val().length; + + if(longueur>0 && longueur<6) + { + v_msg="6 caractères minimum exigé!"; + v_msgEng="6 characters minmum required!"; + alert_ebene(v_msg, v_msgEng); + + $("#nvmdp").focus(); + return false; + } + + if ($("#cfnvmdp" ).val()!=$("#nvmdp" ).val()) + { + v_msg="Veuillez confirmer votre mot de passe!"; + v_msgEng="Please confirm your password!"; + alert_ebene(v_msg, v_msgEng); + + $("#nvmdp").focus(); + return false; + } +} + +function modifier_profil() +{ + if ($("#idLigne" ).val()<="") + { + v_msg="Veuillez sélectionner une ligne!"; + v_msgEng="Please select a line!"; + alert_ebene(v_msg, v_msgEng); + + return; + } else + window.location.assign($("#racineWeb").val()+"Modifierprofil/"+$("#idLigne" ).val()+"/"); +} + + +function parametrer_profil() +{ + if ($("#idLigne" ).val()<="") + { + v_msg="Veuillez sélectionner une ligne!"; + v_msgEng="Please select a line!"; + alert_ebene(v_msg, v_msgEng); + + return; + } else + window.location.assign($("#racineWeb").val()+"Parametrerprofil/"+$("#idLigne" ).val()+"/"); +} + +function supprimer_profil(id, libelle) +{ + v_msg="Confirmez-vous la suppression de la ligne : "+libelle+"?"; + v_msgEng="Do you confirm the deletion of the line : "+libelle+"?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Listeprofil/supprimer/"+id+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function modifier_utilisateur() +{ + if ($("#idLigne" ).val()<="") + { + v_msg="Veuillez sélectionner une ligne!"; + v_msgEng="Please select a line!"; + alert_ebene(v_msg, v_msgEng); + + return; + } else + window.location.assign($("#racineWeb").val()+"Modifierutilisateur/"+$("#idLigne" ).val()+"/"); +} + +function supprimer_utilisateur(id,libelle) +{ + v_msg="Confirmez-vous la suppression de la ligne : "+libelle+"?"; + v_msgEng="Do you confirm the deletion of the line : "+libelle+"?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Listeutilisateur/supprimer/"+id+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_police() +{ + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous la suppression de cette police?"; + v_msgEng="Do you confirm the deletion of this policy?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Fichepolice/supprimer/"+$("#idPolice_C").val()+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_devis() +{ + transforme = $("#transforme").val(); + if (transforme=="1") + { + v_msg="Cotation déjà transformée!"; + v_msgEng="Quote already transformed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nbTotalCollege = $("#nbTotalCollege").val(); + + if (nbTotalCollege > "0") + { + v_msg="Impossible de supprimer cette cotation!"; + v_msgEng="Impossible to delete this quote!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + // + v_msg="Confirmez-vous la suppression de cette cotation?"; + v_msgEng="Do you confirm the deletion of this quote?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Fichedevis/supprimer/"+$("#idPolice_d_C").val()+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function archiver_garantie_police() +{ + v_msg="Confirmez-vous l\'archivage des garanties de cette police?"; + v_msgEng="Do you confirm the archiving of the guarantees of this policy?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Fichepolice/archivergarantie/"+$("#idPolice_C").val()+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function archiver_colleege_police() +{ +} + +function ajaxListerUtilisateursProfil() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxutilisateursprofil/", + type : 'post', + data: "codeProfil="+$("#codeProfil").val(), + error: function(errorData) { + }, + success: function(data) { + $("#listeutilisateur").html(data); + } + }); +} + +function ajaxListerUtilisateursPrestataire() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxutilisateursprestataire/", + type : 'post', + data: "codePrestataire="+$("#codePrestataire").val(), + error: function(errorData) { + }, + success: function(data) { + $("#listeutilisateur").html(data); + } + }); +} + +function attribuer_profil_utilisateur(p_choix,p_id_utilisateur) +{ + donnees = 'id_utilisateur='+p_id_utilisateur; + donnees += '&codeProfil='+$("#codeProfil").val(); + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxutilisateursprofil/attribuerProfil/"+p_id_utilisateur+"/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function attribuer_prestataire_utilisateur(p_choix,p_id_utilisateur) +{ + donnees = 'id_utilisateur='+p_id_utilisateur; + donnees += '&codePrestataire='+$("#codePrestataire").val(); + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxutilisateursprestataire/attribuerPrestataire/"+p_id_utilisateur+"/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function beneficiaire_a_facturer(p_choix,p_id_beneficiaire) +{ + donnees = 'idBeneficiairePrime='+p_id_beneficiaire; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxbeneficiaireafacturer/selectionner/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + $("#actualsiser" ).val("0"); + } + }); +} + +function ajaxListerMenusProfil() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmenusprofil/", + type : 'post', + data: "codeProfil="+$("#codeProfil").val(), + error: function(errorData) { + }, + success: function(data) { + $("#listemenu").html(data); + } + }); +} + +function ajouter_menu_profil(p_choix,p_code_menu,p_id_menuprofil) +{ + donnees = 'id_menuprofil='+p_id_menuprofil; + donnees += '&codeMenu='+p_code_menu; + donnees += '&codeProfil='+$("#codeProfil").val(); + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmenusprofil/ajouterMenu/"+p_id_menuprofil+"/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function ajaxListerVuesProfil() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxvuesprofil/", + type : 'post', + data: "codeProfil="+$("#codeProfil").val()+"&vue="+$("#vue").val(), + error: function(errorData) { + }, + success: function(data) { + $("#listemenu").html(data); + } + }); +} + +function ajouter_vue_profil(p_choix,p_code_menu,p_id_menuvueprofil) +{ + donnees = 'id_menuvueprofil='+p_id_menuvueprofil; + donnees += '&codeMenu='+p_code_menu; + donnees += '&codeProfil='+$("#codeProfil").val(); + donnees += '&vue='+$("#vue").val(); + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxvuesprofil/ajouterMenu/"+p_id_menuvueprofil+"/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + + +function lancer_facturation() +{ + if ($("#actualsiser").val()=="0" && $("#primeTtc").val()>"0") + { + v_msg="Veuillez réactualiser!"; + v_msgEng="Please refresh!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if ($("#primeTtc").val()<="0") + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to charge!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Lancer la facturation?"; + v_msgEng="Start billing?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Facturerpolice/facturer/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function afficher_image(fichier) +{ + window.open(fichier); +} + +function modifier_adherent() +{ + + + if ($("#idAdherent_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Modifieradherent/"+$("#idAdherent_C").val()+"/"); + } +} + +function modifier_beneficiaire() +{ + if ($("#idBeneficiaire_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Modifierbeneficiaire/"+$("#idBeneficiaire_C").val()+"/"); + } +} + +function supprimer_bon() +{ + if ($("#codePrestataire").val()<" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if ($("#noDepart").val()<="0") + { + v_msg="Veuillez revoir vos bornes!"; + v_msgEng="Please check your limits!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if ($("#noFin").val()<$("#noDepart").val()) + { + v_msg="Veuillez revoir vos bornes!"; + v_msgEng="Please check your limits!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous la suppression de la plage de "+$("#noDepart").val()+" à "+$("#noFin").val()+" pour "+$("#codePrestataire").val()+"?"; + v_msgEng="Do you confirm the deletion of the range from "+$("#noDepart").val()+" to "+$("#noFin").val()+" for "+$("#codePrestataire").val()+"?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $('#frmsupprimerbons').submit(); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function selectionner_bon(id,no, codeEtatBon, motifAnnulation) +{ + $("#idBon_C").val(id); + $("#numeroBon_C").val(no); + $("#motifAnnulation_C").val(motifAnnulation); + $("#codeEtatBon_C").val(codeEtatBon); +} + +function annuler_bon() +{ + var codeEtatBon = $("#codeEtatBon_C").val(); + var motifAnnulation = $("#motifAnnulation_C").val(); + var numeroBon = $("#numeroBon_C").val(); + var idBon = $("#idBon_C").val(); + + if (numeroBon<=" ") + { + v_msg="Veuillez sélectionner une ligne!"; + v_msgEng="Please select a line!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (codeEtatBon=="3") + { + v_msg="Anullé pour motif : "+motifAnnulation; + v_msgEng="Canceled for reason : "+motifAnnulation; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (codeEtatBon=="4") + { + v_msg="Remplacé pour motif : "+motifAnnulation; + v_msgEng="Replaced for reason : "+motifAnnulation; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous l\'annulation du bon No "+numeroBon+"?"; + v_msgEng="Do you confirm the cancellation of the form No "+numeroBon+"?"; + + confirm_ebene(v_msg, v_msgEng).then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + let v_msg = "Raison de l'annulation?"; + let v_msgEng = "Reason for cancellation?"; + + prompt_ebene(v_msg, v_msgEng, "", function(motifAnnulation) { + if (!motifAnnulation || motifAnnulation.trim() === "") { + v_msg = "Vous devez saisir un motif!"; + v_msgEng = "You have to enter a reason!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + $("#motifAnnulation_C").val(motifAnnulation); + + let donnees = 'idBon=' + idBon + '&motifAnnulation=' + encodeURIComponent(motifAnnulation); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxafficherbons/annulerBon/", + type: 'post', + data: donnees, + error: function(errorData) { }, + success: function(data) { }, + complete: function() { + afficherbon(); + } + }); + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function ajaxbondisponible() +{ + if ($("#codeActe").val()<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + if ($("#codeMedecin").val()<=" ") + { + v_msg="Veuillez sélectionner un prescripteur!"; + v_msgEng="Please select a prescriber!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeMedecin").focus(); + return; + } + + if ($("#numeroBon").val()<=" ") + { + v_msg="Veuillez saisir un No de bon!"; + v_msgEng="Please enter a prescription number!"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroBon").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxbondisponible/", + type : 'post', + data: "codePrestataire="+$("#codePrestataire").val()+"&numeroBon="+$("#numeroBon").val(), + error: function(errorData) { + }, + success: function(data) { + $("#msgErreur").html(data); + }, + complete: function() { + imprimerbon(); + } + }); +} + +function imprimerbon() +{ + if ($("#codeActe").val()<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + if ($("#numeroBon").val()<=" ") + { + v_msg="Veuillez saisir un No de bon!"; + v_msgEng="Please enter a prescription number!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + var codeEtatBon = $("input[name='codeEtatBon']").val(); + + if (codeEtatBon!="1") + { + return; + } + + $("#frmconsultation").submit(); +} + +function imprimerbonVierge() +{ + if ($("#codeActe").val()<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + $("#codeTypeBon").val('2'); + $("#frmconsultation").submit(); + $("#codeTypeBon").val('1'); +} + + +function ajaxcommission() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcommission/", + type : 'post', + data: "codeApporteur="+$("#codeApporteur").val()+"&codeEtape="+$("#codeEtape").val(), + error: function(errorData) { + }, + success: function(data) { + $("#infocomm").html(data); + }, + complete: function() { + $("#tauxCommission").val( $("#tauxCommission_info").val()); + } + }); +} + +function selectionTauxGarant() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcommissiongarant/", + type : 'post', + data: "codeGcAssureur="+$("#codeGcAssureur").val(), + error: function(errorData) { + }, + success: function(data) { + $("#div_taux_garant").html(data); + + var gcTauxFraisReel = $("#gcTauxFraisReel").val(); + var gcTauxCommissionGerant = $("#gcTauxCommissionGerant").val(); + var gcLimiteConsommation = $("#gcLimiteConsommation").val(); + var gcTauxRistourne = $("#gcTauxRistourne").val(); + var seuilRdGarant = $("#seuilRdGarant").val(); + + if(gcTauxCommissionGerant>"0"){ + $("#tauxCommissionGerant").val(gcTauxCommissionGerant); + } + + $("#tauxCommissionGcAssureur").val(gcTauxFraisReel); + $("#limiteConsommation").val(gcLimiteConsommation); + $("#tauxRistourne").val(gcTauxRistourne); + $("#seuilRdPolice").val(seuilRdGarant); + + + }, + complete: function() { + + + } + }); +} + + +function ajaxinfosacte() +{ + if ($("#codeActe").val()<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosacte/", + type : 'post', + data: "codePrestataire="+$("#codePrestataire").val()+"&codeActe="+$("#codeActe").val(), + error: function(errorData) { + }, + success: function(data) { + $("#infosacte").html(data); + }, + complete: function() { + $("#montantacte").val( $("#montantacte_info").val()); + $("#tauxCouverture").val( $("#tauxCouverture_info").val()); + calculer_Tm(); + } + }); +} + +function recapitulerprimeimposee() +{ + primeNette = $("#primeNette").val(); + fraisCarte = $("#fraisCarte").val(); + + donnees = "primeNette="+primeNette+"&fraisCarte="+fraisCarte; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxrecapitulerprimeimposee/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#primeimposee").html(data); + }, + complete: function() { + $("#primeHt").val( $("#primeHt_info").val()); + $("#accessoire").val( $("#accessoire_info").val()); + $("#accessoireGarant").val( $("#accessoireGarant_info").val()); + $("#commission").val( $("#commission_info").val()); + $("#commissionGestion").val( $("#commissionGestion_info").val()); + $("#commissionAutre").val( $("#commissionAutre_info").val()); + $("#taxe").val( $("#taxe_info").val()); + $("#primeTtc").val( $("#primeTtc_info").val()); + $("#primeNetteStat").val( $("#primeNetteStat_info").val()); + } + }); +} + +function imposerprime() +{ + v_msg="Confirmez-vous cette nouvelle prime?"; + v_msgEng="Do you confirm this new premium?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#frmModifierprimebeneficiaire").submit(); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function calculer_Tm() +{ + $("#montantTm").val( ($("#montantacte").val() * (100-$("#tauxCouverture").val() )) / 100 ); + if ($("#codeMedecin").val()>" ") + $("#numeroBon").focus(); + else + $("#codeMedecin").focus(); + return true; +} + +function controlefocusconsultationMd() +{ + if ($("#codeActe").val()>" ") + $("#numeroBon").focus(); + else + $("#codeActe").focus(); + return true; +} + +function ajaxinfosacteexamen() +{ + if ($("#codeActe").val()<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosacte/", + type : 'post', + data: "codePrestataire="+$("#codePrestataire").val()+"&codeActe="+$("#codeActe").val(), + error: function(errorData) { + }, + success: function(data) { + $("#infosacte").html(data); + }, + complete: function() { + $("#tauxCouverture").val( $("#tauxCouverture_info").val()); + } + }); +} + +function ajaxbonexamendisponible() +{ + if ($("#codeActe").val()<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + if ($("#numeroBon").val()<=" ") + { + v_msg="Veuillez saisir un No de bon!"; + v_msgEng="Please enter a prescription number!"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroBon").focus(); + return; + } + + $("#codeTypeBon").val('1'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxbondisponible/", + type : 'post', + data: "codePrestataire="+$("#codePrestataire").val()+"&numeroBon="+$("#numeroBon").val(), + error: function(errorData) { + }, + success: function(data) { + $("#msgErreur").html(data); + }, + complete: function() { + imprimerbon(); + } + }); +} + +function ajaxbonhospitdisponible() +{ + if ($("#codeActe").val()<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + if ($("#numeroBon").val()<=" ") + { + v_msg="Veuillez saisir un No de bon!"; + v_msgEng="Please enter a prescription number!"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroBon").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxbondisponible/", + type : 'post', + data: "codePrestataire="+$("#codePrestataire").val()+"&numeroBon="+$("#numeroBon").val(), + error: function(errorData) { + }, + success: function(data) { + $("#msgErreur").html(data); + }, + complete: function() { + imprimerbon(); + } + }); +} + +function repondreDemandePec(numeroDemande, codeFamille) +{ + if(codeFamille=="EE") + { + window.location.assign($("#racineWeb").val()+"Repondrepecexamen/"+numeroDemande+"/"); + } + else + { + window.location.assign($("#racineWeb").val()+"Repondrepechospit/"+numeroDemande+"/"); + } +} + +function accueil() +{ + if($("#codeProfil_C" ).val()=="MEC") + { + window.location.assign($("#racineWeb").val()+"Accueilmedecin/"); + } + else + { + window.location.assign($("#racineWeb").val()+"Accueil/"); + } +} + +function tache() +{ + if($("#codeProfil_C" ).val()=="ASS") + { + window.location.assign($("#racineWeb").val()+"Tacheassure/"); + } + else + { + window.location.assign($("#racineWeb").val()+"Tache/"); + } +} + +function actualiserdemandeexam() +{ + window.location.assign($("#racineWeb").val()+"Examenententeprealable/"); +} + +function actualiserdemandehospit() +{ + window.location.assign($("#racineWeb").val()+"Avishospitalisation/"); +} + +function actualiserprolongationhospit() +{ + window.location.assign($("#racineWeb").val()+"Prologerhospitalisation/"); +} + +function Imprimerbonpecexam(numeroDemande) +{ + window.location.assign($("#racineWeb").val()+"Imprimerbonpecexam/"+ numeroDemande +"/"); +} + +function Imprimerbonpechosp(numeroDemande) +{ + window.location.assign($("#racineWeb").val()+"Imprimerbonpechosp/"+ numeroDemande +"/"); +} + +function Imprimerprolongationhosp(numeroDemande) +{ + window.location.assign($("#racineWeb").val()+"Imprimprolonghosp/"+ numeroDemande +"/"); +} + +function forceDownload(fileURL, fileName) +{ +} + + +function ged() +{ + if ($("#numeroBeneficiaire_C" ).val()<=" ") + { + v_msg="Veuillez sélectionner un assuré!"; + v_msgEng="Please select an insured person!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Ged/"); +} + +function gedassure() +{ + if ($("#numeroAdherent_C" ).val()<=" ") + { + v_msg="Veuillez sélectionner un assuré!"; + v_msgEng="Please select an insured person!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Gedassure/"); +} + + +function tachesadherent() +{ + if ($("#numeroAdherent_C" ).val()<=" ") + { + v_msg="Veuillez sélectionner un assuré!"; + v_msgEng="Please select an insured person!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Tacheadherent/"); +} + +function afficherged(cheminFichier) +{ + if (cheminFichier<=" ") + { + v_msg="Veuillez sélectionner un fichier!"; + v_msgEng="Please select a file"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.open(cheminFichier, '_blank'); +} + +function archiverged() +{ + if ($("#nomFichier").val()<=" ") + { + v_msg="Veuillez sélectionner un document!"; + v_msgEng="Please select a document"; + alert_ebene(v_msg, v_msgEng); + + return; + } + if( $("#accesAssure").val()=="0" && $("#accesPrestataire").val()=="0" + && $("#accesMedecin").val()=="0" && $("#accesGestionnaire").val()=="0") + { + v_msg="Le document doit être visible par au moins un des acteurs!"; + v_msgEng="The document must be seen by at least one of the persons in charge!"; + alert_ebene(v_msg, v_msgEng); + return; + } + $("#frmarchiherged").submit(); +} + +function archiverfacture() +{ + if ($("#nomFichier").val()<=" ") + { + v_msg="Veuillez sélectionner un fichier!"; + v_msgEng="Please select a file"; + alert_ebene(v_msg, v_msgEng); + + return; + } + $("#frmarchiherged").submit(); +} + +function ajaxinfosdestinatairetache() +{ + if ($("#codeDestinataire").val()<=" ") + { + v_msg="Veuillez sélectionner un destinataire!"; + v_msgEng="Please select a recipient!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeDestinataire").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosdestinatairetache/", + type : 'post', + data: "codeDestinataire="+$("#codeDestinataire").val(), + error: function(errorData) { + }, + success: function(data) { + $("#infosdestinatairetache").html(data); + }, + complete: function() { + $("#emailtache").val( $("#emailActeurtache_info").val()); + } + }); +} + +function afficherPrestataireAssure(id) +{ + if (id <=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Prestataireassure/"+id+"/"); +} + + +function selectionner_Rq(lienrequete) +{ + $("#lienrequete" ).val(lienrequete); +} + + +function parametre_Rq() +{ + if ($("#lienrequete" ).val()<="") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query (request)!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + { + window.location.assign($("#racineWeb" ).val()+$("#lienrequete" ).val()); + } +} + +function imprimer_pdf() +{ + $("#sortie").val('1'); + $("#frmrequete").submit(); +} + +function export_xls() +{ + $("#sortie").val('2'); + $("#frmrequete").submit(); + $("#sortie").val('1'); +} + +function affichermanuel() +{ + codeProfil = $("#codeProfil_C").val(); + + cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_CENTRES_DE_SOINS.pdf"; + + switch(codeProfil) + { + case "AAA": + cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_AGENT_AFRIK_ASSUR.pdf"; + break; + case "ADM": + cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_ADMINISTRATEUR_SYSTEME.pdf"; + break; + case "ASS": + cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_ASSURE.pdf"; + break; + case "CSO": + cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_CENTRES_DE_SOINS.pdf"; + break; + case "DIR": + cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_DIRECTION_AFRIK_ASSUR.pdf"; + break; + case "LAB": + cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_LABORATOIRES.pdf"; + break; + case "MEC": + cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_MEDECINS_CONSEIL.pdf"; + break; + case "PHA": + cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_PHARMACIES.pdf"; + break; + } + window.open('Docs/'+cheminFichier, '_blank'); +} + +function ajaxListerequetesProfil() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxrequetesprofil/", + type : 'post', + data: "codeProfil="+$("#codeProfil").val(), + error: function(errorData) { + }, + success: function(data) { + $("#listerequete").html(data); + } + }); +} + +function ajouter_requete_profil(p_choix,p_nomRequete,p_id_requeteprofil) +{ + donnees = 'id_requeteprofil='+p_id_requeteprofil; + donnees += '&nomRequete='+p_nomRequete; + donnees += '&codeProfil='+$("#codeProfil").val(); + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxrequetesprofil/ajouterRequete/"+p_id_requeteprofil+"/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function supprimer_beneficiaire() +{ + idBeneficiaire = $("#idBeneficiaire_C").val(); + + primeArchive=$("#primeArchive").val(); + if (primeArchive=="1") + { + v_msg="Prime archivée!"; + v_msgEng="Primium archived!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (primeArchive=="0") + { + supprimer_beneficiaire_id(idBeneficiaire); + return; + } + + codeTypeAvenant=$("#codeTypeAvenant_C").val(); + + if (codeTypeAvenant!="REN" && codeTypeAvenant!="AFN") + { + v_msg="Veuillez procéder à un retrait!"; + v_msgEng="Please make a withdrawal!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + supprimer_beneficiaire_id(idBeneficiaire); +} + +function supprimer_beneficiaire_id(idBeneficiaire) +{ + v_msg="Confirmez-vous la suppression de ce bénéficiaire?"; + v_msgEng="Do you confirm the removal of this beneficiary?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxbeneficiaire/supprimer/", + type : 'post', + data: "idBeneficiaire="+idBeneficiaire, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + afficher_adherent_id(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function actualiserbeneficiaireafacturer() +{ + window.location.assign($("#racineWeb").val()+"Facturerpolice/"); +} + +function selectionner_tout_beneficiaireafacturer(choix) +{ + window.location.assign($("#racineWeb").val()+"Facturerpolice/selectionnertout/"+choix+"/"); +} + +function compta() +{ + numeroClient = $("#numeroClient_C" ).val(); + idClient = $("#idClient_C").val(); + + if(idClient<'0') + { + idClient = '0'; + } + + if(idClient>'0') + { + window.location.assign($("#racineWeb").val()+"Compta/"+idClient+"/"); + } + else + { + window.location.assign($("#racineWeb").val()+"Compta/"); + } +} + + +function selection_quittanes_enc() +{ + numeroClient = $("#numeroClient_C" ).val(); + idClient = $("#idClient_C").val(); + window.location.assign($("#racineWeb").val()+"Encselectionquittances/"+idClient+"/"); +} + +function selection_quittances_cli_enc() +{ + numeroClient = $("#numeroClient_C" ).val(); + idClient = $("#idClient_C").val(); + window.location.assign($("#racineWeb").val()+"Encselectquitclient/"+idClient+"/"); +} + +function compta_changer_client(numeroClient) +{ + if (numeroClient>"0") + { + $("#forminfoclient").submit(); + } +} + + +function encaissement_changer_client(numeroClient) +{ + if (numeroClient>"0") + { + $("#forminfoclient").submit(); + } +} + +function afficher_quittances_police() +{ + numeroPolice = $("#numeroPolice_C" ).val(); + idPolice = $("#idPolice_C" ).val(); + + $("#div_quittancepolice").html('
' + '
'); + + if (numeroPolice>" ") + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxquittancepolice/", + type : 'post', + data: "idPolice="+idPolice+"&numeroPolice="+numeroPolice, + error: function(errorData) { + // $("#div_ajaxgabarit").html(data); + }, + success: function(data) { + // $("#div_ajaxgabarit").html(data); + $("#div_quittancepolice").html(data); + } + }); + } +} + +function afficher_quittances_impayees_client() +{ + idClient = $("#idClient_C").val(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsituationclient/", + type : 'post', + data: "idClient="+idClient, + error: function(errorData) { + }, + success: function(data) { + $("#div_quittancesclient").html(data); + } + }); +} + +function afficher_encaissements_quittance(idQuittance, numeroQuittance) +{ + if (idQuittance>"0") + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxencaissementquittance/", + type : 'post', + data: "idQuittance="+idQuittance+"&numeroQuittance="+numeroQuittance, + error: function(errorData) { + }, + success: function(data) { + $("#div_encaissementsquittance").html(data); + } + }); + } +} + + +function afficher_encaissement(idEncaissement) +{ + if (idEncaissement>"0") + { + window.location.assign($("#racineWeb" ).val()+"Ficheencaissement/"+idEncaissement+"/"); + } +} + + +function encaisser_client() +{ + numeroClient = $("#numeroClient_C" ).val(); + idClient = $("#idClient_C").val(); + + if (idClient>"0") + { + window.location.assign($("#racineWeb").val()+"Encaisserclient/"+idClient+"/"); + } + else + { + v_msg="Veuillez sélectionner un client!"; + v_msgEng="Please select a customer!"; + alert_ebene(v_msg, v_msgEng); + + compta(); + } +} + +function encaisser_depot_bord() +{ + $("#btn_depot").click(); +} + +function enregistrer_college() +{ + // + var primeTtcCollege = parseInt($('#primeTtcCollege').val().replace(/ /g,"")); + var nomForm = $('#nomForm').val(); + + var plafondCollege = parseInt($('#plafondCollege').val().replace(/ /g,"")); + var plafondAdherent = parseInt($('#plafondAdherent').val().replace(/ /g,"")); + + if($('#codeProduit').val()<=" ") + { + v_msg="Veuillez sélectionner un produit!"; + v_msgEng="Please select a category!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeProduit').focus(); + return; + } + + if($('#idBaremePriseEnCharge').val()=="0") + { + v_msg="Veuillez sélectionner un barème!"; + v_msgEng="Please select a scale!"; + alert_ebene(v_msg, v_msgEng); + + $('#idBaremePriseEnCharge').focus(); + return; + } + + + if($('#codeCollegeType').val()<=" ") + { + v_msg="Veuillez sélectionner un collège type!"; + v_msgEng="Please select a typical college!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeCollegeType').focus(); + return; + } + + if($('#codeReseau').val()<=" ") + { + v_msg="Veuillez sélectionner un réseau de soins!"; + v_msgEng="Please select a care network!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeReseau').focus(); + return; + } + + if($('#codeBaseTarification').val()=="AUC") + { + v_msg="Veuillez sélectionner une base tarifaire!"; + v_msgEng="Please select a fare basis!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeBaseTarification').focus(); + return; + } + + /* Ne pas rendre le plafondAdherent obligatoire + if(plafondAdherent=="0" || plafondAdherent obligatoire<=" "){ + + v_msg="Veuillez indiquer le montant du plafond famille!"; + v_msgEng="Please indicate the amount of the family ceiling!"; + alert_ebene(v_msg, v_msgEng); + + + $("#plafondAdherent").focus(); + + return; + + } + */ + + enregistrer_college_temp(); + + v_msg="Confirmez-vous l'enregistrement du collège?"; + v_msgEng="Do you confirm college registration?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + if($('#nomForm').val()=="creercollege"){ + window.location.assign($("#racineWeb" ).val()+"Creercollege/enregistrer/"); + }else{ + window.location.assign($("#racineWeb" ).val()+"Modifiercollege/enregistrer/"); + } + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + + +} + +function enregistrer_college_d() +{ + var garantieArchive = $('#garantieArchive').val(); + + if(garantieArchive == "1"){ + afficher_police_d_id(); + } + + + var primeTtcCollege = parseInt($('#primeTtcCollege').val().replace(/ /g,"")); + var nomForm = $('#nomForm').val(); + + var plafondCollege = parseInt($('#plafondCollege').val().replace(/ /g,"")); + var plafondAdherent = parseInt($('#plafondAdherent').val().replace(/ /g,"")); + + if($('#codeProduit').val()<=" ") + { + v_msg="Veuillez sélectionner un produit!"; + v_msgEng="Please select a category!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeProduit').focus(); + return; + } + + if($('#idBaremePriseEnCharge').val()=="0") + { + v_msg="Veuillez sélectionner un barème!"; + v_msgEng="Please select a scale!"; + alert_ebene(v_msg, v_msgEng); + + $('#idBaremePriseEnCharge').focus(); + return; + } + + + if($('#codeCollegeType').val()<=" ") + { + v_msg="Veuillez sélectionner un collège type!"; + v_msgEng="Please select a typical college!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeCollegeType').focus(); + return; + } + + if($('#codeReseau').val()<=" ") + { + v_msg="Veuillez sélectionner un réseau de soins!"; + v_msgEng="Please select a care network!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeReseau').focus(); + return; + } + + if($('#codeBaseTarification').val()=="AUC") + { + v_msg="Veuillez sélectionner une base tarifaire!"; + v_msgEng="Please select a fare basis!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeBaseTarification').focus(); + return; + } + + /* Ne pas rendre le plafondAdherent obligatoire + if(plafondAdherent=="0" || plafondAdherent<=" "){ + + v_msg="Veuillez indiquer le montant du plafond famille!"; + v_msgEng="Please indicate the amount of the family ceiling!"; + alert_ebene(v_msg, v_msgEng); + + + $("#plafondAdherent").focus(); + + return; + + } + */ + + enregistrer_college_temp_d(); + + v_msg="Confirmez-vous l'enregistrement du collège?"; + v_msgEng="Do you confirm college registration?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + if($('#nomForm').val()=="creercolleged"){ + window.location.assign($("#racineWeb" ).val()+"Creercolleged/enregistrer/"); + }else{ + window.location.assign($("#racineWeb" ).val()+"Modifiercolleged/enregistrer/"); + } + + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function encaisser_quittance(idQuittance) +{ + if (idQuittance>"0") + { + window.location.assign($("#racineWeb" ).val()+"Encaisserquittance/"+idQuittance+"/"); + } +} + + +function selectionner_quittance_impayee(numeroQuittance, idQuittance, primeTtc, encaisse, solde) +{ + $("#numeroQuittanceAcpte").val(numeroQuittance); + $("#idQuittanceAcpte").val(idQuittance); + + $("#primeTtcAcpte").val(primeTtc); + $("#encaisseAcpte").val(encaisse); + $("#montantAcpte").val(solde); + $("#anc_soldeAcpte").val(solde); + + formatMonetaire(primeTtcAcpte); + formatMonetaire(encaisseAcpte); + formatMonetaire(montantAcpte); + formatMonetaire(anc_soldeAcpte); + + $("#montantAcpte").focus(); +} + +function ajouter_quittance_acompte() +{ + idQuittance = $("#idQuittanceAcpte" ).val(); + v_montantAcpte = $("#montantAcpte" ).val(); + v_primeTtcAcpte = $("#primeTtcAcpte" ).val(); + + v_montantAcpte = v_montantAcpte.replaceAll(' ', ''); + v_primeTtcAcpte = v_primeTtcAcpte.replaceAll(' ', ''); + + if(idQuittance<="0") + { + v_msg="Veuillez sélectionner une quittance!"; + v_msgEng="PLease select a premium issue!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + if(v_montantAcpte<="0") + { + $("#v_montantAcpte").focus(); + v_msg="Veuillez saisir l\'acompte!"; + v_msgEng="Please enter the deposit!"; + alert_ebene(v_msg, v_msgEng); + return; + } + v_anc_soldeAcpte = $("#anc_soldeAcpte" ).val(); + v_anc_soldeAcpte = v_anc_soldeAcpte.replaceAll(' ', ''); + + if(Number(v_montantAcpte)>Number(v_anc_soldeAcpte)) + { + $("#montantAcpte").focus(); + v_msg="Veuillez vérifier le montant de l\'acompte!"; + v_msgEng="Please check the amount of the deposit!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + donnees = 'idQuittance='+idQuittance+'&montantAcpte='+v_montantAcpte+'&primeTtcAcpte='+v_primeTtcAcpte; + + $("#div_situation_client").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsituationclient/ajouteracomptequittance/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_situation_client").html(data); + }, + error: function(data) { + }, + complete: function() { + recap_bordereau_encaissement(); + } + }); +} + +function ajouter_quittance_acompte_client() +{ + idQuittance = $("#idQuittanceAcpte" ).val(); + v_montantAcpte = $("#montantAcpte" ).val(); + v_primeTtcAcpte = $("#primeTtcAcpte" ).val(); + + v_montantAcpte = v_montantAcpte.replaceAll(' ', ''); + v_primeTtcAcpte = v_primeTtcAcpte.replaceAll(' ', ''); + + if(idQuittance<="0") + { + $("#montantAcpte").focus(); + v_msg="Veuillez sélectionner une quittance!"; + v_msgEng="PLease select a premium issue!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + if(v_montantAcpte<="0") + { + v_msg="Veuillez saisir l\'acompte!"; + v_msgEng="Please enter the deposit!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + v_anc_soldeAcpte = $("#anc_soldeAcpte" ).val(); + v_anc_soldeAcpte = v_anc_soldeAcpte.replaceAll(' ', ''); + + if(Number(v_montantAcpte)>Number(v_anc_soldeAcpte)) + { + $("#montantAcpte").focus(); + v_msg="Veuillez vérifier le montant de l\'acompte!"; + v_msgEng="Please check the amount of the deposit!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + donnees = 'idQuittance='+idQuittance+'&montantAcpte='+v_montantAcpte+'&primeTtcAcpte='+v_primeTtcAcpte; + + $("#div_situation_client").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximpayeclient/ajouteracomptequittance/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_situation_client").html(data); + }, + error: function(data) { + }, + complete: function() { + recap_bordereau_encaissement(); + } + }); +} + +function solder_quittance_temp(idQuittance) +{ + donnees = 'idQuittance='+idQuittance; + + $("#div_situation_client").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsituationclient/solderquittance/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_situation_client").html(data); + }, + error: function(data) { + }, + complete: function() { + recap_bordereau_encaissement(); + } + }); +} + +function solder_quittance_client_temp(idQuittance) +{ + donnees = 'idQuittance='+idQuittance; + + $("#div_situation_client").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximpayeclient/solderquittance/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_situation_client").html(data); + }, + error: function(data) { + }, + complete: function() { + recap_bordereau_encaissement(); + } + }); +} + +function supprimer_detail_encaissement(idDetailencaissement) +{ + donnees = 'idDetailencaissement='+idDetailencaissement; + + $("#div_situation_client").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsituationclient/supprimerquittance/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_situation_client").html(data); + }, + error: function(data) { + }, + complete: function() { + recap_bordereau_encaissement(); + } + }); +} + + +function retirer_garantie_police(idGarantie) +{ + donnees = 'idGarantie='+idGarantie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiespolice/supprimergarantie/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + + +function ajouter_une_garantie_college(codeGarantie) +{ + donnees = 'codeGarantie='+codeGarantie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/ajoutergarantie/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + + +function supprimer_detail_encaissement_client(idDetailencaissement) +{ + donnees = 'idDetailencaissement='+idDetailencaissement; + + $("#div_situation_client").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximpayeclient/supprimerquittance/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_situation_client").html(data); + }, + error: function(data) { + }, + complete: function() { + recap_bordereau_encaissement(); + } + }); +} + +function encaissement_changer_client(numeroClient) +{ + if (numeroClient>"0") + { + $("#forminfoclient").submit(); + } +} + +function encaisser_bordereau() +{ + window.location.assign($("#racineWeb").val()+"Encaisserbordereau/"); +} + +function encaisser_bordereau_detail() +{ +} + + +function imprimer_recu(idEncaissement) +{ + donnees = 'idEncaissement='+idEncaissement; + + var div_export = $('#div_export_a'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerrecucaisse/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} + +function afficher_pop_recherche_client() +{ + numeroclientsearch = $("#numeroclientsearch").val(); + nomsearch = $("#nomsearch").val(); + prenomsearch = $("#prenomsearch").val(); + telsearch = $("#telsearch").val(); + + if (numeroclientsearch+nomsearch+prenomsearch+telsearch > " ") + { + donnees = "valid=1&numeroclientsearch="+numeroclientsearch+"&nomsearch="+nomsearch+"&prenomsearch="+prenomsearch+"&telsearch="+telsearch; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteclients/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_listeclient").html(data); + } + }); + } +} + +function afficher_pop_recherche_client_enc() +{ + numeroclientsearch = $("#numeroclientsearch").val(); + nomsearch = $("#nomsearch").val(); + prenomsearch = $("#prenomsearch").val(); + telsearch = $("#telsearch").val(); + + if (numeroclientsearch+nomsearch+prenomsearch+telsearch > " ") + { + donnees = "valid=1&numeroclientsearch="+numeroclientsearch+"&nomsearch="+nomsearch+"&prenomsearch="+prenomsearch+"&telsearch="+telsearch; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteclientsenc/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_listeclient").html(data); + } + }); + } +} + +function selectionner_client_pop(id,no,nom) +{ + $("#nocli").val(no); + $("#nomcli").val(nom); + selectionner_client(id,no); +} + +function ctrlkeypress(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + afficher_pop_recherche_client(); + } +} + +function ctrlkeypress_enc(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + afficher_pop_recherche_client_enc(); + } +} + +function ajaxListerMoyenPaiement() +{ + codeModePaiement = $("#codeModePaiement").val(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmoyenpaiement/", + type : 'post', + data: "codeModePaiement="+codeModePaiement, + error: function(errorData) { + }, + success: function(data) { + $("#listemoyenpaiement").html(data); + $("#codeMoyenPaiement").focus(); + }, + complete: function() { + } + }); +} + +function ajax_no_cpt_paiement() +{ + codeModePaiement = $("#codeModePaiement").val(); + codeMoyenPaiement = $("#codeMoyenPaiement").val(); + + donnees = "codeModePaiement="+codeModePaiement+"&codeMoyenPaiement="+codeMoyenPaiement; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnocptmoyenpaiement/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infonocpt").html(data); + }, + complete: function() { + $("#numeroCompte").val( $("#numeroCompte_info").val()); + $("#referencePaiement").focus(); + } + }); +} + +function modifier_detail_encaissement(idDetailencaissement) +{ +} + +function recap_bordereau_encaissement() +{ + montant_ecart = $("#montant_ecart_info").val(); + $("#montant_selection").val( $("#montant_selection_info").val()); + $("#montant_ecart").val(montant_ecart); +} + + +function enregistrer_encaissement_bordereau() +{ + montant_ecart = $("#montant_ecart").val(); + montant_ecart = montant_ecart.replace(" ", ""); + montant_ecart = parseInt(montant_ecart); + montant_ecart = Math.abs(montant_ecart); + + if(montant_ecart>"100") + { + v_msg="Veuillez vérifier votre écart!"; + v_msgEng="Please check your gap!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#formente_encaissement").submit(); +} + +function enregistrer_encaissement_client() +{ + montant_ecart = $("#montant_ecart").val(); + montant_ecart = montant_ecart.replace(" ", ""); + montant_ecart = parseInt(montant_ecart); + montant_ecart = Math.abs(montant_ecart); + + if(montant_ecart>"100") + { + v_msg="Veuillez vérifier votre écart!"; + v_msgEng="Please check your gap!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + montant = $("#montant").val(); + montant = montant.replace(" ", ""); + montant = parseInt(montant); + montant = Math.abs(montant); + + codeModePaiement = $("#codeModePaiement").val(); + codeMoyenPaiement = $("#codeMoyenPaiement").val(); + referencePaiement = $("#referencePaiement").val(); + libelleOperation = $("#libelleOperation").val(); + + + if(montant=="100") + { + v_msg="Veuillez saisir un montant!"; + v_msgEng="Please enter an amount"; + alert_ebene(v_msg, v_msgEng); + + $("#montant").focus(); + return; + } + + if(codeModePaiement<=" ") + { + v_msg="Veuillez indiquer le mode de paiement!"; + v_msgEng="Please enter the method of payment"; + alert_ebene(v_msg, v_msgEng); + + $("#codeModePaiement").focus(); + return; + } + + if(codeMoyenPaiement<=" ") + { + v_msg="Veuillez indiquer le moyen de paiement!"; + v_msgEng="Please enter the method of payment!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeMoyenPaiement").focus(); + return; + } + + if(referencePaiement<=" ") + { + v_msg="Veuillez indiquer la référence du paiement!"; + v_msgEng="Please enter the payment reference!"; + alert_ebene(v_msg, v_msgEng); + + $("#referencePaiement").focus(); + return; + } + + if(libelleOperation<=" ") + { + v_msg="Veuillez saisir le libellé de l\'opération!"; + v_msgEng="Please enter the text of the transaction!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleOperation").focus(); + return; + } + + $("#formente_encaissement").submit(); +} + +function ajax_context_client(idClient) +{ + donnees = 'idClient='+idClient; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextclient/", + type : 'post', + data: donnees, + error: function(errorData) { + } + }); +} + +function ajax_context_client_afficher(idClient) +{ + donnees = 'idClient='+idClient; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextclient/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Ficheclient/"); + } + }); +} + + +function ajax_context_client_d_afficher(idClient) +{ + donnees = 'idClient='+idClient; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextclientd/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Ficheprospect/"); + } + }); +} + +function ajax_context_police(idPolice) +{ + donnees = 'idPolice='+idPolice; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextpolice/", + type : 'post', + data: donnees, + error: function(errorData) { + } + }); +} + +function ajax_context_police_d(idPolice) +{ + donnees = 'idPolice='+idPolice; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextpoliced/", + type : 'post', + data: donnees, + error: function(errorData) { + } + }); +} + +function ajax_context_police_afficher(idPolice) +{ + donnees = 'idPolice='+idPolice; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextpolice/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Fichepolice/"); + } + }); +} + +function ajax_context_garant_afficher(codeGcAssureur) +{ + donnees = 'codeGcAssureur='+codeGcAssureur; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextgarant/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data){ + afficher_gc_assureur(data); + }, + complete: function() { + + } + }); +} + +function ajax_context_police_d_afficher(idPolice) +{ + donnees = 'idPolice='+idPolice; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextpoliced/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Fichedevis/"); + } + }); +} + +function ajax_deconnexion() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdeconnexion/", + complete: function() + { + window.open('about:blank','_parent',''); + close(); + window.close(); + } + }); + +/* 24/03/2019 + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdeconnexion/" + }); +*/ +} + +function selectionner_college(idCollege) +{ + $("#idCollege" ).val(idCollege); +} + +function supprimer_college(idCollege) +{ + v_msg="Confirmez-vous la suppression de ce collège?"; + v_msgEng="Do you confirm the removal of this college?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Collegepolice/supprimerCollege/"+idCollege+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_college_d(idCollege) +{ + transforme = $("#transforme").val(); + if (transforme=="1") + { + v_msg="Cotation déjà transformée!"; + v_msgEng="Quote already transformed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous la suppression de ce collège?"; + v_msgEng="Do you confirm the removal of this college?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Fichedevis/supprimerCollege/"+idCollege+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function modifier_college(idCollege) +{ + if (idCollege>"0") + { + window.location.assign($("#racineWeb" ).val()+"Modifiercollege/"+idCollege+"/"); + } +} + +function modifier_college_d(idCollege) +{ + transforme = $("#transforme").val(); + if (transforme=="1") + { + v_msg="Cotation déjà transformée!"; + v_msgEng="Quote already transformed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (idCollege>"0") + { + window.location.assign($("#racineWeb" ).val()+"Modifiercolleged/"+idCollege+"/"); + } +} + +function consulter_college(idCollege) +{ + if (idCollege>"0") + { + window.location.assign($("#racineWeb" ).val()+"Consultercollege/"+idCollege+"/"); + } +} + +function retour_college() +{ + idCollege=$("#idCollege").val(); + + if (idCollege>"0") + { + window.location.assign($("#racineWeb" ).val()+"Consultercollege/"+idCollege+"/"); + } +} + +function ajax_flexcode() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxflexcode/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + $("#content").html(data); + }, + complete: function() { + } + }); +} + +function ajaxttcfammille() +{ + idCollege=$("#idCollege").val(); + dateEntree=$("#dateEntree").val(); + + donnees = 'idCollege='+idCollege; + donnees += '&dateEntree='+dateEntree; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxttcfammille/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infottc").html(data); + }, + complete: function() { + } + }); +} + +function supprimer_adherent() +{ + idAherent=$("#idAdherent_C").val(); + + primeArchive=$("#primeArchive").val(); + if (primeArchive=="1") + { + v_msg="Prime archivée!"; + v_msgEng="Primium archived!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeTypeAvenant=$("#codeTypeAvenant_C").val(); + + // alert('codeTypeAvenant => '+codeTypeAvenant); + // return; + + if (codeTypeAvenant!="REN" && codeTypeAvenant!="AFN" && codeTypeAvenant!="CHE") + { + v_msg="Veuillez procéder à un retrait!"; + v_msgEng="Please make a withdrawal!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (primeArchive=="0") + { + supprimer_adherent_id(idAherent); + return; + } +} + + +function supprimer_adherent_id(idAherent) +{ + v_msg="Confirmez-vous la suppression de cet adhérent?"; + v_msgEng="Do you confirm the deletion of this member?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxadherent/supprimer/", + type : 'post', + data: "idAherent="+idAherent, + error: function(errorData) { + }, + success: function(data) + { + v_msg="Suppression terminée avec succès terminé!"; + v_msgEng="Deletion completed successfully completed!"; + alert_ebene(v_msg, v_msgEng); + }, + complete: function() + { + adherents_police(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + +} + +function supprimer_adherent_id_list(idAherent) +{ + codeTypeAvenant=$("#codeTypeAvenant_C").val(); + + if (codeTypeAvenant!="REN" && codeTypeAvenant!="AFN" && codeTypeAvenant!="CHE") + { + v_msg="Veuillez procéder à un retrait!"; + v_msgEng="Please make a withdrawal!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous la suppression de cet adhérent?"; + v_msgEng="Do you confirm the deletion of this member?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"ajaxadherent/supprimer/", + type : 'post', + data: "idAherent="+idAherent, + error: function(errorData) { + }, + success: function(data) { + v_msg="Suppression terminée avec succès terminé!"; + v_msgEng="Deletion completed successfully completed!"; + alert_ebene(v_msg, v_msgEng); + }, + complete: function() { + adherents_police(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function ajax_init_echancier() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinitnbecheance/", + type : 'post', + data: "codeTypeEcheancier="+$("#codeTypeEcheancier").val(), + error: function(errorData) { + }, + success: function(data) { + $("#infonbEcheance").html(data); + }, + complete: function() { + $("#nbEcheance").val( $("#nbEcheance_info").val()); + ajax_maj_echancier(); + } + }); +} + +function ajax_maj_echancier() +{ + codeTypeEcheancier = $("#codeTypeEcheancier").val(); + nbEcheance = $("#nbEcheance").val(); + tauxInteret = $("#tauxInteret").val(); + + donnees = "codeTypeEcheancier="+codeTypeEcheancier+"&nbEcheance="+nbEcheance+"&tauxInteret="+tauxInteret; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmajcheancier/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Echeancier/"); + } + }); +} + +function enregistrer_echeancier() +{ + if ($("#nbEcheance").val()=="1") + { + v_msg="Confirmez-vous l\'émission sans échéancier?"; + v_msgEng="Do you confirm the issue of primium without payment schedule?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + afficher_police_id(); + return; + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + return; + } + }); + } + + v_msg="Confirmez-vous cet échéancier?"; + v_msgEng="Do you confirm this payment schedule?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmajcheancier/enregistrer/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + afficher_police_id(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function ajax_maj_lib_echancier(idEcheancier, libelleEcheance) +{ + donnees = "idEcheancier="+idEcheancier+"&libelleEcheance="+libelleEcheance; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmajcheancier/majlibelle/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Echeancier/"); + } + }); +} + +function ajax_maj_date_echancier(idEcheancier, datePaiement) +{ + donnees = "idEcheancier="+idEcheancier+"&datePaiement="+datePaiement; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmajcheancier/majdatepaiement/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Echeancier/"); + } + }); +} + + + +function ajax_maj_taux_echancier(idEcheancier, tauxEcheance) +{ + nbEcheance = $("#nbEcheance").val(); + + donnees = "idEcheancier="+idEcheancier+"&tauxEcheance="+tauxEcheance+"&nbEcheance="+nbEcheance; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmajcheancier/majtauxecheance/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Echeancier/"); + } + }); +} + +function retirer_garantie_college(idGarantie) +{ + donnees = 'idGarantie='+idGarantie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/supprimergarantie/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function ajax_maj_taux_plafond(idGarantie, tauxPlafond, controle) +{ + tauxPlafond=tauxPlafond.replace(",","."); + controle.value=tauxPlafond; + + if(controle_numerique(controle)) + { + donnees = 'idGarantie='+idGarantie+"&tauxPlafond="+tauxPlafond; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/majtauxplafond/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + //controle.focus(); + } + }); + } +} + +function ajax_imposer_plafond(idGarantie, plafond, controle) +{ + plafond=plafond.replace(",","."); + controle.value=plafond; + + if(controle_numerique(controle)) + { + donnees = 'idGarantie='+idGarantie+"&plafond="+plafond; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/imposerplafond/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + //controle.focus(); + } + }); + } +} + +function ajax_maj_lib_gar_opt(idGarantie, libellegarantie, controle) +{ + if (libellegarantie<=" ") + { + return; + } + + donnees = 'idGarantie='+idGarantie+"&libellegarantie="+libellegarantie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/majlibgar/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + //controle.focus(); + } + }); +} + +function maj_prime_gar_opt(idGarantie, primeOption, controle) +{ + if(controle_numerique(controle)) + { + donnees = 'idGarantie='+idGarantie+"&primeOption="+primeOption; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/majprimeopt/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + //controle.focus(); + } + }); + } +} + +function archiver_garantie_college(idCollege) +{ + v_msg="Validez-vous ce collège?"; + v_msgEng="Do you validate this college?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcollege/archivergarntie/", + type : 'post', + data: "idCollege="+idCollege, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() + { + college_police(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function controle_champ_obligatoire(controle) +{ + if (controle.value<=" ") + { + v_msg="Valeur exigée!"; + v_msgEng="Value required!"; + alert_ebene(v_msg, v_msgEng); + + controle.focus(); + return false; + } + return true; +} + +function controle_champ_obligatoire_new(controle) +{ + if (controle.value<=" ") + { + v_msg="Valeur exigée!"; + v_msgEng="Value required!"; + alert_ebene(v_msg, v_msgEng); + + controle.focus(); + return false; + } + return true; +} + +function controle_champ_obligatoire_old(controle) +{ + if (controle.value<=" ") + { + v_msg="Valeur exigée!"; + v_msgEng="Value required!"; + alert_ebene(v_msg, v_msgEng); + + controle.focus(); + return false; + } + return true; +} + + +function plafond_adherent() +{ + if ($("#idAdherent_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Plafondadherent/"); + } +} + +function creer_adherents() +{ + nbAdh = $("#nbAdh_C").val(); + codeTypeContrat = $("#codeTypeContrat_C").val(); + + //if ((codeTypeContrat!="G") && (nbAdh>0) ) + if ((codeTypeContrat=="P") && (nbAdh>0) ) + { + v_msg="Ce n\'est pas une police GROUPE!"; + v_msgEng="This is not a GROUP policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="SU") + { + v_msg="Attention! Police suspendue!"; + v_msgEng="Warning! Suspended policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Creeradherent/"); +} + +function creer_colleges() +{ + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Creercollege/initcollege/"); +} + + +function creer_colleges_d() +{ + transforme = $("#transforme").val(); + if (transforme=="1") + { + v_msg="Cotation déjà transformée!"; + v_msgEng="Quote already transformed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Creercolleged/initcollege/"); +} + +function creer_beneficiaires() +{ + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="SU") + { + v_msg="Attention! Police suspendue!"; + v_msgEng="Warning! Suspended policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + etatadh=$("#codeEtatAdherent_C").val(); + + if (etatadh != "V") + { + v_msg="Attention! cette famille n\'est pas en vigueur!"; + v_msgEng="Warning! this family is not in force!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Creerbeneficiaire/"); +} + +function changer_etat_adherent() +{ + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="SU") + { + v_msg="Attention! Police suspendue!"; + v_msgEng="Warning! Suspended policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Changeretatadherent/"); +} + +function creer_avenant() +{ + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Creeravenant/"); +} + +function liste_avenant() +{ + window.location.assign($("#racineWeb" ).val()+"Listeavenant/"); +} + +function prorater_prime_adherent() +{ + codeModeCalculPrime = $("#codeModeCalculPrime").val(); + + if(codeModeCalculPrime=="TA"){ + calcul_prime_adherent(); + + return; + } + + idCollege=$("#idCollege").val(); + + if (idCollege<=" ") + { + v_msg="Veuillez sélectionner un collège!"; + v_msgEng="Please select a college!"; + alert_ebene(v_msg, v_msgEng); + + $("#div_prime").html(""); + + return; + } + + dateEntree=$("#dateEntree").val(); + prorata=$("#prorata").val(); + + + + donnees = 'idCollege='+idCollege; + donnees += '&dateEntree='+dateEntree; + donnees += '&prorata='+prorata; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxproraterprime/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_prime").html(data); + }, + complete: function() { + } + }); +} + +function prorater_prime_beneficiaire() +{ + + + codeModeCalculPrime = $("#codeModeCalculPrime").val(); + + if(codeModeCalculPrime=="TA"){ + calcul_prime_beneficiaire(); + + return; + } + + idAvenant = $("#idAvenant").val(); + + if(idAvenant<=" ") + { + v_msg="Veuillez sélectionner un avenant!"; + v_msgEng="Please select an Amendment!"; + alert_ebene(v_msg, v_msgEng); + + $("#idAvenant").focus(); + return; + } + + codeLienParente=$("#codeLienParente").val(); + + if (codeLienParente=="A") + { + v_msg="Veuillez revoir le lien de parenté!"; + v_msgEng="Please review the relationship"; + alert_ebene(v_msg, v_msgEng); + $("#codeLienParente").focus(); + return; + } + + dateEntree=$("#dateEntree").val(); + fraisCarte=$("#fraisCarte").val(); + prorata=$("#prorata").val(); + + donnees = '&dateEntree='+dateEntree; + donnees += '&fraisCarte='+fraisCarte; + donnees += '&prorata='+prorata; + donnees += '&codeLienParente='+codeLienParente; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxproraterprimebeneficiaire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_prime").html(data); + }, + complete: function() { + } + }); +} + +function histo_etats() +{ + window.location.assign($("#racineWeb" ).val()+"Histoetat/"); +} + +function afficher_emission(idEmission) +{ + if (idEmission>"0") + { + window.location.assign($("#racineWeb" ).val()+"Emission/"+idEmission+"/"); + } +} + +function exporter_liste_assures() +{ + $('#div_exporter_liste_assures').html(''); + + $("#btn_exporter_liste_assures").click(); +} + + +function imprimer_liste_assures() +{ + $('#div_export_assures').html(''); + + $("#btn_liste_assures").click(); +} + +function imprimer_limites() +{ + idEntetecontrat=$("#idEntetecontrat").val(); + + if (idEntetecontrat<="0") + { + v_msg="Veuillez sélectionner une période!"; + v_msgEng="Please select a period!"; + alert_ebene(v_msg, v_msgEng); + + $("#idEntetecontrat").focus(); + + div_attente.html(''); + + return; + } + + donnees = 'idEntetecontrat='+idEntetecontrat; + + var div_export = $('#div_export_a'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerlimite/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} + +function avenantimprimer_cp() +{ + + + idAvenant=$("#idAvenant").val(); + + donnees = '&idAvenant='+idAvenant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxavenantimprimercp/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} + +function imprimer_cp(lienEtat) +{ + + + + var td2 = $("#debutStat").datepicker("getDate"); + var td3 = $("#finStat").datepicker("getDate"); + + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); // debutStat + dt3=Math.round(Date.parse(td3)/(1000*3600*24)); // finStat + + if (dt3' + ''); + + donnees = '&idAvenant='+idAvenant +'&lienEtat='+lienEtat+'&debutStat='+debutStat+"&finStat="+finStat; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimercp/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} + + +function imprimer_reseau_college(idCollege) +{ + var div_imprime_reseau = $('#div_imprime_reseau'); + + donnees = 'idCollege='+idCollege; + + div_imprime_reseau.html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimereseaucollege/", + type: 'POST', + data: donnees, + success: function(data) + { + div_imprime_reseau.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} + + +function imprimer_cp_d(lienEtat) +{ + var div_export = $('#div_export_a'); + div_export.html('
' + '
'); + + donnees = 'lienEtat='+lienEtat; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimercpd/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} + +function imprimer_cp_eng() +{ + var div_export = $('#div_export_a'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimercpeng/", + type: 'POST', + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} + +function imprimer_cp_eng_d() +{ + var div_export = $('#div_export_a'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimercpengd/", + type: 'POST', + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} + + +function rachat_tm_police() +{ + if($('#rachatTm').val()=="1") + { + $("#tauxRachatTm").readable(); + } + else + { + $("#tauxRachatTm").val("0"); + $("#tauxRachatTm").unreadable(); + } +} + +function taux_referencement() +{ + if($('#avecReferencement').val()=="1") + { + $("#tauxAvecReferencement").val("0"); + $("#tauxAvecReferencement").readable(); + + $("#tauxSansReferencement").val("0"); + $("#tauxSansReferencement").readable(); + } + else + { + $("#tauxAvecReferencement").val("0"); + $("#tauxSansReferencement").val("0"); + + $("#tauxAvecReferencement").unreadable(); + $("#tauxSansReferencement").unreadable(); + + } +} + +function pop_tableau_prestation() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtableauprestation/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + $("#div_tableau_prestation").html(data); + }, + complete: function() { + $("#btn_pop").click(); + } + }); +} + + +function pop_consulter_tableau_prestation() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconsultertableauprestation/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + $("#div_tableau_prestation").html(data); + }, + complete: function() { + $("#btn_pop").click(); + } + }); +} + +function pop_afficher_detail_resiliation() +{ + var div_tableau_assure = $('#div_tableau_assure'); + + div_tableau_assure.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailresiliation/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + div_tableau_assure.html(data); + + var oTable = $('.tabliste').DataTable(); + oTable.destroy(); + + setTimeout(function() { + appliquerDataTable(); + }, 500); + }, + complete: function() { + $("#btn_pop").click(); + } + }); +} + +function maj_college() +{ + if($('#codeProduit').val()<=" ") + { + v_msg="Veuillez sélectionner un produit!"; + v_msgEng="Please select a category!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeProduit').focus(); + return; + } + $("#btn_recap").click(); +} + +function ajax_maj_tm(idPrestation, tm, controle) +{ + tm=tm.replace(",","."); + controle.value=tm; + + if(controle_numerique(controle)) + { + donnees = 'idPrestation='+idPrestation+"&tm="+tm; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtableauprestation/majtm/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); + } +} + +function texte_cp() +{ + window.location.assign($("#racineWeb" ).val()+"Textecp/"); +} + +function imprimer_contrat() +{ + window.location.assign($("#racineWeb" ).val()+"Contrat/"); +} + +function imprimer_devis() +{ + window.location.assign($("#racineWeb" ).val()+"Imprimerdevis/"); +} + +function rapport_sp_police() +{ + window.location.assign($("#racineWeb" ).val()+"Sppolice/"); +} + +function rapport_sp_adherent() +{ + window.location.assign($("#racineWeb" ).val()+"Spadherent/"); +} + + +function rapport_sp_college() +{ + window.location.assign($("#racineWeb" ).val()+"Spcollege/"); +} + +function rapport_sp_beneficiaire() +{ + window.location.assign($("#racineWeb" ).val()+"Spbeneficiaire/"); +} + +function enregistrer_avenant() +{ + // + codeTypeAvenant=$("#codeTypeAvenant").val(); + + //alert(codeTypeAvenant); + //return; + + oldCodeTypeAvenant=$("#oldCodeTypeAvenant").val(); + + if ($("#codeTypeAvenant").val()<" ") + { + v_msg="Veuillez sélectionner le type d\'avenant!"; + v_msgEng="Please select the type of amendment!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if(codeTypeAvenant!="CHE" && codeTypeAvenant!="REN") + { + + var d_effet = new Date($("#dateEffetSql").val()); // 01/05/2022 + var d_fin = new Date($("#dateFinSql").val()); // 31/12/2022 + var d_avenant = $("#dateAvenant").datepicker("getDate"); // 20/07/2022 + + dt_effet = Math.round(Date.parse(d_effet)/(1000*3600*24)); + dt_fin = Math.round(Date.parse(d_fin)/(1000*3600*24)); + dt_avenant = Math.round(Date.parse(d_avenant)/(1000*3600*24)); + + /* + alert("dt_effet => "+dt_effet); + alert("dt_fin => "+dt_fin); + alert("dt_avenant => "+dt_avenant); + return; + */ + if(codeTypeAvenant!="RVP"){ + if (dt_avenant>dt_fin || dt_avenantdt2) + { + v_msg="Veuillez revoir la date de renouvellement!"; + v_msgEng="Please review the renewal date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + var eff = $("#dateAvenant").datepicker("getDate"); + var ech = $("#dateEcheanceRen").datepicker("getDate"); + + if (ech>eff.addMonths(12)) { + v_msg="Période supérieur à un an!"; + v_msgEng="Period greater than one year!"; + alert_ebene(v_msg, v_msgEng); + } + } + + if(codeTypeAvenant=="CHE" && oldCodeTypeAvenant=="REN") + { + var td1 = new Date($("#dateEffet").val()); + var td2 = $("#dateAvenant").datepicker("getDate"); + + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + + if (dt1>dt2) + { + v_msg="Veuillez revoir la date!"; + v_msgEng="Please review the date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + } + + if ( + codeTypeAvenant=="RET" || + codeTypeAvenant=="RES" || + codeTypeAvenant=="SUS" || + codeTypeAvenant=="ANL" || + codeTypeAvenant=="RVP" || + codeTypeAvenant=="ADL" || + codeTypeAvenant=="INC" || + codeTypeAvenant=="CHC" || + codeTypeAvenant=="CHE" || + codeTypeAvenant=="SUA" || + codeTypeAvenant=="RVA" || + codeTypeAvenant=="ING" || + codeTypeAvenant=="INA" || + codeTypeAvenant=="REG" || + codeTypeAvenant=="REA") + { + motifAvenant=$("#motifAvenant").val(); + + if ($("#motifAvenant").val()<" ") + { + v_msg="Veuillez fournir le motif!"; + v_msgEng="Please provide the reason"; + alert_ebene(v_msg, v_msgEng); + + return; + } + } + + v_msg="Confirmez-vous cet avenant?"; + v_msgEng="Do you confirm this amendment to the contract?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + var div_attente = $('#div_attente'); + div_attente.html('
' + '
'); + + codeTypeAvenant=$("#codeTypeAvenant").val(); + + donnees = ""; + + if (codeTypeAvenant=="ANL") + { + donnees = "controle=existequittance"; + } + + if(donnees>" ") + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontroleavenantpolice/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + // alert(data); + $("#div_controler_avenant").html(data); + }, + complete: function() { + $("#controler_avenant").val($("#controler_avenant_info").val()); + + resultat_controler_avenant = $("#controler_avenant").val(); + + if (resultat_controler_avenant=="Q") + { + v_msg="Attention, cette police possède des quittances!"; + v_msgEng="Warning, this policy has premium issues!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (resultat_controler_avenant=="C") + { + v_msg="Attention, cette police possède des sinistres!"; + v_msgEng="Warning, this policy has claims!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + // return; + $("#btn_enreg").click(); + } + }); + div_attente.empty(); + } + else + if (codeTypeAvenant=="ADL") + { + donnees = "dateAvenant="+$("#dateAvenant").val()+"&motifAvenant="+motifAvenant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlimiteadditionnelle/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + $("#btn_enreg").click(); + } + }); + } + else + { + $("#btn_enreg").click(); + } + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + +} + + +function enregistrer_resiliation() +{ + v_msg="Confirmez-vous la résiliation de cette police?"; + v_msgEng="Do you confirm the cancellation of this policy?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Ficheresiliation/enregistrerresiliation/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function enregistrer_retrait() +{ + var div_assure_a_retirer = $('#div_assure_a_retirer'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailretrait/recapituler/", + type: 'POST', + success: function(data) { + div_assure_a_retirer.html(data); + }, + error: function(data) { + }, + complete: function() { + nbAliment=$("#nbAliment").val(); + + if (nbAliment<"1") + { + v_msg="Veuillez sélectionner les personnes à retirer!"; + v_msgEng="Please select the people to remove!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous le retrait des personnes sélectionnées de cette police?"; + v_msgEng="Do you confirm the withdrawal of the selected people from this policy?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Ficheretrait/enregistrerretrait/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + } + }); + + +} + +function controle_date_avenant() +{ + + + $("#div_periodidite").html(""); + + codeTypeAvenant=$("#codeTypeAvenant").val(); + + idBeneficiaireFacture = $("#idBeneficiaireFacture").val(); + + idCollegeFacture = $("#idCollegeFacture").val(); + + //alert(idCollegeFacture); + + + if(codeTypeAvenant=="REN") + { + $("#dateAvenant").val($("#DateRenouvellement_fr").val()); + $("#motifAvenant").val(""); + + $("#motifAvenant").unreadable(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxrenouvellement/", + type: 'POST', + // data: donnees, + success: function(data) + { + $("#div_periodidite").html(data); + $(".datepicker" ).datepicker(); + CalculerEcheanceRen(); + CalculerFinRen(); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); + $("#dateAvenant").readable(); + } + else + if(codeTypeAvenant=="ADL") + { + $("#dateAvenant").val($("#datejourfr_C").val()); + $("#dateAvenant").unreadable(); + $("#motifAvenant").readable(); + + } + + else + if(codeTypeAvenant=="ANL") + { + $("#dateAvenant").val($("#dateEffet").val()); + $("#dateAvenant").unreadable(); + $("#motifAvenant").readable(); + } + else + if(codeTypeAvenant=="QTM") + { + if(idCollegeFacture=="0"){ + v_msg="Aucun collège validé!"; + v_msgEng="No validated college"; + + alert_ebene(v_msg, v_msgEng); + + setTimeout(function() { + window.location.assign($("#racineWeb" ).val()+"Creeravenant/"); + }, 2000); + + + return; + } + + $("#dateAvenant").val($("#datejourfr_C").val()); + + $("#dateAvenant").readable(); + $("#motifAvenant").readable(); + + if(idBeneficiaireFacture=="") + { + ajouteradherentfacturation(); + + } + + } + else + { + $("#dateAvenant").val($("#datejourfr_C").val()); + + $("#dateAvenant").readable(); + $("#motifAvenant").readable(); + } + +} + +function pop_afficher_detail_renouvellement() +{ + var div_patienter = $('#div_patienter'); + + div_patienter.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailrenouvellement/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + + div_patienter.html(''); + + $('#div_detail_renouvellement').html(data); + //appliquerDataTable(); + $('#div_detail_renouvellement').modal("show"); + + var oTable = $('.tabliste').DataTable(); + oTable.destroy(); + + setTimeout(function() { + appliquerDataTable(); + }, 500); + }, + complete: function() { + $("#btn_pop").click(); + } + }); +} + +function enregistrer_renouvellemnt() +{ + v_msg="Confirmez-vous le renouvellement de cette police?"; + v_msgEng="Do you confirm the renewal of this policy?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Ficherenouvellement/enregistrerrenouvellement/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function fiche_limite_additionnelle() +{ + window.location.assign($("#racineWeb" ).val()+"Fichelimiteadditionnelle/"); +} + +function enregistrer_changement_etat_famille() +{ + codeEtatAdherent=$("#codeEtatAdherent").val(); + + if (codeEtatAdherent<" ") + { + v_msg="Veuillez sélectionner le nouvel état!"; + v_msgEng="Please select the new state!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + motifEtat=$("#motifEtat").val(); + + if (motifEtat<" ") + { + v_msg="Veuillez indiquer le motif!"; + v_msgEng="Please enter the reason!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ce changement d\'état?"; + v_msgEng="Do you confirm this change of state?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#btn_enreg").click(); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function changer_etat_beneficiaire() +{ + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="SU") + { + v_msg="Attention! Police suspendue!"; + v_msgEng="Warning! Suspended policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Changeretatbeneficiaire/"); +} + +function enregistrer_changement_etat_beneficiaire() +{ + codeEtatBeneficiaire=$("#codeEtatBeneficiaire").val(); + + if (codeEtatBeneficiaire<" ") + { + v_msg="Veuillez sélectionner le nouvel état!"; + v_msgEng="Please select the new state!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + motifEtat=$("#motifEtat").val(); + + if (motifEtat<" ") + { + v_msg="Veuillez indiquer le motif!"; + v_msgEng="Please enter the reason!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ce changement d\'état?"; + v_msgEng="Do you confirm this change of state?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#btn_enreg").click(); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function pop_afficher_selection_retrait() +{ + var div_selection_assure = $('#div_selection_assure'); + + div_selection_assure.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionretrait/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + div_selection_assure.html(data); + + var oTable = $('.tabliste').DataTable(); + oTable.destroy(); + + setTimeout(function() { + appliquerDataTable(); + }, 500); + }, + complete: function() { + $("#btn_pop").click(); + } + }); +} + +function beneficiaire_a_retirer(p_choix, p_id_beneficiaire) +{ + donnees = 'idBeneficiaire='+p_id_beneficiaire; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionretrait/selectionner/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function recapituler_retrait() +{ + var div_assure_a_retirer = $('#div_assure_a_retirer'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailretrait/recapituler/", + type: 'POST', + success: function(data) { + div_assure_a_retirer.html(data); + + var oTable = $('.tabliste').DataTable(); + oTable.destroy(); + + setTimeout(function() { + appliquerDataTable(); + }, 500); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function changer_college() +{ + codeTypeAvenant=$("#codeTypeAvenant_C").val(); + + // autorisé le 11/07/2018 en attendant + if (codeTypeAvenant!="REN") + { + v_msg="Opération possible uniquement lors du renouvellement!"; + v_msgEng="Operation possible only during renewal!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeEtatFacturation=$("#codeEtatFacturation").val(); + if (codeEtatFacturation=="1") + { + v_msg="Attention! Famille déjà facturée!"; + v_msgEng="Warning! Family already billed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + consommation_adherent=$("#consommation_adherent").val(); + if(consommation_adherent>"0") + { + v_msg="Attention! cette famille a déjà consommé!"; + v_msgEng="Warning! this family has already consumed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Changercollege/"); +} + +function changer_college_adherent() +{ + idCollege=$("#idCollege").val(); + + if (idCollege<=" ") + { + v_msg="Veuillez sélectionner un collège!"; + v_msgEng="Please select a college!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idCollege='+idCollege; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxchangercollege/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_prime").html(data); + }, + complete: function() { + } + }); +} + +function enregistrer_changement_college() +{ + idCollege=$("#idCollege").val(); + idCollegeOld=$("#idCollegeOld").val(); + + if (idCollege==idCollegeOld) + { + v_msg="Veuillez sélectionner un autre collège!"; + v_msgEng="Please select a another college!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (idCollege<=" ") + { + v_msg="Veuillez sélectionner un collège!"; + v_msgEng="Please select a college!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette opération?"; + v_msgEng="Do you confirm this operation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#btn_enreg").click(); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function enregistrer_limite_additionnelle() +{ + nbAliment=$("#nbAliment").val(); + + if (nbAliment<"1") + { + v_msg="Veuillez sélectionner les familles concernées!"; + v_msgEng="Please select the families concerned!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + cumulPlafond=$("#cumulPlafond").val(); + + // alert("cumulPlafond => "+cumulPlafond); + // return; + + if (cumulPlafond<="1") + { + v_msg="Veuillez saisir les limites additionnelles!"; + v_msgEng="Please enter the additional limits!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ces limites additionnelles?"; + v_msgEng="Do you confirm these additional limits?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Fichelimiteadditionnelle/enregistrerlimiteadditionnelle/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function selection_college(p_choix,p_id_college_temp) +{ + donnees = 'idCollegeTemp='+p_id_college_temp; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlimiteadditionnelle/selectionner/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + recapituler_limite_additionnelle(); + } + }); +} + +function modifier_college_temp(p_id_college_temp) +{ + if (p_id_college_temp>"0") + { + window.location.assign($("#racineWeb" ).val()+"Modifiercollegetemp/"+p_id_college_temp+"/"); + } +} + +function maj_limite_additionnelle(idGarantie, plafond, controle) +{ + if(controle_numerique(controle)) + { + donnees = 'idGarantie='+idGarantie+"&plafond="+plafond; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollegeadd/majplafondadd/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + controle.focus(); + } + }); + } +} + +function maj_prime_additionnelle(idGarantie, primeOption, controle) +{ + if(controle_numerique(controle)) + { + donnees = 'idGarantie='+idGarantie+"&primeOption="+primeOption; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollegeadd/majprimeadd/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + recapituler_limite_college(); + controle.focus(); + } + }); + } +} + +function enregistrer_college_temp() +{ + + idCollegeTemp = $('#idCollegeTemp').val(); + codeProduit = $('#codeProduit').val(); + codeCollegeType = $('#codeCollegeType').val(); + codeReseau = $('#codeReseau').val(); + codeTypeRemboursement = $('#codeTypeRemboursement').val(); + codeTerritoire = $('#codeTerritoire').val(); + codeLienParente = $('#codeLienParente').val(); + libelleCollege = $('#libelleCollege').val(); + ticketModerateurCollege = $('#ticketModerateurCollege').val(); + + delaiCarenceCollege = $('#delaiCarenceCollege').val(); + plafondCollege = parseInt($('#plafondCollege').val().replace(/ /g,""),10); + + plafondAdherent = parseInt($('#plafondAdherent').val().replace(/ /g,""),10); + + idPolice = $('#idPolice').val(); + numeroPolice = $('#numeroPolice').val(); + accessoireManuel = parseInt($('#accessoireManuel').val().replace(/ /g,""),10); + rachatTm = $('#rachatTm').val(); + tauxRachatTm = $('#tauxRachatTm').val(); + tauxPrimeRachatTm = $('#tauxPrimeRachatTm').val(); + budgetDefini = "0"; + montantBudget = "0"; + nbAdherent = $('#nbAdherent').val(); + nbAyantdroit = $('#nbAyantdroit').val(); + codeTypeTarifActe = $('#codeTypeTarifActe').val(); + codeTarifActe = $('#codeTarifActe').val(); + codeGcAssureur = $('#codeGcAssureur').val(); + + codeGcAssureur = $('#codeGcAssureur').val(); + idBaremePriseEnCharge = $('#idBaremePriseEnCharge').val(); + + codeBaseTarification = $('#codeBaseTarification').val(); + + seuilRdCollege = $('#seuilRdCollege').val(); + + + + forfaitHonoraire = 0; //parseInt($('#forfaitHonoraire').val().replace(/ /g,""),10); + forfaitAppelFond = 0; //parseInt($('#forfaitAppelFond').val().replace(/ /g,""),10); + forfaitAppelCotisation = 0; // parseInt($('#forfaitAppelCotisation').val().replace(/ /g,""),10); + + ticketModerateurHorsReseau = $('#ticketModerateurHorsReseau').val(); + ageLimiteEnfantEleve = $('#ageLimiteEnfantEleve').val(); + + donnees = 'id='+idCollegeTemp+'&codeProduit='+codeProduit+'&codeCollegeType='+codeCollegeType+'&codeReseau='+codeReseau; + donnees += '&codeTypeRemboursement='+codeTypeRemboursement+'&codeTerritoire='+codeTerritoire+'&codeLienParente='+codeLienParente; + donnees += '&libelleCollege='+libelleCollege+'&ticketModerateurCollege='+ticketModerateurCollege+'&delaiCarenceCollege='+delaiCarenceCollege; + donnees += '&plafondCollege='+plafondCollege+'&idPolice='+idPolice+'&numeroPolice='+numeroPolice+'&accessoireManuel='+accessoireManuel; + donnees += '&rachatTm='+rachatTm+'&tauxRachatTm='+tauxRachatTm+'&tauxPrimeRachatTm='+tauxPrimeRachatTm+'&budgetDefini='+budgetDefini; + donnees += '&montantBudget='+montantBudget+'&nbAdherent='+nbAdherent+'&nbAyantdroit='+nbAyantdroit+'&codeTypeTarifActe='+codeTypeTarifActe; + donnees += '&codeTarifActe='+codeTarifActe+'&codeGcAssureur='+codeGcAssureur+'&idBaremePriseEnCharge='+idBaremePriseEnCharge; + donnees += '&codeBaseTarification='+codeBaseTarification+'&seuilRdCollege='+seuilRdCollege+'&plafondAdherent='+plafondAdherent; + + //donnees += '&forfaitHonoraire='+forfaitHonoraire+'&forfaitAppelFond='+forfaitAppelFond+'&forfaitAppelCotisation='+forfaitAppelCotisation; + donnees += '&forfaitHonoraire='+forfaitHonoraire+'&forfaitAppelFond='+forfaitAppelFond+'&forfaitAppelCotisation='+forfaitAppelCotisation; + donnees += '&ticketModerateurHorsReseau='+ticketModerateurHorsReseau+'&ageLimiteEnfantEleve='+ageLimiteEnfantEleve; + + console.log(donnees); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/enregistrercollegelienparentetemp/", + type: 'POST', + data: donnees, + success: function(data) + { + + }, + complete: function(data) + { + } + }); +} + +function recapituler_limite_additionnelle() +{ + var div_primes = $('#div_primes'); + + $.ajax({ + url: $("#racineWeb").val()+"Recaplimiteadd/", + type: 'POST', + success: function(data) { + div_primes.html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function recapituler_limite_college() +{ + var div_recap = $('#div_recap'); + + $.ajax({ + url: $("#racineWeb").val()+"Recaplimitecollege/", + type: 'POST', + success: function(data) { + div_recap.html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + + +function changer_limite() +{ + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="SU") + { + v_msg="Attention! Police suspendue!"; + v_msgEng="Warning! Suspended policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + etatadh=$("#codeEtatAdherent_C").val(); + + if (etatadh != "V") + { + v_msg="Attention! cette famille n\'est pas en vigueur!"; + v_msgEng="Warning! this family is not in force!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + rapport_sp_police=$("#rapport_sp_police").val(); + if(rapport_sp_police>"0.70") + { + v_msg="Attention! S/P > 70%"; + v_msgEng="Warbing! Loss Ratio > 70%"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlimiteaddadherent/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Changerlimite/"); + } + }); +} + +function maj_limite_add_adherent(idGarantie, plafond, controle) +{ + if(controle_numerique(controle)) + { + donnees = 'idGarantie='+idGarantie+"&plafond="+plafond; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollegeadherent/majplafondadherent/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + controle.focus(); + } + }); + } +} + +function enregistrer_changement_limite() +{ + $("#btn_enreg").click(); +} + +function pop_afficher_selection_limite(p_id_college_temp) +{ + var div_selection_assure = $('#div_selection_assure'); + donnees = 'id_college_temp='+p_id_college_temp; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionlimite/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + div_selection_assure.html(data); + }, + complete: function() { + $("#btn_pop").click(); + } + }); +} + +function selection_famille_limite(p_choix,p_idBeneficiaire) +{ + donnees = 'idBeneficiaire='+p_idBeneficiaire; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionlimite/selectionner/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + recapituler_limite_college_simple(); + } + }); +} + + +function recapituler_limite_college_simple() +{ + $.ajax({ + url: $("#racineWeb").val()+"Recaplimitecollege/recapituler/", + type: 'POST', + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + recapituler_limite_additionnelle(); + } + }); +} + +function selectionner_tout_limite(p_idCollegeTemp, p_choix) +{ + donnees = 'idCollegeTemp='+p_idCollegeTemp; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionlimite/selectionnertout/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + recapituler_limite_college_simple(); + pop_afficher_selection_limite(p_idCollegeTemp); + } + }); +} + +function gestionbon() +{ + adminBon = $("#adminBon").val(); + + if (adminBon!="1") + { + v_msg="Accès refusé!"; + v_msgEng="Access denied!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb").val()+"Gestionbons/"); +} + +function getDenierNumeroBon() +{ + $("#msgErreur").html(""); + $("#div_wait").html(""); + + codeTypeBon=$("#codeTypeBon").val(); + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#msgErreur").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderniernumerobon/", + type : 'post', + data: "codeTypeBon="+codeTypeBon, + error: function(errorData) { + }, + success: function(data) { + $("#infodernierbon").html(data); + $("#msgErreur").html(""); + }, + complete: function() { + denierNumeroBon = $("#denierNumeroBon_info").val(); + denierNumeroBon = parseInt(denierNumeroBon); + $("#denierNumeroBon").val(denierNumeroBon); + $("#noDepart").val(denierNumeroBon+1); + $("#noFin").val(denierNumeroBon+50); + } + }); +} + +function genererbon() +{ + codePrestataire=$("#codePrestataire").val(); + codeTypeBon=$("#codeTypeBon").val(); + receptionnaire=$("#receptionnaire").val(); + + noDepart=$("#noDepart").val(); + noFin=$("#noFin").val(); + + if (noDepart=="") + { + noDepart="0"; + } + + if (noFin=="") + { + noFin="0"; + } + + noDepart = parseInt(noDepart); + noFin = parseInt(noFin); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + $("#btn_pop_prestataire").click(); + return; + } + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeBon").focus(); + return; + } + + if (noFin { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'codeTypeBon='+codeTypeBon+'&noDepart='+noDepart+'&noFin='+noFin+'&receptionnaire='+receptionnaire+'&codePrestataire='+codePrestataire; + + // donnees_sav = donnees+'&typeMail=mailgenererbon'; + donnees_sav = donnees; + typeMail='mailgenererbon'; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxplagebonlibre/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infoplagelibre").html(data); + + }, + complete: function() { + plageLibre_info=$("#plageLibre_info").val(); + + if (plageLibre_info!="0") + { + v_msg="Cette plage est déjà occupée!"; + v_msgEng="This range is already occupied!"; + alert_ebene(v_msg, v_msgEng); + + $("#noDepart").focus(); + return; + } + + $("#div_page_entiere").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgenererbons/genererBon/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_page_entiere").html(data); + }, + complete: function() { + imprimer_livraison_bon(); + } + }); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function afficherbon() +{ + codePrestataire=$("#codePrestataire").val(); + + codeTypeBon=$("#codeTypeBon").val(); + codeEtatBon=$("#codeEtatBon").val(); + + noDepart=$("#noDepart").val(); + noFin=$("#noFin").val(); + + if (noDepart=="") + { + noDepart="0"; + } + + if (noFin=="") + { + noFin="0"; + } + + noDepart = parseInt(noDepart); + noFin = parseInt(noFin); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + return; + } + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeBon").focus(); + return; + } + + if (noFin' + ''); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxafficherbons/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_bonpecs").html(data); + }, + complete: function() { + $("#nbligne").val("Nombre de bons affichés : "+$("#nbligne_info").val()); + } + }); +} + +function listergenerationbon() +{ + codePrestataire=$("#codePrestataire").val(); + codeTypeBon=$("#codeTypeBon").val(); + d1=$("#d1").val(); + d2=$("#d2").val(); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + return; + } + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeBon").focus(); + return; + } + + donnees = 'codePrestataire='+codePrestataire+'&codeTypeBon='+codeTypeBon+'&d1='+d1+'&d2='+d2; + + $("#div_bonpecs").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxalistegenererbons/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_bonpecs").html(data); + }, + complete: function() { + $("#nbligne").val("Nombre de lignes affichées : "+$("#nbligne_info").val()); + } + }); +} + +function listerdemandebon() +{ + codePrestataire=$("#codePrestataire").val(); + codeTypeBon=$("#codeTypeBon").val(); + d1=$("#d1").val(); + d2=$("#d2").val(); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + return; + } + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeBon").focus(); + return; + } + + donnees = 'codePrestataire='+codePrestataire+'&codeTypeBon='+codeTypeBon+'&d1='+d1+'&d2='+d2; + + $("#div_bonpecs").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxalistedemandebon/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_bonpecs").html(data); + }, + complete: function() { + } + }); +} + +function ajaxListerExclusions() +{ + $("#div_acte").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxexclureacte/", + type : 'post', + data: "idCollege="+$("#idCollege").val(), + error: function(errorData) { + }, + success: function(data) { + $("#div_acte").html(data); + } + }); +} + +function exclure_acte(p_choix, p_codeActe, id_exclusioncollege) +{ + donnees = 'idCollege='+$("#idCollege").val(); + donnees += '&id_exclusioncollege='+id_exclusioncollege; + donnees += '&codeActe='+p_codeActe; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxexclureacte/exclure/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function separateur_millier(montant) +{ + montant = parseInt(montant); + montant.toLocaleString(); + return montant.toLocaleString(); +} + +function afficher_detail_generartionbon(idgenerationbon) +{ + if (idgenerationbon>"") + { + window.location.assign($("#racineWeb" ).val()+"Detailgenerationbon/"+idgenerationbon+"/"); + } +} + +function afficher_tarifoptique() +{ + var div_detail = $('#div_detail'); + + codeTarifOptique=$("#codeTarifOptique").val(); + libelleOptique=$("#libelleOptique").val(); + + if(codeTarifOptique<=' ') + { + v_msg="Veuillez sélectionner un tarif!"; + v_msgEng="Please select a rate!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTarifOptique").focus(); + return; + } + + /* + if(libelleOptique<=' ') + { + v_msg="Veuillez saisir un nom!"; + v_msgEng="Please enter a name!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleOptique").focus(); + return; + } + */ + + donnees = 'codeTarifOptique='+codeTarifOptique+'&libelleOptique='+libelleOptique; + + div_detail.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifoptique/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_detail").html(data); + appliquerDataTable(); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function() + { + } + }); +} + +function maj_tarifoptique(idDetail, prix) +{ + donnees = 'idDetail='+idDetail+"&prix="+prix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifoptique/maj/", + type: 'POST', + data: donnees, + success: function(data) { + }, + complete: function(data) + { + } + }); +} + +function supprimer_espace_nombre(nombre) +{ + // nombre = nombre.replace(" ", ""); + nombre = nombre.replace(/ /g, ""); + + if(isNaN(nombre)) + { + v_msg = nombre+" n\'est pas un nombre!"; + v_msgEng = nombre+" is not a number!"; + alert_ebene(v_msg, v_msgEng); + + return '0'; + } + nombre = parseInt(nombre); + return nombre; +} + +function afficher_tarifpharmacie() +{ + var div_detail = $('#div_detail'); + + codeTarifMedicament=$("#codeTarifMedicament").val(); + libelleMedicament=$("#libelleMedicament").val(); + + if(codeTarifMedicament<=' ') + { + v_msg="Veuillez sélectionner un tarif!"; + v_msgEng="Please select a rate!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTarifMedicament").focus(); + return; + } + + /* + if(libelleMedicament<=' ') + { + v_msg="Veuillez indiquer le nom!"; + v_msgEng="Please enter the name!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleMedicament").focus(); + return; + } + */ + + donnees = 'codeTarifMedicament='+codeTarifMedicament+'&libelleMedicament='+libelleMedicament; + + div_detail.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifmedicament/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_detail").html(data); + appliquerDataTable(); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function() + { + } + }); +} + +function maj_tarifpharmacie(idDetail, prix) +{ + donnees = 'idDetail='+idDetail+"&prix="+prix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifmedicament/maj/", + type: 'POST', + data: donnees, + success: function(data) { + }, + complete: function(data) + { + } + }); +} + +function afficher_tarifacte() +{ + var div_detail = $('#div_detail'); + + codeTarifActe=$("#codeTarifActe").val(); + libelleActe=$("#libelleActe").val(); + + if(codeTarifActe<=' ') + { + v_msg="Veuillez sélectionner un tarif!"; + v_msgEng="Please select a rate!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTarifActe").focus(); + return; + } + + if(libelleActe<=' ') + { + v_msg="Veuillez indiquer le nom!"; + v_msgEng="Please enter the name!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleActe").focus(); + return; + } + + donnees = 'codeTarifActe='+codeTarifActe+'&libelleActe='+libelleActe; + + div_detail.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifacte/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_detail").html(data); + appliquerDataTable(); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function() + { + } + }); +} + +function maj_tarifacte(idDetail, prix) +{ + donnees = 'idDetail='+idDetail+"&prix="+prix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifacte/maj/", + type: 'POST', + data: donnees, + success: function(data) { + }, + complete: function(data) + { + } + }); +} + +function gestiondiverses() +{ + adminDiv = $("#adminDiv").val(); + + if (adminDiv!="1") + { + v_msg="Accès refusé!"; + v_msgEng="Access denied!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Gestiondiverses/"); +} + + +function liste_derogation_beneficiaire() +{ + window.location.assign($("#racineWeb" ).val()+"Listederogationsbenficiaire/"); +} + +function listerderogationbeneficiaire() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + + $("#div_derogations").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_derogations").html(data); + }, + complete: function() { + } + }); +} + +function accepter_derogation(idDemandederogation) +{ + window.location.assign($("#racineWeb" ).val()+"Accepterderogation/"+idDemandederogation+"/"); +} + +function refuser_derogation(idDemandederogation) +{ + window.location.assign($("#racineWeb" ).val()+"Refuserderogation/"+idDemandederogation+"/"); +} + +function enregistrerrefusderogation() +{ + idDemandederogation = $("#idDemandederogation").val(); + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifRefusAssure").val(); + + if (motifReel<=" ") + { + v_msg="Veuillez saisir le motif réel!"; + v_msgEng="Please enter the real reason!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReel").focus(); + return; + } + + if (motifRefusAssure<=" ") + { + v_msg="Veuillez saisir un motif pour l\'assuré!"; + v_msgEng="Please enter a reason for the insured!"; + + $("#motifRefusAssure").focus(); + return; + } + + + v_msg="Confirmez-vous ce refus?"; + v_msgEng="Do you confirm this refusal?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + codePrestataire = $("#codePrestataire").val(); + + donnees = 'idDemandederogation='+idDemandederogation+'&motifReel='+motifReel+'&motifRefusAssure='+motifRefusAssure+'&codePrestataire='+codePrestataire; + + donnees_sav = donnees; + typeMail='refusderogation'; + typeSms="refusderogation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/enregistrerrefusderogation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + preparesms(typeSms); + }, + complete: function() { + + v_msg="Refus envoyé avec succès!"; + v_msgEng="Disagreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_derogation_beneficiaire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function enregistreraccordderogation() +{ + idDemandederogation = $("#idDemandederogation").val(); + motifReel = $("#motifReel").val(); + debut =$("#debut").val(); + fin =$("#fin").val(); + + codeDerogation = $("#codeDerogation").val(); + tmDerogation = $("#tmDerogation").val(); + tmDerogation = parseInt(tmDerogation); + + codePrestataire = $("#codePrestataire").val(); + + if (motifReel<=" ") + { + v_msg="Veuillez saisir le motif!"; + v_msgEng="Please enter the reason!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReel").focus(); + return; + } + + var td0 = $("#datejourfr_C").datepicker("getDate"); + var td1 = $("#debut").datepicker("getDate"); + var td2 = $("#fin").datepicker("getDate"); + + dt0=Math.round(Date.parse(td0)/(1000*3600*24)); + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + + if ((dt0>dt1) || dt1>dt2) + { + v_msg="Veuillez revoir les dates!"; + v_msgEng="Please review the dates!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cet accord?"; + v_msgEng="Do you confirm this agreement?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'idDemandederogation='+idDemandederogation+'&motifReel='+motifReel+'&debut='+debut+'&fin='+fin; + donnees += '&codeDerogation='+codeDerogation+'&tmDerogation='+tmDerogation+'&codePrestataire='+codePrestataire; + + donnees_sav = donnees; + typeMail='accordderogation'; + typeSms = "accordderogation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/enregistreraccordderogation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + preparesms(typeSms); + }, + complete: function() { + + v_msg="Accord envoyé avec succès!"; + v_msgEng="Agreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_derogation_beneficiaire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function listerderogations() +{ + codePrestataire=$("#codePrestataire").val(); + codeDerogation=$("#codeDerogation").val(); + codeReponseDerogation=$("#codeReponseDerogation").val(); + debut=$("#debut").val(); + fin=$("#fin").val(); + + donnees = 'codePrestataire='+codePrestataire+'&codeDerogation='+codeDerogation+'&codeReponseDerogation='+codeReponseDerogation; + donnees += '&debut='+debut+'&fin='+fin; + + $("#div_derogations").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogations/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_derogations").html(data); + }, + complete: function() { + } + }); +} + +function accepter_derogation_2(idDemandederogation) +{ + window.location.assign($("#racineWeb" ).val()+"Accepterderogations/"+idDemandederogation+"/"); +} + +function refuser_derogation_2(idDemandederogation) +{ + window.location.assign($("#racineWeb" ).val()+"Refuserderogations/"+idDemandederogation+"/"); +} + +function enregistrerrefusderogation_2() +{ + idDemandederogation = $("#idDemandederogation").val(); + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifReel").val(); + + + if (motifReel<=" ") + { + v_msg="Veuillez saisir le motif réel!"; + v_msgEng="Please enter the real reason!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReel").focus(); + return; + } + + if (motifRefusAssure<=" ") + { + v_msg="Veuillez saisir un motif pour l\'assuré!"; + v_msgEng="Please enter a reason for the insured!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifRefusAssure").focus(); + return; + } + + v_msg="Confirmez-vous ce refus?"; + v_msgEng="Do you confirm this refusal?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + codePrestataire = $("#codePrestataire").val(); + + donnees = 'idDemandederogation='+idDemandederogation+'&motifReel='+motifReel+'&motifRefusAssure='+motifRefusAssure+'&codePrestataire='+codePrestataire; + + donnees_sav = donnees; + typeMail='refusderogation'; + typeSms="refusderogation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/enregistrerrefusderogation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + preparesms(typeSms); + }, + complete: function() { + + v_msg="Refus envoyé avec succès!"; + v_msgEng="Disagreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_derogations(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function enregistreraccordderogation_2() +{ + idDemandederogation = $("#idDemandederogation").val(); + motifReel = $("#motifReel").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + codeDerogation = $("#codeDerogation").val(); + tmDerogation = $("#tmDerogation").val(); + tmDerogation = parseInt(tmDerogation); + + codePrestataire = $("#codePrestataire").val(); + + if (motifReel<=" ") + { + v_msg="Veuillez saisir le motif!"; + v_msgEng="Please enter the reason!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReel").focus(); + return; + } + + var td0 = $("#datejourfr_C").datepicker("getDate"); + var td1 = $("#debut").datepicker("getDate"); + var td2 = $("#fin").datepicker("getDate"); + + dt0=Math.round(Date.parse(td0)/(1000*3600*24)); + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + + if (dt0>dt1 || dt1>dt2) + { + v_msg="Veuillez revoir les dates!"; + v_msgEng="Please review the dates!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + v_msg="Confirmez-vous cet accord?"; + v_msgEng="Do you confirm this agreement?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'idDemandederogation='+idDemandederogation+'&motifReel='+motifReel+'&debut='+debut+'&fin='+fin; + donnees += '&codeDerogation='+codeDerogation+'&tmDerogation='+tmDerogation+'&codePrestataire='+codePrestataire; + + donnees_sav = donnees; + typeMail='accordderogation'; + typeSms = "accordderogation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/enregistreraccordderogation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + preparesms(typeSms); + }, + complete: function() { + + v_msg="Accord envoyé avec succès!"; + v_msgEng="Agreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_derogations(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function liste_derogations() +{ + window.location.assign($("#racineWeb" ).val()+"Listederogations/"); +} + +function prestations() +{ + if ($("#idBeneficiaire_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Prestations/"+$("#idBeneficiaire_C" ).val()+"/"); + }else{ + + window.location.assign($("#racineWeb" ).val()+"Rechercheprestations/"); + } +} + +function dossiers() +{ + window.location.assign($("#racineWeb" ).val()+"Dossiers/"); +} + +function factures() +{ + window.location.assign($("#racineWeb" ).val()+"Factures/"); +} + +function listerdossier() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + + $("#div_dossiers").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdossiers/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_dossiers").html(data); + }, + complete: function() { + } + }); +} + +function selectionner_feuille_maladie(no) +{ + $("#numeroFeuilleMaladie_C" ).val(no); +} + +function selectionner_facture(idFacture) +{ + $("#idFacture_C" ).val(idFacture); +} + +function afficher_feuille_maladie() +{ + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C" ).val(); + + if (numeroFeuilleMaladie>"") + { + ajax_context_feuille_maladie_afficher(numeroFeuilleMaladie); + } +} + +function ajax_context_feuille_maladie_afficher(numeroFeuilleMaladie) +{ + donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfeuillemaladie/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Feuillemaladiecons/"); + } + }); +} + +function afficher_facture() +{ + idFacture=$("#idFacture_C" ).val(); + + if (idFacture>"") + { + ajax_context_facture_afficher(idFacture); + } +} + +function ajax_context_facture_afficher(idFacture) +{ + donnees = 'idFacture='+idFacture; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfacture/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Facture/"); + } + }); +} + +function listerfacture() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + + $("#div_dossiers").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactures/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_dossiers").html(data); + }, + complete: function() { + } + }); +} + +function sinistres() +{ + adminDiv = $("#adminDiv").val(); + + if (adminDiv!="1") + { + v_msg="Accès refusé!"; + v_msgEng="Access denied!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Rechercheprestations/"); +} + + +function afficher_pharmacie(numeroBonOrdonnance, codePrestataireLivraison, prestataireLivraison) +{ + /*facture = $("#facture").val(); + + if(facture=="0"){ + v_msg="Non facturé!"; + v_msgEng="Not billed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + donnees = 'numeroBonOrdonnance='+numeroBonOrdonnance+'&codePrestataireLivraison='+codePrestataireLivraison; + donnees += '&prestataireLivraison='+prestataireLivraison; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextpharmaciencien/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Pharmaciencons/"); + } + }); +} + +function afficher_optique(numeroBonOptique, codePrestataireLivraison) +{ + donnees = 'numeroBonOptique='+numeroBonOptique+'&codePrestataireLivraison='+codePrestataireLivraison; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextopticien/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Opticiencons/"); + } + }); +} + +function fraisfuneraire() +{ + window.location.assign($("#racineWeb" ).val()+"Fraisfuneraire/"); +} + + +function demanderfraisfuneraire() +{ + fraisFuneraireDemande=$("#fraisFuneraireDemande_C").val(); + + if (fraisFuneraireDemande==1) + { + v_msg="Déjà effectuée!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Demandefraisfuneraire/"); +} + + +function modifierdemanderfraisfuneraire() +{ + fraisFuneraireDemande=$("#fraisFuneraireDemande_C").val(); + fraisFunerairePaye=$("#fraisFunerairePaye_C").val(); + + if (fraisFuneraireDemande!=1) + { + v_msg="Aucune demande en cours!"; + v_msgEng="No request in progress!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (fraisFunerairePaye==1) + { + v_msg="Déjà payé!"; + v_msgEng="Already paid!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + demandeReglement=$("#demandeReglement").val(); + demandeReglement = parseInt(demandeReglement); + + if (demandeReglement==1) + { + v_msg="Déjà effectuée!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Modifierfraisfuneraire/"); +} + + +function payerfraisfuneraire() +{ + fraisFuneraireDemande=$("#fraisFuneraireDemande_C").val(); + fraisFunerairePaye=$("#fraisFunerairePaye_C").val(); + + if (fraisFuneraireDemande!=1) + { + v_msg="Aucune demande en cours!"; + v_msgEng="No request in progress!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + demandeReglement=$("#demandeReglement").val(); + demandeReglement = parseInt(demandeReglement); + + if (demandeReglement==0) + { + v_msg="Aucune Demande de Règlement!"; + v_msgEng="No request in progress!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (fraisFunerairePaye==1) + { + v_msg="Déjà payé!"; + v_msgEng="Already paid!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Payerfraisfuneraire/"); +} + +function enregistrerdemandefraisfuneraire() +{ + enVigueur=$("#enVigueur_C").val(); + codeEtatBeneficiaire=$("#codeEtatBeneficiaire_C").val(); + etatbeneficiaire=$("#etatbeneficiaire_C").val(); + + if (enVigueur!="1") + { + v_msg="Attention! cette personne n'est pas en vigueur,"; + v_msgEng="Warning! This person is not in force,"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (codeEtatBeneficiaire!="V") + { + v_msg="Attention! "+etatbeneficiaire; + v_msgEng="Warning! "+etatbeneficiaire; + alert_ebene(v_msg, v_msgEng); + + return; + } + + demandeur = $("#demandeur").val(); + codeLienDemandeur = $("#codeLienDemandeur").val(); + + causeDeces = $("#causeDeces").val(); + dateDeces=$("#dateDeces").val(); + + beneficiaireReglement = $("#beneficiaireReglement").val(); + codeLienBeneficiaire = $("#codeLienBeneficiaire").val(); + + observations = $("#observations").val(); + fraisReel = $("#fraisReel").val(); + montantApayer = $("#montantApayer").val(); + + codeModePaiementDemande = $("#codeModePaiementDemande").val(); + codeBanqueBeneficiaire = $("#codeBanqueBeneficiaire").val(); + numeroCompteBeneficiaire = $("#numeroCompteBeneficiaire").val(); + + + if (demandeur<=" ") + { + v_msg="Veuillez saisir le nom du demandeur!"; + v_msgEng="Please enter the name of the payment requestor"; + alert_ebene(v_msg, v_msgEng); + + $("#demandeur").focus(); + return; + } + + if (codeLienDemandeur<=" ") + { + v_msg="Veuillez sélectionner le lien de parenté avec le demandeur!"; + v_msgEng="Please select the relationship with the requestor!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienDemandeur").focus(); + return; + } + + if (causeDeces<=" ") + { + v_msg="Veuillez saisir la cause du décès!"; + v_msgEng="Please enter the cause of death"; + alert_ebene(v_msg, v_msgEng); + + $("#causeDeces").focus(); + return; + } + + if (dateDeces<=" ") + { + v_msg="Veuillez saisir la date du décès!"; + v_msgEng="Please enter the date of death!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateDeces").focus(); + return; + } + + if (beneficiaireReglement<=" ") + { + v_msg="Veuillez saisir le nom du bénéficiaire du règlement!"; + v_msgEng="Please enter the name of the payee!"; + alert_ebene(v_msg, v_msgEng); + + $("#beneficiaireReglement").focus(); + return; + } + + if (codeLienBeneficiaire<=" ") + { + v_msg="Veuillez sélectionner le lien avec le bénéficiaire du règlement!"; + v_msgEng="Please select the relationship with the payee!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienBeneficiaire").focus(); + return; + } + + if(montantApayer<=" ") + { + montantApayer = "0"; + } + + if(montantApayer==0) + { + v_msg="Veuillez revoir le montant!"; + v_msgEng="Please review the amount!"; + alert_ebene(v_msg, v_msgEng); + + $("#montantApayer").focus(); + + return; + } + + + if (codeModePaiementDemande<=" ") + { + v_msg="Veuillez sélectionner le mode de paiement!"; + v_msgEng="Please select the payment method!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeModePaiementDemande").focus(); + return; + } + + if (codeModePaiementDemande=="VR") + { + if (codeBanqueBeneficiaire<=" ") + { + v_msg="Veuillez sélectionner la banque du bénéficiaire!"; + v_msgEng="Please select the beneficiary\'s bank!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeBanqueBeneficiaire").focus(); + return; + } + + if (numeroCompteBeneficiaire<=" ") + { + v_msg="Veuillez saisir le No de compte du bénéficiaire!"; + v_msgEng="Please enter the beneficiary\'s account number"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroCompteBeneficiaire").focus(); + return; + } + } + + dateEffetPolice = $("#dateEffetPolice_C").val(); + dateEcheancePolice = $("#dateEcheancePolice_C").val(); + // var td0 = new Date(dateEffetPolice); + dateEntreeBeneficiaire= $("#dateEntreeBeneficiaire_C").val(); + + + var td0 = $("#datejourfr_C").datepicker("getDate");//new Date(dateEntreeBeneficiaire); + var td1 = $("#dateDeces").datepicker("getDate"); + var td2 = $("#datejourfr_C").datepicker("getDate"); + var td3 = $("#datejourfr_C").datepicker("getDate");//new Date(dateEcheancePolice); + + dt0=Math.round(Date.parse(td0)/(1000*3600*24)); + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + dt3=Math.round(Date.parse(td3)/(1000*3600*24)); + + if (dt1>dt2) + { + v_msg="Veuillez revoir la date!"; + v_msgEng="Please review the date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateDeces").focus(); + return; + } + + if (dt1>dt3 || dt1dt3) + { + v_msg="Attention! cette police n'est pas couverte à cette date!"; + v_msgEng="Warning! This insurance policy is not valid on this date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette demande de frais funéraires?"; + v_msgEng="Do you confirm this request for funeral fees?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'demandeur='+demandeur+'&codeLienDemandeur='+codeLienDemandeur; + donnees += '&beneficiaireReglement='+beneficiaireReglement+'&codeLienBeneficiaire='+codeLienBeneficiaire; + donnees += '&fraisReel='+fraisReel+'&montantApayer='+montantApayer; + donnees += '&causeDeces='+causeDeces+'&dateDeces='+dateDeces; + donnees += '&observations='+observations; + + donnees += '&codeModePaiementDemande='+codeModePaiementDemande; + donnees += '&codeBanqueBeneficiaire='+codeBanqueBeneficiaire+'&numeroCompteBeneficiaire='+numeroCompteBeneficiaire; + + donnees_sav = donnees; + + typeMail='fraisfuneraire'; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerdemandefraisfuneraire/enregistrerdemandefraisfuneraire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + v_msg="Opération effectuée avec succès!"; + v_msgEng="Operation successfully completed"; + alert_ebene(v_msg, v_msgEng); + }, + complete: function() { + fraisfuneraire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function listerfraisfuneraires() +{ +} + +function enregistrermodificationsfraisfuneraire() +{ + + idFraisfuneraire = $("#idFraisfuneraire").val(); + + demandeur = $("#demandeur").val(); + codeLienDemandeur = $("#codeLienDemandeur").val(); + + causeDeces = $("#causeDeces").val(); + dateDeces=$("#dateDeces").val(); + + beneficiaireReglement = $("#beneficiaireReglement").val(); + codeLienBeneficiaire = $("#codeLienBeneficiaire").val(); + + observations = $("#observations").val(); + fraisReel = $("#fraisReel").val(); + montantApayer = $("#montantApayer").val(); + + codeModePaiementDemande = $("#codeModePaiementDemande").val(); + codeBanqueBeneficiaire = $("#codeBanqueBeneficiaire").val(); + numeroCompteBeneficiaire = $("#numeroCompteBeneficiaire").val(); + + if (demandeur<=" ") + { + v_msg="Veuillez saisir le nom du demandeur!"; + v_msgEng="Please enter the name of the payment requestor"; + alert_ebene(v_msg, v_msgEng); + + $("#demandeur").focus(); + return; + } + + if (codeLienDemandeur<=" ") + { + v_msg="Veuillez sélectionner le lien de parenté avec le demandeur!"; + v_msgEng="Please select the relationship with the requestor!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienDemandeur").focus(); + return; + } + + if (causeDeces<=" ") + { + v_msg="Veuillez saisir la cause du décès!"; + v_msgEng="Please enter the cause of death"; + alert_ebene(v_msg, v_msgEng); + + $("#causeDeces").focus(); + return; + } + + if (dateDeces<=" ") + { + v_msg="Veuillez saisir la date du décès!"; + v_msgEng="Please enter the date of death!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateDeces").focus(); + return; + } + + if (beneficiaireReglement<=" ") + { + v_msg="Veuillez saisir le nom du bénéficiaire du règlement!"; + v_msgEng="Please enter the name of the payee!"; + alert_ebene(v_msg, v_msgEng); + + $("#beneficiaireReglement").focus(); + return; + } + + if (codeLienBeneficiaire<=" ") + { + v_msg="Veuillez sélectionner le lien avec le bénéficiaire du règlement!"; + v_msgEng="Please select the relationship with the payee!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienBeneficiaire").focus(); + return; + } + + if (codeModePaiementDemande<=" ") + { + v_msg="Veuillez sélectionner le mode de paiement!"; + v_msgEng="Please select the payment method!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeModePaiementDemande").focus(); + return; + } + + if (codeModePaiementDemande=="VR") + { + if (codeBanqueBeneficiaire<=" ") + { + v_msg="Veuillez sélectionner la banque du bénéficiaire!"; + v_msgEng="Please select the beneficiary\'s bank!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeBanqueBeneficiaire").focus(); + return; + } + + if (numeroCompteBeneficiaire<=" ") + { + v_msg="Veuillez saisir le No de compte du bénéficiaire!"; + v_msgEng="Please enter the beneficiary\'s account number"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroCompteBeneficiaire").focus(); + return; + } + } + + + if(montantApayer<=" ") + { + montantApayer = "0"; + } + + if(montantApayer==0) + { + v_msg="Veuillez revoir le montant!"; + v_msgEng="Please review the amount!"; + alert_ebene(v_msg, v_msgEng); + + $("#montantApayer").focus(); + + return; + } + + dateEffetPolice = $("#dateEffetPolice_C").val(); + dateEcheancePolice=$("#dateEcheancePolice_C").val(); + + // var td0 = new Date(dateEffetPolice); + dateEntreeBeneficiaire= $("#dateEntreeBeneficiaire_C").val(); + + var td0 = $("#dateEntreeBeneficiaire").datepicker("getDate");//new Date(dateEntreeBeneficiaire); + var td1 = $("#dateDeces").datepicker("getDate"); + var td2 = $("#datejourfr_C").datepicker("getDate"); + var td3 = $("#dateEcheancePolice").datepicker("getDate");//new Date(dateEcheancePolice); + + dt0=Math.round(Date.parse(td0)/(1000*3600*24)); + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + dt3=Math.round(Date.parse(td3)/(1000*3600*24)); + + if (dt1>dt2) + { + v_msg="Veuillez revoir la date de consultation!"; + v_msgEng="Please review the date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (dt1>dt3 || dt1dt3) + { + v_msg="Attention! cette police n'est pas couverte à cette date!"; + v_msgEng="Warning! This insurance policy is not valid on this date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ces modifications?"; + v_msgEng="Do you confirm these modifications?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'demandeur='+demandeur+'&codeLienDemandeur='+codeLienDemandeur; + donnees += '&beneficiaireReglement='+beneficiaireReglement+'&codeLienBeneficiaire='+codeLienBeneficiaire; + donnees += '&fraisReel='+fraisReel+'&montantApayer='+montantApayer; + donnees += '&causeDeces='+causeDeces+'&dateDeces='+dateDeces; + donnees += '&observations='+observations+'&idFraisfuneraire='+idFraisfuneraire; + + donnees += '&codeModePaiementDemande='+codeModePaiementDemande; + donnees += '&codeBanqueBeneficiaire='+codeBanqueBeneficiaire+'&numeroCompteBeneficiaire='+numeroCompteBeneficiaire; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerdemandefraisfuneraire/enregistrermodificationsfraisfuneraire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + v_msg="Modifications effectuées avec succès!"; + v_msgEng="Changes made successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + complete: function() { + fraisfuneraire() + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function initierdecompte() +{ + codePeriodeMax = $("#codePeriodeMax").val(); + + codePrestataire=$("#codePrestataire").val(); + codeExercice=$("#codeExercice").val(); + codeMois=$("#codeMois").val(); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + return; + } + + if (codeExercice<=" ") + { + v_msg="Veuillez sélectionner un exercice!"; + v_msgEng="Please select an exercise!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeExercice").focus(); + return; + } + + if (codeMois<=" ") + { + v_msg="Veuillez sélectionner une période!"; + v_msgEng="Please select a period!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeMois").focus(); + return; + } + + codePeriodeCourant = codeExercice+codeMois; + + if (codePeriodeCourant>codePeriodeMax) + { + v_msg="Mois non encore entamé!"; + v_msgEng="Month not yet started!"; + alert_ebene(v_msg, v_msgEng); + return; + + $("#codeMois").focus(); + return; + } + + donnees = 'codePrestataire='+codePrestataire+'&codeExercice='+codeExercice+'&codeMois='+codeMois; + + var div_wait = $('#div_wait'); + div_wait.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/initierdecompte/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#inforegle").html(data); + }, + complete: function() { + regle=$("#regle").val(); + + if(regle==-1) + { + v_msg="Problème lors de l\'initialisation!"; + v_msgEng="Problem during initialization!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + else if(regle==0 || regle==2 || regle==3 || regle==8) + { + afficherdecompte(); + } + else + { + // 9 => Décompte validé mais en attente de règlemen + // 1 => Décompte réglé + consulterdecompte(); + } + } + }); +} + +function liste_decompte() +{ + window.location.assign($("#racineWeb" ).val()+"Listedecomptes/"); +} + +function decompte() +{ + window.location.assign($("#racineWeb" ).val()+"Initdecompte/"); +} + +function afficherdecompte() +{ + window.location.assign($("#racineWeb" ).val()+"Decompte/"); +} + +function re_afficherdecompte() +{ + $("#detail_reglement").html('
' + '
'); + + window.location.assign($("#racineWeb" ).val()+"Decompte/"); +} + +function rechargerfacture() +{ + $("#detail_reglement").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/rechargerfacture/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + afficherdecompte(); + }, + complete: function() { + } + }); +} + +function reinitialiserdecompte() +{ +/* +0 Décompte en cours +2 Attente Valid. prestat. / Waiting for provider s valid. +3 Validé par le prestataire +8 Pas besoin de valid prestat / Provid valid not needed +9 En attente de règelment +1 Réglé / Payé +*/ + + // Ajout du 26/03/2025 => KANE => Pour empêcher de réinitilider un décompte déjà validé + regle=$("#regle").val(); + regle = parseInt(regle); + + //if (regle==0) + if (regle!=0 && regle!=2) + { + v_msg="Impossible de réinitialiser!"; + v_msgEng="Unable to reset!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + // Fin Ajout du 26/03/2025 KANE + + v_msg="Remettre le décompte à zéro. Confirmez-vous cette opération?"; + v_msgEng="Reset the counts. Do you confirm this operation?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#detail_reglement").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/reinitialiserdecompte/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + afficherdecompte(); + }, + complete: function() { + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function afficher_feuille_maladie_dec() +{ + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + + if (numeroFeuilleMaladie>"") + { + ajax_context_feuille_maladie_afficher_dec(numeroFeuilleMaladie); + } +} + +function ajax_context_feuille_maladie_afficher_dec(numeroFeuilleMaladie) +{ + donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfeuillemaladie/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Feuillemaladiedec/"); + } + }); +} + +function afficher_optique_dec(numeroBonOptique, codePrestataireLivraison) +{ + donnees = 'numeroBonOptique='+numeroBonOptique+'&codePrestataireLivraison='+codePrestataireLivraison; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextopticien/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Opticiendec/"); + } + }); +} + +function afficher_pharmacie_dec(numeroBonOrdonnance, codePrestataireLivraison) +{ + donnees = 'numeroBonOrdonnance='+numeroBonOrdonnance+'&codePrestataireLivraison='+codePrestataireLivraison; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextpharmaciencien/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Pharmaciendec/"); + } + }); +} + +function maj_montantForce(idFacture, montantForce) +{ + donnees = 'idFacture='+idFacture+"&montantForce="+montantForce; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxentetedecompte/majmontantforce/", + type: 'POST', + data: donnees, + success: function(data) { + $("#reglement").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + + +function afficherfacturenoncharge() +{ +} + +function afficherfactureattente() +{ +} + +function valider_facture(idFacture, numeroFeuilleMaladie, p_choix, codeTypeFacture) +{ + donnees = 'idFacture='+idFacture+'&choix='+p_choix+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&codeTypeFacture='+codeTypeFacture; + + var ctrl_montantForce = $("#montantForce"+idFacture); + var ctrl_montantApayer = $("#montantApayer"+idFacture); + var ctrl_montantRedresse = $("#montantRedresse"+idFacture); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxvaliderfacture/validerfacture/", + type: 'POST', + data: donnees, + success: function(data) { + $("#reglement").html(data); + + montantForce_val = $("#montantForce_val").val(); + montantApayer_val = $("#montantApayer_val").val(); + montantRedresse_val = $("#montantRedresse_val").val(); + montantRedresse_sans_format = $("#montantRedresse_sans_format").val(); + observations_val = $("#observations_val").val(); + + ctrl_montantForce.html(montantForce_val); + + c_html = " "; + + ctrl_montantApayer.html(c_html); + + ctrl_montantRedresse.html(montantRedresse_val); + }, + error: function(data) { + }, + complete: function() + { + // alert("p_choix2 => "+p_choix); + if((p_choix=="9")){ + init_maj_detail_rejet_decompte(idFacture); + } + + /* if ( (montantRedresse_sans_format!=0) && (observations_val<=" ") || (p_choix=="2")) + { + maj_observations_facture(idFacture, observations_val); + } */ + } + }); +} + +function maj_observations_facture(idFacture, observations) +{ + let v_msg = "Veuillez saisir ou modifier les observations!"; + let v_msgEng = "Please enter or edit comments!"; + + prompt_ebene(v_msg, v_msgEng, "", function(observations) { + + if(observations==null) + { + return; + } + + v_msg="Confirmez-vous ces modifications?"; + v_msgEng="Do you confirm these modifications?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + let donnees = 'idFacture='+idFacture; + donnees += "&observations="+encodeURIComponent(observations); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/majobservations/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + }); + +} + +function afficher_div_wait() +{ + $("#div_wait").html('
' + '
'); +} + +function effacer_div_wait() +{ + $("#div_wait").html(""); +} + +function rechercheprestations_form() +{ + $("#frmrechercheprestation").submit(); +} + +function consulterdecompte() +{ + // detail_reglement + var div_wait = $('#detail_reglement'); + div_wait.html('
' + '
'); + + window.location.assign($("#racineWeb" ).val()+"Decomptecons/"); +} + + +function maj_bordereau_decompte(idReglement, numeroBordereau) +{ + let v_msg = "Veuillez saisir ou modifier le No de bordereau!"; + let v_msgEng = "Please enter or modify the slip number!"; + + prompt_ebene(v_msg, v_msgEng, "", function(numeroBordereau) { + if(numeroBordereau==null) + { + return; + } + + v_msg="Confirmez-vous ces modifications?"; + v_msgEng="Do you confirm these modifications?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + let donnees = 'idReglement='+idReglement; + donnees += "&numeroBordereau=" + encodeURIComponent(numeroBordereau); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/majbordereaudecompte/", + type: 'POST', + data: donnees, + success: function(data) { + $("#numeroBordereauDecompte").val(numeroBordereau); + }, + error: function(data) { + }, + complete: function() { + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + }); + +} + +function validerdecompte_premier() +{ +/* +0 Décompte en cours + +2 Attente Valid. prestat. / Waiting for provider s valid. + +3 Validé par le prestataire + +8 Pas besoin de valid prestat / Provid valid not needed + +9 En attente de règelment + +1 Réglé / Payé +*/ + datejour_C=$("#datejour_C").val(); + datejour_C = datejour_C.substring(0, 7) + codePerdiodeLong=$("#codePerdiodeLong").val(); + + if (codePerdiodeLong>=datejour_C) + { + v_msg="Impossible de valider un mois non terminé!"; + v_msgEng="Unable to validate an unfinished month!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + regle=$("#regle").val(); + regle = parseInt(regle); + + if (regle>0) + { + v_msg="1ère validation déjà effectuée!"; + v_msgEng="1st validation already done!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if ($("#montantApayer").val()<="0") + { + v_msg="Rien à valider!"; + v_msgEng="Nothing to validate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nbNonTraite = $("#nbNonTraite").val(); + if (nbNonTraite!="0") + { + v_msg="Vous avez "+nbNonTraite+" facture(s) non traitée(s)!"; + v_msgEng="You have "+nbNonTraite+" bill(s) not processed!"; + + alert_ebene(v_msg, v_msgEng); + + return; + } + + reclamationPrestataireObligatoire = $("#reclamationPrestataireObligatoire").val(); + montantPrestataire = $("#montantPrestataire").val(); + if (reclamationPrestataireObligatoire=="1" && montantPrestataire<="0") + { + v_msg="Veuillez indiquer le montant réclamé par le prestataire! => Réception facture"; + v_msgEng="Please indicate the amount claimed by the provider! => Invoice receipt"; + alert_ebene(v_msg, v_msgEng); + + $('#btn_pop_reception').click(); + + return; + } + + nbExclues = $("#nbExclues").val(); + if (nbExclues<="0") + { + v_msg="Confirmez-vous qu'il n'y a pas de factures à exclure?"; + v_msgEng="Do you confirm that there are no invoices to exclude?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + return; + } + }); + + } + + v_msg="Confirmez-vous la 1ère validation?"; + v_msgEng="Do you confirm the 1st validation?"; + + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#detail_reglement").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/validerdecomptepremier/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + + prestataire = $("#prestataire").val(); + numeroDecompte = $("#numeroDecompte").val(); + numeroLotDecompte = $("#numeroLotDecompte").val(); + periode = $("#periode").val(); + + + p_message = prestataire+" "; + + p_message += "\n"; + p_message += "Decompte : Attente Valid. prestat. / Waiting for provider valid."; + + p_message += "\n"; + p_message += "Periode : "+periode; + + p_message += "\n"; + p_message += "No Decompte : "+numeroDecompte; + + p_message += "\n"; + p_message += "No Lot : "+numeroLotDecompte; + + envoyer_messagerie(p_message, "0"); + }, + complete: function() + { + v_msg="Validation terminée avec succès!"; + v_msgEng="Validation successfully completed"; + alert_ebene(v_msg, v_msgEng); + + afficherdecompte(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function validerdecompte() +{ +/* +0 Décompte en cours + +2 Attente Valid. prestat. / Waiting for provider s valid. + +3 Validé par le prestataire + +8 Pas besoin de valid prestat / Provid valid not needed + +9 En attente de règelment + +1 Réglé / Payé +*/ + + regle=$("#regle").val(); + regle = parseInt(regle); + + if (regle==0) + { + v_msg="Veuillez procéder à la 1ère validation!"; + v_msgEng="Please proceed to the 1st validation!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (regle==2) + { + v_msg="En attente de la validation du prestataire!"; + v_msgEng="Waiting for the validation of the provider!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if ($("#montantApayer").val()<="0") + { + v_msg="Rien à valider!"; + v_msgEng="Nothing to validate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if ( (regle==3) || (regle==8) ) + { + v_msg="Confirmez-vous la 2ème validation?"; + v_msgEng="Do you confirm the 2nd validation?"; + + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#detail_reglement").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/validerdecompte/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() + { + v_msg="Validation terminée avec succès!"; + v_msgEng="Validation successfully completed"; + alert_ebene(v_msg, v_msgEng); + + consulterdecompte(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + } +} + +function afficher_div_wait() +{ + $("#div_page_complet").disable(); +} + +function effacer_div_wait() +{ + $("#div_wait").html(""); +} + + +function imprimerbordereaudecompte() +{ + idReglement = $("#idReglement").val(); + + if (idReglement>"0") + { + var div_wait = $('#div_wait'); + div_wait.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerdemandereglement/imprimerbordereaudecompte", + type: 'POST', + success: function(data) + { + div_wait.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); + } +} + +/* +function activePrestataire(){ + var codeTypeTarifActe = $('#codeTypeTarifActe').val(); + + //alert(codeTypeTarifActe); + + if(codeTypeTarifActe=="TCE" ){ + $('#codePrestataire').removeAttr('disabled'); + }else{ + $('#codePrestataire').attr('disabled', 'disabled'); + } +} +*/ + +function reglerdecompte() +{ +/* +0 Décompte en cours + +2 Attente Valid. prestat. / Waiting for provider s valid. + +3 Validé par le prestataire + +8 Pas besoin de valid prestat / Provid valid not needed + +9 En attente de règelment + +1 Réglé / Payé +*/ + + demandeReglement=$("#demandeReglement").val(); + demandeReglement = parseInt(demandeReglement); + + if (demandeReglement==0) + { + v_msg="Aucune Demande de Règlement!"; + v_msgEng="No request in progress!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + regle=$("#regle").val(); + + if (regle==1) + { + v_msg="Déjà réglé!"; + v_msgEng="Already paid!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Reglerdecompte/"); +} + + +function enregistrerreglementdecompte() +{ + idReglement = $("#idReglement").val(); + dateComptable = $("#dateComptable").val(); + montantPaye = $("#montantPaye").val(); + codeModePaiement = $("#codeModePaiement").val(); + referencePaiement = $("#referencePaiement").val(); + + codeBanquePayeur = $("#codeBanquePayeur").val(); + + if (codeModePaiement<=" ") + { + v_msg="Veuillez sélectionner le mode de paiement!"; + v_msgEng="Please select the payment method!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeModePaiement").focus(); + return; + } + + if (codeBanquePayeur<=" ") + { + v_msg="Veuillez sélectionner la banque de paiement!"; + v_msgEng="Please select the payment bank!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeBanquePayeur").focus(); + return; + } + + if (referencePaiement<=" ") + { + v_msg="Veuillez indiquer la référence du paiement!"; + v_msgEng="Please enter the payment reference!"; + alert_ebene(v_msg, v_msgEng); + + $("#referencePaiement").focus(); + return; + } + + if (dateComptable<=" ") + { + v_msg="Veuillez saisir la date comptable!"; + v_msgEng="Please enter the posting date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateComptable").focus(); + return; + } + + if(montantPaye<=" ") + { + montantPaye = "0"; + } + + if(montantPaye==0) + { + v_msg="Veuillez revoir le montant!"; + v_msgEng="Please review the amount!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ce règelement?"; + v_msgEng="Do you confirm this payment?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'idReglement='+idReglement+'&codeModePaiement='+codeModePaiement; + donnees += '&referencePaiement='+referencePaiement+'&montantPaye='+montantPaye; + donnees += '&dateComptable='+dateComptable; + donnees += '&codeBanquePayeur='+codeBanquePayeur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/enregistrerreglementdecompte/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + consulterdecompte(); + }, + complete: function() { + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function preparesms(typeSms) +{ + + envoismsactif = $("#envoismsactif").val(); + if(envoismsactif=="0") + { + return; + } + + codeLangueSociete = $("#codeLangueSociete").val(); + + p_destinataires = ""; + p_message = ""; + creation_message = "1"; + + if (typeSms=="accordderogation") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroDerogation = $("#numeroDerogation").val(); + libelleDerogation = $("#libelleDerogation").val(); + tmDerogation = $("#tmDerogation").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Exemption granted for : " : "Derogation accordee pour : "; + p_message += libelleDerogation; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroDerogation; + } + + if (typeSms=="refusderogation") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroDerogation = $("#numeroDerogation").val(); + libelleDerogation = $("#libelleDerogation").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Exemption refused for : " : "Derogation refusee pour : "; + p_message += libelleDerogation; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroDerogation; + } + + if (typeSms=="accordententeprealable") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleActe = $("#libelleActe").val(); + motifReel = $("#motifReel").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += "Instruction : "+motifReel+" "; + p_message += "\n"; + + + p_message += (codeLangueSociete=="en_US") ? "Act granted : " : "Acte accorde : "; + p_message += libelleActe; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="refusententeprealable") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleActe = $("#libelleActe").val(); + motifReel = $("#motifReel").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + + p_message += "Motif de refus : "+motifReel+" "; + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Act refused : " : "Acte refuse : "; + p_message += libelleActe; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="refusacteexclu") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroAutorisation = $("#numeroAutorisation").val(); + libelleActe = $("#libelleActe").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + p_message += "Acte refuse : "+libelleActe+" "; + p_message += "\n"; + p_message += "No demande : "+numeroAutorisation; + } + + if (typeSms=="accordacteexclu") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroAutorisation = $("#numeroAutorisation").val(); + libelleActe = $("#libelleActe").val(); + + prixTarif = $("#prixTarif").val(); + valeurActe = $("#valeurActe").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + p_message += "Acte accorde : "+libelleActe+" "; + p_message += "\n"; + + p_message +="Tarif convention : "+prixTarif+" FRW "; + p_message +="Tarif accorde : "+valeurActe+" FRW "; + + p_message += "No demande : "+numeroAutorisation; + } + + if (typeSms=="accordententeprealablepha") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleMedicament = $("#libelleMedicament").val(); + motifReel = $("#motifReel").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Drug granted : " : "Medicament accorde : "; + p_message += libelleMedicament; + p_message += "\n"; + p_message += "Instruction : "+motifReel+" "; + + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + + if (typeSms=="refusententeprealablepha") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleMedicament = $("#libelleMedicament").val(); + motifReel = $("#motifReel").val(); + + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Drug refused : " : "Medicament refuse : "; + p_message += libelleMedicament; + + p_message += "\n"; + p_message += "Motif de refus : "+motifReel+" "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="accordententeprealableopt") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleOptique = $("#libelleOptique").val(); + motifReel = $("#motifReel").val(); + + + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Glasses granted : " : "Verres accordes : "; + p_message += libelleOptique; + + p_message += "\n"; + p_message += "Instruction : "+motifReel+" "; + + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="refusententeprealableopt") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleOptique = $("#libelleOptique").val(); + motifReel = $("#motifReel").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Glasses refused : " : "Verres refuses : "; + p_message += libelleOptique; + + p_message += "\n"; + p_message += "Motif de refus : "+motifReel+" "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="accordententeprealablemont") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Optical frame : granted" : "Monture accordee"; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="refusententeprealablemont") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Optical frame : refused" : "Monture refuse"; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="accordsubstitutionpha") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroDemandeSubstitution = $("#numeroDemandeSubstitution").val(); + nomPrescrit = $("#nomPrescrit").val(); + libelleSubstitut = $("#libelleSubstitut").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Substitution granted : " : "Substitution accorde : "; + p_message += nomPrescrit+" => "+libelleSubstitut; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroDemandeSubstitution; + } + + + if (typeSms=="refussubstitutionpha") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroDemandeSubstitution = $("#numeroDemandeSubstitution").val(); + nomPrescrit = $("#nomPrescrit").val(); + libelleSubstitut = $("#libelleSubstitut").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Substitution refused : " : "Substitution refuse : "; + p_message += nomPrescrit+" => "+libelleSubstitut; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroDemandeSubstitution; + } + + if (typeSms=="proformahospitalisation") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + idProforma = $("#idProforma").val(); + numeroBonHospitalisation= $("#numeroBonHospitalisation").val(); + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifRefusAssure").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Assuré : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + if(numeroBonHospitalisation > "0") + { + p_message += "Observation : "+motifReel+" "; + p_message += "\n"; + } + + if(motifRefusAssure > " ") + { + p_message += "Refus : "+motifRefusAssure+" "; + p_message += "\n"; + } + + if(numeroBonHospitalisation > "0") + { + p_message += (codeLangueSociete=="en_US") ? "Agreement for hospitalization Proforma Number : " : "Accord pour hospitalisation Proforma No : "; + p_message += idProforma; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Voucher number : " : "No Bon : "; + p_message += numeroBonHospitalisation; + }else{ + p_message += (codeLangueSociete=="en_US") ? "refusal Proforma Number : " : "Refus Proforma No : "; + p_message += idProforma; + } + } + + envoyersms(p_destinataires, p_message, creation_message); +} + + +function liste_ententeprealables() +{ + retour = $("#retour").val(); + + if(retour==undefined){ + window.location.assign($("#racineWeb" ).val()+"Listeententeprealables/"); + }else{ + window.location.assign($("#racineWeb" ).val()+retour+"/"); + } +} + +function liste_actes_exclus() +{ + window.location.assign($("#racineWeb" ).val()+"Listeexclusions/"); +} + +function listeententeprealables() { + + + codePrestataire = $("#codePrestataire").val(); + + if(codePrestataire==undefined || codePrestataire=="undefined") + { + codePrestataire=""; + } + codeReponseEntentePrealable = $("#codeReponseEntentePrealable").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + donnees = 'codePrestataire=' + codePrestataire + '&codeReponseEntentePrealable=' + codeReponseEntentePrealable; + donnees += '&debut=' + debut + '&fin=' + fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + //url: $("#racineWeb").val() + "Ajaxententeprealables/", + url: $("#racineWeb").val() + "Ajaxententeprealables/entetesentente/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + $("#div_ententeprealable").html(data); + + + }, + complete: function () { + } + }); +} + + + + + +function accepter_ententeprealable_2(idDemandeententeprealable, facture) +{ + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb" ).val()+"Accepterententeprealables/"+idDemandeententeprealable+"/"); +} + +function refuser_ententeprealable_2(idDemandeententeprealable, facture) +{ + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb" ).val()+"Refuserententeprealables/"+idDemandeententeprealable+"/"); +} + +// + +function accepter_ententeprealable(idDemandeententeprealable, facture) +{ + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb" ).val()+"Accepterententeprealable/"+idDemandeententeprealable+"/"); +} + +function refuser_ententeprealable(idDemandeententeprealable, facture) +{ + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb" ).val()+"Refuserententeprealable/"+idDemandeententeprealable+"/"); +} + +function liste_ententeprealable_beneficiaire() +{ + window.location.assign($("#racineWeb" ).val()+"Listeententeprealablesbenficiaire/"); +} + +function liste_actes_exclus_beneficiaire() +{ + window.location.assign($("#racineWeb" ).val()+"Listeexclusionsbenficiaire/"); +} + +function enregistreraccordententepreslable_2() +{ + + + idDemandeententeprealable = $("#idDemandeententeprealable").val(); + motifReel = $("#motifReel").val(); + + quantiteModifiee = $("#quantiteModifiee").val(); + quantiteModifieeHospit = $("#quantiteModifieeHospit").val(); + + quantiteHospit = $("#quantiteHospit").val(); + + modeSaisieFeuille = $("#modeSaisieFeuille").val(); + // + //motifReel = "BON POUR ACCORD"; + + if (quantiteModifiee==undefined || quantiteModifiee ==""){ + quantiteModifiee = ""; + } + + if (quantiteModifieeHospit==undefined || quantiteModifieeHospit ==""){ + quantiteModifieeHospit = ""; + } + + if (quantiteHospit==undefined || quantiteHospit ==""){ + quantiteHospit = ""; + } + + if (motifReel == undefined || motifReel == "" || motifReel<=" ") + { + motifReel = "BON POUR ACCORD"; + } + + v_msg="Confirmez-vous cet accord?"; + v_msgEng="Do you confirm this agreement?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + codePrestataire = $("#codePrestataire").val(); + + donnees = 'idDemandeententeprealable='+idDemandeententeprealable + donnees += '&motifReel='+motifReel+'&codePrestataire='+codePrestataire + donnees += '&quantiteModifiee='+quantiteModifiee+'&quantiteModifieeHospit='+quantiteModifieeHospit; + donnees += '&quantiteHospit='+quantiteHospit; + + donnees_sav = donnees; + typeMail="accordententeprealable"; + typeSms = "accordententeprealable"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxententeprealablesbenficiaire/enregistreraccordententeprealable/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + if (modeSaisieFeuille !=1) { + preparesms(typeSms); + } + }, + complete: function() { + + v_msg="Accord envoyé avec succès!"; + v_msgEng="Agreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_ententeprealables(); + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function initbareme(){ + + v_msg="Voulez-vous réinitialiser la zone de sélection du barème?"; + v_msgEng="Do you want to reset the scale selection area?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $('#idBaremePriseEnCharge').append($('