From b928c6faac31a3a91053dd73c7110463d297b92a Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 21 Apr 2026 09:57:01 +0000 Subject: [PATCH] a --- Js/fonctions.js | 18817 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 18817 insertions(+) diff --git a/Js/fonctions.js b/Js/fonctions.js index e69de29..761a356 100644 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -0,0 +1,18817 @@ +function alert_ebene(p_msg, p_msg_eng) +{ + codeLangue = $("#codeLangue").val(); + + if(codeLangue=="en_US") + { + alert(p_msg_eng); + } + else + { + alert(p_msg); + } +} + +function alert_ebene_ajax(p_msg, p_msg_eng) +{ + codeLangue = $("#codeLangue").val(); + + if(codeLangue=="en_US") + { + alert(p_msg_eng); + } + else + { + alert(p_msg); + } +} + +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 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); + } +} + +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érieur à 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é 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é 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ébut JS client */ +function selectionner_client(id,no) +{ + $("#idClient_C").val(id); + $("#numeroClient_C").val(no); + $("#nomClient_C").val(""); +} + +function selectionner_client_d(id,no) +{ + $("#idClient_d_C").val(id); + $("#numeroClient_d_C").val(no); + $("#nomClient_d_C").val(""); +} + +function afficher_client_id() +{ + idClient=$("#idClient_C" ).val(); + + if (idClient>"") + { + ajax_context_client_afficher(idClient); + } +} + +function afficher_client_d_id() +{ + idClient=$("#idClient_d_C" ).val(); + + if (idClient>"") + { + ajax_context_client_d_afficher(idClient); + } +} + + +/* Fin JS client */ + +/* Début JS police */ +function selectionner_police(id,no) +{ + $("#idPolice_C" ).val(id); + $("#numeroPolice_C" ).val(no); +} + +function selectionner_police_d(id,no) +{ + $("#idPolice_d_C" ).val(id); + $("#numeroPolice_d_C" ).val(no); +} + +function afficher_police_id() +{ + idPolice=$("#idPolice_C" ).val(); + + if (idPolice>"") + { + ajax_context_police_afficher(idPolice); + } +} + +function afficher_police_d_id() +{ + idPolice=$("#idPolice_d_C" ).val(); + + if (idPolice>"") + { + ajax_context_police_d_afficher(idPolice); + } +} + + +/* Fin JS client */ + +/* Début JS adherent */ +function selectionner_adherent(id,no) +{ + $("#idAdherent_C" ).val(id); + $("#numeroAdherent_C" ).val(no); +} + +function afficher_adherent() +{ + if ($("#numeroAdherent_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Ficheadherent/"+$("#numeroAdherent_C" ).val()+"/"); + } +} + +function afficher_adherent_id() +{ + if ($("#idAdherent_C" ).val()>"") + { + window.location.assign($("#racineWeb" ).val()+"Ficheadherent/"+$("#idAdherent_C" ).val()+"/"); + } +} +/* Fin JS adherent */ + +/* Début JS bénéficiare */ +function selectionner_beneficiaire(id,no) +{ + $("#idBeneficiaire_C").val(id); + $("#numeroBeneficiaire_C" ).val(no); +} + +function afficher_beneficiaire_id() +{ + idBeneficiaire=$("#idBeneficiaire_C").val(); + okId=$("#okId").val(); + okId_face=$("#okId_face").val(); + + if (idBeneficiaire>"") + { + ajax_context_beneficiaire_afficher(idBeneficiaire, okId, okId_face); + } +} + +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() +{ + v_msg="Etes-vous sur de vouloir quitter?"; + v_msgEng="Are you sure you want to exit?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + 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é!"; + 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électionner 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électionner un acte!"; + v_msgEng="Please select an act!"; + + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + $("#codeTypeBon").val('2'); + $("#frmconsultation").submit(); + $("#codeTypeBon").val('1'); +} + +function calculer_Tm() +{ + $("#montantTm").val( ($("#montantacte").val() * (100-$("#tauxCouverture").val() )) / 100 ); + if ($("#codeMedecin").val()>" ") + $("#numeroBon").focus(); + else + $("#codeMedecin").focus(); + return true; +} + +function controlefocusconsultationMd() +{ + if ($("#codeActe").val()>" ") + $("#numeroBon").focus(); + else + $("#codeActe").focus(); + return true; +} + +function ajaxinfosacteexamen() +{ + if ($("#codeActe").val()<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosacte/", + type : 'post', + data: "codePrestataire="+$("#codePrestataire").val()+"&codeActe="+$("#codeActe").val(), + error: function(errorData) { + }, + success: function(data) { + $("#infosacte").html(data); + }, + complete: function() { + $("#tauxCouverture").val( $("#tauxCouverture_info").val()); + } + }); +} + +function ajaxbonexamendisponible() +{ + if ($("#codeActe").val()<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + if ($("#numeroBon").val()<="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électionner 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électionner un assuré!"; + 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électionner un assuré!"; + v_msgEng="Please select an insured person!"; + alert_ebene(v_msg, v_msgEng); + return; + } + window.location.assign($("#racineWeb").val()+"Tacheadherent/"); +} + +function afficherged(cheminFichier) +{ + if (cheminFichier<=" ") + { + v_msg="Veuillez sélectionner un fichier!"; + v_msgEng="Please select a file"; + alert_ebene(v_msg, v_msgEng); + return; + } + //window.open(cheminFichier); + window.open(cheminFichier, '_blank'); +} + +function archiverged() +{ + if ($("#nomFichier").val()<=" ") + { + v_msg="Veuillez sélectionner un document!"; + v_msgEng="Please select a document"; + alert_ebene(v_msg, v_msgEng); + return; + } + if( $("#accesAssure").val()=="0" && $("#accesPrestataire").val()=="0" + && $("#accesMedecin").val()=="0" && $("#accesGestionnaire").val()=="0") + { + v_msg="Le document doit être visible par au moins un des acteurs!"; + v_msgEng="The document must be seen by at least one of the persons in charge!"; + alert_ebene(v_msg, v_msgEng); + return; + } + $("#frmarchiherged").submit(); +} + +function archiverfacture() +{ + if ($("#nomFichier").val()<=" ") + { + v_msg="Veuillez sélectionner un fichier!"; + v_msgEng="Please select a file"; + alert_ebene(v_msg, v_msgEng); + return; + } + $("#frmarchiherged").submit(); +} + +function ajaxinfosdestinatairetache() +{ + if ($("#codeDestinataire").val()<=" ") + { + v_msg="Veuillez sélectionner un destinataire!"; + v_msgEng="Please select a recipient!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeDestinataire").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosdestinatairetache/", + type : 'post', + data: "codeDestinataire="+$("#codeDestinataire").val(), + error: function(errorData) { + }, + success: function(data) { + $("#infosdestinatairetache").html(data); + }, + complete: function() { + $("#emailtache").val( $("#emailActeurtache_info").val()); + } + }); +} + +function selectionner_tache(id) +{ + $("#idTache").val(id); +} + +function afficher_tache() +{ + if ($("#idTache" ).val()<="") + { + v_msg="Veuillez sélectionner 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électionner 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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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 controle_numerique(controle) +{ + if(isNaN(controle.value)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + controle.value=""; + controle.focus(); + return false; + } + return true; +} + +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ée!"; + 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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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() +{ + 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(); + + radiation = $("#radiation").val(); + + /* + if (dateEffetCouvert!="1") + { + v_msg="Attention! Non renouvelé"; + v_msgEng="Warning! Not renewed"; + alert_ebene(v_msg, v_msgEng); + return false; + } + */ + + 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") + { + if(radiation=="0" && codeEtatBeneficiaire=="R"){ + return true; + }else{ + 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; + } + + // 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"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 décédée!"; + v_msgEng="Warning! Deceased!"; + alert_ebene(v_msg, v_msgEng); + return false; + } + + return true; +} + + +function consultation() +{ + + prestationPossible = $("#prestationPossible").val(); + if (prestationPossible!="1") + { + v_msg="Assuré non encore couvert!"; + v_msgEng="Insured not yet covered!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + dateEffetCouvert = $("#dateEffetCouvert").val(); + if (dateEffetCouvert!="1") + { + v_msg="Attention! Non renouvelé"; + v_msgEng="Warning! Not renewed"; + alert_ebene(v_msg, v_msgEng); + return; + } + + modeSaisieFacture=$("#modeSaisieFacture").val(); + + if(modeSaisieFacture=="1") + { + $("#btn_popdate_reelle").click(); + return; + } + + if (prestation_possible()) + { + p_codeModeBiometrie = $("#p_codeModeBiometrie" ).val(); + if(p_codeModeBiometrie=="0") + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + window.location.assign($("#racineWeb" ).val()+"Consultation/"); + return; + } + + okId=$("#okId" ).val(); + okId_face=$("#okId_face" ).val(); + + if(okId=="1" || okId_face=="1") + { + window.location.assign($("#racineWeb" ).val()+"Consultation/"); + return; + } + + modeSaisieFacture=$("#modeSaisieFacture").val(); + + if(modeSaisieFacture=="1") + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + window.location.assign($("#racineWeb" ).val()+"Consultation/"); + return; + } + + 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(); + + if (finger_id==0) + { + v_msg="Veuillez procéder à 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 (okId!=1 && okId_face!=1) + { + v_msg="Veuillez procéder à l\'identification avant!"; + v_msgEng="Please check identity before!"; + alert_ebene(v_msg, v_msgEng); + return; + } + } + + window.location.assign($("#racineWeb" ).val()+"Consultation/"); + } +} + +function gestionbon() +{ + adminBon = $("#adminBon" ).val(); + + if (adminBon!="1") + { + v_msg="Accès refusé!"; + v_msgEng="Access denied!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + window.location.assign($("#racineWeb").val()+"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électionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + $("#codeTypeBon").focus(); + return; + } + + if (noFin  ' + 'Veuillez patienter... / Please wait...' + ''); + + $.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és : "+$("#nbligne_info").val()); + } + + // $("#nbligne").val("Nombre de bons affichés : "+$("#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<=" ") + { + v_msg="Veuillez sélectionner une ligne!"; + v_msgEng="Please select a line!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (codeEtatBon=="3") + { + v_msg="Anullé pour motif : "+motifAnnulation; + v_msgEng="Canceled for reason : "+motifAnnulation; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (codeEtatBon=="4") + { + v_msg="Remplacé pour motif : "+motifAnnulation; + v_msgEng="Replaced for reason : "+motifAnnulation; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (codeEtatBon=="9") + { + v_msg="Demande anullation pour motif : "+motifAnnulation; + v_msgEng="Cancellation request for reason : "+motifAnnulation; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous la demande d\'annulation du bon No "+numeroBon+"?"; + v_msgEng="Do you confirm the request for cancellation of the prescription No "+numeroBon+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + v_msg="Raison de l\'annulation?"; + v_msgEng="Reason for cancellation?"; + + motifAnnulation = prompt_ebene(v_msg, v_msgEng, motifAnnulation); + if (motifAnnulation<=" ") + { + v_msg="Vous devez saisir un motif!"; + v_msgEng="You have to enter a reason!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + $("#motifAnnulation_C").val(motifAnnulation); + + donnees = 'idBon='+idBon+'&motifAnnulation='+motifAnnulation; + donnees_sav = 'idBon='+idBon+'&typeMail=maildemandeannulationbon'; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxafficherbons/demanderAnnulationBon/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + mettremailattente(donnees_sav); + + v_msg="Demande envoyée avec succès!"; + v_msgEng="Request sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + afficherbon(); + } + }); + } +} + +function enregistrer_commande_bon() +{ + codeTypeBon=$("#codeTypeBon").val(); + + if ($("#codeTypeBon").val()<" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + $("#codeTypeBon").focus(); + return; + } + + quantite =$("#quantite").val(); + + if (quantite<" ") + { + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + $("#quantite").focus(); + return; + } + + quantite = parseInt(quantite); + + if(quantite<1) + { + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + $("#quantite").focus(); + return; + } + + /* + commentaire=$("#commentaire").val(); + + if ($("#commentaire").val()<" ") + { + v_msg="Veuillez saisir une note!"; + v_msgEng="Please enter a note/comment!"; + alert_ebene(v_msg, v_msgEng); + $("#commentaire").focus(); + return; + } + */ + + var codehtml = ""; + + v_msg="Confirmez-vous cette commande?"; + v_msgEng="Do you confirm this order?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + prestataire = $("#prestataire_C").val(); + donnees = 'codeTypeBon='+codeTypeBon+'&quantite='+quantite; + donnees_sav = donnees+'&prestataire='+prestataire+'&typeMail=mailcommandebon'; + + lst_libelleBon = document.getElementById("codeTypeBon"); + libelleBon = lst_libelleBon.options[lst_libelleBon.selectedIndex].text.trim(); + typeSms = "commandebon"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcommanderbons/commanderBon/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + codehtml = data; + preparesms(typeSms); + }, + complete: function() { + mettremailattente(donnees_sav); + + v_msg="commande envoyée avec succès!"; + v_msgEng="Order sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + $("#div_page_entiere").html(codehtml); + } + }); + } +} + +function receptionner_bon() +{ + nbligne_info=$("#nbligne_info").val(); + nbligne_info = parseInt(nbligne_info); + + if (nbligne_info==0) + { + v_msg="Veuillez actualiser la liste avant!"; + v_msgEng="Please refresh before!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + codeTypeBon=$("#codeTypeBon").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électionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeTypeBon").focus(); + return; + } + + if (noFin  ' + 'Veuillez patienter... / Please wait...' + ''); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxalistegenererbons/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_bonpecs").html(data); + }, + complete: function() { + $("#nbligne").val("Nombre de lignes affichées : "+$("#nbligne_info").val()); + } + }); +} + + +function listerdemandebon() +{ + codeTypeBon=$("#codeTypeBon").val(); + d1=$("#d1").val(); + d2=$("#d2").val(); + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + $("#codeTypeBon").focus(); + return; + } + + donnees = 'codeTypeBon='+codeTypeBon+'&d1='+d1+'&d2='+d2; + + $("#div_bonpecs").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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électionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + $("#codeActe").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosacte/", + type : 'post', + data: "codePrestataire="+$("#codePrestataire").val()+"&codeActe="+$("#codeActe").val(), + error: function(errorData) { + }, + success: function(data) { + $("#infosacte").html(data); + }, + complete: function() { + $("#montantacte").val( $("#montantacte_info").val()); + $("#tauxCouverture").val( $("#tauxCouverture_info").val()); + // calculer_Tm(); + } + }); +} + + +function ajaxprixacte() +{ + codeGestionBon = $("#codeGestionBon").val(); + + codeActe = $("#codeActe").val(); + + if (codeActe<=" ") + { + $("#prixActe_info").val("0"); + $("#montantTm_info").val("0"); + $("#aRembourser_info").val("0"); + + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + $("#codeActe").focus(); + return; + } + + donnees = 'codeActe='+codeActe; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprixacte/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infosacte").html(data); + + $("#numeroBon").val(""); + $("#codeRaisonConsultation").focus(); + $("#msgErreur").html(""); + + if (codeGestionBon=="0") + { + $("#btn_enreg").disable(); + $("#codeEtatBon").val(""); + } + }, + complete: function() { + } + }); +} + + +function ajaxbondisponible() +{ + codeMedecin = $("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + 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électionner 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électionner 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électionner un médecin!"; + 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électionner 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électionner 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éro 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() { + } + }); +} + +function enregistrerconsultation() +{ + /* + dateSurvenance = $("#dateSurvenance").val(); + alert("dateSurvenance => "+dateSurvenance); + 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; + } + + /* + delaiCarenceBeneficiaire = $("#delaiCarenceBeneficiaire").val(); + delaiCarenceBeneficiaire = parseInt(delaiCarenceBeneficiaire); + + if (delaiCarenceBeneficiaire>0) + { + if (anciennete"+delaiCarenceBeneficiaire); + // alert("appliquerDelaiCarence =>"+appliquerDelaiCarence); + // return; + + if (delaiCarenceBeneficiaire>0 && appliquerDelaiCarence=="1") + { + if (anciennete  ' + 'Veuillez patienter... / Please wait...' + ''); + + $.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() +{ + 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(); + nbBonsOrd = $("#nbBonsOrd").val(); + + numeroBonSave = $("#numeroBonSave").val(); + + codeMedecin = $("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + //$("#codeMedecin").focus(); + $("#nomMedecin").focus(); + return; + } + + if (codeGestionBon=="0") + { + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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éro 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 prescription?"; + } + else + { + numeroBon = "-1"; + v_msg="Confirmez-vous cette prescription?"; + v_msgEng="Do you confirm this prescription?"; + } + + /* + v_msg="Confirmez-vous ce No de bon?"; + v_msgEng="Do you confirm this number of prescription?"; + */ + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'numeroBon='+numeroBon+'&codeMedecin='+codeMedecin; + + // ajout du 27/06/2019 => prise en compte de la gestion paperless + donnees += '&codeGestionBon='+codeGestionBon; + + $("#btn_enreg").disable(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerprescription/enregistrerprescription/", + type : 'post', + data: donnees, + error: function(errorData) + { + }, + success: function(data) + { + // $('#div_test_gabarit').html(data); + }, + complete: function() { + v_msg="Prescription enregistrée avec succès"; + v_msgEng="Saved successfully!"; + alert_ebene(v_msg, v_msgEng); + + prescription_medicament(); + } + }); + } +} + +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éjà effectué!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeMedecin = $("#codeMedecin").val(); + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + 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éro 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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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() +{ + codeMedicament = $("#codeMedicament_pop").val(); + libelleMedicament = $("#libelleMedicament_pop").val(); + + if (codeMedicament<=" ") + { + v_msg="Veuillez sélectionner un médicament!"; + v_msgEng="Please select a medicine/drug!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + v_msg="Prescrire : "+libelleMedicament+"?"; + v_msgEng="Prescribe : "+libelleMedicament+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'codeMedicament='+codeMedicament; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailprescription/ajoutermedicament/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + prescription_medicament(); + }, + complete: function() { + } + }); + } +} + +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é!"; + 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 supprimer_medicament(idMedicament) +{ + v_msg="Confirmez-vous la suppression de ce médicament?"; + v_msgEng="Do you confirm the removal of this medicine/drug?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'idMedicament='+idMedicament; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailprescription/supprimer/", + type: 'POST', + data: donnees, + success: function(data) { + // $("#medicaments").html(data); + prescription_medicament(); + }, + error: function(data) { + }, + complete: function() { + } + }); + } +} + +function ajoutermedicament(idMedicament) +{ + donnees = 'idMedicament='+idMedicament; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacie/ajoutermedicament/", + type: 'POST', + data: donnees, + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +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(); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + } + }); +} + + +function ajoutermedicament_tous() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacie/ajoutermedicamenttous/", + type: 'POST', + success: function(data) { + $("#livraison").html(data); + }, + 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(); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + } + }); +} + +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() +{ + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + idPrestationactes=$("#idPrestationactes").val(); + idPrestationactes = parseInt(idPrestationactes); + + nbLivre=$("#nbLivre").val(); + nbLivre = parseInt(nbLivre); + + // if (idPrestationactes==0 && nbLivre<1) + if (nbLivre<1) + { + v_msg="Rien à enregitrer! Confirmez-vous cette situation?"; + v_msgEng="Nothing to save! Do you confirm this situation?"; + } + else + { + v_msg="Confirmez-vous cette livraison?"; + v_msgEng="Do you confirm this delivery?"; + } + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacie/enregistrerpharmacie/", + type: 'POST', + success: function(data) { + maj_fraisexclu_cso(); + }, + error: function(data) { + }, + 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) +{ + if(numeroBonOptique<="0") + { + // actualiser_opticien(); + reinitialiser_opticien(); + return; + } + + donnees = 'numeroBonOptique='+numeroBonOptique; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxchangerordonnanceopt/", + type: 'POST', + data: donnees, + success: function(data) { + 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() +{ + bonCaduc=$("#bonCaduc").val(); + if (bonCaduc==1) + { + v_msg="Bon caduc!"; + v_msgEng="Obsolete!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + actVisible=$("#actVisible").val(); + + // if (actVisible!="1" && modeSaisieFacture!="1") + if (actVisible!="1") + { + v_msg="Non autorisée!"; + v_msgEng="Not allowed!"; + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroBonOrdonnance = $("#numeroBonOrdonnance").val(); + numeroBonOrdonnance = parseInt(numeroBonOrdonnance); + + if (numeroBonOrdonnance<=0) + { + v_msg="Pas de prescription!"; + v_msgEng="No prescription!"; + alert_ebene(v_msg, v_msgEng); + + // feuillemaladie(); + return; + } + + v_msg="Confirmez-vous cette ordonnance ?"; + v_msgEng="Do you confirm this prescription?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + feuillemaladie(); + } +} + +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électionner 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é!"; + 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() +{ + acteExclu = $("#acteExclu").val(); + + autorisation = "0"; + + if(acteExclu==1) + { + autorisation = "2"; + + v_msg="Acte non couvert!"; + v_msgEng="Not covered!"; + alert_ebene(v_msg, v_msgEng); + $("#codeActe").focus(); + return; + } + + donnees="" + donnees_sav=""; + + codeMedecin = $("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + $("#nomMedecin").focus(); + return; + } + + codeActe = $("#codeActe").val(); + if (codeActe<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + $("#codeActe").focus(); + return; + } + + div_prix = $("#prixActe"); + prixActe = div_prix.val(); + + prixTarif = $("#prixTarif").val(); + + if(prixActe==0 || parseFloat(prixActe)>parseFloat(prixTarif)) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + div_quantite = $("#quantite"); + quantite = div_quantite.val(); + + if(quantite=="") + { + quantite = "0"; + } + + quantite = parseInt(quantite); + div_quantite.val(quantite); + + if(quantite==0) + { + div_quantite.focus(); + + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please neter the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cet acte?"; + v_msgEng="Do you confirm this act?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + prixActe = $("#prixActe").val(); + valeurActe = $("#valeurActe").val(); + + montantTm = $("#montantTm").val(); + aRembourser = $("#aRembourser").val(); + + ententePrealable = $("#ententePrealable").val(); + + if(ententePrealable==1) + { + ententePrealable = "2"; + } + + donnees = 'codeActe='+codeActe+'&codeMedecin='+codeMedecin+'&quantite='+quantite+'&ententePrealable='+ententePrealable; + donnees += '&prixActe='+prixActe+'&valeurActe='+valeurActe+'&montantTm='+montantTm+'&aRembourser='+aRembourser; + donnees += '&autorisation='+autorisation+'&prixTarif='+prixTarif; + + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + + donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; + donnees_sav2 = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailautorisation'; + + typeSms="ententeprealable"; + typeSms2="autorisation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistreractemedical/enregistreractemedical/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + maj_fraisexclu_cso(); + + if(ententePrealable=="2") + { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + } + + if(autorisation=="2") + { + preparesms(typeSms2); + + v_msg="Demande autorisation envoyée!"; + v_msgEng="Request for authorization sent!"; + alert_ebene(v_msg, v_msgEng); + } + }, + complete: function() { + if(ententePrealable=="2") + { + mettremailattente(donnees_sav); + } + + if(autorisation=="2") + { + mettremailattente(donnees_sav2); + } + + feuillemaladie(); + } + }); + } +} + +function ajax_changer_qte_acte() +{ + codeActe = $("#codeActe").val(); + prixActe = $("#prixActe").val(); + + if (codeActe<=" ") + { + v_msg="Veuillez sélectionner 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é!"; + 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) +{ + v_msg="Confirmez-vous la suppression de cet acte?"; + v_msgEng="Do you confirm the removal of this act?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'idPrestationactes='+idPrestationactes+'&codeTypePrestation='+codeTypePrestation; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistreractemedical/supprimeracte/", + type: 'POST', + data: donnees, + success: function(data) { + feuillemaladie_ajax(); + }, + error: function(data) { + }, + complete: function() { + } + }); + } +} + +function supprimer_chambre(idChambre) +{ + v_msg="Confirmez-vous la suppression de cette chambre?"; + v_msgEng="Do you confirm the removal of this room?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'idPrestationactes='+idChambre+'&codeTypePrestation=HOSP'; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistreractemedical/supprimeracte/", + type: 'POST', + data: donnees, + success: function(data) { + attribution_chambre(); + }, + error: function(data) { + }, + complete: function() { + } + }); + } +} + +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éjà effectué!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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() { + } + }); +} + +function enregistrerhospitalisation() +{ + 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(); + nbBonsOrd = $("#nbBonsOrd").val(); + + numeroBonSave = $("#numeroBonSave").val(); + + numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); + + if (codeGestionBon=="0") + { + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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éro 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 prescription?"; + } + else + { + numeroBon = "-1"; + v_msg="Confirmez-vous cette prescription?"; + v_msgEng="Do you confirm this prescription?"; + } + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'numeroBon='+numeroBon+'&numeroFeuilleMaladie='+numeroFeuilleMaladie; + donnees_sav = donnees+'&typeMail=mailhospitalisation'; + + // ajout du 27/06/2019 => prise en compte de la gestion paperless + donnees += '&codeGestionBon='+codeGestionBon; + + $("#btn_enreg").disable(); + + typeSms="hospitalisation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerhospitalisation/enregistrerhospitalisation/", + type : 'post', + data: donnees, + error: function(errorData) { + // $("#msgErreur").html(errorData); + }, + success: function(data) + { + // $('#div_test_gabarit').html(data); + + /* + mise en commentaire le 04/07/2019 + => pour les attributions automatiques, on ne connait + pas encore le No de bon + preparesms(typeSms); + */ + }, + complete: function() + { + /* + mise en commentaire le 04/07/2019 + => pour les attributions automatiques, on ne connait + pas encore le No de bon + mettremailattente(donnees_sav); + */ + + v_msg="Avis hospitalisation envoyé, souhaitez-vous ajouter une chambre?"; + v_msgEng="Hospitalization notice sent, would you like to add a room?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + attribution_chambre(); + } + else + { + feuillemaladie(); + } + } + }); + } +} + +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électionner 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ée!"; + v_msgEng="Please enter the duration!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + donnees = 'codeActe='+codeActe+'&quantite='+quantite; + + $("#infosacte").html('
  ' + 'Veuillez patienter...' + '
'); + + $.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électionner 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ée!"; + v_msgEng="Please enter duration!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + claculerfinchambre(); + + donnees = 'codeActe='+codeActe+'&quantite='+quantite+'&prixActe='+prixActe+'&numeroChambre='+numeroChambre; + + $("#infosacte").html('
  ' + 'Veuillez patienter...' + '
'); + + $.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ée!"; + 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 ); + + // contrôle du cheveauchement des dates + /* + var td1 = new Date($("#dateFinHospit").val()); + var td2 = $("#debut").datepicker("getDate"); + + + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + + if (dt1>dt2) + { + $("#btn_enreg").disable(); + $("#debut").focus(); + + v_msg="Veuillez revoir vos dates!"; + v_msgEng="Please review your dates!"; + alert_ebene(v_msg, v_msgEng); + return; + } + $("#btn_enreg").enable(); + */ +} + +function enregistrerchambre() +{ + acteExclu = $("#acteExclu").val(); + ententePrealable = $("#ententePrealable").val(); + + /* + alert('ententePrealable = '+ententePrealable); + return; + */ + + autorisation = "0"; + + if(acteExclu==1) + { + autorisation = "2"; + v_msg="Non couvert!"; + v_msgEng="Not covered!"; + alert_ebene(v_msg, v_msgEng); + $("#codeActe").focus(); + return; + } + + codeActe = $("#codeActe").val(); + if (codeActe<=" ") + { + v_msg="Veuillez sélectionner un type de chambre!"; + v_msgEng="Please select a category of room!"; + alert_ebene(v_msg, v_msgEng); + $("#codeActe").focus(); + return; + } + + div_prix = $("#prixActe"); + prixActe = div_prix.val(); + + prixTarif = prixActe; + + if(prixActe==0) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + div_quantite = $("#quantite"); + quantite = div_quantite.val(); + + if(quantite=="") + { + quantite = "0"; + } + + quantite = parseInt(quantite); + div_quantite.val(quantite); + + if(quantite==0) + { + div_quantite.focus(); + + v_msg="Veuillez saisir la durée!"; + v_msgEng="Please enter the duration!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + // contrôle du cheveauchement des dates + + // mis en commentaire le 31/10/2018 BONA + /* + var td1 = new Date($("#dateFinHospit").val()); + var td2 = $("#debut").datepicker("getDate"); + + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + + if (dt1>dt2) + { + $("#btn_enreg").disable(); + $("#debut").focus(); + + v_msg="Veuillez revoir vos dates!"; + v_msgEng="Please review your dates!"; + alert_ebene(v_msg, v_msgEng); + return; + } + // $("#btn_enreg").enable(); + */ + + numeroChambre = $("#numeroChambre").val(); + if (numeroChambre<=" ") + { + v_msg="Veuillez saisir le No de chambre!"; + v_msgEng="Please enter room number!"; + alert_ebene(v_msg, v_msgEng); + $("#numeroChambre").focus(); + return; + } + + v_msg="Confirmez-vous cette chambre?"; + v_msgEng="Do you confirm this room?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees="" + donnees_sav=""; + + if(ententePrealable==1) + { + ententePrealable = "2"; + } + + prixActe = $("#prixActe").val(); + valeurActe = $("#valeurActe").val(); + + montantTm = $("#montantTm").val(); + aRembourser = $("#aRembourser").val(); + + debut = $("#debut").val(); + // $("#fin").enable(); + fin = $("#fin").val(); + + donnees = 'codeActe='+codeActe+'&quantite='+quantite+'&prixActe='+prixActe+'&valeurActe='+valeurActe; + donnees += '&montantTm='+montantTm+'&aRembourser='+aRembourser+'&debut='+debut+'&fin='+fin +'&numeroChambre='+numeroChambre; + donnees += '&autorisation='+autorisation+'&prixTarif='+prixTarif; + donnees += '&ententePrealable='+ententePrealable; + + // alert("donnees => "+donnees); + // return; + + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + + donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; + donnees_sav2 = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailautorisation'; + + typeSms="ententeprealable"; + typeSms2="autorisation"; + + $("#btn_enreg_chambre").disable(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerchambre/enregistrerchambre/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + maj_fraisexclu_cso(); + + if(ententePrealable=="2") + { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + } + + if(autorisation=="2") + { + preparesms(typeSms2); + + v_msg="Demande autorisation envoyée!"; + v_msgEng="Request for authorization sent!"; + alert_ebene(v_msg, v_msgEng); + } + }, + complete: function() { + if(ententePrealable=="2") + { + mettremailattente(donnees_sav); + } + + if(autorisation=="2") + { + mettremailattente(donnees_sav2); + } + + v_msg="Enregistrée avec succès"; + v_msgEng="Saved successfully!"; + alert_ebene(v_msg, v_msgEng); + + attribution_chambre(); + } + }); + } +} + +function actesmedicaux() +{ + actVisible=$("#actVisible").val(); + + // if (actVisible!="1" && modeSaisieFacture!="1") + if (actVisible!="1") + { + v_msg="Non autorisée!"; + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Actesmedicaux/"); +} + +function optique() +{ + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + 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éder à 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éder à 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éder à 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, + success: function(data) + { + $('#div_ok_face_info').html(data); + }, + error: function(errorData) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"); + } + }); +} + +function ajax_context_beneficiaire_afficher(idBeneficiaire, okId) +{ + donnees = 'idBeneficiaire='+idBeneficiaire+'&okId='+okId; + + $.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éjà facturé!"; + 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épassement 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"); + $("#okId_face").val("1"); + } + else + { + okId=$("#okId" ).val(); + okId_face=$("#okId_face" ).val(); + + if (okId!=1 && okId_face!=1) + { + v_msg="Veuillez procéder à 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) { + preparesms_adherent(typeSms); + }, + error: function(data) { + }, + complete: function() + { + preparemail_adherent(typeSms); + + v_msg="Facturation effectuée avec succès!"; + v_msgEng="Billing done successfully!"; + alert_ebene(v_msg, v_msgEng); + + feuillemaladie(); + } + }); + +} + +function facturer_feuillemaladie() +{ + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numOrd = $("#numOrd").val(); + noPrescription = $("#noPrescription").val(); + + if (numOrd==0 && noPrescription==0) + { + v_msg="Attention, pas de presciption de médicaments!?"; + v_msgEng="Warning, no presciption of drugs!"; + alert_ebene(v_msg, v_msgEng); + + prescription_medicament(); + return; + } + + prixActe = $("#prixActe").val(); + if (prixActe==0) + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + affectionObligatoire=$("#affectionObligatoire").val(); + codeAffection=$("#codeAffection").val(); + + if (affectionObligatoire=="1" && codeAffection<="0000") + { + v_msg="Diagnostique exigé!"; + v_msgEng="Diagnosis required!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleAffection").focus(); + $("#btn_pop_affection").click(); + + return; + } + + v_msg="Confirmez-vous la facturation?"; + v_msgEng="Do you confirm billing?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + user_id_0 = $("#user_id_C").val(); + + modeSaisieFacture=$("#modeSaisieFacture").val(); + derogationFingerFacturation=$("#derogationFingerFacturation").val(); + + // alert("modeSaisieFacture="+modeSaisieFacture+" ; derogationFingerFacturation="+derogationFingerFacturation); + // return; + + if(modeSaisieFacture=="1" || derogationFingerFacturation=="1") + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_cso(user_id_0); + return; + } + + + derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); + + // alert("derogation_finger_en_cours="+derogation_finger_en_cours); + // return; + + if(derogation_finger_en_cours>0) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_cso(user_id_0); + return; + } + else + { + beneficiaire = $("#beneficiaire_C").val(); + user_id = $("#user_id_C").val(); + finger_id = $("#finger_id_C").val(); + + $("#facturation").val("1"); + + data = "action=index&user_id="+user_id+"&user_name="+beneficiaire+"&finger="+finger_id+"&facturation=1"; + + // load("flexcode/user.php?"+data); + load("flexcode/user_facturation.php?"+data); + + } + } +} + +function facturer_pha() +{ + idPrestationactes=$("#idPrestationactes").val(); + idPrestationactes = parseInt(idPrestationactes); + + /* mis en commentaire le 31/07/2018 => permettre la multi-facturation + if (idPrestationactes>0) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + nbLivre=$("#nbLivre").val(); + nbLivre = parseInt(nbLivre); + + // if (idPrestationactes==0 && nbLivre<1) + if (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=mailpharmacie'; + + typeSms = "facturer_pha"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacien/enregistrerpharmacie/", + type: 'POST', + success: function(data) { + preparesms_adherent(typeSms); + }, + error: function(data) { + }, + complete: function() { + preparemail_adherent(typeSms); + + v_msg="Facturation effectuée avec succès!"; + v_msgEng="Billing done successfully!"; + alert_ebene(v_msg, v_msgEng); + + window.location.assign($("#racineWeb" ).val()+"Pharmacien/"); + } + }); +} + +function valider_pharmacie_pha() +{ + prixActe = $("#prixActe").val(); + if (prixActe==0) + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + 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; + } + + estRempalace=$("#estRempalace").val(); + + if (estRempalace=="1") + { + v_msg="Remplacée!"; + v_msgEng="Replaced!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroPrescription=$("#numeroPrescription_C").val(); + + if (numeroPrescription<="0") + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + idPrestationactes=$("#idPrestationactes").val(); + idPrestationactes = parseInt(idPrestationactes); + + /* mis en commentaire le 31/07/2018 => permettre la multi-facturation + if (idPrestationactes>0) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + nbLivre=$("#nbLivre").val(); + nbLivre = parseInt(nbLivre); + + // if (idPrestationactes==0 && nbLivre<1) + if (nbLivre<1) + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette livraison?"; + v_msgEng="Do you confirm this delivery?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + // 07/01/2018 => Mis en commentaire parce pas besoin de fingerprint en pharmacie + /* + derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); + if(derogation_finger_en_cours>0) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_pha(); + } + else + { + beneficiaire = $("#beneficiaire_C").val(); + user_id =$("#user_id_C").val(); + finger_id =$("#finger_id_C").val(); + + $("#facturation").val("1"); + + data = "action=index&user_id="+user_id+"&user_name="+beneficiaire+"&finger="+finger_id+"&facturation=1"; + + load("flexcode/user.php?"+data); + } + */ + + facturer_pha(); + } +} + +function valider_optique() +{ + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + /* + nbVerres=$("#nbVerres").val(); + nbVerres = parseInt(nbVerres); + + if (nbVerres<1) + { + v_msg="Rien à valider!"; + v_msgEng="Nothing to save!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + numeroBonOptique=$("#numeroBonOptique").val(); + if (numeroBonOptique<=0) + { + v_msg="Pas de prescription!"; + v_msgEng="No prescription!"; + alert_ebene(v_msg, v_msgEng); + + // feuillemaladie(); + return; + } + + v_msg="Confirmez-vous cette ordonnance ?"; + v_msgEng="Do you confirm this prescription?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistreroptique/videroptiquetemp/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + feuillemaladie(); + }, + complete: function() { + } + }); + } +} + +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éjà effectué!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeMedecin = $("#codeMedecin").val(); + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + 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éro 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() { + } + }); +} + + +function supprimer_optique(idOptique) +{ + v_msg="Confirmez-vous la suppression de ce verre?"; + v_msgEng="Do you confirm the removal of this glass?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'idOptique='+idOptique; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerverre/supprimerverre/", + type: 'POST', + data: donnees, + success: function(data) { + $("#medicaments").html(data); + }, + error: function(data) { + }, + complete: function() { + prescription_optique(); + } + }); + } +} + + +function enregistreroptique() +{ + 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(); + nbBonsOrd = $("#nbBonsOrd").val(); + + numeroBonSave = $("#numeroBonSave").val(); + + codeMedecin = $("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + $("#nomMedecin").focus(); + return; + } + + if (codeGestionBon=="0") + { + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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éro 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 prescription?"; + } + else + { + numeroBon = "-1"; + v_msg="Confirmez-vous cette prescription?"; + v_msgEng="Do you confirm this prescription?"; + } + + /* + v_msg="Confirmez-vous ce No de bon?"; + v_msgEng="Do you confirm this number of prescription?"; + */ + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'numeroBon='+numeroBon+'&codeMedecin='+codeMedecin; + + // ajout du 27/06/2019 => prise en compte de la gestion paperless + donnees += '&codeGestionBon='+codeGestionBon; + + $("#btn_enreg").disable(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistreroptique/enregistreroptique/", + type : 'post', + data: donnees, + error: function(errorData) { + // $("#msgErreur").html(errorData); + }, + success: function(data) { + // $('#div_test_gabarit').html(data); + }, + complete: function() { + v_msg="Prescription enregistrée avec succès"; + v_msgEng="Saved successfully!"; + alert_ebene(v_msg, v_msgEng); + + prescription_optique(); + } + }); + } +} + +function enregistrerverre() +{ + codeOptique = $("#codeOptique").val(); + if (codeOptique<=" ") + { + v_msg="Veuillez sélectionner un verre!"; + v_msgEng="Please select a glass!"; + alert_ebene(v_msg, v_msgEng); + $("#codeOptique").focus(); + return; + } + + v_msg="Confirmez-vous ces verres?"; + v_msgEng="Do you confirm these glasses?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + + donnees = 'codeOptique='+codeOptique; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerverre/enregistrerverre/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + prescription_optique(); + }, + complete: function() { + } + }); + } +} + + +function valider_chambre() +{ + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + bonCaduc=$("#bonCaduc").val(); + if (bonCaduc==1) + { + v_msg="Bon caduc!"; + v_msgEng="Obsolete!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette hospitalisation ?"; + v_msgEng="Do you confirm this hospitalization?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + feuillemaladie(); + } +} + + +function valider_opticien() +{ + prixActe = $("#prixActe").val(); + if (prixActe==0) + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + 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; + } + + numeroOptique=$("#numeroOptique_C").val(); + + if (numeroOptique<="0") + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + idPrestationactes=$("#idPrestationactes").val(); + idPrestationactes = parseInt(idPrestationactes); + + if (idPrestationactes>0) + { + v_msg="Déjà facturé!"; + 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; + } + + v_msg="Confirmez-vous cette livraison?"; + v_msgEng="Do you confirm this delivery?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + // 07/01/2018 => Mis en commentaire parce pas besoin de fingerprint en magasin optique + /* + derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); + if(derogation_finger_en_cours>0) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_opt(); + } + else + { + beneficiaire = $("#beneficiaire_C").val(); + user_id =$("#user_id_C").val(); + finger_id =$("#finger_id_C").val(); + + $("#facturation").val("1"); + + data = "action=index&user_id="+user_id+"&user_name="+beneficiaire+"&finger="+finger_id+"&facturation=1"; + + load("flexcode/user.php?"+data); + } + */ + facturer_opt(); + } +} + +function opticien() +{ + 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"); + $("#okId_face" ).val("1"); + } + else + { + finger_id = $("#finger_id_C" ).val(); + + if (finger_id==0) + { + v_msg="Veuillez procéder à l\'enrôlement avant!"; + v_msgEng="Please enroll before!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + okId=$("#okId" ).val(); + $("#okId_face" ).val("1"); + + if (okId!=1 && okId_face!=1) + { + v_msg="Veuillez procéder à l\'identification avant!"; + v_msgEng="Please check identity before!"; + alert_ebene(v_msg, v_msgEng); + return; + } + } + */ + + 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éjà facturé!"; + 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) { + preparesms_adherent(typeSms); + }, + error: function(data) { + }, + complete: function() + { + preparemail_adherent(typeSms); + + v_msg="Facturation effectuée 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/"); +} + +function enregistrerdemandederogation() +{ + codeDerogation = $("#codeDerogation").val(); + + lst_libelleDerogation = document.getElementById("codeDerogation"); + libelleDerogation = lst_libelleDerogation.options[lst_libelleDerogation.selectedIndex].text.trim(); + + college_couvert=$("#college_couvert_C").val(); + if (college_couvert>0 && codeDerogation=="01") + { + v_msg="Attention! Cette personne a déjà accès à ce centre"; + v_msgEng="Warning! This person all ready have access to this center"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if (codeDerogation<=" ") + { + v_msg="Veuillez sélectionner une dérogation!"; + v_msgEng="Please select an exemption!"; + alert_ebene(v_msg, v_msgEng); + $("#codeDerogation").focus(); + return; + } + + observations = $("#observations").val(); + if (observations<=" ") + { + v_msg="Veuillez saisir la motivation!"; + v_msgEng="Please select the motivation!"; + alert_ebene(v_msg, v_msgEng); + $("#observations").focus(); + return; + } + + v_msg="Confirmez-vous cette demande de dérogation?"; + v_msgEng="Do you confirm this request?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'codeDerogation='+codeDerogation+'&observations='+observations+'&libelleDerogation='+libelleDerogation; + + idBeneficiaire = $("#idBeneficiaire_C").val(); + prestataire = $("#prestataire_C").val(); + + + donnees_sav = donnees+'&prestataire='+prestataire+'&idBeneficiaire='+idBeneficiaire+'&typeMail=maildemandederogation'; + + typeSms = "demandederogation"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerdemandederogation/enregistrerdemandederogation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + preparesms(typeSms); + }, + complete: function() + { + mettremailattente(donnees_sav); + + v_msg="Demande envoyée avec succès!"; + v_msgEng="Request sent successfully!"; + alert_ebene(v_msg, v_msgEng); + + liste_derogation(); + } + }); + } +} + +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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); +} + +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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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; + donnees_sav = donnees; + + $("#reglement").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconsultationcsoentete/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#reglement").html(data); + }, + complete: function() { + } + }); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconsultationcso/", + 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_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() +{ + actVisible=$("#actVisible").val(); + modeSaisieFacture=$("#modeSaisieFacture").val(); + saisirFactureDecompte=$("#saisirFactureDecompte").val(); + modeSaisieFeuille=$("#modeSaisieFeuille").val(); + + if (modeSaisieFeuille=="1" && saisirFactureDecompte!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + // if (actVisible!="1" && modeSaisieFacture!="1") + if (actVisible!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (modeSaisieFacture="1" && saisirFactureDecompte!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Prescription/"); +} + +function livraison_pharmacie() +{ + actVisible=$("#actVisible").val(); + + // if (actVisible!="1" && modeSaisieFacture!="1") + if (actVisible!="1") + { + v_msg="Non autorisée!"; + 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() +{ + modeSaisieFacture=$("#modeSaisieFacture").val(); + saisirFactureDecompte=$("#saisirFactureDecompte").val(); + + modeSaisieFeuille=$("#modeSaisieFeuille").val(); + + if (modeSaisieFeuille=="1" && saisirFactureDecompte!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (modeSaisieFacture=="1" && saisirFactureDecompte!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Optique/"); +} + +function attribution_chambre() +{ + window.location.assign($("#racineWeb" ).val()+"Chambre/"); +} + +function feuillemaladie() +{ + window.location.assign($("#racineWeb" ).val()+"Feuillemaladie/"); +} + +function feuillemaladie_ajax() +{ + $("#div_feuillemaladie").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfeuillemaladie/", + type: 'POST', + success: function(data) { + $("#div_feuillemaladie").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite_cso(); + } + }); +} + +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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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électionner 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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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('
  ' + 'Veuillez patienter...' + '
'); + + 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(); + + 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=="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(); + + p_message = prestataire+" "; + p_message += "\n"; + p_message += "Patient : "+patient+" ("+numeroBeneficiaire+") "; + p_message += "\n"; + p_message += (codeLangueSociete=="en_US") ? "Hospit. form No : " : "No Bon Hospit. : "; + p_message += numeroBon; + p_message += "\n"; + p_message += (codeLangueSociete=="en_US") ? "Hospitalization notification" : "Avis Hospitalisation"; + } + + 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"; + } + + 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épassement 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épassement 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(); + } + }); +} + +function consommables() +{ + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + facturerConsommable=$("#facturerConsommable").val(); + if (facturerConsommable!="1") + { + v_msg="Consommables non facturés!"; + v_msgEng="Consumables not invoiced!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + ajoutConsommable = $("#ajoutConsommable").val(); + + if (ajoutConsommable!="1") + { + v_msg="Déjà inclu dans les actes ! Souhaitez-vous continuer?"; + v_msgEng="Already included in the acts ! Would you like to continue?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + window.location.assign($("#racineWeb" ).val()+"Consommables/"); + return; + } + else + { + return; + } + } + window.location.assign($("#racineWeb" ).val()+"Consommables/"); +} + + +function afficher_recherche_consommable() +{ + nomConsommable = $("#nomConsommable").val(); + + if (nomConsommable > " ") + { + donnees = "nomConsommable="+nomConsommable; + + $("#div_listeconsommable").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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électionner un consommable!"; + v_msgEng="Please select a consumable!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + v_msg="Ajouter : "+libelleConsommable+"?"; + v_msgEng="Add : "+libelleConsommable+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + 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(); + } + }); + } +} + +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é!"; + 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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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() +{ + + noOrdreMedecin = $("#noOrdreMedecin").val(); + nomsearch = $("#nomsearch").val(); + + if(noOrdreMedecin+nomsearch<=" ") + return; + + donnees = "valid=1&noOrdreMedecin="+noOrdreMedecin+"&nomsearch="+nomsearch; + + $("#div_listemedecins").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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) +{ + if(noOrdreMedecin+codeMedecin<=" ") + return; + + v_msg="Confirmez-vous ce Médecin : "+nomMedecin+"?"; + v_msgEng="Do you confirm this Doctor : "+nomMedecin+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $("#codeMedecin").val(codeMedecin); + $("#nomMedecin").html(nomMedecin+" ( "+noOrdreMedecin+" )"); + + if(codeMedecin=="ZZZZ") + { + $("#medecinManquant").readable(); + $("#codeSpecialiteManuel").enable(); + + } + else + { + $("#medecinManquant").unreadable(); + $("#codeSpecialiteManuel").disable(); + } + + $("#close_pop").click(); + } +} + +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é!"; + 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; +} + +function substituer_medicament(idMedicament) +{ + v_msg="Substituer ce médicament?"; + v_msgEng="Substitute this drug?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + + donnees = 'idMedicament='+idMedicament; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsubstitutionmedicament/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_substitution").html(data); + }, + complete: function() { + $("#btn_pop").click(); + } + }); + } +} + + +function annuler_substitution_medicament(idMedicament) +{ + v_msg="Annuler cette substitution?"; + v_msgEng="Cancel this substitution?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'idMedicament='+idMedicament; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacien/annulersubstitutionmedicament/", + type: 'POST', + data: donnees, + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + } + }); + } +} + + +function enregistrersubstituion_medicament() +{ + idMedicament = $("#idMedicament").val(); + prixTarif = $("#prixTarif").val(); + prixSubstitut = $("#prixSubstitut").val(); + + if(prixSubstitut==0 || parseFloat(prixSubstitut)>parseFloat(prixTarif)) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette substitution ?"; + v_msgEng="Do you confirm this substitution?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'idMedicament='+idMedicament+'&prixSubstitut='+prixSubstitut; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacien/enregistrersubstitutionmedicament/", + type: 'POST', + data: donnees, + success: function(data) { + $("#btn_close_pop").click(); + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + } + }); + } +} + +function selectionner_acte_cons(codeFamilleActe, codeActe, familleActe, libelleActe) +{ + if(libelleActe<=" ") + return; + + $("#codeFamilleActe").val(codeFamilleActe); + ajaxactespossibles(); + + v_msg="Confirmez-vous cet acte : "+libelleActe+"?"; + v_msgEng="Do you confirm this act : "+libelleActe+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $("#codeActe").val(codeActe); + ajaxprixacte(); + + $("#libelleActe").val(libelleActe); + $("#close_pop_acte").click(); + } +} + +function afficher_pop_recherche_actes_cons() +{ + libelleActeSearch = $("#libelleActeSearch").val(); + + if(libelleActeSearch<=" ") + { + return; + } + + donnees = "valid=1&libelleActeSearch="+libelleActeSearch; + + $("#div_liste_actes_cons").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.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) +{ + if(libelleActe<=" ") + return; + + $("#codeFamilleActe").val(codeFamilleActe); + // ajaxactespossibles(); + ajaxactespossibles_med(); + + v_msg="Confirmez-vous cet acte : "+libelleActe+"?"; + v_msgEng="Do you confirm this act : "+libelleActe+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $("#codeActe").val(codeActe); + ajaxprixactemed(); + + $("#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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistemedicamentspha/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_listemedicament").html(data); + } + }); + } +} + + +function prescrire_medicament_pha() +{ +// Ajout à la prescription + codePrestatairePrescription = $("#codePrestatairePrescription").val(); + codeMedicament = $("#codeMedicament_pop").val(); + + + libelleMedicament = $("#libelleMedicament_pop").val(); + + if (codeMedicament<=" ") + { + v_msg="Veuillez sélectionner un médicament!"; + v_msgEng="Please select a medicine/drug!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + donnees = 'codeMedicament='+codeMedicament; + donnees += '&codePrestatairePrescription=' + codePrestatairePrescription; + + // alert(donnees); + // return; + + v_msg="Prescrire : "+libelleMedicament+"?"; + v_msgEng="Prescribe : "+libelleMedicament+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacien/ajoutermedicamentprescription/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#btn_close_pop_medicament").click(); + $("#livraison").html(data); + raffraichier_detail_prescription(); + }, + complete: function() { + alerter_depassement_limite(); + } + }); + } +// Fin Ajout à l aprescription +} + +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ée!"; + 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é!"; + 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() +{ + actVisible=$("#actVisible").val(); + + modeSaisieFeuille=$("#modeSaisieFeuille").val(); + + if (modeSaisieFeuille=="1" && saisirFactureDecompte!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (actVisible!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Prescriptionexamen/"); +} + +function valider_presciption_examens() +{ + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nbExamens=$("#nbExamens").val(); + nbExamens = parseInt(nbExamens); + + /* On peut saisir juste le No de bon + sans saisir le détail de la prescription + + if (nbExamens<1) + { + v_msg="Rien à valider!"; + v_msgEng="Nothing to save!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + numeroBonExamen=$("#numeroBonExamen").val(); + if (numeroBonExamen<=0) + { + v_msg="Pas de prescription!"; + v_msgEng="No prescription!"; + alert_ebene(v_msg, v_msgEng); + + // feuillemaladie(); + return; + } + + v_msg="Confirmez-vous cette presciption ?"; + v_msgEng="Do you confirm this prescription?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + feuillemaladie(); + /* + $.ajax({ + // url: $("#racineWeb").val()+"Ajaxenregistreroptique/videroptiquetemp/", + url: $("#racineWeb").val()+"Ajaxenregistrerexamen/viderexamentemp/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + feuillemaladie(); + }, + complete: function() { + } + }); + */ + } +} + +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éjà effectué!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeMedecin = $("#codeMedecin").val(); + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + 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éro 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) +{ + v_msg="Confirmez-vous la suppression de cet examen?"; + v_msgEng="Do you confirm the removal of this exam?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'idExamen='+idExamen; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailprescriptionexamen/supprimer/", + type: 'POST', + data: donnees, + success: function(data) { + $("#examens").html(data); + }, + error: function(data) { + }, + complete: function() { + prescription_examen(); + } + }); + } +} + +function enregistrerprescriptionexamen() +{ + 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(); + nbBonsOrd = $("#nbBonsOrd").val(); + + numeroBonSave = $("#numeroBonSave").val(); + + codeMedecin = $("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + $("#nomMedecin").focus(); + return; + } + + if (codeGestionBon=="0") + { + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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éro 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 prescription?"; + } + else + { + numeroBon = "-1"; + v_msg="Confirmez-vous cette prescription?"; + v_msgEng="Do you confirm this prescription?"; + } + + /* + v_msg="Confirmez-vous ce No de bon?"; + v_msgEng="Do you confirm this number of prescription?"; + */ + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'numeroBon='+numeroBon+'&codeMedecin='+codeMedecin; + + // ajout du 27/06/2019 => prise en compte de la gestion paperless + donnees += '&codeGestionBon='+codeGestionBon; + + $("#btn_enreg").disable(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionexamen/enregistrerprescriptionexamen/", + type : 'post', + data: donnees, + error: function(errorData) { + // $("#msgErreur").html(errorData); + }, + success: function(data) + { + // $('#div_test_gabarit').html(data); + }, + complete: function() { + v_msg="Prescription enregistrée avec succès"; + v_msgEng="Saved successfully!"; + alert_ebene(v_msg, v_msgEng); + + prescription_examen(); + } + }); + } +} + +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('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteexamenspossibles/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_liste_actes_possibles").html(data); + } + }); +} + +function ajouter_examen_possible(codeActe, libelleActe, acteExclu, ententePrealable) +{ + typeSms="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+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'codeActe='+codeActe+'&ententePrealable='+ententePrealable; + + if (ententePrealable==1) + { + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + donnees_sav = donnees+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailprescriptionexamen/ajouterexamen/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + if(ententePrealable==1) + { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + } + + // prescription_examen(); + + }, + complete: function() { + if(ententePrealable==1) + { + mettremailattente(donnees_sav); + } + + 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é!"; + 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() +{ + actVisible=$("#actVisible").val(); + + // if (actVisible!="1" && modeSaisieFacture!="1") + if (actVisible!="1") + { + v_msg="Non autorisée!"; + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroExamen=$("#numeroExamen_C").val(); + + if (numeroExamen==0) + { + v_msg="Aucun examen prescrit!"; + v_msgEng="No prescribed exam!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Examensmedicaux/"); +} + + +function valider_examen_cso() +{ + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + nbLivre=$("#nbLivre").val(); + nbLivre = parseInt(nbLivre); + + if (nbLivre<1) + { + v_msg="Rien à enregitrer!"; + v_msgEng="Nothing to save!"; + + alert_ebene(v_msg, v_msgEng); + feuillemaladie(); + } + else + { + v_msg="Confirmez-vous ces examens?"; + v_msgEng="Do you confirm these exams?"; + } + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailexamen/enregistrerexamen/", + type: 'POST', + success: function(data) { + maj_fraisexclu_cso(); + }, + error: function(data) { + }, + complete: function() { + feuillemaladie(); + } + }); + } +} + +function ajouterexamen_tous() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailexamen/ajouterexamentous/", + type: 'POST', + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite_cso(); + } + }); +} + +function ajouterexamen(idExamen, ententePrealable, codeActe) +{ + donnees = 'idExamen='+idExamen+'&codeActe='+codeActe+'&ententePrealable='+ententePrealable; + + typeSms="ententeprealable"; + + if (ententePrealable==9) + { + v_msg="Acte refusé!"; + v_msgEng="Act refused!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (ententePrealable==2) + { + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + donnees_sav = donnees+'&codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailexamen/ajouterexamen/", + type: 'POST', + data: donnees, + success: function(data) { + $("#livraison").html(data); + + if(ententePrealable=="2") + { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + } + }, + error: function(data) { + }, + complete: function() { + if(ententePrealable=="2") + { + mettremailattente(donnees_sav); + } + } + }); +} + +function retirerexamen_tous() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailexamen/retirerexamentous/", + type: 'POST', + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function retirerexamen(idExamen) +{ + donnees = 'idExamen='+idExamen; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailexamen/retirerexamen/", + type: 'POST', + data: donnees, + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function consulter_limite_avant_facturation_cons() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturecons/"); + */ +} + +function consulter_limite_avant_facturation() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacture/"); + */ +} + + + +function consulter_limite_avant_facturation_cons_ben() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfactureconsben/"); + */ +} + +function consulter_limite_avant_facturation_pha() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturepha/"); + */ +} + +function consulter_limite_avant_facturation_pha_cons() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturephacons/"); + */ +} + +function consulter_limite_avant_facturation_pha_cons_ben() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturephaconsben/"); + */ +} + +function actualiser_opticien() +{ + window.location.assign($("#racineWeb" ).val()+"Opticien/"); +} + +function reinitialiser_opticien() +{ + window.location.assign($("#racineWeb" ).val()+"Opticien/0"); +} + + +function consulter_limite_avant_facturation_opt() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Plafondavantfactureopt/"); + */ +} + +function consulter_limite_avant_facturation_opt_cons() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfactureoptcons/"); + */ +} + +function consulter_limite_avant_facturation_opt_cons_ben() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfactureoptconsben/"); + */ +} + +function ajouterexamen_lab_tous() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetaillaboratoire/ajouterexamentous/", + type: 'POST', + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + } + }); +} + +function ajouterexamen_lab(idExamen) +{ + donnees = 'idExamen='+idExamen; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetaillaboratoire/ajouterexamen/", + type: 'POST', + data: donnees, + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + } + }); +} + + +function retirerexamen_lab(idExamen) +{ + donnees = 'idExamen='+idExamen; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetaillaboratoire/retirerexamen/", + type: 'POST', + data: donnees, + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + } + }); +} + +function ctrlkeypress_examens_possibles_lab(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + afficher_pop_recherche_examens_possibles_lab(); + } +} + +function afficher_pop_recherche_examens_possibles_lab() +{ + libelleActeSearch = $("#libelleActeSearch").val(); + + if(libelleActeSearch<=" ") + { + return; + } + + donnees = "valid=1&libelleActeSearch="+libelleActeSearch; + + $("#div_liste_actes_possibles").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteexamenspossibleslab/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_liste_actes_possibles").html(data); + } + }); +} + +function consulter_limite_avant_facturation_lab() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturelab/"); + */ +} + +function actualiser_laboratoire() +{ + window.location.assign($("#racineWeb" ).val()+"Laboratoire/"); +} + +function valider_examen_lab() +{ + actVisible=$("#actVisible").val(); + + // if (actVisible!="1" && modeSaisieFacture!="1") + if (actVisible!="1") + { + v_msg="Non autorisée!"; + 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; + } + + numeroExamen=$("#numeroExamen_C").val(); + + if (numeroExamen<="0") + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + facture=$("#facture").val(); + facture = parseInt(facture); + + if (facture>0) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nbLivre=$("#nbLivre").val(); + nbLivre = parseInt(nbLivre); + + if (facture==0 && nbLivre<1) + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ces actes?"; + v_msgEng="Do you confirm those acts?"; + // alert_ebene(v_msg, v_msgEng); + + if(confirm_ebene(v_msg, v_msgEng)) + { + user_id_0 = $("#user_id_C").val(); + + modeSaisieFacture=$("#modeSaisieFacture").val(); + derogationFingerFacturation=$("#derogationFingerFacturation").val(); + if(modeSaisieFacture=="1" || derogationFingerFacturation=="1") + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_lab(user_id_0); + return; + } + + derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); + if(derogation_finger_en_cours>0) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_lab(user_id_0); + } + else + { + beneficiaire = $("#beneficiaire_C").val(); + user_id =$("#user_id_C").val(); + finger_id =$("#finger_id_C").val(); + + $("#facturation").val("1"); + + data = "action=index&user_id="+user_id+"&user_name="+beneficiaire+"&finger="+finger_id+"&facturation=1"; + + load("flexcode/user.php?"+data); + } + } +} + +function retirerexamen_lab_tous() +{ + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetaillaboratoire/retirerexamentous/", + type: 'POST', + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + // actualiser_pharmacien(); + } + }); +} + +function facturer_lab(user_id) +{ + facture=$("#facture").val(); + facture = parseInt(facture); + + if (facture>0) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nbLivre=$("#nbLivre").val(); + nbLivre = parseInt(nbLivre); + + if (facture==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=maillabo'; + + typeSms = "facturer_lab"; + + donnees_retour =""; + + 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()+"Ajaxdetaillaboratoire/enregistrerlaboratoire/", + type: 'POST', + data: donnees_substitut, + success: function(data) { + preparesms_adherent(typeSms); + }, + error: function(data) { + }, + complete: function() { + preparemail_adherent(typeSms); + + v_msg="Facturation effectuée avec succès!"; + v_msgEng="Billing done successfully!"; + alert_ebene(v_msg, v_msgEng); + + window.location.assign($("#racineWeb" ).val()+"Laboratoire/"); + } + }); +} + +function prescrire_examen_lab(codeActe, libelleActe, acteExclu, ententePrealable) +{ + typeSms="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+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'codeActe='+codeActe+'&ententePrealable='+ententePrealable; + + if (ententePrealable==1) + { + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + donnees_sav = donnees+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetaillaboratoire/ajouterexamenprescription/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#btn_close_pop_acte").click(); + $("#livraison").html(data); + + if(ententePrealable==1) + { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + } + }, + complete: function() { + if(ententePrealable==1) + { + mettremailattente(donnees_sav); + } + alerter_depassement_limite(); + } + }); + } +} + +function enregistrer_nv_consommables() +{ + libelleconsommable = $("#libelleconsommable").val(); + + if (libelleconsommable<=" ") + { + v_msg="Veuillez saisir le nom!"; + v_msgEng="Please enter tyhe name!"; + alert_ebene(v_msg, v_msgEng); + $("#libelleconsommable").focus(); + return; + } + + quantiteconsommable=$("#quantiteconsommable").val(); + quantiteconsommable=quantiteconsommable.replace(",","."); + $("#quantiteconsommable").val(quantiteconsommable); + + if(isNaN(quantiteconsommable)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#quantiteconsommable").val("0"); + $("#quantiteconsommable").focus(); + return; + } + + if(quantiteconsommable==0) + { + $("#quantiteconsommable").focus(); + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + prixconsommable=$("#prixconsommable").val(); + prixconsommable=prixconsommable.replace(",","."); + $("#prixconsommable").val(prixconsommable); + + if(isNaN(prixconsommable)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#prixconsommable").val("0"); + $("#prixconsommable").focus(); + return; + } + + if(prixconsommable==0) + { + $("#prixconsommable").focus(); + v_msg="Veuillez saisir le prix!"; + v_msgEng="Please enter the price!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + donnees = 'libelleconsommable='+libelleconsommable+'&prixconsommable='+prixconsommable+'&quantiteconsommable='+quantiteconsommable; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteconsommables/creerconsommable/", + type: 'POST', + data: donnees, + success: function(data) { + // $('#div_test_gabarit').html(data); + }, + error: function(data) { + }, + complete: function() { + afficher_consommable(); + } + }); +} + +function ajax_maj_prix_consommable(idConsommable, valeurActe, controle) +{ + valeurActe=valeurActe.replace(",","."); + controle.value=valeurActe; + + if(controle_numerique(controle)) + { + if(valeurActe==0) + { + controle.focus(); + v_msg="Veuillez saisir le prix!"; + v_msgEng="Please enter the price!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idConsommable='+idConsommable+"&valeurActe="+valeurActe; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteconsommables/majprix/", + type: 'POST', + data: donnees, + success: function(data) { + // $('#div_test_gabarit').html(data); + }, + error: function(data) { + }, + complete: function() { + afficher_consommable(); + } + }); + } +} + +function remplacer_feuillemaladie() +{ + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Remplacerfeuille/"); +} + +function ajaxinfosremplacerbonconsultation() +{ + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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); + + $("#msgErreur").html(""); + $("#codeEtatBon").val(""); + + $("#numeroBon").focus(); + return; + } + + donnees = "numeroBon="+numeroBon; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosremplacerbonconsultation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infosbon").html(data); + }, + complete: function() { + } + }); +} + +function enregistrerremplacementconsultation() +{ + numeroBonSave = $("#numeroBonSave").val(); + + motifremplacement = $("#motifremplacement").val(); + + if (motifremplacement<=" ") + { + v_msg="Veuillez saisir le otif du remplacement!"; + v_msgEng="Please enter the reason!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifremplacement").focus(); + return; + } + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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éro 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?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); + OldnumeroBon = $("#OldnumeroBon").val(); + + donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie+'&numeroBon='+numeroBon+'&OldnumeroBon='+OldnumeroBon+'&motifremplacement='+motifremplacement; + + // donnees += '&dateSurvenance='+dateSurvenance+'&observations='+observations+'&prixActe='+prixActe; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosremplacerbonconsultation/enregistrerremplacementconsultation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + v_msg="Feuille remplacée avec succès!"; + v_msgEng="Replaced successfully!"; + alert_ebene(v_msg, v_msgEng); + + feuillemaladie(); + } + }); + } +} + +function remplacer_ordonnance() +{ + bonCaduc=$("#bonCaduc").val(); + if (bonCaduc==1) + { + v_msg="Bon caduc!"; + v_msgEng="Obsolete!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + facture=$("#facture").val(); + + if (facture!=1) + { + v_msg="Pas encore facturé, vous pouvez modifier l\'ordonnance!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroBonOrdonnance = $("#numeroBonOrdonnance").val(); + numeroBonOrdonnance = parseInt(numeroBonOrdonnance); + + /* + if (numeroBonOrdonnance<=0) + { + v_msg="Pas de prescription!"; + v_msgEng="No prescription!"; + 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; + } + + derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); + if(derogation_finger_en_cours>0) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + fiche_remplacer_ordonnance(); + } + else + { + beneficiaire = $("#beneficiaire_C").val(); + user_id =$("#user_id_C").val(); + finger_id =$("#finger_id_C").val(); + + $("#remplacerordonnance").val("1"); + + data = "action=index&user_id="+user_id+"&user_name="+beneficiaire+"&finger="+finger_id+"&remplacerordonnance=1"; + + load("flexcode/user.php?"+data); + } +} + +function fiche_remplacer_ordonnance() +{ + window.location.assign($("#racineWeb" ).val()+"Remplacerordonnance/"); +} + +function ajaxinfosremplacerordonnance() +{ + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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); + + $("#msgErreur").html(""); + $("#codeEtatBon").val(""); + + $("#numeroBon").focus(); + return; + } + + donnees = "numeroBon="+numeroBon; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosremplacerordonnence/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infosbon").html(data); + }, + complete: function() { + } + }); +} + +function enregistrerremplacementordonnance() +{ + numeroBonSave = $("#numeroBonSave").val(); + + motifremplacement = $("#motifremplacement").val(); + + if (motifremplacement<=" ") + { + v_msg="Veuillez saisir le otif du remplacement!"; + v_msgEng="Please enter the reason!"; + alert_ebene(v_msg, v_msgEng); + $("#motifremplacement").focus(); + return; + } + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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éro 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?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); + OldnumeroBon = $("#OldnumeroBon").val(); + + donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie+'&numeroBon='+numeroBon+'&OldnumeroBon='+OldnumeroBon+'&motifremplacement='+motifremplacement; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosremplacerordonnence/enregistrerremplacementordonnance/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + v_msg="Ordonnance remplacée avec succès!"; + v_msgEng="Replaced successfully!"; + alert_ebene(v_msg, v_msgEng); + + prescription_medicament(); + } + }); + } +} + +function afficher_laboratoire_cso() +{ + window.location.assign($("#racineWeb" ).val()+"Laboratoirecso/"); +} + + +function afficher_seance_cso() +{ + window.location.assign($("#racineWeb" ).val()+"Kinecso/"); +} + +function consulter_limite_avant_facturation_lab_cso() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturelabcso/"); + */ +} + +function rechercherbonexamen_lab() +{ + numeroBonExamen=$("#numeroBonExamen").val(); + + if (numeroBonExamen>" ") + { + chercher_ordonnance_lab(numeroBonExamen); + } +} + +function rechercherbonexamen_lab_cso() +{ + numeroBonExamen=$("#numeroBonExamen").val(); + + if (numeroBonExamen>" ") + { + chercher_ordonnance_lab_cso(numeroBonExamen); + } +} + +function chercher_ordonnance_lab_cso(numeroBonExamen) +{ + donnees = 'numeroBonExamen='+numeroBonExamen; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxchangerordonnancelab/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + afficher_laboratoire_cso(); + } + }); +} + +function valider_examen_lab_cso() +{ + actVisible=$("#actVisible").val(); + + if (actVisible!="1") + { + v_msg="Non autorisée!"; + 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; + } + + numeroExamen=$("#numeroExamen_C").val(); + + if (numeroExamen<="0") + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + /* + facture=$("#facture").val(); + facture = parseInt(facture); + + if (facture>0) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + nbLivre=$("#nbLivre").val(); + nbLivre = parseInt(nbLivre); + + // alert("nbLivre => "+nbLivre); + // return; + + // if (facture==0 && nbLivre<1) + if (nbLivre<1) + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ces actes?"; + v_msgEng="Do you confirm those acts?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + user_id_0 = $("#user_id_C").val(); + + modeSaisieFacture=$("#modeSaisieFacture").val(); + derogationFingerFacturation=$("#derogationFingerFacturation").val(); + if(modeSaisieFacture=="1" || derogationFingerFacturation=="1") + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_lab_cso(user_id_0); + return; + } + + derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); + if(derogation_finger_en_cours>0) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_lab_cso(user_id_0); + } + else + { + beneficiaire = $("#beneficiaire_C").val(); + user_id = $("#user_id_C").val(); + finger_id = $("#finger_id_C").val(); + + $("#facturation").val("1"); + + data = "action=index&user_id="+user_id+"&user_name="+beneficiaire+"&finger="+finger_id+"&facturation=1"; + + load("flexcode/user.php?"+data); + } + } +} + +function facturer_lab_cso(user_id) +{ + facture=$("#facture").val(); + facture = parseInt(facture); + + if (facture>0) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + nbLivre=$("#nbLivre").val(); + nbLivre = parseInt(nbLivre); + + if (facture==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=maillabo'; + + typeSms = "facturer_lab"; + + 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()+"Ajaxdetaillaboratoire/enregistrerlaboratoire/", + type: 'POST', + data: donnees_substitut, + success: function(data) { + preparesms_adherent(typeSms); + }, + error: function(data) { + }, + complete: function() { + preparemail_adherent(typeSms); + + v_msg="Facturation effectuée avec succès!"; + v_msgEng="Billing done successfully!"; + alert_ebene(v_msg, v_msgEng); + + afficher_laboratoire_cso(); + + } + }); +} + +function prescription_seance() +{ + actVisible=$("#actVisible").val(); + + modeSaisieFeuille=$("#modeSaisieFeuille").val(); + + if (modeSaisieFeuille=="1" && saisirFactureDecompte!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (actVisible!="1") + { + v_msg="Non autorisée!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Prescriptionseance/"); +} + + +function seances() +{ + actVisible=$("#actVisible").val(); + + // if (actVisible!="1" && modeSaisieFacture!="1") + if (actVisible!="1") + { + v_msg="Non autorisée!"; + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroPrescriptionKine=$("#numeroPrescriptionKine_C").val(); + + if (numeroPrescriptionKine==0) + { + v_msg="Aucune séance prescrite!"; + v_msgEng="No prescribed session!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Seances/"); +} + +function ajaxinfosbonprescriptionseance() +{ + 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; + } + + numeroBonKine = $("#numeroBonKine").val(); + numeroBonKine = parseInt(numeroBonKine); + if (numeroBonKine>0) + { + v_msg="Déjà effectué!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeMedecin = $("#codeMedecin").val(); + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroBon").val(""); + $("#btn_enreg").disable(); + $("#msgErreur").html(""); + $("#codeEtatBon").val(""); + + $("#nomMedecin").focus(); + return; + } + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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()+"Ajaxinfosbonseance/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infosbon").html(data); + }, + complete: function() { + } + }); +} + +function enregistrerprescriptionseance() +{ + 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(); + nbBonsOrd = $("#nbBonsOrd").val(); + + numeroBonSave = $("#numeroBonSave").val(); + + codeMedecin = $("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + // $("#codeMedecin").focus(); + $("#nomMedecin").focus(); + return; + } + + if (codeGestionBon=="0") + { + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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éro 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 prescription?"; + } + else + { + numeroBon = "-1"; + v_msg="Confirmez-vous cette prescription?"; + v_msgEng="Do you confirm this prescription?"; + } + + /* + v_msg="Confirmez-vous ce No de bon?"; + v_msgEng="Do you confirm this number of prescription?"; + */ + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'numeroBon='+numeroBon+'&codeMedecin='+codeMedecin; + + // ajout du 27/06/2019 => prise en compte de la gestion paperless + donnees += '&codeGestionBon='+codeGestionBon; + + $("#btn_enreg").disable(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionseance/enregistrerprescriptionseance/", + type : 'post', + data: donnees, + error: function(errorData) { + // $("#msgErreur").html(errorData); + }, + success: function(data) + { + // $('#div_test_gabarit').html(data); + }, + complete: function() { + v_msg="Prescription enregistrée avec succès"; + v_msgEng="Saved successfully!"; + alert_ebene(v_msg, v_msgEng); + + prescription_seance(); + } + }); + } +} + +function modifierprescriptionseance() +{ + acteExclu = $("#acteExclu").val(); + ententePrealable = $("#ententePrealableSea").val(); + autorisation = "0"; + + if(acteExclu==1) + { + v_msg="Acte non couvert!"; + v_msgEng="Not covered!"; + alert_ebene(v_msg, v_msgEng); + $("#codeActe").focus(); + return; + } + + codeMedecin = $("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + // $("#codeMedecin").focus(); + $("#nomMedecin").focus(); + return; + } + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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; + } + + codeActePrescription = $("#codeActe").val(); + + if (codeActePrescription<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + // $("#codeActePrescription").focus(); + return; + } + + quantite =$("#quantite").val(); + + quantite = parseInt(quantite); + + if(quantite<1) + { + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + // $("#quantite").focus(); + return; + } + + div_prix = $("#prixActe"); + prixActe = div_prix.val(); + + /* + if(prixActe==0) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + v_msg="Confirmez-vous cette presciption ?"; + v_msgEng="Do you confirm this prescription?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + if(ententePrealable==1) + { + ententePrealable = "2"; + } + + montantTm =$("#montantTm").val(); + montantArembourser =$("#aRembourser").val(); + fraisReel =$("#totalActe").val(); + + donnees = 'codeActePrescription='+codeActePrescription +'&quantite='+quantite +'&prixActe='+prixActe; + donnees += '&montantTm='+montantTm +'&montantArembourser='+montantArembourser +'&fraisReel='+fraisReel; + donnees += '&ententePrealable='+ententePrealable; + + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + + donnees_sav = 'codeActe='+codeActePrescription+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; + donnees_sav2 = 'codeActe='+codeActePrescription+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailautorisation'; + + typeSms="ententeprealable"; + typeSms2="autorisation"; + + $("#btn_enreg_seance").disable(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerprescriptionseance/modifierprescriptionseance/", + type : 'post', + data: donnees, + error: function(errorData) { + $("#msgErreur").html(errorData); + }, + success: function(data) { + if(ententePrealable=="2") + { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + } + + if(autorisation=="2") + { + preparesms(typeSms2); + + v_msg="Demande autorisation envoyée!"; + v_msgEng="Request for authorization sent!"; + alert_ebene(v_msg, v_msgEng); + } + }, + complete: function() + { + if(ententePrealable=="2") + { + mettremailattente(donnees_sav); + } + + if(autorisation=="2") + { + mettremailattente(donnees_sav2); + } + + v_msg="Prescription enregistrée avec succès"; + v_msgEng="Saved successfully!"; + alert_ebene(v_msg, v_msgEng); + + prescription_seance(); + } + }); + } +} + +function ajaxprixseance() +{ + $("#prixActe_info").val("0"); + $("#montantTm_info").val("0"); + $("#aRembourser_info").val("0"); + // $("#quantite_info").val("0"); + + codeActe = $("#codeActe").val(); + + if (codeActe<=" ") + { + v_msg="Veuillez sélectionner un act!"; + 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 le nombre de séances!"; + v_msgEng="Please enter the number of sessions!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + // on va griser le bouton btn_enreg_seance + $("#btn_enreg_seance").disable(); + + donnees = 'codeActe='+codeActe+'&quantite='+quantite; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprixseance/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infosacte").html(data); + }, + complete: function() { + } + }); +} + +function valider_presciption_seances() +{ + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroBonKine=$("#numeroBonKine").val(); + if (numeroBonKine<=0) + { + v_msg="Pas de prescription!"; + v_msgEng="No prescription!"; + alert_ebene(v_msg, v_msgEng); + + // feuillemaladie(); + return; + } + + codeActePrescription = $("#codeActePrescription").val(); + + if (codeActePrescription<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#btn_prescrire").click(); + + return; + } + + nbSeance=$("#nbSeance").val(); + nbSeance = parseInt(nbSeance); + + if (nbSeance<1) + { + v_msg="Veuillez saisir le nombre de séances!"; + v_msgEng="Please enter the number of sessions!"; + alert_ebene(v_msg, v_msgEng); + + $("#btn_prescrire").click(); + + return; + } + + v_msg="Confirmez-vous cette presciption ?"; + v_msgEng="Do you confirm this prescription?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + feuillemaladie(); + } +} + +function valider_seance_cso() +{ + ententePrealableSea=$("#ententePrealableSea").val(); + + if (ententePrealableSea>1) + { + v_msg="Entente préalable!"; + v_msgEng="Prior agreement!"; + 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(); + nbBonsCons = $("#nbBonsCons").val(); + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroBonSeance=$("#numeroBonSeance_C").val(); + + if (numeroBonSeance<="0") + { + v_msg="Veuillez sélectionner un bon!"; + v_msgEng="Please enter a prescription number!"; + alert_ebene(v_msg, v_msgEng); + + $("#btn_InitSession").click(); + return; + } + + div_quantite = $("#quantiteSeance"); + 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 le nombre de séances!"; + v_msgEng="Please enter the number of sessions!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + div_prix = $("#prixActe"); + prixActe = div_prix.val(); + + if(prixActe==0) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + + v_msg="Confirmez-vous ces séances?"; + v_msgEng="Do you confirm these sessions?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + // ajout du 27/06/2019 => prise en compte de la gestion paperless + donnees = 'codeGestionBon='+codeGestionBon; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailseance/enregistrerseance/", + type: 'POST', + data: donnees, + success: function(data) + { + // $('#div_test_gabarit').html(data); + + maj_fraisexclu_cso(); + }, + error: function(data) + { + }, + complete: function() + { + feuillemaladie(); + } + }); + } +} + +function actualiser_seance() +{ + window.location.assign($("#racineWeb" ).val()+"Seances/"); +} + +// SEANCES KINE +function valider_seance_sea_cso() +{ + ententePrealableSea=$("#ententePrealableSea").val(); + + if (ententePrealableSea>1) + { + v_msg="Entente préalable!"; + v_msgEng="Prior agreement!"; + 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(); + nbBonsCons = $("#nbBonsCons").val(); + + 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; + } + + numeroBonSeance=$("#numeroBonSeance_C").val(); + + if (numeroBonSeance<="0") + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeActe = $("#codeActe").val(); + + if (codeActe<=" ") + { + v_msg="Veuillez sélectionner un act!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + quantiteSeance=$("#quantiteSeance").val(); + + if (quantiteSeance<=0) + { + v_msg="Veuillez revoir la quantité!"; + v_msgEng="Please review the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + fraisRetenuSeance=$("#fraisRetenuSeance").val(); + + if (fraisRetenuSeance<=0) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ces séances?"; + v_msgEng="Do you confirm those sessions?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + user_id_0 = $("#user_id_C").val(); + + modeSaisieFacture=$("#modeSaisieFacture").val(); + derogationFingerFacturation=$("#derogationFingerFacturation").val(); + if(modeSaisieFacture=="1" || derogationFingerFacturation=="1") + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_sea_cso(user_id_0); + return; + } + + derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); + if(derogation_finger_en_cours>0) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_sea_cso(user_id_0); + } + else + { + beneficiaire = $("#beneficiaire_C").val(); + user_id =$("#user_id_C").val(); + finger_id =$("#finger_id_C").val(); + + $("#facturation").val("1"); + + data = "action=index&user_id="+user_id+"&user_name="+beneficiaire+"&finger="+finger_id+"&facturation=1"; + + // load("flexcode/user.php?"+data); + load("flexcode/user_facturation.php?"+data); + } + } +} + +function facturer_sea_cso(user_id) +{ + 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(); + nbBonsCons = $("#nbBonsCons").val(); + + cout = $("#cout").val(); + + if (cout==0) + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + prixActe = $("#prixActe").val(); + 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=mailkine'; + + typeSms = "facturer_sea"; + + 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; + + // ajout du 27/06/2019 => prise en compte de la gestion paperless + // donnees += '&codeGestionBon='+codeGestionBon; + donnees_substitut += '&codeGestionBon='+codeGestionBon; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturatioseancesea/facturerseance/", + type: 'POST', + data: donnees_substitut, + success: function(data) + { + // $('#div_test_gabarit').html(data); + preparesms_adherent(typeSms); + }, + error: function(data) { + }, + complete: function() + { + preparemail_adherent(typeSms); + + v_msg="Facturation effectuée avec succès!"; + v_msgEng="Billing done successfully!"; + alert_ebene(v_msg, v_msgEng); + + afficher_seance_cso(); + } + }); + +} + +function rechercherbonkine_sea() +{ + numeroBonKine=$("#numeroBonKine").val(); + + if (numeroBonKine>" ") + { + chercher_ordonnance_sea(numeroBonKine); + } +} + +function chercher_ordonnance_sea(numeroBonKine) +{ + $("#numeroBonSeance_C").val("-1"); + donnees = 'numeroBonKine='+numeroBonKine; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxchangerordonnancesea/", + type: 'POST', + data: donnees, + success: function(data) { + window.location.assign($("#racineWeb" ).val()+"Kine/"); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function ctrlkeypressordsea(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + numeroBonKine=$("#numeroBonKine").val(); + $("#numeroBonKine").blur(); + } +} + +function rechercherbonkine_sea_cso() +{ + numeroBonKine=$("#numeroBonKine").val(); + + if (numeroBonKine>" ") + { + chercher_ordonnance_sea_cso(numeroBonKine); + } +} + +function chercher_ordonnance_sea_cso(numeroBonKine) +{ + $("#numeroBonSeance_C").val("-1"); + donnees = 'numeroBonKine='+numeroBonKine; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxchangerordonnancesea/", + type: 'POST', + data: donnees, + success: function(data) { + window.location.assign($("#racineWeb" ).val()+"Kinecso/"); + }, + error: function(data) { + }, + complete: function() { + } + }); + +} + + +function ajaxinfosbonseancekine() +{ + 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; + } + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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_bon_kine").disable(); + $("#msgErreur").html(""); + $("#codeEtatBon").val(""); + + $("#numeroBon").focus(); + return; + } + + donnees = "numeroBon="+numeroBon; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosbonseancekine/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infosbon").html(data); + }, + complete: function() { + } + }); +} + +function enregistrerbonsseancekine() +{ + 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(); + nbBonsCons = $("#nbBonsCons").val(); + + if (codeGestionBon=="0") + { + numeroBonSave = $("#numeroBonSave").val(); + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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éro 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"; + numeroBon = "1"; + v_msg="Confirmez-vous ce dossier?"; + v_msgEng="Do you confirm this claim?"; + } + + /* + v_msg="Confirmez-vous ce No de bon?"; + v_msgEng="Do you confirm this number of presciption?"; + */ + + if(confirm_ebene(v_msg, v_msgEng)) + { + + donnees = "numeroBon="+numeroBon; + + // ajout du 27/06/2019 => prise en compte de la gestion paperless + donnees += '&codeGestionBon='+codeGestionBon; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosbonseancekine/attributionbontemporaire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + // $('#div_test_gabarit').html(data); + }, + complete: function() { + afficher_facturation_seance(); + } + }); + } +} + + +function afficher_facturation_seance() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturatioseancesea/", + // type : 'post', + // data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#btn_close_pop_session").click(); + $("#div_facturation_seance").html(data); + }, + complete: function(data) { + $("#numeroBonSeance_C").val($("#numeroBonSeance_info").val()); + } + }); +} + +function ajaxprixseancesea() +{ + codeActe = $("#codeActe").val(); + + if (codeActe<=" ") + { + $("#prixActe_info").val("0"); + $("#totalActe_info").val("0"); + $("#montantTm_info").val("0"); + $("#aRembourser_info").val("0"); + + v_msg="Veuillez sélectionner un act!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + div_quantite = $("#quantiteSeance"); + quantite = div_quantite.val(); + + if(quantite=="") + { + quantite = "0"; + } + + div_quantite.val(quantite); + + quantite = parseInt(quantite); + + if(quantite==0) + { + div_quantite.val(1); + + quantite = 1; + /* + div_quantite.focus(); + v_msg="Veuillez saisir le nombre de séances!"; + v_msgEng="Please enter the number of sessions!"; + alert_ebene(v_msg, v_msgEng); + + return; + */ + } + + div_nbRestant = $("#nbRestant"); + nbRestant = div_nbRestant.val(); + nbRestant = parseInt(nbRestant); + + if(quantite>nbRestant) + { + // div_quantite.focus(); + v_msg="Vous ne pouvez pas dépasser "+nbRestant+" séances!"; + v_msgEng="Only "+nbRestant+" sessions are possible!"; + alert_ebene(v_msg, v_msgEng); + + // return; + quantite = 0; + } + + donnees = 'codeActe='+codeActe+'&quantite='+quantite; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxprixseancesea/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infosacte").html(data); + }, + complete: function() { + } + }); +} + +// Facturation SEANCE KINE + +function valider_seance_sea() +{ + ententePrealableSea=$("#ententePrealableSea").val(); + + if (ententePrealableSea>1) + { + v_msg="Entente préalable!"; + v_msgEng="Prior agreement!"; + 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(); + nbBonsCons = $("#nbBonsCons").val(); + + 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; + } + + numeroBonSeance=$("#numeroBonSeance_C").val(); + + if (numeroBonSeance<="0") + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + codeActe = $("#codeActe").val(); + + if (codeActe<=" ") + { + v_msg="Veuillez sélectionner un act!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeActe").focus(); + return; + } + + fraisRetenuSeance=$("#fraisRetenuSeance").val(); + + if (fraisRetenuSeance<=0) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous ces séances?"; + v_msgEng="Do you confirm those sessions?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + user_id_0 = $("#user_id_C").val(); + + modeSaisieFacture=$("#modeSaisieFacture").val(); + derogationFingerFacturation=$("#derogationFingerFacturation").val(); + if(modeSaisieFacture=="1" || derogationFingerFacturation=="1") + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_sea(user_id_0); + return; + } + + derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); + if(derogation_finger_en_cours>0) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_sea(user_id_0); + } + else + { + beneficiaire = $("#beneficiaire_C").val(); + user_id =$("#user_id_C").val(); + finger_id =$("#finger_id_C").val(); + + $("#facturation").val("1"); + + data = "action=index&user_id="+user_id+"&user_name="+beneficiaire+"&finger="+finger_id+"&facturation=1"; + + load("flexcode/user.php?"+data); + } + } +} + +function facturer_sea(user_id) +{ + 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(); + nbBonsCons = $("#nbBonsCons").val(); + + cout = $("#cout").val(); + + if (cout==0) + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + prixActe = $("#prixActe").val(); + 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=mailkine'; + + typeSms = "facturer_sea"; + + 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; + // ajout du 27/06/2019 => prise en compte de la gestion paperless + donnees_substitut += '&codeGestionBon='+codeGestionBon; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturatioseancesea/facturerseance/", + type: 'POST', + data: donnees_substitut, + success: function(data) + { + preparesms_adherent(typeSms); + }, + error: function(data) { + }, + complete: function() + { + preparemail_adherent(typeSms); + + v_msg="Facturation effectuée avec succès!"; + v_msgEng="Billing done successfully!"; + alert_ebene(v_msg, v_msgEng); + + // window.location.assign($("#racineWeb" ).val()+"Kine/"); + afficher_seance_kine(); + } + }); +} + +/* +function rechercherbonexamen_lab_cso() +{ + numeroBonExamen=$("#numeroBonExamen").val(); + + if (numeroBonExamen>" ") + { + chercher_ordonnance_lab_cso(numeroBonExamen); + } +} +*/ + +// 19/11/2017 + +function enregistrerbonsseancekinecso() +{ + 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(); + nbBonsCons = $("#nbBonsCons").val(); + + if (codeGestionBon=="0") + { + numeroBonSave = $("#numeroBonSave").val(); + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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éro 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"; + numeroBon = "1"; + v_msg="Confirmez-vous ce dossier?"; + v_msgEng="Do you confirm this claim?"; + } + + /* + v_msg="Confirmez-vous ce No de bon?"; + v_msgEng="Do you confirm this number of presciption?"; + */ + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = "numeroBon="+numeroBon; + + // ajout du 27/06/2019 => prise en compte de la gestion paperless + donnees += '&codeGestionBon='+codeGestionBon; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosbonseancekinecso/attributionbontemporaire/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + // $('#div_test_gabarit').html(data); + }, + complete: function() + { + afficher_facturation_seance_cso(); + } + }); + } +} + + +function afficher_facturation_seance_cso() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturatioseancecso/", + error: function(errorData) { + }, + success: function(data) { + $("#btn_close_pop_session").click(); + $("#div_facturation_seance").html(data); + }, + complete: function(data) { + $("#numeroBonSeance_C").val($("#numeroBonSeance_info").val()); + } + }); +} + + +function ajaxinfosbonseancekinecso() +{ + 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; + } + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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_bon_kine").disable(); + $("#msgErreur").html(""); + $("#codeEtatBon").val(""); + + $("#numeroBon").focus(); + return; + } + + donnees = "numeroBon="+numeroBon; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxinfosbonseancekinecso/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infosbon").html(data); + }, + complete: function() { + } + }); +} + +function ajaxmajquteseancecso() +{ + div_prix = $("#prixActe"); + prixActe = div_prix.val(); + + if(prixActe==0) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + div_quantite = $("#quantiteSeance"); + 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 le nombre de séances!"; + v_msgEng="Please enter the number of sessions!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + div_nbRestant = $("#nbRestant"); + nbRestant = div_nbRestant.val(); + nbRestant = parseInt(nbRestant); + + if(quantite>nbRestant) + { + div_quantite.focus(); + v_msg="Vous ne pouvez pas dépasser "+nbRestant+" séances!"; + v_msgEng="Only "+nbRestant+" sessions are possible!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#btn_enreg_seance").disable(); + + donnees = 'prixActe='+prixActe+'&quantite='+quantite; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfacturatioseancecso/modifierseancecso/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + // $("#infoseance").html(data); + }, + complete: function() { + afficher_facturation_seance_cso(); + } + }); +} + + + +function consulter_limite_avant_facturation_kinecso(idFacture) +{ + /* + if (idFacture<=0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturekinecso/"+idFacture+"/"); + */ +} + + +function consulter_limite_avant_facturation_kine(idFacture) +{ + /* + if (idFacture<=0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturekine/"+idFacture+"/"); + */ +} + +function afficher_seance_kine() +{ + window.location.assign($("#racineWeb" ).val()+"Kine/"); +} + +// consulatation_ben + +function consultationbenlab() +{ + window.location.assign($("#racineWeb" ).val()+"Consultationbenlab/"); +} + +function consultationbensea() +{ + window.location.assign($("#racineWeb" ).val()+"Consultationbensea/"); +} + +function laboratoire() +{ + 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"); + $("#okId_face" ).val("1"); + } + else + { + finger_id = $("#finger_id_C" ).val(); + + if (finger_id==0) + { + v_msg="Veuillez procéder à 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 (okId!=1 && (okId_face!=1) + { + v_msg="Veuillez procéder à l\'identification avant!"; + v_msgEng="Please check identity before!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + } + */ + + window.location.assign($("#racineWeb" ).val()+"Laboratoire/"); + } +} + + +function seancekine() +{ + 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"); + $("#okId_face" ).val("1"); + } + else + { + finger_id = $("#finger_id_C" ).val(); + + if (finger_id==0) + { + v_msg="Veuillez procéder à 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 (okId!=1 && okId!=1) + { + v_msg="Veuillez procéder à l\'identification avant!"; + v_msgEng="Please check identity before!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + } + */ + + window.location.assign($("#racineWeb" ).val()+"Kine/"); + } +} + +function afficher_facture_cons_lab(idFacture, numeroBonExamen, codePrestataireLivraison) +{ + if (idFacture>"") + { + donnees = 'idFacture='+idFacture+'&numeroBonExamen='+numeroBonExamen+'&codePrestataireLivraison='+codePrestataireLivraison; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfacturelab/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + consulter_facture_lab(); + } + }); + } +} + +function consulter_facture_lab() +{ + window.location.assign($("#racineWeb" ).val()+"Laboratoirecons/"); +} + +function consulter_limite_avant_facturation_lab_cons() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturelabcons/"); + */ +} + +function afficher_facture_cons_lab_ben(idFacture, numeroBonExamen, codePrestataireLivraison) +{ + if (idFacture>"") + { + donnees = 'idFacture='+idFacture+'&numeroBonExamen='+numeroBonExamen+'&codePrestataireLivraison='+codePrestataireLivraison; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfacturelab/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + consulter_facture_lab_ben(); + } + }); + } +} + +function consulter_facture_lab_ben() +{ + window.location.assign($("#racineWeb" ).val()+"Laboratoireconsben/"); +} + +function consulter_limite_avant_facturation_lab_cons_ben() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfacturelabconsben/"); + */ +} + +function listerdossiercons_lab() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + donnees_sav = donnees; + + $("#detail_reglement").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconsultationlabentete/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#reglement").html(data); + }, + complete: function() { + } + }); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconsultationlab/", + type : 'post', + data: donnees_sav, + error: function(errorData) { + }, + success: function(data) { + $("#detail_reglement").html(data); + $("#detail_reglement").css("padding-top", "0px"); + }, + complete: function() { + } + }); +} + +function lister_factures_lab_ben() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + + $("#div_dossiers").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconsultationbenlab/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_dossiers").html(data); + }, + complete: function() { + } + }); +} + +function consultationsea() +{ + window.location.assign($("#racineWeb" ).val()+"Consultationsea/"); +} + +function listerdossiercons_sea() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + donnees_sav = donnees; + + $("#detail_reglement").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconsultationseaentete/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#reglement").html(data); + }, + complete: function() { + } + }); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconsultationsea/", + type : 'post', + data: donnees_sav, + error: function(errorData) { + }, + success: function(data) { + $("#detail_reglement").html(data); + $("#detail_reglement").css("padding-top", "0px"); + }, + complete: function() { + } + }); +} + +function consulter_facture_sea() +{ + window.location.assign($("#racineWeb" ).val()+"Kinecons/"); +} + +function consulter_limite_avant_facturation_sea_cons() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfactureseacons/"); + */ +} + +function lister_factures_sea_ben() +{ + d1=$("#d1").val(); + d2=$("#d2").val(); + + donnees = 'd1='+d1+'&d2='+d2; + + $("#div_dossiers").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + // url: $("#racineWeb").val()+"Ajaxconsultationbenlab/", + url: $("#racineWeb").val()+"Ajaxconsultationbensea/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_dossiers").html(data); + }, + complete: function() { + } + }); +} + +function afficher_facture_cons_sea(idFacture, numeroBonKine, codePrestataireLivraison) +{ + if (idFacture>"") + { + donnees = 'idFacture='+idFacture+'&numeroBonKine='+numeroBonKine+'&codePrestataireLivraison='+codePrestataireLivraison; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfacturesea/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + consulter_facture_sea(); + } + }); + } +} + + +function afficher_facture_cons_sea_ben(idFacture, numeroBonKine, codePrestataireLivraison) +{ + if (idFacture>"") + { + donnees = 'idFacture='+idFacture+'&numeroBonKine='+numeroBonKine+'&codePrestataireLivraison='+codePrestataireLivraison; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextfacturesea/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + consulter_facture_sea_ben(); + } + }); + } +} + +function consulter_facture_sea_ben() +{ + window.location.assign($("#racineWeb" ).val()+"Kineconsben/"); +} + +function consulter_limite_avant_facturation_sea_cons_ben() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfactureseaconsben/"); + */ +} + +function ctrlkeypress_numeroBon(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + $("#numeroBon").blur(); + } +} + +function verifier_feuille_maladie_dec_cons(numeroFeuilleMaladie, idFacture) +{ + $("#numeroFeuilleMaladie_C").val(numeroFeuilleMaladie); + numeroDecompte = $("#numeroDecompte").val(); + + // if (numeroFeuilleMaladie>"") + if (idFacture>"") + { + donnees = 'numeroFeuilleMaladie='+numeroFeuilleMaladie+'&numeroDecompte='+numeroDecompte+'&idFacture='+idFacture; + + codeTypePrestataire = $("#codeTypePrestataire_C").val(); + + if(codeTypePrestataire=="CSO" || codeTypePrestataire=="LAB" || codeTypePrestataire=="SEA") + { + + verifier_feuille_maladie_dec_cso_cons(donnees); + } + else + if(codeTypePrestataire=="PHA") + { + verifier_feuille_maladie_dec_pha_cons(donnees); + } + else + if(codeTypePrestataire=="OPT") + { + verifier_feuille_maladie_dec_opt_cons(donnees); + } + } +} + + +function imprimerbordereaudecompte() +{ + idReglement = $("#idReglement").val(); + + + if (idReglement>"0") + { + var div_wait = $('#div_wait'); + div_wait.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerdemandereglement/imprimerbordereaudecompte", + type: 'POST', + success: function(data) + { + div_wait.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); + } +} + +function verifier_feuille_maladie_dec_cso_cons(donnees) +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxverifierfacturecons/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_verification_facture").html(data); + }, + complete: function() { + $("#btn_pop").click(); + } + }); +} + +function verifier_feuille_maladie_dec_pha_cons(donnees) +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxverifierfacturephacons/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_verification_facture").html(data); + }, + complete: function() { + $("#btn_pop").click(); + } + }); +} + +function verifier_feuille_maladie_dec_opt_cons(donnees) +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxverifierfactureoptcons/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_verification_facture").html(data); + }, + complete: function() { + $("#btn_pop").click(); + } + }); +} + +function limite_avant_facture_dec(idFacture) +{ + donnees = 'idFacture='+idFacture; + $.ajax({ + url: $("#racineWeb").val()+"AjaxPlafondavantfacturecdec/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_limites").html(data); + }, + complete: function() { + } + }); +} + +function demander_decompte() +{ + window.location.assign($("#racineWeb" ).val()+"Initdemandedecompte/"); +} + +function initierdemandedecompte() +{ + codeExercice=$("#codeExercice").val(); + codeMois=$("#codeMois").val(); + + if (codeExercice<=" ") + { + v_msg="Veuillez sélectionner un exercice!"; + v_msgEng="Please select an exercise!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeExercice").focus(); + + return; + } + + if (codeMois<=" ") + { + v_msg="Veuillez sélectionner une période!"; + v_msgEng="Please select a period!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeMois").focus(); + return; + } + + donnees = 'codeExercice='+codeExercice+'&codeMois='+codeMois; + + // $("#div_dossiers").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdemandedecompte/initierdemandedecompte/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#inforegle").html(data); + }, + complete: function() { + regle=$("#regle").val(); + + if(regle==-1) + { + v_msg="Problème lors de l\'initialisation!"; + v_msgEng="Problem during initialization!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + else + { + afficher_demande_decompte(); + } + } + }); +} + +function afficher_demande_decompte() +{ + $("#detail_demande_decompte").html('
  ' + 'Veuillez patienter...' + '
'); + window.location.assign($("#racineWeb" ).val()+"Demandedecompte/"); +} + + +function imprimerbordereaudemandedecompte() +{ + idDemandeDecompte = $("#idDemandeDecompte").val(); + + if (idDemandeDecompte>"0") + { + var div_wait = $('#div_wait'); + div_wait.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerdemandedecompte/imprimerdemandecompte", + type: 'POST', + success: function(data) + { + div_wait.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); + } +} + +function rechargerdemandedecompte() +{ + $("#detail_demande_decompte").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdemandedecompte/rechargerdemandedecompte/", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + afficher_demande_decompte(); + }, + complete: function() { + } + }); +} + +function actualiser_decompte() +{ + $("#div_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + window.location.assign($("#racineWeb" ).val()+"Decomptecons/"); +} + +function monture() +{ + $("#monture").val("1"); + + if (prestation_possible()) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + + window.location.assign($("#racineWeb" ).val()+"Monture/"); + + /* MAJ du 06/06/2019 => proposition de Pascal => les magasins d'optique n'ont pas de lecteurs d'empriente + modeSaisieFacture=$("#modeSaisieFacture").val(); + if(modeSaisieFacture=="1") + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + + window.location.assign($("#racineWeb" ).val()+"Monture/"); + return; + } + + 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(); + + if (finger_id==0) + { + v_msg="Veuillez procéder à 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 (okId!=1 && okId_face!=1) + { + v_msg="Veuillez procéder à l\'identification avant!"; + v_msgEng="Please check identity before!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + } + + window.location.assign($("#racineWeb" ).val()+"Monture/"); + */ + } +} + +function actualiser_monture() +{ + window.location.assign($("#racineWeb" ).val()+"Monture/"); +} + +function valider_monture() +{ + dejaFacture=$("#dejaFacture").val(); + + // alert("dejaFacture =>" +dejaFacture); + // return; + + if (dejaFacture=="1") + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + ententePrealableMont=$("#ententePrealableMont").val(); + + nbActesMonture=$("#nbActesMonture").val(); + + if (nbActesMonture>0 && ententePrealableMont!=1) + { + /* + v_msg="Montures déjà livrées une fois!"; + v_msgEng="Frames already delivered once!"; + */ + v_msg="Veuillez demander une autorisation!"; + v_msgEng="Please ask for an authorization!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroFacture=$("#numeroFacture").val(); + + if (numeroFacture<=" ") + { + v_msg="Veuillez saisir le No de la facture!"; + v_msgEng="Please enter the Invoice No!"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroFacture").focus(); + + return; + } + + prixActe = $("#prixActe").val(); + if (prixActe==0) + { + v_msg="Rien à facturer!"; + v_msgEng="Nothing to bill!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette livraison?"; + v_msgEng="Do you confirm this delivery?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + user_id_0 = $("#user_id_C").val(); + + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + + facturer_monture(user_id_0); + + /* MAJ du 06/06/2019 => proposition de Pascal => les magasins d'optique n'ont pas de lecteurs d'empriente + modeSaisieFacture=$("#modeSaisieFacture").val(); + derogationFingerFacturation=$("#derogationFingerFacturation").val(); + if(modeSaisieFacture=="1" || derogationFingerFacturation=="1") + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_monture(user_id_0); + return; + } + + derogation_finger_en_cours=$("#derogation_finger_en_cours_C").val(); + if(derogation_finger_en_cours>0) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + facturer_monture(user_id_0); + } + else + { + beneficiaire = $("#beneficiaire_C").val(); + user_id =$("#user_id_C").val(); + finger_id =$("#finger_id_C").val(); + + $("#facturation").val("1"); + + data = "action=index&user_id="+user_id+"&user_name="+beneficiaire+"&finger="+finger_id+"&facturation=1"; + + load("flexcode/user.php?"+data); + } + */ + } +} + +function maj_monture_temp_monture(idOptique, monture) +{ + numeroFacture=$("#numeroFacture").val(); + + donnees = 'idOptique='+idOptique+"&monture="+monture+"&numeroFacture="+numeroFacture; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmonture/majmonture/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_monture").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + } + }); +} + +function facturer_monture(user_id) +{ + dejaFacture=$("#dejaFacture").val(); + + if (dejaFacture=="1") + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numeroFacture=$("#numeroFacture").val(); + + if (numeroFacture<=" ") + { + v_msg="Veuillez saisir le No de la facture!"; + v_msgEng="Please enter the Invoice No!"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroFacture").focus(); + + 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; + donnees += '&numeroFacture='+numeroFacture; + + + // numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); + codePrestataire = $("#codePrestataire_C").val(); + + donnees_sav = 'codePrestataire='+codePrestataire+'&typeMail=mailoptique'; + + typeSms = "facturer_mont"; + + donnees_retour =""; + + user_id_0 = $("#user_id_C").val(); + user_id_substitut = "0"; + if (user_id_0!=user_id) + { + user_id_substitut = user_id; + } + + donnees += '&user_id_substitut='+user_id_substitut; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmonture/enregistrermonture/", + type: 'POST', + data: donnees, + success: function(data) + { + donnees_retour = data; + preparesms_adherent(typeSms); + }, + error: function(data) + { + + }, + complete: function() { + preparemail_adherent(typeSms); + + v_msg="Facturation effectuée avec succès!"; + v_msgEng="Billing done successfully!"; + alert_ebene(v_msg, v_msgEng); + + $("#div_monture").html(donnees_retour); + // window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"); + } + }); +} + + +function requetes_prestaire() +{ + window.location.assign($("#racineWeb" ).val()+"Requetes/"); +} + +function ajaxenteterequete() +{ + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + donnees = 'codeRequete='+codeRequete; + + v_url = $("#racineWeb").val()+"Ajaxrequeteentete"+codeRequete+"/"; + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ente_requete").html(data); + $(".datepicker" ).datepicker(); + } + }); +} + +function requetes_feuilles_maladie() +{ + $('#div_export_a').html(""); + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"/"; + + // Ligne 1 + codePrestataire = $("#codePrestataire").val(); + dateConsultation1 = $("#dateConsultation1").val(); + dateConsultation2 = $("#dateConsultation2").val(); + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + + // Ligne 2 + codeMedecin = $("#codeMedecin").val(); + + numeroBonConsultation1 = $("#numeroBonConsultation1").val(); + numeroBonConsultation2 = $("#numeroBonConsultation2").val(); + + numeroBonOrdonnance1 = $("#numeroBonOrdonnance1").val(); + numeroBonOrdonnance2 = $("#numeroBonOrdonnance2").val(); + + numeroBonHospitalisation1 = $("#numeroBonHospitalisation1").val(); + numeroBonHospitalisation2 = $("#numeroBonHospitalisation2").val(); + + numeroBonOptique1 = $("#numeroBonOptique1").val(); + numeroBonOptique2 = $("#numeroBonOptique2").val(); + + // Ligne 3 + codeTypePrestataire = $("#codeTypePrestataire").val(); + numeroDecompte1 = $("#numeroDecompte1").val(); + numeroDecompte2 = $("#numeroDecompte2").val(); + codeRaisonConsultation = $("#codeRaisonConsultation").val(); + hospitalisation = $("#hospitalisation").val(); + numeroChambre = $("#numeroChambre").val(); + chirurgie = $("#chirurgie").val(); + facture = $("#facture").val(); + + // Ligne 4 + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroBonConsultation1 = convertir_en_entier(numeroBonConsultation1); + numeroBonConsultation2 = convertir_en_entier(numeroBonConsultation2); + + numeroBonOrdonnance1 = convertir_en_entier(numeroBonOrdonnance1); + numeroBonOrdonnance2 = convertir_en_entier(numeroBonOrdonnance2); + + numeroBonOptique1 = convertir_en_entier(numeroBonOptique1); + numeroBonOptique2 = convertir_en_entier(numeroBonOptique2); + + numeroBonHospitalisation1 = convertir_en_entier(numeroBonHospitalisation1); + numeroBonHospitalisation2 = convertir_en_entier(numeroBonHospitalisation2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&dateConsultation1=' + dateConsultation1; + donnees += '&dateConsultation2=' + dateConsultation2; + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + + // Ligne 2 + donnees += '&codeMedecin=' + codeMedecin; + + donnees += '&numeroBonConsultation1=' + numeroBonConsultation1; + donnees += '&numeroBonConsultation2=' + numeroBonConsultation2; + + donnees += '&numeroBonOrdonnance1=' + numeroBonOrdonnance1; + donnees += '&numeroBonOrdonnance2=' + numeroBonOrdonnance2; + + donnees += '&numeroBonHospitalisation1=' + numeroBonHospitalisation1; + donnees += '&numeroBonHospitalisation2=' + numeroBonHospitalisation2; + + donnees += '&numeroBonOptique1=' + numeroBonOptique1; + donnees += '&numeroBonOptique2=' + numeroBonOptique2; + + // Ligne 3 + donnees += '&codeTypePrestataire=' + codeTypePrestataire; + + donnees += '&numeroDecompte1=' + numeroDecompte1; + donnees += '&numeroDecompte2=' + numeroDecompte2; + + donnees += '&codeRaisonConsultation=' + codeRaisonConsultation; + donnees += '&hospitalisation=' + hospitalisation; + donnees += '&numeroChambre=' + numeroChambre; + donnees += '&chirurgie=' + chirurgie; + donnees += '&facture=' + facture; + + // Ligne 4 + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + $("#div_detail_requete").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + //$("#div_detail_requete").html(data); + }, + complete: function() { + $("#div_detail_requete").html(donnees_retour); + $("#nbligne").val("Result : "+$("#nbligne_info").val()); + } + }); +} + +function requetes_feuilles_maladie_export() +{ + $('#div_detail_requete').html(''); + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"export/"; + + // Ligne 1 + codePrestataire = $("#codePrestataire").val(); + dateConsultation1 = $("#dateConsultation1").val(); + dateConsultation2 = $("#dateConsultation2").val(); + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + + // Ligne 2 + codeMedecin = $("#codeMedecin").val(); + + numeroBonConsultation1 = $("#numeroBonConsultation1").val(); + numeroBonConsultation2 = $("#numeroBonConsultation2").val(); + + numeroBonOrdonnance1 = $("#numeroBonOrdonnance1").val(); + numeroBonOrdonnance2 = $("#numeroBonOrdonnance2").val(); + + numeroBonHospitalisation1 = $("#numeroBonHospitalisation1").val(); + numeroBonHospitalisation2 = $("#numeroBonHospitalisation2").val(); + + numeroBonOptique1 = $("#numeroBonOptique1").val(); + numeroBonOptique2 = $("#numeroBonOptique2").val(); + + // Ligne 3 + codeTypePrestataire = $("#codeTypePrestataire").val(); + numeroDecompte1 = $("#numeroDecompte1").val(); + numeroDecompte2 = $("#numeroDecompte2").val(); + codeRaisonConsultation = $("#codeRaisonConsultation").val(); + hospitalisation = $("#hospitalisation").val(); + numeroChambre = $("#numeroChambre").val(); + chirurgie = $("#chirurgie").val(); + facture = $("#facture").val(); + + // Ligne 4 + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroBonConsultation1 = convertir_en_entier(numeroBonConsultation1); + numeroBonConsultation2 = convertir_en_entier(numeroBonConsultation2); + + numeroBonOrdonnance1 = convertir_en_entier(numeroBonOrdonnance1); + numeroBonOrdonnance2 = convertir_en_entier(numeroBonOrdonnance2); + + numeroBonOptique1 = convertir_en_entier(numeroBonOptique1); + numeroBonOptique2 = convertir_en_entier(numeroBonOptique2); + + numeroBonHospitalisation1 = convertir_en_entier(numeroBonHospitalisation1); + numeroBonHospitalisation2 = convertir_en_entier(numeroBonHospitalisation2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&dateConsultation1=' + dateConsultation1; + donnees += '&dateConsultation2=' + dateConsultation2; + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + + // Ligne 2 + donnees += '&codeMedecin=' + codeMedecin; + + donnees += '&numeroBonConsultation1=' + numeroBonConsultation1; + donnees += '&numeroBonConsultation2=' + numeroBonConsultation2; + + donnees += '&numeroBonOrdonnance1=' + numeroBonOrdonnance1; + donnees += '&numeroBonOrdonnance2=' + numeroBonOrdonnance2; + + donnees += '&numeroBonHospitalisation1=' + numeroBonHospitalisation1; + donnees += '&numeroBonHospitalisation2=' + numeroBonHospitalisation2; + + donnees += '&numeroBonOptique1=' + numeroBonOptique1; + donnees += '&numeroBonOptique2=' + numeroBonOptique2; + + // Ligne 3 + donnees += '&codeTypePrestataire=' + codeTypePrestataire; + + donnees += '&numeroDecompte1=' + numeroDecompte1; + donnees += '&numeroDecompte2=' + numeroDecompte2; + + donnees += '&codeRaisonConsultation=' + codeRaisonConsultation; + donnees += '&hospitalisation=' + hospitalisation; + donnees += '&numeroChambre=' + numeroChambre; + donnees += '&chirurgie=' + chirurgie; + donnees += '&facture=' + facture; + + // Ligne 4 + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + var div_export = $('#div_detail_requete'); + div_export.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + // $('#div_detail_requete').html(""); + // $('#div_export_a').html(data); + }, + complete: function() { + $('#div_detail_requete').html(""); + $('#div_export_a').html(donnees_retour); + } + }); +} + + +function selectionner_medecin_requete(codeMedecin, nomMedecin, noOrdreMedecin) +{ + $("#codeMedecin").val(codeMedecin); + $("#nomMedecin").html(nomMedecin+" ( "+noOrdreMedecin+" )"); + $("#close_pop").click(); +} + +function afficher_pop_recherche_medecin_requete() +{ + + noOrdreMedecin = $("#noOrdreMedecin").val(); + nomsearch = $("#nomsearch").val(); + + if(noOrdreMedecin+nomsearch<=" ") + return; + + donnees = "valid=1&noOrdreMedecin="+noOrdreMedecin+"&nomsearch="+nomsearch; + + $("#div_listemedecins").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistemedecinsrequete/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_listemedecins").html(data); + } + }); +} + +function ctrlkeypress_medecin_requete(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + afficher_pop_recherche_medecin_requete(); + } +} + +function reinitialiser_medecin() +{ + $("#codeMedecin").val(""); + $("#nomMedecin").html("Rechercher Médecin..."); + $("#close_pop").click(); +} + +function requetes_factures() +{ + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"/"; + + codePrestataire = $("#codePrestataire").val(); + dateFacture1 = $("#dateFacture1").val(); + dateFacture2 = $("#dateFacture2").val(); + + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&dateFacture1=' + dateFacture1; + donnees += '&dateFacture2=' + dateFacture2; + + $("#div_detail_requete").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + //$("#div_detail_requete").html(data); + }, + complete: function() { + $("#div_detail_requete").html(donnees_retour); + $("#nbligne").val("Result : "+$("#nbligne_info").val()); + } + }); +} + +function requetes_factures_export() +{ + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"export/"; + + codePrestataire = $("#codePrestataire").val(); + dateFacture1 = $("#dateFacture1").val(); + dateFacture2 = $("#dateFacture2").val(); + + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&dateFacture1=' + dateFacture1; + donnees += '&dateFacture2=' + dateFacture2; + + var div_export = $('#div_detail_requete'); + div_export.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + // $('#div_detail_requete').html(""); + // $('#div_export_a').html(data); + }, + complete: function() { + $('#div_detail_requete').html(""); + $('#div_export_a').html(donnees_retour); + } + }); +} + +function requetes_bonpoec() +{ + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"/"; + + // Ligne 1 + codePrestataire = $("#codePrestataire").val(); + codeTypeBon = $("#codeTypeBon").val(); + codeEtatBon = $("#codeEtatBon").val(); + + // Ligne 2 + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + numeroBon1 = $("#numeroBon1").val(); + numeroBon2 = $("#numeroBon2").val(); + + // Ligne 4 + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroBon1 = convertir_en_entier(numeroBon1); + numeroBon2 = convertir_en_entier(numeroBon2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&codeTypeBon=' + codeTypeBon; + donnees += '&codeEtatBon=' + codeEtatBon; + + // Ligne 2 + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + donnees += '&numeroBon1=' + numeroBon1; + donnees += '&numeroBon2=' + numeroBon2; + + // Ligne 4 + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + $("#div_detail_requete").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + //$("#div_detail_requete").html(data); + }, + complete: function() { + $("#div_detail_requete").html(donnees_retour); + $("#nbligne").val("Result : "+$("#nbligne_info").val()); + } + }); +} + +function requetes_bonpoec_export() +{ + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"export/"; + + // Ligne 1 + codePrestataire = $("#codePrestataire").val(); + codeTypeBon = $("#codeTypeBon").val(); + codeEtatBon = $("#codeEtatBon").val(); + + // Ligne 2 + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + numeroBon1 = $("#numeroBon1").val(); + numeroBon2 = $("#numeroBon2").val(); + + // Ligne 3 + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroBon1 = convertir_en_entier(numeroBon1); + numeroBon2 = convertir_en_entier(numeroBon2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&codeTypeBon=' + codeTypeBon; + donnees += '&codeEtatBon=' + codeEtatBon; + + // Ligne 2 + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + donnees += '&numeroBon1=' + numeroBon1; + donnees += '&numeroBon2=' + numeroBon2; + + // Ligne 3 + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + var div_export = $('#div_detail_requete'); + div_export.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + // $('#div_detail_requete').html(""); + // $('#div_export_a').html(data); + }, + complete: function() { + $('#div_detail_requete').html(""); + $('#div_export_a').html(donnees_retour); + } + }); +} + + +function requetes_prestationactes() +{ + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"/"; + + codePrestataire = $("#codePrestataire").val(); + datePrestation1 = $("#datePrestation1").val(); + datePrestation2 = $("#datePrestation2").val(); + + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&datePrestation1=' + datePrestation1; + donnees += '&datePrestation2=' + datePrestation2; + + $("#div_detail_requete").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + //$("#div_detail_requete").html(data); + }, + complete: function() { + $("#div_detail_requete").html(donnees_retour); + $("#nbligne").val("Result : "+$("#nbligne_info").val()); + } + }); +} + +function requetes_prestationactes_export() +{ + $('#div_detail_requete').html(''); + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"export/"; + + codePrestataire = $("#codePrestataire").val(); + datePrestation1 = $("#datePrestation1").val(); + datePrestation2 = $("#datePrestation2").val(); + + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&datePrestation1=' + datePrestation1; + donnees += '&datePrestation2=' + datePrestation2; + + var div_export = $('#div_detail_requete'); + div_export.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + // $('#div_detail_requete').html(""); + // $('#div_export_a').html(data); + }, + complete: function() { + $('#div_detail_requete').html(""); + $('#div_export_a').html(donnees_retour); + } + }); +} + +function requetes_pharmacie() +{ + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"/"; + + // Ligne 1 + codePrestataire = $("#codePrestataire").val(); + dateLivraison1 = $("#dateLivraison1").val(); + dateLivraison2 = $("#dateLivraison2").val(); + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + + // Ligne 2 + codeMedecin = $("#codeMedecin").val(); + + numeroBonConsultation1 = $("#numeroBonConsultation1").val(); + numeroBonConsultation2 = $("#numeroBonConsultation2").val(); + + numeroBonOrdonnance1 = $("#numeroBonOrdonnance1").val(); + numeroBonOrdonnance2 = $("#numeroBonOrdonnance2").val(); + + numeroFeuilleMaladie1 = $("#numeroFeuilleMaladie1").val(); + numeroFeuilleMaladie2 = $("#numeroFeuilleMaladie2").val(); + + codePrestatairePrescription = $("#codePrestatairePrescription").val(); + + // Ligne 3 + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // Ligne 4 + libelleMedicament = $("#libelleMedicament").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroBonConsultation1 = convertir_en_entier(numeroBonConsultation1); + numeroBonConsultation2 = convertir_en_entier(numeroBonConsultation2); + + numeroBonOrdonnance1 = convertir_en_entier(numeroBonOrdonnance1); + numeroBonOrdonnance2 = convertir_en_entier(numeroBonOrdonnance2); + + numeroFeuilleMaladie1 = convertir_en_entier(numeroFeuilleMaladie1); + numeroFeuilleMaladie2 = convertir_en_entier(numeroFeuilleMaladie2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&dateLivraison1=' + dateLivraison1; + donnees += '&dateLivraison2=' + dateLivraison2; + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + + // Ligne 2 + donnees += '&codeMedecin=' + codeMedecin; + + donnees += '&numeroBonConsultation1=' + numeroBonConsultation1; + donnees += '&numeroBonConsultation2=' + numeroBonConsultation2; + + donnees += '&numeroBonOrdonnance1=' + numeroBonOrdonnance1; + donnees += '&numeroBonOrdonnance2=' + numeroBonOrdonnance2; + + donnees += '&numeroFeuilleMaladie1=' + numeroFeuilleMaladie1; + donnees += '&numeroFeuilleMaladie2=' + numeroFeuilleMaladie2; + + donnees += '&codePrestatairePrescription=' + codePrestatairePrescription; + + // Ligne 3 + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + // Ligne 4 + donnees += '&libelleMedicament=' + libelleMedicament; + + $("#div_detail_requete").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + //$("#div_detail_requete").html(data); + }, + complete: function() { + $("#div_detail_requete").html(donnees_retour); + $("#nbligne").val("Result : "+$("#nbligne_info").val()); + } + }); +} + +function requetes_pharmacie_export() +{ + $('#div_detail_requete').html(''); + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"export/"; + + // Ligne 1 + codePrestataire = $("#codePrestataire").val(); + dateLivraison1 = $("#dateLivraison1").val(); + dateLivraison2 = $("#dateLivraison2").val(); + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + + // Ligne 2 + codeMedecin = $("#codeMedecin").val(); + + numeroBonConsultation1 = $("#numeroBonConsultation1").val(); + numeroBonConsultation2 = $("#numeroBonConsultation2").val(); + + numeroBonOrdonnance1 = $("#numeroBonOrdonnance1").val(); + numeroBonOrdonnance2 = $("#numeroBonOrdonnance2").val(); + + numeroFeuilleMaladie1 = $("#numeroFeuilleMaladie1").val(); + numeroFeuilleMaladie2 = $("#numeroFeuilleMaladie2").val(); + + codePrestatairePrescription = $("#codePrestatairePrescription").val(); + + // Ligne 3 + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // Ligne 4 + libelleMedicament = $("#libelleMedicament").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroBonConsultation1 = convertir_en_entier(numeroBonConsultation1); + numeroBonConsultation2 = convertir_en_entier(numeroBonConsultation2); + + numeroBonOrdonnance1 = convertir_en_entier(numeroBonOrdonnance1); + numeroBonOrdonnance2 = convertir_en_entier(numeroBonOrdonnance2); + + numeroFeuilleMaladie1 = convertir_en_entier(numeroFeuilleMaladie1); + numeroFeuilleMaladie2 = convertir_en_entier(numeroFeuilleMaladie2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&dateLivraison1=' + dateLivraison1; + donnees += '&dateLivraison2=' + dateLivraison2; + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + + // Ligne 2 + donnees += '&codeMedecin=' + codeMedecin; + + donnees += '&numeroBonConsultation1=' + numeroBonConsultation1; + donnees += '&numeroBonConsultation2=' + numeroBonConsultation2; + + donnees += '&numeroBonOrdonnance1=' + numeroBonOrdonnance1; + donnees += '&numeroBonOrdonnance2=' + numeroBonOrdonnance2; + + donnees += '&numeroFeuilleMaladie1=' + numeroFeuilleMaladie1; + donnees += '&numeroFeuilleMaladie2=' + numeroFeuilleMaladie2; + + donnees += '&codePrestatairePrescription=' + codePrestatairePrescription; + + // Ligne 3 + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + // Ligne 4 + donnees += '&libelleMedicament=' + libelleMedicament; + + var div_export = $('#div_detail_requete'); + div_export.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + // $('#div_detail_requete').html(""); + // $('#div_export_a').html(data); + }, + complete: function() { + $('#div_detail_requete').html(""); + $('#div_export_a').html(donnees_retour); + } + }); +} + +function requetes_optique() +{ + $('#div_export').html(""); + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"/"; + + // Ligne 1 + codePrestataire = $("#codePrestataire").val(); + dateLivraison1 = $("#dateLivraison1").val(); + dateLivraison2 = $("#dateLivraison2").val(); + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + + // Ligne 2 + codeMedecin = $("#codeMedecin").val(); + + numeroBonConsultation1 = $("#numeroBonConsultation1").val(); + numeroBonConsultation2 = $("#numeroBonConsultation2").val(); + + numeroBonOptique1 = $("#numeroBonOptique1").val(); + numeroBonOptique2 = $("#numeroBonOptique2").val(); + + numeroFeuilleMaladie1 = $("#numeroFeuilleMaladie1").val(); + numeroFeuilleMaladie2 = $("#numeroFeuilleMaladie2").val(); + + + codePrestatairePrescription = $("#codePrestatairePrescription").val(); + + // Ligne 3 + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // Ligne 4 + libelleOptique = $("#libelleOptique").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroBonConsultation1 = convertir_en_entier(numeroBonConsultation1); + numeroBonConsultation2 = convertir_en_entier(numeroBonConsultation2); + + numeroBonOptique1 = convertir_en_entier(numeroBonOptique1); + numeroBonOptique2 = convertir_en_entier(numeroBonOptique2); + + numeroFeuilleMaladie1 = convertir_en_entier(numeroFeuilleMaladie1); + numeroFeuilleMaladie2 = convertir_en_entier(numeroFeuilleMaladie2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&dateLivraison1=' + dateLivraison1; + donnees += '&dateLivraison2=' + dateLivraison2; + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + + // Ligne 2 + donnees += '&codeMedecin=' + codeMedecin; + + donnees += '&numeroBonConsultation1=' + numeroBonConsultation1; + donnees += '&numeroBonConsultation2=' + numeroBonConsultation2; + + donnees += '&numeroBonOptique1=' + numeroBonOptique1; + donnees += '&numeroBonOptique2=' + numeroBonOptique2; + + donnees += '&numeroFeuilleMaladie1=' + numeroFeuilleMaladie1; + donnees += '&numeroFeuilleMaladie2=' + numeroFeuilleMaladie2; + + donnees += '&codePrestatairePrescription=' + codePrestatairePrescription; + + // Ligne 3 + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + // Ligne 4 + donnees += '&libelleOptique=' + libelleOptique; + + $("#div_detail_requete").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + //$("#div_detail_requete").html(data); + }, + complete: function() { + $("#div_detail_requete").html(donnees_retour); + $("#nbligne").val("Result : "+$("#nbligne_info").val()); + } + }); +} + +function requetes_optique_export() +{ + $('#div_detail_requete').html(''); + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"export/"; + + // Ligne 1 + codePrestataire = $("#codePrestataire").val(); + dateLivraison1 = $("#dateLivraison1").val(); + dateLivraison2 = $("#dateLivraison2").val(); + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + + // Ligne 2 + codeMedecin = $("#codeMedecin").val(); + + numeroBonConsultation1 = $("#numeroBonConsultation1").val(); + numeroBonConsultation2 = $("#numeroBonConsultation2").val(); + + numeroBonOptique1 = $("#numeroBonOptique1").val(); + numeroBonOptique2 = $("#numeroBonOptique2").val(); + + numeroFeuilleMaladie1 = $("#numeroFeuilleMaladie1").val(); + numeroFeuilleMaladie2 = $("#numeroFeuilleMaladie2").val(); + + codePrestatairePrescription = $("#codePrestatairePrescription").val(); + + // Ligne 3 + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // Ligne 4 + libelleOptique = $("#libelleOptique").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroBonConsultation1 = convertir_en_entier(numeroBonConsultation1); + numeroBonConsultation2 = convertir_en_entier(numeroBonConsultation2); + + numeroBonOptique1 = convertir_en_entier(numeroBonOptique1); + numeroBonOptique2 = convertir_en_entier(numeroBonOptique2); + + numeroFeuilleMaladie1 = convertir_en_entier(numeroFeuilleMaladie1); + numeroFeuilleMaladie2 = convertir_en_entier(numeroFeuilleMaladie2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += 'codePrestataire=' + codePrestataire; + donnees += '&dateLivraison1=' + dateLivraison1; + donnees += '&dateLivraison2=' + dateLivraison2; + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + + // Ligne 2 + donnees += '&codeMedecin=' + codeMedecin; + + donnees += '&numeroBonConsultation1=' + numeroBonConsultation1; + donnees += '&numeroBonConsultation2=' + numeroBonConsultation2; + + donnees += '&numeroBonOptique1=' + numeroBonOptique1; + donnees += '&numeroBonOptique2=' + numeroBonOptique2; + + donnees += '&numeroFeuilleMaladie1=' + numeroFeuilleMaladie1; + donnees += '&numeroFeuilleMaladie2=' + numeroFeuilleMaladie2; + + donnees += '&codePrestatairePrescription=' + codePrestatairePrescription; + + // Ligne 3 + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + // Ligne 4 + donnees += '&libelleOptique=' + libelleOptique; + + var div_export = $('#div_detail_requete'); + div_export.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + // $('#div_detail_requete').html(""); + // $('#div_export_a').html(data); + }, + complete: function() { + $('#div_detail_requete').html(""); + $('#div_export_a').html(donnees_retour); + } + }); +} + + +function requetes_assure() +{ + $('#div_export').html(""); + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"/"; + + // Ligne 1 + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // Ligne 2 + numeroPolice = $("#numeroPolice").val(); + codeProduit = $("#codeProduit").val(); + codeEtatPolice = $("#codeEtatPolice").val(); + codeLienParente = $("#codeLienParente").val(); + codeEtatBeneficiaire = $("#codeEtatBeneficiaire").val(); + sexe = $("#sexe").val(); + + // Ligne 3 + numeroClient1 = $("#numeroClient1").val(); + numeroClient2 = $("#numeroClient2").val(); + telephonePortableAdherent = $("#telephonePortableAdherent").val(); + emailAdherent = $("#emailAdherent").val(); + decede = $("#decede").val(); + nomClient = $("#nomClient").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroClient1 = convertir_en_entier(numeroClient1); + numeroClient2 = convertir_en_entier(numeroClient2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + // Ligne 2 + donnees += '&numeroPolice=' + numeroPolice; + donnees += '&codeProduit=' + codeProduit; + donnees += '&codeEtatPolice=' + codeEtatPolice; + donnees += '&codeLienParente=' + codeLienParente; + donnees += '&codeEtatBeneficiaire=' + codeEtatBeneficiaire; + donnees += '&sexe=' + sexe; + + // Ligne 3 + donnees += '&numeroClient1=' + numeroClient1; + donnees += '&numeroClient2=' + numeroClient2; + donnees += '&telephonePortableAdherent=' + telephonePortableAdherent; + donnees += '&emailAdherent=' + emailAdherent; + donnees += '&decede=' + decede; + donnees += '&nomClient=' + nomClient; + + $("#div_detail_requete").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + //$("#div_detail_requete").html(data); + }, + complete: function() { + $("#div_detail_requete").html(donnees_retour); + $("#nbligne").val("Result : "+$("#nbligne_info").val()); + } + }); +} + +function requetes_assure_export() +{ + $('#div_detail_requete').html(''); + $('#div_export_a').html(""); + + donnees = ""; + donnees_retour = ""; + + codeRequete=$("#codeRequete").val(); + + if (codeRequete<=" ") + { + v_msg="Veuillez sélectionner une requête!"; + v_msgEng="Please select a query!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeRequete").focus(); + return; + } + + v_url = $("#racineWeb").val()+"Ajaxrequete"+codeRequete+"export/"; + + // Ligne 1 + numeroAdherent = $("#numeroAdherent").val(); + numeroBeneficiaire = $("#numeroBeneficiaire").val(); + adherent = $("#adherent").val(); + beneficiaire = $("#beneficiaire").val(); + + // Ligne 2 + numeroPolice = $("#numeroPolice").val(); + codeProduit = $("#codeProduit").val(); + codeEtatPolice = $("#codeEtatPolice").val(); + codeLienParente = $("#codeLienParente").val(); + codeEtatBeneficiaire = $("#codeEtatBeneficiaire").val(); + sexe = $("#sexe").val(); + + // Ligne 3 + numeroClient1 = $("#numeroClient1").val(); + numeroClient2 = $("#numeroClient2").val(); + telephonePortableAdherent = $("#telephonePortableAdherent").val(); + emailAdherent = $("#emailAdherent").val(); + decede = $("#decede").val(); + nomClient = $("#nomClient").val(); + + // FIN champs + + // DEBUT convertir_en_entier + numeroClient1 = convertir_en_entier(numeroClient1); + numeroClient2 = convertir_en_entier(numeroClient2); + // FIN convertir_en_entier + + // Ligne 1 + donnees += '&numeroAdherent=' + numeroAdherent; + donnees += '&numeroBeneficiaire=' + numeroBeneficiaire; + donnees += '&adherent=' + adherent; + donnees += '&beneficiaire=' + beneficiaire; + + // Ligne 2 + donnees += '&numeroPolice=' + numeroPolice; + donnees += '&codeProduit=' + codeProduit; + donnees += '&codeEtatPolice=' + codeEtatPolice; + donnees += '&codeLienParente=' + codeLienParente; + donnees += '&codeEtatBeneficiaire=' + codeEtatBeneficiaire; + donnees += '&sexe=' + sexe; + + // Ligne 3 + donnees += '&numeroClient1=' + numeroClient1; + donnees += '&numeroClient2=' + numeroClient2; + donnees += '&telephonePortableAdherent=' + telephonePortableAdherent; + donnees += '&emailAdherent=' + emailAdherent; + donnees += '&decede=' + decede; + donnees += '&nomClient=' + nomClient; + + var div_export = $('#div_detail_requete'); + div_export.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: v_url, + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + // $('#div_detail_requete').html(""); + // $('#div_export_a').html(data); + }, + complete: function() { + $('#div_detail_requete').html(""); + $('#div_export_a').html(donnees_retour); + } + }); +} + +function convertir_en_entier(valeur) +{ + if(isNaN(valeur)) + { + valeur = "0"; + } + + if (valeur=="") + { + valeur="0"; + } + + valeur = parseInt(valeur); + + return valeur; +} + +function selectionactesmedicaux() +{ + actVisible=$("#actVisible").val(); + + // if (actVisible!="1" && modeSaisieFacture!="1") + if (actVisible!="1") + { + v_msg="Non autorisée!"; + 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; + } + + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Selectactesmedicaux/"); +} + +function ajaxactespossibles_selection() +{ + codeFamilleActe=$("#codeFamilleActe").val(); + + donnees = 'codeFamilleActe='+codeFamilleActe; + + $("#listeacte").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxactespossiblesselection/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + // $('#div_test_gabarit').html(data); + $("#listeacte").html(data); + }, + complete: function() { + } + }); +} + +function ajouter_un_acte_selection(codeActe, prixActe, montantTm, aRembourser, ententePrealable) +{ + donnee_a_affciher = ""; + + codeFamilleActe=$("#codeFamilleActe").val(); + + donnees="" + donnees_sav=""; + + codeMedecin = $("#codeMedecin").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + $("#nomMedecin").focus(); + return; + } + + if (codeActe<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if(prixActe==0) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cet acte?"; + v_msgEng="Do you confirm this act?"; + + // if(confirm_ebene(v_msg, v_msgEng)) + // { + if(ententePrealable==1) + { + ententePrealable = "2"; + } + + donnees = 'codeFamilleActe='+codeFamilleActe+'&codeActe='+codeActe+'&codeMedecin='+codeMedecin+'&ententePrealable='+ententePrealable; + donnees += '&prixActe='+prixActe+'&montantTm='+montantTm+'&aRembourser='+aRembourser; + + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + + donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; + // donnees_sav2 = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailautorisation'; + + typeSms="ententeprealable"; + // typeSms2="autorisation"; + + $("#listeacte").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectactesmedicaux/enregistreractemedical/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + maj_fraisexclu_cso(); + + if(ententePrealable=="2") + { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + + } + donnee_a_affciher = data; + }, + complete: function() { + if(ententePrealable=="2") + { + mettremailattente(donnees_sav); + } + $("#totam_donnees").html(donnee_a_affciher); + } + }); + // } +} + +function supprimer_acte_medical_selection(idPrestationactes, codeTypePrestation) +{ + donnee_a_affciher = ""; + + /* + v_msg="Confirmez-vous la suppression de cet acte?"; + v_msgEng="Do you confirm the removal of this act?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + */ + codeFamilleActe=$("#codeFamilleActe").val(); + + donnees = 'codeFamilleActe='+codeFamilleActe+'&idPrestationactes='+idPrestationactes+'&codeTypePrestation='+codeTypePrestation; + + $("#listeacte").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectactesmedicaux/supprimeracte/", + type: 'POST', + data: donnees, + success: function(data) { + donnee_a_affciher = data; + // maj_fraisexclu_cso(); + }, + error: function(data) { + }, + complete: function() { + $("#totam_donnees").html(donnee_a_affciher); + } + }); + // } +} + +function valider_selection_acte() +{ + v_msg="Confirmez-vous cette saisie?"; + v_msgEng="Do you confirm this situation?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + feuillemaladie(); + } +} + + +function ajax_maj_qte_acte(idPrestationactes, quantite, controle) +{ + quantite=quantite.replace(",","."); + controle.value=quantite; + + if(controle_numerique(controle)) + { + if(quantite==0) + { + controle.focus(); + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idPrestationactes='+idPrestationactes+"&quantite="+quantite; + + donnee_a_affciher = ""; + + donnees = 'idPrestationactes='+idPrestationactes+"&quantite="+quantite;; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxactesmedicauxselect/majquantite/", + type: 'POST', + data: donnees, + success: function(data) { + donnee_a_affciher = data; + }, + error: function(data) { + }, + complete: function() { + $("#div_prestations").html(donnee_a_affciher); + controle.focus(); + } + }); + } +} + + +function selectionner_acte_possibles_select(codeFamilleActe, codeActe, familleActe, libelleActe) +{ + if(libelleActe<=" ") + return; + + $("#codeFamilleActe").val(codeFamilleActe); + $("#libelleActe").val(libelleActe); + + ajaxactespossibles_selection(); + + $("#close_pop_acte").click(); +} + +function afficher_pop_recherche_actes_possibles_select() +{ + libelleActeSearch = $("#libelleActeSearch").val(); + + if(libelleActeSearch<=" ") + { + return; + } + + donnees = "valid=1&libelleActeSearch="+libelleActeSearch; + + $("#div_liste_actes_possibles").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteactespossiblesselect/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_liste_actes_possibles").html(data); + } + }); +} + +function ctrlkeypress_actes_possibles_select(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + afficher_pop_recherche_actes_possibles_select(); + } +} + +function selectionexamens() +{ + actVisible=$("#actVisible").val(); + + // if (actVisible!="1" && modeSaisieFacture!="1") + if (actVisible!="1") + { + v_msg="Non autorisée!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Selectexaemens/"); +} + +function ajaxexamenpossibles_selection() +{ + codeFamilleActe=$("#codeFamilleActe").val(); + + donnees = 'codeFamilleActe='+codeFamilleActe; + + $("#listeacte").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxexamenspossiblesselection/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#listeacte").html(data); + }, + complete: function() { + } + }); +} + +function ajouter_un_examen_selection(codeActe, prixActe, montantTm, aRembourser, ententePrealable) +{ + donnee_a_affciher = ""; + + codeFamilleActe=$("#codeFamilleActe").val(); + + donnees="" + donnees_sav=""; + + if (codeActe<=" ") + { + v_msg="Veuillez sélectionner un acte!"; + v_msgEng="Please select an act!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if(prixActe==0) + { + v_msg="Veuillez revoir le tarif!"; + v_msgEng="Please review rate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if(ententePrealable==1) + { + ententePrealable = "2"; + } + + donnees = 'codeFamilleActe='+codeFamilleActe+'&codeActe='+codeActe+'&ententePrealable='+ententePrealable; + donnees += '&prixActe='+prixActe+'&montantTm='+montantTm+'&aRembourser='+aRembourser; + + numeroFeuilleMaladie=$("#numeroFeuilleMaladie_C").val(); + + donnees_sav = 'codeActe='+codeActe+'&numeroFeuilleMaladie='+numeroFeuilleMaladie+'&typeMail=mailententeprealable'; + + typeSms="ententeprealable"; + + $("#listeacte").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectexamens/ajouterexamenprescription/", + type : 'post', + data: donnees, + error: function(errorData) + { + }, + success: function(data) { + // $('#div_test_gabarit').html(data); + if(ententePrealable=="2") + { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + + } + donnee_a_affciher = data; + }, + complete: function() + { + if(ententePrealable=="2") + { + mettremailattente(donnees_sav); + } + $("#totam_donnees").html(donnee_a_affciher); + } + }); +} + +function retirerexamen_lab_selection(idExamen) +{ + + donnee_a_affciher = ""; + + codeFamilleActe=$("#codeFamilleActe").val(); + + donnees = 'codeFamilleActe='+codeFamilleActe+'&idExamen='+idExamen; + + $("#listeacte").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectexamens/retirerexamen/", + type: 'POST', + data: donnees, + success: function(data) { + donnee_a_affciher = data; + alerter_depassement_limite(); + }, + error: function(data) { + }, + complete: function() { + $("#totam_donnees").html(donnee_a_affciher); + } + }); +} + +function valider_selection_examen() +{ + v_msg="Confirmez-vous cette saisie?"; + v_msgEng="Do you confirm this situation?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + afficher_laboratoire_cso(); + } +} + +function selectionexamens_lab() +{ + window.location.assign($("#racineWeb" ).val()+"Selectexaemenslab/"); +} + +function valider_selection_examen_lab() +{ + v_msg="Confirmez-vous cette saisie?"; + v_msgEng="Do you confirm this situation?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + actualiser_laboratoire(); + } +} + +function afficher_examensmedicaux() +{ + window.location.assign($("#racineWeb" ).val()+"Examensmedicaux/"); +} + +function selectionexamens_cso() +{ + window.location.assign($("#racineWeb" ).val()+"Selectexaemenscso/"); +} + +function valider_selection_examen_cso() +{ + v_msg="Confirmez-vous cette saisie?"; + v_msgEng="Do you confirm this situation?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + afficher_examensmedicaux(); + } +} + +function no_presciption() +{ + facture=$("#facture").val(); + + if (facture==1) + { + v_msg="Déjà facturé!"; + v_msgEng="Already charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + numOrd = $("#numOrd").val(); + noPrescription = $("#noPrescription").val(); + + if (numOrd==0 && noPrescription==0) + { + v_msg="Confirmez-vous qu\'il n\'y a pas de prescription de médicaments?"; + v_msgEng="Do you confirm that there is no drugs prescription?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistrerprescription/noprescription/", + type : 'post', + // data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + feuillemaladie(); + } + }); + } + return; + } + feuillemaladie(); +} + +function prescrire_verre_opt() +{ +// Ajout à la prescription + /* + nbActesVerres = $("#nbActesVerres").val(); + + if (nbActesVerres>0) + { + v_msg="Veuillez sélectionner un verre!"; + v_msgEng="Please select a glass!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeOptique").focus(); + return; + } + */ + + codePrestatairePrescription = $("#codePrestatairePrescription").val(); + codeOptique = $("#codeOptique").val(); + + if (codeOptique<=" ") + { + v_msg="Veuillez sélectionner les verres!"; + v_msgEng="Please select the glasses!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeOptique").focus(); + return; + } + + donnees = 'codeOptique='+codeOptique; + donnees += '&codePrestatairePrescription=' + codePrestatairePrescription; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailopticien/ajouterverreprescription/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#btn_close_pop_verre").click(); + // $("#livraison").html(data); + }, + complete: function() { + // alerter_depassement_limite(); + actualiser_opticien(); + } + }); + + //} + +// Fin Ajout à la prescription +} + +function validerdecompte_prestataire() +{ +/* +0 Décompte en cours + +2 Attente Valid. prestat. / Waiting for provider s valid. + +3 Validé par le prestataire + +8 Pas besoin de valid prestat / Provid valid not needed + +9 En attente de règelment + +1 Réglé / Payé +*/ + + regle=$("#regle").val(); + regle = parseInt(regle); + + if (regle==1) + { + v_msg="Déjà payé!"; + v_msgEng="Already paid!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (regle==0) + { + v_msg="Veuillez attendre la 1ère validation de l\'assureur!"; + v_msgEng="Please wait for the first validation of the insurer!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (regle==3) + { + v_msg="Déjà validé!"; + v_msgEng="Already validated!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (regle==8) + { + v_msg="Pas besoin de validation prestataire!"; + v_msgEng="Provider validation not needed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (regle==9) + { + v_msg="En attente de paiement!"; + v_msgEng="Waiting for payment!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if ($("#montantApayer").val()<="0") + { + v_msg="Rien à valider!"; + v_msgEng="Nothing to validate!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (regle==2) + { + + v_msg="Confirmez-vous la validation?"; + v_msgEng="Do you confirm the validation?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdecompte/validerdecompteprestataire", + type : 'post', + error: function(errorData) { + }, + success: function(data) { + // $("#div_detail").html(""); + v_msg="Décompte validé avec succès!"; + v_msgEng="validated successfully!"; + alert_ebene(v_msg, v_msgEng); + + }, + complete: function() { + // actualiser_decompte(); + afficher_decompte(); + } + }); + } + } +} + +function retourdecompte() +{ + idSaisieDecompte = $("#idSaisieDecompte").val(); + lienPrestation_C = $("#lienPrestation_C").val(); + lienProduction_C = $("#lienProduction_C").val(); + + v_url = lienProduction_C+"/Connexiondecompte/"+idSaisieDecompte; + + if (idSaisieDecompte>"") + { + window.location.assign(v_url); + } +} + +function enregistrer_nv_medicament() +{ + libelleMedicament = $("#libelleMedicament").val(); + + if (libelleMedicament<=" ") + { + v_msg="Veuillez saisir le nom!"; + v_msgEng="Please enter the name!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleMedicament").focus(); + return; + } + + prixMedicament=$("#prixMedicament").val(); + prixMedicament=prixMedicament.replace(",","."); + $("#prixMedicament").val(prixMedicament); + + if(isNaN(prixMedicament)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#prixMedicament").val("0"); + $("#prixMedicament").focus(); + return; + } + + if(prixMedicament==0) + { + $("#prixMedicament").focus(); + v_msg="Veuillez saisir le prix!"; + v_msgEng="Please enter the price!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + qteMedicament=$("#qteMedicament").val(); + qteMedicament=qteMedicament.replace(",","."); + $("#qteMedicament").val(qteMedicament); + + if(isNaN(qteMedicament)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#qteMedicament").val("0"); + $("#qteMedicament").focus(); + return; + } + + if(qteMedicament==0) + { + $("#qteMedicament").focus(); + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'libelleMedicament='+libelleMedicament+'&prixMedicament='+prixMedicament+'&qteMedicament='+qteMedicament; + + typeSms="ententeprealablepha"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistemedicamentspha/creermedicament/", + type: 'POST', + data: donnees, + success: function(data) { + // $("#medicaments").html(data); + // alert("error => "+data); + // $("#div_new_medicament_test").html(data); + + $("#btn_close_pop_new_med").click(); + $("#btn_close_pop_medicament").click(); + }, + error: function(data) { + alert("error => "+data); + $("#div_new_medicament_test").html(data); + }, + complete: function() { + actualiser_saisie_pharmacien(); + } + }); +} + +function demander_accord_pha(idMedicament) +{ + donnees = 'idMedicament='+idMedicament; + + typeSms="ententeprealablepha"; + + donnees_sav = 'idMedicament='+idMedicament+'&typeMail=mailententeprealablepha'; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacien/demanderaccordpha/", + type: 'POST', + data: donnees, + success: function(data) { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + + // raffraichir affichage + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + mettremailattente(donnees_sav); + } + }); +} + +function controle_longeur_passe(controle) +{ + longueur = controle.value.length; + + if(longueur==0) + { + return false; + } + + if(longueur<6) + { + v_msg="6 caractères minimum exigé!"; + v_msgEng="6 characters minmum required!"; + alert_ebene(v_msg, v_msgEng); + + controle.value=""; + controle.focus(); + return false; + } +} + +function ajax_maj_prix_medicament_pha(idMedicament, prix, controle) +{ + prix=prix.replace(",","."); + controle.value=prix; + + if(controle_numerique(controle)) + { + if(prix==0) + { + controle.focus(); + v_msg="Veuillez saisir le prix!"; + v_msgEng="Please enter the price!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idMedicament='+idMedicament+"&prix="+prix; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacien/majprixpha/", + type: 'POST', + data: donnees, + success: function(data) { + // $("#medicaments").html(data); + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + controle.focus(); + } + }); + } +} + +function facture_sans_bon() +{ + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + + if (numeroBeneficiaire<="0") + { + v_msg="Veuillez sélectionner un bénéficiaire!"; + v_msgEng="Please select an insured person!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb").val()+"Facturesansboncso/"); +} + +function nouvelle_sans_bon() +{ + window.location.assign($("#racineWeb").val()+"Facturesansboncso/"); +} + +// js_facture_san_sbon +function enregistrerfacture_sans_bon_temp(v_initialiser) +{ + dateFacture=$("#dateFacture").val(); + debutMoisDecompte = $("#debutMoisDecompte").val(); + + codeMedecin = $("#codeMedecin").val(); + medecinManquant = $("#medecinManquant").val(); + + if (codeMedecin<=" ") + { + v_msg="Veuillez sélectionner un médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + $("#nomMedecin").focus(); + return; + } + + if (codeMedecin=="ZZZZ" && medecinManquant<=" ") + { + v_msg="Veuillez saisir le nom du médecin non enregistré!"; + v_msgEng="Please enter the name of the non-registered doctor!"; + alert_ebene(v_msg, v_msgEng); + + $("#medecinManquant").focus(); + return; + } + + numeroBon = $("#numeroBon").val(); + + if (numeroBon<=" ") + { + v_msg="Veuillez saisir le No de Bons!"; + v_msgEng="Please enter the first number of form!"; + alert_ebene(v_msg, v_msgEng); + + $("#numeroBon").focus(); + return; + } + + + if (dateFacture<=" ") + { + v_msg="Veuillez saisir la date de la facture!"; + v_msgEng="Please enter the date of the invoice!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateFacture").focus(); + return; + } + + /* + medecinManquant = $("#medecinManquant").val(); + + if (medecinManquant<=" ") + { + v_msg="Veuillez saisir le Médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + $("#medecinManquant").focus(); + return; + } + */ + + // vérifier que le gars est couvert + // modifié le 09/07/2019 + $("#dateFactureReelle").val(dateFacture); + if (prestation_possible_assureur()) + { + observations = $("#observations").val(); + hospitalisation = $("#hospitalisation").val(); + tm = $("#tmFacture").val(); + + donnees = 'observations='+observations+'&dateFacture='+dateFacture+'&hospitalisation='+hospitalisation+'&tm='+tm+'&numeroBon='+numeroBon+'&medecinManquant='+medecinManquant+'&codeMedecin='+codeMedecin; + donnees += '&initialiserprestation='+v_initialiser; + + $("#div_prestations").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailfacturesansboncso/enregistrerfacturetemp/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_facture").html(data); + $(".datepicker" ).datepicker(); + }, + complete: function() { + alerter_depassement_limite_sans_bon(); + } + }); + } +} + +function enregistrerfacture_sans_bon() +{ + enregistrerfacture_sans_bon_temp("0"); + + medecinManquant = $("#medecinManquant").val(); + + if (medecinManquant<=" ") + { + v_msg="Veuillez saisir le Médecin!"; + v_msgEng="Please select a doctor!"; + alert_ebene(v_msg, v_msgEng); + + $("#medecinManquant").focus(); + return; + } + + dateFacture=$("#dateFacture").val(); + + if (dateFacture<=" ") + { + v_msg="Veuillez saisir la date de la facture!"; + v_msgEng="Please enter the date of the invoice"; + alert_ebene(v_msg, v_msgEng); + + $("#dateFacture").focus(); + return; + } + + prixActe = $("#prixActe").val(); + if (prixActe==0) + { + v_msg="Rien à enregistrer!"; + v_msgEng="Nothing to save!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#dateFactureReelle").val(dateFacture); + if (prestation_possible_assureur()) + { + v_msg="Confirmez-vous cette facture?"; + v_msgEng="Do you confirm this invoice?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailfacturesansboncso/validerfacturesansbon/", + error: function(errorData) { + }, + success: function(data) { + // maj_fraisexclu_cso(); + $(".datepicker" ).datepicker(); + }, + complete: function() { + v_msg="Validation effectuée avec succès!"; + v_msgEng="Validation done successfully!"; + alert_ebene(v_msg, v_msgEng); + + afficher_beneficiaire_id(); + } + }); + } + } +} + +function ajax_maj_tm_facture(tm, controle) +{ + donnees = 'tm='+tm; + + tm=tm.replace(",","."); + controle.value=tm; + + if(controle_numerique(controle)) + { + // enregistrerfacture_sans_bon_temp(); + enregistrerfacture_sans_bon_temp("0"); + } +} + +function ajax_maj_prix_acte(idPrestation, valeurActe, controle) +{ + donnees = 'idPrestation='+idPrestation+"&valeurActe="+valeurActe; + + valeurActe=valeurActe.replace(",","."); + controle.value=valeurActe; + + if(controle_numerique(controle)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailfacturesansboncso/majprix/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture").html(data); + $(".datepicker" ).datepicker(); + }, + error: function(data) { + }, + complete: function(data) { + alerter_depassement_limite_sans_bon(); + } + }); + } +} + + +function valider_facture_sans_bon_temp() +{ + enregistrerfacture_sans_bon_temp("1"); +} + +function alerter_depassement_limite_sans_bon() +{ + fraisExclu=$("#fraisExclu").val(); + fraisExclu = parseInt(fraisExclu); + + if (fraisExclu>0) + { + v_msg="Attention ! Dépassement de limite"; + v_msgEng="Warning ! Overflow"; + alert_ebene(v_msg, v_msgEng); + + return; + } +} + +function consulter_limite_avant_facturation_classique() +{ + /* + idFacture=$("#idFacture_C").val(); + + if (idFacture==0) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Plafondavantfactureclassique/"); + */ +} + +function pop_messagerie() +{ + nbMessagesNonLus = $("#timer").val(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessagerieliste/", + error: function(errorData) { + }, + success: function(data) { + $("#div_messagerie").html(data); + }, + complete: function() { + $("#btn_pop_messagerie").click(); + } + }); +} + +function marquer_message_comme_lu(idMessagerie, controle) +{ + donnees = 'idMessagerie='+idMessagerie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessagerieliste/marquercommelu/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + controle.parentElement.removeChild(controle); + } + }); +} + + +function envoyer_messagerie(textMessage, idParent) +{ + donnees = 'textMessage='+textMessage+"&idParent="+idParent; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessagerie/creermessage/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + } + }); +} + +function repondre_message(idMessagerie, idParent, controle) +{ + donnees = 'idMessagerie='+idMessagerie+'&idParent='+idParent; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessageriereponse/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_messagerie_reponse").html(data); + }, + complete: function() { + repondu = $("#repondu").val(); + if(repondu=="1") + { + v_msg="Déjà répondu!"; + v_msgEng="Already answered!"; + alert_ebene(v_msg, v_msgEng); + + controle.parentElement.removeChild(controle); + return; + } + else + {$("#btn_pop_messagerie_reponse").click(); + } + } + }); +} + +function gerer_messagerie() +{ + window.location.assign($("#racineWeb").val()+"Messagerie/"); +} + +function afficher_lite_messagerie() +{ + donnees = ""; + donnees_retour = ""; + + date1 = $("#date1").val(); + date2 = $("#date2").val(); + + messageLu = $("#messageLu").val(); + textMessage = $("#textMessage").val(); + + donnees += 'date1=' + date1; + donnees += '&date2=' + date2; + donnees += '&messageLu=' + messageLu; + donnees += '&textMessage=' + textMessage; + + $("#div_messagerie_gestion").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistemessagerie/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_messagerie_gestion").html(donnees_retour); + $("#nbligne").val("Lignes : "+$("#nbligne_info").val()); + } + }); +} + + +function enregistrer_repondre_message() +{ + idMessagerie = $("#idMessagerie").val(); + idParent = $("#idParentReponse").val(); + + textMessage = $("#textMessageReponse").val(); + textMessage = textMessage.trim(); + + if (textMessage<=" ") + { + v_msg="Veuillez saisir la réponse!"; + v_msgEng="Please enter the answer!"; + alert_ebene(v_msg, v_msgEng); + + $("#textMessageReponse").focus(); + return; + } + + donnees = 'idMessagerie='+idMessagerie+"&idParent="+idParent+"&textMessage="+textMessage; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessagerie/repondremessage/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + $("#btn_pop_messagerie_reponse_quit").click(); + } + }); +} + +function historique_message(idParent) +{ + donnees = 'idParent='+idParent; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessageriehistorique/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_messagerie_historique").html(data); + }, + complete: function() { + $("#btn_pop_messagerie_historique").click(); + } + }); +} + +function initiermessage() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessagerienew/", + error: function(errorData) { + }, + success: function(data) { + $("#div_messagerie_new").html(data); + }, + complete: function() { + $("#btn_pop_messagerie_new").click(); + } + }); +} + +function enregistrer_new_message() +{ + textMessage = $("#textMessageNew").val(); + textMessage = textMessage.trim(); + + if (textMessage<=" ") + { + v_msg="Veuillez saisir le message!"; + v_msgEng="Please enter the message!"; + alert_ebene(v_msg, v_msgEng); + + $("#textMessageNew").focus(); + return; + } + + donnees = 'textMessage='+textMessage+"&idParent=0"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessagerie/creermessage/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + $("#btn_pop_messagerie_new_quit").click(); + } + }); +} + +function consultation_assureur() +{ + dateFactureReelle = $("#dateFactureReelle").val(); + + if (dateFactureReelle<=" ") + { + v_msg="Veuillez saisir la date de la consultation!"; + v_msgEng="Please enter the date of the consultation!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateFactureReelle").focus(); + return; + } + + if (prestation_possible_assureur()) + { + $("#okId" ).val("1"); + $("#okId_face" ).val("1"); + + ajax_context_datefacture_reelle(dateFactureReelle); + } +} + +function prestation_possible_assureur() +{ + 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(); + + dateSortieBeneficiaire = $("#dateSortieBeneficiaire_C").val(); + var tdd = new Date(dateSortieBeneficiaire); + dtd = Math.round(Date.parse(tdd)/(1000*3600*24)); + + + dateFactureReelle = $("#dateFactureReelle").val(); + dateEffetPolice = $("#dateEffetPolice_C").val(); + dateEcheancePolice = $("#dateEcheancePolice_C").val(); + dateEntreeBeneficiaire = $("#dateEntreeBeneficiaire_C").val(); + + libelledebutMoisDecompte = $("#debutMoisDecompte").val(); + debutMoisDecompte = $("#debutMoisDecompte").datepicker("getDate"); + var tddebut = new Date(debutMoisDecompte); + dddebut = Math.round(Date.parse(tddebut)/(1000*3600*24)); + + CalculerFinMoisDecompte(); + + libellefinMoisDecompte = $("#finMoisDecompte").val(); + finMoisDecompte = $("#finMoisDecompte").datepicker("getDate"); + var tfin = new Date(finMoisDecompte); + ddfin = Math.round(Date.parse(tfin)/(1000*3600*24)); + + var td0 = new Date(dateEntreeBeneficiaire); + var td1 = $("#dateFactureReelle").datepicker("getDate"); + var td2 = new Date(dateEcheancePolice); + var tdj = new Date(datejour); + + 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)); + dtj=Math.round(Date.parse(tdj)/(1000*3600*24)); + + if ( (dt1ddfin) ) + { + v_msg="Attention! date hors du mois! => "+libelledebutMoisDecompte+" - "+libellefinMoisDecompte; + v_msgEng="Warning! date out of the month!"; + alert_ebene(v_msg, v_msgEng); + + return false; + } + + if(dateSortieBeneficiaire>"2000-01-01") + { + 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; + } + } + else + { + // A désactivé peut-être pour RADIANT + 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; + } + + // Fin désactivation peut-être pour RADIANT + + 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 (dt1>dtj) + { + v_msg="Attention! Revoir la date!"; + v_msgEng="Warning! Review the date!"; + alert_ebene(v_msg, v_msgEng); + + return false; + } + + if (dt1>dt2 || dt1"2000-01-01") + { + v_msg="Attention! personne décédée!"; + v_msgEng="Warning! Deceased!"; + alert_ebene(v_msg, v_msgEng); + + return false; + } + } + return true; +} + +function ajax_context_datefacture_reelle(dateFactureReelle) +{ + donnees = 'dateFactureReelle='+dateFactureReelle; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdatefacturerelle/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + aller_a_la_consultatio(); + } + }); +} + +function aller_a_la_consultatio() +{ + window.location.assign($("#racineWeb" ).val()+"Consultation/"); +} + +function ajax_maj_qte_examen_lab(idExamen, quantite, controle) +{ + quantite=quantite.replace(",","."); + controle.value=quantite; + + if(controle_numerique(controle)) + { + if(quantite==0) + { + controle.focus(); + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idExamen='+idExamen+"&quantite="+quantite; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetaillaboratoire/majquantiteexam/", + type: 'POST', + data: donnees, + success: function(data) { + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + alerter_depassement_limite(); + controle.focus(); + } + }); + } +} + +function ajax_maj_qte_examen_lab_select(idExamen, quantite, controle) +{ + donnee_a_affciher = ""; + + quantite=quantite.replace(",","."); + controle.value=quantite; + + if(controle_numerique(controle)) + { + if(quantite==0) + { + controle.focus(); + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idExamen='+idExamen+"&quantite="+quantite; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxselectexamens/majquantiteexam/", + type: 'POST', + data: donnees, + success: function(data) { + // $("#livraison").html(data); + donnee_a_affciher = data; + alerter_depassement_limite(); + }, + error: function(data) { + }, + complete: function() { + $("#totam_donnees").html(donnee_a_affciher); + controle.focus(); + } + }); + } +} + +function ajax_maj_qte_examen_cso(idExamen, quantite, controle) +{ + donnee_a_affciher = ""; + + quantite=quantite.replace(",","."); + controle.value=quantite; + + if(controle_numerique(controle)) + { + if(quantite==0) + { + controle.focus(); + v_msg="Veuillez saisir la quantité!"; + v_msgEng="Please enter the quantity!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idExamen='+idExamen+"&quantite="+quantite; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailexamen/majquantiteexam/", + type: 'POST', + data: donnees, + success: function(data) { + $("#livraison").html(data); + controle.focus(); + }, + error: function(data) { + }, + complete: function() { + } + }); + } +} + +function actualiser_saisie_pharmacien() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacien/", + // type : 'post', + // data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#livraison").html(data); + raffraichier_detail_prescription(); + }, + complete: function() { + alerter_depassement_limite(); + } + }); +} + +function lister_ged() +{ + d1 = $("#d1").val(); + d2 = $("#d2").val(); + nomOrigine = $("#nomOrigine").val(); + + donnees = 'd1='+d1+'&d2='+d2+'&nomOrigine='+nomOrigine; + + $("#div_ged").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteged/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ged").html(data); + }, + complete: function() { + } + }); +} + +function ctrlkeypress_lister_ged(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + lister_ged();; + } +} + +function check_ged(idGed, cheminFichier, controle) +{ + donnees = "idGed="+idGed+"&cheminFichier="+cheminFichier; + + // var cible_ged = $('#cible_ged'); + var ctrl_btn_ged = $("#btn_ged"+idGed); + var ctrl_mess_not_found= $("#mess_not_found"+idGed); + var ctrl_check = $("#ctrl_check"+idGed); + + // document.getElementById('bouton_'+id).innerHTML='Afficher le texte'; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxged/verifierexistancefichier/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + + donnees_retour = data; + + if(donnees_retour=="1") + { + ctrl_btn_ged.show(); + } + else + { + ctrl_mess_not_found.html("Not found"); + } + }, + complete: function() + { + controle.style.display = 'none'; + ctrl_check.show(); + } + }); +} + +function lister_ged_adherent() +{ + d1 = $("#d1").val(); + d2 = $("#d2").val(); + nomOrigine = $("#nomOrigine").val(); + + donnees = 'd1='+d1+'&d2='+d2+'&nomOrigine='+nomOrigine; + + $("#div_ged").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistegedadherent/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ged").html(data); + }, + complete: function() { + } + }); +} + +function lister_ged_beneficiaire_prest() +{ + d1 = $("#d1").val(); + d2 = $("#d2").val(); + nomOrigine = $("#nomOrigine").val(); + + donnees = 'd1='+d1+'&d2='+d2+'&nomOrigine='+nomOrigine; + + $("#div_ged").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistegedbeneficiaireprest/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ged").html(data); + }, + complete: function() { + } + }); +} + + +function lister_ged_feuille_maladie() +{ + d1 = $("#d1").val(); + d2 = $("#d2").val(); + nomOrigine = $("#nomOrigine").val(); + + donnees = 'd1='+d1+'&d2='+d2+'&nomOrigine='+nomOrigine; + + $("#div_ged").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistegedfeuillemaladie/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ged").html(data); + }, + complete: function() { + } + }); +} + +function pop_ged_pharmacie() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistegedpharmacie/", + error: function(errorData) { + }, + success: function(data) + { + $("#div_ged").html(data); + }, + complete: function() { + $("#btn_pop_ged_pharmacie").click(); + } + }); +} + +function save_enroleur(user_id) +{ + if (user_id>"") + { + donnees = 'user_id='+user_id; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontextbeneficiaire/saveenroleur/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + complete: function() { + } + }); + } +} + + +/* ACTIVATION POPUP +function imprimer_liste_assures() +{ + $('#div_export_assures').html(''); + + $("#btn_liste_assures").click(); + popalertmessagerie +} +*/ + +function pop_dernier_messagerie() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessagerieliste/derniermessage/", + error: function(errorData) { + }, + success: function(data) { + $("#div_dernier_messagerie").html(data); + }, + complete: function() { + $("#btn_pop_dernier_messagerie").click(); + } + }); +} + +function marquer_dernier_message_comme_lu(idMessagerie, controle) +{ + donnees = 'idMessagerie='+idMessagerie; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessagerieliste/marquercommelu/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + // controle.parentElement.removeChild(controle); + $("#btn_close_pop_dernier_messagerie").click(); + } + }); +} + +function isNumeric(num){ + return !isNaN(num) +} + +function retirer_consommable(idConsommable) +{ + donnees = 'idConsommable='+idConsommable; + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you Confirm this deletion?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteconsommables/retirerconsommable/", + type: 'POST', + data: donnees, + success: function(data) { + // $('#div_test_gabarit').html(data); + }, + error: function(data) { + }, + complete: function() { + afficher_consommable(); + } + }); + } +} + +function retirer_consommable_tous() +{ + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you Confirm this deletion?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlisteconsommables/retirerconsommabletous/", + type: 'POST', + success: function(data) { + // $('#div_test_gabarit').html(data); + }, + error: function(data) { + }, + complete: function() { + afficher_consommable(); + } + }); + } +} + +function valider_consommables() +{ + facturerConsommable=$("#facturerConsommable").val(); + if (facturerConsommable!="1") + { + v_msg="Consommables non facturés!"; + v_msgEng="Consumables not invoiced!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + v_msg="Confirmez-vous cette saisie?"; + v_msgEng="Do you confirm this situation?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + feuillemaladie(); + } +} + +function imprimerdecompteprestataireaccord() +{ + regle=$("#regle").val(); + + if( (regle!=1) && (regle!=9) ) + { + v_msg="Pas encore validé par l\'asssureur"; + v_msgEng="Not yet validates by insurer!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + idReglement = $("#idReglement").val(); + + if (idReglement>"0") + { + var div_wait = $('#div_wait'); + div_wait.html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerdemandereglement/imprimerdecompteprestataireaccord", + type: 'POST', + success: function(data) + { + div_wait.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); + } +} + + +function consulter_une_factures() +{ + window.location.assign($("#racineWeb" ).val()+"Factureconsprestataire/"); +} + +function ctrlkeypressfacture(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + $("#idFacture").blur(); + } +} + +function chercher_facture(idFacture) +{ + + $("#div_facture_detail").html(''); + + $("#div_consulter_facture").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconsprestataire/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_consulter_facture").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function consulterfacturefeuillemaladie() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconsprestataire/feuillemaladie/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function consulterfactureprestationactes() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconsprestataire/prestationactes/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function consulterfacturemedicaments() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconsprestataire/medicaments/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function consulter_facture_pop(idFacture) +{ + + $("#div_facture_detail").html(''); + + $("#div_consulter_facture_pop").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconspop/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_consulter_facture_pop").html(data); + }, + error: function(data) { + }, + complete: function() { + $('#btn_pop_consulter_facture').click(); + } + }); +} + +function consulterfacturefeuillemaladie_pop() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconspop/feuillemaladie/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function consulterfactureprestationactes_pop() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconspop/prestationactes/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function consulterfacturemedicaments_pop() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconspop/medicaments/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function consulterfactureverres_pop() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconspop/verres/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function consulterfactureged_pop() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconspop/geds/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function reafficher_ged_facture(idFacture) +{ + if (idFacture>"0") + { + donnees = 'idFacture='+idFacture; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgedfacture/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_ged").html(data); + }, + complete: function() { + } + }); + } +} + +function valider_ged_facture() +{ + idFacture = $("#idFactureGed").val(); + v_url = $("#racineWeb").val()+"Ajaxgedfacture/chargerged"; + + donnees = ""; + + donnees = new FormData($("#ajax_form_upload")[0]); + + $.ajax({ + type: "POST", + url: v_url, + data: donnees, + contentType: false, + cache: false, + processData :false, + + success: function(message){ + alert_ebene(message); + }, + error: function(errorData){ + }, + complete: function() { + // reafficher_ged_facture(idFacture); + } + }); +} + +function consulterfactureged() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconsprestataire/geds/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function enregistrer_nv_verres() +{ + libelleOptique = $("#libelleOptique").val(); + + if (libelleOptique<=" ") + { + v_msg="Veuillez saisir le nom!"; + v_msgEng="Please enter the name!"; + alert_ebene(v_msg, v_msgEng); + + $("#libelleOptique").focus(); + return; + } + + prixVerre=$("#prixVerre").val(); + prixVerre=prixVerre.replace(",","."); + $("#prixVerre").val(prixVerre); + + if(isNaN(prixVerre)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#prixVerre").val("0"); + $("#prixVerre").focus(); + return; + } + + if(prixVerre==0) + { + $("#prixVerre").focus(); + v_msg="Veuillez saisir le prix!"; + v_msgEng="Please enter the price!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'libelleOptique='+libelleOptique+'&prixVerre='+prixVerre; + + // typeSms="ententeprealableopt"; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailopticien/creerverre/", + type: 'POST', + data: donnees, + success: function(data) { + + $("#btn_close_pop_new_verre").click(); + $("#btn_close_pop_verre").click(); + + // $("#div_test_gabarit").html(data); + + }, + error: function(data) { + }, + complete: function() { + actualiser_opticien(); + } + }); +} + +function demander_accord_opt(idOptique) +{ + donnees = 'idOptique='+idOptique; + + typeSms="ententeprealableopt"; + + donnees_sav = 'idOptique='+idOptique+'&typeMail=mailententeprealableopt'; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailopticien/demanderaccordopt/", + type: 'POST', + data: donnees, + success: function(data) { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + + // raffraichir affichage + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + mettremailattente(donnees_sav); + } + }); +} + +function demander_accord_mont(idOptique) +{ + + prixPrestataire = $("#prixPrestataire").val(); + + prixPrestataire=prixPrestataire.replace(",","."); + $("#prixPrestataire").val(prixPrestataire); + + if(isNaN(prixPrestataire)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#prixPrestataire").val("0"); + $("#prixPrestataire").focus(); + return; + } + + if(prixPrestataire==0) + { + $("#prixPrestataire").focus(); + + v_msg="Veuillez saisir le prix!"; + v_msgEng="Please enter the price!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + donnees = 'idOptique='+idOptique+'&prixPrestataire='+prixPrestataire; + + typeSms="ententeprealablemont"; + + donnees_sav = donnees+'&typeMail=mailententeprealablemont'; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmonture/demanderaccordmont/", + + type: 'POST', + data: donnees, + success: function(data) { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + + $("#div_monture").html(data); + }, + error: function(data) { + }, + complete: function() { + mettremailattente(donnees_sav); + } + }); +} + +// 06/04/2019 +function changer_langue() +{ + codeLangue = $("#codeLangue").val(); + + v_msg="Confirmez-vous le changement de langue?"; + v_msgEng="Do you confirm the language change?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxchangerlangue/changerlangue/", + type : 'post', + // data: donnees, + error: function(errorData) + { + }, + success: function(data) + { + }, + complete: function() + { + window.location.assign($("#racineWeb" ).val()+"Connexion/deconnecter/"); + } + }); + } +} + +function envoyersms(p_destinataires, p_message, creation_message) +{ + if(creation_message=="1") + { + envoyer_messagerie(p_message, "0"); + } + + envoismsactif = $("#envoismsactif").val(); + if(envoismsactif=="0") + { + return; + } + + if(p_destinataires.length<5) + { + /* + v_msg="SMS => Pas de destintaire!"; + v_msgEng="SMS => No recipient!"; + + alert_ebene(v_msg, v_msgEng); + */ + + return; + } + + fournisseurSms = $("#fournisseurSms").val(); + + if (fournisseurSms<=" ") + { + v_msg="Fournisseur de SMS non défini!"; + v_msgEng="SMS provider not defined!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if(fournisseurSms=="esicia") + { + ajouter_sms_attente(p_destinataires, p_message); + return; + } + else + if(fournisseurSms=="blive") + { + ajouter_sms_attente(p_destinataires, p_message); + return; + } + else + if(fournisseurSms=="hooza") + { + ajouter_sms_attente(p_destinataires, p_message); + return; + } + else + { + v_msg=fournisseurSms+" => Fournisseur de SMS inconnu!"; + v_msgEng=fournisseurSms+" => Unknown SMS Provider!"; + alert_ebene(v_msg, v_msgEng); + return; + } +} + +function preparesms_adherent(typeSms) +{ + // ajout du 09/04/2025 => empêcher l'nevoi des messages de Facturation + return; + + /* + envoismsactif = $("#envoismsactif").val(); + if(envoismsactif=="0") + { + return; + } + + smsAssure = $("#smsAssure").val(); + if(smsAssure=="0") + { + return; + } + + smsmParFacture = $("#smsmParFacture").val(); + + if(smsmParFacture=="0") + { + return; + } + + codeLangueAdherent = $("#codeLangueAdherent").val(); + + p_destinataires = ""; + p_message = ""; + creation_message = "0"; + + devise = $("#devise_C").val(); + + if (typeSms=="facturer_cso") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonConsultation = $("#numeroBonConsultation_C").val(); + + p_destinataires = $("#telephonePortableAdherent_C").val(); + + p_message = $("#prestataire_C").val()+" "; + p_message +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += (codeLangueAdherent=="en_US") ? "Consultation form No :" : "Bon consultation No : "; + p_message += numeroBonConsultation+" "; + + p_message += (codeLangueAdherent=="en_US") ? "Consumptions : " : "Consommations : "; + p_message += cout_f+" "+devise; + + p_message +=" TM : "+montantTm_f+" "+devise; + } + + if (typeSms=="facturer_pha") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonOrdonnance = $("#numeroBonOrdonnance_C").val(); + + p_destinataires = $("#telephonePortableAdherent_C").val(); + + p_message = $("#prestataire_C").val()+" "; + p_message +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += (codeLangueAdherent=="en_US") ? "Prescription No : " : "Ordonnance No : "; + p_message += numeroBonOrdonnance+" "; + + p_message += (codeLangueAdherent=="en_US") ? "Pharmacy Consumptions : " : "Consommations Pharmacie : "; + p_message += cout_f+" "+devise; + + p_message +=" TM : "+montantTm_f+" "+devise; + + } + + if (typeSms=="facturer_lab") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonExamen = $("#numeroBonExamen_C").val(); + + p_destinataires = $("#telephonePortableAdherent_C").val(); + + p_message = $("#prestataire_C").val()+" "; + p_message +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += (codeLangueAdherent=="en_US") ? "Exam form No : " : "Bon Examens No : "; + p_message += numeroBonExamen+" "; + + p_message += (codeLangueAdherent=="en_US") ? "Laboratory consumptions : " : "Consommations Labo : "; + p_message += cout_f+" "+devise; + + p_message +=" TM : "+montantTm_f+" "+devise; + } + + if (typeSms=="facturer_opt") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonOptique = $("#numeroBonOptique_C").val(); + + p_destinataires = $("#telephonePortableAdherent_C").val(); + + p_message = $("#prestataire_C").val()+" "; + p_message +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += (codeLangueAdherent=="en_US") ? "Optical foem No : " : "Bon Optique No : "; + p_message += numeroBonOptique+" "; + + p_message += (codeLangueAdherent=="en_US") ? "Optical consumptions : " : "Consommations Optiques : "; + p_message += cout_f+" "+devise; + + p_message +=" TM : "+montantTm_f+" "+devise; + } + + if (typeSms=="facturer_mont") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + + p_destinataires = $("#telephonePortableAdherent_C").val(); + + p_message = $("#prestataire_C").val()+" "; + p_message +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += (codeLangueAdherent=="en_US") ? "Optical frames Consumptions : " : "Consommations Montures : "; + p_message += cout_f+" "+devise; + + p_message +=" TM : "+montantTm_f+" "+devise; + } + + if (typeSms=="facturer_sea") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonKine = $("#numeroBonKine_C").val(); + + p_destinataires = $("#telephonePortableAdherent_C").val(); + + p_message = $("#prestataire_C").val()+" "; + p_message +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_message += (codeLangueAdherent=="en_US") ? "KINE form No : " : "Bon KINE No : "; + p_message += numeroBonKine+" "; + + p_message += (codeLangueAdherent=="en_US") ? "KINE Consumptions : " : "Consommations KINE : "; + p_message += cout_f+" "+devise; + + p_message +=" TM : "+montantTm_f+" "+devise; + } + + envoyersms(p_destinataires, p_message, creation_message); + */ +} + +function ajouter_sms_attente(p_destinataires, p_message) +{ + donnees = "destinataires="+p_destinataires+"&message="+p_message; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsmsattente/ajouter/", + type: 'POST', + data: donnees, + success: function(data) + { + }, + error: function(errdata) + { + }, + complete: function() + { + } + }); +} + +function ajouter_sms_attente_singleton(p_destinataires, p_message) +{ + donnees = "destinataires="+p_destinataires+"&message="+p_message; + + var addr = p_destinataires.split(","); + + addr.forEach(function(element) + { + p_dest = element; + + if(p_dest.length>4) + { + donnees = "destinataires="+p_dest+"&message="+p_message; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsmsattente/ajouter/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + } + }); + } + else + { + v_msg=p_dest+" => Mauvais format!"; + v_msgEng=p_dest+" => wrong phone format!"; + alert_ebene(v_msg, v_msgEng); + } + }); +} + +function tester_disponibiliter_sms() +{ + p_message = ""; + + fournisseurSms = $("#fournisseurSms").val(); + + if (fournisseurSms<=" ") + { + v_msg="Fournisseur de SMS non défini!"; + v_msgEng="SMS provider not defined!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + if(fournisseurSms=="esicia") + { + p_message = "Fournisseur : esicia "; + } + else + if(fournisseurSms=="blive") + { + p_message = "Fournisseur : blive "; + } + else + if(fournisseurSms=="hooza") + { + p_message = "Fournisseur : hooza "; + } + else + { + v_msg=fournisseurSms+" => Fournisseur de SMS inconnu!"; + v_msgEng=fournisseurSms+" => Unknown SMS Provider!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + p_destinataires = "25761198584"; + // p_destinataires = "25761198584,25761198584"; + + donnees = "destinataires="+p_destinataires+"&message="+p_message+"&fournisseurSms="+fournisseurSms; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxtesterdisponiblitesms/envoyerlesms/", + type: 'POST', + data: donnees, + success: function(data) + { + $('#div_test_gabarit').html(data); + }, + error: function(errdata) + { + }, + complete: function() + { + } + }); +} + +function ajouter_destinataire_sms_adherent(p_destinataires) +{ + envoismsactif = $("#envoismsactif").val(); + if(envoismsactif=="0") + { + return p_destinataires; + } + + smsAssure = $("#smsAssure").val(); + if(smsAssure=="0") + { + return p_destinataires; + } + + tel_adh = $("#telephonePortableAdherent_C").val(); + + if(tel_adh.length>4) + { + return p_destinataires+","+tel_adh; + } + + return p_destinataires; +} + +function tester_ajouter_destinataire_sms_adherent() +{ + p_destinataires = "22506802339"; +} + +function preparemail_adherent(typeSms) +{ + emailParFacture = $("#emailParFacture").val(); + + if(emailParFacture=="0") + { + return; + } + + emailAdherent = $("#emailAdherent_C").val(); + + if(emailAdherent.length<5) + { + return; + } + + codeLangueAdherent = $("#codeLangueAdherent").val(); + + p_objet_email_adh = (codeLangueAdherent=="en_US") ? "ALERT CONSUMPTION" : "ALERT CONSOMMATIONS"; + + p_messageemail_adh = ""; + + devise = $("#devise_C").val(); + + cout = parseInt(cout); + cout = cout.toLocaleString(); + + if (typeSms=="facturer_cso") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonConsultation = $("#numeroBonConsultation_C").val(); + + p_messageemail_adh = $("#prestataire_C").val()+" "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="Patient : "+patient+" ("+numeroBeneficiaire+")"; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "Consultation form No : " : "Bon consultation No : "; + p_messageemail_adh += numeroBonConsultation; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "Consumptions : " : "Consommations : "; + p_messageemail_adh += cout_f+" "+devise; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="TM : "+montantTm_f+" "+devise; + } + + if (typeSms=="facturer_pha") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonOrdonnance = $("#numeroBonOrdonnance_C").val(); + + p_messageemail_adh = $("#prestataire_C").val()+" "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "Prescription No : " : "Ordonnance No : "; + p_messageemail_adh += numeroBonOrdonnance; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "Pharmacy Consumptions : " : "Consommations Pharmacie : "; + p_messageemail_adh += cout_f+" "+devise; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="TM : "+montantTm_f+" "+devise; + + } + + if (typeSms=="facturer_lab") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonExamen = $("#numeroBonExamen_C").val(); + + p_messageemail_adh = $("#prestataire_C").val()+" "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "Exam form No : " : "Bon Examens No : "; + p_messageemail_adh += numeroBonExamen; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "Laboratory consumptions : " : "Consommations Labo : "; + p_messageemail_adh += cout_f+" "+devise; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="TM : "+montantTm_f+" "+devise; + } + + if (typeSms=="facturer_opt") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonOptique = $("#numeroBonOptique_C").val(); + + p_messageemail_adh = $("#prestataire_C").val()+" "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "Optical form No : " : "Bon Optique No : "; + p_messageemail_adh += numeroBonOptique; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "Optical consumptions : " : "Consommations Optiques : "; + p_messageemail_adh += cout_f+" "+devise; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="TM : "+montantTm_f+" "+devise; + } + + if (typeSms=="facturer_mont") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + + p_messageemail_adh = $("#prestataire_C").val()+" "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "Optical frames Consumptions : " : "Consommations Montures : "; + p_messageemail_adh += cout_f+" "+devise; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="TM : "+montantTm_f+" "+devise; + } + + if (typeSms=="facturer_sea") + { + patient = $("#beneficiaire_C").val(); + numeroBeneficiaire = $("#numeroBeneficiaire_C" ).val(); + numeroBonKine = $("#numeroBonKine_C").val(); + + p_messageemail_adh = $("#prestataire_C").val()+" "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="Patient : "+patient+" ("+numeroBeneficiaire+") "; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "KINE form No : " : "Bon KINE No : "; + p_messageemail_adh += numeroBonKine; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh += (codeLangueAdherent=="en_US") ? "KINE Consumptions : " : "Consommations KINE : "; + p_messageemail_adh += cout_f+" "+devise; + + p_messageemail_adh +="\n\n"; + + p_messageemail_adh +="TM : "+montantTm_f+" "+devise; + } + + ajouter_mail_attente(emailAdherent, p_objet_email_adh, p_messageemail_adh); +} + +function ajouter_mail_attente(emailAdherent, p_objet_email_adh, p_messageemail_adh) +{ + donnees = "email="+emailAdherent+"&objet="+p_objet_email_adh+"&message="+p_messageemail_adh; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxsmailadhattente/ajouter/", + type: 'POST', + data: donnees, + success: function(data) + { + }, + error: function(errdata) + { + }, + complete: function() + { + } + }); +} + +function verifiertentativeidentitification(user_id) +{ + /* + donnees = 'user_id='+user_id; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenvoimaildivers/verifiertentativeidentitification/", + type : 'post', + data: donnees, + error: function(errorData) + { + }, + success: function(data) + { + }, + complete: function() { + } + }); + */ +} + +function afficherbon_vide() +{ + $("#div_bonpecs").html(""); + + codeLangue = $("#codeLangue").val(); + if(codeLangue=="en_US") + { + $("#nbligne").val("Number of lines displayed : 0"); + } + else + { + $("#nbligne").val("Nombre de bons affichés : 0"); + } + + codeTypeBon=$("#codeTypeBon").val(); + + if (codeTypeBon<=" ") + { + v_msg="Veuillez sélectionner un type de bon!"; + v_msgEng="Please select a form type!"; + alert_ebene(v_msg, v_msgEng); + $("#codeTypeBon").focus(); + return; + } + + $("#div_bonpecs").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxafficherbons/vide/", + error: function(errorData) + { + }, + success: function(data) + { + $("#div_bonpecs").html(data); + }, + complete: function() + { + } + }); +} + +function demander_accord_pha_cso(idMedicament) +{ + donnees = 'idMedicament='+idMedicament; + + typeSms="ententeprealablepha"; + + donnees_sav = 'idMedicament='+idMedicament+'&typeMail=mailententeprealablepha'; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailpharmacie/demanderaccordpha/", + type: 'POST', + data: donnees, + success: function(data) { + preparesms(typeSms); + + v_msg="Demande accord prealable envoyée!"; + v_msgEng="Request prior agreement sent!"; + alert_ebene(v_msg, v_msgEng); + + // raffraichir affichage + $("#livraison").html(data); + }, + error: function(data) { + }, + complete: function() { + mettremailattente(donnees_sav); + } + }); +} + +function desactiver_click_droit() +{ + if (document.addEventListener) { + document.addEventListener('contextmenu', function (e) { + e.preventDefault(); + }, false); + } else { + document.attachEvent('oncontextmenu', function () { + window.event.returnValue = false; + }); + } +} + +function enregistrer_new_notes() +{ + notesNew = $("#notesNew").val(); + notesNew = notesNew.trim(); + + if (notesNew<=" ") + { + v_msg="Veuillez saisir la note!"; + v_msgEng="Please enter the note!"; + alert_ebene(v_msg, v_msgEng); + + $("#notesNew").focus(); + return; + } + + donnees = 'notesNew='+notesNew; + + v_msg="Confirmez-vous cette note?"; + v_msgEng="Do you confirm this note?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnotesfeuillemaladie/creernote/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + $("#btn_pop_note_new_quit").click(); + }, + complete: function() { + afficher_notes_feuille(); + } + }); + } +} + +function afficher_notes_feuille() +{ + $("#div_notes").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnotesfeuillemaladie/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_notes").html(donnees_retour); + } + }); +} + +function initiernotesfeuille() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnotesfeuillemaladie/nouvellenote/", + error: function(errorData) { + }, + success: function(data) + { + $("#div_note_new").html(data); + }, + complete: function() { + $("#btn_pop_note_new").click(); + } + }); +} + +function click_btn_add_drug() +{ + hospitalisation = $("#hospitalisation_C").val(); + + nbMedicamentMax = parseInt($("#nbMedicamentMax").val()); + nbMedicamentSaisie = parseInt($("#nbMedicamentSaisie").val()); + + if (nbMedicamentSaisie>=nbMedicamentMax && hospitalisation!="1") + { + v_msg="Attention! Maximum de médicaments atteint!"; + v_msgEng="Warning! Maximum drugs reached!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + $("#btn_add_drug").click(); +} + +function imprimer_feuille_maladie() +{ + facture=$("#facture").val(); + + if (facture!=1) + { + v_msg="Pas encore facturée!"; + v_msgEng="Not yet charged!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + // $("#div_notes").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees_retour = ""; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerfeuillemaladie/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_export_a").html(donnees_retour); + $("#btn_imprimer_feuille_maladie").click(); + } + }); +} + +function controle_numerique_new(idControle, oldValue) +{ + controle = document.getElementById(idControle); + + valeur = controle.value; + + if(isNaN(valeur)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + controle.value=oldValue; + controle.focus(); + return false; + } + + return true; +} + +function reinitrechercherbonordonnance() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxchangerordonnance/reinit/", + type: 'POST', + // data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Pharmacien/"); + } + }); +} + +function reinit_chercher_ordonnance_opt() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxchangerordonnanceopt/reinit/", + type: 'POST', + // data: donnees, + success: function(data) { + // window.location.assign($("#racineWeb" ).val()+"Opticien/"); + }, + error: function(data) { + }, + complete: function() + { + window.location.assign($("#racineWeb" ).val()+"Opticien/"); + } + }); +} + +// + +function reinitrechercherbonkine() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxchangerordonnancesea/reinit/", + type: 'POST', + // data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() { + window.location.assign($("#racineWeb" ).val()+"Kine/"); + } + }); +} + +function supprimer_espace_string(p_mot) +{ + p_mot = p_mot.trim(); + p_mot = p_mot.replace(" ", ""); + return p_mot; +} + +function notesfeuillemaladie() +{ + actVisible=$("#actVisible").val(); + + if (actVisible!="1") + { + v_msg="Non autorisée!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Notesfeuillemaladie/"); +} + +function raffraichier_gabarit() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxgabarit/", + success: function(data) + { + $("#div_ajaxgabarit").html(data); + }, + error: function(errorData) + { + }, + complete: function() + { + $(".datepicker" ).datepicker(); + + raffraichier_messagerie(); + } + }); +} + +function connexion_cookie() +{ + msgErreur=$("#msgErreur").val(); + + donnees = 'msgErreur='+msgErreur; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxconnexioncookie/", + type: 'POST', + data: donnees, + success: function(data) + { + $("#div_ajaxconnexion").html(data); + }, + error: function(errorData) + { + }, + complete: function() + { + var login = document.getElementById("login").value; + if (login>" ") + { + $("#mdp").focus(); + } + else + { + $("#login").focus(); + } + } + }); +} + + +function ajaxaffectionspossibles() +{ + codeTypeAffection=$("#codeTypeAffection").val(); + + donnees = 'codeTypeAffection='+codeTypeAffection; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxaffectionspossibles/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#listeaffections").html(data); + } + }); +} + + +function enregistreraffection() +{ + affectionObligatoire=$("#affectionObligatoire").val(); + codeAffection=$("#codeAffectionPop").val(); + codeAffectionOld=$("#codeAffection").val(); + + if (affectionObligatoire=="1" && codeAffection<="0000") + { + v_msg="Diagnostique exigé!"; + v_msgEng="Diagnosis required!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeAffectionPop").focus(); + + return; + } + + if (codeAffection==codeAffectionOld) + { + v_msg="Déjà saisi!"; + v_msgEng="Already done!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeAffectionPop").focus(); + + return; + } + + v_msg="Confirmez-vous cette affection?"; + v_msgEng="Do you confirm this affection?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'codeAffection='+codeAffection; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistreraffection/enregistreraffection/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() + { + $("#close_pop_affection").click(); + feuillemaladie(); + } + }); + } +} + +function diagnosticsfeuillemaladie() +{ + /* + actVisible=$("#actVisible").val(); + + if (actVisible!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + */ + + window.location.assign($("#racineWeb" ).val()+"Diagnosticscons/"); +} + +function afficher_diagnostics_feuille() +{ + $("#div_dianostics").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdiagnosticscons/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_dianostics").html(donnees_retour); + } + }); +} + + +function imprimer_ecarts_decompte() +{ + var div_export = $('#div_export_ecart_decompte'); + + div_export.html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $("#btn_imprimer_ecart_decompte").click(); + + // alert("Ajaximprimerecartdecompte"); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximprimerecartdecompte/", + type: 'POST', + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + // $("#btn_imprimer_ecart_decompte").click(); + } + }); + +} + +function afficher_ecarts_facture_cons() +{ + $("#div_ecart_decompte").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxecartdecomptecons/ecartfacture/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_ecart_decompte").html(donnees_retour); + } + }); +} + +function ecarts_facture_non_saisies_cons() +{ + $("#div_ecart_decompte").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxecartdecomptecons/ecartnonsaisi/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_ecart_decompte").html(donnees_retour); + } + }); +} + +function initvidermessagerie() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxvidermessagerie/", + error: function(errorData) { + }, + success: function(data) { + $("#div_vider_messagerie").html(data); + }, + complete: function() { + $("#btn_pop_vider_messagerie").click(); + $(".datepicker" ).datepicker(); + } + }); +} + +function vidermessagerie() +{ + dateLimite = $("#dateLimite").val(); + + v_msg="Confirmez-vous le vidage de tous les messages générés avant le "+dateLimite+" ?"; + v_msgEng="Do you confirm the emptying of all messages generated before the "+dateLimite+" ?"; + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'dateLimite=' + dateLimite; + + $("#btn_pop_vider_messagerie").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxvidermessagerie/vidermessagerie/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + // $('#div_test_gabarit').html(data); + }, + complete: function() + { + v_msg="Vidage effectué avec succès!"; + v_msgEng="Emptying done successfully!"; + alert_ebene(v_msg, v_msgEng); + + $("#btn_pop_vider_messagerie_quit").click(); + gerer_messagerie(); + // Messagerie/ + } + }); + } +} + +function afficher_contacts_assureur() +{ + window.location.assign($("#racineWeb" ).val()+"Infossassureur/"); +} + +function ajaxdelaicarencecaisonconsultation() +{ + codeRaisonConsultation=$("#codeRaisonConsultation").val(); + + donnees = 'codeRaisonConsultation='+codeRaisonConsultation; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdelaicarencecaisonconsultation/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#infodelaicarence").html(data); + }, + complete: function() { + $("#delaiCarenceRaisonconsultation").val( $("#delaiCarenceRaisonconsultation_info").val()); + $("#appliquerDelaiCarence").val( $("#appliquerDelaiCarence_info").val()); + } + }); +} + +function CalculerFinMoisDecompte() +{ + var typdate = $("#debutMoisDecompte").datepicker("getDate"); + typdate.addMonths(1); + $("#finMoisDecompte").datepicker( "setDate", typdate ); +} + +function reposmedical() +{ + actVisible=$("#actVisible").val(); + + if (actVisible!="1") + { + v_msg="Non autorisée!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Reposmedical/"); +} + +function afficher_repos_medical() +{ + $("#div_notes").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxreposmedical/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_notes").html(donnees_retour); + } + }); +} + +function initier_repos_medical() +{ + $.ajax({ + url: $("#racineWeb").val()+"Ajaxreposmedical/nouveaureposmedical/", + error: function(errorData) { + }, + success: function(data) + { + $("#div_note_new").html(data); + }, + complete: function() { + $("#btn_pop_note_new").click(); + } + }); +} + +function enregistrer_new_repos_medical() +{ + notesNew = $("#notesNew").val(); + notesNew = notesNew.trim(); + + if (notesNew<=" ") + { + v_msg="Veuillez saisir la note!"; + v_msgEng="Please enter the note!"; + alert_ebene(v_msg, v_msgEng); + + $("#notesNew").focus(); + return; + } + + nbJour = $("#nbJour").val(); + + if(isNaN(nbJour)) + { + v_msg="Veuillez revoir la duréee!"; + v_msgEng="Please review the duration!"; + alert_ebene(v_msg, v_msgEng); + + $("#nbJour").focus(); + return; + } + + if (nbJour<="0") + { + v_msg="Veuillez revoir la duréee!"; + v_msgEng="Please review the duration!"; + alert_ebene(v_msg, v_msgEng); + + $("#nbJour").focus(); + return; + } + + donnees = 'notesNew='+notesNew+"&nbJour="+nbJour; + + v_msg="Confirmez-vous ce repos médical?"; + v_msgEng="Do you confirm this medical rest?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxreposmedical/creerreposmedical/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + $("#btn_pop_note_new_quit").click(); + }, + complete: function() { + afficher_repos_medical(); + } + }); + } +} + +function supprimer_affections(idAffection) +{ + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxenregistreraffection/supprimeraffection/", + type : 'post', + data: "idAffection="+idAffection, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + $("#close_pop_affection").click(); + feuillemaladie(); + } + }); + } +} + +function anteceentsmedicaux() +{ + estMedecin=$("#estMedecin").val(); + + if (estMedecin!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Anteceentsmedicaux/"); +} + +function diagnosticsbeneficiaire() +{ + estMedecin=$("#estMedecin").val(); + + if (estMedecin!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Diagnosticsconsbeneficiaire/"); +} + +function notesbeneficiaire() +{ + estMedecin=$("#estMedecin").val(); + + if (estMedecin!="1") + { + v_msg="Non autorisé!"; + v_msgEng="Not allowed!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + window.location.assign($("#racineWeb" ).val()+"Notesbeneficiaire/"); +} + +function afficher_diagnostics_beneficiaire() +{ + $("#div_dianostics").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdiagnosticsbeneficiaire/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_dianostics").html(donnees_retour); + } + }); +} + +function afficher_notes_beneficiaire() +{ + $("#div_notes").html('
  ' + 'Veuillez patienter...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxnotesbeneficiaire/", + error: function(errorData) { + }, + success: function(data) { + donnees_retour = data; + }, + complete: function() { + $("#div_notes").html(donnees_retour); + } + }); +} + +function test_online() +{ + if(navigator.onLine) + { + $("#test_connexion").css('background-color', 'green'); + v_msg="Connexion OK!"; + v_msgEng="Connection OK"; + alert_ebene(v_msg, v_msgEng); + + } + else + { + $("#test_connexion").css('background-color', 'red'); + v_msg="Problème de Connexion!"; + v_msgEng="Connection Problem!"; + alert_ebene(v_msg, v_msgEng); + } + return; +} + +function raffraichier_messagerie() +{ + deconnexion='0'; + if(navigator.onLine) + { + $("#test_connexion").css('background-color', 'green'); + c_html = ""; + $.ajax({ + url: $("#racineWeb").val()+"Ajaxmessagerie/", + success: function(data) { + c_html = data; + }, + error: function(errorData) { + }, + complete: function() { + $("#nbMessagesNonLus").html(c_html); + msgNonLus=$("#msgNonLus").val(); + + deconnexion=$("#deconnexion").val(); + // alert("deconnexion => "+deconnexion); + if(deconnexion=='1') + { + window.location.assign($("#racineWeb" ).val()+"Connexion/deconnecter/"); + } + + if(msgNonLus>0) + { + pop_dernier_messagerie(); + } + } + }); + } + else + { + $("#test_connexion").css('background-color', 'red'); + return; + } +} + + +function consulterfactureverres() +{ + idFacture = $("#idFacture").val(); + + $("#div_facture_detail").html('
  ' + 'Veuillez patienter...' + '
'); + + donnees = 'idFacture='+idFacture; + + if(isNaN(idFacture)) + { + v_msg="Valeur numérique exigée!"; + v_msgEng="Numeric value required!"; + alert_ebene(v_msg, v_msgEng); + + $("#idFacture").val("0"); + $("#idFacture").focus(); + return; + } + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfactureconsprestataire/verres/", + type: 'POST', + data: donnees, + success: function(data) { + $("#div_facture_detail").html(data); + }, + error: function(data) { + }, + complete: function() { + } + }); +} + +function init_remplacer_medicament(idMedicament) +{ + donnees = 'idMedicament='+idMedicament; + + // alert(donnees); + // return; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailprescription/initremplacement/", + type: 'POST', + data: donnees, + success: function(data) { + }, + error: function(data) { + }, + complete: function() + { + $("#btn_remplacer_medicament").click(); + } + }); +} + +function consulter_remplacer_medicament() +{ + $("#div_liste_medicaments_remplaces").html('
  ' + 'Veuillez patienter...' + '
'); + + $('#btn_medicaments_remplaces').click(); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailprescription/consulterremplacement/", + type: 'POST', + success: function(data) { + $("#div_liste_medicaments_remplaces").html(data); + }, + error: function(data) { + }, + complete: function() + { + // $('#btn_medicaments_remplaces').click(); + } + }); +} + +function ctrlkeypress_medicament_remplacement(ev) +{ + var keycode = (ev.keyCode ? ev.keyCode : ev.which); + if(keycode == '13') + { + afficher_pop_recherche_medicament_remplacement(); + } +} + +function afficher_pop_recherche_medicament_remplacement() +{ + nomsearch = $("#nomsearchrempl").val(); + + if (nomsearch > " ") + { + donnees = "valid=1&nomsearch="+nomsearch; + + // alert(donnees); + // return; + + $("#div_listemedicament_rempl").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlistemedicaments/remplacement/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + $("#div_listemedicament_rempl").html(data); + } + }); + } +} + +function selectionner_medicament_pop_rempl(codeMedicament, libelleMedicament) +{ + $("#codeMedicament_pop_rempl").val(codeMedicament); + $("#libelleMedicament_pop_rempl").val(libelleMedicament); +} + +function remplacer_medicament() +{ + codeMedicamentNouv = $("#codeMedicament_pop_rempl").val(); + libelleMedicamentNouv = $("#libelleMedicament_pop_rempl").val(); + + if (codeMedicamentNouv<=" ") + { + v_msg="Veuillez sélectionner un médicament!"; + v_msgEng="Please select a medicine/drug!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + v_msg="Prescrire : "+libelleMedicamentNouv+"?"; + v_msgEng="Prescribe : "+libelleMedicamentNouv+"?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + donnees = 'codeMedicamentNouv='+codeMedicamentNouv; + + // alert(donnees); + // return; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdetailprescription/remplacermedicament/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + // $('#div_test_gabarit').html(data); + // $("#btn_close_pop_rempl").click(); + prescription_medicament(); + }, + complete: function() { + } + }); + } +} + +function imprimer_facture_feuille_maladie(idFactureFeuille) +{ + donnees = 'idFacture='+idFactureFeuille; + + // alert("imprimer_facture_feuille_maladie => "+donnees); + // return; + + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxfeuillemaladie/imprimerfacture/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) + { + $("#div_imprimer_facture").html(data); + }, + complete: function() { + $("#btn_pop_imprimer_facture").click(); + } + }); +} + +function appliquerDataTable(){ + + var sc = $(window).scrollTop(), + dh = $(document).height(), + ch = $(window).height(); + scrollPercent = (sc / (dh-ch)) * 100; + + try{ + var oTable = $('.tabliste').DataTable({ + "lengthMenu": [ 50, 100, 150], + "scrollX": true, + "scrollY": "75vh", + "pagingType": "full_numbers", + "autoWidth": true, + "language": { + "lengthMenu":"Affiche _MENU_ par page", + "zeroRecords": "Désolé - Aucune donnée trouvée", + "info": "_PAGE_ sur _PAGES_ pages", + "infoEmpty": "Pas d'enregistrement", + "search": "Recherche:", + "fixedColumns": true, + "paginate": { + "next": "►", + "previous": "◄", + "first": "|◄", + "last": "►|" + }, + "infoFiltered": "(filtré de _MAX_ total enregistrements)" + } + }); + /* + $(window).bind('resize', function () { + oTable.fnAdjustColumnSizing(false); + }); + */ + } + catch(err){ + return false; + } + +} + +function appliquerDataTableMini(){ + try{ + $('.tablistemini').DataTable({ + "lengthMenu": [ 50, 100, 150], + "scrollX": true, + "scrollY": "34vh", + "pagingType": "full_numbers", + "autoWidth": false, + "language": { + "lengthMenu":"Affiche _MENU_ par page", + "zeroRecords": "Désolé - Aucune donnée trouvée", + "info": "_PAGE_ sur _PAGES_ pages", + "infoEmpty": "Pas d'enregistrement", + "search": "Recherche:", + "paginate": { + "next": "►", + "previous": "◄", + "first": "|◄", + "last": "►|" + }, + "infoFiltered": "(filtré de _MAX_ total enregistrements)" + } + }); + + } + catch(err){ + return false; + } +} + +function dataTableSpeciale(){ + try{ + $('.tabspeciale').DataTable({ + "lengthMenu": [ 50, 100, 150], + "scrollX": true, + "scrollY": "75vh", + "pagingType": "full_numbers", + "autoWidth": false, + "bFilter": false, + "bLengthChange": false, + "orderMulti": true, + "language": { + "lengthMenu":"Affiche _MENU_ par page", + "zeroRecords": "Désolé - Aucune donnée trouvée", + "info": "_PAGE_ sur _PAGES_ pages", + "infoEmpty": "Pas d'enregistrement", + "search": "Recherche:", + "paginate": { + "next": "►", + "previous": "◄", + "first": "|◄", + "last": "►|" + }, + "infoFiltered": "(filtré de _MAX_ total enregistrements)" + } + }); + + } + catch(err){ + return false; + } +} + +function dataTableSpecialeMini(){ + try{ + $('.tabspecialemini').DataTable({ + "lengthMenu": [ 50, 100, 150], + "scrollX": true, + "scrollY": "34vh", + "pagingType": "full_numbers", + "autoWidth": false, + "bFilter": false, + "bLengthChange": false, + "orderMulti": true, + "language": { + "lengthMenu":"Affiche _MENU_ par page", + "zeroRecords": "Désolé - Aucune donnée trouvée", + "info": "_PAGE_ sur _PAGES_ pages", + "infoEmpty": "Pas d'enregistrement", + "search": "Recherche:", + "paginate": { + "next": "►", + "previous": "◄", + "first": "|◄", + "last": "►|" + }, + "infoFiltered": "(filtré de _MAX_ total enregistrements)" + } + }); + + } + catch(err){ + return false; + } +} + +$(function(){ + appliquerDataTable(); + dataTableSpeciale(); + + $('.selectpicker').selectpicker(); + + $("#div_selection").hide(); + + $("#searchInput").keyup(debounce(function() { + const libelle = $(this).val().trim(); + + if (!libelle || libelle.length < 3) { + $("#div_selection").hide(); + return; + } + + const formHandlers = { + "selectactesmedicaux": { + link: "Ajaxchargeractesmedicaux/", + data: { libelle: libelle } + } + }; + + const handler = formHandlers[$('#nomForm').val()]; + if (!handler) return; + + /* Vérification des prérequis si nécessaire + if (handler.preCheck && !handler.preCheck()) { + return; + } + */ + + // Préparation des données + const data = typeof handler.data === 'function' ? handler.data() : handler.data; + + // Envoi de la requête AJAX + $.ajax({ + type: "POST", + url: $("#racineWeb").val() + handler.link, + data: data, + beforeSend: function() { + $("#searchInput").css("background", "#FFF url(Bootstrap/images/loading.gif) no-repeat 165px"); + }, + success: function(data) { + $("#div_selection").show().html(data); + $("#searchInput").css("background", "#FFF"); + }, + error: function(xhr, status, error) { + console.error("Erreur lors de la recherche:", error); + $("#searchInput").css("background", "#FFF"); + } + }); + }, 300)); +}); + +function ajaxinfosboninitconsultation() +{ + 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; + } + + numeroBon = $("#numeroBon").val(); + + if(isNaN(numeroBon)) + { + v_msg="Veuillez revoir le numéro 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() { + } + }); +} + +function enregistrerinitconsultation() +{ + 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 (delaiCarenceBeneficiaire>0) + { + if (anciennete  ' + 'Veuillez patienter... / Please wait...' + ''); + + compare_face = $("#compare_face").val(); + + var dataURL = canvas.toDataURL("image/jpeg"); + + $.ajax({ + url: $("#racineWeb").val()+"Fichebeneficiaire/ebeneenregistrerface/", + type: 'POST', + data: {'image_face' : dataURL, 'compare_face' : compare_face , 'del_face' : "0"}, + success: function(data) { + $("#ebene_take_photo_face").enable(); + $("#div_wait_face_ebene").html(''); + $("#message_face").html(data); + photo_succes = $("#photo_succes").val(); + if(photo_succes=="1") + { + v_msg="Enrôlement effectué avec succès!"; + v_msgEng="Enrollment completed successfully!!"; + // alert_ebene(v_msg, v_msgEng); + setTimeout(() => { + window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"); + }, 1000) + } + }, + error: function(data) { + }, + complete: function(data) { + $("#div_wait_face_ebene").html(''); + } + }); +} + +function ebene_confirmer_photo_face() // OK +{ + $("#ebene_confirmer_photo_face").disable(); + $("#ebene_supprimer_photo_face").disable(); + $("#ebene_take_photo_face").disable(); + $("#motif").disable(); + + $("ebene_confirmer_photo_face").prop('disabled', true); + $("ebene_supprimer_photo_face").prop('disabled', true); + $("ebene_take_photo_face").prop('disabled', true); + $("motif").prop('disabled', true); + + $('#message_face').html(""); + $("#div_wait_face_ebene").html(''); + + $("#del_face").val("0"); + faceRegistered = $("#faceRegistered").val(); + if(faceRegistered!="1") + { + v_msg="Cette personne n'a pas encore de photo dans le système!"; + v_msgEng="This person does not have a photo in the system yet!"; + alert_ebene(v_msg, v_msgEng); + $('#message_face').html(""); + return; + } + + image_face = $("#image_face").val(); + if(image_face<=" ") + { + v_msg="Veuillez prendre une photo!"; + v_msgEng="Please take a photo!"; + alert_ebene(v_msg, v_msgEng); + $('#message_face').html(""); + return; + } + + $("#div_wait_face_ebene").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + compare_face = $("#compare_face").val(); + + var dataURL = canvas.toDataURL("image/jpeg"); + + $.ajax({ + url: $("#racineWeb").val()+"Fichebeneficiaire/ebeneenregistrerface/", + type: 'POST', + data: {'image_face' : dataURL, 'compare_face' : compare_face , 'del_face' : "0"}, + success: function(data) { + $("#ebene_take_photo_face").enable(); + $("#div_wait_face_ebene").html(''); + $("#message_face").html(data); + photo_succes = $("#photo_succes").val(); + if(photo_succes=="1") + { + $("#okId_face").val("1"); + v_msg="Face confirmée!"; + v_msgEng="Face confirmed!"; + // alert_ebene(v_msg, v_msgEng); + setTimeout(() => { + consultation(); + }, 1000) + } + else + { + $("#okId").val("-1"); + $("#okId_face").val("-1"); + } + }, + error: function(data) { + }, + complete: function(data) { + $("#div_wait_face_ebene").html(''); + } + }); +} + +function ebene_supprimer_photo_face() // OK +{ + $('#message_face').html(""); + $("#div_wait_face_ebene").html(''); + + motif=$("#motif").val(); + motif= motif.trim(); + $("#motif").val(motif); + + if (motif<=" ") + { + v_msg="Veuillez saisir un motif!"; + v_msgEng="Please enter a reaon!"; + alert_ebene(v_msg, v_msgEng); + + $("#motif").focus(); + return; + } + + $("#del_face").val("1"); + + faceRegistered = $("#faceRegistered").val(); + if(faceRegistered!="1") + { + v_msg="Cette personne n'a pas encore de photo dans le système!"; + v_msgEng="This person does not have a photo in the system yet!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + image_face = $("#image_face").val(); + if(image_face<=" ") + { + v_msg="Veuillez prendre une photo!"; + v_msgEng="Please take a photo!"; + alert_ebene(v_msg, v_msgEng); + return; + } + + v_msg="Confirmez-vous cette suppression?"; + v_msgEng="Do you confirm this deletion?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + $("#ebene_confirmer_photo_face").disable(); + $("#ebene_supprimer_photo_face").disable(); + $("#ebene_take_photo_face").disable(); + $("#motif").disable(); + + $("ebene_confirmer_photo_face").prop('disabled', true); + $("ebene_supprimer_photo_face").prop('disabled', true); + $("ebene_take_photo_face").prop('disabled', true); + $("motif").prop('disabled', true); + + $("#div_wait_face_ebene").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + compare_face = $("#compare_face").val(); + + var dataURL = canvas.toDataURL("image/jpeg"); + + $.ajax({ + url: $("#racineWeb").val()+"Fichebeneficiaire/ebeneenregistrerface/", + type: 'POST', + data: {'image_face' : dataURL, 'compare_face' : compare_face, 'del_face' : "1", 'motif' : motif}, + success: function(data) { + $("#ebene_take_photo_face").enable(); + $("#div_wait_face_ebene").html(''); + $("#message_face").html(data); + photo_succes = $("#photo_succes").val(); + if(photo_succes=="1") + { + $("#okId").val("-1"); + $("#okId_face").val("-1"); + + document.getElementById('photo_face').setAttribute('src', ""); + + $("#faceRegistered").val("0"); + + $("#ebene_confirmer_photo_face").disable(); + $("#ebene_supprimer_photo_face").disable(); + $("#motif").disable(); + + $("ebene_confirmer_photo_face").prop('disabled', true); + $("ebene_supprimer_photo_face").prop('disabled', true); + $("motif").prop('disabled', true); + + v_msg="Face supprimée avec succès!"; + v_msgEng="Face removed successfully!"; + // alert_ebene(v_msg, v_msgEng); + setTimeout(() => { + window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"); + }, 1000) + } + }, + error: function(data) { + }, + complete: function(data) { + $("#div_wait_face_ebene").html(''); + } + }); + } +} + +function fiche_beneficiaire() +{ + window.location.assign($("#racineWeb" ).val()+"Fichebeneficiaire/"); +} + +function ebene_confirmer_photo_face_facturation() // OK +{ + $("#ebene_confirmer_photo_face").disable(); + $("#ebene_take_photo_face").disable(); + + $("ebene_confirmer_photo_face").prop('disabled', true); + $("ebene_take_photo_face").prop('disabled', true); + + $('#message_face').html(""); + $("#div_wait_face_ebene").html(''); + + image_face = $("#image_face").val(); + if(image_face<=" ") + { + v_msg="Veuillez prendre une photo!"; + v_msgEng="Please take a photo!"; + alert_ebene(v_msg, v_msgEng); + $('#message_face').html(""); + return; + } + + $("#div_wait_face_ebene").html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + compare_face = $("#compare_face").val(); + + var dataURL = canvas.toDataURL("image/jpeg"); + + $.ajax({ + url: $("#racineWeb").val()+"Feuillemaladie/confirmerface/", + type: 'POST', + data: {'image_face' : dataURL, 'compare_face' : compare_face , 'del_face' : "0"}, + + success: function(data) { + // $('#div_test_gabarit').html(data); + $("#ebene_take_photo_face").enable(); + $("#div_wait_face_ebene").html(''); + $("#message_face").html(data); + photo_succes = $("#photo_succes").val(); + if(photo_succes=="1") + { + $("#close_poprec_faciane").click(); + $("#okId_face").val("1"); + /* + v_msg="Face confirmée!"; + v_msgEng="Face confirmed!"; + alert_ebene(v_msg, v_msgEng); + */ + user_id_0 = $("#user_id_C").val(); + + codeTypeFacture = $("#codeTypeFacture_C" ).val(); + // alert("codeTypeFacture = "+codeTypeFacture); + // return; + if(codeTypeFacture=="PHAR") + { + facturer_pha(); + } + else if(codeTypeFacture=="CSO") + { + facturer_cso(user_id); + } + else if(codeTypeFacture=="OPT") + { + facturer_opt(); + } + else if(codeTypeFacture=="MON") + { + facturer_monture(user_id); + } + else if(codeTypeFacture=="LAB") + { + facturer_lab(user_id); + } + else if(codeTypeFacture=="LABCSO") + { + facturer_lab_cso(user_id); + } + else if(codeTypeFacture=="SEA") + { + facturer_sea(user_id); + } + else if(codeTypeFacture=="SEACSO") + { + facturer_sea_cso(user_id); + } + } + else + { + $("#okId").val("-1"); + $("#okId_face").val("-1"); + } + }, + error: function(data) { + $('#div_test_gabarit').html(data); + }, + complete: function() { + $("#div_wait_face_ebene").html(''); + } + }); +} + +function facturation_reconnaissance_faciale() +{ + faceRegistered = $("#faceRegistered").val(); + if(faceRegistered!="1") + { + v_msg="Cettte personne n'a pas encore de face dans le système!"; + v_msgEng="This person doesn't have a face in the system yet!"; + alert_ebene(v_msg, v_msgEng); + $('#message_face').html(""); + return; + } + + re_init_photo_face(); + $("#btn_pop_confirm_face").click(); + +} + +function listerrdv() +{ + d1 = $("#d1").val(); + d2 = $("#d2").val(); + + codeEtatRdv = $("#codeEtatRdv").val(); + + donnees = 'd1='+ d1+'&d2='+d2+'&codeEtatRdv='+codeEtatRdv; + + $("#div_dossiers").html('
' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdemanderdv/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + // alert(data); + + + $('#div_dossiers').html(data); + }, + complete: function() { + + } + }); +} + +function selectionner_rdv(idDemande) +{ + donnees = 'idDemande='+idDemande; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxdemanderdv/selectionner/", + type: 'POST', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + // alert(data); + + + + }, + complete: function() { + ouvrir_rdv(); + } + }); +} + + +function ouvrir_rdv() +{ + window.location.assign($("#racineWeb" ).val()+"Rendezvous/"); + +} + +function historique_rdv() +{ + window.location.assign($("#racineWeb" ).val()+"Historiquerdv/"); + +} + +function valider_rdv() +{ + numeroDemandeRdv = $("#numeroDemandeRdv").val(); + codeEtatRdv = $("#codeEtatRdv").val(); + + motifReponseRdv = $("#motifReponseRdv").val(); + motifReponseRdv = motifReponseRdv.trim(); + + if(codeEtatRdv=="0"){ + + v_msg="Un autre état de réponse est obligatoire!"; + v_msgEng="Another response status is required!"; + alert_ebene(v_msg, v_msgEng); + + $("#codeEtatRdv").focus(); + + return; + } + + if (codeEtatRdv=="1"){ + dateRdvAccordee = $("#dateRdvAccordee").val(); + heureRdvAccordee = $("#heureRdvAccordee").val(); + + if(dateRdvAccordee<=" "){ + v_msg="Une date de rendez-vous est obligatoire!"; + v_msgEng="An appointment date is required!"; + alert_ebene(v_msg, v_msgEng); + + $("#dateRdvAccordee").focus(); + + return; + } + + if(heureRdvAccordee<=" "){ + v_msg="Une heure de rendez-vous est obligatoire!"; + v_msgEng="An appointment time is required!"; + alert_ebene(v_msg, v_msgEng); + + $("#heureRdvAccordee").focus(); + + return; + } + + }else{ + dateRdvAccordee = ""; + heureRdvAccordee = ""; + } + + + if(codeEtatRdv=="9" && motifReponseRdv<=" "){ + v_msg="Le motif est obligatoire!"; + v_msgEng="The pattern is mandatory!"; + alert_ebene(v_msg, v_msgEng); + + $("#motifReponseRdv").focus(); + + return; + } + + donnees = 'numeroDemandeRdv='+ numeroDemandeRdv+'&codeEtatRdv='+codeEtatRdv; + donnees += '&dateRdvAccordee='+dateRdvAccordee+'&heureRdvAccordee='+heureRdvAccordee; + donnees += '&motifReponseRdv='+motifReponseRdv; + + v_msg="Confirmez-vous la modification de votre demande?"; + v_msgEng="Do you confirm the modification of your request?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + vLink = "Ajaxdemanderdv/valider/"; + $.ajax({ + type: "POST", + url: $("#racineWeb").val()+vLink, + data:donnees, + error: function(errorData) { + }, + success: function(data) { + // alert(data); + // $('#div_test_gabarit').html(data); + + }, + complete: function() { + historique_rdv(); + } + }); + } + +} + +function visibilite_date_rdv() +{ + codeEtatRdv = $('#codeEtatRdv').val(); + + if(codeEtatRdv=="0" || codeEtatRdv=="1"){ + $('#tr_date').show(); + }else{ + + $('#tr_date').hide(); + } +} + +// Fonction debounce pour limiter les appels fréquents +function debounce(func, wait, immediate) { + let timeout; + return function() { + const context = this, args = arguments; + const later = function() { + timeout = null; + if (!immediate) func.apply(context, args); + }; + const callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) func.apply(context, args); + }; +} + +function selectElement(val){ + $("#searchInput").val(val); + $("#div_selection").hide(); +} + +function validate_acte_params(params) { + if (!params.codeMedecin || params.codeMedecin.trim() === "") { + alert_ebene("Veuillez sélectionner un médecin!", "Please select a doctor!"); + $("#nomMedecin").focus(); + return false; + } + + if (!params.codeActe || params.codeActe.trim() === "") { + alert_ebene("Veuillez sélectionner un acte!", "Please select an act!"); + return false; + } + + if (!params.prixActe || params.prixActe == 0) { + alert_ebene("Veuillez revoir le tarif!", "Please review rate!"); + return false; + } + + return true; +} + +function ajouter_un_acte_selection_new(params) { + // Normalisation entente préalable + if (params.ententePrealable == 1) { + params.ententePrealable = "2"; + } + + var donnees = { + codeFamilleActe: params.codeFamilleActe, + codeActe: params.codeActe, + codeMedecin: params.codeMedecin, + ententePrealable: params.ententePrealable, + prixActe: params.prixActe, + montantTm: params.montantTm, + aRembourser: params.aRembourser + }; + + var numeroFeuilleMaladie = $("#numeroFeuilleMaladie_C").val(); + var donnees_sav = { + codeActe: params.codeActe, + numeroFeuilleMaladie: numeroFeuilleMaladie, + typeMail: "mailententeprealable" + }; + + $("#div_prestations").html('
Veuillez patienter...
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxselectactesmedicaux/enregistreractemedical/", + type: 'post', + data: donnees, + success: function(data) { + maj_fraisexclu_cso(); + + if (params.ententePrealable == "2") { + preparesms("ententeprealable"); + alert_ebene("Demande accord préalable envoyée!", "Request prior agreement sent!"); + } + + $("#totam_donnees").html(data); + }, + complete: function() { + if (params.ententePrealable == "2") { + mettremailattente(donnees_sav); + } + } + }); +} + +function add_selected_acte_medicaux(controle) { + var str = controle.split(' <==> '); + var codeActe = str[0] || ""; + var libelleActe = str[1] || ""; + var acteExclu = str[3] || ""; + + acteExclu = (acteExclu === "Garanti" || acteExclu === "Guaranteed") ? 0 : 1; + + if (!libelleActe.trim()) return; + if (acteExclu === 1) { + alert_ebene("Acte non couvert!", "Not covered!"); + return; + } + + $("#div_patientez").html('
'); + + $.ajax({ + url: $("#racineWeb").val() + "Ajaxchargeractesmedicaux/actecharge/", + type: 'post', + data: { codeActe: codeActe }, + success: function(data) { + //alert(data); + //$('#div_test_gabarit').html(data); + //return; + $("#div_patientez").html(data); + $("#searchInput").val(''); + + var params = { + codeActe: codeActe, + prixActe: $("#prixActe").val(), + montantTm: $("#montantTm").val(), + aRembourser: $("#aRembourser").val(), + ententePrealable: $("#ententePrealable").val(), + codeFamilleActe: $("#codeFamilleActe").val(), + codeMedecin: $("#codeMedecin").val() + }; + + if (validate_acte_params(params)) { + ajouter_un_acte_selection_new(params); + } + } + }); +} \ No newline at end of file