Rabu, 04 Januari 2012

Public Class LATIHAN 037_46109056

    Dim ASYH As New DataTable
    Dim ODC As New OleDb.OleDbCommand
    Dim ERRY As New ByIskandar.CariKeDataBaseByIskandar
    Dim DAT As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Datamajemuk.ERRY")
    Private Sub LATIHAN037_46109056_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim DIA As New OleDb.OleDbDataAdapter
        DIA = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & NOTRANS_056.Text & "'", DAT)
        ASYH.Rows.Clear()
        DIA.Fill(ASYH)
        DIA.Dispose()

        Dim dc(1) As DataColumn
        dc(0) = ASYH.Columns("kodebarang")
        ASYH.PrimaryKey = dc

        DGV_056.DataSource = ASYH
    End Sub

    Private Sub ERr()
        Dim ERr1 As Integer = 0
        For Each ERr2 As DataRow In ASYH.Rows
            ERr1 += ERr2("JUMLAH")
        Next
        NOTOT_056.Text = ERr1
    End Sub

    Private Sub NOUN_056_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NOUN_056.TextChanged
        NOJUM_056.Text = Val(NOUN_056.Text) * Val(NOHR_056.Text)
    End Sub

    Private Sub NOKB_056_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles NOKB_056.Leave
        If NOKB_056.Text.Length = 0 Then
            Exit Sub
        End If
        ERRY.AturPencarianDataBase("barang", "kodebarang", NOKB_056.Text, 1, DAT)
        If ERRY.JumlanBaris > 0 Then
            NOKB_056.Text = ERRY.DataTablenya.Rows(0).Item("KODEBARANG")
            NONB_056.Text = ERRY.DataTablenya.Rows(0).Item("NAMABARANG")
        Else
            MsgBox("Kode barang itu tidak ada..")
            Exit Sub
        End If
    End Sub

    Private Sub NOKB_056_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NOKB_056.TextChanged
        NONB_056.Text = ""
        NOUN_056.Text = ""
        NOHR_056.Text = ""
    End Sub

    Private Sub TAMBAH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH.Click
        If NOKB_056.Text.Length = 0 Then
            MsgBox("Isi rong itu Kode Barang na..")
            Exit Sub
        End If

        If Val(NOUN_056.Text) = 0 Then
            MsgBox("Isi rong itu Unit na..")
            Exit Sub
        End If

        If Val(NOHR_056.Text) = 0 Then
            MsgBox("Isi rong itu Harga na..")
            Exit Sub
        End If

        Dim dr As DataRow
        dr = ASYH.Rows.Find(NOKB_056.Text)
        If dr Is Nothing Then
            dr = ASYH.NewRow
            dr("KODEBARANG") = NOKB_056.Text
            dr("NAMABARANG") = NONB_056.Text
            dr("UNIT") = Val(NOUN_056.Text)
            dr("HARGA") = Val(NOHR_056.Text)
            dr("JUMLAH") = Val(NOJUM_056.Text)

            ASYH.Rows.Add(dr)

            NOKB_056.Text = ""
            NOUN_056.Text = ""
            NOHR_056.Text = ""

        Else
            MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
        End If
        ERr()
    End Sub

    Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
        If NOTRANS_056.Text.Length = 0 Then
            MsgBox("Isi rong No Transaksi na..")
            Exit Sub
        End If

        If NOJT_056.Text.Length = 0 Then
            MsgBox("isi rong Jenis Transaksi na..")
            Exit Sub
        End If

        If ASYH.Rows.Count = 0 Then
            MsgBox("MNOTRANS_056f..Isi rong itu datatable na..")
            Exit Sub
        End If

        ERRY.AturPencarianDataBase("mastertransaksi", "notrans", NOTRANS_056.Text, 1, DAT)
        If ERRY.JumlanBaris > 0 Then
            MsgBox("Adami no trans seperti itu...")
            Exit Sub
        End If

        ODC = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanNOHR_056altransaksi, jenistransaksi) values ('" & NOTRANS_056.Text & "',#" & DTP_056.Value.Month & "/" & DTP_056.Value.Day & "/" & DTP_056.Value.Year & "#,'" & NOJT_056.Text & "')", DAT)
        DAT.Open()
        ODC.ExecuteNonQuery()
        DAT.Close()

        For Each x As DataRow In ASYH.Rows
            ODC = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NOTRANS_056.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", DAT)
            DAT.Open()
            ODC.ExecuteNonQuery()
            DAT.Close()
        Next
        ODC.Dispose()

        NOTRANS_056.Text = ""
        NOJT_056.Text = ""

        ASYH.Rows.Clear()
        ERr()
    End Sub
End Class



Public Class LATIHAN 038_46109056

    Dim ERRY As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database Password=ERRY")
    Dim ASYH As New DataTable
    Dim DATA As DataRow
    Private Sub LATIHAN038_46109056_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim ADAP As New OleDb.OleDbDataAdapter
        ADAP = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NOTRANS_056.Text & "'", ERRY)
        ADAP.Fill(ASYH)
        ADAP.Dispose()

        Dim dataPrimary(1) As DataColumn
        dataPrimary(0) = ASYH.Columns("KODEBARANG")
        ASYH.PrimaryKey = dataPrimary
        DGV1_056.DataSource = ASYH

    End Sub

    Private Sub TOTALJUMLAH()
        Dim TOT As Double = 0
        For Each Z As DataRow In ASYH.Rows
            TOT = TOT + Z("JUMLAH")
        Next
        NOTOT_056.Text = TOT

    End Sub

    Private Sub NOKB_056_LEAVE(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NOKB_056.Leave

        If NOKB_056.Text.Length = 0 Then
            Exit Sub
        End If

        Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
        Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", NOKB_056.Text, 1, ERRY)
        If Pencari.JumlanBaris > 0 Then
            NOKB_056.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
            NONB_056.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
        Else
            MsgBox("Kode barang tersebut tidak ada")
            If LATIHAN383940_46109056.ShowDialog = Windows.Forms.DialogResult.OK Then
                NOKB_056.Text = Latihan383940_46109056.DGV1_056.CurrentRow.Cells("KodeBarang").Value
                NONB_056.Text = Latihan383940_46109056.DGV1_056.CurrentRow.Cells("NamaBarang").Value
            Else
                NOKB_056.Text = ""
            End If
        End If
    End Sub

    Private Sub NOKB_056_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NOKB_056.TextChanged
        NONB_056.Text = ""
        NOUN_056.Text = ""
        NOHR_056.Text = ""
    End Sub

    Private Sub NOUN_056_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NOUN_056.TextChanged
        NOJM_056.Text = Val(NOUN_056.Text) * Val(NOHR_056.Text)
    End Sub
    Private Sub TAMBAH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH.Click

        If NOKB_056.Text.Length = 0 Then
            MsgBox("Kode barang sudah ada")
            Exit Sub
        End If

        If NONB_056.Text.Length = 0 Then
            MsgBox("Nama barang sudah ada")
        End If

        If Val(NOUN_056.Text) = 0 Then
            MsgBox("Masukkan unit barang")
            Exit Sub
        End If

        If Val(NOHR_056.Text) = 0 Then
            MsgBox("Masukkan harga barang barang")
            Exit Sub
        End If

        DATA = ASYH.Rows.Find(NOKB_056.Text)

        If DATA Is Nothing Then
            DATA = ASYH.NewRow
            DATA("KODEBARANG") = NOKB_056.Text
        Else
            MsgBox("Maaf kodebarang sudah ada")
            Exit Sub
        End If


        DATA = ASYH.NewRow
        DATA("KODEBARANG") = NOKB_056.Text
        DATA("NAMABARANG") = NONB_056.Text
        DATA("UNIT") = NOUN_056.Text
        DATA("HARGA") = NOHR_056.Text
        DATA("JUMLAH") = NOJM_056.Text

        ASYH.Rows.Add(DATA)

        NOKB_056.Text = ""
        NONB_056.Text = ""
        NOUN_056.Text = ""
        NOHR_056.Text = ""

        TOTALJUMLAH()
    End Sub

    Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click

        If NOTRANS_056.Text.Length = 0 Then
            MsgBox("No. transaksi sudah ada")
            Exit Sub
        End If

        If NOJT_056.Text.Length = 0 Then
            MsgBox("Jenis transaksi sudah ada")
            Exit Sub
        End If


        If ASYH.Rows.Count = 0 Then
            MsgBox("Jumlah baris tidak terisi")
            Exit Sub
        End If


        Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
        pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NOTRANS_056.Text, 1, ERRY)
        If pencari.JumlanBaris > 0 Then
            MsgBox("data tersebut sudah ada")
            Exit Sub
        End If


        Dim ODC As New OleDb.OleDbCommand
        ODC = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NOTRANS_056.Text & "', #" & NOTGL_056.Value.Month & "/" & NOTGL_056.Value.Day & "/" & NOTGL_056.Value.Year & "#, '" & NOJT_056.Text & "')", ERRY)
        ERRY.Open()
        ODC.ExecuteNonQuery()
        ERRY.Close()


        For Each Z As DataRow In ASYH.Rows
            ODC = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NOTRANS_056.Text & "','" & Z("KODEBARANG") & "'," & Z("UNIT") & ", " & Z("HARGA") & ")", ERRY)
            ERRY.Open()
            ODC.ExecuteNonQuery()
            ERRY.Close()
            ODC.Dispose()
        Next

        NOTRANS_056.Text = ""
        NOJT_056.Text = ""
        NOJM_056.Text = ""

        ASYH.Rows.Clear()

        TOTALJUMLAH()

    End Sub

End Class




Public Class LATIHAN 039_46109056

    Dim ERRY As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database Password=ERRY")

    Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
        If NOTRANS_056.Text.Length = 0 Then
            MsgBox("No. transaksi sudah ada nah!!! GANTIQI....")
            Exit Sub
        End If

        If NOJTR_056.Text.Length = 0 Then
            MsgBox("Jenis Transtaksi itu sudah ada nah !!! GANTIQI....")
            Exit Sub
        End If

        If DGV1_056.Rows.Count = 0 Then
            MsgBox("Jumlah baris tidak terisi")
            Exit Sub
        End If

        Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
        pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NOTRANS_056.Text, 1, ERRY)
        If pencari.JumlanBaris > 0 Then
            MsgBox("data itu sudah ada nah !!! GANTIQI....")
            Exit Sub
        End If

        Dim ODC As New OleDb.OleDbCommand
        ODC = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NOTRANS_056.Text & "', #" & NOTGL_056.Value.Month & "/" & NOTGL_056.Value.Day & "/" & NOTGL_056.Value.Year & "#, '" & NOJTR_056.Text & "')", ERRY)
        ERRY.Open()
        ODC.ExecuteNonQuery()
        ERRY.Close()

        For Each X As DataRow In DGV1_056.Rows
            ODC = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NOTRANS_056.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", ERRY)
            ERRY.Open()
            ODC.ExecuteNonQuery()
            ERRY.Close()
            ODC.Dispose()
        Next

        NOTRANS_056.Text = ""
        NOJTR_056.Text = ""

        DGV1_056.Rows.Clear()

    End Sub
End Class



Public Class LATIHAN 040A_46109056

    Dim ERRY As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=ERRY")
    Dim ASYH As New DataTable
    Dim ASYH1 As New DataTable
    Dim DATA As New DataSet
    Dim ODC1 As New BindingSource
    Dim ODC2 As New BindingSource
    Public Sub ERRYaa()

        ASYH1.Rows.Clear()
        ASYH.Rows.Clear()

        Dim dt1 As New OleDb.OleDbDataAdapter
        dt1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", ERRY)
        dt1.Fill(ASYH)

        dt1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", ERRY)
        dt1.Fill(ASYH1)

        dt1.Dispose()
    End Sub
    Private Sub LATIHAN040A_46109056_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ERRYaa()


        DATA.Tables.Add(ASYH)
        DATA.Tables.Add(ASYH1)


        ASYH.TableName = "T01"
        ASYH1.TableName = "T02"


        DATA.Relations.Add(New DataRelation("X", DATA.Tables("T01").Columns("NOTRANS"), DATA.Tables("T02").Columns("NOTRANS")))


        ODC1.DataSource = DATA
        ODC1.DataMember = "T01"
        ODC2.DataSource = ODC1
        ODC2.DataMember = "X"


        DGV1_056.DataSource = ODC1
        DGV2_056.DataSource = ODC2

    End Sub
    Private Sub EDIT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT.Click

        If LATIHAN_040B_46109056.Visible = False Then
            LATIHAN_040B_46109056.Show()
        Else
            LATIHAN_040B_46109056.Activate()
        End If

        LATIHAN_040B_46109056.StatusStrip1.Text = DGV1_056.CurrentRow.Cells("NOTRANS").Value
        LATIHAN_040B_46109056.NOTRANS_056.Text = DGV1_056.CurrentRow.Cells("NOTRANS").Value
        LATIHAN_040B_46109056.NOJT_056.Text = DGV1_056.CurrentRow.Cells("JENISTRANSAKSI").Value

        LATIHAN_040B_46109056.MANIS()
        LATIHAN_040B_46109056.TOTALJUMLAH()
    End Sub

    Private Sub TAMBAH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH.Click
        If LATIHAN_040B_46109056.Visible = False Then
            LATIHAN_040B_46109056.Show()
        Else
            LATIHAN_040B_46109056.Activate()
        End If

        LATIHAN_040B_46109056.StatusStrip1.Text = "-"
        LATIHAN_040B_46109056.NOTRANS_056.Text = ""
        LATIHAN_040B_46109056.NOJT_056.Text = ""

        LATIHAN_040B_46109056.MANIS()
        LATIHAN_040B_46109056.TOTALJUMLAH()

    End Sub

    Private Sub HAPUS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HAPUS.Click
        Dim T As New OleDb.OleDbCommand
        T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DGV1_056.CurrentRow.Cells("NOTRANS").Value & "'", ERRY)
        ERRY.Open()
        T.ExecuteNonQuery()
        ERRY.Close()

        T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DGV1_056.CurrentRow.Cells("NOTRANS").Value & "'", ERRY)
        ERRY.Open()
        T.ExecuteNonQuery()
        ERRY.Close()

        T.Dispose()

        ERRYaa()
    End Sub

End Class



Public Class LATIHAN_040B_46109056

    Dim ERRY As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=ERRY")
    Dim DATA As New DataTable

    Public Sub MANIS()
        Dim X As New OleDb.OleDbDataAdapter
        X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NOTRANS_056.Text & "'", ERRY)
        DATA.Rows.Clear()
        X.Fill(DATA)
    End Sub

    Private Sub LATIHAN_040B_46109056_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim dataPrimary(1) As DataColumn
        dataPrimary(0) = DATA.Columns("NOTRANS")
        DATA.PrimaryKey = dataPrimary

        DGV_056.DataSource = DATA

        TOTALJUMLAH()
    End Sub
    Public Sub TOTALJUMLAH()
        Dim TOT As Double = 0
        For Each x As DataRow In DATA.Rows
            TOT = TOT + x("JUMLAH")
        Next
        NOTOT_056.Text = TOT
    End Sub
    Private Sub DGV_056_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV_056.CellContentClick

        If DGV_056.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
            DGV_056.CurrentRow.Cells("NAMABARANG").Value = ""
            DGV_056.CurrentRow.Cells("UNIT").Value = 0
            DGV_056.CurrentRow.Cells("HARGA").Value = 0
            DGV_056.CurrentRow.Cells("JUMLAH").Value = 0

            Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
            Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DGV_056.CurrentRow.Cells("KODEBARANG").Value, 1, ERRY)

            If Pencari.JumlanBaris > 0 Then
                DGV_056.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
            Else
                DGV_056.CurrentRow.Cells("KODEBARANG").Value = ""
                If Latihan383940_46109056.ShowDialog = Windows.Forms.DialogResult.OK Then
                    DGV_056.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109056.DGV1_056.CurrentRow.Cells("KODEBARANG").Value
                    DGV_056.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109056.DGV1_056.CurrentRow.Cells("NAMABARANG").Value
                End If
            End If

        ElseIf DGV_056.Columns(e.ColumnIndex).Name = "UNIT" Or DGV_056.Columns(e.ColumnIndex).Name = "HARGA" Then

            DGV_056.CurrentRow.Cells("JUMLAH").Value = DGV_056.CurrentRow.Cells("UNIT").Value * DGV_056.CurrentRow.Cells("HARGA").Value
        End If

        TOTALJUMLAH()
    End Sub

    Private Sub Button1_Button2()
        If NOTRANS_056.Text.Length = 0 Then
            MsgBox("Maaf, Nomor transaksi harus diisi dulu")
            Exit Sub
        End If

        If NOJT_056.Text.Length = 0 Then
            MsgBox("Maaf, Jenis transaksi harus diisi dulu")
            Exit Sub
        End If

        If Data.Rows.Count() = 0 Then
            MsgBox("Maaf, Proses tidak dapat dilanjutkan")
            Exit Sub
        End If

        If StatusStrip1.Text <> NOTRANS_056.Text Then
            Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
            pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NOTRANS_056.Text, 1, ERRY)
            If pencari.JumlanBaris > 0 Then
                MsgBox("Nomor transaksi sudah ada")
                Exit Sub
            End If
        End If

        Dim T As New OleDb.OleDbCommand
        T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NOTRANS_056.Text & "', #" & NOTGL_056.Value.Month & "/" & NOTGL_056.Value.Day & "/" & NOTGL_056.Value.Year & "#, '" & NOJT_056.Text & "')", ERRY)

        ERRY.Open()

        T.ExecuteNonQuery()

        ERRY.Close()


        For Each X As DataRow In DATA.Rows

            T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NOTRANS_056.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", ERRY)
            ERRY.Open()
            T.ExecuteNonQuery()
            ERRY.Close()
            T.Dispose()
        Next

        StatusStrip1.Text = "-"
        NOTRANS_056.Text = ""
        NOJT_056.Text = ""

        DATA.Rows.Clear()

        TOTALJUMLAH()

        LATIHAN040A_46109056.ERRYaa()

    End Sub

    Private Sub EDIT_46109056()
        If NOTRANS_056.Text.Length = 0 Then
            MsgBox("Maaf, Nomor transaksi harus diisi dulu nah !!!")
            Exit Sub
        End If

        If NOJT_056.Text.Length = 0 Then
            MsgBox("Maaf, Jenis transaksi harus diisi dulu nah !!!")
            Exit Sub
        End If

        If DATA.Rows.Count() = 0 Then
            MsgBox("Maaf, Proses tidak dapat dilanjutkan gang....")
            Exit Sub
        End If

        If StatusStrip1.Text <> NOTRANS_056.Text Then
            Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
            pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NOTRANS_056.Text, 1, ERRY)
            If pencari.JumlanBaris > 0 Then
                MsgBox("Nomor transaksi sudah ada")
                Exit Sub
            End If
        End If

        Dim T As New OleDb.OleDbCommand
        T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & NOTRANS_056.Text & "'", ERRY)
        ERRY.Open()
        T.ExecuteNonQuery()
        ERRY.Close()

        T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NOTRANS_056.Text & "', #" & NOTGL_056.Value.Month & "/" & NOTGL_056.Value.Day & "/" & NOTGL_056.Value.Year & "#, '" & NOJT_056.Text & "')", ERRY)
        ERRY.Open()
        T.ExecuteNonQuery()
        ERRY.Close()

        T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS= '" & NOTRANS_056.Text & "'", ERRY)
        ERRY.Open()
        T.ExecuteNonQuery()
        ERRY.Close()


        For Each XX As DataRow In DATA.Rows

            T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NOTRANS_056.Text & "', '" & XX("KODEBARANG") & "', " & XX("UNIT") & ", " & XX("HARGA") & ")", ERRY)
            ERRY.Open()
            T.ExecuteNonQuery()
            ERRY.Close()
            T.Dispose()
        Next

        StatusStrip1.Text = "-"
        NOTRANS_056.Text = ""
        NOJT_056.Text = ""

        DATA.Rows.Clear()

        TOTALJUMLAH()
        LATIHAN040A_46109056.ERRYaa()
    End Sub

    Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
        If StatusStrip1.Text = "-" Then
            Button1_Button2()
        Else
            EDIT_46109056()
        End If
    End Sub

End Class