Pages

Diberdayakan oleh Blogger.

Minggu, 30 Juni 2013

SISTEM INFORMASI PEMESANAN DAN PENJUALAN SUKU CADANG MOBIL PADA UD.STAR DIESEL



SISTEM INFORMASI PEMESANAN DAN PENJUALAN SUKU CADANG MOBIL PADA UD.STAR DIESEL

Desaign form suplier


Desaign database


 Listing program suplier



Imports System.Data.OleDb

Public Class FORM_SUPLIER
    Public DB As OleDbConnection
    Public CMD As OleDbCommand
    Public ADP As OleDbDataAdapter
    Public DR As OleDbDataReader
    Public DS As New DataSet
    Dim SQL As String

    Public Sub OpenDB()
        Dim LOKASI = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =C:\LIER\SUPLIER.mdb"
        DB = New OleDbConnection(LOKASI)
        If DB.State = ConnectionState.Closed Then
            DB.Open()
        End If
    End Sub
    Sub TampilRecordSuplier()
        ADP = New OleDbDataAdapter("SELECT * FROM SUPLIER", DB)
        DS = New DataSet
        ADP.Fill(DS, "SUPLIER")
        DataGridView1.DataSource = DS.Tables("SUPLIER")
    End Sub
    Sub ButtonBaru()
        br.Enabled = True
        smpn.Enabled = False
        edit.Enabled = False
        hps.Enabled = False
        btl.Enabled = False
        klr.Enabled = True
    End Sub
    Sub ButtonEdit()
        br.Enabled = False
        smpn.Enabled = False
        edit.Enabled = True
        hps.Enabled = True
        btl.Enabled = True
        klr.Enabled = False
    End Sub
    Sub ButtonSimpan()
        br.Enabled = False
        smpn.Enabled = True
        edit.Enabled = False
        hps.Enabled = False
        btl.Enabled = True
        klr.Enabled = False
    End Sub
    Sub HapusText()
        KS.Text = ""
        NAMA.Text = ""
        ALAMAT.Text = ""
        NO.Text = ""
        Call ButtonBaru()
    End Sub

    Private Sub FORM_SUPLIER_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call OpenDB()
        Call HapusText()
        Call TampilRecordSuplier()
    End Sub

    Private Sub br_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles br.Click
        Call HapusText()
        KS.Focus()

    End Sub

    Private Sub btl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btl.Click
        Call HapusText()
        KS.Focus()

    End Sub

    Private Sub klr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles klr.Click
        Me.Close()

    End Sub

    Private Sub smpn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles smpn.Click
        SQL = "INSERT INTO SUPLIER(KODE_SUPLIER, NAMA, ALAMAT, NO_TLPN) " & _
                       " values('" & KS.Text & "','" & _
                                     NAMA.Text & "','" & _
                                     ALAMAT.Text & "','" & _
                                     NO.Text & "')"


        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call br_Click(sender, e)
        Call TampilRecordSuplier()
    End Sub

    Private Sub hps_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hps.Click
        SQL = "DELETE FROM SUPLIER Where KODE_SUPLIER='" & KS.Text & "'"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call br_Click(sender, e)
        Call TampilRecordSuplier()
    End Sub

    Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
        SQL = "UPDATE SUPLIER SET NAMA='" & NAMA.Text & "'," & _
                    " ALAMAT='" & ALAMAT.Text & "'," & _
                    " NO_TLPN='" & NO.Text & "' " & _
                    " Where KODE_SUPLIER='" & KS.Text & "'"

        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call br_Click(sender, e)
        Call TampilRecordSuplier()
    End Sub

    Private Sub KS_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles KS.KeyPress
        Dim tombol As Integer = Asc(e.KeyChar)
        Dim xkode As String
        If tombol = 13 Then

            SQL = "select * from SUPLIER Where KODE_SUPLIER='" & KS.Text & "'"
            CMD = New OleDbCommand(SQL, DB)
            DR = CMD.ExecuteReader
            DR.Read()
            If DR.HasRows = True Then
                NAMA.Text = DR.Item(1)
                ALAMAT.Text = DR.Item(2)
                NO.Text = DR.Item(3)
                Call ButtonEdit()
                MsgBox("Data ditemukan !")
            Else
                xkode = KS.Text
                Call HapusText()
                KS.Text = xkode
                Call ButtonSimpan()
            End If
            NAMA.Focus()
        End If
    End Sub
   End Class

Cetak suplier 

 




0 komentar:

Posting Komentar