prestation/Js/fonctions.js
2026-06-23 11:55:32 +00:00

9647 lines
256 KiB
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

nomSociete = $("#nomSociete").val();
function alert_ebene_no_sweet_alert(p_msg, p_msg_eng)
{
codeLangue = $("#codeLangue").val();
if(codeLangue=="en_US")
{
alert(p_msg_eng);
}
else
{
alert(p_msg);
}
}
function alert_ebene_callback(p_msg, p_msg_eng, callback) {
let codeLangue = $("#codeLangue").val();
let message = (codeLangue === "en_US") ? p_msg_eng : p_msg;
let titre = (codeLangue === "en_US") ? "Alert Information!" : "Information !";
let btnText = (codeLangue === "en_US") ? "OK" : "D'accord";
const hasCallback = typeof callback === "function";
Swal.fire({
title: titre,
text: message,
icon: "info",
confirmButtonText: btnText,
allowOutsideClick: false,
allowEscapeKey: false
}).then((result) => {
if (hasCallback && result.isConfirmed) {
callback();
}
});
}
function alert_ebene(p_msg, p_msg_eng) {
// Récupération de la langue sélectionnée
let codeLangue = $("#codeLangue").val();
// Choix du message en fonction de la langue
let message = (codeLangue === "en_US") ? p_msg_eng : p_msg;
// Utilisation de SweetAlert pour afficher le message
Swal.fire({
title: message,
icon: 'info', // Icône de type information
confirmButtonText: codeLangue === "en_US" ? 'OK' : 'D\'accord'
});
}
function confirm_ebene(p_msg, p_msg_eng)
{
codeLangue = $("#codeLangue").val();
if(codeLangue=="en_US")
{
return confirm(p_msg_eng);
}
else
{
return confirm(p_msg);
}
}
function confirm_ebene_sweet(p_msg, p_msg_eng) {
// Récupération de la langue sélectionnée
let codeLangue = $("#codeLangue").val();
// Choix du message en fonction de la langue
let message = (codeLangue === "en_US") ? p_msg_eng : p_msg;
// Utilisation de SweetAlert avec une promesse
return Swal.fire({
title: message,
icon: 'warning',
showCancelButton: true,
confirmButtonText: codeLangue === "en_US" ? 'Yes' : 'Oui',
cancelButtonText: codeLangue === "en_US" ? 'No' : 'Non'
}).then((result) => {
return result.isConfirmed; // Retourne true si l'utilisateur confirme, false sinon
});
}
function confirm_ebene_sweet_callback(msgFr, msgEn, onConfirm) {
// Récupération de la langue sélectionnée
let codeLangue = $("#codeLangue").val();
// Sélection du texte en fonction de la langue
let msg = (codeLangue === 'en_US') ? msgEn : msgFr;
let confirmBtn = (codeLangue === 'en_US') ? "Yes" : "Oui";
let cancelBtn = (codeLangue === 'en_US') ? "No" : "Non";
// Utilisation de SweetAlert2
Swal.fire({
title: msg,
icon: "warning",
showCancelButton: true,
confirmButtonText: confirmBtn,
cancelButtonText: cancelBtn
}).then((result) => {
if (result.isConfirmed) {
onConfirm(); // Exécute la fonction de confirmation
}
});
}
function confirm_ouvrir_dossier(p_msg, p_msg_eng) {
const title = $("#codeLangue").val() === "en_US"
? "Do you want to open the patient's medical file?"
: "Voulez-vous ouvrir le dossier médical du patient?";
confirm_ebene_sweet(title, p_msg_eng).then((confirmed) => {
if (confirmed) {
dossiers(0);
}
});
}
function prompt_ebene(p_msg, p_msg_eng, p_retour)
{
codeLangue = $("#codeLangue").val();
if(codeLangue=="en_US")
{
return prompt(p_msg_eng, p_retour);
}
else
{
return prompt(p_msg, p_retour);
}
}
function prompt_ebene_sweet(p_msg, p_msg_eng, p_retour, callback) {
let codeLangue = $("#codeLangue").val();
let message = (codeLangue === "en_US") ? p_msg_eng : p_msg;
Swal.fire({
title: message,
input: 'text',
inputValue: p_retour,
showCancelButton: true,
confirmButtonText: 'OK',
cancelButtonText: 'Annuler'
}).then((result) => {
if (result.isConfirmed) {
callback(result.value); // Exécute la fonction callback avec la valeur saisie
} else {
callback(null); // Annule l'opération
}
});
}
var p_destinataires="";
var p_message="";
function adherents_police()
{
if ($("#idPolice_C" ).val()>"")
{
window.location.assign($("#racineWeb" ).val()+"Listeadherent/");
}
}
$.prototype.enable = function () {
$.each(this, function (index, el) {
$(el).removeAttr('disabled');
});
}
$.prototype.disable = function () {
$.each(this, function (index, el) {
$(el).attr('disabled', 'disabled');
});
}
$.prototype.unreadable = function () {
$.each(this, function (index, el) {
$(el).attr('READONLY', 'READONLY');
});
}
$.prototype.readable = function () {
$.each(this, function (index, el) {
$(el).removeAttr('READONLY');
});
}
Date.estAnneeBissextile = function (annee) {
return (((annee % 4 === 0) && (annee % 100 !== 0)) || (annee % 400 === 0));
};
Date.getDaysInMonth = function (annee, month) {
return [31, (Date.estAnneeBissextile(annee) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
};
Date.prototype.estAnneeBissextile = function () {
return Date.estAnneeBissextile(this.getFullYear());
};
Date.prototype.getDaysInMonth = function () {
return Date.getDaysInMonth(this.getFullYear(), this.getMonth());
};
Date.prototype.addMonths = function (value) {
var n = this.getDate();
this.setDate(1);
this.setMonth(this.getMonth() + value);
this.setDate(Math.min(n, this.getDaysInMonth()));
this.setDate(this.getDate()-1);
return this;
};
$( ".datepicker" ).datepicker({
inline: true,
changeMonth: true,
changeYear: true,
yearRange: "c-60:c+20"
});
/*les fonctions courantes et globales */
function get_age(dater)
{
var td2 = $("#datejourfr_C").datepicker("getDate");
return age = td2.getFullYear()-dater.getFullYear();
}
// function controle_age(dater, codeLienParente, controle)
function controle_age(dater, codeLienParente)
{
age = get_age(dater);
$("#agepersonne").val("Âge : "+age);
if (age>65)
{
v_msg="Âge "+age+" sup\u00e9rieur à 65 ans!";
v_msgEng="Age "+age+" over 65!";
alert_ebene(v_msg, v_msgEng);
return false;
}
if ( (codeLienParente=="E")&& (age>21) )
{
v_msg="Âge "+age+" => Enfant âg\u00e9 de plus de 21 ans!";
v_msgEng="Âge "+age+" => Child over 21 years old!";
alert_ebene(v_msg, v_msgEng);
return false;
}
if ( (codeLienParente=="O")&& (age>21) )
{
v_msg="Âge "+age+" => Enfant âg\u00e9 de plus de 21 ans!";
v_msgEng="Âge "+age+" => Child over 21 years old!";
alert_ebene(v_msg, v_msgEng);
return false;
}
return true;
}
/* D\u00e9but JS client */
function selectionner_client(id,no)
{
$("#idClient_C").val(id);
$("#numeroClient_C").val(no);
$("#nomClient_C").val("");
}
function selectionner_client_d(id,no)
{
$("#idClient_d_C").val(id);
$("#numeroClient_d_C").val(no);
$("#nomClient_d_C").val("");
}
function afficher_client_id()
{
idClient=$("#idClient_C" ).val();
if (idClient>"")
{
ajax_context_client_afficher(idClient);
}
}
function afficher_client_d_id()
{
idClient=$("#idClient_d_C" ).val();
if (idClient>"")
{
ajax_context_client_d_afficher(idClient);
}
}
/* Fin JS client */
/* D\u00e9but JS police */
function selectionner_police(id,no)
{
$("#idPolice_C" ).val(id);
$("#numeroPolice_C" ).val(no);
}
function selectionner_police_d(id,no)
{
$("#idPolice_d_C" ).val(id);
$("#numeroPolice_d_C" ).val(no);
}
function afficher_police_id()
{
idPolice=$("#idPolice_C" ).val();
if (idPolice>"")
{
ajax_context_police_afficher(idPolice);
}
}
function afficher_police_d_id()
{
idPolice=$("#idPolice_d_C" ).val();
if (idPolice>"")
{
ajax_context_police_d_afficher(idPolice);
}
}
/* Fin JS client */
/* D\u00e9but JS adherent */
function selectionner_adherent(id,no)
{
$("#idAdherent_C" ).val(id);
$("#numeroAdherent_C" ).val(no);
}
function afficher_adherent()
{
if ($("#numeroAdherent_C" ).val()>"")
{
window.location.assign($("#racineWeb" ).val()+"Ficheadherent/"+$("#numeroAdherent_C" ).val()+"/");
}
}
function afficher_adherent_id()
{
if ($("#idAdherent_C" ).val()>"")
{
window.location.assign($("#racineWeb" ).val()+"Ficheadherent/"+$("#idAdherent_C" ).val()+"/");
}
}
/* Fin JS adherent */
/* D\u00e9but JS b\u00e9n\u00e9ficiare */
function selectionner_beneficiaire(id,no)
{
$("#idBeneficiaire_C").val(id);
$("#numeroBeneficiaire_C" ).val(no);
}
function afficher_beneficiaire_id()
{
idBeneficiaire=$("#idBeneficiaire_C").val();
okId=$("#okId").val();
okId_face=$("#okId_face ").val();
if (idBeneficiaire>"")
{
ajax_context_beneficiaire_afficher(idBeneficiaire, okId, okId_face);
}else{
recherche();
}
}
function afficher_adherent_assure()
{
if ($("#idAdherent_C" ).val()<=" ")
{
return;
}
window.location.assign($("#racineWeb" ).val()+"ficheadherentassure/");
}
function afficher_assure()
{
if ($("#idAdherent_C" ).val()>"")
{
window.location.assign($("#racineWeb" ).val()+"ficheadherentassure/"+$("#idAdherent_C" ).val()+"/");
}
}
/* Fin JS beneficiaire */
function fermerFenetre() {
const v_msg = "Etes-vous sur de vouloir quitter?";
const v_msgEng = "Are you sure you want to exit?";
confirm_ebene_sweet(v_msg, v_msgEng).then((confirmed) => {
if (confirmed) {
ajax_deconnexion();
}
});
}
function ChangerPass()
{
if ($("#ancmdp" ).val()<=' ')
{
v_msg="Veuillez saisir l\'ancien mot de passe!";
v_msgEng="Please enter the old password!";
alert_ebene(v_msg, v_msgEng);
$("#ancmdp").focus();
return false;
}
if ($("#nvmdp" ).val()<=' ')
{
v_msg="Veuillez saisir un mot de passe!";
v_msgEng="Please enter a password!";
alert_ebene(v_msg, v_msgEng);
$("#nvmdp").focus();
return false;
}
if ($("#nvmdp").val()=='0000' || $("#nvmdp").val()=='radiant')
{
v_msg="Veuillez changer de mot de passe!";
v_msgEng="Please change password!";
alert_ebene(v_msg, v_msgEng);
$("#nvmdp").focus();
return false;
}
longueur = $("#nvmdp").val().length;
if(longueur>0 && longueur<6)
{
v_msg="6 caractères minimum exig\u00e9!";
v_msgEng="6 characters minimum required!";
alert_ebene(v_msg, v_msgEng);
$("#nvmdp").focus();
return false;
}
if ($("#cfnvmdp" ).val()!=$("#nvmdp" ).val())
{
v_msg="Veuillez confirmer votre mot de passe!";
v_msgEng="Please confirm your password!";
alert_ebene(v_msg, v_msgEng);
$("#nvmdp").focus();
return false;
}
}
function afficher_image(fichier)
{
window.open(fichier);
}
function selectionner_bon(id,no, codeEtatBon, motifAnnulation)
{
$("#idBon_C").val(id);
$("#numeroBon_C").val(no);
$("#motifAnnulation_C").val(motifAnnulation);
$("#codeEtatBon_C").val(codeEtatBon);
}
function imprimerbon()
{
if ($("#codeActe").val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").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);
return;
}
var codeEtatBon = $("input[name='codeEtatBon']").val();
if (codeEtatBon!="1")
{
return;
}
$("#frmconsultation").submit();
}
function imprimerbonVierge()
{
if ($("#codeActe").val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").focus();
return;
}
$("#codeTypeBon").val('2');
$("#frmconsultation").submit();
$("#codeTypeBon").val('1');
}
function calculer_Tm()
{
$("#montantTm").val( ($("#montantacte").val() * (100-$("#tauxCouverture").val() )) / 100 );
if ($("#codeMedecin").val()>" ")
$("#numeroBon").focus();
else
$("#codeMedecin").focus();
return true;
}
function controlefocusconsultationMd()
{
if ($("#codeActe").val()>" ")
$("#numeroBon").focus();
else
$("#codeActe").focus();
return true;
}
function ajaxinfosacteexamen()
{
if ($("#codeActe").val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").focus();
return;
}
$.ajax({
url: $("#racineWeb").val()+"Ajaxinfosacte/",
type : 'post',
data: "codePrestataire="+$("#codePrestataire").val()+"&codeActe="+$("#codeActe").val(),
error: function(errorData) {
},
success: function(data) {
$("#infosacte").html(data);
},
complete: function() {
$("#tauxCouverture").val( $("#tauxCouverture_info").val());
}
});
}
function ajaxbonexamendisponible()
{
if ($("#codeActe").val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").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;
}
$("#codeTypeBon").val('1');
$.ajax({
url: $("#racineWeb").val()+"Ajaxbondisponible/",
type : 'post',
data: "codePrestataire="+$("#codePrestataire").val()+"&numeroBon="+$("#numeroBon").val(),
error: function(errorData) {
},
success: function(data) {
$("#msgErreur").html(data);
},
complete: function() {
imprimerbon();
}
});
}
function ajaxbonhospitdisponible()
{
if ($("#codeActe").val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").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;
}
$.ajax({
url: $("#racineWeb").val()+"Ajaxbondisponible/",
type : 'post',
data: "codePrestataire="+$("#codePrestataire").val()+"&numeroBon="+$("#numeroBon").val(),
error: function(errorData) {
},
success: function(data) {
$("#msgErreur").html(data);
},
complete: function() {
imprimerbon();
}
});
}
function accueil()
{
if($("#codeProfil_C" ).val()=="MEC")
{
window.location.assign($("#racineWeb").val()+"Accueilmedecin/");
}
else
{
window.location.assign($("#racineWeb").val()+"Accueil/");
}
}
function forceDownload(fileURL, fileName)
{
}
function ged()
{
if ($("#numeroBeneficiaire_C" ).val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un assur\u00e9!";
v_msgEng="Please select an insured person!";
alert_ebene(v_msg, v_msgEng);
return;
}
window.location.assign($("#racineWeb").val()+"Ged/");
}
function tachesadherent()
{
if ($("#numeroAdherent_C" ).val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un assur\u00e9!";
v_msgEng="Please select an insured person!";
alert_ebene(v_msg, v_msgEng);
return;
}
window.location.assign($("#racineWeb").val()+"Tacheadherent/");
}
function afficherged(cheminFichier)
{
if (cheminFichier<=" ")
{
v_msg="Veuillez s\u00e9lectionner un fichier!";
v_msgEng="Please select a file";
alert_ebene(v_msg, v_msgEng);
return;
}
//window.open(cheminFichier);
window.open(cheminFichier, '_blank');
}
function archiverged()
{
if ($("#nomFichier").val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un document!";
v_msgEng="Please select a document";
alert_ebene(v_msg, v_msgEng);
return;
}
if( $("#accesAssure").val()=="0" && $("#accesPrestataire").val()=="0"
&& $("#accesMedecin").val()=="0" && $("#accesGestionnaire").val()=="0")
{
v_msg="Le document doit être visible par au moins un des acteurs!";
v_msgEng="The document must be seen by at least one of the persons in charge!";
alert_ebene(v_msg, v_msgEng);
return;
}
$("#frmarchiherged").submit();
}
function archiverfacture()
{
if ($("#nomFichier").val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un fichier!";
v_msgEng="Please select a file";
alert_ebene(v_msg, v_msgEng);
return;
}
$("#frmarchiherged").submit();
}
function ajaxinfosdestinatairetache()
{
if ($("#codeDestinataire").val()<=" ")
{
v_msg="Veuillez s\u00e9lectionner un destinataire!";
v_msgEng="Please select a recipient!";
alert_ebene(v_msg, v_msgEng);
$("#codeDestinataire").focus();
return;
}
$.ajax({
url: $("#racineWeb").val()+"Ajaxinfosdestinatairetache/",
type : 'post',
data: "codeDestinataire="+$("#codeDestinataire").val(),
error: function(errorData) {
},
success: function(data) {
$("#infosdestinatairetache").html(data);
},
complete: function() {
$("#emailtache").val( $("#emailActeurtache_info").val());
}
});
}
function selectionner_tache(id)
{
$("#idTache").val(id);
}
function afficher_tache()
{
if ($("#idTache" ).val()<="")
{
v_msg="Veuillez s\u00e9lectionner une ligne!";
v_msgEng="Please select a line!";
alert_ebene(v_msg, v_msgEng);
} else
window.location.assign($("#racineWeb" ).val()+"Affichertache/"+$("#idTache").val()+"/");
}
function reinitialiserrecherche()
{
// window.location.assign($("#racineWeb").val()+"Tache/");
}
function selectionner_Rq(lienrequete)
{
$("#lienrequete" ).val(lienrequete);
}
function parametre_Rq()
{
if ($("#lienrequete" ).val()<="")
{
v_msg="Veuillez s\u00e9lectionner une requête!";
v_msgEng="Please select a query (request)!";
alert_ebene(v_msg, v_msgEng);
}
{
window.location.assign($("#racineWeb" ).val()+$("#lienrequete" ).val());
}
}
function imprimer_pdf()
{
$("#sortie").val('1');
$("#frmrequete").submit();
}
function export_xls()
{
$("#sortie").val('2');
$("#frmrequete").submit();
$("#sortie").val('1');
}
function affichermanuel()
{
codeProfil = $("#codeProfil_C").val();
cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_CENTRES_DE_SOINS.pdf";
switch(codeProfil)
{
case "AAA":
cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_AGENT_AFRIK_ASSUR.pdf";
break;
case "ADM":
cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_ADMINISTRATEUR_SYSTEME.pdf";
break;
case "ASS":
cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_ASSURE.pdf";
break;
case "CSO":
cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_CENTRES_DE_SOINS.pdf";
break;
case "DIR":
cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_DIRECTION_AFRIK_ASSUR.pdf";
break;
case "LAB":
cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_LABORATOIRES.pdf";
break;
case "MEC":
cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_MEDECINS_CONSEIL.pdf";
break;
case "PHA":
cheminFichier="MANUEL_AFRIK_ASSUR_SANTE_PHARMACIES.pdf";
break;
}
window.open('Docs/'+cheminFichier, '_blank');
}
function ajaxListerequetesProfil()
{
$("#listerequete").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxrequetesprofil/",
type : 'post',
data: "codeProfil="+$("#codeProfil").val(),
error: function(errorData) {
},
success: function(data) {
$("#listerequete").html(data);
}
});
}
function compta()
{
numeroClient = $("#numeroClient_C" ).val();
idClient = $("#idClient_C").val();
window.location.assign($("#racineWeb").val()+"Compta/"+idClient+"/");
}
function selectionner_client_pop(id,no,nom)
{
$("#nocli").val(no);
$("#nomcli").val(nom);
selectionner_client(id,no);
}
function ajax_context_client(idClient)
{
donnees = 'idClient='+idClient;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextclient/",
type : 'post',
data: donnees,
error: function(errorData) {
}
});
}
function ajax_context_client_afficher(idClient)
{
donnees = 'idClient='+idClient;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextclient/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
window.location.assign($("#racineWeb" ).val()+"Ficheclient/");
}
});
}
function ajax_context_police(idPolice)
{
donnees = 'idPolice='+idPolice;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextpolice/",
type : 'post',
data: donnees,
error: function(errorData) {
}
});
}
function ajax_context_police_afficher(idPolice)
{
donnees = 'idPolice='+idPolice;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextpolice/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
window.location.assign($("#racineWeb" ).val()+"Fichepolice/");
}
});
}
/* 24/03/2019
function ajax_deconnexion()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdeconnexion/"
});
}
*/
function ajax_deconnexion()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdeconnexion/",
complete: function()
{
window.open('about:blank','_parent','');
close();
window.close();
}
});
}
function ajax_flexcode()
{
// donnees = 'idPolice='+idPolice;
$.ajax({
url: $("#racineWeb").val()+"Ajaxflexcode/",
type : 'post',
// data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#content").html(data);
},
complete: function() {
// window.location.assign($("#racineWeb" ).val()+"Fichepolice/");
}
});
}
function controle_champ_obligatoire(controle)
{
if (controle.value<=" ")
{
v_msg="Valeur exig\u00e9e!";
v_msgEng="Value required!";
alert_ebene(v_msg, v_msgEng);
controle.focus();
return false;
}
return true;
}
function exporter_liste_assures()
{
$('#div_liste').html('');
var div_export = $('#div_export');
div_export.html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxexporterlisteassure/",
type: 'POST',
success: function(data)
{
div_export.html(data);
},
error : function(resultat, statut, erreur)
{
},
complete: function(data)
{
}
});
}
function imprimer_liste_assures()
{
$('#div_liste').html('');
var div_export = $('#div_export');
div_export.html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaximprimerlisteassure/",
type: 'POST',
success: function(data)
{
div_export.html(data);
},
error : function(resultat, statut, erreur)
{
},
complete: function(data)
{
}
});
}
function imprimer_limites()
{
$('#div_liste').html('');
var div_export = $('#div_export');
div_export.html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaximprimerlimite/",
type: 'POST',
success: function(data)
{
div_export.html(data);
},
error : function(resultat, statut, erreur)
{
},
complete: function(data)
{
}
});
}
function pop_tableau_prestation()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxtableauprestation/",
type : 'post',
error: function(errorData) {
},
success: function(data) {
$("#div_tableau_prestation").html(data);
},
complete: function() {
$("#btn_pop").click();
}
});
}
function selectionner_tout_limite(p_idCollegeTemp, p_choix)
{
donnees = 'idCollegeTemp='+p_idCollegeTemp;
donnees += '&choix='+p_choix;
$.ajax({
url: $("#racineWeb").val()+"Ajaxselectionlimite/selectionnertout/",
type: 'POST',
data: donnees,
success: function(data) {
},
error: function(data) {
},
complete: function() {
recapituler_limite_college_simple();
pop_afficher_selection_limite(p_idCollegeTemp);
}
});
}
function prestation_possible()
{
//estGarantie = $("#estGarantie").val();
enVigueur = $("#enVigueur_C").val();
codeEtatBeneficiaire = $("#codeEtatBeneficiaire_C").val();
etatbeneficiaire = $("#etatbeneficiaire_C").val();
college_couvert = $("#college_couvert_C").val();
derogation_en_cours = $("#derogation_en_cours_C").val();
derogation_finger_en_cours = $("#derogation_finger_en_cours_C").val();
datejour = $("#datejour_C").val();
dateEffetPolice = $("#dateEffetPolice_C").val();
dateEcheancePolice = $("#dateEcheancePolice_C").val();
dateEffetCouvert = $("#dateEffetCouvert").val();
ageMaxBeneficiaireAtteint = $("#ageMaxBeneficiaireAtteint_C").val();
if (enVigueur!="1")
{
v_msg="Attention! cette personne n'est pas en vigueur";
v_msgEng="Warning! This person is not in force";
alert_ebene(v_msg, v_msgEng);
return false;
}
if (codeEtatBeneficiaire!="V")
{
v_msg="Attention! "+etatbeneficiaire;
v_msgEng="Warning! "+etatbeneficiaire;
alert_ebene(v_msg, v_msgEng);
return false;
}
if (college_couvert<1 && derogation_en_cours<1)
{
v_msg="Attention! Cette personne n\'a pas accès à ce centre";
v_msgEng="Warning! This person does not have access to this center";
alert_ebene(v_msg, v_msgEng);
return false;
}
if (ageMaxBeneficiaireAtteint == '1')
{
v_msg="Âge maximum atteint pour cette personne!";
v_msgEng="Maximum age reached for this person!";
alert_ebene(v_msg, v_msgEng);
return false;
}
// var td0 = new Date(dateEffetPolice);
dateEntreeBeneficiaire = $("#dateEntreeBeneficiaire_C").val();
var td0 = new Date(dateEntreeBeneficiaire);
var td1 = new Date(datejour);
var td2 = new Date(dateEcheancePolice);
dt0=Math.round(Date.parse(td0)/(1000*3600*24));
dt1=Math.round(Date.parse(td1)/(1000*3600*24));
dt2=Math.round(Date.parse(td2)/(1000*3600*24));
// if (dt1>dt2)
if (dt1>dt2 || dt1<dt0)
{
v_msg="Attention! cette police n'est pas couverte à cette date!";
v_msgEng="Warning! This insurance policy is not valid on this date!";
alert_ebene(v_msg, v_msgEng);
return false;
}
dateSortieBeneficiaire = $("#dateSortieBeneficiaire_C").val();
if(dateSortieBeneficiaire>"2000-01-01")
{
var tdd = new Date(dateSortieBeneficiaire);
dtd=Math.round(Date.parse(tdd)/(1000*3600*24));
if (dt1>dtd)
{
v_msg="Attention! cette personne n'est pas couverte à cette date!";
v_msgEng="Warning! This person is not valid on this date!";
alert_ebene(v_msg, v_msgEng);
return false;
}
}
dateDeces_C=$("#dateDeces_C").val();
if(dateDeces_C>"2000-01-01")
{
v_msg="Attention! personne est d\u00e9c\u00e9d\u00e9e!";
v_msgEng="Warning! Deceased!";
alert_ebene(v_msg, v_msgEng);
return false;
}
return true;
}
function consultation()
{
/* Laisser la possibilit\u00e9 de g\u00e9rer les cas d'accident */
/*
anciennete = $("#anciennete").val();
delaiCarenceBeneficiaire = $("#delaiCarenceBeneficiaire").val();
anciennete = parseInt(anciennete);
delaiCarenceBeneficiaire = parseInt(delaiCarenceBeneficiaire);
if (delaiCarenceBeneficiaire>0)
{
if (anciennete<delaiCarenceBeneficiaire)
{
v_msg="Attention! P\u00e9riode de carence!";
v_msgEng="Warning! waiting period!";
alert_ebene(v_msg, v_msgEng);
return;
}
}
*/
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;
}else{
v_msg="Non autoris\u00e9e!";
v_msgEng="Not allowed!";
alert_ebene(v_msg, v_msgEng);
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;
}
}
$('#div_consultation').show();
//window.location.assign($("#racineWeb" ).val()+"Consultation/");
}
else{
$('#div_consultation').hide();
}
}
function gestionbon()
{
adminBon = $("#adminBon" ).val();
if (adminBon!="1")
{
v_msg="Accès refus\u00e9!";
v_msgEng="Access denied!";
alert_ebene(v_msg, v_msgEng);
return;
}
window.location.assign($("#racineWeb").val()+"Receptionbons/");
}
function afficherbon()
{
codeTypeBon=$("#codeTypeBon").val();
codeEtatBon=$("#codeEtatBon").val();
noDepart=$("#noDepart").val();
noFin=$("#noFin").val();
if (noDepart=="")
{
noDepart="0";
}
if (noFin=="")
{
noFin="0";
}
noDepart = parseInt(noDepart);
noFin = parseInt(noFin);
if (codeTypeBon<=" ")
{
v_msg="Veuillez s\u00e9lectionner un type de bon!";
v_msgEng="Please select a form type!";
alert_ebene(v_msg, v_msgEng);
$("#codeTypeBon").focus();
return;
}
if (noFin<noDepart)
{
v_msg="Veuillez revoir vos bornes!";
v_msgEng="Please check your limits!";
alert_ebene(v_msg, v_msgEng);
return;
}
donnees = 'codeTypeBon='+codeTypeBon+'&codeEtatBon='+codeEtatBon+'&noDepart='+noDepart+'&noFin='+noFin;
$("#div_bonpecs").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxafficherbons/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_bonpecs").html(data);
},
complete: function()
{
codeLangue = $("#codeLangue").val();
if(codeLangue=="en_US")
{
$("#nbligne").val("Number of lines displayed : "+$("#nbligne_info").val());
}
else
{
$("#nbligne").val("Nombre de bons affich\u00e9s : "+$("#nbligne_info").val());
}
// $("#nbligne").val("Nombre de bons affich\u00e9s : "+$("#nbligne_info").val());
}
});
}
function demander_annulation_bon() {
var codeEtatBon = $("#codeEtatBon_C").val();
var motifAnnulation = $("#motifAnnulation_C").val();
var numeroBon = $("#numeroBon_C").val();
var idBon = $("#idBon_C").val();
if (numeroBon <= " ") {
alert_ebene("Veuillez sélectionner une ligne!", "Please select a line!");
return;
}
// Check bon status and show appropriate message
if (codeEtatBon == "3") {
alert_ebene("Annulé pour motif : " + motifAnnulation, "Canceled for reason : " + motifAnnulation);
return;
}
if (codeEtatBon == "4") {
alert_ebene("Remplacé pour motif : " + motifAnnulation, "Replaced for reason : " + motifAnnulation);
return;
}
if (codeEtatBon == "9") {
alert_ebene("Demande annulation pour motif : " + motifAnnulation,
"Cancellation request for reason : " + motifAnnulation);
return;
}
// Ask for confirmation
const confirmMsg = "Confirmez-vous la demande d'annulation du bon No " + numeroBon + "?";
const confirmMsgEng = "Do you confirm the request for cancellation of the prescription No " + numeroBon + "?";
confirm_ebene_sweet(confirmMsg, confirmMsgEng).then((confirmed) => {
if (!confirmed) return;
// Ask for cancellation reason
const reasonMsg = "Raison de l'annulation?";
const reasonMsgEng = "Reason for cancellation?";
motifAnnulation = prompt_ebene(reasonMsg, reasonMsgEng, motifAnnulation);
if (motifAnnulation <= " ") {
alert_ebene("Vous devez saisir un motif!", "You have to enter a reason!");
return;
}
$("#motifAnnulation_C").val(motifAnnulation);
const donnees = 'idBon=' + idBon + '&motifAnnulation=' + motifAnnulation;
const donnees_sav = 'idBon=' + idBon + '&typeMail=maildemandeannulationbon';
$.ajax({
url: $("#racineWeb").val() + "Ajaxafficherbons/demanderAnnulationBon/",
type: 'post',
data: donnees,
error: function(errorData) {
// Handle error if needed
},
success: function(data) {
// Handle success if needed
},
complete: function() {
mettremailattente(donnees_sav);
alert_ebene("Demande envoyée avec succès!", "Request sent successfully!");
afficherbon();
}
});
});
}
function enregistrer_commande_bon() {
// Validation des champs obligatoires
const codeTypeBon = $("#codeTypeBon").val();
if (!codeTypeBon || codeTypeBon.trim() === "") {
alert_ebene("Veuillez sélectionner un type de bon!", "Please select a form type!");
$("#codeTypeBon").focus();
return;
}
// Validation de la quantité
let quantite = $("#quantite").val();
if (!quantite || quantite.trim() === "") {
alert_ebene("Veuillez saisir la quantité!", "Please enter the quantity!");
$("#quantite").focus();
return;
}
quantite = parseInt(quantite);
if (isNaN(quantite) || quantite < 1) {
alert_ebene("La quantité doit être un nombre valide supérieur à 0!",
"Quantity must be a valid number greater than 0!");
$("#quantite").focus();
return;
}
// Confirmation de la commande
confirm_ebene_sweet(
"Confirmez-vous cette commande?",
"Do you confirm this order?"
).then((isConfirmed) => {
if (!isConfirmed) return;
// Préparation des données pour l'API
const prestataire = $("#prestataire_C").val();
const donnees = {
codeTypeBon: codeTypeBon,
quantite: quantite
};
const donnees_sav = {
...donnees,
prestataire: prestataire,
typeMail: 'mailcommandebon'
};
// Récupération du libellé du bon
const libelleBon = $("#codeTypeBon option:selected").text().trim();
const typeSms = "commandebon";
// Envoi de la commande
$.ajax({
url: $("#racineWeb").val() + "Ajaxcommanderbons/commanderBon/",
type: 'post',
data: donnees,
error: function(errorData) {
// Gestion des erreurs si nécessaire
},
success: function(data) {
preparesms(typeSms);
return data; // On retourne les données pour le complete
},
complete: function(data) {
mettremailattente($.param(donnees_sav));
alert_ebene("Commande envoyée avec succès!", "Order sent successfully!");
$("#div_page_entiere").html(data.responseText || data);
}
});
});
}
function receptionner_bon() {
// Validation initiale
let nbligne_info = parseInt($("#nbligne_info").val()) || 0;
if (nbligne_info === 0) {
alert_ebene("Veuillez actualiser la liste avant!", "Please refresh before!");
return;
}
// Récupération et validation des données
const codeTypeBon = $("#codeTypeBon").val();
let noDepart = parseInt($("#noDepart").val()) || 0;
let noFin = parseInt($("#noFin").val()) || 0;
if (!codeTypeBon || codeTypeBon.trim() === "") {
alert_ebene("Veuillez sélectionner un type de bon!", "Please select a form type!");
$("#codeTypeBon").focus();
return;
}
if (noFin < noDepart || noFin === 0) {
alert_ebene("Veuillez revoir vos bornes!", "Please check your limits!");
return;
}
// Confirmation
const confirmationMsg = `Confirmez-vous la réception de la plage de bons de ${noDepart} à ${noFin}?`;
const confirmationMsgEng = `Do you confirm receipt of the prescriptions range from ${noDepart} to ${noFin}?`;
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng).then((isConfirmed) => {
if (!isConfirmed) return;
// Préparation des données
const prestataire = $("#prestataire_C").val();
const donnees = {
codeTypeBon: codeTypeBon,
noDepart: noDepart,
noFin: noFin
};
const donnees_sav = {
...donnees,
prestataire: prestataire,
typeMail: 'mailreceptionbon'
};
// Envoi des données
$.ajax({
url: `${$("#racineWeb").val()}Ajaxafficherbons/receptionnerBon/`,
type: 'post',
data: donnees,
error: function(errorData) {
// Gestion d'erreur si nécessaire
},
complete: function() {
mettremailattente($.param(donnees_sav));
alert_ebene("Réception confirmée avec succès!", "Reception confirmed successfully!");
afficherbon();
}
});
});
}
function listergenerationbon()
{
codeTypeBon=$("#codeTypeBon").val();
d1=$("#d1").val();
d2=$("#d2").val();
if (codeTypeBon<=" ")
{
v_msg="Veuillez s\u00e9lectionner un type de bon!";
v_msgEng="Please select a form type!";
alert_ebene(v_msg, v_msgEng);
$("#codeTypeBon").focus();
return;
}
donnees = 'codeTypeBon='+codeTypeBon+'&d1='+d1+'&d2='+d2;
$("#div_bonpecs").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxalistegenererbons/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_bonpecs").html(data);
},
complete: function() {
$("#nbligne").val("Nombre de lignes affich\u00e9es : "+$("#nbligne_info").val());
}
});
}
function listerdemandebon()
{
codeTypeBon=$("#codeTypeBon").val();
d1=$("#d1").val();
d2=$("#d2").val();
if (codeTypeBon<=" ")
{
v_msg="Veuillez s\u00e9lectionner un type de bon!";
v_msgEng="Please select a form type!";
alert_ebene(v_msg, v_msgEng);
$("#codeTypeBon").focus();
return;
}
donnees = 'codeTypeBon='+codeTypeBon+'&d1='+d1+'&d2='+d2;
$("#div_bonpecs").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxalistedemandebon/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_bonpecs").html(data);
},
complete: function() {
}
});
}
function ajaxactespossibles()
{
codeGestionBon = $("#codeGestionBon").val();
codeFamilleActe=$("#codeFamilleActe").val();
codeTypePrestation=$("#codeTypePrestation").val();
donnees = 'codeFamilleActe='+codeFamilleActe+'&codeTypePrestation='+codeTypePrestation;
$.ajax({
url: $("#racineWeb").val()+"Ajaxactespossibles/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#listeacte").html(data);
$("#prixActe_info").val("0");
$("#montantTm_info").val("0");
$("#aRembourser_info").val("0");
$("#numeroBon").val("");
// $("#btn_enreg").disable();
// $("#codeEtatBon").val("");
$("#msgErreur").html("");
if (codeGestionBon=="0")
{
$("#btn_enreg").disable();
$("#codeEtatBon").val("");
}
}
});
}
function ajaxactespossibles_med()
{
codeFamilleActe=$("#codeFamilleActe").val();
codeTypePrestation=$("#codeTypePrestation").val();
donnees = 'codeFamilleActe='+codeFamilleActe+'&codeTypePrestation='+codeTypePrestation;
$.ajax({
url: $("#racineWeb").val()+"Ajaxactespossiblesmed/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#listeacte").html(data);
$("#prixActe_info").val("0");
$("#montantTm_info").val("0");
$("#aRembourser_info").val("0");
},
complete: function() {
}
});
}
function ajaxinfosacte()
{
if ($("#codeActe").val()<=" ")
{
$("#prixActe_info").val("0");
$("#montantTm_info").val("0");
$("#aRembourser_info").val("0");
$("#numeroBon").val("");
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").focus();
return;
}
$.ajax({
url: $("#racineWeb").val()+"Ajaxinfosacte/",
type : 'post',
data: "codePrestataire="+$("#codePrestataire").val()+"&codeActe="+$("#codeActe").val(),
error: function(errorData) {
},
success: function(data) {
$("#infosacte").html(data);
},
complete: function() {
$("#montantacte").val( $("#montantacte_info").val());
$("#tauxCouverture").val( $("#tauxCouverture_info").val());
// calculer_Tm();
}
});
}
function ajaxprixacte()
{
codeGestionBon = $("#codeGestionBon").val();
codeActe = $("#codeActe").val();
codeMedecin = $('#codeMedecin').val();
codeSpecialite = $('#codeMedecin').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;
}
datePrestation = $('#dateSurvenance').val();
sessionConsultationConservee = $("#sessionConsultationConservee").val();
codeActeConsultationGratuite = $("#codeActeConsultationGratuite").val();
if(sessionConsultationConservee=="0"){
faireDefileMessage("", "");
}
if (codeActe<=" ")
{
$("#prixActe_info").val("0");
$("#montantTm_info").val("0");
$("#aRembourser_info").val("0");
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").focus();
return;
}
if(codeActe==codeActeConsultationGratuite){
$('#bonPrincipal').removeAttr('disabled');
$('#bonPrincipal').attr('required', 'required');
var bonPrincipal = $("#bonPrincipal").val();
if(bonPrincipal > "0"){
$("#bonPrincipal").val(bonPrincipal);
}else{
$("#bonPrincipal").val("0");
}
$('#labelBonPrincipal').addClass("required");
$('#labelBonPrincipal').css({"font-weight": "bold"});
}else{
$('#bonPrincipal').attr('disabled', 'disabled');
$("#bonPrincipal").val("");
$('#bonPrincipal').removeAttr('required');
$('#labelBonPrincipal').removeClass("required");
$('#labelBonPrincipal').css({"font-weight": "normal"});
}
prixSaisi = $('#prixSaisi').val();
prixModifiable = $('#prixModifiable').val();
donnees = 'codeActe='+codeActe+'&datePrestation='+datePrestation;
donnees += '&prixSaisi='+prixSaisi;
donnees += '&prixModifiable='+prixModifiable;
// alert(donnees);
$("#infosacte").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxprixacte/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosacte").html(data);
// $('#div_test_gabarit').html($("#infosacte").html());
$("#numeroBon").val("");
$("#codeRaisonConsultation").focus();
$("#msgErreur").html("");
if (codeGestionBon=="0")
{
$("#btn_enreg").disable();
$("#codeEtatBon").val("");
}
},
complete: function() {
actualiseTauxCouverture();
}
});
}
function ajaxbondisponible()
{
codeMedecin = $("#codeMedecin").val();
if (codeMedecin<=" ")
{
v_msg="Veuillez s\u00e9lectionner un m\u00e9decin!";
v_msgEng="Please select a doctor!";
alert_ebene(v_msg, v_msgEng);
// $("#codeMedecin").focus();
$("#nomMedecin").focus();
$("#numeroBon").val("");
return;
}
codeActe = $("#codeActe").val();
if (codeActe<=" ")
{
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").focus();
$("#numeroBon").val("");
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();
$("#numeroBon").val("");
return;
}
numeroBon = $("#numeroBon").val();
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;
}
donnees = "numeroBon="+numeroBon;
$.ajax({
url: $("#racineWeb").val()+"Ajaxbondisponible/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosbon").html(data);
},
complete: function() {
}
});
}
function ajaxinfosbonconsultation()
{
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;
}
codeGestionBon = $("#codeGestionBon").val();
if (codeGestionBon!="0")
{
v_msg="Option non disponible!";
v_msgEng="Option not available!";
alert_ebene(v_msg, v_msgEng);
return;
}
codeMedecin = $("#codeMedecin").val();
if (codeMedecin<=" ")
{
v_msg="Veuillez s\u00e9lectionner un m\u00e9decin!";
v_msgEng="Please select a doctor!";
alert_ebene(v_msg, v_msgEng);
$("#numeroBon").val("");
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
// $("#codeMedecin").focus();
$("#nomMedecin").focus();
$("#btn_pop_medecin").click();
return;
}
codeActe = $("#codeActe").val();
if (codeActe<=" ")
{
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#numeroBon").val("");
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#codeActe").focus();
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);
$("#numeroBon").val("");
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#codeRaisonConsultation").focus();
return;
}
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);
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
return;
}
donnees = "numeroBon="+numeroBon;
$.ajax({
url: $("#racineWeb").val()+"Ajaxinfosbonconsultation/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosbon").html(data);
},
complete: function() {
}
});
}
////// pour le mode saisi facture
function receptionner_bon() {
// Validation initiale
let nbligne_info = parseInt($("#nbligne_info").val()) || 0;
if (nbligne_info === 0) {
alert_ebene("Veuillez actualiser la liste avant!", "Please refresh before!");
return;
}
// Récupération et validation des données
const codeTypeBon = $("#codeTypeBon").val();
let noDepart = parseInt($("#noDepart").val()) || 0;
let noFin = parseInt($("#noFin").val()) || 0;
if (!codeTypeBon || codeTypeBon.trim() === "") {
alert_ebene("Veuillez sélectionner un type de bon!", "Please select a form type!");
$("#codeTypeBon").focus();
return;
}
if (noFin < noDepart || noFin === 0) {
alert_ebene("Veuillez revoir vos bornes!", "Please check your limits!");
return;
}
// Confirmation
const confirmationMsg = `Confirmez-vous la réception de la plage de bons de ${noDepart} à ${noFin}?`;
const confirmationMsgEng = `Do you confirm receipt of the prescriptions range from ${noDepart} to ${noFin}?`;
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng).then((isConfirmed) => {
if (!isConfirmed) return;
// Préparation des données
const prestataire = $("#prestataire_C").val();
const donnees = {
codeTypeBon: codeTypeBon,
noDepart: noDepart,
noFin: noFin
};
const donnees_sav = {
...donnees,
prestataire: prestataire,
typeMail: 'mailreceptionbon'
};
// Envoi des données
$.ajax({
url: `${$("#racineWeb").val()}Ajaxafficherbons/receptionnerBon/`,
type: 'post',
data: donnees,
error: function(errorData) {
// Gestion d'erreur si nécessaire
},
complete: function() {
mettremailattente($.param(donnees_sav));
alert_ebene("Réception confirmée avec succès!", "Reception confirmed successfully!");
afficherbon();
}
});
});
}
////////
function enregistrerconsultationold() {
// Validation initiale
const badcodeGestionBon = $("#badcodeGestionBon").val();
if (badcodeGestionBon === "1") {
alert_ebene("Veuillez revoir le type de gestion de bons!", "Please review the type of forms management!");
return;
}
// Gestion des délais de carence
const appliquerDelaiCarence = $("#appliquerDelaiCarence").val();
const anciennete = parseInt($("#anciennete").val()) || 0;
const delaiCarenceBeneficiaire = parseInt($("#delaiCarenceBeneficiaire").val()) || 0;
const delaiCarenceRaisonconsultation = parseInt($("#delaiCarenceRaisonconsultation").val()) || 0;
if (delaiCarenceBeneficiaire > 0 && appliquerDelaiCarence === "1") {
if (anciennete < delaiCarenceBeneficiaire) {
alert_ebene("Attention! Période de carence!", "Warning! waiting period!");
return;
}
const delaiCarenceActe = parseInt($("#delaiCarenceActe").val()) || 0;
if (anciennete < delaiCarenceActe) {
alert_ebene("Attention! Période de carence => Acte!", "Warning! waiting period => Act!");
return;
}
if (anciennete < delaiCarenceRaisonconsultation) {
alert_ebene("Attention! Période de carence => Raison de consultation!",
"Warning! waiting period => Reason Consultation!");
return;
}
}
// Validation des champs obligatoires
const codeMedecin = $("#codeMedecin").val();
// const medecinManquant = $("#medecinManquant").val();
const medecinManquant = "";
const codeFamilleActe = $("#codeFamilleActe").val();
const codeActe = $("#codeActe").val();
const codeRaisonConsultation = $("#codeRaisonConsultation").val();
const codeGestionBon = $("#codeGestionBon").val();
if (!codeMedecin || codeMedecin.trim() === "") {
alert_ebene("Veuillez sélectionner un médecin!", "Please select a doctor!");
$("#codeMedecin").focus();
return;
}
if (codeMedecin === "ZZZZ" && (!medecinManquant || medecinManquant.trim() === "")) {
alert_ebene("Veuillez saisir le nom du médecin non enregistré!",
"Please enter the name of the non-registered doctor!");
// $("#medecinManquant").focus();
return;
}
if (!codeFamilleActe || codeFamilleActe.trim() === "") {
alert_ebene("Veuillez sélectionner un acte!", "Please select an act!");
$("#codeFamilleActe").focus();
return;
}
if (!codeActe || codeActe.trim() === "") {
alert_ebene("Veuillez sélectionner un acte!", "Please select an act!");
$("#codeActe").focus();
return;
}
if (!codeRaisonConsultation || codeRaisonConsultation.trim() === "") {
alert_ebene("Veuillez sélectionner une raison pour la consultation!",
"Please select a reason for the consultation!");
$("#codeRaisonConsultation").focus();
return;
}
// Gestion spécifique des bons
let numeroBon;
let confirmationMsg, confirmationMsgEng;
if (codeGestionBon === "0") {
numeroBon = $("#numeroBon").val();
const numeroBonSave = $("#numeroBonSave").val();
const codeEtatBon = $("#codeEtatBon").val();
if (isNaN(numeroBon)) {
alert_ebene("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
$("#btn_enreg").prop("disabled", true);
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
return;
}
if (!numeroBon || numeroBon <= "0") {
alert_ebene("Veuillez saisir un No de bon!", "Please enter a prescription number!");
$("#numeroBon").focus();
return;
}
if (codeEtatBon !== "1") {
alert_ebene("Veuillez saisir un No de bon disponible!", "Please enter a prescription number available!");
$("#numeroBon").focus();
return;
}
if (numeroBonSave !== numeroBon) {
alert_ebene("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
$("#btn_enreg").prop("disabled", true);
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
return;
}
confirmationMsg = "Confirmez-vous ce No de bon?";
confirmationMsgEng = "Do you confirm this number of prescription?";
} else {
numeroBon = "-1";
confirmationMsg = "Confirmez-vous ce dossier?";
confirmationMsgEng = "Do you confirm this claim?";
}
// Confirmation et envoi des données
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng).then((isConfirmed) => {
if (!isConfirmed) return;
// Préparation des données
const donnees = {
codeActe: codeActe,
numeroBon: numeroBon,
codeMedecin: codeMedecin,
codeRaisonConsultation: codeRaisonConsultation,
dateSurvenance: $("#dateSurvenance").val(),
observations: $("#observations").val(),
prixActe: $("#prixActe").val(),
montantTm: $("#montantTm").val(),
aRembourser: $("#aRembourser").val(),
numeroDerogation: $("#derogation_en_cours_C").val() || "0",
numeroDerogationFinger: $("#derogation_finger_en_cours_C").val() || "0",
medecinManquant: medecinManquant,
dateReferencement: $("#dateReferencement").val() || "",
codeReferencement: $("#codeReferencement").val() || "",
codeGestionBon: codeGestionBon
};
$("#btn_enreg").prop("disabled", true);
$.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistrerconsultation/enregistrerconsultation/`,
type: 'post',
data: donnees,
error: function(errorData) {
// Gestion d'erreur si nécessaire
},
success: function(data) {
maj_fraiseexclu_cso();
if (codeRaisonConsultation === "ACIR") {
preparesms("accident");
alert_ebene("alerte envoyée pour accident!", "alert sent for accident!");
}
},
complete: function() {
alert_ebene("Consultation enregistrée avec succès", "Saved successfully!");
feuillemaladie();
}
});
});
}
function enregistrerconsultation()
{
codeLangue = $("#codeLangue").val();
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())
{
//avecReferencement = $("#avecReferencement").val();
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;
}
}
modeSaisieFacture=$("#modeSaisieFacture").val();
if(modeSaisieFacture=="1")
{
$("#btn_popdate_reelle").click();
return;
}else{
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<delaiCarenceActe)
{
v_msg="Attention! P\u00e9riode de carence => Acte!";
v_msgEng="Warning! waiting period => Act!";
alert_ebene(v_msg, v_msgEng);
return;
}
if (anciennete<delaiCarenceRaisonconsultation)
{
v_msg="Attention! P\u00e9riode de carence => Raison de consultation!";
v_msgEng="Warning! waiting period => Reason Consultation!";
alert_ebene(v_msg, v_msgEng);
return;
}
}
codeGestionBon = $("#codeGestionBon").val();
nbBonsCons = $("#nbBonsCons").val();
numeroBonSave = $("#numeroBonSave").val();
codeMedecin = $("#codeMedecin").val();
// medecinManquant = $("#medecinManquant").val();
medecinManquant = "";
if (codeMedecin<=" ")
{
v_msg="Veuillez s\u00e9lectionner un m\u00e9decin!";
v_msgEng="Please select a doctor!";
alert_ebene(v_msg, v_msgEng);
$("#codeMedecin").focus();
return;
}
if (codeMedecin=="ZZZZ" && medecinManquant<=" ")
{
v_msg="Veuillez saisir le nom du m\u00e9decin non enregistr\u00e9!";
v_msgEng="Please enter the name of the non-registered doctor!";
alert_ebene(v_msg, v_msgEng);
// $("#medecinManquant").focus();
return;
}
codeActe=$("#codeActe").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;
}
codeTypeConsultation = $("#codeTypeConsultation").val();
dureeDerniereConsultation = parseInt($("#dureeDerniereConsultation").val());
dureeVieBon = parseInt($("#dureeVieBon").val());
dernierActe = $("#dernierActe").val();
dernierMedecinConsulte = $("#dernierMedecinConsulte").val();
codePrestataire = $("#codePrestataire").val();
dernierCentre = $("#dernierCentre").val();
dateDernierActe = $("#dateDernierActe").val();
dateJour = $("#dateJour").val();
codeSpecialite = $("#codeSpecialite").val();
specialiteEstPossible = $("#specialiteEstPossible").val();
finControleConsultation = addDays(dateDernierActe, dureeVieBon);
const maDate = new Date();
maDate.toLocaleDateString("fr");
var dateFinControleConsultation = new Date(formatDateInput(finControleConsultation));
var dateJourConsultation = new Date(formatDateInput(maDate.toLocaleDateString("fr")));
dateDerniereConsultaionGeneraliste = $("#dateDerniereConsultaionGeneraliste").val();
dateDerniereConsultaionSpecialiste = $("#dateDerniereConsultaionSpecialiste").val();
nbreConsultaionSpecialisteJour = $("#nbreConsultaionSpecialisteJour").val();
paramConsultationSpecialisteJour = $("#paramConsultationSpecialisteJour").val();
var codeTypePrestataire = $("#codeTypePrestataire").val();
var dateSurvenance = $("#dateSurvenance").val();
prixActe = $("#prixActe").val();
prixBase = $("#prixBase").val();
montantTm = $("#montantTm").val();
aRembourser = $("#aRembourser").val();
prixActeTarifPolicePrestataire = $("#prixActeTarifPolicePrestataire").val();
age = parseInt($("#age").val());
agemaxipediatrie = parseInt($("#agemaxipediatrie").val());
parametreNombreFeuilleGratuitJour = parseInt($("#parametreNombreFeuilleGratuitJour").val());
nombreFeuilleGratuite = parseInt($("#nombreFeuilleGratuite").val());
bonPrincipal = $("#bonPrincipal").val();
if(bonPrincipal==undefined){
bonPrincipal = "0";
}
if (codeActe<=" ")
{
v_msg="Veuillez s\u00e9lectionner un acte!";
v_msgEng="Please select an act!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").focus();
return;
}else if(codeActe != codeActeConsultationGratuite && codeTypeConsultation != 'CO'){
if((prixActe == "0" && codeTypePrestataire!='CME' && prixActeTarifPolicePrestataire != "0")){
v_msg="Un prix est exigé pour cette consultation! Veuillez en informer "+nomSociete+" pour vous l'ajouter!";
v_msgEng="A price is required for this consultation! Please inform "+nomSociete+" to add it to you!";
alert_ebene(v_msg, v_msgEng);
faireDefileMessage(v_msg, v_msgEng);
return;
}else if((codeActe == dernierActe) && (dureeDerniereConsultation > "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) {
ententePrealable = $("#ententePrealable").val();
if (ententePrealable==1){
ententePrealable = "2";
}
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";
}
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;
}
});
}
else{
$('#div_consultation').hide();
}
}
function listerdossier()
{
d1=$("#d1").val();
d2=$("#d2").val();
donnees = 'd1='+d1+'&d2='+d2;
$("#div_dossiers").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxdossiers/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_dossiers").html(data);
},
complete: function() {
}
});
}
function selectionner_feuille_maladie(no)
{
$("#numeroFeuilleMaladie_C" ).val(no);
}
function afficher_feuille_maladie()
{
numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C" ).val();
if (numeroFeuilleMaladie>"")
{
ajax_context_feuille_maladie_afficher(numeroFeuilleMaladie);
}
}
function ajax_context_feuille_maladie_afficher(numeroFeuilleMaladie)
{
donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextfeuillemaladie/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
feuillemaladie();
}
});
}
function enregistrerprescription() {
// Validation initiale
const badcodeGestionBon = $("#badcodeGestionBon").val();
if (badcodeGestionBon === "1") {
alert_ebene("Veuillez revoir le type de gestion de bons!", "Please review the type of forms management!");
return;
}
// Récupération des données
const codeGestionBon = $("#codeGestionBon").val();
const codeMedecin = $("#codeMedecin").val();
// Validation du médecin
if (!codeMedecin || codeMedecin.trim() === "") {
alert_ebene("Veuillez sélectionner un médecin!", "Please select a doctor!");
$("#nomMedecin").focus();
return;
}
// Gestion spécifique des bons
let numeroBon;
let confirmationMsg, confirmationMsgEng;
if (codeGestionBon === "0") {
numeroBon = $("#numeroBon").val();
const numeroBonSave = $("#numeroBonSave").val();
const codeEtatBon = $("#codeEtatBon").val();
if (isNaN(numeroBon)) {
alert_ebene("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
$("#btn_enreg").prop("disabled", true);
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
return;
}
if (!numeroBon || numeroBon <= "0") {
alert_ebene("Veuillez saisir un No de bon!", "Please enter a prescription number!");
$("#numeroBon").focus();
return;
}
if (codeEtatBon !== "1") {
alert_ebene("Veuillez saisir un No de bon disponible!", "Please enter a prescription number available!");
$("#numeroBon").focus();
return;
}
if (numeroBonSave !== numeroBon) {
alert_ebene("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
$("#btn_enreg").prop("disabled", true);
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
return;
}
confirmationMsg = "Confirmez-vous ce No de bon?";
confirmationMsgEng = "Do you confirm this number of prescription?";
} else {
numeroBon = "-1";
confirmationMsg = "Confirmez-vous cette prescription?";
confirmationMsgEng = "Do you confirm this prescription?";
}
// Confirmation et envoi des données
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng).then((isConfirmed) => {
if (!isConfirmed) return;
// Préparation des données
const donnees = {
numeroBon: numeroBon,
codeMedecin: codeMedecin,
codeGestionBon: codeGestionBon
};
$("#btn_enreg").prop("disabled", true);
// Envoi de la requête AJAX
$.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistrerprescription/enregistrerprescription/`,
type: 'post',
data: donnees,
error: function(errorData) {
// Gestion d'erreur si nécessaire
},
complete: function() {
alert_ebene("Prescription enregistrée avec succès", "Saved successfully!");
prescription_medicament();
}
});
});
}
function envoieprescription()
{
donnees = '';
$.ajax({
url: $("#racineWeb").val()+"Ajaxenregistrerprescription/envoieprescription/",
type : 'post',
data: donnees,
error: function(errorData)
{
},
success: function(data)
{
// $('#div_test_gabarit').html(data);
},
complete: function() {
}
});
}
function ajaxinfosbonprescription()
{
bonCaduc=$("#bonCaduc").val();
if (bonCaduc==1)
{
v_msg="Bon caduc!";
v_msgEng="Obsolete!";
alert_ebene(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;
}
codeGestionBon = $("#codeGestionBon").val();
if (codeGestionBon!="0")
{
v_msg="Option non disponible!";
v_msgEng="Option not available!";
alert_ebene(v_msg, v_msgEng);
return;
}
numeroBonOrdonnance = $("#numeroBonOrdonnance").val();
numeroBonOrdonnance = parseInt(numeroBonOrdonnance);
if (numeroBonOrdonnance>0)
{
v_msg="D\u00e9jà effectu\u00e9!";
v_msgEng="Already done!";
alert_ebene(v_msg, v_msgEng);
return;
}
facture=$("#facture").val();
if (facture==1)
{
v_msg="D\u00e9jà factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
codeMedecin = $("#codeMedecin").val();
if (codeMedecin<=" ")
{
v_msg="Veuillez s\u00e9lectionner un m\u00e9decin!";
v_msgEng="Please select a doctor!";
alert_ebene(v_msg, v_msgEng);
$("#numeroBon").val("");
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
// $("#codeMedecin").focus();
$("#nomMedecin").focus();
return;
}
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);
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
return;
}
donnees = "numeroBon="+numeroBon;
$.ajax({
url: $("#racineWeb").val()+"Ajaxinfosbonprescription/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosbon").html(data);
},
complete: function() {
}
});
}
function afficher_pop_recherche_medicament()
{
nomsearch = $("#nomsearch").val();
if (nomsearch > " ")
{
donnees = "valid=1&nomsearch="+nomsearch;
$("#div_listemedicament").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlistemedicaments/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_listemedicament").html(data);
}
});
}
}
function ctrlkeypress(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
afficher_pop_recherche_medicament();
}
}
function selectionner_medicament_pop(codeMedicament, libelleMedicament)
{
$("#codeMedicament_pop").val(codeMedicament);
$("#libelleMedicament_pop").val(libelleMedicament);
}
function ajouter_medicament() {
// Récupération et validation des données
const codeMedicament = $("#codeMedicament_pop").val();
const libelleMedicament = $("#libelleMedicament_pop").val();
if (!codeMedicament || codeMedicament.trim() === "") {
alert_ebene("Veuillez sélectionner un médicament!", "Please select a medicine/drug!");
return;
}
// Confirmation
const confirmationMsg = `Prescrire : ${libelleMedicament}?`;
const confirmationMsgEng = `Prescribe : ${libelleMedicament}?`;
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng).then((isConfirmed) => {
if (!isConfirmed) return;
// Envoi de la requête AJAX
$.ajax({
url: `${$("#racineWeb").val()}Ajaxdetailprescription/ajoutermedicament/`,
type: 'post',
data: { codeMedicament: codeMedicament },
error: function(errorData) {
// Gestion d'erreur si nécessaire
},
success: function(data) {
prescription_medicament();
}
});
});
}
function ajax_maj_qte_medicament(idMedicament, 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 = 'idMedicament='+idMedicament+"&quantite="+quantite;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailprescription/majquantite/",
type: 'POST',
data: donnees,
success: function(data) {
$("#medicaments").html(data);
},
error: function(data) {
},
complete: function() {
//controle.focus();
}
});
}
}
function ajax_maj_posologie_medicament(idMedicament, posologie, controle)
{
donnees = 'idMedicament='+idMedicament+"&posologie="+posologie;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailprescription/majposologie/",
type: 'POST',
data: donnees,
success: function(data) {
$("#medicaments").html(data);
},
error: function(data) {
},
complete: function() {
//controle.focus();
}
});
}
function supprimer_medicament(idMedicament) {
// Messages de confirmation
const confirmationMsg = "Confirmez-vous la suppression de ce médicament?";
const confirmationMsgEng = "Do you confirm the removal of this medicine/drug?";
// Afficher l'indicateur de chargement
const loadingHtml = `
<div style="padding-top80px; text-align:center; font-size:14px;">
<span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span>
</div>
`;
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng).then((isConfirmed) => {
if (!isConfirmed) return;
// Afficher le loader
$("#medicaments").html(loadingHtml);
// Envoyer la requête AJAX
$.ajax({
url: `${$("#racineWeb").val()}Ajaxdetailprescription/supprimer/`,
type: 'POST',
data: { idMedicament: idMedicament },
success: function() {
prescription_medicament(); // Rafraîchir la liste des médicaments
},
error: function() {
// Gestion d'erreur si nécessaire
}
});
});
}
function ajoutermedicament(idMedicament)
{
donnees = 'idMedicament='+idMedicament;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacie/ajoutermedicament/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
//afficheDivPlafond();
getstatutacte("PH");
},
error: function(data) {
},
complete: function() {
nbreLigne = parseInt($("#nbreLigne").val());
if(nbreLigne>0){
for(let i = 1; i <= nbreLigne; i++){
$("#div_selection"+i).hide();
}
}
}
});
}
function ajoutermedicament_pha(idMedicament)
{
donnees = 'idMedicament='+idMedicament;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/ajoutermedicament/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
// raffraichier_detail_prescription();
//$(this).get(0).focus();
getstatutacte("PH");
},
error: function(data) {
},
complete: function() {
//alerter_depassement_limite();
}
});
}
function actualiseordonnancepha(){
donnees = '';
$.ajax({
url: $("#racineWeb").val()+"Ajaxactualiseordonnancepha/",
type: 'POST',
data: donnees,
success: function(data) {
$("#ordonnance").html(data);
},
error: function(data) {
},
complete: function() {
}
});
}
function ajoutermedicament_tous()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacie/ajoutermedicamenttous/",
type: 'POST',
success: function(data) {
$("#livraison").html(data);
//afficheDivPlafond();
getstatutacte("PH");
},
error: function(data) {
},
complete: function() {
//alerter_depassement_limite_cso();
}
});
}
function ajoutermedicament_pha_tous()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/ajoutermedicamenttous/",
type: 'POST',
success: function(data) {
$("#livraison").html(data);
// raffraichier_detail_prescription();
$("#valeurActeManuel1").focus();
getstatutacte("PH");
},
error: function(data) {
},
complete: function() {
//alerter_depassement_limite();
}
});
}
function formatMonetaire(controle){
controle.value = formatCurrency(controle.value);
return;
}
function controle_numerique(controle)
{
controle.value=controle.value.replace(/ /g,"");
controle.value=parseInt(controle.value.replace(",","."),10);
if(isNaN(controle.value))
{
v_msg="Valeur num\u00e9rique exig\u00e9e!";
v_msgEng="Numeric value required!";
alert_ebene(v_msg, v_msgEng);
controle.value="0";
controle.focus();
return false;
}
return true;
}
function ajax_maj_prix_medicament_pha(idMedicament, tarifPublic, prix, controle)
{
var appliquerMargePrixMedicament = $('#appliquerMargePrixMedicament').val();
var margePrixMedicament = $('#margePrixMedicament').val();
var typeMargePrixMedicament = $('#typeMargePrixMedicament').val();
var devise = $("#devise").val();
prix=prix.replace(",",".");
prix=prix.replace(/ /g,"");
controle.value=prix;
/*if(prix==0)
{
controle.focus();
v_msg="Veuillez saisir le prix!";
v_msgEng="Please enter the price!";
alert_ebene(v_msg, v_msgEng);
return;
}*/
if(typeMargePrixMedicament=="Taux")
{
pourcentage = parseInt(tarifPublic) * parseInt(margePrixMedicament);
prixMarge = parseInt(pourcentage) / 100;
prixMarjore =parseInt(tarifPublic) + parseInt(prixMarge);
}else{
prixMarjore =parseInt(tarifPublic) + parseInt(margePrixMedicament);
}
margePrixMedicament = parseInt(margePrixMedicament);
if(controle_numerique(controle))
{
if(appliquerMargePrixMedicament == "1")
{
if(prix > prixMarjore){
controle.value = tarifPublic;
controle.focus();
v_msg="D\u00e9sol\u00e9! Le prix saisi est sup\u00e9rieur \u00e0 la valeur de la marge de "+formatCurrency(prixMarge)+" "+devise+" appliquable au le prix syst\u00e8me de ce m\u00e9dicament.";
v_msgEng="Sorry! but the price entered is higher than the value of the margin "+formatCurrency(prixMarge)+" "+devise+" applicable to the system price of this medicine.";
alert_ebene(v_msg, v_msgEng);
return;
}
donnees = 'idMedicament='+idMedicament+"&prix="+prix;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/majprixpha/",
type: 'POST',
data: donnees,
success: function(data) {
// $("#medicaments").html(data);
$("#livraison").html(data);
getstatutacte("PH");
},
error: function(data) {
},
complete: function() {
alerter_depassement_limite();
controle.focus();
}
});
}else{
donnees = 'idMedicament='+idMedicament+"&prix="+prix;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/majprixpha/",
type: 'POST',
data: donnees,
success: function(data) {
// $("#medicaments").html(data);
$("#livraison").html(data);
getstatutacte("PH");
},
error: function(data) {
},
complete: function() {
//alerter_depassement_limite();
controle.focus();
}
});
}
}
}
function ajax_maj_prix_medicament_cso(idMedicament, tarifPublic, prix, controle)
{
var appliquerMargePrixMedicament = $('#appliquerMargePrixMedicament').val();
var margePrixMedicament = $('#margePrixMedicament').val();
var devise = $("#devise").val();
codeLangue = $("#codeLangue").val();
prix=prix.replace(",",".");
prix=prix.replace(/ /g,"");
controle.value=prix;
prixMarge = parseInt(tarifPublic) + parseInt(margePrixMedicament);
margePrixMedicament = parseInt(margePrixMedicament);
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;
}
if(appliquerMargePrixMedicament == "1"){
if(prix > prixMarge){
v_msg="Confirmez vous le d\u00e9passement de la marge de "+formatCurrency(margePrixMedicament)+" "+devise+" que vous avez appliqu\u00e9e au tarif public du m\u00e9dicament?";
v_msgEng="Do you confirm that the margin of "+formatCurrency(margePrixMedicament)+" "+devise+" that you have applied to the public drug price has been exceeded?";
if(codeLangue=="en_US")
{
swal({
title: v_msgEng,
text: "",
icon: 'warning',
buttons: true,
dangerMode: true,
buttons: {
cancel: "No",
confirm: "Yes",
}
}).then(function(isConfirm) {
if (isConfirm)
{
donnees = 'idMedicament='+idMedicament+"&prix="+prix;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacie/majprixcso/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
getstatutacte("PH");
},
error: function(data) {
},
complete: function() {
getstatutacte("PH");
controle.focus();
}
});
}
else
{
controle.value = 0;
controle.focus();
return;
}
});
}
else
{
swal({
title: v_msg,
text: "",
icon: 'warning',
buttons: true,
dangerMode: true,
buttons: {
cancel: "Non",
confirm: "Oui",
}
}).then(function(isConfirm) {
if (isConfirm)
{
donnees = 'idMedicament='+idMedicament+"&prix="+prix;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacie/majprixcso/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
getstatutacte("PH");
},
error: function(data) {
},
complete: function() {
//alerter_depassement_limite();
getstatutacte("PH");
controle.focus();
}
});
}
else
{
controle.value = 0;
controle.focus();
return;
}
});
}
} else{
donnees = 'idMedicament='+idMedicament+"&prix="+prix;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacie/majprixcso/",
type: 'POST',
data: donnees,
success: function(data) {
// $("#medicaments").html(data);
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
getstatutacte("PH");
controle.focus();
}
});
}
}else{
donnees = 'idMedicament='+idMedicament+"&prix="+prix;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacie/majprixcso/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
getstatutacte("PH");
controle.focus();
}
});
}
}
}
function maj_prixmanuel_pha(idLivre, nbreLivre, valeurActeManuel, controle)
{
valeurActeManuel=valeurActeManuel.replace(/ /g,"");
valeurActeManuel=parseInt(valeurActeManuel.replace(",","."),10);
controle.value=valeurActeManuel;
tm = parseInt($('#tm').val());
if(controle_numerique(controle))
{
if(valeurActeManuel==0)
{
controle.focus();
v_msg="Veuillez saisir le prix!";
v_msgEng="Please enter the price!";
alert_ebene(v_msg, v_msgEng);
return;
}
$('#prixManuel'+nbreLivre).val(valeurActeManuel*parseInt($('#quantite'+nbreLivre).val()));
prixManuel = parseInt($('#prixManuel'+nbreLivre).val());
$('#montantTm'+nbreLivre).val(parseInt(prixManuel*tm/100));
montantTm = parseInt($('#montantTm'+nbreLivre).val());
$('#montantArembourser'+nbreLivre).val(prixManuel-montantTm);
montantArembourser = parseInt($('#montantArembourser'+nbreLivre).val());
donnees = 'idLivre='+idLivre+"&valeurActeManuel="+valeurActeManuel+"&prixManuel="+prixManuel;
donnees += '&montantTm='+montantTm+"&montantArembourser="+montantArembourser;
//alert(donnees);
//return;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/majprixmanuelpha/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
// raffraichier_detail_prescription();
},
error: function(data) {
},
complete: function() {
alerter_depassement_limite();
controle.focus();
}
});
}
}
function tableaulivre_pha()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/tableaulivre/",
type: 'POST',
data: donnees,
success: function(data) {
$("#div_tableau_pha").html(data);
},
error: function(data) {
},
complete: function() {
}
});
}
function retirermedicament(idMedicament)
{
donnees = 'idMedicament='+idMedicament;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacie/retirermedicament/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
}
});
}
function retirermedicament_pha(idMedicament)
{
donnees = 'idMedicament='+idMedicament;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/retirermedicament/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
//raffraichier_detail_prescription();
},
error: function(data) {
},
complete: function() {
alerter_depassement_limite();
}
});
}
function retirermedicament_tous()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacie/retirermedicamenttous/",
type: 'POST',
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
}
});
}
function retirermedicament_pha_tous()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/retirermedicamenttous/",
type: 'POST',
success: function(data) {
$("#livraison").html(data);
//raffraichier_detail_prescription();
},
error: function(data) {
},
complete: function() {
alerter_depassement_limite();
// actualiser_pharmacien();
}
});
}
function valider_pharmacie_cso() {
// Vérification si déjà facturé
const facture = $("#facture").val();
if (facture == 1) {
alert_ebene("Déjà facturé!", "Already charged!");
return;
}
// Validation des quantités
const quantiteTotalLivree = parseInt($("#quantiteTotalLivree").val()) || 0;
if (quantiteTotalLivree <= 0) {
alert_ebene("Aucune quantité à livrer!", "No quantity to deliver!");
return;
}
// Préparation du message de confirmation
const nbLivre = parseInt($("#nbLivre").val()) || 0;
let confirmationMsg, confirmationMsgEng;
if (nbLivre < 1) {
confirmationMsg = "Rien à enregistrer! Confirmez-vous cette situation?";
confirmationMsgEng = "Nothing to save! Do you confirm this situation?";
} else {
confirmationMsg = "Confirmez-vous cette livraison?";
confirmationMsgEng = "Do you confirm this delivery?";
}
// Confirmation et traitement
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng).then((isConfirmed) => {
if (!isConfirmed) return;
$.ajax({
url: `${$("#racineWeb").val()}Ajaxdetailpharmacie/enregistrerpharmacie/`,
type: 'POST',
success: function() {
maj_fraisexclu_cso();
},
complete: function() {
feuillemaladie();
}
});
});
}
function chercher_ordonnance(numeroBonOrdonnance)
{
donnees = 'numeroBonOrdonnance='+numeroBonOrdonnance;
$.ajax({
url: $("#racineWeb").val()+"Ajaxchangerordonnance/",
type: 'POST',
data: donnees,
success: function(data) {
},
error: function(data) {
},
complete: function() {
window.location.assign($("#racineWeb" ).val()+"Pharmacien/");
}
});
}
function chercher_ordonnance_opt(numeroBonOptique)
{
$("#msgErreur").empty();
if(numeroBonOptique<="0")
{
// actualiser_opticien();
reinitialiser_opticien();
return;
}
donnees = 'numeroBonOptique='+numeroBonOptique;
$.ajax({
url: $("#racineWeb").val()+"Ajaxchangerordonnanceopt/",
type: 'POST',
data: donnees,
success: function(data) {
$("#ordonnance").html(data);
numeroBon = $("#numeroBon").val();
if(numeroBon=="-1"){
return;
}else{
opticien();
}
//window.location.assign($("#racineWeb" ).val()+"Opticien/");
},
error: function(data) {
},
complete: function() {
}
});
}
function chercher_ordonnance_lab(numeroBonExamen)
{
donnees = 'numeroBonExamen='+numeroBonExamen;
$.ajax({
url: $("#racineWeb").val()+"Ajaxchangerordonnancelab/",
type: 'POST',
data: donnees,
success: function(data) {
window.location.assign($("#racineWeb" ).val()+"Laboratoire/");
},
error: function(data) {
},
complete: function() {
}
});
}
function ctrlkeypressord(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
numeroBonOrdonnance=$("#numeroBonOrdonnance").val();
$("#numeroBonOrdonnance").blur();
}
}
function rechercherbonordonnance()
{
numeroBonOrdonnance=$("#numeroBonOrdonnance").val();
if (numeroBonOrdonnance>" ")
{
chercher_ordonnance(numeroBonOrdonnance);
}
}
function ctrlkeypressordopt(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
numeroBonOptique=$("#numeroBonOptique").val();
$("#numeroBonOptique").blur();
}
}
function ctrlkeypressordlab(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
numeroBonExamen=$("#numeroBonExamen").val();
$("#numeroBonExamen").blur();
}
}
function rechercherbonoptique()
{
numeroBonOptique=$("#numeroBonOptique").val();
if (numeroBonOptique>" ")
{
chercher_ordonnance_opt(numeroBonOptique);
}
}
function valider_presciption() {
// Validations initiales
if ($("#bonCaduc").val() == 1) {
alert_ebene("Bon caduc!", "Obsolete!");
return;
}
if ($("#actVisible").val() != "1") {
alert_ebene("Non autorisée!", "Not allowed!");
return;
}
if ($("#badcodeGestionBon").val() == "1") {
alert_ebene("Veuillez revoir le type de gestion de bons!", "Please review the type of forms management!");
return;
}
if ($("#facture").val() == 1) {
alert_ebene("Déjà facturé!", "Already charged!");
return;
}
const numeroBonOrdonnance = parseInt($("#numeroBonOrdonnance").val()) || 0;
if (numeroBonOrdonnance <= 0) {
alert_ebene("Pas de prescription!", "No prescription!");
return;
}
// Données supplémentaires
const modeSaisieFacture = $("#modeSaisieFacture").val();
const existeEntentePrealable = $("#existeEntentePrealable").val();
// Confirmation
confirm_ebene_sweet(
"Confirmez-vous cette prescription?",
"Do you confirm this prescription?"
).then((isConfirmed) => {
if (!isConfirmed) return;
// Envoi AJAX
$.ajax({
url: `${$("#racineWeb").val()}Ajaxdetailprescription/`,
type: 'post',
success: () => {
if (modeSaisieFacture == "0") {
envoieprescription();
}
if (existeEntentePrealable > "0") {
alert_ebene(
"Demande accord préalable envoyée!",
"Request prior agreement sent!"
);
}
feuillemaladie();
},
error: (errorData) => {
console.error("Erreur lors de la validation:", errorData);
}
});
});
}
function ajaxchanger_type_bon()
{
$("#msgErreur").html("");
}
function ajaxprixactemed()
{
$("#prixActe_info").val("0");
$("#montantTm_info").val("0");
$("#aRembourser_info").val("0");
codeActe = $("#codeActe").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;
}
div_quantite = $("#quantite");
quantite = div_quantite.val();
if(quantite=="")
{
quantite = "0";
}
div_quantite.val(quantite);
quantite = parseInt(quantite);
if(quantite==0)
{
div_quantite.focus();
v_msg="Veuillez saisir la quantit\u00e9!";
v_msgEng="Please enter quantity!";
alert_ebene(v_msg, v_msgEng);
$("#quantite").focus();
return;
}
donnees = 'codeActe='+codeActe+'&quantite='+quantite;
$.ajax({
url: $("#racineWeb").val()+"Ajaxprixactemed/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosacte").html(data);
},
complete: function() {
}
});
}
function enregistreractemedical() {
// Validations initiales
const acteExclu = $("#acteExclu").val();
let autorisation = "0";
if (acteExclu == 1) {
autorisation = "2";
alert_ebene("Acte non couvert!", "Not covered!");
$("#codeActe").focus();
return;
}
// Validation des champs obligatoires
const codeMedecin = $("#codeMedecin").val();
if (!codeMedecin || codeMedecin.trim() === "") {
alert_ebene("Veuillez sélectionner un médecin!", "Please select a doctor!");
$("#nomMedecin").focus();
return;
}
const codeActe = $("#codeActe").val();
if (!codeActe || codeActe.trim() === "") {
alert_ebene("Veuillez sélectionner un acte!", "Please select an act!");
$("#codeActe").focus();
return;
}
// Validation des prix et quantités
const prixActe = parseFloat($("#prixActe").val()) || 0;
const prixTarif = parseFloat($("#prixTarif").val()) || 0;
if (prixActe === 0 || prixActe > prixTarif) {
alert_ebene("Veuillez revoir le tarif!", "Please review rate!");
return;
}
let quantite = parseInt($("#quantite").val()) || 0;
$("#quantite").val(quantite);
if (quantite === 0) {
$("#quantite").focus();
alert_ebene("Veuillez saisir la quantité!", "Please enter the quantity!");
return;
}
// Confirmation
confirm_ebene_sweet(
"Confirmez-vous cet acte?",
"Do you confirm this act?"
).then((isConfirmed) => {
if (!isConfirmed) return;
// Préparation des données
const valeurActe = $("#valeurActe").val();
const montantTm = $("#montantTm").val();
const aRembourser = $("#aRembourser").val();
let ententePrealable = $("#ententePrealable").val();
ententePrealable = ententePrealable == "1" ? "2" : ententePrealable;
const donnees = {
codeActe: codeActe,
codeMedecin: codeMedecin,
quantite: quantite,
ententePrealable: ententePrealable,
prixActe: prixActe,
valeurActe: valeurActe,
montantTm: montantTm,
aRembourser: aRembourser,
autorisation: autorisation,
prixTarif: prixTarif
};
const numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val();
const donnees_sav = {
codeActe: codeActe,
numeroFeuilleMaladie: numeroFeuilleMaladie,
typeMail: 'mailententeprealable'
};
const donnees_sav2 = {
codeActe: codeActe,
numeroFeuilleMaladie: numeroFeuilleMaladie,
typeMail: 'mailautorisation'
};
// Envoi AJAX
$.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistreractemedical/enregistreractemedical/`,
type: 'post',
data: donnees,
success: () => {
maj_fraisexclu_cso();
if (ententePrealable == "2") {
preparesms("ententeprealable");
alert_ebene("Demande accord préalable envoyée!", "Request prior agreement sent!");
mettremailattente($.param(donnees_sav));
}
if (autorisation == "2") {
preparesms("autorisation");
alert_ebene("Demande autorisation envoyée!", "Request for authorization sent!");
mettremailattente($.param(donnees_sav2));
}
},
complete: () => {
feuillemaladie();
},
error: (error) => {
console.error("Erreur lors de l'enregistrement:", error);
}
});
});
}
function ajax_changer_qte_acte()
{
codeActe = $("#codeActe").val();
prixActe = $("#prixActe").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;
}
div_quantite = $("#quantite");
quantite = div_quantite.val();
if(quantite=="")
{
quantite = "0";
}
div_quantite.val(quantite);
quantite = parseInt(quantite);
if(quantite==0)
{
div_quantite.focus();
div_quantite.val("");
v_msg="Veuillez saisir la quantit\u00e9!";
v_msgEng="Please neter the quantity!";
alert_ebene(v_msg, v_msgEng);
return;
}
donnees = 'codeActe='+codeActe+'&quantite='+quantite+'&prixActe='+prixActe;
$.ajax({
url: $("#racineWeb").val()+"Ajaxchangerqteacte/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosacte").html(data);
},
complete: function() {
}
});
}
function supprimer_acte_medical(idPrestationactes, codeTypePrestation) {
// Messages de confirmation
const confirmationMsg = "Confirmez-vous la suppression de cet acte?";
const confirmationMsgEng = "Do you confirm the removal of this act?";
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng).then((isConfirmed) => {
if (!isConfirmed) return;
// Envoi de la requête AJAX
$.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistreractemedical/supprimeracte/`,
type: 'POST',
data: {
idPrestationactes: idPrestationactes,
codeTypePrestation: codeTypePrestation
},
success: function() {
feuillemaladie_ajax();
},
error: function(error) {
console.error("Erreur lors de la suppression:", error);
}
});
});
}
function supprimer_chambre(idChambre) {
// Messages de confirmation
const confirmationMsg = "Confirmez-vous la suppression de cette chambre?";
const confirmationMsgEng = "Do you confirm the removal of this room?";
// Configuration des données AJAX
const ajaxData = {
idPrestationactes: idChambre,
codeTypePrestation: 'HOSP'
};
const ajaxConfig = {
url: `${$("#racineWeb").val()}Ajaxenregistreractemedical/supprimeracte/`,
type: 'POST',
data: ajaxData,
success: attribution_chambre,
error: function(error) {
console.error("Erreur lors de la suppression de la chambre:", error);
}
};
// Gestion de la confirmation et de l'appel AJAX
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng)
.then((confirmed) => {
if (confirmed) {
$.ajax(ajaxConfig);
}
});
}
function ajaxinfosbonhospitalisation()
{
bonCaduc=$("#bonCaduc").val();
// alert("bonCaduc => "+bonCaduc);
// return;
if (bonCaduc==1)
{
v_msg="Bon caduc!";
v_msgEng="Obsolete!";
alert_ebene(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;
}
codeGestionBon = $("#codeGestionBon").val();
if (codeGestionBon!="0")
{
v_msg="Option non disponible!";
v_msgEng="Option not available!";
alert_ebene(v_msg, v_msgEng);
return;
}
numeroBonHospitalisation = $("#numeroBonHospitalisation").val();
numeroBonHospitalisation = parseInt(numeroBonHospitalisation);
if (numeroBonHospitalisation>0)
{
v_msg="D\u00e9jà effectu\u00e9!";
v_msgEng="Already done!";
alert_ebene(v_msg, v_msgEng);
return;
}
facture=$("#facture").val();
if (facture==1)
{
v_msg="D\u00e9jà factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
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 Hospitalisation!";
v_msgEng="Please enter a prescription number!";
alert_ebene(v_msg, v_msgEng);
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
return;
}
donnees = "numeroBon="+numeroBon;
$.ajax({
url: $("#racineWeb").val()+"Ajaxinfosbonhospitalisation/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosbon").html(data);
},
complete: function() {
}
});
}
async function enregistrerhospitalisation() {
// Validation initiale
if ($("#badcodeGestionBon").val() === "1") {
alert_ebene("Veuillez revoir le type de gestion de bons!", "Please review the type of forms management!");
return;
}
// Récupération des données
const codeGestionBon = $("#codeGestionBon").val();
const motifHospitalisation = $("#motifHospitalisation").val().trim();
const numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val();
const codeLangue = $("#codeLangue").val();
// Validation du motif d'hospitalisation
if (!motifHospitalisation) {
alert_ebene("Saisissez le motif d'hospitalisation!", "Enter the hospitalization reason!");
$("#motifHospitalisation").focus();
return;
}
// Gestion spécifique des bons
let numeroBon;
let confirmationMsg, confirmationMsgEng;
if (codeGestionBon === "0") {
numeroBon = $("#numeroBon").val();
const numeroBonSave = $("#numeroBonSave").val();
const codeEtatBon = $("#codeEtatBon").val();
if (isNaN(numeroBon)) {
handleNumeroBonError("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
return;
}
if (!numeroBon || numeroBon <= "0") {
alert_ebene("Veuillez saisir un No de bon!", "Please enter a prescription number!");
$("#numeroBon").focus();
return;
}
if (codeEtatBon !== "1") {
alert_ebene("Veuillez saisir un No de bon disponible!", "Please enter a prescription number available!");
$("#numeroBon").focus();
return;
}
if (numeroBonSave !== numeroBon) {
handleNumeroBonError("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
return;
}
confirmationMsg = "Confirmez-vous ce No de bon?";
confirmationMsgEng = "Do you confirm this number of prescription?";
} else {
numeroBon = "-1";
confirmationMsg = "Confirmez-vous cette prescription?";
confirmationMsgEng = "Do you confirm this prescription?";
}
// Fonction helper pour gérer les erreurs de numéro de bon
function handleNumeroBonError(msg, msgEng) {
alert_ebene(msg, msgEng);
$("#btn_enreg").prop("disabled", true);
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
}
// Confirmation principale
const isConfirmed = await confirm_ebene_sweet(confirmationMsg, confirmationMsgEng);
if (!isConfirmed) {
feuillemaladie();
return;
}
// Préparation des données
const donnees = {
numeroBon: numeroBon,
numeroFeuilleMaladie: numeroFeuilleMaladie,
motifHospitalisation: motifHospitalisation,
codeGestionBon: codeGestionBon
};
$("#btn_enreg").prop("disabled", true);
try {
// Envoi de la requête AJAX
await $.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistrerhospitalisation/enregistrerhospitalisation/`,
type: 'post',
data: donnees
});
// Demande de continuation
const continueMsg = "Avis d'hospitalisation envoyé, souhaitez-vous continuer?";
const continueMsgEng = "Hospitalization notice sent, would you like to add a room?";
const wantsToContinue = await confirm_ebene_sweet(continueMsg, continueMsgEng);
if (wantsToContinue) {
attribution_chambre();
} else {
feuillemaladie();
}
} catch (error) {
console.error("Erreur lors de l'enregistrement:", error);
$("#btn_enreg").prop("disabled", false);
}
}
function libellesubstitut(controle)
{
var libelle = controle.options[controle.selectedIndex].text;
$("#libelleSubstitut").val(libelle);
}
function verifierPrixSubstitut(controle){
var prixSubstitut = $('#prixSubstitut').val();
var prixPublicSubstitut = $('#prixPublicSubstitut').val();
var prixTarif = $('#prixTarif').val();
var idMedicament = $('#idMedicament').val();
var nomPrescrit = $('#nomPrescrit').val();
var posologie = $('#posologie').val();
var nvellePosologie = $('#nvellePosologie').val();
var appliquerMargePrixSubstitutMedicament = $('#appliquerMargePrixSubstitutMedicament').val();
var margePrixSubstitutMedicament = $('#margePrixSubstitutMedicament').val();
var idSubstitut = $('#idSubstitut').val();
var libelleSubstitut = $("#libelleSubstitut").val();
var devise = $("#devise").val();
if (idSubstitut=="")
{
v_msg="Veuillez s\u00e9lectionner un m\u00e9dicament de substitution!";
v_msgEng="Please select a replacement drug!";
alert_ebene(v_msg, v_msgEng);
$("#prixSubstitut").val(0);
$("#prixSubstitut").focus();
return false;
}
prixPublicSubstitut = prixPublicSubstitut.replace(/ /g,"");
prixPublicSubstitut = parseInt(prixPublicSubstitut.replace(",","."),10);
prixSubstitut = prixSubstitut.replace(/ /g,"");
prixSubstitut = parseInt(prixSubstitut.replace(",","."),10);
prixTarif = prixTarif.replace(/ /g,"");
prixTarif = parseInt(prixTarif.replace(",","."),10);
margePrixSubstitutMedicament = margePrixSubstitutMedicament.replace(/ /g,"");
margePrixSubstitutMedicament = parseInt(margePrixSubstitutMedicament.replace(",","."),10);
if(appliquerMargePrixSubstitutMedicament == "1"){
prixTarif = prixTarif + margePrixSubstitutMedicament;
}else{
$("#btn_actu").prop("disabled",true);
$("#btn_enreg").prop("disabled",false);
$("#div_patienter").empty();
return false;
}
donnees_sav = 'idMedicament='+idMedicament+'&nomPrescrit='+nomPrescrit+'&prixTarif='+prixTarif;
donnees_sav += '&idSubstitut='+idSubstitut+'&libelleSubstitut='+libelleSubstitut;
donnees_sav += '&prixPublicSubstitut='+prixPublicSubstitut+'&prixSubstitut='+prixSubstitut;
donnees_sav += '&posologie='+posologie+'&nvellePosologie='+nvellePosologie;
donnees_sav += '&typeMail=maildemandesubstitution';
//donnees_sav = 'idMedicament='+idMedicament+'&prixTarif='+prixTarif;
//donnees_sav += '&idSubstitut='+idSubstitut+'&prixSubstitut='+prixSubstitut;
//donnees_sav += '&typeMail=maildemandesubstitution';
if(prixSubstitut > 0){
if(prixSubstitut > prixTarif){
//typeSms = "demandesubstitution";
//v_msg="Le prix du m\u00e9dicament de substitution est sup\u00e9rieur au prix du m\u00e9dicament prescrit augment\u00e9 de la marge maximum de "+formatCurrency(margePrixSubstitutMedicament)+" "+devise+" d\u00e9finie, veuillez attendre l'accord de l'assureur avant de continuer.";
//v_msgEng="The price of the replacement drug is higher than the price of the prescribed drug plus the maximum margin of "+formatCurrency(margePrixSubstitutMedicament)+" "+devise+" defined, please wait for the insurer's agreement before continuing.";
v_msg="Vous devez imp\u00e9rativement prendre un m\u00e9dicament de prix inf\u00e9rieur ou \u00e9gal \u00e0 celui prescrit!";
v_msgEng="You must imperatively take a medicine of lower price or equal to that prescribed!";
alert_ebene(v_msg, v_msgEng);
$("#searchInput").val("");
$("#prixSubstitut").val(0);
//preparesms(typeSms);
//mettremailattente(donnees_sav);
//$("#btn_actu").prop("disabled",false);
//etatreponsesubstitution();
//$("#btn_actu").focus();
//$("#btn_actu").click();
//sleep(1/10);
//$("#btn_actu").click();
return false;
}else{
$("#btn_actu").prop("disabled",true);
$("#btn_enreg").prop("disabled",false);
$("#div_patienter").empty();
}
}
}
function etatreponsesubstitution()
{
var idMedicament = $('#idMedicament').val();
var idSubstitut = $('#idSubstitut').val();
var prixSubstitut = $('#prixSubstitut').val();
var posologie = $('#posologie').val();
var nvellePosologie = $.trim($('#nvellePosologie').val());
donnees = 'idMedicament='+idMedicament;
donnees += '&idSubstitut='+idSubstitut;
donnees += '&prixSubstitut='+prixSubstitut;
donnees += '&posologie='+posologie;
donnees += '&nvellePosologie='+nvellePosologie;
//alert(donnees);
//return;
$("#div_patienter").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxetatreponsesubstitution/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_patienter").html(data);
var codeReponseEntentePrealable = $('#codeReponseEntentePrealable').val();
if(codeReponseEntentePrealable=="1"){
$("#btn_actu").prop("disabled",true);
$("#btn_enreg").prop("disabled",false);
$('#').val();
}
},
complete: function() {
}
});
}
function sleep(seconds){
var waitUntil = new Date().getTime() + seconds*1000;
while(new Date().getTime() < waitUntil){
true;
}
}
function viderDuree(){
//
$("#quantite").val("1");
div_quantite.focus();
}
function ajaxprixchambre()
{
$("#btn_enreg").disable();
$("#prixActe_info").val("0");
$("#montantTm_info").val("0");
$("#aRembourser_info").val("0");
codeActe = $("#codeActe").val();
if (codeActe<=" ")
{
v_msg="Veuillez s\u00e9lectionner un type de chambre!";
v_msgEng="Please select a category of room!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").focus();
return;
}
div_quantite = $("#quantite");
quantite = div_quantite.val();
if(quantite=="")
{
quantite = "0";
}
div_quantite.val(quantite);
quantite = parseInt(quantite);
if(quantite==0)
{
div_quantite.focus();
v_msg="Veuillez saisir la dur\u00e9e!";
v_msgEng="Please enter the duration!";
alert_ebene(v_msg, v_msgEng);
return;
}
donnees = 'codeActe='+codeActe+'&quantite='+quantite;
$("#infosacte").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxprixchambre/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosacte").html(data);
},
complete: function() {
}
});
}
function ajax_changer_duree_chambre()
{
$("#btn_enreg").disable();
codeActe = $("#codeActe").val();
prixActe = $("#prixActe").val();
numeroChambre = $("#numeroChambre").val();
/*
alert("numeroChambre => "+numeroChambre);
return;
*/
if (codeActe<=" ")
{
v_msg="Veuillez s\u00e9lectionner un type de chambre!";
v_msgEng="Please select a category of room!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").focus();
return;
}
div_quantite = $("#quantite");
quantite = div_quantite.val();
if(quantite=="")
{
quantite = "0";
}
div_quantite.val(quantite);
quantite = parseInt(quantite);
if(quantite==0)
{
div_quantite.focus();
div_quantite.val("");
v_msg="Veuillez saisir la dur\u00e9e!";
v_msgEng="Please enter duration!";
alert_ebene(v_msg, v_msgEng);
return;
}
claculerfinchambre();
donnees = 'codeActe='+codeActe+'&quantite='+quantite+'&prixActe='+prixActe+'&numeroChambre='+numeroChambre;
$("#infosacte").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxchangerdureechambre/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosacte").html(data);
},
complete: function() {
}
});
}
function claculerfinchambre()
{
div_quantite = $("#quantite");
quantite = div_quantite.val();
if(quantite=="")
{
quantite = "0";
}
div_quantite.val(quantite);
quantite = parseInt(quantite);
if(quantite==0)
{
div_quantite.focus();
div_quantite.val("");
v_msg="Veuillez saisir la dur\u00e9e!";
v_msgEng="Please enter the duration!";
alert_ebene(v_msg, v_msgEng);
return;
}
var typdate = $("#debut").datepicker("getDate");
typdate.setDate(typdate.getDate() + quantite -1);
$( "#fin" ).datepicker( "setDate", typdate );
}
async function enregistrerchambre() {
// Validate acteExclu
const acteExclu = $("#acteExclu").val();
let autorisation = "0";
if (acteExclu == "1") {
autorisation = "2";
alert_ebene("Non couvert!", "Not covered!");
$("#codeActe").focus();
return;
}
// Validate required fields
const codeActe = $("#codeActe").val();
if (!codeActe || codeActe.trim() === "") {
alert_ebene("Veuillez sélectionner un type de chambre!", "Please select a category of room!");
$("#codeActe").focus();
return;
}
const prixActe = parseFloat($("#prixActe").val()) || 0;
if (prixActe === 0) {
alert_ebene("Veuillez revoir le tarif!", "Please review rate!");
return;
}
let quantite = parseInt($("#quantite").val()) || 0;
$("#quantite").val(quantite);
if (quantite === 0) {
$("#quantite").focus();
alert_ebene("Veuillez saisir la durée!", "Please enter the duration!");
return;
}
const numeroChambre = $("#numeroChambre").val();
if (!numeroChambre || numeroChambre.trim() === "") {
alert_ebene("Veuillez saisir le No de chambre!", "Please enter room number!");
$("#numeroChambre").focus();
return;
}
// Get additional data
const ententePrealable = $("#ententePrealable").val() === "1" ? "2" : $("#ententePrealable").val();
const valeurActe = $("#valeurActe").val();
const montantTm = $("#montantTm").val();
const aRembourser = $("#aRembourser").val();
const debut = $("#debut").val();
const fin = $("#fin").val();
const motifHospit = $("#motifHospit").val();
const numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val();
const prixTarif = prixActe;
// Confirmation dialog
const isConfirmed = await confirm_ebene_sweet(
"Confirmez-vous cette chambre?",
"Do you confirm this room?"
);
if (!isConfirmed) return;
// Prepare data for AJAX call
const donnees = {
codeActe,
quantite,
prixActe,
valeurActe,
montantTm,
aRembourser,
debut,
fin,
numeroChambre,
autorisation,
prixTarif,
ententePrealable
};
const donnees_sav = {
codeActe,
numeroFeuilleMaladie,
quantite,
motifHospit,
typeMail: 'mailententeprealable'
};
const donnees_sav2 = {
codeActe,
numeroFeuilleMaladie,
quantite,
motifHospit,
typeMail: 'mailautorisation'
};
// Disable button during processing
$("#btn_enreg_chambre").prop("disabled", true);
try {
// Make AJAX call
await $.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistrerchambre/enregistrerchambre/`,
type: 'post',
data: donnees
});
// Process results
maj_fraisexclu_cso();
if (ententePrealable === "2") {
preparesms("ententeprealable");
alert_ebene("Demande accord préalable envoyée!", "Request prior agreement sent!");
await mettremailattente($.param(donnees_sav));
}
if (autorisation === "2") {
preparesms("autorisation");
alert_ebene("Demande autorisation envoyée!", "Request for authorization sent!");
await mettremailattente($.param(donnees_sav2));
}
alert_ebene("Enregistrée avec succès", "Saved successfully!");
attribution_chambre();
} catch (error) {
console.error("Error during room registration:", error);
} finally {
$("#btn_enreg_chambre").prop("disabled", false);
}
}
function actesmedicaux()
{
actVisible=$("#actVisible").val();
// if (actVisible!="1" && modeSaisieFacture!="1")
if (actVisible!="1")
{
v_msg="Non autoris\u00e9e!";
v_msgEng="Not allowed!";
alert_ebene(v_msg, v_msgEng);
return;
}
modeSaisieFacture=$("#modeSaisieFacture").val();
facture=$("#facture").val();
if (modeSaisieFacture=="0" && facture==1)
{
v_msg="D\u00e9jà factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
bonCaduc=$("#bonCaduc").val();
if (bonCaduc==1 && modeSaisieFacture!="1")
{
v_msg="Bon caduc!";
v_msgEng="Obsolete!";
alert_ebene(v_msg, v_msgEng);
return;
}
window.location.assign($("#racineWeb" ).val()+"Actesmedicaux/");
}
function optique()
{
facture=$("#facture").val();
if (facture==1)
{
v_msg="D\u00e9jà factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
prescription_optique();
}
function pharmacien()
{
if (prestation_possible())
{
/* mis en commentaire le 28/11/2017
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()+"Pharmacien/");
}
}
function dossiers(okId)
{
codeProfil = $("#codeProfil_C" ).val();
if(codeProfil=="PHA")
{
pharmacien();
return;
}
if(codeProfil=="OPT")
{
monture = $("#monture").val();
if(monture=="1")
{
window.location.assign($("#racineWeb" ).val()+"Monture/");
return;
}
opticien();
return;
}
if(codeProfil=="LAB")
{
laboratoire();
return;
}
if(codeProfil=="SEA")
{
seancekine();
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();
finger_id = $("#okId" ).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;
}
}
*/
modeSaisieFacture=$("#modeSaisieFacture").val();
if(modeSaisieFacture=="1")
{
window.location.assign($("#racineWeb" ).val()+"Dossiers/");
return;
}
if (prestation_possible())
{
if (okId==1)
{
window.location.assign($("#racineWeb" ).val()+"Consultation/");
return;
}
else
{
okId=$("#okId" ).val();
}
if (okId==1)
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextidentification/",
type : 'post',
error: function(errorData) {
},
complete: function() {
if (prestation_possible())
{
window.location.assign($("#racineWeb" ).val()+"Dossiers/");
}
}
});
}
else
{
window.location.assign($("#racineWeb" ).val()+"Dossiers/");
}
}
}
function afficher_beneficiaire_id_okId()
{
idBeneficiaire=$("#idBeneficiaire_C").val();
okId=$("#okId").val();
okId_face=$("#okId_face ").val();
if (idBeneficiaire>"")
{
ajax_context_beneficiaire_afficher(idBeneficiaire, okId, okId_face);
}
}
function ajax_context_beneficiaire_afficher(idBeneficiaire, okId, okId_face)
{
donnees = 'idBeneficiaire='+idBeneficiaire+'&okId='+okId+'&okId_face='+okId_face;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextbeneficiaire/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/");
}
});
}
function facturer_cso(user_id)
{
facture=$("#facture").val();
if (facture==1)
{
v_msg="D\u00e9jà factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
// verifier depasement
fraisExclu=$("#fraisExclu").val();
fraisExclu = parseInt(fraisExclu);
if (fraisExclu>0)
{
v_msg="Attention ! D\u00e9passement de limite, souhaitez-vous continuer?";
v_msgEng="Warning ! Overflow, Would you like to continue?";
if(!confirm_ebene(v_msg, v_msgEng))
{
return;
}
}
// Fin verification depassement
/*
derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val();
if(derogation_finger_en_cours>0)
{
$("#okId" ).val("1");
}
else
{
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;
}
}
*/
prixActe = $("#prixActe").val();
/*
if (prixActe==0)
{
v_msg="Rien à facturer!";
v_msgEng="Nothing to bill!";
alert_ebene(v_msg, v_msgEng);
return;
}
*/
montantTm = $("#montantTm").val();
cout = $("#cout").val();
montantTm_f = $("#montantTm_f").val();
cout_f = $("#cout_f").val();
donnees = 'prixActe='+prixActe;
donnees += '&montantTm='+montantTm;
donnees += '&cout='+cout;
numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val();
donnees_sav = 'numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailfacturationfeuillemaladie';
typeSms = "facturer_cso";
user_id_0 = $("#user_id_C").val();
user_id_substitut = "0";
if (user_id_0!=user_id)
{
user_id_substitut = user_id;
}
donnees_substitut = 'user_id_substitut='+user_id_substitut;
$.ajax({
url: $("#racineWeb").val()+"Ajaxfacturerfeuillemaladie/facturer/",
type: 'POST',
data: donnees_substitut,
success: function(data) {
},
error: function(data) {
},
complete: function()
{
v_msg="Facturation d\u00e9finitive effectu\u00e9e avec succès!";
v_msgEng="Final invoicing successfully completed!";
alert_ebene(v_msg, v_msgEng);
feuillemaladie();
}
});
}
// Fonction de facturation de la feuille de maladie
async function facturer_feuillemaladie() {
const codeLangue = $("#codeLangue").val();
const prixActe = $("#prixActe").val();
// Vérification si le prix est nul
if (prixActe === "0") {
const v_msg = "Rien à facturer!";
const v_msgEng = "Nothing to charge!";
alert_ebene(v_msg, v_msgEng);
return;
}
// Entente préalable en attente
const ententePrealableenattente = $("#ententePrealableenattente").val();
if (ententePrealableenattente === "1") {
const v_msg = "Veuillez attendre la réponse du gestionnaire avant la facturation définitive !";
const v_msgEng = "Please wait for the manager's response before final billing!";
alert_ebene(v_msg, v_msgEng);
return;
}
// Entente préalable pour consultation
const ententePrealableCons = $("#ententePrealableCons").val();
if (ententePrealableCons === "2" || ententePrealableCons === "9") {
const v_msg = ententePrealableCons === "2"
? "Veuillez attendre l'accord de l'assureur!"
: "Non autorisé car l'acte consultation a été refusé par l'assureur!";
const v_msgEng = ententePrealableCons === "2"
? "Please wait for insurer approval!"
: "Not authorized because the consultation act was refused by the insurer!";
alert_ebene(v_msg, v_msgEng);
return;
}
const modeSaisieFacture = $("#modeSaisieFacture").val();
const facture = $("#facture").val();
const contestation = $("#contestation").val();
// Dossier médical contesté
if (facture === "0" && contestation === "1") {
const v_msg = "Dossier médical contesté !";
const v_msgEng = "Medical records contested!";
alert_ebene(v_msg, v_msgEng);
return;
}
// Déjà facturé
if (modeSaisieFacture === "0" && facture === "1") {
const v_msg = "Déjà facturé!";
const v_msgEng = "Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
// Bon caduc
const bonCaduc = $("#bonCaduc").val();
if (bonCaduc === "1" && modeSaisieFacture !== "1") {
const v_msg = "Bon caduc!";
const v_msgEng = "Obsolete!";
alert_ebene(v_msg, v_msgEng);
return;
}
// Affection obligatoire non renseignée
const affectionObligatoire = $("#affectionObligatoire").val();
const codeAffection = $("#codeAffection").val();
if (affectionObligatoire === "1" && codeAffection === "990" && modeSaisieFacture !== "1") {
const v_msg = "Diagnostique exigé!";
const v_msgEng = "Diagnosis required!";
alert_ebene(v_msg, v_msgEng);
$("#libelleAffection").focus();
$("#btn_pop_affection").click();
return;
}
// Période clôturée
const codeEtatDecompte = $("#codeEtatDecompte").val();
if (codeEtatDecompte === "1" || codeEtatDecompte === "9") {
const v_msg = "Période clôturée!";
const v_msgEng = "Period closed!";
alert_ebene(v_msg, v_msgEng);
return;
}
const numOrd = $("#numOrd").val();
const noPrescription = $("#noPrescription").val();
const hospitalisation = $("#hospitalisation").val();
// Cas où il ny a ni ordonnance ni prescription
if (numOrd === "0" && noPrescription === "0" && hospitalisation === "0" && modeSaisieFacture === "0") {
const v_msg = "Souhaitez-vous créer une ordonnance médicale avant de facturer?";
const v_msgEng = "Would you like to create a medical prescription before invoicing?";
const confirmPrescription = await confirm_ebene_sweet(v_msg, v_msgEng);
if (confirmPrescription) {
// L'utilisateur choisit de créer une ordonnance
prescription_medicament();
return;
}
// Si l'utilisateur ne veut pas créer d'ordonnance, confirmation de la facturation finale
const v_msg2 = "Confirmez-vous la facturation définitive?";
const v_msgEng2 = "Do you confirm the final billing?";
const confirmFacture = await confirm_ebene_sweet(v_msg2, v_msgEng2);
if (confirmFacture) {
const user_id_0 = $("#user_id_C").val();
facturer_cso(user_id_0);
}
return;
}
// Cas classique : confirmation directe de la facturation
const v_msg = "Confirmez-vous la facturation définitive?";
const v_msgEng = "Do you confirm the final billing?";
const confirmFacture = await confirm_ebene_sweet(v_msg, v_msgEng);
if (confirmFacture) {
const user_id_0 = $("#user_id_C").val();
facturer_cso(user_id_0);
}
}
function facturer_pha()
{
//
var div_messages = $('#div_messages');
div_messages.html('');
nbLivre=$("#nbLivre").val();
nbLivre = parseInt(nbLivre);
if (nbLivre<1)
{
v_msg="Rien à facturer!";
v_msgEng="Nothing to bill!";
alert_ebene(v_msg, v_msgEng);
return;
}
coutprescription = $("#coutprescription").val();
//alert(coutprescription);
//return;
montantTm = $("#montantTm").val();
cout = $("#cout").val();
montantTm_f = $("#montantTm_f").val();
cout_f = $("#cout_f").val();
donnees = 'prixActe='+coutprescription;
donnees += '&montantTm='+montantTm;
donnees += '&cout='+cout;
numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val();
codePrestataire = $("#codePrestataire_C").val();
donnees_sav = 'numeroFeuilleMaladie='+numeroFeuilleMaladie+'&codePrestataire='+codePrestataire+'&typeMail=mailpharmacie';
typeSms = "facturer_pha";
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/enregistrerpharmacie/",
type: 'POST',
success: function(data) {
// KANE 17/03/2025 => ne pas envoyer de SMS d'alerte de facturation
// preparesms_adherent(typeSms);
},
error: function(data) {
},
complete: function() {
// KANE 17/03/2025 => ne pas envoyer de mail d'alerte de facturation
// preparemail_adherent(typeSms);
v_msg="Facturation effectu\u00e9e avec succès!";
v_msgEng="Billing done successfully!";
alert_ebene(v_msg, v_msgEng);
window.location.assign($("#racineWeb" ).val()+"Pharmacien/");
}
});
}
async function valider_pharmacie_pha() {
// Configuration and initial checks
const modeSaisieFacture = $("#modeSaisieFacture").val();
const bonCaduc = $("#bonCaduc").val();
// Validation checks
if (bonCaduc == "1" && modeSaisieFacture != "1") {
alert_ebene("Bon caduc!", "Obsolete!");
return;
}
const estRempalace = $("#estRempalace").val();
if (estRempalace == "1") {
alert_ebene("Remplacée!", "Replaced!");
return;
}
const numeroPrescription = $("#numeroPrescription_C").val();
if (numeroPrescription <= "0") {
alert_ebene("Rien à facturer!", "Nothing to bill!");
return;
}
const coutprescription = $("#coutprescription").val();
if (coutprescription <= 0 || coutprescription == undefined) {
alert_ebene("Rien à facturer!", "Nothing to bill!");
return;
}
const montantsaisi = $("#montantsaisi").val();
if (montantsaisi == "1") {
alert_ebene(
"Veuillez verifier les montants et facturer à nouveau s'il vous plaît!",
"Please check the amounts and invoice again!"
);
return;
}
// Validate medication prices
const nbLivre = parseInt($("#nbLivre").val()) || 0;
if (nbLivre < 1) {
alert_ebene("Rien à facturer!", "Nothing to bill!");
return;
}
for (let pas = 1; pas <= nbLivre; pas++) {
if ($("#valeurActeManuel" + pas).val() == "0") {
alert_ebene(
"Veuiller entrer le prix du médicament!",
"Please enter the drug price!"
);
$("#valeurActeManuel" + pas).focus();
return;
}
}
// Confirmation dialog
const isConfirmed = await confirm_ebene_sweet(
"Confirmez-vous cette facturation?",
"Do you confirm this billing?"
);
if (isConfirmed) {
facturer_pha();
}
}
function imprimer_facture_definitive_pha()
{
//
idFacture = $("#idFacture").val();
if (idFacture>="0")
{
donnees = "idFacture="+idFacture;
var div_export = $('#div_facture_definitive');
div_export.html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaximprimerfacturedefinitivepha/",
type: 'POST',
data: donnees,
success: function(data)
{
div_export.html(data);
},
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 imprimer_facture_definitive_opt()
{
idFacture = $("#idFacture").val();
if (idFacture>="0")
{
donnees = "idFacture="+idFacture;
var div_export = $('#div_facture_definitive');
div_export.html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
//$("#btn_facture_partielle").click();
$.ajax({
url: $("#racineWeb").val()+"Ajaximprimerfacturedefinitiveopt/",
type: 'POST',
data: donnees,
success: function(data)
{
div_export.html(data);
//facturepartielle();
//$('#div_export_a').html(data);
},
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;
}
}
async function valider_optique() {
// Initial validations
const bonCaduc = $("#bonCaduc").val();
if (bonCaduc == "1") {
alert_ebene("Bon caduc!", "Obsolete!");
return;
}
const badcodeGestionBon = $("#badcodeGestionBon").val();
if (badcodeGestionBon == "1") {
alert_ebene("Veuillez revoir le type de gestion de bons!", "Please review the type of forms management!");
return;
}
const facture = $("#facture").val();
if (facture == "1") {
alert_ebene("Déjà facturé!", "Already charged!");
return;
}
const numeroBonOptique = $("#numeroBonOptique").val();
if (numeroBonOptique <= 0) {
alert_ebene("Pas de prescription!", "No prescription!");
return;
}
// Collect all optical prescription data
const opticalData = {
numeroBonOptique: numeroBonOptique,
axeVisionLoinDroit: $("#axeVisionLoinDroit").val(),
verreCylindriqueDroit: $("#verreCylindriqueDroit").val(),
verreSpheriqueDroit: $("#verreSpheriqueDroit").val(),
axeVisionLoinGauche: $("#axeVisionLoinGauche").val(),
verreCylindriqueGauche: $("#verreCylindriqueGauche").val(),
verreSpheriqueGauche: $("#verreSpheriqueGauche").val(),
distanceInterpupillaireVisionLoin: $("#distanceInterpupillaireVisionLoin").val(),
axeVisionPresDroit: $("#axeVisionPresDroit").val(),
axeVisionPresGauche: $("#axeVisionPresGauche").val(),
distanceInterpupillaireVisionPres: $("#distanceInterpupillaireVisionPres").val(),
doubleFoyer: $("#doubleFoyer").val(),
progressif: $("#progressif").val(),
teinteA: $("#teinteA").val(),
teinteAB: $("#teinteAB").val(),
teinteB: $("#teinteB").val(),
teinteC: $("#teinteC").val(),
photogray: $("#photogray").val(),
antireflet: $("#antireflet").val(),
photochromique: $("#photochromique").val(),
antiUV: $("#antiUV").val(),
transition: $("#transition").val(),
antiBuee: $("#antiBuee").val(),
filtreBleu: $("#filtreBleu").val()
};
// Confirmation dialog
const isConfirmed = await confirm_ebene_sweet(
"Confirmez-vous cette ordonnance ?",
"Do you confirm this prescription?"
);
if (!isConfirmed) return;
// Submit the data
try {
await $.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistreroptique/enregistrerprescriptionoptique/`,
type: 'post',
data: opticalData
});
feuillemaladie();
} catch (error) {
console.error("Error saving optical prescription:", error);
}
}
function separateur_millier(montant)
{
montant = parseInt(montant);
montant.toLocaleString();
return montant.toLocaleString();
}
function ajaxinfosbonoptique()
{
bonCaduc=$("#bonCaduc").val();
// alert("bonCaduc => "+bonCaduc);
// return;
if (bonCaduc==1)
{
v_msg="Bon caduc!";
v_msgEng="Obsolete!";
alert_ebene(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;
}
codeGestionBon = $("#codeGestionBon").val();
if (codeGestionBon!="0")
{
v_msg="Option non disponible!";
v_msgEng="Option not available!";
alert_ebene(v_msg, v_msgEng);
return;
}
numeroBonOptique = $("#numeroBonOptique").val();
numeroBonOptique = parseInt(numeroBonOptique);
if (numeroBonOptique>0)
{
v_msg="D\u00e9jà effectu\u00e9!";
v_msgEng="Already done!";
alert_ebene(v_msg, v_msgEng);
return;
}
facture=$("#facture").val();
if (facture==1)
{
v_msg="D\u00e9jà factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
codeMedecin = $("#codeMedecin").val();
if (codeMedecin<=" ")
{
v_msg="Veuillez s\u00e9lectionner un m\u00e9decin!";
v_msgEng="Please select a doctor!";
alert_ebene(v_msg, v_msgEng);
$("#numeroBon").val("");
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
// $("#codeMedecin").focus();
$("#nomMedecin").focus();
return;
}
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);
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
return;
}
donnees = "numeroBon="+numeroBon;
$.ajax({
url: $("#racineWeb").val()+"Ajaxinfosbonoptique/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosbon").html(data);
},
complete: function() {
}
});
}
async function supprimer_optique(idOptique) {
// Confirmation message
const confirmationMsg = "Confirmez-vous la suppression de ce verre?";
const confirmationMsgEng = "Do you confirm the removal of this glass?";
// Show confirmation dialog
const isConfirmed = await confirm_ebene_sweet(confirmationMsg, confirmationMsgEng);
if (!isConfirmed) return;
try {
// Make the AJAX request
const response = await $.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistrerverre/supprimerverre/`,
type: 'POST',
data: { idOptique }
});
// Update the UI
$("#medicaments").html(response);
prescription_optique();
} catch (error) {
console.error("Error deleting optical prescription:", error);
// Optionally show an error message to the user
alert_ebene(
"Erreur lors de la suppression du verre",
"Error while removing the glass"
);
}
}
async function enregistreroptique() {
// Validate bon management type
if ($("#badcodeGestionBon").val() === "1") {
alert_ebene("Veuillez revoir le type de gestion de bons!", "Please review the type of forms management!");
return;
}
// Get form values
const codeGestionBon = $("#codeGestionBon").val();
const codeMedecin = $("#codeMedecin").val();
const motifOptique = $("#motifOptique").val().trim();
const codeLangue = $("#codeLangue").val();
// Validate doctor selection
if (!codeMedecin || codeMedecin.trim() === "") {
alert_ebene("Veuillez sélectionner un médecin!", "Please select a doctor!");
$("#nomMedecin").focus();
return;
}
// Validate prescription reason
if (!motifOptique) {
alert_ebene("Saisissez le motif de la prescription!", "Enter the reason for the prescription!");
$("#motifOptique").focus();
return;
}
// Handle bon number validation for non-paperless mode
let numeroBon;
let confirmationMsg, confirmationMsgEng;
if (codeGestionBon === "0") {
numeroBon = $("#numeroBon").val();
const numeroBonSave = $("#numeroBonSave").val();
const codeEtatBon = $("#codeEtatBon").val();
if (isNaN(numeroBon)) {
handleNumeroBonError("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
return;
}
if (!numeroBon || numeroBon <= "0") {
alert_ebene("Veuillez saisir un No de bon!", "Please enter a prescription number!");
$("#numeroBon").focus();
return;
}
if (codeEtatBon !== "1") {
alert_ebene("Veuillez saisir un No de bon disponible!", "Please enter a prescription number available!");
$("#numeroBon").focus();
return;
}
if (numeroBonSave !== numeroBon) {
handleNumeroBonError("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
return;
}
confirmationMsg = "Confirmez-vous ce No de bon?";
confirmationMsgEng = "Do you confirm this number of prescription?";
} else {
numeroBon = "-1";
confirmationMsg = "Confirmez-vous cette prescription?";
confirmationMsgEng = "Do you confirm this prescription?";
}
// Helper function for bon number errors
function handleNumeroBonError(msg, msgEng) {
alert_ebene(msg, msgEng);
$("#btn_enreg").prop("disabled", true);
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
}
// Show confirmation dialog
const isConfirmed = await confirm_ebene_sweet(confirmationMsg, confirmationMsgEng);
if (!isConfirmed) return;
// Prepare data for submission
const donnees = {
numeroBon,
codeMedecin,
motifOptique,
codeGestionBon
};
// Disable submit button during processing
$("#btn_enreg").prop("disabled", true);
try {
// Submit the form
await $.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistreroptique/enregistreroptique/`,
type: 'post',
data: donnees
});
// Show success message and refresh
alert_ebene("Prescription enregistrée avec succès", "Saved successfully!");
prescription_optique();
} catch (error) {
console.error("Error saving optical prescription:", error);
} finally {
$("#btn_enreg").prop("disabled", false);
}
}
async function enregistrerverre() {
// Validate glass selection
const codeOptique = $("#codeOptique").val();
if (!codeOptique || codeOptique.trim() === "") {
alert_ebene("Veuillez sélectionner un verre!", "Please select a glass!");
$("#codeOptique").focus();
return;
}
// Show confirmation dialog
const isConfirmed = await confirm_ebene_sweet(
"Confirmez-vous ces verres?",
"Do you confirm these glasses?"
);
if (!isConfirmed) return;
try {
// Submit the data
await $.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistrerverre/enregistrerverre/`,
type: 'post',
data: { codeOptique }
});
// Refresh the prescription view
prescription_optique();
} catch (error) {
console.error("Error saving glasses:", error);
alert_ebene(
"Erreur lors de l'enregistrement des verres",
"Error while saving glasses"
);
}
}
async function valider_chambre() {
// Get form values
const formValues = {
dureeHospit: $("#dureeHospit").val(),
dateDebutHospit: $("#dateDebutHospit").val(),
optionHospitalisation: $("#optionHospitalisation").val(),
avisHospitalisation: $("#avisHospitalisation").val(),
libelleAvis: $("#libelleAvis").val(),
nbreActesSansPrix: $("#nbreActesSansPrix").val(),
nbreActesSansPrixPro: $("#nbreActesSansPrixPro").val(),
reclame: $("#reclame").val(),
modeSaisieFacture: $("#modeSaisieFacture").val(),
prixChambreProlongation: $("#prixChambreProlongation").val(),
noChambrePro: $("#noChambrePro").val(),
idProlongationFeuille: $("#idProlongationFeuille").val(),
badcodeGestionBon: $("#badcodeGestionBon").val(),
chambreOK: $("#chambreOK").val(),
facture: $("#facture").val(),
bonCaduc: $("#bonCaduc").val(),
noChambre: $("#noChambre").val()
};
// Validate required fields
if (!formValues.dateDebutHospit) {
alert_ebene(
"Veuillez saisir la date de début de l'hospitalisation!",
"Please enter the start date of hospitalization!"
);
$("#dateDebutHospit").focus();
return;
}
if (formValues.dureeHospit === "0") {
alert_ebene(
"Veuillez saisir la durée de l'hospitalisation!",
"Please enter the duration of hospitalization!"
);
$("#dureeHospit").focus();
return;
}
// Validate hospital notice
if (!["1", "9"].includes(formValues.avisHospitalisation)) {
alert_ebene(formValues.libelleAvis, formValues.libelleAvis);
return;
}
// Validate bon management
if (formValues.badcodeGestionBon === "1") {
alert_ebene(
"Veuillez revoir le type de gestion de bons!",
"Please review the type of forms management!"
);
return;
}
// Validate claim status
if (formValues.reclame === "0") {
alert_ebene("Rien à valider!", "Nothing to confirm!");
return;
}
// Check if already billed
if (formValues.facture === "1") {
alert_ebene("Déjà facturé!", "Already charged!");
return;
}
// Check if bon is obsolete
if (formValues.bonCaduc === "1") {
alert_ebene("Bon caduc!", "Obsolete!");
return;
}
// Validate room number
if (!formValues.noChambre || formValues.noChambre.trim() === "") {
alert_ebene(
"Veuillez entrer le numero de chambre!",
"Please enter the room number!"
);
$("#noChambre").focus();
return;
}
// Validate extension room if applicable
if (parseInt(formValues.idProlongationFeuille) > 0) {
if (!formValues.noChambrePro || formValues.noChambrePro.trim() === "") {
alert_ebene(
"Veuillez entrer le numero de chambre de prorogation!",
"Please enter the extension room number!"
);
return;
}
if (!formValues.prixChambreProlongation || formValues.prixChambreProlongation === "0") {
alert_ebene(
"Vous n'avez pas saisi le prix de la chambre de prorogation.",
"You have not entered the price of the extension room."
);
$("#btn_close_pop").click();
return;
}
}
// Prepare data for submission
const donnees = { noChambre: formValues.noChambre };
// Show confirmation dialog
const isConfirmed = await confirm_ebene_sweet(
"Confirmez-vous cette hospitalisation ?",
"Do you confirm this hospitalization?"
);
if (!isConfirmed) return;
try {
// Delete acts without price if needed
if (parseInt(formValues.nbreActesSansPrix) > 0 || parseInt(formValues.nbreActesSansPrixPro) > 0) {
await $.ajax({
url: `${$("#racineWeb").val()}Ajaxselectactesmedicauxhospitalisation/supprimeacte/`,
type: 'POST',
data: donnees
});
faireDefileMessage(
"Les actes sans prix unitaire seront supprimés à la validation!",
"Acts without a unit price will be deleted upon validation!"
);
}
// Validate hospitalization
await $.ajax({
url: `${$("#racineWeb").val()}Ajaxselectactesmedicauxhospitalisation/validerhospitalisation/`,
type: 'POST',
data: donnees
});
// Refresh the medical sheet
feuillemaladie();
} catch (error) {
console.error("Error validating room:", error);
alert_ebene(
"Erreur lors de la validation de la chambre",
"Error while validating the room"
);
}
}
async function valider_opticien() {
// Get form values
const modeSaisieFacture = $("#modeSaisieFacture").val();
const bonCaduc = $("#bonCaduc").val();
const idPrestationactes = parseInt($("#idPrestationactes").val()) || 0;
const codeReponseEntentePrealable = $("#codeReponseEntentePrealable").val();
const numeroOptique = $("#numeroOptique_C").val();
// Validate prescription status
if (bonCaduc == "1" && modeSaisieFacture != "1") {
alert_ebene("Bon caduc!", "Obsolete!");
return;
}
if (idPrestationactes > 0) {
alert_ebene("Déjà facturé!", "Already charged!");
return;
}
if (codeReponseEntentePrealable != "1") {
alert_ebene(
"Vous ne pouvez pas facturer! Veuillez attendre l'accord de l'assureur.",
"You cannot charge! Please wait for the agreement of the insurer."
);
return;
}
if (numeroOptique <= "0") {
alert_ebene("Rien à facturer!", "Nothing to bill!");
return;
}
// Show confirmation dialog
const isConfirmed = await confirm_ebene_sweet(
"Confirmez-vous cette facturation?",
"Do you confirm this billing?"
);
if (isConfirmed) {
facturer_opt();
}
}
function opticien()
{
window.location.assign($("#racineWeb" ).val()+"Opticien/");
}
function envoyer_alert_tentative_fraude(user_id)
{
/*
donnees = 'user_id='+user_id;
idBeneficiaire = $("#idBeneficiaire_C").val();
prestataire = $("#prestataire_C").val();
donnees_sav = donnees+'&prestataire='+prestataire+'&idBeneficiaire='+idBeneficiaire+'&typeMail=mailfraudeidentite';
mettremailattente(donnees_sav);
*/
}
function ajouterverre_opt_tous()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailopticien/ajouterverretous/",
type: 'POST',
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
alerter_depassement_limite();
}
});
}
function ajouterverre_opt(idOptique)
{
donnees = 'idOptique='+idOptique;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailopticien/ajouterverre/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
alerter_depassement_limite();
}
});
}
function retirerverre_opt_tous()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailopticien/retirerverretous/",
type: 'POST',
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
}
});
}
function retirerverre_opt(idOptique)
{
donnees = 'idOptique='+idOptique;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailopticien/retirerverre/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
}
});
}
function facturer_opt()
{
idPrestationactes=$("#idPrestationactes").val();
idPrestationactes = parseInt(idPrestationactes);
if (idPrestationactes>0)
{
v_msg="D\u00e9jà factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
/*nbLivre=$("#nbLivre").val();
nbLivre = parseInt(nbLivre);
if (idPrestationactes==0 && nbLivre<1)
{
v_msg="Rien à facturer!";
v_msgEng="Nothing to bill!";
alert_ebene(v_msg, v_msgEng);
return;
}
*/
prixActe = $("#prixActe").val();
if (prixActe==0)
{
v_msg="Rien à facturer!";
v_msgEng="Nothing to bill!";
alert_ebene(v_msg, v_msgEng);
return;
}
montantTm = $("#montantTm").val();
cout = $("#cout").val();
montantTm_f = $("#montantTm_f").val();
cout_f = $("#cout_f").val();
donnees = 'prixActe='+prixActe;
donnees += '&montantTm='+montantTm;
donnees += '&cout='+cout;
numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val();
codePrestataire = $("#codePrestataire_C").val();
donnees_sav = 'numeroFeuilleMaladie='+numeroFeuilleMaladie+'&codePrestataire='+codePrestataire+'&typeMail=mailoptique';
typeSms = "facturer_opt";
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailopticien/enregistreroptique/",
type: 'POST',
success: function(data) {
// KANE 17/03/2025 => ne pas envoyer de SMS d'alerte de facturation
// preparesms_adherent(typeSms);
},
error: function(data) {
},
complete: function()
{
// KANE 17/03/2025 => ne pas envoyer de mail d'alerte de facturation
// preparemail_adherent(typeSms);
v_msg="Facturation effectu\u00e9e avec succès!";
v_msgEng="Billing done successfully!";
alert_ebene(v_msg, v_msgEng);
window.location.assign($("#racineWeb" ).val()+"Opticien/");
}
});
}
function afficher_detail_generartionbon(idgenerationbon)
{
if (idgenerationbon>"")
{
window.location.assign($("#racineWeb" ).val()+"Detailgenerationbon/"+idgenerationbon+"/");
}
}
function maj_monture_temp(idOptique, monture)
{
donnees = 'idOptique='+idOptique+"&monture="+monture;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailopticien/majmonture/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
alerter_depassement_limite();
}
});
}
function supprimer_espace_nombre(nombre)
{
nombre = nombre.replace(" ", "");
if(isNaN(nombre))
{
v_msg = nombre+" n'est pas un nombre!";
v_msgEng = nombre+" is not a number!";
alert_ebene(v_msg, v_msgEng);
return '0';
}
nombre = parseInt(nombre);
return nombre;
}
function demander_derogation()
{
window.location.assign($("#racineWeb" ).val()+"Demandederogation/");
}
async function enregistrerdemandederogation() {
// Get form values
const codeDerogation = $("#codeDerogation").val();
const college_couvert = $("#college_couvert_C").val();
const observations = $("#observations").val().trim();
const libelleDerogation = $("#codeDerogation option:selected").text().trim();
// Set the derogation label
$("#libelleDerogation").val(libelleDerogation);
// Validate college access
if (college_couvert > 0 && codeDerogation === "01") {
alert_ebene(
"Attention! Cette personne a déjà accès à ce centre",
"Warning! This person already has access to this center"
);
return;
}
// Validate derogation selection
if (!codeDerogation || codeDerogation.trim() === "") {
alert_ebene(
"Veuillez sélectionner une dérogation!",
"Please select an exemption!"
);
$("#codeDerogation").focus();
return;
}
// Validate observations
if (!observations) {
alert_ebene(
"Veuillez saisir la motivation!",
"Please enter the motivation!"
);
$("#observations").focus();
return;
}
// Show confirmation dialog
const isConfirmed = await confirm_ebene_sweet(
"Confirmez-vous cette demande de dérogation?",
"Do you confirm this request?"
);
if (!isConfirmed) return;
// Prepare data for submission
const donnees = {
codeDerogation,
observations,
libelleDerogation
};
try {
// Submit the request
await $.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistrerdemandederogation/enregistrerdemandederogation/`,
type: 'post',
data: donnees
});
// Show success message and refresh list
alert_ebene(
"Demande envoyée avec succès!",
"Request sent successfully!"
);
liste_derogation();
} catch (error) {
console.error("Error submitting derogation request:", error);
alert_ebene(
"Erreur lors de l'envoi de la demande",
"Error while sending the request"
);
}
}
function liste_derogation()
{
window.location.assign($("#racineWeb" ).val()+"Listederogations/");
}
function listerderogation()
{
d1=$("#d1").val();
d2=$("#d2").val();
donnees = 'd1='+d1+'&d2='+d2;
$("#div_derogations").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxderogation/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_derogations").html(data);
},
complete: function() {
}
});
}
function afficher_div_wait()
{
// $("#div_page_complet").disable();
// $("#div_wait").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
}
function effacer_div_wait()
{
$("#div_wait").html("");
}
function consultationpha()
{
window.location.assign($("#racineWeb" ).val()+"Consultationpha/");
}
function consultationlab()
{
window.location.assign($("#racineWeb" ).val()+"Consultationlab/");
}
function consultationopt()
{
window.location.assign($("#racineWeb" ).val()+"Consultationopt/");
}
function consultationcso()
{
window.location.assign($("#racineWeb" ).val()+"Consultationcso/");
}
function consultationbenpha()
{
window.location.assign($("#racineWeb" ).val()+"Consultationbenpha/");
}
function consultationbenopt()
{
window.location.assign($("#racineWeb" ).val()+"Consultationbenopt/");
}
function consultationbencso()
{
window.location.assign($("#racineWeb" ).val()+"Consultationbencso/");
}
function listerdossiercons_ben()
{
d1=$("#d1").val();
d2=$("#d2").val();
donnees = 'd1='+d1+'&d2='+d2;
$("#div_dossiers").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxconsultationbencso/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_dossiers").html(data);
},
complete: function() {
}
});
}
function listerdossiercons()
{
d1=$("#d1").val();
d2=$("#d2").val();
donnees = 'd1='+d1+'&d2='+d2;
$("#div_entete_dossier").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxconsultationcsoentete/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_entete_dossier").html(data);
},
complete: function() {
ajax_consultationcso(d1, d2);
}
});
}
function ajax_consultationcso(d1, d2)
{
donnees = 'd1='+d1+'&d2='+d2;
$("#detail_reglements").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxconsultationcso/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#detail_reglements").html(data);
},
complete: function() {
}
});
}
function afficher_feuille_maladie_cons()
{
numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C" ).val();
if (numeroFeuilleMaladie>"")
{
ajax_context_feuille_maladie_afficher_cons(numeroFeuilleMaladie);
}
}
function ajax_context_feuille_maladie_afficher_cons(numeroFeuilleMaladie)
{
donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextfeuillemaladie/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
consulter_feuillemaladie();
}
});
}
function afficher_feuille_maladie_cons_ben()
{
numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C" ).val();
if (numeroFeuilleMaladie>"")
{
ajax_context_feuille_maladie_afficher_cons_ben(numeroFeuilleMaladie);
}
}
function ajax_context_feuille_maladie_afficher_cons_ben(numeroFeuilleMaladie)
{
donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextfeuillemaladie/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
consulter_feuillemaladie_ben();
}
});
}
function consulter_prescription_ben()
{
window.location.assign($("#racineWeb" ).val()+"Prescriptionconsben/");
}
function consulter_chambre_ben()
{
window.location.assign($("#racineWeb" ).val()+"Chambreconsben/");
}
function consulter_optique_ben()
{
window.location.assign($("#racineWeb" ).val()+"Optiqueconsben/");
}
function consulter_feuillemaladie_ben()
{
window.location.assign($("#racineWeb" ).val()+"Feuillemaladieconsben/");
}
function consulter_prescription()
{
window.location.assign($("#racineWeb" ).val()+"Prescriptioncons/");
}
function consulter_chambre()
{
window.location.assign($("#racineWeb" ).val()+"Chambrecons/");
}
function consulter_optique()
{
window.location.assign($("#racineWeb" ).val()+"Optiquecons/");
}
function consulter_feuillemaladie()
{
window.location.assign($("#racineWeb" ).val()+"Feuillemaladiecons/");
}
//
function prescription_medicament()
{
// 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;
}
///////////////
hospitalisation = $("#hospitalisation").val();
numOrd = $("#numOrd").val();
facture=$("#facture").val();
if (numOrd == "0" && facture==1)
{
v_msg="D\u00e9j\u00e0 factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
contestation = $("#contestation").val();
if(numOrd == "0" && contestation == "1"){
const v_msg = "Dossier médical contesté !";
const v_msgEng = "Medical records contested!";
alert_ebene(v_msg, v_msgEng);
return;
}
if (hospitalisation=="1" && numOrd=="0")
{
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;
}
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;
}
numeroBon = $("#numeroBon").val();
codeMedecin = $("#codeMedecin").val();
codeGestionBon = "2";
/* CODE A RAJOUTER POUR LES CODE D'AFFECTION*/
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;
}
// if (actVisible!="1" && modeSaisieFacture!="1")
if (actVisible!="1")
{
v_msg="Non autoris\u00e9!";
v_msgEng="Not allowed!";
alert_ebene(v_msg, v_msgEng);
return;
}
if (numOrd=="0" && contestation == "0"){
enregistrerprescriptionmedicatement(numeroBon,codeMedecin,codeGestionBon);
} else{
window.location.assign($("#racineWeb" ).val()+"Prescription/");
}
}
function livraison_pharmacie()
{
actVisible=$("#actVisible").val();
nomForm = $("#nomForm").val();
if (nomForm=="feuillemaladie"){
estGarantiePha = $("#estGarantiePha").val();
/*
if (estGarantiePha!="1"){
v_msg="Cet acte n'est pas garantie pour le b\u00e9n\u00e9ficiaire!";
v_msgEng="This act is not guaranteed for the beneficiary!";
alert_ebene(v_msg, v_msgEng);
return;
}*/
}
// if (actVisible!="1" && modeSaisieFacture!="1")
if (actVisible!="1")
{
v_msg="Non autoris\u00e9e!";
v_msgEng="Not allowed!";
alert_ebene(v_msg, v_msgEng);
return;
}
modeSaisieFacture=$("#modeSaisieFacture").val();
bonCaduc=$("#bonCaduc").val();
if (bonCaduc==1 && modeSaisieFacture!="1")
{
v_msg="Bon caduc!";
v_msgEng="Obsolete!";
alert_ebene(v_msg, v_msgEng);
return;
}
numeroBonOrdonnance=$("#numeroBonOrdonnance_C").val();
if (numeroBonOrdonnance==0)
{
v_msg="Aucune prescription!";
v_msgEng="No prescription!";
alert_ebene(v_msg, v_msgEng);
return;
}
window.location.assign($("#racineWeb" ).val()+"Pharmacie/");
}
function prescription_optique()
{
//
codePrestataire=$("#codePrestataire").val();
affectionObligatoire=$("#affectionObligatoire").val();
codeAffection=$("#codeAffection").val();
modeSaisieFacture=$("#modeSaisieFacture").val();
numeroBonOptique=$("#numeroBonOptique").val();
facture=$("#facture").val();
if (numeroBonOptique == "0" && facture==1)
{
v_msg="D\u00e9j\u00e0 factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
contestation = $("#contestation").val();
if(numeroBonOptique == "0" && contestation == "1"){
v_msg="Dossier médical contesté !";
v_msgEng="Medical records contested!";
alert_ebene(v_msg, v_msgEng);
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;
}
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;
}
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;
}
window.location.assign($("#racineWeb" ).val()+"Optique/");
}
// Fonction pour gérer l'attribution d'une chambre d'hospitalisation
async function attribution_chambre() {
const affectionObligatoire = $("#affectionObligatoire").val();
const codeAffection = $("#codeAffection").val();
let modeSaisieFacture = $("#modeSaisieFacture").val();
const numeroBonHospitalisation = $("#numeroBonHospitalisation").val();
const dateDebutHospit = $("#dateDebutHospit").val();
let facture = $("#facture").val();
const codeLangue = $("#codeLangue").val();
const contestation = $("#contestation").val();
const ententePrealableCons = $("#ententePrealableCons").val();
const avisHospitalisation = $("#avisHospitalisation").val();
const idProformaHospitalisation = $("#idProformaHospitalisation").val();
const garantieHospitalisation = $("#garantieHospitalisation").val();
const finCarenceHospitalisation = $("#finCarenceHospitalisation").val();
const autoriserBonHospitAvantDate = $("#autoriserBonHospitAvantDate").val();
// Déjà facturé
if (numeroBonHospitalisation === "0" && facture === "1") {
alert_ebene("Déjà facturé!", "Already charged!");
return;
}
// Dossier médical contesté
if (numeroBonHospitalisation === "0" && contestation === "1") {
alert_ebene("Dossier médical contesté !", "Medical records contested!");
return;
}
// Diagnostique exigé
if (affectionObligatoire === "1" && codeAffection === "990" && modeSaisieFacture !== "1") {
alert_ebene("Diagnostique exigé!", "Diagnosis required!");
$("#libelleAffection").focus();
$("#btn_pop_affection").click();
return;
}
// L'assureur n'a pas encore donné son accord
if (ententePrealableCons === "2" || ententePrealableCons === "9") {
const msg = ententePrealableCons === "9"
? ["Non autorisé car l'acte consultation a été refusé par l'assureur!", "Not authorized because the consultation act was refused by the insurer!"]
: ["Veuillez attendre l'accord de l'assureur!", "Please wait for insurer approval!"];
alert_ebene(msg[0], msg[1]);
return;
}
// Carence toujours en cours
if (garantieHospitalisation !== undefined && garantieHospitalisation !== "1970-01-01") {
alert_ebene(
"Le délai de carence est toujours en vigueur pour cet assuré sur cette prescription, la fin est prévue pour le " + finCarenceHospitalisation,
"Waiting period is still in force for this insured on this prescription, the end is scheduled for " + finCarenceHospitalisation
);
return;
}
// Proforma disponible : l'afficher
if (avisHospitalisation === "0" && numeroBonHospitalisation === "0" && idProformaHospitalisation > "0" && facture === "0") {
afficher_proforma_hospitalisation(idProformaHospitalisation);
return;
}
// Cas où l'hospitalisation est programmée dans le futur mais non autorisée
if (avisHospitalisation === "1" && estDateFuture(dateDebutHospit) && autoriserBonHospitAvantDate === "0" && idProformaHospitalisation > "0" && facture === "0") {
alert_ebene(
"Hospitalisation chirurgicale non encore autorisée! Attendez, s'il vous plaît, la date de sa programmation. Merci pour votre compréhension!",
"Surgical hospitalization not yet authorized! Please wait for the scheduling date. Thank you for understanding!"
);
return;
}
// Si un avis dhospitalisation est en attente de validation
if (avisHospitalisation === "2") {
const v_msg = "Un avis d'hospitalisation a déjà été envoyé pour validation! Souhaitez-vous le modifier?";
const v_msgEng = "A notice of hospitalization has already been sent for validation! Would you like to modify it?";
const confirmer = await confirm_ebene_sweet(v_msg, v_msgEng);
if (confirmer) {
hospitalisation(); // Lutilisateur confirme vouloir modifier
} else {
feuillemaladie(); // Sinon on retourne à la feuille de maladie
}
return;
}
// Si lavis a été rejeté
if (avisHospitalisation === "3" && facture === "0") {
alert_ebene("Avis hospitalization rejeté!", "Hospitalization request rejected!");
return;
}
// Si un avis de prorogation a été envoyé
if (avisHospitalisation === "4") {
const v_msg = "Avis de prorogation d'hospitalisation envoyé pour validation! Souhaitez-vous le modifier?";
const v_msgEng = "Notice of extension of hospitalization sent for validation! Would you like to modify it?";
const confirmer = await confirm_ebene_sweet(v_msg, v_msgEng);
if (confirmer) {
hospitalisation();
} else {
feuillemaladie();
}
return;
}
// Aucun cas bloquant : passer à lhospitalisation
hospitalisation();
}
// K@M0us2023
function hospitalisation()
{
feuillemaladie_ajax();
window.location.assign($("#racineWeb" ).val()+"Chambre/");
}
function feuillemaladie()
{
nomForm = $("#nomForm").val();
if(nomForm=="frmactesmedicaux"){
motifActe = $("#motifActe").val();
nbEntentePrealable = parseInt($("#nbEntentePrealable").val());
if(nbEntentePrealable>0 && motifActe <=" ")
{
v_msg="Le renseignement clinique est obligatoire pour que votre demande soit envoy\u00e9e \u00e0 l'assureur.";
v_msgEng="Clinical information is mandatory for your claim to be sent to the insurer.";
alert_ebene(v_msg, v_msgEng);
$("#motifActe").focus();
return;
}
}
window.location.assign($("#racineWeb" ).val()+"Feuillemaladie/");
}
function feuillemaladie_ajax()
{
feuillemaladie();
}
function recherche()
{
window.location.assign($("#racineWeb" ).val()+"Recherche/");
}
function requetes()
{
codeProfil = $("#codeProfil_C" ).val();
if(codeProfil=="PHA")
{
consultationpha();
return;
}
if(codeProfil=="OPT")
{
consultationopt();
return;
}
if(codeProfil=="CSO")
{
consultationcso();
return;
}
if(codeProfil=="LAB")
{
consultationlab();
return;
}
if(codeProfil=="SEA")
{
consultationsea();
return;
}
}
//
function lister_factures_pha_ben()
{
d1=$("#d1").val();
d2=$("#d2").val();
donnees = 'd1='+d1+'&d2='+d2;
$("#div_dossiers").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxconsultationbenpha/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_dossiers").html(data);
},
complete: function() {
}
});
}
function lister_factures_opt_ben()
{
d1=$("#d1").val();
d2=$("#d2").val();
donnees = 'd1='+d1+'&d2='+d2;
$("#div_dossiers").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxconsultationbenopt/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_dossiers").html(data);
},
complete: function() {
}
});
}
function afficher_facture_cons_pha_ben(idFacture, numeroBonOrdonnance, codePrestataireLivraison)
{
if (idFacture>"")
{
donnees = 'idFacture='+idFacture+'&numeroBonOrdonnance='+numeroBonOrdonnance+'&codePrestataireLivraison='+codePrestataireLivraison;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextfacturepha/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
consulter_facture_pha_ben();
}
});
}
}
function afficher_facture_cons_pha(idFacture, numeroBonOrdonnance, codePrestataireLivraison)
{
if (idFacture>"")
{
donnees = 'idFacture='+idFacture+'&numeroBonOrdonnance='+numeroBonOrdonnance+'&codePrestataireLivraison='+codePrestataireLivraison;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextfacturepha/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
consulter_facture_pha();
}
});
}
}
function consulter_facture_pha_ben()
{
window.location.assign($("#racineWeb" ).val()+"Pharmacienconsben/");
}
function consulter_facture_pha()
{
window.location.assign($("#racineWeb" ).val()+"Pharmaciencons/");
}
function afficher_facture_cons_opt_ben(idFacture, numeroBonOptique, numeroOptique, codePrestataireLivraison)
{
if (idFacture>"")
{
donnees = 'idFacture='+idFacture+'&numeroBonOptique='+numeroBonOptique+'&numeroOptique='+numeroOptique;
donnees += '&codePrestataireLivraison='+codePrestataireLivraison;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextfactureopt/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
consulter_facture_opt_ben();
}
});
}
}
function consulter_facture_opt_ben()
{
window.location.assign($("#racineWeb" ).val()+"Opticienconsben/");
}
function consultations()
{
window.location.assign($("#racineWeb" ).val()+"Consultations/");
}
function listerdossiercons_pha()
{
d1=$("#d1").val();
d2=$("#d2").val();
donnees = 'd1='+d1+'&d2='+d2;
donnees_sav = donnees;
$("#detail_reglement").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxconsultationphaentete/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#reglement").html(data);
},
complete: function() {
}
});
$.ajax({
url: $("#racineWeb").val()+"Ajaxconsultationpha/",
type : 'post',
data: donnees_sav,
error: function(errorData) {
},
success: function(data) {
$("#detail_reglement").html(data);
$("#detail_reglement").css("padding-top", "0px");
},
complete: function() {
}
});
}
function listerdossiercons_opt()
{
d1=$("#d1").val();
d2=$("#d2").val();
donnees = 'd1='+d1+'&d2='+d2;
donnees_sav = donnees;
$("#detail_reglement").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxconsultationoptentete/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#reglement").html(data);
},
complete: function() {
}
});
$.ajax({
url: $("#racineWeb").val()+"Ajaxconsultationopt/",
type : 'post',
data: donnees_sav,
error: function(errorData) {
},
success: function(data) {
$("#detail_reglement").html(data);
$("#detail_reglement").css("padding-top", "0px");
},
complete: function() {
}
});
}
function afficher_facture_cons_opt(idFacture, numeroBonOptique, numeroOptique, codePrestataireLivraison)
{
if (idFacture>"")
{
donnees = 'idFacture='+idFacture+'&numeroBonOptique='+numeroBonOptique+'&numeroOptique='+numeroOptique;
donnees += '&codePrestataireLivraison='+codePrestataireLivraison;
$.ajax({
url: $("#racineWeb").val()+"Ajaxcontextfactureopt/",
type : 'post',
data: donnees,
error: function(errorData) {
},
complete: function() {
consulter_facture_opt();
}
});
}
}
function consulter_facture_opt()
{
window.location.assign($("#racineWeb" ).val()+"Opticiencons/");
}
function liste_decompte()
{
window.location.assign($("#racineWeb" ).val()+"Listedecomptes/");
}
function listerdecomptes()
{
codeExercice = $("#codeExercice").val();
// codeMois = $("#codeMois").val();
codeEtatDecompte = $("#codeEtatDecompte").val();
if (codeExercice<=" ")
{
v_msg="Veuillez s\u00e9lectionner un exercice!";
v_msgEng="Please select an exercise!";
alert_ebene(v_msg, v_msgEng);
$("#codeExercice").focus();
return;
}
donnees = 'codeExercice='+codeExercice+'&codeEtatDecompte='+codeEtatDecompte;
$("#div_detail").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlistedecomptes/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_detail").html(data);
},
complete: function() {
}
});
}
function consulterdecompte(idReglement)
{
donnees = 'idReglement='+idReglement;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdecompte/initierdecompte/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
},
complete: function() {
afficher_decompte();
}
});
}
function afficher_decompte()
{
// $("#detail_demande_decompte").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
window.location.assign($("#racineWeb" ).val()+"Decomptecons/");
}
function sortirdexclusionstandards()
{
idBeneficiaire = $("#idBeneficiaire_C").val();
idAdherent_C = $("#idAdherent_C" ).val();
if (idBeneficiaire>"0")
{
afficher_beneficiaire_id();
}
if (idAdherent_C>"0")
{
afficher_adherent_id();
}
else
{
recherche();
}
}
function exclusionstandards()
{
window.location.assign($("#racineWeb" ).val()+"Exclusionstandards/");
}
function envoimaildivers(datamail)
{
// var url_mail = "http://testprestation.medicare.rw/Cron/Ajaxenvoimaildivers.php?"+datamail;
lienMail = $("#lienMail_C").val();
var url_mail = lienMail+"/Cron/Ajaxenvoimaildivers.php?"+datamail;
$.ajax({
url : url_mail,
type : "GET",
error : function(errorData) {
},
success :function(data)
{
}
});
}
function mettremailattente(datamail)
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxmailattente/ajouter/",
type: 'POST',
data: datamail,
success: function(data)
{
},
error: function(errorData)
{
},
complete: function()
{
}
});
}
function preparesms(typeSms)
{
envoismsactif = $("#envoismsactif").val();
if(envoismsactif=="0")
{
return;
}
codeLangueSociete = $("#codeLangueSociete").val();
p_destinataires = "";
p_message = "";
creation_message = "1";
if (typeSms=="demandederogation")
{
p_destinataires = $("#smsDerogation_C").val();
copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val();
if (copieSmsPrestataireAssure=="1")
{
p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires);
}
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
libelleDerogation = $("#libelleDerogation").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Request for exemption : " : "Demande derogation pour : ";
p_message += libelleDerogation;
}
if (typeSms=="ententeprealable")
{
p_destinataires = $("#smsAccordPrealable_C").val();
copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val();
if (copieSmsPrestataireAssure=="1")
{
p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires);
}
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Alert: Prior agreement" : "Alerte : Accord prealable";
}
if (typeSms=="ententeprealableexamen")
{
p_destinataires = $("#smsAccordPrealable_C").val();
copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val();
if (copieSmsPrestataireAssure=="1")
{
p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires);
}
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
fraisTotal = parseInt($("#fraisTotal").val());
montantTotalExamen = parseInt($("#montantTotalExamen").val());
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
if(isNaN(fraisTotal) || fraisTotal==undefined || fraisTotal =="" || fraisTotal < montantTotalExamen){
p_message += (codeLangueSociete=="en_US") ? "Alert: Prior agreement medical examinations" : "Alerte : Accord prealable examens";
}else{
p_message += (codeLangueSociete=="en_US") ? "Alert: Prior agreement medical examinations"+"\nAmount greater than:"+montantTotalExamen+" Fcfa." : "Alerte : Accord prealable examens medicaux"+"\nMontant sup\u00e9rieur \u00e0: "+montantTotalExamen+" Fcfa.";
}
}
if (typeSms=="hospitalisation")
{
p_destinataires = $("#smsMedecinConseil_C").val();
copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val();
if (copieSmsPrestataireAssure=="1")
{
p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires);
}
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
dateDebutHospit = $("#dateDebutHospit").val();
optionHospitalisation = $("#optionHospitalisation").val();
nomForm = $("#nomForm").val();
duree = $("#quantite").val();
dureeHospit = $("#dureeHospit").val();
numeroChambre = $("#numeroChambre").val();
motifHospitalisation= $("#motifHospitalisation").val();
numeroBon = $("#numeroBonHospitalisation").val();
motifProlongation = $("#motifProlongation").val();
codeTypeHospitalisationPro = $("#codeTypeHospitalisationPro").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Alert : Hospitalization notification" : "Alerte: Avis Hospitalisation";
//p_message += numeroBon;
if(nomForm=="chambre"){
if(optionHospitalisation=="option-1"){
type = (codeLangueSociete=="en_US") ? "MEDICAL HOSPITALIZATION" : "HOSPITALISATION MEDICALE";
}
if(optionHospitalisation=="option-3"){
type = (codeLangueSociete=="en_US") ? "SURGICAL HOSPITALIZATION" : "HOSPITALISATION CHIRURGICALE";
}
p_message += "\n";
if(motifProlongation == undefined || motifProlongation ==""){
p_message += (codeLangueSociete=="en_US") ? "Clinical Information: " : "Raison clinique: ";
p_message += motifHospitalisation;
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Type: " : "Type: ";
p_message += type;
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Number of days: " : "Nombre de jours: ";
p_message += dureeHospit;
}else{
if (codeTypeHospitalisationPro=="option-1"){
type = (codeLangueSociete=="en_US") ? "MEDICAL HOSPITALIZATION" : "HOSPITALISATION MEDICALE";
}
if (codeTypeHospitalisationPro=="option-3"){
type = (codeLangueSociete=="en_US") ? "SURGICAL HOSPITALIZATION" : "HOSPITALISATION CHIRURGICALE";
}
p_message += (codeLangueSociete=="en_US") ? "Clinical reason extension: " : "Raison clinique prolongation: ";
p_message += motifProlongation;
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Type: " : "Type: ";
p_message += type;
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Number of days: " : "Nombre de jour: ";
p_message += duree;
}
}
}
if (typeSms=="autorisation")
{
p_destinataires = $("#smsAccordPrealable_C").val();
copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val();
if (copieSmsPrestataireAssure=="1")
{
p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires);
}
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Alert : Request authorization for excluded act" : "Alerte : Demande autorisation pour acte exclu";
}
if (typeSms=="commandebon")
{
p_destinataires = $("#smsGestionBon_C").val();
prestataire = $("#prestataire_C").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Order of claims form " : "Commande de bons de PEC";
p_message += "\n";
p_message += "Quantit. : "+quantite+" ";
p_message += "\n";
p_message += "Type : "+libelleBon+".";
}
if (typeSms=="ententeprealablepha")
{
p_destinataires = $("#smsAccordPrealable_C").val();
copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val();
if (copieSmsPrestataireAssure=="1")
{
p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires);
}
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Alert: Prior agreement for pharmacy" : "Alerte : Accord prealable pharmacie";
}
if (typeSms=="accident")
{
p_destinataires = $("#smsAccordPrealable_C").val();
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Alert: Circulation accident" : "Alerte : Accident de la circulation";
}
if (typeSms=="ententeprealableopt")
{
p_destinataires = $("#smsAccordPrealable_C").val();
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Alert: Prior agreement for glasses" : "Alerte : Accord prealable verres";
}
if (typeSms=="ententeprealablemont")
{
p_destinataires = $("#smsAccordPrealable_C").val();
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Alert: Prior agreement for optical frames" : "Alerte : Accord prealable monture";
}
if (typeSms=="demandesubstitution")
{
p_destinataires = $("#smsAccordPrealable_C").val();
patient = $("#beneficiaire_C").val();
numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val();
prestataire = $("#prestataire_C").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Alert: Higher substitution drug price" : "Alerte: Prix m\u00e9dicament substitution sup\u00e9rieur";
}
if (typeSms=="proformahospitalisation")
{
p_destinataires = $("#smsAccordPrealable_C").val();
nomForm = $("#nomForm").val();
copieSmsPrestataireAssure = $("#copieSmsPrestataireAssure").val();
if (copieSmsPrestataireAssure=="1")
{
p_destinataires = ajouter_destinataire_sms_adherent(p_destinataires);
}
if(nomForm=="proformahospitalisation"){
patient = $("#nomAssure").val();
numeroBeneficiaire = $("#searchInputB" ).val();
}else{
patient = $("#beneficiaire").val();
numeroBeneficiaire = $("#numeroBeneficiaire" ).val();
}
prestataire = $("#prestataire_C").val();
idProforma = $("#idProforma").val();
p_message = prestataire+" ";
p_message += "\n";
p_message += "Assuré : "+patient+" ("+numeroBeneficiaire+") ";
p_message += "\n";
p_message += (codeLangueSociete=="en_US") ? "Alert: Proforma Hospitalization No: "+idProforma : "Alerte : Proforma Hospitalisation No: "+idProforma;
}
envoyersms(p_destinataires, p_message, creation_message);
}
function liste_ententeprealable()
{
window.location.assign($("#racineWeb" ).val()+"Listeententeprealables/");
}
function liste_exclusions()
{
window.location.assign($("#racineWeb" ).val()+"Listeexclusions/");
}
function alerter_depassement_limite()
{
fraisExcluLivre=$("#fraisExcluLivre").val();
fraisExcluLivre = parseInt(fraisExcluLivre);
if (fraisExcluLivre>0)
{
v_msg="Attention ! D\u00e9passement de limite";
v_msgEng="Warning ! Overflow";
alert_ebene(v_msg, v_msgEng);
return;
}
}
function alerter_depassement_limite_cso()
{
fraisExclu=$("#fraisExclu").val();
fraisExclu = parseInt(fraisExclu);
/*
if (fraisExclu>0)
{
v_msg="Attention ! D\u00e9passement de limite";
v_msgEng="Warning ! Overflow";
alert_ebene(v_msg, v_msgEng);
return;
}
*/
}
function maj_fraisexclu_cso()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdepassementlimitefeuillemaladie/",
error: function(errorData) {
},
success: function(data) {
$("#div_fraisExclu").html(data);
},
complete: function() {
alerter_depassement_limite_cso();
}
});
}
// Fonction pour gérer laccès à la page des consommables
async function consommables() {
// Vérifie si l'entente préalable est toujours en attente ou refusée
const ententePrealableCons = $("#ententePrealableCons").val();
if (ententePrealableCons === "2" || ententePrealableCons === "9") {
const msg = ententePrealableCons === "2"
? ["Veuillez attendre l'accord de l'assureur!", "Please wait for insurer approval!"]
: ["Non autorisé car l'acte consultation a été refusé par l'assureur!", "Not authorized because the consultation act was refused by the insurer!"];
alert_ebene(msg[0], msg[1]);
return;
}
const modeSaisieFacture = $("#modeSaisieFacture").val();
const facture = $("#facture").val();
const contestation = $("#contestation").val();
// Dossier médical contesté
if (facture === "0" && contestation === "1") {
alert_ebene("Dossier médical contesté !", "Medical records contested!");
return;
}
// Acte déjà facturé
if (modeSaisieFacture === "0" && facture === "1") {
alert_ebene("Déjà facturé!", "Already charged!");
return;
}
const bonCaduc = $("#bonCaduc").val();
// Bon caduc = plus valide
if (bonCaduc === "1" && modeSaisieFacture !== "1") {
alert_ebene("Bon caduc!", "Obsolete!");
return;
}
const hospitalisation = $("#hospitalisation").val();
// Période dhospitalisation active
if (hospitalisation === "1") {
alert_ebene_callback(
"Non autorisé car la période d'hospitalisation est en cours.",
"Not authorized because the period of hospitalization is in progress.",
function () {
window.location.assign($("#racineWeb").val() + "Feuillemaladie/");
}
);
return;
}
const actVisible = $("#actVisible").val();
// Vérifie les droits de l'utilisateur
if (actVisible !== "1") {
alert_ebene(
"Non autorisé car l'utilisateur n'a pas les droits requis. Veuillez contacter l'assureur!",
"Not authorized because the user does not have the required rights. Please contact the insurer!"
);
return;
}
// Vérifie si les consommables sont facturables
const facturerConsommable = $("#facturerConsommable").val();
if (facturerConsommable !== "1") {
alert_ebene("Consommables non facturés!", "Consumables not invoiced!");
return;
}
const ajoutConsommable = $("#ajoutConsommable").val();
// Cas particulier : consommable déjà inclus dans les actes
if (ajoutConsommable !== "1") {
const v_msg = "Déjà inclu dans les actes ! Souhaitez-vous continuer?";
const v_msgEng = "Already included in the acts ! Would you like to continue?";
const confirm = await confirm_ebene_sweet(v_msg, v_msgEng);
if (confirm) {
window.location.assign($("#racineWeb").val() + "Consommables/");
}
// Si lutilisateur refuse, on reste sur place
return;
}
// Aucun blocage → accès direct à la page des consommables
window.location.assign($("#racineWeb").val() + "Consommables/");
}
function afficher_recherche_consommable()
{
nomConsommable = $("#nomConsommable").val();
if (nomConsommable > " ")
{
donnees = "nomConsommable="+nomConsommable;
$("#div_listeconsommable").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlisteconsommables/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_listeconsommable").html(data);
}
});
}
}
function ajouter_consommable(idConsommable, libelleConsommable) {
if (libelleConsommable <= " ") {
v_msg = "Veuillez s\u00e9lectionner un consommable!";
v_msgEng = "Please select a consumable!";
alert_ebene(v_msg, v_msgEng);
return;
}
v_msg = "Ajouter : " + libelleConsommable + "?";
v_msgEng = "Add : " + libelleConsommable + "?";
confirm_ebene_sweet(v_msg, v_msgEng).then(function(isConfirm) {
if (isConfirm) {
donnees = 'idConsommable=' + idConsommable;
$.ajax({
url: $("#racineWeb").val() + "Ajaxlisteconsommables/ajouterconsommable/",
type: 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
maj_fraisexclu_cso();
},
complete: function() {
// afficher_consommable();
feuillemaladie();
}
});
} else {
return;
}
});
}
function ajax_maj_qte_consommable(idConsommable, 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 = 'idConsommable='+idConsommable+"&quantite="+quantite;
$.ajax({
url: $("#racineWeb").val()+"Ajaxlisteconsommables/majquantite/",
type: 'POST',
data: donnees,
success: function(data) {
// $('#div_test_gabarit').html(data);
},
error: function(data) {
},
complete: function() {
afficher_consommable();
}
});
}
}
function ctrlkeypressconsommable(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
afficher_recherche_consommable();
}
}
function afficher_consommable()
{
$("#div_listeconsommable").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxafficherconsommables/",
error: function(errorData) {
},
success: function(data) {
$("#div_listeconsommable").html(data);
$("#libelleconsommable").focus();
}
});
}
function changer_type_bon()
{
$("#nbligne_info").val("0");
afficherbon_vide();
}
function afficher_pop_recherche_medecin()
{
codeMedecin = $("#codeMedecin").val();
nomsearch = $("#nomsearch").val();
if(codeMedecin+nomsearch<=" ")
return;
donnees = "valid=1&codeMedecin="+codeMedecin+"&nomsearch="+nomsearch;
$("#div_listemedecins").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlistemedecins/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_listemedecins").html(data);
},
complete: function() {
}
});
}
function afficher_pop_recherche_actes_possibles()
{
libelleActeSearch = $("#libelleActeSearch").val();
if(libelleActeSearch<=" ")
{
return;
}
donnees = "valid=1&libelleActeSearch="+libelleActeSearch;
$("#div_liste_actes_possibles").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlisteactespossibles/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_liste_actes_possibles").html(data);
}
});
}
function ctrlkeypress_medecin(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
afficher_pop_recherche_medecin();
}
}
function ctrlkeypress_actes_cons(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
afficher_pop_recherche_actes_cons();
}
}
function ctrlkeypress_actes_possibles(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
afficher_pop_recherche_actes_possibles();
}
}
function selectionner_medecin(codeMedecin, nomMedecin, noOrdreMedecin) {
// Vérification si les paramètres sont vides
if (noOrdreMedecin + codeMedecin <= " ") {
return;
}
// Préparation des messages en français et anglais
v_msg = "Confirmez-vous ce Médecin : " + nomMedecin + "?";
v_msgEng = "Do you confirm this Doctor : " + nomMedecin + "?";
// Appel de la fonction de confirmation unifiée
confirm_ebene_sweet(v_msg, v_msgEng).then(function(isConfirm) {
if (isConfirm) {
// Si l'utilisateur confirme
$("#codeMedecin").val(codeMedecin);
$("#nomMedecin").html(nomMedecin + " ( " + codeMedecin + " )");
// Fermeture de la popup
$("#close_pop").click();
} else {
// Si l'utilisateur annule
return;
}
});
}
function maj_prix_actemedical()
{
prixTarif = $("#prixTarif").val();
prixNew = $("#prixNew").val();
if(prixNew==0 || parseFloat(prixNew)>parseFloat(prixTarif))
{
v_msg="Veuillez revoir le tarif!";
v_msgEng="Please review rate!";
alert_ebene(v_msg, v_msgEng);
$("#prixNew").focus();
return;
}
div_quantite = $("#quantite");
quantite = div_quantite.val();
if(quantite=="")
{
quantite = "0";
}
div_quantite.val(quantite);
quantite = parseInt(quantite);
if(quantite==0)
{
div_quantite.focus();
v_msg="Veuillez saisir la quantit\u00e9!";
v_msgEng="Please enter quantity!";
alert_ebene(v_msg, v_msgEng);
$("#quantite").focus();
return;
}
ententePrealable = $("#ententePrealable").val();
acteExclu = $("#acteExclu").val();
acteChirurgie = $("#acteChirurgie").val();
donnees = 'prixNew='+prixNew+'&quantite='+quantite+'&prixTarif='+prixTarif;
donnees += '&ententePrealable='+ententePrealable+'&acteExclu='+acteExclu+'&acteChirurgie='+acteChirurgie;
$.ajax({
url: $("#racineWeb").val()+"Ajaxmajprixactemed/",
type : 'post',
data : donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosacte").html(data);
},
complete: function() {
$("#btn_close_pop_tarif").click();
}
});
}
function afficher_pop_tarif()
{
prixActe = $("#prixActe").val();
$("#prixNew").val(prixActe);
$("#btn_pop_tarif").click();
}
function demanderaccordacteexclu()
{
v_msg="Acte non couvert!";
v_msgEng="Not covered!";
alert_ebene(v_msg, v_msgEng);
$("#codeActe").focus();
return;
}
function demanderaccordchambreexclu()
{
v_msg="Attention! Chambre exclue. Demander un accord?";
v_msgEng="Warning! Non covered room. Request Agreement?";
alert_ebene(v_msg, v_msgEng);
return;
}
// Fonction pour gérer la substitution dun médicament
async function substituer_medicament(idMedicament, posologie, idDemandeSubstitution, quantite) {
const bonCaduc = $('#bonCaduc').val();
// Messages par défaut
let v_msg = "Substituer ce médicament ?";
let v_msgEng = "Substitute this drug ?";
// Cas dun bon caduc : blocage immédiat
if (bonCaduc === "1") {
v_msg = "Substitution impossible, le bon est caduc !";
v_msgEng = "Impossible substitution, the voucher is void!";
alert_ebene(v_msg, v_msgEng);
return;
}
// Si une demande de substitution est déjà présente → appel direct sans confirmation
if (idDemandeSubstitution > "0") {
const donnees = 'idMedicament=' + idMedicament +
'&posologie=' + posologie +
'&idDemandeSubstitution=' + idDemandeSubstitution +
'&quantite=' + quantite;
$.ajax({
url: $("#racineWeb").val() + "Ajaxsubstitutionmedicament/",
type: 'post',
data: donnees,
error: function(errorData) {
// En cas derreur silencieuse
},
success: function(data) {
// Mise à jour du formulaire de substitution avec les nouveaux éléments
$("#div_substitution").html(data);
$("#div_substitution #frmmedicament #libelleMedicamentSearch").focus();
},
complete: function () {
$("#btn_pop").click();
etatreponsesubstitution();
}
});
return;
}
// Sinon, demande de confirmation utilisateur via SweetAlert custom
const confirm = await confirm_ebene_sweet(v_msg, v_msgEng);
if (!confirm) {
// L'utilisateur a refusé → on quitte
return;
}
// L'utilisateur a confirmé → envoi AJAX avec idDemandeSubstitution = 0
const donnees = 'idMedicament=' + idMedicament +
'&posologie=' + posologie +
'&idDemandeSubstitution=0' +
'&quantite=' + quantite;
$.ajax({
url: $("#racineWeb").val() + "Ajaxsubstitutionmedicament/",
type: 'post',
data: donnees,
error: function(errorData) {
// Erreur AJAX silencieuse
},
success: function(data) {
$("#div_substitution").html(data);
$("#libelleMedicamentSearch").focus();
},
complete: function () {
$("#btn_pop").click();
}
});
}
function annuler_substitution_medicament(idMedicament) {
// Messages de confirmation
const v_msg = "Annuler cette substitution?";
const v_msgEng = "Cancel this substitution?";
// Appel de la confirmation unifiée
confirm_ebene_sweet(v_msg, v_msgEng).then(function(isConfirm) {
if (isConfirm) {
// Préparation des données pour la requête AJAX
const donnees = 'idMedicament=' + idMedicament;
// Requête AJAX
$.ajax({
url: $("#racineWeb").val() + "Ajaxdetailpharmacien/annulersubstitutionmedicament/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
// Gestion d'erreur (peut être améliorée si nécessaire)
},
complete: function() {
alerter_depassement_limite();
}
});
}
// Si l'utilisateur annule, ne rien faire (return implicite)
});
}
function enregistrersubstituion_medicament() {
// Récupération des valeurs du formulaire
const idMedicament = $("#idMedicament").val();
// Traitement du prix tarif
let prixTarif = $("#prixTarif").val();
prixTarif = parseInt(prixTarif.replace(/ /g, "").replace(",", "."), 10);
const idSubstitut = $("#idSubstitut").val();
// Traitement du prix substitut
let prixSubstitut = $("#prixSubstitut").val();
prixSubstitut = parseInt(prixSubstitut.replace(/ /g, "").replace(",", "."), 10);
const qteMedicamentSubstitut = $("#qteMedicamentSubstitut").val();
const nvellePosologie = $("#nvellePosologie").val();
// Validation du prix substitut
if (prixSubstitut === 0) {
const v_msg = "Veuillez revoir le tarif!";
const v_msgEng = "Please review rate!";
alert_ebene(v_msg, v_msgEng);
$("#prixSubstitut").focus();
return false;
}
// Messages de confirmation
const v_msg = "Confirmez-vous cette substitution?";
const v_msgEng = "Do you confirm this substitution?";
// Appel de la confirmation unifiée
confirm_ebene_sweet(v_msg, v_msgEng).then(function(isConfirm) {
if (isConfirm) {
// Préparation des données pour la requête AJAX
let donnees = `idMedicament=${idMedicament}&prixTarif=${prixTarif}&idSubstitut=${idSubstitut}&prixSubstitut=${prixSubstitut}`;
donnees += `&nvellePosologie=${nvellePosologie}&qteMedicamentSubstitut=${qteMedicamentSubstitut}`;
// Envoi de la requête AJAX
$.ajax({
url: $("#racineWeb").val() + "Ajaxdetailpharmacien/enregistrersubstitutionmedicament/",
type: 'POST',
data: donnees,
success: function(data) {
$("#btn_close_pop").click();
},
error: function(data) {
// Gestion d'erreur (peut être améliorée si nécessaire)
},
complete: function() {
$("#btn_ordonnance").click();
$("#btn_livarison").click();
alerter_depassement_limite();
window.location.assign($("#racineWeb").val() + "Pharmacien/");
}
});
}
// Si l'utilisateur annule, ne rien faire
});
}
function actualise_livraisonpha_substituer()
{
donnees = '';
$.ajax({
url: $("#racineWeb").val()+"Ajaxlivraisonphasubstitues/",
type: 'POST',
data: donnees,
success: function(data) {
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
//alerter_depassement_limite();
}
});
}
function selectionner_acte_cons(codeFamilleActe, codeActe, familleActe, libelleActe) {
// Vérification si le libellé de l'acte est vide
if (libelleActe <= " ") return;
// Initialisation des valeurs du formulaire
$("#codeFamilleActe").val(codeFamilleActe);
ajaxactespossibles();
// Préparation des messages de confirmation
const v_msg = `Confirmez-vous cet acte : ${libelleActe}?`;
const v_msgEng = `Do you confirm this act : ${libelleActe}?`;
// Appel de la confirmation unifiée
confirm_ebene_sweet(v_msg, v_msgEng).then(function(isConfirm) {
if (isConfirm) {
// Si confirmation, mise à jour des champs et fermeture de la popup
$("#codeActe").val(codeActe);
ajaxprixacte();
$("#libelleActe").val(libelleActe);
$("#close_pop_acte").click();
}
// Si annulation, ne rien faire (return implicite)
});
}
function afficher_pop_recherche_actes_cons()
{
libelleActeSearch = $("#libelleActeSearch").val();
if(libelleActeSearch<=" ")
{
return;
}
donnees = "valid=1&libelleActeSearch="+libelleActeSearch;
$("#div_liste_actes_cons").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlisteactescons/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_liste_actes_cons").html(data);
}
});
}
function selectionner_acte_possibles(codeFamilleActe, codeActe, familleActe, libelleActe) {
// Vérification si le libellé est vide
if (libelleActe <= " ") return;
// Initialisation des valeurs
$("#codeFamilleActe").val(codeFamilleActe);
ajaxactespossibles_med(); // Appel spécifique à la version médicale
// Messages de confirmation
const v_msg = `Confirmez-vous cet acte : ${libelleActe}?`;
const v_msgEng = `Do you confirm this act : ${libelleActe}?`;
// Confirmation unifiée
confirm_ebene_sweet(v_msg, v_msgEng).then(isConfirm => {
if (isConfirm) {
$("#codeActe").val(codeActe);
ajaxprixactemed(); // Appel spécifique à la version médicale
$("#libelleActe").val(libelleActe);
$("#close_pop_acte").click();
}
});
}
function ctrlkeypress_pha(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
afficher_pop_recherche_medicament_pha();
}
}
function afficher_pop_recherche_medicament_pha()
{
nomsearch = $("#nomsearch").val();
if (nomsearch > " ")
{
donnees = "valid=1&nomsearch="+nomsearch;
$("#div_listemedicament").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlistemedicamentspha/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_listemedicament").html(data);
}
});
}
}
function prescrire_medicament_pha() {
// Récupération des valeurs du formulaire
const codePrestatairePrescription = $("#codePrestatairePrescription").val();
const codeMedicament = $("#codeMedicament_pop").val();
const libelleMedicament = $("#libelleMedicament_pop").val();
// Validation du médicament sélectionné
if (codeMedicament <= " ") {
const v_msg = "Veuillez sélectionner un médicament!";
const v_msgEng = "Please select a medicine/drug!";
alert_ebene(v_msg, v_msgEng);
return;
}
// Préparation des données AJAX
const donnees = `codeMedicament=${codeMedicament}&codePrestatairePrescription=${codePrestatairePrescription}`;
// Messages de confirmation
const v_msg = `Prescrire : ${libelleMedicament}?`;
const v_msgEng = `Prescribe : ${libelleMedicament}?`;
// Confirmation unifiée
confirm_ebene_sweet(v_msg, v_msgEng).then(isConfirm => {
if (!isConfirm) return;
// Requête AJAX
$.ajax({
url: `${$("#racineWeb").val()}Ajaxdetailpharmacien/ajoutermedicamentprescription/`,
type: 'post',
data: donnees,
error: function(errorData) {
// Gestion d'erreur (peut être améliorée)
},
success: function(data) {
$("#btn_close_pop_medicament").click();
$("#livraison").html(data);
raffraichier_detail_prescription();
},
complete: function() {
alerter_depassement_limite();
}
});
});
}
function raffraichier_detail_prescription()
{
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailordonnance/",
type : 'post',
// data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#ordonnance").html(data);
},
complete: function() {
}
});
}
function actualiser_pharmacien()
{
/* modif du 15/11/2018
// window.location.assign($("#racineWeb" ).val()+"Pharmacien/");
actualiser_saisie_pharmacien();
*/
actVisible=$("#actVisible").val();
// if (actVisible!="1" && modeSaisieFacture!="1")
if (actVisible!="1")
{
v_msg="Non autoris\u00e9e!";
v_msgEng="Not allowed!";
alert_ebene(v_msg, v_msgEng);
return;
}
window.location.assign($("#racineWeb" ).val()+"Pharmacien/");
}
function ajax_maj_qte_medicament_pha(idMedicament, 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 = 'idMedicament='+idMedicament+"&quantite="+quantite;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailpharmacien/majquantitepha/",
type: 'POST',
data: donnees,
success: function(data) {
// $("#medicaments").html(data);
$("#livraison").html(data);
},
error: function(data) {
},
complete: function() {
alerter_depassement_limite();
controle.focus();
}
});
}
}
function prescription_examen()
{
affectionObligatoire=$("#affectionObligatoire").val();
codeAffection=$("#codeAffection").val();
modeSaisieFacture=$("#modeSaisieFacture").val();
numeroBonExamen=$("#numeroBonExamen").val();
facture=$("#facture").val();
if (numeroBonExamen == "0" && facture==1)
{
v_msg="D\u00e9j\u00e0 factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
contestation = $("#contestation").val();
if(numeroBonExamen == "0" && contestation == "1"){
const v_msg = "Dossier médical contesté !";
const v_msgEng = "Medical records contested!";
alert_ebene(v_msg, v_msgEng);
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;
}
///////////////
actVisible=$("#actVisible").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 (actVisible!="1" && modeSaisieFacture!="1")
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;
}
window.location.assign($("#racineWeb" ).val()+"Prescriptionexamen/");
}
function valider_presciption_examens() {
// Validations initiales
const bonCaduc = $("#bonCaduc").val();
if (bonCaduc == 1) {
alert_ebene("Bon caduc!", "Obsolete!");
return;
}
const badcodeGestionBon = $("#badcodeGestionBon").val();
if (badcodeGestionBon == "1") {
alert_ebene("Veuillez revoir le type de gestion de bons!", "Please review the type of forms management!");
return;
}
const facture = $("#facture").val();
if (facture == 1) {
alert_ebene("Déjà facturé!", "Already charged!");
return;
}
const numeroBonExamen = $("#numeroBonExamen").val();
if (numeroBonExamen <= 0) {
alert_ebene("Pas de prescription!", "No prescription!");
feuillemaladie();
return;
}
const motifExamen = $("#motifExamen").val();
if (motifExamen <= " ") {
alert_ebene("Veuillez entrer le motif de la prescription d'examen!",
"Please enter the reason for the examination prescription!");
$("#codeActe").val("");
$("#motifExamen").focus();
return;
}
// Confirmation finale
const numeroEnteteEntentePrealable = $("#numeroEnteteEntentePrealable").val();
confirm_ebene_sweet("Confirmez-vous cette presciption ?", "Do you confirm this prescription?")
.then(isConfirm => {
if (!isConfirm) return;
envoieprescription_examen();
if (numeroEnteteEntentePrealable == "0") {
alert_ebene("Demande accord prealable envoyée!", "Request prior agreement sent!");
}
feuillemaladie();
});
}
function majMotifExamen(){
motifExamen = $("#motifExamen").val();
donnees = 'motifExamen='+motifExamen;
//$("#examens").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionexamen/majmotifexamen/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data)
{
},
complete: function()
{
}
});
}
function majMotifSeance(){
codeGestionBon = "2";
numeroBon = $("#numeroBon").val();
codeMedecin = $("#codeMedecin").val();
motifSeance = $("#motifSeance").val();
donnees = 'numeroBon='+numeroBon+'&codeMedecin='+codeMedecin+'&motifSeance='+motifSeance+'&codeGestionBon='+codeGestionBon;
$.ajax({
url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionseance/majmotifseance/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data)
{
window.location.assign($("#racineWeb" ).val()+"Prescriptionsence/");
},
complete: function()
{
}
});
}
function majMotifMiseEnObservation(){
motif = $("#motif").val();
donnees = 'motif='+motif;
$.ajax({
url: $("#racineWeb").val()+"Ajaxselectactesmedicauxobservation/majmotif/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data)
{
},
complete: function()
{
}
});
}
function majMotifHospitalisation(){
motifHospitalisation = $("#motifHospitalisation").val();
donnees = 'motifHospitalisation='+motifHospitalisation;
$.ajax({
url: $("#racineWeb").val()+"Ajaxenregistrerhospitalisation/majmotif/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data)
{
},
complete: function()
{
}
});
}
function majMotifOptique(){
codeGestionBon = "2";
numeroBon = $("#numeroBon").val();
codeMedecin = $("#codeMedecin").val();
motifOptique = $("#motifOptique").val();
donnees = 'numeroBon='+numeroBon+'&codeMedecin='+codeMedecin+'&motifOptique='+motifOptique+'&codeGestionBon='+codeGestionBon;
$.ajax({
url: $("#racineWeb").val()+"Ajaxenregistreroptique/majmotifoptique/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data)
{
window.location.assign($("#racineWeb" ).val()+"Optique/");
},
complete: function()
{
}
});
}
function chargeactesexamen(libelle)
{
if(libelle=="acte"){
libelle = $("#searchExam").val();
}
if(libelle==""){
return;
}
donnees = 'libelle='+libelle;
$.ajax({
url: $("#racineWeb").val()+"Ajaxchargeractesexamen/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data)
{
$("#div_select_examen").html(data);
//$("#codeActe").selectpicker();
$("#codeActe").focus();
//$("#codeActe").click();
},
complete: function()
{
//chargeactesexamen();
}
});
}
function ajaxPrescriptionexamen()
{
donnees = '';
$.ajax({
url: $("#racineWeb").val()+"Ajaxprescriptionexamen/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data)
{
$("#div_prescription").html(data);
},
complete: function()
{
//chargeactesexamen();
}
});
}
function ajaxinfosbonprescriptionexamen()
{
bonCaduc=$("#bonCaduc").val();
// alert("bonCaduc => "+bonCaduc);
// return;
if (bonCaduc==1)
{
v_msg="Bon caduc!";
v_msgEng="Obsolete!";
alert_ebene(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;
}
codeGestionBon = $("#codeGestionBon").val();
if (codeGestionBon!="0")
{
v_msg="Option non disponible!";
v_msgEng="Option not available!";
alert_ebene(v_msg, v_msgEng);
return;
}
numeroBonExamen = $("#numeroBonExamen").val();
numeroBonExamen = parseInt(numeroBonExamen);
if (numeroBonExamen>0)
{
v_msg="D\u00e9jà effectu\u00e9!";
v_msgEng="Already done!";
alert_ebene(v_msg, v_msgEng);
return;
}
facture=$("#facture").val();
if (facture==1)
{
v_msg="D\u00e9jà factur\u00e9!";
v_msgEng="Already charged!";
alert_ebene(v_msg, v_msgEng);
return;
}
codeMedecin = $("#codeMedecin").val();
if (codeMedecin<=" ")
{
v_msg="Veuillez s\u00e9lectionner un m\u00e9decin!";
v_msgEng="Please select a doctor!";
alert_ebene(v_msg, v_msgEng);
$("#numeroBon").val("");
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
// $("#codeMedecin").focus();
$("#nomMedecin").focus();
return;
}
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);
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
return;
}
donnees = "numeroBon="+numeroBon;
$.ajax({
url: $("#racineWeb").val()+"Ajaxinfosbonexamen/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#infosbon").html(data);
},
complete: function() {
}
});
}
function supprimer_examen(idExamen) {
// Messages de confirmation
const v_msg = "Confirmez-vous la suppression de cet examen?";
const v_msgEng = "Do you confirm the removal of this exam?";
// Confirmation unifiée
confirm_ebene_sweet(v_msg, v_msgEng).then(isConfirm => {
if (!isConfirm) return;
// Requête AJAX
$.ajax({
url: `${$("#racineWeb").val()}Ajaxdetailprescriptionexamen/supprimer/`,
type: 'POST',
data: `idExamen=${idExamen}`,
success: function(data) {
$("#examens").html(data);
},
error: function(data) {
// Gestion d'erreur (peut être améliorée si nécessaire)
},
complete: function() {
prescription_examen();
}
});
});
}
function enregistrerprescriptionexamen() {
// Fonction interne pour gérer les bons invalides
function handleInvalidBon(frenchMsg, englishMsg) {
alert_ebene(frenchMsg, englishMsg);
$("#btn_enreg").disable();
$("#msgErreur").html("");
$("#codeEtatBon").val("");
$("#numeroBon").focus();
}
// Validation initiale
const badcodeGestionBon = $("#badcodeGestionBon").val();
if (badcodeGestionBon == "1") {
alert_ebene("Veuillez revoir le type de gestion de bons!", "Please review the type of forms management!");
return;
}
const codeMedecin = $("#codeMedecin").val();
if (codeMedecin <= " ") {
alert_ebene("Veuillez sélectionner un médecin!", "Please select a doctor!");
$("#nomMedecin").focus();
return;
}
const motifExamen = $("#motifExamen").val();
if (motifExamen <= " ") {
alert_ebene("Saisissez le motif de la prescription de l'examen!", "Enter the reason for ordering the examination!");
$("#motifExamen").focus();
return;
}
// Gestion du numéro de bon
const codeGestionBon = $("#codeGestionBon").val();
let numeroBon = "-1";
let confirmationMsg, confirmationMsgEng;
if (codeGestionBon == "0") {
numeroBon = $("#numeroBon").val();
const numeroBonSave = $("#numeroBonSave").val();
const codeEtatBon = $("#codeEtatBon").val();
if (isNaN(numeroBon)) {
handleInvalidBon("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
return;
}
if (numeroBon <= "0") {
alert_ebene("Veuillez saisir un No de bon!", "Please enter a prescription number!");
$("#numeroBon").focus();
return;
}
if (codeEtatBon != "1") {
alert_ebene("Veuillez saisir un No de bon disponible!", "Please enter a prescription number available!");
$("#numeroBon").focus();
return;
}
if (numeroBonSave != numeroBon) {
handleInvalidBon("Veuillez revoir le numéro de bon!", "Please review the prescription number!");
return;
}
confirmationMsg = "Confirmez-vous ce No de bon?";
confirmationMsgEng = "Do you confirm this number of prescription?";
} else {
confirmationMsg = "Confirmez-vous cette prescription?";
confirmationMsgEng = "Do you confirm this prescription?";
}
// Confirmation et envoi AJAX
confirm_ebene_sweet(confirmationMsg, confirmationMsgEng).then(isConfirm => {
if (!isConfirm) return;
const donnees = `numeroBon=${numeroBon}&codeMedecin=${codeMedecin}&motifExamen=${motifExamen}&codeGestionBon=${codeGestionBon}`;
$("#btn_enreg").disable();
$.ajax({
url: `${$("#racineWeb").val()}Ajaxenregistrerprescriptionexamen/enregistrerprescriptionexamen/`,
type: 'post',
data: donnees,
error: function(errorData) {},
success: function(data) {},
complete: function() {
alert_ebene("Prescription enregistrée avec succès", "Saved successfully!");
prescription_examen();
}
});
});
}
function genereBonAutomatiqueExamen(codeGestionBon,codeMedecin,numeroBon)
{
motifExamen = $("#motifExamen").val();
if (motifExamen==undefined)
{
motifExamen ="";
}
donnees = 'numeroBon='+numeroBon+'&codeMedecin='+codeMedecin+'&motifExamen='+motifExamen;
// ajout du 27/06/2019 => prise en compte de la gestion paperless
donnees += '&codeGestionBon='+codeGestionBon;
$.ajax({
url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionexamen/enregistrerprescriptionexamen/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data)
{
},
complete: function() {
window.location.assign($("#racineWeb" ).val()+"Prescriptionexamen/");
}
});
}
function ctrlkeypress_examens_possibles(ev)
{
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if(keycode == '13')
{
afficher_pop_recherche_examens_possibles();
}
}
function afficher_pop_recherche_examens_possibles()
{
libelleActeSearch = $("#libelleActeSearch").val();
if(libelleActeSearch<=" ")
{
return;
}
donnees = "valid=1&libelleActeSearch="+libelleActeSearch;
$("#div_liste_actes_possibles").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlisteexamenspossibles/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_liste_actes_possibles").html(data);
dataTableSpeciale();
}
});
}
function afficher_pop_recherche_autres_possibles()
{
libelleActeSearch = $("#libelleActeSearch").val();
if(libelleActeSearch<=" ")
{
return;
}
donnees = "valid=1&libelleActeSearch="+libelleActeSearch;
$("#div_liste_actes_possibles").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlisteexamenspossibles/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_liste_actes_possibles").html(data);
dataTableSpeciale();
}
});
}
function afficher_pop_recherche_bio_possibles()
{
libelleActeSearch = $("#libelleActeSearch").val();
if(libelleActeSearch<=" ")
{
return;
}
donnees = "bio=1&libelleActeSearch="+libelleActeSearch;
$("#div_liste_actes_possibles").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlisteexamenspossibles/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_liste_actes_possibles").html(data);
dataTableSpeciale();
}
});
}
function afficher_pop_recherche_ima_possibles()
{
libelleActeSearch = $("#libelleActeSearch").val();
if(libelleActeSearch<=" ")
{
return;
}
donnees = "ima=1&libelleActeSearch="+libelleActeSearch;
$("#div_liste_actes_possibles").html('<div style="text-align:center; color: #4caf50 ; font-size:14px;"><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlisteexamenspossibles/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_liste_actes_possibles").html(data);
dataTableSpeciale();
}
});
}
async function ajouter_examen_possible(codeActe, libelleActe, acteExclu, ententePrealable) {
if(libelleActeSearch <= " ") {
return;
}
if(acteExclu == 1) {
v_msg = "Acte non couvert!";
v_msgEng = "Not covered!";
alert_ebene(v_msg, v_msgEng);
return;
}
v_msg = "Confirmez-vous cet acte : "+libelleActe+"?";
v_msgEng = "Do you confirm this act : "+libelleActe+"?";
const isConfirmed = await confirm_ebene_sweet(v_msg, v_msgEng);
if (!isConfirmed) {
return;
}
donnees = 'codeActe='+codeActe+'&ententePrealable='+ententePrealable;
try {
const data = await $.ajax({
url: $("#racineWeb").val()+"Ajaxdetailprescriptionexamen/ajouterexamen/",
type: 'post',
data: donnees
});
if(ententePrealable == 1) {
v_msg = "Demande accord prealable envoy\u00e9e!";
v_msgEng = "Request prior agreement sent!";
alert_ebene(v_msg, v_msgEng);
}
prescription_examen();
} catch(errorData) {
// Gestion des erreurs
} finally {
prescription_examen();
}
}
function ajax_maj_qte_examen(idExamen, 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 = 'idExamen='+idExamen+"&quantite="+quantite;
$.ajax({
url: $("#racineWeb").val()+"Ajaxdetailprescriptionexamen/majquantite/",
type: 'POST',
data: donnees,
success: function(data) {
$("#examens").html(data);
},
error: function(data) {
},
complete: function() {
controle.focus();
}
});
}
}
function examensmedicaux()
{
hospitalisation = $("#hospitalisation").val();
numeroBonExamen = $("#numeroBonExamen").val();
if (hospitalisation=="1" && numeroBonExamen=="0")
{
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(v_msg, v_msgEng);
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_m