' Copyright (C) 2025  P4pillon.org
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU Affero General Public License as
' published by the Free Software Foundation, either version 3 of the
' License, or (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU Affero General Public License for more details.
'
' You should have received a copy of the GNU Affero General Public License
' along with this program.  If not, see <https://www.gnu.org/licenses/>.
Imports System.Xml
Public Class Config_Remplacement

    Private Sub Config_Remplacement_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim ConfigXml As New XmlDocument
        Dim ConfigXMLelementliste As XmlNodeList
        ConfigXml.Load(Application.StartupPath + "\config.xml")

        ConfigXMLelementliste = ConfigXml.GetElementsByTagName("Remplacement")
        Titulaire_Num_Id_Nat_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Num_Id_Nat").InnerText
        Titulaire_Cle_Num_Id_Nat_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Cle_Num_Id_Nat").InnerText
        Titulaire_Num_Id_fact_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Num_Id_Facturation").InnerText
        Titulaire_Cle_Num_Id_fact_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Cle_Num_Id_Facturation").InnerText
        Titulaire_Nom_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Nom").InnerText
        Titulaire_Prenom_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Prenom").InnerText
        Titulaire_Code_Conventionnel_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Code_Conventionnel").InnerText
        Titulaire_Code_specialite_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Code_specialite").InnerText
        Titulaire_Code_Zone_tarifaire_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Code_Zone_tarifaire").InnerText
        Titulaire_Code_Zone_IK_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Code_Zone_IK").InnerText
        Titulaire_Code__Agrement_1_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Code__Agrement_1").InnerText
        Titulaire_Code__Agrement_2_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Code__Agrement_2").InnerText
        Titulaire_Code__Agrement_3_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Code__Agrement_3").InnerText
        Titulaire_Condition_Exercice_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Condition_Exercice").InnerText
        Titulaire_Num_RPPS_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Num_RPPS").InnerText
        Titulaire_Cle_Num_RPPS_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Cle_Num_RPPS").InnerText
        Titulaire_raison_sociale_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_raison_sociale").InnerText
        Titulaire_Num_log_situ_fact_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Titulaire_Num_log_situ_fact").InnerText

        Remplacant_Num_Id_Nat_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Remplacant_Num_Id_Nat").InnerText
        Remplacant_Cle_Num_Id_Nat_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Remplacant_Cle_Num_Id_Nat").InnerText
        Remplacant_Num_Id_Facturation_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Remplacant_Num_Id_Facturation").InnerText
        Remplacant_Cle_Num_Id_Facturation_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Remplacant_Cle_Num_Id_Facturation").InnerText
        Remplacant_Num_log_situ_fact_TextBox.Text = ConfigXMLelementliste.Item(0).Item("Remplacant_Num_log_situ_fact").InnerText

        If UCase(ConfigXMLelementliste.Item(0).Item("Activer_Session_Remplacement").InnerText) = "OUI" Then
            CheckBox_Activer_Session_Remplacant.Checked = True
        Else
            CheckBox_Activer_Session_Remplacant.Checked = False
        End If
    End Sub

    Private Sub OK_PictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_PictureBox.Click

        Dim ConfigXml As New XmlDocument
        Dim ConfigXMLelementliste As XmlNodeList
        ConfigXml.Load(Application.StartupPath + "\config.xml")

        MyMsg_Box.Presentation("Officine", "Voulez vous enregistrer les informations?", True, "OUI", True, "NON", True, "Annuler")
        Dim reponse = MyMsg_Box.ShowDialog()
        Select Case reponse

            Case MsgBoxResult.Yes
                ConfigXMLelementliste = ConfigXml.GetElementsByTagName("Remplacement")
                ConfigXMLelementliste.Item(0).Item("Titulaire_Num_Id_Nat").InnerText = Titulaire_Num_Id_Nat_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Cle_Num_Id_Nat").InnerText = Titulaire_Cle_Num_Id_Nat_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Num_Id_Facturation").InnerText = Titulaire_Num_Id_fact_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Cle_Num_Id_Facturation").InnerText = Titulaire_Cle_Num_Id_fact_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Nom").InnerText = Titulaire_Nom_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Prenom").InnerText = Titulaire_Prenom_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Code_Conventionnel").InnerText = Titulaire_Code_Conventionnel_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Code_specialite").InnerText = Titulaire_Code_specialite_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Code_Zone_tarifaire").InnerText = Titulaire_Code_Zone_tarifaire_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Code_Zone_IK").InnerText = Titulaire_Code_Zone_IK_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Code__Agrement_1").InnerText = Titulaire_Code__Agrement_1_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Code__Agrement_2").InnerText = Titulaire_Code__Agrement_2_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Code__Agrement_3").InnerText = Titulaire_Code__Agrement_3_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Condition_Exercice").InnerText = Titulaire_Condition_Exercice_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Num_RPPS").InnerText = Titulaire_Num_RPPS_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Cle_Num_RPPS").InnerText = Titulaire_Cle_Num_RPPS_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_raison_sociale").InnerText = Titulaire_raison_sociale_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Titulaire_Num_log_situ_fact").InnerText = Titulaire_Num_log_situ_fact_TextBox.Text

                If CheckBox_Activer_Session_Remplacant.Checked = True Then
                    ConfigXMLelementliste.Item(0).Item("Activer_Session_Remplacement").InnerText = "OUI"
                Else
                    ConfigXMLelementliste.Item(0).Item("Activer_Session_Remplacement").InnerText = "NON"
                End If

                ConfigXMLelementliste.Item(0).Item("Remplacant_Num_Id_Nat").InnerText = Remplacant_Num_Id_Nat_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Remplacant_Cle_Num_Id_Nat").InnerText = Remplacant_Cle_Num_Id_Nat_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Remplacant_Num_Id_Facturation").InnerText = Remplacant_Num_Id_Facturation_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Remplacant_Cle_Num_Id_Facturation").InnerText = Remplacant_Cle_Num_Id_Facturation_TextBox.Text
                ConfigXMLelementliste.Item(0).Item("Remplacant_Num_log_situ_fact").InnerText = Remplacant_Num_log_situ_fact_TextBox.Text

                'save
                ConfigXml.Save("config.xml")

                Config.Load_Config_File()

                Me.Dispose()

            Case MsgBoxResult.No
                Me.Dispose()

            Case MsgBoxResult.Cancel

        End Select
    End Sub

    Private Sub Titulaire_Vitale_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Titulaire_Vitale.Click

        SGD_LibererSession(NumeroSessionCPS)
        If SGD_ReserverSession(0, NumeroSessionCPS) <> 0 Then
            MyMsg_Box.Presentation("Officine", "ERREUR POUR LA RESERVATION DE SESSION CPS", False, "", False, "", True, "OK")
            MyMsg_Box.ShowDialog()
            Me.Close()
        End If
        AfficheErreur(SIS_LireCartePS(NomRessourcePS, NomRessourceLecteur, "", NumeroSessionCPS))
        '''''''''''''''''''''''''''''''''''''''''''''
        Occurence_Grp2 = 1
        While SGD_LireGroupeSuivant(NumeroSessionCPS, 2, Occurence_Grp2, 2, 1) = 0
            Occurence_Grp2 = Occurence_Grp2 + 1
        End While
        If Occurence_Grp2 > 1 Then
            ValeurChamp = "@@"
            TailleMax = 2
            While ValeurChamp <> "50" And Occurence_Grp2 <> 0
                Occurence_Grp2 = InputBox("Choix situation PS 1 à " + Occurence_Grp2.ToString, "", "1")
                SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 14, ValeurChamp, TailleMax)
                If ValeurChamp <> "50" Then
                    MyMsg_Box.Presentation("Officine", "Situation Pharmacien Obligatoire", False, "", False, "", True, "OK")
                    MyMsg_Box.ShowDialog()
                End If
            End While

        End If
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        ValeurChamp = "123456789012345678901234567890"
        TailleMax = 30
        SGD_LireChamp(NumeroSessionCPS, 1, 1, 3, ValeurChamp, TailleMax)
        Titulaire_Num_Id_Nat_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "1"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 1, 1, 4, ValeurChamp, TailleMax)
        Titulaire_Cle_Num_Id_Nat_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "12345678"
        TailleMax = 8
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 9, ValeurChamp, TailleMax)
        Titulaire_Num_Id_fact_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "1"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 10, ValeurChamp, TailleMax)
        Titulaire_Cle_Num_Id_fact_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "123456789012345678901234567"
        TailleMax = 27
        SGD_LireChamp(NumeroSessionCPS, 1, 1, 6, ValeurChamp, TailleMax)
        Titulaire_Nom_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "123456789012345678901234567"
        TailleMax = 27
        SGD_LireChamp(NumeroSessionCPS, 1, 1, 7, ValeurChamp, TailleMax)
        Titulaire_Prenom_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "1"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 13, ValeurChamp, TailleMax)
        Titulaire_Code_Conventionnel_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "12"
        TailleMax = 2
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 14, ValeurChamp, TailleMax)
        Titulaire_Code_specialite_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "12"
        TailleMax = 2
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 15, ValeurChamp, TailleMax)
        Titulaire_Code_Zone_tarifaire_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "12"
        TailleMax = 2
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 16, ValeurChamp, TailleMax)
        Titulaire_Code_Zone_IK_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "1"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 17, ValeurChamp, TailleMax)
        Titulaire_Code__Agrement_1_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "1"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 18, ValeurChamp, TailleMax)
        Titulaire_Code__Agrement_2_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "1"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 19, ValeurChamp, TailleMax)
        Titulaire_Code__Agrement_3_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        Dim ModeExercice As String = "@@"
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 2, ModeExercice, TailleMax)
        ModeExercice = Mid(ModeExercice, 1, TailleMax)
        Select Case ModeExercice
            Case "00", "0" 'Libéral, exploitant, commerçant
                Titulaire_Condition_Exercice_TextBox.Text = "L"
            Case "01", "1" 'Salarié
                Titulaire_Condition_Exercice_TextBox.Text = "S"
            Case "04", "4" 'Remplaçant
                Titulaire_Condition_Exercice_TextBox.Text = "L"
            Case "07", "7" 'Bénévole, Visu_API, FichierTrace)
        End Select

        ValeurChamp = "@@"
        SGD_LireChamp(NumeroSessionCPS, 1, 1, 1, ValeurChamp, 2)
        If ValeurChamp = "0" Or ValeurChamp = "00" Then 'Carte du Professionnel de Santé (CPS)
            ValeurChamp = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
            TailleMax = 30
            SGD_LireChamp(NumeroSessionCPS, 1, 1, 3, ValeurChamp, TailleMax)
            If TailleMax > 10 Then
                ValeurChamp = Mid(ValeurChamp, 1, 10)
            Else
                ValeurChamp = Mid(ValeurChamp, 1, TailleMax)
                While ValeurChamp.Length < 10
                    ValeurChamp = "0" & ValeurChamp
                End While
            End If
            If InStr(ValeurChamp, "@") = 0 Then
                Titulaire_Num_RPPS_TextBox.Text = ValeurChamp
            Else
                Titulaire_Num_RPPS_TextBox.Text = ""
            End If
            ValeurChamp = "@"
            TailleMax = 1
            SGD_LireChamp(NumeroSessionCPS, 1, 1, 4, ValeurChamp, TailleMax)
            If ValeurChamp <> "@" Then
                Titulaire_Cle_Num_RPPS_TextBox.Text = ValeurChamp
            Else
                Titulaire_Cle_Num_RPPS_TextBox.Text = ""
            End If
        Else 'CPF ou CPE
            Titulaire_Num_RPPS_TextBox.Text = ""
            Titulaire_Cle_Num_RPPS_TextBox.Text = ""
        End If

        ValeurChamp = "1234567890123456789012345678901234567890"
        TailleMax = 40
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 8, ValeurChamp, TailleMax)
        Titulaire_raison_sociale_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)


        ValeurChamp = "@"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 1, ValeurChamp, TailleMax)
        Dim array() As Byte = System.Text.Encoding.ASCII.GetBytes(ValeurChamp)
        Titulaire_Num_log_situ_fact_TextBox.Text = array(0)

        SGD_LibererSession(NumeroSessionCPS)

    End Sub

    Private Sub Remplacant_vitale_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Remplacant_vitale.Click

        SGD_LibererSession(NumeroSessionCPS)
        If SGD_ReserverSession(0, NumeroSessionCPS) <> 0 Then
            MyMsg_Box.Presentation("Officine", "ERREUR POUR LA RESERVATION DE SESSION CPS", False, "", False, "", True, "OK")
            MyMsg_Box.ShowDialog()
            Me.Close()
        End If
        AfficheErreur(SIS_LireCartePS(NomRessourcePS, NomRessourceLecteur, "", NumeroSessionCPS))
        '''''''''''''''''''''''''''''''''''''''''''''
        Occurence_Grp2 = 1
        While SGD_LireGroupeSuivant(NumeroSessionCPS, 2, Occurence_Grp2, 2, 1) = 0
            Occurence_Grp2 = Occurence_Grp2 + 1
        End While
        If Occurence_Grp2 > 1 Then
            ValeurChamp = "@@"
            TailleMax = 2
            While ValeurChamp <> "50" And Occurence_Grp2 <> 0
                Occurence_Grp2 = InputBox("Choix situation PS 1 à " + Occurence_Grp2.ToString, "", "1")
                SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 14, ValeurChamp, TailleMax)
                If ValeurChamp <> "50" Then
                    MyMsg_Box.Presentation("Officine", "Situation Pharmacien Obligatoire", False, "", False, "", True, "OK")
                    MyMsg_Box.ShowDialog()
                End If
            End While

        End If
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

        ValeurChamp = "123456789012345678901234567890"
        TailleMax = 30
        SGD_LireChamp(NumeroSessionCPS, 1, 1, 3, ValeurChamp, TailleMax)
        Remplacant_Num_Id_Nat_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "1"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 1, 1, 4, ValeurChamp, TailleMax)
        Remplacant_Cle_Num_Id_Nat_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "12345678"
        TailleMax = 8
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 9, ValeurChamp, TailleMax)
        Remplacant_Num_Id_Facturation_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "1"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 10, ValeurChamp, TailleMax)
        Remplacant_Cle_Num_Id_Facturation_TextBox.Text = Mid(ValeurChamp, 1, TailleMax)

        ValeurChamp = "@"
        TailleMax = 1
        SGD_LireChamp(NumeroSessionCPS, 2, Occurence_Grp2, 1, ValeurChamp, TailleMax)
        Dim array() As Byte = System.Text.Encoding.ASCII.GetBytes(ValeurChamp)
        Remplacant_Num_log_situ_fact_TextBox.Text = array(0)

        SGD_LibererSession(NumeroSessionCPS)
    End Sub

    Private Sub CheckBox_Activer_Session_Remplacant_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox_Activer_Session_Remplacant.CheckedChanged

        If CheckBox_Activer_Session_Remplacant.Checked = True And _
        (Titulaire_Cle_Num_Id_fact_TextBox.Text = "" Or Titulaire_Cle_Num_Id_fact_TextBox.Text = "" Or Titulaire_Nom_TextBox.Text = "" Or _
         Titulaire_Prenom_TextBox.Text = "" Or Titulaire_Code_Conventionnel_TextBox.Text = "" Or Titulaire_Code_specialite_TextBox.Text = "" Or _
         Titulaire_Code_Zone_tarifaire_TextBox.Text = "" Or Titulaire_Code_Zone_IK_TextBox.Text = "" Or Remplacant_Num_Id_Nat_TextBox.Text = "" Or _
         Remplacant_Cle_Num_Id_Nat_TextBox.Text = "") Then
            MyMsg_Box.Presentation("Officine", "Données incomplètes pour l'activation de la session du remplaçant.", False, "", False, "", True, "OK")
            MyMsg_Box.ShowDialog()
            CheckBox_Activer_Session_Remplacant.Checked = False
        End If

        'If CheckBox_Activer_Session_Remplacant.Checked = True Then

        '    Titulaire_Num_Id_Nat_TextBox.Enabled = False
        '    Titulaire_Cle_Num_Id_Nat_TextBox.Enabled = False
        '    Titulaire_Num_Id_fact_TextBox.Enabled = False
        '    Titulaire_Cle_Num_Id_fact_TextBox.Enabled = False
        '    Titulaire_Nom_TextBox.Enabled = False
        '    Titulaire_Prenom_TextBox.Enabled = False
        '    Titulaire_Code_Conventionnel_TextBox.Enabled = False
        '    Titulaire_Code_specialite_TextBox.Enabled = False
        '    Titulaire_Code_Zone_tarifaire_TextBox.Enabled = False
        '    Titulaire_Code_Zone_IK_TextBox.Enabled = False
        '    Titulaire_Code__Agrement_1_TextBox.Enabled = False
        '    Titulaire_Code__Agrement_2_TextBox.Enabled = False
        '    Titulaire_Code__Agrement_3_TextBox.Enabled = False
        '    Titulaire_Condition_Exercice_TextBox.Enabled = False
        '    Titulaire_Num_RPPS_TextBox.Enabled = False
        '    Titulaire_Cle_Num_RPPS_TextBox.Enabled = False
        '    Titulaire_raison_sociale_TextBox.Enabled = False
        '    Titulaire_Num_log_situ_fact_TextBox.Enabled = False
        '    Remplacant_Num_Id_Nat_TextBox.Enabled = False
        '    Remplacant_Cle_Num_Id_Nat_TextBox.Enabled = False
        '    Remplacant_Num_Id_Facturation_TextBox.Enabled = False
        '    Remplacant_Cle_Num_Id_Facturation_TextBox.Enabled = False

        'Else
        '    Titulaire_Num_Id_Nat_TextBox.Enabled = True
        '    Titulaire_Cle_Num_Id_Nat_TextBox.Enabled = True
        '    Titulaire_Num_Id_fact_TextBox.Enabled = True
        '    Titulaire_Cle_Num_Id_fact_TextBox.Enabled = True
        '    Titulaire_Nom_TextBox.Enabled = True
        '    Titulaire_Prenom_TextBox.Enabled = True
        '    Titulaire_Code_Conventionnel_TextBox.Enabled = True
        '    Titulaire_Code_specialite_TextBox.Enabled = True
        '    Titulaire_Code_Zone_tarifaire_TextBox.Enabled = True
        '    Titulaire_Code_Zone_IK_TextBox.Enabled = True
        '    Titulaire_Code__Agrement_1_TextBox.Enabled = True
        '    Titulaire_Code__Agrement_2_TextBox.Enabled = True
        '    Titulaire_Code__Agrement_3_TextBox.Enabled = True
        '    Titulaire_Condition_Exercice_TextBox.Enabled = True
        '    Titulaire_Num_RPPS_TextBox.Enabled = True
        '    Titulaire_Cle_Num_RPPS_TextBox.Enabled = True
        '    Titulaire_raison_sociale_TextBox.Enabled = True
        '    Titulaire_Num_log_situ_fact_TextBox.Enabled = True
        '    Remplacant_Num_Id_Nat_TextBox.Enabled = True
        '    Remplacant_Cle_Num_Id_Nat_TextBox.Enabled = True
        '    Remplacant_Num_Id_Facturation_TextBox.Enabled = True
        '    Remplacant_Cle_Num_Id_Facturation_TextBox.Enabled = True

        'End If
    End Sub


    Private Sub Annuler_PictureBox_Click(sender As Object, e As EventArgs) Handles Annuler_PictureBox.Click
        Me.Dispose()

    End Sub

    Private Sub Clear_titulaire_PictureBox_Click(sender As Object, e As EventArgs) Handles Clear_PictureBox.Click
        For Each obj In GroupBox1.Controls
            If obj.GetType Is GetType(TextBox) Then
                obj.Text = ""
            End If
        Next
    End Sub

    Private Sub Clear_PictureBox2_Click(sender As Object, e As EventArgs) Handles Clear_PictureBox2.Click
        For Each obj In GroupBox2.Controls
            If obj.GetType Is GetType(TextBox) Then
                obj.Text = ""
            End If
        Next
    End Sub
End Class