' 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/>.
Public Class Contraceptif_Urg_saisie_date_naissance


    Private Sub Contraceptif_Urg_saisie_date_naissance_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim i_string As String
        For i = 1 To 31
            i_string = i.ToString
            If i_string.Length < 2 Then
                i_string = "0" + i_string
            End If
            ComboBoxjour.Items.Add(i_string)
        Next
        For i = 1 To 12
            i_string = i.ToString
            If i_string.Length < 2 Then
                i_string = "0" + i_string
            End If
            ComboBoxmois.Items.Add(i_string)
        Next
        Dim année_courante As Integer = Now.Year
        For i = année_courante - 19 To année_courante
            ComboBoxannée.Items.Add(i)
        Next
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        If ComboBoxjour.Text = "" Or ComboBoxmois.Text = "" Or ComboBoxannée.Text = "" Then
            MyMsg_Box.Presentation("Officine !", "Selectionnez Date de Naissance", False, "", False, "", True, "OK")
            MyMsg_Box.ShowDialog()

            Exit Sub
        End If
        MyMsg_Box.Presentation("Officine ?", "Confirmer le " + ComboBoxjour.Text + "/" + ComboBoxmois.Text + "/" + ComboBoxannée.Text, True, "OUI", True, "NON", False, "")
        If MyMsg_Box.ShowDialog = Windows.Forms.DialogResult.Yes Then
            CurrentBenéficiaire.G104C12 = ComboBoxannée.Text.ToString + ComboBoxmois.Text.ToString + ComboBoxjour.Text.ToString + "0000"
            COMPTOIR_MAIN.Enabled = True
            Me.Close()
        Else
            MyMsg_Box.Presentation("Officine !", "Date par defaut selectionnée", False, "", False, "", True, "OK")
            MyMsg_Box.ShowDialog()
            COMPTOIR_MAIN.Enabled = True
            Me.Close()
        End If
  


    End Sub



    Private Sub PictureBox1_MouseHover(sender As Object, e As EventArgs) Handles PictureBox1.MouseHover
        PictureBox1.BackgroundImage = officine.My.Resources.validate2
    End Sub

    Private Sub PictureBox1_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox1.MouseLeave
        PictureBox1.BackgroundImage = officine.My.Resources.validate
    End Sub
End Class