From 0c21151b635048ba1fae3497adc037259cfa7a54 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Sun, 15 Mar 2026 12:04:33 +0000 Subject: [PATCH] a --- Js/fonctions.js | 9071 +---------------------------------------------- 1 file changed, 1 insertion(+), 9070 deletions(-) diff --git a/Js/fonctions.js b/Js/fonctions.js index 110b475..9192a18 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -19744,9073 +19744,4 @@ function consulterfactureverres() }); } -function init_remplacer_medicament(idMedicament) -{ - donnees = 'idMedicament='+idMedicament; - - // alert(donnees); - // return; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailprescription/initremplacement/", - type: 'POST', - data: donnees, - success: function(data) { - }, - error: function(data) { - }, - complete: function() - { - $("#btn_remplacer_medicament").click(); - } - }); -} - -function consulter_remplacer_medicament() -{ - $("#div_liste_medicaments_remplaces").html('
' + '
'); - - $('#btn_medicaments_remplaces').click(); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailprescription/consulterremplacement/", - type: 'POST', - success: function(data) { - $("#div_liste_medicaments_remplaces").html(data); - }, - error: function(data) { - }, - complete: function() - { - // $('#btn_medicaments_remplaces').click(); - } - }); -} - -function ctrlkeypress_medicament_remplacement(ev) -{ - var keycode = (ev.keyCode ? ev.keyCode : ev.which); - if(keycode == '13') - { - afficher_pop_recherche_medicament_remplacement(); - } -} - -function afficher_pop_recherche_medicament_remplacement() -{ - nomsearch = $("#nomsearchrempl").val(); - - if (nomsearch > " ") - { - donnees = "valid=1&nomsearch="+nomsearch; - - // alert(donnees); - // return; - - $("#div_listemedicament_rempl").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxlistemedicaments/remplacement/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#div_listemedicament_rempl").html(data); - } - }); - } -} - -function selectionner_medicament_pop_rempl(codeMedicament, libelleMedicament) -{ - $("#codeMedicament_pop_rempl").val(codeMedicament); - $("#libelleMedicament_pop_rempl").val(libelleMedicament); -} - -/** - * Remplace un médicament dans une prescription - * - Vérifie qu'un médicament a été sélectionné - * - Demande confirmation avec le nom du médicament - * - Envoie la requête de remplacement au serveur - * - Rafraîchit l'affichage de la prescription - */ -async function remplacer_medicament() { - // Récupération des valeurs du formulaire - const codeMedicamentNouv = $("#codeMedicament_pop_rempl").val(); - const libelleMedicamentNouv = $("#libelleMedicament_pop_rempl").val(); - - // Validation de la sélection - if (!codeMedicamentNouv || codeMedicamentNouv.trim() <= " ") { - alert_ebene("Veuillez sélectionner un médicament!", "Please select a medicine/drug!"); - return; - } - - // Préparation des messages dynamiques - const messages = { - fr: `Prescrire : ${libelleMedicamentNouv}?`, - en: `Prescribe : ${libelleMedicamentNouv}?` - }; - - // Demande de confirmation - const confirmation = await confirm_ebene_sweet(messages.fr, messages.en); - if (!confirmation) return; - - // Configuration de la requête - const url = `${$("#racineWeb").val()}Ajaxdetailprescription/remplacermedicament/`; - const donnees = `codeMedicamentNouv=${encodeURIComponent(codeMedicamentNouv)}`; - - // Envoi de la requête - try { - await $.ajax({ - url: url, - type: 'POST', - data: donnees - }); - - // Rafraîchissement de l'affichage - prescription_medicament(); - - } catch (error) { - console.error("Erreur lors du remplacement du médicament", error); - } -} - -var formatCurrency = function(num){ - var str = num.toString().replace("", ""), parts = false, output = [], i = 1, formatted = null; - if(str.indexOf(".") > 0) { - parts = str.split("."); - str = parts[0]; - } - str = str.split("").reverse(); - for(var j = 0, len = str.length; j < len; j++) { - if(str[j] != " ") { - output.push(str[j]); - if(i%3 == 0 && j < (len - 1)) { - output.push(" "); - } - i++; - } - } - formatted = output.reverse().join(""); - return(formatted + ((parts) ? "." + parts[1].substr(0, 2) : "")); -}; - -$(function() { - // Initialisation des composants - appliquerDataTable(); - dataTableSpeciale(); - afficheGaranties(); - afficherficheconsultation(); - afficheDivPlafond(); - - // Variables globales - const nomForm = $('#nomForm').val(); - const racineWeb = $("#racineWeb").val(); - - // Rafraîchir les notifications toutes les 10 secondes - setInterval(raffraichier_messagerie, 10000); - - // Gestion des différents formulaires - const formHandlers = { - chambre: handleChambreForm, - miseEnObservation: handleMiseEnObservationForm, - frmactesmedicaux: handleActesMedicauxForm, - prescriptionexamens: handlePrescriptionExamensForm, - prescriptionmedicament: handlePrescriptionMedicamentForm, - pharmacie: handlePharmacieForm, - pharmacien: handlePharmacienForm, - Optique: handleOptiqueForm, - ficheBeneficiaire: handleFicheBeneficiaireForm, - proformahospitalisation: handleProformaHospitalisationForm, - hospitalisationproforma: handleHospitalisationProformaForm, - feuillemaladie: handleFeuilleMaladieForm - }; - - if (formHandlers[nomForm]) { - formHandlers[nomForm](); - } - - // Initialisation de la recherche - initSearch(); -}); - -// Fonctions de gestion des formulaires -function handleChambreForm() { - const avisHospitalisation = $('#avisHospitalisation').val(); - const numeroBonHospitalisation = $('#numeroBonHospitalisation').val(); - const typeHospitalisation = $('#typeHospitalisation').val(); - - if (avisHospitalisation == "1" && numeroBonHospitalisation <= "0") { - creerbonhospitalisation(); - } else if (avisHospitalisation == "2") { - return false; - } else if ((!typeHospitalisation || typeHospitalisation == undefined) && numeroBonHospitalisation == "0") { - return false; - } else { - cach(); - const noChambre = $("#noChambre").val(); - - $("#div_selection").hide(); - - if (!noChambre || noChambre.trim() === "") { - const v_msg = "Veuillez entrer le numero de chambre!"; - const v_msgEng = "Please enter the room number!"; - alert_ebene(v_msg, v_msgEng); - $("#noChambre").focus(); - return; - } - - $("#searchExam").keyup(debounce(function() { - const libelle = $(this).val(); - if (libelle.length >= 3) { - examenhospitalisation(libelle); - } else { - $("#div_selection").hide(); - } - }, 300)); - } -} - -function handleMiseEnObservationForm() { - let codeFamilleActeObs = $('#codeFamilleActeObs').val(); - if (!codeFamilleActeObs) { - $('#codeFamilleActeObs').val("FA008"); - $('#codeFamilleActe').val("FA008"); - } - ajaxactespossibles_miseenobservation(); -} - -function handleActesMedicauxForm() { - const codeFamilleActeMed = $('#codeFamilleActeMed').val(); - if (codeFamilleActeMed) { - ajaxactespossibles_selection(); - } -} - -function handlePrescriptionExamensForm() { - ajax_demande_accord_examen(); -} - -function handlePrescriptionMedicamentForm() { - const prescriptionSiCritereBareme = $('#prescriptionSiCritereBareme').val(); - const statut = $('#statut').val(); - - if (prescriptionSiCritereBareme == "0" || statut != "1") { - const libelleMotif = $("#libelleMotif").val(); - const libelleMotifEng = $("#libelleMotifEng").val(); - faireDefileMessage(libelleMotif, libelleMotifEng); - } -} - -function handlePharmacieForm() { - const codeActe = "PH"; - getstatutacte(codeActe); - - const nbreLigne = parseInt($("#nbreLigne").val()); - if (nbreLigne > 0) { - for (let i = 1; i <= nbreLigne; i++) { - $("#div_selection"+i).hide(); - } - } -} - -function handlePharmacienForm() { - const codeActe = "PH"; - getstatutacte(codeActe); -} - -function handleOptiqueForm() { - const prescriptionSiCritereBareme = $('#prescriptionSiCritereBareme').val(); - const statut = $('#statut').val(); - - if (prescriptionSiCritereBareme == "0" || statut != "1") { - const libelleMotif = $("#libelleMotif").val(); - const libelleMotifEng = $("#libelleMotifEng").val(); - faireDefileMessage(libelleMotif, libelleMotifEng); - } -} - -function handleFicheBeneficiaireForm() { - const codeMedecin = $('#codeMedecin').val(); - const codeActe = $('#codeActe').val(); - - if (codeActe && codeActe.trim() !== "" && codeMedecin && codeMedecin.trim() !== "") { - ajaxprixacte(); - getstatutacte(codeActe); - } -} - -function handleProformaHospitalisationForm() { - $("#div_selectionB").hide(); - - $("#searchInputB").keyup(debounce(function() { - const numero = $(this).val(); - if (numero.length >= 2) { - chargernumero(numero); - } else { - $("#div_selectionB").hide(); - } - }, 300)); - - const idBeneficiaire = $("#idBeneficiaire").val(); - ajax_beneficiaire_contexte(idBeneficiaire); - - if (idBeneficiaire > "0") { - ajaxbeneficiairecouvert(idBeneficiaire); - } - - affichedetailproformahopitalisation(); -} - -function handleHospitalisationProformaForm() { - afficherMasquerEnteteProforma(); - affichedetailproformahopitalisation(); -} - -function handleFeuilleMaladieForm() { - const bonCaduc = $("#bonCaduc").val(); - const facture = $("#facture").val(); - const codeAffection = $("#codeAffection").val(); - const contestation = $("#contestation").val(); - - if (codeAffection == "990" && contestation == "0" && facture == "0" && bonCaduc == "0") { - showAffectionTooltip(); - } -} - -function showAffectionTooltip() { - const codeLangue = $("#codeLangue").val(); - const p_msg_eng = "Click this button to add at least one condition to your medical record!"; - const p_msg = "Cliquer sur ce bouton pour ajouter, au moins, une affection au dossier médical!"; - const message = codeLangue == "en_US" ? p_msg_eng : p_msg; - - const tooltip = $(` -
-
${message}
-
- `); - - $('#btn_pop_affection').after(tooltip); - - function positionTooltip() { - const btn = $('#btn_pop_affection'); - const btnRect = btn[0].getBoundingClientRect(); - const tooltipDiv = $('.custom-tooltip'); - - const leftPosition = btnRect.left + (btnRect.width / 2) - (tooltipDiv.outerWidth() / 2); - const adjustedLeft = Math.max(10, leftPosition); - const maxRight = window.innerWidth - tooltipDiv.outerWidth() - 10; - const finalLeft = Math.min(adjustedLeft, maxRight); - - tooltip.css({ - 'top': btnRect.bottom + window.scrollY + 'px', - 'left': finalLeft + 'px' - }); - } - - positionTooltip(); - $(window).on('resize', positionTooltip); - - $(document).on('click', function(e) { - if (!$(e.target).closest('#btn_pop_affection').length && - !$(e.target).closest('.custom-tooltip').length) { - tooltip.remove(); - $(window).off('resize', positionTooltip); - $(document).off('click', arguments.callee); - } - }); -} - -function initSearch() { - $("#div_selection").hide(); - - $("#searchInput").keyup(debounce(function() { - const libelle = $(this).val().trim(); - - if (!libelle || libelle.length < 3) { - $("#div_selection").hide(); - return; - } - - const formHandlers = { - "prescriptionexamens": { - link: "Ajaxchargeractesexamen/", - data: { libelle: libelle } - }, - "prescriptionmedicament": { - link: "Ajaxchargerlistemedicaments/", - data: { libelle: libelle } - }, - "chambre": { - link: "Ajaxchargeractesexamenhospitalisation/", - data: { libelle: libelle } - }, - "dentaire": { - link: "Ajaxchargeractesdentisterie/", - data: { libelle: libelle } - }, - "proformahospitalisation": { - link: "Ajaxchargeractesproformahospitalisation/", - preCheck: checkProformaRequirements, - data: function() { - return { - libelle: libelle, - idBeneficiaire: $("#idBeneficiaire").val() - }; - } - }, - "hospitalisationproforma": { - link: "Ajaxchargeractesproformahospitalisation/", - preCheck: checkProformaRequirements, - data: function() { - return { - libelle: libelle, - idBeneficiaire: $("#idBeneficiaire").val() - }; - } - } - }; - - const handler = formHandlers[$('#nomForm').val()]; - if (!handler) return; - - // Vérification des prérequis si nécessaire - if (handler.preCheck && !handler.preCheck()) { - return; - } - - // Préparation des données - const data = typeof handler.data === 'function' ? handler.data() : handler.data; - - // Envoi de la requête AJAX - $.ajax({ - type: "POST", - url: $("#racineWeb").val() + handler.link, - data: data, - beforeSend: function() { - $("#searchInput").css("background", "#FFF url(Bootstrap/images/LoaderIcon.gif) no-repeat 165px"); - }, - success: function(data) { - $("#div_selection").show().html(data); - $("#searchInput").css("background", "#FFF"); - }, - error: function(xhr, status, error) { - console.error("Erreur lors de la recherche:", error); - $("#searchInput").css("background", "#FFF"); - } - }); - }, 300)); -} - -function checkProformaRequirements() { - const idBeneficiaire = $("#idBeneficiaire").val(); - const motif = $("#motif").val(); - const dateDebut = $("#dateDebut").val(); - const duree = $("#duree").val(); - - if (!idBeneficiaire || idBeneficiaire.trim() === "") { - const v_msg = "Veuillez sélectionner un No Bénéficiaire!"; - const v_msgEng = "Please select a Beneficiary Number!"; - alert_ebene(v_msg, v_msgEng); - $("#searchInput").val('').focus(); - $("#searchInputB").focus(); - return false; - } - - if (!motif || motif.trim() === "") { - const v_msg = "Veuillez renseigner le motif d'hospitalisation!"; - const v_msgEng = "Please fill in the reason for hospitalization!"; - alert_ebene(v_msg, v_msgEng); - $("#searchInput").val('').focus(); - $("#motif").focus(); - return false; - } - - if (!dateDebut || dateDebut.trim() === "") { - const v_msg = "Veuillez saisir la date de début!"; - const v_msgEng = "Please enter the start date!"; - alert_ebene(v_msg, v_msgEng); - $("#searchInput").val('').focus(); - $("#dateDebut").focus(); - return false; - } - - if (duree == "0") { - const v_msg = "Veuillez renseigner le nombre de jours prévisionnels d'hospitalisation!"; - const v_msgEng = "Please fill in the estimated number of days of hospitalization!"; - alert_ebene(v_msg, v_msgEng); - $("#searchInput").val('').focus(); - $("#duree").focus(); - return false; - } - - return true; -} - -// Fonction debounce pour limiter les appels fréquents -function debounce(func, wait, immediate) { - let timeout; - return function() { - const context = this, args = arguments; - const later = function() { - timeout = null; - if (!immediate) func.apply(context, args); - }; - const callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - if (callNow) func.apply(context, args); - }; -} - -function actualiserFeuillemaladie() -{ - - feuillemaladie(); -} - -function affichelistemedicament() -{ - var libelle = $('#searchInput').val(); - - if(libelle!='' && libelle.length >="3") - { - var donnees = 'libelle='+ libelle; - - vLink = "Ajaxchargermedicamentsubstitution/"; - $.ajax({ - type: "POST", - url: $("#racineWeb").val()+vLink, - data:donnees, - beforeSend: function(){ - $("#searchInput").css("background","#FFF url(Bootstrap/images/LoaderIcon.gif) no-repeat 165px"); - }, - success: function(data){ - $("#div_selection").show(); - $("#div_selection").html(data); - $("#searchInput").css("background","#FFF"); - } - }); - }else{ - $("#div_selection").hide(); - return false; - } -} - - -function selectElement(val){ - - $("#searchInput").val(val); - $("#div_selection").hide(); -} - -function enregistrerprescriptionmedicatement(numeroBon,codeMedecin,codeGestionBon) -{ - - - donnees = 'numeroBon='+numeroBon+'&codeMedecin='+codeMedecin; - donnees += '&codeGestionBon='+codeGestionBon; - - $("#btn_enreg").disable(); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerprescription/enregistrerprescription/", - type : 'post', - data: donnees, - error: function(errorData) - { - }, - success: function(data) - { - $('#div_test_gabarit').html(data); - }, - complete: function() { - - window.location.assign($("#racineWeb" ).val()+"Prescription/"); - } - }); - -} - - -// Applique la librairie DataBase sur les tableaux -function appliquerDataTable(){ - var sc = $(window).scrollTop(), - dh = $(document).height(), - ch = $(window).height(); - scrollPercent = (sc / (dh-ch)) * 100; - - try{ - var oTable = $('.tabliste').DataTable({ - "lengthMenu": [ 50, 100, 150], - "scrollX": true, - "scrollY": "75vh", - "pagingType": "full_numbers", - "autoWidth": false, - "language": { - "lengthMenu":"_MENU_", - "zeroRecords": "D\u00e9sol\u00e9 - Aucune donn\u00e9e trouv\u00e9e", - "info": "_PAGE_ sur _PAGES_ pages", - "infoEmpty": "Pas d'enregistrement", - "search": "Recherche:", - "paginate": { - "next": "►", - "previous": "◄", - "first": "|◄", - "last": "►|" - }, - "infoFiltered": "(filtr\u00e9 de _MAX_ total enregistrements)" - } - }); - /* - $(window).bind('resize', function () { - oTable.fnAdjustColumnSizing(false); - }); - */ - } - catch(err){ - return false; - } - -} - -function facturepartielle() -{ - affectionObligatoire=$("#affectionObligatoire").val(); - codeAffection=$("#codeAffection").val(); - modeSaisieFacture=$("#modeSaisieFacture").val(); - - if (affectionObligatoire=="1" && codeAffection=="990" && modeSaisieFacture!="1") - { - v_msg="Diagnostique exig\u00e9!"; - v_msgEng="Diagnosis required!"; - alert_ebene(v_msg, v_msgEng); - - $("#libelleAffection").focus(); - $("#btn_pop_affection").click(); - - return; - } - - // POUR LES CONSULTATIONS A ENTENTE PREALBLE - ententePrealableCons=$("#ententePrealableCons").val(); - - if (ententePrealableCons=="2" || ententePrealableCons=="9" ) - { - v_msg="Veuillez attendre l'accord de l'assureur!"; - v_msgEng="Please wait for insurer approval!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - if (ententePrealableCons=="9" ) - { - v_msg="Non autoris\u00e9 car l'acte consultation a \u00e9t\u00e9 r\u00e9fus\u00e9 par l'assureur!"; - v_msgEng="Not authorized because the consultation act was refused by the insurer!"; - alert_ebene(v_msg, v_msgEng); - return; - } - /////////////// - //alert("La Facturation partielle est actuellement en cours de construction! Veuillez cliquer sur le sous-menu \"Fermer Doss\" en dessous, pour clôturer le dossier du patient ainsi que sa prise en compte par l'assureur. Merci pour votre compr\u00e9hension!"); - - //return; - - actVisible=$("#actVisible").val(); - if (actVisible!="1") - { - v_msg="Non autoris\u00e9 car l'utilisateur n'a pas les droits requis. Veuillez contacter l'assureur!"; - v_msgEng="Not authorized because the user does not have the required rights. Please contact the insurer!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - var nomForm = $('#nomForm').val(); - - if(nomForm == "Listefacturepartielle"){ - window.location.assign($("#racineWeb" ).val()+"Listefacturepartielle/"); - }else{ - - window.location.assign($("#racineWeb" ).val()+"Facturepartielle/"); - - } -} - - -function imprimerfacturepartielle(idPrestationactes, codeTypePrestation) -{ - if (idPrestationactes>"0") - { - - if (codeTypePrestation == 'HOSP'){ - print_hospitalisation(); - }else{ - - donnees = "idPrestationactes="+idPrestationactes+"&codeTypePrestation="+codeTypePrestation; - - var div_export = $('#div_facture_partielle'); - div_export.html('
' + '
'); - - $("#btn_facture_partielle").click(); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaximprimerfacturepartielle/", - type: 'POST', - data: donnees, - success: function(data) - { - div_export.html(data); - //facturepartielle(); - }, - error : function(resultat, statut, erreur) - { - }, - complete: function(data) - { - // - - } - }); - } - } - else - { - v_msg="Rien \u00e0 imprimer!"; - v_msgEng="Nothing to print!"; - alert_ebene(v_msg, v_msgEng); - - return; - } -} - - -function actualisefacpartielle() -{ - facturepartielle(); - -} - - -function dataTableSpeciale(){ - try{ - $('.tabspeciale').DataTable({ - "lengthMenu": [ 20, 50, 100], - "scrollX": true, - "scrollY": "75vh", - "pagingType": "full_numbers", - "autoWidth": false, - "bFilter": false, - "bLengthChange": false, - "orderMulti": true, - "language": { - "lengthMenu":"Affiche _MENU_ par page", - "zeroRecords": "D\u00e9sol\u00e9 - Aucune donn\u00e9e trouv\u00e9e", - "info": "_PAGE_ sur _PAGES_ pages", - "infoEmpty": "Pas d'enregistrement", - "search": "Recherche:", - "paginate": { - "next": "?", - "previous": "?", - "first": "|?", - "last": "?|" - }, - "infoFiltered": "(filtr\u00e9 de _MAX_ total enregistrements)" - } - }); - - } - catch(err){ - return false; - } -} - -// 19/05/2021 - -function supprimer_miseenobservation() -{ - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectactesmedicauxobservation/supprimermiseenobservation/", - type: 'POST', - data: donnees, - success: function(data) { - feuillemaladie(); - }, - error: function(data) { - }, - complete: function() { - - } - }); - -} - -// 24/05/2021 - -function select_prestatation_a_facturer(p_choix, idPrestationactes) -{ - - donnees = 'idPrestationactes='+idPrestationactes; - donnees += '&choix='+p_choix; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfacturepartielle/selectionnerunacte/", - type: 'POST', - data: donnees, - success: function(data) { - //$("#div_liste_actes").html(data); - facturepartielle(); - }, - error: function(data) { - }, - complete: function() { - - } - }); -} - -function selectionner_tous_actes_a_facturer() -{ - - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfacturepartielle/selectionnertous/", - type: 'POST', - data: donnees, - success: function(data) { - //$("#div_liste_actes").html(data); - facturepartielle(); - }, - error: function(data) { - }, - complete: function() { - } - }); -} - -function annuler_selection_actes_a_facturer() -{ - - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfacturepartielle/annulerselection/", - type: 'POST', - data: donnees, - success: function(data) { - $("#div_liste_actes").html(data); - //facturepartielle(); - }, - error: function(data) { - }, - complete: function() { - } - }); -} - -function imprimerfactureselection(idEnteteFacture) -{ - var nbreSelec = $('#nbreSelec').val(); - - if(nbreSelec==undefined && idEnteteFacture > 0){ - nbreSelec = idEnteteFacture; - } - - if(nbreSelec > 0 ){ - - donnees = 'idEnteteFacture='+idEnteteFacture; - - - var div_export = $('#div_facture_selection'); - div_export.html('
' + '
'); - - $("#btn_facture_selection").click(); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaximprimerfacturepartielleselection/", - type: 'POST', - data: donnees, - success: function(data) - { - div_export.html(data); - //facturepartielle(); - }, - error : function(resultat, statut, erreur) - { - }, - complete: function(data) - { - // - - } - }); - - }else{ - v_msg="Rien \u00e0 imprimer!"; - v_msgEng="Nothing to print!"; - alert_ebene(v_msg, v_msgEng); - - return; - } -} - - -/** - * Supprime une facture sélectionnée après confirmation - * @param {number} idEnteteFacture - ID de l'entête de facture à supprimer - * @param {string} numeroFacture - Numéro de facture pour l'affichage - */ -async function supprimefactureselection(idEnteteFacture, numeroFacture) { - // Préparation des données et messages - const donnees = `idEnteteFacture=${idEnteteFacture}`; - const messages = { - fr: `Confirmez-vous la suppression de la facture ${numeroFacture}?`, - en: `Do you confirm suppression of invoice ${numeroFacture}?` - }; - - // Configuration de l'URL - const url = `${$("#racineWeb").val()}Ajaxlistefacturepartielle/supprimefactureselection/`; - - // Demande de confirmation - const confirmation = await confirm_ebene_sweet(messages.fr, messages.en); - if (!confirmation) return; - - // Exécution de la suppression - try { - await $.ajax({ - url: url, - type: 'POST', - data: donnees - }); - - // Rafraîchissement de l'affichage - facturepartielle(); - - } catch (error) { - console.error("Erreur lors de la suppression de la facture", error); - } -} - -/** - * Supprime une facture partielle après confirmation utilisateur - * @param {number} idPrestationactes - ID de la prestation à supprimer - * @param {string} numeroFacture - Numéro de facture pour affichage dans la confirmation - */ -async function supprimefacturepartielle(idPrestationactes, numeroFacture) { - // Préparation des données - const donnees = `idPrestationactes=${idPrestationactes}`; - const url = `${$("#racineWeb").val()}Ajaxlistefacturepartielle/supprimefacturepartielle/`; - - // Messages de confirmation (incluant le numéro de facture) - const messages = { - fr: `Confirmez-vous la suppression de la facture ${numeroFacture}?`, - en: `Do you confirm suppression of invoice ${numeroFacture}?` - }; - - // Demande de confirmation - const confirmation = await confirm_ebene_sweet(messages.fr, messages.en); - if (!confirmation) return; - - // Exécution de la suppression - try { - await $.ajax({ - url: url, - type: 'POST', - data: donnees - }); - - // Rafraîchissement de l'affichage - facturepartielle(); - - } catch (error) { - console.error("Erreur lors de la suppression de la facture partielle", error); - // Potentiellement ajouter un message d'erreur utilisateur ici - } -} - -// 28/05/2021 - -function afficher_liste_recherche_medicament() -{ - libelleMedicamentSearch = $("#libelleMedicamentSearch").val(); - - if(libelleMedicamentSearch<=" ") - { - v_msg="Entrez le nom du m\u00e9dicament à rechercher"; - v_msgEng="Enter the name of drug for search"; - - alert_ebene(v_msg,v_msgEng); - - $("#libelleMedicamentSearch").focus(); - return false; - } - - donnees = "valid=1&libelleMedicamentSearch="+libelleMedicamentSearch; - - $("#div_liste_medicament").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxlistemedicamentsubstitution/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#div_liste_medicament").html(data); - //dataTableSpeciale(); - } - }); -} - -function ctrlkeypress_sub(ev) -{ - var keycode = (ev.keyCode ? ev.keyCode : ev.which); - if(keycode == '13') - { - afficher_liste_recherche_medicament(); - } -} - -function selectionner_medicament_sub(idMedicament, codeMedicament, libelleMedicament, prix) -{ - $("#idSubstitut").val(idMedicament); - $("#codeSubstitut").val(codeMedicament); - $("#libelleSubstitut").val(libelleMedicament); - $("#libelleMedicamentSearch").val(libelleMedicament); - $("#prixPublicSubstitut").val(prix); - - $("#prixPublicSubstitut").focus(); - $("#prixSubstitut").focus(); - - $("#div_liste_medicament").empty(); -} - -function ajax_maj_valeurActe_detailoptique(idDetail, valeurActe, controle){ - - valeurActe=valeurActe.replace(",","."); - valeurActe=valeurActe.replace(/ /g,""); - - controle.value=valeurActe; - - if(controle_numerique(controle)) - { - if(valeurActe==0) - { - - v_msg="Veuillez saisir le prix!"; - v_msgEng="Please enter the price!"; - alert_ebene(v_msg, v_msgEng); - - controle.focus(); - return; - } - - donnees = 'idDetail='+idDetail; - donnees += "&valeurActe="+valeurActe; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailopticien/majprix/", - type: 'POST', - data: donnees, - success: function(data) { - // $("#medicaments").html(data); - $("#livraison").html(data); - }, - error: function(data) { - }, - complete: function() { - - controle.focus(); - - actualiser_opticien(); - } - }); - } - -} - -function ajax_maj_quantite_detailoptique(idDetail, quantite, 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 = 'idDetail='+idDetail - donnees += "&quantite="+quantite; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailopticien/majquantite/", - type: 'POST', - data: donnees, - success: function(data) { - // $("#medicaments").html(data); - $("#livraison").html(data); - }, - error: function(data) { - }, - complete: function() { - - - controle.focus(); - - actualiser_opticien(); - } - }); - -} - -// 13/07/2021 -function ajaxplafondacteoptique() -{ - - codeActe = $("#codeActe").val(); - datePrescription = $("#datePrescription").val(); - - - if (codeActe<=" ") - { - v_msg="Veuillez s\u00e9lectionner un acte!"; - v_msgEng="Please select an act!"; - alert_ebene(v_msg, v_msgEng); - $("#codeActe").focus(); - return; - } - - donnees = 'codeActe='+codeActe+'&datePrescription='+datePrescription; - - //$("#div_plafond").html('
' + '
'); - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailopticien/plafondacte/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#div_plafond").html(data); - - }, - complete: function() { - } - }); -} - -function prescrire_acte_opt() -{ - - var statutActe = $("#statutActe").val(); - var libelleMotif = $("#libelleMotif").val(); - var libelleMotifEng = $("#libelleMotifEng").val(); - - - if(statutActe != "1") - { - alert_ebene(libelleMotif, libelleMotifEng); - - faireDefileMessage(libelleMotif, libelleMotifEng); - return; - }else{ - - faireDefileMessage("", ""); - - codePrestatairePrescription = $("#codePrestatairePrescription").val(); - codeActe = $("#codeActe").val(); - - soldeConsommation = $("#soldeConsommation").val(); - - if(soldeConsommation==undefined){ - soldeConsommation = "9999999999"; - }else{ - soldeConsommation = soldeConsommation.replace(/ /g,""); - } - - soldeNbreTransaction = $("#soldeNbreTransaction").val(); - - if(soldeNbreTransaction == undefined){ - soldeNbreTransaction = "999"; - } - - if (codeActe<=" ") - { - v_msg="Veuillez s\u00e9lectionner un acte!"; - v_msgEng="Please select an act!"; - alert_ebene(v_msg, v_msgEng); - - $("#codeActe").focus(); - return; - } - - donnees = 'codeActe='+codeActe; - donnees += '&soldeConsommation='+soldeConsommation; - donnees += '&soldeNbreTransaction='+soldeNbreTransaction; - - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailopticien/ajouteracteprescription/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#btn_close_pop_verre").click(); - $("#livraison").html(data); - }, - complete: function() { - //actualiser_opticien(); - } - }); - - } - -// Fin Ajout à la prescription -} - -function clignotte(obj){ - setInterval(function(){obj.style.visibility= (obj.style.visibility=='visible')?'hidden':'visible';},5000); -} - - -/** - * Supprime un acte optique après vérification et confirmation - * @param {number} idDetail - ID de l'acte à supprimer - * @param {string} codeReponseEntentePrealable - Code statut de l'entente préalable - * @returns {void} - */ -async function supprimer_acte_opticien(idDetail, codeReponseEntentePrealable) { - // Vérification préalable si la suppression est autorisée - if (codeReponseEntentePrealable === '2') { - alert_ebene("Suppression impossible!", "Deletion not possible!"); - return; - } - - // Configuration des messages - const messages = { - fr: "Confirmez-vous la suppression de cet acte?", - en: "Do you confirm the removal of this act?", - confirmText: { - fr: "Oui", - en: "Yes" - }, - cancelText: { - fr: "Non", - en: "No" - } - }; - - // Demande de confirmation - const confirmation = await confirm_ebene_sweet(messages.fr, messages.en); - if (!confirmation) return; - - // Préparation de la requête - const donnees = `idDetail=${idDetail}`; - const url = `${$("#racineWeb").val()}Ajaxdetailopticien/supprimeracte/`; - - try { - // Exécution de la suppression - const data = await $.ajax({ - url: url, - type: 'POST', - data: donnees - }); - - // Mise à jour de l'interface - $("#livraison").html(data); - opticien(); - - } catch (error) { - console.error("Erreur lors de la suppression de l'acte", error); - // Ajouter ici un message d'erreur utilisateur si nécessaire - } -} - -function reinitialiser_plafond() -{ - $("#codeActe").val(""); - - $("#div_plafond").html(''); - - $("#close_pop").click(); -} - -function referencer(codeReference) -{ - if($('#referencer').val()=="1") - { - $("#codeReferencement").val(codeReference); - } - else - { - $("#codeReferencement").val("0"); - } -} - - -function affiche_prix_mediacment_substitution(controle) -{ - - if(controle!='' && controle.length >="10"){ - var str = controle.split(' <==> '); - var codeMedicament = str[0]; - var libelleMedicament = str[1]; - - //alert(str[4]); return; - - //$('#ententePrealableSubstitut').val(dstr[2]); - - donnees = 'codeMedicament='+codeMedicament+'&libelle='+libelleMedicament; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxsubstitutionmedicament/prixsubstitut/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - var dstr = data.split('/'); - - $("#prixPublicSubstitut").val(parseInt(dstr[0])); - $('#idSubstitut').val(parseInt(dstr[1])); - - $('#ententePrealableSubstitut').val(dstr[2]); - - - $("#libelleSubstitut").val(libelleMedicament); - - }, - complete: function() { - } - }); - }else{ - return false; - } - -} - -function affiche_info_mediacment_substitution(controle) -{ - - if(controle!='' && controle.length >="10"){ - var str = controle.split(' <==> '); - var libelle = str[0]; - - donnees = 'libelle='+libelle; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxsubstitutionmedicament/infosubstitut/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - var dstr = data.split('/'); - - $("#prixPublicSubstitut").val(parseInt(dstr[0])); - $('#idSubstitut').val(parseInt(dstr[1])); - - $("#libelleSubstitut").val(libelle); - - }, - complete: function() { - } - }); - }else{ - return false; - } - -} - - -/** - * Ajoute un médicament à la prescription après validation - * @param {string} controle - Chaîne contenant les informations du médicament (code, libellé, etc.) - */ -async function add_selected_drug(controle) { - // Vérification du formulaire pharmacien - if ($("#nomForm").val() === "pharmacien") { - affiche_prix_mediacment_substitution(controle); - return; - } - - // Vérification du nombre maximum de médicaments - const hospitalisation = $("#hospitalisation_C").val(); - const miseEnObservation = $("#miseEnObservation_C").val(); - const nbMedicamentMax = parseInt($("#nbMedicamentMax").val()); - const nbMedicamentSaisie = parseInt($("#nbMedicamentSaisie").val()); - - if (nbMedicamentSaisie >= nbMedicamentMax && hospitalisation !== "1" && miseEnObservation !== "1") { - alert_ebene("Attention! Maximum de médicaments atteint!", "Warning! Maximum drugs reached!"); - return; - } - - // Extraction des données du médicament - const [codeMedicament, libelleMedicament, , exclu, , ententePrealableStr] = controle.split(' <==> '); - const ententePrealable = ententePrealableStr === "Demander Accord" ? 1 : 0; - - // Avertissement si médicament non remboursé - if (exclu === "Non garanti") { - alert_ebene( - "Ce médicament n'est pas remboursé par l'assureur!", - "This drug is not reimbursed by the insurer!" - ); - } - - // Demande de confirmation - const confirmation = await confirm_ebene_sweet( - `Confirmez-vous cet médicament : ${libelleMedicament}?`, - `Do you confirm these medications : ${libelleMedicament}?` - ); - - if (!confirmation) return; - - // Affichage du loader - afficherLoader("#medicaments"); - - // Envoi des données - try { - await $.ajax({ - url: `${$("#racineWeb").val()}Ajaxdetailprescription/ajoutermedicament/`, - type: 'POST', - data: `codeMedicament=${codeMedicament}&ententePrealable=${ententePrealable}` - }); - - // Rafraîchissement de l'affichage - prescription_medicament(); - - } catch (error) { - console.error("Erreur lors de l'ajout du médicament", error); - } -} - - -function add_selected_exam(controle) { - - - let motifExamen = $("#motifExamen").val(); - let prescriptionSiCritereBareme = $("#prescriptionSiCritereBareme").val(); - - // Vérifie si le motif de l'examen est renseigné - if (motifExamen <= " ") { - v_msg = "Veuillez entrer le motif de la prescription d'examen !"; - v_msgEng = "Please enter the reason for the examination prescription!"; - alert_ebene(v_msg, v_msgEng); - - $("#codeActe").val(""); - $("#motifExamen").focus(); - return; - } - - let str = controle.split(' <==> '); - let codeActe = str[0]; - let libelleActe = str[1]; - let codeGarantie = str[2]; - let acteExclu = str[3]; - let ententePrealable = str[4]; - - let datePrescription = $("#datePrescription").val(); - let prixTarif = "0"; - let statut = isStatut(codeActe); - - // Vérifie si l'acte est autorisé selon le statut et la prescription - if (statut != '1' && prescriptionSiCritereBareme == "0") { - v_msg = "Cet acte n'est pas autorisé !"; - v_msgEng = "This act is not allowed!"; - alert_ebene(v_msg, v_msgEng); - - getstatutacte(codeActe); - $('#searchInput').val(''); - $("#div_selection").hide(); - return; - } - - // Conversion de chaînes vers booléens - acteExclu = (acteExclu == "Garanti") ? 0 : 1; - ententePrealable = (ententePrealable == "Demander Accord") ? 1 : 0; - - if (libelleActe <= " ") { - $("#codeActe").focus(); - return; - } - - // Vérifie si l'acte est exclu - if (acteExclu == 1) { - v_msg = "Acte non couvert !"; - v_msgEng = "Not covered!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - // Texte de confirmation - let v_msg = "Confirmez-vous cet acte : " + libelleActe + " ?"; - let v_msgEng = "Do you confirm this act : " + libelleActe + " ?"; - - /** - * Remplacement de la logique SweetAlert par confirm_ebene_sweet_callback() - * confirm_ebene_sweet_callback(msgFr, msgEn, callback) - * Affiche un popup de confirmation dans la bonne langue, et exécute callback() si l'utilisateur confirme. - */ - confirm_ebene_sweet_callback(v_msg, v_msgEng, function () { - let donnees = 'codeActe=' + codeActe + '&ententePrealable=' + ententePrealable; - donnees += '&prixTarif=' + prixTarif; - - if (ententePrealable == 1) { - let numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); - donnees += '&numeroFeuilleMaladie=' + numeroFeuilleMaladie + '&typeMail=mailententeprealable'; - } - - $("#examens").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val() + "Ajaxdetailprescriptionexamen/ajouterexamen/", - type: 'post', - data: donnees, - error: function (errorData) { - // Gérer les erreurs si nécessaire - }, - success: function (data) { - // Gérer le succès si nécessaire - }, - complete: function (data) { - // Recharge la liste des examens après ajout - prescription_examen(); - } - }); - }); -} - - -function afficheDetailPrescriptionExamen(){ - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailprescriptionexamen/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#examens").html(data); - }, - complete: function() { - } - }); - -} - - -function generercodereference() -{ - var d = new Date(); - var date = d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate(); - - var minNumber = 1; // le minimum - var maxNumber = 100; // le maximum - var randomnumber = Math.floor(Math.random() * (maxNumber + 1) + minNumber); // la fonction magique - - $("#codeReference").val(date+'-'+randomnumber); - - $("#codeReferencement").val(date+'-'+randomnumber); - - $("#dureeCode").val(1); - $("#dureeCode").readable(); - - maj_beneficiaire(); - -} - -function maj_beneficiaire(){ - - var codeReference = $("#codeReference").val(); - var dureeCode = $("#dureeCode").val(); - - donnees = 'codeReference='+codeReference+'&dureeCode='+dureeCode; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxmajbeneficiaire/majbeneficiaire/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - }, - complete: function() { - } - }); -} - -function imprimer_facture_definitive() -{ - - idFacture = $("#idFacture").val(); - if (idFacture>"0") - { - donnees = "idFacture="+idFacture; - - - var div_export = $('#div_facture_definitive'); - div_export.html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaximprimerfacturedefinitive/", - type: 'POST', - data: donnees, - success: function(data) - { - div_export.html(data); - //facturepartielle(); - }, - error : function(resultat, statut, erreur) - { - }, - complete: function(data) - { - // - - } - }); - } - else - { - v_msg="Rien à imprimer!"; - v_msgEng="Nothing to print!"; - alert_ebene(v_msg, v_msgEng); - - return; - } -} - -function imprimerbonprescription() -{ - var div_wait = $('#div_export_a'); - - div_wait.html('
' + '
'); - - donnees = ""; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaximprimerbonprescrition/", - type: 'POST', - data: donnees, - success: function(data) - { - div_wait.html(data); - }, - error : function(resultat, statut, erreur) - { - }, - complete: function(data) - { - } - }); - -} - -//08-11-2021 -function afficheGaranties() -{ - masquer = $("#masquer").val(); - - if(masquer=="1"){ - $('#div_garantie').hide(); - $("#masquer").val("0"); - $("#span_libelle").text("Afficher"); - - }else{ - - $('#div_garantie').show(); - $("#masquer").val("1"); - $("#span_libelle").text("Masquer"); - } -} - -function afficherficheconsultation() -{ - masquerconsulation = $("#masquerconsulation").val(); - - if(masquerconsulation=="Renseigner la fiche de consultation"){ - $('#div_consultation').hide(); - $("#masquerconsulation").val("Consultation"); - - }if(masquerconsulation=="Consultation"){ - - dateEffetCouvert = $("#dateEffetCouvert").val(); - - if (dateEffetCouvert!="1") - { - v_msg="Attention! Non renouvel\u00e9"; - v_msgEng="Warning! Not renewed"; - alert_ebene(v_msg, v_msgEng); - return; - } - modeSaisieFacture=$("#modeSaisieFacture").val(); - - if(modeSaisieFacture=="1") - { - $("#btn_popdate_reelle").click(); - return; - } - - if (prestation_possible()) - { - //avecReferencement = $("#avecReferencement").val(); - if (prestataireReference=="0") - { - if ($("#codeReferencement").val()==""){ - okReferencement="0"; - }else{ - okReferencement="1"; - } - }else{ - okReferencement="1"; - //window.location.assign($("#racineWeb" ).val()+"Consultation/"+okReferencement); - $('#div_consultation').show(); - return; - } - - modeSaisieFacture=$("#modeSaisieFacture").val(); - - if(modeSaisieFacture=="1") - { - $("#okId" ).val("1"); - //window.location.assign($("#racineWeb" ).val()+"Consultation/"); - $('#div_consultation').show(); - return; - } - - derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); - if(derogation_finger_en_cours>0) - { - $("#okId" ).val("1"); - } - else - { - finger_id = $("#finger_id_C" ).val(); - - if (finger_id==0) - { - v_msg="Veuillez proc\u00e9der à l\'enrôlement avant!"; - v_msgEng="Please enroll before!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - okId=$("#okId" ).val(); - - if (okId!=1) - { - v_msg="Veuillez proc\u00e9der à l\'identification avant!"; - v_msgEng="Please check identity before!"; - alert_ebene(v_msg, v_msgEng); - return; - } - } - - //window.location.assign($("#racineWeb" ).val()+"Consultation/"); - $('#div_consultation').show(); - - } - else{ - $('#div_consultation').hide(); - } - } -} - - -function imprimer_hospitalisation() -{ - numeroBonHospitalisation = $("#numeroBonHospitalisation").val(); - - if (numeroBonHospitalisation=="0"){ - - v_msg="Rien à imprimer!"; - v_msgEng="Nothing to print!"; - alert_ebene(v_msg, v_msgEng); - - return; - - } - - $.ajax({ - url: $("#racineWeb").val()+"Ajaximprimerbonhospitalisation/", - success: function(data) - { - $("#div_export_a").html(data); - $("#btn_imprimer_hospit").click(); - }, - error : function(resultat, statut, erreur) - { - }, - complete: function(data) - { - - } - }); - -} - -function ajax_maj_qte_prescrit_examen(idExamen, quantite, controle) -{ - donnee_a_affciher = ""; - - quantite=quantite.replace(",","."); - controle.value=quantite; - - fraisTotal = parseInt($("#fraisTotal").val()); - montantTotalMedicament = parseInt($("#montantTotalMedicament").val()); - - codeReponseEntentePrealable=$("#codeReponseEntentePrealable").val(); - - - 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 = 'idExamen='+idExamen+"&quantite="+quantite; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailprescriptionexamen/majquantite/", - type: 'POST', - data: donnees, - success: function(data) { - $("#examens").html(data); - controle.focus(); - }, - error: function(data) { - }, - complete: function() { - prescription_examen(); - } - }); - } -} - - -function ajax_affiche_fin_delaicarence() { - // Récupération des informations nécessaires - codeLangue = $("#codeLangue").val(); - plafondAtteint = $("#plafondAtteint").val(); - nomForm = $("#nomForm").val(); - codeMedecin = $("#codeMedecin").val(); - var codeActe = $('#codeActe').val(); - var datePrestation = $('#dateSurvenance').val(); - - // Vérification du médecin sélectionné - if (codeMedecin <= " ") { - v_msg = "Veuillez sélectionner un médecin!"; - v_msgEng = "Please select a doctor!"; - alert_ebene(v_msg, v_msgEng); - $("#codeMedecin").focus(); - return; - } - - // Vérification de l’acte sélectionné - if (codeActe <= " ") { - v_msg = "Veuillez sélectionner un acte"; - v_msgEng = "Please select an act!"; - alert_ebene(v_msg, v_msgEng); - $("#codeActe").focus(); - return; - } - - // Préparation des données pour l’appel AJAX - let donnees = 'codeActe=' + codeActe + '&datePrestation=' + datePrestation; - - // Si le plafond est atteint, demander confirmation avant de continuer - if (plafondAtteint == "1") { - let msgFr = "L'assuré assumera entièrement les frais de consultation car son plafond est atteint! Souhaitez-vous continuer?"; - let msgEng = "The insured will fully assume the consultation costs because his ceiling has been reached! Would you like to continue?"; - - // Appel de la fonction de confirmation personnalisée - confirm_ebene_sweet(msgFr, msgEng).then(function (isConfirmed) { - if (isConfirmed) { - enregistrerconsultation(); - } - }); - - } else { - // Sinon on continue avec l’appel AJAX pour vérifier le délai de carence - $.ajax({ - url: $("#racineWeb").val() + "Ajaxaffichedatefindelaicarenceacte/", - type: 'POST', - data: donnees, - success: function (data) { - $("#div_findelaicarence").html(data); - - var dateFinDelaiCarenceActe = $("#dateFinDelaiCarenceActe").val(); - var plafondActe = $("#plafondActe").val().replace(/ /g, ""); - var consommation = $("#consommation").val().replace(/ /g, ""); - var soldeConsommation = $("#soldeConsommation").val().replace(/ /g, ""); - var nbreTransaction = $("#nbreTransaction").val(); - var nbreSinistre = $("#nbreSinistre").val(); - var soldeNbreTransaction = $("#soldeNbreTransaction").val(); - - // Vérification du délai de carence - if (dateFinDelaiCarenceActe != "01/01/1970") { - v_msg = "Impossible de faire cet acte à cause du délai de carence qui est toujours en vigueur pour cet assuré! Il prendra fin le " + dateFinDelaiCarenceActe + ". Merci pour votre compréhension!"; - v_msgEng = "Impossible to do this act because of the deficiency period that is still in force for this insured! It will end on " + dateFinDelaiCarenceActe + ". Thank you for your understanding."; - alert_ebene(v_msg, v_msgEng); - return; - } else { - // Cas de la consultation ou fiche bénéficiaire - if (nomForm == "consultation" || nomForm == "ficheBeneficiaire") { - if (soldeConsommation > "0") { - if (nbreTransaction == "0") { - enregistrerconsultation(); - } else { - if (nbreTransaction > "0" && soldeNbreTransaction > "0") { - enregistrerconsultation(); - } else { - let msgFr = "L'assuré assumera entièrement les frais de consultation car le seuil de garantie est atteint! Souhaitez-vous continuer?"; - let msgEng = "The insured will fully assume the consultation costs because the guarantee threshold has been reached! Would you like to continue?"; - - // Confirmation avant d’enregistrer la consultation si le seuil est atteint - confirm_ebene_sweet(msgFr, msgEng).then(function (isConfirmed) { - if (isConfirmed) { - enregistrerconsultation(); - } - }); - } - } - } else { - v_msg = "L'assuré a atteint son plafond de garantie pour cet acte. Prise en charge impossible."; - v_msgEng = "The insured has reached his limit of cover for this act. Support not possible."; - alert_ebene(v_msg, v_msgEng); - return; - } - } - } - }, - error: function (data) { - // Gérer les erreurs ici si nécessaire - }, - complete: function () { - // Traitement à faire une fois l’appel terminé - } - }); - } -} - - -function info_fin_delaicarence(codeActe){ - - donnees_s = 'codeActe='+codeActe; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxaffichedatefindelaicarenceacte/", - type: 'POST', - data: donnees_s, - success: function(data){ - $("#div_findelaicarence").html(data); - var dateFinDelaiCarenceActe = $("#dateFinDelaiCarenceActe").val(); - - if(dateFinDelaiCarenceActe!="01/01/1970"){ - v_msg="Le d\u00e9lai de carence est toujours en vigueur sur cet acte. Les frais qui seront g\u00e9n\u00e9r\u00e9s seront enti\u00e8rement \u00e0 la charge du patient. La fin du d\u00e9lai de carence est pr\u00e9vu pour le: "+dateFinDelaiCarenceActe+". Merci pour votre compr\u00e9hension!"; - v_msgEng="The waiting period is still in force on this act. The costs that will be generated will be entirely at the expense of the patient. The end of the deficiency period is present for: "+dateFinDelaiCarenceActe+". Thank you for your understanding."; - alert_ebene(v_msg, v_msgEng); - - faireDefileMessage(v_msg, v_msgEng); - } - - }, - error: function(data) { - }, - complete: function() { - - } - }); -} - -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 ajax_demande_accord_pharmacie(){ - - typeSms="ententeprealable"; - - donnees = ""; - - fraisTotal = parseInt($("#fraisTotal").val()); - ententePrealable = $("#ententePrealable").val(); - montantTotalMedicament = parseInt($("#montantTotalMedicament").val()); - - if(fraisTotal > montantTotalMedicament){ - v_msg="Une demande d'accord pr\u00e9alable a \u00e9t\u00e9 envoy\u00e9e \u00e0 l'assureur car les frais de m\u00e9dicaments prescrits sont sup\u00e9rieurs \u00e0 "+montantTotalMedicament+" Fcfa"; - v_msgEng="A request for prior agreement will be sent to the insurer because prescription drug costs are higher than "+montantTotalMedicament; - alert_ebene(v_msg, v_msgEng); - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailprescription/accordpharmacie/", - type: 'POST', - data: donnees, - success: function(data){ - $("#medicaments").html(data); - if(fraisTotal > montantTotalMedicament){ - preparesms(typeSms); - } - }, - error: function(data) { - }, - complete: function() { - - } - }); - } -} - -function ajax_demande_accord_examen(){ - - typeSms="ententeprealableexamen"; - - donnees = ""; - - fraisTotal = parseInt($("#fraisTotal").val()); - ententePrealable = $("#ententePrealable").val(); - montantTotalExamen = parseInt($("#montantTotalExamen").val()); - - - codeReponseEntentePrealable=$("#codeReponseEntentePrealable").val(); - - numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); - - - if((fraisTotal > montantTotalExamen) && (codeReponseEntentePrealable=="2")){ - v_msg="Une demande d'accord pr\u00e9alable a \u00e9t\u00e9 envoy\u00e9e \u00e0 l'assureur car les frais d'examen sont sup\u00e9rieurs \u00e0 "+montantTotalExamen+" Fcfa"; - v_msgEng="A request for prior agreement will be sent to the insurer because the examination fees are higher than "+montantTotalExamen; - alert_ebene(v_msg, v_msgEng); - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailprescriptionexamen/accordexamen/", - type: 'POST', - data: donnees, - success: function(data){ - $("#examens").html(data); - if((fraisTotal > montantTotalExamen) && (codeReponseEntentePrealable=="2")){ - preparesms(typeSms); - } - }, - error: function(data) { - }, - complete: function() { - - } - }); - } -} - -// 26-05-2022 -function afficheDivPlafond() -{ - masquer = $("#masquer").val(); - - if(masquer=="1"){ - $('#div_plafond_beneficiaire').hide(); - $("#masquer").val("0"); - $("#span_libelle").text("Voir"); - - }else{ - $('#div_plafond_beneficiaire').show(); - $("#masquer").val("1"); - $("#span_libelle").text("Masquer"); - } -} - -// 10-06-2022 - -function addDays(date, days) { - var result = new Date(date); - result.setDate(result.getDate() + days); - return result.toLocaleDateString("fr"); - -} - -function formatDateInput(date){ - return date.split('/').reverse().join('-'); - -} - - -// 25-10-2022 - -function ajax_maj_prix_actesmedicaux(idPrestationactes, prix, controle, codeActe, ententePrealable, autorisation) -{ - - prix=prix.replace(/ /g,""); - controle.value=prix; - - numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); - - donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; - donnees_sav2 = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailautorisation'; - - //alert(ententePrealable); - //return; - - typeSms="ententeprealable"; - typeSms2="autorisation"; - - if(controle_numerique(controle)) - { - if(prix==0) - { - controle.focus(); - v_msg="Veuillez saisir le tarif!"; - v_msgEng="Please enter the price!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - donnees = 'idPrestationactes='+idPrestationactes+"&prix="+prix; - - donnee_a_affciher = ""; - - donnees = 'idPrestationactes='+idPrestationactes+"&prix="+prix;; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxactesmedicauxselect/majprixacte/", - type: 'POST', - data: donnees, - success: function(data) { - donnee_a_affciher = data; - - maj_fraisexclu_cso(); - - if(ententePrealable=="2") - { - preparesms(typeSms); - - v_msg="Demande accord prealable envoy\u00e9e!"; - v_msgEng="Request prior agreement sent!"; - alert_ebene(v_msg, v_msgEng); - } - - if(autorisation=="2") - { - preparesms(typeSms2); - - v_msg="Demande autorisation envoy\u00e9e!"; - v_msgEng="Request for authorization sent!"; - alert_ebene(v_msg, v_msgEng); - } - }, - error: function(data) { - }, - complete: function() { - $("#div_prestations").html(donnee_a_affciher); - controle.focus(); - } - }); - } -} - -//26-10-2022 -function formatNumerique(controle){ - controle.value = controle.value.replace(/ /g,""); - return; - -} - -//28-10-2022 -function messageSituationHospitalisation(){ - var optionHospitalisation = $("#optionHospitalisation").val(); - - if(optionHospitalisation == "option-1"){ - codeActe = "HHM"; - }else if (optionHospitalisation == "option-3"){ - codeActe = "HHC"; - }else{ - codeActe = ""; - } - - - getstatutacte(codeActe); - - var donnees = 'codeActe='+codeActe; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxsituationhospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) - { - $("#div_reponse").html(data); - - }, - complete: function(data) - { - - } - }); -} - -function avishospitalisation() -{ - // - - motifHospitalisation = $("#motifHospitalisation").val(); - dureeHospit = $("#dureeHospit").val(); - dateDebutHospit = $("#dateDebutHospit").val(); - optionHospitalisation = $("#optionHospitalisation").val(); - modeSaisieFacture = $("#modeSaisieFacture").val(); - - codeActeChambreHospit = $("#codeActeChambreHospit").val(); - - //typeSms = "hospitalisation"; - - - - if (motifHospitalisation <= " ") - { - v_msg="Veuillez renseigner le motif d'hospitalisation!"; - v_msgEng="Please fill in the reason for hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#motifHospitalisation").focus(); - return; - } - - if (optionHospitalisation <= " ") - { - v_msg="Veuillez renseigner le type d'hospitalisation!"; - v_msgEng="Please fill in the type of hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#optionHospitalisation").focus(); - return; - } - - if (codeActeChambreHospit <= " ") - { - v_msg="Veuillez renseigner le type de chambre!"; - v_msgEng="Please enter the room type!"; - alert_ebene(v_msg, v_msgEng); - - $("#codeActeChambreHospit").focus(); - return; - } - - - if (dateDebutHospit<=" ") - { - v_msg="Veuillez saisir la date de d\u00e9but!"; - v_msgEng="Please enter the start date!"; - alert_ebene(v_msg, v_msgEng); - - $("#dateDebutHospit").focus(); - return; - } - - if (dureeHospit == "0") - { - v_msg="Veuillez renseigner le nombre de jours pr\u00e9visionnels d'hospitalisation!"; - v_msgEng="Please fill in the estimated number of days of hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#dureeHospit").focus(); - return; - } - - //alert(typeSms); - - - donnees = 'motifHospitalisation='+motifHospitalisation; - donnees += '&dureeHospit='+dureeHospit+'&dateDebutHospit='+dateDebutHospit; - donnees += '&optionHospitalisation='+optionHospitalisation+'&codeActeChambreHospit='+codeActeChambreHospit; - - if (optionHospitalisation=="option-1"){ - codeActe = "HHM"; - } - - if (optionHospitalisation=="option-3"){ - codeActe = "HHC"; - } - - numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); - - //donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&quantite='+dureeHospit+'&motifHospit='+motifHospitalisation+'&typeMail=mailententeprealable'; - - //alert(donnees);return; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerchambre/majavishospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - /*if(modeSaisieFacture=="0"){ - preparesms(typeSms); - }*/ - - v_msg="Avis d'hospitalisation envoy\u00e9 avec succ\u00e8s, merci de patienter un instant pour la suite..."; - v_msgEng="Hospitalization notice sent successfully, please wait a moment for the rest..."; - - alert_ebene_callback(v_msg, v_msgEng, function() { - window.location.assign($("#racineWeb").val()+"Feuillemaladie/"); - }); - - return; - - }, - complete: function() { - /*if(modeSaisieFacture=="0"){ - mettremailattente(donnees_sav); - }*/ - } - }); - -} - - -function modidieravishospitalisation() -{ - // - - motifHospitalisation = $("#motifHospitalisation").val(); - dureeHospit = $("#dureeHospit").val(); - dateDebutHospit = $("#dateDebutHospit").val(); - optionHospitalisation = $("#optionHospitalisation").val(); - - modeSaisieFacture = $("#modeSaisieFacture").val(); - - codeActeChambre = $("#codeActeChambreHospit").val(); - - if (motifHospitalisation <= " ") - { - v_msg="Veuillez renseigner le motif d'hospitalisation!"; - v_msgEng="Please fill in the reason for hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#motifHospitalisation").focus(); - return; - } - - if (optionHospitalisation <= " ") - { - v_msg="Veuillez renseigner le type d'hospitalisation!"; - v_msgEng="Please fill in the type of hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#optionHospitalisation").focus(); - return; - } - - if (codeActeChambre <= " ") - { - v_msg="Veuillez renseigner le type de chambre!"; - v_msgEng="Please enter the room type!"; - alert_ebene(v_msg, v_msgEng); - - $("#codeActeChambreHospit").focus(); - return; - } - - if (dateDebutHospit<=" ") - { - v_msg="Veuillez saisir la date de d\u00e9but!"; - v_msgEng="Please enter the start date!"; - alert_ebene(v_msg, v_msgEng); - - $("#dateDebutHospit").focus(); - return; - } - - if (dureeHospit == "0") - { - v_msg="Veuillez renseigner le nombre de jours pr\u00e9visionnels d'hospitalisation!"; - v_msgEng="Please fill in the estimated number of days of hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#dureeHospit").focus(); - return; - } - - //alert(typeSms); - - - donnees = 'motifHospitalisation='+motifHospitalisation; - donnees += '&dureeHospit='+dureeHospit+'&dateDebutHospit='+dateDebutHospit; - donnees += '&optionHospitalisation='+optionHospitalisation+'&codeActeChambre='+codeActeChambre; - - //alert(donnees); - - if (optionHospitalisation=="option-1"){ - codeActe = "HHM"; - } - - if (optionHospitalisation=="option-3"){ - codeActe = "HHC"; - } - - numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); - - //donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&quantite='+dureeHospit+'&motifHospit='+motifHospitalisation+'&typeMail=mailententeprealable'; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerchambre/majavishospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - v_msg="Avis d'hospitalisation modifi\u00e9 avec succ\u00e8s, merci de patienter un instant pour la suite..."; - v_msgEng="Notice of hospitalization successfully modified, please wait a moment for the rest..."; - - alert_ebene_callback(v_msg, v_msgEng, function() { - window.location.assign($("#racineWeb").val()+"Feuillemaladie/"); - }); - - return; - - }, - complete: function() { - - - } - }); - -} - -function afficheReponseAvis(){ - var avisHospitalisation = $('#avisHospitalisation').val(); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxreponseavis/", - success: function(data) - { - //$("#div_reponse").html(''); - $("#div_reponse").html(data); - - }, - error: function(errorData) { - }, - complete: function(data) - { - - } - }); - -} - -function creerbonhospitalisation() -{ - codeGestionBon = "2"; - - numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); - - motifHospitalisation = $("#motifHospitalisation").val(); - - numeroBon = "-1"; - - donnees = 'numeroBon='+numeroBon+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&motifHospitalisation='+motifHospitalisation; - donnees += '&codeGestionBon='+codeGestionBon; - - var div_patientez = $('#div_patientez'); - - div_patientez.html('
' + '
'); - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerhospitalisation/enregistrerhospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - // $("#msgErreur").html(errorData); - }, - success: function(data) - { - //attribution_chambre(); - }, - complete: function() - { - attribution_chambre(); - - } - }); - -} - -function enregistrerTypeHospitalisation(type){ - - donnees = "type="+type; - - var div_wait = $('#div_famille_acte'); - - div_wait.html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectfamilleactehospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - // alert("Erreur : "+errorData); - }, - success: function(data) { - $("#div_famille_acte").html(data); - $("#codeFamilleActe").selectpicker(); - var codeFamilleActe = $('#codeFamilleActe').val(); - - - if(codeFamilleActe=="" || codeFamilleActe==undefined){ - var nbreProlongation = parseInt($("#nbreProlongation").val()); - - if(nbreProlongation==undefined){ - nbreProlongation = 0; - } - - cach(); - - if(nbreProlongation > "0"){ - for (let pas = 1; pas <= nbreProlongation; pas++) { - cachLigneTab(pas); - } - } - return false; - }else{ - } - - - }, - complete: function() { - - } - }); - -} - -function ajaxactespossibles_selection_hospitalisation() -{ - $("#totam_donnees").html('
' + '
'); - - var codeFamilleActe = "FA100"; - - donnees = 'codeFamilleActe='+codeFamilleActe; - - donnees = ''; - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectactesmedicauxhospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#totam_donnees").html(data); - appliquerDataTable(); - $(".datepicker" ).datepicker(); - cach(); - - var noChambre = $("#noChambre").val(); - - if (noChambre<=" ") - { - v_msg="Veuillez entrer le numero de chambre!"; - v_msgEng="Please enter the room number!"; - alert_ebene(v_msg, v_msgEng); - - $("#noChambre").focus(); - - return; - } - - var nbreProlongation = parseInt($("#nbreProlongation").val()); - - if(nbreProlongation > "0"){ - for (let pas = 1; pas <= nbreProlongation; pas++) { - cachLigneTab(pas); - - if ($("#noChambrePro"+pas).val()<=" ") - { - v_msg="Veuillez entrer le numero de chambre!"; - v_msgEng="Please enter the room number!"; - alert_ebene(v_msg, v_msgEng); - - $("#noChambrePro"+pas).focus(); - return; - } - - } - } - }, - complete: function() { - afficherPlafondHospitalisation(); - ajax_btn_avishospitalisation(); - } - }); -} - -function afficherPlafondHospitalisation() -{ - $.ajax({ - url: $("#racineWeb").val()+"Ajaxmajplafondhospitalisation/", - success: function(data) - { - $("#div_plafond_beneficiaire").html(data); - - }, - error : function(resultat, statut, erreur) - { - }, - complete: function(data) - { - - } - }); - - - -} - -function examenhospitalisation(libelle) -{ - - var donnees = 'libelle='+ libelle; - - vLink = "Ajaxchargeractesexamenhospitalisation/"; - - $.ajax({ - type: "POST", - url: $("#racineWeb").val()+vLink, - data:donnees, - beforeSend: function(){ - $("#searchInput").css("background","#FFF url(Bootstrap/images/LoaderIcon.gif) no-repeat 165px"); - }, - success: function(data){ - $("#div_selection").show(); - $("#div_selection").html(data); - $("#searchInput").css("background","#FFF"); - } - }); -} - - - -/** - * Ajoute un examen hospitalier après validation - * @param {string} controle - Chaîne contenant les informations de l'acte (code, libellé, etc.) - */ -async function add_selected_exam_hosp(controle) { - // Extraction des données de l'acte - const [codeActe, libelleActe, , acteExcluStr] = controle.split(' <==> '); - const acteExclu = acteExcluStr === "Garanti" ? 0 : 1; - const ententePrealable = 0; - const prixTarif = 0; - - // Validation de l'acte - if (!libelleActe || libelleActe.trim() <= " ") { - $("#codeActe").focus(); - return; - } - - // Vérification de la couverture - if (acteExclu === 1) { - alert_ebene("Acte non couvert!", "Not covered!"); - return; - } - - // Demande de confirmation - const confirmation = await confirm_ebene_sweet( - `Confirmez-vous cet acte : ${libelleActe}?`, - `Do you confirm this act : ${libelleActe}?` - ); - - if (!confirmation) return; - - // Préparation des données - const donnees = new URLSearchParams({ - codeActe, - ententePrealable, - prixTarif, - acteExclu - }); - - // Gestion spécifique si entente préalable - if (ententePrealable == 2) { - const numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); - donnees.append('numeroFeuilleMaladie', numeroFeuilleMaladie); - donnees.append('typeMail', 'mailententeprealable'); - } - - // Affichage du loader - afficherLoader("#div_prestations"); - - // Envoi de la requête - try { - await $.ajax({ - url: `${$("#racineWeb").val()}Ajaxchargeractesexamenhospitalisation/ajouterexamen/`, - type: 'POST', - data: donnees.toString() - }); - - // Rafraîchissement de l'affichage - ajaxactespossibles_selection_hospitalisation(); - $("#searchInput").val(''); - - } catch (error) { - console.error("Erreur lors de l'ajout de l'examen", error); - } -} - - -function majMotifProlongation(){ - - motifProlongation = $("#motifProlongation").val(); - - donnees = 'motifProlongation='+motifProlongation; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerhospitalisation/majmotifprolongation/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - - - }, - complete: function() - { - - } - }); -} - - -function affiche_prestations_prolongation(idProlongation, ligne) -{ - - donnees = 'idProlongation='+idProlongation; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxprestationsprolongation/", - type: 'POST', - data: donnees, - success: function(data) { - $("#div_prestations_prolongation"+ligne).html(data); - - var nbreProlongation = parseInt($("#nbreProlongation").val()); - var noChambrePro = $("#noChambrePro").val(); - - if(noChambrePro!=undefined && noChambrePro<=" ") - { - v_msg="Veuillez entrer le numero de chambre de prorogation!"; - v_msgEng="Please enter the extension room number!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - if(nbreProlongation > "0"){ - for (let pas = 1; pas <= nbreProlongation; pas++) { - cachLigneTab(pas); - } - } - }, - error: function(data) { - }, - complete: function() { - - } - }); - -} - -function aff() -{ - $('#cach').show(); - $('#aff').hide(); - tr_type = document.getElementById('tr_type'); - tr_motif = document.getElementById('tr_motif'); - tr_instruction = document.getElementById('tr_instruction'); - - tr_type.style.display = ""; - tr_motif.style.display = ""; - tr_instruction.style.display = ""; -} - - -function cach() -{ - // - - $('#cach').hide(); - $('#aff').show(); - - numeroBon = $("#numeroBon").val(); - - - if(numeroBon > "0") { - tr_type = document.getElementById('tr_type'); - tr_motif = document.getElementById('tr_motif'); - tr_instruction = document.getElementById('tr_instruction'); - - tr_type.style.display = "none"; - tr_motif.style.display = "none"; - tr_instruction.style.display = "none"; - } -} - -function affLigneTab(ligne) -{ - $('#cach'+ligne).show(); - $('#aff'+ligne).hide(); - - tr_type = document.getElementById('tr_type'+ligne); - tr_motif = document.getElementById('tr_motif'+ligne); - tr_instruction = document.getElementById('tr_instruction'+ligne); - - tr_type.style.display = ""; - tr_motif.style.display = ""; - tr_instruction.style.display = ""; - -} - -function cachLigneTab(ligne) -{ - $('#cach'+ligne).hide(); - $('#aff'+ligne).show(); - - tr_type = document.getElementById('tr_type'+ligne); - tr_motif = document.getElementById('tr_motif'+ligne); - tr_instruction = document.getElementById('tr_instruction'+ligne); - - tr_type.style.display = "none"; - tr_motif.style.display = "none"; - tr_instruction.style.display = "none"; -} - - -function majChambreHospitalisation() -{ - var noChambre = $("#noChambre").val(); - - donnees = 'noChambre='+noChambre; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerhospitalisation/majnochambre/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - attribution_chambre(); - - }, - complete: function() - { - - } - }); -} - - -function majChambreProrogation(idProlongation, noChambrePro) -{ - - donnees = 'idProlongation='+idProlongation+'&noChambrePro='+noChambrePro; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerhospitalisation/majChambreProrogation/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - }, - complete: function() - { - - } - }); -} - -function extraitNombre(str){ - return Number(str.replace(/[^\d]/g, "")) -} - - -function enregistrer_nv_consommables_hospit() -{ - 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; - - $("#div_patienter_consommable").html('
' + '
'); - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxlisteconsommables/creerconsommablehospit/", - type: 'POST', - data: donnees, - success: function(data) { - - }, - error: function(data) { - }, - complete: function() { - attribution_chambre(); - } - }); -} - -function print_hospitalisation() -{ - $('#div_export_a').html(''); - - $("#btn_imprimer_chambre").click(); -} - -function imprimer_bon_pec_hospitalisation() -{ - nomForm = $("#nomForm").val(); - - donnees_retour = ""; - - donnees = "nomForm="+nomForm; - - $('#div_export_a').html(''); - - var div_export = $('#div_export_a'); - - div_export.html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaximprimerfacturehospitalisation/bonpec/", - type: 'POST', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - donnees_retour = data; - - }, - complete: function() { - div_export.html(donnees_retour); - - } - }); - -} - -function imprimer_facture_hospitalisation() -{ - donnees_retour = ""; - - $('#div_export_a').html(''); - - var div_export = $('#div_export_a'); - - div_export.html('
' + '
'); - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaximprimerfacturehospitalisation/", - success: function(data) - { - donnees_retour = data; - - }, - error : function(resultat, statut, erreur) - { - }, - complete: function(data) - { - div_export.html(donnees_retour); - } - }); - -} - -//01-11-2022 -function selectionner_tous_hospitalisation() -{ - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfacturepartielle/selectionnertoushospit/", - type: 'POST', - data: donnees, - success: function(data) { - //$("#div_liste_actes").html(data); - //facturepartielle(); - }, - error: function(data) { - }, - complete: function() { - } - }); -} - -function test() -{ - v_msg="Confirmez-vous le test?"; - v_msgEng="Do you confirm this test?"; - - if (confirm_ebene(v_msg, v_msgEng)){ - - console.log('ok'); - }else{ - console.log('false'); - } - -} - -function specialite_medecin() -{ - donnees_retour = ""; - - codeSpecialite = $("#codeSpecialite").val(); - dureeVieBon = parseInt($("#dureeVieBon").val()); - agemaxipediatrie = parseInt($("#agemaxipediatrie").val()); - - donnees = 'codeSpecialite='+codeSpecialite; - - //alert(donnees); - //return; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxspecialitemedecin/", - type: 'POST', - data: donnees, - success: function(data) { - - donnees_retour = data; - }, - error: function(data) { - - }, - complete: function() { - - $("#div_medecin").html(donnees_retour); - - $(".selectpicker").selectpicker(); - - specialiteEstPossible = $("#specialiteEstPossible").val(); - - if(specialiteEstPossible == "1"){ - ajaxprixacte(); - }else if(specialiteEstPossible == "2"){ - v_msg="Attention, ce patient n'a pas moins de "+agemaxipediatrie+" ans! Il ne peut pas faire cette consultation, veuiller changer l'acte ou la sp\u00e9cialit\u00e9."; - v_msgEng="Attention, this patient is not less than "+agemaxipediatrie+" years old! He cannot do this consultation, please change the act or specialty."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - - $("#codeActe").focus(); - - vider_medecin(); - - $("#infosacte").html(''); - - return; - }else if(specialiteEstPossible == "0"){ - v_msg="La derni\u00e8re consultation du patient pour cette sp\u00e9cialit\u00e9 date de moins de "+dureeVieBon+" jours. Veuiller la changer ou passer en consultation gratuite."; - v_msgEng="The patient's last consultation for this specialty was less than "+dureeVieBon+" days ago. Please change it or have a free consultation."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - - alert_ebene(v_msg, v_msgEng); - - $("#codeActe").focus(); - - vider_medecin(); - - $("#infosacte").html(''); - - return; - } - } - }); - -} - -function majDebutHospitalisation() -{ - var dateDebutHospit = $("#dateDebutHospit").val(); - var dureeHospit = $("#dureeHospit").val(); - var dureeCorrigeeHospit = $("#dureeCorrigeeHospit").val(); - - donnees = 'dateDebutHospit='+dateDebutHospit; - donnees += '&dureeHospit='+dureeHospit; - donnees += '&dureeCorrigeeHospit='+dureeCorrigeeHospit; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerhospitalisation/majdebut/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - }, - complete: function() - { - - } - }); -} - -function majDureeHospitalisation() -{ - var dureeHospit = $("#dureeHospit").val(); - var dateDebutHospit = $("#dateDebutHospit").val(); - - if(dateDebutHospit==""){ - v_msg="Veuillez saisir la date de début de l'hospitalisation!"; - v_msgEng="Please enter the start date of hospitalization!"; - - alert_ebene(v_msg, v_msgEng); - - $("#dateDebutHospit").focus(); - - return; - } - - donnees = 'dureeHospit='+dureeHospit; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerhospitalisation/majduree/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - //$("#div_datefin").html(data); - //majTypeHospitalisation(); - //prestations_hospitalisation(); - }, - complete: function() - { - - } - }); -} - - -function majTypeHospitalisation() -{ - var optionHospitalisation = $("#optionHospitalisation").val(); - - donnees = 'optionHospitalisation='+optionHospitalisation; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerhospitalisation/majoptionhospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - }, - complete: function() - { - - } - }); -} - -//03-03-2023 - -function getsourcebaremegarantie(codeGarantie, datePrestation) -{ - - donnees = 'codeGarantie='+codeGarantie; - donnees += '&datePrestation='+datePrestation; - - //alert(donnees); - //return; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxsourcebareme/sourcebaremegarantie/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - actualiserInfosBareme(); - }, - complete: function() - { - - } - }); -} - -function getsourcebareme(codeActe, datePrestation) -{ - donnees = 'codeActe='+codeActe; - donnees += '&datePrestation='+datePrestation; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxsourcebareme/sourcebareme/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - - actualiserInfosBareme(); - }, - complete: function() - { - - } - }); -} - -function actualiserInfosBareme() -{ - donnees = ''; - - $("#div_infos_baremegarantie").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxsourcebareme/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - $("#div_infos_baremegarantie").html(data); - - var statut = $("#statut").val(); - - alert_bareme_statut(statut); - - }, - complete: function() - { - - } - }); - -} - -//10-03-2023 -function ajax_afficher_beneficiaire() -{ - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfichebeneficiaire/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - $("#div_beneficiaire").html(data); - - $("#codeMedecin").selectpicker(); - $("#codeActe").selectpicker(); - - }, - complete: function() - { - - } - }); - -} - -//22-03-2023 -function alert_bareme() -{ - baremeExiste = $("#baremeExiste").val(); - bareme_actif = $("#bareme_actif").val(); - ageBeneficiaire = parseInt($("#ageBeneficiaire").val()); - ageMinimum = parseInt($("#ageMinimum").val()); - ageMaximum = parseInt($("#ageMaximum").val()); - - bareme_codeTypeRemboursement = $("#bareme_codeTypeRemboursement").val(); - - soldeConsommationFamilleAct = $("#soldeConsommationFamilleAct").val(); - soldeConsommationAct = $("#soldeConsommationAct").val(); - soldeConsommationFamilleGar = $("#soldeConsommationFamilleGar").val(); - soldeConsommationGar = $("#soldeConsommationGar").val(); - soldeNbreTransactionFamilleAct = $("#soldeNbreTransactionFamilleAct").val(); - soldeNbreTransactionAct = $("#soldeNbreTransactionAct").val(); - soldeNbreTransactionFamilleGar = $("#soldeNbreTransactionFamilleGar").val(); - soldeNbreTransactionGar = $("#soldeNbreTransactionGar").val(); - - - if(soldeConsommationFamilleAct<="0" || soldeConsommationAct<="0" || soldeConsommationFamilleGar<="0" - || soldeConsommationGar<="0" || soldeNbreTransactionFamilleAct<="0" || soldeNbreTransactionAct<="0" - || soldeNbreTransactionFamilleGar<="0" || soldeNbreTransactionGar<="0") - { - v_msg="Impossible de s\u00e9lectionner cet acte! Le solde du plafond ou du nombre de transaction est nul!"; - v_msgEng="Unable to select this act! The balance of the ceiling or number of transactions is zero!"; - - alert_ebene(v_msg, v_msgEng); - - //faireDefileMessage(v_msg, v_msgEng); - return; - } - - if(baremeExiste == "0") - { - v_msg="Aucun bar\u00e8me n'existe, veuillez en informer "+nomSociete+" afin que cel\u00e0 soit corrig\u00e9."; - v_msgEng="No scale exists, please inform "+nomSociete+" so that this can be corrected."; - alert_ebene(v_msg, v_msgEng); - - //faireDefileMessage(v_msg, v_msgEng); - return; - } - - if(bareme_actif == "0") - { - v_msg="Il n'y a pas de bar\u00e8me de garantie actif \u00e0 cette date, veuillez en informer "+nomSociete+" afin que cel\u00e0 soit corrig\u00e9."; - v_msgEng="There is no active guarantee schedule on this date, please inform "+nomSociete+" so that this can be corrected."; - alert_ebene(v_msg, v_msgEng); - - //faireDefileMessage(v_msg, v_msgEng); - return; - } - - if((ageMinimum > "0" && ageMaximum > "0") && (ageBeneficiaire < ageMinimum || ageBeneficiaire > ageMaximum)) - { - v_msg="L'\u00e2ge du patient n'est pas pris en compte dans le bar\u00e8me de garantie!"; - v_msgEng="The age of the insured is not taken into account in the warranty schedule!"; - alert_ebene(v_msg, v_msgEng); - - //faireDefileMessage(v_msg, v_msgEng); - return; - } - - if(bareme_codeTypeRemboursement == "RDE") - { - v_msg="L'assur\u00e9 est en remboursement direct pour cette garantie. Il devra enti\u00e8rement payer la prestation et se faire rembourser par "+nomSociete+"!"; - v_msgEng="The insured is in direct reimbursement for this guarantee. He will have to fully pay for the service and be reimbursed by "+nomSociete+"!"; - alert_ebene(v_msg, v_msgEng); - - - //faireDefileMessage(v_msg, v_msgEng); - return; - } -} - - -function alert_bareme_statut(statut) -{ - - if(statut == "0") - { - v_msg="Le bar\u00e8me n'existe pas ou il est inactif!"; - v_msgEng="The scale does not exist or it is inactive!"; - alert_ebene(v_msg, v_msgEng); - - faireDefileMessage(v_msg, v_msgEng); - return; - }else if(statut == "2") - { - v_msg="Le patient est en remboursement direct exclusif (RDE) pour cette garantie!"; - v_msgEng="The patient is in exclusive direct reimbursement (DDR) for this benefit!"; - alert_ebene(v_msg, v_msgEng); - - faireDefileMessage(v_msg, v_msgEng); - return; - }else if(statut=="3") - { - v_msg="L'\u00e2ge du patient n'est pas pris en compte dans le bar\u00e8me!"; - v_msgEng="The age of the patient is not taken into account in the scale!"; - alert_ebene(v_msg, v_msgEng); - - faireDefileMessage(v_msg, v_msgEng); - return; - }else if(statut=="4") - { - v_msg="Le d\u00e9lai de carence est toujours en vigueur sur cette garantie!"; - v_msgEng="The waiting period is still in effect on this guarantee!"; - - alert_ebene(v_msg, v_msgEng); - - faireDefileMessage(v_msg, v_msgEng); - return; - }else if(statut=="5") - { - v_msg="Le solde du plafond ou du nombre de prestations de la famille ou du patient est nul!"; - v_msgEng="The balance of the ceiling or the number of benefits of the family or the patient is zero!"; - - alert_ebene(v_msg, v_msgEng); - - faireDefileMessage(v_msg, v_msgEng); - return; - }else if(statut=="7") - { - v_msg="Le plafond annuelle du patient est atteint!"; - v_msgEng="The annual patient ceiling has been reached!"; - - alert_ebene(v_msg, v_msgEng); - - faireDefileMessage(v_msg, v_msgEng); - return; - }else{ - - faireDefileMessage("", ""); - } - -} - -function isNumeric(num){ - return !isNaN(parseInt(num)) && isFinite(num); -} - - -function getstatutacte(codeActe="") -{ - - - if(codeActe==""){ - codeActe = $("#codeActe").val(); - } - - datePrestation = $('#dateSurvenance').val(); - - donnee_a_affciher = ""; - - - if (codeActe<=" ") - { - v_msg="Veuillez s\u00e9lectionner un acte!"; - v_msgEng="Please select an act!"; - alert_ebene(v_msg, v_msgEng); - $("#codeActe").focus(); - return; - } - - donnees = 'codeActe='+codeActe+'&datePrestation='+datePrestation; - - //alert(donnees); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxstatutacte/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - donnee_a_affciher = data; - }, - complete: function() { - - - $("#div_statutacte").html(donnee_a_affciher); - - var statut = $("#statut").val(); - var libelleMotif = $("#libelleMotif").val(); - var libelleMotifEng = $("#libelleMotifEng").val(); - - - faireDefileMessage(libelleMotif, libelleMotifEng); - } - }); -} - - - - - -function isStatut(codeActe) -{ - - - var myVar = ''; - - if(codeActe==""){ - codeActe = $("#codeActe").val(); - } - - datePrestation = $('#dateSurvenance').val(); - - donnee_a_affciher = ""; - - - if (codeActe<=" ") - { - v_msg="Veuillez s\u00e9lectionner un acte!"; - v_msgEng="Please select an act!"; - alert_ebene(v_msg, v_msgEng); - $("#codeActe").focus(); - return; - } - - donnees = 'codeActe='+codeActe+'&datePrestation='+datePrestation; - - //alert(donnees); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxstatutacte/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - async: false, - success: function(data) { - donnee_a_affciher = data; - }, - complete: function() { - - $("#div_statutacte").html(donnee_a_affciher); - - var statut = $("#statut").val(); - - myVar = statut; - } - }); - return myVar; -} - -function enregistrer_consultation() -{ - codeActe = $("#codeActe").val(); - nomForm = $('#nomForm').val(); - datePrestation = $('#dateSurvenance').val(); - - codeMedecin = $("#codeMedecin").val(); - - // medecinManquant = $("#medecinManquant").val(); - medecinManquant = ""; - - - dateEffetCouvert= $("#dateEffetCouvert").val(); - - codeActeConsultationGratuite = $("#codeActeConsultationGratuite").val(); - - if (dateEffetCouvert!="1") - { - v_msg="Attention! Non renouvel\u00e9"; - v_msgEng="Warning! Not renewed"; - alert_ebene(v_msg, v_msgEng); - return; - } - - fingerActif = $("#fingerActif" ).val(); - faceActif = $("#faceActif").val(); - - if (prestation_possible()) - { - if (prestataireReference=="0") - { - if ($("#codeReferencement").val()==""){ - okReferencement="0"; - }else{ - okReferencement="1"; - } - }else{ - okReferencement="1"; - - } - - derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); - if(derogation_finger_en_cours>0) - { - $("#okId" ).val("1"); - $("#okId_face" ).val("1"); - } - else - { - finger_id = $("#finger_id_C" ).val(); - faceRegistered = $("#faceRegistered").val(); - - if( (fingerActif=='1' && finger_id==0) || (faceActif=='1' && faceRegistered!="1") ) - { - v_msg="Veuillez proc\u00e9der à l\'enrôlement avant!"; - v_msgEng="Please enroll before!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - okId=$("#okId" ).val(); - okId_face=$("#okId_face" ).val(); - - if( (fingerActif=='1' && okId!=1) || (faceActif=='1' && okId_face!=1) ) - { - v_msg="Veuillez proc\u00e9der à l\'identification avant!"; - v_msgEng="Please check identity before!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - } - } - - if (codeActe<=" ") - { - v_msg="Veuillez s\u00e9lectionner un acte!"; - v_msgEng="Please select an act!"; - alert_ebene(v_msg, v_msgEng); - $("#codeActe").focus(); - return; - } - - if (codeSpecialite<=" ") - { - v_msg="Veuillez s\u00e9lectionner une sp\u00e9cialit\u00e9!"; - v_msgEng="Please select a specialty!"; - alert_ebene(v_msg, v_msgEng); - $("#codeSpecialite").focus(); - return; - } - - if (codeMedecin<=" ") - { - v_msg="Veuillez s\u00e9lectionner un praticien!"; - v_msgEng="Please select a practitioner!"; - alert_ebene(v_msg, v_msgEng); - $("#codeMedecin").focus(); - return; - } - - if (codeMedecin=="ZZZZ" && medecinManquant<=" ") - { - v_msg="Veuillez saisir le nom du praticien non enregistr\u00e9!"; - v_msgEng="Please enter the name of the non-registered practitioner!"; - alert_ebene(v_msg, v_msgEng); - // $("#medecinManquant").focus(); - return; - } - - - - bonPrincipal = $("#bonPrincipal").val(); - autoriserUnBonPrincipal = $("#autoriserUnBonPrincipal").val(); - - if(codeActe == codeActeConsultationGratuite && $("#prixActe").val() == "0" && autoriserUnBonPrincipal == "1"){ - if(bonPrincipal=="0") - { - v_msg="Veuillez entrer le numéro du bon principal!"; - v_msgEng="Please enter the main voucher number!"; - alert_ebene(v_msg, v_msgEng); - $("#bonPrincipal").focus(); - return; - } - } - - donnee_a_affciher = ""; - - donnees = 'codeActe='+codeActe+'&datePrestation='+datePrestation; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxstatutacte/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - donnee_a_affciher = data; - }, - complete: function() { - - - $("#div_statutacte").html(donnee_a_affciher); - - var statut = $("#statut").val(); - var libelleMotif = $("#libelleMotif").val(); - var libelleMotifEng = $("#libelleMotifEng").val(); - - if(statut != "1") - { - alert_ebene(libelleMotif, libelleMotifEng); - - faireDefileMessage(libelleMotif, libelleMotifEng); - - //conserver_infos_consultation(); - - return; - }else{ - - faireDefileMessage("", ""); - - if(nomForm == "ficheBeneficiaire") - { - enregistrerconsultation(); - }else{ - enregistrerconsultationassureur(); - } - } - } - }); - -} - -//28-05-2023 -function actualiseTauxCouverture() -{ - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxactualisetauxcouverture/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#div_taux").html(data); - - }, - complete: function() { - - } - }); - - -} - -/** - * Fonction pour ajouter un acte médical à la sélection - * @param {string} codeActe - Code identifiant l'acte médical - * @param {number} prixBase - Prix de base de l'acte - * @param {number} prixActe - Prix appliqué de l'acte - * @param {number} ententePrealable - Indicateur d'entente préalable (1=oui, 0=non) - */ -async function ajouter_un_acte_selection(codeActe, prixBase, prixActe, ententePrealable) { - // Initialisation des variables - donnee_a_affciher = ""; - - // Récupération des valeurs du formulaire - codeFamilleActeMed = $("#codeFamilleActeMed").val(); - datePrestation = $("#datePrestation").val(); - codeFamilleActe = $("#codeFamilleActe").val(); - donnees = ""; - donnees_sav = ""; - modeSaisieFacture = $("#modeSaisieFacture").val(); - codeMedecin = $("#codeMedecin").val(); - - // Vérification du prix de l'acte - if(prixActe == 0) { - v_msg = "Veuillez faire enregistrer votre tarif!"; - v_msgEng = "Please register your rate!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - motifActe = $("#motifActe").val(); - - // Messages de confirmation - v_msg = "Confirmez-vous cet acte?"; - v_msgEng = "Do you confirm this act?"; - - // Confirmation avec SweetAlert standardisé - const isConfirm = await confirm_ebene_sweet(v_msg, v_msgEng); - - if (!isConfirm) { - return; // Annulation par l'utilisateur - } - - // Traitement si confirmation - if(ententePrealable == 1) { - ententePrealable = "2"; - } - - // Préparation des données pour l'AJAX - donnees = 'codeFamilleActe='+codeFamilleActe+'&codeActe='+codeActe+'&ententePrealable='+ententePrealable; - donnees += '&prixActe='+prixActe+'&prixBase='+prixBase+'&motifActe='+motifActe; - - numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); - donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; - - // Affichage du loader - $("#listeacte").html('
' + '
'); - - // Appel AJAX pour enregistrer l'acte - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectactesmedicaux/enregistreractemedical/", - type: 'post', - data: donnees, - error: function(errorData) { - // Gestion des erreurs (à compléter selon les besoins) - }, - success: function(data) { - // $('#div_test_gabarit').html(data); - donnee_a_affciher = data; - }, - complete: function() { - // Mise à jour de l'interface après l'enregistrement - $("#totam_donnees").html(donnee_a_affciher); - appliquerDataTable(); - majgestionacte(); - } - }); -} - -function verifie_statut_acte_selection(codeActe, prixBase, prixActe, ententePrealable) -{ - datePrestation = $("#datePrestation").val(); - - nomForm = $("#nomForm").val(); - - donnees = "codeActe="+codeActe+"&datePrestation="+datePrestation; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxstatutacte/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#div_statutacte").html(data); - - var statut = $("#statut").val(); - - if(statut=="1"){ - if(nomForm=="frmactesmedicaux"){ - ajouter_un_acte_selection(codeActe, prixBase, prixActe, ententePrealable); - }else if(nomForm=="miseEnObservation"){ - ajouter_un_acte_miseenobservation(codeActe, prixBase, prixActe, ententePrealable); - } - - }else{ - var libelleMotif = $("#libelleMotif").val(); - var libelleMotifEng = $("#libelleMotifEng").val(); - - alert_ebene(libelleMotif, libelleMotifEng); - - faireDefileMessage(libelleMotif, libelleMotifEng); - return; - } - }, - complete: function() { - - } - }); - -} - -//06-06-2023 -function ajax_btn_avishospitalisation() -{ - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxbtnavishospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#div_btn_avis").html(data); - - }, - complete: function() { - - } - }); - -} - - - -//07-06-2023 -function majgestionacte(){ - - nbreActesPrescrits = $("#nbreActesPrescrits").val(); - - donnees = "nbreActesPrescrits="+nbreActesPrescrits; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectactesmedicaux/majgestionacte/", - type: 'POST', - data: donnees, - success: function(data) { - - }, - error: function(data) { - }, - complete: function() { - - } - }); -} - -// 1 - modifieravisprorogationhospitalisation() -// 0 - avisprorogationhospitalisation() - -function verifiestatutprorogationhospitalisation(id, codeTypeHospitalisationPro) -{ - - motifProlongation = $("#motifProlongation").val(); - quantite = $("#quantite").val(); - datePrestation = $("#debut").val(); - - codeActeChambre = $("#codeActeChambre").val(); - - - if (motifProlongation <= " ") - { - v_msg="Veuillez renseigner le motif d'hospitalisation!"; - v_msgEng="Please fill in the reason for hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#motifProlongation").focus(); - return; - } - - /* - if (codeTypeHospitalisationPro <= " ") - { - v_msg="Veuillez renseigner le type d'hospitalisation!"; - v_msgEng="Please fill in the type of hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#codeTypeHospitalisationPro").focus(); - return; - } - */ - - if (codeActeChambre <= " ") - { - v_msg="Veuillez renseigner le type de chambre!"; - v_msgEng="Please enter the room type!"; - alert_ebene(v_msg, v_msgEng); - - $("#codeActeChambre").focus(); - return; - } - - if (quantite == "0") - { - v_msg="Veuillez renseigner le nombre de jours pr\u00e9visionnels d'hospitalisation!"; - v_msgEng="Please fill in the estimated number of days of hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#quantite").focus(); - return; - } - - if(codeTypeHospitalisationPro == "option-1"){ - codeActe = "HHM"; - }else if (codeTypeHospitalisationPro == "option-3"){ - codeActe = "HHC"; - }else{ - codeActe = ""; - } - - donnees = "codeActe="+codeActe+"&datePrestation="+datePrestation; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxstatutacte/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#div_statutacte").html(data); - - var statut = $("#statut").val(); - - if(statut=="1"){ - if(id=="0"){ - avisprorogationhospitalisation(); - }else if(id=="1"){ - modifieravisprorogationhospitalisation(); - } - }else{ - var libelleMotif = $("#libelleMotif").val(); - var libelleMotifEng = $("#libelleMotifEng").val(); - - alert_ebene(libelleMotif, libelleMotifEng); - - return; - } - }, - complete: function() { - - } - }); - -} - -function avisprorogationhospitalisation() -{ - // - motifProlongation = $("#motifProlongation").val(); - quantite = $("#quantite").val(); - debut = $("#debut").val(); - codeTypeHospitalisationPro = $("#codeTypeHospitalisationPro").val(); - - dateDebutPro = $("#dateDebutPro").val(); - dateJour = $("#dateJour").val(); - optionHospitalisationPro= $("#optionHospitalisationPro").val(); - - idProlongation = $("#idProlongation").val(); - - prixChambre = $("#prixChambre").val(); - - prixChambreProlongation = $("#prixChambreProlongation").val(); - - codeActeChambre = $("#codeActeChambre").val(); - - - if (idProlongation==undefined || idProlongation == "0") { - - if (prixChambre==undefined || prixChambre == "0") - { - v_msg="Prorogation impossible! Vous n'avez pas saisi de prix de la derni\u00e8re chambre d'hospitalisation."; - v_msgEng="Impossible extension! You did not enter a price for the last hospital room."; - alert_ebene(v_msg, v_msgEng); - - $("#btn_close_pop").click(); - - return; - } - }else{ - if (prixChambreProlongation==undefined || prixChambreProlongation == "0") - { - v_msg="Prorogation impossible! Vous n'avez pas saisi de prix pour la derni\u00e8re chambre d'hospitalisation."; - v_msgEng="Impossible extension! You did not enter a price for the last hospital room."; - alert_ebene(v_msg, v_msgEng); - - $("#btn_close_pop").click(); - - return; - } - - } - - - var td0 = new Date(dateDebutPro); - var tdj = new Date(dateJour); - - dt0=Math.round(Date.parse(td0)/(1000*3600*24)); - dtj=Math.round(Date.parse(tdj)/(1000*3600*24)); - - //alert('dateDebutPro ='+dt0+' dateJour='+dtj); - //return; - - - if(codeTypeHospitalisationPro == optionHospitalisationPro){ - if (dtj < dt0) - { - v_msg="Prorogation impossible! Veuillez attendre la fin de l'hospitalisation en cours avant de la proroger."; - v_msgEng="Extension not possible! Please wait until the end of the current hospitalization before extending it."; - alert_ebene(v_msg, v_msgEng); - - return false; - } - } - - - //alert("dateDebutPro="+dateDebutPro+", dateJour="+dateJour); return; - - - donnees = 'motifProlongation='+motifProlongation; - donnees += '&quantite='+quantite+'&debut='+debut; - donnees += '&codeTypeHospitalisationPro='+codeTypeHospitalisationPro; - donnees += '&codeActeChambre='+codeActeChambre; - - if (codeTypeHospitalisationPro=="option-1"){ - codeActe = "HHM"; - } - - if (codeTypeHospitalisationPro=="option-3"){ - codeActe = "HHC"; - } - - numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); - - //donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&quantite='+quantite+'&motifHospit='+motifProlongation+'&typeMail=mailententeprealable'; - - //typeSms = "hospitalisation"; - - //alert(donnees); return; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerchambre/avisprorogationhospit/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - //preparesms(typeSms); - //alertsmsavis(typeSms); - - v_msg="Avis de prorogation d'hospitalisation envoy\u00e9 avec succ\u00e8s, merci de patienter un instant pour la suite..."; - v_msgEng="Notice of extension of hospitalization sent successfully, please wait a moment for the rest..."; - - alert_ebene_callback(v_msg, v_msgEng, function() { - window.location.assign($("#racineWeb").val()+"Feuillemaladie/"); - }); - - return; - - }, - complete: function() { - mettremailattente(donnees_sav); - - } - }); - -} - -function modifieravisprorogationhospitalisation() -{ - // - motifProlongation = $("#motifProlongation").val(); - quantite = $("#quantite").val(); - debut = $("#debut").val(); - codeTypeHospitalisationPro = $("#codeTypeHospitalisationPro").val(); - optionHospitalisationPro= $("#optionHospitalisationPro").val(); - - idProlongation = $("#idProlongation").val(); - - prixChambre = $("#prixChambre").val(); - - prixChambreProlongation = $("#prixChambreProlongation").val(); - - dateDebutPro = $("#dateDebutPro").val(); - dateJour = $("#dateJour").val(); - - codeActeChambre = $("#codeActeChambre").val(); - - - - if (idProlongation==undefined || idProlongation == "0") { - - if (prixChambre==undefined || prixChambre == "0") - { - v_msg="Prorogation impossible! Vous n'avez pas saisi de prix de la derni\u00e8re chambre d'hospitalisation."; - v_msgEng="Impossible extension! You did not enter a price for the last hospital room."; - alert_ebene(v_msg, v_msgEng); - - $("#btn_close_pop").click(); - - return; - } - }else{ - if (prixChambreProlongation==undefined || prixChambreProlongation == "0") - { - v_msg="Prorogation impossible! Vous n'avez pas saisi de prix pour la derni\u00e8re chambre d'hospitalisation."; - v_msgEng="Impossible extension! You did not enter a price for the last hospital room."; - alert_ebene(v_msg, v_msgEng); - - $("#btn_close_pop").click(); - - return; - } - - } - - - - var td0 = new Date(dateDebutPro); - var tdj = new Date(dateJour); - - dt0=Math.round(Date.parse(td0)/(1000*3600*24)); - dtj=Math.round(Date.parse(tdj)/(1000*3600*24)); - - //alert('dateDebutPro ='+dt0+' dateJour='+dtj); - //return; - - if(codeTypeHospitalisationPro == optionHospitalisationPro){ - if (dtj < dt0) - { - v_msg="Prorogation impossible! Veuillez attendre la fin de l'hospitalisation en cours avant de la proroger."; - v_msgEng="Extension not possible! Please wait until the end of the current hospitalization before extending it."; - alert_ebene(v_msg, v_msgEng); - - return false; - } - } - - donnees = 'motifProlongation='+motifProlongation; - donnees += '&quantite='+quantite+'&debut='+debut; - donnees += '&codeTypeHospitalisationPro='+codeTypeHospitalisationPro; - donnees += '&codeActeChambre='+codeActeChambre; - - if (codeTypeHospitalisationPro=="option-1"){ - codeActe = "HHM"; - } - - if (codeTypeHospitalisationPro=="option-3"){ - codeActe = "HHC"; - } - - numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); - - //donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&quantite='+quantite+'&motifHospit='+motifProlongation+'&typeMail=mailententeprealable'; - - //typeSms = "hospitalisation"; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerchambre/avisprorogationhospit/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - //preparesms(typeSms); - //alertsmsavis(typeSms); - - v_msg="Avis de prorogation d'hospitalisation modifi\u00e9 avec succ\u00e8s, merci de patienter un instant pour la suite..."; - v_msgEng="Notice of extension of hospitalization modified successfully, please wait a moment for the rest..."; - - alert_ebene_callback(v_msg, v_msgEng, function() { - window.location.assign($("#racineWeb").val()+"Feuillemaladie/"); - }); - - return; - - }, - complete: function() { - //mettremailattente(donnees_sav); - - } - }); - -} - -function re_init_photo_face() -{ - var photo = document.getElementById('photo_face'); - photo.setAttribute('src', ""); - $('#message_face').html(""); - $('#image_face').val(""); - $("#div_wait_face_ebene").html(''); -} - -function ebene_init_photo_face() // OK -{ - faceRegistered = $("#faceRegistered").val(); - if(faceRegistered=="1") - { - v_msg="Cettte personne a déjà une face dans le système!"; - v_msgEng="This person already has a face in the system!"; - alert_ebene(v_msg, v_msgEng); - $('#message_face').html(""); - return; - } - re_init_photo_face(); - $("#btn_pop_save_face").click(); -} - - -function ebene_init_confirm_photo_face() // OK -{ - faceRegistered = $("#faceRegistered").val(); - if(faceRegistered!="1") - { - v_msg="Cettte personne n'a pas encore de face dans le système!"; - v_msgEng="This person doesn't have a face in the system yet!"; - alert_ebene(v_msg, v_msgEng); - $('#message_face').html(""); - return; - } - - re_init_photo_face(); - $("#btn_pop_save_face").click(); - -} - -function ebene_enregistrer_photo_face() // OK -{ - $("#ebene_confirmer_photo_face").disable(); - $("#ebene_supprimer_photo_face").disable(); - $("#ebene_take_photo_face").disable(); - $("#motif").disable(); - - $("ebene_confirmer_photo_face").prop('disabled', true); - $("ebene_supprimer_photo_face").prop('disabled', true); - $("ebene_take_photo_face").prop('disabled', true); - $("motif").prop('disabled', true); - - $('#message_face').html(""); - $("#div_wait_face_ebene").html(''); - - $("#okId").val("-1"); - $("#okId_face").val("-1"); - - $("#del_face").val("0"); - image_face = $("#image_face").val(); - if(image_face<=" ") - { - v_msg="Veuillez prendre une photo!"; - v_msgEng="Please take a photo!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - $("#div_wait_face_ebene").html('
' + '
'); - - compare_face = $("#compare_face").val(); - - var dataURL = canvas.toDataURL("image/jpeg"); - - $.ajax({ - url: $("#racineWeb").val()+"Fichebeneficiaire/ebeneenregistrerface/", - type: 'POST', - data: {'image_face' : dataURL, 'compare_face' : compare_face , 'del_face' : "0"}, - success: function(data) { - $("#ebene_take_photo_face").enable(); - $("#div_wait_face_ebene").html(''); - $("#message_face").html(data); - photo_succes = $("#photo_succes").val(); - if(photo_succes=="1") - { - v_msg="Enrôlement effectué avec succès!"; - v_msgEng="Enrollment completed successfully!!"; - // alert_ebene(v_msg, v_msgEng); - setTimeout(() => { - window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"); - }, 1000) - } - }, - error: function(data) { - }, - complete: function(data) { - $("#div_wait_face_ebene").html(''); - } - }); -} - -function ebene_confirmer_photo_face() // OK -{ - $("#ebene_confirmer_photo_face").disable(); - $("#ebene_supprimer_photo_face").disable(); - $("#ebene_take_photo_face").disable(); - $("#motif").disable(); - - $("ebene_confirmer_photo_face").prop('disabled', true); - $("ebene_supprimer_photo_face").prop('disabled', true); - $("ebene_take_photo_face").prop('disabled', true); - $("motif").prop('disabled', true); - - $('#message_face').html(""); - $("#div_wait_face_ebene").html(''); - - $("#del_face").val("0"); - faceRegistered = $("#faceRegistered").val(); - if(faceRegistered!="1") - { - v_msg="Cette personne n'a pas encore de photo dans le système!"; - v_msgEng="This person does not have a photo in the system yet!"; - alert_ebene(v_msg, v_msgEng); - $('#message_face').html(""); - return; - } - - image_face = $("#image_face").val(); - if(image_face<=" ") - { - v_msg="Veuillez prendre une photo!"; - v_msgEng="Please take a photo!"; - alert_ebene(v_msg, v_msgEng); - $('#message_face').html(""); - return; - } - - $("#div_wait_face_ebene").html('
' + '
'); - - compare_face = $("#compare_face").val(); - - var dataURL = canvas.toDataURL("image/jpeg"); - - $.ajax({ - url: $("#racineWeb").val()+"Fichebeneficiaire/ebeneenregistrerface/", - type: 'POST', - data: {'image_face' : dataURL, 'compare_face' : compare_face , 'del_face' : "0"}, - success: function(data) { - $("#ebene_take_photo_face").enable(); - $("#div_wait_face_ebene").html(''); - $("#message_face").html(data); - photo_succes = $("#photo_succes").val(); - if(photo_succes=="1") - { - $("#okId_face").val("1"); - v_msg="Face confirmée!"; - v_msgEng="Face confirmed!"; - // alert_ebene(v_msg, v_msgEng); - setTimeout(() => { - // consultation(); - fiche_beneficiaire(); - }, 1000) - } - else - { - $("#okId").val("-1"); - $("#okId_face").val("-1"); - } - }, - error: function(data) { - }, - complete: function(data) { - $("#div_wait_face_ebene").html(''); - } - }); -} - - -function ebene_supprimer_photo_face() // OK -{ - $('#message_face').html(""); - $("#div_wait_face_ebene").html(''); - - motif=$("#motif").val(); - motif= motif.trim(); - $("#motif").val(motif); - - if (motif<=" ") - { - v_msg="Veuillez saisir un motif!"; - v_msgEng="Please enter a reaon!"; - alert_ebene(v_msg, v_msgEng); - - $("#motif").focus(); - return; - } - - $("#del_face").val("1"); - - faceRegistered = $("#faceRegistered").val(); - if(faceRegistered!="1") - { - v_msg="Cette personne n'a pas encore de photo dans le système!"; - v_msgEng="This person does not have a photo in the system yet!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - image_face = $("#image_face").val(); - if(image_face<=" ") - { - v_msg="Veuillez prendre une photo!"; - v_msgEng="Please take a photo!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - v_msg="Confirmez-vous cette suppression?"; - v_msgEng="Do you confirm this deletion?"; - - if(confirm_ebene(v_msg, v_msgEng)) - { - $("#ebene_confirmer_photo_face").disable(); - $("#ebene_supprimer_photo_face").disable(); - $("#ebene_take_photo_face").disable(); - $("#motif").disable(); - - $("ebene_confirmer_photo_face").prop('disabled', true); - $("ebene_supprimer_photo_face").prop('disabled', true); - $("ebene_take_photo_face").prop('disabled', true); - $("motif").prop('disabled', true); - - $("#div_wait_face_ebene").html('
' + '
'); - - compare_face = $("#compare_face").val(); - - var dataURL = canvas.toDataURL("image/jpeg"); - - $.ajax({ - url: $("#racineWeb").val()+"Fichebeneficiaire/ebeneenregistrerface/", - type: 'POST', - data: {'image_face' : dataURL, 'compare_face' : compare_face, 'del_face' : "1", 'motif' : motif}, - success: function(data) { - $("#ebene_take_photo_face").enable(); - $("#div_wait_face_ebene").html(''); - $("#message_face").html(data); - photo_succes = $("#photo_succes").val(); - if(photo_succes=="1") - { - $("#okId").val("-1"); - $("#okId_face").val("-1"); - - document.getElementById('photo_face').setAttribute('src', ""); - - $("#faceRegistered").val("0"); - - $("#ebene_confirmer_photo_face").disable(); - $("#ebene_supprimer_photo_face").disable(); - $("#motif").disable(); - - $("ebene_confirmer_photo_face").prop('disabled', true); - $("ebene_supprimer_photo_face").prop('disabled', true); - $("motif").prop('disabled', true); - - v_msg="Face supprimée avec succès!"; - v_msgEng="Face removed successfully!"; - // alert_ebene(v_msg, v_msgEng); - setTimeout(() => { - window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"); - }, 1000) - } - }, - error: function(data) { - }, - complete: function(data) { - $("#div_wait_face_ebene").html(''); - } - }); - } -} - -function fiche_beneficiaire() -{ - window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"); -} - - -function controler_bon_principal() -{ - - - bonPrincipal = $("#bonPrincipal").val(); - - donnees = "bonPrincipal="+bonPrincipal; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxcontrolerbonprincipal/", - type: 'POST', - data: donnees, - success: function(data) { - - if(data=="0"){ - v_msg="Ce numéro de bon est incorrect!"; - v_msgEng="This voucher number is wrong!"; - alert_ebene(v_msg, v_msgEng); - - $("#bonPrincipal").val("0"); - - return; - }else{ - return; - } - - }, - error: function(data) { - }, - complete: function() { - - } - }); - -} - -function conserver_infos_consultation() -{ - codeMedecin = $("#codeMedecin").val(); - codeActe = $("#codeActe").val(); - - codeRaisonConsultation = $("#codeRaisonConsultation").val(); - observations = $("#observations").val(); - bonPrincipal = $("#bonPrincipal").val(); - - donnees = 'codeMedecin='+codeMedecin; - donnees += '&codeActe='+codeActe; - donnees += '&codeRaisonConsultation='+codeRaisonConsultation; - donnees += '&observations='+observations; - donnees += '&bonPrincipal='+bonPrincipal; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxconserverconsultation/", - type: 'POST', - data: donnees, - success: function(data) { - - - }, - error: function(data) { - }, - complete: function() { - - } - }); - -} - -function enregistrerdemandederogationbareme(codeDerogation, libelleDerogation, codeActe, codeGarantie, derogationAccorde) -{ - - // - if(derogationAccorde!="0"){ - if(derogationAccorde=="2"){ - v_msg="La demande de dérogation est en cours de traitement! Veuillez patienter!"; - v_msgEng="Your Request is being processed! Please wait for the answer..."; - alert_ebene(v_msg, v_msgEng); - }else if(derogationAccorde=="9"){ - v_msg="La demande de dérogation a été refusée!"; - v_msgEng="The exemption request has been refused!"; - - faireDefileMessage(v_msg, v_msgEng); - - }else{ - faireDefileMessage("", ""); - } - - getstatutacte(codeActe); - - return; - } - - numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); - - donnees = 'codeDerogation='+codeDerogation+'&observations='+libelleDerogation+'&libelleDerogation='+libelleDerogation; - donnees += '&codeActe='+codeActe+'&codeGarantie='+codeGarantie+'&numeroFeuilleMaladie'+numeroFeuilleMaladie; - - idBeneficiaire = $("#idBeneficiaire_C").val(); - prestataire = $("#prestataire_C").val(); - - - donnees_sav = donnees+'&prestataire='+prestataire+'&idBeneficiaire='+idBeneficiaire+'&typeMail=maildemandederogation'; - - typeSms = "demandederogation"; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerdemandederogation/enregistrerdemandederogationbareme/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - preparesms(typeSms); - }, - complete: function() - { - mettremailattente(donnees_sav); - - v_msg="Demande envoy\u00e9e avec succès!"; - v_msgEng="Request sent successfully!"; - alert_ebene(v_msg, v_msgEng); - - //getstatutactederogation(codeActe, derogationAccorde); - - getstatutacte(codeActe); - - } - }); - -} - -function ajax_maj_duree_medicament(idMedicament, duree, controle) -{ - duree=duree.replace(",","."); - controle.value=duree; - - if(controle_numerique(controle)) - { - if(duree==0) - { - controle.focus(); - v_msg="Veuillez saisir la dur\u00e9e du traitement!"; - v_msgEng="Please enter the treatment duration!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - donnees = 'idMedicament='+idMedicament+"&duree="+duree; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailprescription/majduree/", - type: 'POST', - data: donnees, - success: function(data) { - $("#medicaments").html(data); - }, - error: function(data) { - }, - complete: function() { - //controle.focus(); - } - }); - } -} - - -function ajaxmajmotifacte() -{ - donnees = 'motifActe='+$('#motifActe').val(); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectactesmedicaux/majmotifacte/", - type: 'POST', - data: donnees, - success: function(data) { - - }, - error: function(data) { - }, - complete: function() { - - } - }); - -} - - - -///////////////// - -function proforma_hopitalisation() -{ - window.location.assign($("#racineWeb" ).val()+"Proformahospitalisation/"); - -} - -function chargernumero(numero) -{ - //var nomForm = $('#nomForm').val(); - - var donnees = 'numero='+ numero; - - - vLink = "Ajaxchargernumerobeneficiaire/"; - - $.ajax({ - type: "POST", - url: $("#racineWeb").val()+vLink, - data:donnees, - beforeSend: function(){ - $("#searchInputB").css("background","#FFF url(Bootstrap/images/LoaderIcon.gif) no-repeat 165px"); - }, - success: function(data){ - $("#div_selectionB").show(); - $("#div_selectionB").html(data); - $("#searchInputB").css("background","#FFF"); - } - }); -} - -function selectBeneficiaire(id, numero, nom, nomPolice, nomCollege, codeLienParente, numeroAdherent, adherent){ - - var nomForm = $('#nomForm').val(); - - ajax_beneficiaire_contexte(id); - - if(nomForm == "proformahospitalisation"){ - ajaxbeneficiairecouvert(id); - } - - $("#searchInputB").val(numero); - $("#div_selectionB").hide(); - $("#nomAssure").val(nom); - $("#idBeneficiaire").val(id); - - $("#nomPolice").val(nomPolice); - $("#nomCollege").val(nomCollege); - $("#codeLienParente").val(codeLienParente); - - $("#noAdherent").val(numeroAdherent); - $("#nomAdherent").val(adherent); - - donnees = "idBeneficiaire="+id; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxproformahospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - }, - complete: function(data) { - - } - }); - -} - - -function add_selected_acte_proforma_hosp(controle) -{ - - - var nomForm = $("#nomForm").val(); - - var str = controle.split(' <==> '); - - var codeActe = str[0]; - var libelleActe = str[1]; - var prixTarif = 0; - var acteExclu = str[3]; - var ententePrealable = 0; - - if(acteExclu=="Garanti"){ - acteExclu=0; - }else{ - acteExclu=1; - } - - if(libelleActe<=" ") - { - $("#codeActe").focus(); - return; - } - - if(acteExclu==1) - { - v_msg="Acte non couvert!"; - v_msgEng="Not covered!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - idBeneficiaire = $("#idBeneficiaire").val(); - optionHospitalisation = "option-3";//$("#optionHospitalisation").val(); - dateDebut = $("#dateDebut").val(); - duree = $("#duree").val(); - motif = $("#motif").val(); - codeMedecin = $("#codeMedecin").val(); - - idProforma = $("#idProformaHospitalisation").val(); - - donnees = 'codeActe='+codeActe+'&ententePrealable='+ententePrealable; - donnees += '&prixTarif='+prixTarif+'&acteExclu='+acteExclu; - donnees += '&idBeneficiaire='+idBeneficiaire+'&motif='+motif; - donnees += '&optionHospitalisation='+optionHospitalisation; - donnees += '&dateDebut='+dateDebut+'&duree='+duree+'&codeMedecin='+codeMedecin; - - $("#div_attente").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxchargeractesproformahospitalisation/ajouteracte/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#searchInput").val(''); - - $("#div_prestations").html('
' + '
'); - - if(idProforma > 0){ - if(nomForm=="hospitalisationproforma"){ - window.location.assign($("#racineWeb" ).val()+"Hospitalisationproforma/"+idProforma+"/"); - }else{ - window.location.assign($("#racineWeb" ).val()+"Proformahospitalisation/"); - } - - }else{ - if(nomForm=="hospitalisationproforma"){ - window.location.assign($("#racineWeb" ).val()+"Hospitalisationproforma/"); - }else{ - window.location.assign($("#racineWeb" ).val()+"Proformahospitalisation/"); - } - } - - }, - complete: function(data) { - - } - }); - -} - -function affichedetailproformahopitalisation() -{ - - idBeneficiaire = $("#idBeneficiaire").val(); - dateDebut = $("#dateDebut").val(); - - if(idBeneficiaire>"0" && dateDebut>" ") - { - ajaxactes_proforma_hospitalisation(); - } - -} - - -function ajaxactes_proforma_hospitalisation() -{ - nomForm = $("#nomForm").val(); - idBeneficiaire = $("#idBeneficiaire").val(); - optionHospitalisation = "option-3";//$("#optionHospitalisation").val(); - dateDebut = $("#dateDebut").val(); - - donnees = 'idBeneficiaire='+idBeneficiaire; - donnees += '&optionHospitalisation='+optionHospitalisation; - donnees += '&dateDebut='+dateDebut; - - $("#div_prestations").html('
' + '
'); - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxactesproformahospitalisation/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - - $("#div_prestations").html(data); - - if(nomForm=="proformahospitalisation"){ - motifProforma = $("#motif").val(); - dureeProforma = $("#duree").val(); - codeMedecinProforma = $("#codeMedecin").val(); - codeMedecinProforma = $("#codeMedecin").val(); - codeAffectionProforma = $("#codeAffection").val(); - - motif = $("#motif").val(motifProforma); - duree = $("#duree").val(dureeProforma); - codeMedecin = $("#codeMedecin").val(codeMedecinProforma); - codeAffection = $("#codeMedecin").val(codeAffectionProforma); - } - - }, - complete: function() { - - } - }); -} - -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()+"Ajaxactesproformahospitalisation/majvaleuracte/", - type: 'POST', - data: donnees, - success: function(data) { - - }, - error: function(data) { - }, - complete: function() { - - ajaxactes_proforma_hospitalisation(); - } - }); - } -} - -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()+"Ajaxactesproformahospitalisation/majquantite/", - type: 'POST', - data: donnees, - success: function(data) { - - }, - error: function(data) { - }, - complete: function() { - ajaxactes_proforma_hospitalisation(); - - } - }); - } -} - -/** - * Supprime un acte proforma d'une hospitalisation après confirmation - * @param {string} idPrestationactes - L'identifiant de la prestation à supprimer - * @param {string} codeTypePrestation - Le code type de la prestation - */ -async function supprimer_acte_proforma_hospitalisation(idPrestationactes, codeTypePrestation) { - // Préparation des données pour la requête AJAX - const donnees = `idPrestationactes=${idPrestationactes}&codeTypePrestation=${codeTypePrestation}`; - - // Demande de confirmation à l'utilisateur - const isConfirmed = await confirm_ebene_sweet( - "Confirmez-vous cette suppression?", - "Do you confirm this deletion?" - ); - - // Si l'utilisateur confirme la suppression - if (isConfirmed) { - // Affichage du message d'attente - $("#div_prestations").html('
' + '
'); - - // Envoi de la requête AJAX pour suppression - try { - await $.ajax({ - url: $("#racineWeb").val() + "Ajaxactesproformahospitalisation/supprimeracte/", - type: 'POST', - data: donnees - }); - } catch (error) { - // Gestion silencieuse des erreurs (comme dans le code original) - } finally { - // Rechargement de la liste des prestations après suppression - ajaxactes_proforma_hospitalisation(); - } - } -} - - -/** - * Fonction pour initialiser/réinitialiser un formulaire d'hospitalisation - * - Vide tous les champs du formulaire - * - Réinitialise les sessions via AJAX - * - Recharge la page après traitement - */ -async function init_proforma_hopitalisation() { - // Messages de confirmation multilingues - const v_msg = "Confirmez-vous cette la réinitialisation?"; - const v_msgEng = "Do you confirm this reset?"; - - // Demande de confirmation à l'utilisateur - const isConfirm = await confirm_ebene_sweet(v_msg, v_msgEng); - - if (!isConfirm) { - return; // Annulation par l'utilisateur - } - - // Réinitialisation des champs du formulaire - $("#searchInputB").val(""); - $("#div_selectionB").hide(); - $("#nomAssure").val(""); - $("#idBeneficiaire").val("0"); - - $("#nomPolice").val(""); - $("#nomCollege").val(""); - $("#codeLienParente").val(""); - - $("#noAdherent").val(""); - $("#nomAdherent").val(""); - - $("#dateDebut").val(""); - $("#duree").val("0"); - - $("#motif").val(""); - - $("#codeMedecin").val(""); - $("#codeAffection").val(""); - - $("#searchInput").val(''); - - // Vidage des divs de contenu - $("#div_prestations").html(""); - $("#div_couverture").html(""); - $("#div_messages").html(""); - - // Réactivation des champs - $("#dateDebut").enable(); - $("#duree").enable(); - $("#motif").enable(); - $("#codeMedecin").enable(); - $("#codeAffection").enable(); - - // Mise à jour des select pickers - $('.selectpicker').selectpicker('refresh'); - - // Appel AJAX pour nettoyer la session - $.ajax({ - url: $("#racineWeb").val() + "Ajaxproformahospitalisation/unsetsession/", - type: 'POST', - data: '', - success: function(data) { - // Callback si besoin - }, - error: function(data) { - // Gestion d'erreur si besoin - }, - complete: function() { - // Redirection après nettoyage - window.location.assign($("#racineWeb").val() + "Proformahospitalisation/"); - } - }); -} - -/** - * Fonction pour valider une proforma d'hospitalisation - * - Effectue plusieurs vérifications préalables - * - Valide la proforma via un appel AJAX - * - Affiche les messages appropriés - */ -async function valider_proforma_hopitalisation() { - // Récupération des valeurs du formulaire - const idBeneficiaire = $("#idBeneficiaire").val(); - const motif = $("#motif").val(); - const dateDebut = $("#dateDebut").val(); - const duree = $("#duree").val(); - const codeReponseEntentePrealable = $("#codeReponseEntentePrealable").val(); - const nbreActe = $("#nbreActe").val(); - const demandeTraite = $("#demandeTraite").val(); - const ligneZero = $("#ligneZero").val(); - const idProforma = $("#idProforma").val(); - const numeroEntentePrealable = $("#numeroEntentePrealable").val(); - - // Vérification 1: Proforma déjà validée - if (codeReponseEntentePrealable > " ") { - alert_ebene( - "Proforma déjà validée!", - "Proforma already validated!" - ); - return; - } - - // Vérification 2: Proforma déjà traitée - if (demandeTraite > "0") { - alert_ebene( - "Proforma déjà traitée!", - "Proforma already processed!" - ); - return; - } - - // Vérification 3: Aucun acte sélectionné - if (nbreActe == "0") { - alert_ebene( - "Veuillez sélectionner et ajouter des actes à la proforma!", - "Please select and add acts to the proforma!" - ); - return; - } - - // Vérification 4: Bénéficiaire non sélectionné - if (idBeneficiaire == '0' || idBeneficiaire <= " ") { - alert_ebene( - "Veuillez sélectionner un No Bénéficiaire!", - "Please select a Beneficiary Number!" - ); - $("#searchInput").val(''); - $("#searchInputB").focus(); - return; - } - - // Vérification 5: Motif non renseigné - if (motif <= " ") { - alert_ebene( - "Veuillez renseigner le motif d'hospitalisation!", - "Please fill in the reason for hospitalization!" - ); - $("#searchInput").val(''); - $("#motif").focus(); - return; - } - - // Vérification 6: Date non renseignée - if (dateDebut <= " ") { - alert_ebene( - "Veuillez saisir la date de début!", - "Please enter the start date!" - ); - $("#dateDebut").focus(); - return; - } - - // Vérification 7: Durée non renseignée - if (duree == "0") { - alert_ebene( - "Veuillez renseigner le nombre de jours prévisionnels d'hospitalisation!", - "Please fill in the estimated number of days of hospitalization!" - ); - $("#duree").focus(); - return; - } - - // Vérification 8: Aucun acte ajouté - if (idProforma == "0") { - alert_ebene( - "Veuillez d'abord, ajouter, au moins un acte!", - "Please first add at least one act" - ); - return; - } - - // Vérification 9: Lignes nulles présentes - if (ligneZero == "1") { - alert_ebene( - "Il y a des lignes nulles! Supprimer les ou entrer leurs montants.", - "There are zero lines! Delete them or enter their amounts." - ); - return; - } - - // Préparation des données pour l'AJAX - const donnees = 'idProforma=' + idProforma; - - // Demande de confirmation - const isConfirm = await confirm_ebene_sweet( - "Validez-vous cette Proforma?", - "Do you validate this Proforma?" - ); - - if (!isConfirm) return; - - // Appel AJAX pour validation - try { - await $.ajax({ - url: $("#racineWeb").val() + "Ajaxproformahospitalisation/valider/", - type: 'post', - data: donnees - }); - - // Message de succès si nouvelle entente - if (numeroEntentePrealable == "0") { - alert_ebene( - "La facture proforma d'hospitalisation No: " + idProforma + " envoyé avec succès!", - "The proforma hospitalization invoice No: " + idProforma + " sent successfully" - ); - } - - // Fermeture de la proforma - fermer_proforma_hospitalisation(); - } catch (error) { - // Gestion des erreurs (à adapter selon les besoins) - console.error("Erreur lors de la validation:", error); - } -} - - -function fermer_proforma_hospitalisation() -{ - window.location.assign($("#racineWeb" ).val()+"Historiqueproformahospitalisation/"); - -} - - -function save_nv_consommable_proformahospit() -{ - idProforma = $("#idProformaHospitalisation").val(); - nomForm = $("#nomForm").val(); - - if(idProforma=="0"){ - v_msg="Veuillez d'abord, ajouter, au moins un acte!"; - v_msgEng="Please first add at least one act"; - alert_ebene(v_msg, v_msgEng); - - if(nomForm=="hospitalisationproforma"){ - window.location.assign($("#racineWeb" ).val()+"Hospitalisationproforma/"); - }else{ - window.location.assign($("#racineWeb" ).val()+"Proformahospitalisation/"); - } - //return; - } - - 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()+"Ajaxlisteconsommables/creerconsommableproformahospit/", - type: 'POST', - data: donnees, - success: function(data) { - - }, - error: function(data) { - }, - complete: function() { - //attribution_chambre(); - - $("#div_prestations").html('
' + '
'); - - if(idProforma > 0){ - if(nomForm=="hospitalisationproforma"){ - window.location.assign($("#racineWeb" ).val()+"Hospitalisationproforma/"+idProforma+"/"); - }else{ - window.location.assign($("#racineWeb" ).val()+"Proformahospitalisation/"); - } - - }else{ - if(nomForm=="hospitalisationproforma"){ - window.location.assign($("#racineWeb" ).val()+"Hospitalisationproforma/"); - }else{ - window.location.assign($("#racineWeb" ).val()+"Proformahospitalisation/"); - } - } - - - } - }); -} - - -/** - * Fonction pour enregistrer l'en-tête d'une proforma d'hospitalisation - * - Effectue plusieurs validations des champs obligatoires - * - Enregistre les données via AJAX - * - Redirige vers la page appropriée après enregistrement - */ -async function enregistrer_entete_proforma_hospitalisation() { - // Récupération des valeurs du formulaire - const optionHospitalisation = "option-3"; // Valeur fixe pour l'option d'hospitalisation - const dateDebut = $("#dateDebut").val(); - const codeMedecin = $("#codeMedecin").val(); - const duree = $("#duree").val(); - const motif = $("#motif").val(); - const idProformaHospitalisation = $("#idProformaHospitalisation").val(); - const codeAffection = $("#codeAffection").val(); - const numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); - const idBeneficiaire = $("#idBeneficiaire_C").val(); - const codePrestataire = $("#codePrestataire_C").val(); - - // Validation 1: Motif d'hospitalisation - if (motif <= " ") { - alert_ebene( - "Veuillez renseigner le motif d'hospitalisation!", - "Please fill in the reason for hospitalization!" - ); - $("#searchInput").val(''); - $("#motif").focus(); - return; - } - - // Validation 2: Date de début - if (dateDebut <= " ") { - alert_ebene( - "Veuillez saisir la date de début!", - "Please enter the start date!" - ); - $("#searchInput").val(''); - $("#dateDebut").focus(); - return; - } - - // Validation 3: Durée d'hospitalisation - if (duree == "0") { - alert_ebene( - "Veuillez renseigner le nombre de jours prévisionnels d'hospitalisation!", - "Please fill in the estimated number of days of hospitalization!" - ); - $("#searchInput").val(''); - $("#duree").focus(); - return; - } - - // Validation 4: Médecin sélectionné - if (codeMedecin <= " ") { - alert_ebene( - "Veuillez sélectionner un médecin!", - "Please select a doctor!" - ); - $("#codeMedecin").focus(); - return; - } - - // Préparation des données pour l'AJAX - let donnees = `optionHospitalisation=${optionHospitalisation}&motif=${motif}`; - donnees += `&dateDebut=${dateDebut}&duree=${duree}&codeMedecin=${codeMedecin}`; - donnees += `&idProformaHospitalisation=${idProformaHospitalisation}`; - donnees += `&numeroFeuilleMaladie=${numeroFeuilleMaladie}`; - donnees += `&idBeneficiaire=${idBeneficiaire}&codePrestataire=${codePrestataire}`; - donnees += `&codeAffection=${codeAffection}`; - - // Demande de confirmation - const isConfirm = await confirm_ebene_sweet( - "Confirmez-vous cette entête de proforma?", - "Do you confirm this proforma header?" - ); - - if (!isConfirm) return; - - // Envoi des données via AJAX - try { - const response = await $.ajax({ - url: $("#racineWeb").val() + "Ajaxproformahospitalisation/enregistrerentete/", - type: 'POST', - data: donnees - }); - - // Traitement de la réponse - const idProforma = parseInt(response); - - // Redirection en fonction du résultat - const baseUrl = $("#racineWeb").val(); - const redirectUrl = idProforma > 0 - ? `${baseUrl}Hospitalisationproforma/${idProforma}/` - : `${baseUrl}Hospitalisationproforma/`; - - window.location.assign(redirectUrl); - - } catch (error) { - console.error("Erreur lors de l'enregistrement:", error); - // Gestion d'erreur supplémentaire possible ici - } -} - -function listerproformahospitalisation() -{ - d1 = $("#d1").val(); - d2 = $("#d2").val(); - - $("#div_proformas").html('
' + '
'); - - $("#div_messages").html(''); - - donnees = 'd1='+d1+'&d2='+d2; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxlisterproformahospitalisation/", - type: 'POST', - data: donnees, - success: function(data) { - $("#div_proformas").html(data); - }, - error: function(data) { - }, - complete: function() { - - } - }); - -} - -function fermer_historique_proforma_hospitalisation() -{ - - window.location.assign($("#racineWeb" ).val()+$("#vueParent").val()+"/"); - -} - -function afficher_proforma_hospitalisation(idProforma) -{ - - window.location.assign($("#racineWeb" ).val()+"Hospitalisationproforma/"+idProforma+"/"); - -} - -function maj_duree_traitement_seance_cso() -{ - - - dureeTraitement = $("#dureeTraitement").val(); - - donnees = 'dureeTraitement='+dureeTraitement; - - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionseance/majdureeseance/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - //window.location.assign($("#racineWeb" ).val()+"Prescriptionsence/"); - - }, - complete: function() - { - - } - }); - - -} - -function proforma_seance_cso(codeActe) -{ - - //typeSms="ententeprealable"; - - dureeTraitement = $('#dureeTraitement').val(); - - if(dureeTraitement=="0"){ - - v_msg="Veuillez indiquer la durée du traitement!"; - v_msgEng="Please indicate the duration of treatment!"; - alert_ebene(v_msg, v_msgEng); - - $('#dureeTraitement').focus(); - - return; - } - - donnees = 'codeActe='+codeActe; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfacturatioseancecso/proformacso/", - type: 'POST', - data: donnees, - success: function(data) { - - - if(data!="2"){ - //preparesms(typeSms); - v_msg="Demande accord prealable envoy\u00e9e!"; - v_msgEng="Request prior agreement sent!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - }, - error: function(data) { - }, - complete: function() { - afficher_seance_cso(); - } - }); -} - -function proforma_seance_sea(codeActe) -{ - - //typeSms="ententeprealable"; - - dureeTraitement = $('#dureeTraitement').val(); - - if(dureeTraitement=="0"){ - - v_msg="Veuillez indiquer la durée du traitement!"; - v_msgEng="Please indicate the duration of treatment!"; - alert_ebene(v_msg, v_msgEng); - - $('#dureeTraitement').focus(); - - return; - } - - donnees = 'codeActe='+codeActe; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfacturatioseancesea/proformasea/", - type: 'POST', - data: donnees, - success: function(data) { - if(data!="2"){ - //preparesms(typeSms); - v_msg="Demande accord prealable envoy\u00e9e!"; - v_msgEng="Request prior agreement sent!"; - alert_ebene(v_msg, v_msgEng); - } - - }, - error: function(data) { - }, - complete: function() { - actualiser_seance_sea(); - //reinitrechercherbonkine(); - } - }); -} - -function actualiser_seance_sea() -{ - window.location.assign($("#racineWeb" ).val()+"Kine/"); -} - -function actualiser_seance_cso() -{ - window.location.assign($("#racineWeb" ).val()+"Kinecso/"); -} - -/** - * Fonction pour enregistrer l'en-tête d'une proforma d'hospitalisation - * - Valide les champs obligatoires - * - Enregistre les données via AJAX - * - Gère la redirection après enregistrement - */ -async function enregistrer_entete_hospitalisation_proforma() { - // Récupération des valeurs du formulaire - const optionHospitalisation = "option-3"; // Option fixe pour l'hospitalisation - const dateDebut = $("#dateDebut").val(); - const codeMedecin = $("#codeMedecin").val(); - const duree = $("#duree").val(); - const motif = $("#motif").val(); - const numeroBeneficiaire = $("#numeroBeneficiaire").val(); - const codeActeChambre = $("#codeActeChambre").val(); - const codeAffection = $("#codeAffection").val(); - - // Validation 1: Type de chambre - if (codeActeChambre <= " ") { - alert_ebene( - "Veuillez renseigner le type de chambre!", - "Please enter the room type!" - ); - $("#codeActeChambre").focus(); - return; - } - - // Validation 2: Date de début - if (dateDebut <= " ") { - alert_ebene( - "Veuillez saisir la date de début!", - "Please enter the start date!" - ); - $("#dateDebut").focus(); - return; - } - - // Validation 3: Durée d'hospitalisation - if (duree == "0") { - alert_ebene( - "Veuillez renseigner le nombre de jours prévisionnels d'hospitalisation!", - "Please fill in the estimated number of days of hospitalization!" - ); - $("#duree").focus(); - return; - } - - // Validation 4: Motif d'hospitalisation - if (motif <= " ") { - alert_ebene( - "Veuillez renseigner le motif d'hospitalisation!", - "Please fill in the reason for hospitalization!" - ); - $("#motif").focus(); - return; - } - - // Validation 5: Médecin sélectionné - if (codeMedecin <= " ") { - alert_ebene( - "Veuillez sélectionner un médecin!", - "Please select a doctor!" - ); - $("#codeMedecin").focus(); - return; - } - - // Préparation des données pour l'AJAX - let donnees = `optionHospitalisation=${optionHospitalisation}&motif=${motif}`; - donnees += `&dateDebut=${dateDebut}&duree=${duree}&codeMedecin=${codeMedecin}`; - donnees += `&numeroBeneficiaire=${numeroBeneficiaire}&codeAffection=${codeAffection}`; - donnees += `&codeActeChambre=${codeActeChambre}`; - - // Demande de confirmation - const isConfirm = await confirm_ebene_sweet( - "Confirmez-vous l'enregistrement de cette entête de proforma?", - "Do you confirm the recording of this proforma header?" - ); - - if (!isConfirm) return; - - // Envoi des données via AJAX - try { - const response = await $.ajax({ - url: $("#racineWeb").val() + "Ajaxactesproformahospitalisation/enregistrerentete/", - type: 'POST', - data: donnees - }); - - // Traitement de la réponse - $("#div_proforma").html(response); - const idProforma = parseInt($("#idProforma").val()); - - // Redirection si ID proforma valide - if (idProforma > 0) { - window.location.assign(`${$("#racineWeb").val()}Hospitalisationproforma/${idProforma}/`); - } - - } catch (error) { - console.error("Erreur lors de l'enregistrement:", error); - // Gestion d'erreur supplémentaire possible ici - } -} - - -//04-01-2024 -function dentisterie() -{ - facture=$("#facture").val(); - - if (facture==1) - { - v_msg="D\u00e9j\u00e0 factur\u00e9!"; - v_msgEng="Already charged!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - contestation = $("#contestation").val(); - if(facture == "0" && contestation == "1"){ - v_msg="Dossier médical contesté !"; - v_msgEng="Medical records contested!"; - - alert_ebene(v_msg, v_msgEng); - return; - } - - affectionObligatoire=$("#affectionObligatoire").val(); - codeAffection=$("#codeAffection").val(); - modeSaisieFacture=$("#modeSaisieFacture").val(); - - hospitalisation = $("#hospitalisation").val(); - if (hospitalisation=="1") - { - v_msg="Non autoris\u00e9 car la p\u00e9riode d'hospitalisation est en cours."; - v_msgEng="Not authorized because the period of hospitalization is in progress."; - - alert_ebene_callback(v_msg, v_msgEng, function() { - window.location.assign($("#racineWeb").val()+"Feuillemaladie/"); - }); - - return; - } - - - if (affectionObligatoire=="1" && codeAffection=="990" && modeSaisieFacture!="1") - { - v_msg="Diagnostique exig\u00e9!"; - v_msgEng="Diagnosis required!"; - alert_ebene(v_msg, v_msgEng); - - $("#libelleAffection").focus(); - $("#btn_pop_affection").click(); - - return; - } - - - window.location.assign($("#racineWeb" ).val()+"Dentisterie/"); -} - -function ajoute_dentaire() -{ - var codeActe = $('#codeActe').val(); - - if (!codeActe || codeActe.trim() <= " ") { - $("#searchInput").focus(); - alert_ebene( - "Veuillez sélectionner un acte!", - "Please select an act!" - ); - return; - } - - var ententePrealable = $('#ententePrealable').val(); - - var numeroDent = $("#numeroDent").val(); - - var motifDentaire = $('#motifDentaire').val(); - - var idCollege = $('#idCollege').val(); - var nbreProthese = $('#nbreProthese').val(); - - donnees = 'codeActe='+codeActe+'&numeroDent='+numeroDent+'&motifDentaire='+motifDentaire; - - var div_prestations = $('#div_prestations'); - div_prestations.html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetaildentisterie/ajouter/", - type: 'POST', - data: donnees, - success: function(data) - { - div_prestations.html(data); - var bool = $('#bool').val(); - - if(bool=="1"){ - v_msg="Ajout impossible risque de doublons!"; - v_msgEng="Addition impossible risk of duplicates!"; - - alert_ebene(v_msg, v_msgEng); - return; - } - }, - error : function(resultat, statut, erreur) - { - }, - complete: function(data) - { - dentisterie(); - } - }); -} - -// 07-11-2022 -function ajax_maj_prixacte_dentaire(idPrestationactes, prix, controle) -{ - prix=prix.replace(",","."); - prix=prix.replace(/ /g,""); - controle.value=prix; - - if(controle_numerique(controle)) - { - if(prix==0) - { - controle.focus(); - v_msg="Veuillez saisir le prix!"; - v_msgEng="Please enter the price!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - donnees = 'idPrestationactes='+idPrestationactes+"&prix="+prix; - - donnee_a_affciher = ""; - - donnees = 'idPrestationactes='+idPrestationactes+"&prix="+prix;; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetaildentisterie/majprixacte/", - type: 'POST', - data: donnees, - success: function(data) { - donnee_a_affciher = data; - }, - error: function(data) { - }, - complete: function() { - $("#div_prestations").html(donnee_a_affciher); - controle.focus(); - } - }); - } -} - - -function ajax_maj_qte_acte_dentaire(idPrestationactes, quantite, controle) -{ - quantite=quantite.replace(",","."); - controle.value=quantite; - - if(controle_numerique(controle)) - { - if(quantite==0) - { - controle.focus(); - v_msg="Veuillez saisir la quantité!"; - v_msgEng="Please enter the quantity!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - donnees = 'idPrestationactes='+idPrestationactes+"&quantite="+quantite; - - donnee_a_affciher = ""; - - donnees = 'idPrestationactes='+idPrestationactes+"&quantite="+quantite;; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetaildentisterie/majquantite/", - type: 'POST', - data: donnees, - success: function(data) { - donnee_a_affciher = data; - }, - error: function(data) { - }, - complete: function() { - $("#div_prestations").html(donnee_a_affciher); - controle.focus(); - } - }); - } -} - -/** - * Fonction pour supprimer un acte dentaire sélectionné - * - Affiche une confirmation avant suppression - * - Envoie la requête de suppression via AJAX - * - Met à jour l'affichage après suppression - * @param {number} idPrestationactes - L'identifiant de l'acte dentaire à supprimer - */ -async function supprimer_acte_dentaire_selection(idPrestationactes) { - let donnee_a_affciher = ""; - - // Demande de confirmation avec gestion multilingue - const isConfirm = await confirm_ebene_sweet( - "Confirmez-vous la suppression de cet acte?", - "Do you confirm the removal of this act?" - ); - - if (!isConfirm) { - return false; - } - - // Affichage du loader pendant le traitement - $("#listeacte").html('
' + '
'); - - // Préparation des données pour la requête AJAX - const donnees = `idPrestationactes=${idPrestationactes}`; - - try { - // Envoi de la requête AJAX - const response = await $.ajax({ - url: $("#racineWeb").val() + "Ajaxdetaildentisterie/supprimeracte/", - type: 'POST', - data: donnees - }); - - // Traitement de la réponse - donnee_a_affciher = response; - - // Mise à jour de l'affichage - $("#div_prestations").html(donnee_a_affciher); - - } catch (error) { - console.error("Erreur lors de la suppression de l'acte:", error); - // Gestion d'erreur supplémentaire possible ici - } -} - -/** - * Fonction pour valider un traitement dentaire - * - Demande confirmation à l'utilisateur - * - Envoie la validation via AJAX - * - Affiche un message si demande d'accord préalable envoyée - * - Recharge la feuille de maladie après traitement - */ -async function valider_dentaire() { - // Récupération des états actuels - const existeEntentePrealable = parseInt($("#existeEntentePrealable").val()); - const envoyeSms = parseInt($("#envoyeSms").val()); - - // Demande de confirmation multilingue - const isConfirm = await confirm_ebene_sweet( - "Confirmez-vous la validation?", - "Do you confirm validation?" - ); - - if (!isConfirm) { - return false; - } - - try { - // Envoi de la validation via AJAX - await $.ajax({ - url: $("#racineWeb").val() + "Ajaxdetaildentisterie/valider/", - type: 'POST', - data: '' - }); - - // Vérification si besoin d'envoyer un message de confirmation - if (existeEntentePrealable === 2 && envoyeSms === 0) { - alert_ebene( - "Demande accord préalable envoyée!", - "Request prior agreement sent!" - ); - } - - // Rechargement de la feuille de maladie - feuillemaladie(); - - } catch (error) { - console.error("Erreur lors de la validation dentaire:", error); - // Gestion d'erreur supplémentaire possible ici - } -} - -function add_selected_dentisterie(controle) -{ - - - motifDentaire = $("#motifDentaire").val(); - - if (motifDentaire<=" ") - { - v_msg="Veuillez entrer le motif de la prescription dentaire!"; - v_msgEng="Please enter the reason for the dental prescription!"; - alert_ebene(v_msg, v_msgEng); - - $("#searchInput").val(""); - $("#motifDentaire").focus(); - - return; - }else{ - var str = controle.split(' <==> '); - - - var codeActe = str[0]; - var libelleActe = str[1]; - var acteExclu = str[2]; - var ententePrealable = str[3]; - - var datePrescription = $("#datePrescription").val(); - - var statut = isStatut(codeActe); - - //alert(statut); - //return; - - if(statut!='1') - { - v_msg="Cet acte n'est pas autorisé!"; - v_msgEng="This act is not allowed!"; - alert_ebene(v_msg, v_msgEng); - - getstatutacte(codeActe); - $('#searchInput').val(''); - $("#div_selection").hide(); - return; - } - - if(acteExclu=="Garanti"){ - acteExclu=0; - }else{ - acteExclu=1; - } - - if(ententePrealable=="Demander Accord"){ - ententePrealable=1; - }else{ - ententePrealable=0; - } - - if(libelleActe<=" ") - { - $("#codeActe").focus(); - return; - } - - if(acteExclu==1) - { - v_msg="Acte non couvert!"; - v_msgEng="Not covered!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - - $("#codeActe").val(codeActe); - $("#libelleActe").val(libelleActe); - //$("#prixTarif").val("0"); - //$("#codeGarantie").val("DEN"); - $("#acteExclu").val(acteExclu); - $("#ententePrealable").val(ententePrealable); - } -} - -function maj_motif_dentaire() -{ - motifDentaire = $("#motifDentaire").val(); - - if (motifDentaire>" ") - { - donnees = "motifDentaire="+motifDentaire; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetaildentisterie/majmotifdentaire/", - type: 'POST', - data: donnees, - success: function(data) { - - }, - error: function(data) { - }, - complete: function() { - - } - }); - } -} - - -function maj_medecin_dentaire() -{ - codeMedecin = $("#codeMedecin").val(); - motifDentaire = $("#motifDentaire").val(); - - donnees = "codeMedecin="+codeMedecin+"&motifDentaire="+motifDentaire; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetaildentisterie/majmedecin/", - type: 'POST', - data: donnees, - success: function(data) { - - // maj_fraisexclu_cso(); - }, - error: function(data) { - }, - complete: function() { - - } - }); - -} - - -function ajax_maj_renouvelable_medicament(idMedicament, renouvelable, controle) -{ - - donnees = 'idMedicament='+idMedicament+"&renouvelable="+renouvelable; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailprescription/majrenouvelable/", - type: 'POST', - data: donnees, - success: function(data) { - $("#medicaments").html(data); - }, - error: function(data) { - }, - complete: function() { - //controle.focus(); - } - }); - -} - -function ajax_maj_frequence_medicament(idMedicament, frequence, controle) -{ - - - frequence=frequence.replace(",","."); - controle.value=frequence; - - if(controle_numerique(controle)) - { - donnees = 'idMedicament='+idMedicament+"&frequence="+frequence; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailprescription/majfrequence/", - type: 'POST', - data: donnees, - success: function(data) { - $("#medicaments").html(data); - }, - error: function(data) { - }, - complete: function() { - //controle.focus(); - } - }); - } - -} - -function ajax_maj_qte_medicament_cso(idLivre, quantite, controle, quantiteRestante, ligne, quantiteRestanteInitiale) -{ - quantite=parseInt(quantite.replace(",",".")); - controle.value=quantite; - - - - quantiteRestanteInitiale = parseInt(quantiteRestanteInitiale); - - - if(quantiteRestanteInitiale > 0){ - quantiteRestante = quantiteRestanteInitiale; - } - - if(isNaN(quantite) || quantite < 0 ){ - controle.value = 0; - controle.focus(); - return; - } - - interdirVentePartielleMedicament = $("#interdirVentePartielleMedicament").val(); - - if(interdirVentePartielleMedicament=="1"){ - - if((quantite > 0) && (quantite < quantiteRestante)){ - controle.focus(); - v_msg="La vente partielle de médicament est interdite!"; - v_msgEng="Partial sale of medicine is prohibited!"; - alert_ebene(v_msg, v_msgEng); - - controle.value = 0; - return; - } - - } - - - - if(controle_numerique(controle)) - { - if(quantite > parseInt(quantiteRestante)){ - controle.focus(); - v_msg="La quantité servie est supérieure à la quantité restante! "; - v_msgEng="Review the quantity served, it is greater than the remaining quantity!"; - alert_ebene(v_msg, v_msgEng); - - controle.value = 0; - return; - } - - donnees = 'idLivre='+idLivre+"&quantite="+quantite+'&quantiteRestanteInitiale='+quantiteRestanteInitiale; - - //alert(donnees);return; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailpharmacie/majquantitecso/", - type: 'POST', - data: donnees, - success: function(data) { - $("#livraison").html(data); - - var nbLigne = parseInt($("#nbLigne").val()); - $("#qte"+parseInt(ligne+1)).focus(); - - }, - error: function(data) { - }, - complete: function() { - controle.focus(); - } - }); - } - -} - -function enregistrer_rapport_seance() -{ - - - rapportTraitement = $("#rapportTraitement").val(); - - if (rapportTraitement <= " ") - { - v_msg="Veuillez enregistrer le rapport du traitement des séances!"; - v_msgEng="Please fill in the reason for hospitalization!"; - alert_ebene(v_msg, v_msgEng); - - $("#rapportTraitement").focus(); - return; - } - - donnees = 'rapportTraitement='+rapportTraitement; - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionseance/majrapportTraitement/", - type : 'post', - data: donnees, - error: function(errorData) { - - }, - success: function(data) - { - //window.location.assign($("#racineWeb" ).val()+"Prescriptionsence/"); - - }, - complete: function() - { - //valider_seance_cso(); - } - }); - - -} - - -function listemedicamentsubstitue(ligne, quantite, tM, codeMedicament) -{ - var libelle = $('#searchInput'+ligne).val(); - var donnees = 'libelle='+ libelle+'&ligne='+ligne+'&quantite='+quantite+'&tM='+tM+'&codeMedicament='+codeMedicament; - - if(libelle.length >="3") - { - vLink = "Ajaxlistemedicamentsubstitue/"; - $.ajax({ - type: "POST", - url: $("#racineWeb").val()+vLink, - data:donnees, - beforeSend: function(){ - $("#searchInput"+ligne).css("background","#FFF url(Bootstrap/images/LoaderIcon.gif) no-repeat 165px"); - }, - success: function(data){ - $("#div_selection"+ligne).show(); - $("#div_selection"+ligne).html(data); - $("#searchInput"+ligne).css("background","#FFF"); - } - }); - }else{ - $("#div_selection"+ligne).hide(); - return false; - } -} - - -function selectElementSubtitue(val, ligne, quantite, tM, codeSubstitut, codeMedicament) { - - - // Extraction des valeurs depuis la chaîne 'val' - var str = val.split(' <==> '); - var libelle = str[0]; - var forme = str[1]; - var srtGarantie = str[2]; - var prix = str[3]; - - var valeurActe = parseInt(extraitNombre(prix)); - - // Vérifie si le médicament n'est pas garanti (non remboursé) - if (srtGarantie === "Non garanti") { - // Message d’alerte en français et en anglais - const v_msg = "Attention, ce produit n'est pas remboursé! Voulez-vous continuer?"; - const v_msgEng = "Be careful, this product is not refunded! Do you want to continue?"; - - // Appel à la boîte de dialogue personnalisée avec callback - confirm_ebene_sweet_callback(v_msg, v_msgEng, function () { - // Si l’utilisateur confirme, on force tM à 0 (pas de taux de remboursement) - tM = 0; - - // Calcul des montants et mise à jour de l’interface - remplirChampsMedicament(); - }); - - // On retourne immédiatement, le traitement se poursuivra dans le callback si confirmé - return; - } - - // Si le produit est garanti, on remplit directement les champs - remplirChampsMedicament(); - - // Fonction interne pour éviter la duplication du code de remplissage - function remplirChampsMedicament() { - var fraisReel = valeurActe * parseInt(quantite); - var montantTm = parseInt(fraisReel * parseInt(tM) / 100); - var montantArembourser = parseInt(fraisReel) - parseInt(montantTm); - - $("#searchInput" + ligne).val(libelle); - $("#div_selection" + ligne).hide(); - - $("#valeurActe" + ligne).val(formatCurrency(valeurActe)); - $("#fraisReel" + ligne).val(formatCurrency(fraisReel)); - $("#montantTm" + ligne).val(formatCurrency(montantTm)); - $("#montantArembourser" + ligne).val(formatCurrency(montantArembourser)); - $("#forme" + ligne).val(forme); - - // Mise à jour côté serveur du médicament substitué - var donnees = "codeMedicament=" + codeMedicament + "&codeSubstitut=" + codeSubstitut; - - $.ajax({ - url: $("#racineWeb").val() + "Ajaxdetailpharmacie/majmedicamentsubstitution/", - type: 'POST', - data: donnees, - success: function(data) { - // Optionnel : traitement si nécessaire - }, - error: function(data) { - // Optionnel : gestion d'erreur - } - }); - } -} - - -function fermer_seance() -{ - - window.location.assign($("#racineWeb" ).val()+$("#vueParent").val()+"/"); - -} - - -function changer_entite_portail() -{ - codeSociete=$("#codeSociete").val(); - - if (codeSociete<=" ") - { - v_msg="Veuillez sélectionner une entité!"; - v_msgEng="Please select an entity!"; - alert_ebene(v_msg, v_msgEng); - - $("#codeSociete").focus(); - return; - } - - donnees = 'codeSociete='+codeSociete; - - v_url = $("#racineWeb").val()+"Ajaxchangerentiteportail/"; - - $("#div_login_portail").html('
' + '
'); - - $.ajax({ - url: v_url, - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - // alert(data); - $("#div_login_portail").html(data); - $("#login").focus(); - }, - complete: function() - { - src_logo="Societes/"+codeSociete+"/Tarifs/Img/logo_societe.png"; - $("#logo_entite").attr("src",src_logo); - } - }); -} - -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() - { - $(".selectpicker").selectpicker(); - } - }); - -} - -function affichespecialite() -{ - // 10/03/2026 => Si on change d'acte, mettre le prix saisie ) 0 - $("#prixSaisi").val(0); - $("#prixModifiable").val(0); - donnees = ""; - donnees_retour = ""; - - codeActe = $("#codeActe").val(); - nbSpecialite = "0"; - - donnees = 'codeActe='+codeActe; - - faireDefileMessage("", ""); - - var div_specialite = $('#div_specialite'); - div_specialite.html('
' + '
'); - - // div_specialite - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxspecialiteacte/", - type : 'post', - data: donnees, - error: function(errorData) - { - }, - success: function(data) - { - - donnees_retour = data; - - }, - complete: function() - { - - $("#div_specialite").html(donnees_retour); - - $(".selectpicker").selectpicker(); - - acteNuit = $("#acteNuit").val(); - nuit = $("#nuit").val(); - nbSpecialite = $("#nbSpecialite").val(); - - if (acteNuit=="1" && nuit=="0") - { - v_msg="Vous ne pouvez pas effectuer cet acte à cette heure!"; - v_msgEng="You cannot perform this act at this time!"; - alert_ebene(v_msg, v_msgEng); - $("#codeActe").focus(); - - return; - } - - if(nbSpecialite=="1"){ - specialite_medecin(); - } - } - }); -} - -function consulter_envois_sms() -{ - donnees = ""; - donnees_retour = ""; - - date1 = $("#date1").val(); - date2 = $("#date2").val(); - - donnees += 'date1=' + date1; - donnees += '&date2=' + date2; - - $("#div_sms").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdestinatairesms/consulter/", - 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 vider_medecin(){ - - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxspecialitemedecin/vider/", - type : 'post', - data: donnees, - error: function(errorData) - { - }, - success: function(data) - { - $("#div_medecin").html(data); - }, - complete: function() - { - $(".selectpicker").selectpicker(); - initialiser_prix_acte(); - } - }); -} - -function initialiser_prix_acte(){ - - donnees = ''; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxprixacte/initialiser/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#infosacte").html(data); - }, - complete: function() { - - } - }); -} - -/** - * Fonction pour créer une nouvelle proforma d'hospitalisation chirurgicale - * - Valide les champs obligatoires - * - Crée la proforma via un appel AJAX - * - Redirige vers la page de la proforma après création - */ -async function nouvelle_proforma_hopitalisation() { - // Récupération des valeurs du formulaire - const codeLangue = $("#codeLangue").val(); - const motifHospitalisation = $('#motifHospitalisation').val(); - const optionHospitalisation = $('#optionHospitalisation').val(); - const codeActeChambreHospit = $('#codeActeChambreHospit').val(); - const dateDebutHospit = $('#dateDebutHospit').val(); - const dureeHospit = $('#dureeHospit').val(); - const numeroFeuilleMaladie = $("#numeroFeuilleMaladie").val(); - const idBeneficiaire = $("#idBeneficiaire").val(); - const codePrestataire = $("#codePrestataire").val(); - - // Validation des champs obligatoires - if (motifHospitalisation <= " ") { - alert_ebene( - "Veuillez renseigner le motif d'hospitalisation!", - "Please fill in the reason for hospitalization!" - ); - $("#motifHospitalisation").focus(); - return; - } - - if (optionHospitalisation <= " ") { - alert_ebene( - "Veuillez renseigner le type d'hospitalisation!", - "Please fill in the type of hospitalization!" - ); - $("#optionHospitalisation").focus(); - return; - } - - if (codeActeChambreHospit <= " ") { - alert_ebene( - "Veuillez renseigner le type de chambre!", - "Please enter the room type!" - ); - $("#codeActeChambreHospit").focus(); - return; - } - - if (dateDebutHospit <= " ") { - alert_ebene( - "Veuillez saisir la date de début!", - "Please enter the start date!" - ); - $("#dateDebutHospit").focus(); - return; - } - - if (dureeHospit == "0") { - alert_ebene( - "Veuillez renseigner le nombre de jours prévisionnels d'hospitalisation!", - "Please fill in the estimated number of days of hospitalization!" - ); - $("#dureeHospit").focus(); - return; - } - - // Préparation des données pour l'AJAX - let donnees = `motifHospitalisation=${motifHospitalisation}`; - donnees += `&optionHospitalisation=${optionHospitalisation}`; - donnees += `&codeActeChambreHospit=${codeActeChambreHospit}`; - donnees += `&dateDebutHospit=${dateDebutHospit}`; - donnees += `&dureeHospit=${dureeHospit}`; - donnees += `&numeroFeuilleMaladie=${numeroFeuilleMaladie}`; - donnees += `&idBeneficiaire=${idBeneficiaire}`; - donnees += `&codePrestataire=${codePrestataire}`; - - // Demande de confirmation - const isConfirm = await confirm_ebene_sweet( - "Confirmez-vous la création d'une facture proforma d'hospitalisation chirurgicale?", - "Do you confirm the creation of a surgical hospitalization proforma invoice?" - ); - - if (!isConfirm) return false; - - try { - // Envoi de la requête AJAX - const response = await $.ajax({ - url: $("#racineWeb").val() + "Ajaxproformahospitalisationfeuille/", - type: 'POST', - data: donnees - }); - - // Traitement de la réponse - $("#div_proforma").html(response); - const idProforma = parseInt($("#idProforma").val()); - - // Redirection si proforma créée - if (idProforma > 0) { - window.location.assign(`${$("#racineWeb").val()}Hospitalisationproforma/${idProforma}/`); - } - - } catch (error) { - console.error("Erreur lors de la création de la proforma:", error); - // Gestion d'erreur supplémentaire possible ici - } -} - -function messageSituationProformaHospit(){ - - - var optionHospitalisation = $("#optionHospitalisation").val(); - var datePrestation = $('#dateDebut').val(); - var idBeneficiaire = $('#idBeneficiaire').val(); - - - var estcouvert = $('#estcouvert').val(); - var estsorti = $('#estsorti').val(); - - - - if(optionHospitalisation == "option-1"){ - codeActe = "HHM"; - }else if (optionHospitalisation == "option-3"){ - codeActe = "HHC"; - }else{ - codeActe = ""; - } - - if(estcouvert == "0" || estsorti == "1") - { - v_msg="Proforma impossible \u00e0 \u00e9tablir car ce b\u00e9n\u00e9ficiaire n'est plus couvert par l'assurance!"; - v_msgEng="Proforma impossible to establish because this beneficiary is no longer covered by insurance!"; - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - - $("#dateDebut").disable(); - $("#duree").disable(); - $("#motif").disable(); - $("#codeMedecin").disable(); - $("#codeAffection").disable(); - - return; - } - - ajax_beneficiaire_contexte(idBeneficiaire); - - getstatutactedate(codeActe, datePrestation); - - var donnees = 'codeActe='+codeActe+'&datePrestation='+datePrestation+'&idBeneficiaire='+idBeneficiaire; - - $("#div_reponse").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxsituationproformahospit/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) - { - $("#div_reponse").html(data); - - }, - complete: function(data) - { - - } - }); -} - - -function ajaxbeneficiairecouvert(id) -{ - donnees = "idBeneficiaire="+id; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxbeneficiairecouvert/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#div_couverture").html(data); - }, - complete: function(data) { - - } - }); -} - -function ajax_beneficiaire_contexte(idBeneficiaire) -{ - donnees = 'idBeneficiaire='+idBeneficiaire; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxbeneficiairecontexte/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - complete: function() { - - } - }); -} - -function getstatutactedate(codeActe, datePrestation) -{ - - - donnee_a_affciher = ""; - - - donnees = 'codeActe='+codeActe+'&datePrestation='+datePrestation; - - //alert(donnees); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxstatutacte/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - - donnee_a_affciher = data; - }, - complete: function() { - - - $("#div_statutacte").html(donnee_a_affciher); - - var statut = $("#statut").val(); - var libelleMotif = $("#libelleMotif").val(); - var libelleMotifEng = $("#libelleMotifEng").val(); - - - faireDefileMessage(libelleMotif, libelleMotifEng); - } - }); -} - -/** - * Fonction pour supprimer une proforma d'hospitalisation - * - Demande confirmation avant suppression - * - Envoie la requête de suppression via AJAX - * - Actualise la liste des proformas après suppression - * @param {number} idProforma - L'identifiant de la proforma à supprimer - */ -async function supprimer_proforma_hospitalisation(idProforma) { - // Préparation des données pour la requête AJAX - const donnees = `idProforma=${idProforma}`; - - // Demande de confirmation avec gestion multilingue - const isConfirm = await confirm_ebene_sweet( - "Attention! Confirmez-vous la suppression de cette proforma?", - "Attention! Do you confirm the deletion of this proforma?" - ); - - if (!isConfirm) { - return false; - } - - try { - // Envoi de la requête de suppression - await $.ajax({ - url: $("#racineWeb").val() + "Ajaxlisterproformahospitalisation/supprimer/", - type: 'POST', - data: donnees - }); - - // Actualisation de la liste des proformas - listerproformahospitalisation(); - - } catch (error) { - console.error("Erreur lors de la suppression de la proforma:", error); - // Gestion d'erreur supplémentaire possible ici - } -} - -// Fonction pour vérifier si une date est antérieure à aujourd'hui -function verifierDate() { - - dateString = $("#dateDebut").val(); - // Décomposer la date au format "jj/mm/aaaa" - const [jour, mois, annee] = dateString.split('/').map(Number); - - // Créer un objet Date à partir de la date saisie - const dateSaisie = new Date(annee, mois - 1, jour); - - // Obtenir la date actuelle sans l'heure - const aujourdHui = new Date(); - aujourdHui.setHours(0, 0, 0, 0); - - // Vérifier si la date saisie est strictement antérieure à aujourd'hui - if (dateSaisie < aujourdHui) { - - v_msg="La date de d\u00e9but ne peut-\u00eatre ant\u00e9rieure \u00e0 la date du jour!"; - v_msgEng="The start date cannot be earlier than today!"; - - alert_ebene(v_msg, v_msgEng); - - $("#dateDebut").val(""); - $("#dateDebut").focus(); - return; - } else{ - messageSituationProformaHospit(); - } -} - -function estDateFuture(date) { - // Obtenir la date d'aujourd'hui sans l'heure - const aujourdHui = new Date(); - aujourdHui.setHours(0, 0, 0, 0); // Réinitialiser les heures pour une comparaison pure de dates - - // S'assurer que l'argument 'date' est un objet Date - const dateComparee = new Date(date); - dateComparee.setHours(0, 0, 0, 0); // De même, ignorer l'heure - - // Comparer les dates - return dateComparee > aujourdHui; -} - -function ouvrir_feuillemaladie(numeroBon, dateDebut) -{ - - autoriserBonHospitAvantDate = $("#autoriserBonHospitAvantDate").val(); - - if(estDateFuture(dateDebut) && autoriserBonHospitAvantDate=="0") - { - v_msg="Hospitalisation chirurgicale non encore autorisée! Attendez, s'il vous plaît, la date de sa programmation. Merci pour votre compréhension!"; - v_msgEng="Surgical hospitalization not yet authorized! Please wait for the scheduling date. Thank you for understanding!"; - - alert_ebene(v_msg, v_msgEng); - - faireDefileMessage(v_msg, v_msgEng); - - return; - } - - donnees = 'numeroBon='+numeroBon; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxouvrirfeuillemaladie/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) - { - feuillemaladie(); - - }, - complete: function(data) - { - - } - }); - -} - -function verifierDateChambre() { - - dateString = $("#dateDebutHospit").val(); - // Décomposer la date au format "jj/mm/aaaa" - const [jour, mois, annee] = dateString.split('/').map(Number); - - // Créer un objet Date à partir de la date saisie - const dateSaisie = new Date(annee, mois - 1, jour); - - // Obtenir la date actuelle sans l'heure - const aujourdHui = new Date(); - aujourdHui.setHours(0, 0, 0, 0); - - // Vérifier si la date saisie est strictement antérieure à aujourd'hui - if (dateSaisie < aujourdHui) { - - v_msg="La date de d\u00e9but ne peut-\u00eatre ant\u00e9rieure \u00e0 la date du jour!"; - v_msgEng="The start date cannot be earlier than today!"; - - alert_ebene(v_msg, v_msgEng); - - $("#dateDebutHospit").val(""); - $("#dateDebutHospit").focus(); - return; - } -} - -/** - * Fonction pour changer le mot de passe utilisateur - * - Affiche un avertissement avant redirection - * - Gère la confirmation en multilingue (FR/EN) - * - Redirige vers la page de changement de mot de passe après confirmation - * - Prévient l'utilisateur qu'il sera déconnecté après l'opération - */ -async function change_password() { - // Messages d'avertissement multilingues - const messages = { - fr: { - titre: "Attention, vous serez déconnecté par la suite!", - question: "Voulez-vous changer votre mot de passe?", - confirm: "Oui", - cancel: "Non" - }, - en: { - titre: "Attention, you will be logged out afterwards!", - question: "Do you want to change your password?", - confirm: "Yes", - cancel: "No" - } - }; - - // Détermination de la langue - const langue = $("#codeLangue").val() === "en_US" ? "en" : "fr"; - const { titre, question, confirm, cancel } = messages[langue]; - - // Demande de confirmation - const isConfirm = await Swal.fire({ - title: `${titre} ${question}`, - icon: 'warning', - showCancelButton: true, - confirmButtonText: confirm, - cancelButtonText: cancel, - dangerMode: true - }); - - // Redirection si confirmé - if (isConfirm.isConfirmed) { - window.location.assign(`${$("#racineWeb").val()}Changermotpass/`); - } -} - -function tarif_applique(tarif) -{ - v_msg="Tarif appliqué : "+tarif; - v_msgEng="Price applied : "+tarif; - - alert_ebene(v_msg, v_msgEng); - -} - -function imprimer_facture_seance(idFacture) -{ - - - donnees = "idFacture="+idFacture; - - var div_export = $('#div_facture_definitive'); - div_export.html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaximprimerfacturedefinitive/", - type: 'POST', - data: donnees, - success: function(data) - { - div_export.html(data); - //facturepartielle(); - }, - error : function(resultat, statut, erreur) - { - }, - complete: function(data) - { - // - - } - }); - -} - -function creer_proforma_hospitalistation() -{ - - - prestationPossible = $("#prestationPossible").val(); - face_confirmee = $("#face_confirmee").val(); - faceActif = $("#faceActif").val(); - codeProfil = $("#codeProfil_C" ).val(); - - if(prestationPossible == "0" || codeProfil == "PHA" || codeProfil == "OPT" || codeProfil == "LAB" || codeProfil == "SEA"){ - - v_msg="Non autoris\u00e9e!"; - v_msgEng="Not allowed!"; - - alert_ebene(v_msg, v_msgEng); - - return; - } - - if ((face_confirmee == "1") || (faceActif != '1')){ - - window.location.assign($("#racineWeb" ).val()+"Proformahospitalisation/"); - - }else{ - - v_msg="Veuillez authentifier la photo du patient!"; - v_msgEng="Please authenticate the patient's photo!"; - - alert_ebene(v_msg, v_msgEng); - - return; - } -} - -function pop_ged_optique() -{ - $.ajax({ - url: $("#racineWeb").val()+"Ajaxlistegedoptique/", - error: function(errorData) { - }, - success: function(data) - { - $("#div_ged").html(data); - }, - complete: function() { - $("#btn_pop_ged_optique").click(); - } - }); -} - -function consulter_envois_sms() -{ - donnees = ""; - donnees_retour = ""; - - date1 = $("#date1").val(); - date2 = $("#date2").val(); - - donnees += 'date1=' + date1; - donnees += '&date2=' + date2; - - $("#div_sms").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdestinatairesms/consulter/", - 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 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 consulter_envois_whatsapp_en_cours() -{ - donnees = ""; - donnees_retour = ""; - - date1 = $("#date1").val(); - date2 = $("#date2").val(); - - donnees += 'date1=' + date1; - donnees += '&date2=' + date2; - - $("#div_sms").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdestinatairesms/consulterwhatsappencours/", - 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 mettre_sms_commun_attente_assureur() -{ - textMessage = $("#textMessageCommun").val(); - textMessage = textMessage.trim(); - - if (textMessage<=" ") - { - v_msg="Veuillez saisir le message!"; - v_msgEng="Please enter the message!"; - alert_ebene(v_msg, v_msgEng); - - $("#textMessageCommun").focus(); - return; - } - - donnees = "textMessage="+textMessage; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdestinatairesms/mettrewhatsappattenteassureur/", - type: 'POST', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - // $('#div_test_gabarit').html(data); - // alert(data); - }, - complete: function() { - v_msg="Messages mis dans la queue des envois!"; - v_msgEng="Messages in the queue!"; - alert_ebene(v_msg, v_msgEng); - re_init_envoi_sms(); - } - }); -} - -function mettre_sms_commun_attente_assure() -{ - - idAdherent_C = $("#idAdherent_C").val(); - - if (idAdherent_C<="0") - { - v_msg="Veuillez sélectionner un assuré!"; - v_msgEng="Please select an insured!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - textMessage = $("#textMessageCommun").val(); - textMessage = textMessage.trim(); - - if (textMessage<=" ") - { - v_msg="Veuillez saisir le message!"; - v_msgEng="Please enter the message!"; - alert_ebene(v_msg, v_msgEng); - - $("#textMessageCommun").focus(); - return; - } - - donnees = "textMessage="+textMessage; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdestinatairesms/mettrewhatsappattenteassure/", - type: 'POST', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - // $('#div_test_gabarit').html(data); - // alert(data); - }, - complete: function() { - v_msg="Messages mis dans la queue des envois!"; - v_msgEng="Messages in the queue!"; - alert_ebene(v_msg, v_msgEng); - re_init_envoi_sms(); - } - }); -} - -function mettre_sms_commun_attente_tous() -{ - - idAdherent_C = $("#idAdherent_C").val(); - - if (idAdherent_C<="0") - { - v_msg="Veuillez sélectionner un assuré!"; - v_msgEng="Please select an insured!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - - textMessage = $("#textMessageCommun").val(); - textMessage = textMessage.trim(); - - if (textMessage<=" ") - { - v_msg="Veuillez saisir le message!"; - v_msgEng="Please enter the message!"; - alert_ebene(v_msg, v_msgEng); - - $("#textMessageCommun").focus(); - return; - } - - donnees = "textMessage="+textMessage; - - // alert("mettre_sms_commun_attente_tous => idAdherent_C = "+idAdherent_C+" ; "+donnees); - // return; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdestinatairesms/mettrewhatsappattenteassureurassure/", - type: 'POST', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - // $('#div_test_gabarit').html(data); - // alert(data); - }, - complete: function() { - v_msg="Messages mis dans la queue des envois!"; - v_msgEng="Messages in the queue!"; - alert_ebene(v_msg, v_msgEng); - re_init_envoi_sms(); - } - }); -} - -function re_init_envoi_sms() -{ - window.location.assign($("#racineWeb" ).val()+"Envoisms/"); -} - -// KANE 12/04/2025 -function envoieprescription_examen() -{ - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionexamen/envoieprescriptionexamen/", - type : 'post', - error: function(errorData) - { - }, - success: function(data) - { - // alert(data); - // $('#div_test_gabarit').html(data); - }, - complete: function() { - feuillemaladie(); - } - }); -} - -function envoieprescription_seance() -{ - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionseance/envoieprescriptionseance/", - type : 'post', - error: function(errorData) - { - }, - success: function(data) - { - // alert(data); - // $('#div_test_gabarit').html(data); - }, - complete: function() { - // feuillemaladie(); - } - }); -} - - -function actualiser_proforma_hospitalisation() -{ - idProforma = $("#idProformaHospitalisation").val(); - - window.location.assign($("#racineWeb" ).val()+"Hospitalisationproforma/"+idProforma+"/"); - -} - -function verifierContestationAvantOuverture() { - - var contestation = $("#contestation").val(); - - if (contestation == "1") { - // Ne pas ouvrir le modal si contestation == 1 - feuillemaladie(); - - } else { - // Ouvrir le modal si pas de contestation - $('#popRechercheAffection').modal('show'); - } - -} - -function actualiser_contestation(){ - - const numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); - - if (numeroFeuilleMaladie > "0") { - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfeuillemaladie/", - type : 'post', - error: function(errorData) - { - }, - success: function(data) - { - // Mise à jour du contenu de la div contestation - $("#div_contestation").html(data); - }, - complete: function() { - - } - }); - } -} - -function actualiser_avis_hospitalisation(){ - - const numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); - - if (numeroFeuilleMaladie > "0") { - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfeuillemaladie/avishopitalisation/", - type : 'post', - error: function(errorData) - { - }, - success: function(data) - { - // Mise à jour du contenu de la div contestation - $("#div_avis_hos").html(data); - }, - complete: function() { - - } - }); - } -} - - -function verification_contestation() { - - // Récupération des valeurs des champs - const bonCaduc = $("#bonCaduc").val(); - const facture = $("#facture").val(); - const numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); - const nomForm = $("#nomForm").val(); - - // Vérification si le numéro de feuille de maladie est valide - if (numeroFeuilleMaladie > "0") { - $.ajax({ - url: $("#racineWeb").val() + "Ajaxfeuillemaladie/", - type: 'POST', - success: function(data) { - - - // Mise à jour du contenu de la div contestation - $("#div_contestation").html(data); - - // Vérification des conditions de contestation - const contestation = $("#contestation").val(); - - if (bonCaduc === "0" && facture === "0" && contestation === "1") { - // Affichage de l'alerte en cas de contestation - const v_msg = "Dossier médical contesté !"; - const v_msgEng = "Medical records contested!"; - - alert_ebene_callback(v_msg, v_msgEng, function(){ - feuillemaladie(); - }); - - } else { - // Exécution des fonctions spécifiques selon le formulaire - switch(nomForm) - { - case "prescriptionexamens": - enregistrerprescriptionexamen(); - break; - case "prescriptionseances": - enregistrerprescriptionseance(); - break; - case "Optique": - enregistreroptique(); - break; - case "dentaire": - maj_motif_dentaire(); - break; - - // Possibilité d'ajouter d'autres cas si nécessaire - } - } - }, - error: function(xhr, status, error) { - console.error("Erreur AJAX:", status, error); - // Vous pourriez ajouter ici un traitement d'erreur - } - }); - } -} - -function alertsiprixprestationzero() -{ - v_msg="Veuillez saisir au moins un prix de prestation!"; - v_msgEng="Please enter at least one service price!"; - - alert_ebene(v_msg, v_msgEng); - return; -} - -function afficherMasquerEnteteProforma() -{ - masquerEnteteProforma = $("#masquerEnteteProforma").val(); - - const element = document.getElementById("chevron-entete-proforma"); - - if(masquerEnteteProforma=="1"){ - $('#div_entete_proforma').hide(); - $("#masquerEnteteProforma").val("0"); - //$("#span_entete_proforma").text("Afficher"); - - element.classList.remove("bi-chevron-up"); - element.classList.add("bi-chevron-down"); - }else{ - $('#div_entete_proforma').show(); - $("#masquerEnteteProforma").val("1"); - //$("#span_entete_proforma").text("Masquer"); - - element.classList.remove("bi-chevron-down"); - element.classList.add("bi-chevron-up"); - } -} - -function listerrdv() -{ - - - d1 = $("#d1").val(); - d2 = $("#d2").val(); - - codeEtatRdv = $("#codeEtatRdv").val(); - - donnees = 'd1='+ d1+'&d2='+d2+'&codeEtatRdv='+codeEtatRdv; - - $("#div_dossiers").html('
' + '
'); - - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdemanderdv/", - type: 'POST', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - // alert(data); - - - $('#div_dossiers').html(data); - }, - complete: function() { - - } - }); -} - -function selectionner_rdv(idDemande) -{ - donnees = 'idDemande='+idDemande; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdemanderdv/selectionner/", - type: 'POST', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - // alert(data); - - - - }, - complete: function() { - ouvrir_rdv(); - } - }); -} - - -function ouvrir_rdv() -{ - window.location.assign($("#racineWeb" ).val()+"Rendezvous/"); - -} - -function historique_rdv() -{ - window.location.assign($("#racineWeb" ).val()+"Historiquerdv/"); - -} - -function valider_rdv() -{ - - - numeroDemandeRdv = $("#numeroDemandeRdv").val(); - codeEtatRdv = $("#codeEtatRdv").val(); - - motifReponseRdv = $("#motifReponseRdv").val(); - motifReponseRdv = motifReponseRdv.trim(); - - if(codeEtatRdv=="0"){ - - v_msg="Un autre état de réponse est obligatoire!"; - v_msgEng="Another response status is required!"; - alert_ebene(v_msg, v_msgEng); - - $("#codeEtatRdv").focus(); - - return; - } - - if (codeEtatRdv=="1"){ - dateRdvAccordee = $("#dateRdvAccordee").val(); - heureRdvAccordee = $("#heureRdvAccordee").val(); - - if(dateRdvAccordee<=" "){ - v_msg="Une date de rendez-vous est obligatoire!"; - v_msgEng="An appointment date is required!"; - alert_ebene(v_msg, v_msgEng); - - $("#dateRdvAccordee").focus(); - - return; - } - - if(heureRdvAccordee<=" "){ - v_msg="Une heure de rendez-vous est obligatoire!"; - v_msgEng="An appointment time is required!"; - alert_ebene(v_msg, v_msgEng); - - $("#heureRdvAccordee").focus(); - - return; - } - - }else{ - dateRdvAccordee = ""; - heureRdvAccordee = ""; - } - - - if(codeEtatRdv=="9" && motifReponseRdv<=" "){ - v_msg="Le motif est obligatoire!"; - v_msgEng="The pattern is mandatory!"; - alert_ebene(v_msg, v_msgEng); - - $("#motifReponseRdv").focus(); - - return; - } - - donnees = 'numeroDemandeRdv='+ numeroDemandeRdv+'&codeEtatRdv='+codeEtatRdv; - donnees += '&dateRdvAccordee='+dateRdvAccordee+'&heureRdvAccordee='+heureRdvAccordee; - donnees += '&motifReponseRdv='+motifReponseRdv; - - - v_msg="Confirmez-vous la modification de votre demande?"; - v_msgEng="Do you confirm the modification of your request?"; - - confirm_ebene_sweet(v_msg, v_msgEng) - .then((isConfirmed) => { - if (isConfirmed) { - // L'utilisateur a confirmé - - vLink = "Ajaxdemanderdv/valider/"; - - $.ajax({ - type: "POST", - url: $("#racineWeb").val()+vLink, - data:donnees, - error: function(errorData) { - }, - success: function(data) { - //alert(data); - // $('#div_test_gabarit').html(data); - - }, - complete: function() { - - historique_rdv(); - } - - }); - - } else { - // L'utilisateur a annulé - console.log("Confirmation refusée"); - } - }); - -} - -function visibilite_date_rdv() -{ - codeEtatRdv = $('#codeEtatRdv').val(); - - if(codeEtatRdv=="0" || codeEtatRdv=="1"){ - $('#tr_date').show(); - }else{ - - $('#tr_date').hide(); - } -} - -function ajax_context_feuille_maladie_recherche(numeroBonConsultation,idBeneficiaire,idPolice) -{ - // - donnees = 'numeroBonConsultation='+numeroBonConsultation + '&idBeneficiaire='+idBeneficiaire+ '&idPolice='+idPolice ; - $.ajax({ - url: $("#racineWeb").val()+"Ajaxcontextfeuillemaladie/recherche/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - complete: function() { - feuillemaladie(); - } - }); -} - -// -function filtrefeuillerecher() { - etatFeuille = $("#etatFeuille").val(); - debut = $("#debut").val(); - fin = $("#fin").val(); - - donnees = 'etatFeuille=' + etatFeuille; - donnees += '&debut=' + debut + '&fin=' + fin; - - $("#div_filtrefeuillerecher").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val() + "Ajaxcloturerfeuillemaladie/filtrefeuillerecher/", - type: 'post', - data: donnees, - error: function (errorData) { - }, - success: function (data) { - $("#div_filtrefeuillerecher").html(data); - $(".datepicker" ).datepicker(); - appliquerDataTable(); - - }, - complete: function () { - } - }); -} - - -function listeententeprealables() { - - codeReponseEntentePrealable = $("#codeReponseEntentePrealable").val(); - debut_entente = $("#debut_entente").val(); - fin_entente = $("#fin_entente").val(); - - donnees = 'codeReponseEntentePrealable=' + codeReponseEntentePrealable; - donnees += '&debut_entente=' + debut_entente + '&fin_entente=' + fin_entente; - - $("#div_ententeprealable").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val() + "Ajaxententeprealables/", - type: 'post', - data: donnees, - error: function (errorData) { - }, - success: function (data) { - $("#div_ententeprealable").html(data); - $(".datepicker" ).datepicker(); - appliquerDataTable(); - - }, - complete: function () { - } - }); -} - -function cloturer_feuille_maladie(numeroFeuilleMaladie,idBeneficiaire) -{ - - - donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie +'&idBeneficiaire='+idBeneficiaire; - - $("#div_dossiers").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxcloturerfeuillemaladie/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#div_recap_feuille_maladie").html(data); - $("#div_recap_feuille_maladie").modal({ backdrop: 'static', keyboard: false, show: true }); - $("#div_recap_feuille_maladie").modal("show"); - $("#codeAffectionPop").selectpicker(); - }, - complete: function() { - afficherMasquerBeneficiaire(); - } - }); -} - -function afficherMasquerBeneficiaire() { - masquerbeneficiaire= $("#masquerbeneficiaire").val(); - - if (masquerbeneficiaire == "1") { - $('#div_beneficiaire').hide(); - $("#masquerbeneficiaire").val("0"); - $("#span_beneficiaire").html(''); - - } else { - $('#div_beneficiaire').show(); - $("#masquerbeneficiaire").val("1"); - $("#span_beneficiaire").html(''); - } -} - -function listerdossiercontestes() -{ - - - d1=$("#d1").val(); - d2=$("#d2").val(); - - donnees = 'd1='+d1+'&d2='+d2; - - $("#div_dossiers").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdossierscontestes/", - type : 'post', - data: donnees, - error: function(errorData) { - // alert("Erreur : "+errorData); - }, - success: function(data) { - - - $("#div_dossiers").html(data); - }, - complete: function() { - } - }); -} - -// pour le mode saisi facture décompte -function enregistrerconsultationassureur() -{ - codeLangue = $("#codeLangue").val(); - codeActeConsultationGratuite = $("#codeActeConsultationGratuite").val(); - - $("#okId" ).val("1"); - $("#okId_face" ).val("1"); - - /* - codeTypeRemboursement=$("#codeTypeRemboursement").val(); - - if(codeTypeRemboursement=="RDE"){ - - v_msg="Attention! La consultation est exclusivement en remboursement direct! Le patient est pri\u00e9 de se rendre chez le gestionnaire pour se faire rembourser. Merci pour votre compr\u00e9hension!"; - v_msgEng="Warning! The consultation is exclusively in direct reimbursement! The patient is asked to go to the manager for reimbursement. "+nomSociete+" thanks you!"; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - } - */ - - badcodeGestionBon = $("#badcodeGestionBon").val(); - - if (badcodeGestionBon=="1") - { - v_msg="Veuillez revoir le type de gestion de bons!"; - v_msgEng="Please review the type of forms management!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - appliquerDelaiCarence = $("#appliquerDelaiCarence").val(); - - anciennete = $("#anciennete").val(); - anciennete = parseInt(anciennete); - - delaiCarenceRaisonconsultation = $("#delaiCarenceRaisonconsultation").val(); - delaiCarenceRaisonconsultation = parseInt(delaiCarenceRaisonconsultation); - - delaiCarenceBeneficiaire = $("#delaiCarenceBeneficiaire").val(); - delaiCarenceBeneficiaire = parseInt(delaiCarenceBeneficiaire); - - if (delaiCarenceBeneficiaire > 0 && appliquerDelaiCarence=="1") - { - if (anciennete < delaiCarenceBeneficiaire) - { - v_msg="Attention! P\u00e9riode de carence!"; - v_msgEng="Warning! waiting period!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - delaiCarenceActe = $("#delaiCarenceActe").val(); - delaiCarenceActe = parseInt(delaiCarenceActe); - - if (anciennete "0") && (dureeDerniereConsultation <= dureeVieBon) && (codePrestataire == dernierCentre)){ - if(codeTypeConsultation == "GE"){ - v_msg="La derni\u00e8re consultation du patient pour cet acte date de moins de "+dureeVieBon+" jours. Veuiller changer l'acte ou passer en consultation gratuite. Merci pour votre compr\u00e9hension!"; - v_msgEng="The patient's last consultation was less than "+dureeVieBon+" days ago. Please change the deed or go to free consultation. Thanks for understanding."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else if((codeTypeConsultation == "SP") && (dernierMedecinConsulte == codeMedecin)){ - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 par ce sp\u00e9cialiste, il ya moins de "+dureeVieBon+" jours. Veuiller changer l'acte ou passer en consultation gratuite. Merci pour votre compr\u00e9hension!"; - v_msgEng="Please note, this patient has already been consulted by this specialist, less than "+dureeVieBon+" days ago. Please change the deed or go to free consultation. Thanks for understanding."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - } - }else if ((codeActe == dernierActe) && (dureeDerniereConsultation == "0")){ - if((codeTypeConsultation == "GE") && (codePrestataire == dernierCentre)){ - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 aujourd'hui par un g\u00e9n\u00e9raliste. Voulez-vous ouvrir son dossier m\u00e9dical?"; - v_msgEng="Attention, this patient has already been consulted by a general practitioner today. Would you like to open his medical file?"; - - confirm_ebene_sweet(v_msg, v_msgEng).then((confirmed) => { - if (confirmed) { - dossiers(0); - } else { - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 aujourd'hui par un g\u00e9n\u00e9raliste. Cliquer sur le menu Dossiers, dans la barre de gauche, pour ouvrir son dossier m\u00e9dical."; - v_msgEng="Attention, this patient has already been consulted by a general practitioner today. Click on the Files menu, in the left bar, to open his medical file."; - faireDefileMessage(v_msg, v_msgEng); - } - }); - return; - }else if((codeTypeConsultation == "GE") && (codePrestataire != dernierCentre)){ - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 aujourd'hui ailleurs par un g\u00e9n\u00e9raliste. Veuiller changer l'acte ou demander au patient de revenir un autre jour. Merci pour votre compr\u00e9hension!"; - v_msgEng="Please note, for this day the patient has already been consulted elsewhere by a general practitioner. Please change the procedure or ask the patient to come back another day. Thank you for your understanding."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else if((codeTypeConsultation == "SP") && (nbreConsultaionSpecialisteJour >= paramConsultationSpecialisteJour)){ - v_msg="Attention, ce patient a d\u00e9ja consult\u00e9 "+ paramConsultationSpecialisteJour +" sp\u00e9cialistes aujourd'hui. Veuiller changer l'acte. Merci pour votre compr\u00e9hension!"; - v_msgEng="Attention, this patient has already consulted "+ paramConsultationSpecialisteJour +" specialists today. Please change the deed. Thanks for understanding."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else if((codeTypeConsultation == "SP") && (codePrestataire == dernierCentre) && (dernierMedecinConsulte == codeMedecin)){ - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 aujourd'hui par ce sp\u00e9cialiste."; - v_msgEng="Attention, this patient has already been consulted by this specialist today."; - - confirm_ebene_sweet( - codeLangue === "en_US" ? "Do you want to open the patient's medical file?" : "Voulez-vous ouvrir le dossier médical du patient?", - codeLangue === "en_US" ? v_msgEng : v_msg - ).then((confirmed) => { - if (confirmed) { - dossiers(0); - } else { - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 aujourd'hui par ce sp\u00e9cialiste. Cliquer sur le menu Dossiers, dans la barre de gauche, pour ouvrir son dossier m\u00e9dical."; - v_msgEng="Attention, this patient has already been consulted by this specialist today. Click on the Files menu, in the left bar, to open his medical file."; - faireDefileMessage(v_msg, v_msgEng); - } - }); - return; - } - }else if ((codeActe == dernierActe) && (dureeDerniereConsultation == "0")){ - if((codeTypeConsultation == "GE") && (codePrestataire == dernierCentre)){ - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 aujourd'hui par un g\u00e9n\u00e9raliste. Voulez-vous ouvrir son dossier m\u00e9dical?"; - v_msgEng="Attention, this patient has already been consulted by a general practitioner today. Would you like to open his medical file?"; - - confirm_ebene_sweet(v_msg, v_msgEng).then((confirmed) => { - if (confirmed) { - dossiers(0); - } else { - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 aujourd'hui par un g\u00e9n\u00e9raliste. Cliquer sur le menu Dossiers, dans la barre de gauche, pour ouvrir son dossier m\u00e9dical."; - v_msgEng="Attention, this patient has already been consulted by a general practitioner today. Click on the Files menu, in the left bar, to open his medical file."; - faireDefileMessage(v_msg, v_msgEng); - } - }); - return; - }else if((codeTypeConsultation == "GE") && (codePrestataire != dernierCentre)){ - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 aujourd'hui dans un autre centre."; - v_msgEng="Attention, this patient has already been consulted today in another center"; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else if((codeTypeConsultation == "GE") && (dureeDerniereConsultation >= "0") && (dureeDerniereConsultation <= dureeVieBon) && (codePrestataire == dernierCentre)){ - v_msg="La derni\u00e8re consultation g\u00e9n\u00e9raliste du patient date de moins de "+dureeVieBon+" jours. Veuiller changer l'acte ou passer en consultation gratuite. Merci pour votre compr\u00e9hension!"; - v_msgEng="The patient's last general consultation was less than "+dureeVieBon+" days ago. Please change the deed or go to free consultation. Thanks for understanding."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else if((codeTypeConsultation == "SP") && (specialiteEstPossible == "0")){ - if(codeSpecialite == "PED" && (age > agemaxipediatrie)) { - v_msg="Attention, ce patient n'a pas moins de "+agemaxipediatrie+" ans! Il ne peut pas faire cette consultation, veuiller changer l'acte."; - v_msgEng="Attention, this patient is not less than "+agemaxipediatrie+" years old! He cannot do this consultation, please change the act."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else{ - v_msg="La derni\u00e8re consultation du patient pour cet acte date de moins de "+dureeVieBon+" jours. Veuiller changer l'acte ou passer en consultation gratuite. Merci pour votre compr\u00e9hension!"; - v_msgEng="The patient's last consultation was less than "+dureeVieBon+" days ago. Please change the deed or go to free consultation. Thanks for understanding."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - } - } - }else if((codeTypeConsultation == "SP") && (nbreConsultaionSpecialisteJour >= paramConsultationSpecialisteJour) && (dureeDerniereConsultation == "0")){ - v_msg="Attention, ce patient a d\u00e9ja consult\u00e9 "+ paramConsultationSpecialisteJour +" sp\u00e9cialistes aujourd'hui. Veuiller changer l'acte. Merci pour votre compr\u00e9hension!"; - v_msgEng="Attention, this patient has already consulted "+ paramConsultationSpecialisteJour +" specialists today. Please change the deed. Thanks for understanding."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else if((codeTypeConsultation == "GE") && (dureeDerniereConsultation == "0") && (codePrestataire != dernierCentre)){ - v_msg="Attention, ce patient a d\u00e9ja \u00e9t\u00e9 consult\u00e9 aujourd'hui dans un autre centre."; - v_msgEng="Attention, this patient has already been consulted today in another center"; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else if((codeTypeConsultation == "GE") && (dureeDerniereConsultation >= "0") && (dureeDerniereConsultation <= dureeVieBon) && (codePrestataire == dernierCentre)){ - v_msg="La derni\u00e8re consultation g\u00e9n\u00e9raliste du patient date de moins de "+dureeVieBon+" jours. Veuiller changer l'acte ou passer en consultation gratuite. Merci pour votre compr\u00e9hension!"; - v_msgEng="The patient's last general consultation was less than "+dureeVieBon+" days ago. Please change the deed or go to free consultation. Thanks for understanding."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else if((codeTypeConsultation == "SP") && (specialiteEstPossible == "0")){ - if(codeSpecialite == "PED" && (age > agemaxipediatrie)) { - v_msg="Attention, ce patient n'a pas moins de "+agemaxipediatrie+" ans! Il ne peut pas faire cette consultation, veuiller changer l'acte."; - v_msgEng="Attention, this patient is not less than "+agemaxipediatrie+" years old! He cannot do this consultation, please change the act."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - }else{ - v_msg="La derni\u00e8re consultation du patient pour cet acte date de moins de "+dureeVieBon+" jours. Veuiller changer l'acte ou passer en consultation gratuite. Merci pour votre compr\u00e9hension!"; - v_msgEng="The patient's last consultation was less than "+dureeVieBon+" days ago. Please change the deed or go to free consultation. Thanks for understanding."; - - alert_ebene(v_msg, v_msgEng); - faireDefileMessage(v_msg, v_msgEng); - return; - } - } - }else if(codeActe == codeActeConsultationGratuite || codeTypeConsultation == "CO"){ - if((dureeDerniereConsultation == "0") && (nombreFeuilleGratuite >= parametreNombreFeuilleGratuitJour)){ - v_msg="Le quotas journalier de feuille de soin gratuite est atteint pour ce patient."; - v_msgEng="The daily free care sheet quota has been reached for this patient."; - - confirm_ouvrir_dossier(v_msg, v_msgEng); - - return; - } - } - - codeRaisonConsultation = $("#codeRaisonConsultation").val(); - - if (codeRaisonConsultation<=" ") - { - v_msg="Veuillez s\u00e9lectionner une raison pour la consultation!"; - v_msgEng="Please select a reason for the consultation!"; - alert_ebene(v_msg, v_msgEng); - $("#codeRaisonConsultation").focus(); - return; - } - - if (codeGestionBon=="0") - { - numeroBon = $("#numeroBon").val(); - - if(isNaN(numeroBon)) - { - v_msg="Veuillez revoir le num\u00e9ro de bon!"; - v_msgEng="Please review the prescription number!"; - alert_ebene(v_msg, v_msgEng); - - $("#btn_enreg").disable(); - $("#msgErreur").html(""); - $("#codeEtatBon").val(""); - - $("#numeroBon").focus(); - return; - } - - if ($("#numeroBon").val()<="0") - { - v_msg="Veuillez saisir un No de bon!"; - v_msgEng="Please enter a prescription number!"; - alert_ebene(v_msg, v_msgEng); - $("#numeroBon").focus(); - return; - } - - codeEtatBon = $("#codeEtatBon").val(); - - if (codeEtatBon!="1") - { - v_msg="Veuillez saisir un No de bon disponible!"; - v_msgEng="Please enter a prescription number available!"; - alert_ebene(v_msg, v_msgEng); - $("#numeroBon").focus(); - return; - } - - if(numeroBonSave!=numeroBon) - { - v_msg="Veuillez revoir le num\u00e9ro de bon!"; - v_msgEng="Please review the prescription number!"; - alert_ebene(v_msg, v_msgEng); - - $("#btn_enreg").disable(); - $("#msgErreur").html(""); - $("#codeEtatBon").val(""); - - $("#numeroBon").focus(); - return; - } - - v_msg="Confirmez-vous ce No de bon?"; - v_msgEng="Do you confirm this number of presciption?"; - } - else - { - numeroBon = "-1"; - v_msg="Confirmez-vous l'ouverture d'un dossier médical pour ce patient?"; - v_msgEng="Do you confirm the opening of a medical file for this patient?"; - } - - confirm_ebene_sweet(v_msg, v_msgEng).then((confirmed) => { - if (confirmed) { - dateSurvenance = $("#dateSurvenance").val(); - observations = $("#observations").val(); - - depassement = $("#depassement").val(); - numeroDerogation = $("#derogation_en_cours_C").val(); - numeroDerogationFinger = $("#derogation_finger_en_cours_C").val(); - - okReferencement = $("#okReferencement").val(); - - dateReferencement = $("#dateReferencement").val(); - codeReferencement = $("#codeReferencement").val(); - - if(dateReferencement == undefined){ - dateReferencement=""; - } - - if(codeReferencement == undefined){ - codeReferencement=""; - } - - if (numeroDerogation<1) { - numeroDerogation = "0"; - } - - if (numeroDerogationFinger<1) { - numeroDerogationFinger = "0"; - } - - ententePrealable='0'; - bonPrincipal = "0"; - medecinManquant =""; - - donnees = 'codeActe='+codeActe+'&numeroBon='+numeroBon+'&codeMedecin='+codeMedecin+'&codeRaisonConsultation='+codeRaisonConsultation; - donnees += '&dateSurvenance='+dateSurvenance+'&observations='+observations+'&prixActe='+prixActe+'&prixBase='+prixBase; - donnees += '&montantTm='+montantTm+'&aRembourser='+aRembourser+'&numeroDerogation='+numeroDerogation+'&depassement='+depassement; - donnees += '&numeroDerogationFinger='+numeroDerogationFinger; - donnees += '&medecinManquant='+medecinManquant; - donnees += '&ententePrealable='+ententePrealable; - donnees += '&dateReferencement='+dateReferencement; - donnees += '&codeReferencement='+codeReferencement; - donnees += '&bonPrincipal='+bonPrincipal; - donnees += '&codeGestionBon='+codeGestionBon; - donnees += '&codeSpecialite='+codeSpecialite; - - $("#btn_enreg").disable(); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxenregistrerconsultation/enregistrerconsultation/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - maj_fraisexclu_cso(); - }, - complete: function() { - v_msg="Consultation enregistr\u00e9e avec succ\u00e8s"; - v_msgEng="Saved successfully!"; - alert_ebene(v_msg, v_msgEng); - feuillemaladie(); - } - }); - } else { - return; - } - }); -} - -async function envoyer_demande_reconnaissance_faciale() { - // alert("envoyer_demande_reconnaissance_faciale"); - // return; - - // Demande de confirmation multilingue - const isConfirm = await confirm_ebene_sweet( - "Confirmez-vous la validation?", - "Do you confirm validation?" - ); - - if (!isConfirm) { - return false; - } - - try { - await $.ajax({ - url: $("#racineWeb").val() + "Ajaxdetaildentisterie/valider/", - type: 'POST', - data: '' - }); - - alert_ebene( - "Demande envoyée!", - "Request sent!" - ); - - fiche_beneficiaire(); - - } catch (error) { - console.error("Erreur :", error); - } -} - -function modifier_prix_acte() { - prixModifiable = $('#prixModifiable').val(); - $('#prixSaisi').val(prixModifiable); - prixModifiable = $('#prixModifiable').val(); - prixSaisi = $('#prixSaisi').val(); - - if(prixSaisi<="0"){ - initialiser_prix_acte(); - } - else{ - ajaxprixacte(); - } -} - -function modifier_prix_examen(idExamen, prixSaisi) { - donnees = 'idExamen='+idExamen+'&prixSaisi='+prixSaisi; - - if (prixSaisi <= "0"){ - v_msg="Rien à faire!"; - v_msgEng="Nothing to do!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetailexamen/majprixamen/", - type: 'POST', - data: donnees, - success: function(data) { - $("#livraison").html(data); - }, - error: function(data) { - }, - complete: function() { - } - }); -} - - -function modifier_prix_examen_lab(idExamen, prixSaisi) { - donnees = 'idExamen='+idExamen+'&prixSaisi='+prixSaisi; - - if (prixSaisi <= "0"){ - v_msg="Rien à faire!"; - v_msgEng="Nothing to do!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetaillaboratoire/majprixamen/", - type: 'POST', - data: donnees, - success: function(data) { - $("#livraison").html(data); - }, - error: function(data) { - }, - complete: function() { - } - }); -} - -function modifier_prix_seance() { - prixModifiable = $('#prixModifiable').val(); - $('#prixSaisi').val(prixModifiable); - $('#prixActe').val(prixModifiable); - - ajaxprixseance(); -} - -function modifier_prix_dentisterie(idDentisterie, prixSaisi) { - donnees = 'idDentisterie='+idDentisterie+'&prixSaisi='+prixSaisi; - - if (prixSaisi <= "0"){ - v_msg="Rien à faire!"; - v_msgEng="Nothing to do!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxdetaildentisterie/majprixdentisterie/", - type: 'POST', - data: donnees, - complete: function() { - dentisterie(); - } - }); -} - -function modifier_prix_autres_actes(idPrestationactes, prixSaisi, controle) { - donnees = 'idPrestationactes='+idPrestationactes+'&prixSaisi='+prixSaisi; - - if (prixSaisi <= "0"){ - v_msg="Rien à faire!"; - v_msgEng="Nothing to do!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - let donnee_a_afficher = ""; - - $("#div_prestations").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxactesmedicauxselect/majprixautresactes/", - type: 'POST', - data: donnees, - success: function(data) { - donnee_a_afficher = data; - }, - complete: function() { - $("#div_prestations").html(donnee_a_afficher); - controle.focus(); - } - }); -} - -function ajax_maj_qte_acte(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; - - donnee_a_affciher = ""; - - donnees = 'idPrestationactes='+idPrestationactes+"&quantite="+quantite; - - $("#div_prestations").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxactesmedicauxselect/majquantite/", - type: 'POST', - data: donnees, - success: function(data) { - donnee_a_affciher = data; - }, - error: function(data) { - }, - complete: function() { - $("#div_prestations").html(donnee_a_affciher); - controle.focus(); - } - }); - } -} - -/** - * Fonction pour supprimer un acte médical sélectionné - * @param {string} idPrestationactes - Identifiant unique de la prestation à supprimer - * @param {string} codeTypePrestation - Code du type de prestation - */ -async function supprimer_acte_medical_selection(idPrestationactes, codeTypePrestation) { - // 1. Initialisation des variables - let donnee_a_afficher = ""; - - // 2. Messages de confirmation multilingues - const messages = { - confirmation: { - fr: "Confirmez-vous la suppression de cet acte?", - en: "Do you confirm the removal of this act?" - }, - chargement: { - fr: "Veuillez patienter...", - en: "Please wait..." - } - }; - - // 3. Demande de confirmation à l'utilisateur - const isConfirmed = await confirm_ebene_sweet( - messages.confirmation.fr, - messages.confirmation.en - ); - - if (!isConfirmed) return; - - // 4. Récupération du code famille acte - const codeFamilleActe = $("#codeFamilleActe").val(); - - // 5. Affichage de l'indicateur de chargement - // $("#listeacte").html('
' + '
'); - $("#div_prestations").html('
' + '
'); - - - // 6. Préparation des données pour la requête - const donnees = { - codeFamilleActe: codeFamilleActe, - idPrestationactes: idPrestationactes, - codeTypePrestation: codeTypePrestation - }; - - // 7. Envoi de la requête AJAX - try { - const response = await $.ajax({ - url: $("#racineWeb").val() + "Ajaxselectactesmedicaux/supprimeracte/", - type: 'POST', - data: donnees - }); - - // 8. Traitement de la réponse - donnee_a_afficher = response; - - // 9. Mise à jour de l'interface utilisateur - $("#totam_donnees").html(donnee_a_afficher); - appliquerDataTable(); // Application du plugin DataTables - majgestionacte(); // Mise à jour de la gestion des actes - - } catch (error) { - console.error("Erreur lors de la suppression de l'acte médical:", error); - // Gestion supplémentaire des erreurs pourrait être ajoutée ici - } -} - -// Fonction appelée lorsqu’on veut indiquer qu’il n’y a pas de prescription pour un patient -function no_presciption() -{ - const facture = $("#facture").val(); - const contestation = $("#contestation").val(); - - // Si la facture est déjà émise, on affiche une alerte et on arrête - if (facture == "1") { - const v_msg = "D\u00e9jà factur\u00e9!"; - const v_msgEng = "Already charged!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - // Si le dossier est contesté, on empêche la validation - if (contestation == "1") { - const v_msg = "Dossier médical contest\u00e9 !"; - const v_msgEng = "Medical records contested!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - const numOrd = $("#numOrd").val(); - const noPrescription = $("#noPrescription").val(); - - // Si aucune ordonnance ni indication "pas de prescription" - if (numOrd == "0" && noPrescription == "0") { - const v_msg = "Confirmez-vous qu'il n'y a pas de prescription de m\u00e9dicaments?"; - const v_msgEng = "Do you confirm that there is no drugs prescription?"; - const codeLangue = $("#codeLangue").val(); - - // Appel d'une boîte de confirmation personnalisée, adaptée à la langue - confirm_ebene_sweet( - v_msg, v_msgEng - ).then((confirmed) => { - if (confirmed) { - $.ajax({ - url: $("#racineWeb").val() + "Ajaxenregistrerprescription/noprescription/", - type: 'post', - error: function(errorData) { - // alert(errorData); - }, - success: function(data) { - // alert(data); - }, - - complete: function() { - feuillemaladie(); // Rechargement de la feuille de maladie - } - }); - } - }); - } -} - -function modifier_prix_seance_kine() { - prixModifiable = $('#prixModifiable').val(); - $('#prixSaisi').val(prixModifiable); - $('#prixActe').val(prixModifiable); - - ajaxprixseancesea(); -} - -function ajaxprixseancesea() -{ - codeActe = $("#codeActe").val(); - - if (codeActe<=" ") - { - $("#prixActe_info").val("0"); - $("#totalActe_info").val("0"); - $("#montantTm_info").val("0"); - $("#aRembourser_info").val("0"); - $("#depassement_info").val("0"); - - v_msg="Veuillez s\u00e9lectionner un act!"; - v_msgEng="Please select an act!"; - alert_ebene(v_msg, v_msgEng); - - $("#codeActe").focus(); - return; - } - - quantite = $("#quantiteSeance").val(); - - quantite = parseInt(quantite); - - if(quantite==0) - { - $("#quantiteSeance").val(1); - quantite = 1; - } - - nbRestant = $("#nbRestant").val(); - nbRestant = parseInt(nbRestant); - - if(quantite>nbRestant) - { - v_msg="Vous ne pouvez pas d\u00e9passer "+nbRestant+" s\u00e9ances!"; - v_msgEng="Only "+nbRestant+" sessions are possible!"; - alert_ebene(v_msg, v_msgEng); - quantite = 0; - } - - prixSaisi = $("#prixSaisi").val(); - donnees = 'codeActe='+codeActe+'&quantite='+quantite; - donnees += '&prixSaisi='+prixSaisi; - - $("#infosacte").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxprixseancesea/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - $("#infosacte").html(data); - }, - complete: function() { - } - }); -} - -function ajax_maj_qte_acte_hospitalisation(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; - } - - $("#totam_donnees").html('
' + '
'); - - donnees = 'idPrestationactes='+idPrestationactes+"&quantite="+quantite; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectactesmedicauxhospitalisation/majquantite/", - type: 'POST', - data: donnees, - success: function(data) { - }, - error: function(data) { - }, - complete: function() { - ajaxactespossibles_selection_hospitalisation(); - } - }); - } -} - -function ajax_maj_prix_acte_hospitalisation(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)) - { - if (valeurActe <= "0"){ - v_msg="Rien à faire!"; - v_msgEng="Nothing to do!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - $("#totam_donnees").html('
' + '
'); - - donnees = 'idPrestationactes='+idPrestationactes+"&valeurActe="+valeurActe; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectactesmedicauxhospitalisation/majvaleuracte/", - type: 'POST', - data: donnees, - success: function(data) { - }, - error: function(data) { - }, - complete: function() { - ajaxactespossibles_selection_hospitalisation(); - } - }); - } -} - - -function ajax_maj_qte_acte_miseenobservation(idDetail, 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 = 'idDetail='+idDetail+"&quantite="+quantite; - - donnee_a_affciher = ""; - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectactesmedicauxobservation/majvaleuracte/", - type: 'POST', - data: donnees, - success: function(data) { - donnee_a_affciher = data; - }, - error: function(data) { - }, - complete: function() { - $("#div_prestations").html(donnee_a_affciher); - controle.focus(); - } - }); - } -} - -function ajax_maj_prix_acte_miseenobservation(idDetail, valeurActe, controle) -{ - valeurActe=valeurActe.replace(",","."); - controle.value=valeurActe; - - if(controle_numerique(controle)) - { - if(valeurActe==0) - { - controle.focus(); - v_msg="Rien à faire!"; - v_msgEng="Nothing to do!"; - alert_ebene(v_msg, v_msgEng); - return; - } - - donnees = 'idDetail='+idDetail+"&valeurActe="+valeurActe; - - donnee_a_afficher = ""; - - $("#totam_donnees").html('
' + '
'); - - $.ajax({ - url: $("#racineWeb").val()+"Ajaxselectactesmedicauxobservation/majvaleuracte/", - type: 'POST', - data: donnees, - success: function(data) { - donnee_a_afficher = data; - }, - error: function(data) { - }, - complete: function() { - - $("#totam_donnees").html(donnee_a_afficher); - appliquerDataTable(); // Application du plugin DataTables - ajaxactespossibles_miseenobservation(); // Rafraîchissement de la liste des actes - } - }); - } -} - -/** - * Fonction pour supprimer un acte médical en mise en observation - * @param {string} idDetail - Identifiant unique de l'acte à supprimer - */ -async function supprimer_acte_medical_miseenobservation(idDetail) { - // 1. Initialisation de la variable pour stocker les données à afficher - let donnee_a_afficher = ""; - - // 2. Messages de confirmation multilingues - const confirmationMsg = { - fr: "Confirmez-vous la suppression de cet acte?", - en: "Do you confirm the removal of this act?" - }; - - // 3. Demande de confirmation à l'utilisateur - const isConfirmed = await confirm_ebene_sweet(confirmationMsg.fr, confirmationMsg.en); - if (!isConfirmed) return; - - // 4. Affichage de l'indicateur de chargement - $("#listeacte").html('
' + '
'); - - // 5. Envoi de la requête de suppression au serveur - try { - const response = await $.ajax({ - url: $("#racineWeb").val() + "Ajaxselectactesmedicauxobservation/supprimeracte/", - type: 'POST', - data: { idDetail: idDetail } - }); - - // 6. Traitement de la réponse - donnee_a_afficher = response; - - // 7. Mise à jour de l'interface utilisateur - $("#totam_donnees").html(donnee_a_afficher); - appliquerDataTable(); // Application du plugin DataTables - ajaxactespossibles_miseenobservation(); // Rafraîchissement de la liste des actes - - } catch (error) { - console.error("Erreur lors de la suppression de l'acte:", error); - // Gestion supplémentaire des erreurs pourrait être ajoutée ici - } -} +function init_remplacer_medicament(idMe \ No newline at end of file