' 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 Reprise_Facture_Encaissement


    Public Dif_G1910C3 As Decimal
    Public Dif_G1910C6 As Decimal


    Private Sub Reprise_Facture_Encaissement_Shown(sender As Object, e As EventArgs) Handles Me.Shown
        Dif_RadioButton1.Text = ((Dif_G1910C3 + Dif_G1910C6) / 100).ToString
        Dif_RadioButton1.Checked = True
        AMO_RadioButton2.Text = (Dif_G1910C3 / 100).ToString
        AMC_RadioButton3.Text = (Dif_G1910C6 / 100).ToString
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If Dif_RadioButton1.Checked = True Then
            VenteForm.Reprise_dif_à_encaisser = (Dif_G1910C3 + Dif_G1910C6) / 100
        ElseIf AMO_RadioButton2.Checked = True Then
            VenteForm.Reprise_dif_à_encaisser = Dif_G1910C3 / 100
        ElseIf AMC_RadioButton3.Checked = True Then
            VenteForm.Reprise_dif_à_encaisser = Dif_G1910C6 / 100
        Else
            Try
                CDec(Autre_Montant_TextBox1.Text).ToString()
            Catch ex As Exception
                MyMsg_Box.Presentation("Officine", "montant incohérent", False, "", False, "", True, "OK")
                MyMsg_Box.ShowDialog()
                Exit Sub
            End Try
            VenteForm.Reprise_dif_à_encaisser = CDec(Autre_Montant_TextBox1.Text)
        End If
        Me.Close()
    End Sub

    
    Private Sub Autre_Montant_TextBox1_TextChanged(sender As Object, e As EventArgs) Handles Autre_Montant_TextBox1.TextChanged
        Autre_Montant_TextBox1.Text = Replace(Autre_Montant_TextBox1.Text, ".", ",")
    End Sub
End Class