diff --git a/Js/fonctions.js b/Js/fonctions.js index 7c4a3a22..d1b7117c 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -5404,3 +5404,5676 @@ function maj_prime_additionnelle(idGarantie, primeOption, controle) function enregistrer_college_temp() { + idCollegeTemp = $('#idCollegeTemp').val(); + codeProduit = $('#codeProduit').val(); + codeCollegeType = $('#codeCollegeType').val(); + codeReseau = $('#codeReseau').val(); + codeTypeRemboursement = $('#codeTypeRemboursement').val(); + codeTerritoire = $('#codeTerritoire').val(); + codeLienParente = $('#codeLienParente').val(); + libelleCollege = $('#libelleCollege').val(); + ticketModerateurCollege = $('#ticketModerateurCollege').val(); + + delaiCarenceCollege = $('#delaiCarenceCollege').val(); + plafondCollege = parseInt($('#plafondCollege').val().replace(/ /g,""),10); + + plafondAdherent = parseInt($('#plafondAdherent').val().replace(/ /g,""),10); + + idPolice = $('#idPolice').val(); + numeroPolice = $('#numeroPolice').val(); + accessoireManuel = parseInt($('#accessoireManuel').val().replace(/ /g,""),10); + rachatTm = $('#rachatTm').val(); + tauxRachatTm = $('#tauxRachatTm').val(); + tauxPrimeRachatTm = $('#tauxPrimeRachatTm').val(); + budgetDefini = "0"; + montantBudget = "0"; + nbAdherent = $('#nbAdherent').val(); + nbAyantdroit = $('#nbAyantdroit').val(); + codeTypeTarifActe = $('#codeTypeTarifActe').val(); + codeTarifActe = $('#codeTarifActe').val(); + codeGcAssureur = $('#codeGcAssureur').val(); + + codeGcAssureur = $('#codeGcAssureur').val(); + idBaremePriseEnCharge = $('#idBaremePriseEnCharge').val(); + + codeBaseTarification = $('#codeBaseTarification').val(); + + seuilRdCollege = $('#seuilRdCollege').val(); + + forfaitHonoraire = 0; //parseInt($('#forfaitHonoraire').val().replace(/ /g,""),10); + forfaitAppelFond = 0; //parseInt($('#forfaitAppelFond').val().replace(/ /g,""),10); + forfaitAppelCotisation = 0; // parseInt($('#forfaitAppelCotisation').val().replace(/ /g,""),10); + + ticketModerateurHorsReseau = $('#ticketModerateurHorsReseau').val(); + ageLimiteEnfantEleve = $('#ageLimiteEnfantEleve').val(); + + donnees = 'id='+idCollegeTemp+'&codeProduit='+codeProduit+'&codeCollegeType='+codeCollegeType+'&codeReseau='+codeReseau; + donnees += '&codeTypeRemboursement='+codeTypeRemboursement+'&codeTerritoire='+codeTerritoire+'&codeLienParente='+codeLienParente; + donnees += '&libelleCollege='+libelleCollege+'&ticketModerateurCollege='+ticketModerateurCollege+'&delaiCarenceCollege='+delaiCarenceCollege; + donnees += '&plafondCollege='+plafondCollege+'&idPolice='+idPolice+'&numeroPolice='+numeroPolice+'&accessoireManuel='+accessoireManuel; + donnees += '&rachatTm='+rachatTm+'&tauxRachatTm='+tauxRachatTm+'&tauxPrimeRachatTm='+tauxPrimeRachatTm+'&budgetDefini='+budgetDefini; + donnees += '&montantBudget='+montantBudget+'&nbAdherent='+nbAdherent+'&nbAyantdroit='+nbAyantdroit+'&codeTypeTarifActe='+codeTypeTarifActe; + donnees += '&codeTarifActe='+codeTarifActe+'&codeGcAssureur='+codeGcAssureur+'&idBaremePriseEnCharge='+idBaremePriseEnCharge; + donnees += '&codeBaseTarification='+codeBaseTarification+'&seuilRdCollege='+seuilRdCollege+'&plafondAdherent='+plafondAdherent; + + //donnees += '&forfaitHonoraire='+forfaitHonoraire+'&forfaitAppelFond='+forfaitAppelFond+'&forfaitAppelCotisation='+forfaitAppelCotisation; + donnees += '&forfaitHonoraire='+forfaitHonoraire+'&forfaitAppelFond='+forfaitAppelFond+'&forfaitAppelCotisation='+forfaitAppelCotisation; + donnees += '&ticketModerateurHorsReseau='+ticketModerateurHorsReseau+'&ageLimiteEnfantEleve='+ageLimiteEnfantEleve; + + fraisCarte = $("#fraisCarte").val(); + fraisCarte = fraisCarte.replace(/ /g,""); + + fraisCarteRen = $("#fraisCarteRen").val(); + fraisCarteRen = fraisCarteRen.replace(/ /g,""); + + donnees +='&fraisCarte='+fraisCarte+'&fraisCarteRen='+fraisCarteRen; + + console.log(donnees); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollege/enregistrercollegelienparentetemp/", + type: 'POST', + data: donnees, + success: function(data) + { + /* + alert(data); + $('#div_test_gabarit').html(data); + */ + }, + complete: function(data) + { + } + }); +} + +function recapituler_limite_additionnelle() +{ + var div_primes = $('#div_primes'); + + $.ajax({ + url: $("#racineWeb").val()+"Recaplimiteadd/", + type: 'POST', + success: function(data) { + div_primes.html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function recapituler_limite_college() +{ + var div_recap = $('#div_recap'); + + $.ajax({ + url: $("#racineWeb").val()+"Recaplimitecollege/", + type: 'POST', + success: function(data) { + div_recap.html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + + +function changer_limite() +{ + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="SU") + { + v_msg="Attention! Police suspendue!"; + v_msgEng="Warning! Suspended policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + etatadh=$("#codeEtatAdherent_C").val(); + + if (etatadh != "V") + { + v_msg="Attention! cette famille n\'est pas en vigueur!"; + v_msgEng="Warning! this family is not in force!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + rapport_sp_police=$("#rapport_sp_police").val(); + if(rapport_sp_police>"0.70") + { + v_msg="Attention! S/P > 70%"; + v_msgEng="Warbing! Loss Ratio > 70%"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlimiteaddadherent/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Changerlimite/"); + } + }); +} + +function maj_limite_add_adherent(idGarantie, plafond, controle) +{ + if(controle_numerique(controle)) + { + donnees = 'idGarantie='+idGarantie+"&plafond="+plafond; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgarantiescollegeadherent/majplafondadherent/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_garanties").html(data); + }, + error: function(data) { + }, + complete: function() { + controle.focus(); + } + }); + } +} + +function enregistrer_changement_limite() +{ + $("#btn_enreg").click(); +} + +function pop_afficher_selection_limite(p_id_college_temp) +{ + var div_selection_assure = $('#div_selection_assure'); + $("#btn_pop").click(); + + donnees = 'id_college_temp='+p_id_college_temp; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionlimite/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + div_selection_assure.html(data); + }, + complete: function() { + // $("#btn_pop").click(); + } + }); +} + +function selection_famille_limite(p_choix,p_idBeneficiaire) +{ + donnees = 'idBeneficiaire='+p_idBeneficiaire; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionlimite/selectionner/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + recapituler_limite_college_simple(); + } + }); +} + + +function recapituler_limite_college_simple() +{ + $.ajax({ + url: $("#racineWeb").val()+"Recaplimitecollege/recapituler/", + type: 'POST', + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + recapituler_limite_additionnelle(); + } + }); +} + +function selectionner_tout_limite(p_idCollegeTemp, p_choix) +{ + donnees = 'idCollegeTemp='+p_idCollegeTemp; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectionlimite/selectionnertout/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + recapituler_limite_college_simple(); + pop_afficher_selection_limite(p_idCollegeTemp); + } + }); +} + +function gestionbon() +{ + adminBon = $("#adminBon").val(); + + if (adminBon!="1") + { + v_msg="Accès refusé!"; + v_msgEng="Access denied!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb").val()+"Gestionbons/"); +} + +function getDenierNumeroBon() +{ + $("#msgErreur").html(""); + $("#div_wait").html(""); + + codeTypeBon=$("#codeTypeBon").val(); + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#msgErreur").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderniernumerobon/", + type : 'post', + data: "codeTypeBon="+codeTypeBon, + error: function(errorData) { + }, + success: function(data) { + $("#infodernierbon").html(data); + $("#msgErreur").html(""); + }, + complete: function() { + denierNumeroBon = $("#denierNumeroBon_info").val(); + denierNumeroBon = parseInt(denierNumeroBon); + $("#denierNumeroBon").val(denierNumeroBon); + $("#noDepart").val(denierNumeroBon+1); + $("#noFin").val(denierNumeroBon+50); + } + }); +} + +function genererbon() +{ + codePrestataire=$("#codePrestataire").val(); + codeTypeBon=$("#codeTypeBon").val(); + receptionnaire=$("#receptionnaire").val(); + + noDepart=$("#noDepart").val(); + noFin=$("#noFin").val(); + + if (noDepart=="") + { + noDepart="0"; + } + + if (noFin=="") + { + noFin="0"; + } + + noDepart = parseInt(noDepart); + noFin = parseInt(noFin); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + $("#btn_pop_prestataire").click(); + return; + } + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeBon").focus(); + return; + } + + if (noFin { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'codeTypeBon='+codeTypeBon+'&noDepart='+noDepart+'&noFin='+noFin+'&receptionnaire='+receptionnaire+'&codePrestataire='+codePrestataire; + + // donnees_sav = donnees+'&typeMail=mailgenererbon'; + donnees_sav = donnees; + typeMail='mailgenererbon'; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxplagebonlibre/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infoplagelibre").html(data); + + }, + complete: function() { + plageLibre_info=$("#plageLibre_info").val(); + + if (plageLibre_info!="0") + { + v_msg="Cette plage est déjà occupée!"; + v_msgEng="This range is already occupied!"; + alert_ebene(v_msg, v_msgEng); + + $("#noDepart").focus(); + return; + } + + $("#div_page_entiere").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgenererbons/genererBon/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_page_entiere").html(data); + }, + complete: function() { + imprimer_livraison_bon(); + } + }); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function afficherbon() +{ + codePrestataire=$("#codePrestataire").val(); + + codeTypeBon=$("#codeTypeBon").val(); + codeEtatBon=$("#codeEtatBon").val(); + + noDepart=$("#noDepart").val(); + noFin=$("#noFin").val(); + + if (noDepart=="") + { + noDepart="0"; + } + + if (noFin=="") + { + noFin="0"; + } + + noDepart = parseInt(noDepart); + noFin = parseInt(noFin); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + return; + } + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeBon").focus(); + return; + } + + if (noFin' + ''); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxafficherbons/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_bonpecs").html(data); + }, + complete: function() { + $("#nbligne").val("Nombre de bons affichés : "+$("#nbligne_info").val()); + } + }); +} + +function listergenerationbon() +{ + codePrestataire=$("#codePrestataire").val(); + codeTypeBon=$("#codeTypeBon").val(); + d1=$("#d1").val(); + d2=$("#d2").val(); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + return; + } + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeBon").focus(); + return; + } + + donnees = 'codePrestataire='+codePrestataire+'&codeTypeBon='+codeTypeBon+'&d1='+d1+'&d2='+d2; + + $("#div_bonpecs").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxalistegenererbons/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_bonpecs").html(data); + }, + complete: function() { + $("#nbligne").val("Nombre de lignes affichées : "+$("#nbligne_info").val()); + } + }); +} + +function listerdemandebon() +{ + codePrestataire=$("#codePrestataire").val(); + codeTypeBon=$("#codeTypeBon").val(); + d1=$("#d1").val(); + d2=$("#d2").val(); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + return; + } + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeBon").focus(); + return; + } + + donnees = 'codePrestataire='+codePrestataire+'&codeTypeBon='+codeTypeBon+'&d1='+d1+'&d2='+d2; + + $("#div_bonpecs").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxalistedemandebon/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_bonpecs").html(data); + }, + complete: function() { + } + }); +} + +function ajaxListerExclusions() +{ + $("#div_acte").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxexclureacte/", + type : 'post', + data: "idCollege="+$("#idCollege").val(), + error: function(errorData) { + }, + success: function(data) { + $("#div_acte").html(data); + } + }); +} + +function exclure_acte(p_choix, p_codeActe, id_exclusioncollege) +{ + donnees = 'idCollege='+$("#idCollege").val(); + donnees += '&id_exclusioncollege='+id_exclusioncollege; + donnees += '&codeActe='+p_codeActe; + donnees += '&choix='+p_choix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxexclureacte/exclure/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function separateur_millier(montant) +{ + montant = parseInt(montant); + montant.toLocaleString(); + return montant.toLocaleString(); +} + +function afficher_detail_generartionbon(idgenerationbon) +{ + if (idgenerationbon>"") + { + window.location.assign($("#racineWeb" ).val()+"Detailgenerationbon/"+idgenerationbon+"/"); + } +} + +function afficher_tarifoptique() +{ + var div_detail = $('#div_detail'); + + codeTarifOptique=$("#codeTarifOptique").val(); + libelleOptique=$("#libelleOptique").val(); + + if(codeTarifOptique<=' ') + { + v_msg="Veuillez sélectionner un tarif!"; + v_msgEng="Please select a rate!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTarifOptique").focus(); + return; + } + + /* + if(libelleOptique<=' ') + { + v_msg="Veuillez saisir un nom!"; + v_msgEng="Please enter a name!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleOptique").focus(); + return; + } + */ + + donnees = 'codeTarifOptique='+codeTarifOptique+'&libelleOptique='+libelleOptique; + + div_detail.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifoptique/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_detail").html(data); + appliquerDataTable(); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function() + { + } + }); +} + +function maj_tarifoptique(idDetail, prix) +{ + donnees = 'idDetail='+idDetail+"&prix="+prix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifoptique/maj/", + type: 'POST', + data: donnees, + success: function(data) { + }, + complete: function(data) + { + } + }); +} + +function supprimer_espace_nombre(nombre) +{ + // nombre = nombre.replace(" ", ""); + nombre = nombre.replace(/ /g, ""); + + if(isNaN(nombre)) + { + v_msg = nombre+" n\'est pas un nombre!"; + v_msgEng = nombre+" is not a number!"; + alert_ebene(v_msg, v_msgEng); + + return '0'; + } + nombre = parseInt(nombre); + return nombre; +} + +function afficher_tarifpharmacie() +{ + var div_detail = $('#div_detail'); + + codeTarifMedicament=$("#codeTarifMedicament").val(); + libelleMedicament=$("#libelleMedicament").val(); + + if(codeTarifMedicament<=' ') + { + v_msg="Veuillez sélectionner un tarif!"; + v_msgEng="Please select a rate!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTarifMedicament").focus(); + return; + } + + /* + if(libelleMedicament<=' ') + { + v_msg="Veuillez indiquer le nom!"; + v_msgEng="Please enter the name!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleMedicament").focus(); + return; + } + */ + + donnees = 'codeTarifMedicament='+codeTarifMedicament+'&libelleMedicament='+libelleMedicament; + + div_detail.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifmedicament/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_detail").html(data); + appliquerDataTable(); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function() + { + } + }); +} + +function maj_tarifpharmacie(idDetail, prix) +{ + donnees = 'idDetail='+idDetail+"&prix="+prix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifmedicament/maj/", + type: 'POST', + data: donnees, + success: function(data) { + }, + complete: function(data) + { + } + }); +} + +function afficher_tarifacte() +{ + var div_detail = $('#div_detail'); + + codeTarifActe=$("#codeTarifActe").val(); + libelleActe=$("#libelleActe").val(); + + if(codeTarifActe<=' ') + { + v_msg="Veuillez sélectionner un tarif!"; + v_msgEng="Please select a rate!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTarifActe").focus(); + return; + } + + if(libelleActe<=' ') + { + v_msg="Veuillez indiquer le nom!"; + v_msgEng="Please enter the name!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleActe").focus(); + return; + } + + donnees = 'codeTarifActe='+codeTarifActe+'&libelleActe='+libelleActe; + + div_detail.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifacte/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_detail").html(data); + appliquerDataTable(); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function() + { + } + }); +} + +function maj_tarifacte(idDetail, prix) +{ + donnees = 'idDetail='+idDetail+"&prix="+prix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtarifacte/maj/", + type: 'POST', + data: donnees, + success: function(data) { + }, + complete: function(data) + { + } + }); +} + +function gestiondiverses() +{ + adminDiv = $("#adminDiv").val(); + + if (adminDiv!="1") + { + v_msg="Accès refusé!"; + v_msgEng="Access denied!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Gestiondiverses/"); +} + + +function liste_derogation_beneficiaire() +{ + window.location.assign($("#racineWeb" ).val()+"Listederogationsbenficiaire/"); +} + +function listerderogationbeneficiaire() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + + $("#div_derogations").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_derogations").html(data); + }, + complete: function() { + } + }); +} + +function accepter_derogation(idDemandederogation) +{ + window.location.assign($("#racineWeb" ).val()+"Accepterderogation/"+idDemandederogation+"/"); +} + +function refuser_derogation(idDemandederogation) +{ + window.location.assign($("#racineWeb" ).val()+"Refuserderogation/"+idDemandederogation+"/"); +} + +function enregistrerrefusderogation() +{ + idDemandederogation = $("#idDemandederogation").val(); + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifRefusAssure").val(); + + if (motifReel<=" ") + { + v_msg="Veuillez saisir le motif réel!"; + v_msgEng="Please enter the real reason!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReel").focus(); + return; + } + + if (motifRefusAssure<=" ") + { + v_msg="Veuillez saisir un motif pour l\'assuré!"; + v_msgEng="Please enter a reason for the insured!"; + + $("#motifRefusAssure").focus(); + return; + } + + + v_msg="Confirmez-vous ce refus?"; + v_msgEng="Do you confirm this refusal?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + codePrestataire = $("#codePrestataire").val(); + + donnees = 'idDemandederogation='+idDemandederogation+'&motifReel='+motifReel+'&motifRefusAssure='+motifRefusAssure+'&codePrestataire='+codePrestataire; + + donnees_sav = donnees; + typeMail='refusderogation'; + typeSms="refusderogation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/enregistrerrefusderogation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + preparesms(typeSms); + }, + complete: function() { + + v_msg="Refus envoyé avec succès!"; + v_msgEng="Disagreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_derogation_beneficiaire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function enregistreraccordderogation() +{ + idDemandederogation = $("#idDemandederogation").val(); + motifReel = $("#motifReel").val(); + debut =$("#debut").val(); + fin =$("#fin").val(); + + codeDerogation = $("#codeDerogation").val(); + tmDerogation = $("#tmDerogation").val(); + tmDerogation = parseInt(tmDerogation); + + codePrestataire = $("#codePrestataire").val(); + + if (motifReel<=" ") + { + v_msg="Veuillez saisir le motif!"; + v_msgEng="Please enter the reason!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReel").focus(); + return; + } + + var td0 = $("#datejourfr_C").datepicker("getDate"); + var td1 = $("#debut").datepicker("getDate"); + var td2 = $("#fin").datepicker("getDate"); + + dt0=Math.round(Date.parse(td0)/(1000*3600*24)); + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + + if ((dt0>dt1) || dt1>dt2) + { + v_msg="Veuillez revoir les dates!"; + v_msgEng="Please review the dates!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cet accord?"; + v_msgEng="Do you confirm this agreement?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'idDemandederogation='+idDemandederogation+'&motifReel='+motifReel+'&debut='+debut+'&fin='+fin; + donnees += '&codeDerogation='+codeDerogation+'&tmDerogation='+tmDerogation+'&codePrestataire='+codePrestataire; + + donnees_sav = donnees; + typeMail='accordderogation'; + typeSms = "accordderogation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/enregistreraccordderogation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + preparesms(typeSms); + }, + complete: function() { + + v_msg="Accord envoyé avec succès!"; + v_msgEng="Agreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_derogation_beneficiaire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function listerderogations() +{ + codePrestataire=$("#codePrestataire").val(); + codeDerogation=$("#codeDerogation").val(); + codeReponseDerogation=$("#codeReponseDerogation").val(); + debut=$("#debut").val(); + fin=$("#fin").val(); + + donnees = 'codePrestataire='+codePrestataire+'&codeDerogation='+codeDerogation+'&codeReponseDerogation='+codeReponseDerogation; + donnees += '&debut='+debut+'&fin='+fin; + + $("#div_derogations").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogations/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_derogations").html(data); + }, + complete: function() { + } + }); +} + +function accepter_derogation_2(idDemandederogation) +{ + window.location.assign($("#racineWeb" ).val()+"Accepterderogations/"+idDemandederogation+"/"); +} + +function refuser_derogation_2(idDemandederogation) +{ + window.location.assign($("#racineWeb" ).val()+"Refuserderogations/"+idDemandederogation+"/"); +} + +function enregistrerrefusderogation_2() +{ + idDemandederogation = $("#idDemandederogation").val(); + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifReel").val(); + + + if (motifReel<=" ") + { + v_msg="Veuillez saisir le motif réel!"; + v_msgEng="Please enter the real reason!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReel").focus(); + return; + } + + if (motifRefusAssure<=" ") + { + v_msg="Veuillez saisir un motif pour l\'assuré!"; + v_msgEng="Please enter a reason for the insured!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifRefusAssure").focus(); + return; + } + + v_msg="Confirmez-vous ce refus?"; + v_msgEng="Do you confirm this refusal?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + codePrestataire = $("#codePrestataire").val(); + + donnees = 'idDemandederogation='+idDemandederogation+'&motifReel='+motifReel+'&motifRefusAssure='+motifRefusAssure+'&codePrestataire='+codePrestataire; + + donnees_sav = donnees; + typeMail='refusderogation'; + typeSms="refusderogation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/enregistrerrefusderogation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + preparesms(typeSms); + }, + complete: function() { + + v_msg="Refus envoyé avec succès!"; + v_msgEng="Disagreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_derogations(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function enregistreraccordderogation_2() +{ + idDemandederogation = $("#idDemandederogation").val(); + motifReel = $("#motifReel").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + codeDerogation = $("#codeDerogation").val(); + tmDerogation = $("#tmDerogation").val(); + tmDerogation = parseInt(tmDerogation); + + codePrestataire = $("#codePrestataire").val(); + + if (motifReel<=" ") + { + v_msg="Veuillez saisir le motif!"; + v_msgEng="Please enter the reason!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReel").focus(); + return; + } + + var td0 = $("#datejourfr_C").datepicker("getDate"); + var td1 = $("#debut").datepicker("getDate"); + var td2 = $("#fin").datepicker("getDate"); + + dt0=Math.round(Date.parse(td0)/(1000*3600*24)); + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + + if (dt0>dt1 || dt1>dt2) + { + v_msg="Veuillez revoir les dates!"; + v_msgEng="Please review the dates!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + v_msg="Confirmez-vous cet accord?"; + v_msgEng="Do you confirm this agreement?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'idDemandederogation='+idDemandederogation+'&motifReel='+motifReel+'&debut='+debut+'&fin='+fin; + donnees += '&codeDerogation='+codeDerogation+'&tmDerogation='+tmDerogation+'&codePrestataire='+codePrestataire; + + donnees_sav = donnees; + typeMail='accordderogation'; + typeSms = "accordderogation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxderogationsbenficiaire/enregistreraccordderogation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + preparesms(typeSms); + }, + complete: function() { + + v_msg="Accord envoyé avec succès!"; + v_msgEng="Agreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_derogations(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function liste_derogations() +{ + window.location.assign($("#racineWeb" ).val()+"Listederogations/"); +} + +function prestations() +{ + if ($("#idBeneficiaire_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Prestations/"+$("#idBeneficiaire_C" ).val()+"/"); + }else{ + + window.location.assign($("#racineWeb" ).val()+"Rechercheprestations/"); + } +} + +function dossiers() +{ + window.location.assign($("#racineWeb" ).val()+"Dossiers/"); +} + +function factures() +{ + window.location.assign($("#racineWeb" ).val()+"Factures/"); +} + +function listerdossier() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + + $("#div_dossiers").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdossiers/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_dossiers").html(data); + }, + complete: function() { + } + }); +} + +function selectionner_feuille_maladie(no) +{ + $("#numeroFeuilleMaladie_C" ).val(no); +} + +function selectionner_facture(idFacture) +{ + $("#idFacture_C" ).val(idFacture); +} + +function afficher_feuille_maladie() +{ + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C" ).val(); + + if (numeroFeuilleMaladie>"") + { + ajax_context_feuille_maladie_afficher(numeroFeuilleMaladie); + } +} + +function ajax_context_feuille_maladie_afficher(numeroFeuilleMaladie) +{ + donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfeuillemaladie/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Feuillemaladiecons/"); + } + }); +} + +function afficher_facture() +{ + idFacture=$("#idFacture_C" ).val(); + + if (idFacture>"") + { + ajax_context_facture_afficher(idFacture); + } +} + +function ajax_context_facture_afficher(idFacture) +{ + donnees = 'idFacture='+idFacture; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfacture/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Facture/"); + } + }); +} + +function listerfacture() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + + $("#div_dossiers").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactures/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_dossiers").html(data); + }, + complete: function() { + } + }); +} + +function sinistres() +{ + adminDiv = $("#adminDiv").val(); + + if (adminDiv!="1") + { + v_msg="Accès refusé!"; + v_msgEng="Access denied!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Rechercheprestations/"); +} + + +function afficher_pharmacie(numeroBonOrdonnance, codePrestataireLivraison, prestataireLivraison) +{ + /*facture = $("#facture").val(); + + if(facture=="0"){ + v_msg="Non facturé!"; + v_msgEng="Not billed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + donnees = 'numeroBonOrdonnance='+numeroBonOrdonnance+'&codePrestataireLivraison='+codePrestataireLivraison; + donnees += '&prestataireLivraison='+prestataireLivraison; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextpharmaciencien/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Pharmaciencons/"); + } + }); +} + +function afficher_optique(numeroBonOptique, codePrestataireLivraison) +{ + donnees = 'numeroBonOptique='+numeroBonOptique+'&codePrestataireLivraison='+codePrestataireLivraison; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextopticien/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Opticiencons/"); + } + }); +} + +function fraisfuneraire() +{ + window.location.assign($("#racineWeb" ).val()+"Fraisfuneraire/"); +} + + +function demanderfraisfuneraire() +{ + fraisFuneraireDemande=$("#fraisFuneraireDemande_C").val(); + + if (fraisFuneraireDemande==1) + { + v_msg="Déjà effectuée!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Demandefraisfuneraire/"); +} + + +function modifierdemanderfraisfuneraire() +{ + fraisFuneraireDemande=$("#fraisFuneraireDemande_C").val(); + fraisFunerairePaye=$("#fraisFunerairePaye_C").val(); + + if (fraisFuneraireDemande!=1) + { + v_msg="Aucune demande en cours!"; + v_msgEng="No request in progress!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (fraisFunerairePaye==1) + { + v_msg="Déjà payé!"; + v_msgEng="Already paid!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + demandeReglement=$("#demandeReglement").val(); + demandeReglement = parseInt(demandeReglement); + + if (demandeReglement==1) + { + v_msg="Déjà effectuée!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Modifierfraisfuneraire/"); +} + + +function payerfraisfuneraire() +{ + fraisFuneraireDemande=$("#fraisFuneraireDemande_C").val(); + fraisFunerairePaye=$("#fraisFunerairePaye_C").val(); + + if (fraisFuneraireDemande!=1) + { + v_msg="Aucune demande en cours!"; + v_msgEng="No request in progress!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + demandeReglement=$("#demandeReglement").val(); + demandeReglement = parseInt(demandeReglement); + + if (demandeReglement==0) + { + v_msg="Aucune Demande de Règlement!"; + v_msgEng="No request in progress!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (fraisFunerairePaye==1) + { + v_msg="Déjà payé!"; + v_msgEng="Already paid!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Payerfraisfuneraire/"); +} + +function enregistrerdemandefraisfuneraire() +{ + enVigueur=$("#enVigueur_C").val(); + codeEtatBeneficiaire=$("#codeEtatBeneficiaire_C").val(); + etatbeneficiaire=$("#etatbeneficiaire_C").val(); + + if (enVigueur!="1") + { + v_msg="Attention! cette personne n'est pas en vigueur,"; + v_msgEng="Warning! This person is not in force,"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (codeEtatBeneficiaire!="V") + { + v_msg="Attention! "+etatbeneficiaire; + v_msgEng="Warning! "+etatbeneficiaire; + alert_ebene(v_msg, v_msgEng); + + return; + } + + demandeur = $("#demandeur").val(); + codeLienDemandeur = $("#codeLienDemandeur").val(); + + causeDeces = $("#causeDeces").val(); + dateDeces=$("#dateDeces").val(); + + beneficiaireReglement = $("#beneficiaireReglement").val(); + codeLienBeneficiaire = $("#codeLienBeneficiaire").val(); + + observations = $("#observations").val(); + fraisReel = $("#fraisReel").val(); + montantApayer = $("#montantApayer").val(); + + codeModePaiementDemande = $("#codeModePaiementDemande").val(); + codeBanqueBeneficiaire = $("#codeBanqueBeneficiaire").val(); + numeroCompteBeneficiaire = $("#numeroCompteBeneficiaire").val(); + + + if (demandeur<=" ") + { + v_msg="Veuillez saisir le nom du demandeur!"; + v_msgEng="Please enter the name of the payment requestor"; + alert_ebene(v_msg, v_msgEng); + + $("#demandeur").focus(); + return; + } + + if (codeLienDemandeur<=" ") + { + v_msg="Veuillez sélectionner le lien de parenté avec le demandeur!"; + v_msgEng="Please select the relationship with the requestor!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienDemandeur").focus(); + return; + } + + if (causeDeces<=" ") + { + v_msg="Veuillez saisir la cause du décès!"; + v_msgEng="Please enter the cause of death"; + alert_ebene(v_msg, v_msgEng); + + $("#causeDeces").focus(); + return; + } + + if (dateDeces<=" ") + { + v_msg="Veuillez saisir la date du décès!"; + v_msgEng="Please enter the date of death!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateDeces").focus(); + return; + } + + if (beneficiaireReglement<=" ") + { + v_msg="Veuillez saisir le nom du bénéficiaire du règlement!"; + v_msgEng="Please enter the name of the payee!"; + alert_ebene(v_msg, v_msgEng); + + $("#beneficiaireReglement").focus(); + return; + } + + if (codeLienBeneficiaire<=" ") + { + v_msg="Veuillez sélectionner le lien avec le bénéficiaire du règlement!"; + v_msgEng="Please select the relationship with the payee!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienBeneficiaire").focus(); + return; + } + + if(montantApayer<=" ") + { + montantApayer = "0"; + } + + if(montantApayer==0) + { + v_msg="Veuillez revoir le montant!"; + v_msgEng="Please review the amount!"; + alert_ebene(v_msg, v_msgEng); + + $("#montantApayer").focus(); + + return; + } + + + if (codeModePaiementDemande<=" ") + { + v_msg="Veuillez sélectionner le mode de paiement!"; + v_msgEng="Please select the payment method!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeModePaiementDemande").focus(); + return; + } + + if (codeModePaiementDemande=="VR") + { + if (codeBanqueBeneficiaire<=" ") + { + v_msg="Veuillez sélectionner la banque du bénéficiaire!"; + v_msgEng="Please select the beneficiary\'s bank!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeBanqueBeneficiaire").focus(); + return; + } + + if (numeroCompteBeneficiaire<=" ") + { + v_msg="Veuillez saisir le No de compte du bénéficiaire!"; + v_msgEng="Please enter the beneficiary\'s account number"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroCompteBeneficiaire").focus(); + return; + } + } + + dateEffetPolice = $("#dateEffetPolice_C").val(); + dateEcheancePolice = $("#dateEcheancePolice_C").val(); + // var td0 = new Date(dateEffetPolice); + dateEntreeBeneficiaire= $("#dateEntreeBeneficiaire_C").val(); + + + var td0 = $("#datejourfr_C").datepicker("getDate");//new Date(dateEntreeBeneficiaire); + var td1 = $("#dateDeces").datepicker("getDate"); + var td2 = $("#datejourfr_C").datepicker("getDate"); + var td3 = $("#datejourfr_C").datepicker("getDate");//new Date(dateEcheancePolice); + + dt0=Math.round(Date.parse(td0)/(1000*3600*24)); + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + dt3=Math.round(Date.parse(td3)/(1000*3600*24)); + + if (dt1>dt2) + { + v_msg="Veuillez revoir la date!"; + v_msgEng="Please review the date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateDeces").focus(); + return; + } + + if (dt1>dt3 || dt1dt3) + { + v_msg="Attention! cette police n'est pas couverte à cette date!"; + v_msgEng="Warning! This insurance policy is not valid on this date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette demande de frais funéraires?"; + v_msgEng="Do you confirm this request for funeral fees?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'demandeur='+demandeur+'&codeLienDemandeur='+codeLienDemandeur; + donnees += '&beneficiaireReglement='+beneficiaireReglement+'&codeLienBeneficiaire='+codeLienBeneficiaire; + donnees += '&fraisReel='+fraisReel+'&montantApayer='+montantApayer; + donnees += '&causeDeces='+causeDeces+'&dateDeces='+dateDeces; + donnees += '&observations='+observations; + + donnees += '&codeModePaiementDemande='+codeModePaiementDemande; + donnees += '&codeBanqueBeneficiaire='+codeBanqueBeneficiaire+'&numeroCompteBeneficiaire='+numeroCompteBeneficiaire; + + donnees_sav = donnees; + + typeMail='fraisfuneraire'; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerdemandefraisfuneraire/enregistrerdemandefraisfuneraire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + v_msg="Opération effectuée avec succès!"; + v_msgEng="Operation successfully completed"; + alert_ebene(v_msg, v_msgEng); + }, + complete: function() { + fraisfuneraire(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function listerfraisfuneraires() +{ +} + +function enregistrermodificationsfraisfuneraire() +{ + + idFraisfuneraire = $("#idFraisfuneraire").val(); + + demandeur = $("#demandeur").val(); + codeLienDemandeur = $("#codeLienDemandeur").val(); + + causeDeces = $("#causeDeces").val(); + dateDeces=$("#dateDeces").val(); + + beneficiaireReglement = $("#beneficiaireReglement").val(); + codeLienBeneficiaire = $("#codeLienBeneficiaire").val(); + + observations = $("#observations").val(); + fraisReel = $("#fraisReel").val(); + montantApayer = $("#montantApayer").val(); + + codeModePaiementDemande = $("#codeModePaiementDemande").val(); + codeBanqueBeneficiaire = $("#codeBanqueBeneficiaire").val(); + numeroCompteBeneficiaire = $("#numeroCompteBeneficiaire").val(); + + if (demandeur<=" ") + { + v_msg="Veuillez saisir le nom du demandeur!"; + v_msgEng="Please enter the name of the payment requestor"; + alert_ebene(v_msg, v_msgEng); + + $("#demandeur").focus(); + return; + } + + if (codeLienDemandeur<=" ") + { + v_msg="Veuillez sélectionner le lien de parenté avec le demandeur!"; + v_msgEng="Please select the relationship with the requestor!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienDemandeur").focus(); + return; + } + + if (causeDeces<=" ") + { + v_msg="Veuillez saisir la cause du décès!"; + v_msgEng="Please enter the cause of death"; + alert_ebene(v_msg, v_msgEng); + + $("#causeDeces").focus(); + return; + } + + if (dateDeces<=" ") + { + v_msg="Veuillez saisir la date du décès!"; + v_msgEng="Please enter the date of death!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateDeces").focus(); + return; + } + + if (beneficiaireReglement<=" ") + { + v_msg="Veuillez saisir le nom du bénéficiaire du règlement!"; + v_msgEng="Please enter the name of the payee!"; + alert_ebene(v_msg, v_msgEng); + + $("#beneficiaireReglement").focus(); + return; + } + + if (codeLienBeneficiaire<=" ") + { + v_msg="Veuillez sélectionner le lien avec le bénéficiaire du règlement!"; + v_msgEng="Please select the relationship with the payee!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeLienBeneficiaire").focus(); + return; + } + + if (codeModePaiementDemande<=" ") + { + v_msg="Veuillez sélectionner le mode de paiement!"; + v_msgEng="Please select the payment method!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeModePaiementDemande").focus(); + return; + } + + if (codeModePaiementDemande=="VR") + { + if (codeBanqueBeneficiaire<=" ") + { + v_msg="Veuillez sélectionner la banque du bénéficiaire!"; + v_msgEng="Please select the beneficiary\'s bank!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeBanqueBeneficiaire").focus(); + return; + } + + if (numeroCompteBeneficiaire<=" ") + { + v_msg="Veuillez saisir le No de compte du bénéficiaire!"; + v_msgEng="Please enter the beneficiary\'s account number"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroCompteBeneficiaire").focus(); + return; + } + } + + + if(montantApayer<=" ") + { + montantApayer = "0"; + } + + if(montantApayer==0) + { + v_msg="Veuillez revoir le montant!"; + v_msgEng="Please review the amount!"; + alert_ebene(v_msg, v_msgEng); + + $("#montantApayer").focus(); + + return; + } + + dateEffetPolice = $("#dateEffetPolice_C").val(); + dateEcheancePolice=$("#dateEcheancePolice_C").val(); + + // var td0 = new Date(dateEffetPolice); + dateEntreeBeneficiaire= $("#dateEntreeBeneficiaire_C").val(); + + var td0 = $("#dateEntreeBeneficiaire").datepicker("getDate");//new Date(dateEntreeBeneficiaire); + var td1 = $("#dateDeces").datepicker("getDate"); + var td2 = $("#datejourfr_C").datepicker("getDate"); + var td3 = $("#dateEcheancePolice").datepicker("getDate");//new Date(dateEcheancePolice); + + dt0=Math.round(Date.parse(td0)/(1000*3600*24)); + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + dt3=Math.round(Date.parse(td3)/(1000*3600*24)); + + if (dt1>dt2) + { + v_msg="Veuillez revoir la date de consultation!"; + v_msgEng="Please review the date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (dt1>dt3 || dt1dt3) + { + v_msg="Attention! cette police n'est pas couverte à cette date!"; + v_msgEng="Warning! This insurance policy is not valid on this date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ces modifications?"; + v_msgEng="Do you confirm these modifications?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'demandeur='+demandeur+'&codeLienDemandeur='+codeLienDemandeur; + donnees += '&beneficiaireReglement='+beneficiaireReglement+'&codeLienBeneficiaire='+codeLienBeneficiaire; + donnees += '&fraisReel='+fraisReel+'&montantApayer='+montantApayer; + donnees += '&causeDeces='+causeDeces+'&dateDeces='+dateDeces; + donnees += '&observations='+observations+'&idFraisfuneraire='+idFraisfuneraire; + + donnees += '&codeModePaiementDemande='+codeModePaiementDemande; + donnees += '&codeBanqueBeneficiaire='+codeBanqueBeneficiaire+'&numeroCompteBeneficiaire='+numeroCompteBeneficiaire; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerdemandefraisfuneraire/enregistrermodificationsfraisfuneraire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + v_msg="Modifications effectuées avec succès!"; + v_msgEng="Changes made successfully!"; + alert_ebene(v_msg, v_msgEng); + }, + complete: function() { + fraisfuneraire() + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + + +function initierdecompte() +{ + codePeriodeMax = $("#codePeriodeMax").val(); + + codePrestataire=$("#codePrestataire").val(); + codeExercice=$("#codeExercice").val(); + codeMois=$("#codeMois").val(); + + if (codePrestataire<=" ") + { + v_msg="Veuillez sélectionner un prestataire!"; + v_msgEng="Please select a provider!"; + alert_ebene(v_msg, v_msgEng); + + $("#codePrestataire").focus(); + return; + } + + if (codeExercice<=" ") + { + v_msg="Veuillez sélectionner un exercice!"; + v_msgEng="Please select an exercise!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeExercice").focus(); + return; + } + + if (codeMois<=" ") + { + v_msg="Veuillez sélectionner une période!"; + v_msgEng="Please select a period!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeMois").focus(); + return; + } + + codePeriodeCourant = codeExercice+codeMois; + + if (codePeriodeCourant>codePeriodeMax) + { + v_msg="Mois non encore entamé!"; + v_msgEng="Month not yet started!"; + alert_ebene(v_msg, v_msgEng); + return; + + $("#codeMois").focus(); + return; + } + + donnees = 'codePrestataire='+codePrestataire+'&codeExercice='+codeExercice+'&codeMois='+codeMois; + + var div_wait = $('#div_wait'); + div_wait.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/initierdecompte/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#inforegle").html(data); + }, + complete: function() { + regle=$("#regle").val(); + + if(regle==-1) + { + v_msg="Problème lors de l\'initialisation!"; + v_msgEng="Problem during initialization!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + else if(regle==0 || regle==2 || regle==3 || regle==8) + { + afficherdecompte(); + } + else + { + // 9 => Décompte validé mais en attente de règlemen + // 1 => Décompte réglé + consulterdecompte(); + } + } + }); +} + +function liste_decompte() +{ + window.location.assign($("#racineWeb" ).val()+"Listedecomptes/"); +} + +function decompte() +{ + window.location.assign($("#racineWeb" ).val()+"Initdecompte/"); +} + +function afficherdecompte() +{ + window.location.assign($("#racineWeb" ).val()+"Decompte/"); +} + +function re_afficherdecompte() +{ + $("#detail_reglement").html('
' + '
'); + + window.location.assign($("#racineWeb" ).val()+"Decompte/"); +} + +function rechargerfacture() +{ + $("#detail_reglement").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/rechargerfacture/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + afficherdecompte(); + }, + complete: function() { + } + }); +} + +function reinitialiserdecompte() +{ +/* +0 Décompte en cours +2 Attente Valid. prestat. / Waiting for provider s valid. +3 Validé par le prestataire +8 Pas besoin de valid prestat / Provid valid not needed +9 En attente de règelment +1 Réglé / Payé +*/ + + // Ajout du 26/03/2025 => KANE => Pour empêcher de réinitilider un décompte déjà validé + regle=$("#regle").val(); + regle = parseInt(regle); + + //if (regle==0) + if (regle!=0 && regle!=2) + { + v_msg="Impossible de réinitialiser!"; + v_msgEng="Unable to reset!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + // Fin Ajout du 26/03/2025 KANE + + v_msg="Remettre le décompte à zéro. Confirmez-vous cette opération?"; + v_msgEng="Reset the counts. Do you confirm this operation?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#detail_reglement").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/reinitialiserdecompte/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + afficherdecompte(); + }, + complete: function() { + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function afficher_feuille_maladie_dec() +{ + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + + if (numeroFeuilleMaladie>"") + { + ajax_context_feuille_maladie_afficher_dec(numeroFeuilleMaladie); + } +} + +function ajax_context_feuille_maladie_afficher_dec(numeroFeuilleMaladie) +{ + donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfeuillemaladie/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Feuillemaladiedec/"); + } + }); +} + +function afficher_optique_dec(numeroBonOptique, codePrestataireLivraison) +{ + donnees = 'numeroBonOptique='+numeroBonOptique+'&codePrestataireLivraison='+codePrestataireLivraison; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextopticien/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Opticiendec/"); + } + }); +} + +function afficher_pharmacie_dec(numeroBonOrdonnance, codePrestataireLivraison) +{ + donnees = 'numeroBonOrdonnance='+numeroBonOrdonnance+'&codePrestataireLivraison='+codePrestataireLivraison; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextpharmaciencien/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Pharmaciendec/"); + } + }); +} + +function maj_montantForce(idFacture, montantForce) +{ + donnees = 'idFacture='+idFacture+"&montantForce="+montantForce; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxentetedecompte/majmontantforce/", + type: 'POST', + data: donnees, + success: function(data) { + $("#reglement").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + + +function afficherfacturenoncharge() +{ +} + +function afficherfactureattente() +{ +} + +function valider_facture(idFacture, numeroFeuilleMaladie, p_choix, codeTypeFacture) +{ + donnees = 'idFacture='+idFacture+'&choix='+p_choix+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&codeTypeFacture='+codeTypeFacture; + + var ctrl_montantForce = $("#montantForce"+idFacture); + var ctrl_montantApayer = $("#montantApayer"+idFacture); + var ctrl_montantRedresse = $("#montantRedresse"+idFacture); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxvaliderfacture/validerfacture/", + type: 'POST', + data: donnees, + success: function(data) { + $("#reglement").html(data); + + montantForce_val = $("#montantForce_val").val(); + montantApayer_val = $("#montantApayer_val").val(); + montantRedresse_val = $("#montantRedresse_val").val(); + montantRedresse_sans_format = $("#montantRedresse_sans_format").val(); + observations_val = $("#observations_val").val(); + + ctrl_montantForce.html(montantForce_val); + + c_html = " "; + + ctrl_montantApayer.html(c_html); + + ctrl_montantRedresse.html(montantRedresse_val); + }, + error: function(data) { + }, + complete: function() + { + // alert("p_choix2 => "+p_choix); + if((p_choix=="9")){ + init_maj_detail_rejet_decompte(idFacture); + } + + /* if ( (montantRedresse_sans_format!=0) && (observations_val<=" ") || (p_choix=="2")) + { + maj_observations_facture(idFacture, observations_val); + } */ + } + }); +} + +function maj_observations_facture(idFacture, observations) +{ + let v_msg = "Veuillez saisir ou modifier les observations!"; + let v_msgEng = "Please enter or edit comments!"; + + prompt_ebene(v_msg, v_msgEng, "", function(observations) { + + if(observations==null) + { + return; + } + + v_msg="Confirmez-vous ces modifications?"; + v_msgEng="Do you confirm these modifications?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + let donnees = 'idFacture='+idFacture; + donnees += "&observations="+encodeURIComponent(observations); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/majobservations/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + }); + +} + +function afficher_div_wait() +{ + $("#div_wait").html('
' + '
'); +} + +function effacer_div_wait() +{ + $("#div_wait").html(""); +} + +function rechercheprestations_form() +{ + $("#frmrechercheprestation").submit(); +} + +function consulterdecompte() +{ + // detail_reglement + var div_wait = $('#detail_reglement'); + div_wait.html('
' + '
'); + + window.location.assign($("#racineWeb" ).val()+"Decomptecons/"); +} + + +function maj_bordereau_decompte(idReglement, numeroBordereau) +{ + let v_msg = "Veuillez saisir ou modifier le No de bordereau!"; + let v_msgEng = "Please enter or modify the slip number!"; + + prompt_ebene(v_msg, v_msgEng, "", function(numeroBordereau) { + if(numeroBordereau==null) + { + return; + } + + v_msg="Confirmez-vous ces modifications?"; + v_msgEng="Do you confirm these modifications?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + let donnees = 'idReglement='+idReglement; + donnees += "&numeroBordereau=" + encodeURIComponent(numeroBordereau); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/majbordereaudecompte/", + type: 'POST', + data: donnees, + success: function(data) { + $("#numeroBordereauDecompte").val(numeroBordereau); + }, + error: function(data) { + }, + complete: function() { + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + }); + +} + +function validerdecompte_premier() +{ +/* +0 Décompte en cours + +2 Attente Valid. prestat. / Waiting for provider s valid. + +3 Validé par le prestataire + +8 Pas besoin de valid prestat / Provid valid not needed + +9 En attente de règelment + +1 Réglé / Payé +*/ + datejour_C=$("#datejour_C").val(); + datejour_C = datejour_C.substring(0, 7) + codePerdiodeLong=$("#codePerdiodeLong").val(); + + if (codePerdiodeLong>=datejour_C) + { + v_msg="Impossible de valider un mois non terminé!"; + v_msgEng="Unable to validate an unfinished month!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + regle=$("#regle").val(); + regle = parseInt(regle); + + if (regle>0) + { + v_msg="1ère validation déjà effectuée!"; + v_msgEng="1st validation already done!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if ($("#montantApayer").val()<="0") + { + v_msg="Rien à valider!"; + v_msgEng="Nothing to validate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nbNonTraite = $("#nbNonTraite").val(); + if (nbNonTraite!="0") + { + v_msg="Vous avez "+nbNonTraite+" facture(s) non traitée(s)!"; + v_msgEng="You have "+nbNonTraite+" bill(s) not processed!"; + + alert_ebene(v_msg, v_msgEng); + + return; + } + + reclamationPrestataireObligatoire = $("#reclamationPrestataireObligatoire").val(); + montantPrestataire = $("#montantPrestataire").val(); + if (reclamationPrestataireObligatoire=="1" && montantPrestataire<="0") + { + v_msg="Veuillez indiquer le montant réclamé par le prestataire! => Réception facture"; + v_msgEng="Please indicate the amount claimed by the provider! => Invoice receipt"; + alert_ebene(v_msg, v_msgEng); + + $('#btn_pop_reception').click(); + + return; + } + + nbExclues = $("#nbExclues").val(); + if (nbExclues<="0") + { + v_msg="Confirmez-vous qu'il n'y a pas de factures à exclure?"; + v_msgEng="Do you confirm that there are no invoices to exclude?"; + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + return; + } + }); + + } + + v_msg="Confirmez-vous la 1ère validation?"; + v_msgEng="Do you confirm the 1st validation?"; + + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#detail_reglement").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/validerdecomptepremier/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + + prestataire = $("#prestataire").val(); + numeroDecompte = $("#numeroDecompte").val(); + numeroLotDecompte = $("#numeroLotDecompte").val(); + periode = $("#periode").val(); + + + p_message = prestataire+" "; + + p_message += "\n"; + p_message += "Decompte : Attente Valid. prestat. / Waiting for provider valid."; + + p_message += "\n"; + p_message += "Periode : "+periode; + + p_message += "\n"; + p_message += "No Decompte : "+numeroDecompte; + + p_message += "\n"; + p_message += "No Lot : "+numeroLotDecompte; + + envoyer_messagerie(p_message, "0"); + }, + complete: function() + { + v_msg="Validation terminée avec succès!"; + v_msgEng="Validation successfully completed"; + alert_ebene(v_msg, v_msgEng); + + afficherdecompte(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function validerdecompte() +{ +/* +0 Décompte en cours + +2 Attente Valid. prestat. / Waiting for provider s valid. + +3 Validé par le prestataire + +8 Pas besoin de valid prestat / Provid valid not needed + +9 En attente de règelment + +1 Réglé / Payé +*/ + + regle=$("#regle").val(); + regle = parseInt(regle); + + if (regle==0) + { + v_msg="Veuillez procéder à la 1ère validation!"; + v_msgEng="Please proceed to the 1st validation!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (regle==2) + { + v_msg="En attente de la validation du prestataire!"; + v_msgEng="Waiting for the validation of the provider!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if ($("#montantApayer").val()<="0") + { + v_msg="Rien à valider!"; + v_msgEng="Nothing to validate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if ( (regle==3) || (regle==8) ) + { + v_msg="Confirmez-vous la 2ème validation?"; + v_msgEng="Do you confirm the 2nd validation?"; + + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $("#detail_reglement").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/validerdecompte/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() + { + v_msg="Validation terminée avec succès!"; + v_msgEng="Validation successfully completed"; + alert_ebene(v_msg, v_msgEng); + + consulterdecompte(); + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + + } +} + +function afficher_div_wait() +{ + $("#div_page_complet").disable(); +} + +function effacer_div_wait() +{ + $("#div_wait").html(""); +} + + +function imprimerbordereaudecompte() +{ + idReglement = $("#idReglement").val(); + + if (idReglement>"0") + { + var div_wait = $('#div_wait'); + div_wait.html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerdemandereglement/imprimerbordereaudecompte", + type: 'POST', + success: function(data) + { + div_wait.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); + } +} + +/* +function activePrestataire(){ + var codeTypeTarifActe = $('#codeTypeTarifActe').val(); + + //alert(codeTypeTarifActe); + + if(codeTypeTarifActe=="TCE" ){ + $('#codePrestataire').removeAttr('disabled'); + }else{ + $('#codePrestataire').attr('disabled', 'disabled'); + } +} +*/ + +function reglerdecompte() +{ +/* +0 Décompte en cours + +2 Attente Valid. prestat. / Waiting for provider s valid. + +3 Validé par le prestataire + +8 Pas besoin de valid prestat / Provid valid not needed + +9 En attente de règelment + +1 Réglé / Payé +*/ + + demandeReglement=$("#demandeReglement").val(); + demandeReglement = parseInt(demandeReglement); + + if (demandeReglement==0) + { + v_msg="Aucune Demande de Règlement!"; + v_msgEng="No request in progress!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + regle=$("#regle").val(); + + if (regle==1) + { + v_msg="Déjà réglé!"; + v_msgEng="Already paid!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Reglerdecompte/"); +} + + +function enregistrerreglementdecompte() +{ + idReglement = $("#idReglement").val(); + dateComptable = $("#dateComptable").val(); + montantPaye = $("#montantPaye").val(); + codeModePaiement = $("#codeModePaiement").val(); + referencePaiement = $("#referencePaiement").val(); + + codeBanquePayeur = $("#codeBanquePayeur").val(); + + if (codeModePaiement<=" ") + { + v_msg="Veuillez sélectionner le mode de paiement!"; + v_msgEng="Please select the payment method!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeModePaiement").focus(); + return; + } + + if (codeBanquePayeur<=" ") + { + v_msg="Veuillez sélectionner la banque de paiement!"; + v_msgEng="Please select the payment bank!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeBanquePayeur").focus(); + return; + } + + if (referencePaiement<=" ") + { + v_msg="Veuillez indiquer la référence du paiement!"; + v_msgEng="Please enter the payment reference!"; + alert_ebene(v_msg, v_msgEng); + + $("#referencePaiement").focus(); + return; + } + + if (dateComptable<=" ") + { + v_msg="Veuillez saisir la date comptable!"; + v_msgEng="Please enter the posting date!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateComptable").focus(); + return; + } + + if(montantPaye<=" ") + { + montantPaye = "0"; + } + + if(montantPaye==0) + { + v_msg="Veuillez revoir le montant!"; + v_msgEng="Please review the amount!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ce règelement?"; + v_msgEng="Do you confirm this payment?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + donnees = 'idReglement='+idReglement+'&codeModePaiement='+codeModePaiement; + donnees += '&referencePaiement='+referencePaiement+'&montantPaye='+montantPaye; + donnees += '&dateComptable='+dateComptable; + donnees += '&codeBanquePayeur='+codeBanquePayeur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/enregistrerreglementdecompte/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + consulterdecompte(); + }, + complete: function() { + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function preparesms(typeSms) +{ + + envoismsactif = $("#envoismsactif").val(); + if(envoismsactif=="0") + { + return; + } + + codeLangueSociete = $("#codeLangueSociete").val(); + + p_destinataires = ""; + p_message = ""; + creation_message = "1"; + + if (typeSms=="accordderogation") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroDerogation = $("#numeroDerogation").val(); + libelleDerogation = $("#libelleDerogation").val(); + tmDerogation = $("#tmDerogation").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Exemption granted for : " : "Derogation accordee pour : "; + p_message += libelleDerogation; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroDerogation; + } + + if (typeSms=="refusderogation") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroDerogation = $("#numeroDerogation").val(); + libelleDerogation = $("#libelleDerogation").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Exemption refused for : " : "Derogation refusee pour : "; + p_message += libelleDerogation; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroDerogation; + } + + if (typeSms=="accordententeprealable") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleActe = $("#libelleActe").val(); + motifReel = $("#motifReel").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += "Instruction : "+motifReel+" "; + p_message += "\n"; + + + p_message += (codeLangueSociete=="en_US") ? "Act granted : " : "Acte accorde : "; + p_message += libelleActe; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="refusententeprealable") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleActe = $("#libelleActe").val(); + motifReel = $("#motifReel").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + + p_message += "Motif de refus : "+motifReel+" "; + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Act refused : " : "Acte refuse : "; + p_message += libelleActe; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="refusacteexclu") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroAutorisation = $("#numeroAutorisation").val(); + libelleActe = $("#libelleActe").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + p_message += "Acte refuse : "+libelleActe+" "; + p_message += "\n"; + p_message += "No demande : "+numeroAutorisation; + } + + if (typeSms=="accordacteexclu") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroAutorisation = $("#numeroAutorisation").val(); + libelleActe = $("#libelleActe").val(); + + prixTarif = $("#prixTarif").val(); + valeurActe = $("#valeurActe").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + p_message += "Acte accorde : "+libelleActe+" "; + p_message += "\n"; + + p_message +="Tarif convention : "+prixTarif+" FRW "; + p_message +="Tarif accorde : "+valeurActe+" FRW "; + + p_message += "No demande : "+numeroAutorisation; + } + + if (typeSms=="accordententeprealablepha") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleMedicament = $("#libelleMedicament").val(); + motifReel = $("#motifReel").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Drug granted : " : "Medicament accorde : "; + p_message += libelleMedicament; + p_message += "\n"; + p_message += "Instruction : "+motifReel+" "; + + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + + if (typeSms=="refusententeprealablepha") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleMedicament = $("#libelleMedicament").val(); + motifReel = $("#motifReel").val(); + + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Drug refused : " : "Medicament refuse : "; + p_message += libelleMedicament; + + p_message += "\n"; + p_message += "Motif de refus : "+motifReel+" "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="accordententeprealableopt") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleOptique = $("#libelleOptique").val(); + motifReel = $("#motifReel").val(); + + + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Glasses granted : " : "Verres accordes : "; + p_message += libelleOptique; + + p_message += "\n"; + p_message += "Instruction : "+motifReel+" "; + + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="refusententeprealableopt") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + libelleOptique = $("#libelleOptique").val(); + motifReel = $("#motifReel").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Glasses refused : " : "Verres refuses : "; + p_message += libelleOptique; + + p_message += "\n"; + p_message += "Motif de refus : "+motifReel+" "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="accordententeprealablemont") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Optical frame : granted" : "Monture accordee"; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="refusententeprealablemont") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroEntentePrealable = $("#numeroEntentePrealable").val(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Optical frame : refused" : "Monture refuse"; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroEntentePrealable; + } + + if (typeSms=="accordsubstitutionpha") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroDemandeSubstitution = $("#numeroDemandeSubstitution").val(); + nomPrescrit = $("#nomPrescrit").val(); + libelleSubstitut = $("#libelleSubstitut").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Substitution granted : " : "Substitution accorde : "; + p_message += nomPrescrit+" => "+libelleSubstitut; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroDemandeSubstitution; + } + + + if (typeSms=="refussubstitutionpha") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + numeroDemandeSubstitution = $("#numeroDemandeSubstitution").val(); + nomPrescrit = $("#nomPrescrit").val(); + libelleSubstitut = $("#libelleSubstitut").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Substitution refused : " : "Substitution refuse : "; + p_message += nomPrescrit+" => "+libelleSubstitut; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Request number : " : "No demande : "; + p_message += numeroDemandeSubstitution; + } + + if (typeSms=="proformahospitalisation") + { + p_destinataires = $("#smsGestionPrestataire").val(); + + copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val(); + if (copieSmsPrestataireAssure=="1") + { + p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires); + } + + patient = $("#beneficiaire").val(); + numeroBeneficiaire = $("#numeroBeneficiaire" ).val(); + prestataire = $("#prestataire").val(); + idProforma = $("#idProforma").val(); + numeroBonHospitalisation= $("#numeroBonHospitalisation").val(); + motifReel = $("#motifReel").val(); + motifRefusAssure = $("#motifRefusAssure").val(); + + p_message = prestataire+" "; + + p_message += "\n"; + + p_message += "Assuré : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += "\n"; + + if(numeroBonHospitalisation > "0") + { + p_message += "Observation : "+motifReel+" "; + p_message += "\n"; + } + + if(motifRefusAssure > " ") + { + p_message += "Refus : "+motifRefusAssure+" "; + p_message += "\n"; + } + + if(numeroBonHospitalisation > "0") + { + p_message += (codeLangueSociete=="en_US") ? "Agreement for hospitalization Proforma Number : " : "Accord pour hospitalisation Proforma No : "; + p_message += idProforma; + + p_message += "\n"; + + p_message += (codeLangueSociete=="en_US") ? "Voucher number : " : "No Bon : "; + p_message += numeroBonHospitalisation; + }else{ + p_message += (codeLangueSociete=="en_US") ? "refusal Proforma Number : " : "Refus Proforma No : "; + p_message += idProforma; + } + } + + envoyersms(p_destinataires, p_message, creation_message); +} + + +function liste_ententeprealables() +{ + retour = $("#retour").val(); + + if(retour==undefined){ + window.location.assign($("#racineWeb" ).val()+"Listeententeprealables/"); + }else{ + window.location.assign($("#racineWeb" ).val()+retour+"/"); + } +} + +function liste_actes_exclus() +{ + window.location.assign($("#racineWeb" ).val()+"Listeexclusions/"); +} + +function listeententeprealables() { + + + codePrestataire = $("#codePrestataire").val(); + + if(codePrestataire==undefined || codePrestataire=="undefined") + { + codePrestataire=""; + } + codeReponseEntentePrealable = $("#codeReponseEntentePrealable").val(); + debut = $("#debut").val(); + fin = $("#fin").val(); + + donnees = 'codePrestataire=' + codePrestataire + '&codeReponseEntentePrealable=' + codeReponseEntentePrealable; + donnees += '&debut=' + debut + '&fin=' + fin; + + $("#div_ententeprealable").html('
' + '
'); + + $.ajax({ + //url: $("#racineWeb").val() + "Ajaxententeprealables/", + url: $("#racineWeb").val() + "Ajaxententeprealables/entetesentente/", + type: 'post', + data: donnees, + error: function (errorData) { + }, + success: function (data) { + + $("#div_ententeprealable").html(data); + + + }, + complete: function () { + } + }); +} + + + + + +function accepter_ententeprealable_2(idDemandeententeprealable, facture) +{ + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb" ).val()+"Accepterententeprealables/"+idDemandeententeprealable+"/"); +} + +function refuser_ententeprealable_2(idDemandeententeprealable, facture) +{ + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb" ).val()+"Refuserententeprealables/"+idDemandeententeprealable+"/"); +} + +// + +function accepter_ententeprealable(idDemandeententeprealable, facture) +{ + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb" ).val()+"Accepterententeprealable/"+idDemandeententeprealable+"/"); +} + +function refuser_ententeprealable(idDemandeententeprealable, facture) +{ + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb" ).val()+"Refuserententeprealable/"+idDemandeententeprealable+"/"); +} + +function liste_ententeprealable_beneficiaire() +{ + window.location.assign($("#racineWeb" ).val()+"Listeententeprealablesbenficiaire/"); +} + +function liste_actes_exclus_beneficiaire() +{ + window.location.assign($("#racineWeb" ).val()+"Listeexclusionsbenficiaire/"); +} + +function enregistreraccordententepreslable_2() +{ + + + idDemandeententeprealable = $("#idDemandeententeprealable").val(); + motifReel = $("#motifReel").val(); + + quantiteModifiee = $("#quantiteModifiee").val(); + quantiteModifieeHospit = $("#quantiteModifieeHospit").val(); + + quantiteHospit = $("#quantiteHospit").val(); + + modeSaisieFeuille = $("#modeSaisieFeuille").val(); + // + //motifReel = "BON POUR ACCORD"; + + if (quantiteModifiee==undefined || quantiteModifiee ==""){ + quantiteModifiee = ""; + } + + if (quantiteModifieeHospit==undefined || quantiteModifieeHospit ==""){ + quantiteModifieeHospit = ""; + } + + if (quantiteHospit==undefined || quantiteHospit ==""){ + quantiteHospit = ""; + } + + if (motifReel == undefined || motifReel == "" || motifReel<=" ") + { + motifReel = "BON POUR ACCORD"; + } + + v_msg="Confirmez-vous cet accord?"; + v_msgEng="Do you confirm this agreement?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + codePrestataire = $("#codePrestataire").val(); + + donnees = 'idDemandeententeprealable='+idDemandeententeprealable + donnees += '&motifReel='+motifReel+'&codePrestataire='+codePrestataire + donnees += '&quantiteModifiee='+quantiteModifiee+'&quantiteModifieeHospit='+quantiteModifieeHospit; + donnees += '&quantiteHospit='+quantiteHospit; + + donnees_sav = donnees; + typeMail="accordententeprealable"; + typeSms = "accordententeprealable"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxententeprealablesbenficiaire/enregistreraccordententeprealable/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + if (modeSaisieFeuille !=1) { + preparesms(typeSms); + } + }, + complete: function() { + + v_msg="Accord envoyé avec succès!"; + v_msgEng="Agreement sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_ententeprealables(); + + } + }); + } else { + // L'utilisateur a annulé + console.log("Confirmation refusée"); + } + }); + +} + +function initbareme(){ + + v_msg="Voulez-vous réinitialiser la zone de sélection du barème?"; + v_msgEng="Do you want to reset the scale selection area?"; + + + confirm_ebene(v_msg, v_msgEng) + .then((isConfirmed) => { + if (isConfirmed) { + // L'utilisateur a confirmé + $('#idBaremePriseEnCharge').append($('