' 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 Détail_Recap_Paiement
    Public datepaiement As String
    Public libellé1 As String
    Public libellé2 As String
    Public org_payeur As String
    Public org_emetteur As String

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


        Label1.Text = datepaiement + "  " + libellé1 + "  " + libellé2 + "  " + org_emetteur + "  " + org_payeur
        Dim Paiements_datatable As DataTable = Me.RsP_PaiementsTableAdapter1.GetData_détail_recap_paiements(Mid(datepaiement, 1, 2) + Mid(datepaiement, 4, 2) + Mid(datepaiement, 7, 2), libellé1, libellé2, org_payeur)

        For r = 0 To Paiements_datatable.Rows.Count - 1
            DataGridView1.Rows.Add()

            For c = 0 To Paiements_datatable.Columns.Count - 1
                If Paiements_datatable.Columns.Item(c).ColumnName = "NumFacture" Then
                    DataGridView1.Item(NumFacture.Index, r).Value = Paiements_datatable(r).Item(c)
                ElseIf Paiements_datatable.Columns.Item(c).ColumnName = "NumLot" Then
                    DataGridView1.Item(NumLot.Index, r).Value = Paiements_datatable(r).Item(c)
                ElseIf Paiements_datatable.Columns.Item(c).ColumnName = "Part" Then
                    DataGridView1.Item(Part.Index, r).Value = Paiements_datatable(r).Item(c)
                ElseIf Paiements_datatable.Columns.Item(c).ColumnName = "Montant_Payé" Then
                    DataGridView1.Item(Montant_Payé.Index, r).Value = Paiements_datatable(r).Item(c)
                End If
            Next

        Next

    End Sub
End Class