Rabu, 14 Desember 2011

Script Visual Basic Apkomp 4 PNUP - FORM33 A & FORM33 B -

Public Class Form33A_36109006
    Dim dt As New DataTable
    Dim rr As New OleDb.OleDbCommand
    Dim mhh006 As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Public Sub harun()
        Dim muhharun As New OleDb.OleDbDataAdapter
        muhharun = New OleDb.OleDbDataAdapter("select * from barang", mhh006)
        dt.Rows.Clear()
        muhharun.Fill(dt)
        muhharun.Dispose()
    End Sub

    Private Sub Latihan_33A_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        harun()
        dgv_36109006.DataSource = dt
    End Sub

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

        Form33B_36109006.kb1_36109006.Text = ""
        Form33B_36109006.nb_36109006.Text = ""
        Form33B_36109006.hj_36109006.Text = ""
        Form33B_36109006.jb_36109006.Text = ""
        Form33B_36109006.ee_36109006.Text = "-"
    End Sub

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

        Form33B_36109006.kb1_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value
        Form33B_36109006.nb_36109006.Text = dgv_36109006.CurrentRow.Cells("namabarang").Value
        Form33B_36109006.hj_36109006.Text = dgv_36109006.CurrentRow.Cells("hargajual").Value
        Form33B_36109006.jb_36109006.Text = dgv_36109006.CurrentRow.Cells("jumlahbarang").Value
        Form33B_36109006.ee_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value

        Form33B_36109006.Show()
    End Sub
    Private Sub hapus_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus_36109006.Click
        rr = New OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv_36109006.CurrentRow.Cells("kodebarang").Value & "'", mhh006)
        mhh006.Open()
        rr.ExecuteNonQuery()
        mhh006.Close()
        rr.Dispose()

        harun()

    End Sub


End Class


Public Class Form33B_36109006
    Dim harun As New ByIskandar.CariKeDataBaseByIskandar
    Dim rr As New OleDb.OleDbCommand
    Dim mhh As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub indonesia()
        If kb1_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If nb_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(hj_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(jb_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If
    End Sub

    Private Sub tambah()
        indonesia()
        harun.AturPencarianDataBase("Barang", "KodeBarang", kb1_36109006.Text, 1, mhh)
        If harun.JumlanBaris > 0 Then
            MsgBox("Kode barang sudah ada")
            Exit Sub
        End If

        rr = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb1_36109006.Text & "','" & nb_36109006.Text & "'," & Val(hj_36109006.Text) & "," & Val(jb_36109006.Text) & ")", mhh)
        mhh.Open()
        rr.ExecuteNonQuery()
        mhh.Close()
        rr.Dispose()

        kb1_36109006.Text = ""
        nb_36109006.Text = ""
        hj_36109006.Text = ""
        jb_36109006.Text = ""

        Form33A_36109006.harun()
    End Sub

    Private Sub edit()
        indonesia()
        If kb1_36109006.Text <> ee_36109006.Text Then
            harun.AturPencarianDataBase("Barang", "KodeBarang", kb1_36109006.Text, 1, mhh)
            If harun.JumlanBaris > 0 Then
                MsgBox("Kode barang sudah ada")
                Exit Sub
            End If
        End If

        rr = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb1_36109006.Text & "', namabarang = '" & nb_36109006.Text & "', hargajual = " & Val(hj_36109006.Text) & ", jumlahbarang = " & Val(jb_36109006.Text) & " where kodebarang = '" & ee_36109006.Text & "'", mhh)

        mhh.Open()
        rr.ExecuteNonQuery()
        mhh.Close()
        rr.Dispose()

        kb1_36109006.Text = ""
        nb_36109006.Text = ""
        hj_36109006.Text = ""
        jb_36109006.Text = ""
        ee_36109006.Text = "-"

        Form33A_36109006.harun()
    End Sub

    Private Sub save_36109006_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save_36109006.Click
        If ee_36109006.Text = "-" Then
            tambah()
        Else
            edit()
        End If
    End Sub

End Class

Script Visual Basic Apkomp 4 PNUP - FORM32 A , FORM32 B& FORM32 C -

Public Class Form32A_36109006
    Dim rr As New DataTable
    Dim harun As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Public Sub muhharun()
        Dim mhh As New OleDb.OleDbDataAdapter
        mhh = New OleDb.OleDbDataAdapter("select * from barang", harun)
        rr.Rows.Clear()
        mhh.Fill(rr)
        mhh.Dispose()
    End Sub

    Private Sub Form32A_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        muhharun()
        dgv_36109006.DataSource = rr
    End Sub

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

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

        Form32C_36109006.kb_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value
        Form32C_36109006.nb_36109006.Text = dgv_36109006.CurrentRow.Cells("namabarang").Value
        Form32C_36109006.hj_36109006.Text = dgv_36109006.CurrentRow.Cells("hargajual").Value
        Form32C_36109006.jb_36109006.Text = dgv_36109006.CurrentRow.Cells("jumlahbarang").Value
        Form32C_36109006.ee_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value

        Form32C_36109006.Show()
    End Sub
End Class


Public Class Form32B_36109006
    Dim harun As New ByIskandar.CariKeDataBaseByIskandar
    Dim cm As New OleDb.OleDbCommand
    Dim mhh As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub simpan_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109006.Click
        If txt1_36109006.Text.Length = 0 Then
            MsgBox("Isi rong itu yang  kosong")
            Exit Sub
        End If

        If txt2_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(txt_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(txt4_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        harun.AturPencarianDataBase("Barang", "KodeBarang", txt1_36109006.Text, 1, mhh)
        If harun.JumlanBaris > 0 Then
            MsgBox("Kode barang sudah ada")
            Exit Sub
        End If

        cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & txt1_36109006.Text & "','" & txt2_36109006.Text & "'," & Val(txt_36109006.Text) & "," & Val(txt4_36109006.Text) & ")", mhh)
        mhh.Open()
        cm.ExecuteNonQuery()
        mhh.Close()
        cm.Dispose()

        txt1_36109006.Text = ""
        txt2_36109006.Text = ""
        txt_36109006.Text = ""
        txt4_36109006.Text = ""


    End Sub

End Class



Public Class Form32C_36109006
    Dim harun As New ByIskandar.CariKeDataBaseByIskandar
    Dim rr As New OleDb.OleDbCommand
    Dim mhh As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.AHJ_36109006DB")

    Private Sub simpan_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109006.Click
        If kb_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If nb_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(hj_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(jb_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If kb_36109006.Text <> ee_36109006.Text Then
            harun.AturPencarianDataBase("Barang", "KodeBarang", kb_36109006.Text, 1, mhh)
            If harun.JumlanBaris > 0 Then
                MsgBox("Adami kode barang seperti itu")
                Exit Sub
            End If
        End If

        rr = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb_36109006.Text & "', namabarang = '" & nb_36109006.Text & "', hargajual = " & Val(hj_36109006.Text) & ", jumlahbarang = " & Val(jb_36109006.Text) & " where kodebarang = '" & ee_36109006.Text & "'", mhh)

        mhh.Open()
        rr.ExecuteNonQuery()
        mhh.Close()
        rr.Dispose()

        kb_36109006.Text = ""
        nb_36109006.Text = ""
        hj_36109006.Text = ""
        jb_36109006.Text = ""
        ee_36109006.Text = ""

        Form32A_36109006.harun()
    End Sub


End Class

Script Visual Basic Apkomp 4 PNUP - FORM31 A & FORM31 B -

Public Class Form31A_36109006
    Dim rr As New DataTable
    Dim harun36109006 As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Public Sub muhharun()
        Dim hrun As New OleDb.OleDbDataAdapter
        hrun = New OleDb.OleDbDataAdapter("select * from barang", harun36109006)
        rr.Rows.Clear()
        hrun.Fill(rr)
        hrun.Dispose()
    End Sub

    Private Sub Form_31A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        muhharun()
        dgv_36109006.DataSource = rr
    End Sub

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

        Form31B_36109006.kb_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value
        Form31B_36109006.nb_36109006.Text = dgv_36109006.CurrentRow.Cells("namabarang").Value
        Form31B_36109006.hj_36109006.Text = dgv_36109006.CurrentRow.Cells("hargajual").Value
        Form31B_36109006.jb_36109006.Text = dgv_36109006.CurrentRow.Cells("jumlahbarang").Value
        Form31B_36109006.kbl_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value

        Form31B_36109006.Show()
    End Sub
End Class




Public Class Form31B_36109006
    Dim muhharun36109006 As New ByIskandar.CariKeDataBaseByIskandar
    Dim cm As New OleDb.OleDbCommand
    Dim hrun36109006 As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub simpan_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109006.Click
        If kb_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If nb_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(hj_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(jb_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If kb_36109006.Text <> kbl_36109006.Text Then
            muhharun36109006.AturPencarianDataBase("Barang", "KodeBarang", kb_36109006.Text, 1, hrun36109006)
            If muhharun36109006.JumlanBaris > 0 Then
                MsgBox("kode barang sudah ada")
                Exit Sub
            End If
        End If

        cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb_36109006.Text & "', namabarang = '" & nb_36109006.Text & "', hargajual = " & Val(hj_36109006.Text) & ", jumlahbarang = " & Val(jb_36109006.Text) & " where kodebarang = '" & kbl_36109006.Text & "'", hrun36109006)

        hrun36109006.Open()
        cm.ExecuteNonQuery()
        hrun36109006.Close()
        cm.Dispose()

        kb_36109006.Text = ""
        nb_36109006.Text = ""
        hj_36109006.Text = ""
        jb_36109006.Text = ""
        kbl_36109006.Text = "-"

        Form31A_36109006.muhharun()
    End Sub

End Class

Script Visual Basic Apkomp 4 PNUP - FORM30 A & FORM30 B -

Public Class Form30A_36109006
    Dim rr As New DataTable
    Dim muhharun As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Public Sub harun36109006()
        Dim hrn36109006 As New OleDb.OleDbDataAdapter
        hrn36109006 = New OleDb.OleDbDataAdapter("select * from barang", muhharun)
        rr.Rows.Clear()
        hrn36109006.Fill(rr)
        hrn36109006.Dispose()
    End Sub

    Private Sub Form30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        harun36109006()
        DGV_36109006.DataSource = rr
    End Sub

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

        Form30B_36109006.kb1_001_36109006.Text = DGV_36109006.CurrentRow.Cells("kodebarang").Value
        Form30B_36109006.kb_001_36109006.Text = DGV_36109006.CurrentRow.Cells("kodebarang").Value
        Form30B_36109006.nb_001_36109006.Text = DGV_36109006.CurrentRow.Cells("namabarang").Value
        Form30B_36109006.hj_001_36109006.Text = DGV_36109006.CurrentRow.Cells("hargajual").Value
        Form30B_36109006.jb_001_36109006.Text = DGV_36109006.CurrentRow.Cells("jumlahbarang").Value

        Form30B_36109006.Show()
    End Sub
End Class









Public Class Form30B_36109006
    Dim harun36109006 As New ByIskandar.CariKeDataBaseByIskandar
    Dim cm As New OleDb.OleDbCommand
    Dim muhharun As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub simpan_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109006.Click
        If kb_001_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If nb_001_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(hj_001_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(jb_001_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If kb1_001_36109006.Text <> kb_001_36109006.Text Then
            harun36109006.AturPencarianDataBase("Barang", "KodeBarang", kb_001_36109006.Text, 1, muhharun)
            If harun36109006.JumlanBaris > 0 Then
                MsgBox("Adami kode barang seperti itu")
                Exit Sub
            End If
        End If

        cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb_001_36109006.Text & "', namabarang = '" & nb_001_36109006.Text & "', hargajual = " & Val(hj_001_36109006.Text) & ", jumlahbarang = " & Val(jb_001_36109006.Text) & " where kodebarang = '" & kb1_001_36109006.Text & "'", muhharun)

        muhharun.Open()
        cm.ExecuteNonQuery()
        muhharun.Close()
        cm.Dispose()

        kb1_001_36109006.Text = ""
        kb_001_36109006.Text = ""
        nb_001_36109006.Text = ""
        hj_001_36109006.Text = ""
        jb_001_36109006.Text = ""

        Form30A_36109006.harun36109006()
    End Sub

End Class

Kamis, 24 November 2011

Script Visual Basic Apkomp 4 PNUP - FORM29--

Public Class Form29_36109006
    Dim HARUN_36109006 As New OleDb.OleDbCommand
    Dim HARUN As New ByIskandar.CariKeDataBaseByIskandar
    Dim MUHHARUN As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
    Private Sub SIMPAN_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN_36109006.Click
        If KODEBARANG2_36109006.Text.Length = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        If NAMABARANG_36109006.Text.Length = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        If Val(HARGAJUAL_36109006.Text) = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        If Val(JUMLAHBARANG_36109006.Text) = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        If KODEBARANG1_36109006.Text <> KODEBARANG2_36109006.Text Then

            HARUN.AturPencarianDataBase("Barang", "KodeBarang", KODEBARANG2_36109006.Text, 1, MUHHARUN)
            If HARUN.JumlanBaris > 0 Then
                MsgBox("Kode Barang Sudah Ada")
                Exit Sub
            End If
        End If

        HARUN_36109006 = New OleDb.OleDbCommand("update barang set kodebarang = '" & KODEBARANG2_36109006.Text & "', namabarang = '" & NAMABARANG_36109006.Text & "', hargajual = " & Val(HARGAJUAL_36109006.Text) & ", jumlahbarang = " & Val(JUMLAHBARANG_36109006.Text) & " where kodebarang = '" & KODEBARANG1_36109006.Text & "'", MUHHARUN)
        MUHHARUN.Open()
        HARUN_36109006.ExecuteNonQuery()
        MUHHARUN.Close()
        HARUN_36109006.Dispose()

        KODEBARANG1_36109006.Text = ""
        KODEBARANG2_36109006.Text = ""
        NAMABARANG_36109006.Text = ""
        HARGAJUAL_36109006.Text = ""
        JUMLAHBARANG_36109006.Text = ""
    End Sub

End Class

Selasa, 22 November 2011

Script Visual Basic Apkomp 4 PNUP - FORM28A dan FORM28B--

Public Class Form28A_36109006
    Dim DT_36109006 As New DataTable
    Dim HARUN As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
    Public Sub MHH()
        Dim IM As New OleDb.OleDbDataAdapter
        IM = New OleDb.OleDbDataAdapter("select * from barang", HARUN)
        DT_36109006.Rows.Clear()
        IM.Fill(DT_36109006)
        IM.Dispose()
    End Sub
    Private Sub Form28A_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MHH()
        DGV1_36109006.DataSource = DT_36109006
    End Sub
    Private Sub INPUT_36109006_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUT_36109006.Click
        If Form28B_36109006.Visible = False Then
            Form28B_36109006.Show()
        Else
            Form28B_36109006.Activate()
        End If
    End Sub
    Private Sub TUTUP_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TUTUP_36109006.Click
        Close()
    End Sub

End Class


Public Class Form28B_36109006
    Dim MHH As New ByIskandar.CariKeDataBaseByIskandar
    Dim KendaraanSimpan As New OleDb.OleDbCommand
    Dim Jalan As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\DataBarang.ACCDB")
    Private Sub SIMPAN_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN_36109006.Click
        If KODEBARANG_36109006.Text.Length = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        If NAMABARANG_36109006.Text.Length = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        If Val(HARGAJUAL_36109006.Text) = 0 Then
            MsgBox("Masukkan Teks")
            Exit Sub
        End If

        If Val(JUMLAHBARANG_36109006.Text) = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
        PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", KODEBARANG_36109006.Text, 1, Jalan)

        If PENCARI.JumlanBaris > 0 Then
            MsgBox("Data sudah dimasukkan")

            KODEBARANG_36109006.Text = " "
            NAMABARANG_36109006.Text = " "
            HARGAJUAL_36109006.Text = " "
            JUMLAHBARANG_36109006.Text = " "
            Exit Sub
        End If


        Dim Cm As New OleDb.OleDbCommand
        Cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KODEBARANG_36109006.Text & "','" & NAMABARANG_36109006.Text & "', " & Val(HARGAJUAL_36109006.Text) & "," & Val(JUMLAHBARANG_36109006.Text) & ")", Jalan)
        Jalan.Open()
        Cm.ExecuteNonQuery()
        Jalan.Close()
        Cm.Dispose()


        KODEBARANG_36109006.Text = " "
        NAMABARANG_36109006.Text = " "
        HARGAJUAL_36109006.Text = " "
        JUMLAHBARANG_36109006.Text = " "

    End Sub

End Class

Script Visual Basic Apkomp 4 PNUP - FORM27-

Public Class Form27_36109006
    Dim harun As New ByIskandar.CariKeDataBaseByIskandar
    Dim hrn As New OleDb.OleDbCommand
    Dim muhharun As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub simpan36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109006.Click
        If kb_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If nb_36109006.Text.Length = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(hj_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        If Val(jb_36109006.Text) = 0 Then
            MsgBox("Isi yang kosong")
            Exit Sub
        End If

        harun.AturPencarianDataBase("Barang", "KodeBarang", kb_36109006.Text, 1, muhharun)
        If harun.JumlanBaris > 0 Then
            MsgBox("kode barang sudah ada")
            Exit Sub
        End If

        hrn = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109006.Text & "','" & nb_36109006.Text & "'," & Val(hj_36109006.Text) & "," & Val(jb_36109006.Text) & ")", muhharun)
        muhharun.Open()
        hrn.ExecuteNonQuery()
        muhharun.Close()
        hrn.Dispose()

        kb_36109006.Text = ""
        nb_36109006.Text = ""
        hj_36109006.Text = ""
        jb_36109006.Text = ""
    End Sub

    Private Sub Form27_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub


End Class

Jumat, 11 November 2011

Script Visual Basic Aplikasi Komputer 4, Semester 5 (latihan 23a-26b)

Public Class Latihan23A_36109006
    Dim HARUN36109006 As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim HRN36109006 As New DataTable
    Private Sub Latihan23A_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select* from mastertransaksi", HARUN36109006)
        HRN36109006.Rows.Clear()
        adapter.Fill(HRN36109006)
        adapter.Dispose()

        DGV_36109006.DataSource = HRN36109006


    End Sub
    Private Sub Klik006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Klik006.Click
        If Latihan23B_36109006.Visible = False Then
            Latihan23B_36109006.Show()
        Else : Latihan23B_36109006.Activate()
        End If

        Latihan23B_36109006.N_36109006.Text = DGV_36109006.CurrentRow.Cells("NoTrans").Value
        Latihan23B_36109006.DT_36109006.Value = DGV_36109006.CurrentRow.Cells("TanggalTransaksi").Value
        Latihan23B_36109006.J_36109006.Text = DGV_36109006.CurrentRow.Cells("JenisTransaksi").Value

        Latihan23B_36109006.muhammadharun(Latihan23B_36109006.N_36109006.Text)

    End Sub
End Class


Public Class Latihan23B_36109006
    Dim HARUN36109006 As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim HRN36109006 As New DataTable
    Public Sub muhammadharun(ByVal A As String)
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select*from detailtransaksi where notrans='" & A & "'", HARUN36109006)
        HRN36109006.Rows.Clear()
        adapter.Fill(HRN36109006)

        DGV1_36109006.DataSource = HRN36109006


    End Sub
End Class


Public Class Form24A_36109006
    Dim HARUN As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim HRN As New DataTable
    Private Sub Form24A_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select*from Barang", HARUN)
        HRN.Rows.Clear()
        adapter.Fill(HRN)
        adapter.Dispose()

        DGVA_36109006.DataSource = HRN

    End Sub
    Private Sub Klik006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Klik006.Click
        If Form24B_36109006.Visible = False Then
            Form24B_36109006.Show()
        Else : Form24B_36109006.Activate()
        End If

        Form24B_36109006.KODEBARANG006.Text = DGVA_36109006.CurrentRow.Cells("KodeBarang").Value
        Form24B_36109006.NAMABARANG006.Text = DGVA_36109006.CurrentRow.Cells("NamaBarang").Value
        Form24B_36109006.HARGAJUAL006.Text = DGVA_36109006.CurrentRow.Cells("PersediaanAwal").Value
        Form24B_36109006.JUMLAHBARANG006.Text = DGVA_36109006.CurrentRow.Cells("HargaJual").Value

        Form24B_36109006.uly(Form24B_36109006.KODEBARANG006.Text)


    End Sub
End Class




Public Class Form24B_36109006
    Dim HARUN As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim HRN As New DataTable
    Public Sub uly(ByVal A As String)
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select*from detailtransaksi where KodeBarang='" & A & "'", HARUN)
        HRN.Rows.Clear()
        adapter.Fill(HRN)

        DGVB_36109006.DataSource = HRN

    End Sub
End Class

Public Class Form25A_36109006
    Dim HARUN As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim HRN As New DataTable
    Private Sub Form25A_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select*from Barang", HARUN)
        HRN.Rows.Clear()
        adapter.Fill(HRN)
        adapter.Dispose()

        DGVA_36109006.DataSource = HRN

    End Sub
    Private Sub Klik006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Klik006.Click
        If Form25B_36109006.Visible = False Then
            Form25B_36109006.Show()
        Else : Form25B_36109006.Activate()
        End If

        Form25B_36109006.KODEBARANG1_36109006.Text = DGVA_36109006.CurrentRow.Cells("KodeBarang").Value
        Form25B_36109006.NAMABARANG1_36109006.Text = DGVA_36109006.CurrentRow.Cells("NamaBarang").Value
        Form25B_36109006.HARGAJUAL1_36109006.Text = DGVA_36109006.CurrentRow.Cells("PersediaanAwal").Value
        Form25B_36109006.JUMLAHBARANG1_36109006.Text = DGVA_36109006.CurrentRow.Cells("HargaJual").Value


        Form25B_36109006.HRUN(Form25B_36109006.KODEBARANG1_36109006.Text)


    End Sub
End Class

Public Class Form25B_36109006
    Dim HARUN As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim HRN As New DataTable
    Public Sub HRUN(ByVal A As String)
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select MASTERTRANSAKSI.NOTRANS, MASTERTRANSAKSI.TANGGALTRANSAKSI, MASTERTRANSAKSI.JENISTRANSAKSI, MASTERTRANSAKSI.KETERANGAN, DETAILTRANSAKSI.UHRN, DETAILTRANSAKSI.HARGA, [DETAILTRANSAKSI]![UHRN]*[DETAILTRANSAKSI]![HARGA] AS Jumlah FROM MASTERTRANSAKSI INNER JOIN DETAILTRANSAKSI ON MASTERTRANSAKSI.NOTRANS = DETAILTRANSAKSI.NOTRANS WHERE KODEBARANG = '" & A & "'", HARUN)
        HRN.Rows.Clear()
        adapter.Fill(HRN)
        adapter.Dispose()

        DGVB_36109006.DataSource = HRN

    End Sub

  
End Class


Public Class Form26A_36109006
    Dim HARUN As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim HRUN As New DataTable
    Private Sub Form26A_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select*from Barang", HARUN)
        HRUN.Rows.Clear()
        adapter.Fill(HRUN)
        adapter.Dispose()

        DGVA_36109006.DataSource = HRUN

    End Sub

    Private Sub Klik006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Klik006.Click
        If Form26B_36109006.Visible = False Then
            Form26B_36109006.Show()
        Else : Form26B_36109006.Activate()
        End If

        Form26B_36109006.KODEBARANG1_36109006.Text = DGVA_36109006.CurrentRow.Cells("KodeBarang").Value
        Form26B_36109006.NAMABARANG1_36109006.Text = DGVA_36109006.CurrentRow.Cells("NamaBarang").Value
        Form26B_36109006.HARGAJUAL1_36109006.Text = DGVA_36109006.CurrentRow.Cells("PersediaanAwal").Value
        Form26B_36109006.JUMLAHBARANG1_36109006.Text = DGVA_36109006.CurrentRow.Cells("HargaJual").Value


        Form26B_36109006.HRN(Form26B_36109006.KODEBARANG1_36109006.Text)


    End Sub

End Class


Public Class Form26B_36109006
    Dim HARUN As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim HRUN As New DataTable
    Public Sub HRN(ByVal A As String)
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select MASTERTRANSAKSI.NOTRANS, MASTERTRANSAKSI.TANGGALTRANSAKSI, MASTERTRANSAKSI.JENISTRANSAKSI, MASTERTRANSAKSI.KETERANGAN, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, [DETAILTRANSAKSI]![UNIT]*[DETAILTRANSAKSI]![HARGA] AS Jumlah FROM MASTERTRANSAKSI INNER JOIN DETAILTRANSAKSI ON MASTERTRANSAKSI.NOTRANS = DETAILTRANSAKSI.NOTRANS WHERE KODEBARANG = '" & A & "'", HARUN)
        HRUN.Rows.Clear()
        adapter.Fill(HRUN)
        adapter.Dispose()

        DGVB_36109006.DataSource = HRUN

        Dim tu As Integer
        Dim total As Integer
        For Each baris As DataRow In HRUN.Rows
            tu = tu + baris("UNIT")
            total = total + baris("JUMLAH")
        Next
        TOTALUNIT_36109006.Text = tu
        TOTALJUMLAH_36109006.Text = total

    End Sub

 
End Class

Script Visual Basic Aplikasi Komputer 4 Semester 5 (latihan 15-22)


Public NotInheritable Class form15_36109006
    Dim harun As New DataTable
    Dim harun006 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")

    Private Sub form15_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Hhrndles MyBase.Load
        Dim hrun006 As New OleDb.OleDbDataAdapter
        hrun006 = New OleDb.OleDbDataAdapter("select * from BARHRNG", harun006)
        hrun006.Fill(harun)
        hrun006.Dispose()
        DGV_36109006.DataSource = harun
    End Sub
End Class


Public NotInheritable Class form16_36109006
    Dim harun As New DataTable
    Dim harun006 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")
    Private Sub form16_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Hhrndles MyBase.Load
        Dim hrun006 As New OleDb.OleDbDataAdapter
        hrun006 = New OleDb.OleDbDataAdapter("select * from MASTERTRHRNSAKSI", harun006)
        hrun006.Fill(harun)
        hrun006.Dispose()
        DGV_36109006.DataSource = harun
    End Sub
End Class


Public NotInheritable Class form17_36109006
    Dim harun As New DataTable
    Dim harun006 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")

    Private Sub form17_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Hhrndles MyBase.Load
        Dim hrun006 As New OleDb.OleDbDataAdapter
        hrun006 = New OleDb.OleDbDataAdapter("select * from DETAILTRHRNSAKSI", harun006)
        hrun006.Fill(harun)
        hrun006.Dispose()
        DGV_36109006.DataSource = harun
    End Sub
End Class


Public NotInheritable Class form18_36109006
    Dim harun As New DataTable
    Dim harun006 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")
    Private Sub form18_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Hhrndles MyBase.Load
        Dim hrun006 As New OleDb.OleDbDataAdapter
        hrun006 = New OleDb.OleDbDataAdapter("select  * from Query1", harun006)
        hrun006.Fill(harun)
        hrun006.Dispose()
        DGV_36109006.DataSource = harun
    End Sub
End Class


Public NotInheritable Class form19_36109006
    Dim harun As New DataTable
    Dim harun006 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")

    Private Sub form19_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Hhrndles MyBase.Load
        Dim hrun006 As New OleDb.OleDbDataAdapter
        hrun006 = New OleDb.OleDbDataAdapter("select  * from Query2", harun006)
        hrun006.Fill(harun)
        hrun006.Dispose()
        DGV_36109006.DataSource = harun
    End Sub
End Class

Public NotInheritable Class form20_36109006
    Dim harun As New DataTable
    Dim harun006 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")
    Private Sub form20_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Hhrndles MyBase.Load
        Dim hrun006 As New OleDb.OleDbDataAdapter
        hrun006 = New OleDb.OleDbDataAdapter("select  * from Query3", harun006)
        hrun006.Fill(harun)
        hrun006.Dispose()
        DGV_36109006.DataSource = harun
    End Sub
End Class

Public NotInheritable Class form21_36109006
    Dim harun As New DataSet
    Dim harun1 As New DataTable
    Dim harun2 As New DataTable
    Dim harun0061 As New BindingSource
    Dim harun0062 As New BindingSource
    Dim harun00611 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")
    Dim harun00612 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")
    Private Sub form21_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Hhrndles MyBase.Load
        Dim hrun0061 As New OleDb.OleDbDataAdapter
        hrun0061 = New OleDb.OleDbDataAdapter("select  * from MASTERTRHRNSAKSI", harun00611)
        hrun0061.Fill(harun1)
        hrun0061.Dispose()
        dgv1_36109006.DataSource = harun1
        Dim hrun0062 As New OleDb.OleDbDataAdapter
        hrun0062 = New OleDb.OleDbDataAdapter("select  * from DETAILTRHRNSAKSI", harun00612)
        hrun0062.Fill(harun2)
        hrun0062.Dispose()
        dgv2_36109006.DataSource = harun2
        harun.Tables.Add(harun1)
        harun.Tables.Add(harun2)
        harun1.TableName = "hrn1"
        harun2.TableName = "hrn2"
        harun.Relations.Add(New DataRelation("hrnt1", harun.Tables("hrn1").Columns("NOTRHRNS"), harun.Tables("hrn2").Columns("NOTRHRNS")))
        harun0061.DataSource = harun
        harun0061.DataMember = "hrn1"
        harun0062.DataSource = harun0061
        harun0062.DataMember = "hrnt1"
        dgv1_36109006.DataSource = harun0061
        dgv2_36109006.DataSource = harun0062
    End Sub
End Class

Public NotInheritable Class form22_36109006
    Dim harun As New DataSet
    Dim harun1 As New DataTable
    Dim harun2 As New DataTable
    Dim harun0061 As New BindingSource
    Dim harun0062 As New BindingSource
    Dim harun00611 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")
    Dim harun00612 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTrhrnsaksiJualBeli.accdb'")
    Private Sub form22_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Hhrndles MyBase.Load
        Dim hrun0061 As New OleDb.OleDbDataAdapter
        hrun0061 = New OleDb.OleDbDataAdapter("select  * from MASTERTRHRNSAKSI", harun00611)
        hrun0061.Fill(harun1)
        hrun0061.Dispose()
        dgv1_36109006.DataSource = harun1
        Dim hrun0062 As New OleDb.OleDbDataAdapter
        hrun0062 = New OleDb.OleDbDataAdapter("select  * from Query4", harun00612)
        hrun0062.Fill(harun2)
        hrun0062.Dispose()
        dgv2_36109006.DataSource = harun2
        harun.Tables.Add(harun1)
        harun.Tables.Add(harun2)
        harun1.TableName = "hrn1"
        harun2.TableName = "hrn2"
        harun.Relations.Add(New DataRelation("hrnt1", harun.Tables("hrn1").Columns("NOTRHRNS"), harun.Tables("hrn2").Columns("NOTRHRNS")))
        harun0061.DataSource = harun
        harun0061.DataMember = "hrn1"
        harun0062.DataSource = harun0061
        harun0062.DataMember = "hrnt1"
        dgv1_36109006.DataSource = harun0061
        dgv2_36109006.DataSource = harun0062
    End Sub
End Class








Diberdayakan oleh Blogger.

BTricks