diff --git a/Js/fonctions.js b/Js/fonctions.js index 129eb5a..1e41e7e 100644 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -12283,4 +12283,6536 @@ function requetes_factures() alert_ebene(v_msg, v_msgEng); $("#codeRequete").focus(); - return; \ No newline at end of file + 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