Public Class Form3
    Dim db_informatique2 As New class2
    Dim rassmal As Double
    Dim x As Integer




    Private Sub TabPage5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Form4.Show()
        Me.Hide()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Form1.Show()
        Me.Hide()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Form2.Show()
        Me.Hide()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Form5.Show()
        Me.Hide()
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        If RadioButton2.Checked = True Then
            t1.Visible = True
            Label1.Visible = True
            TextBox1.Visible = True
            t1.Focus()

        Else
            TextBox1.Text = 0
            t1.Visible = False
            Label1.Visible = False
            TextBox1.Visible = False
        End If
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

        If RadioButton1.Checked = True Then
            TextBox1.Text = 0
            db_informatique2.Myreq = "select*from factureachat"
            db_informatique2.Connecting_in_informatique()
            ListView2.Items.Clear()
            rassmal = 0
            Do While db_informatique2.rdr.Read
                ListView2.Items.Add(New ListViewItem({(db_informatique2.rdr(0).ToString), (db_informatique2.rdr(1).ToString), (db_informatique2.rdr(4).ToString), (db_informatique2.rdr(6).ToString), (db_informatique2.rdr(7).ToString), (db_informatique2.rdr(8).ToString), (db_informatique2.rdr(9).ToString), (db_informatique2.rdr(10).ToString)}))
                rassmal = rassmal + (db_informatique2.rdr(12).ToString)

            Loop
            db_informatique2.Connecting_in_informatique()
            t6.Text = rassmal
        Else
            x = 0
            db_informatique2.Myreq = "select*from factureachat where codep='" & t1.Text & "'"
            db_informatique2.Connecting_in_informatique()
            ListView2.Items.Clear()
            rassmal = 0
            Do While db_informatique2.rdr.Read
                ListView2.Items.Add(New ListViewItem({(db_informatique2.rdr(0).ToString), (db_informatique2.rdr(1).ToString), (db_informatique2.rdr(4).ToString), (db_informatique2.rdr(6).ToString), (db_informatique2.rdr(7).ToString), (db_informatique2.rdr(8).ToString), (db_informatique2.rdr(9).ToString), (db_informatique2.rdr(10).ToString)}))
                rassmal = rassmal + (db_informatique2.rdr(12).ToString)
                x = (db_informatique2.rdr(4).ToString)
            Loop
            db_informatique2.Connecting_in_informatique()
            t6.Text = rassmal
            TextBox1.Text = x
            t1.Text = ""
        End If
    End Sub

    Private Sub t1_PreviewKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles t1.PreviewKeyDown
        If e.KeyValue = Keys.Enter Then
            x = 0
            db_informatique2.Myreq = "select*from factureachat where codep='" & t1.Text & "'"
            db_informatique2.Connecting_in_informatique()
            ListView2.Items.Clear()
            rassmal = 0
            Do While db_informatique2.rdr.Read
                ListView2.Items.Add(New ListViewItem({(db_informatique2.rdr(0).ToString), (db_informatique2.rdr(1).ToString), (db_informatique2.rdr(4).ToString), (db_informatique2.rdr(6).ToString), (db_informatique2.rdr(7).ToString), (db_informatique2.rdr(8).ToString), (db_informatique2.rdr(9).ToString), (db_informatique2.rdr(10).ToString)}))
                rassmal = rassmal + (db_informatique2.rdr(12).ToString)
                x = (db_informatique2.rdr(4).ToString)
            Loop
            db_informatique2.Connecting_in_informatique()
            t6.Text = rassmal
            t1.Text = ""
            TextBox1.Text = x
        End If

    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

    End Sub

    Private Sub Form3_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
        Form1.Close()
    End Sub

    Private Sub TableLayoutPanel5_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles TableLayoutPanel5.Paint

    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click


        db_informatique2.Myreq = "select*from factureachat"
        db_informatique2.Connecting_in_informatique()
        ListView2.Items.Clear()

        Do While db_informatique2.rdr.Read
            If (db_informatique2.rdr(4).ToString) <= 0 Then
                ListView2.Items.Add(New ListViewItem({(db_informatique2.rdr(0).ToString), (db_informatique2.rdr(1).ToString), (db_informatique2.rdr(4).ToString), (db_informatique2.rdr(6).ToString), (db_informatique2.rdr(7).ToString), (db_informatique2.rdr(8).ToString), (db_informatique2.rdr(9).ToString), (db_informatique2.rdr(10).ToString)}))
            End If

        Loop
        db_informatique2.Disconnecting_in_informatique()
        If MessageBox.Show(" هل تريد طباعة تقرير النواقص  ", "طباعة", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = System.Windows.Forms.DialogResult.Yes Then

            Form11.Show()
        End If



    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        db_informatique2.Myreq = "select*from factureachat"
        db_informatique2.Connecting_in_informatique()
        ListView2.Items.Clear()

        Do While db_informatique2.rdr.Read
            If (db_informatique2.rdr(4).ToString) < 0 Then
                ListView2.Items.Add(New ListViewItem({(db_informatique2.rdr(0).ToString), (db_informatique2.rdr(1).ToString), (db_informatique2.rdr(4).ToString), (db_informatique2.rdr(6).ToString), (db_informatique2.rdr(7).ToString), (db_informatique2.rdr(8).ToString), (db_informatique2.rdr(9).ToString), (db_informatique2.rdr(10).ToString)}))

            End If
        Loop
        db_informatique2.Disconnecting_in_informatique()

    End Sub

End Class
