diff --git a/Js/fonctions.js b/Js/fonctions.js index c59741b9..555210c9 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -76736,4 +76736,16344 @@ function inserer_bareme_acte_lienparente_college() codeLienParenteActeLienParente = $("#codeLienParenteActeLienParente").val(); forfaitPlafondActeLienParente = $("#forfaitPlafondActeLienParente").val(); codePeriodicitePlafondActeLienParente = $("#codePeriodicitePlafondActeLienParente").val(); - nbreTransactionActeLienParente = $("#nbreTransactionActeLienParente \ No newline at end of file + nbreTransactionActeLienParente = $("#nbreTransactionActeLienParente").val(); + codePeriodiciteActeLienParente = $("#codePeriodiciteActeLienParente").val(); + codeTypeRemboursementActeLienParente = $("#codeTypeRemboursementActeLienParente").val(); + delaiCarenceActeLienParente = $("#delaiCarenceActeLienParente").val(); + ticketModerateurActeLienParente = $("#ticketModerateurActeLienParente").val(); + ageMinimumActeLienParente = $("#ageMinimumActeLienParente").val(); + ageMaximumActeLienParente = $("#ageMaximumActeLienParente").val(); + actifActeLienParente = $("#actifActeLienParente").val(); + + forfaitTmActeLienParente = $("#forfaitTmActeLienParente").val(); + + forfaitPlafondActeLienParente = forfaitPlafondActeLienParente.replace(/ /g,""); + forfaitTmActeLienParente = forfaitTmActeLienParente.replace(/ /g,""); + + if(codeActeLienParente <=" "){ + + v_msg="Veuillez entrer un acte!"; + v_msgEng="Please enter an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActeLienParente").focus(); + return; + + } + + if(dateEffetActeLienParente <= " "){ + + v_msg="Veuillez entrer une date d'effet!"; + v_msgEng="Please enter an effective date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateEffetActeLienParente").focus(); + return; + + } + + if(codeLienParenteActeLienParente <= " "){ + + v_msg="Veuillez entrer le lien de parenté!"; + v_msgEng="Please enter the relationship!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienParenteActeLienParente").focus(); + return; + + } + + if(actifActeLienParente <= " "){ + + v_msg="Veuillez indiquer le statut de cet barème!"; + v_msgEng="Please indicate the status of this scale!"; + alert_ebene(v_msg, v_msgEng); + + $("#actifActeLienParente").focus(); + return; + + } + + $("#div_actes_lienparente").html('
' + '
'); + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + donnees += '&codeActeLienParente='+codeActeLienParente; + donnees += '&dateEffetActeLienParente='+dateEffetActeLienParente; + donnees += '&codeLienParenteActeLienParente='+codeLienParenteActeLienParente; + donnees += '&forfaitPlafondActeLienParente='+forfaitPlafondActeLienParente; + donnees += '&codePeriodicitePlafondActeLienParente='+codePeriodicitePlafondActeLienParente; + donnees += '&nbreTransactionActeLienParente='+nbreTransactionActeLienParente; + donnees += '&codePeriodiciteActeLienParente='+codePeriodiciteActeLienParente; + + + donnees += '&codeTypeRemboursementActeLienParente='+codeTypeRemboursementActeLienParente; + donnees += '&delaiCarenceActeLienParente='+delaiCarenceActeLienParente; + donnees += '&ticketModerateurActeLienParente='+ticketModerateurActeLienParente; + donnees += '&ageMinimumActeLienParente='+ageMinimumActeLienParente; + donnees += '&ageMaximumActeLienParente='+ageMaximumActeLienParente; + donnees += '&actifActeLienParente='+actifActeLienParente; + + donnees += '&forfaitTmActeLienParente='+forfaitTmActeLienParente; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactelienparentecollege/ajouter/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + intit_saisie_actebareme_lienparente(); + actualiser_bareme_acte_lienparente_college(); + + }, + complete: function() { + afficheNombreLigneBaremeCollege('actesbaremepriseenchargelienparente'); + } + }); +} + +function actualiser_bareme_acte_lienparente_college() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactelienparentecollege/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_actes_lienparente').html(data); + + + }, + complete: function() { + + } + }); + +} + +function supprimer_baremeactelienparente_college(adminProd, idActe) +{ + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactelienparentecollege/supprimer/", + type : 'post', + data: "idActe="+idActe, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_bareme_acte_lienparente_college(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_baremeacte_college(adminProd, idActe) +{ + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactecollege/supprimer/", + type : 'post', + data: "idActe="+idActe, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_bareme_acte_college(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_baremegarantielienparente_college(adminProd, idGarantie) +{ + + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantielienparentecollege/supprimer/", + type : 'post', + data: "idGarantie="+idGarantie, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_bareme_garantie_lienparente_college(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_baremegarantie_college(adminProd,idGarantie) +{ + + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantiecollege/supprimer/", + type : 'post', + data: "idGarantie="+idGarantie, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_bareme_garantie_college(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function actualiser_bareme_garantie_college() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantiecollege/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_garanties_bareme').html(data); + + + }, + complete: function() { + + } + }); + +} + +function afficherDetailBaremeCollegeTemp() +{ + masquerBareme = $("#masquerBareme").val(); + + if(masquerBareme == undefined){ + masquerBareme = "1"; + } + + //alert(masquerGarantie); + + if(masquerBareme=="1"){ + $('#div_bareme').hide(); + $("#masquerBareme").val("0"); + $("#span_bareme").text("[+]"); + + }else{ + $('#div_bareme').show(); + $("#masquerBareme").val("1"); + //$("#dateEffetGarantie").focus(); + $("#span_bareme").text("[-]"); + + init_saisie_detailbareme(); + actualiser_detailbareme_college_temp(); + } + + afficheNombreLigneBaremeCollegeTemp('detailbareme'); +} + +function actualiser_detailbareme_college_temp() +{ + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + donnees = 'idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererdetailbaremecollegetemp/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_bareme').html(data); + + + }, + complete: function() { + + } + }); + +} + +function afficheNombreLigneBaremeCollegeTemp(table) +{ + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnbrelignebaremecollegetemp/"+table+"/", + type : 'post', + data: "table="+table, + error: function(errorData) { + }, + success: function(data) { + if(table=="garantiesbaremepriseencharge"){ + $("#garantiesbaremepriseencharge").html(data); + }else if(table=="garantiesbaremepriseenchargelienparente"){ + $("#garantiesbaremepriseenchargelienparente").html(data); + }else if(table=="actesbaremepriseencharge"){ + $("#actesbaremepriseencharge").html(data); + }else if(table=="actesbaremepriseenchargelienparente"){ + $("#actesbaremepriseenchargelienparente").html(data); + }else if(table=="detailbareme"){ + $("#detailbareme").html(data); + } + }, + complete: function() { + + } + }); +} + +function inserer_bareme_college_temp() +{ + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + dateEffetBareme = $("#dateEffetBareme").val(); + ticketModerateurBareme = $("#ticketModerateurBareme").val(); + //actif = $("#actif").val(); + + if(dateEffetBareme <= " "){ + + v_msg="Veuillez entrer une date d'effet!"; + v_msgEng="Please enter an effective date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateEffetBareme").focus(); + return; + + } + + if(ticketModerateurBareme <= " "){ + + v_msg="Veuillez entrer un ticket modérateur!"; + v_msgEng="Please enter a co-payment!"; + alert_ebene(v_msg, v_msgEng); + + $("#ticketModerateurBareme").focus(); + return; + + } + + $("#div_bareme").html('
' + '
'); + + donnees = 'idBaremePriseEnCharge='+idBaremePriseEnCharge; + donnees += '&dateEffetBareme='+dateEffetBareme; + donnees += '&ticketModerateurBareme='+ticketModerateurBareme; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererdetailbaremecollegetemp/ajouter/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + init_saisie_detailbareme(); + actualiser_detailbareme_college_temp(); + }, + complete: function() { + afficheNombreLigneBaremeCollegeTemp('detailbareme'); + $("#masquerBareme").val("0"); + afficherDetailBaremeCollegeTemp(); + } + }); +} + +function afficher_actes_garantiebareme_college_temp(idBaremePriseEnCharge, codeGarantie){ + // + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $("#div_patienter").html(''); + + $("#div_patienter").html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxactesgarantiebaremecollegetemp/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + + + $('#div_actesgarantiebareme').html(data); + $('#div_actesgarantiebareme').modal("show"); + + appliquerDataTableBareme(); + + $('#div_actesgarantiebareme').on('shown.bs.modal', function(){ + stylechampsRequis(); + }); + + afficherMasquerGarantiesBaremeCollegeTemp(); + afficherMasquerGarantiesBaremeLienParenteCollegeTemp(); + afficherMasquerActeBaremeCollegeTemp(); + afficherMasquerActeBaremeLienParenteCollegeTemp(); + + $(".datepicker").datepicker(); + $("#codeActe").selectpicker(); + $("#codeActeLienParente").selectpicker(); + $("#div_patienter").html(''); + }, + complete: function() { + afficheNombreLigneBaremeCollegeTemp('garantiesbaremepriseencharge'); + afficheNombreLigneBaremeCollegeTemp('garantiesbaremepriseenchargelienparente'); + afficheNombreLigneBaremeCollegeTemp('actesbaremepriseencharge'); + afficheNombreLigneBaremeCollegeTemp('actesbaremepriseenchargelienparente'); + } + }); +} + +function afficherMasquerGarantiesBaremeCollegeTemp() +{ + masquerGarantie = $("#masquerGarantie").val(); + + + if(masquerGarantie == undefined){ + masquerGarantie = "1"; + } + + //alert(masquerGarantie); + + if(masquerGarantie=="1"){ + $('#div_garanties_masquer').hide(); + $("#masquerGarantie").val("0"); + $("#span_garantie").text("[+]"); + + }else{ + $('#div_garanties_masquer').show(); + $("#masquerGarantie").val("1"); + //$("#dateEffetGarantie").focus(); + intit_saisie_garantiebareme(); + actualiser_bareme_garantie_college_temp(); + $("#span_garantie").text("[-]"); + + $("#masquerGarantieLienParente").val("1"); + $("#masquerActe").val("1"); + $("#masquerActeLienParente").val("1"); + + afficherMasquerGarantiesBaremeLienParenteCollegeTemp(); + afficherMasquerActeBaremeCollegeTemp(); + afficherMasquerActeBaremeLienParenteCollegeTemp(); + } + + afficheNombreLigneBaremeCollegeTemp('garantiesbaremepriseencharge'); +} + +function afficherMasquerGarantiesBaremeLienParenteCollegeTemp() +{ + masquerGarantieLienParente = $("#masquerGarantieLienParente").val(); + + if(masquerGarantieLienParente == undefined){ + masquerGarantieLienParente = "1"; + } + + if(masquerGarantieLienParente=="1"){ + $('#div_garanties_lienparente_masquer').hide(); + $("#masquerGarantieLienParente").val("0"); + $("#span_garantie_lienparente").text("[+]"); + + }else{ + $('#div_garanties_lienparente_masquer').show(); + $("#masquerGarantieLienParente").val("1"); + intit_saisie_garantiebareme_lienparente(); + actualiser_bareme_garantie_lienparente_college_temp(); + $("#span_garantie_lienparente").text("[-]"); + + $("#masquerGarantie").val("1"); + $("#masquerActe").val("1"); + $("#masquerActeLienParente").val("1"); + + afficherMasquerGarantiesBaremeCollegeTemp(); + afficherMasquerActeBaremeCollegeTemp(); + afficherMasquerActeBaremeLienParenteCollegeTemp(); + } + + afficheNombreLigneBaremeCollegeTemp('garantiesbaremepriseenchargelienparente'); +} + +function afficherMasquerActeBaremeCollegeTemp() +{ + masquerActe = $("#masquerActe").val(); + + if(masquerActe == undefined){ + masquerActe = "1"; + } + + if(masquerActe=="1"){ + $('#div_acte_masquer').hide(); + $("#masquerActe").val("0"); + $("#span_acte").text("[+]"); + + }else{ + $('#div_acte_masquer').show(); + $("#masquerActe").val("1"); + intit_saisie_actebareme(); + actualiser_bareme_acte_college_temp(); + $("#span_acte").text("[-]"); + + $("#masquerGarantie").val("1"); + $("#masquerGarantieLienParente").val("1"); + $("#masquerActeLienParente").val("1"); + + afficherMasquerGarantiesBaremeCollegeTemp(); + afficherMasquerGarantiesBaremeLienParenteCollegeTemp(); + afficherMasquerActeBaremeLienParenteCollegeTemp(); + } + + afficheNombreLigneBaremeCollegeTemp('actesbaremepriseencharge'); +} + +function afficherMasquerActeBaremeLienParenteCollegeTemp() +{ + masquerActeLienParente = $("#masquerActeLienParente").val(); + + if(masquerActeLienParente == undefined){ + masquerActeLienParente = "1"; + } + + if(masquerActeLienParente=="1"){ + $('#div_acte_lienparente_masquer').hide(); + $("#masquerActeLienParente").val("0"); + $("#span_acte_lienparente").text("[+]"); + + }else{ + $('#div_acte_lienparente_masquer').show(); + $("#masquerActeLienParente").val("1"); + + intit_saisie_actebareme_lienparente(); + actualiser_bareme_acte_lienparente_college_temp(); + $("#span_acte_lienparente").text("[-]"); + + $("#masquerGarantie").val("1"); + $("#masquerGarantieLienParente").val("1"); + $("#masquerActe").val("1"); + + afficherMasquerGarantiesBaremeCollegeTemp(); + afficherMasquerGarantiesBaremeLienParenteCollegeTemp(); + afficherMasquerActeBaremeCollegeTemp(); + } + + afficheNombreLigneBaremeCollegeTemp('actesbaremepriseenchargelienparente'); +} + +function actualiser_bareme_acte_lienparente_college_temp() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactelienparentecollegetemp/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_actes_lienparente').html(data); + + + }, + complete: function() { + + } + }); + +} + +function actualiser_bareme_acte_college_temp() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactecollegetemp/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_actes_bareme').html(data); + + + }, + complete: function() { + + } + }); + +} + +function actualiser_bareme_garantie_lienparente_college_temp() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantielienparentecollegetemp/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_garanties_bareme_lienparente').html(data); + + + }, + complete: function() { + + } + }); + +} + +function actualiser_bareme_garantie_college_temp() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantiecollegetemp/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_garanties_bareme').html(data); + + + }, + complete: function() { + + } + }); + +} + +function supprimer_baremegarantie_college_temp(adminProd,idGarantie) +{ + + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantiecollegetemp/supprimer/", + type : 'post', + data: "idGarantie="+idGarantie, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_bareme_garantie_college_temp(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_baremegarantielienparente_college_temp(adminProd, idGarantie) +{ + + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantielienparentecollegetemp/supprimer/", + type : 'post', + data: "idGarantie="+idGarantie, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_bareme_garantie_lienparente_college_temp(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_baremeactelienparente_college_temp(adminProd, idActe) +{ + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactelienparentecollegetemp/supprimer/", + type : 'post', + data: "idActe="+idActe, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_bareme_acte_lienparente_college_temp(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_baremeacte_college_temp(adminProd, idActe) +{ + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactecollegetemp/supprimer/", + type : 'post', + data: "idActe="+idActe, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_bareme_acte_college_temp(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function inserer_bareme_garantie_college_temp() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + dateEffetGarantie = $("#dateEffetGarantie").val(); + forfaitPlafondGarantieAdherent = $("#forfaitPlafondGarantieAdherent").val(); + codePeriodicitePlafondGarantieAdherent = $("#codePeriodicitePlafondGarantieAdherent").val(); + nbreTransactionGarantieAdherent = $("#nbreTransactionGarantieAdherent").val(); + codePeriodiciteGarantieAdherent = $("#codePeriodiciteGarantieAdherent").val(); + forfaitPlafondGarantie = $("#forfaitPlafondGarantie").val(); + codePeriodicitePlafondGarantie = $("#codePeriodicitePlafondGarantie").val(); + nbreTransactionGarantie = $("#nbreTransactionGarantie").val(); + codePeriodiciteGarantie = $("#codePeriodiciteGarantie").val(); + //codeObservationFamilleActe = $("#codeObservationFamilleActe").val(); + codeTypeRemboursement = $("#codeTypeRemboursement").val(); + delaiCarenceFamilleActe = $("#delaiCarenceFamilleActe").val(); + ticketModerateurFamilleActe = $("#ticketModerateurFamilleActe").val(); + + forfaitTmGarantie = $("#forfaitTmGarantie").val(); + + ageMinimumFamilleActe = $("#ageMinimumFamilleActe").val(); + ageMaximumFamilleActe = $("#ageMaximumFamilleActe").val(); + actifFamilleActe = $("#actifFamilleActe").val(); + + + forfaitPlafondGarantieAdherent = forfaitPlafondGarantieAdherent.replace(/ /g,""); + forfaitPlafondGarantie = forfaitPlafondGarantie.replace(/ /g,""); + + forfaitTmGarantie = forfaitTmGarantie.replace(/ /g,""); + + + if(dateEffetGarantie <= " "){ + + v_msg="Veuillez entrer une date d'effet!"; + v_msgEng="Please enter an effective date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateEffetGarantie").focus(); + return; + + } + + if(actifFamilleActe <= " "){ + + v_msg="Veuillez indiquer le statut de cet barème!"; + v_msgEng="Please indicate the status of this scale!"; + alert_ebene(v_msg, v_msgEng); + + $("#actifFamilleActe").focus(); + return; + + } + + $("#div_garanties_bareme").html('
' + '
'); + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + donnees += '&dateEffetGarantie='+dateEffetGarantie; + donnees += '&forfaitPlafondGarantieAdherent='+forfaitPlafondGarantieAdherent; + donnees += '&codePeriodicitePlafondGarantieAdherent='+codePeriodicitePlafondGarantieAdherent; + donnees += '&nbreTransactionGarantieAdherent='+nbreTransactionGarantieAdherent; + donnees += '&codePeriodiciteGarantieAdherent='+codePeriodiciteGarantieAdherent; + donnees += '&forfaitPlafondGarantie='+forfaitPlafondGarantie; + donnees += '&codePeriodicitePlafondGarantie='+codePeriodicitePlafondGarantie; + donnees += '&nbreTransactionGarantie='+nbreTransactionGarantie; + donnees += '&codePeriodiciteGarantie='+codePeriodiciteGarantie; + //donnees += '&codeObservationFamilleActe='+codeObservationFamilleActe; + donnees += '&codeTypeRemboursement='+codeTypeRemboursement; + donnees += '&delaiCarenceFamilleActe='+delaiCarenceFamilleActe; + donnees += '&ticketModerateurFamilleActe='+ticketModerateurFamilleActe; + donnees += '&ageMinimumFamilleActe='+ageMinimumFamilleActe; + donnees += '&ageMaximumFamilleActe='+ageMaximumFamilleActe; + donnees += '&actifFamilleActe='+actifFamilleActe; + + donnees += '&forfaitTmGarantie='+forfaitTmGarantie; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantiecollegetemp/ajouter/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + intit_saisie_garantiebareme(); + actualiser_bareme_garantie_college_temp(); + + }, + complete: function() { + afficheNombreLigneBaremeCollegeTemp('garantiesbaremepriseencharge'); + + } + }); +} + +function validiteDateEffetGarantieLienParenteCollegeTemp(){ + + var codeGarantie = $("#codeGarantie").val(); + var idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + var dateEffetGarantieLienParente = $("#dateEffetGarantieLienParente").val(); + var codeLienParente = $("#codeLienParente").val(); + + var datejour = $("#datejour_C").val(); + + var str = dateEffetGarantieLienParente.split('/'); + var effet = str[2]+'-'+str[1]+'-'+str[0]; + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + donnees += '&codeLienParente='+codeLienParente; + + //alert(donnees); + //return; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantielienparentecollegetemp/controle/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_maxdateeffetGarantieLienParente').html(data); + + var tdj = new Date(datejour); + var tde = new Date(effet); + + maxDateEffetGarantieLienParente = $("#maxDateEffetGarantieLienParente").val(); + + dte=Math.round(Date.parse(tde)/(1000*3600*24)); + dtj=Math.round(Date.parse(tdj)/(1000*3600*24)); + + if((dte < dtj) && (maxDateEffetGarantieLienParente!=undefined || maxDateEffetGarantieLienParente!='')){ + var tdm = new Date(maxDateEffetGarantieLienParente); + dtm = Math.round(Date.parse(tdm)/(1000*3600*24)); + + if(dte < dtm){ + + v_msg="Date d'effet invalide!"; + v_msgEng="Invalid effective date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateEffetGarantieLienParente").val(''); + $("#dateEffetGarantieLienParente").focus(); + return; + }else{ + inserer_bareme_garantie_lienparente_college_temp(); + } + }else{ + + inserer_bareme_garantie_lienparente_college_temp(); + } + + }, + complete: function() { + + + } + }); + +} + +function inserer_bareme_garantie_lienparente_college_temp() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + dateEffetGarantieLienParente = $("#dateEffetGarantieLienParente").val(); + codeLienParente = $("#codeLienParente").val(); + forfaitPlafondGarantieLienParente = $("#forfaitPlafondGarantieLienParente").val(); + codePeriodicitePlafondGarantieLienParente = $("#codePeriodicitePlafondGarantieLienParente").val(); + nbreTransactionGarantieLienParente = $("#nbreTransactionGarantieLienParente").val(); + codePeriodiciteGarantieLienParente = $("#codePeriodiciteGarantieLienParente").val(); + //codeObservationFamilleActeLienParente = $("#codeObservationFamilleActeLienParente").val(); + codeTypeRemboursementLienParente = $("#codeTypeRemboursementLienParente").val(); + delaiCarenceFamilleActeLienParente = $("#delaiCarenceFamilleActeLienParente").val(); + ticketModerateurFamilleActeLienParente = $("#ticketModerateurFamilleActeLienParente").val(); + + + forfaitTmGarantieLienParente = $("#forfaitTmGarantieLienParente").val(); + + ageMinimumFamilleActeLienParente = $("#ageMinimumFamilleActeLienParente").val(); + ageMaximumFamilleActeLienParente = $("#ageMaximumFamilleActeLienParente").val(); + actifFamilleActeLienParente = $("#actifFamilleActeLienParente").val(); + + + forfaitPlafondGarantieLienParente = forfaitPlafondGarantieLienParente.replace(/ /g,""); + forfaitTmGarantieLienParente = forfaitTmGarantieLienParente.replace(/ /g,""); + + if(dateEffetGarantieLienParente <= " "){ + + v_msg="Veuillez entrer une date d'effet!"; + v_msgEng="Please enter an effective date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateEffetGarantieLienParente").focus(); + return; + + } + + if(codeLienParente <= " "){ + + v_msg="Veuillez entrer le lien de parenté!"; + v_msgEng="Please enter the relationship!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienParente").focus(); + return; + + } + + if(actifFamilleActeLienParente <= " "){ + + v_msg="Veuillez indiquer le statut de cet barème!"; + v_msgEng="Please indicate the status of this scale!"; + alert_ebene(v_msg, v_msgEng); + + $("#actifFamilleActeLienParente").focus(); + return; + + } + + $("#div_garanties_bareme_lienparente").html('
' + '
'); + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + donnees += '&dateEffetGarantieLienParente='+dateEffetGarantieLienParente; + donnees += '&codeLienParente='+codeLienParente; + donnees += '&forfaitPlafondGarantieLienParente='+forfaitPlafondGarantieLienParente; + donnees += '&codePeriodicitePlafondGarantieLienParente='+codePeriodicitePlafondGarantieLienParente; + donnees += '&nbreTransactionGarantieLienParente='+nbreTransactionGarantieLienParente; + donnees += '&codePeriodiciteGarantieLienParente='+codePeriodiciteGarantieLienParente; + + + //donnees += '&codeObservationFamilleActeLienParente='+codeObservationFamilleActeLienParente; + donnees += '&codeTypeRemboursementLienParente='+codeTypeRemboursementLienParente; + donnees += '&delaiCarenceFamilleActeLienParente='+delaiCarenceFamilleActeLienParente; + donnees += '&ticketModerateurFamilleActeLienParente='+ticketModerateurFamilleActeLienParente; + donnees += '&ageMinimumFamilleActeLienParente='+ageMinimumFamilleActeLienParente; + donnees += '&ageMaximumFamilleActeLienParente='+ageMaximumFamilleActeLienParente; + donnees += '&actifFamilleActeLienParente='+actifFamilleActeLienParente; + + donnees += '&forfaitTmGarantieLienParente='+forfaitTmGarantieLienParente; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremegarantielienparentecollegetemp/ajouter/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + intit_saisie_garantiebareme_lienparente(); + actualiser_bareme_garantie_lienparente_college_temp(); + + }, + complete: function() { + afficheNombreLigneBaremeCollegeTemp('garantiesbaremepriseenchargelienparente'); + + } + }); +} + +function validiteDateEffetActeBaremeCollegeTemp(){ + + var codeGarantie = $("#codeGarantie").val(); + var idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + var codeActe = $("#codeActe").val(); + + var dateEffetActe = $("#dateEffetActe").val(); + var datejour = $("#datejour_C").val(); + + var str = dateEffetActe.split('/'); + var effet = str[2]+'-'+str[1]+'-'+str[0]; + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + donnees += '&codeActe='+codeActe; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactecollegetemp/controle/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_maxdateeffetactebareme').html(data); + + var tdj = new Date(datejour); + var tde = new Date(effet); + + maxDateEffetActeBareme = $("#maxDateEffetActeBareme").val(); + + dte=Math.round(Date.parse(tde)/(1000*3600*24)); + dtj=Math.round(Date.parse(tdj)/(1000*3600*24)); + + if((dte < dtj) && (maxDateEffetActeBareme!=undefined || maxDateEffetActeBareme!='')){ + var tdm = new Date(maxDateEffetActeBareme); + dtm = Math.round(Date.parse(tdm)/(1000*3600*24)); + + if(dte < dtm){ + + v_msg="Date d'effet invalide!"; + v_msgEng="Invalid effective date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateEffetActe").val(''); + $("#dateEffetActe").focus(); + return; + }else{ + inserer_bareme_acte_college_temp(); + } + }else{ + + inserer_bareme_acte_college_temp(); + } + + }, + complete: function() { + + + } + }); + +} + +function inserer_bareme_acte_college_temp() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + codeActe = $("#codeActe").val(); + + dateEffetActe = $("#dateEffetActe").val(); + forfaitPlafondActeAdherent = $("#forfaitPlafondActeAdherent").val(); + codePeriodicitePlafondActeAdherent = $("#codePeriodicitePlafondActeAdherent").val(); + nbreTransactionActeAdherent = $("#nbreTransactionActeAdherent").val(); + codePeriodiciteActeAdherent = $("#codePeriodiciteActeAdherent").val(); + forfaitPlafondActe = $("#forfaitPlafondActe").val(); + codePeriodicitePlafondActe = $("#codePeriodicitePlafondActe").val(); + nbreTransactionActe = $("#nbreTransactionActe").val(); + codePeriodiciteActe = $("#codePeriodiciteActe").val(); + codeTypeRemboursementActe = $("#codeTypeRemboursementActe").val(); + delaiCarenceActe = $("#delaiCarenceActe").val(); + ticketModerateurActe = $("#ticketModerateurActe").val(); + ageMinimumActe = $("#ageMinimumActe").val(); + ageMaximumActe = $("#ageMaximumActe").val(); + actifActe = $("#actifActe").val(); + + + forfaitTmActe = $("#forfaitTmActe").val(); + + + forfaitPlafondActeAdherent = forfaitPlafondActeAdherent.replace(/ /g,""); + forfaitPlafondActe = forfaitPlafondActe.replace(/ /g,""); + forfaitTmActe = forfaitTmActe.replace(/ /g,""); + + if(codeActe <= " "){ + + v_msg="Veuillez entrer un acte!"; + v_msgEng="Please enter an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + + } + + if(dateEffetActe <= " "){ + + v_msg="Veuillez entrer une date d'effet!"; + v_msgEng="Please enter an effective date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateEffetActe").focus(); + return; + + } + + if(actifActe <= " "){ + + v_msg="Veuillez indiquer le statut de cet barème!"; + v_msgEng="Please indicate the status of this scale!"; + alert_ebene(v_msg, v_msgEng); + + $("#actifActe").focus(); + return; + + } + + $("#div_actes_bareme").html('
' + '
'); + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + donnees += '&codeActe='+codeActe; + + donnees += '&dateEffetActe='+dateEffetActe; + donnees += '&forfaitPlafondActeAdherent='+forfaitPlafondActeAdherent; + donnees += '&codePeriodicitePlafondActeAdherent='+codePeriodicitePlafondActeAdherent; + donnees += '&nbreTransactionActeAdherent='+nbreTransactionActeAdherent; + donnees += '&codePeriodiciteActeAdherent='+codePeriodiciteActeAdherent; + + donnees += '&forfaitPlafondActe='+forfaitPlafondActe; + donnees += '&codePeriodicitePlafondActe='+codePeriodicitePlafondActe; + donnees += '&nbreTransactionActe='+nbreTransactionActe; + donnees += '&codePeriodiciteActe='+codePeriodiciteActe; + donnees += '&codeTypeRemboursementActe='+codeTypeRemboursementActe; + donnees += '&delaiCarenceActe='+delaiCarenceActe; + donnees += '&ticketModerateurActe='+ticketModerateurActe; + donnees += '&ageMinimumActe='+ageMinimumActe; + donnees += '&ageMaximumActe='+ageMaximumActe; + donnees += '&actifActe='+actifActe; + + donnees += '&forfaitTmActe='+forfaitTmActe; + + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactecollegetemp/ajouter/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + intit_saisie_actebareme(); + actualiser_bareme_acte_college_temp(); + + }, + complete: function() { + afficheNombreLigneBaremeCollegeTemp('actesbaremepriseencharge'); + + } + }); +} + +function validiteDateEffetActeBaremeLienParenteCollegeTemp(){ + + var codeGarantie = $("#codeGarantie").val(); + var idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + var codeActeLienParente = $("#codeActeLienParente").val(); + + var dateEffetActeLienParente = $("#dateEffetActeLienParente").val(); + var codeLienParenteActeLienParente = $("#codeLienParenteActeLienParente").val(); + + var datejour = $("#datejour_C").val(); + + var str = dateEffetActeLienParente.split('/'); + var effet = str[2]+'-'+str[1]+'-'+str[0]; + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + donnees += '&codeActeLienParente='+codeActeLienParente; + donnees += '&codeLienParenteActeLienParente='+codeLienParenteActeLienParente; + + //alert(donnees); + //return; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactelienparentecollegetemp/controle/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_maxdateeffetactebaremelienparente').html(data); + + var tdj = new Date(datejour); + var tde = new Date(effet); + + maxDateEffetActeBaremeLienParente = $("#maxDateEffetActeBaremeLienParente").val(); + + + dte=Math.round(Date.parse(tde)/(1000*3600*24)); + dtj=Math.round(Date.parse(tdj)/(1000*3600*24)); + + if((dte < dtj) && (maxDateEffetActeBaremeLienParente!=undefined || maxDateEffetActeBaremeLienParente!='')){ + var tdm = new Date(maxDateEffetActeBaremeLienParente); + dtm = Math.round(Date.parse(tdm)/(1000*3600*24)); + + if(dte < dtm){ + + v_msg="Date d'effet invalide!"; + v_msgEng="Invalid effective date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateEffetActeLienParente").val(''); + $("#dateEffetActeLienParente").focus(); + return; + }else{ + inserer_bareme_acte_lienparente_college_temp(); + } + }else{ + + inserer_bareme_acte_lienparente_college_temp(); + } + + }, + complete: function() { + + + } + }); + +} + +function inserer_bareme_acte_lienparente_college_temp() +{ + codeGarantie = $("#codeGarantie").val(); + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + codeActeLienParente = $("#codeActeLienParente").val(); + + dateEffetActeLienParente = $("#dateEffetActeLienParente").val(); + codeLienParenteActeLienParente = $("#codeLienParenteActeLienParente").val(); + forfaitPlafondActeLienParente = $("#forfaitPlafondActeLienParente").val(); + codePeriodicitePlafondActeLienParente = $("#codePeriodicitePlafondActeLienParente").val(); + nbreTransactionActeLienParente = $("#nbreTransactionActeLienParente").val(); + codePeriodiciteActeLienParente = $("#codePeriodiciteActeLienParente").val(); + codeTypeRemboursementActeLienParente = $("#codeTypeRemboursementActeLienParente").val(); + delaiCarenceActeLienParente = $("#delaiCarenceActeLienParente").val(); + ticketModerateurActeLienParente = $("#ticketModerateurActeLienParente").val(); + ageMinimumActeLienParente = $("#ageMinimumActeLienParente").val(); + ageMaximumActeLienParente = $("#ageMaximumActeLienParente").val(); + actifActeLienParente = $("#actifActeLienParente").val(); + + forfaitTmActeLienParente = $("#forfaitTmActeLienParente").val(); + + forfaitPlafondActeLienParente = forfaitPlafondActeLienParente.replace(/ /g,""); + forfaitTmActeLienParente = forfaitTmActeLienParente.replace(/ /g,""); + + if(codeActeLienParente <=" "){ + + v_msg="Veuillez entrer un acte!"; + v_msgEng="Please enter an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActeLienParente").focus(); + return; + + } + + if(dateEffetActeLienParente <= " "){ + + v_msg="Veuillez entrer une date d'effet!"; + v_msgEng="Please enter an effective date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateEffetActeLienParente").focus(); + return; + + } + + if(codeLienParenteActeLienParente <= " "){ + + v_msg="Veuillez entrer le lien de parenté!"; + v_msgEng="Please enter the relationship!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienParenteActeLienParente").focus(); + return; + + } + + if(actifActeLienParente <= " "){ + + v_msg="Veuillez indiquer le statut de cet barème!"; + v_msgEng="Please indicate the status of this scale!"; + alert_ebene(v_msg, v_msgEng); + + $("#actifActeLienParente").focus(); + return; + + } + + $("#div_actes_lienparente").html('
' + '
'); + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + donnees += '&codeActeLienParente='+codeActeLienParente; + donnees += '&dateEffetActeLienParente='+dateEffetActeLienParente; + donnees += '&codeLienParenteActeLienParente='+codeLienParenteActeLienParente; + donnees += '&forfaitPlafondActeLienParente='+forfaitPlafondActeLienParente; + donnees += '&codePeriodicitePlafondActeLienParente='+codePeriodicitePlafondActeLienParente; + donnees += '&nbreTransactionActeLienParente='+nbreTransactionActeLienParente; + donnees += '&codePeriodiciteActeLienParente='+codePeriodiciteActeLienParente; + + + donnees += '&codeTypeRemboursementActeLienParente='+codeTypeRemboursementActeLienParente; + donnees += '&delaiCarenceActeLienParente='+delaiCarenceActeLienParente; + donnees += '&ticketModerateurActeLienParente='+ticketModerateurActeLienParente; + donnees += '&ageMinimumActeLienParente='+ageMinimumActeLienParente; + donnees += '&ageMaximumActeLienParente='+ageMaximumActeLienParente; + donnees += '&actifActeLienParente='+actifActeLienParente; + + donnees += '&forfaitTmActeLienParente='+forfaitTmActeLienParente; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererbaremeactelienparentecollegetemp/ajouter/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + intit_saisie_actebareme_lienparente(); + actualiser_bareme_acte_lienparente_college_temp(); + + }, + complete: function() { + afficheNombreLigneBaremeCollegeTemp('actesbaremepriseenchargelienparente'); + } + }); +} + +function supprimer_detailbareme_college(adminProd, idDetail) +{ + + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererdetailbaremecollege/supprimer/", + type : 'post', + data: "idDetail="+idDetail, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_detailbareme_college(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function supprimer_detailbareme_college_temp(adminProd, idDetail) +{ + + if (adminProd != "1"){ + v_msg="Vous n'\u00eates pas autoris\u00e9!"; + v_msgEng="You are not authorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinsererdetailbaremecollegetemp/supprimer/", + type : 'post', + data: "idDetail="+idDetail, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + actualiser_detailbareme_college_temp(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function modecalculeprime() { + let codeModecalculPrime = $("#codeModecalculPrime").val(); + let codeGcAssureur = $("#codeGcAssureur").val(); + let codeProduit = $("#codeProduit").val() || ''; + let racineWeb = $("#racineWeb").val(); + + // Validation du Garant + if (codeGcAssureur == "AUC") { + alert_ebene("Veuillez indiquer le code garant!", "Please indicate the guarantor code!"); + $("#codeGcAssureur").focus(); + $("#codeModecalculPrime").val(""); + return; + } + + // Nettoyage des zones + $("#div_typetrancheage, #div_prime_lienparente").empty(); + + if (codeModecalculPrime <= " ") { + alert_ebene("Veuillez indiquer le mode de calcul!", "Please indicate the calculation mode!"); + $("#codeModecalculPrime").focus(); + return; + } + + // Définition du loader + const loader = ` +
+
+ Chargement de la configuration... +
`; + + if (codeModecalculPrime == "TA") { + $("#div_typetrancheage").html(loader); + $.ajax({ + url: racineWeb + "Ajaxprimelienparente/typetrancheage/", + type: 'post', + data: { codeGcAssureur: codeGcAssureur }, + success: function(data) { + // 1. On injecte les données + $("#div_typetrancheage").hide().html(data).fadeIn(); + + // 2. On cible précisément le select qui vient d'être chargé + let $select = $("#codeEnteteTrancheAge"); + + if ($select.length) { + // IMPORTANT : On détruit l'éventuelle instance précédente + // pour nettoyer le DOM des résidus du premier rendu + $select.selectpicker('destroy'); + + // On réinitialise proprement + $select.selectpicker({ + liveSearch: true, + style: 'btn-white border-2 shadow-none', + size: 5, + noneSelectedText: 'Sélectionnez une tranche...' + }); + } + } + }); + } else { + $("#div_prime_lienparente").html(loader); + $.ajax({ + url: racineWeb + "Ajaxprimelienparente/", + type: 'post', + data: { codeGcAssureur: codeGcAssureur, codeProduit: codeProduit }, + success: function(data) { + $("#div_prime_lienparente").hide().html(data).fadeIn(); + } + }); + } +} + +function trancheage() { + let codeModecalculPrime = $("#codeModecalculPrime").val(); + let codeGcAssureur = $("#codeGcAssureur").val(); + let codeProduit = $("#codeProduit").val() || ''; + let codeEnteteTrancheAge = $("#codeEnteteTrancheAge").val(); + let racineWeb = $("#racineWeb").val(); + + if (codeEnteteTrancheAge <= " " && codeModecalculPrime == "TA") { + alert_ebene("Veuillez sélectionner une catégorie de tranche d'âge!", "Please select an age group category!"); + $("#codeEnteteTrancheAge").focus(); + $("#div_trancheage").empty(); + return; + } + + // Loader Standard + $("#div_trancheage").html( + '
' + + '
' + + 'Chargement de la grille...
' + ); + + $.ajax({ + url: racineWeb + "Ajaxprimelienparente/trancheage/", + type: 'post', + data: { + codeGcAssureur: codeGcAssureur, + codeProduit: codeProduit, + codeEnteteTrancheAge: codeEnteteTrancheAge + }, + success: function(data) { + $("#div_trancheage").hide().html(data).fadeIn(); + } + }); +} + +function ajaxprimelienparente() +{ + donnees = ""; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimelienparente/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $("#div_modeprime").html(data); + + }, + complete: function() { + + } + }); +} + +function ajax_maj_prime_produit(idPrime, prime, controle) +{ + prime=prime.replace(/ /g,""); + prime=parseInt(prime.replace(",","."),10); + controle.value=prime; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&prime="+prime; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimelienparente/majprimeproduit/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + +function ajaxmodecalculprime() +{ + idProduit = $("#idProduit").val(); + codeModecalculPrime = $("#codeModecalculPrime").val(); + + if(codeModecalculPrime<=" ") + { + v_msg="Veuillez indiquer le mode de calcul de prime!"; + v_msgEng="Please indicate how the premium is calculated!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeModecalculPrime").focus(); + + $("#div_modeprime").html(''); + + return; + }else if(codeModecalculPrime!="LP") + { + $("#div_modeprime").empty(); + $("#div_modeprime").html('
' + '
'); + }else{ + //ajaxprimelienparente(); + $("#div_modeprime").empty(); + return; + } + + $("#div_modeprime").html('
' + '
'); + + + donnees = "idProduit="+idProduit+"&codeModecalculPrime="+codeModecalculPrime; + + //alert(donnees); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmodecalculprime/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $("#div_modeprime").html(data); + + $("#codeEnteteTrancheAge").selectpicker(); + + }, + complete: function() { + + } + }); +} + +/* +function test_code(controle) +{ + alert(event.keyCode); + + return; + + if((event.keyCode < 45) || (event.keyCode > 45 && event.keyCode <= 47) + || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode >=91 && event.keyCode < 95) + || (event.keyCode == 96) || (event.keyCode>=123 && event.keyCode<=126)) + { + + v_msg="Un code ne peut contenir de caractères spéciaux!"; + v_msgEng="A code cannot contain special characters!"; + + alert_ebene(v_msg, v_msgEng); + + controle.value=""; + controle.focus(); + + event.returnValue = false; + } + +} +*/ + +function test_code(controle, code) +{ + var reg = new RegExp('^[a-zA-Z][a-zA-Z0-9]*$'); + + if(reg.test(code)==false) + { + v_msg="Code invalide! Un code ne doit pas contenir d'espace ni de caractère spéciaux et ne pas commencer par un chiffre!"; + v_msgEng="Code is invalid! A code must not contain spaces or special characters and must not start with a number!" ; + alert_ebene(v_msg, v_msgEng); + + controle.value=""; + controle.focus(); + return false; + } +} + + +function ajax_maj_nbrefamille_college_temp(idPrime, nbreFamille, controle, modeDevis) +{ + nbreFamille=nbreFamille.replace(/ /g,""); + nbreFamille=parseInt(nbreFamille.replace(",","."),10); + controle.value=nbreFamille; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&nbreFamille="+nbreFamille; + + if(modeDevis == "0"){ + v_url = "Ajaxprimescategorie/majnbrefamillecollege/"; + }else{ + v_url = "Ajaxprimescategoried/majnbrefamillecollege/"; + } + + $.ajax({ + url: $("#racineWeb").val()+v_url, + type: 'POST', + data: donnees, + success: function(data) { + + + }, + error: function(data) { + }, + complete: function() { + if(modeDevis == "0"){ + enregistrer_college_temp(); + recapitulercollege(); + }else{ + enregistrer_college_temp_d(); + recapitulercollege_d(); + } + + } + }); + } +} + +function ajax_maj_supplementaire_college_temp(idPrime, prime, controle, modeDevis) +{ + prime=prime.replace(/ /g,""); + prime=parseInt(prime.replace(",","."),10); + controle.value=prime; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&prime="+prime; + + if(modeDevis == "0"){ + v_url = "Ajaxprimescategorie/majprimesupplementairecollege/"; + }else{ + v_url = "Ajaxprimescategoried/majprimesupplementairecollege/"; + } + + $.ajax({ + url: $("#racineWeb").val()+v_url, + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + + }, + complete: function() { + if(modeDevis == "0"){ + enregistrer_college_temp(); + }else{ + enregistrer_college_temp_d(); + } + } + }); + } +} + +function ajax_maj_prime_trancheage_college(idPrime, prime, controle, modeDevis) +{ + + + prime=prime.replace(/ /g,""); + prime=parseInt(prime.replace(",","."),10); + controle.value=prime; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&prime="+prime; + + if(modeDevis == "0"){ + v_url = "Ajaxprimescategorie/majprimetrancheage/"; + }else{ + v_url = "Ajaxprimescategoried/majprimetrancheage/"; + } + + $.ajax({ + url: $("#racineWeb").val()+v_url, + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + + if(modeDevis == "0"){ + change_categorie_college_temp(); + }else{ + change_categorie_college_temp_d(); + } + } + }); + } +} + +function maj_effectif_trancheage_college(idPrime, population, controle, modeDevis) +{ + + + population=population.replace(/ /g,""); + population=parseInt(population.replace(",","."),10); + controle.value=population; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&population="+population; + + if(modeDevis == "0"){ + v_url = "Ajaxprimescategorie/majpopulationtranche/"; + }else{ + v_url = "Ajaxprimescategoried/majpopulationtranche/"; + } + + $.ajax({ + url: $("#racineWeb").val()+v_url, + type: 'POST', + data: donnees, + success: function(data) { + + + }, + error: function(data) { + }, + complete: function() { + + + if(modeDevis == "0"){ + change_categorie_college_temp(); + }else{ + change_categorie_college_temp_d(); + } + } + }); + } +} + + + +function calcul_prime_adherent() +{ + codeModeCalculPrime = $("#codeModeCalculPrime").val(); + + if(codeModeCalculPrime=='TA'){ + idCollege=$("#idCollege").val(); + dateEntree=$("#dateEntree").val(); + dateNaissance=$("#dateNaissance").val(); + prorata=$("#prorata").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; + donnees += '&dateEntree='+dateEntree; + donnees += '&prorata='+prorata; + donnees += '&dateNaissance='+dateNaissance; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxproraterprime/calculprime/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_prime").html(data); + }, + complete: function() { + } + }); + } + +} + +function calcul_prime_beneficiaire() +{ + codeModeCalculPrime = $("#codeModeCalculPrime").val(); + + if(codeModeCalculPrime=='TA'){ + idAdherent = $("#idAdherent").val(); + dateNaissance =$("#dateNaissance").val(); + fraisCarte =$("#fraisCarte").val(); + prorata =$("#prorata").val(); + + + donnees = 'idAdherent='+idAdherent; + donnees += '&dateNaissance='+dateNaissance; + donnees += '&fraisCarte='+fraisCarte; + donnees += '&prorata='+prorata; + + // ajout KANE 27/10/2023 + codeLienParente =$("#codeLienParente").val(); + donnees += '&codeLienParente='+codeLienParente; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxproraterprimebeneficiaire/calculprime/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_prime").html(data); + }, + complete: function() { + } + }); + } + +} + + + +function retour_de_detailbaremecollegetemp() +{ + window.location.assign($("#racineWeb" ).val()+$("#retour").val()+"/"); +} + +function init_trancheage_college_temp() +{ + codeProduit = $("#codeProduit").val(); + + donnees = 'codeProduit='+codeProduit; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimescategorie/inittrancheage/", + type: 'POST', + data: donnees, + success: function(data) { + + + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + + +function init_prime_college_temp() +{ + codeProduit = $("#codeProduit").val(); + + donnees = 'codeProduit='+codeProduit; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimescategorie/initprimelienparente/", + type: 'POST', + data: donnees, + success: function(data) { + + + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + + +function init_prime_college_base_tarif() +{ + codeProduit = $("#codeProduit").val(); + codeBaseTarification = $("#codeBaseTarification").val(); + + donnees = 'codeProduit='+codeProduit+'&codeBaseTarification='+codeBaseTarification; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimescategorie/initprimebasetarif/", + type: 'POST', + data: donnees, + success: function(data) { + + + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function modifier_centre_gestion(idCentreGestion) +{ + if(isNaN(idCentreGestion)){ + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + return false; + } + + window.location.assign($("#racineWeb" ).val()+"Modifierparametresgeneraux/"+idCentreGestion+"/"); + +} + +function controle_effet_assure(){ + + + var d_effet = new Date($("#dateEffetSql").val()); // 01/05/2022 + var d_fin = new Date($("#dateFinSql").val()); // 31/12/2022 + var d_entree = $("#dateEntree").datepicker("getDate"); // 20/07/2022 + + var effet = $("#dateAvenant").val(); + + + dt_effet = Math.round(Date.parse(d_effet)/(1000*3600*24)); + dt_fin = Math.round(Date.parse(d_fin)/(1000*3600*24)); + d_entree = Math.round(Date.parse(d_entree)/(1000*3600*24)); + + //alert('dt_effet='+dt_effet+'&dt_fin='+dt_fin+'&d_entree='+d_entree); + + if (d_entree>dt_fin || d_entree' + ''); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxbeneficiaireremboursement/liste/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + $('#div_liste_beneficiaire').html(data); + }, + complete: function() { + + } + }); + +} + +function modifier_beneficiaire_remboursement(idData) +{ + + donnees = 'idData='+idData; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxbeneficiaireremboursement/saisirmodif/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + $('#div_saisie_beneficiaire').html(data); + + }, + complete: function() { + + } + }); + + +} + +function enregistrer_beneficiaire_remboursement() +{ + idData = $("#idData").val(); + idAdherent = $("#idAdherent").val(); + beneficiaireReglement = $("#beneficiaireReglement").val(); + codeLienBeneficiaire = $("#codeLienBeneficiaire").val(); + codeModePaiement = $("#codeModePaiement").val(); + + enVigueur = $("#enVigueur").val(); + + telephoneMobile = $("#telephoneMobile").val(); + rib = $("#rib").val(); + + if($('#beneficiaireReglement').val()<=" ") + { + v_msg="Veuillez saisir le bénéficiaire!"; + v_msgEng="Please enter the beneficiary!"; + alert_ebene(v_msg, v_msgEng); + + $('#beneficiaireReglement').focus(); + $("#beneficiaireReglement").val(""); + return; + } + + if($('#codeLienBeneficiaire').val()<=" ") + { + v_msg="Veuillez saisir le lien avec l'adhérent!"; + v_msgEng="Please enter the link with the member!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeLienBeneficiaire').focus(); + $("#codeLienBeneficiaire").val(""); + return; + } + + + if($('#codeModePaiement').val()<=" ") + { + v_msg="Veuillez saisir le mode de paiement!"; + v_msgEng="Please enter payment method!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeModePaiement').focus(); + $("#codeModePaiement").val(""); + return; + } + + donnees = 'idData='+idData; + donnees += '&idAdherent='+idAdherent+'&beneficiaireReglement='+beneficiaireReglement; + donnees += '&codeLienBeneficiaire='+codeLienBeneficiaire+'&codeModePaiement='+codeModePaiement; + donnees += '&enVigueur='+enVigueur+'&telephoneMobile='+telephoneMobile+'&rib='+rib; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxbeneficiaireremboursement/enregistrer/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + actualiser_beneficiaire_remboursement(); + }, + complete: function() { + //afficherListeBeneficiaire(); + } + }); + +} + +function reinitialiser_beneficiaire_remboursement() +{ + + donnees = ''; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxbeneficiaireremboursement/reinitialiser/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + $('#div_saisie_beneficiaire').html(data); + + }, + complete: function() { + + } + }); + + +} + + +function recherchecode(controle, code, table) +{ + var donnee_a_affciher = ""; + + donnees = 'code='+code+'&table='+table; + + //alert(donnees); + //return; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxrecherchecodetable/rechercher/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + donnee_a_affciher = data; + }, + complete: function() { + //alert(donnee_a_affciher); + if(donnee_a_affciher=="true") + { + v_msg="Ce code existe déjà! Veuillez le remplacer."; + v_msgEng="This code already exists! Please replace it."; + alert_ebene(v_msg, v_msgEng); + + controle.value=""; + controle.focus(); + } + } + }); + +} + +// DEBUT KANE 21/10/2023 pour gérer le paramétrage des tranches d'âge +function filtreentetetrancheange(){ + var codeGcAssureur = $('#codeGcAssureur').val(); + + donnees = 'codeGcAssureur='+codeGcAssureur; + + if(codeGcAssureur !=""){ + $('#div_entetetrancheage').html(''); + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltreentetetrancheange/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + // + $('#div_entetetrancheage').html(data); + $("#codeEnteteTrancheAge").selectpicker(); + }, + complete: function() { + + } + }); + + + } +} + +function afficher_trancheage() { + + if (verifier_entete_trancheage()) { + let racineWeb = $("#racineWeb").val(); + let donnees = 'codeGcAssureur=' + codeGcAssureur + '&codeEnteteTrancheAge=' + codeEnteteTrancheAge; + let div_attente = $('#div_trancheage'); + + // Loader moderne + div_attente.html( + '
' + + '
' + + 'Chargement des tranches...
' + ); + + $.ajax({ + url: racineWeb + "Ajaxtrancheage/affichertrancheage/", + type: 'post', + data: donnees, + success: function(data) { + div_attente.hide().html(data).fadeIn(); + }, + complete: function() { + $("#ageMax").focus(); + } + }); + } +} + +function supprimer_derniere_tranche_age(idTrancheage) +{ + donnees = 'idTrancheage='+idTrancheage; + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this removal?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtrancheage/supprimer/", + type: 'POST', + data: donnees, + success: function(data) + { + }, + error: function(data) { + }, + complete: function() { + afficher_trancheage(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function vider_entete_trancheage() +{ + if(verifier_entete_trancheage()) + { + donnees = 'codeGcAssureur='+codeGcAssureur+'&codeEnteteTrancheAge='+codeEnteteTrancheAge; + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this removal?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtrancheage/viderentetetrancheage/", + type: 'POST', + data: donnees, + success: function(data) + { + // $('#div_test_gabarit').html(data); + }, + error: function(data) { + }, + complete: function() { + afficher_trancheage(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + } +} + +function verifier_entete_trancheage() +{ + codeGcAssureur = $('#codeGcAssureur').val(); + codeEnteteTrancheAge=$("#codeEnteteTrancheAge").val(); + + if (codeGcAssureur<=" ") + { + v_msg="Veuillez sélectionner un garant!"; + v_msgEng="Please select a guarantor!"; + alert_ebene(v_msg, v_msgEng); + return false; + } + + if (codeEnteteTrancheAge<=" ") + { + v_msg="Veuillez sélectionner une catégorie de tranche d'âge!"; + v_msgEng="Please select an age range category!"; + alert_ebene(v_msg, v_msgEng); + + return false; + } + + return true; +} + +function ajouter_une_trancheage() +{ + if(verifier_entete_trancheage()) + { + + ageMax = $("#ageMax").val(); + ageMax = ageMax.replace(/ /g,""); + ageMax = parseInt(ageMax.replace(",","."),10); + + if (ageMax<="0") + { + v_msg="Veuillez revoir votre saisie!"; + v_msgEng="Please review your entry!"; + alert_ebene(v_msg, v_msgEng); + return false; + } + + donnees = 'codeGcAssureur='+codeGcAssureur+'&codeEnteteTrancheAge='+codeEnteteTrancheAge+'&ageMax='+ageMax; + + v_msg="Confirmez-vous cette ajout?"; + v_msgEng="Do you confirm this addition?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtrancheage/ajouterunetrancheage/", + type: 'POST', + data: donnees, + success: function(data) + { + // $('#div_test_gabarit').html(data); + }, + error: function(data) { + }, + complete: function() { + afficher_trancheage(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + } +} + + +function validation_ancien_numero() +{ + ancienNumeroAssure = $('#ancienNumeroAssure').val(); + conserverAncienNumeroAssure = $('#conserverAncienNumeroAssure').val(); + + if(conserverAncienNumeroAssure=="1"){ + + if(ancienNumeroAssure<=" "){ + v_msg="Veuillez saisir l'ancien numéro d'assuré!"; + v_msgEng="Please enter the old insurance number!"; + alert_ebene(v_msg, v_msgEng); + + $('#ancienNumeroAssure').focus(); + + $('#conserverAncienNumeroAssure').val("0"); + return; + } + + donnees="ancienNumeroAssure="+ancienNumeroAssure; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxanciennumeroassure/", + type: 'POST', + data: donnees, + success: function(data) + { + $('#div_validation').html(data); + + valider = $("#valider").val(); + + if(valider>"0"){ + v_msg="L'ancien numéro assuré saisi existe déjà pour un autre bénéficiaire. Remplacer le!"; + v_msgEng="The old insured number entered already exists for another beneficiary. Replace it!"; + alert_ebene(v_msg, v_msgEng); + + $('#ancienNumeroAssure').focus(); + $('#ancienNumeroAssure').val(""); + $('#conserverAncienNumeroAssure').val("0"); + + return; + } + + + + }, + error: function(data) { + }, + complete: function() { + + } + }); + }else{ + + if(ancienNumeroAssure >" "){ + + v_msg="Cet ancien numéro assuré ne sera retenu comme numéro bénéficiaire que si vous le conservez par la suite!"; + v_msgEng="This old insured number will only be retained as a beneficiary number if you keep it afterwards!"; + + alert_ebene(v_msg, v_msgEng); + + } + + } + +} +// Ajaxselectionsuspensionassure +function pop_afficher_selection_suspension_assure() +{ + var div_selection_assure = $('#div_selection_assure'); + div_selection_assure.html('
' + '
'); + $("#btn_pop").click(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionsuspensionassure/", + 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_suspendre(p_choix, p_id_beneficiaire) +{ + donnees = 'idBeneficiaire='+p_id_beneficiaire; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionsuspensionassure/selectionner/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function actualiser_suspension_assure() +{ + var div_assure_a_retirer = $('#div_assure_a_retirer'); + + div_assure_a_retirer.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailsuspensionassure/", + type: 'POST', + success: function(data) { + div_assure_a_retirer.html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +// enregistrer_avenant_incorporation_garantie +function enregistrer_suspension_assure() +{ + var div_assure_a_retirer = $('#div_assure_a_retirer'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailsuspensionassure/", + 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 à suspendre!"; + v_msgEng="Please select people to suspend!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous la suspension des personnes sélectionnées de cette police?"; + v_msgEng="Do you confirm the suspension of selected individuals from this policy?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Suspensionassure/enregistrer/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + } + }); + + +} + +function pop_afficher_selection_remiseenvigueur_assure() +{ + var div_selection_assure = $('#div_selection_assure'); + div_selection_assure.html('
' + '
'); + $("#btn_pop").click(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionremiseenvigueurassure/", + 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_remettreenvigueur(p_choix, p_id_beneficiaire) +{ + donnees = 'idBeneficiaire='+p_id_beneficiaire; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionremiseenvigueurassure/selectionner/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function actualiser_remiseenvigueur_assure() +{ + var div_assure_a_retirer = $('#div_assure_a_retirer'); + + div_assure_a_retirer.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailremiseenvigueurassure/", + type: 'POST', + success: function(data) { + div_assure_a_retirer.html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function enregistrer_remiseenvigueur_assure() +{ + var div_assure_a_retirer = $('#div_assure_a_retirer'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailremiseenvigueurassure/", + 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 à remettre en vigueur!"; + v_msgEng="Please select the people to reinstate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous la remise en vigueur des personnes sélectionnées de cette police?"; + v_msgEng="Do you confirm the reinstatement of selected persons of this policy?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Remiseenvigueurassure/enregistrer/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + } + }); + + +} + + +function filtregarantiecollege() +{ + var idCollegePolice = $('#idCollegePolice').val(); + + if(idCollegePolice ==""){ + idCollegePolice = "0"; + } + + donnees = 'idCollegePolice='+idCollegePolice; + + var div_garantieproduit = $('#div_garantieproduit'); + + div_garantieproduit.html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltregarantiecollege/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + div_garantieproduit.html(data); + //afficher_adherents_police(); + + + }, + complete: function() { + + } + }); + +} + +function incorporer_une_garantie_college(codeGarantie) +{ + var idCollegePolice = $('#idCollegePolice').val(); + + if (idCollegePolice<=" ") + { + v_msg="Veuillez sélectionner un collège!"; + v_msgEng="Please select a college!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idCollegePolice='+idCollegePolice+'&codeGarantie='+codeGarantie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltregarantiecollege/incorporer/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + filtregarantiecollege(); + } + }); +} + +function annuler_une_garantie_college(idGarantie) +{ + donnees = 'idGarantie='+idGarantie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltregarantiecollege/annuler/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + filtregarantiecollege(); + } + }); +} + +// +function enregistrer_avenant_incorporation_garantie() +{ + v_msg="Confirmez-vous l'incorporation des garanties à cette police?"; + v_msgEng="Do you confirm the incorporation of the guarantees into this policy?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltregarantiecollege/enregistrer/", + type: 'POST', + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + // window.location.assign($("#racineWeb" ).val()+"Fichepolice/"); + window.location.assign($("#racineWeb" ).val()+"Listeavenant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function filtregarantiecollegeretrait() +{ + var idCollegePolice = $('#idCollegePolice').val(); + + if(idCollegePolice ==""){ + idCollegePolice = "0"; + } + + donnees = 'idCollegePolice='+idCollegePolice; + + var div_garantieproduit = $('#div_garantieproduit'); + + div_garantieproduit.html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltregarantiecollegeretrait/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + div_garantieproduit.html(data); + //afficher_adherents_police(); + + + }, + complete: function() { + + } + }); + +} + + +function retirer_une_garantie_college(codeGarantie) +{ + var idCollegePolice = $('#idCollegePolice').val(); + + if (idCollegePolice<=" ") + { + v_msg="Veuillez sélectionner un collège!"; + v_msgEng="Please select a college!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idCollegePolice='+idCollegePolice+'&codeGarantie='+codeGarantie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltregarantiecollegeretrait/retirer/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + filtregarantiecollegeretrait(); + } + }); +} + + +function annuler_une_garantie_college_retrait(idGarantie) +{ + donnees = 'idGarantie='+idGarantie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltregarantiecollegeretrait/annuler/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + filtregarantiecollegeretrait(); + } + }); +} + +// +function enregistrer_avenant_retrait_garantie() +{ + v_msg="Confirmez-vous le retrait des garanties à cette police?"; + v_msgEng="Do you confirm the withdrawal of coverage from this policy?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltregarantiecollegeretrait/enregistrer/", + type: 'POST', + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + // window.location.assign($("#racineWeb" ).val()+"Fichepolice/"); + window.location.assign($("#racineWeb" ).val()+"Listeavenant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function filtregarantiesparcollege() +{ + var idCollegePolice = $('#idCollegePolice').val(); + var div_garanties_college = $('#div_garanties_college'); + + donnees = 'idCollegePolice='+idCollegePolice; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltregarantiesparcollege/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + div_garanties_college.html(data); + $("#codeGarantie").val(""); + }, + complete: function() { + + } + }); + + +} + +function filtreactecollegeretrait() +{ + var idCollegePolice = $('#idCollegePolice').val(); + var codeGarantie = $('#codeGarantie').val(); + + if (codeGarantie<=" ") + { + v_msg="Veuillez sélectionner une garantie!"; + v_msgEng="Please select a guarantee!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeGarantie').focus(); + + return; + } + + donnees = 'idCollegePolice='+idCollegePolice+'&codeGarantie='+codeGarantie; + + var div_garantieproduit = $('#div_garantieproduit'); + + div_garantieproduit.html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltreactecollegeretrait/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + div_garantieproduit.html(data); + appliquerDataTable(); + + + }, + complete: function() { + + } + }); + +} + +function retirer_un_acte_college(codeGarantie, codeActe) +{ + var idCollegePolice = $('#idCollegePolice').val(); + + if (idCollegePolice<=" ") + { + v_msg="Veuillez sélectionner un collège!"; + v_msgEng="Please select a college!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idCollegePolice='+idCollegePolice+'&codeGarantie='+codeGarantie+'&codeActe='+codeActe; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltreactecollegeretrait/retirer/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + filtreactecollegeretrait(); + } + }); +} + +// +function annuler_retrait_un_acte_college(idActe) +{ + donnees = 'idActe='+idActe; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltreactecollegeretrait/annuler/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + filtreactecollegeretrait(); + } + }); +} + + +function enregistrer_avenant_retrait_acte() +{ + v_msg="Confirmez-vous le retrait des actes à cette police?"; + v_msgEng="Do you confirm the withdrawal of deeds from this policy?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltreactecollegeretrait/enregistrer/", + type: 'POST', + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + // window.location.assign($("#racineWeb" ).val()+"Fichepolice/"); + window.location.assign($("#racineWeb" ).val()+"Listeavenant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function mode_calcul_prime_college() +{ + var idCollege = $('#idCollege').val(); + + if (idCollege<=" ") + { + + return; + } + + var div_modeCalculPrime = $('#div_modeCalculPrime'); + + donnees = 'idCollege='+idCollege; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmodecalculeprimecollege/", + type: 'POST', + data: donnees, + success: function(data) { + div_modeCalculPrime.html(data); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function liste_ententeprealables_dent() +{ + window.location.assign($("#racineWeb" ).val()+"Listeententeprealabledent/"); +} + +function Listeententeprealabledent() +{ + codeReponseEntentePrealable=$("#codeReponseEntentePrealable").val(); + debut=$("#debut").val(); + fin=$("#fin").val(); + + donnees = 'codeReponseEntentePrealable='+codeReponseEntentePrealable; + donnees += '&debut='+debut+'&fin='+fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxententeprealabledent/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ententeprealable").html(data); + }, + complete: function() { + } + }); +} + + + + +function liste_ententeprealables_hospi() +{ + window.location.assign($("#racineWeb" ).val()+"Listeententeprealablehospi/"); +} + +function Listeententeprealablehospi() +{ + codeReponseEntentePrealable=$("#codeReponseEntentePrealable").val(); + debut=$("#debut").val(); + fin=$("#fin").val(); + + donnees = 'codeReponseEntentePrealable='+codeReponseEntentePrealable; + donnees += '&debut='+debut+'&fin='+fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Listeententeprealablehospi/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ententeprealable").html(data); + }, + complete: function() { + } + }); +} + + +function listeententeprealablesdent() +{ + codeReponseEntentePrealable=$("#codeReponseEntentePrealable").val(); + debut=$("#debut").val(); + fin=$("#fin").val(); + + donnees = 'codeReponseEntentePrealable='+codeReponseEntentePrealable; + donnees += '&debut='+debut+'&fin='+fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxententeprealablesdent/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ententeprealable").html(data); + }, + complete: function() { + } + }); +} + +function listeententeprealableshospi() +{ + codeReponseEntentePrealable=$("#codeReponseEntentePrealable").val(); + debut=$("#debut").val(); + fin=$("#fin").val(); + + donnees = 'codeReponseEntentePrealable='+codeReponseEntentePrealable; + donnees += '&debut='+debut+'&fin='+fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxententeprealableshospi/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ententeprealable").html(data); + }, + complete: function() { + } + }); +} + +function accepterrefusertouslesmedicaments() { + + modeSaisieFeuille = $("#modeSaisieFeuille").val(); + + idPrescription = $("#idPrescription").val(); + numeroFeuilleMaladie = $("#numeroFeuilleMaladie").val(); + + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifRefusPrestataire").val(); + motifRefusPrestataire = $("#motifRefusPrestataire").val(); + + entente = $("#entente").val(); + refuser = $("#refuser").val(); + accepter = $("#accepter").val(); + smsenoye = $("#smsenoye").val(); + + + if (refuser > 0) { + typeMailRefus = 'refusententeprealablepha'; + typeSmsRefus = "refusententeprealablepha"; + + } + + if (accepter > 0) { + typeMailAccord = "accordententeprealablepha"; + typeSmsAccord = "accordententeprealablepha"; + } + + if (accepter > 0 && refuser > 0) { + var accepterRefuser = 1; + } + + + if ((motifReel == "" || motifReel <= " ") && (accepter > 0)) { + motifReel = "BON POUR ACCORD"; + $("#motifReel").val(motifReel); + } + + + if ((motifRefusAssure == "" || motifRefusPrestataire <= " ") && (refuser > 0)) { + $("#btn-fermer-modal").removeAttr('data-bs-dismiss'); + v_msg = "Veuillez saisir un motif de refus pour l\'assuré! et le prestataire"; + v_msgEng = "Please enter a reason for refusal for the insured! and the service provider"; + alert_ebene(v_msg, v_msgEng); + + $("#motifRefusPrestataire").focus(); + return; + }else{ + v_msg = "Confirmez-vous la liste des medicaments?"; + v_msgEng = "DDo you confirm the list of medications?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + codePrestataire = $("#codePrestataireMedicament").val(); + + donnees = 'idPrescription=' + idPrescription + '&motifReel=' + motifReel + '&motifRefusAssure=' + + motifRefusAssure + '&codePrestataire=' + codePrestataire + + '&refuser=' + refuser + '&entente=' + entente + + '&accepter=' + accepter + + '&numeroFeuilleMaladie=' + numeroFeuilleMaladie + + '&motifRefusPrestataire=' + motifRefusPrestataire; + + donnees_sav = donnees; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxententeprealablesbenficiaire/accepterrefusertouslesmedicaments/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + if (modeSaisieFeuille != 1) { + if ((refuser > "0") && (smsenoye != "1") && (accepterRefuser != 1)) { + preparesmsRefus(typeSmsRefus); + } + if ((accepter > "0") && (smsenoye != "1") && (accepterRefuser != 1)) { + debugger + preparesmsAccord(typeSmsAccord); + } + if (accepterRefuser == 1 && (smsenoye != "1")) { + preparesmsAccordRefus(typeSmsAccord, typeSmsRefus); + } + } + }, + complete: function () { + + + liste_ententeprealables_pha(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + } + +} + +function refusermedicament(idMedicament, numeroFeuilleMaladie, p_choix) { + + + + donnees = 'idMedicament=' + idMedicament + "&numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + if (p_choix == 1) { + $.ajax({ + url: $("#racineWeb").val() + "Ajaxmedicamentsprescrits/refusermedicament/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_medicaments_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + }else{ + $.ajax({ + url: $("#racineWeb").val() + "Ajaxmedicamentsprescrits/annulerrefusermedicament/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_medicaments_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + } + +} +/* ENLEVER PARCE QUE CA RETOURNE DES ERREURS*/ +function ajax_maj_qte_prescrit_medicament(idMedicament, quantite, controle) { + + donnee_a_affciher = ""; + + quantite = quantite.replace(",", "."); + controle.value = quantite; + + if (controle_numerique(controle)) { + if (quantite == 0) { + controle.focus(); + v_msg = "Veuillez saisir la quantit\u00e9!"; + v_msgEng = "Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idMedicament=' + idMedicament + "&quantite=" + quantite; + + //alert(donnees); + //return; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsentente/majquantiteaccorde/", + type: 'POST', + data: donnees, + success: function (data) { + + }, + error: function (data) { + }, + complete: function () { + affiche_liste_phar_provisoire(); + } + }); + } +} + +function preparesmsRefus(typeSmsRefus) { + + envoismsactif = $("#envoismsactif").val(); + if (envoismsactif == "0") { + return; + } + + codeLangueSociete = $("#codeLangueSociete").val(); + + p_destinataires = ""; + p_message = ""; + creation_message = "1"; + + + if (typeSmsRefus == "refusententeprealable") { + p_destinataires = $("#smsGestionPrestataire").val(); + entente = $("#entente").val(); + accepter = $("#accepter").val(); + refuser = $("#refuser").val(); + + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure == "1") { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + prestataire = $("#prestataire").val(); + numeroBonExamen = $("#numeroBonExamen").val(); + libelleActe = $("#libelleActe").val(); + motifRefusAssure = $("#motifRefusPrestataire").val(); + + p_message = (codeLangueSociete == "en_US") ? "Act refused : " : "Actes refusés : "; + + p_message += "\n"; + + if (refuser > 0) { + for (let i = 1; i <= refuser; i++) { + p_message += '- ' + $("#libelleActeRefuser_" + i).val(); + p_message += "\n"; + } + } else { + p_message += libelleActe; + p_message += "\n"; + } + + p_message += "Motif de refus : " + motifRefusAssure + " "; + + + + } + + if (typeSmsRefus == "refusententeprealablepha") { + + //pour fraza + p_destinataires = $("#smsGestionPrestataire").val(); + entente = $("#entente").val(); + accepter = $("#accepter").val(); + refuser = $("#refuser").val(); + + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure == "1") { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + prestataire = $("#prestataire").val(); + numeroBonExamen = $("#numeroBonExamen").val(); + numeroBonOrdonnance = $("#numeroBonOrdonnance").val(); + //numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleMedicament = $("#libelleMedicament").val(); + motifRefusAssure = $("#motifRefusPrestataire").val(); + motifReel = $("#motifReel").val(); + + //p_message = prestataire+" "; + + p_message = (codeLangueSociete == "en_US") ? "Act refused : " : "Médicaments refusés : "; + + p_message += "\n"; + + if (refuser > 0) { + for (let i = 1; i <= refuser; i++) { + p_message += '- ' + $("#libelleMedicamentRefuser_" + i).val(); + p_message += "\n"; + } + } else { + p_message += libelleMedicament; + p_message += "\n"; + } + + p_message += "Motif de refus : " + motifRefusAssure + " "; + + + } + + + envoyersms(p_destinataires, p_message, creation_message); +} + + +function preparesmsAccord(typeSmsAccord) { + + envoismsactif = $("#envoismsactif").val(); + if (envoismsactif == "0") { + return; + } + + codeLangueSociete = $("#codeLangueSociete").val(); + + p_destinataires = ""; + p_message = ""; + creation_message = "1"; + + if (typeSmsAccord == "accordententeprealable") { + + + p_destinataires = $("#smsGestionPrestataire").val(); + entente = $("#entente").val(); + accepter = $("#accepter").val(); + refuser = $("#refuser").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + + if (copieSmsPrestataireAssure == "1") { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + prestataire = $("#prestataire").val(); + numeroBonExamen = $("#numeroBonExamen").val(); + libelleActe = $("#libelleActe").val(); + motifReel = $("#motifReel").val(); + + if ((motifReel == "" || motifReel <= " ") && (accepter > 0)) { + motifReel = "BON POUR ACCORD"; + } + + + p_message = (codeLangueSociete == "en_US") ? "Act granted : " : "Actes accordés : "; + + p_message += "\n"; + + if (accepter > 0) { + for (let i = 1; i <= accepter; i++) { + p_message += '- ' + $("#libelleActeAccepter_" + i).val(); + p_message += "\n"; + } + } else { + p_message += libelleActe; + p_message += "\n"; + } + + p_message += "Observation : " + motifReel + " "; + + + } + + if (typeSmsAccord == "accordententeprealablepha") { + + + p_destinataires = $("#smsGestionPrestataire").val(); + entente = $("#entente").val(); + accepter = $("#accepter").val(); + refuser = $("#refuser").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(); + numeroBonOrdonnance = $("#numeroBonOrdonnance").val(); + libelleMedicament = $("#libelleMedicament").val(); + motifReel = $("#motifReel").val(); + if ((motifReel == "" || motifReel <= " ") && (accepter > 0)) { + motifReel = "BON POUR ACCORD"; + } + p_message = (codeLangueSociete == "en_US") ? "Act granted : " : "Médicaments accordés : "; + + p_message += "\n"; + + if (accepter > 0) { + for (let i = 1; i <= accepter; i++) { + p_message += '- ' + $("#libelleMedicamentAccepter_" + i).val(); + p_message += "\n"; + } + } else { + p_message += libelleMedicament; + p_message += "\n"; + } + + p_message += "Observation : " + motifReel + " "; + + } + + + envoyersms(p_destinataires, p_message, creation_message); +} + +function preparesmsAccordRefus(typeSmsAccord, typeSmsRefus) { + + envoismsactif = $("#envoismsactif").val(); + if (envoismsactif == "0") { + return; + } + + codeLangueSociete = $("#codeLangueSociete").val(); + + p_destinataires = ""; + p_message = ""; + creation_message = "1"; + + + if (typeSmsAccord == "accordententeprealable" && typeSmsRefus == "refusententeprealable") { + + + p_destinataires = $("#smsGestionPrestataire").val(); + entente = $("#entente").val(); + accepter = $("#accepter").val(); + refuser = $("#refuser").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + + if (copieSmsPrestataireAssure == "1") { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + prestataire = $("#prestataire").val(); + numeroBonExamen = $("#numeroBonExamen").val(); + libelleActe = $("#libelleActe").val(); + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifRefusPrestataire").val(); + //p_message = prestataire+" "; + if ((motifReel == "" || motifReel <= " ") && (accepter > 0)) { + motifReel = "BON POUR ACCORD"; + } + + p_message = (codeLangueSociete == "en_US") ? "Act refused : " : "Actes refusé : "; + + p_message += "\n"; + + if (refuser > 0) { + for (let i = 1; i <= refuser; i++) { + p_message += '- ' + $("#libelleActeRefuser_" + i).val(); + p_message += "\n"; + } + } else { + p_message += libelleActe; + p_message += "\n"; + } + + p_message += "Motif de refus : " + motifRefusAssure + " "; + + p_message += "\n"; + + p_message += (codeLangueSociete == "en_US") ? "Act granted : " : "Actes accordés : "; + + p_message += "\n"; + + if (accepter > 0) { + for (let i = 1; i <= accepter; i++) { + p_message += '- ' + $("#libelleActeAccepter_" + i).val(); + p_message += "\n"; + } + } else { + p_message += libelleActe; + p_message += "\n"; + } + + p_message += "Observation : " + motifReel + " "; + //p_message += "\n"; + + } + + if (typeSmsAccord == "accordententeprealablepha" && typeSmsRefus == "refusententeprealablepha") { + + + p_destinataires = $("#smsGestionPrestataire").val(); + entente = $("#entente").val(); + accepter = $("#accepter").val(); + refuser = $("#refuser").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(); + numeroBonOrdonnance = $("#numeroBonOrdonnance").val(); + libelleMedicament = $("#libelleMedicament").val(); + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifRefusPrestataire").val(); + + p_message = (codeLangueSociete == "en_US") ? "Act refused : " : "Médicaments refusés : "; + + p_message += "\n"; + + if (refuser > 0) { + for (let i = 1; i <= refuser; i++) { + p_message += '- ' + $("#libelleMedicamentRefuser_" + i).val(); + p_message += "\n"; + } + } else { + p_message += libelleMedicament; + p_message += "\n"; + } + + p_message += "Motif de refus : " + motifRefusAssure + " "; + + p_message += "\n"; + + p_message += (codeLangueSociete == "en_US") ? "Act granted : " : "Medicaments accordés : "; + + p_message += "\n"; + + if (accepter > 0) { + for (let i = 1; i <= accepter; i++) { + p_message += '- ' + $("#libelleMedicamentAccepter_" + i).val(); + p_message += "\n"; + } + } else { + p_message += libelleMedicament; + p_message += "\n"; + } + + p_message += "Observation : " + motifReel + " "; + } + + + envoyersms(p_destinataires, p_message, creation_message); +} + + +function validerTousLesMedicaments(numeroFeuilleMaladie, p_choix) { + + + donnees = "&numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxmedicamentsprescrits/validertousmedicaments/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_medicaments_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + +} + + +function annulerValiderTousLesMedicaments(numeroFeuilleMaladie, p_choix) { + + + donnees = "&numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxmedicamentsprescrits/annulervalidertous/", + type: 'POST', + data: donnees, + success: function (data) { + + $("#div_medicaments_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + +} + +function refuserTousLesMedicaments(numeroFeuilleMaladie, p_choix) { + + + donnees = "numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxmedicamentsprescrits/refusertousmedicaments/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_medicaments_prescrits").html(data); + + }, + error: function (data) { + }, + complete: function () { + } + }); + +} + + +function annulerRefuserTousLesMedicaments(numeroFeuilleMaladie, p_choix) { + + + donnees = "numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxmedicamentsprescrits/annulerrefusertous/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_medicaments_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + +} + +function validermedicament(idMedicament, numeroFeuilleMaladie, p_choix) { + + donnees = 'idMedicament=' + idMedicament + "&numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + + if (p_choix == 1) { + $.ajax({ + url: $("#racineWeb").val() + "Ajaxmedicamentsprescrits/validermedicament/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_medicaments_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + }else{ + $.ajax({ + url: $("#racineWeb").val() + "Ajaxmedicamentsprescrits/annulervalidermedicament/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_medicaments_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + } + +} + + +function accepterrefusertouslesexamens() { + + modeSaisieFeuille = $("#modeSaisieFeuille").val(); + codePrestataire = $("#codePrestataireExamen").val(); + + + idExamen = $("#idExamen").val(); + numeroFeuilleMaladie = $("#numeroFeuilleMaladie").val(); + + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifRefusPrestataire").val(); + motifRefusPrestataire = $("#motifRefusPrestataire").val(); + + entente = $("#entente").val(); + refuser = $("#refuser").val(); + accepter = $("#accepter").val(); + smsenoye = $("#smsenoye").val(); + + + if (refuser > 0) { + typeMailRefus = 'refusententeprealable'; + typeSmsRefus = "refusententeprealable"; + } + + if (accepter > 0) { + typeMailAccord = "accordententeprealable"; + typeSmsAccord = "accordententeprealable"; + } + + if (accepter > 0 && refuser > 0) { + var accepterRefuser = 1; + } + + + if ((motifReel == "" || motifReel <= " ") && (accepter > 0)) { + motifReel = "BON POUR ACCORD"; + + $("#motifReel").val(motifReel); + } + + + if ((motifRefusAssure <= " " || motifRefusPrestataire <= " ") && (refuser > 0)) { + v_msg = "Veuillez saisir le motif du refus!"; + v_msgEng = "Please enter the reason for the refusal!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifRefusAssure").focus(); + return; + }else{ + + + v_msg = "Confirmez-vous la liste des examens?"; + v_msgEng = "Do you confirm this refusal?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'idExamen=' + idExamen + '&motifReel=' + motifReel; + donnees += '&motifRefusAssure='+ motifRefusAssure + '&codePrestataire='+ codePrestataire; + donnees += '&refuser=' + refuser + '&entente=' + entente + '&accepter=' + accepter; + donnees += '&numeroFeuilleMaladie=' + numeroFeuilleMaladie + '&motifRefusPrestataire=' + motifRefusPrestataire; + + donnees_sav = donnees; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxententeprealablesbenficiaire/accepterrefusertouslesexamens/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + if (modeSaisieFeuille != 1) { + if ((refuser > 0) && (accepterRefuser != 1)) { + + preparesmsRefus(typeSmsRefus); + } + if ((accepter > 0) && (accepterRefuser != 1)) { + + preparesmsAccord(typeSmsAccord); + } + if (accepterRefuser == 1) { + preparesmsAccordRefus(typeSmsAccord, typeSmsRefus); + } + } + }, + complete: function () { + + liste_ententeprealables(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + } + +} + +function validerTouteDemandes(numeroFeuilleMaladie, p_choix, codeTypePrestation) { + + codeLangue = $("#codeLangue").val(); + + donnees = "&numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + donnees +="&codeTypePrestation="+codeTypePrestation; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteactesprescrits/validerTouteDemandes/", + type: 'POST', + data: donnees, + success: function (data) { + + $("#div_examens_prescrits").html(data); + //controle.focus(); + if(codeLangue=="en_US") + { + $("#motifReel").val("GOOD FOR AGREEMENT"); + }else{ + $("#motifReel").val("BON POUR ACCORD"); + } + }, + error: function (data) { + }, + complete: function () { + } + }); + +} + +function refuserTouteDemandes(numeroFeuilleMaladie, p_choix, codeTypePrestation) { + + + donnees = "numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + donnees +="&codeTypePrestation="+codeTypePrestation; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteactesprescrits/refuserTouteDemandes/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_examens_prescrits").html(data); + + }, + error: function (data) { + }, + complete: function () { + } + }); + +} + +function validerexamen(idExamen, numeroFeuilleMaladie, p_choix, codeTypePrestation) { + + + donnees = 'idExamen=' + idExamen + "&numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + donnees +="&codeTypePrestation="+codeTypePrestation; + + if (p_choix == 1) { + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteactesprescrits/validerexamen/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_examens_prescrits").html(data); + + }, + error: function (data) { + }, + complete: function () { + } + }); + } else { + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteactesprescrits/annulervalidationexamen/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_examens_prescrits").html(data); + + }, + error: function (data) { + }, + complete: function () { + } + }); + } + + +} + + +function refuserexamen(idExamen, numeroFeuilleMaladie, p_choix, codeTypePrestation) { + + + donnees = 'idExamen=' + idExamen + "&numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + donnees +="&codeTypePrestation="+codeTypePrestation; + + if (p_choix == 1) { + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteactesprescrits/refuserexamen/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_examens_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + } else { + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteactesprescrits/annulerrefusexamen/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_examens_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + } +} + +function annulerValiderTouteDemandes(numeroFeuilleMaladie, p_choix, codeTypePrestation) { + + + donnees = "&numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + donnees +="&codeTypePrestation="+codeTypePrestation; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteactesprescrits/annulervaliderTouteDemande/", + type: 'POST', + data: donnees, + success: function (data) { + + $("#div_examens_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + +} + +function annulerRefuserTouteDemandes(numeroFeuilleMaladie, p_choix, codeTypePrestation) { + + + donnees = "numeroFeuilleMaladie=" + numeroFeuilleMaladie + "&p_choix=" + p_choix; + donnees +="&codeTypePrestation="+codeTypePrestation; + + //$("#div_examens").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteactesprescrits/annulerRefuserTouteDemandes/", + type: 'POST', + data: donnees, + success: function (data) { + $("#div_examens_prescrits").html(data); + //controle.focus(); + }, + error: function (data) { + }, + complete: function () { + } + }); + +} + +function ajax_maj_prime_produit_lienparente(idPrime, prime, controle) +{ + prime=prime.replace(/ /g,""); + prime=parseInt(prime.replace(",","."),10); + controle.value=prime; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&prime="+prime; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimelienparente/majprimeproduitlienparente/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + + +function ajax_maj_plafond_produit_lienparente(idPrime, plafond, controle) +{ + plafond=plafond.replace(/ /g,""); + plafond=parseInt(plafond.replace(",","."),10); + controle.value=plafond; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&plafond="+plafond; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimelienparente/majplafondproduitlienparente/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + +function ajax_maj_autoriser_produit_lienparente(idPrime, autorise, controle, ligne) +{ + donnees = 'idPrime='+idPrime+"&autorise="+autorise; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimelienparente/majautoriserproduitlienparente/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + + +} + +function ajax_maj_nbrefamille_produit_lienparente(idPrime, nbrefamille, controle) +{ + nbrefamille=nbrefamille.replace(/ /g,""); + nbrefamille=parseInt(nbrefamille.replace(",","."),10); + controle.value=nbrefamille; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&nbrefamille="+nbrefamille; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimelienparente/majnbrefamilleproduitlienparente/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + +function ajax_maj_supplementaire_produit_lienparente(idPrime, supplementaire, controle) +{ + supplementaire=supplementaire.replace(/ /g,""); + supplementaire=parseInt(supplementaire.replace(",","."),10); + controle.value=supplementaire; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&supplementaire="+supplementaire; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimelienparente/majsupplementaireproduitlienparente/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + +function consulter_produit(idProduit) +{ + window.location.assign($("#racineWeb" ).val()+"Consulterproduit/"+idProduit+"/"); +} + +/* +function etatBarMenu() +{ + + + var bar = "0"; + + if (body.classList.contains('toggle-sidebar')) { + bar = "1"; + } else { + bar = "0"; + } + + donnees = 'bar='+bar; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxetatbarmenu/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_etat_menu").html(data); + }, + error: function(data) { + }, + complete: function() { + hideBar(); + } + }); + +} +*/ + +/* +function hideBar() +{ + + + bar = $("#bar").val(); + + if(bar=="1"){ + + body.classList.remove("toggle-sidebar"); + }else{ + body.classList.add("toggle-sidebar"); + } + +} +*/ + +function ajax_maj_prime_ajuster(idCollege, prime, controle, codeLienParente) +{ + prime=prime.replace(",","."); + controle.value=prime; + + if(controle_numerique(controle)) + { + donnees = 'idCollege='+idCollege+"&prime="+prime+'&codeLienParente='+codeLienParente; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxajustementprime/majprime/", + type: 'POST', + data: donnees, + success: function(data) { + // $("#div_test_gabarit").html(data); + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + +function recapituler_ajustement() +{ + donnees = ''; + + $("#div_college").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxajustementprime/recapituler/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_college").html(data); + + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + +function enregistrer_ajustementprime() +{ + donnees = ''; + + v_msg="Confirmez-vous l'ajustement des primes de cette police?"; + v_msgEng="Can you confirm the premium adjustment for this policy?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxajustementprime/enregistrer/", + type: 'POST', + data: donnees, + success: function(data) { + //$("#div_college").html(data); + + }, + error: function(data) { + }, + complete: function() { + // window.location.assign($("#racineWeb" ).val()+"Fichepolice/"); + window.location.assign($("#racineWeb" ).val()+"Facturerpolice/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function ajax_maj_autoriser_college_temp(idPrime, autorise, controle, modeDevis) +{ + + donnees = 'idPrime='+idPrime+"&autorise="+autorise; + + if(modeDevis == "0"){ + v_url = "Ajaxprimescategorie/majautorisercollege/"; + }else{ + v_url = "Ajaxprimescategoried/majautorisercollege/"; + } + + $.ajax({ + url: $("#racineWeb").val()+v_url, + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + if(modeDevis == "0"){ + enregistrer_college_temp(); + }else{ + enregistrer_college_temp_d(); + } + } + }); + +} + + +function affichertoutfacturationprime() +{ + $("#div_page_complet").html('
' + '
'); + // + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturerpolice/affichertoutfacturationprime/", + type : 'post', + // data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_page_complet").html(data); + appliquerDataTable(); + }, + complete: function() { + } + }); +} + +function importer_modele_assure(idAvenant) +{ + etape2=$("#etape2").val(); + + if (etape2 != "1") + { + v_msg="Etape 2 incomplète!"; + v_msgEng="Incomplete step 2!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $('#div_form_upload').hide(); + + + var div_export = $('#div_exporter_liste_assures'); + + enregistrer_date_effet(); + + div_export.html('
' + '
'); + + cheminFichier=$("#cheminFichier").val(); + + donnees = 'idAvenant='+idAvenant+'&cheminFichier='+cheminFichier; + + $("#div_erreur_excel").html(""); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassure/importermodele/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(''); + $("#div_erreur_excel").html(data); + + v_msg="Opération terminée avec succès!"; + v_msgEng="Operation completed successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + div_export.html(''); + + succes_impot_execl=$("#succes_impot_execl").val(); + + if (succes_impot_execl == "1") + { + maj_etape_3_import_assures(); + } + } + }); +} + +// + +function saisie_date_entree(idAvenant){ + + + $("#div_patienter").html('
' + '
'); + + donnees = 'idAvenant='+idAvenant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsaisidateassure/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $("#div_patienter").html(''); + $('#div_saisie_date').html(data); + $(".datepicker" ).datepicker(); + $('#div_saisie_date').modal("show"); + + }, + complete: function() { + + } + }); +} + +function enregistrer_date_effet() +{ + dateEffet = $("#dateEntree").val(); + + donnees = 'dateEffet='+dateEffet; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsaisidateassure/majdateeffet/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + + + }, + complete: function() { + + } + }); + +} + + +function annulation_quittance(){ + annule = $("#annule").val(); + annulant= $("#annulant").val(); + + if(annule=="1" || annulant=="1"){ + v_msg="Emission déjà annulée!"; + v_msgEng="Issue already canceled!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#div_patienter").html('
' + '
'); + + donnees = ''; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxannulerquittance/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $("#div_patienter").html(''); + $('#div_annulation_quittance').html(data); + $('#div_annulation_quittance').modal("show"); + + }, + complete: function() { + + } + }); +} + +function valier_annulation_quittance(idEmission) +{ + var motifAnnulation = $("#motifAnnulation").val(); + + if(motifAnnulation<=" "){ + v_msg = "Veuillez saisir le motif d'annulation de la quittance!"; + v_msgEng = "Please enter the reason for cancelling the receipt!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifAnnulation").focus(); + return false; + + } + + $("#div_wait").html('
' + '
'); + + $("#btn_annulation").prop("disabled",true); + + donnees = 'idEmission='+idEmission+'&motifAnnulation='+motifAnnulation; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxannulerquittance/valider/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + $("#btn_annulation").prop("disabled",false); + + v_msg="Emission annulmée avec effectué!"; + v_msgEng="Successfuly done!"; + alert_ebene(v_msg, v_msgEng); + + afficher_emission(idEmission); + }, + complete: function() { + + } + }); +} + +function nb_famille_atteint() +{ + codeLienParente = $("#codeLienParente").val(); + + $("#btn_enreg_ben").enable(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxproraterprimebeneficiaire/nbfamilleatteint/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_nbfamilleatteint').html(data); + + nbfamilleatteint = $("#nbfamilleatteint").val(); + + if(nbfamilleatteint=="1"){ + $("#btn_enreg_ben").disable(); + + v_msg = "Population maximum atteinte pour ce lien parenté!"; + v_msgEng = "Maximum population reached for this relationship"; + alert_ebene(v_msg, v_msgEng); + } + }, + complete: function() { + + } + }); + +} + + +function ajax_maj_Agemin_produit_lienparente(idPrime, ageMin, controle) +{ + ageMin=ageMin.replace(/ /g,""); + ageMin=parseInt(ageMin.replace(",","."),10); + controle.value=ageMin; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&ageMin="+ageMin; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimelienparente/majagemin/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + + +function ajax_maj_Agemax_produit_lienparente(idPrime, ageMax, controle) +{ + ageMax=ageMax.replace(/ /g,""); + ageMax=parseInt(ageMax.replace(",","."),10); + controle.value=ageMax; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&ageMax="+ageMax; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimelienparente/majagemax/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + + +function ajax_maj_agemin_college_temp(idPrime, ageMin, controle, modeDevis) +{ + ageMin=ageMin.replace(/ /g,""); + ageMin=parseInt(ageMin.replace(",","."),10); + controle.value=ageMin; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&ageMin="+ageMin; + + if(modeDevis == "0"){ + v_url = "Ajaxprimescategorie/majagemincollege/"; + }else{ + v_url = "Ajaxprimescategoried/majagemincollege/"; + } + + $.ajax({ + url: $("#racineWeb").val()+v_url, + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + if(modeDevis == "0"){ + enregistrer_college_temp(); + }else{ + enregistrer_college_temp_d(); + } + } + }); + } +} + +function ajax_maj_agemax_college_temp(idPrime, ageMax, controle, modeDevis) +{ + ageMax=ageMax.replace(/ /g,""); + ageMax=parseInt(ageMax.replace(",","."),10); + controle.value=ageMax; + + if(controle_numerique(controle)) + { + donnees = 'idPrime='+idPrime+"&ageMax="+ageMax; + + if(modeDevis == "0"){ + v_url = "Ajaxprimescategorie/majagemaxcollege/"; + }else{ + v_url = "Ajaxprimescategoried/majagemaxcollege/"; + } + + $.ajax({ + url: $("#racineWeb").val()+v_url, + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + if(modeDevis == "0"){ + enregistrer_college_temp(); + }else{ + enregistrer_college_temp_d(); + } + } + }); + } +} + + +function filtrertypefacturegarant(){ + + var codeGcAssureur = $('#codeGcAssureur').val(); + + donnees ='codeGcAssureur='+codeGcAssureur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/filtretypefacture/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + $('#div_typefacture').html(data); + }, + complete: function(){ + } + }); + +} + +function initierfacturegarant() +{ + codeGcAssureur = $("#codeGcAssureur").val(); + dateFacture = $("#dateFacture").val(); + codeTypeFacturationGarant = $("#codeTypeFacturationGarant").val(); + codePeriodicite = $("#codePeriodicite").val(); + codeExercice = $("#codeExercice").val(); + + bonneDate = control_date_facture_garant(dateFacture, codeExercice); + + + if(!bonneDate) + { + v_msg="Veuillez revoir la date!"; + v_msgEng="Please review the date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateFacture").focus(); + return; + } + + if(codeGcAssureur<=" ") + { + v_msg="Veuillez sélectionner un garant!"; + v_msgEng="Please select a guarantor!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeGcAssureur").focus(); + return; + } + + if(codeTypeFacturationGarant<=" "){ + v_msg="Veuillez sélectionner un type de facturation!"; + v_msgEng="Please select a billing type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeFacturationGarant").focus(); + return; + + } + + if(codePeriodicite<=" "){ + v_msg="Veuillez sélectionner une périodicité!"; + v_msgEng="Please select a periodicity!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePeriodicite").focus(); + return; + + } + + donnees = 'codeGcAssureur='+codeGcAssureur+'&codeTypeFacturationGarant='+codeTypeFacturationGarant; + donnees += '&codePeriodicite='+codePeriodicite+'&codeExercice='+codeExercice+'&dateFacture='+dateFacture; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/initierfacturegarant/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Detailfacturegarant/"); + } + }); + +} + +function filtreperiodicitefacture(){ + + var codeGcAssureur = $('#codeGcAssureur').val(); + var codeNatureFacturationGarant = $('#codeNatureFacturationGarant').val(); + + if(codeGcAssureur<=" ") + { + v_msg="Veuillez sélectionner un garant!"; + v_msgEng="Please select a guarantor!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeGcAssureur").focus(); + return; + } + + if(codeNatureFacturationGarant<=" "){ + v_msg="Veuillez sélectionner la nature de la facture!"; + v_msgEng="Please select the nature of the invoice!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeNatureFacturationGarant").focus(); + return; + + } + + /* + if(codeNatureFacturationGarant=="DEF"){ + v_msg="Non implémenté pour le moment!"; + v_msgEng="Not implemented at the moment!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeNatureFacturationGarant").val(""); + $("#codeNatureFacturationGarant").focus(); + return; + } + */ + + donnees = 'codeGcAssureur='+codeGcAssureur+'&codeNatureFacturationGarant='+codeNatureFacturationGarant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/filtreperiodicite/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + $('#div_periodicite').html(data); + $("#codePeriodicite").disable(); + }, + complete: function(){ + + } + }); + +} + + +function maj_ht_facturegarant_temp() +{ + montantHt = parseInt($('#montantHt').val().replace(/ /g,"")); + + donnees = 'montantHt='+montantHt; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/majmontantht/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + $('#div_detail_facture').html(data); + }, + complete: function(){ + } + }); + +} + +function genererfacturecautiongarant() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfacturecaution/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichegroupefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + + +function ajax_maj_accessoire_facture_honoraire_prime (controle,p_accessoire, id) +{ + // p_accessoire=p_accessoire.replace(",","."); + parseInt(p_accessoire.replace(/ /g,"")); + + controle.value=p_accessoire; + + if(controle_numerique(controle)) + { + donnees = 'id='+id; + donnees += '&accessoire='+p_accessoire; + + + // debugger + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/majaccessoirehonorairePrime/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_detail_facture').html(data); + }, + error: function(data) { + }, + complete: function() { + + + } + }); + } +} + + +function genererfacturehonoraireprimegarant() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfacturehonoraireprime/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function genererfacturesinitresgarant() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfacturesinistre/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function genererfacturehonorairesinitresgarant() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfacturehonorairesinistre/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function select_garant_a_facturer(p_choix, id) +{ + donnees = 'id='+id; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/selectiongarant/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_garant').html(data); + + + + dataTab(); + }, + error: function(data) { + }, + complete: function() { + + //affichertoutfacturationprime(); + } + }); +} + +function select_typefacture_garant_a_facturer(p_choix, id) +{ + donnees = 'id='+id; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/selectiontypefacture/", + type: 'POST', + data: donnees, + success: function(data) { + $('#tab_type_facture').html(data); + }, + error: function(data) { + }, + complete: function() { + + //affichertoutfacturationprime(); + } + }); +} + + +function select_tous_garant_a_facturer(p_choix) +{ + + + donnees = 'choix='+p_choix; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/tousgarants/", + type: 'POST', + data: donnees, + success: function(data) { + + $('#div_garant').html(data); + + + + dataTab(); + }, + error: function(data) { + }, + complete: function() { + + //affichertoutfacturationprime(); + } + }); +} + +function select_tous_type_facture(p_choix) +{ + + donnees = 'choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/toustypefacture/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_type_facture').html(data); + + dataTab(); + }, + error: function(data) { + }, + complete: function() { + + //affichertoutfacturationprime(); + } + }); +} + +function fin_periode_facturation_garant() +{ + codeMoisDebut = $("#codeMoisDebut").val(); + + donnees = 'codeMoisDebut='+codeMoisDebut; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/finperiode/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_mois_fin').html(data); + }, + error: function(data) { + }, + complete: function() { + + //affichertoutfacturationprime(); + } + }); + + +} + +function control_date_facture_garant(dateFacture, exercice) +{ + tab = dateFacture.split('/'); + + annee = parseInt(tab[2]); + exercice = parseInt(exercice); + + return (exercice==annee); +} + +function filtrer_facture_garants() +{ + nbreGarantsSelection = $("#nbreGarantsSelection").val(); + nbreNatureFacSelection = $("#nbreNatureFacSelection").val(); + + + if (nbreGarantsSelection == "0"){ + v_msg="Veuillez s\u00e9lectionnez au moins un garant!"; + v_msgEng="Please select at least one guarantor!"; + + alert_ebene(v_msg, v_msgEng); + + $('#div_liste_facture_garant').html(''); + + return; + } + + if (nbreNatureFacSelection == "0"){ + v_msg="Veuillez s\u00e9lectionnez au moins une nature de facture!"; + v_msgEng="Please select at least one invoice type!"; + alert_ebene(v_msg, v_msgEng); + + $('#div_liste_facture_garant').html(''); + + return; + } + + debut = $("#debut").val(); + fin = $("#fin").val(); + + + + donnees = 'debut='+debut+'&fin='+fin; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/filtrerfacturegarants/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + lister_facture_garants(); + } + }); + +} + + +function lister_facture_garants() +{ + $("#div_liste_facture_garant").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/listerfacturegarants/", + type: 'POST', + success: function(data) { + $('#div_liste_facture_garant').html(data); + filtreTab(); + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + +function charger_honoraire_forfaitaire_garant() +{ + codeGcAssureur = $("#codeGcAssureur").val(); + codeAssietteFacturationGarant = $("#codeAssietteFacturationGarant").val(); + codeTypeFacturationGarant = $("#codeTypeFacturationGarant").val(); + + $("#div_honoraires_forfaitaire").html('
' + '
'); + + donnees = 'codeGcAssureur='+codeGcAssureur; + donnees += '&codeAssietteFacturationGarant='+codeAssietteFacturationGarant; + donnees += '&codeTypeFacturationGarant='+codeTypeFacturationGarant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/honoraireforfaitgarant/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_honoraires_forfaitaire').html(data); + setTimeout(function() { + dataTableMini(); + }, 500); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function genererfacturehonoraireforfaitaire() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfacturehonoraireforfaitaire/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function charger_appel_fond_garant() +{ + codeGcAssureur = $("#codeGcAssureur").val(); + codeAssietteFacturationGarant = $("#codeAssietteFacturationGarant").val(); + codeTypeFacturationGarant = $("#codeTypeFacturationGarant").val(); + + $("#div_appel_fond").html('
' + '
'); + + donnees = 'codeGcAssureur='+codeGcAssureur; + donnees += '&codeAssietteFacturationGarant='+codeAssietteFacturationGarant; + donnees += '&codeTypeFacturationGarant='+codeTypeFacturationGarant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/appelfondgarant/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_appel_fond').html(data); + setTimeout(function() { + dataTableMini(); + }, 500); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + + +function genererfactureappelfondgarant() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfactureappelfond/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + + +function charger_appel_cotisation_garant() +{ + codeGcAssureur = $("#codeGcAssureur").val(); + codeAssietteFacturationGarant = $("#codeAssietteFacturationGarant").val(); + codeTypeFacturationGarant = $("#codeTypeFacturationGarant").val(); + + $("#div_appel_cotisation").html('
' + '
'); + + donnees = 'codeGcAssureur='+codeGcAssureur; + donnees += '&codeAssietteFacturationGarant='+codeAssietteFacturationGarant; + donnees += '&codeTypeFacturationGarant='+codeTypeFacturationGarant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/appelcotisationgarant/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_appel_cotisation').html(data); + + setTimeout(function() { + dataTableMini(); + }, 500); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function genererfactureappelcotisationgarant() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfactureappelcotisationgarant/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function charger_honoraire_budget_garant() +{ + codeGcAssureur = $("#codeGcAssureur").val(); + codeAssietteFacturationGarant = $("#codeAssietteFacturationGarant").val(); + codeTypeFacturationGarant = $("#codeTypeFacturationGarant").val(); + + $("#div_appel_cotisation").html('
' + '
'); + + donnees = 'codeGcAssureur='+codeGcAssureur; + donnees += '&codeAssietteFacturationGarant='+codeAssietteFacturationGarant; + donnees += '&codeTypeFacturationGarant='+codeTypeFacturationGarant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/honorairebudgetgarant/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_appel_cotisation').html(data); + + setTimeout(function() { + dataTableMini(); + }, 500); + }, + error: function(data) { + }, + complete: function() { + + } + }); + + +} + +function genererfacturehonorairebudgetgarant() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfacturehonorairebudgetgarant/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function retour_fiche_garant() +{ + idGc = $("#idGc").val(); + + afficher_gc_assureur(idGc); + +} + + +function select_toutes_factures_edition(p_choix) +{ + + donnees = 'choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/toutesfacturesedition/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + lister_facture_garants(); + } + }); +} + +function select_facture_a_editer(p_choix, id) +{ + donnees = 'id='+id; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/unefactureedition/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + lister_facture_garants(); + } + }); +} + + +function selectionner_convention(idEntete, codeTypeFacture, codeConvention){ + // + + donnees = 'idEntete='+idEntete+'&codeTypeFacture='+codeTypeFacture+'&codeConvention='+codeConvention; + // + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconventioneditionfacture/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_convention_garant').html(data); + $('#div_convention_garant').modal("show"); + + }, + complete: function() { + + } + }); +} + +function editer_facture_garant() +{ + codeConvention = $("#codeConvention").val(); + + + if(codeConvention<=" ") + { + v_msg="Veuillez sélectionner une convention!"; + v_msgEng="Please select a convention!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeConvention").focus(); + return; + } + + donnees = 'codeConvention='+codeConvention; + // + var div_export = $('#div_editer_facture'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarantedition/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + div_export.html(data); + + }, + complete: function() { + + } + }); + + +} + +function majtextefacturation(idTexte, texte) +{ + + donnees = 'idTexte='+idTexte+'&texte='+texte; + + v_url = $("#racineWeb").val()+"Ajaxparamsysteme/majtextefacturation/"; + + $.ajax({ + url: v_url, + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + + + } + }); + +} + +function majecheancefacturation(idTexte, echeance) +{ + + donnees = 'idTexte='+idTexte+'&echeance='+echeance; + + v_url = $("#racineWeb").val()+"Ajaxparamsysteme/majecheancefacturation/"; + + $.ajax({ + url: v_url, + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + + + } + }); + +} + +function retirer_tous_prestataires_du_site() +{ + retirer_tous_prestataires_reseau(); +} + +function filtrer_facture_garants_encaissement() +{ + debut =$("#debut").val(); + fin =$("#fin").val(); + encaisse=$("#encaisse").val(); + + donnees = 'debut='+debut+'&fin='+fin+'&encaisse='+encaisse; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/filtrerfacturegarantsencaissement/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + lister_encaissement_facture_garants(); + + } + }); + +} + +function nom_tireur(controle){ + $("#nomTireur").val(controle.options[controle.selectedIndex].text); +} + +// +function solder_facturegarant_temp(idFacture) +{ + donnees = 'idFacture='+idFacture; + + $("#div_situation_garant").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsituationgarant/solderfacture/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_situation_garant").html(data); + }, + error: function(data) { + }, + complete: function() { + //recap_bordereau_encaissement_garant(); + } + }); +} + +function recap_bordereau_encaissement_garant() +{ + montant_ecart = $("#montant_ecart_info").val(); + $("#montant_selection").val( $("#montant_selection_info").val()); + $("#montant_ecart").val(montant_ecart); +} + +function supprimer_detail_encaissement_garant(idDetailencaissement) +{ + donnees = 'idDetailencaissement='+idDetailencaissement; + + $("#div_situation_garant").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsituationgarant/supprimerfacture/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_situation_garant").html(data); + }, + error: function(data) { + }, + complete: function() { + //recap_bordereau_encaissement_garant(); + } + }); +} + +function selectionner_facturegarant_impayee(numeroFacture, idFacture, montantTtc, montantEncaisse, solde) +{ + $("#numeroFactureAcpte").val(numeroFacture); + $("#idFactureAcpte").val(idFacture); + $("#montantTtcAcpte").val(formatCurrency(montantTtc)); + $("#montantEncaisseAcpte").val(formatCurrency(montantEncaisse)); + $("#montantAcpte").val(formatCurrency(solde)); + $("#anc_soldeAcpte").val(solde); + + $("#montantAcpte").focus(); +} + + +function ajouter_facturegarant_acompte() +{ + idFacture = $("#idFactureAcpte" ).val(); + montantAcpte = parseInt($('#montantAcpte').val().replace(/ /g,""),10); + + montantTtcAcpte = parseInt($('#montantTtcAcpte').val().replace(/ /g,""),10); + + if(idFacture<="0") + { + v_msg="Veuillez sélectionner une facture!"; + v_msgEng="PLease select an invoice!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + if(montantAcpte<="0") + { + v_msg="Veuillez saisir l\'acompte!"; + v_msgEng="Please enter the deposit!"; + alert_ebene(v_msg, v_msgEng); + $("#montantAcpte" ).focus(); + return; + } + + anc_soldeAcpte = parseInt($('#anc_soldeAcpte').val().replace(/ /g,""),10); + + if(Number(montantAcpte)>Number(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 = 'idFacture='+idFacture+'&montantAcpte='+montantAcpte+'&montantTtcAcpte='+montantTtcAcpte; + + $("#div_situation_garant").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsituationgarant/ajouteracomptefacture/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_situation_garant").html(data); + }, + error: function(data) { + }, + complete: function() { + //recap_bordereau_encaissement_garant(); + } + }); +} + +function enregistrer_encaissement_facturegarant() +{ + montant_ecart = $("#montant_ecart").val(); + montant_ecart = montant_ecart.replace(" ", ""); + montant_ecart = parseInt(montant_ecart); + montant_ecart = Math.abs(montant_ecart); + + EcartEncaissementTolerable = parseInt($("#EcartEncaissementTolerable").val()); + + //if(montant_ecart>"100") + if(montant_ecart>EcartEncaissementTolerable) + { + v_msg="Veuillez vérifier votre écart!"; + v_msgEng="Please check your gap!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous l'enregistrement?"; + v_msgEng="Do you confirm registration?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#formente_encaissement").submit(); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function imprimer_recu_garant(idEncaissement) +{ + donnees = 'idEncaissement='+idEncaissement; + + var div_export = $('#div_export_a'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerrecucaisse/garant/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} + +function filtrer_encaissements_garants() +{ + debut =$("#debut").val(); + fin =$("#fin").val(); + + donnees = 'debut='+debut+'&fin='+fin; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/filtrerencaissements/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + lister_encaissements_garants(); + } + }); + +} + + +function lister_encaissements_garants() +{ + + $("#div_liste_encaissements_garant").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/listerencaissementsgarants/", + type: 'POST', + success: function(data) { + $('#div_liste_encaissements_garant').html(data); + dataTab(); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function imprimer_recu_garant_consulter(idEncaissement) +{ + div_edition = $('#div_edition'); + + donnees = 'idEncaissement='+idEncaissement; + + //alert(donnees); + + var div_export = $('#div_page_encaissement'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerrecucaisse/garantpop/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + div_edition.modal("show"); + } + }); + +} + +function select_encaissement_a_editer(p_choix, id) +{ + donnees = 'id='+id; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/unencaisseselection/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + lister_encaissements_garants(); + } + }); +} + +function select_tous_encaisse_garant(p_choix) +{ + + donnees = 'choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/tousencaissegarant/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + lister_encaissements_garants(); + } + }); +} + +function get_type_garant() +{ + var codeGcAssureur = $('#codeGcAssureur').val(); + + donnees ='codeGcAssureur='+codeGcAssureur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/gettypegarant/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + $('#div_type_garant').html(data); + }, + complete: function(){ + } + }); + + +} + + +function exporter_liste_facture_garant() +{ + div_exporter = $('#div_exporter'); + + debut =$("#debut").val(); + fin =$("#fin").val(); + encaisse=$("#encaisse").val(); + + donnees = 'debut='+debut+'&fin='+fin+'&encaisse='+encaisse; + + + var div_export = $('#div_export_a'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxexporterfacturegarant/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + div_exporter.modal("show"); + } + }); + +} + +function exporter_liste_groupe_facture_garant() +{ + div_exporter = $('#div_exporter'); + + debut =$("#debut").val(); + fin =$("#fin").val(); + encaisse=$("#encaisse").val(); + + donnees = 'debut='+debut+'&fin='+fin+'&encaisse='+encaisse; + + + var div_export = $('#div_export_a'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxexporterfacturegarant/groupefacture/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + div_exporter.modal("show"); + } + }); + +} + +function exporter_liste_encaissement_garant() +{ + div_exporter = $('#div_exporter'); + + debut =$("#debut").val(); + fin =$("#fin").val(); + + + donnees = 'debut='+debut+'&fin='+fin; + + + //alert(donnees); + //return; + + var div_export = $('#div_export_b'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxexporterfacturegarant/encaissementgarant/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(data); + + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + div_exporter.modal("show"); + } + }); + +} + +function controle_spmax() +{ + spMin = parseInt($("#spMin").val()); + spMax = parseInt($("#spMax").val()); + + if(spMin>spMax) + { + v_msg="Veuillez vérifier S/P Maximum!"; + v_msgEng="Please check Maximum S/P!"; + alert_ebene(v_msg, v_msgEng); + + $("#spMax").val(0); + $("#spMax").focus(); + + return; + } + +} +//Ajaxtbajouterbaremeaccessoireavenant +//Ajaxtbmodifierbaremeaccessoireavenant/ +//Ajaxajouterbaremeaccessoiregarant + +//Ajaxtbmodifiertableauajustement/ + +function controle_spmax() +{ + spMin = parseInt($("#spMin").val()); + spMax = parseInt($("#spMax").val()); + + if(spMin>spMax) + { + v_msg="Veuillez vérifier S/P Maximum!"; + v_msgEng="Please check Maximum S/P!"; + alert_ebene(v_msg, v_msgEng); + + $("#spMax").val(0); + $("#spMax").focus(); + + return; + } + +} + + +function afficher_tauxajustement_garant(){ + + var codeGcAssureur = $('#codeGcAssureur').val(); + afficheBoutons(0); + + donnees = 'codeGcAssureur='+codeGcAssureur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtblistertableauajustementgarant/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + $('#div_lister_table').html(data); + appliquerDataTable(); + }, + complete: function() { + + } + }); + +} + +function affiche_garants_territoire() +{ + var codeTerritoire = $('#codeTerritoire').val(); + + donnees = 'codeTerritoire='+codeTerritoire; + + div_garant=$("#div_garant"); + + div_garant.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantterritoire/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + + $('#div_garant').html(data); + datatab_plus(); + }, + complete: function() { + + } + }); +} + +function ajouter_un_garant_territoire(codeGcAssureur) +{ + + codeTerritoire=$("#codeTerritoire").val(); + + if (codeTerritoire<=" ") + { + v_msg="Veuillez sélectionner un territoire!"; + v_msgEng="Please select a territory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeTerritoire='+codeTerritoire+'&codeGcAssureur='+codeGcAssureur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantterritoire/ajouterungarant/", + type: 'POST', + data: donnees, + success: function(data) { + // $('#div_test_gabarit').html(data); + }, + error: function(data) { + }, + complete: function() { + affiche_garants_territoire(); + } + }); +} + +// +function ajouter_tous_garants_territoire() +{ + codeTerritoire=$("#codeTerritoire").val(); + + if (codeTerritoire<=" ") + { + v_msg="Veuillez sélectionner un territoire!"; + v_msgEng="Please select a territory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeTerritoire='+codeTerritoire; + + 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é + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantterritoire/ajoutertousgarants/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + affiche_garants_territoire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function retirer_tous_garants_territoire() +{ + codeTerritoire=$("#codeTerritoire").val(); + + if (codeTerritoire<=" ") + { + v_msg="Veuillez sélectionner un territoire!"; + v_msgEng="Please select a territory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeTerritoire='+codeTerritoire; + + 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é + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantterritoire/retirertousgarants/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + affiche_garants_territoire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function retirer_un_garant_territoire(idGarant) +{ + codeTerritoire=$("#codeTerritoire").val(); + + if (codeTerritoire<=" ") + { + v_msg="Veuillez sélectionner un territoire!"; + v_msgEng="Please select a territory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idGarant='+idGarant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantterritoire/retirerungarant/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + affiche_garants_territoire(); + } + }); +} + +function maj_montant_accessoire_territoire(idGarant, montant, controle) +{ + montant=montant.replace(/ /g,""); + montant=parseInt(montant.replace(",","."),10); + controle.value=montant; + + if(controle_numerique(controle)) + { + donnees = 'idGarant='+idGarant+"&montant="+montant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantterritoire/majmontant/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + +/* +function maj_forfait_honoraire_college(idColleTemp, forfait, controle) +{ + forfait=forfait.replace(/ /g,""); + forfait=parseInt(forfait.replace(",","."),10); + controle.value=forfait; + + if(controle_numerique(controle)) + { + donnees = 'idColleTemp='+idColleTemp+"&forfait="+forfait; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/majforfaithonoraire/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + +function maj_forfait_appelfond_college(idColleTemp, forfait, controle) +{ + forfait=forfait.replace(/ /g,""); + forfait=parseInt(forfait.replace(",","."),10); + controle.value=forfait; + + if(controle_numerique(controle)) + { + donnees = 'idColleTemp='+idColleTemp+"&forfait="+forfait; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/majforfaitappelfond/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} + +function maj_forfait_appelcotisation_college(idColleTemp, forfait, controle) +{ + forfait=forfait.replace(/ /g,""); + forfait=parseInt(forfait.replace(",","."),10); + controle.value=forfait; + + if(controle_numerique(controle)) + { + donnees = 'idColleTemp='+idColleTemp+"&forfait="+forfait; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/majforfaitappelcotisation/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + } +} +*/ + +function controle_primeMax() +{ + primeMin = $("#primeMin").val().replace(/ /g,""); + primeMax = $("#primeMax").val().replace(/ /g,""); + + primeMin = parseInt(primeMin); + primeMax = parseInt(primeMax); + + if(primeMin>primeMax) + { + v_msg="Veuillez vérifier la prime maximum!"; + v_msgEng="Please check the maximum premium!"; + alert_ebene(v_msg, v_msgEng); + + $("#primeMax").val(0); + $("#primeMax").focus(); + + return; + } + +} + +function affiche_prime_min() +{ + codeTypeContrat = $("#codeTypeContrat").val(); + codeApplication = $("#codeApplication").val(); + + if (codeTypeContrat<=" ") + { + v_msg="Veuillez sélectionner un type de contrat!"; + v_msgEng="Please select a type of contract!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (codeApplication<=" ") + { + v_msg="Veuillez sélectionner un champs d'application!"; + v_msgEng="Please select a field of application!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeTypeContrat='+codeTypeContrat+"&codeApplication="+codeApplication; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtbajouterbaremeaccessoireavenant/primemini/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_prime_mini").html(data); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + + +function affiche_prime_min_garant() +{ + codeTypeContrat = $("#codeTypeContrat").val(); + codeApplication = $("#codeApplication").val(); + + codeGcAssureur = $("#codeGcAssureur").val(); + + if (codeTypeContrat<=" ") + { + v_msg="Veuillez sélectionner un type de contrat!"; + v_msgEng="Please select a type of contract!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (codeApplication<=" ") + { + v_msg="Veuillez sélectionner un champs d'application!"; + v_msgEng="Please select a field of application!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeTypeContrat='+codeTypeContrat+"&codeApplication="+codeApplication; + donnees += '&codeGcAssureur='+codeGcAssureur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxajouterbaremeaccessoiregarant/primemini/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_prime_mini").html(data); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function ajax_fiche_facture_garant(idEntetefacturegarant) +{ + donnees = 'idEntetefacturegarant='+idEntetefacturegarant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfichefacturegarant/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_fiche_facture_modal").html(data); + //alert(data); + //return; + $('#div_fiche_facture').modal("show"); + + + setTimeout(function() { + //your datatable code + dataTableMini(); + + }, 500); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function editionmouvementeffectif(idEmission) +{ + donnees = 'idEmission='+idEmission; + + $("#div_deatil_pop").html('
' + '
'); + + $("#btn_pop").click(); + + + $.ajax({ + // url: $("#racineWeb").val()+"Ajaxcontextditionpieceavenant/", + url: $("#racineWeb").val()+"Ajaxeditionmouvementeffectif/", + type: 'POST', + data: donnees, + success: function(data) + { + $("#div_deatil_pop").html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + + } + }); +} +function afficherListeActesPrescrits(numeroFeuilleMaladie, codeTypePrestation, codeGarantie) { + + + codeReponseEntentePrealable = $("#codeReponseEntentePrealable").val(); + + donnees = "numeroFeuilleMaladie=" + numeroFeuilleMaladie; + donnees += "&codeReponseEntentePrealable=" + codeReponseEntentePrealable; + donnees += "&codeTypePrestation=" + codeTypePrestation; + donnees += "&codeGarantie=" + codeGarantie; + + + $("#div_patienter").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteactesprescrits/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_examens_prescrits").html(data); + appliquerDataTable(); + $("#div_examens_prescrits").modal({ backdrop: 'static', keyboard: false, show: true }); + $("#div_examens_prescrits").modal("show"); + $("#div_patienter").empty(); + + /* + var motifReel = document.getElementById('motifReel'); + var motifRefusPrestataire = document.getElementById('motifRefusPrestataire'); + motifReel.value = ""; + motifRefusPrestataire.value = ""; + */ + }, + complete: function () { + + } + }); + +} + +function listeententeprealablesproformahospi() +{ + demandeTraite = $("#demandeTraite").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + donnees = 'demandeTraite='+demandeTraite; + donnees += '&debut=' + debut + '&fin=' + fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxententeprealablesproformahospi/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ententeprealable").html(data); + }, + complete: function() { + } + }); +} + + + +function afficheractesproforma(idProforma) { + + window.location.assign($("#racineWeb" ).val()+"Traitementproformahospitalisation/"+idProforma+"/"); +} + +function maj_dureeCorrigee_proforma_hospit(idProforma, dureeCorrigee) +{ + donnees = 'idProforma='+idProforma; + donnees += '&dureeCorrigee='+dureeCorrigee; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtraitementproformahospitalisation/majdureecorrigee/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + }, + complete: function() { + ajaxtraitementproformahospitalisation(); + } + }); + +} + +function ajaxtraitementproformahospitalisation() +{ + $idProforma = $("#idProforma").val(); + + donnees = 'idProforma='+idProforma; + $("#div_examens").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtraitementproformahospitalisation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + $("#div_examens").html(data); + }, + complete: function() { + } + }); + + +} + +function validertoutproformahospit(idProforma){ + + codeLangue = $("#codeLangue").val(); + + donnees = "idProforma=" + idProforma; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxtraitementproformahospitalisation/validertoutproformahospit/", + type: 'POST', + data: donnees, + success: function (data) { + + $("#div_examens").html(data); + if(codeLangue=="en_US") + { + $("#motifReel").val("GOOD FOR AGREEMENT"); + }else{ + $("#motifReel").val("BON POUR ACCORD"); + } + }, + error: function (data) { + }, + complete: function () { + ajaxtraitementproformahospitalisation(); + } + }); + +} + + +function annulervalidertoutproformahospit(idProforma) +{ + donnees = "idProforma=" + idProforma; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxtraitementproformahospitalisation/annulervalidertoutproformahospit/", + type: 'POST', + data: donnees, + success: function (data) { + + $("#motifReel").val(""); + + }, + error: function (data) { + }, + complete: function () { + ajaxtraitementproformahospitalisation(); + } + }); + + +} + +function refusertoutproformahospit(idProforma) +{ + donnees = "idProforma=" + idProforma; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxtraitementproformahospitalisation/refusertoutproformahospit/", + type: 'POST', + data: donnees, + success: function (data) { + + $("#motifReel").val(""); + + }, + error: function (data) { + }, + complete: function () { + ajaxtraitementproformahospitalisation(); + } + }); + + +} + + +function annulerrefusertoutproformahospit(idProforma) +{ + donnees = "idProforma=" + idProforma; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxtraitementproformahospitalisation/annulerrefusertoutproformahospit/", + type: 'POST', + data: donnees, + success: function (data) { + + $("#motifReel").val(""); + + }, + error: function (data) { + }, + complete: function () { + ajaxtraitementproformahospitalisation(); + } + }); + + +} + +function ajax_maj_prix_acte_proformahospitalisation(idPrestationactes, valeurActe, controle) +{ + valeurActe=valeurActe.replace(",","."); + controle.value=valeurActe; + + valeurActe=valeurActe.replace(/ /g,""); + valeurActe=parseInt(valeurActe.replace(",","."),10); + controle.value=valeurActe; + + if(controle_numerique(controle)) + { + donnees = 'idPrestationactes='+idPrestationactes+"&valeurActe="+valeurActe; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtraitementproformahospitalisation/majvaleuracte/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + ajaxtraitementproformahospitalisation(); + + + } + }); + } +} + +function ajax_maj_qte_acte_proformahospitalisation(idPrestationactes, quantite, controle) +{ + quantite=quantite.replace(",","."); + controle.value=quantite; + + if(controle_numerique(controle)) + { + if(quantite==0) + { + controle.focus(); + v_msg="Veuillez saisir la quantit\u00e9!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idPrestationactes='+idPrestationactes+"&quantite="+quantite; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtraitementproformahospitalisation/majquantite/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + ajaxtraitementproformahospitalisation(); + } + }); + } +} + +function validerunacteproformahospit(idProforma, idPrestationactes, choix) +{ + + + donnees = "idPrestationactes=" + idPrestationactes+"&choix="+choix; + donnees += "&idProforma="+idProforma; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxtraitementproformahospitalisation/validerunacteproformahospit/", + type: 'POST', + data: donnees, + success: function (data) { + + $("#motifReel").val(""); + + }, + error: function (data) { + }, + complete: function () { + ajaxtraitementproformahospitalisation(); + } + }); + + +} + +function refuserunacteproformahospit(idProforma, idPrestationactes, choix) +{ + donnees = "idPrestationactes=" + idPrestationactes+"&choix="+choix; + donnees += "&idProforma="+idProforma; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxtraitementproformahospitalisation/refuserunacteproformahospit/", + type: 'POST', + data: donnees, + success: function (data) { + + $("#motifReel").val(""); + + }, + error: function (data) { + }, + complete: function () { + ajaxtraitementproformahospitalisation(); + } + }); + +} + +function validerproformahospitalisation(idProforma) +{ + + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifRefusAssure").val(); + + siRefus = $("#siRefus").val(); + accorderTout = $("#accorderTout").val(); + //entente = $("#entente").val(); + + + if ((motifReel == "" || motifReel <= " ") && (accorderTout > 0)) { + motifReel = "BON POUR ACCORD"; + + $("#motifReel").val(motifReel); + + maj_motifReel_proformahospit(idProforma, motifReel); + } + + + if ((motifRefusAssure <= " ") && (siRefus > 0)) { + v_msg = "Veuillez saisir le motif du refus!"; + v_msgEng = "Please enter the reason for the refusal!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifRefusAssure").focus(); + return; + } + + dureeCorrigee = $("#dureeCorrigee").val(); + if (dureeCorrigee<='0') { + v_msg = "Veuillez saisir la durée accordée!"; + v_msgEng = "Please enter the duration granted!"; + alert_ebene(v_msg, v_msgEng); + + $("#dureeCorrigee").focus(); + return; + } + + donnees = "idProforma="+idProforma; + + //typeSms="proformahospitalisation"; + + v_msg="Validez-vous cette facture proforma?"; + v_msgEng="Do you validate this proforma invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val() + "Ajaxtraitementproformahospitalisation/validerproformahospit/", + type: 'POST', + data: donnees, + success: function (data) { + //alert(data); + v_msg = "Facture Proforma trait\u00e9 avec succès!"; + v_msgEng = "Proforma invoice processed successfully!"; + alert_ebene(v_msg, v_msgEng); + + setTimeout(function() { + //your datatable code + fermertraitementproformahospitalisation(); + }, 500); + + }, + error: function (data) { + }, + complete: function () { + // listeententeprealablesproformahospi(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function maj_motifReel_proformahospit(idProforma, observation) +{ + donnees = 'idProforma='+idProforma; + donnees += '&observation='+observation; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtraitementproformahospitalisation/majobservation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + }, + complete: function() { + //ajaxtraitementproformahospitalisation(); + } + }); +} + + +function maj_motifRefusPrestataire_proformahospit(idProforma, motifRefus) +{ + donnees = 'idProforma='+idProforma; + donnees += '&motifRefus='+motifRefus; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtraitementproformahospitalisation/majmotifrefus/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + }, + complete: function() { + //ajaxtraitementproformahospitalisation(); + } + }); +} + +function fermertraitementproformahospitalisation() +{ + window.location.assign($("#racineWeb" ).val()+"Proformahospitalisation/"); + +} + +function filtrergenreconjoint() +{ + codeLienParente = $('#codeLienParente').val(); + genreAdherent = $('#genreAdherent').val(); + + if(codeLienParente=='C'){ + if(genreAdherent=="F"){ + $('#sexe').val('M'); + $('#sexeConjoint').val('M'); + }else{ + $('#sexe').val('F'); + $('#sexeConjoint').val('F'); + } + + $('#sexe').disable(); + return; + } + $('#sexe').enable(); +} + + +function agemaxbeneficiaire() +{ + codeLienParente = $('#codeLienParente').val(); + idCollege = $('#idCollege').val(); + + if (idCollege<=" ") + { + return; + } + + donnees = 'idCollege='+idCollege; + donnees += '&codeLienParente='+codeLienParente; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxagemaxbeneficiaire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_age_max").html(data); + }, + complete: function() { + + } + }); + +} + +function select_tous_beneficiaire_a_retirer(p_choix) +{ + + + donnees = 'choix='+p_choix; + + $('#div_selection_assure').html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionretrait/tousselectionner/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_selection_assure').html(data); + + var oTable = $('.tabliste').DataTable(); + oTable.destroy(); + + setTimeout(function() { + appliquerDataTable(); + }, 500); + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + + +function ajouteradherentfacturation() +{ + + donnees = ''; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxadherent/ajouteradherentfacturation/", + type: 'POST', + data: donnees, + success: function(data) { + //$('#div_selection_assure').html(data); + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + +function select_tous_beneficiaire_changement_college(p_choix) +{ + + + donnees = 'choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionchangementcollege/tousselectionner/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_selection_assure').html(data); + var oTable = $('.tabliste').DataTable(); + oTable.destroy(); + + setTimeout(function() { + appliquerDataTable(); + }, 500); + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + + +function pop_changementcollege_masse() +{ + var div_changementcollege_masse = $('#div_changementcollege_masse'); + + div_changementcollege_masse.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionchangementcollege/affichercollegebeneficiaireenmasse/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + div_changementcollege_masse.html(data); + + var oTable = $('.tabliste').DataTable(); + oTable.destroy(); + + setTimeout(function() { + appliquerDataTable(); + }, 500); + }, + complete: function() { + $("#btn_changementcollege_masse").click(); + } + }); +} + +function select_tous_beneficiaire_changement_college_masse(p_choix) +{ + + + donnees = 'choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionchangementcollege/tousselectionnermasse/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_tabliste').html(data); + + var oTable = $('.tabliste').DataTable(); + oTable.destroy(); + + appliquerDataTable(); + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + +function choix_beneficiaire_changementcollege_masse(p_choix, p_id_beneficiaire) +{ + + + donnees = 'idBeneficiaire='+p_id_beneficiaire; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionchangementcollege/selectionnermasse/", + type: 'POST', + data: donnees, + success: function(data) { + + $('#div_nbselection').html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + + +function changer_college_beneficiaire_masse() +{ + idCollegeNew = $("#idCollegeNew").val(); + + if (idCollegeNew<=" ") + { + v_msg="Veuillez sélectionner un collège!"; + v_msgEng="Please select a college!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nbselection = $("#nbselection").val(); + + if (nbselection == "0") + { + v_msg="Veuillez sélectionner des bénéficiaires!"; + v_msgEng="Please select beneficiaries!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idCollegeNew='+idCollegeNew; + + $("#div_tabliste").html('
' + '
'); + + v_msg="Confirmez-vous le changement de collège?"; + v_msgEng="Do you confirm the change of college?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionchangementcollege/changercollegebeneficiairemasse/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $('#div_tabliste').html(data); + + var oTable = $('.tabliste').DataTable(); + oTable.destroy(); + + appliquerDataTable(); + }, + complete: function() { + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function modifier_limite_adherent(idLimite, plafondOld) +{ + donnees = "idLimite="+idLimite+'&plafondOld='+plafondOld; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlimiteadherent/modifierlimite/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $('#div_modif_limite').html(data); + $("#plafondNew").focus(); + + }, + complete: function() { + } + }); + +} + +function valider_limite_adherent() +{ + + + idLimite = $("#idLimite").val(); + + plafond = $("#plafondNew").val().replace(/ /g,""); + + + motif = $("#motif").val(); + + idAdherent = $("#idAdherent").val(); + + if (plafond<=" ") + { + $("#plafondNew").val("0"); + } + + if(motif <=" ") + { + v_msg="Le motif est obligatoire!"; + v_msgEng="The pattern is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + $("#motif").focus(); + + return; + + } + + plafondOld = $("#plafondOld").val().replace(/ /g,""); + + if(plafond=="0" || plafond==plafondOld){ + return; + } + + donnees = "idLimite="+idLimite+'&plafond='+plafond+'&motif='+motif+'&idAdherent='+idAdherent; + + v_msg="Confirmez-vous la modification du plafond?"; + v_msgEng="Do you confirm the modification of the ceiling?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlimiteadherent/majplafond/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $('#div_modif_limite').empty(); + $('#div_bareme').html(data); + }, + complete: function() { + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function modifier_limite_beneficiaire(idLimite, plafondOld) +{ + donnees = "idLimite="+idLimite+'&plafondOld='+plafondOld; + + $('#div_modif_limite').empty(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlimitebeneficiaire/modifierlimite/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $('#div_modif_limite').html(data); + $("#plafondNew").focus(); + + }, + complete: function() { + } + }); + +} + + +function valider_limite_beneficiaire() +{ + + + idLimite = $("#idLimite").val(); + + plafond = $("#plafondNew").val().replace(/ /g,""); + + motif = $("#motif").val(); + + idBeneficiaire = $("#idBeneficiaire").val(); + + //$('#div_bareme').empty(); + + if (plafond<=" ") + { + $("#plafondNew").val("0"); + } + + if(motif <=" ") + { + v_msg="Le motif est obligatoire!"; + v_msgEng="The pattern is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + $("#motif").focus(); + + return; + } + + plafondOld = $("#plafondOld").val().replace(/ /g,""); + + if(plafond=="0" || plafond==plafondOld){ + return; + } + + donnees = "idLimite="+idLimite+'&plafond='+plafond+'&motif='+motif+'&idBeneficiaire='+idBeneficiaire; + + v_msg="Confirmez-vous la modification du plafond?"; + v_msgEng="Do you confirm the modification of the ceiling?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlimitebeneficiaire/majplafond/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $('#div_modif_limite').empty(); + $('#div_bareme').html(data); + }, + complete: function() { + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function appliquer_ajustemet_renouvellement() +{ + appliquerTauxAjustement = $('#appliquerTauxAjustement').val(); + + donnees = 'appliquerTauxAjustement='+appliquerTauxAjustement; + + $("#div_prime_a_emettre").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailrenouvellement/appliquertauxajustement/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_prime_a_emettre").html(data); + }, + complete: function() { + + } + }); +} + +function alertvip(codeReponse, medical, idDemandederogation) +{ + if(medical=='derogation'){ + v_msg="Attention bénéficiaire VIP!"; + v_msgEng="Attention VIP beneficiary!"; + + + alert_ebene(v_msg, v_msgEng); + + + setTimeout(function() { + if(codeReponse=="A"){ + accepter_derogation_2(idDemandederogation); + }else{ + refuser_derogation_2(idDemandederogation); + } + + }, 500); + } + + +} + + +function retour_modifierparametre() +{ + codeProfil = $('#codeProfil_C').val(); + + if(codeProfil=="SUPADM"){ + window.location.assign($("#racineWeb" ).val()+"Listecentregestion/"); + }else{ + window.location.assign($("#racineWeb" ).val()+"Parametresgeneraux/"); + } +} + +function listeenteteententeprealables() { + codePrestataire = $("#codePrestataire").val(); + + if(codePrestataire==undefined || codePrestataire=="undefined") + { + codePrestataire=""; + } + demandeTraite = $("#demandeTraite").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + donnees = 'codePrestataire=' + codePrestataire + '&demandeTraite='+demandeTraite; + donnees += '&debut=' + debut + '&fin=' + fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxententeprealables/entetesententeprealable/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_ententeprealable").html(data); + + + }, + complete: function () { + } + }); +} + + + + +function affiche_liste_act_exam_provisoire() +{ + + codeTypeEntentePrealable = $("#codeTypeEntentePrealable").val(); + + + $("#tab_liste").html('
' + '
'); + + if(codeTypeEntentePrealable=="EXAM"){ + v_url = "Ajaxlisteacteexamen/traitementprovisoireexam/"; + }else{ + v_url = "Ajaxlisteacteexamen/traitementprovisoireact/"; + } + + donnees = ""; + + $.ajax({ + url: $("#racineWeb").val() + v_url, + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#tab_liste").html(data); + }, + complete: function () { + + } + }); + +} + + +function traiter_un_provisoire_act_exam(idExamen, codeReponseProvisoire) +{ + + donnees = "idExamen=" + idExamen + "&codeReponseProvisoire=" + codeReponseProvisoire; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteacteexamen/traiterunprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + affiche_liste_act_exam_provisoire(); + }, + complete: function () { + + } + }); + +} + +function traitement_tous_provisoire_act_exam(codeReponseProvisoire) +{ + donnees = "codeReponseProvisoire=" + codeReponseProvisoire; + + //alert(donnees); + //return; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteacteexamen/traitertousprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + affiche_liste_act_exam_provisoire(); + }, + complete: function () { + + } + }); + +} + + +function afficher_detail_act_exam(idEnteteEntentePrealable) { + + donnees = "idEnteteEntentePrealable=" + idEnteteEntentePrealable; + + + $("#div_patienter").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteacteexamen/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_examens_prescrits").html(data); + //appliquerDataTable(); + $("#div_examens_prescrits").modal({ backdrop: 'static', keyboard: false, show: true }); + $("#div_examens_prescrits").modal("show"); + $("#div_patienter").empty(); + + $(".selectpicker").selectpicker(); + }, + complete: function () { + afficherMasquerAntecedents(); + afficherMasquerSituation(); + } + }); + +} + + +function valider_entente(codeTypeEntentePrealable) { + observations = $("#observations").val(); + motifRefusAssure = $("#motifRefusAssure").val(); + + nombreRefus = $("#nombreRefus").val(); + nombreEnAttente = $("#nombreEnAttente").val(); + + if(nombreEnAttente>"0"){ + v_msg = "Veuillez traiter toutes les lignes!"; + v_msgEng = "Please process all lines!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + if (nombreRefus >"0" && motifRefusAssure <= " ") { + v_msg = "Veuillez saisir le motif pour les refus!"; + v_msgEng = "Please enter the reason for rejections!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifRefusAssure").focus(); + + return; + } + + + v_msg = "Confirmez-vous cette validation?"; + v_msgEng = "Do you confirm this validation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'observations=' + observations + '&motifRefusAssure=' + motifRefusAssure; + + donnees_sav = donnees; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteacteexamen/valider/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $('#div_resultat_validation').html(data); + valider = $("#valider").val(); + + if(valider=="1"){ + v_msg = "Validation réussie!"; + v_msgEng = "Validation succeed!"; + alert_ebene(v_msg, v_msgEng); + + $("#btn-fermer-entente").click(); + + }else{ + v_msg = "Echèc de la validation!"; + v_msgEng = "Validation failed!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + }, + complete: function () { + switch (codeTypeEntentePrealable) + { + case "ACT": + listeenteteententeprealables(); + break; + + case "EXAM": + listeenteteententeprealables(); + break; + + case "DEN": + listeenteteententeprealablesdent(); + break; + + case "SEA": + listeenteteententeprealablessea(); + break; + + case "HOS": + listeenteteententeprealableshospi(); + break; + + default: + v_msg = "type inconu!"; + v_msgEng = "Unknown type!"; + alert_ebene(v_msg, v_msgEng); + } + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function majobservation_act_exam() +{ + observations = $("#observations").val(); + + donnees = "observations=" + observations; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteacteexamen/majobservation/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + }, + complete: function () { + + } + }); + +} + +function majmotifrefus_act_exam() +{ + motifRefusAssure = $("#motifRefusAssure").val(); + + donnees = "motifRefusAssure=" + motifRefusAssure; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteacteexamen/majmotifrefus/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + }, + complete: function () { + + } + }); + +} + +function listeenteteententeprealablesdent() { + + demandeTraite = $("#demandeTraite").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + donnees = 'demandeTraite='+demandeTraite; + donnees += '&debut=' + debut + '&fin=' + fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxententeprealablesdent/entetesententeprealable/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_ententeprealable").html(data); + + + }, + complete: function () { + } + }); +} + + +function afficher_detail_phar(idEnteteEntentePrealable) { + + + donnees = "idEnteteEntentePrealable=" + idEnteteEntentePrealable; + + + $("#div_patienter").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsentente/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + //$('#div_test_gabarit').html(data); + //alert(data); + + $("#div_medicaments_prescrits").html(data); + $("#div_medicaments_prescrits").modal({ backdrop: 'static', keyboard: false, show: true }); + $("#div_medicaments_prescrits").modal("show"); + $("#div_patienter").empty(); + + }, + complete: function () { + afficherMasquerMedicaments(); + afficherMasquerAntecedents(); + afficherMasquerSituation(); + } + }); + +} + +function traiter_un_provisoire_pha(idMedicament, codeReponseProvisoire) +{ + + donnees = "idMedicament=" + idMedicament + "&codeReponseProvisoire=" + codeReponseProvisoire; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsentente/traiterunprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + affiche_liste_phar_provisoire(); + }, + complete: function () { + + } + }); + +} + +function traitement_tous_provisoire_pha(codeReponseProvisoire) +{ + donnees = "codeReponseProvisoire=" + codeReponseProvisoire; + + //alert(donnees); + //return; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsentente/traitertousprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + affiche_liste_phar_provisoire(); + }, + complete: function () { + + } + }); + +} + +function affiche_liste_phar_provisoire() +{ + $("#tab_liste").html('
' + '
'); + + donnees = ""; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsentente/traitementprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#tab_liste").html(data); + }, + complete: function () { + + } + }); + +} + +function valider_entente_pha() { + + observations = $("#observations").val(); + motifRefusAssure = $("#motifRefusAssure").val(); + + nombreRefus = $("#nombreRefus").val(); + nombreEnAttente = $("#nombreEnAttente").val(); + + if(nombreEnAttente>"0"){ + v_msg = "Veuillez traiter toutes les lignes!"; + v_msgEng = "Please process all lines!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + if (nombreRefus >"0" && motifRefusAssure <= " ") { + v_msg = "Veuillez saisir le motif pour les refus!"; + v_msgEng = "Please enter the reason for rejections!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifRefusAssure").focus(); + + return; + } + + + v_msg = "Confirmez-vous cette validation?"; + v_msgEng = "Do you confirm this validation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'observations=' + observations + '&motifRefusAssure=' + motifRefusAssure; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsentente/valider/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $('#div_resultat_validation').html(data); + valider = $("#valider").val(); + + if(valider=="1"){ + v_msg = "Validation réussie!"; + v_msgEng = "Validation succeed!"; + alert_ebene(v_msg, v_msgEng); + + $("#btn-fermer-entente").click(); + }else{ + v_msg = "Echèc de la validation!"; + v_msgEng = "Validation failed!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + }, + complete: function () { + listeententeprealablespha(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function majobservation_phar() +{ + observations = $("#observations").val(); + + donnees = "observations=" + observations; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsentente/majobservation/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + }, + complete: function () { + + } + }); + +} + +function majmotifrefus_phar() +{ + motifRefusAssure = $("#motifRefusAssure").val(); + + donnees = "motifRefusAssure=" + motifRefusAssure; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsentente/majmotifrefus/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + }, + complete: function () { + + } + }); + +} + +function liste_ententeprealables_sea() +{ + window.location.assign($("#racineWeb" ).val()+"Listeententeprealablesea/"); +} + +function listeenteteententeprealablessea() { + + demandeTraite = $("#demandeTraite").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + donnees = 'demandeTraite='+demandeTraite; + donnees += '&debut=' + debut + '&fin=' + fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxententeprealablessea/entetesententeprealable/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_ententeprealable").html(data); + + + }, + complete: function () { + } + }); +} + + +function listeenteteententeprealablesopt() { + + demandeTraite = $("#demandeTraite").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + donnees = 'demandeTraite='+demandeTraite; + donnees += '&debut=' + debut + '&fin=' + fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxententeprealablesopt/entetesententeprealable/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_ententeprealable").html(data); + + + }, + complete: function () { + } + }); +} + +function listeenteteententeprealableshospi() { + + demandeTraite = $("#demandeTraite").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + donnees = 'demandeTraite='+demandeTraite; + donnees += '&debut=' + debut + '&fin=' + fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxententeprealableshospi/entetesententeprealable/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_ententeprealable").html(data); + + + }, + complete: function () { + } + }); +} + +function listeententeprealablessea() +{ + codeReponseEntentePrealable=$("#codeReponseEntentePrealable").val(); + debut=$("#debut").val(); + fin=$("#fin").val(); + + donnees = 'codeReponseEntentePrealable='+codeReponseEntentePrealable; + donnees += '&debut='+debut+'&fin='+fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxententeprealablessea/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ententeprealable").html(data); + }, + complete: function() { + } + }); +} + +function control_param_facturation_garant() +{ + + codeSourceFondGarantAppelFond = $("#codeSourceFondGarantAppelFond").val(); + codeSourceFondGarantHonoraire = $("#codeSourceFondGarantHonoraire").val(); + codeSourceFondGarantCaution = $("#codeSourceFondGarantCaution").val(); + + if(codeSourceFondGarantHonoraire == "FOR"){ + $("#forfaitHonoraire").enable(); + //$("#montantBudget").disable(); + //$("#montantBudget").val("0"); + + }else{ + $("#forfaitHonoraire").disable(); + $("#forfaitHonoraire").val("0"); + + } + + if(codeSourceFondGarantCaution == "FOR"){ + $("#forfaitCautionPermanant").enable(); + //$("#montantBudget").disable(); + //$("#montantBudget").val("0"); + + }else{ + $("#forfaitCautionPermanant").disable(); + $("#forfaitCautionPermanant").val("0"); + } + + if(codeSourceFondGarantHonoraire == "BUD" || codeSourceFondGarantHonoraire == "SIN"){ + $("#gcTauxCommissionGerant").disable(); + $("#gcTauxFraisReel").enable(); + $("#gcTauxCommissionGerant").val("0"); + }else if(codeSourceFondGarantHonoraire == "FOR"){ + $("#gcTauxCommissionGerant").disable(); + $("#gcTauxFraisReel").disable(); + $("#gcTauxCommissionGerant").val("0"); + $("#gcTauxFraisReel").val("0"); + }else if(codeSourceFondGarantHonoraire == "PRI"){ + $("#gcTauxCommissionGerant").enable(); + $("#gcTauxFraisReel").disable(); + $("#gcTauxFraisReel").val("0"); + } + + if(codeSourceFondGarantAppelFond == "BUD" || codeSourceFondGarantHonoraire == "BUD" || codeSourceFondGarantCaution == "BUD"){ + $("#montantBudget").enable(); + }else{ + $("#montantBudget").disable(); + $("#montantBudget").val("0"); + } +} + +function filtre_assiette_fond(){ + + codeSourceFondGarantAppelFond = $("#codeSourceFondGarantAppelFond").val(); + + donnees = "codeSourceFondGarantAppelFond="+codeSourceFondGarantAppelFond; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxassiettefacturationgarant/fonds/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_assiette_fonds").html(data); + }, + complete: function() { + } + }); +} + +function filtre_assiette_honoraire(){ + + codeSourceFondGarantHonoraire = $("#codeSourceFondGarantHonoraire").val(); + + donnees = "codeSourceFondGarantHonoraire="+codeSourceFondGarantHonoraire; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxassiettefacturationgarant/honoraire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_assiette_honoraire").html(data); + }, + complete: function() { + } + }); +} + +function change_periodicite_honoraire() +{ + $("#codePeriodiciteHonoraire").val($("#codePeriodiciteAppelFond").val()); +} + +function initiergroupefacturegarant() +{ + + codeGcAssureur = $("#codeGcAssureur").val(); + dateFacture = $("#dateFacture").val(); + codeNatureFacturationGarant = $("#codeNatureFacturationGarant").val(); + codePeriodicite = $("#codePeriodicite").val(); + codeExercice = $("#codeExercice").val(); + + bonneDate = control_date_facture_garant(dateFacture, codeExercice); + + + if(!bonneDate) + { + v_msg="Veuillez revoir la date!"; + v_msgEng="Please review the date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateFacture").focus(); + return; + } + + if(codeGcAssureur<=" ") + { + v_msg="Veuillez sélectionner un garant!"; + v_msgEng="Please select a guarantor!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeGcAssureur").focus(); + return; + } + + if(codeNatureFacturationGarant<=" "){ + v_msg="Veuillez sélectionner un type de facturation!"; + v_msgEng="Please select a billing type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeFacturationGarant").focus(); + return; + + } + + if(codePeriodicite<=" "){ + v_msg="Veuillez sélectionner une périodicité!"; + v_msgEng="Please select a periodicity!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePeriodicite").focus(); + return; + + } + + donnees = 'codeGcAssureur='+codeGcAssureur+'&codeNatureFacturationGarant='+codeNatureFacturationGarant; + donnees += '&codePeriodicite='+codePeriodicite+'&codeExercice='+codeExercice+'&dateFacture='+dateFacture; + + $("#div_patienter").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/initiergroupefacturegarant/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Detailgroupefacturegarant/"); + } + }); + +} + + + + +// +function afficher_detail_optique(idEnteteEntentePrealable) { + + + donnees = "idEnteteEntentePrealable=" + idEnteteEntentePrealable; + + + $("#div_patienter").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteoptique/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + //$('#div_test_gabarit').html(data); + //alert(data); + //return; + + $("#div_optique_prescrits").html(data); + //appliquerDataTable(); + $("#div_optique_prescrits").modal({ backdrop: 'static', keyboard: false, show: true }); + $("#div_optique_prescrits").modal("show"); + $("#div_patienter").empty(); + + }, + complete: function () { + + } + }); + +} + +function traiter_un_provisoire_opt(idMedicament, codeReponseProvisoire) +{ + + donnees = "idMedicament=" + idMedicament + "&codeReponseProvisoire=" + codeReponseProvisoire; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteoptique/traiterunprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + affiche_liste_opt_provisoire(); + }, + complete: function () { + + } + }); + +} + +function traitement_tous_provisoire_opt(codeReponseProvisoire) +{ + donnees = "codeReponseProvisoire=" + codeReponseProvisoire; + + //alert(donnees); + //return; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteoptique/traitertousprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + affiche_liste_opt_provisoire(); + }, + complete: function () { + + } + }); + +} + +function affiche_liste_opt_provisoire() +{ + $("#tab_liste").html('
' + '
'); + + donnees = ""; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteoptique/traitementprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#tab_liste").html(data); + }, + complete: function () { + + } + }); + +} + +function valider_entente_opt() { + + observations = $("#observations").val(); + motifRefusAssure = $("#motifRefusAssure").val(); + + nombreRefus = $("#nombreRefus").val(); + nombreEnAttente = $("#nombreEnAttente").val(); + + if(nombreEnAttente>"0"){ + v_msg = "Veuillez traiter toutes les lignes!"; + v_msgEng = "Please process all lines!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + if (nombreRefus >"0" && motifRefusAssure <= " ") { + v_msg = "Veuillez saisir le motif pour les refus!"; + v_msgEng = "Please enter the reason for rejections!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifRefusAssure").focus(); + + return; + } + + + v_msg = "Confirmez-vous cette validation?"; + v_msgEng = "Do you confirm this validation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'observations=' + observations + '&motifRefusAssure=' + motifRefusAssure; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteoptique/valider/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $('#div_resultat_validation').html(data); + valider = $("#valider").val(); + + if(valider=="1"){ + v_msg = "Validation réussie!"; + v_msgEng = "Validation succeed!"; + alert_ebene(v_msg, v_msgEng); + + $("#btn-fermer-entente").click(); + }else{ + v_msg = "Echèc de la validation!"; + v_msgEng = "Validation failed!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + }, + complete: function () { + listeenteteententeprealablesopt(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function majobservation_opt() +{ + observations = $("#observations").val(); + + donnees = "observations=" + observations; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteoptique/majobservation/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + }, + complete: function () { + + } + }); + +} + +function majmotifrefus_opt() +{ + motifRefusAssure = $("#motifRefusAssure").val(); + + donnees = "motifRefusAssure=" + motifRefusAssure; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlisteoptique/majmotifrefus/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + }, + complete: function () { + + } + }); + +} + +// +function afficher_laboratoire(numeroBonExamen, codePrestataireLivraison, prestataireLivraison) +{ + donnees = 'numeroBonExamen='+numeroBonExamen+'&codePrestataireLivraison='+codePrestataireLivraison; + donnees += '&prestataireLivraison='+prestataireLivraison; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextlaboratoire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Laboratoirecons/"); + } + }); +} + + +function genererfactureperiodiquegarant() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfactureperiodique/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichegroupefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + +function afficher_detail_facture_garant(idEntetefacturegarant) +{ + window.location.assign($("#racineWeb" ).val()+"Detailfactureperiodiquegarant/"+idEntetefacturegarant); +} + +function modifier_param_fact_garant(superUser) +{ + if (superUser != "1"){ + v_msg="Non autorisé!"; + v_msgEng="Unauthorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Etes-vous sûr de vouloir modifier ces paramètres ?"; + v_msgEng="Are you sure you want to change these settings?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + window.location.assign($("#racineWeb" ).val()+"Paramfacturegarant/"); + } + }); + +} + +function consulter_param_fact_garant() +{ + window.location.assign($("#racineWeb" ).val()+"Paramfacturegarantcons/"); +} + +function editer_groupe_facture_garant() +{ + donnees=""; + + var div_export = $('#div_editer_facture'); + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarantedition/groupefacture/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + div_export.html(data); + + }, + complete: function() { + + } + }); + + +} + +function select_toutes_natures_facture(p_choix) +{ + + donnees = 'choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/toutesnaturesfacture/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_type_facture').html(data); + datafiltre(); + + }, + error: function(data) { + }, + complete: function() { + + //affichertoutfacturationprime(); + } + }); +} + +function select_naturefacture_garant_a_facturer(p_choix, id) +{ + donnees = 'id='+id; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/selectionnaturefacture/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_type_facture').html(data); + datafiltre(); + }, + error: function(data) { + }, + complete: function() { + + //affichertoutfacturationprime(); + } + }); +} + + + +function ajax_fiche_groupe_facture_garant(idGroupefacturegarant) +{ + + + donnees = 'idGroupefacturegarant='+idGroupefacturegarant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfichefacturegarant/groupefacture/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_fiche_groupe_facture_modal").html(data); + + + $('#div_fiche_groupe_facture').modal("show"); + + + setTimeout(function() { + //your datatable code + dataTableMini(); + + }, 500); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function lister_encaissement_facture_garants() +{ + $("#div_liste_facture_garant").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/listerfactuegarantsencaissement/", + type: 'POST', + success: function(data) { + $('#div_liste_facture_garant').html(data); + + dataTab(); + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + + +function select_toutes_factures_edition_encaissement(p_choix) +{ + + donnees = 'choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/toutesfactureseditionencaissement/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + + lister_encaissement_facture_garants(); + } + }); +} + +function select_facture_a_editer_encaissement(p_choix, id) +{ + donnees = 'id='+id; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/unefactureeditionencaissement/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + lister_encaissement_facture_garants(); + } + }); +} + +function creer_dossier_classique() +{ + idBeneficiaire = $("#idBeneficiaire").val(); + + ajax_context_adherent(idBeneficiaire); +} + +function ajax_context_adherent(idBeneficiaire) +{ + + + if (idBeneficiaire=="0") + { + v_msg="Veuillez sélectionner un assuré!"; + v_msgEng="Please select one person!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = "idBeneficiaire="+idBeneficiaire; + donnees_retour = ""; + + $("#div_attente").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextadherent/", + type : 'post', + data: donnees, + success: function(data) + { + + //$("#div_ajaxgabarit").html(data); + + $("#div_context_adherent").html(data); + + //$("#div_attente").html(''); + + var aBeneficiaireRemb = $("#aBeneficiaireRemb").val(); + //var idAdherent = $("#idAdherent").val(); + + if(aBeneficiaireRemb > "0") + { + window.location.assign($("#racineWeb" ).val()+"Creerdossierclassique/"); + + }else{ + v_msg="Aucun bénéficiaire de remboursement n'est enregistré pour cet assuré!"; + v_msgEng="No reimbursement beneficiary is registered for this insured"; + + alert_ebene(v_msg, v_msgEng); + return; + } + }, + error: function(errorData) { + }, + complete: function() { + + } + }); +} + + +function creer_dossier_classique_police() +{ + window.location.assign($("#racineWeb" ).val()+"Creerdossierclassiquepolice/"); +} + +function ajax_police_context() +{ + idPolice = $("#idPolice").val(); + + if (idPolice>"0") + { + $("#div_attente").html('
' + '
'); + + ajax_context_police(idPolice); + creer_dossier_classique_police(); + }else{ + v_msg="Veuillez sélectionner une police pour le remboursement direct!"; + v_msgEng="Please select a policy for direct reimbursement!"; + + alert_ebene(v_msg, v_msgEng); + + $("#idPolice").focus(); + } +} + +function affiche_pays_territoire() +{ + var codeTerritoire = $('#codeTerritoire').val(); + + donnees = 'codeTerritoire='+codeTerritoire; + + div_pays=$("#div_pays"); + + div_pays.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxpaysterritoire/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + + $('#div_pays').html(data); + datatab_plus(); + }, + complete: function() { + + } + }); +} + + +function ajouter_un_pays_territoire(codePays) +{ + + codeTerritoire=$("#codeTerritoire").val(); + + if (codeTerritoire<=" ") + { + v_msg="Veuillez sélectionner un territoire!"; + v_msgEng="Please select a territory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeTerritoire='+codeTerritoire+'&codePays='+codePays; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxpaysterritoire/ajouterunpaysterritoire/", + type: 'POST', + data: donnees, + success: function(data) { + // $('#div_test_gabarit').html(data); + }, + error: function(data) { + }, + complete: function() { + affiche_pays_territoire(); + } + }); +} + +// +function ajouter_tous_pays_territoire() +{ + codeTerritoire=$("#codeTerritoire").val(); + + if (codeTerritoire<=" ") + { + v_msg="Veuillez sélectionner un territoire!"; + v_msgEng="Please select a territory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeTerritoire='+codeTerritoire; + + 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é + $.ajax({ + url: $("#racineWeb").val()+"Ajaxpaysterritoire/ajoutertouspaysterritoire/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + affiche_pays_territoire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function retirer_tous_pays_territoire() +{ + codeTerritoire=$("#codeTerritoire").val(); + + if (codeTerritoire<=" ") + { + v_msg="Veuillez sélectionner un territoire!"; + v_msgEng="Please select a territory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeTerritoire='+codeTerritoire; + + 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é + $.ajax({ + url: $("#racineWeb").val()+"Ajaxpaysterritoire/retirertouspaysterritoire/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + affiche_pays_territoire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function retirer_un_pays_territoire(idPays) +{ + codeTerritoire=$("#codeTerritoire").val(); + + if (codeTerritoire<=" ") + { + v_msg="Veuillez sélectionner un territoire!"; + v_msgEng="Please select a territory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idPays='+idPays; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxpaysterritoire/retirerunpaysterritoire/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + affiche_pays_territoire(); + } + }); +} + +function annuler_facture_classique(idFactureClassique, idFacture) { + + v_msg="Confirmez-vous cette annulation?"; + v_msgEng="Do you confirm this cancellation?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'idFactureClassique=' + idFactureClassique+'&idFacture='+idFacture; + + $("#div_annuler_facture").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxannulationfacturerd/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_annuler_facture").html(data); + $("#div_annuler_facture").modal({backdrop: 'static', keyboard: false, show: true }); + $("#div_annuler_facture").modal("show"); + }, + complete: function () { + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function valider_annulation_facture_classique() +{ + + + idFactureClassique = $("#idFactureClassique").val(); + + motif = $("#motif").val(); + + if(motif <=" ") + { + v_msg="Le motif est obligatoire!"; + v_msgEng="The pattern is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + $("#motif").focus(); + + return; + } + + donnees = "idFactureClassique="+idFactureClassique+'&motif='+motif; + + v_msg="Validez-vous cette annulation?"; + v_msgEng="Do you validate this cancellation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxannulationfacturerd/annuler/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + }, + complete: function() { + afficher_dossier_classique(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function notificationcartesociete() +{ + donnees = ""; + + v_msg="Confirmez-vous l'envoi des numéros de carte aux assurés de toutes les polices?"; + v_msgEng="Do you confirm sending card numbers to policyholders of all policies?"; + + $("#div_patienter").html('
' + '
'); + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnotificationcarte/societe/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + v_msg="Numéros de carte envoyés avec succès!"; + v_msgEng="Card numbers sent successfully!"; + + $("#div_patienter").empty(); + alert_ebene(v_msg, v_msgEng); + }, + complete: function() { + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function notificationcartepolice() +{ + donnees = ""; + + v_msg="Confirmez-vous l'envoi des numéros de carte aux assurés de la police?"; + v_msgEng="Do you confirm sending card numbers to policyholders?"; + + $("#div_patienter").html('
' + '
'); + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnotificationcarte/police/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + v_msg="Numéros de carte envoyés avec succès!"; + v_msgEng="Card numbers sent successfully!"; + + $("#div_patienter").empty(); + + alert_ebene(v_msg, v_msgEng); + }, + complete: function() { + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function notificationcarteadherent() +{ + donnees = ""; + + v_msg="Confirmez-vous l'envoi des numéros de carte des membres de la famille à l'assuré principal?"; + v_msgEng="Do you confirm sending family members' card numbers to the primary insured?"; + + $("#div_patienter").html('
' + '
'); + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnotificationcarte/adherent/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + v_msg="Numéros de carte envoyés avec succès!"; + v_msgEng="Card numbers sent successfully!"; + + $("#div_patienter").empty(); + + alert_ebene(v_msg, v_msgEng); + }, + complete: function() { + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function notificationcarte() +{ + donnees = ""; + + v_msg="Confirmez-vous l'envoi du numéro de carte au bénéficiaire?"; + v_msgEng="Do you confirm sending the card number to the beneficiary?"; + + $("#div_patienter").html('
' + '
'); + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnotificationcarte/nocarte/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + v_msg="Numéros de carte envoyé avec succès!"; + v_msgEng="Card number sent successfully!"; + + $("#div_patienter").empty(); + + alert_ebene(v_msg, v_msgEng); + }, + complete: function() { + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + + + +function ajouter_toutes_specialite() +{ + codeMedecin=$("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médécin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeMedecin='+codeMedecin; + + 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é + $.ajax({ + url: $("#racineWeb").val()+"Ajaxspecialitemedecin/ajoutertoutesspecialites/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + afficher_specialite_medecin(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function afficher_specialite_medecin() +{ + codeMedecin=$("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médécin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeMedecin='+codeMedecin; + + var div_attente = $('#div_specialite'); + + div_attente.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxspecialitemedecin/afficherspecialitemedecin/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + div_attente.html(data); + + appliquerDataTable(); + }, + complete: function() { + } + }); +} + +function retirer_toutes_specialites_medecin() +{ + codeMedecin=$("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médécin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeMedecin='+codeMedecin; + + 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é + $.ajax({ + url: $("#racineWeb").val()+"Ajaxspecialitemedecin/retirertoutesspecialites/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + afficher_specialite_medecin(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function ajouter_une_specialite_medecin(codeSpecialite) +{ + codeMedecin=$("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médécin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeMedecin='+codeMedecin+'&codeSpecialite='+codeSpecialite; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxspecialitemedecin/ajouterunespecialite/", + type: 'POST', + data: donnees, + success: function(data) { + // $('#div_test_gabarit').html(data); + }, + error: function(data) { + }, + complete: function() { + afficher_specialite_medecin(); + } + }); +} + + +function retirer_une_specialite_medecin(idSpecialite) +{ + codeMedecin=$("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médécin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeMedecin='+codeMedecin+'&idSpecialite='+idSpecialite; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxspecialitemedecin/retirerunespecialite/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + afficher_specialite_medecin(); + } + }); +} + + +function affiche_historique_prestations_beneficiaire(){ + + var numeroBeneficiaire = $('#numeroBeneficiaire').val(); + + + $("#div_patienter").html('
' + '
'); + + + donnees = 'numeroBeneficiaire='+numeroBeneficiaire; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxhistoriqueprestationsbeneficiaire/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $("#div_patienter").html(''); + $('#div_historique_prestations').html(data); + $('#div_historique_prestations').modal("show"); + }, + complete: function() { + + } + }); +} + +function affiche_historique_prestations_famille(){ + + var numeroAdherent = $('#numeroAdherent').val(); + + + $("#div_patienter").html('
' + '
'); + + + donnees = 'numeroAdherent='+numeroAdherent; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxhistoriqueprestationsfamille/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $("#div_patienter").html(''); + $('#div_historique_prestations').html(data); + $('#div_historique_prestations').modal("show"); + }, + complete: function() { + + } + }); +} + + + +function afficherhistoriqueadherent(numeroAdherent){ + + d1=$("#d1").val(); + d2=$("#d2").val(); + + codeGarantie=$("#codeGarantie").val(); + + donnees = "numeroAdherent="+numeroAdherent+"&codeGarantie="+codeGarantie; + donnees += '&d1='+d1+'&d2='+d2; + + $("#div_prestation").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxhistoriqueprestationsfamille/prestations/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_prestation").html(data); + + setTimeout(function() { + functionDataTable(); + }, 500); + + + }, + complete: function() { + + } + }); + +} + +function consulter_detail_bareme_college(idBaremePriseEnCharge) +{ + window.location.assign($("#racineWeb" ).val()+"Consulterdetailbaremecollege/"+idBaremePriseEnCharge+"/"); +} + +function retour_fiche_consulter_bareme() +{ + var retour = $('#retour').val(); + + if(retour=="Ficheadherent"){ + afficher_adherent_id(); + }else{ + afficher_beneficiaire_id(); + } + +} + +function afficher_consulter_actes_garantiebareme(idBaremePriseEnCharge, codeGarantie){ + + + donnees = 'codeGarantie='+codeGarantie; + donnees += '&idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $("#div_patienter").html(''); + + $("#div_patienter").html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconsulteractesgarantiebareme/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + + + $('#div_actesgarantiebareme').html(data); + $('#div_actesgarantiebareme').modal("show"); + + appliquerDataTableBareme(); + + $('#div_actesgarantiebareme').on('shown.bs.modal', function(){ + stylechampsRequis(); + }); + + afficherMasquerGarantiesBaremeCollege(); + afficherMasquerGarantiesBaremeLienParenteCollege(); + afficherMasquerActeBaremeCollege(); + afficherMasquerActeBaremeLienParenteCollege(); + + $(".datepicker").datepicker(); + $("#codeActe").selectpicker(); + $("#codeActeLienParente").selectpicker(); + $("#div_patienter").html(''); + }, + complete: function() { + afficheNombreLigneBaremeCollege('garantiesbaremepriseencharge'); + afficheNombreLigneBaremeCollege('garantiesbaremepriseenchargelienparente'); + afficheNombreLigneBaremeCollege('actesbaremepriseencharge'); + afficheNombreLigneBaremeCollege('actesbaremepriseenchargelienparente'); + } + }); +} + +function changer_entite_portail() +{ + codeSociete=$("#codeSociete").val(); + + if (codeSociete<=" ") + { + v_msg="Veuillez indiquer une entité!"; + v_msgEng="Please indicate an entity!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeSociete").focus(); + return; + } + + //alert(codeSociete); + //return; + + donnees = 'codeSociete='+codeSociete; + + v_url = $("#racineWeb").val()+"Ajaxchangerentiteportail/"; + + $("#div_login_portail").html('
' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + // alert('success :' + errorData); + $("#div_login_portail").html(errorData); + }, + success: function(data) { + // alert('success :' + data); + $("#div_login_portail").html(data); + societeExiste = $("#societeExiste").val(); + entiteActive = $("#entiteActive").val(); + + if(societeExiste=="1" && entiteActive=="1") + { + $("#btn_connexion").enable(); + $("#login").focus(); + + }else + { + $("#btn_connexion").disable(); + } + } + }); +} + +function filtreproduitbareme() { + const codeGcAssureur = $('#codeGcAssureur').val(); + + if (!codeGcAssureur || codeGcAssureur.trim() === "") { + $('#div_bareme').html(""); + return; + } + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxfiltreproduitbareme/", + type: 'post', + data: { codeGcAssureur: codeGcAssureur }, + success: function(data) { + $('#div_produit').html(data); + if (typeof actualiserSelectPicker === 'function') { + actualiserSelectPicker('#codeProduit', false); // true pour donner le focus + } else { + // Fallback si la fonction n'est pas chargée + $('#codeProduit').selectpicker('refresh'); + } + } + }); +} + +function afficher_bareme_produit() { + const codeGcAssureur = $("#codeGcAssureur").val(); + const codeProduit = $("#codeProduit").val(); + + if (!codeProduit || codeProduit.trim() === "") { + alert_ebene("Veuillez sélectionner un produit!", "Please select a product!"); + return; + } + + const loader = ` +
+
+
+
+ ${($("#codeLangue").val() === 'en_US') ? 'Fetching scales...' : 'Récupération des barèmes...'} +
+
+
`; + + $('#div_bareme').html(loader); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxbaremeproduit/", + type: 'post', + data: { codeGcAssureur: codeGcAssureur, codeProduit: codeProduit }, + success: function(data) { + $('#div_bareme').hide().html(data).fadeIn(400); + if (typeof appliquerDataTable === 'function') appliquerDataTable(); + } + }); +} + + +function changer_langue_connexion() +{ + codeLangue = $("#langue").val(); + donnees = 'codeLangue='+codeLangue; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconnexioncookie/changerlangue/", + type : 'post', + data: donnees, + error: function(errorData) + { + }, + success: function(data) + { + $("#div_detail_connexion").html(data); + }, + complete: function() + { + actualiserDescriptionPortail(codeLangue); + } + }); + +} + +/* ---------------------------------------------------------- + Textes par slide (9 entrées, FR + EN) + Synchronisés avec le carrousel via updateCaption() + ---------------------------------------------------------- */ +var SLIDE_TEXTS = [ + { fr: "Gérez vos structures de santé en toute simplicité", + en: "Manage your healthcare facilities with ease" }, + { fr: "Des outils puissants pour vos équipes médicales", + en: "Powerful tools for your medical teams" }, + { fr: "Suivi en temps réel de vos indicateurs de performance", + en: "Real-time monitoring of your key performance indicators" }, + { fr: "La digitalisation au service de la santé", + en: "Digitalization at the service of healthcare" }, + { fr: "Collaborez efficacement entre établissements", + en: "Collaborate effectively across facilities" }, + { fr: "Pilotez votre activité depuis un tableau de bord unifié", + en: "Drive your activity from a unified dashboard" }, + { fr: "Sécurisez les données de vos patients", + en: "Keep your patients' data safe and secure" }, + { fr: "Optimisez la gestion de vos ressources humaines", + en: "Streamline your human resources management" }, + { fr: "L'ERP SaaS taillé pour la santé en Afrique", + en: "The SaaS ERP built for healthcare in Africa" } +]; + +function getCaption(index) { + codeLangue = $("#langue").val(); + + var entry = SLIDE_TEXTS[index] || {}; + return (codeLangue === 'en_US') ? (entry.en || '') : (entry.fr || ''); +} + +/* Fondu sortant → swap texte → fondu entrant */ +function updateCaption(index) { + var el = document.getElementById('slideCaption'); + if (!el) return; + el.classList.add('animating'); + setTimeout(function () { + el.textContent = getCaption(index); + el.classList.remove('animating'); + }, 200); +} + +/** + * Met à jour dynamiquement la description du portail selon la langue + * @param {string} p_langue - 'fr_FR' ou 'en_US' + */ +function actualiserDescriptionPortail(p_langue) { + const $description = $('#description'); + + // Définition des textes (Dictionnaire local) + const textes = { + 'fr_FR': 'Solution de Gestion Santé Intégrée', + 'en_US': 'Integrated Health Management Solution' + }; + + // Vérification de l'existence de la clé, sinon défaut en Français + const nouveauTexte = textes[p_langue] || textes['fr_FR']; + + // Animation fluide pour le changement de texte (SaaS UX) + $description.fadeOut(200, function() { + $(this).text(nouveauTexte).fadeIn(200); + }); +} + +function ctrlkeypress_liste_clients(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + afficher_liste_clients(); + } +} + +function afficher_liste_clients() +{ + donnees = ""; + donnees_retour = ""; + + typeClient = $("#typeClient").val(); + nom = $("#nom").val(); + numeroClient = $("#numeroClient").val(); + + /* + if(typeClient==''){ + typeClient=0; + } + */ + + if(numeroClient==''){ + numeroClient=0; + } + + donnees += 'typeClient=' + typeClient; + donnees += '&nom=' + nom; + donnees += '&numeroClient=' + numeroClient; + + //alert(donnees); + //return; + + $("#div_clients").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisterclients/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_clients").html(donnees_retour); + + appliquerDataTable(); + } + }); +} + +function creer_client() +{ + window.location.assign($("#racineWeb" ).val()+"Creerclient/"); +} + +function messageproforma(){ + + + var demandeTraite = $("#demandeTraite").val(); + var numeroBonHospitalisation = $("#numeroBonHospitalisation").val(); + + if(demandeTraite > "0") { + if(numeroBonHospitalisation =="0"){ + + v_msg="Aucun Num\u00e9ro de bon d'hospitalisation n'est g\u00e9n\u00e9r\u00e9. Proforma refusé!"; + v_msgEng="No Hospitalization Voucher Number is generated. Proforma refused!"; + + faireDefileMessage(v_msg, v_msgEng); + + }else{ + + v_msg="Le bon d'hospitalisation No: "+numeroBonHospitalisation+" a été généré avec succès!"; + v_msgEng="Hospitalization voucher No: "+numeroBonHospitalisation+" has been successfully generated!"; + + faireDefileMessage(v_msg, v_msgEng); + } + } + +} + +function faireDefileMessage(p_msg, p_msg_eng){ + + if(p_msg!=""){ + codeLangue = $("#codeLangue").val(); + + if(codeLangue=="en_US") + { + $("#div_messages").html(''+p_msg_eng+''); + } + else + { + $("#div_messages").html(''+p_msg+''); + } + }else{ + + $("#div_messages").html(''); + + } + +} + +function ajouter_un_acte_proforma(codeActe) +{ + var idProforma = $("#idProforma").val(); + + donnees="" + + + if (codeActe<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'codeActe='+codeActe+'&idProforma='+idProforma; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtraitementproformahospitalisation/ajouteractes/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + afficheractesproforma(idProforma); + }, + complete: function() { + + } + }); +} + + +function save_nv_consommable_proformahospit() +{ + idProforma = $("#idProforma ").val(); + libelleconsommable = $("#libelleconsommable").val(); + + + if (libelleconsommable<=" ") + { + v_msg="Veuillez saisir le nom!"; + v_msgEng="Please enter tyhe name!"; + alert_ebene(v_msg, v_msgEng); + $("#libelleconsommable").focus(); + return; + } + + quantiteconsommable=$("#quantiteconsommable").val(); + quantiteconsommable=quantiteconsommable.replace(",","."); + $("#quantiteconsommable").val(quantiteconsommable); + + if(isNaN(quantiteconsommable)) + { + v_msg="Valeur num\u00e9rique exig\u00e9e!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#quantiteconsommable").val("0"); + $("#quantiteconsommable").focus(); + return; + } + + if(quantiteconsommable==0) + { + $("#quantiteconsommable").focus(); + v_msg="Veuillez saisir la quantit\u00e9!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + prixconsommable=$("#prixconsommable").val(); + prixconsommable=prixconsommable.replace(",","."); + $("#prixconsommable").val(prixconsommable); + + if(isNaN(prixconsommable)) + { + v_msg="Valeur num\u00e9rique exig\u00e9e!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#prixconsommable").val("0"); + $("#prixconsommable").focus(); + return; + } + + if(prixconsommable==0) + { + $("#prixconsommable").focus(); + v_msg="Veuillez saisir le prix!"; + v_msgEng="Please enter the price!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + donnees = 'libelleconsommable='+libelleconsommable+'&prixconsommable='+prixconsommable+'&quantiteconsommable='+quantiteconsommable; + donnees += '&idProforma='+idProforma; + + $("#div_patienter_consommable").html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtraitementproformahospitalisation/creerconsommableproformahospit/", + type: 'POST', + data: donnees, + success: function(data) { + afficheractesproforma(idProforma); + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + +function genererfacturedeficitgarant() +{ + donnees = ''; + + v_msg="Confirmez-vous la génération de cette facture?"; + v_msgEng="Do you confirm the creation of this invoice?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturegarant/genererfacturedeficit/", + type: 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + + }, + success: function(data) { + + }, + complete: function(){ + window.location.assign($("#racineWeb" ).val()+"Fichegroupefacturegarant/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + + +function de_archiver_produit(idProduit, dansBareme) +{ + if (dansBareme == "1") + { + v_msg="Op\u00e9ration impossible \u00e0 cause de l'utilisation de ce produit dans un bar\u00e8me de prise en charge!"; + v_msgEng="Operation impossible due to the use of this product in a support scale!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous le d\u00e9sarchivage de ce produit?"; + v_msgEng="Do you confirm the unarchiving of this product?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxproduit/desarchiver/", + type : 'post', + data: "idProduit="+idProduit, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() + { + window.location.assign($("#racineWeb" ).val()+"Produits/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function archiver_produit(idProduit) +{ + + v_msg="Confirmez-vous l'archivage de ce produit?"; + v_msgEng="Do you confirm archiving of this product?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxproduit/archiver/", + type : 'post', + data: "idProduit="+idProduit, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() + { + window.location.assign($("#racineWeb" ).val()+"Produits/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function dupliquer_tarif_actes(idTarif, codeTarifActe) +{ + + + donnees = "codeTarifActe="+codeTarifActe; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcompteurdetailtarifacte/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + + $('#div_compteur').html(data); + + compteur = parseInt($("#compteur").val()); + + if(compteur > 1){ + + v_msg="Confirmez-vous la duplication de ce tarif?"; + v_msgEng="Do you confirm the duplication of this rate?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Dupliquertarifacte/"+idTarif+"/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + }else{ + v_msg="Op\u00e9ration impossible! Veuillez ajouter du détail à ce tarif avant sa duplication."; + v_msgEng="Operation impossible! Please add detail to this rate before duplicating it."; + alert_ebene(v_msg, v_msgEng); + + return; + } + }, + complete: function() + { + + } + }); + +} + +function dupliquertarifacte(){ + + var codeTarifActeSource = $('#codeTarifActeSource').val(), + codeTarifActeCible = $('#codeTarifActeCible').val(), + + //dateEffet = $('#dateEffet').val(); + + donnees = 'codeTarifActeSource='+codeTarifActeSource; + donnees += '&codeTarifActeCible='+codeTarifActeCible; + //donnees += '&dateEffet='+dateEffet; + + $("#div_message").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdupliquertarif/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + + $('#div_message').html(data); + + + + /* + setTimeout(function() { + //your datatable code + lister_tarif_actes(); + }, 500); + */ + }, + complete: function() { + + } + }); + +} + +function ctrlkeypress_liste_prospects(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + afficher_liste_prospects(); + } +} + +function afficher_liste_prospects() +{ + donnees = ""; + donnees_retour = ""; + + typeClient = $("#typeClient").val(); + nom = $("#nom").val(); + numeroClient = $("#numeroClient").val(); + + /* + if(typeClient==''){ + typeClient=0; + } + */ + + if(numeroClient==''){ + numeroClient=0; + } + + donnees += 'typeClient=' + typeClient; + donnees += '&nom=' + nom; + donnees += '&numeroClient=' + numeroClient; + + //alert(donnees); + //return; + + $("#div_prospects").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisterprospects/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_prospects").html(donnees_retour); + + appliquerDataTable(); + } + }); +} + +function creer_prospect() +{ + window.location.assign($("#racineWeb" ).val()+"Creerprospect/"); +} + +function exporter_liste_prospects() +{ + var div_export = $('#div_export_prospects'); + div_export.html('
' + '
'); + + $("#btn_liste_prospects").click(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxexporterlisteprospects/", + type: 'POST', + // data: donnees, + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + // $("#btn_liste_clients").click(); + } + }); +} + +// devis + +function init_import_assures_d() +{ + + + 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; + } + + numeroOptionTarif = $("#numeroOptionTarif").val(); + donnees = 'idDevis='+idDevis+"&numeroOptionTarif="+numeroOptionTarif; + + if (numeroOptionTarif<="0") + { + v_msg="Aucune option!"; + v_msgEng="No option!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeTypeContrat = $("#codeTypeContrat").val(); + policeGroupe = $("#policeGroupe").val(); + + /* + //if (codeTypeContrat!="G") + if (policeGroupe!="1") + { + v_msg="Ce n\'est pas une police GROUPE!"; + v_msgEng="This is not a GROUP policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + window.location.assign($("#racineWeb" ).val()+"Importassuredevis/"); +} + +function importer_modele_assure_d() +{ + etape2=$("#etape2").val(); + + if (etape2 != "1") + { + v_msg="Etape 2 incomplète!"; + v_msgEng="Incomplete step 2!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $('#div_form_upload').hide(); + + var div_export = $('#div_exporter_liste_assures'); + + cheminFichier=$("#cheminFichier").val(); + numeroOptionTarif = $("#numeroOptionTarif").val(); + + donnees = 'numeroOptionTarif='+numeroOptionTarif+'&cheminFichier='+cheminFichier; + + div_export.html('
' + '
'); + + $("#div_erreur_excel").html(""); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/importermodele/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(''); + $("#div_erreur_excel").html(data); + + v_msg="Opération terminée avec succès!"; + v_msgEng="Operation completed successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + div_export.html(''); + + succes_impot_execl=$("#succes_impot_execl").val(); + + if (succes_impot_execl == "1") + { + maj_etape_3_import_assures_d(numeroOptionTarif); + } + } + }); +} + +function maj_etape_3_import_assures_d(numeroOptionTarif) +{ + donnees = 'numeroOptionTarif='+numeroOptionTarif; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/majetape/", + type: 'POST', + data: donnees, + success: function(data) + { + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + window.location.assign($("#racineWeb" ).val()+"Listeimportassuredevis/"); + } + }); +} + +function afficher_adherent_importee_devis() +{ + 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; + + var div_attente = $('#div_adherents_importes'); + + div_attente.html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/afficheradherentimportee/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + div_attente.html(data); + }, + complete: function() { + } + }); +} + +function ajouter_tous_adherent_importe_college_devis() +{ + 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; + + + v_msg="Attention, cela va vider tous les autres collèges! Confirmez-vous?"; + v_msgEng="Be careful, this will empty all other colleges! Do you confirm?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/ajoutertousadherentaucollege/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + afficher_adherent_importee_devis(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + +function ajouter_sans_college_adherent_importe_college_devis() +{ + 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; + + v_msg="Attention! Confirmez-vous cette opération?"; + v_msgEng="Warning! Do you confirm this operation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/ajoutersanscollegeadherentaucollege/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + afficher_adherent_importee_devis(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function retirer_tous_adherent_importe_college_devis() +{ + 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; + + v_msg="Attention, cela va vider ce collège! Confirmez-vous?"; + v_msgEng="Attention, this will empty this college! Do you confirm?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/retirertousadherentaucollege/", + type: 'POST', + data: donnees, + success: function(data) { + // $("#div_test_gabarit").html(data); + }, + error: function(data) { + // $("#div_test_gabarit").html(data); + }, + complete: function() { + afficher_adherent_importee_devis(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function retirer_un_adherent_importe_college_devis(idBeneficiairemodel) +{ + donnees = 'idBeneficiairemodel='+idBeneficiairemodel; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/retirerunadherentaucollege/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + + }, + complete: function() { + afficher_adherent_importee_devis(); + } + }); +} + +function ajouter_un_adherent_importe_college_devis(idBeneficiairemodel) +{ + 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 = 'idBeneficiairemodel='+idBeneficiairemodel+'&idCollege='+idCollege; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/ajouterunadherentaucollege/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + afficher_adherent_importee_devis(); + } + }); +} + +function calculer_population_lien_parente_temp() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/majpopulationcollegeliste/", + type: 'POST', + // data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function incorporer_assures_inmportes_devis() +{ + nb_adh=$("#nb_adh").val(); + + if (nb_adh>"0") + { + v_msg="Veuillez revoir les collèges et relancer le calcul des primes!"; + v_msgEng="Please review the colleges and restart the premium calculation!!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nb_ligne_ass=$("#nb_ligne_ass").val(); + + if (nb_ligne_ass=="0") + { + v_msg="Rien à importer!"; + v_msgEng="Nothing to import!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Avez-vous fait l\'étape 2 => calcul des primes?"; + v_msgEng="Did you do step 2 => premium calculation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + console.log("Confirmation confirmé"); + } else { + // L'utilisateur a annulé + return; + console.log("Confirmation refusée"); + } + }); + + primeTtcTotal=$("#primeTtcTotal").val(); + + if (primeTtcTotal=="0") + { + v_msg="Pas de primes! souhaitez-vous recalculer les primes?"; + v_msgEng="No premiums! do you want to recalculate the premiums?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + return; + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + v_msg="Notez que vous avez accepté l\'incorporation sans primes!"; + v_msgEng="Note that you accepted the incorporation without premium!"; + alert_ebene(v_msg, v_msgEng); + } + + nbBeneficiaireFamilleAtteint = $("#nbBeneficiaireFamilleAtteint").val(); + + if(nbBeneficiaireFamilleAtteint>"0"){ + v_msg = "Population maximum atteinte pour les lignes en rouge!"; + v_msgEng = "Maximum population reached for red lines!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nbGgeMaxBeneficiaireAtteint = $("#nbGgeMaxBeneficiaireAtteint").val(); + + if(nbGgeMaxBeneficiaireAtteint>"0"){ + v_msg = "Âge limite atteinte pour certaines personnes!"; + v_msgEng = "Age limit reached for certain people!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + v_msg="Confirmez-vous l\'incorporation de cette liste?"; + v_msgEng="Do you confirm the incorporation of this list?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + var div_attente = $('#div_liste_assure_importe'); + + div_attente.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/incorpoerassuresimportes/", + type: 'POST', + // data: donnees, + success: function(data) { + v_msg="Incorporation terminée avec succès!"; + v_msgEng="Incorporation completed successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + error: function(data) { + }, + complete: function() { + afficher_police_d_id(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + +function traiter_lignes_importees_d() +{ + etape2=$("#etape2").val(); + + if (etape2 != "1") + { + v_msg="Etape 2 incomplète!"; + v_msgEng="Incomplete step 2!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + etape3=$("#etape3").val(); + + if (etape3 != "1") + { + v_msg="Etape 3 incomplète!"; + v_msgEng="Incomplete step 3!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Listeimportassuredevis/"); +} + +function lister_assures_devis() +{ + window.location.assign($("#racineWeb" ).val()+"Listeassuredevis/"); +} + +function calculer_population_lien_parente_valide() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/majpopulationcollegelistevalide/", + type: 'POST', + // data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + + +function afficher_adherents_devis() +{ + $("#div_liste_adherent").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteadherentdevis/", + type : 'post', + // data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_liste_adherent").html(data); + $(".selectpicker").selectpicker(); + appliquerDataTable(); + } + }); +} + +function pop_adherent_devis(idAdherent) +{ + if (idAdherent>"0") + { + donnees = 'idAdherent='+idAdherent; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteadherentdevis/beneficiairesfamille/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + // $("#div_test_gabarit").html(data); + $("#div_deatil_pop").html(data); + }, + complete: function() { + $("#btn_pop").click(); + } + }); + } +} + +function exporter_liste_assures_devis() +{ + $("#div_deatil_pop").html('
' + '
'); + + $("#btn_pop").click(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteadherentdevis/exporterlisteassuresdevis/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + $("#div_deatil_pop").html(data); + }, + complete: function() { + } + }); +} + +function imprimer_liste_assures_devis() +{ + $("#div_deatil_pop").html('
' + '
'); + + $("#btn_pop").click(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteadherentdevis/imprimerlisteassuresdevis/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + $("#div_deatil_pop").html(data); + }, + complete: function() { + } + }); +} + +// transformer devis en Contrat +function init_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é + $("#btn_pop").click(); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + +function clients_transformer_devis() +{ + idDevis = $("#idPolice_d_C").val(); + donnees = 'idDevis='+idDevis; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtransformerdevis/clientsexistants/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_clients_existants").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function transformer_devis(idClientExistant) +{ + idDevis = $("#idPolice_d_C").val(); + dateEffetContrat = $("#dateEffetContrat").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; + donnees += '&idClientExistant='+idClientExistant+"&dateEffetContrat="+dateEffetContrat; + + $.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 enregistrer_college_temp_d() +{ + + 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(); + + numeroOptionTarif = $('#numeroOptionTarif').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; + donnees += '&numeroOptionTarif='+numeroOptionTarif; + + //console.log(donnees); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescolleged/enregistrercollegelienparentetemp/", + type: 'POST', + data: donnees, + success: function(data) + { + + }, + complete: function(data) + { + } + }); +} + +function change_categorie_college_temp_d() +{ + codeProduit = $('#codeProduit').val(); + + codeLienParente = "A"; + + codeBaseTarification = $('#codeBaseTarification').val(); + + + 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(codeBaseTarification=="AUC") + { + $("#div_prime_categorie").empty(); + $("#div_recapituler").empty(); + + return; + } + + donnees = 'codeProduit='+codeProduit+'&codeBaseTarification='+codeBaseTarification; + + $("#div_prime_categorie").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimescategoried/", + type: 'POST', + data: donnees, + success: function(data) + { + // + $("#div_prime_categorie").html(data); + + enregistrer_college_temp_d(); + recapitulercollege_d(); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + + } + }); +} + +function init_prime_college_temp_d() +{ + codeProduit = $("#codeProduit").val(); + + donnees = 'codeProduit='+codeProduit; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimescategoried/initprimelienparente/", + type: 'POST', + data: donnees, + success: function(data) { + + + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function init_trancheage_college_temp_d() +{ + codeProduit = $("#codeProduit").val(); + + donnees = 'codeProduit='+codeProduit; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimescategoried/inittrancheage/", + type: 'POST', + data: donnees, + success: function(data) { + + + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function init_prime_college_base_tarif_d() +{ + + codeProduit = $("#codeProduit").val(); + codeBaseTarification = $("#codeBaseTarification").val(); + + donnees = 'codeProduit='+codeProduit+'&codeBaseTarification='+codeBaseTarification; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprimescategoried/initprimebasetarif/", + type: 'POST', + data: donnees, + success: function(data) { + + + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function init_bareme_d() +{ + idBaremePriseEnCharge = $("#idBaremePriseEnCharge").val(); + + donnees = 'idBaremePriseEnCharge='+idBaremePriseEnCharge; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxplafondfamilleproduitd/initbareme/", + type: 'POST', + data: donnees, + success: function(data) + { + + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function recapitulercollege_d(){ + 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(); + idBaremePriseEnCharge = $('#idBaremePriseEnCharge').val(); + codeBaseTarification = $('#codeBaseTarification').val(); + seuilRdCollege = $('#seuilRdCollege').val(); + plafondAdherent = $('#plafondAdherent').val(); + + /* + forfaitHonoraire = parseInt($('#forfaitHonoraire').val().replace(/ /g,""),10); + forfaitAppelFond = parseInt($('#forfaitAppelFond').val().replace(/ /g,""),10); + forfaitAppelCotisation = parseInt($('#forfaitAppelCotisation').val().replace(/ /g,""),10); + */ + + + forfaitHonoraire = 0; //parseInt($('#forfaitHonoraire').val().replace(/ /g,""),10); + forfaitAppelFond = 0; //parseInt($('#forfaitAppelFond').val().replace(/ /g,""),10); + forfaitAppelCotisation = 0; //parseInt($('#forfaitAppelCotisation').val().replace(/ /g,""),10); + + numeroOptionTarif = $('#numeroOptionTarif').val(); + + + if(codeBaseTarification <=" " || codeBaseTarification ==undefined) + { + v_msg="Veuillez sélectionner la base de tarification!"; + v_msgEng="Please select pricing basis!"; + alert_ebene(v_msg, v_msgEng); + + $('#codeBaseTarification').focus(); + return; + } + + $('#div_recapituler').html('
' + '
'); + + + 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+'&codeBaseTarification='+codeBaseTarification; + donnees += '&seuilRdCollege='+seuilRdCollege+'&plafondAdherent='+plafondAdherent; + + //donnees += '&forfaitHonoraire='+forfaitHonoraire+'&forfaitAppelFond='+forfaitAppelFond+'&forfaitAppelCotisation='+forfaitAppelCotisation; + donnees += '&forfaitHonoraire='+forfaitHonoraire+'&forfaitAppelFond='+forfaitAppelFond+'&forfaitAppelCotisation='+forfaitAppelCotisation; + donnees += '&numeroOptionTarif='+numeroOptionTarif; + //console.log(donnees); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxrecapitulercolleged/recapituler/", + type: 'POST', + data: donnees, + success: function(data) + { + $('#div_recapituler').empty(); + $('#div_recapituler').html(data); + }, + complete: function(data) + { + enregistrer_college_temp_d(); + + actualisercollege_temp_d(); + } + }); + +} + +function affiche_garanties_par_statut_d() +{ + codeLienParente=$("#codeLienParente").val(); + + if($('#codeLienParente').val()<=" ") + { + v_msg="Veuillez revoir le status!"; + v_msgEng="Please review the status"; + alert_ebene(v_msg, v_msgEng); + + $('#codeLienParente').focus(); + return; + } + + donnees = 'codeLienParente='+codeLienParente; + + //$("#div_garanties_status").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescolleged/", + type: 'POST', + data: donnees, + success: function(data) + { + $("#div_garanties_status").html(data); + + + }, + complete: function(data) + { + enregistrer_college_temp_d(); + } + }); +} + +function actualisercollege_temp_d(){ + + donnees = "" + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmajcolleged/", + type: 'POST', + data: donnees, + success: function(data) + { + $('#div_majcollege').empty(); + $('#div_majcollege').html(data); + $('.selectpicker').selectpicker(); + }, + complete: function(data) + { + + } + }); + +} + +function calculer_prime_inmportation_devis() +{ + nb_adh=$("#nb_adh").val(); + + if (nb_adh>"0") + { + v_msg="Veuillez lier toutes les famille à leur collège!"; + v_msgEng="Please link all the family to their college!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous le calcul de primes?"; + v_msgEng="Do you confirm the premium calculation?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + var div_attente = $('#div_liste_assure_importe'); + + div_attente.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassuredevis/calculerprimeimportee/", + type: 'POST', + // data: donnees, + success: function(data) { + v_msg="Calcul de primes terminée avec succès!"; + v_msgEng="Premium calculation completed successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + error: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Listeimportassuredevis/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + + +function filtreadherentparcollege_d() +{ + + + var idCollegePolice = $('#idCollegePolice').val(); + + if(idCollegePolice ==""){ + idCollegePolice = "0"; + } + + donnees = 'idCollegePolice='+idCollegePolice; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltreadherentparcollegedevis/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + afficher_adherents_devis(); + }, + complete: function() { + + } + }); + +} + +function transformer_client_d(idClient) +{ + donnees = 'idClient='+idClient; + + v_msg="Confirmez-vous la transformation de ce client en prospect?"; + v_msgEng="Do you confirm the transformation of this customer into a prospect?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisterprospects/transformer/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_prospect').html(data); + + idProspect = $("#idProspect").val(); + numeroProspect = $("#numeroProspect").val(); + + $("#idClient_d_C").val(idProspect); + $("#numeroClient_d_C").val(numeroProspect); + + if (idProspect>"") + { + ajax_context_client_d_afficher(idProspect); + } + }, + complete: function() { + + } + }); + + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function filtre_facture_abonnement() +{ + codeExercice = $("#codeExercice").val(); + + donnees = 'codeExercice='+codeExercice; + + + var div_attente = $('#div_facture'); + + div_attente.html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistefacturesabonnement/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + div_attente.html(data); + }, + complete: function() { + + } + }); +} + +function facture_impayees_abonnement() +{ + + + donnees = ""; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistefacturesabonnement/listeimpayees/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_impayees').html(data); + }, + complete: function() { + $("#btn_modal").click(); + } + }); + +} + +function select_toutes_factures_impayees(p_choix) +{ + + + donnees = 'choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistefacturesabonnement/selectiontoutes/", + type: 'POST', + data: donnees, + success: function(data) { + + $('#div_impayees').html(data); + + }, + error: function(data) { + }, + complete: function() { + + //affichertoutfacturationprime(); + } + }); +} + +function select_une_facture_impayee(p_choix, id) +{ + donnees = 'id='+id; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistefacturesabonnement/selectionneune/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_impayees').html(data); + + + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + +function affiche_montant_a_payer_saas() +{ + donnees = ""; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistefacturesabonnement/montantapayer/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_historique').html(data); + }, + error: function(data) { + }, + complete: function() { + + } + }); + +} + +function proceder_paiement_saas() +{ + window.location.assign($("#racineWeb" ).val()+"Payerabonnement/"); +} + +function maj_facture_payer_saas() +{ + donnees = ""; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistefacturesabonnement/majfacturespayees/", + type: 'POST', + data: donnees, + success: function(data) { + + }, + error: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Abonnement/"); + } + }); + +} + +function filtreproduitexclusion(){ + + + var codeGcAssureur = $('#codeGcAssureur').val(); + + if(codeGcAssureur<=" "){ + $('#div_actesproduit').html(""); + } + + donnees = 'codeGcAssureur='+codeGcAssureur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltreproduitexclusion/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + // + $('#div_produit').html(data); + + $("#codeProduit").selectpicker(); + }, + complete: function() { + + } + }); + +} + +function modifier_lien_parente(idLien) +{ + donnees = 'idLien='+idLien; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxparamlienparente/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + // 1. Injecter le contenu dans le conteneur de la modale + $('#div_maj_lien').html(data); + + // 2. Initialiser et afficher la modale Bootstrap + var myModal = new bootstrap.Modal(document.getElementById('div_maj_lien')); + myModal.show(); + } + + }); +} + +function enregistrer_modif_lien_parente() +{ + idLien = $("#idLien").val(); + enVigueur = $("#enVigueur").val(); + + + donnees = 'idLien='+idLien+'&enVigueur='+enVigueur; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxparamlienparente/historiser/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + //alert("Success : "+data); + // + + v_msg="Mis à jour effectuée avec succès!"; + v_msgEng="Updated successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + complete: function() + { + window.location.assign($("#racineWeb" ).val()+"Paramlienparente/"); + } + }); +} + +function activation_prestataire(codePrestataire){ + + let idPrestataire = $('#idPrestataire').val(); + + $("#div_patienter").html('
' + '
'); + + donnees = 'codePrestataire='+codePrestataire; + donnees += '&idPrestataire='+idPrestataire; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxactivationprestataire/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $("#div_patienter").html(''); + $('#div_activation').html(data); + //appliquerDataTable(); + $('#div_activation').modal("show"); + + }, + complete: function() { + + } + }); +} + +function historique_activation_prestataire(codePrestataire) +{ + donnees = 'codePrestataire='+codePrestataire; + + $("#div_historique").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxactivationprestataire/historique/", + type : 'post', + data: donnees, + error: function(errorData){ + alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_historique').html(data); + }, + complete: function() { + retour_prestataire_id(); + } + }); +} + +function maj_authentification_otp() +{ + activerOtp = $("#activerOtp").val(); + + if(activerOtp == "1"){ + v_msg="Etes-vous sur de vouloir activer la double authentification?"; + v_msgEng="Are you sure you want to enable two-factor authentication?"; + }else{ + + v_msg="Etes-vous sur de vouloir désactiver la double authentification?"; + v_msgEng="Are you sure you want to disable two-factor authentication?"; + } + + donnees = 'activerOtp='+activerOtp; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxparametresgeneraux/majauthentification/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_complexite_pass").html(data); + v_msg="Mise à jour effectuée avec succès!"; + v_msgEng="Update done successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + error: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Paramreinitmotpass/"); + } + }); + + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +// FONCTION OTP +function maj_authentification_otp() { + const activerOtp = $("#activerOtp").val(); + const racineWeb = $("#racineWeb").val(); + const codeLangue = $("#codeLangue").val(); + + if(activerOtp == "1"){ + v_msg="Etes-vous sur de vouloir activer la double authentification?"; + v_msgEng="Are you sure you want to enable two-factor authentication?"; + }else{ + v_msg="Etes-vous sur de vouloir désactiver la double authentification?"; + v_msgEng="Are you sure you want to disable two-factor authentication?"; + } + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + $.ajax({ + url: racineWeb + "Ajaxparametresgeneraux/majauthentification/", + type: 'POST', + data: { activerOtp: activerOtp }, + success: function() { + let msg = (codeLangue === "en_US") ? "OTP Security updated" : "Sécurité OTP mise à jour"; + toastr.success(msg); + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Paramreinitmotpass/"); + } + }); + } + }); +} + + + +function modifier_param_filtrage_ip() +{ + + window.location.assign($("#racineWeb" ).val()+"Filtreadresseip/"); +} + +function consulter_param_filtrage_ip() +{ + window.location.assign($("#racineWeb" ).val()+"Filtreadresseipcons/"); +} + + +function retour_param_habilitation() +{ + window.location.assign($("#racineWeb" ).val()+"Paramhabilitation/"); +} + +function enregistrer_modif_param_filtreip() +{ + idSocieteuser = $("#idSocieteuser").val(); + donnees = 'idSocieteuser='+idSocieteuser; + + + + filtrerIp = $("#filtrerIp").val(); + filtrerIpPrestataire= $("#filtrerIpPrestataire").val(); + + donnees += '&filtrerIp='+filtrerIp; + donnees += '&filtrerIpPrestataire='+filtrerIpPrestataire; + + 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é + $.ajax({ + url: $("#racineWeb").val()+"Ajaxparametresgeneraux/majfiltreip/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + consulter_param_filtrage_ip(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function tester_disponibiliter_whatsapp() { + // 1. Initialisation des variables + const p_destinataires = $("#destinataires").val(); + const racineWeb = $("#racineWeb").val(); + const div_cible = $('#div_test_gabarit'); + const codeLangue = $("#codeLangue").val(); + + // On force waapi par défaut selon votre logique actuelle, + // mais prêt pour une sélection dynamique si besoin. + const fournisseurWhatsApp = 'waapi'; + + // 2. Validation du destinataire + if (!p_destinataires || p_destinataires.trim() === "") { + alert_ebene("Veuillez saisir un destinataire!", "Please enter a recipient!"); + $("#destinataires").focus(); + return; + } + + // 3. Validation et mapping du message fournisseur + let p_message = ""; + const providers = { + 'waapi': 'Fournisseur WhatsApp : waapi', + 'ultramsg': 'Fournisseur WhatsApp : ultramsg' + }; + + if (providers[fournisseurWhatsApp]) { + p_message = providers[fournisseurWhatsApp]; + } else { + alert_ebene( + fournisseurWhatsApp + " => Fournisseur de WhatsApp inconnu!", + fournisseurWhatsApp + " => Unknown WhatsApp Provider!" + ); + return; + } + + // 4. Préparation des données (Format Objet) + const donnees = { + destinataires: p_destinataires, + message: p_message, + fournisseurWhatsApp: fournisseurWhatsApp + }; + + // 5. Affichage du loader stylisé + div_cible.html(` +
+
+

+ ${(codeLangue === "en_US") ? "Sending WhatsApp message..." : "Envoi du message WhatsApp..."} +

+
+ `); + + // 6. Requête AJAX + $.ajax({ + url: racineWeb + "Ajaxtesterdisponiblitesms/envoyerlewhatsapp/", + type: 'POST', + data: donnees, + success: function(data) { + toastr.success((codeLangue === "en_US") ? "WhatsApp API called" : "API WhatsApp appelée"); + div_cible.html(data); + }, + error: function(xhr) { + toastr.error((codeLangue === "en_US") ? "Connection error" : "Erreur de connexion"); + div_cible.html(`
Error: ${xhr.statusText}
`); + } + }); +} + + +function parametre_produit() { + var codeProduit = $('#codeProduit').val(); + var racineWeb = $("#racineWeb").val(); + + if (codeProduit <= " ") { + $('#div_parametres').html('

Veuillez sélectionner un produit.

'); + return; + } + + // Loader Standard + $("#div_parametres").html( + '
' + + '
' + + 'Chargement...
' + ); + + $.ajax({ + url: racineWeb + "Ajaxparametreproduitgarant/", + type: 'post', + data: { codeProduit: codeProduit }, + success: function(data) { + $('#div_parametres').hide().html(data).fadeIn(); + }, + error: function() { + $('#div_parametres').html('
Erreur lors du chargement des paramètres.
'); + } + }); +} + +function retour_param_fact_garant() +{ + window.location.assign($("#racineWeb" ).val()+"Paramfacturegarantcons/"); +} + +function inserer_param_fact_produit() +{ + codeGcAssureur = $('#codeGcAssureur').val(); + codeProduit = $('#codeProduit').val(); + + gcTauxFraisReel = $('#gcTauxFraisReel').val(); + gcTauxRedressement = $('#gcTauxRedressement').val(); + gcTauxCommissionGerant = $('#gcTauxCommissionGerant').val(); + + + montantBudget = parseInt($("#montantBudget").val().replace(/ /g,""),10);; + montantBudgetEnfantSupl = parseInt($("#montantBudgetEnfantSupl").val().replace(/ /g,""),10); + montantBudgetConjointSupl = parseInt($("#montantBudgetConjointSupl").val().replace(/ /g,""),10); + + forfaitHonoraire = parseInt($("#forfaitHonoraire").val().replace(/ /g,""),10); + nbAdherent = parseInt($("#nbAdherent").val().replace(/ /g,""),10); + nbBeneficiaire = parseInt($("#nbBeneficiaire").val().replace(/ /g,""),10); + + donnees = 'codeGcAssureur='+codeGcAssureur; + donnees += '&codeProduit='+codeProduit; + donnees += '&gcTauxFraisReel='+gcTauxFraisReel; + + donnees += '&gcTauxRedressement='+gcTauxRedressement; + donnees += '&gcTauxCommissionGerant='+gcTauxCommissionGerant; + donnees += '&montantBudget='+montantBudget; + donnees += '&montantBudgetEnfantSupl='+montantBudgetEnfantSupl; + donnees += '&montantBudgetConjointSupl='+montantBudgetConjointSupl; + donnees += '&forfaitHonoraire='+forfaitHonoraire; + donnees += '&nbAdherent='+nbAdherent; + donnees += '&nbBeneficiaire='+nbBeneficiaire; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxparametreproduitgarant/inserer/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + // + + v_msg="Paramètres insérés avec succès!"; + v_msgEng="Parameters inserted successfully!"; + alert_ebene(v_msg, v_msgEng); + + + }, + complete: function() { + retour_param_fact_garant(); + } + }); + +} + +function modifier_param_fact_produit(superUser) +{ + if (superUser != "1"){ + v_msg="Non autorisé!"; + v_msgEng="Unauthorized!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Paramfactureproduitgarant/"); +} + +function enregistrer_param_fact_produit() +{ + codeGcAssureur = $('#codeGcAssureur').val(); + codeProduit = $('#codeProduit').val(); + + gcTauxFraisReel = $('#gcTauxFraisReel').val(); + gcTauxRedressement = $('#gcTauxRedressement').val(); + gcTauxCommissionGerant = $('#gcTauxCommissionGerant').val(); + + montantBudget = parseInt($("#montantBudget").val().replace(/ /g,""),10);; + montantBudgetEnfantSupl = parseInt($("#montantBudgetEnfantSupl").val().replace(/ /g,""),10); + montantBudgetConjointSupl = parseInt($("#montantBudgetConjointSupl").val().replace(/ /g,""),10); + + forfaitHonoraire = parseInt($("#forfaitHonoraire").val().replace(/ /g,""),10); + nbAdherent = parseInt($("#nbAdherent").val().replace(/ /g,""),10); + nbBeneficiaire = parseInt($("#nbBeneficiaire").val().replace(/ /g,""),10); + + donnees = 'codeGcAssureur='+codeGcAssureur; + donnees += '&codeProduit='+codeProduit; + donnees += '&gcTauxFraisReel='+gcTauxFraisReel; + + donnees += '&gcTauxRedressement='+gcTauxRedressement; + donnees += '&gcTauxCommissionGerant='+gcTauxCommissionGerant; + donnees += '&montantBudget='+montantBudget; + donnees += '&montantBudgetEnfantSupl='+montantBudgetEnfantSupl; + donnees += '&montantBudgetConjointSupl='+montantBudgetConjointSupl; + donnees += '&forfaitHonoraire='+forfaitHonoraire; + donnees += '&nbAdherent='+nbAdherent; + donnees += '&nbBeneficiaire='+nbBeneficiaire; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxparametreproduitgarant/enregistrer/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + // + + v_msg="Paramètres enregistrés avec succès!"; + v_msgEng="Settings saved successfully!"; + alert_ebene(v_msg, v_msgEng); + + + }, + complete: function() { + retour_param_fact_garant_cons(); + } + }); + +} + +function retour_param_fact_garant_cons() +{ + window.location.assign($("#racineWeb" ).val()+"Paramfactureproduitgarantcons/"); +} + + +function ouvrir_parametre_produit() +{ + if ( $("#paramFacGcProduit").val() == "0") + { + v_msg="Non autorisée!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Paramfactureproduitgarantcons/"); +} + +function change_password() +{ + + v_msg="Attention, vous serez déconnecté par la suite! Voulez-vous changer votre mot de passe?"; + v_msgEng="Attention, you will be logged out afterwards! Do you want to change your password?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Changermotpass/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + + +function infos_entite() +{ + donnees = ""; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosentite/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + // + $('#div_entite').html(data); + + delaiUsageSaas = $("#delaiUsageSaas").val(); + + //dateLimiteUsage = $("#dateLimiteUsage").val(); + + /* + v_msg="Dernière facture SAAS: "+delaiUsageSaas+"\nFin de licence: "+dateLimiteUsage; + v_msgEng="Latest SAAS invoice: "+delaiUsageSaas+"\nEnd of license: "+dateLimiteUsage; + */ + + v_msg="Fin d'abonnement: "+delaiUsageSaas; + v_msgEng="End of subscription: "+delaiUsageSaas; + + + alert_ebene(v_msg, v_msgEng); + + return; + + }, + complete: function() { + + } + }); +} + +function change_password() +{ + + v_msg="Attention, vous serez déconnecté par la suite! Voulez-vous changer votre mot de passe?"; + v_msgEng="Attention, you will be logged out afterwards! Do you want to change your password?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + window.location.assign($("#racineWeb" ).val()+"Changermotpass/"); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + +function annuler_facture_classique_police(idFactureClassique, idFacture) { + + v_msg="Confirmez-vous cette annulation?"; + v_msgEng="Do you confirm this cancellation?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'idFactureClassique=' + idFactureClassique+'&idFacture='+idFacture; + + $("#div_annuler_facture").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxannulationfacturerdpolice/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_annuler_facture").html(data); + $("#div_annuler_facture").modal({backdrop: 'static', keyboard: false, show: true }); + $("#div_annuler_facture").modal("show"); + }, + complete: function () { + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function valider_annulation_facture_classique_police() +{ + + + idFactureClassique = $("#idFactureClassique").val(); + + motif = $("#motif").val(); + + if(motif <=" ") + { + v_msg="Le motif est obligatoire!"; + v_msgEng="The pattern is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + $("#motif").focus(); + + return; + } + + donnees = "idFactureClassique="+idFactureClassique+'&motif='+motif; + + v_msg="Validez-vous cette annulation?"; + v_msgEng="Do you validate this cancellation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxannulationfacturerdpolice/annuler/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + }, + complete: function() { + afficher_dossier_classique_police(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function tarif_applique(tarif) +{ + v_msg="Tarif appliqué : "+tarif; + v_msgEng="Price applied : "+tarif; + + alert_ebene(v_msg, v_msgEng); + + return; + +} + +function consulter_envois_whatsapp() +{ + donnees = ""; + donnees_retour = ""; + + date1 = $("#date1").val(); + date2 = $("#date2").val(); + + donnees += 'date1=' + date1; + donnees += '&date2=' + date2; + + $("#div_sms").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdestinatairesms/consulterwhatsapp/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_sms").html(donnees_retour); + $("#nbligne").val("Lignes : "+$("#nbligne_info").val()); + } + }); +} + +function genererQRCode(matricule) { + /* + + const container = document.getElementById('qr-code-container'); + container.innerHTML = '
Génération en cours...
'; + + donnees = "matricule="+matricule; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgenererqrcode/", + type : 'post', + dataType: 'json', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + + + if (data.success) { + // Recharger la page + //modifier_beneficiaire(); + location.reload(); + } else { + container.innerHTML = ` +
+ Erreur: ${data.error || 'Échec de génération'} + +
`; + } + + }, + complete: function() { + + } + }); + */ +} + +function regenererQRCode(matricule) { + /* + + v_msg="Voulez-vous vraiment régénérer ce QR Code ?"; + v_msgEng="Do you really want to regenerate this QR Code?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + genererQRCode(matricule); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + */ +} + +function listerremboursement() +{ + + + d1 = $("#d1").val(); + d2 = $("#d2").val(); + codeEtatDemandeRemboursement = $("#codeEtatDemandeRemboursement").val(); + + donnees = 'd1='+ d1+'&d2='+d2+'&codeEtatDemandeRemboursement='+codeEtatDemandeRemboursement; + + $("#div_dossiers").html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdemanderemboursement/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + // alert(data); + + + $('#div_dossiers').html(data); + }, + complete: function() { + + } + }); +} + +function selectionner_remboursement(idDemande) +{ + donnees = 'idDemande='+idDemande; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdemanderemboursement/selectionnerremb/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + // alert(data); + + }, + complete: function() { + actualiser_remboursement(); + } + }); +} + +function actualiser_remboursement() +{ + window.location.assign($("#racineWeb" ).val()+"Demanderemboursement/"); + +} + +function valider_reponse_demande_rd() +{ + idDemandeRemboursement = $("#idDemandeRemboursement").val(); + idBeneficiaire = $("#idBeneficiaire").val(); + codeEtatDemandeRemboursement = $("#codeEtatDemandeRemboursement").val(); + motifReponseDemandeRemboursement = $("#motifReponseDemandeRemboursement").val(); + + nbreFichier = $("#nbreFichier").val(); + + if(codeEtatDemandeRemboursement=="0"){ + + v_msg="Un autre état de réponse est obligatoire!"; + v_msgEng="Another response status is required!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeEtatDemandeRemboursement").focus(); + + return; + } + + if(motifReponseDemandeRemboursement<=" "){ + + v_msg="Le motif est obligatoire!"; + v_msgEng="The pattern is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReponseDemandeRemboursement").focus(); + + return; + } + + if(codeEtatDemandeRemboursement=="1" && nbreFichier=="0"){ + + v_msg="Au moins une facture doit être incluse à la demande !"; + v_msgEng="At least one invoice must be included with the request!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + donnees = 'idDemandeRemboursement='+idDemandeRemboursement; + donnees += '&codeEtatDemandeRemboursement='+codeEtatDemandeRemboursement; + donnees += '&motifReponseDemandeRemboursement='+motifReponseDemandeRemboursement; + + v_msg="Confirmez-vous cette réponse ?"; + v_msgEng="Do you confirm this answer?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdemanderemboursement/majreponse/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + // alert(data); + + + }, + complete: function() { + + if(codeEtatDemandeRemboursement=="1"){ + ajax_context_adherent(idBeneficiaire); + }else{ + window.location.assign($("#racineWeb" ).val()+"Historiqueremboursement/"); + + } + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function creer_dossier_demande_rd() +{ + + idBeneficiaire = $("#idBeneficiaire").val(); + + v_msg="Confirmez-vous la création du dossier de remboursement ?"; + v_msgEng="Do you confirm the creation of the reimbursement file?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + ajax_context_adherent(idBeneficiaire); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + +function filtrespoliceencoursgarant(){ + + var codeGcAssureur = $('#codeGcAssureur').val(); + + donnees = 'codeGcAssureur='+codeGcAssureur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfiltrespoliceencoursgarant/", + type : 'post', + data: donnees, + error: function(errorData){ + //alert("Erreur : "+errorData); + }, + success: function(data) { + //alert("Success : "+data); + $('#div_policegarant').html(data); + + $("#idPolice" ).selectpicker(); + }, + complete: function() { + reinit_edition_carte(); + } + }); + +} + +function reinit_edition_carte(){ + idPolice =$("#idPolice").val(); + + $("#div_liste_carte").html('
' + '
'); + + donnees = 'idPolice='+idPolice; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistecarteassure/reinitedition/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_liste_carte").html(''); + }, + complete: function() { + + } + }); + +} + +function filtrescollegepolicecarte() { + + donnees = "idPolice=" + $("#idPolice").val(); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxfiltrescollegepolicecarte/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#div_college").html(data); + $("#idCollege").selectpicker(); + }, + complete: function () { + + } + }); +} + +function select_tous_carte_a_editer(p_choix) +{ + + + donnees = 'choix='+p_choix; + + $("#div_liste_carte").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistecarteassure/toutchoisir/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_liste_carte').html(data); + appliquerDataTable(); + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + +function select_un_assure_a_editer(p_choix, id) +{ + donnees = 'id='+id; + donnees += '&choix='+p_choix; + + //$("#div_liste_carte").html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistecarteassure/selectionunassure/", + type: 'POST', + data: donnees, + success: function(data) { + //$('#div_liste_carte').html(data); + //appliquerDataTable(); + }, + error: function(data) { + }, + complete: function() { + + } + }); +} + +function confirmer_edition_carte(){ + + idPolice =$("#idPolice").val(); + typeEdition =$("#typeEdition").val(); + + $("#div_liste_carte").html('
' + '
'); + + donnees = 'idPolice='+idPolice; + + v_msg="Confirmez-vous l'édition de carte assuré ?"; + v_msgEng="Do you confirm the insured card edition?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + if (numeroBeneficiaire_C>"") + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistecarteassure/confirmedition/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + }, + complete: function() { + afficher_liste_carteassure_commun(); + } + }); + } + } else { + afficher_liste_carteassure_commun(); + } + }); + +} + +function actualiser_carte_assure() +{ + window.location.assign($("#racineWeb" ).val()+"Carteassures/"); +} + +function afficher_detail_emission(idEmission) +{ + if (idEmission>"0") + { + window.location.assign($("#racineWeb" ).val()+"Detailemission/"+idEmission+"/"); + } +} + + +function paiement_mobile_un_dossier() +{ + regle=$("#regle").val(); + + if (regle==1) + { + v_msg="Déjà payé!"; + v_msgEng="Already paid!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + fraisRetenu=$("#fraisRetenu").val(); + if (fraisRetenu<=0) + { + v_msg="Rien à payer!"; + v_msgEng="Nothing to pay!"; + 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; + } + + paiementMobileActif=$("#paiementMobileActif").val(); + paiementMobileActif = parseInt(paiementMobileActif); + + if (paiementMobileActif!=1) + { + v_msg="Module paiement mobile non activé!"; + v_msgEng="Mobile payment module not activated"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Paiementmobile/"); +} + +function reinitialiser_changementcollege() +{ + v_msg="Confirmez-vous la réinitialisation?"; + v_msgEng="Do you confirm the reset?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + window.location.assign($("#racineWeb" ).val()+"Fichechangementcollege/"); + } + }); +} + +function lister_avenants_sans_primes() +{ + $("#div_page_complet").html('
' + '
'); + + debut=$("#debut").val(); + fin=$("#fin").val(); + + donnees = 'debut='+debut+'&fin='+fin; + + $("#avenant_a_facturer").html('
' + '
'); + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturerpolice/listeravenantsanprime/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_page_complet").html(data); + appliquerDataTable(); + }, + complete: function() { + } + }); +} + + +function cloturer_avenant_sans_prime(idAvenant) +{ + v_msg="Confirmez-vous cette opération?"; + v_msgEng="Do you confirm this operation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + + $("#div_page_complet").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturerpolice/clotureravenantsansprime/", + type : 'post', + data: "idAvenant="+idAvenant, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() + { + lister_avenants_sans_primes(); + } + }); + } else { + } + }); + +} + +function tester_reconnaissance_faciale() +{ + alert("tester_reconnaissance_faciale"); + return; + + p_idReglement = $("#idReglement").val(); + p_fournisseurPaiementMobile = $("#fournisseurPaiementMobile").val(); + p_prefixdestinataire = $("#prefixdestinataire").val(); + p_destinataires = $("#destinataires").val(); + + paiementMobileActif=$("#paiementMobileActif").val(); + paiementMobileActif = parseInt(paiementMobileActif); + + if (paiementMobileActif!=1) + { + v_msg="Module paiement mobile non activé!"; + v_msgEng="Mobile payment module not activated"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + if (p_idReglement<=" ") + { + v_msg="ID Règlement manquant!"; + v_msgEng="Missing Regulation ID!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (fournisseurPaiementMobile<=" ") + { + v_msg="Fournisseur de paiement mobile non défini!"; + v_msgEng="Mobile payment provide not defined!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (p_prefixdestinataire<=" ") + { + v_msg="Veuillez saisir un préfixe!"; + v_msgEng="Please enter a prefix!"; + alert_ebene(v_msg, v_msgEng); + + $("#prefixdestinataire").focus(); + return; + } + + if (p_destinataires<=" ") + { + v_msg="Veuillez saisir un destinataire!"; + v_msgEng="Please enter a recipient!"; + alert_ebene(v_msg, v_msgEng); + + $("#destinataires").focus(); + return; + } + + const liste_fournisseurs = ["cinetpay", "paydunya", "waveci"]; + + if (!liste_fournisseurs.includes(p_fournisseurPaiementMobile)) + { + v_msg=p_fournisseurPaiementMobile+" => Fournisseur de paiement mobile inconnu!"; + v_msgEng=fournisseurPaiementMobile+" => Unknown Mobile payment provider!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + donnees = "idReglement="+p_idReglement; + donnees += "&fournisseurPaiementMobile="+p_fournisseurPaiementMobile; + donnees += "&prefixdestinataire="+p_prefixdestinataire; + donnees += "&destinataires="+p_destinataires; + + $("#div_test_gabarit").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtesterpaiementmobile/envoyerargent/", + type: 'POST', + data: donnees, + success: function(data) + { + // alert("success "+data); + $('#div_test_gabarit').html(data); + }, + error: function(errdata) + { + // alert("Error : "+errdata); + $('#div_test_gabarit').html(errdata); + }, + complete: function() + { + } + }); +} + +function tester_paiement_mobile() +{ + p_idReglement = $("#idReglement").val(); + p_fournisseurPaiementMobile = $("#fournisseurPaiementMobile").val(); + p_prefixdestinataire = $("#prefixdestinataire").val(); + p_destinataires = $("#destinataires").val(); + p_withdrawModePaiementMobile = $("#withdrawModePaiementMobile").val(); + + paiementMobileActif=$("#paiementMobileActif").val(); + paiementMobileActif = parseInt(paiementMobileActif); + + if (paiementMobileActif!=1) + { + v_msg="Module paiement mobile non activé!"; + v_msgEng="Mobile payment module not activated"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + if (p_idReglement<=" ") + { + v_msg="ID Règlement manquant!"; + v_msgEng="Missing Regulation ID!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (fournisseurPaiementMobile<=" ") + { + v_msg="Fournisseur de paiement mobile non défini!"; + v_msgEng="Mobile payment provide not defined!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (p_prefixdestinataire<=" ") + { + v_msg="Veuillez saisir un préfixe!"; + v_msgEng="Please enter a prefix!"; + alert_ebene(v_msg, v_msgEng); + + $("#prefixdestinataire").focus(); + return; + } + + if (p_destinataires<=" ") + { + v_msg="Veuillez saisir un destinataire!"; + v_msgEng="Please enter a recipient!"; + alert_ebene(v_msg, v_msgEng); + + $("#destinataires").focus(); + return; + } + + if (p_withdrawModePaiementMobile<=" ") + { + v_msg="Veuillez indiquer le withdraw mode!"; + v_msgEng="Please indicate the withdraw mode!"; + alert_ebene(v_msg, v_msgEng); + + $("#withdrawModePaiementMobile").focus(); + return; + } + + const liste_fournisseurs = ["cinetpay", "paydunya", "waveci"]; + + if (!liste_fournisseurs.includes(p_fournisseurPaiementMobile)) + { + v_msg=p_fournisseurPaiementMobile+" => Fournisseur de paiement mobile inconnu!"; + v_msgEng=fournisseurPaiementMobile+" => Unknown Mobile payment provider!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + donnees = "idReglement="+p_idReglement; + donnees += "&fournisseurPaiementMobile="+p_fournisseurPaiementMobile; + donnees += "&prefixdestinataire="+p_prefixdestinataire; + donnees += "&destinataires="+p_destinataires; + donnees += "&withdrawModePaiementMobile="+p_withdrawModePaiementMobile; + + $("#div_test_gabarit").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtesterpaiementmobile/envoyerargent/", + type: 'POST', + data: donnees, + success: function(data) + { + // alert("success "+data); + $('#div_test_gabarit').html(data); + }, + error: function(errdata) + { + // alert("Error : "+errdata); + $('#div_test_gabarit').html(errdata); + }, + complete: function() + { + } + }); +} + +function paiement_par_mobile() +{ + p_idReglement = $("#idReglement").val(); + p_fournisseurPaiementMobile = $("#fournisseurPaiementMobile").val(); + p_prefixePaiementMobile = $("#prefixePaiementMobile").val(); + p_mobilePaiement = $("#mobilePaiement").val(); + p_withdrawModePaiementMobile = $("#withdrawModePaiementMobile").val(); + + paiementMobileActif=$("#paiementMobileActif").val(); + paiementMobileActif = parseInt(paiementMobileActif); + + if (paiementMobileActif!=1) + { + v_msg="Module paiement mobile non activé!"; + v_msgEng="Mobile payment module not activated"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + plafondPaiementMobile=$("#plafondPaiementMobile").val(); + plafondPaiementMobile = parseInt(plafondPaiementMobile); + + montantMobileMoney=$("#montantMobileMoney").val(); + montantMobileMoney = parseInt(montantMobileMoney); + + if (montantMobileMoney > plafondPaiementMobile) + { + v_msg="Plafond mobile monney dépassé!"; + v_msgEng="Mobile money ceiling exceeded!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (p_idReglement<=" ") + { + v_msg="Veuillez indiquer un décompte à payer!"; + v_msgEng="Please indicate a statement to pay!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (p_prefixePaiementMobile<=" ") + { + v_msg="L'indicatif du téléphonique est obligatoire!"; + v_msgEng="The telephone code is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (p_fournisseurPaiementMobile<=" ") + { + v_msg="Fournisseur de paiement mobile non défini!"; + v_msgEng="Mobile payment provide not defined!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (p_mobilePaiement<=" ") + { + v_msg="Le numéro du téléphonique est obligatoire!"; + v_msgEng="The phone number is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + if (p_withdrawModePaiementMobile<=" ") + { + v_msg="Veuillez indiquer un oprérateur!"; + v_msgEng="Please specify an operator!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#btn_paiement").prop("disabled",true); + + donnees = "idReglement="+p_idReglement; + donnees += "&withdrawModePaiementMobile="+p_withdrawModePaiementMobile; + + // alert(donnees); + // return; + + v_msg="Confirmez-vous le paiement mobile?"; + v_msgEng="Do you confirm mobile payment?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + + $("#div_wait").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxpaiementmobile/envoyerargent/", + type: 'POST', + data: donnees, + success: function(data) + { + $('#div_wait').html(data); + + $("#btn_paiement").prop("disabled",false); + + v_msg="Paiement mobile bien effectué!"; + v_msgEng="Mobile payment successful!"; + alert_ebene(v_msg, v_msgEng); + }, + error: function(errdata) + { + // alert("Error : "+errdata); + $('#div_test_gabarit').html(errdata); + }, + complete: function() + { + afficher_dossier_classique(); + } + }); + } else { + afficher_dossier_classique(); + } + }); +} + +function paiement_mobile_un_dossier_police() +{ + regle=$("#regle").val(); + + if (regle==1) + { + v_msg="Déjà payé!"; + v_msgEng="Already paid!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + fraisRetenu=$("#fraisRetenu").val(); + if (fraisRetenu<=0) + { + v_msg="Rien à payer!"; + v_msgEng="Nothing to pay!"; + 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; + } + + paiementMobileActif=$("#paiementMobileActif").val(); + paiementMobileActif = parseInt(paiementMobileActif); + + if (paiementMobileActif!=1) + { + v_msg="Module paiement mobile non activé!"; + v_msgEng="Mobile payment module not activated"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Paiementmobilepolice/"); +} + + +function paiement_par_mobile_police() +{ + p_idReglement = $("#idReglement").val(); + p_fournisseurPaiementMobile = $("#fournisseurPaiementMobile").val(); + p_prefixePaiementMobile = $("#prefixePaiementMobile").val(); + p_mobilePaiement = $("#mobilePaiement").val(); + p_withdrawModePaiementMobile = $("#withdrawModePaiementMobile").val(); + + paiementMobileActif=$("#paiementMobileActif").val(); + paiementMobileActif = parseInt(paiementMobileActif); + + if (paiementMobileActif!=1) + { + v_msg="Module paiement mobile non activé!"; + v_msgEng="Mobile payment module not activated"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + plafondPaiementMobile=$("#plafondPaiementMobile").val(); + plafondPaiementMobile = parseInt(plafondPaiementMobile); + + montantMobileMoney=$("#montantMobileMoney").val(); + montantMobileMoney = parseInt(montantMobileMoney); + + if (montantMobileMoney > plafondPaiementMobile) + { + v_msg="Plafond mobile monney dépassé!"; + v_msgEng="Mobile money ceiling exceeded!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (p_idReglement<=" ") + { + v_msg="Veuillez indiquer un décompte à payer!"; + v_msgEng="Please indicate a statement to pay!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (p_prefixePaiementMobile<=" ") + { + v_msg="L'indicatif du téléphonique est obligatoire!"; + v_msgEng="The telephone code is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (p_fournisseurPaiementMobile<=" ") + { + v_msg="Fournisseur de paiement mobile non défini!"; + v_msgEng="Mobile payment provide not defined!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (p_mobilePaiement<=" ") + { + v_msg="Le numéro du téléphonique est obligatoire!"; + v_msgEng="The phone number is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (p_withdrawModePaiementMobile<=" ") + { + v_msg="Veuillez indiquer un oprérateur!"; + v_msgEng="Please specify an operator!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#btn_paiement").prop("disabled",true); + + donnees = "idReglement="+p_idReglement; + donnees += "&withdrawModePaiementMobile="+p_withdrawModePaiementMobile; + + // alert(donnees); + // return; + + v_msg="Confirmez-vous le paiement mobile?"; + v_msgEng="Do you confirm mobile payment?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + + $("#div_wait").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxpaiementmobile/envoyerargent/", + type: 'POST', + data: donnees, + success: function(data) + { + $('#div_wait').html(data); + + $("#btn_paiement").prop("disabled",false); + + // $('#div_test_gabarit').html(data); + + v_msg="Paiement mobile bien effectué!"; + v_msgEng="Mobile payment successful!"; + alert_ebene(v_msg, v_msgEng); + }, + error: function(errdata) + { + $('#div_test_gabarit').html(errdata); + }, + complete: function() + { + afficher_dossier_classique_police(); + } + }); + } else { + afficher_dossier_classique_police(); + } + }); +} + + +function exporter_modele_tarif_acte() +{ + $('#div_form_upload').hide(); + + + var div_export = $('#div_exporter_tarif'); + + + div_export.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximportertarifacte/exportermodele/", + type: 'POST', + //data: donnees, + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function() + { + } + }); +} + + +function init_import_tarif_actes() +{ + adminSin=$("#adminSin").val(); + + if (adminSin!="1") + { + v_msg="Non autorisée!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeTarifActe=$("#codeTarifActe").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; + } + + donnees = 'codeTarifActe='+codeTarifActe; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcomposantetarif/initimport/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + //alert(data); + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Importertarifsactes/"); + } + }); +} + + +function charger_fichier_modele_tarifacte() +{ + $('#div_exporter_tarif').html(""); + + $('#div_form_upload').show(); + + // return; +} + +function importer_modele_tarif_acte() +{ + etape2=$("#etape2").val(); + + if (etape2 != "1") + { + v_msg="Etape 2 incomplète!"; + v_msgEng="Incomplete step 2!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeTarifActe=$("#codeTarifActe").val(); + cheminFichier=$("#cheminFichier").val(); + + donnees = 'codeTarifActe='+codeTarifActe+'&cheminFichier='+cheminFichier; + + + $('#div_form_upload').hide(); + + var div_export = $('#div_exporter_tarif'); + + div_export.html('
' + '
'); + + $("#div_erreur_excel").html(""); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximportertarifacte/importermodele/", + type: 'POST', + data: donnees, + success: function(data) + { + div_export.html(''); + $("#div_erreur_excel").html(data); + + v_msg="Opération terminée avec succès!"; + v_msgEng="Operation completed successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + + div_export.html(''); + + succes_impot_execl=$("#succes_impot_execl").val(); + + if (succes_impot_execl == "1") + { + maj_etape_3_import_actes(); + } + + } + }); +} + +function maj_etape_3_import_actes() +{ + codeTarifActe=$("#codeTarifActe").val(); + + donnees = 'codeTarifActe='+codeTarifActe; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximportertarifacte/majetape/", + type: 'POST', + data: donnees, + success: function(data) + { + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + window.location.assign($("#racineWeb" ).val()+"Listeimporttarifacte/"); + } + }); +} + +function traiter_actes_importes() +{ + etape2=$("#etape2").val(); + + if (etape2 != "1") + { + v_msg="Etape 2 incomplète!"; + v_msgEng="Incomplete step 2!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + etape3=$("#etape3").val(); + + if (etape3 != "1") + { + v_msg="Etape 3 incomplète!"; + v_msgEng="Incomplete step 3!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Listeimporttarifacte/"); +} + +function ajax_composante_tarif_acte_importe() +{ + adminSin=$("#adminSin").val(); + + if (adminSin!="1") + { + v_msg="Non autorisée!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeTarifActe=$("#codeTarifActe").val(); + codeFamilleActe=$("#codeFamilleActe").val(); + + if(codeFamilleActe<=' ') + { + v_msg="Veuillez saisir une famille!"; + v_msgEng="Please select a family!"; + alert_ebene(v_msg, v_msgEng); + $("#codeFamilleActe").focus(); + return; + } + + donnees = 'codeTarifActe='+codeTarifActe+'&codeFamilleActe='+codeFamilleActe; + + var div_attente = $('#div_compsante_tarif'); + + div_attente.html('
' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximportertarifacte/affichercomposantetarif/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + // $('#div_test_gabarit').html(data); + div_attente.html(data); + $(".datepicker").datepicker(); + appliquerDataTable(); + }, + complete: function() { + } + }); +} + +function valider_import_tarif_actes() +{ + codeTarifActe=$("#codeTarifActe").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; + } + + donnees = 'codeTarifActe='+codeTarifActe; + + v_msg="Validez-vous cette importation de tarif?"; + v_msgEng="Do you validate this tariff import?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $.ajax({ + url: $("#racineWeb").val()+"Ajaximportertarifacte/validerimporttarifacte/", + type: 'POST', + data: donnees, + success: function(data) + { + $('#div_test_gabarit').html(data); + }, + error: function(data) { + $('#div_test_gabarit').html(data); + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Compositiontarifactes/"); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + +function importer_tarif_medicaments_code() +{ + adminSin=$("#adminSin").val(); + + if (adminSin!="1") + { + v_msg="Non autorisée!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeTarifMedicament=$("#codeTarifMedicament").val(); + + donnees = 'codeTarifMedicament='+codeTarifMedicament; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcomposantetarifmedicament/initimportcode/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Importertarifmedicament/"); + } + }); +} + +function afficher_liste_carteassure_police() +{ + donnees = ""; + donnees_retour = ""; + + idPolice =$("#idPolice").val(); + if(idPolice<=' ') + { + v_msg="Veuillez saisir une police!"; + v_msgEng="Please select a police!"; + alert_ebene(v_msg, v_msgEng); + + $("#idPolice").focus(); + return; + } + + idCollege=$("#idCollege").val(); + + $("#div_export_a").html(""); + + $("#div_liste_carte").html('
' + '
'); + + donnees = 'idPolice='+idPolice+'&idCollege='+idCollege; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistecarteassure/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_liste_carte").html(donnees_retour); + appliquerDataTable(); + $("#nbligne").val("Lignes : "+$("#nbligne_info").val()); + } + }); +} + +function tester_edition_carteassure() +{ + idPolice =$("#idPolice").val(); + donnees = 'idPolice='+idPolice; + + $('#div_export_a').html(""); + $('#div_liste_carte').html(""); + + $("#div_liste_carte").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistecarteassure/afficherliste/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_liste_carte").html(donnees_retour); + $("#nbligne").val("Lignes : "+$("#nbligne_info").val()); + + nbChoix = $("#nbChoix").val(); + if (nbChoix<="0") + { + v_msg="Liste vide!"; + v_msgEng="Empty list!"; + alert_ebene(v_msg, v_msgEng); + appliquerDataTable(); + return false; + } + else + { + editer_carteassure(); + } + } + }); +} + +function editer_carteassure() +{ + nbChoix = $("#nbChoix").val(); + if (nbChoix<="0") + { + v_msg="Liste vide!"; + v_msgEng="Empty list!"; + alert_ebene(v_msg, v_msgEng); + return false; + } + + idPolice =$("#idPolice").val(); + idCollege=$("#idCollege").val(); + + $('#div_export_a').html(""); + $('#div_liste_carte').html(""); + + donnees = 'idPolice='+idPolice+'&idCollege='+idCollege; + + v_url = $("#racineWeb").val()+"Ajaxeditioncarteassure/"; + + $("#div_export_a").html('
' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_export_a").html(data); + } + }); +} + +function controler_piece_beneficiaire() +{ + v_codeNaturePiece = $("#codeNaturePiece").val(); + + if(v_codeNaturePiece<=' ') + { + v_msg="Veuillez sélection la nature de la pièce!"; + v_msgEng="Please select the type of document!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeNaturePiece").focus(); + return; + } + + $('#numeroPiece').removeAttr('minlength'); + + if(v_codeNaturePiece=="CNI") + { + $('#div_controle_piece').html(""); + + v_numeroPiece = $("#numeroPiece").val(); + + $('#numeroPiece').attr('minlength', 9); + + donnees = "numeroPiece="+v_numeroPiece; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontrolepiece/", + type: 'POST', + data: donnees, + success: function(data) { + $('#div_controle_piece').html(data); + + var resultatPiece = $("#resultatPiece").val(); + + if(resultatPiece!="0") + { + $("#numeroPiece").focus(); + return; + } + }, + error: function(data) { + }, + complete: function() + { + } + }); + } +} + +function enregistrer_encaissement_quittance() +{ + anc_solde = $("#anc_solde").val(); + montant = $("#montant").val(); + montant_ecart = (montant-anc_solde); + montant_ecart = Math.abs(montant_ecart); + + 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(); + codeTypePaiement = $("#codeTypePaiement").val(); + banquePayeur = $("#banquePayeur").val(); + + 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(codeTypePaiement=="B" || codeTypePaiement=="M") + { + if (nomTireur<=" ") + { + v_msg="Veuillez saisir le tireur!"; + v_msgEng="Please enter the issuer of the check! "; + alert_ebene(v_msg, v_msgEng); + + $("#nomTireur").focus(); + return; + } + + if(banquePayeur<=" ") + { + v_msg="Veuillez indiquer l\'établissement payeur!"; + v_msgEng="Please indicate the paying institution!"; + alert_ebene(v_msg, v_msgEng); + + $("#banquePayeur").focus(); + return; + } + } + + if(montant_ecart>"100") + { + v_msg="Veuillez vérifier votre écart!"; + v_msgEng="Please check your gap!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + // if(montant=="100") + 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(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 suite_encaissement_client() +{ + 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(); + codeTypePaiement = $("#codeTypePaiement").val(); + nomTireur = $("#nomTireur").val(); + banquePayeur = $("#banquePayeur").val(); + + 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(codeTypePaiement=="B" || codeTypePaiement=="M") + { + if (nomTireur<=" ") + { + v_msg="Veuillez saisir le tireur!"; + v_msgEng="Please enter the issuer of the check! "; + alert_ebene(v_msg, v_msgEng); + + $("#nomTireur").focus(); + return; + } + + if(banquePayeur<=" ") + { + v_msg="Veuillez indiquer l\'établissement payeur!"; + v_msgEng="Please indicate the paying institution!"; + alert_ebene(v_msg, v_msgEng); + + $("#banquePayeur").focus(); + return; + } + } + + if(montant<="0") + { + v_msg="Veuillez saisir un montant!"; + v_msgEng="Please enter an amount"; + alert_ebene(v_msg, v_msgEng); + + $("#montant").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; + } + + $("#btn_suivant").click(); +} + + +function suite_encaissement_bordreau() +{ + 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(); + codeTypePaiement = $("#codeTypePaiement").val(); + nomTireur = $("#nomTireur").val(); + banquePayeur = $("#banquePayeur").val(); + + 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(codeTypePaiement=="B" || codeTypePaiement=="M") + { + if (nomTireur<=" ") + { + v_msg="Veuillez saisir le tireur!"; + v_msgEng="Please enter the issuer of the check! "; + alert_ebene(v_msg, v_msgEng); + + $("#nomTireur").focus(); + return; + } + + if(banquePayeur<=" ") + { + v_msg="Veuillez indiquer l\'établissement payeur!"; + v_msgEng="Please indicate the paying institution!"; + alert_ebene(v_msg, v_msgEng); + + $("#banquePayeur").focus(); + return; + } + } + + if(montant<="0") + { + v_msg="Veuillez saisir un montant!"; + v_msgEng="Please enter an amount"; + alert_ebene(v_msg, v_msgEng); + + $("#montant").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; + } + + $("#btn_suivant").click(); +} + +function suite_encaissement_depot() +{ + 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(); + codeTypePaiement = $("#codeTypePaiement").val(); + nomTireur = $("#nomTireur").val(); + banquePayeur = $("#banquePayeur").val(); + + 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(codeTypePaiement=="B" || codeTypePaiement=="M") + { + if (nomTireur<=" ") + { + v_msg="Veuillez saisir le tireur!"; + v_msgEng="Please enter the issuer of the check! "; + alert_ebene(v_msg, v_msgEng); + + $("#nomTireur").focus(); + return; + } + + if(banquePayeur<=" ") + { + v_msg="Veuillez indiquer l\'établissement payeur!"; + v_msgEng="Please indicate the paying institution!"; + alert_ebene(v_msg, v_msgEng); + + $("#banquePayeur").focus(); + return; + } + } + + if(montant<="0") + { + v_msg="Veuillez saisir un montant!"; + v_msgEng="Please enter an amount"; + alert_ebene(v_msg, v_msgEng); + + $("#montant").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; + } + + $("#btn_depot").click(); +} + +function liste_renouvellement_medicament() +{ + demandeTraite = $("#demandeTraite").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + donnees = 'demandeTraite='+demandeTraite; + donnees += '&debut='+debut+'&fin='+fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxententeprealablespha/renouvellementmedicament/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ententeprealable").html(data); + }, + complete: function() { + + } + }); +} + +function afficher_detail_ren_medicament(idPrescription) { + + + donnees = "idPrescription=" + idPrescription; + + + $("#div_patienter").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsrenouvellement/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + //$('#div_test_gabarit').html(data); + //alert(data); + + $("#div_medicaments_prescrits").html(data); + $("#div_medicaments_prescrits").modal({ backdrop: 'static', keyboard: false, show: true }); + $("#div_medicaments_prescrits").modal("show"); + $("#div_patienter").empty(); + + //alert("afficherMasquerMedicaments"); + // afficherMasquerMedicaments(); + + }, + complete: function () { + + } + }); + +} + +function ajax_maj_qte_prescrit_medicament(idMedicament, quantite, controle) { + + donnee_a_affciher = ""; + + quantite = quantite.replace(",", "."); + controle.value = quantite; + + if (controle_numerique(controle)) { + if (quantite == 0) { + controle.focus(); + v_msg = "Veuillez saisir la quantit\u00e9!"; + v_msgEng = "Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idMedicament=' + idMedicament + "&quantite=" + quantite; + + //alert(donnees); + //return; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsrenouvellement/majquantiteaccorde/", + type: 'POST', + data: donnees, + success: function (data) { + + }, + error: function (data) { + }, + complete: function () { + affiche_liste_phar_renouvellement_provisoire(); + } + }); + } +} + +function affiche_liste_phar_renouvellement_provisoire() +{ + $("#tab_liste").html('
' + '
'); + + donnees = ""; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsrenouvellement/traitementprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $("#tab_liste").html(data); + }, + complete: function () { + + } + }); + +} + +function ajax_maj_duree_triatement_renouvelleemnt_medicament(idMedicament, dureeTraitement, controle) { + + donnee_a_affciher = ""; + + dureeTraitement = dureeTraitement.replace(",", "."); + controle.value = dureeTraitement; + + if (controle_numerique(controle)) { + if (dureeTraitement == 0) { + controle.focus(); + v_msg = "Veuillez saisir la durée!"; + v_msgEng = "Please enter the duration!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idMedicament=' + idMedicament + "&dureeTraitement=" + dureeTraitement; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsrenouvellement/majdureetraitement/", + + type: 'POST', + data: donnees, + success: function (data) { + + }, + error: function (data) { + }, + complete: function () { + affiche_liste_phar_renouvellement_provisoire(); + } + }); + } +} + +function traitement_tous_ren_medic(codeReponseProvisoire) +{ + donnees = "codeReponseProvisoire=" + codeReponseProvisoire; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsrenouvellement/traitertousprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + // $('#div_test_gabarit').html(data); + affiche_liste_phar_renouvellement_provisoire(); + }, + complete: function () { + + } + }); + +} + +function traiter_un_provisoire_ren_medic(idMedicament, codeReponseProvisoire) +{ + donnees = "idMedicament=" + idMedicament + "&codeReponseProvisoire=" + codeReponseProvisoire; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsrenouvellement/traiterunprovisoire/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + affiche_liste_phar_renouvellement_provisoire(); + }, + complete: function () { + + } + }); + +} + +function valider_renouvellement_medicament() { + + observations = $("#observations").val(); + motifRefusAssure = $("#motifRefusAssure").val(); + + nombreRefus = $("#nombreRefus").val(); + nombreEnAttente = $("#nombreEnAttente").val(); + + if(nombreEnAttente>"0"){ + v_msg = "Veuillez traiter toutes les lignes!"; + v_msgEng = "Please process all lines!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + if (nombreRefus >"0" && motifRefusAssure <= " ") { + v_msg = "Veuillez saisir le motif pour les refus!"; + v_msgEng = "Please enter the reason for rejections!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifRefusAssure").focus(); + + return; + } + + v_msg = "Confirmez-vous cette validation?"; + v_msgEng = "Do you confirm this validation?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'observations=' + observations + '&motifRefusAssure=' + motifRefusAssure; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxlistemedicamentsrenouvellement/valider/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + $('#div_resultat_validation').html(data); + valider = $("#valider").val(); + + if(valider=="1"){ + v_msg = "Validation réussie!"; + v_msgEng = "Validation succeed!"; + alert_ebene(v_msg, v_msgEng); + + $("#btn-fermer-entente").click(); + }else{ + v_msg = "Echèc de la validation!"; + v_msgEng = "Validation failed!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + }, + complete: function () { + liste_renouvellement_medicament(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function afficherMasquerAntecedents() +{ + masquerAntecedents = $("#masquerAntecedents").val(); + + const element = document.getElementById("chevron-antecedents"); + + if(masquerAntecedents=="1"){ + $('#div_antecedents').hide(); + $("#masquerAntecedents").val("0"); + //$("#span_antecedents").text("Voir"); + + element.classList.remove("bi-chevron-up"); + element.classList.add("bi-chevron-down"); + + }else{ + $('#div_antecedents').show(); + $("#masquerAntecedents").val("1"); + //$("#span_antecedents").text("Masquer"); + + element.classList.remove("bi-chevron-down"); + element.classList.add("bi-chevron-up"); + + afficher_diagnostics_beneficiaire_entente(); + } + +} + + +function afficher_diagnostics_beneficiaire_entente() +{ + idBeneficiaire = $("#idBeneficiaire").val(); + + donnees = "idBeneficiaire=" + idBeneficiaire; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdiagnosticsbeneficiaireentente/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_dianostics").html(donnees_retour); + } + }); +} + +function afficher_liste_carteassure_adherent() +{ + donnees = ""; + donnees_retour = ""; + + idAdherent =$("#idAdherent").val(); + if(idAdherent<=' ') + { + v_msg="Veuillez sélectionner une famille!"; + v_msgEng="Please select a family!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#div_export_a").html(""); + + $("#div_liste_carte").html('
' + '
'); + + donnees = 'idAdherent='+idAdherent; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistecarteassure/indexadherent/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_liste_carte").html(donnees_retour); + appliquerDataTable(); + $("#nbligne").val("Lignes : "+$("#nbligne_info").val()); + } + }); +} + + +function afficher_liste_carteassure_commun() +{ + typeEdition =$("#typeEdition").val(); + + switch(typeEdition) { + case "garant": + afficher_liste_carteassure(); + break; + case "police": + afficher_liste_carteassure_police(); + break; + case "adherent": + afficher_liste_carteassure_adherent(); + break; + default: + afficher_liste_carteassure(); + } +} + +function imprimer_carte_assure() +{ + prestationPossible = $("#prestationPossible").val(); + + if (prestationPossible!="1") + { + v_msg="Pas encore couvert!"; + v_msgEng="Not covered yet!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb" ).val()+"Carteassuresadherent/"); +} + +function afficherMasquerSituation() +{ + masquerSituation = $("#masquerSituation").val(); + + const element = document.getElementById("chevron-situation"); + + if(masquerSituation=="1"){ + $('#div_situation').hide(); + $("#masquerSituation").val("0"); + + + element.classList.remove("bi-chevron-up"); + element.classList.add("bi-chevron-down"); + + }else{ + $('#div_situation').show(); + $("#masquerSituation").val("1"); + + + element.classList.remove("bi-chevron-down"); + element.classList.add("bi-chevron-up"); + + afficher_situation_beneficiaire(); + } + +} + +function afficherMasquerMedicaments() +{ + masquerMedicament = $("#masquerMedicament").val(); + + const element = document.getElementById("chevron-medicament"); + + if(masquerMedicament=="1"){ + $('#div_medicament').hide(); + $("#masquerMedicament").val("0"); + + element.classList.remove("bi-chevron-up"); + element.classList.add("bi-chevron-down"); + + }else{ + $('#div_medicament').show(); + $("#masquerMedicament").val("1"); + + element.classList.remove("bi-chevron-down"); + element.classList.add("bi-chevron-up"); + + afficher_ordonnance_beneficiaire(); + } +} + +function afficher_situation_beneficiaire() +{ + donnees_retour = ''; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsituationbeneficiaire/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_situation").html(donnees_retour); + } + }); +} + +function afficher_ordonnance_beneficiaire() +{ + numeroFeuilleMaladie = $("#numeroFeuilleMaladie").val(); + + donnees = "numeroFeuilleMaladie="+numeroFeuilleMaladie; + + donnees_retour = ''; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxordonnancebeneficiaire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_medicament").html(donnees_retour); + } + }); +} + +// Fonction globale pour tes notifications AJAX (Wahoo Effect) +function notification(type, message) { + const Toast = Swal.mixin({ + toast: true, + position: 'top-end', + showConfirmButton: false, + timer: 3000, + timerProgressBar: true, + didOpen: (toast) => { + toast.addEventListener('mouseenter', Swal.stopTimer) + toast.addEventListener('mouseleave', Swal.resumeTimer) + } + }); + + Toast.fire({ + icon: type, // 'success', 'error', 'warning', 'info' + title: message + }); +} + +function gerer_garant_defaut() +{ + codeGcAssureurDefaut=$("#codeGcAssureurDefaut").val(); + codeGcAssureur=$("#codeGcAssureur").val(); + + if(codeGcAssureurDefaut>" ") + { + $('#codeGcAssureur').val(codeGcAssureurDefaut).trigger('change'); + selectionTauxGarant(); + } +} + +function toggleSidebar() { + document.body.classList.toggle('sidebar-collapsed'); +} + +function init_revoquer_htagcarte(idHtagcarte) { + $("#idHtagcarte").val(idHtagcarte); + $("#div_revoquer_carte").modal({backdrop: 'static', keyboard: false, show: true }); + $("#div_revoquer_carte").modal("show"); +} + +function enregistrer_modif_parametres_prod() +{ + idSocieteuser = $("#idSocieteuser").val(); + donnees = 'idSocieteuser='+idSocieteuser; + + tauxHonoraires = $("#tauxHonoraires").val(); + spMax = $("#spMax").val(); + fraisCarteAN = $("#fraisCarteAN").val(); + donnees += '&tauxHonoraires='+tauxHonoraires+'&spMax='+spMax+'&fraisCarteAN='+fraisCarteAN; + + fraisCarteREN = $("#fraisCarteREN").val(); + fraisCarteImp = $("#fraisCarteImp").val(); + spAlertAdherent = $("#spAlertAdherent").val(); + donnees += '&fraisCarteREN='+fraisCarteREN+'&fraisCarteImp='+fraisCarteImp+'&spAlertAdherent='+spAlertAdherent; + + tauxRistourne = $("#tauxRistourne").val(); + seuilRistourne = $("#seuilRistourne").val(); + + archivageAutomatiquePrime = $("#archivageAutomatiquePrime").val(); + ecartEncaissementTolerable= $("#ecartEncaissementTolerable").val(); + + donnees += '&tauxRistourne='+tauxRistourne+'&seuilRistourne='+seuilRistourne; + donnees += '&archivageAutomatiquePrime='+archivageAutomatiquePrime; + donnees += '&ecartEncaissementTolerable='+ecartEncaissementTolerable; + + notificationSmsNumeroAssure = $("#notificationSmsNumeroAssure").val(); + notificationGroupeNumeroAssure = $("#notificationGroupeNumeroAssure").val(); + lettrageAutoGarant = $("#lettrageAutoGarant").val(); + + parametresFacturationGarantProduit = $("#parametresFacturationGarantProduit").val(); + + assureAjoutPhoto = $("#assureAjoutPhoto").val(); + + donnees += '¬ificationSmsNumeroAssure='+notificationSmsNumeroAssure; + donnees += '¬ificationGroupeNumeroAssure='+notificationGroupeNumeroAssure; + donnees += '&lettrageAutoGarant='+lettrageAutoGarant; + + donnees += '¶metresFacturationGarantProduit='+parametresFacturationGarantProduit; + donnees += '&assureAjoutPhoto='+assureAjoutPhoto; + + + 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é + $.ajax({ + url: $("#racineWeb").val()+"Ajaxparametresgeneraux/enregistrermodifprod/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + afficher_autres_parametresgeneraux(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); +} + +function enregistrer_modif_parametres_med() +{ + + idSocieteuser = $("#idSocieteuser").val(); + + envoismsactif = $("#s_envoismsactif").val(); + + smsAssure = $("#s_smsAssure").val(); + smsmParFacture = $("#s_smsmParFacture").val(); + + emailParFacture = $("#s_emailParFacture").val(); + copieSmsAssure = $("#s_copieSmsAssure").val(); + + seuilAlerteActif = $("#s_seuilAlerteActif").val(); + + montantTotalExamen = $("#s_montantTotalExamen").val(); + montantTotalMedicament = $("#s_montantTotalMedicament").val(); + + accorderMedecinSouscripteur = $("#s_accorderMedecinSouscripteur").val(); + delaisReponseMedecinSouscripteur = $("#s_delaisReponseMedecinSouscripteur").val(); + + tousActesSoumisOuinon = $("#s_tousActesSoumisOuinon").val(); + + envoismswhatsappactif = $("#s_envoismswhatsappactif").val(); + appliquerTarifBas = $("#s_appliquerTarifBas").val(); + nombreActeEntentePrealable = $("#s_nombreActeEntentePrealable").val(); + + donnees = 'idSocieteuser='+idSocieteuser; + donnees += '&envoismsactif='+envoismsactif; + donnees += '&smsAssure='+smsAssure+'&smsmParFacture='+smsmParFacture; + donnees += '&emailParFacture='+emailParFacture+'&copieSmsAssure='+copieSmsAssure; + donnees += '&seuilAlerteActif='+seuilAlerteActif; + donnees += '&montantTotalExamen='+montantTotalExamen; + donnees += '&montantTotalMedicament='+montantTotalMedicament; + + donnees += '&accorderMedecinSouscripteur='+accorderMedecinSouscripteur; + donnees += '&delaisReponseMedecinSouscripteur='+delaisReponseMedecinSouscripteur; + + donnees += '&tousActesSoumisOuinon='+tousActesSoumisOuinon; + + donnees += '&envoismswhatsappactif='+envoismswhatsappactif; + donnees += '&appliquerTarifBas='+appliquerTarifBas; + donnees += '&nombreActeEntentePrealable='+nombreActeEntentePrealable; + + 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é + $.ajax({ + url: $("#racineWeb").val()+"Ajaxparametresgeneraux/enregistrermodifmed/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + v_msg="Mise à jour effectuée avec succès!"; + v_msgEng="Update done successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + complete: function() + { + afficher_autres_parametresgeneraux(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +/** + * Initialise DataTables avec options d'export et de tri + * @param {string} selector - Sélecteur CSS de la table + * @param {string} pageTitle - Titre pour les exports PDF/Excel + * @param {boolean|array} defaultOrder - Exemple: [1, 'desc'] ou false pour garder l'ordre serveur + */ +function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Données', defaultOrder = false) { + if ($(selector).length === 0) return; + + var hasGlobalSearch = $('#globalSearch').length > 0; + + if ($.fn.DataTable.isDataTable(selector)) { + $(selector).DataTable().destroy(); + } + + // Modification du DOM : + // On enveloppe 'f' (Filter) dans une div avec 'ms-auto' pour le pousser à droite + var domStructure = hasGlobalSearch + ? '<"d-flex align-items-center justify-content-start p-3 border-bottom"B>t<"d-flex justify-content-between align-items-center p-3 bg-light"ip>' + : '<"d-flex align-items-center p-3 border-bottom"B<"ms-auto"f>>t<"d-flex justify-content-between align-items-center p-3 bg-light"ip>'; + + var orderConfig = (defaultOrder === false) ? [] : defaultOrder; + + var table = $(selector).DataTable({ + "dom": domStructure, + "order": orderConfig, + "buttons": [ + { + extend: 'excelHtml5', + text: 'Excel', + className: 'btn btn-success btn-sm fw-bold border-0 shadow-sm px-3', + title: pageTitle, // Identique au PDF + exportOptions: { + columns: ':not(.no-export)' // Exclut les colonnes avec la classe .no-export + } + }, + { + extend: 'pdfHtml5', + text: 'PDF', + className: 'btn btn-danger btn-sm fw-bold border-0 shadow-sm px-3 ms-2', + title: pageTitle, + orientation: 'landscape', + pageSize: 'A4', + exportOptions: { + columns: ':not(.no-export)' // Exclut les colonnes avec la classe .no-export + } + } + ], + "language": { + "url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json", + "search": "", // On vide le texte "Rechercher :" pour un look plus moderne + "searchPlaceholder": "Rechercher..." + }, + "pageLength": 10, + "autoWidth": false, + "drawCallback": function() { + if (!hasGlobalSearch) { + // Style de l'input de recherche + $('.dataTables_filter input') + .addClass('form-control form-control-sm shadow-none border-primary-subtle') + .css({ + 'width': '250px', + 'border-radius': '20px', + 'padding-left': '15px' + }); + } + $('.dataTables_paginate .paginate_button').addClass('btn btn-xs mx-1'); + } + }); + + if (hasGlobalSearch) { + $('#globalSearch').off('keyup').on('keyup', function() { + table.search(this.value).draw(); + }); + } + + return table; +} + + +function loadMessageSection(section) { + let url = ""; + let target = "#content-" + section; + let donnees = ""; + + // Détermination de l'ID du tableau et du titre pour l'export + let tableId = (section === 'Motifs') ? '#tableMotifs' : '#tableTextes'; + let pageTitle = (section === 'Motifs') ? 'Liste des Motifs de Dépassement' : 'Liste des Textes de Facturation'; + + if (section === 'Motifs') url = $("#racineWeb").val() + "Ajaxmotifdepassement/"; + if (section === 'Facturation') url = $("#racineWeb").val() + "Ajaxtextefacturationgarant/"; + + // Si déjà chargé, on ajuste simplement les colonnes pour le rendu visuel + if ($(target).find('table').length > 0) { + if ($.fn.DataTable.isDataTable(tableId)) { + $(tableId).DataTable().columns.adjust(); + } + return; + } + + $.ajax({ + url: url, + type: 'post', + data: donnees, + success: function(data) { + // 1. Injection du contenu HTML + $(target).html(data); + + // 2. Initialisation forcée avec un léger délai pour laisser le DOM respirer + setTimeout(function() { + initSmartTable(tableId, pageTitle, false); + }, 150); + }, + error: function() { + $(target).html('
Erreur de chargement
'); + } + }); +} + +/** + * Initialise, rafraîchit et ouvre le SelectPicker + * @param {string} selector - Le sélecteur du select + * @param {boolean} donnerFocus - Si true, donne le focus et ouvre le menu + */ +function actualiserSelectPicker(selector, donnerFocus = false) { + $(selector).each(function() { + const $el = $(this); + const lang = $("#codeLangue").val(); + const txtDefault = (lang === 'en_US') ? "-- Select --" : "-- Sélectionner --"; + + // 1. Nettoyage anti-doublon (Destruction complète) + if ($el.data('selectpicker')) { + $el.selectpicker('destroy'); + } + $el.siblings('.bootstrap-select').remove(); + $el.removeAttr('title').prop('title', ''); + + // 2. Initialisation Neutral Pro + $el.selectpicker({ + liveSearch: true, + container: 'body', + style: 'btn-white border-2 border-start-0 fw-bold', + width: '100%', + size: 8, + noneSelectedText: txtDefault, + noneResultsText: (lang === 'en_US') ? "No results" : "Aucun résultat", + liveSearchPlaceholder: (lang === 'en_US') ? "Search..." : "Rechercher..." + }); + + // 3. Focus et Ouverture automatique + if (donnerFocus) { + setTimeout(() => { + // Donne le focus au composant + $el.selectpicker('focus'); + // Ouvre le menu déroulant immédiatement + $el.selectpicker('toggle'); + }, 150); // Délai légèrement augmenté pour garantir l'ouverture + } + }); +} + +function changerAnneeFiltre(valeur) { + // 1. On peut forcer le stockage en session via un petit appel rapide si nécessaire + // ou simplement s'assurer que afficheDonneesTableChoisie utilise bien cette valeur. + console.log("Filtrage pour l'année : " + valeur); + + // Appel de votre fonction moteur + // Astuce : vérifiez que dans votre contrôleur PHP, vous récupérez bien $_POST['annee'] + afficheDonneesTableChoisie('Ajaxtblisterjoursferiers'); +} + +/** + * Initialise une DataTable standard pour les tables de référence + * @param {string} selector - L'ID ou la classe de la table (ex: '#tableLister') + * @param {string} exportTitle - Le nom du fichier lors de l'export + * @param {boolean|array} defaultOrder - Exemple: [1, 'desc'] ou false pour garder l'ordre serveur + */ +function initDataTableReference(selector, exportTitle = 'Export_Donnees', defaultOrder = false) { + const codeLangue = $("#codeLangue").val(); + + // Objet de traduction interne + const langConfig = (codeLangue === "en_US") ? { + search: "Search:", + lengthMenu: "Show _MENU_ entries", + info: "Showing _START_ to _END_ of _TOTAL_ entries", + infoEmpty: "Showing 0 to 0 of 0 entries", + infoFiltered: "(filtered from _MAX_ total entries)", + zeroRecords: "No matching records found", + paginate: { next: "Next", previous: "Previous" } + } : { + search: "Recherche :", + lengthMenu: "Afficher _MENU_ lignes", + info: "Affichage de _START_ à _END_ sur _TOTAL_ lignes", + infoEmpty: "Affichage de 0 à 0 sur 0 ligne", + infoFiltered: "(filtré de _MAX_ lignes au total)", + zeroRecords: "Aucune donnée trouvée", + paginate: { next: "Suivant", previous: "Précédent" } + }; + + if ($.fn.DataTable.isDataTable(selector)) { + $(selector).DataTable().destroy(); + } + + // Gestion du tri par défaut (false = pas de tri forcé) + const orderConfig = (defaultOrder === false) ? [] : defaultOrder; + + const table = $(selector).DataTable({ + dom: 'frtip', + responsive: true, + pageLength: 10, + order: orderConfig, // <-- Application de la configuration de tri + language: langConfig, + buttons: [ + { + extend: 'excelHtml5', + text: ' Excel', + className: 'btn btn-sm btn-success-light border-success fw-bold text-success rounded-pill shadow-xs', + title: exportTitle, + exportOptions: { columns: ':not(:last-child)' } + }, + { + extend: 'pdfHtml5', + text: ' PDF', + className: 'btn btn-sm btn-danger-light border-danger fw-bold text-danger rounded-pill shadow-xs', + title: exportTitle, + exportOptions: { columns: ':not(:last-child)' }, + customize: function (doc) { + doc.styles.tableHeader.fillColor = '#212e53'; + doc.styles.tableHeader.color = 'white'; + doc.content[1].table.widths = Array(doc.content[1].table.body[0].length + 1).join('*').split(''); + } + } + ], + drawCallback: function() { + const info = this.api().page.info(); + const label = (codeLangue === "en_US") ? " Lines" : " Lignes"; + $("#badge-total").text(info.recordsTotal + label); + } + }); + + table.buttons().container().appendTo('#table-buttons'); + return table; +} + +function ajouter_utilisateur_gc() +{ + window.location.assign($("#racineWeb" ).val()+"Creerusergc/"); +} + +function nouveau_produit() +{ + window.location.assign($("#racineWeb" ).val()+"Nouveauproduit/"); +} + +function actualiser_garantie_produit() { + // 1. Définition des constantes et cibles + const codeGcAssureur = $("#codeGcAssureur").val(); + const codeProduit = $("#codeProduit").val(); + const div_cible = $('#div_garantieproduit'); + const racineWeb = $("#racineWeb").val(); + const codeLangue = $("#codeLangue").val(); + + // 2. Validation du Garant via alert_ebene + if (!codeGcAssureur || codeGcAssureur.trim() === "") { + let v_msg = "Garant manquant ! Veuillez sélectionner un garant pour continuer."; + let v_msg_eng = "Guarantor missing ! Please select a guarantor to continue."; + + alert_ebene(v_msg, v_msg_eng); + + $("#codeGcAssureur").focus(); + div_cible.html(""); + return; + } + + // 3. Validation du Produit via alert_ebene + if (!codeProduit || codeProduit.trim() === "") { + let v_msg = "Produit manquant ! Veuillez sélectionner un produit."; + let v_msg_eng = "Product missing ! Please select a product."; + + alert_ebene(v_msg, v_msg_eng); + + div_cible.html(""); + return; + } + + // 4. Préparation et affichage du loader bilingue + const donnees = { codeProduit: codeProduit }; + let loadingTxt = (codeLangue === "en_US") ? "Loading the entry form..." : "Chargement du formulaire de saisie..."; + + div_cible.html(` +
+
+ Loading... +
+
${loadingTxt}
+
+ `); + + // 5. Exécution de la requête AJAX + $.ajax({ + url: racineWeb + "Ajaxparamseuilalerte/actualisegarantieproduit/", + type: 'post', + data: donnees, + success: function(data) { + div_cible.html(data); + }, + error: function() { + let errorTxt = (codeLangue === "en_US") ? "Technical error while retrieving the form." : "Erreur technique lors de la récupération du formulaire."; + div_cible.html(` + + `); + } + }); +} + +let timerDispo, timerAffect; +/** + * Recherche Serveur Multi-critères + * @param {string} target - 'dispo' ou 'affect' + */ +function rechercheServeur(target) { + // 1. Récupération des critères selon la colonne + let nom = $("#search_nom_" + target).val(); + let ville = $("#search_ville_" + target).val(); + let type = $("#search_type_" + target).val(); + let query = (nom + " " + ville + " " + type).trim(); + + // 2. Sécurité : On ne lance rien si c'est trop court (sauf si vide pour réinitialiser) + if (query.length > 0 && query.length < 3) return; + + // 3. Gestion du Timer (Debounce) + let timer = (target === 'dispo') ? timerDispo : timerAffect; + clearTimeout(timer); + + let currentTimer = setTimeout(function() { + let action = (target === 'dispo') ? 'rechercherdispos' : 'rechercheraffectes'; + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxprestatairesreseau/" + action + "/", + type: 'post', + data: { query: query }, + beforeSend: function() { + $("#count_" + target).html(''); + }, + success: function(data) { + // On remplace le corps du tableau + $("#tab_" + target + " tbody").html(data); + + // Mise à jour du compteur de lignes + let nbre = $("#tab_" + target + " tbody tr").length; + $("#count_" + target).text(nbre); + } + }); + }, 400); + + // Mise à jour de la référence du timer + if (target === 'dispo') timerDispo = currentTimer; + else timerAffect = currentTimer; +} + +// On initialise le tableau global s'il n'existe pas +if (typeof tab === 'undefined') { + var tab = { "libelle": "BAREME", "client": "", "taux": "", "territoire": "", "produit": "" }; +} + +function filtresouscripteur() { + const codeGcAssureur = $('#codeGcAssureur').val(); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxfiltresouscripteur/", + type: 'post', + data: { codeGcAssureur: codeGcAssureur }, + success: function(data) { + // Injection du HTML + $('#div_souscripteur').html(data); + + // Réactivation Neutral Pro + actualiserSelectPicker('#numeroClient'); + + // On vide la valeur dans le tableau et on rafraîchit le libellé + tab["client"] = ""; + libelleBareme(); + } + }); +} + +function filtreproduitcreerbareme() { + const codeGcAssureur = $('#codeGcAssureur').val(); + + if (codeGcAssureur !== "") { + $.ajax({ + url: $("#racineWeb").val() + "Ajaxfiltreproduit/creerbareme/", + type: 'post', + data: { codeGcAssureur: codeGcAssureur }, + success: function(data) { + $('#div_produit').html(data); + + // Réactivation Neutral Pro + actualiserSelectPicker('#codeProduit'); + + tab["produit"] = ""; + libelleBareme(); + } + }); + } +} + +// Version sécurisée de la construction du libellé +function libelleBareme() { + // On nettoie les undefined pour éviter d'afficher "undefined" dans l'input + const parts = [ + tab["libelle"] || "BAREME", + tab["client"] || "", + tab["taux"] || "", + tab["territoire"] || "", + (tab["produit"] ? "- " + tab["produit"] : "") + ]; + + // On joint les éléments avec un espace et on nettoie les doubles espaces + const finalLibelle = parts.filter(p => p !== "").join(' ').replace(/\s\s+/g, ' '); + $('#libelle').val(finalLibelle.trim().toUpperCase()); +} + +function libelleClientBareme(controle) { + // Si l'option vide est choisie, on ne met rien + tab["client"] = (controle.value === "") ? "" : $(controle).find('option:selected').text(); + libelleBareme(); +} + +function libelleProduitBareme(controle) { + tab["produit"] = (controle.value === "") ? "" : $(controle).find('option:selected').text(); + libelleBareme(); +} + +function libelleTauxBareme(controle) { + tab["taux"] = $(controle).find('option:selected').text(); + libelleBareme(); +} + +function libelleTerritoireBareme(codeTerritoire) { + // On peut mapper le code à un nom si besoin, ou utiliser le code directement + tab["territoire"] = codeTerritoire; + libelleBareme(); +} + +function retour_bereme_initial() +{ + idBaremePriseEnCharge=$("#idBaremePriseEnCharge").val(); + + if (idBaremePriseEnCharge>"0") + { + detail_baremepriseencharge(idBaremePriseEnCharge); + } +} + +/** + * Contrôle la validité chronologique de la date d'effet pour une Lettre Clé + */ +function validiteDateEffetBaremeLettreCle() { + // 1. Collecte des informations + const racineWeb = $("#racineWeb").val(); + const dateEffetSaisieStr = $("#dateEffetActe").val(); + const dateJourSystemeStr = $("#datejour_C").val(); // Format YYYY-MM-DD + + const donneesControle = { + idBaremePriseEnCharge: $("#idBaremePriseEnCharge").val(), + lettreCle: $("#lettreCle").val() + }; + + // Validation immédiate : Lettre clé obligatoire + if (!donneesControle.lettreCle || donneesControle.lettreCle.trim() === "") { + alert_ebene("Veuillez sélectionner une lettre clé !", "Please select a key letter !"); + return; + } + + // Validation immédiate : Date obligatoire + if (!dateEffetSaisieStr || dateEffetSaisieStr.trim() === "") { + alert_ebene("Veuillez entrer une date d'effet !", "Please enter an effective date !"); + $("#dateEffetActe").focus(); + return; + } + + // 2. Préparation des objets Date + const parts = dateEffetSaisieStr.split('/'); + const dateEffetSaisie = new Date(parts[2], parts[1] - 1, parts[0]); + const dateJourSysteme = new Date(dateJourSystemeStr); + + // 3. Appel AJAX de contrôle + $.ajax({ + url: racineWeb + "Ajaxbaremelettrecle/controle/", + type: 'post', + data: donneesControle, + success: function(data) { + // Injection du champ hidden maxDateEffetActeBareme retourné par le serveur + $('#div_maxdateeffetactebareme').html(data); + + const maxDateBaseStr = $("#maxDateEffetActeBareme").val(); + + // Calcul des timestamps en jours (pour une comparaison fiable) + const dte = Math.round(dateEffetSaisie.getTime() / (1000 * 3600 * 24)); + const dtj = Math.round(dateJourSysteme.getTime() / (1000 * 3600 * 24)); + + // 4. Logique de validation chronologique + if (dte < dtj && maxDateBaseStr) { + const maxDateBase = new Date(maxDateBaseStr); + const dtm = Math.round(maxDateBase.getTime() / (1000 * 3600 * 24)); + + if (dte < dtm) { + // Date invalide car antérieure à la dernière modification connue + alert_ebene( + "Date d'effet invalide ! Elle ne peut être antérieure à la dernière mise à jour de cette lettre clé.", + "Invalid effective date ! It cannot be earlier than the last update of this key letter." + ); + $("#dateEffetActe").val('').focus(); + return; + } + } + + // 5. Validation réussie : Passage à l'insertion + if (typeof inserer_bareme_lettre_cle === 'function') { + inserer_bareme_lettre_cle(); + } + }, + error: function() { + alert_ebene("Erreur lors de la vérification de la date.", "Error during date verification."); + } + }); +} + +/** + * Insère une nouvelle ligne de barème pour une lettre clé après confirmation + */ +function inserer_bareme_lettre_cle() { + // 1. Récupération des éléments d'environnement + const racineWeb = $("#racineWeb").val(); + const codeLangue = $("#codeLangue").val(); + const $conteneurDetail = $("#div_detail_bareme"); + + // 2. Collecte et nettoyage des données + const donnees = { + idBaremePriseEnCharge: $("#idBaremePriseEnCharge").val(), + lettreCle: $("#lettreCle").val(), + dateEffetActe: $("#dateEffetActe").val(), + forfaitPlafondActe: $("#forfaitPlafondActe").val().replace(/\s/g, ""), // Supprime tous les types d'espaces + ticketModerateurActe: $("#ticketModerateurActe").val() + }; + + // 3. Validations de saisie + if (!donnees.lettreCle || donnees.lettreCle.trim() === "") { + alert_ebene("Veuillez entrer une lettre clé !", "Please enter a key letter !"); + $("#lettreCle").focus(); + return; + } + + if (!donnees.dateEffetActe || donnees.dateEffetActe.trim() === "") { + alert_ebene("Veuillez entrer une date d'effet !", "Please enter an effective date !"); + $("#dateEffetActe").focus(); + return; + } + + // Validation du montant (doit être supérieur à 0) + if (parseFloat(donnees.forfaitPlafondActe) <= 0 || donnees.forfaitPlafondActe === "") { + alert_ebene("Veuillez entrer un montant valide !", "Please enter a valid amount !"); + $("#forfaitPlafondActe").focus(); + return; + } + + // 4. Processus de confirmation et envoi + confirm_ebene("Confirmez-vous cette opération ?", "Do you confirm this transaction ?") + .then((isConfirmed) => { + if (isConfirmed) { + // Affichage du loader (SaaS UX) + const loadingTxt = (codeLangue === "en_US") ? "Processing..." : "Traitement en cours..."; + $conteneurDetail.html(` +
+
+
${loadingTxt}
+
+ `); + + // Appel AJAX + $.ajax({ + url: racineWeb + "Ajaxbaremelettrecle/ajouter/", + type: 'post', + data: donnees, // Envoi sous forme d'objet (plus propre) + success: function(response) { + // Actualisation de l'historique (table de détail) + if (typeof actualiser_bareme_acte_lettre_cle === 'function') { + actualiser_bareme_acte_lettre_cle(); + } + }, + error: function() { + alert_ebene("Erreur lors de l'enregistrement.", "Error during saving."); + } + }); + } + }); +} + +/** + * Actualise l'historique des barèmes par lettres clés + */ +function actualiser_bareme_acte_lettre_cle() { + // 1. Initialisation des variables d'environnement + const racineWeb = $("#racineWeb").val(); + const codeLangue = $("#codeLangue").val(); + const $conteneur = $('#div_detail_bareme'); + + const donnees = { + idBaremePriseEnCharge: $("#idBaremePriseEnCharge").val() + }; + + // 2. Feedback visuel de mise à jour (SaaS UX) + // On affiche un spinner discret pour indiquer le rafraîchissement + const refreshMsg = (codeLangue === "en_US") ? "Updating history..." : "Mise à jour de l'historique..."; + + $conteneur.html(` +
+
+ ${refreshMsg} +
+ `); + + // 3. Appel AJAX + $.ajax({ + url: racineWeb + "Ajaxbaremelettrecle/", + type: 'post', + data: donnees, + success: function(data) { + // Injection du nouveau contenu avec une transition fluide + $conteneur.hide().html(data).fadeIn(200); + }, + error: function(xhr, status, error) { + $conteneur.html(` +
+ + ${(codeLangue === "en_US") ? "Error refreshing data." : "Erreur lors du rafraîchissement des données."} +
+ `); + } + }); +} + +/** + * Récupère et affiche le détail des actes liés à une lettre clé dans une modale + * @param {number} idActesbaremeinitiallettrecle + * @param {string} lettreCle + */ +async function detail_baremeacte_lettre_cle(idInitial, lettre) { + // 1. On charge le contenu (qui va injecter le HTML dans la div) + // On attend que le HTML soit injecté avant de demander à Bootstrap d'afficher la modale + await chargerContenuDetailActe(idInitial, lettre); + + // 2. Une fois le contenu chargé, on ouvre la modale + // On utilise le sélecteur jQuery standard pour éviter "Illegal invocation" + $("#div_detail_bareme_actes").modal("show"); +} + +/** + * Charge ou actualise uniquement le contenu interne de la modale de détail + * sans manipuler l'état d'ouverture de la modale Bootstrap. + * * @param {number|string} idInitial - ID du barème initial (idActesbaremeinitiallettrecle) + * @param {string} lettre - La lettre clé concernée (ex: 'K', 'B', 'V') + */ +async function chargerContenuDetailActe(idInitial, lettre, mode = 'complet') { + const racineWeb = document.getElementById("racineWeb").value; + const url = `${racineWeb}Ajaxbaremelettrecle/detailactes/`; + + const formData = new FormData(); + formData.append("idActesbaremeinitiallettrecle", idInitial); + formData.append("lettreCle", lettre); + + try { + const response = await fetch(url, { method: "POST", body: formData }); + const html = await response.text(); + + if (mode === 'complet') { + document.getElementById("div_detail_bareme_actes").innerHTML = html; + } else { + // MODE REFRESH : On remplace uniquement le contenu du tableau + const parser = new DOMParser(); + const doc = parser.parseFromString(html, 'text/html'); + const nouveauContenu = doc.getElementById('div_table_detail_lettrecle'); + const zoneCible = document.getElementById('div_table_detail_lettrecle'); + + if (nouveauContenu && zoneCible) { + // On écrase le contenu actuel par le nouveau + zoneCible.innerHTML = nouveauContenu.innerHTML; + console.log("Zone cible actualisée."); + } else { + console.error("Erreur : Zone cible div_table_detail_lettrecle non trouvée."); + } + } + + // On recrée DataTable après l'injection + initDataTableDetail(); + + } catch (error) { + console.error("Erreur Fetch :", error); + } +} + +// Petite fonction pour éviter de dupliquer le code DataTable +function initDataTableDetail() { + const codeLangue = document.getElementById("codeLangue")?.value || 'fr_FR'; + + if ($.fn.DataTable.isDataTable('#table_detail_actes')) { + $('#table_detail_actes').DataTable().destroy(); + } + + $('#table_detail_actes').DataTable({ + "language": { + "url": codeLangue === "en_US" + ? "//cdn.datatables.net/plug-ins/1.13.6/i18n/en-GB.json" + : "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json" + }, + "pageLength": 10, + "responsive": true, + /* Explication du DOM : + - <'row' ... > : On crée une ligne Bootstrap + - <'col-md-6'l> : La colonne de gauche (50%) pour le 'l' (Length / Sélecteur de nombre de lignes) + - <'col-md-6 text-end'f> : La colonne de droite (50%) avec 'text-end' pour le 'f' (Filter / Recherche) + */ + "dom": "<'row mb-2'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6 text-end'f>>" + + "<'row'<'col-sm-12'tr>>" + + "<'row mt-3'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7 text-end'p>>" + }); +} + +/** + * Supprime un acte spécifique du détail d'une lettre clé + * @param {string} adminProd - Niveau d'autorisation + * @param {number} idActe - ID de la ligne à supprimer + */ +function supprimer_baremeacte_lettre_cle_detail(adminProd, idActe) { + if (String(adminProd) !== "1") { + alert_ebene("Vous n'êtes pas autorisé !", "You are not authorized!"); + return; + } + + confirm_ebene("Confirmez-vous cette suppression ?", "Do you confirm this deletion ?") + .then((isConfirmed) => { + if (isConfirmed) { + $.ajax({ + url: $("#racineWeb").val() + "Ajaxbaremelettrecle/supprimerdetailacte/", + type: 'post', + data: { idActe: idActe }, + // On s'assure que le succès du serveur déclenche l'actualisation + success: function(response) { + console.log("Suppression réussie côté serveur."); + + // 1. Récupération des IDs dans la modale + const idInitial = $("#idInitial_hidden").val(); + const lettre = $("#lettre_hidden").val(); + + // 2. Lancement du rafraîchissement CHIRURGICAL + // On ajoute un petit délai de sécurité pour laisser le temps à la DB + setTimeout(() => { + chargerContenuDetailActe(idInitial, lettre, 'refresh'); + }, 100); + }, + error: function() { + alert_ebene("Erreur lors de la suppression.", "Error during deletion."); + } + }); + } + }); +} + +/** + * Supprime une ligne de barème (historique principal) + * @param {string} adminProd - Niveau d'autorisation + * @param {number} idActe - ID de la ligne à supprimer + */ +function supprimer_baremeacte_lettre_cle(adminProd, idActe) { + // 1. Contrôle de sécurité strict + if (String(adminProd) !== "1") { + alert_ebene("Vous n'êtes pas autorisé !", "You are not authorized!"); + return; + } + + // 2. Demande de confirmation + confirm_ebene("Confirmez-vous cette suppression ?", "Do you confirm this deletion ?") + .then((isConfirmed) => { + if (isConfirmed) { + + // 3. Appel AJAX + $.ajax({ + url: $("#racineWeb").val() + "Ajaxbaremelettrecle/supprimer/", + type: 'post', + data: { idActe: idActe }, // Envoi sous forme d'objet pour plus de sécurité + success: function(response) { + // Optionnel : Vous pouvez ajouter un petit toast de succès ici + console.log("Suppression effectuée : ID " + idActe); + }, + error: function() { + alert_ebene("Erreur lors de la suppression.", "Error during deletion."); + }, + complete: function() { + // 4. Actualisation de la table principale + // On utilise un petit timeout pour laisser la base de données finaliser l'opération + setTimeout(() => { + actualiser_bareme_acte_lettre_cle(); + }, 100); + } + }); + } else { + console.log("Suppression annulée par l'utilisateur."); + } + }); +} \ No newline at end of file