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
Diberdayakan oleh Blogger.

BTricks